Changeset 12562


Ignore:
Timestamp:
Jul 20, 2011, 11:31:39 PM (10 years ago)
Author:
jordan
Message:

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

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.ac

    r12529 r12562  
    6767DBUS_GLIB_MINIMUM=0.70
    6868AC_SUBST(DBUS_GLIB_MINIMUM)
    69 # register the GTK+ client as a magnet link handler...
    70 GCONF2_MINIMUM=2.20.0
    71 AC_SUBST(GCONF2_MINIMUM)
    7269# implement "watch" directories to use new .torrent files...
    7370GIO_MINIMUM=2.15.5
     
    267264use_dbus_glib=no
    268265use_canberra=no
    269 use_gconf2=no
    270266if test "x$want_gtk" = "xyes" ; then
    271267    if test "x$have_gtk" = "xyes"; then
     
    338334            LIBCANBERRA_CFLAGS=
    339335            LIBCANBERRA_LIBS=
    340         fi
    341     fi
    342 
    343     PKG_CHECK_MODULES([GCONF2],
    344                       [gconf-2.0 >= $GCONF2_MINIMUM],
    345                       [have_gconf2=yes],
    346                       [have_gconf2=no])
    347     AC_ARG_ENABLE([gconf2],
    348                   AS_HELP_STRING([--enable-gconf2],[enable GConf support]),,
    349                   [enable_gconf2=yes])
    350     if test "x$have_gconf2" = "xyes"; then
    351         if test "x$enable_gconf2" = "xyes" ; then
    352             use_gconf2=yes
    353             AC_DEFINE([HAVE_GCONF2], 1)
    354         else
    355             GCONF2_CFLAGS=
    356             GCONF2_LIBS=
    357336        fi
    358337    fi
     
    537516
    538517      * dbus support:                                 ${use_dbus_glib}
    539       * gio for watchdir support:                     ${use_gio}
     518      * gio for watchdir and mime-type support:       ${use_gio}
    540519      * libnotify for 'download completed' popups:    ${use_libnotify}
    541520      * libcanberra for 'download completed' sounds:  ${use_canberra}
    542       * gconf2 to register as a magnet link handler:  ${use_gconf2}
    543521      * libappindicator for an Ubuntu-style tray:     ${use_libappindicator}
    544522
  • trunk/gtk/Makefile.am

    r12206 r12562  
    1717    @LIBEVENT_CFLAGS@ \
    1818    @LIBCANBERRA_CFLAGS@ \
    19     @GCONF2_CFLAGS@ \
    2019    @GTK_CFLAGS@ \
    2120    @LIBCURL_CFLAGS@ \
     
    9796    $(top_builddir)/third-party/libnatpmp/libnatpmp.a \
    9897    @LIBCANBERRA_LIBS@ \
    99     @GCONF2_LIBS@ \
    10098    @DHT_LIBS@ \
    10199    @LIBUTP_LIBS@ \
  • trunk/gtk/main.c

    r12511 r12562  
    3838#include <glib/gstdio.h>
    3939
    40 #ifdef HAVE_GCONF2
    41  #include <gconf/gconf.h>
    42  #include <gconf/gconf-client.h>
    43 #endif
    44 
    4540#include <libtransmission/transmission.h>
    4641#include <libtransmission/rpcimpl.h>
     
    363358register_magnet_link_handler( void )
    364359{
    365 #ifdef HAVE_GCONF2
    366     GError * err;
    367     GConfValue * value;
    368     GConfClient * client = gconf_client_get_default( );
    369     const char * key = "/desktop/gnome/url-handlers/magnet/command";
    370 
    371     /* if there's already a manget handler registered, don't do anything */
    372     value = gconf_client_get( client, key, NULL );
    373     if( value != NULL )
    374     {
    375         gconf_value_free( value );
    376         return;
    377     }
    378 
    379     err = NULL;
    380     if( !gconf_client_set_string( client, key, "transmission '%s'", &err ) )
    381     {
    382         tr_inf( "Unable to register Transmission as default magnet link handler: \"%s\"", err->message );
    383         g_clear_error( &err );
    384     }
    385     else
    386     {
    387         gconf_client_set_bool( client, "/desktop/gnome/url-handlers/magnet/needs_terminal", FALSE, NULL );
    388         gconf_client_set_bool( client, "/desktop/gnome/url-handlers/magnet/enabled", TRUE, NULL );
    389         tr_inf( "Transmission registered as default magnet link handler" );
    390     }
    391 
    392     g_object_unref( G_OBJECT( client ) );
    393 #endif
     360    GAppInfo * app_info = g_app_info_get_default_for_uri_scheme( "magnet" );
     361    if( app_info == NULL )
     362    {
     363        /* there's no default magnet handler, so register ourselves for the job... */
     364        GError * error = NULL;
     365        app_info = g_app_info_create_from_commandline( "transmission-gtk", "transmission-gtk", G_APP_INFO_CREATE_SUPPORTS_URIS, NULL );
     366        g_app_info_set_as_default_for_type( app_info, "x-scheme-handler/magnet", &error );
     367        if( error != NULL )
     368        {
     369            g_warning( _( "Error registering Transmission as x-scheme-handler/magnet handler: %s" ), error->message );
     370            g_clear_error( &error );
     371        }
     372    }
    394373}
    395374
  • trunk/transmission-gtk.spec.in

    r11626 r12562  
    2828Requires: gtk2 >= @GTK_MINIMUM@
    2929# OPTIONAL for the gtk+ client... see configure.ac for details
    30 BuildRequires: GConf2-devel >= @GCONF2_MINIMUM@
    3130BuildRequires: dbus-glib-devel >= @DBUS_GLIB_MINIMUM@
    3231BuildRequires: libcanberra-devel >= @CANBERRA_MINIMUM@
    3332BuildRequires: libnotify-devel >= @LIBNOTIFY_MINIMUM@
    34 Requires: GConf2 >= @GCONF2_MINIMUM@
    3533Requires: dbus-glib >= @DBUS_GLIB_MINIMUM@
    3634Requires: libcanberra >= @CANBERRA_MINIMUM@
Note: See TracChangeset for help on using the changeset viewer.