mirror of
https://github.com/transmission/transmission
synced 2024-12-24 08:43:27 +00:00
(gtk) add prefs to toggle libnotify notification
This commit is contained in:
parent
af7bb90ac1
commit
64e82dad71
3 changed files with 15 additions and 7 deletions
|
@ -53,6 +53,8 @@ tr_prefs_init_global( void )
|
|||
|
||||
pref_int_set_default ( PREF_KEY_PORT, TR_DEFAULT_PORT );
|
||||
|
||||
pref_flag_set_default ( PREF_KEY_NOTIFY, TRUE );
|
||||
|
||||
pref_flag_set_default ( PREF_KEY_NAT, TRUE );
|
||||
pref_flag_set_default ( PREF_KEY_PEX, TRUE );
|
||||
pref_flag_set_default ( PREF_KEY_SYSTRAY, TRUE );
|
||||
|
@ -233,14 +235,11 @@ torrentPage( GObject * core )
|
|||
GtkWidget * w;
|
||||
|
||||
t = hig_workarea_create( );
|
||||
hig_workarea_add_section_title( t, &row, _( "Location" ) );
|
||||
hig_workarea_add_section_title( t, &row, _( "Adding" ) );
|
||||
|
||||
w = new_path_chooser_button( PREF_KEY_DIR_DEFAULT, core );
|
||||
hig_workarea_add_row( t, &row, _( "Default download _location:" ), w, NULL );
|
||||
|
||||
hig_workarea_add_section_divider( t, &row );
|
||||
hig_workarea_add_section_title( t, &row, _( "Adding Torrents" ) );
|
||||
|
||||
s = _( "Show _options dialog" );
|
||||
w = new_check_button( s, PREF_KEY_OPTIONS_PROMPT, core );
|
||||
hig_workarea_add_wide_control( t, &row, w );
|
||||
|
@ -253,6 +252,15 @@ torrentPage( GObject * core )
|
|||
w = new_check_button( s, PREF_KEY_DELETE_ORIGINAL, core );
|
||||
hig_workarea_add_wide_control( t, &row, w );
|
||||
|
||||
#ifdef HAVE_LIBNOTIFY
|
||||
hig_workarea_add_section_divider( t, &row );
|
||||
hig_workarea_add_section_title( t, &row, _( "Notification" ) );
|
||||
|
||||
s = _( "_Popup message when a torrent finishes" );
|
||||
w = new_check_button( s, PREF_KEY_NOTIFY, core );
|
||||
hig_workarea_add_wide_control( t, &row, w );
|
||||
#endif
|
||||
|
||||
hig_workarea_finish( t, &row );
|
||||
return t;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ GtkWidget * tr_prefs_dialog_new( GObject * core, GtkWindow * parent );
|
|||
#define PREF_KEY_ASKQUIT "prompt-before-exit"
|
||||
#define PREF_KEY_ENCRYPTED_ONLY "encrypted-connections-only"
|
||||
#define PREF_KEY_MSGLEVEL "debug-message-level"
|
||||
#define PREF_KEY_NOTIFY "notify-when-complete"
|
||||
#define PREF_KEY_SORT_MODE "sort-mode"
|
||||
#define PREF_KEY_SORT_REVERSED "sort-reversed"
|
||||
#define PREF_KEY_MINIMAL_VIEW "minimal-view"
|
||||
|
|
|
@ -166,7 +166,7 @@ tr_torrent_stop( TrTorrent * self )
|
|||
static gboolean
|
||||
notifyInMainThread( gpointer user_data )
|
||||
{
|
||||
g_message( "calling tr_notify_send on %p", user_data );
|
||||
if( pref_flag_get( PREF_KEY_NOTIFY ) )
|
||||
tr_notify_send( TR_TORRENT( user_data ) );
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -175,7 +175,6 @@ statusChangedCallback( tr_torrent * tor UNUSED,
|
|||
cp_status_t status,
|
||||
void * user_data )
|
||||
{
|
||||
g_message( "status changed! new status is %d, user_data is %p", status, user_data );
|
||||
if( status == TR_CP_COMPLETE )
|
||||
g_idle_add( notifyInMainThread, user_data );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue