[nautilus-actions] Make the AssistantImportAsk dialog transient for main window



commit 88f1b02e95e872dda00d3b9b9c8bfb3f6ce2fe34
Author: Pierre Wieser <pwieser trychlos org>
Date:   Thu Oct 15 19:46:40 2009 +0200

    Make the AssistantImportAsk dialog transient for main window

 src/nact/base-window.c                   |   21 +++++++++++++--------
 src/nact/nact-assistant-import-ask.c     |   14 +++++---------
 src/nact/nautilus-actions-config-tool.ui |    3 +--
 3 files changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/src/nact/base-window.c b/src/nact/base-window.c
index a4e7f1f..86a18c6 100644
--- a/src/nact/base-window.c
+++ b/src/nact/base-window.c
@@ -961,7 +961,6 @@ static void
 on_runtime_init_toplevel( BaseWindow *window, gpointer user_data )
 {
 	static const gchar *thisfn = "base_window_on_runtime_init_toplevel";
-	GtkWindow *parent_toplevel;
 
 	g_debug( "%s: window=%p, user_data=%p, parent_window=%p",
 			thisfn, ( void * ) window, ( void * ) user_data, ( void * ) window->private->parent );
@@ -969,12 +968,6 @@ on_runtime_init_toplevel( BaseWindow *window, gpointer user_data )
 
 	if( !window->private->dispose_has_run ){
 
-		if( window->private->parent ){
-			g_assert( BASE_IS_WINDOW( window->private->parent ));
-			parent_toplevel = base_window_get_toplevel( BASE_WINDOW( window->private->parent ));
-			gtk_window_set_transient_for( window->private->toplevel_window, parent_toplevel );
-		}
-
 		base_iprefs_position_window( window );
 	}
 }
@@ -983,12 +976,24 @@ static void
 window_do_initial_load_toplevel( BaseWindow *window, gpointer user_data )
 {
 	static const gchar *thisfn = "base_window_do_initial_load_toplevel";
+	GtkWindow *parent_toplevel;
 
 	g_debug( "%s: window=%p, user_data=%p", thisfn, ( void * ) window, ( void * ) user_data );
 	g_return_if_fail( BASE_IS_WINDOW( window ));
 
 	if( !window->private->dispose_has_run ){
-		/* nothing to do here */
+
+		g_debug( "%s: parent=%p (%s)", thisfn,
+				( void * ) window->private->parent,
+				window->private->parent ? G_OBJECT_TYPE_NAME( window->private->parent ) : "(null)" );
+
+		if( window->private->parent ){
+
+			g_assert( BASE_IS_WINDOW( window->private->parent ));
+			parent_toplevel = base_window_get_toplevel( BASE_WINDOW( window->private->parent ));
+			g_debug( "%s: toplevel=%p, parent_toplevel=%p", thisfn, ( void * ) window->private->toplevel_window, ( void * ) parent_toplevel );
+			gtk_window_set_transient_for( window->private->toplevel_window, parent_toplevel );
+		}
 	}
 }
 
diff --git a/src/nact/nact-assistant-import-ask.c b/src/nact/nact-assistant-import-ask.c
index f8206d3..31b84e2 100644
--- a/src/nact/nact-assistant-import-ask.c
+++ b/src/nact/nact-assistant-import-ask.c
@@ -68,7 +68,7 @@ static void  instance_init( GTypeInstance *instance, gpointer klass );
 static void  instance_dispose( GObject *dialog );
 static void  instance_finalize( GObject *dialog );
 
-static NactAssistantImportAsk *assistant_import_ask_new( NactApplication *application );
+static NactAssistantImportAsk *assistant_import_ask_new( BaseWindow *parent );
 
 static gchar   *base_get_iprefs_window_id( BaseWindow *window );
 static gchar   *base_get_dialog_name( BaseWindow *window );
@@ -216,9 +216,9 @@ instance_finalize( GObject *dialog )
  * Returns a newly allocated NactAssistantImportAsk object.
  */
 static NactAssistantImportAsk *
-assistant_import_ask_new( NactApplication *application )
+assistant_import_ask_new( BaseWindow *parent )
 {
-	return( g_object_new( NACT_ASSISTANT_IMPORT_ASK_TYPE, BASE_WINDOW_PROP_APPLICATION, application, NULL ));
+	return( g_object_new( NACT_ASSISTANT_IMPORT_ASK_TYPE, BASE_WINDOW_PROP_PARENT, parent, NULL ));
 }
 
 /**
@@ -255,7 +255,7 @@ nact_assistant_import_ask_user( NactMainWindow *parent, const gchar *uri, NAObje
 	pivot = nact_application_get_pivot( application );
 	g_return_val_if_fail( NA_IS_PIVOT( pivot ), IPREFS_IMPORT_NO_IMPORT );
 
-	editor = assistant_import_ask_new( application );
+	editor = assistant_import_ask_new( BASE_WINDOW( parent ));
 	editor->private->parent = parent;
 	editor->private->uri = uri;
 	editor->private->action = action;
@@ -293,12 +293,10 @@ nact_assistant_import_ask_user( NactMainWindow *parent, const gchar *uri, NAObje
 void
 nact_assistant_import_ask_reset_keep_mode( NactMainWindow *parent )
 {
-	NactApplication *application;
 	NactAssistantImportAsk *editor;
 	GtkWindow *window;
 
-	application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( parent )));
-	editor = assistant_import_ask_new( application );
+	editor = assistant_import_ask_new( BASE_WINDOW( parent ));
 
 	if( base_window_init( BASE_WINDOW( editor ))){
 		g_object_get( G_OBJECT( editor ), BASE_WINDOW_PROP_TOPLEVEL_WIDGET, &window, NULL );
@@ -324,8 +322,6 @@ static void
 on_base_initial_load_dialog( NactAssistantImportAsk *editor, gpointer user_data )
 {
 	static const gchar *thisfn = "nact_assistant_import_ask_on_initial_load_dialog";
-	/*GtkWindow *toplevel;
-	GtkWindow *parent_toplevel;*/
 
 	g_debug( "%s: editor=%p, user_data=%p", thisfn, ( void * ) editor, ( void * ) user_data );
 	g_return_if_fail( NACT_IS_ASSISTANT_IMPORT_ASK( editor ));
diff --git a/src/nact/nautilus-actions-config-tool.ui b/src/nact/nautilus-actions-config-tool.ui
index db1f2e4..42afff6 100644
--- a/src/nact/nautilus-actions-config-tool.ui
+++ b/src/nact/nautilus-actions-config-tool.ui
@@ -2105,8 +2105,7 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
   <object class="GtkDialog" id="AssistantImportAsk">
     <property name="border_width">5</property>
     <property name="title" translatable="yes">Already existing action</property>
-    <property name="modal">True</property>
-    <property name="type_hint">normal</property>
+    <property name="type_hint">dialog</property>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox2">
         <property name="visible">True</property>



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