(trunk gtk) #1666: Option to disable notification bubbles

This commit is contained in:
Charles Kerr 2009-01-12 18:48:20 +00:00
parent bb8451344f
commit 20bc67554e
3 changed files with 27 additions and 14 deletions

View File

@ -60,20 +60,27 @@ notifyCallback( NotifyNotification * n UNUSED,
void
tr_notify_send( TrTorrent *tor )
{
const tr_info * info = tr_torrent_info( tor );
NotifyNotification * n = notify_notification_new( _(
"Torrent Complete" ),
info->name,
"transmission", NULL );
if( pref_flag_get( PREF_KEY_SHOW_DESKTOP_NOTIFICATION ) )
{
const tr_info * info = tr_torrent_info( tor );
NotifyNotification * n;
if( info->fileCount == 1 )
notify_notification_add_action( n, "file", _( "Open File" ),
NOTIFY_ACTION_CALLBACK(
notifyCallback ), tor, NULL );
notify_notification_add_action( n, "folder", _( "Open Folder" ),
NOTIFY_ACTION_CALLBACK(
notifyCallback ), tor, NULL );
notify_notification_show( n, NULL );
n = notify_notification_new( _( "Torrent Complete" ),
info->name,
"transmission", NULL );
if( info->fileCount == 1 )
notify_notification_add_action(
n, "file", _( "Open File" ),
NOTIFY_ACTION_CALLBACK( notifyCallback ), tor,
NULL );
notify_notification_add_action(
n, "folder", _( "Open Folder" ),
NOTIFY_ACTION_CALLBACK( notifyCallback ), tor, NULL );
notify_notification_show( n, NULL );
}
}
#endif

View File

@ -39,7 +39,7 @@ tr_prefs_init_global( void )
cf_check_older_configs( );
#if HAVE_GIO
#ifdef HAVE_GIO
str = NULL;
if( !str ) str = g_get_user_special_dir( G_USER_DIRECTORY_DESKTOP );
if( !str ) str = tr_getDefaultDownloadDir( );
@ -56,6 +56,7 @@ tr_prefs_init_global( void )
pref_flag_set_default ( PREF_KEY_FILTERBAR, TRUE );
pref_flag_set_default ( PREF_KEY_STATUSBAR, TRUE );
pref_flag_set_default ( PREF_KEY_SHOW_TRAY_ICON, FALSE );
pref_flag_set_default ( PREF_KEY_SHOW_DESKTOP_NOTIFICATION, TRUE );
pref_string_set_default ( PREF_KEY_STATUSBAR_STATS, "total-ratio" );
pref_flag_set_default ( PREF_KEY_SCHED_LIMIT_ENABLED, FALSE );
@ -350,6 +351,10 @@ desktopPage( GObject * core )
w = new_check_button( s, PREF_KEY_SHOW_TRAY_ICON, core );
hig_workarea_add_wide_control( t, &row, w );
s = _( "Show desktop _notifications" );
w = new_check_button( s, PREF_KEY_SHOW_DESKTOP_NOTIFICATION, core );
hig_workarea_add_wide_control( t, &row, w );
hig_workarea_finish( t, &row );
return t;
}

View File

@ -32,6 +32,7 @@ GtkWidget * tr_prefs_dialog_new( GObject * core,
#define PREF_KEY_DIR_WATCH "watch-dir"
#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_START "start-added-torrents"
#define PREF_KEY_TRASH_ORIGINAL "trash-original-torrent-files"
#define PREF_KEY_ASKQUIT "prompt-before-exit"