From c19fce3506738b639ce1b95d90cbcfb3665937b7 Mon Sep 17 00:00:00 2001 From: Zhang Xianwei Date: Thu, 6 Dec 2018 16:23:27 +0800 Subject: media-keys: Execute default calculator application defined by schema Signed-off-by: Zhang Xianwei --- plugins/media-keys/msd-media-keys-manager.c | 26 +++++++++++++++++--------- 1 file 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 @@ -526,6 +526,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) { @@ -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"); -- cgit v1.2.1