summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang Xianwei <[email protected]>2018-12-06 16:23:27 +0800
committerlukefromdc <[email protected]>2018-12-07 20:37:49 +0000
commitc19fce3506738b639ce1b95d90cbcfb3665937b7 (patch)
tree5207514416089310ad5b7d75408ea28be4b3ae2c
parentda353f29d3797a918f7c2cf249da19926160f2c1 (diff)
downloadmate-settings-daemon-c19fce3506738b639ce1b95d90cbcfb3665937b7.tar.bz2
mate-settings-daemon-c19fce3506738b639ce1b95d90cbcfb3665937b7.tar.xz
media-keys: Execute default calculator application defined by schema
Signed-off-by: Zhang Xianwei <[email protected]>
-rw-r--r--plugins/media-keys/msd-media-keys-manager.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/plugins/media-keys/msd-media-keys-manager.c b/plugins/media-keys/msd-media-keys-manager.c
index 7a82cab..fc9bee7 100644
--- a/plugins/media-keys/msd-media-keys-manager.c
+++ b/plugins/media-keys/msd-media-keys-manager.c
@@ -527,6 +527,22 @@ do_media_action (MsdMediaKeysManager *manager)
}
static void
+do_calculator_action (MsdMediaKeysManager *manager)
+{
+ GSettings *settings;
+ char *calc;
+
+ settings = g_settings_new ("org.mate.applications-calculator");
+ calc = g_settings_get_string (settings, "exec");
+
+ if (calc)
+ execute (manager, calc, FALSE, FALSE);
+
+ g_free (calc);
+ g_object_unref (settings);
+}
+
+static void
do_shutdown_action (MsdMediaKeysManager *manager)
{
execute (manager, "mate-session-save --shutdown-dialog", FALSE, FALSE);
@@ -1245,15 +1261,7 @@ do_action (MsdMediaKeysManager *manager,
do_media_action (manager);
break;
case CALCULATOR_KEY:
- if ((cmd = g_find_program_in_path ("galculator"))) {
- execute (manager, "galculator", FALSE, FALSE);
- } else if ((cmd = g_find_program_in_path ("mate-calc"))) {
- execute (manager, "mate-calc", FALSE, FALSE);
- } else {
- execute (manager, "gnome-calculator", FALSE, FALSE);
- }
-
- g_free (cmd);
+ do_calculator_action (manager);
break;
case PLAY_KEY:
return do_multimedia_player_action (manager, "Play");