1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-19 18:25:38 +00:00

(trunk gtk) #4366 "Use GAppInfo, rather than GConf2, for mime-type registration" -- done.

This commit is contained in:
Jordan Lee 2011-07-20 23:31:39 +00:00
parent 7595a7b026
commit e495a579d3
4 changed files with 12 additions and 59 deletions

View file

@ -66,9 +66,6 @@ AC_SUBST(CANBERRA_MINIMUM)
# inhibit hibernation when a torrent is active...
DBUS_GLIB_MINIMUM=0.70
AC_SUBST(DBUS_GLIB_MINIMUM)
# register the GTK+ client as a magnet link handler...
GCONF2_MINIMUM=2.20.0
AC_SUBST(GCONF2_MINIMUM)
# implement "watch" directories to use new .torrent files...
GIO_MINIMUM=2.15.5
AC_SUBST(GIO_MINIMUM)
@ -266,7 +263,6 @@ use_libappindicator=no
use_libnotify=no
use_dbus_glib=no
use_canberra=no
use_gconf2=no
if test "x$want_gtk" = "xyes" ; then
if test "x$have_gtk" = "xyes"; then
build_gtk=yes
@ -340,23 +336,6 @@ if test "x$build_gtk" = "xyes"; then
fi
fi
PKG_CHECK_MODULES([GCONF2],
[gconf-2.0 >= $GCONF2_MINIMUM],
[have_gconf2=yes],
[have_gconf2=no])
AC_ARG_ENABLE([gconf2],
AS_HELP_STRING([--enable-gconf2],[enable GConf support]),,
[enable_gconf2=yes])
if test "x$have_gconf2" = "xyes"; then
if test "x$enable_gconf2" = "xyes" ; then
use_gconf2=yes
AC_DEFINE([HAVE_GCONF2], 1)
else
GCONF2_CFLAGS=
GCONF2_LIBS=
fi
fi
PKG_CHECK_MODULES([DBUS_GLIB],
[dbus-glib-1 >= $DBUS_GLIB_MINIMUM],
[use_dbus_glib=yes],
@ -536,10 +515,9 @@ Configuration:
Optional dependencies for GTK+ client:
* dbus support: ${use_dbus_glib}
* gio for watchdir support: ${use_gio}
* gio for watchdir and mime-type support: ${use_gio}
* libnotify for 'download completed' popups: ${use_libnotify}
* libcanberra for 'download completed' sounds: ${use_canberra}
* gconf2 to register as a magnet link handler: ${use_gconf2}
* libappindicator for an Ubuntu-style tray: ${use_libappindicator}
Build Daemon: ${build_daemon}

View file

@ -16,7 +16,6 @@ AM_CFLAGS = \
@LIBAPPINDICATOR_CFLAGS@ \
@LIBEVENT_CFLAGS@ \
@LIBCANBERRA_CFLAGS@ \
@GCONF2_CFLAGS@ \
@GTK_CFLAGS@ \
@LIBCURL_CFLAGS@ \
@GIO_CFLAGS@ \
@ -96,7 +95,6 @@ transmission_gtk_LDADD = \
$(top_builddir)/third-party/miniupnp/libminiupnp.a \
$(top_builddir)/third-party/libnatpmp/libnatpmp.a \
@LIBCANBERRA_LIBS@ \
@GCONF2_LIBS@ \
@DHT_LIBS@ \
@LIBUTP_LIBS@ \
@GTK_LIBS@ \

View file

@ -37,11 +37,6 @@
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#ifdef HAVE_GCONF2
#include <gconf/gconf.h>
#include <gconf/gconf-client.h>
#endif
#include <libtransmission/transmission.h>
#include <libtransmission/rpcimpl.h>
#include <libtransmission/utils.h>
@ -362,35 +357,19 @@ static gboolean update_model( gpointer gdata );
static void
register_magnet_link_handler( void )
{
#ifdef HAVE_GCONF2
GError * err;
GConfValue * value;
GConfClient * client = gconf_client_get_default( );
const char * key = "/desktop/gnome/url-handlers/magnet/command";
/* if there's already a manget handler registered, don't do anything */
value = gconf_client_get( client, key, NULL );
if( value != NULL )
GAppInfo * app_info = g_app_info_get_default_for_uri_scheme( "magnet" );
if( app_info == NULL )
{
gconf_value_free( value );
return;
/* there's no default magnet handler, so register ourselves for the job... */
GError * error = NULL;
app_info = g_app_info_create_from_commandline( "transmission-gtk", "transmission-gtk", G_APP_INFO_CREATE_SUPPORTS_URIS, NULL );
g_app_info_set_as_default_for_type( app_info, "x-scheme-handler/magnet", &error );
if( error != NULL )
{
g_warning( _( "Error registering Transmission as x-scheme-handler/magnet handler: %s" ), error->message );
g_clear_error( &error );
}
}
err = NULL;
if( !gconf_client_set_string( client, key, "transmission '%s'", &err ) )
{
tr_inf( "Unable to register Transmission as default magnet link handler: \"%s\"", err->message );
g_clear_error( &err );
}
else
{
gconf_client_set_bool( client, "/desktop/gnome/url-handlers/magnet/needs_terminal", FALSE, NULL );
gconf_client_set_bool( client, "/desktop/gnome/url-handlers/magnet/enabled", TRUE, NULL );
tr_inf( "Transmission registered as default magnet link handler" );
}
g_object_unref( G_OBJECT( client ) );
#endif
}
static void

View file

@ -27,11 +27,9 @@ BuildRequires: gtk2-devel >= @GTK_MINIMUM@
Requires: glib2 >= @GLIB_MINIMUM@
Requires: gtk2 >= @GTK_MINIMUM@
# OPTIONAL for the gtk+ client... see configure.ac for details
BuildRequires: GConf2-devel >= @GCONF2_MINIMUM@
BuildRequires: dbus-glib-devel >= @DBUS_GLIB_MINIMUM@
BuildRequires: libcanberra-devel >= @CANBERRA_MINIMUM@
BuildRequires: libnotify-devel >= @LIBNOTIFY_MINIMUM@
Requires: GConf2 >= @GCONF2_MINIMUM@
Requires: dbus-glib >= @DBUS_GLIB_MINIMUM@
Requires: libcanberra >= @CANBERRA_MINIMUM@
Requires: libnotify >= @LIBNOTIFY_MINIMUM@