[nautilus-actions/gnome-2-28] Fix crash when running Export assistant



commit 20508fcd5d7696c66fa3869a89aac04da917ab1f
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon Oct 26 05:50:15 2009 +0100

    Fix crash when running Export assistant
    
    NactTreeModel takes a NactWindow as an argument instead of NactMainWindow.
    NAIPrefs interface implementation is moved from NactMainWindow to NactWindow.

 ChangeLog                     |   17 +++++++++++++++++
 src/nact/nact-iactions-list.c |    4 ++--
 src/nact/nact-main-window.c   |   17 -----------------
 src/nact/nact-tree-model.c    |   18 +++++++++---------
 src/nact/nact-tree-model.h    |    6 +++---
 src/nact/nact-window.c        |   18 ++++++++++++++++++
 6 files changed, 49 insertions(+), 31 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 09004a9..45354d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2009-10-26 Pierre Wieser <pwieser trychlos org>
 
+	Fix crash when running Export assistant.
+
+	* src/nact/nact-tree-model.c:
+	* src/nact/nact-tree-model.h
+	(nact_tree_model_new, nact_tree_model_runtime_init_dnd):
+	Takes a NactWindow as argument instead of NactMainWindow.
+
+	* src/nact/nact-iactions-list.c
+	(nact_iactions_list_initial_load, nact_iactions_list_runtime_init):
+	Updated accordingly.
+
+	* src/nact/nact-main-window.c (register_type):
+	No more implements the NAIPrefs interface (moved to NactWindow).
+
+	* src/nact/nact-window.c (register_type):
+	Implements NAIPrefs interface.
+
 	* src/nact/nact-assistant-export.ui:
 	* src/nact/nautilus-actions-config-tool.ui:
 	Remove terminating dot from radio button labels.
diff --git a/src/nact/nact-iactions-list.c b/src/nact/nact-iactions-list.c
index 2693319..7b0fa23 100644
--- a/src/nact/nact-iactions-list.c
+++ b/src/nact/nact-iactions-list.c
@@ -177,7 +177,7 @@ nact_iactions_list_initial_load( NactWindow *window )
 	nact_iactions_list_set_send_selection_changed_on_fill_list( window, FALSE );
 	nact_iactions_list_set_is_filling_list( window, FALSE );
 
-	model = nact_tree_model_new( NACT_MAIN_WINDOW( window ));
+	model = nact_tree_model_new( window );
 	gtk_tree_view_set_model( GTK_TREE_VIEW( widget ), GTK_TREE_MODEL( model ));
 	gtk_tree_view_set_enable_tree_lines( GTK_TREE_VIEW( widget ), TRUE );
 	g_object_unref( model );
@@ -217,7 +217,7 @@ nact_iactions_list_runtime_init( NactWindow *window )
 	g_assert( GTK_IS_WIDGET( widget ));
 
 	nact_iactions_list_fill( window, TRUE );
-	nact_tree_model_runtime_init_dnd( NACT_MAIN_WINDOW( window ), GTK_TREE_VIEW( widget ));
+	nact_tree_model_runtime_init_dnd( window, GTK_TREE_VIEW( widget ));
 
 	/* set up selection control */
 	nact_window_signal_connect(
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index d253804..f82fa8f 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -84,7 +84,6 @@ static void             iconditions_tab_iface_init( NactIConditionsTabInterface
 static void             iadvanced_tab_iface_init( NactIAdvancedTabInterface *iface );
 static void             imenubar_iface_init( NactIMenubarInterface *iface );
 static void             ipivot_consumer_iface_init( NAIPivotConsumerInterface *iface );
-static void             iprefs_iface_init( NAIPrefsInterface *iface );
 static void             instance_init( GTypeInstance *instance, gpointer klass );
 static void             instance_dispose( GObject *application );
 static void             instance_finalize( GObject *application );
@@ -204,12 +203,6 @@ register_type( void )
 		NULL
 	};
 
-	static const GInterfaceInfo iprefs_iface_info = {
-		( GInterfaceInitFunc ) iprefs_iface_init,
-		NULL,
-		NULL
-	};
-
 	g_debug( "%s", thisfn );
 
 	type = g_type_register_static( NACT_WINDOW_TYPE, "NactMainWindow", &info, 0 );
@@ -228,8 +221,6 @@ register_type( void )
 
 	g_type_add_interface_static( type, NA_IPIVOT_CONSUMER_TYPE, &ipivot_consumer_iface_info );
 
-	g_type_add_interface_static( type, NA_IPREFS_TYPE, &iprefs_iface_info );
-
 	return( type );
 }
 
@@ -361,14 +352,6 @@ ipivot_consumer_iface_init( NAIPivotConsumerInterface *iface )
 }
 
 static void
-iprefs_iface_init( NAIPrefsInterface *iface )
-{
-	static const gchar *thisfn = "nact_main_window_iprefs_iface_init";
-
-	g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
-}
-
-static void
 instance_init( GTypeInstance *instance, gpointer klass )
 {
 	static const gchar *thisfn = "nact_main_window_instance_init";
diff --git a/src/nact/nact-tree-model.c b/src/nact/nact-tree-model.c
index a35d8da..ec37936 100644
--- a/src/nact/nact-tree-model.c
+++ b/src/nact/nact-tree-model.c
@@ -75,10 +75,10 @@ struct NactTreeModelClassPrivate {
 /* private instance data
  */
 struct NactTreeModelPrivate {
-	gboolean        dispose_has_run;
-	NactMainWindow *window;
-	gchar          *drag_dest_uri;
-	GSList         *drag_items;
+	gboolean    dispose_has_run;
+	NactWindow *window;
+	gchar      *drag_dest_uri;
+	GSList     *drag_items;
 };
 
 #define MAX_XDS_ATOM_VAL_LEN			4096
@@ -296,7 +296,7 @@ instance_finalize( GObject *object )
 }
 
 NactTreeModel *
-nact_tree_model_new( NactMainWindow *window )
+nact_tree_model_new( NactWindow *window )
 {
 	GtkTreeStore  *ts_model;
 	NactTreeModel *model;
@@ -331,7 +331,7 @@ nact_tree_model_new( NactMainWindow *window )
 
 /**
  * nact_tree_model_runtime_init_dnd:
- * @window: the #NactMainWindow window.
+ * @window: the #NactWindow window.
  * @widget: the #GtkTreeView which implements this #NactTreeModel.
  *
  * Initializes the drag & drop features.
@@ -343,7 +343,7 @@ nact_tree_model_new( NactMainWindow *window )
  * - from outside world (e.g. Nautilus) to import actions
  */
 void
-nact_tree_model_runtime_init_dnd( NactMainWindow *window, GtkTreeView *widget )
+nact_tree_model_runtime_init_dnd( NactWindow *window, GtkTreeView *widget )
 {
 	NactTreeModel *model;
 
@@ -351,13 +351,13 @@ nact_tree_model_runtime_init_dnd( NactMainWindow *window, GtkTreeView *widget )
 	g_assert( NACT_IS_TREE_MODEL( model ));
 
 	nact_window_signal_connect(
-			NACT_WINDOW( window ),
+			window,
 			G_OBJECT( widget ),
 			"drag_begin",
 			G_CALLBACK( on_drag_begin ));
 
 	nact_window_signal_connect(
-			NACT_WINDOW( window ),
+			window,
 			G_OBJECT( widget ),
 			"drag_end",
 			G_CALLBACK( on_drag_end ));
diff --git a/src/nact/nact-tree-model.h b/src/nact/nact-tree-model.h
index a2b773c..23430ec 100644
--- a/src/nact/nact-tree-model.h
+++ b/src/nact/nact-tree-model.h
@@ -49,7 +49,7 @@
 
 #include <gtk/gtk.h>
 
-#include "nact-main-window.h"
+#include "nact-window.h"
 
 G_BEGIN_DECLS
 
@@ -87,8 +87,8 @@ enum {
 
 GType          nact_tree_model_get_type( void );
 
-NactTreeModel *nact_tree_model_new( NactMainWindow *window );
-void           nact_tree_model_runtime_init_dnd( NactMainWindow *window, GtkTreeView *widget );
+NactTreeModel *nact_tree_model_new( NactWindow *window );
+void           nact_tree_model_runtime_init_dnd( NactWindow *window, GtkTreeView *widget );
 
 G_END_DECLS
 
diff --git a/src/nact/nact-window.c b/src/nact/nact-window.c
index 0f6cdec..ea54b64 100644
--- a/src/nact/nact-window.c
+++ b/src/nact/nact-window.c
@@ -36,6 +36,7 @@
 #include <glib/gi18n.h>
 
 #include <common/na-iio-provider.h>
+#include <common/na-iprefs.h>
 
 #include "nact-application.h"
 #include "nact-iprefs.h"
@@ -68,6 +69,7 @@ static gboolean      st_debug_signal_connect = TRUE;
 static GType    register_type( void );
 static void     class_init( NactWindowClass *klass );
 static void     iprefs_iface_init( NactIPrefsInterface *iface );
+static void     iprefs_common_iface_init( NAIPrefsInterface *iface );
 static void     instance_init( GTypeInstance *instance, gpointer klass );
 static void     instance_dispose( GObject *application );
 static void     instance_finalize( GObject *application );
@@ -113,12 +115,20 @@ register_type( void )
 		NULL
 	};
 
+	static const GInterfaceInfo iprefs_common_iface_info = {
+		( GInterfaceInitFunc ) iprefs_common_iface_init,
+		NULL,
+		NULL
+	};
+
 	g_debug( "%s", thisfn );
 
 	type = g_type_register_static( BASE_WINDOW_TYPE, "NactWindow", &info, 0 );
 
 	g_type_add_interface_static( type, NACT_IPREFS_TYPE, &prefs_iface_info );
 
+	g_type_add_interface_static( type, NA_IPREFS_TYPE, &iprefs_common_iface_info );
+
 	return( type );
 }
 
@@ -157,6 +167,14 @@ iprefs_iface_init( NactIPrefsInterface *iface )
 }
 
 static void
+iprefs_common_iface_init( NAIPrefsInterface *iface )
+{
+	static const gchar *thisfn = "nact_window_iprefs_common_iface_init";
+
+	g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
+}
+
+static void
 instance_init( GTypeInstance *instance, gpointer klass )
 {
 	static const gchar *thisfn = "nact_window_instance_init";



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