diff options
author | Ken VanDine <ken.vandine@canonical.com> | 2011-08-12 09:57:46 -0400 |
---|---|---|
committer | Ken VanDine <ken.vandine@canonical.com> | 2011-08-12 09:57:46 -0400 |
commit | edfb2ab89822da16fc1150a5350c130830a733b3 (patch) | |
tree | d27c696bb69588d5be5b82beab7c02f780509239 | |
parent | e70592564797c841e8d843afd29d3053bedc0a00 (diff) | |
parent | 632244509d85412748cc2b024a5d92b43306034d (diff) | |
download | ayatana-indicator-power-edfb2ab89822da16fc1150a5350c130830a733b3.tar.gz ayatana-indicator-power-edfb2ab89822da16fc1150a5350c130830a733b3.tar.bz2 ayatana-indicator-power-edfb2ab89822da16fc1150a5350c130830a733b3.zip |
Import upstream version 0.6
-rw-r--r-- | ChangeLog | 38 | ||||
-rwxr-xr-x | configure | 20 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/indicator-power.c | 82 |
4 files changed, 107 insertions, 35 deletions
@@ -1,5 +1,43 @@ # Generated by Makefile. Do not edit. +2011-08-12 Javier Jardón <javier.jardon@codethink.co.uk> + + Release 0.6 + +2011-08-12 Javier Jardón <javier.jardon@codethink.co.uk> + + Show time left to use without brackets, time left to charge with brackets. + + Fixes bug http://bugs.launchpad.net/indicator-power/+bug/824629 + +2011-08-11 Javier Jardón <javier.jardon@codethink.co.uk> + + Fix some memory leaks + +2011-08-11 Michael Terry <michael.terry@canonical.com> + + Don't show settings links when used in a greeter + +2011-08-03 Michael Terry <michael.terry@canonical.com> + + don't show settings links when used in a greeter + +2011-08-11 Javier Jardón <javier.jardon@codethink.co.uk> + + Use a string when the energy source is not present + + Use "not present" instead "0%" + +2011-08-11 Javier Jardón <javier.jardon@codethink.co.uk> + + Only batteries can be primary devices + + So only batteries status icons are allowed in the menu title + +2011-08-11 Javier Jardón <javier.jardon@codethink.co.uk> + + Fix some memory leaks + 2011-08-03 Javier Jardón <javier.jardon@codethink.co.uk> Release 0.5 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for indicator-power 0.5. +# Generated by GNU Autoconf 2.68 for indicator-power 0.6. # # 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='0.5' -PACKAGE_STRING='indicator-power 0.5' +PACKAGE_VERSION='0.6' +PACKAGE_STRING='indicator-power 0.6' PACKAGE_BUGREPORT='http://bugs.launchpad.net/indicator-power' PACKAGE_URL='http://launchpad.net/indicator-power' @@ -1362,7 +1362,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 0.5 to adapt to many kinds of systems. +\`configure' configures indicator-power 0.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1432,7 +1432,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of indicator-power 0.5:";; + short | recursive ) echo "Configuration of indicator-power 0.6:";; esac cat <<\_ACEOF @@ -1561,7 +1561,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -indicator-power configure 0.5 +indicator-power configure 0.6 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1839,7 +1839,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 0.5, which was +It was created by indicator-power $as_me 0.6, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2663,7 +2663,7 @@ fi # Define the identity of the package. PACKAGE='indicator-power' - VERSION='0.5' + VERSION='0.6' cat >>confdefs.h <<_ACEOF @@ -14867,7 +14867,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 0.5, which was +This file was extended by indicator-power $as_me 0.6, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14934,7 +14934,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 0.5 +indicator-power config.status 0.6 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 0372683..19ca570 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([indicator-power], - [0.5], + [0.6], [http://bugs.launchpad.net/indicator-power], [indicator-power], [http://launchpad.net/indicator-power]) diff --git a/src/indicator-power.c b/src/indicator-power.c index 17c6bd5..9211b54 100644 --- a/src/indicator-power.c +++ b/src/indicator-power.c @@ -279,9 +279,6 @@ build_device_time_details (const gchar *device_name, &short_timestring, &detailed_timestring); - *short_details = g_strdup_printf ("(%s)", - short_timestring); - if (state == UP_DEVICE_STATE_CHARGING) { /* TRANSLATORS: %2 is a time string, e.g. "1 hour 5 minutes" */ @@ -289,9 +286,12 @@ build_device_time_details (const gchar *device_name, 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); } else if (state == UP_DEVICE_STATE_DISCHARGING) { + *short_details = g_strdup_printf ("%s", short_timestring); + if (time > 43200) /* 12 hours */ { *accesible_name = g_strdup_printf (_("%s"), device_name); @@ -306,6 +306,9 @@ build_device_time_details (const gchar *device_name, device_name, short_timestring); } } + + g_free (short_timestring); + g_free (detailed_timestring); } else { @@ -315,7 +318,7 @@ build_device_time_details (const gchar *device_name, *accesible_name = g_strdup (*details); *short_details = g_strdup (_("(charged)")); } - else + else if (percentage > 0) { /* TRANSLATORS: %2 is a percentage value. Note: this string is only * used when we don't have a time value */ @@ -325,6 +328,12 @@ build_device_time_details (const gchar *device_name, *short_details = g_strdup_printf (_("(%.0lf%%)"), percentage); } + else + { + *details = g_strdup_printf (_("%s (not present)"), device_name); + *accesible_name = g_strdup (*details); + *short_details = g_strdup (_("(not present)")); + } } } @@ -394,6 +403,12 @@ menu_add_device (GtkMenu *menu, g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (show_info_cb), NULL); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + + g_free (short_details); + g_free (details); + g_free (accesible_name); + g_free (device_icon); + g_free (object_path); } static gsize @@ -419,6 +434,14 @@ menu_add_devices (GtkMenu *menu, return n_devices; } +static gboolean +get_greeter_mode (void) +{ + const gchar *var; + var = g_getenv("INDICATOR_GREETER_MODE"); + return (g_strcmp0(var, "1") == 0); +} + static void build_menu (IndicatorPower *self) { @@ -433,30 +456,33 @@ build_menu (IndicatorPower *self) children = gtk_container_get_children (GTK_CONTAINER (priv->menu)); g_list_foreach (children, (GFunc) gtk_widget_destroy, NULL); + g_list_free (children); /* devices */ n_devices = menu_add_devices (priv->menu, priv->devices); - /* only do the separator if we have at least one device */ - if (n_devices != 0) - { - item = gtk_separator_menu_item_new (); - gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item); - } - - /* options */ - item = gtk_check_menu_item_new_with_label (_("Show Time in Menu Bar")); - g_signal_connect (G_OBJECT (item), "toggled", - G_CALLBACK (option_toggled_cb), self); - gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item); - - /* preferences */ - item = gtk_image_menu_item_new_with_mnemonic (_("Power Settings ...")); - image = gtk_image_new_from_icon_name (GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); - g_signal_connect (G_OBJECT (item), "activate", - G_CALLBACK (show_preferences_cb), NULL); - gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item); + if (!get_greeter_mode ()) { + /* only do the separator if we have at least one device */ + if (n_devices != 0) + { + item = gtk_separator_menu_item_new (); + gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item); + } + + /* options */ + item = gtk_check_menu_item_new_with_label (_("Show Time in Menu Bar")); + g_signal_connect (G_OBJECT (item), "toggled", + G_CALLBACK (option_toggled_cb), self); + gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item); + + /* preferences */ + item = gtk_image_menu_item_new_with_mnemonic (_("Power Settings ...")); + image = gtk_image_new_from_icon_name (GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); + g_signal_connect (G_OBJECT (item), "activate", + G_CALLBACK (show_preferences_cb), NULL); + gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item); + } /* show the menu */ gtk_widget_show_all (GTK_WIDGET (priv->menu)); @@ -499,6 +525,10 @@ get_primary_device (GVariant *devices) g_debug ("%s: got data from object %s", G_STRFUNC, object_path); + /* not battery */ + if (kind != UP_DEVICE_KIND_BATTERY) + continue; + if (state == UP_DEVICE_STATE_DISCHARGING) { discharging = TRUE; @@ -523,6 +553,9 @@ get_primary_device (GVariant *devices) } } + g_free (device_icon); + g_free (object_path); + if (discharging) { primary_device = primary_device_discharging; @@ -584,6 +617,7 @@ put_primary_device (IndicatorPower *self, g_free (short_details); g_free (details); + g_free (accesible_name); g_free (device_icon); g_free (object_path); } |