diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/device-provider-upower.c | 18 | ||||
-rw-r--r-- | src/device.c | 9 | ||||
-rw-r--r-- | src/ib-brightness-control.c | 3 | ||||
-rw-r--r-- | src/service.c | 7 |
4 files changed, 26 insertions, 11 deletions
diff --git a/src/device-provider-upower.c b/src/device-provider-upower.c index ad5bc98..7c12beb 100644 --- a/src/device-provider-upower.c +++ b/src/device-provider-upower.c @@ -288,6 +288,22 @@ on_upower_device_removed (DbusUPower * unused G_GNUC_UNUSED, } 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, gpointer gself) @@ -311,6 +327,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", 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. - <https://bugs.launchpad.net/indicator-power/+bug/824629/comments/7> - - 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. <https://bugs.launchpad.net/indicator-power/+bug/743823> @@ -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. - <http://bugs.launchpad.net/indicator-power/+bug/824629> */ - 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)); diff --git a/src/ib-brightness-control.c b/src/ib-brightness-control.c index 2b9b79d..4fb6bc5 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; } } @@ -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); diff --git a/src/service.c b/src/service.c index b5227f6..a0c7fd1 100644 --- a/src/service.c +++ b/src/service.c @@ -459,10 +459,13 @@ create_brightness_menuitem (IndicatorPowerService * self) get_brightness_range (self, &lo, &hi); - item = g_menu_item_new ("Brightness", "indicator.brightness"); + item = g_menu_item_new (NULL, "indicator.brightness"); 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; } @@ -695,7 +698,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); } /*** |