(trunk gtk) #2597: add an optional "download complete" sound to the gtk client
This commit is contained in:
parent
c06d889269
commit
c7db82d48c
20
configure.ac
20
configure.ac
|
@ -45,6 +45,7 @@ GTK_MINIMUM=2.6.0
|
|||
LIBNOTIFY_MINIMUM=0.4.3
|
||||
DBUS_GLIB_MINIMUM=0.70
|
||||
LIBEVENT_MINIMUM=1.4.5
|
||||
CANBERRA_MINIMUM=0.10
|
||||
AC_SUBST(OPENSSL_MINIMUM)
|
||||
AC_SUBST(CURL_MINIMUM)
|
||||
AC_SUBST(GIO_MINIMUM)
|
||||
|
@ -53,6 +54,7 @@ AC_SUBST(GTK_MINIMUM)
|
|||
AC_SUBST(LIBNOTIFY_MINIMUM)
|
||||
AC_SUBST(DBUS_GLIB_MINIMUM)
|
||||
AC_SUBST(LIBEVENT_MINIUM)
|
||||
AC_SUBST(CANBERRA_MINIMUM)
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
|
@ -273,6 +275,23 @@ if test "x$build_gtk" = "xyes"; then
|
|||
fi
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES([LIBCANBERRA],
|
||||
[libcanberra-gtk >= $CANBERRA_MINIMUM],
|
||||
[have_libcanberra=yes],
|
||||
[have_libcanberra=no])
|
||||
AC_ARG_ENABLE([libcanberra],
|
||||
AS_HELP_STRING([--enable-libcanberra],[enable sounds]),,
|
||||
[enable_libcanberra=yes])
|
||||
use_libcanberra=no
|
||||
if test "x$enable_libcanberra" = "xyes" ; then
|
||||
if test "x$have_libcanberra" = "xyes"; then
|
||||
use_canberra=yes
|
||||
AC_SUBST(LIBCANBERRA_LIBS)
|
||||
AC_SUBST(LIBCANBERRA_CFLAGS)
|
||||
AC_DEFINE([HAVE_LIBCANBERRA], 1)
|
||||
fi
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES([DBUS_GLIB],
|
||||
[dbus-glib-1 >= $DBUS_GLIB_MINIMUM],
|
||||
[use_dbus_glib=yes],
|
||||
|
@ -424,6 +443,7 @@ Configuration:
|
|||
|
||||
Build Mac client: ${build_mac}
|
||||
Build GTK+ client: ${build_gtk}
|
||||
... with canberra support: ${use_canberra}
|
||||
... with gio support: ${use_gio}
|
||||
... with dbus-glib support: ${use_dbus_glib}
|
||||
... with libnotify support: ${use_libnotify}
|
||||
|
|
|
@ -21,6 +21,7 @@ AM_CPPFLAGS = \
|
|||
|
||||
AM_CFLAGS = \
|
||||
$(LIBEVENT_CFLAGS) \
|
||||
$(LIBCANBERRA_CFLAGS) \
|
||||
$(GTK_CFLAGS) \
|
||||
$(LIBCURL_CFLAGS) \
|
||||
$(GIO_CFLAGS) \
|
||||
|
@ -101,6 +102,7 @@ transmission_LDADD = \
|
|||
$(top_builddir)/libtransmission/libtransmission.a \
|
||||
$(top_builddir)/third-party/miniupnp/libminiupnp.a \
|
||||
$(top_builddir)/third-party/libnatpmp/libnatpmp.a \
|
||||
$(LIBCANBERRA_LIBS) \
|
||||
$(DHT_LIBS) \
|
||||
$(GTK_LIBS) \
|
||||
$(GIO_LIBS) \
|
||||
|
|
|
@ -175,6 +175,7 @@ tr_prefs_init_defaults( tr_benc * d )
|
|||
tr_bencDictAddBool( d, PREF_KEY_FILTERBAR, TRUE );
|
||||
tr_bencDictAddBool( d, PREF_KEY_STATUSBAR, TRUE );
|
||||
tr_bencDictAddBool( d, PREF_KEY_SHOW_TRAY_ICON, FALSE );
|
||||
tr_bencDictAddBool( d, PREF_KEY_PLAY_DOWNLOAD_COMPLETE_SOUND, TRUE );
|
||||
tr_bencDictAddBool( d, PREF_KEY_SHOW_DESKTOP_NOTIFICATION, TRUE );
|
||||
tr_bencDictAddBool( d, PREF_KEY_SHOW_MORE_TRACKER_INFO, FALSE );
|
||||
tr_bencDictAddBool( d, PREF_KEY_SHOW_BACKUP_TRACKERS, FALSE );
|
||||
|
|
18
gtk/notify.c
18
gtk/notify.c
|
@ -11,9 +11,15 @@
|
|||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_LIBCANBERRA
|
||||
#include <canberra-gtk.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GIO
|
||||
#include <gio/gio.h>
|
||||
#endif
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include "conf.h"
|
||||
#include "notify.h"
|
||||
|
@ -86,6 +92,18 @@ can_support_actions( void )
|
|||
void
|
||||
tr_notify_send( TrTorrent *tor )
|
||||
{
|
||||
#ifdef HAVE_LIBCANBERRA
|
||||
if( pref_flag_get( PREF_KEY_PLAY_DOWNLOAD_COMPLETE_SOUND ) )
|
||||
{
|
||||
/* play the sound, using sounds from the naming spec */
|
||||
ca_context_play( ca_gtk_context_get (), 0,
|
||||
CA_PROP_EVENT_ID, "complete-download",
|
||||
CA_PROP_APPLICATION_NAME, g_get_application_name,
|
||||
CA_PROP_EVENT_DESCRIPTION, _("Download complete"),
|
||||
NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
if( pref_flag_get( PREF_KEY_SHOW_DESKTOP_NOTIFICATION ) )
|
||||
{
|
||||
const tr_info * info = tr_torrent_info( tor );
|
||||
|
|
|
@ -342,7 +342,7 @@ desktopPage( GObject * core )
|
|||
w = new_check_button( s, PREF_KEY_INHIBIT_HIBERNATION, core );
|
||||
hig_workarea_add_wide_control( t, &row, w );
|
||||
|
||||
s = _( "Show Transmission in the _notification area" );
|
||||
s = _( "Show Transmission icon in the _notification area" );
|
||||
w = new_check_button( s, PREF_KEY_SHOW_TRAY_ICON, core );
|
||||
hig_workarea_add_wide_control( t, &row, w );
|
||||
|
||||
|
@ -350,6 +350,12 @@ desktopPage( GObject * core )
|
|||
w = new_check_button( s, PREF_KEY_SHOW_DESKTOP_NOTIFICATION, core );
|
||||
hig_workarea_add_wide_control( t, &row, w );
|
||||
|
||||
#ifdef HAVE_LIBCANBERRA
|
||||
s = _( "Play _sound when downloads are complete" );
|
||||
w = new_check_button( s, PREF_KEY_PLAY_DOWNLOAD_COMPLETE_SOUND, core );
|
||||
hig_workarea_add_wide_control( t, &row, w );
|
||||
#endif
|
||||
|
||||
hig_workarea_finish( t, &row );
|
||||
return t;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ GtkWidget * tr_prefs_dialog_new( GObject * core,
|
|||
#define PREF_KEY_DIR_WATCH_ENABLED "watch-dir-enabled"
|
||||
#define PREF_KEY_SHOW_TRAY_ICON "show-notification-area-icon"
|
||||
#define PREF_KEY_SHOW_DESKTOP_NOTIFICATION "show-desktop-notification"
|
||||
#define PREF_KEY_PLAY_DOWNLOAD_COMPLETE_SOUND "play-download-complete-sound"
|
||||
#define PREF_KEY_SHOW_MORE_TRACKER_INFO "show-tracker-scrapes"
|
||||
#define PREF_KEY_SHOW_BACKUP_TRACKERS "show-backup-trackers"
|
||||
#define PREF_KEY_START "start-added-torrents"
|
||||
|
|
|
@ -13,21 +13,24 @@ Epoch: 1
|
|||
Source0: %{name}-%{version}.tar.bz2
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
|
||||
|
||||
BuildRequires: curl-devel >= @CURL_MINIMUM@
|
||||
BuildRequires: openssl-devel >= @OPENSSL_MINIMUM@
|
||||
BuildRequires: dbus-glib-devel >= @DBUS_GLIB_MINIMUM@
|
||||
BuildRequires: glib2-devel >= @GLIB_MINIMUM@
|
||||
BuildRequires: gtk2-devel >= @GTK_MINIMUM@
|
||||
BuildRequires: libnotify-devel >= @LIBNOTIFY_MINIMUM@
|
||||
BuildRequires: libcanberra-devel >= @CANBERRA_MINIMUM@
|
||||
BuildRequires: libevent-devel >= @LIBEVENT_MINIMUM@
|
||||
BuildRequires: dbus-glib-devel >= @DBUS_GLIB_MINIMUM@
|
||||
BuildRequires: libnotify-devel >= @LIBNOTIFY_MINIMUM@
|
||||
BuildRequires: openssl-devel >= @OPENSSL_MINIMUM@
|
||||
|
||||
Requires: curl >= @CURL_MINIMUM@
|
||||
Requires: openssl >= @OPENSSL_MINIMUM@
|
||||
Requires: dbus-glib >= @DBUS_GLIB_MINIMUM@
|
||||
Requires: glib2 >= @GLIB_MINIMUM@
|
||||
Requires: gtk2 >= @GTK_MINIMUM@
|
||||
Requires: libcanberra >= @CANBERRA_MINIMUM@
|
||||
Requires: libevent >= @LIBEVENT_MINIMUM@
|
||||
Requires: libnotify >= @LIBNOTIFY_MINIMUM@
|
||||
Requires: dbus-glib >= @DBUS_GLIB_MINIMUM@
|
||||
Requires: openssl >= @OPENSSL_MINIMUM@
|
||||
|
||||
Provides: %{name}
|
||||
|
||||
|
|
Loading…
Reference in New Issue