aboutsummaryrefslogtreecommitdiff
path: root/src/service.c
diff options
context:
space:
mode:
authorCalum Lind <calumlind@gmail.com>2013-12-04 11:59:21 +0000
committerCalum Lind <calumlind@gmail.com>2013-12-04 11:59:21 +0000
commit84d26b8e369a3645ab23552168344f55cdaf8793 (patch)
treecaf867b66d26d02311b01c3d9313b0bdeedda9c5 /src/service.c
parent3ff43b06fcfc04cbcb367d745b2151904bf29d5d (diff)
parent54684163043cba634f473db5181fb54ed893270d (diff)
downloadayatana-indicator-power-84d26b8e369a3645ab23552168344f55cdaf8793.tar.gz
ayatana-indicator-power-84d26b8e369a3645ab23552168344f55cdaf8793.tar.bz2
ayatana-indicator-power-84d26b8e369a3645ab23552168344f55cdaf8793.zip
Focus to battery tab when opening in gnome-power-statistics
Diffstat (limited to 'src/service.c')
-rw-r--r--src/service.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/service.c b/src/service.c
index 424e489..2670a67 100644
--- a/src/service.c
+++ b/src/service.c
@@ -378,6 +378,8 @@ append_device_to_menu (GMenu * menu, const IndicatorPowerDevice * device)
label = indicator_power_device_get_label (device);
item = g_menu_item_new (label, "indicator.activate-statistics");
g_free (label);
+ g_menu_item_set_action_and_target(item, "indicator.activate-statistics", "s",
+ indicator_power_device_get_object_path (device));
if ((icon = indicator_power_device_get_gicon (device)))
{
@@ -695,10 +697,13 @@ on_settings_activated (GSimpleAction * a G_GNUC_UNUSED,
static void
on_statistics_activated (GSimpleAction * a G_GNUC_UNUSED,
- GVariant * param G_GNUC_UNUSED,
+ GVariant * param,
gpointer gself G_GNUC_UNUSED)
{
- execute_command ("gnome-power-statistics");
+ char *cmd = g_strconcat ("gnome-power-statistics", " --device ",
+ g_variant_get_string (param, NULL), NULL);
+ execute_command (cmd);
+ g_free (cmd);
}
static void
@@ -724,7 +729,7 @@ init_gactions (IndicatorPowerService * self)
GActionEntry entries[] = {
{ "activate-settings", on_settings_activated },
{ "activate-phone-settings", on_phone_settings_activated },
- { "activate-statistics", on_statistics_activated }
+ { "activate-statistics", on_statistics_activated, "s" }
};
p->actions = g_simple_action_group_new ();