From 9c1a5e97500a45d62ee0d8bc19b2c77e8234387d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Fri, 12 Aug 2011 12:03:14 +0100 Subject: Show time left to use without brackets, time left to charge with brackets. Fixes bug http://bugs.launchpad.net/indicator-power/+bug/824629 --- src/indicator-power.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/indicator-power.c b/src/indicator-power.c index dbc1d6a..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); -- cgit v1.2.3 From d5c1b2ce0defea98142f5f549cef88a389614e42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Fri, 12 Aug 2011 12:05:04 +0100 Subject: Release 0.6 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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]) -- cgit v1.2.3 From d88054a3a754778ea8221fe9187eea2bab21ac7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Fri, 12 Aug 2011 20:33:12 +0100 Subject: Free memory in the correct place --- src/indicator-power.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/indicator-power.c b/src/indicator-power.c index 9211b54..62cdb44 100644 --- a/src/indicator-power.c +++ b/src/indicator-power.c @@ -551,10 +551,10 @@ get_primary_device (GVariant *devices) { primary_device = device; } - } - g_free (device_icon); - g_free (object_path); + g_free (device_icon); + g_free (object_path); + } if (discharging) { -- cgit v1.2.3 From 37d7b33ae2e034486f762fbf9144699edc4f5c15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Fri, 12 Aug 2011 21:03:44 +0100 Subject: Do not show the default icon by default Show the icon can cause problems in machines with no power devices as the icon will not be updated --- src/indicator-power.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/indicator-power.c b/src/indicator-power.c index 62cdb44..5fada6b 100644 --- a/src/indicator-power.c +++ b/src/indicator-power.c @@ -793,7 +793,6 @@ get_image (IndicatorObject *io) gicon = g_themed_icon_new (DEFAULT_ICON); priv->status_image = GTK_IMAGE (gtk_image_new_from_gicon (gicon, GTK_ICON_SIZE_LARGE_TOOLBAR)); - gtk_widget_show (GTK_WIDGET (priv->status_image)); } return priv->status_image; -- cgit v1.2.3 From bd9dc3e996ff885ab13c81d25d317d5121057366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Mon, 22 Aug 2011 12:27:56 +0100 Subject: Do not use a space before an ellipsis at the end of a string. --- src/indicator-power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/indicator-power.c b/src/indicator-power.c index 5fada6b..1ddcea0 100644 --- a/src/indicator-power.c +++ b/src/indicator-power.c @@ -476,7 +476,7 @@ build_menu (IndicatorPower *self) gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item); /* preferences */ - item = gtk_image_menu_item_new_with_mnemonic (_("Power Settings ...")); + 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", -- cgit v1.2.3 From 94b05b3ac5e37146e6e049df4daf011e0b5689ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Mon, 22 Aug 2011 15:40:07 +0100 Subject: Follow standard alignment of icons in menus Fixes https://bugs.launchpad.net/ubuntu/+source/indicator-power/+bug/829697 --- src/indicator-power.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/indicator-power.c b/src/indicator-power.c index 1ddcea0..24b2b72 100644 --- a/src/indicator-power.c +++ b/src/indicator-power.c @@ -359,6 +359,8 @@ menu_add_device (GtkMenu *menu, UpDeviceState state; GtkWidget *icon; GtkWidget *item; + GtkWidget *details_label; + GtkWidget *grid; GIcon *device_gicons; gchar *device_icon = NULL; gchar *object_path = NULL; @@ -397,12 +399,19 @@ menu_add_device (GtkMenu *menu, /* Create menu item */ item = gtk_image_menu_item_new (); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), icon); - gtk_menu_item_set_label (GTK_MENU_ITEM (item), details); - gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE); + + grid = gtk_grid_new (); + gtk_grid_set_row_spacing (GTK_GRID (grid), 6); + gtk_grid_attach (GTK_GRID (grid), icon, 0, 0, 1, 1); + details_label = gtk_label_new (details); + gtk_grid_attach_next_to (GTK_GRID (grid), details_label, icon, GTK_POS_RIGHT, 1, 1); + gtk_container_add (GTK_CONTAINER (item), grid); + gtk_widget_show (grid); + + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + 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); -- cgit v1.2.3 From 84735ec5056e864684245f90a0116ce09cc42b8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Mon, 22 Aug 2011 20:38:36 +0100 Subject: Use gsettings to store the status of "Show time in Menu Bar" option Fixes https://bugs.launchpad.net/indicator-power/+bug/829853 --- Makefile.am | 14 +++++++++++++- configure.ac | 8 +++++++- data/org.ubuntu.indicator-power.gschema.xml.in | 9 +++++++++ src/indicator-power.c | 16 +++++++++++++++- 4 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 data/org.ubuntu.indicator-power.gschema.xml.in diff --git a/Makefile.am b/Makefile.am index 932775f..70af9f5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,6 +2,13 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} SUBDIRS = po +gsettingsschema_in_files = data/org.ubuntu.indicator-power.gschema.xml.in +gsettings_SCHEMAS = $(gsettingsschema_in_files:.xml.in=.xml) + +@INTLTOOL_XML_NOMERGE_RULE@ + +@GSETTINGS_RULES@ + ################### # Indicator Stuff ################### @@ -24,7 +31,12 @@ libpower_la_LDFLAGS = \ ############################################################ -EXTRA_DIST = autogen.sh +EXTRA_DIST = \ + $(gsettingsschema_in_files) \ + autogen.sh + +CLEANFILES = \ + $(gsettings_SCHEMAS) DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall diff --git a/configure.ac b/configure.ac index 19ca570..94a94bc 100644 --- a/configure.ac +++ b/configure.ac @@ -28,7 +28,7 @@ LT_INIT ########################### # Dependencies ########################### - +GIO_REQUIRED_VERSION=2.26 GTK_REQUIRED_VERSION=3.0 INDICATOR_REQUIRED_VERSION=0.3.90 UPOWER_REQUIRED_VERSION=0.9.5 @@ -36,11 +36,17 @@ GSD_REQUIRED_VERSION=3.1.4 PKG_CHECK_MODULES([UPOWER],[upower-glib >= UPOWER_REQUIRED_VERSION]) PKG_CHECK_MODULES([INDICATOR],[ + gio-2.0 >= $GIO_REQUIRED_VERSION gtk+-3.0 >= $GTK_REQUIRED_VERSION indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION ]) PKG_CHECK_MODULES([GSD],[gnome-settings-daemon >= $GSD_REQUIRED_VERSION]) +########################### +# GSETTINGS +########################### +GLIB_GSETTINGS + ########################### # Check to see if we're local ########################### diff --git a/data/org.ubuntu.indicator-power.gschema.xml.in b/data/org.ubuntu.indicator-power.gschema.xml.in new file mode 100644 index 0000000..a961794 --- /dev/null +++ b/data/org.ubuntu.indicator-power.gschema.xml.in @@ -0,0 +1,9 @@ + + + + false + <_summary>Show time in Menu Bar + <_description>Whether show the time in the menu bar. + + + diff --git a/src/indicator-power.c b/src/indicator-power.c index 24b2b72..7f9e479 100644 --- a/src/indicator-power.c +++ b/src/indicator-power.c @@ -82,6 +82,8 @@ struct _IndicatorPowerPrivate GVariant *devices; GVariant *device; + + GSettings *settings; }; /* Prototypes */ @@ -138,9 +140,15 @@ option_toggled_cb (GtkCheckMenuItem *item, { IndicatorPower *self = INDICATOR_POWER (user_data); IndicatorPowerPrivate *priv = self->priv; + gboolean visible; + + visible = gtk_check_menu_item_get_active (item); gtk_widget_set_visible (GTK_WIDGET (priv->label), - gtk_check_menu_item_get_active (item)); + visible); + + g_settings_set_boolean (priv->settings, "show-time", + visible); } static void @@ -459,6 +467,7 @@ build_menu (IndicatorPower *self) GtkWidget *image; GList *children; gsize n_devices = 0; + gboolean visible; if (priv->menu == NULL) priv->menu = GTK_MENU (gtk_menu_new ()); @@ -482,6 +491,8 @@ build_menu (IndicatorPower *self) 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); + visible = g_settings_get_boolean (priv->settings, "show-time"); + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), visible); gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item); /* preferences */ @@ -755,6 +766,9 @@ indicator_power_init (IndicatorPower *self) priv->proxy_cancel, service_proxy_cb, self); + + /* GSettings */ + priv->settings = g_settings_new ("org.ubuntu.indicator-power"); } static void -- cgit v1.2.3 From b2aec5eb2109ab804d0c3f279e96d11202ccc9e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Mon, 22 Aug 2011 20:49:31 +0100 Subject: Fix typo in the gsettings schema: show_time -> show-time --- data/org.ubuntu.indicator-power.gschema.xml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/org.ubuntu.indicator-power.gschema.xml.in b/data/org.ubuntu.indicator-power.gschema.xml.in index a961794..67676ec 100644 --- a/data/org.ubuntu.indicator-power.gschema.xml.in +++ b/data/org.ubuntu.indicator-power.gschema.xml.in @@ -1,6 +1,6 @@ - + false <_summary>Show time in Menu Bar <_description>Whether show the time in the menu bar. -- cgit v1.2.3 From ad800988e06fa6a694af5f3c61db2c378aed3a74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Mon, 22 Aug 2011 21:39:04 +0100 Subject: Add gsettings schema to the translatable files --- Makefile.am | 6 ++++++ po/POTFILES.in | 1 + 2 files changed, 7 insertions(+) diff --git a/Makefile.am b/Makefile.am index 70af9f5..2168fe5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -31,6 +31,9 @@ libpower_la_LDFLAGS = \ ############################################################ +dist_noinst_DATA = \ + $(gsettings_in_file) + EXTRA_DIST = \ $(gsettingsschema_in_files) \ autogen.sh @@ -38,6 +41,9 @@ EXTRA_DIST = \ CLEANFILES = \ $(gsettings_SCHEMAS) +MAINTAINERCLEANFILES = \ + $(gsettings_SCHEMAS:.xml=.valid) + DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall ############################################################ diff --git a/po/POTFILES.in b/po/POTFILES.in index 5c310d8..62d1e12 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1 +1,2 @@ +data/org.ubuntu.indicator-power.gschema.xml.in src/indicator-power.c -- cgit v1.2.3 From e7e437b45e48d941e2fabb09e2cbfe5c3c2ff8fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Tue, 23 Aug 2011 14:05:38 +0100 Subject: Makefile.am: some autotools fixes --- Makefile.am | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2168fe5..8ae7e6d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,8 +2,8 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} SUBDIRS = po -gsettingsschema_in_files = data/org.ubuntu.indicator-power.gschema.xml.in -gsettings_SCHEMAS = $(gsettingsschema_in_files:.xml.in=.xml) +gsettings_in_file = data/org.ubuntu.indicator-power.gschema.xml.in +gsettings_SCHEMAS = $(gsettings_in_file:.xml.in=.xml) @INTLTOOL_XML_NOMERGE_RULE@ @@ -31,13 +31,13 @@ libpower_la_LDFLAGS = \ ############################################################ -dist_noinst_DATA = \ - $(gsettings_in_file) - -EXTRA_DIST = \ - $(gsettingsschema_in_files) \ +dist_noinst_SCRIPTS = \ autogen.sh +dist_noinst_DATA = \ + data/org.ubuntu.indicator-power.gschema.xml + $(gsettings_in_file) + CLEANFILES = \ $(gsettings_SCHEMAS) -- cgit v1.2.3 From b1a5f6eda8a4b41773e2e7247c2e2a57300a9f9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Tue, 23 Aug 2011 14:16:20 +0100 Subject: Release 0.7 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 94a94bc..8cdded6 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([indicator-power], - [0.6], + [0.7], [http://bugs.launchpad.net/indicator-power], [indicator-power], [http://launchpad.net/indicator-power]) -- cgit v1.2.3