diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-03-11 19:51:17 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-03-11 19:54:14 +0800 |
commit | 1b19a1a35b3ae0786050568d422748b0515252e2 (patch) | |
tree | 316f5b66e99301e221333de1489f1a536477c062 /modules/mailto-handler | |
parent | c71445df87f8eb3d038b31b80656233394bf110f (diff) | |
download | gsoc2013-evolution-1b19a1a35b3ae0786050568d422748b0515252e2.tar.gz gsoc2013-evolution-1b19a1a35b3ae0786050568d422748b0515252e2.tar.zst gsoc2013-evolution-1b19a1a35b3ae0786050568d422748b0515252e2.zip |
mailto-handler cleanups.
Diffstat (limited to 'modules/mailto-handler')
-rw-r--r-- | modules/mailto-handler/evolution-mailto-handler.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/modules/mailto-handler/evolution-mailto-handler.c b/modules/mailto-handler/evolution-mailto-handler.c index b141c35560..b6f3656863 100644 --- a/modules/mailto-handler/evolution-mailto-handler.c +++ b/modules/mailto-handler/evolution-mailto-handler.c @@ -68,7 +68,7 @@ mailto_handler_get_shell (EMailtoHandler *extension) } static gboolean -mailto_handler_is_evolution (/*const */ GAppInfo *app_info) +mailto_handler_is_evolution (GAppInfo *app_info) { gint argc; gchar **argv; @@ -206,8 +206,7 @@ mailto_handler_check (EMailtoHandler *extension) if (!mailto_handler_prompt (extension)) goto exit; - if (app_info) - g_object_unref (app_info); + g_clear_object (&app_info); /* Configure Evolution to be the "mailto" URI handler. */ app_info = g_app_info_create_from_commandline ( @@ -216,15 +215,22 @@ mailto_handler_check (EMailtoHandler *extension) G_APP_INFO_CREATE_SUPPORTS_URIS, &error); - if (app_info && !error) - g_app_info_set_as_default_for_type (app_info, MAILTO_HANDLER, &error); + /* Sanity check. */ + g_return_if_fail ( + ((app_info != NULL) && (error == NULL)) || + ((app_info == NULL) && (error != NULL))); + + if (app_info != NULL) + g_app_info_set_as_default_for_type ( + app_info, MAILTO_HANDLER, &error); exit: - if (app_info) - g_object_unref (app_info); + g_clear_object (&app_info); - if (error) { - g_warning ("Failed to register as default handler: %s", error->message); + if (error != NULL) { + g_warning ( + "Failed to register as default handler: %s", + error->message); g_error_free (error); } } |