[nautilus-actions] A window may have its own UI XML definition file while sharing the common builder



commit 215aaecf52b74c638d065660a11cefd55c827b19
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sat Oct 17 18:41:46 2009 +0200

    A window may have its own UI XML definition file while sharing the common builder

 ChangeLog                            |    7 +++++++
 src/nact/base-window.c               |   19 ++++++++++++++-----
 src/nact/nact-assistant-export-ask.c |    2 +-
 3 files changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4e57472..1689344 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2009-10-17 Pierre Wieser <pwieser trychlos org>
 
+	* src/nact/base-window.c (setup_builder):
+	A window may have its own builder, or its own UI XML definition file,
+	or both.
+
+	* src/nact/nact-assistant-export-ask.c
+	(nact_assistant_export_ask_user): The dialog uses the common builder.
+
 	Make clipboard have an access to preferences.
 	Let the user be asked for the export format in drag and drop operations.
 
diff --git a/src/nact/base-window.c b/src/nact/base-window.c
index 9850ca4..ca65d5b 100644
--- a/src/nact/base-window.c
+++ b/src/nact/base-window.c
@@ -515,8 +515,10 @@ instance_dispose( GObject *window )
 
 		/* release the Gtkbuilder, if any
 		 */
-		if( self->private->builder ){
-			g_object_unref( self->private->builder );
+		if( self->private->has_own_builder ){
+			if( self->private->builder ){
+				g_object_unref( self->private->builder );
+			}
 		}
 
 		/* chain up to the parent class */
@@ -1168,21 +1170,28 @@ set_toplevel_initialized( BaseWindow *window, GtkWindow *toplevel, gboolean init
 
 /*
  * setup the builder of the window as a new one, or use the global one
+ * A dialog may have its own builder ,sharing the common UI XML definition file
+ * or a dialog may have its own UI XML definition file, sharing the common builder
+ * or a dialog may have both its UI XML definition file with its own builder
  */
 static void
 setup_builder( BaseWindow *window )
 {
 	static const gchar *thisfn = "base_window_setup_builder";
+	BaseApplication *application;
 	gchar *fname;
 	GError *error = NULL;
 
 	if( window->private->has_own_builder ){
-
 		window->private->builder = base_builder_new();
 
-		fname = v_get_ui_filename( window );
-		g_return_if_fail( fname && strlen( fname ));
+	} else {
+		application = base_window_get_application( window );
+		window->private->builder = base_application_get_builder( application );
+	}
 
+	fname = v_get_ui_filename( window );
+	if( fname && strlen( fname )){
 		if( !base_builder_add_from_file( window->private->builder, fname, &error )){
 			g_warning( "%s: unable to load %s UI XML definition: %s", thisfn, fname, error->message );
 			g_error_free( error );
diff --git a/src/nact/nact-assistant-export-ask.c b/src/nact/nact-assistant-export-ask.c
index 52bffcd..2a156ce 100644
--- a/src/nact/nact-assistant-export-ask.c
+++ b/src/nact/nact-assistant-export-ask.c
@@ -250,7 +250,7 @@ nact_assistant_export_ask_user( BaseWindow *parent, NAObjectAction *action )
 	g_return_val_if_fail( NA_IS_PIVOT( pivot ), IPREFS_EXPORT_NO_EXPORT );
 
 	editor = assistant_export_ask_new( parent );
-	g_object_set( G_OBJECT( editor ), BASE_WINDOW_PROP_HAS_OWN_BUILDER, TRUE, NULL );
+	/*g_object_set( G_OBJECT( editor ), BASE_WINDOW_PROP_HAS_OWN_BUILDER, TRUE, NULL );*/
 
 	editor->private->parent = parent;
 	editor->private->action = action;



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