Changeset 6285
- Timestamp:
- Jul 2, 2008, 6:49:07 PM (14 years ago)
- Location:
- trunk/gtk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gtk/tr-core.c
r6165 r6285 46 46 #include "util.h" 47 47 48 static void tr_core_set_hibernation_allowed( TrCore * core, gboolean allowed);48 static void maybeInhibitHibernation( TrCore * core ); 49 49 50 50 static gboolean our_instance_adds_remote_torrents = FALSE; … … 502 502 else if( !strcmp( key, PREF_KEY_ALLOW_HIBERNATION ) ) 503 503 { 504 tr_core_set_hibernation_allowed( core, pref_flag_get( key ));504 maybeInhibitHibernation( core ); 505 505 } 506 506 #ifdef HAVE_GIO … … 907 907 /* resume sorting */ 908 908 gtk_tree_sortable_set_sort_column_id( sortable, column, order ); 909 910 /* maybe inhibit hibernation */ 911 maybeInhibitHibernation( self ); 909 912 } 910 913 … … 994 997 #endif 995 998 996 997 void 999 static void 998 1000 tr_core_set_hibernation_allowed( TrCore * core, gboolean allowed ) 999 1001 { … … 1017 1019 } 1018 1020 1021 static void 1022 maybeInhibitHibernation( TrCore * core ) 1023 { 1024 gboolean allowHibernation; 1025 tr_handle * session = tr_core_handle( core ); 1026 1027 /* allow hibernation unless we have active torrents */ 1028 allowHibernation = TRUE; 1029 tr_torrent * tor = NULL; 1030 while(( tor = tr_torrentNext( session, tor ))) { 1031 if( tr_torrentGetStatus( tor ) != TR_STATUS_STOPPED ) { 1032 allowHibernation = FALSE; 1033 break; 1034 } 1035 } 1036 1037 /* even if we do have active torrents, 1038 * maybe allow hibernation anyway... */ 1039 if( !allowHibernation ) 1040 allowHibernation = pref_flag_get( PREF_KEY_ALLOW_HIBERNATION ); 1041 1042 tr_core_set_hibernation_allowed( core, allowHibernation ); 1043 } 1044 1019 1045 /** 1020 1046 *** Prefs -
trunk/gtk/tr-prefs.c
r6162 r6285 53 53 54 54 pref_int_set_default ( PREF_KEY_PEER_SOCKET_TOS, TR_DEFAULT_PEER_SOCKET_TOS ); 55 pref_flag_set_default ( PREF_KEY_ALLOW_HIBERNATION, TRUE );55 pref_flag_set_default ( PREF_KEY_ALLOW_HIBERNATION, FALSE ); 56 56 pref_flag_set_default ( PREF_KEY_BLOCKLIST_ENABLED, TR_DEFAULT_BLOCKLIST_ENABLED ); 57 57 -
trunk/gtk/tr-prefs.h
r6166 r6285 28 28 #define PREF_KEY_DOWNLOAD_DIR "download-dir" 29 29 #define PREF_KEY_OPEN_DIALOG_FOLDER "open-dialog-dir" 30 #define PREF_KEY_ALLOW_HIBERNATION "allow-hibernation "30 #define PREF_KEY_ALLOW_HIBERNATION "allow-hibernation-even-when-torrents-are-active" 31 31 #define PREF_KEY_DIR_WATCH "watch-dir" 32 32 #define PREF_KEY_DIR_WATCH_ENABLED "watch-dir-enabled"
Note: See TracChangeset
for help on using the changeset viewer.