1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-21 21:57:01 +00:00

(trunk gtk) #2873 "optional appindicator support" -- committed patch to trunk for 1.90

This commit is contained in:
Charles Kerr 2010-02-07 19:32:35 +00:00
parent b6c0fb31b1
commit 5074c0c021
3 changed files with 82 additions and 15 deletions

View file

@ -37,7 +37,11 @@ else
fi fi
AM_CONDITIONAL(TR_UNSTABLE, test "x$supported_build" = "xno") AM_CONDITIONAL(TR_UNSTABLE, test "x$supported_build" = "xno")
# MANDATORY for libtransmission ##
##
## MANDATORY for everything
##
##
CURL_MINIMUM=7.16.3 CURL_MINIMUM=7.16.3
AC_SUBST(CURL_MINIMUM) AC_SUBST(CURL_MINIMUM)
LIBEVENT_MINIMUM=1.4.5 LIBEVENT_MINIMUM=1.4.5
@ -45,13 +49,21 @@ AC_SUBST(LIBEVENT_MINIUM)
OPENSSL_MINIMUM=0.9.4 OPENSSL_MINIMUM=0.9.4
AC_SUBST(OPENSSL_MINIMUM) AC_SUBST(OPENSSL_MINIMUM)
# MANDATORY for the GTK+ client ##
##
## MANDATORY for the GTK+ client
##
##
GLIB_MINIMUM=2.6.0 GLIB_MINIMUM=2.6.0
AC_SUBST(GLIB_MINIMUM) AC_SUBST(GLIB_MINIMUM)
GTK_MINIMUM=2.6.0 GTK_MINIMUM=2.6.0
AC_SUBST(GTK_MINIMUM) AC_SUBST(GTK_MINIMUM)
# OPTIONAL for the GTK+ client ##
##
## OPTIONAL for the GTK+ client
##
##
# play the XDG "download done" sound... # play the XDG "download done" sound...
CANBERRA_MINIMUM=0.10 CANBERRA_MINIMUM=0.10
AC_SUBST(CANBERRA_MINIMUM) AC_SUBST(CANBERRA_MINIMUM)
@ -67,6 +79,9 @@ AC_SUBST(GIO_MINIMUM)
# pop up a "download done" notice... # pop up a "download done" notice...
LIBNOTIFY_MINIMUM=0.4.3 LIBNOTIFY_MINIMUM=0.4.3
AC_SUBST(LIBNOTIFY_MINIMUM) AC_SUBST(LIBNOTIFY_MINIMUM)
# create the tray icon with AppIndicator
LIBAPPINDICATOR_MINIMUM=0.0.11
AC_SUBST(LIBAPPINDICATOR_MINIMUM)
AC_PROG_CC AC_PROG_CC
@ -246,6 +261,7 @@ AC_ARG_ENABLE([gtk],
[want_gtk=${have_gtk}]) [want_gtk=${have_gtk}])
build_gtk=no build_gtk=no
use_gio=no use_gio=no
use_libappindicator=no
use_libnotify=no use_libnotify=no
use_dbus_glib=no use_dbus_glib=no
use_canberra=no use_canberra=no
@ -284,6 +300,24 @@ if test "x$build_gtk" = "xyes"; then
fi fi
fi fi
PKG_CHECK_MODULES([LIBAPPINDICATOR],
[appindicator-0.1 >= $LIBAPPINDICATOR_MINIMUM],
[have_libappindicator=yes],
[have_libappindicator=no])
AC_ARG_ENABLE([libappindicator],
AS_HELP_STRING([--enable-libappindicator],[enable AppIndicator support]),,
[enable_libappindicator=yes])
use_libappindicator=no
if test "x$enable_libappindicator" = "xyes" ; then
if test "x$have_libappindicator" = "xyes"; then
use_libappindicator=yes
AC_SUBST(LIBAPPINDICATOR_LIBS)
AC_SUBST(LIBAPPINDICATOR_CFLAGS)
AC_DEFINE([HAVE_LIBAPPINDICATOR], 1)
fi
fi
PKG_CHECK_MODULES([LIBCANBERRA], PKG_CHECK_MODULES([LIBCANBERRA],
[libcanberra-gtk >= $CANBERRA_MINIMUM], [libcanberra-gtk >= $CANBERRA_MINIMUM],
[have_libcanberra=yes], [have_libcanberra=yes],
@ -466,18 +500,19 @@ echo "
Configuration: Configuration:
Source code location: ${srcdir} Source code location: ${srcdir}
Compiler: ${CXX} Compiler: ${CXX}
System or bundled libevent: ${libevent_source} System or bundled libevent: ${libevent_source}
Build Mac client: ${build_mac} Build Mac client: ${build_mac}
Build GTK+ client: ${build_gtk} Build GTK+ client: ${build_gtk}
... with canberra support: ${use_canberra} ... with gio: ${use_gio}
... with gio support: ${use_gio} ... with dbus-glib: ${use_dbus_glib}
... with dbus-glib support: ${use_dbus_glib} ... with libcanberra: ${use_canberra}
... with libgconf support: ${use_libgconf} ... with libappindicator: ${use_libappindicator}
... with libnotify support: ${use_libnotify} ... with libgconf: ${use_libgconf}
Build Command-Line client: ${build_cli} ... with libnotify: ${use_libnotify}
Build Daemon: ${build_daemon} Build Command-Line client: ${build_cli}
Build Daemon: ${build_daemon}
" "

View file

@ -20,6 +20,7 @@ AM_CPPFLAGS = \
$(GTK_EXTRA_CPPFLAGS) $(GTK_EXTRA_CPPFLAGS)
AM_CFLAGS = \ AM_CFLAGS = \
@LIBAPPINDICATOR_CFLAGS@ \
@LIBEVENT_CFLAGS@ \ @LIBEVENT_CFLAGS@ \
@LIBCANBERRA_CFLAGS@ \ @LIBCANBERRA_CFLAGS@ \
@LIBGCONF_CFLAGS@ \ @LIBGCONF_CFLAGS@ \
@ -109,6 +110,7 @@ transmission_LDADD = \
@DHT_LIBS@ \ @DHT_LIBS@ \
@GTK_LIBS@ \ @GTK_LIBS@ \
@GIO_LIBS@ \ @GIO_LIBS@ \
@LIBAPPINDICATOR_LIBS@ \
@LIBNOTIFY_LIBS@ \ @LIBNOTIFY_LIBS@ \
@LIBEVENT_LIBS@ \ @LIBEVENT_LIBS@ \
@DBUS_GLIB_LIBS@ \ @DBUS_GLIB_LIBS@ \

View file

@ -12,6 +12,9 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#ifdef HAVE_LIBAPPINDICATOR
#include <libappindicator/app-indicator.h>
#endif
#include "actions.h" #include "actions.h"
#include "tr-icon.h" #include "tr-icon.h"
#include "util.h" #include "util.h"
@ -31,6 +34,12 @@ tr_icon_refresh( gpointer vicon UNUSED )
#else #else
#ifdef HAVE_LIBAPPINDICATOR
void
tr_icon_refresh( gpointer vindicator UNUSED )
{
}
#else
static void static void
activated( GtkStatusIcon * self UNUSED, activated( GtkStatusIcon * self UNUSED,
gpointer user_data UNUSED ) gpointer user_data UNUSED )
@ -107,7 +116,26 @@ tr_icon_refresh( gpointer vicon )
gtk_status_icon_set_tooltip( GTK_STATUS_ICON( icon ), tip ); gtk_status_icon_set_tooltip( GTK_STATUS_ICON( icon ), tip );
#endif #endif
} }
#endif
#ifdef HAVE_LIBAPPINDICATOR
gpointer
tr_icon_new( TrCore * core)
{
const char * icon_name = TRAY_ICON;
AppIndicator * indicator = app_indicator_new ( "transmission",
icon_name,
APP_INDICATOR_CATEGORY_SYSTEM_SERVICES );
GtkWidget * indicator_menu = action_get_widget( "/icon-popup" );
app_indicator_set_status ( indicator, APP_INDICATOR_STATUS_ACTIVE );
app_indicator_set_menu ( indicator, GTK_MENU (indicator_menu) );
g_object_set_data( G_OBJECT( indicator ), "tr-core", core );
return indicator;
}
#else
gpointer gpointer
tr_icon_new( TrCore * core ) tr_icon_new( TrCore * core )
{ {
@ -121,3 +149,5 @@ tr_icon_new( TrCore * core )
} }
#endif #endif
#endif