[nautilus-actions] Remove nact-iactions-list-item-updated signal



commit 37ab074d3f158ff69502abcfbd6bede45e3eb307
Author: pierre <pierre vfedora10 virtuals pwi>
Date:   Mon Sep 28 12:14:48 2009 +0200

    Remove nact-iactions-list-item-updated signal

 ChangeLog                     |    3 ++
 src/nact/nact-iactions-list.c |   69 ++++++++---------------------------------
 src/nact/nact-iactions-list.h |   18 ++++++-----
 src/nact/nact-main-window.c   |    6 +--
 4 files changed, 28 insertions(+), 68 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b6e4191..cd2476d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,11 +20,14 @@
 
 	* src/nact/nact-main-window.c (nact_main_window_action_exists):
 	No more check for action existancy in NAPivot.
+	No more forward nact-tab-updatable-item-updated signal.
 
 	* src/nact/nact-iactions-list.c:
 	* src/nact/nact-iactions-list.h
 	(nact_iactions_list_collapse_all, nact_iactions_list_expand_all):
 	New functions.
+	Remove useless nact-iactions-list-item-updated signal.
+	Connect instead to nact-tab-updatable-item-updated signal.
 
 	* src/nact/nact-main-menubar.c (on_duplicate_activated):
 	Takes advantage of new UI preferences.
diff --git a/src/nact/nact-iactions-list.c b/src/nact/nact-iactions-list.c
index e180eec..8e4d376 100644
--- a/src/nact/nact-iactions-list.c
+++ b/src/nact/nact-iactions-list.c
@@ -58,7 +58,6 @@ struct NactIActionsListInterfacePrivate {
  */
 enum {
 	SELECTION_CHANGED,
-	ITEM_UPDATED,
 	LAST_SIGNAL
 };
 
@@ -141,8 +140,7 @@ static gboolean     on_button_press_event( GtkWidget *widget, GdkEventButton *ev
 static void         on_edition_status_changed( NactIActionsList *instance, NAIDuplicable *object );
 static gboolean     on_key_pressed_event( GtkWidget *widget, GdkEventKey *event, NactIActionsList *instance );
 static void         on_treeview_selection_changed( GtkTreeSelection *selection, NactIActionsList *instance );
-static void         on_iactions_list_item_updated( NactIActionsList *instance, NAObject *object );
-static void         on_iactions_list_item_updated_treeview( NactIActionsList *instance, NAObject *object );
+static void         on_tab_updatable_item_updated( NactIActionsList *instance, NAObject *object );
 static void         on_iactions_list_selection_changed( NactIActionsList *instance, GSList *selected_items );
 static void         select_first_row( NactIActionsList *instance );
 static void         select_row_at_path( NactIActionsList *instance, GtkTreeView *treeview, GtkTreeModel *model, GtkTreePath *path );
@@ -203,12 +201,12 @@ interface_base_init( NactIActionsListInterface *klass )
 		/**
 		 * nact-iactions-list-selection-changed:
 		 *
-		 * This signal is emitted byIActionsList, in response to the
-		 * "changed" Gtk signal, each time the selection has changed
-		 * in the treeview.
+		 * This signal is emitted byIActionsList to its implementor,
+		 * in response to the "changed" Gtk signal, each time the
+		 * selection has changed in the treeview.
 		 *
-		 * This let us add the the currently selected items as user_data.
-		 * (see #on_treeview_selection_changed()).
+		 * It is not just a proxy, as we add a list of currently selected
+		 * objects as user_data (see #on_treeview_selection_changed()).
 		 *
 		 * Note that IActionsList is itself connected to this signal,
 		 * in order to convert the signal to an interface API
@@ -231,31 +229,6 @@ interface_base_init( NactIActionsListInterface *klass )
 				1,
 				G_TYPE_POINTER );
 
-		/**
-		 * nact-iactions-list-item-updated:
-		 *
-		 * This signal is emitted by the main window, in response to the
-		 * similar signal emitted by each notebook's tab when an entry
-		 * has been modified.
-		 *
-		 * After having dealing with the message, the main window
-		 * forwards the information to IActionsList with this message.
-		 *
-		 * User_data is a pointer to the modified #NAObject. It is owned
-		 * by the tab who had initially sent the message.
-		 */
-		st_signals[ ITEM_UPDATED ] = g_signal_new_class_handler(
-				IACTIONS_LIST_SIGNAL_ITEM_UPDATED,
-				G_TYPE_OBJECT,
-				G_SIGNAL_RUN_LAST,
-				G_CALLBACK( on_iactions_list_item_updated ),
-				NULL,
-				NULL,
-				g_cclosure_marshal_VOID__POINTER,
-				G_TYPE_NONE,
-				1,
-				G_TYPE_POINTER );
-
 		st_initialized = TRUE;
 	}
 }
@@ -407,15 +380,8 @@ nact_iactions_list_runtime_init_toplevel( NactIActionsList *instance, GList *ite
 		base_window_signal_connect(
 				BASE_WINDOW( instance ),
 				G_OBJECT( instance ),
-				IACTIONS_LIST_SIGNAL_ITEM_UPDATED,
-				G_CALLBACK( on_iactions_list_item_updated_treeview ));
-
-		/* install a virtual function as 'item-updated' handler */
-		base_window_signal_connect(
-				BASE_WINDOW( instance ),
-				G_OBJECT( instance ),
-				IACTIONS_LIST_SIGNAL_ITEM_UPDATED,
-				G_CALLBACK( on_iactions_list_item_updated ));
+				TAB_UPDATABLE_SIGNAL_ITEM_UPDATED,
+				G_CALLBACK( on_tab_updatable_item_updated ));
 
 		/* records NactIActionsList as a proxy for edition status modification
 		 */
@@ -1475,29 +1441,20 @@ on_treeview_selection_changed( GtkTreeSelection *selection, NactIActionsList *in
 }
 
 /*
- * our handler for "item-updated" emitted whan an item is modified
- * this let us transform the signal in a virtual function
- * so that our implementors have the best of two worlds ;-)
- */
-static void
-on_iactions_list_item_updated( NactIActionsList *instance, NAObject *object )
-{
-	if( NACT_IACTIONS_LIST_GET_INTERFACE( instance )->item_updated ){
-		NACT_IACTIONS_LIST_GET_INTERFACE( instance )->item_updated( instance, object );
-	}
-}
-
-/*
  * an item has been updated in one of the tabs
  * update the treeview to reflects its new edition status
  */
 static void
-on_iactions_list_item_updated_treeview( NactIActionsList *instance, NAObject *object )
+on_tab_updatable_item_updated( NactIActionsList *instance, NAObject *object )
 {
+	static const gchar *thisfn = "nact_iactions_list_on_tab_updatable_item_updated";
 	NAObject *item;
 	GtkTreeView *treeview;
 	GtkTreeModel *model;
 
+	g_debug( "%s: instance=%p, object=%p (%s)", thisfn,
+			( void * ) instance, ( void * ) object, G_OBJECT_TYPE_NAME( object ));
+
 	if( object ){
 		treeview = get_actions_list_treeview( instance );
 		model = gtk_tree_view_get_model( treeview );
diff --git a/src/nact/nact-iactions-list.h b/src/nact/nact-iactions-list.h
index f40140f..c90c420 100644
--- a/src/nact/nact-iactions-list.h
+++ b/src/nact/nact-iactions-list.h
@@ -61,22 +61,24 @@ typedef struct {
 	 * selection_changed:
 	 * @instance: this #NactIActionsList instance.
 	 * @selected_items: currently selected items.
+	 *
+	 * This function is an exact duplicate of the
+	 * "nact-iactions-list-selection-changed" signal. Implementor may
+	 * choose to to connect to the signal, or to implement this api, in
+	 * order to be triggered when the selection is modified in the
+	 * treeview.
+	 *
+	 * Be warned that both implementing the api and connecting to the
+	 * signal must be considered at least as useless, and just a way to
+	 * be triggered twice for the same event.
 	 */
 	void ( *selection_changed )( NactIActionsList *instance, GSList *selected_items );
-
-	/**
-	 * item_updated:
-	 * @instance: this #NactIActionsList instance.
-	 * @object: the modified #NAObject.
-	 */
-	void ( *item_updated )     ( NactIActionsList *instance, NAObject *object );
 }
 	NactIActionsListInterface;
 
 /* signals
  */
 #define IACTIONS_LIST_SIGNAL_SELECTION_CHANGED			"nact-iactions-list-selection-changed"
-#define IACTIONS_LIST_SIGNAL_ITEM_UPDATED				"nact-iactions-list-item-updated"
 
 /* management modes
  * - edition: dnd, filter, multiple selection, item updated signal
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index 8bd1cb9..399d0ca 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -1029,14 +1029,12 @@ set_current_profile( NactMainWindow *window, gboolean set_action, GSList *select
 static void
 on_tab_updatable_item_updated( NactMainWindow *window, gpointer user_data )
 {
-	static const gchar *thisfn = "nact_main_window_on_tab_updatable_item_updated";
+	/*static const gchar *thisfn = "nact_main_window_on_tab_updatable_item_updated";*/
 
-	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 );*/
 	g_return_if_fail( NACT_IS_MAIN_WINDOW( window ));
 
 	if( !window->private->dispose_has_run ){
-
-		g_signal_emit_by_name( window, IACTIONS_LIST_SIGNAL_ITEM_UPDATED, user_data );
 	}
 }
 



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