]> granicus.if.org Git - transmission/commitdiff
(trunk gtk) #1666: Option to disable notification bubbles
authorCharles Kerr <charles@transmissionbt.com>
Mon, 12 Jan 2009 18:48:20 +0000 (18:48 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Mon, 12 Jan 2009 18:48:20 +0000 (18:48 +0000)
gtk/notify.c
gtk/tr-prefs.c
gtk/tr-prefs.h

index c0a5ec1d190a74b96997953c30f970477861687b..1d39794a1addd1b8cb94dd3a4bf2c15ecc9d81a3 100644 (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;
+
+        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 );
 
-    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 );
+        notify_notification_add_action(
+            n, "folder", _( "Open Folder" ),
+            NOTIFY_ACTION_CALLBACK( notifyCallback ), tor, NULL );
+
+        notify_notification_show( n, NULL );
+    }
 }
 
 #endif
index ca72779515a936ad788f87b1055f70d827ced5e2..895b20ca2356bb22a9a9c92dec10e5fee3ddba08 100644 (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;
 }
index 95d312a18e684c37e3f80eefe2902045b5da5e0b..d9850630dff7921c36c83114931d0d7f9faf1388 100644 (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"