diff options
author | Calum Lind <calumlind@gmail.com> | 2013-11-27 19:44:55 +0000 |
---|---|---|
committer | Calum Lind <calumlind@gmail.com> | 2013-11-27 19:44:55 +0000 |
commit | 54684163043cba634f473db5181fb54ed893270d (patch) | |
tree | 76486862dc8d366e0c22fe8021e4160a9f00bc37 | |
parent | 6c9f30f1e5ee6788369e484c6f995802e0da3915 (diff) | |
download | ayatana-indicator-power-54684163043cba634f473db5181fb54ed893270d.tar.gz ayatana-indicator-power-54684163043cba634f473db5181fb54ed893270d.tar.bz2 ayatana-indicator-power-54684163043cba634f473db5181fb54ed893270d.zip |
Focus to battery tab when opening in gnome-power-statistics
-rw-r--r--[-rwxr-xr-x] | autogen.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | debian/rules | 0 | ||||
-rw-r--r-- | src/service.c | 15 |
3 files changed, 11 insertions, 4 deletions
diff --git a/autogen.sh b/autogen.sh index 1912c87..1912c87 100755..100644 --- a/autogen.sh +++ b/autogen.sh diff --git a/debian/rules b/debian/rules index 83edd94..83edd94 100755..100644 --- a/debian/rules +++ b/debian/rules diff --git a/src/service.c b/src/service.c index c70723a..85ac263 100644 --- a/src/service.c +++ b/src/service.c @@ -369,11 +369,15 @@ append_device_to_menu (GMenu * menu, const IndicatorPowerDevice * device) { GIcon * icon; char * label; + char * action; GMenuItem * menu_item; icon = indicator_power_device_get_gicon (device); label = indicator_power_device_get_label (device); - menu_item = g_menu_item_new (label, "indicator.activate-statistics"); + action = g_strconcat ("indicator.activate-statistics::", + indicator_power_device_get_object_path (device), NULL); + menu_item = g_menu_item_new (label, action); + g_free (action); if (icon != NULL) g_menu_item_set_attribute_value (menu_item, @@ -687,10 +691,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 @@ -743,7 +750,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 (); |