Merge lp:~laney/unity-settings-daemon/lp1394063 into lp:unity-settings-daemon

Proposed by Iain Lane on 2014-11-27
Status: Merged
Approved by: Iain Lane on 2014-11-27
Approved revision: 4060
Merged at revision: 4060
Proposed branch: lp:~laney/unity-settings-daemon/lp1394063
Merge into: lp:unity-settings-daemon
Diff against target: 177 lines (+39/-25)
4 files modified
debian/changelog (+6/-0)
debian/control (+1/-1)
plugins/power/gsd-power-manager.c (+29/-21)
plugins/xrandr/gsd-xrandr-manager.c (+3/-3)
To merge this branch: bzr merge lp:~laney/unity-settings-daemon/lp1394063
Reviewer Review Type Date Requested Status
Iain Lane Approve on 2014-11-27
Review via email: mp+243021@code.launchpad.net

Commit message

Add patch from Tim Lunn to support upower 0.99 properly. (LP: #1394063)

Description of the change

This is basically https://code.launchpad.net/~noskcaj/unity-settings-daemon/upower de-conflicted, so I'm self approving.

To post a comment you must log in.
Iain Lane (laney) :
review: Approve
4061. By Iain Lane on 2014-11-27

Bump upstream version due to mistaken "15.10"

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-10-30 16:30:04 +0000
3+++ debian/changelog 2014-11-27 11:31:46 +0000
4@@ -1,3 +1,9 @@
5+unity-settings-daemon (15.04.1+15.04.20141030-0ubuntu2) UNRELEASED; urgency=medium
6+
7+ * Add patch from Tim Lunn to support upower 0.99 properly. (LP: #1394063)
8+
9+ -- Iain Lane <iain@orangesquash.org.uk> Thu, 27 Nov 2014 09:54:24 +0000
10+
11 unity-settings-daemon (15.04.0+15.10.20141030-0ubuntu1) vivid; urgency=medium
12
13 [ Tim Lunn ]
14
15=== modified file 'debian/control'
16--- debian/control 2014-10-30 16:29:52 +0000
17+++ debian/control 2014-11-27 11:31:46 +0000
18@@ -30,7 +30,7 @@
19 libaccountsservice-dev (>= 0.6.34),
20 libappindicator3-dev (>= 0.4.90),
21 hwdata,
22- libupower-glib-dev (>= 0.9.11),
23+ libupower-glib-dev (>= 0.99.1),
24 libcolord-dev (>= 0.1.12),
25 liblcms2-dev,
26 libnss3-dev,
27
28=== modified file 'plugins/power/gsd-power-manager.c'
29--- plugins/power/gsd-power-manager.c 2014-10-30 16:20:47 +0000
30+++ plugins/power/gsd-power-manager.c 2014-11-27 11:31:46 +0000
31@@ -242,6 +242,7 @@
32 static void inhibit_lid_switch (GsdPowerManager *manager);
33 static void uninhibit_lid_switch (GsdPowerManager *manager);
34 static void main_battery_or_ups_low_changed (GsdPowerManager *manager, gboolean is_low);
35+static void device_properties_changed_cb (UpDevice *device, GParamSpec *pspec, GsdPowerManager *manager);
36 static gboolean idle_is_session_inhibited (GsdPowerManager *manager, guint mask, gboolean *is_inhibited);
37 static void idle_set_mode (GsdPowerManager *manager, GsdPowerIdleMode mode);
38 static void idle_triggered_idle_cb (GsdIdleMonitor *monitor, guint watch_id, gpointer user_data);
39@@ -1036,6 +1037,13 @@
40 GUINT_TO_POINTER(state));
41 }
42
43+ g_ptr_array_add (manager->priv->devices_array, g_object_ref(device));
44+
45+ g_signal_connect (device, "notify::state",
46+ G_CALLBACK (device_properties_changed_cb), manager);
47+ g_signal_connect (device, "notify::warning-level",
48+ G_CALLBACK (device_properties_changed_cb), manager);
49+
50 /* the device is recalled */
51 if (recall_notice)
52 device_perhaps_recall (manager, device);
53@@ -1083,14 +1091,6 @@
54 gboolean ret;
55 GError *error = NULL;
56
57- /* get devices from UPower */
58- ret = up_client_enumerate_devices_sync (manager->priv->up_client, NULL, &error);
59- if (!ret) {
60- g_warning ("failed to get device list: %s", error->message);
61- g_error_free (error);
62- goto out;
63- }
64-
65 engine_recalculate_state (manager);
66
67 /* add to database */
68@@ -1121,13 +1121,18 @@
69 }
70
71 static void
72-engine_device_removed_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager)
73+engine_device_removed_cb (UpClient *client, const char *object_path, GsdPowerManager *manager)
74 {
75- gboolean ret;
76- ret = g_ptr_array_remove (manager->priv->devices_array, device);
77- if (!ret)
78- return;
79- engine_recalculate_state (manager);
80+ guint i;
81+
82+ for (i = 0; i < manager->priv->devices_array->len; i++) {
83+ UpDevice *device = g_ptr_array_index (manager->priv->devices_array, i);
84+
85+ if (g_strcmp0 (object_path, up_device_get_object_path (device)) == 0) {
86+ g_ptr_array_remove_index (manager->priv->devices_array, i);
87+ break;
88+ }
89+ }
90 }
91
92 static void
93@@ -1246,13 +1251,15 @@
94 GVariant *result = NULL;
95
96 policy = g_settings_get_enum (manager->priv->settings, "critical-battery-action");
97+
98 if (policy == GSD_POWER_ACTION_SUSPEND) {
99- if (is_ups == FALSE)
100+ if (is_ups == FALSE) {
101 result = g_dbus_proxy_call_sync (manager->priv->logind_proxy,
102 "CanSuspend",
103 NULL,
104 G_DBUS_CALL_FLAGS_NONE,
105 -1, NULL, NULL);
106+ }
107 } else if (policy == GSD_POWER_ACTION_HIBERNATE) {
108 result = g_dbus_proxy_call_sync (manager->priv->logind_proxy,
109 "CanHibernate",
110@@ -1266,9 +1273,12 @@
111
112 if (result) {
113 const char *s;
114+
115 g_variant_get (result, "(s)", &s);
116 if (g_strcmp0 (s, "yes") != 0)
117 policy = GSD_POWER_ACTION_SHUTDOWN;
118+
119+ g_variant_unref (result);
120 } else {
121 policy = GSD_POWER_ACTION_SHUTDOWN;
122 }
123@@ -1780,7 +1790,7 @@
124 }
125
126 static void
127-engine_device_changed_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager)
128+device_properties_changed_cb (UpDevice *device, GParamSpec *pspec, GsdPowerManager *manager)
129 {
130 UpDeviceKind kind;
131 UpDeviceState state;
132@@ -2306,7 +2316,7 @@
133 }
134
135 static void
136-up_client_changed_cb (UpClient *client, GsdPowerManager *manager)
137+lid_state_changed_cb (UpClient *client, GParamSpec *pspec, GsdPowerManager *manager)
138 {
139 gboolean tmp;
140
141@@ -3494,10 +3504,8 @@
142 G_CALLBACK (engine_device_added_cb), manager);
143 g_signal_connect (manager->priv->up_client, "device-removed",
144 G_CALLBACK (engine_device_removed_cb), manager);
145- g_signal_connect (manager->priv->up_client, "device-changed",
146- G_CALLBACK (engine_device_changed_cb), manager);
147- g_signal_connect_after (manager->priv->up_client, "changed",
148- G_CALLBACK (up_client_changed_cb), manager);
149+ g_signal_connect_after (manager->priv->up_client, "notify::lid-is-closed",
150+ G_CALLBACK (lid_state_changed_cb), manager);
151 g_signal_connect (manager->priv->up_client, "notify::on-battery",
152 G_CALLBACK (up_client_on_battery_cb), manager);
153
154
155=== modified file 'plugins/xrandr/gsd-xrandr-manager.c'
156--- plugins/xrandr/gsd-xrandr-manager.c 2014-06-26 00:02:19 +0000
157+++ plugins/xrandr/gsd-xrandr-manager.c 2014-11-27 11:31:46 +0000
158@@ -2015,7 +2015,7 @@
159 }
160
161 static void
162-power_client_changed_cb (UpClient *client, gpointer data)
163+lid_state_changed_cb (UpClient *client, GParamSpec *pspec, gpointer data)
164 {
165 GsdXrandrManager *manager = data;
166 GsdXrandrManagerPrivate *priv = manager->priv;
167@@ -2267,8 +2267,8 @@
168
169 manager->priv->upower_client = up_client_new ();
170 manager->priv->laptop_lid_is_closed = up_client_get_lid_is_closed (manager->priv->upower_client);
171- g_signal_connect (manager->priv->upower_client, "changed",
172- G_CALLBACK (power_client_changed_cb), manager);
173+ g_signal_connect (manager->priv->upower_client, "notify::lid-is-closed",
174+ G_CALLBACK (lid_state_changed_cb), manager);
175
176 log_msg ("State of screen at startup:\n");
177 log_screen (manager->priv->rw_screen);

Subscribers

People subscribed via source and target branches