(gtk) #1317: Transmission inhibits screen blanking as well as hibernation
This commit is contained in:
parent
cc8bed02c6
commit
03dd43a7f7
|
@ -103,9 +103,7 @@ static GtkToggleActionEntry pref_toggle_entries[] =
|
|||
{ "show-statusbar", NULL,
|
||||
N_( "_Statusbar" ), NULL, NULL, G_CALLBACK( toggle_pref_cb ), FALSE },
|
||||
{ "show-toolbar", NULL,
|
||||
N_( "_Toolbar" ), NULL, NULL, G_CALLBACK( toggle_pref_cb ), FALSE },
|
||||
{ PREF_KEY_SHOW_TRAY_ICON, NULL,
|
||||
N_( "Tray _Icon" ), NULL, NULL, G_CALLBACK( toggle_pref_cb ), FALSE }
|
||||
N_( "_Toolbar" ), NULL, NULL, G_CALLBACK( toggle_pref_cb ), FALSE }
|
||||
};
|
||||
|
||||
static GtkActionEntry entries[] =
|
||||
|
|
|
@ -586,7 +586,7 @@ prefsChanged( TrCore * core,
|
|||
const uint16_t val = pref_int_get( key );
|
||||
tr_sessionSetPeerLimit( tr_core_handle( core ), val );
|
||||
}
|
||||
else if( !strcmp( key, PREF_KEY_ALLOW_HIBERNATION ) )
|
||||
else if( !strcmp( key, PREF_KEY_INHIBIT_HIBERNATION ) )
|
||||
{
|
||||
maybeInhibitHibernation( core );
|
||||
}
|
||||
|
@ -682,7 +682,7 @@ tr_core_new( tr_handle * h )
|
|||
prefsChanged( core, PREF_KEY_SORT_REVERSED, NULL );
|
||||
prefsChanged( core, PREF_KEY_DIR_WATCH_ENABLED, NULL );
|
||||
prefsChanged( core, PREF_KEY_MAX_PEERS_GLOBAL, NULL );
|
||||
prefsChanged( core, PREF_KEY_ALLOW_HIBERNATION, NULL );
|
||||
prefsChanged( core, PREF_KEY_INHIBIT_HIBERNATION, NULL );
|
||||
g_signal_connect( core, "prefs-changed", G_CALLBACK(
|
||||
prefsChanged ), NULL );
|
||||
|
||||
|
@ -1177,27 +1177,19 @@ tr_core_set_hibernation_allowed( TrCore * core,
|
|||
static void
|
||||
maybeInhibitHibernation( TrCore * core )
|
||||
{
|
||||
gboolean allowHibernation;
|
||||
tr_handle * session = tr_core_handle( core );
|
||||
tr_torrent * tor = NULL;
|
||||
gboolean inhibit = pref_flag_get( PREF_KEY_INHIBIT_HIBERNATION );
|
||||
|
||||
/* allow hibernation unless we have active torrents */
|
||||
allowHibernation = TRUE;
|
||||
while( ( tor = tr_torrentNext( session, tor ) ) )
|
||||
if( inhibit )
|
||||
{
|
||||
if( tr_torrentGetStatus( tor ) != TR_STATUS_STOPPED )
|
||||
{
|
||||
allowHibernation = FALSE;
|
||||
break;
|
||||
}
|
||||
/* don't inhibit if we've got active torrents */
|
||||
tr_handle * session = tr_core_handle( core );
|
||||
tr_torrent * tor = NULL;
|
||||
while( ( tor = tr_torrentNext( session, tor ) ) )
|
||||
if( tr_torrentGetStatus( tor ) != TR_STATUS_STOPPED )
|
||||
inhibit = FALSE;
|
||||
}
|
||||
|
||||
/* even if we do have active torrents,
|
||||
* maybe allow hibernation anyway... */
|
||||
if( !allowHibernation )
|
||||
allowHibernation = pref_flag_get( PREF_KEY_ALLOW_HIBERNATION );
|
||||
|
||||
tr_core_set_hibernation_allowed( core, allowHibernation );
|
||||
tr_core_set_hibernation_allowed( core, !inhibit );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -55,7 +55,7 @@ tr_prefs_init_global( void )
|
|||
|
||||
pref_int_set_default ( PREF_KEY_PEER_SOCKET_TOS,
|
||||
TR_DEFAULT_PEER_SOCKET_TOS );
|
||||
pref_flag_set_default ( PREF_KEY_ALLOW_HIBERNATION, FALSE );
|
||||
pref_flag_set_default ( PREF_KEY_INHIBIT_HIBERNATION, FALSE );
|
||||
pref_flag_set_default ( PREF_KEY_BLOCKLIST_ENABLED, TRUE );
|
||||
pref_flag_set_default ( PREF_KEY_BLOCKLIST_UPDATES_ENABLED, TRUE );
|
||||
|
||||
|
@ -382,6 +382,33 @@ torrentPage( GObject * core )
|
|||
return t;
|
||||
}
|
||||
|
||||
/****
|
||||
***** Desktop Tab
|
||||
****/
|
||||
|
||||
static GtkWidget*
|
||||
desktopPage( GObject * core )
|
||||
{
|
||||
int row = 0;
|
||||
const char * s;
|
||||
GtkWidget * t;
|
||||
GtkWidget * w;
|
||||
|
||||
t = hig_workarea_create( );
|
||||
hig_workarea_add_section_title( t, &row, _( "Options" ) );
|
||||
|
||||
s = _( "_Inhibit desktop hibernation when torrents are active" );
|
||||
w = new_check_button( s, PREF_KEY_INHIBIT_HIBERNATION, core );
|
||||
hig_workarea_add_wide_control( t, &row, w );
|
||||
|
||||
s = _( "Show _icon in the desktop Notification Area" );
|
||||
w = new_check_button( s, PREF_KEY_SHOW_TRAY_ICON, core );
|
||||
hig_workarea_add_wide_control( t, &row, w );
|
||||
|
||||
hig_workarea_finish( t, &row );
|
||||
return t;
|
||||
}
|
||||
|
||||
/****
|
||||
***** Peer Tab
|
||||
****/
|
||||
|
@ -1366,23 +1393,26 @@ tr_prefs_dialog_new( GObject * core,
|
|||
gtk_container_set_border_width ( GTK_CONTAINER ( n ), GUI_PAD );
|
||||
|
||||
gtk_notebook_append_page( GTK_NOTEBOOK( n ),
|
||||
torrentPage( core ),
|
||||
gtk_label_new ( _( "Torrents" ) ) );
|
||||
torrentPage( core ),
|
||||
gtk_label_new ( _( "Torrents" ) ) );
|
||||
gtk_notebook_append_page( GTK_NOTEBOOK( n ),
|
||||
peerPage( core ),
|
||||
gtk_label_new ( _( "Peers" ) ) );
|
||||
peerPage( core ),
|
||||
gtk_label_new ( _( "Peers" ) ) );
|
||||
gtk_notebook_append_page( GTK_NOTEBOOK( n ),
|
||||
networkPage( core ),
|
||||
gtk_label_new ( _( "Network" ) ) );
|
||||
networkPage( core ),
|
||||
gtk_label_new ( _( "Network" ) ) );
|
||||
gtk_notebook_append_page( GTK_NOTEBOOK( n ),
|
||||
trackerPage( core ),
|
||||
gtk_label_new ( _( "Trackers" ) ) );
|
||||
desktopPage( core ),
|
||||
gtk_label_new ( _( "Desktop" ) ) );
|
||||
gtk_notebook_append_page( GTK_NOTEBOOK( n ),
|
||||
bandwidthPage( core ),
|
||||
gtk_label_new ( _( "Bandwidth" ) ) );
|
||||
bandwidthPage( core ),
|
||||
gtk_label_new ( _( "Bandwidth" ) ) );
|
||||
gtk_notebook_append_page( GTK_NOTEBOOK( n ),
|
||||
webPage( core ),
|
||||
gtk_label_new ( _( "Web" ) ) );
|
||||
webPage( core ),
|
||||
gtk_label_new ( _( "Web" ) ) );
|
||||
gtk_notebook_append_page( GTK_NOTEBOOK( n ),
|
||||
trackerPage( core ),
|
||||
gtk_label_new ( _( "Trackers" ) ) );
|
||||
|
||||
g_signal_connect( d, "response", G_CALLBACK( response_cb ), core );
|
||||
gtk_box_pack_start_defaults( GTK_BOX( GTK_DIALOG( d )->vbox ), n );
|
||||
|
|
|
@ -33,11 +33,10 @@ GtkWidget * tr_prefs_dialog_new( GObject * core,
|
|||
#define PREF_KEY_OPTIONS_PROMPT "show-options-window"
|
||||
#define PREF_KEY_DOWNLOAD_DIR "download-dir"
|
||||
#define PREF_KEY_OPEN_DIALOG_FOLDER "open-dialog-dir"
|
||||
#define PREF_KEY_ALLOW_HIBERNATION\
|
||||
"allow-hibernation-even-when-torrents-are-active"
|
||||
#define PREF_KEY_INHIBIT_HIBERNATION "inhibit-desktop-hibernation"
|
||||
#define PREF_KEY_DIR_WATCH "watch-dir"
|
||||
#define PREF_KEY_DIR_WATCH_ENABLED "watch-dir-enabled"
|
||||
#define PREF_KEY_SHOW_TRAY_ICON "show-tray-icon"
|
||||
#define PREF_KEY_SHOW_TRAY_ICON "show-notification-area-icon"
|
||||
#define PREF_KEY_START "start-added-torrents"
|
||||
#define PREF_KEY_TRASH_ORIGINAL "trash-original-torrent-files"
|
||||
#define PREF_KEY_PEER_SOCKET_TOS "peer-socket-tos"
|
||||
|
|
1
gtk/ui.h
1
gtk/ui.h
|
@ -29,7 +29,6 @@ static const char * fallback_ui_file =
|
|||
" <menuitem action='show-toolbar'/>\n"
|
||||
" <menuitem action='show-filterbar'/>\n"
|
||||
" <menuitem action='show-statusbar'/>\n"
|
||||
" <menuitem action='show-tray-icon'/>\n"
|
||||
" <separator/>\n"
|
||||
" <menuitem action='sort-by-activity'/>\n"
|
||||
" <menuitem action='sort-by-age'/>\n"
|
||||
|
|
Loading…
Reference in New Issue