1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 01:03:01 +00:00

(trunk gtk) #2201: transmission doesn't remember maximized state

This commit is contained in:
Charles Kerr 2009-06-11 22:36:45 +00:00
parent 17cb7945ed
commit 859c1b6fff
4 changed files with 15 additions and 1 deletions

View file

@ -180,6 +180,7 @@ tr_prefs_init_defaults( tr_benc * d )
tr_bencDictAddBool( d, PREF_KEY_OPTIONS_PROMPT, TRUE );
tr_bencDictAddBool( d, PREF_KEY_MAIN_WINDOW_IS_MAXIMIZED, FALSE );
tr_bencDictAddInt( d, PREF_KEY_MAIN_WINDOW_HEIGHT, 500 );
tr_bencDictAddInt( d, PREF_KEY_MAIN_WINDOW_WIDTH, 300 );
tr_bencDictAddInt( d, PREF_KEY_MAIN_WINDOW_X, 50 );

View file

@ -247,6 +247,8 @@ onMainWindowSizeAllocated( GtkWidget * window,
&& ( gdk_window_get_state( window->window )
& GDK_WINDOW_STATE_MAXIMIZED );
pref_int_set( PREF_KEY_MAIN_WINDOW_IS_MAXIMIZED, isMaximized );
if( !isMaximized )
{
int x, y, w, h;
@ -711,6 +713,14 @@ wannaquit( void * vdata )
/* clear the UI */
gtk_list_store_clear( GTK_LIST_STORE( tr_core_model( cbdata->core ) ) );
/* ensure the window is in its previous position & size.
* this seems to be necessary because changing the main window's
* child seems to unset the size */
gtk_window_resize( cbdata->wind, pref_int_get( PREF_KEY_MAIN_WINDOW_WIDTH ),
pref_int_get( PREF_KEY_MAIN_WINDOW_HEIGHT ) );
gtk_window_move( cbdata->wind, pref_int_get( PREF_KEY_MAIN_WINDOW_X ),
pref_int_get( PREF_KEY_MAIN_WINDOW_Y ) );
/* shut down libT */
g_thread_create( quitThreadFunc, vdata, TRUE, NULL );
}

View file

@ -45,5 +45,6 @@ GtkWidget * tr_prefs_dialog_new( GObject * core,
#define PREF_KEY_MAIN_WINDOW_WIDTH "main-window-width"
#define PREF_KEY_MAIN_WINDOW_X "main-window-x"
#define PREF_KEY_MAIN_WINDOW_Y "main-window-y"
#define PREF_KEY_MAIN_WINDOW_IS_MAXIMIZED "main-window-is-maximized"
#endif

View file

@ -832,7 +832,9 @@ tr_window_new( GtkUIManager * ui_mgr, TrCore * core )
pref_int_get( PREF_KEY_MAIN_WINDOW_WIDTH ),
pref_int_get( PREF_KEY_MAIN_WINDOW_HEIGHT ) );
gtk_window_move( win, pref_int_get( PREF_KEY_MAIN_WINDOW_X ),
pref_int_get( PREF_KEY_MAIN_WINDOW_Y ) );
pref_int_get( PREF_KEY_MAIN_WINDOW_Y ) );
if( pref_flag_get( PREF_KEY_MAIN_WINDOW_IS_MAXIMIZED ) )
gtk_window_maximize( win );
gtk_window_add_accel_group( win, gtk_ui_manager_get_accel_group( ui_mgr ) );
/* window's main container */