From 8ea260af890b6b56632ec835ef26484cdfbff912 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 9 Mar 2008 19:02:16 +0000 Subject: [PATCH] (gtk) notify: in glib >= 2.16, use g_app_info_launch_default_for_uri() to open the completed torrent. --- gtk/notify.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/gtk/notify.c b/gtk/notify.c index 5f42fd066..6824f9da8 100644 --- a/gtk/notify.c +++ b/gtk/notify.c @@ -10,6 +10,9 @@ * $Id$ */ +#ifdef HAVE_GIO +#include +#endif #include #include "notify.h" @@ -55,8 +58,18 @@ notifyCallback( NotifyNotification * n UNUSED, if( path ) { - char * argv[] = { "xdg-open", path, NULL }; - g_spawn_async( NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL ); + gboolean opened = FALSE; +#ifdef HAVE_GIO + GFile * file = g_file_new_for_path( path ); + char * uri = g_file_get_uri( file ); + opened = g_app_info_launch_default_for_uri( uri, NULL, NULL ); + g_free( uri ); + g_object_unref( G_OBJECT( file ) ); +#endif + if( !opened ) { + char * argv[] = { "xdg-open", path, NULL }; + g_spawn_async( NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL ); + } g_free( path ); } }