From fbd06f59d4bc1407108f5b6f060ea4dffaf56032 Mon Sep 17 00:00:00 2001 From: infirit Date: Sat, 13 Dec 2014 23:28:54 +0100 Subject: Sync with GSD: Use MIME types for schemes, not GConf Take the improvement from GSD Commit: 3e4dbcd54412a58d7e6ebde58f191d2a001518b8 From: Rodrigo Moya --- plugins/media-keys/msd-media-keys-manager.c | 36 +++++++---------------------- 1 file changed, 8 insertions(+), 28 deletions(-) (limited to 'plugins') diff --git a/plugins/media-keys/msd-media-keys-manager.c b/plugins/media-keys/msd-media-keys-manager.c index e37b723..95ef52a 100644 --- a/plugins/media-keys/msd-media-keys-manager.c +++ b/plugins/media-keys/msd-media-keys-manager.c @@ -455,42 +455,28 @@ dialog_show (MsdMediaKeysManager *manager) } static void -do_uri_action (MsdMediaKeysManager *manager, gchar *uri) +do_url_action (MsdMediaKeysManager *manager, + const gchar *scheme) { GError *error = NULL; GAppInfo *app_info; - app_info = g_app_info_get_default_for_uri_scheme (uri); + app_info = g_app_info_get_default_for_uri_scheme (scheme); if (app_info != NULL) { if (!g_app_info_launch (app_info, NULL, NULL, &error)) { g_warning ("Could not launch '%s': %s", g_app_info_get_commandline (app_info), error->message); + g_object_unref (app_info); g_error_free (error); } } else { - g_warning ("Could not find default application for '%s' scheme", uri); + g_warning ("Could not find default application for '%s' scheme", scheme); } } -static void -do_help_action (MsdMediaKeysManager *manager) -{ - GError *error = NULL; - if (!g_app_info_launch_default_for_uri ("http://wiki.mate-desktop.org/docs", NULL, &error)) { - g_warning ("Could not launch help application: %s", error->message); - g_error_free (error); - } -} - -static void -do_mail_action (MsdMediaKeysManager *manager) -{ - do_uri_action (manager, "mailto"); -} - static void do_media_action (MsdMediaKeysManager *manager) { @@ -512,12 +498,6 @@ do_media_action (MsdMediaKeysManager *manager) } } -static void -do_www_action (MsdMediaKeysManager *manager) -{ - do_uri_action (manager, "http"); -} - static void do_exit_action (MsdMediaKeysManager *manager) { @@ -967,7 +947,7 @@ do_action (MsdMediaKeysManager *manager, g_free (cmd); break; case EMAIL_KEY: - do_mail_action (manager); + do_url_action (manager, "mailto"); break; case SCREENSAVER_KEY: if ((cmd = g_find_program_in_path ("mate-screensaver-command"))) { @@ -979,10 +959,10 @@ do_action (MsdMediaKeysManager *manager, g_free (cmd); break; case HELP_KEY: - do_help_action (manager); + do_url_action (manager, "help"); break; case WWW_KEY: - do_www_action (manager); + do_url_action (manager, "http"); break; case MEDIA_KEY: do_media_action (manager); -- cgit v1.2.1