diff options
author | Ken VanDine <ken.vandine@canonical.com> | 2012-02-23 02:21:00 -0500 |
---|---|---|
committer | Ken VanDine <ken.vandine@canonical.com> | 2012-02-23 02:21:00 -0500 |
commit | 1d09e63abde55fb518a8f5408f44da2fbe28c6ba (patch) | |
tree | c8e62aea3d9c73ce1645996fe4fc169596263a63 | |
parent | c80b2c61c7472651406897e37f40740d85d3a875 (diff) | |
parent | 9539d05451bcca54e455f4d1687f21d1051a6049 (diff) | |
download | ayatana-indicator-power-1d09e63abde55fb518a8f5408f44da2fbe28c6ba.tar.gz ayatana-indicator-power-1d09e63abde55fb518a8f5408f44da2fbe28c6ba.tar.bz2 ayatana-indicator-power-1d09e63abde55fb518a8f5408f44da2fbe28c6ba.zip |
* New upstream release.
* Fix for the icon not changing when state changes (LP: #933466)
* Fix accessible descriptions (LP: #891932)
-rw-r--r-- | ChangeLog | 32 | ||||
-rwxr-xr-x | configure | 20 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | debian/changelog | 8 | ||||
-rw-r--r-- | src/indicator-power.c | 82 |
5 files changed, 111 insertions, 33 deletions
@@ -1,5 +1,37 @@ # Generated by Makefile. Do not edit. +2012-02-23 Ted Gould <ted@gould.cx> + + 1.91 + +2012-02-22 Ted Gould <ted@gould.cx> + + Fix accessible descriptions + +2012-02-22 Charles Kerr <charles.kerr@canonical.com> + + when a new entry is added, ensure that its accessible_string is properly set + +2012-02-22 Charles Kerr <charles.kerr@canonical.com> + + fix trivial indentation error + +2012-02-22 Charles Kerr <charles.kerr@canonical.com> + + fix trivial misspelling + +2012-02-22 Charles Kerr <charles.kerr@canonical.com> + + fix set_accessible_desc() to update the entries' accessible_desc fields and emit the accessible-desc-changed signal + +2012-02-17 Charles Kerr <charles.kerr@canonical.com> + + Listen for the "g-properties-changed" signal instead of the "g-signal" signal from its GDBusProxy to fix bug #933466. + +2012-02-16 Charles Kerr <charles.kerr@canonical.com> + + register for g-properties-changed rather than g-signal + 2012-02-14 Ted Gould <ted@gould.cx> 1.90 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for indicator-power 1.90. +# Generated by GNU Autoconf 2.68 for indicator-power 1.91. # # Report bugs to <http://bugs.launchpad.net/indicator-power>. # @@ -570,8 +570,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='indicator-power' PACKAGE_TARNAME='indicator-power' -PACKAGE_VERSION='1.90' -PACKAGE_STRING='indicator-power 1.90' +PACKAGE_VERSION='1.91' +PACKAGE_STRING='indicator-power 1.91' PACKAGE_BUGREPORT='http://bugs.launchpad.net/indicator-power' PACKAGE_URL='http://launchpad.net/indicator-power' @@ -1384,7 +1384,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures indicator-power 1.90 to adapt to many kinds of systems. +\`configure' configures indicator-power 1.91 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1454,7 +1454,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of indicator-power 1.90:";; + short | recursive ) echo "Configuration of indicator-power 1.91:";; esac cat <<\_ACEOF @@ -1586,7 +1586,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -indicator-power configure 1.90 +indicator-power configure 1.91 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1864,7 +1864,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by indicator-power $as_me 1.90, which was +It was created by indicator-power $as_me 1.91, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2688,7 +2688,7 @@ fi # Define the identity of the package. PACKAGE='indicator-power' - VERSION='1.90' + VERSION='1.91' cat >>confdefs.h <<_ACEOF @@ -15492,7 +15492,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by indicator-power $as_me 1.90, which was +This file was extended by indicator-power $as_me 1.91, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15559,7 +15559,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -indicator-power config.status 1.90 +indicator-power config.status 1.91 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 406a93c..d00a868 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([indicator-power], - [1.90], + [1.91], [http://bugs.launchpad.net/indicator-power], [indicator-power], [http://launchpad.net/indicator-power]) diff --git a/debian/changelog b/debian/changelog index 229f806..c30a8d7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +indicator-power (1.91-0ubuntu1~ppa1) precise; urgency=low + + * New upstream release. + * Fix for the icon not changing when state changes (LP: #933466) + * Fix accessible descriptions (LP: #891932) + + -- Ted Gould <ted@ubuntu.com> Thu, 23 Feb 2012 00:35:31 -0600 + indicator-power (1.90-0ubuntu2) precise; urgency=low * src/indicator-power.c diff --git a/src/indicator-power.c b/src/indicator-power.c index a5092c1..6140c54 100644 --- a/src/indicator-power.c +++ b/src/indicator-power.c @@ -103,6 +103,8 @@ static const gchar* get_name_hint (IndicatorObject * io); static void update_visibility (IndicatorPower * self); static gboolean should_be_visible (IndicatorPower * self); +static void on_entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data); + static void gsd_appeared_callback (GDBusConnection *connection, const gchar *name, const gchar *name_owner, gpointer user_data); G_DEFINE_TYPE (IndicatorPower, indicator_power, INDICATOR_OBJECT_TYPE); @@ -144,6 +146,9 @@ indicator_power_init (IndicatorPower *self) g_object_set (G_OBJECT(self), INDICATOR_OBJECT_DEFAULT_VISIBILITY, FALSE, NULL); + + g_signal_connect (INDICATOR_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED, + G_CALLBACK(on_entry_added), NULL); } static void @@ -329,7 +334,7 @@ build_device_time_details (const gchar *device_name, gdouble percentage, gchar **short_details, gchar **details, - gchar **accesible_name) + gchar **accessible_name) { gchar *short_timestring = NULL; gchar *detailed_timestring = NULL; @@ -343,8 +348,8 @@ build_device_time_details (const gchar *device_name, if (state == UP_DEVICE_STATE_CHARGING) { /* TRANSLATORS: %2 is a time string, e.g. "1 hour 5 minutes" */ - *accesible_name = g_strdup_printf (_("%s (%s to charge (%.0lf%%))"), - device_name, detailed_timestring, percentage); + *accessible_name = g_strdup_printf (_("%s (%s to charge (%.0lf%%))"), + device_name, detailed_timestring, percentage); *details = g_strdup_printf (_("%s (%s to charge)"), device_name, short_timestring); *short_details = g_strdup_printf ("(%s)", short_timestring); @@ -355,14 +360,14 @@ build_device_time_details (const gchar *device_name, if (time > 43200) /* 12 hours */ { - *accesible_name = g_strdup_printf (_("%s"), device_name); + *accessible_name = g_strdup_printf (_("%s"), device_name); *details = g_strdup_printf (_("%s"), device_name); } else { /* TRANSLATORS: %2 is a time string, e.g. "1 hour 5 minutes" */ - *accesible_name = g_strdup_printf (_("%s (%s left (%.0lf%%))"), - device_name, detailed_timestring, percentage); + *accessible_name = g_strdup_printf (_("%s (%s left (%.0lf%%))"), + device_name, detailed_timestring, percentage); *details = g_strdup_printf (_("%s (%s left)"), device_name, short_timestring); } @@ -376,7 +381,7 @@ build_device_time_details (const gchar *device_name, if (state == UP_DEVICE_STATE_FULLY_CHARGED) { *details = g_strdup_printf (_("%s (charged)"), device_name); - *accesible_name = g_strdup (*details); + *accessible_name = g_strdup (*details); *short_details = g_strdup (""); } else if (percentage > 0) @@ -385,29 +390,62 @@ build_device_time_details (const gchar *device_name, * used when we don't have a time value */ *details = g_strdup_printf (_("%s (%.0lf%%)"), device_name, percentage); - *accesible_name = g_strdup (*details); + *accessible_name = g_strdup (*details); *short_details = g_strdup_printf (_("(%.0lf%%)"), percentage); } else { *details = g_strdup_printf (_("%s (not present)"), device_name); - *accesible_name = g_strdup (*details); + *accessible_name = g_strdup (*details); *short_details = g_strdup (_("(not present)")); } } } +/* ensure that the entry is using self's accessible description */ static void -set_accessible_desc (IndicatorPower *self, - const gchar *desc) +refresh_entry_accessible_desc (IndicatorPower * self, IndicatorObjectEntry * entry) { - if (desc == NULL || desc[0] == '\0') - return; + const char * newval = self->accessible_desc; - g_free (self->accessible_desc); + if (entry->accessible_desc != newval) + { + g_debug ("%s: setting entry %p accessible description to '%s'", G_STRFUNC, entry, newval); + entry->accessible_desc = newval; + g_signal_emit (self, INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, 0, entry); + } +} + +static void +on_entry_added (IndicatorObject * io, + IndicatorObjectEntry * entry, + gpointer user_data G_GNUC_UNUSED) +{ + refresh_entry_accessible_desc (INDICATOR_POWER(io), entry); +} + +static void +set_accessible_desc (IndicatorPower *self, const gchar *desc) +{ + g_debug ("%s: setting accessible description to '%s'", G_STRFUNC, desc); - self->accessible_desc = g_strdup (desc); + if (desc && *desc) + { + /* update our copy of the string */ + char * oldval = self->accessible_desc; + self->accessible_desc = g_strdup (desc); + + /* ensure that the entries are using self's accessible description */ + GList * l; + GList * entries = indicator_object_get_entries(INDICATOR_OBJECT(self)); + for (l=entries; l!=NULL; l=l->next) + refresh_entry_accessible_desc (self, l->data); + + /* cleanup */ + g_list_free (entries); + g_free (oldval); + } } static const gchar * @@ -522,7 +560,7 @@ menu_add_device (GtkMenu *menu, const gchar *device_name; gchar *short_details = NULL; gchar *details = NULL; - gchar *accesible_name = NULL; + gchar *accessible_name = NULL; if (device == NULL) return; @@ -548,7 +586,7 @@ menu_add_device (GtkMenu *menu, device_name = device_kind_to_localised_string (kind); - build_device_time_details (device_name, time, state, percentage, &short_details, &details, &accesible_name); + build_device_time_details (device_name, time, state, percentage, &short_details, &details, &accessible_name); /* Create menu item */ item = gtk_image_menu_item_new (); @@ -568,7 +606,7 @@ menu_add_device (GtkMenu *menu, g_free (short_details); g_free (details); - g_free (accesible_name); + g_free (accessible_name); g_free (device_icon); g_free (object_path); } @@ -746,7 +784,7 @@ put_primary_device (IndicatorPower *self, GIcon *device_gicons; gchar *short_details = NULL; gchar *details = NULL; - gchar *accesible_name = NULL; + gchar *accessible_name = NULL; gchar *device_icon = NULL; gchar *object_path = NULL; gdouble percentage; @@ -777,15 +815,15 @@ put_primary_device (IndicatorPower *self, device_name = device_kind_to_localised_string (kind); /* get the description */ - build_device_time_details (device_name, time, state, percentage, &short_details, &details, &accesible_name); + build_device_time_details (device_name, time, state, percentage, &short_details, &details, &accessible_name); gtk_label_set_label (GTK_LABEL (self->label), short_details); - set_accessible_desc (self, accesible_name); + set_accessible_desc (self, accessible_name); g_free (short_details); g_free (details); - g_free (accesible_name); + g_free (accessible_name); g_free (device_icon); g_free (object_path); } |