[nautilus-actions] NactAssistantExport: keep the position of the horizontal slider



commit 528ba729009a086b9a5771eac8f6324d9a18fa88
Author: Pierre Wieser <pwieser trychlos org>
Date:   Thu Dec 22 01:22:38 2011 +0100

    NactAssistantExport: keep the position of the horizontal slider

 ChangeLog                         |    9 +++++++++
 src/core/na-settings.c            |    1 +
 src/core/na-settings.h            |    1 +
 src/nact/nact-assistant-export.c  |   21 +++++++++++++++++++++
 src/nact/nact-assistant-export.ui |    2 +-
 5 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 282e0eb..a27b2fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2011-12-22 Pierre Wieser <pwieser trychlos org>
 
+	* src/core/na-settings.c:
+	* src/core/na-settings.h: New "export-assistant-paned-width" preference.
+
+	* src/nact/nact-assistant-export.c
+	(instance_dispose, on_base_initialize_base_window):
+	Keep the position of the horizontal pane as a user preference.
+
+	* src/nact/nact-assistant-export.ui: Give a more kind name to the pane.
+
 	* src/nact/nact-assistant-export.c:
 	* src/nact/nact-assistant-export.ui: Whole refactoring.
 
diff --git a/src/core/na-settings.c b/src/core/na-settings.c
index 2cccf50..c2ea6e2 100644
--- a/src/core/na-settings.c
+++ b/src/core/na-settings.c
@@ -151,6 +151,7 @@ static const KeyDef st_def_keys[] = {
 	{ NA_IPREFS_EXPORT_ASK_USER_KEEP_LAST_CHOICE, GROUP_NACT,    NA_DATA_TYPE_BOOLEAN,     "false" },
 	{ NA_IPREFS_EXPORT_ASSISTANT_WSP,             GROUP_NACT,    NA_DATA_TYPE_UINT_LIST,   "" },
 	{ NA_IPREFS_EXPORT_ASSISTANT_URI,             GROUP_NACT,    NA_DATA_TYPE_STRING,      "file:///tmp" },
+	{ NA_IPREFS_EXPORT_ASSISTANT_PANED,           GROUP_NACT,    NA_DATA_TYPE_UINT,        "200" },
 	{ NA_IPREFS_EXPORT_PREFERRED_FORMAT,          GROUP_NACT,    NA_DATA_TYPE_STRING,      NA_IPREFS_DEFAULT_EXPORT_FORMAT },
 	{ NA_IPREFS_FOLDER_CHOOSER_WSP,               GROUP_NACT,    NA_DATA_TYPE_UINT_LIST,   "" },
 	{ NA_IPREFS_FOLDER_CHOOSER_URI,               GROUP_NACT,    NA_DATA_TYPE_STRING,      "file:///" },
diff --git a/src/core/na-settings.h b/src/core/na-settings.h
index 5250a63..66c14a7 100644
--- a/src/core/na-settings.h
+++ b/src/core/na-settings.h
@@ -92,6 +92,7 @@ G_BEGIN_DECLS
 #define NA_IPREFS_EXPORT_ASK_USER_KEEP_LAST_CHOICE	"export-ask-user-keep-last-choice"
 #define NA_IPREFS_EXPORT_ASSISTANT_WSP				"export-assistant-wsp"
 #define NA_IPREFS_EXPORT_ASSISTANT_URI				"export-assistant-lfu"
+#define NA_IPREFS_EXPORT_ASSISTANT_PANED			"export-assistant-paned-width"
 #define NA_IPREFS_EXPORT_PREFERRED_FORMAT			"export-preferred-format"
 #define NA_IPREFS_FOLDER_CHOOSER_WSP				"folder-chooser-wsp"
 #define NA_IPREFS_FOLDER_CHOOSER_URI				"folder-chooser-lfu"
diff --git a/src/nact/nact-assistant-export.c b/src/nact/nact-assistant-export.c
index e733163..a716f00 100644
--- a/src/nact/nact-assistant-export.c
+++ b/src/nact/nact-assistant-export.c
@@ -249,6 +249,10 @@ instance_dispose( GObject *window )
 {
 	static const gchar *thisfn = "nact_assistant_export_instance_dispose";
 	NactAssistantExport *self;
+	GtkAssistant *assistant;
+	GtkWidget *page;
+	guint pos;
+	GtkWidget *pane;
 
 	g_return_if_fail( NACT_IS_ASSISTANT_EXPORT( window ));
 
@@ -265,6 +269,12 @@ instance_dispose( GObject *window )
 			self->private->selected_items = na_object_free_items( self->private->selected_items );
 		}
 
+		assistant = GTK_ASSISTANT( base_window_get_gtk_toplevel( BASE_WINDOW( window )));
+		page = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_ACTIONS_SELECTION );
+		pane = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), "p1-HPaned" );
+		pos = gtk_paned_get_position( GTK_PANED( pane ));
+		na_settings_set_uint( NA_IPREFS_EXPORT_ASSISTANT_PANED, pos );
+
 		/* chain up to the parent class */
 		if( G_OBJECT_CLASS( st_parent_class )->dispose ){
 			G_OBJECT_CLASS( st_parent_class )->dispose( window );
@@ -495,6 +505,8 @@ on_base_initialize_base_window( NactAssistantExport *window, gpointer user_data
 	static const gchar *thisfn = "nact_assistant_export_on_base_initialize_base_window";
 	GtkAssistant *assistant;
 	GtkWidget *page;
+	guint pos;
+	GtkWidget *pane;
 
 	g_return_if_fail( NACT_IS_ASSISTANT_EXPORT( window ));
 
@@ -507,6 +519,15 @@ on_base_initialize_base_window( NactAssistantExport *window, gpointer user_data
 		 */
 		page = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_INTRO );
 		gtk_assistant_set_page_complete( assistant, page, TRUE );
+
+		/* set the slider position
+		 */
+		pos = na_settings_get_uint( NA_IPREFS_EXPORT_ASSISTANT_PANED, NULL, NULL );
+		if( pos ){
+			page = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_ACTIONS_SELECTION );
+			pane = na_gtk_utils_search_for_child_widget( GTK_CONTAINER( page ), "p1-HPaned" );
+			gtk_paned_set_position( GTK_PANED( pane ), pos );
+		}
 	}
 }
 
diff --git a/src/nact/nact-assistant-export.ui b/src/nact/nact-assistant-export.ui
index 6de6f69..e5ba2dd 100644
--- a/src/nact/nact-assistant-export.ui
+++ b/src/nact/nact-assistant-export.ui
@@ -23,7 +23,7 @@
           <object class="GtkAlignment" id="p1-l2-alignment1">
             <property name="visible">True</property>
             <child>
-              <object class="GtkHPaned" id="p1-l3-hpaned1">
+              <object class="GtkHPaned" id="p1-HPaned">
                 <property name="visible">True</property>
                 <child>
                   <object class="GtkVBox" id="p1-l4-vbox1">



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