Changeset 10133


Ignore:
Timestamp:
Feb 7, 2010, 7:32:35 PM (12 years ago)
Author:
charles
Message:

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

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.ac

    r10117 r10133  
    3838AM_CONDITIONAL(TR_UNSTABLE, test "x$supported_build" = "xno")
    3939
    40 # MANDATORY for libtransmission
     40##
     41##
     42##   MANDATORY for everything
     43##
     44##
    4145CURL_MINIMUM=7.16.3
    4246AC_SUBST(CURL_MINIMUM)
     
    4650AC_SUBST(OPENSSL_MINIMUM)
    4751
    48 # MANDATORY for the GTK+ client
     52##
     53##
     54##   MANDATORY for the GTK+ client
     55##
     56##
    4957GLIB_MINIMUM=2.6.0
    5058AC_SUBST(GLIB_MINIMUM)
     
    5260AC_SUBST(GTK_MINIMUM)
    5361
    54 # OPTIONAL for the GTK+ client
     62##
     63##
     64##   OPTIONAL for the GTK+ client
     65##
     66##
    5567# play the XDG "download done" sound...
    5668CANBERRA_MINIMUM=0.10
     
    6880LIBNOTIFY_MINIMUM=0.4.3
    6981AC_SUBST(LIBNOTIFY_MINIMUM)
     82# create the tray icon with AppIndicator
     83LIBAPPINDICATOR_MINIMUM=0.0.11
     84  AC_SUBST(LIBAPPINDICATOR_MINIMUM)
    7085
    7186
     
    247262build_gtk=no
    248263use_gio=no
     264use_libappindicator=no
    249265use_libnotify=no
    250266use_dbus_glib=no
     
    282298            use_libnotify=yes
    283299            AC_DEFINE([HAVE_LIBNOTIFY], 1)
     300        fi
     301    fi
     302
     303    PKG_CHECK_MODULES([LIBAPPINDICATOR],
     304                      [appindicator-0.1 >= $LIBAPPINDICATOR_MINIMUM],
     305                      [have_libappindicator=yes],
     306                      [have_libappindicator=no])
     307
     308    AC_ARG_ENABLE([libappindicator],
     309                  AS_HELP_STRING([--enable-libappindicator],[enable AppIndicator support]),,
     310                  [enable_libappindicator=yes])
     311    use_libappindicator=no
     312    if test "x$enable_libappindicator" = "xyes" ; then
     313        if test "x$have_libappindicator" = "xyes"; then
     314            use_libappindicator=yes
     315            AC_SUBST(LIBAPPINDICATOR_LIBS)
     316            AC_SUBST(LIBAPPINDICATOR_CFLAGS)
     317            AC_DEFINE([HAVE_LIBAPPINDICATOR], 1)
    284318        fi
    285319    fi
     
    467501Configuration:
    468502
    469         Source code location:          ${srcdir}
    470         Compiler:                      ${CXX}
    471         System or bundled libevent:    ${libevent_source}
    472 
    473         Build Mac client:              ${build_mac}
    474         Build GTK+ client:             ${build_gtk}
    475           ... with canberra support:   ${use_canberra}
    476           ... with gio support:        ${use_gio}
    477           ... with dbus-glib support:  ${use_dbus_glib}
    478           ... with libgconf support:   ${use_libgconf}
    479           ... with libnotify support:  ${use_libnotify}
    480         Build Command-Line client:     ${build_cli}
    481         Build Daemon:                  ${build_daemon}
     503        Source code location:        ${srcdir}
     504        Compiler:                    ${CXX}
     505        System or bundled libevent:  ${libevent_source}
     506
     507        Build Mac client:            ${build_mac}
     508        Build GTK+ client:           ${build_gtk}
     509          ... with gio:              ${use_gio}
     510          ... with dbus-glib:        ${use_dbus_glib}
     511          ... with libcanberra:      ${use_canberra}
     512          ... with libappindicator:  ${use_libappindicator}
     513          ... with libgconf:         ${use_libgconf}
     514          ... with libnotify:        ${use_libnotify}
     515        Build Command-Line client:   ${build_cli}
     516        Build Daemon:                ${build_daemon}
    482517
    483518"
  • trunk/gtk/Makefile.am

    r9795 r10133  
    2121
    2222AM_CFLAGS = \
     23    @LIBAPPINDICATOR_CFLAGS@ \
    2324    @LIBEVENT_CFLAGS@ \
    2425    @LIBCANBERRA_CFLAGS@ \
     
    110111    @GTK_LIBS@ \
    111112    @GIO_LIBS@ \
     113    @LIBAPPINDICATOR_LIBS@ \
    112114    @LIBNOTIFY_LIBS@ \
    113115    @LIBEVENT_LIBS@ \
  • trunk/gtk/tr-icon.c

    r9989 r10133  
    1313#include <glib/gi18n.h>
    1414#include <gtk/gtk.h>
     15#ifdef HAVE_LIBAPPINDICATOR
     16 #include <libappindicator/app-indicator.h>
     17#endif
    1518#include "actions.h"
    1619#include "tr-icon.h"
     
    3235#else
    3336
     37#ifdef HAVE_LIBAPPINDICATOR
     38void
     39tr_icon_refresh( gpointer vindicator UNUSED )
     40{
     41}
     42#else
    3443static void
    3544activated( GtkStatusIcon   * self      UNUSED,
     
    108117#endif
    109118}
     119#endif
    110120
     121#ifdef HAVE_LIBAPPINDICATOR
     122gpointer
     123tr_icon_new( TrCore * core)
     124{
     125        const char * icon_name = TRAY_ICON;
     126        AppIndicator * indicator = app_indicator_new ( "transmission",
     127                                                                                                        icon_name,
     128                                                                                                        APP_INDICATOR_CATEGORY_SYSTEM_SERVICES );
     129
     130        GtkWidget * indicator_menu = action_get_widget( "/icon-popup" );
     131
     132        app_indicator_set_status ( indicator, APP_INDICATOR_STATUS_ACTIVE );
     133        app_indicator_set_menu ( indicator, GTK_MENU (indicator_menu) );
     134
     135        g_object_set_data( G_OBJECT( indicator ), "tr-core", core );
     136        return indicator;
     137}                       
     138#else
    111139gpointer
    112140tr_icon_new( TrCore * core )
     
    122150
    123151#endif
     152
     153#endif
Note: See TracChangeset for help on using the changeset viewer.