From 2dc4a6eac35392b8bc8428198b33759e19d57640 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 29 Aug 2013 16:27:16 -0500 Subject: Add a new action for phone settings and call the dispatcher --- src/service.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/service.c b/src/service.c index 1976332..b4f05ea 100644 --- a/src/service.c +++ b/src/service.c @@ -22,6 +22,7 @@ #include #include +#include #include "device.h" #include "device-provider.h" @@ -532,7 +533,7 @@ create_phone_settings_section (IndicatorPowerService * self G_GNUC_UNUSED) update_brightness_action_state (self); g_object_unref (item); - g_menu_append (section, _("Battery settings…"), "indicator.activate-settings"); + g_menu_append (section, _("Battery settings…"), "indicator.activate-phone-settings"); return G_MENU_MODEL (section); } @@ -685,8 +686,6 @@ on_settings_activated (GSimpleAction * a G_GNUC_UNUSED, GVariant * param G_GNUC_UNUSED, gpointer gself G_GNUC_UNUSED) { - /* FIXME: unity8 settings */ - execute_command ("gnome-control-center power"); } @@ -698,6 +697,14 @@ on_statistics_activated (GSimpleAction * a G_GNUC_UNUSED, execute_command ("gnome-power-statistics"); } +static void +on_phone_settings_activated (GSimpleAction * a G_GNUC_UNUSED, + GVariant * param G_GNUC_UNUSED, + gpointer gself G_GNUC_UNUSED) +{ + url_dispatch_send("settings://system/battery", NULL, NULL); +} + /*** **** ***/ @@ -739,6 +746,7 @@ init_gactions (IndicatorPowerService * self) GActionEntry entries[] = { { "activate-settings", on_settings_activated }, + { "activate-phone-settings", on_phone_settings_activated }, { "activate-statistics", on_statistics_activated } }; -- cgit v1.2.3 From 7b1c7e89d51ec3f9acdccecf50a1e19f57669f62 Mon Sep 17 00:00:00 2001 From: Sebastien Bacher Date: Fri, 30 Aug 2013 11:22:59 +0200 Subject: revert previous commit, liburl-dispatcher1 depends on upstart-app-launch which is in universe, that's blocking indicators from landing. --- src/service.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/service.c b/src/service.c index b4f05ea..1976332 100644 --- a/src/service.c +++ b/src/service.c @@ -22,7 +22,6 @@ #include #include -#include #include "device.h" #include "device-provider.h" @@ -533,7 +532,7 @@ create_phone_settings_section (IndicatorPowerService * self G_GNUC_UNUSED) update_brightness_action_state (self); g_object_unref (item); - g_menu_append (section, _("Battery settings…"), "indicator.activate-phone-settings"); + g_menu_append (section, _("Battery settings…"), "indicator.activate-settings"); return G_MENU_MODEL (section); } @@ -686,6 +685,8 @@ on_settings_activated (GSimpleAction * a G_GNUC_UNUSED, GVariant * param G_GNUC_UNUSED, gpointer gself G_GNUC_UNUSED) { + /* FIXME: unity8 settings */ + execute_command ("gnome-control-center power"); } @@ -697,14 +698,6 @@ on_statistics_activated (GSimpleAction * a G_GNUC_UNUSED, execute_command ("gnome-power-statistics"); } -static void -on_phone_settings_activated (GSimpleAction * a G_GNUC_UNUSED, - GVariant * param G_GNUC_UNUSED, - gpointer gself G_GNUC_UNUSED) -{ - url_dispatch_send("settings://system/battery", NULL, NULL); -} - /*** **** ***/ @@ -746,7 +739,6 @@ init_gactions (IndicatorPowerService * self) GActionEntry entries[] = { { "activate-settings", on_settings_activated }, - { "activate-phone-settings", on_phone_settings_activated }, { "activate-statistics", on_statistics_activated } }; -- cgit v1.2.3 From 5ec494416be68f1231331a68b80cac1087c04ba0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 4 Sep 2013 10:32:43 -0500 Subject: Adding a phone settings action --- src/service.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/service.c b/src/service.c index 1976332..b4f05ea 100644 --- a/src/service.c +++ b/src/service.c @@ -22,6 +22,7 @@ #include #include +#include #include "device.h" #include "device-provider.h" @@ -532,7 +533,7 @@ create_phone_settings_section (IndicatorPowerService * self G_GNUC_UNUSED) update_brightness_action_state (self); g_object_unref (item); - g_menu_append (section, _("Battery settings…"), "indicator.activate-settings"); + g_menu_append (section, _("Battery settings…"), "indicator.activate-phone-settings"); return G_MENU_MODEL (section); } @@ -685,8 +686,6 @@ on_settings_activated (GSimpleAction * a G_GNUC_UNUSED, GVariant * param G_GNUC_UNUSED, gpointer gself G_GNUC_UNUSED) { - /* FIXME: unity8 settings */ - execute_command ("gnome-control-center power"); } @@ -698,6 +697,14 @@ on_statistics_activated (GSimpleAction * a G_GNUC_UNUSED, execute_command ("gnome-power-statistics"); } +static void +on_phone_settings_activated (GSimpleAction * a G_GNUC_UNUSED, + GVariant * param G_GNUC_UNUSED, + gpointer gself G_GNUC_UNUSED) +{ + url_dispatch_send("settings://system/battery", NULL, NULL); +} + /*** **** ***/ @@ -739,6 +746,7 @@ init_gactions (IndicatorPowerService * self) GActionEntry entries[] = { { "activate-settings", on_settings_activated }, + { "activate-phone-settings", on_phone_settings_activated }, { "activate-statistics", on_statistics_activated } }; -- cgit v1.2.3 From ce4067c8054de62ac8f54676103253312d80396f Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 11 Sep 2013 11:39:45 -0500 Subject: add a title entry to the header action's state --- src/service.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/service.c b/src/service.c index b4f05ea..85d6202 100644 --- a/src/service.c +++ b/src/service.c @@ -332,6 +332,8 @@ create_header_state (IndicatorPowerService * self) g_variant_builder_init (&b, G_VARIANT_TYPE("a{sv}")); + g_variant_builder_add (&b, "{sv}", "title", g_variant_new_string (_("Battery"))); + g_variant_builder_add (&b, "{sv}", "visible", g_variant_new_boolean (should_be_visible (self))); -- cgit v1.2.3 From 4ca541cc16b60f29a03694034900c30b4d8a5cbd Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 11 Sep 2013 11:40:40 -0500 Subject: use g_variant_new_take_string() where appropriate --- src/service.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/service.c b/src/service.c index 85d6202..b5227f6 100644 --- a/src/service.c +++ b/src/service.c @@ -338,11 +338,7 @@ create_header_state (IndicatorPowerService * self) g_variant_new_boolean (should_be_visible (self))); if (label != NULL) - { - g_variant_builder_add (&b, "{sv}", "label", g_variant_new_string (label)); - - g_free (label); - } + g_variant_builder_add (&b, "{sv}", "label", g_variant_new_take_string (label)); if (icon != NULL) { @@ -352,12 +348,7 @@ create_header_state (IndicatorPowerService * self) } if (a11y != NULL) - { - g_variant_builder_add (&b, "{sv}", "accessible-desc", - g_variant_new_string (a11y)); - - g_free (a11y); - } + g_variant_builder_add (&b, "{sv}", "accessible-desc", g_variant_new_take_string (a11y)); return g_variant_builder_end (&b); } -- cgit v1.2.3 From 3fe1d262f1947ca126a85bdc165a14ee6f26cc4a Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 1 Oct 2013 09:05:32 -0500 Subject: use the correct battery icon when charging/discharging --- src/device.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'src') diff --git a/src/device.c b/src/device.c index 9dc4647..508a734 100644 --- a/src/device.c +++ b/src/device.c @@ -328,10 +328,7 @@ device_kind_to_string (UpDeviceKind kind) This function's logic differs from GSD's power plugin in some ways: - 1. All charging batteries use the same icon regardless of progress. - - - 2. For discharging batteries, we decide whether or not to use the 'caution' + 1. For discharging batteries, we decide whether or not to use the 'caution' icon based on whether or not we have <= 30 minutes remaining, rather than looking at the battery's percentage left. @@ -389,10 +386,6 @@ indicator_power_device_get_icon_names (const IndicatorPowerDevice * device) case UP_DEVICE_STATE_CHARGING: case UP_DEVICE_STATE_PENDING_CHARGE: - /* When charging, always use the same icon regardless of percentage. - */ - percentage = 0; - suffix_str = get_device_icon_suffix (percentage); index_str = get_device_icon_index (percentage); g_ptr_array_add (names, g_strdup_printf ("%s-%s-charging-symbolic", kind_str, suffix_str)); -- cgit v1.2.3 From 5a739fd7ee27a99f98edc469ab839c6c52d861cb Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 1 Oct 2013 13:50:10 -0500 Subject: replace a g_print() call with g_debug() --- src/ib-brightness-control.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ib-brightness-control.c b/src/ib-brightness-control.c index 2b9b79d..ddc82e5 100644 --- a/src/ib-brightness-control.c +++ b/src/ib-brightness-control.c @@ -52,7 +52,7 @@ ib_brightness_control_new (void) (g_strcmp0 (device_type, "platform") == 0) || (g_strcmp0 (device_type, "raw") == 0)) { path = g_strdup (g_udev_device_get_sysfs_path (device->data)); - g_print ("found: %s\n", path); + g_debug ("found: %s", path); break; } } -- cgit v1.2.3 From 76c62923635e09d63d6407fed0b8648eead6ece8 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 1 Oct 2013 13:50:48 -0500 Subject: Listen for the 'Resuming' signal from upower. When it's received, refresh all our devices. --- src/device-provider-upower.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/device-provider-upower.c b/src/device-provider-upower.c index 05faeab..1b1b7bd 100644 --- a/src/device-provider-upower.c +++ b/src/device-provider-upower.c @@ -248,6 +248,22 @@ on_upower_device_removed (DbusUPower * unused G_GNUC_UNUSED, emit_devices_changed (self); } +static void +on_upower_resuming (DbusUPower * unused G_GNUC_UNUSED, + gpointer gself) +{ + IndicatorPowerDeviceProviderUPower * self; + GHashTableIter iter; + gpointer object_path; + + self = INDICATOR_POWER_DEVICE_PROVIDER_UPOWER (gself); + + g_debug ("Resumed from hibernate/sleep; queueing all devices for a refresh"); + g_hash_table_iter_init (&iter, self->priv->devices); + while (g_hash_table_iter_next (&iter, &object_path, NULL)) + refresh_device_soon (self, object_path); +} + static void on_upower_proxy_ready (GObject * source G_GNUC_UNUSED, GAsyncResult * res, @@ -272,6 +288,8 @@ on_upower_proxy_ready (GObject * source G_GNUC_UNUSED, p = self->priv; p->upower_proxy = proxy; + g_signal_connect (proxy, "resuming", + G_CALLBACK (on_upower_resuming), self); g_signal_connect (proxy, "device-changed", G_CALLBACK (on_upower_device_changed), self); g_signal_connect (proxy, "device-added", -- cgit v1.2.3 From 5cc73ec03c4470b721e264263f5f7102d71cf9e2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 4 Oct 2013 09:36:34 -0500 Subject: Adding an additional slash to the settings URL --- src/service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/service.c b/src/service.c index b5227f6..5e00370 100644 --- a/src/service.c +++ b/src/service.c @@ -695,7 +695,7 @@ on_phone_settings_activated (GSimpleAction * a G_GNUC_UNUSED, GVariant * param G_GNUC_UNUSED, gpointer gself G_GNUC_UNUSED) { - url_dispatch_send("settings://system/battery", NULL, NULL); + url_dispatch_send("settings:///system/battery", NULL, NULL); } /*** -- cgit v1.2.3 From f192ac00d09deab88849ed4676d3ef979d265367 Mon Sep 17 00:00:00 2001 From: Marcus Tomlinson Date: Thu, 10 Oct 2013 16:24:18 +0200 Subject: Added "torch-on" and "torch-off" icons to brightness slider menu item. --- src/service.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/service.c b/src/service.c index 5e00370..c70723a 100644 --- a/src/service.c +++ b/src/service.c @@ -463,6 +463,9 @@ create_brightness_menuitem (IndicatorPowerService * self) g_menu_item_set_attribute (item, "x-canonical-type", "s", "com.canonical.unity.slider"); g_menu_item_set_attribute (item, "min-value", "d", brightness_to_percentage (self, lo)); g_menu_item_set_attribute (item, "max-value", "d", brightness_to_percentage (self, hi)); + g_menu_item_set_attribute (item, "min-icon", "s", "torch-off" ); + g_menu_item_set_attribute (item, "max-icon", "s", "torch-on" ); + return item; } -- cgit v1.2.3 From e1e4997683838addfd8ecb37a7f8dee117b63b6e Mon Sep 17 00:00:00 2001 From: Sebastien Bacher Date: Thu, 24 Oct 2013 16:13:57 -0400 Subject: Don't leak the g_file_get_contents value, reported by valgrind --- src/ib-brightness-control.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/ib-brightness-control.c b/src/ib-brightness-control.c index ddc82e5..4fb6bc5 100644 --- a/src/ib-brightness-control.c +++ b/src/ib-brightness-control.c @@ -126,6 +126,7 @@ ib_brightness_control_get_value_from_file (IbBrightnessControl *self, const gcha g_error_free (error); } else { value = atoi (svalue); + g_free (svalue); } g_free (filename); -- cgit v1.2.3