Merge lp:~indicator-applet-developers/ubuntu/precise/indicator-power/upstream into lp:~ubuntu-desktop/indicator-power/ubuntu

Proposed by Ted Gould
Status: Merged
Merged at revision: 95
Proposed branch: lp:~indicator-applet-developers/ubuntu/precise/indicator-power/upstream
Merge into: lp:~ubuntu-desktop/indicator-power/ubuntu
Diff against target: 354 lines (+115/-37)
5 files modified
ChangeLog (+32/-0)
configure (+10/-10)
configure.ac (+1/-1)
debian/changelog (+8/-0)
src/indicator-power.c (+64/-26)
To merge this branch: bzr merge lp:~indicator-applet-developers/ubuntu/precise/indicator-power/upstream
Reviewer Review Type Date Requested Status
Ken VanDine Approve
Review via email: mp+94323@code.launchpad.net

Description of the change

Woot! Fixes!

To post a comment you must log in.
Revision history for this message
Ken VanDine (ken-vandine) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2012-02-14 22:25:10 +0000
3+++ ChangeLog 2012-02-23 06:38:19 +0000
4@@ -1,5 +1,37 @@
5 # Generated by Makefile. Do not edit.
6
7+2012-02-23 Ted Gould <ted@gould.cx>
8+
9+ 1.91
10+
11+2012-02-22 Ted Gould <ted@gould.cx>
12+
13+ Fix accessible descriptions
14+
15+2012-02-22 Charles Kerr <charles.kerr@canonical.com>
16+
17+ when a new entry is added, ensure that its accessible_string is properly set
18+
19+2012-02-22 Charles Kerr <charles.kerr@canonical.com>
20+
21+ fix trivial indentation error
22+
23+2012-02-22 Charles Kerr <charles.kerr@canonical.com>
24+
25+ fix trivial misspelling
26+
27+2012-02-22 Charles Kerr <charles.kerr@canonical.com>
28+
29+ fix set_accessible_desc() to update the entries' accessible_desc fields and emit the accessible-desc-changed signal
30+
31+2012-02-17 Charles Kerr <charles.kerr@canonical.com>
32+
33+ Listen for the "g-properties-changed" signal instead of the "g-signal" signal from its GDBusProxy to fix bug #933466.
34+
35+2012-02-16 Charles Kerr <charles.kerr@canonical.com>
36+
37+ register for g-properties-changed rather than g-signal
38+
39 2012-02-14 Ted Gould <ted@gould.cx>
40
41 1.90
42
43=== modified file 'configure'
44--- configure 2012-02-14 22:25:10 +0000
45+++ configure 2012-02-23 06:38:19 +0000
46@@ -1,6 +1,6 @@
47 #! /bin/sh
48 # Guess values for system-dependent variables and create Makefiles.
49-# Generated by GNU Autoconf 2.68 for indicator-power 1.90.
50+# Generated by GNU Autoconf 2.68 for indicator-power 1.91.
51 #
52 # Report bugs to <http://bugs.launchpad.net/indicator-power>.
53 #
54@@ -570,8 +570,8 @@
55 # Identity of this package.
56 PACKAGE_NAME='indicator-power'
57 PACKAGE_TARNAME='indicator-power'
58-PACKAGE_VERSION='1.90'
59-PACKAGE_STRING='indicator-power 1.90'
60+PACKAGE_VERSION='1.91'
61+PACKAGE_STRING='indicator-power 1.91'
62 PACKAGE_BUGREPORT='http://bugs.launchpad.net/indicator-power'
63 PACKAGE_URL='http://launchpad.net/indicator-power'
64
65@@ -1384,7 +1384,7 @@
66 # Omit some internal or obsolete options to make the list less imposing.
67 # This message is too long to be a string in the A/UX 3.1 sh.
68 cat <<_ACEOF
69-\`configure' configures indicator-power 1.90 to adapt to many kinds of systems.
70+\`configure' configures indicator-power 1.91 to adapt to many kinds of systems.
71
72 Usage: $0 [OPTION]... [VAR=VALUE]...
73
74@@ -1454,7 +1454,7 @@
75
76 if test -n "$ac_init_help"; then
77 case $ac_init_help in
78- short | recursive ) echo "Configuration of indicator-power 1.90:";;
79+ short | recursive ) echo "Configuration of indicator-power 1.91:";;
80 esac
81 cat <<\_ACEOF
82
83@@ -1586,7 +1586,7 @@
84 test -n "$ac_init_help" && exit $ac_status
85 if $ac_init_version; then
86 cat <<\_ACEOF
87-indicator-power configure 1.90
88+indicator-power configure 1.91
89 generated by GNU Autoconf 2.68
90
91 Copyright (C) 2010 Free Software Foundation, Inc.
92@@ -1864,7 +1864,7 @@
93 This file contains any messages produced by compilers while
94 running configure, to aid debugging if configure makes a mistake.
95
96-It was created by indicator-power $as_me 1.90, which was
97+It was created by indicator-power $as_me 1.91, which was
98 generated by GNU Autoconf 2.68. Invocation command line was
99
100 $ $0 $@
101@@ -2688,7 +2688,7 @@
102
103 # Define the identity of the package.
104 PACKAGE='indicator-power'
105- VERSION='1.90'
106+ VERSION='1.91'
107
108
109 cat >>confdefs.h <<_ACEOF
110@@ -15492,7 +15492,7 @@
111 # report actual input values of CONFIG_FILES etc. instead of their
112 # values after options handling.
113 ac_log="
114-This file was extended by indicator-power $as_me 1.90, which was
115+This file was extended by indicator-power $as_me 1.91, which was
116 generated by GNU Autoconf 2.68. Invocation command line was
117
118 CONFIG_FILES = $CONFIG_FILES
119@@ -15559,7 +15559,7 @@
120 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
121 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
122 ac_cs_version="\\
123-indicator-power config.status 1.90
124+indicator-power config.status 1.91
125 configured by $0, generated by GNU Autoconf 2.68,
126 with options \\"\$ac_cs_config\\"
127
128
129=== modified file 'configure.ac'
130--- configure.ac 2012-02-14 22:26:21 +0000
131+++ configure.ac 2012-02-23 06:38:19 +0000
132@@ -1,5 +1,5 @@
133 AC_INIT([indicator-power],
134- [1.90],
135+ [1.91],
136 [http://bugs.launchpad.net/indicator-power],
137 [indicator-power],
138 [http://launchpad.net/indicator-power])
139
140=== modified file 'debian/changelog'
141--- debian/changelog 2012-02-17 15:46:54 +0000
142+++ debian/changelog 2012-02-23 06:38:19 +0000
143@@ -1,3 +1,11 @@
144+indicator-power (1.91-0ubuntu1~ppa1) precise; urgency=low
145+
146+ * New upstream release.
147+ * Fix for the icon not changing when state changes (LP: #933466)
148+ * Fix accessible descriptions (LP: #891932)
149+
150+ -- Ted Gould <ted@ubuntu.com> Thu, 23 Feb 2012 00:35:31 -0600
151+
152 indicator-power (1.90-0ubuntu2) precise; urgency=low
153
154 * src/indicator-power.c
155
156=== modified file 'src/indicator-power.c'
157--- src/indicator-power.c 2012-02-17 15:46:54 +0000
158+++ src/indicator-power.c 2012-02-23 06:38:19 +0000
159@@ -103,6 +103,8 @@
160 static void update_visibility (IndicatorPower * self);
161 static gboolean should_be_visible (IndicatorPower * self);
162
163+static void on_entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data);
164+
165 static void gsd_appeared_callback (GDBusConnection *connection, const gchar *name, const gchar *name_owner, gpointer user_data);
166
167 G_DEFINE_TYPE (IndicatorPower, indicator_power, INDICATOR_OBJECT_TYPE);
168@@ -144,6 +146,9 @@
169 g_object_set (G_OBJECT(self),
170 INDICATOR_OBJECT_DEFAULT_VISIBILITY, FALSE,
171 NULL);
172+
173+ g_signal_connect (INDICATOR_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED,
174+ G_CALLBACK(on_entry_added), NULL);
175 }
176
177 static void
178@@ -329,7 +334,7 @@
179 gdouble percentage,
180 gchar **short_details,
181 gchar **details,
182- gchar **accesible_name)
183+ gchar **accessible_name)
184 {
185 gchar *short_timestring = NULL;
186 gchar *detailed_timestring = NULL;
187@@ -343,8 +348,8 @@
188 if (state == UP_DEVICE_STATE_CHARGING)
189 {
190 /* TRANSLATORS: %2 is a time string, e.g. "1 hour 5 minutes" */
191- *accesible_name = g_strdup_printf (_("%s (%s to charge (%.0lf%%))"),
192- device_name, detailed_timestring, percentage);
193+ *accessible_name = g_strdup_printf (_("%s (%s to charge (%.0lf%%))"),
194+ device_name, detailed_timestring, percentage);
195 *details = g_strdup_printf (_("%s (%s to charge)"),
196 device_name, short_timestring);
197 *short_details = g_strdup_printf ("(%s)", short_timestring);
198@@ -355,14 +360,14 @@
199
200 if (time > 43200) /* 12 hours */
201 {
202- *accesible_name = g_strdup_printf (_("%s"), device_name);
203+ *accessible_name = g_strdup_printf (_("%s"), device_name);
204 *details = g_strdup_printf (_("%s"), device_name);
205 }
206 else
207 {
208 /* TRANSLATORS: %2 is a time string, e.g. "1 hour 5 minutes" */
209- *accesible_name = g_strdup_printf (_("%s (%s left (%.0lf%%))"),
210- device_name, detailed_timestring, percentage);
211+ *accessible_name = g_strdup_printf (_("%s (%s left (%.0lf%%))"),
212+ device_name, detailed_timestring, percentage);
213 *details = g_strdup_printf (_("%s (%s left)"),
214 device_name, short_timestring);
215 }
216@@ -376,7 +381,7 @@
217 if (state == UP_DEVICE_STATE_FULLY_CHARGED)
218 {
219 *details = g_strdup_printf (_("%s (charged)"), device_name);
220- *accesible_name = g_strdup (*details);
221+ *accessible_name = g_strdup (*details);
222 *short_details = g_strdup ("");
223 }
224 else if (percentage > 0)
225@@ -385,29 +390,62 @@
226 * used when we don't have a time value */
227 *details = g_strdup_printf (_("%s (%.0lf%%)"),
228 device_name, percentage);
229- *accesible_name = g_strdup (*details);
230+ *accessible_name = g_strdup (*details);
231 *short_details = g_strdup_printf (_("(%.0lf%%)"),
232 percentage);
233 }
234 else
235 {
236 *details = g_strdup_printf (_("%s (not present)"), device_name);
237- *accesible_name = g_strdup (*details);
238+ *accessible_name = g_strdup (*details);
239 *short_details = g_strdup (_("(not present)"));
240 }
241 }
242 }
243
244-static void
245-set_accessible_desc (IndicatorPower *self,
246- const gchar *desc)
247-{
248- if (desc == NULL || desc[0] == '\0')
249- return;
250-
251- g_free (self->accessible_desc);
252-
253- self->accessible_desc = g_strdup (desc);
254+/* ensure that the entry is using self's accessible description */
255+static void
256+refresh_entry_accessible_desc (IndicatorPower * self, IndicatorObjectEntry * entry)
257+{
258+ const char * newval = self->accessible_desc;
259+
260+ if (entry->accessible_desc != newval)
261+ {
262+ g_debug ("%s: setting entry %p accessible description to '%s'", G_STRFUNC, entry, newval);
263+ entry->accessible_desc = newval;
264+ g_signal_emit (self, INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, 0, entry);
265+ }
266+}
267+
268+static void
269+on_entry_added (IndicatorObject * io,
270+ IndicatorObjectEntry * entry,
271+ gpointer user_data G_GNUC_UNUSED)
272+{
273+ refresh_entry_accessible_desc (INDICATOR_POWER(io), entry);
274+}
275+
276+static void
277+set_accessible_desc (IndicatorPower *self, const gchar *desc)
278+{
279+ g_debug ("%s: setting accessible description to '%s'", G_STRFUNC, desc);
280+
281+ if (desc && *desc)
282+ {
283+ /* update our copy of the string */
284+ char * oldval = self->accessible_desc;
285+ self->accessible_desc = g_strdup (desc);
286+
287+ /* ensure that the entries are using self's accessible description */
288+ GList * l;
289+ GList * entries = indicator_object_get_entries(INDICATOR_OBJECT(self));
290+ for (l=entries; l!=NULL; l=l->next)
291+ refresh_entry_accessible_desc (self, l->data);
292+
293+ /* cleanup */
294+ g_list_free (entries);
295+ g_free (oldval);
296+ }
297 }
298
299 static const gchar *
300@@ -522,7 +560,7 @@
301 const gchar *device_name;
302 gchar *short_details = NULL;
303 gchar *details = NULL;
304- gchar *accesible_name = NULL;
305+ gchar *accessible_name = NULL;
306
307 if (device == NULL)
308 return;
309@@ -548,7 +586,7 @@
310
311 device_name = device_kind_to_localised_string (kind);
312
313- build_device_time_details (device_name, time, state, percentage, &short_details, &details, &accesible_name);
314+ build_device_time_details (device_name, time, state, percentage, &short_details, &details, &accessible_name);
315
316 /* Create menu item */
317 item = gtk_image_menu_item_new ();
318@@ -568,7 +606,7 @@
319
320 g_free (short_details);
321 g_free (details);
322- g_free (accesible_name);
323+ g_free (accessible_name);
324 g_free (device_icon);
325 g_free (object_path);
326 }
327@@ -746,7 +784,7 @@
328 GIcon *device_gicons;
329 gchar *short_details = NULL;
330 gchar *details = NULL;
331- gchar *accesible_name = NULL;
332+ gchar *accessible_name = NULL;
333 gchar *device_icon = NULL;
334 gchar *object_path = NULL;
335 gdouble percentage;
336@@ -777,15 +815,15 @@
337 device_name = device_kind_to_localised_string (kind);
338
339 /* get the description */
340- build_device_time_details (device_name, time, state, percentage, &short_details, &details, &accesible_name);
341+ build_device_time_details (device_name, time, state, percentage, &short_details, &details, &accessible_name);
342
343 gtk_label_set_label (GTK_LABEL (self->label),
344 short_details);
345- set_accessible_desc (self, accesible_name);
346+ set_accessible_desc (self, accessible_name);
347
348 g_free (short_details);
349 g_free (details);
350- g_free (accesible_name);
351+ g_free (accessible_name);
352 g_free (device_icon);
353 g_free (object_path);
354 }

Subscribers

People subscribed via source and target branches