[nautilus-actions] NactMainWindow: restores/saves the notebook tabs position



commit 2811e76151d8bc13f613bd0d288291d625489183
Author: Pierre Wieser <pwieser trychlos org>
Date:   Wed Feb 1 22:37:23 2012 +0100

    NactMainWindow: restores/saves the notebook tabs position

 ChangeLog                   |    4 ++++
 src/nact/nact-main-window.c |   19 ++++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9656eca..9664f4a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2012-02-01 Pierre Wieser <pwieser trychlos org>
 
+	* src/nact/nact-main-window.c
+	(instance_dispose): Saves the current tabs position.
+	(on_base_initialize_gtk): Restaures and set the tabs position.
+
 	* src/core/na-iprefs.c:
 	* src/core/na-iprefs.h (na_iprefs_get_tabs_pos, na_iprefs_set_tabs_pos):
 	New functions.
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index 4e6223f..4b29ff5 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -38,6 +38,7 @@
 #include <api/na-object-api.h>
 #include <api/na-timeout.h>
 
+#include <core/na-iprefs.h>
 #include <core/na-pivot.h>
 
 #include "base-isession.h"
@@ -725,6 +726,7 @@ instance_dispose( GObject *window )
 	NactMainWindow *self;
 	GtkWidget *pane;
 	gint pos;
+	GtkNotebook *notebook;
 
 	g_return_if_fail( NACT_IS_MAIN_WINDOW( window ));
 
@@ -744,6 +746,10 @@ instance_dispose( GObject *window )
 		pos = gtk_paned_get_position( GTK_PANED( pane ));
 		na_settings_set_uint( NA_IPREFS_MAIN_PANED, pos );
 
+		notebook = GTK_NOTEBOOK( base_window_get_widget( BASE_WINDOW( window ), "MainNotebook" ));
+		pos = gtk_notebook_get_tab_pos( notebook );
+		na_iprefs_set_tabs_pos( pos );
+
 		/* unref items view at last as gtk_tree_model_store_clear() will
 		 * finalize all objects, thus invaliditing all our references
 		 */
@@ -853,11 +859,16 @@ on_base_initialize_window( NactMainWindow *window, gpointer user_data )
 	guint pos;
 	GtkWidget *pane;
 	NactApplication *application;
+	GtkNotebook *notebook;
 
 	g_return_if_fail( NACT_IS_MAIN_WINDOW( window ));
 
 	if( !window->private->dispose_has_run ){
-		g_debug( "%s: window=%p, user_data=%p", thisfn, ( void * ) window, ( void * ) user_data );
+
+		g_debug( "%s: window=%p, user_data=%p",
+				thisfn,
+				( void * ) window,
+				( void * ) user_data );
 
 		pos = na_settings_get_uint( NA_IPREFS_MAIN_PANED, NULL, NULL );
 		if( pos ){
@@ -882,6 +893,12 @@ on_base_initialize_window( NactMainWindow *window, gpointer user_data )
 				G_OBJECT( application ),
 				BASE_SIGNAL_QUIT_REQUESTED,
 				G_CALLBACK( on_base_quit_requested ));
+
+		/* restore the notebook tabs position
+		 */
+		pos = na_iprefs_get_tabs_pos( NULL );
+		notebook = GTK_NOTEBOOK( base_window_get_widget( BASE_WINDOW( window ), "MainNotebook" ));
+		gtk_notebook_set_tab_pos( notebook, pos );
 	}
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]