aboutsummaryrefslogtreecommitdiff
path: root/src/service.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/service.c')
-rw-r--r--src/service.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/service.c b/src/service.c
index 1976332..c70723a 100644
--- a/src/service.c
+++ b/src/service.c
@@ -22,6 +22,7 @@
#include <glib/gi18n.h>
#include <gio/gio.h>
+#include <url-dispatcher.h>
#include "device.h"
#include "device-provider.h"
@@ -331,15 +332,13 @@ 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)));
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)
{
@@ -349,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);
}
@@ -469,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;
}
@@ -532,7 +529,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 +682,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 +693,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 +742,7 @@ init_gactions (IndicatorPowerService * self)
GActionEntry entries[] = {
{ "activate-settings", on_settings_activated },
+ { "activate-phone-settings", on_phone_settings_activated },
{ "activate-statistics", on_statistics_activated }
};