[nautilus-actions] Get rid of TREE_SIGNAL_SELECTION_CHANGED signal
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Get rid of TREE_SIGNAL_SELECTION_CHANGED signal
- Date: Tue, 14 Feb 2012 17:40:00 +0000 (UTC)
commit 626b723c78458e0b195f16c92c88a23c2c546f2e
Author: Pierre Wieser <pwieser trychlos org>
Date: Tue Feb 14 10:16:21 2012 +0100
Get rid of TREE_SIGNAL_SELECTION_CHANGED signal
ChangeLog | 11 ++
src/nact/nact-assistant-export.c | 2 +-
src/nact/nact-main-window.c | 7 +-
src/nact/nact-main-window.h | 203 +++++++++++++++-----------------------
src/nact/nact-menubar.c | 2 +-
src/nact/nact-tree-view.c | 44 +--------
src/nact/nact-tree-view.h | 1 -
7 files changed, 97 insertions(+), 173 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 27eacca..c537958 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2012-02-14 Pierre Wieser <pwieser trychlos org>
+ * src/nact/nact-main-window.h:
+ * src/nact/nact-main-window.c
+ (on_base_initialize_window, on_tree_view_selection_changed):
+ * src/nact/nact-assistant-export.c (on_base_all_widgets_showed):
+ * src/nact/nact-menubar.c (on_base_initialize_window):
+ * src/nact/nact-tree-view.c (class_init, on_selection_changed):
+ * src/nact/nact-tree-view.h:
+ Get rid of TREE_SIGNAL_SELECTION_CHANGED signal, only using
+ MAIN_SIGNAL_SELECTION_CHANGED one, based on the assertion that the
+ NactMainWindow will be the first triggered handler.
+
* src/nact/nact-tree-view.c (get_selected_items): Improve debug message.
* src/nact/nact-menubar.c (instance_dispose,
diff --git a/src/nact/nact-assistant-export.c b/src/nact/nact-assistant-export.c
index d73f92c..ee86cba 100644
--- a/src/nact/nact-assistant-export.c
+++ b/src/nact/nact-assistant-export.c
@@ -570,7 +570,7 @@ on_base_all_widgets_showed( NactAssistantExport *window, gpointer user_data )
base_window_signal_connect(
BASE_WINDOW( window ),
G_OBJECT( window ),
- TREE_SIGNAL_SELECTION_CHANGED,
+ MAIN_SIGNAL_SELECTION_CHANGED,
G_CALLBACK( on_items_tree_view_selection_changed ));
/* select the first row
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index eb2e537..fca02b8 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -924,7 +924,7 @@ on_base_initialize_window( NactMainWindow *window, gpointer user_data )
base_window_signal_connect(
BASE_WINDOW( window ),
G_OBJECT( window ),
- TREE_SIGNAL_SELECTION_CHANGED,
+ MAIN_SIGNAL_SELECTION_CHANGED,
G_CALLBACK( on_tree_view_selection_changed ));
base_window_signal_connect(
@@ -947,8 +947,6 @@ on_base_show_widgets( NactMainWindow *window, gpointer user_data )
static const gchar *thisfn = "nact_main_window_on_base_show_widgets";
g_return_if_fail( NACT_IS_MAIN_WINDOW( window ));
- g_return_if_fail( NACT_IS_IEXECUTION_TAB( window ));
- g_return_if_fail( NACT_IS_IPROPERTIES_TAB( window ));
if( !window->private->dispose_has_run ){
@@ -1104,9 +1102,6 @@ on_tree_view_selection_changed( NactMainWindow *window, GList *selected_items, g
}
setup_dialog_title( window );
-
- g_signal_emit_by_name( G_OBJECT( window ),
- MAIN_SIGNAL_SELECTION_CHANGED, na_object_copyref_items( selected_items ));
}
}
diff --git a/src/nact/nact-main-window.h b/src/nact/nact-main-window.h
index 66eb436..b054e53 100644
--- a/src/nact/nact-main-window.h
+++ b/src/nact/nact-main-window.h
@@ -53,11 +53,11 @@
* | |
* | +-> NactMainWindow::instance_contructed()
* | | |
- * | | +-> connect to base-init-gtk-toplevel [window]
- * | | | base-init-window [window]
- * | | | base-all-widgets-showed [window]
- * | | | pivot-items-changed [updater]
- * | | | tab-item-updated [window]
+ * | | +-> connect to base-init-gtk [window]
+ * | | | base-init-window [window]
+ * | | | base-show-widgets [window]
+ * | | | pivot-items-changed [updater]
+ * | | | tab-item-updated [window]
* | | |
* | | +-> nact_menubar_new()
* | | | |
@@ -71,143 +71,102 @@
* | | |
* | | +-> nact_clipboard_new()
* | | |
+ * | | +-> initialize each notebook tab
+ * | | |
+ * | | | NactMainWindow has connected to "base-init-window" signal _before_
+ * | | | other widgets have been created or initialized. We so are sure that
+ * | | | the NactMainWindow handlers will be called first.
* | | <-
- * | <-
- * |
- * +-> base_application_run()
* | |
* | +-> base_window_init()
* | | |
* | | +-> setup builder
* | | +-> load gtk toplevel
- * | | +-> emit signal base-initial-load-gtk-toplevel
+ * | | +-> emit signal base-initialize-gtk
* | | |
- * | | | X-> NactMainWindow::on_base_initialize_gtk_toplevel()
- * | | | |
- * | | | +-> nact_tree_view_new()
- * | | | | |
- * | | | | +-> NactTreeView::instance_contructed()
- * | | | | | |
- * | | | | | +- connect to base-init-window [window]
- * | | | | | | base-all-widgets-showed [window]
- * | | | | | <-
- * | | | | <-
- * | | | |
- * | | | +- connect to tree-selection-changed
- * | | | | tree-modified-status-changed
- * | | | |
- * | | | +- nact_iaction_tab_initial_load_toplevel()
- * | | | +- nact_icommand_tab_initial_load_toplevel()
- * | | | +- nact_ibasenames_tab_initial_load_toplevel()
- * | | | +- nact_imimetypes_tab_initial_load_toplevel()
- * | | | +- nact_ifolders_tab_initial_load_toplevel()
- * | | | +- nact_ischemes_tab_initial_load_toplevel()
- * | | | +- nact_icapabilities_tab_initial_load_toplevel()
- * | | | +- nact_ienvironment_tab_initial_load_toplevel()
- * | | | +- nact_iexecution_tab_initial_load_toplevel()
- * | | | +- nact_iproperties_tab_initial_load_toplevel()
- * | | | |
- * | | | +- nact_main_statusbar_initialize_load_toplevel()
- * | | <-
- * | |
- * | +-> base_window_run()
+ * | | | [H]-> NactMainWindow::on_base_initialize_gtk()
+ * | | | |
+ * | | | +-> nact_tree_view_new()
+ * | | | | |
+ * | | | | +-> NactTreeView::instance_contructed()
+ * | | | | | |
+ * | | | | | +-> connect to base-init-window [window]
+ * | | | | | | base-show-widgets [window]
+ * | | | | | |
+ * | | | | | +-> initialize_gtk()
+ * | | | | | | |
+ * | | | | | | +-> nact_tree_model_new()
+ * | | | | | | | |
+ * | | | | | | | +-> NactTreeModel::nact_tree_model_new()
+ * | | | | | | | |
+ * | | | | | | | <-
+ * | | | | | | <-
+ * | | | | | <-
+ * | | | | <-
+ * | | | |
+ * | | | +-> nact_main_statusbar_initialize_load_toplevel()
* | | |
- * | | +-> emit signal base-runtime-init
+ * | | | [H]-> NactIxxxxxxTab::on_base_initialize_gtk()
* | | |
- * | | | X-> NactMainWindow::on_base_initialize_base_window()
- * | | | |
- * | | | +- nact_iaction_tab_runtime_init_toplevel()
- * | | | +- nact_icommand_tab_runtime_init_toplevel()
- * | | | +- nact_ibasenames_tab_runtime_init_toplevel()
- * | | | +- nact_imimetypes_tab_runtime_init_toplevel()
- * | | | +- nact_ifolders_tab_runtime_init_toplevel()
- * | | | +- nact_ischemes_tab_runtime_init_toplevel()
- * | | | +- nact_icapabilities_tab_runtime_init_toplevel()
- * | | | +- nact_ienvironment_tab_runtime_init_toplevel()
- * | | | +- nact_iexecution_tab_runtime_init_toplevel()
- * | | | +- nact_iproperties_tab_runtime_init_toplevel()
- * | | | |
- * | | | +- connect to delete-event
- * | | | | base-willing-to-quit
- * | | | <-
+ * | | +-> emit signal base-initialize-window
* | | |
- * | | | X-> NactTreeView::on_base_initialize_gtk()
- * | | | | cf. nact-tree-view.c for why this is only called now
- * | | | |
- * | | | +-> nact_tree_model_new()
- * | | | | |
- * | | | | +-> NactTreeModel::nact_tree_model_new()
- * | | | | | |
- * | | | | | +- attach the model to the view
- * | | | | | +- on_initialize_model()
- * | | | | | | |
- * | | | | | | +-> connect to dnd event
- * | | | | | | |
- * | | | | | | <-
- * | | | | | <-
- * | | | | <-
- * | | | <-
+ * | | | [H]-> NactMainWindow::on_base_initialize_base_window()
+ * | | | |
+ * | | | +-> connect to delete-event
+ * | | | | base-quit-requested
+ * | | | |
+ * | | | +-> connect to tree-selection-changed
+ * | | | | tree-modified-status-changed
+ * | | | |
+ * | | | | Because NactMainWindow was the first class to connect to
+ * | | | | "base-initialize-window" signal, then this handler has been
+ * | | | | the first to be called. And so the "tree-selection-changed"
+ * | | | | signal handler will also the first to be called, and we can
+ * | | | | safely rely on that.
+ * | | | <-
* | | |
- * | | | X-> NactTreeView::on_base_initialize_view()
- * | | | |
- * | | | +- connect to selection-changed [selection]
- * | | | |
- * | | | +- nact_tree_ieditable_initialize()
- * | | | |
- * | | | <-
+ * | | | [H]-> NactIxxxxxxTab::on_base_initialize_window()
* | | |
+ * | | | [H]-> NactTreeView::on_base_initialize_view()
+ * | | | |
+ * | | | +-> monitors the selection in the tree
+ * | | | | in order to be able to send the "tree-selection-changed" signal
+ * | | | |
+ * | | | +- nact_tree_ieditable_initialize()
+ * | | | |
+ * | | | <-
* | | |
- * | | +-> gtk_widget_show_all()
- * | | +-> emit signal base-all-widgets-showed
+ * | | +-> emit signal base-show-widgets
* | | |
- * | | | X-> NactMainWindow::on_base_all_widgets_showed()
- * | | | |
- * | | | +- nact_iaction_tab_all_widgets_showed()
- * | | | +- nact_icommand_tab_all_widgets_showed()
- * | | | +- nact_ibasenames_tab_all_widgets_showed()
- * | | | +- nact_imimetypes_tab_all_widgets_showed()
- * | | | +- nact_ifolders_tab_all_widgets_showed()
- * | | | +- nact_ischemes_tab_all_widgets_showed()
- * | | | +- nact_icapabilities_tab_all_widgets_showed()
- * | | | +- nact_ienvironment_tab_all_widgets_showed()
- * | | | +- nact_iexecution_tab_all_widgets_showed()
- * | | | +- nact_iproperties_tab_all_widgets_showed()
- * | | | |
- * | | | +- load items from pivot
+ * | | | [H]-> NactMainWindow::on_base_show_widgets()
+ * | | | |
+ * | | | +-> load items from pivot
+ * | | |
+ * | | | [H]-> NactIxxxxxxTab::on_base_show_widgets()
+ * | | |
+ * | | +-> gtk_widget_show_all()
* | | |
- * | | +-> BaseWindowClass:run()
- * | | | |
- * | | | +-> do_run()
- * | | | | |
- * | | | | +-> gtk_main()
- * | | | |
- * | | | <-
* | | <-
* | <-
* |
+ * +-> gtk_main()
+ * |
* [X] End of initialization process
*
- * Signals, their rules and uses
+ * Some signals and their usages
* =============================
- * TREE_SIGNAL_SELECTION_CHANGED
- * The signal is sent on the BaseWindow by the tree view each time the selection
- * changes.
- * Args:
- * - the list of selected items, may be NULL.
- * Consumers:
- * - the main window updates its 'current' properties, then send the
- * MAIN_SIGNAL_SELECTION_CHANGED signal
- * - the menubar updates its indicator depending of the current selection
- *
* MAIN_SIGNAL_SELECTION_CHANGED
- * The signal is sent on the BaseWindow by the main window when the selection has
- * changed. 'current' main window properties have been set to reflect this new
+ * The signal is sent by the tree view on the BaseWindow each time the
+ * selection has changed. By construction (cf. initialization process),
+ * the main window handler is the first to be triggered by this signal:
+ * it sets the 'current' main window properties to reflect this new
* selection.
* Args:
* - the list of selected items, may be NULL.
* Consumers:
- * - All tabs should take advantage of this signal to enable/disable their
- * page, setup the content of their widgets, and so on.
+ * - all tabs should take advantage of this signal to enable/disable
+ * their page, setup the content of their widgets, and so on.
+ * - the menubar updates its indicator depending of the current selection
*
* TAB_UPDATABLE_SIGNAL_ITEM_UPDATED
* The signal is sent on the BaseWindow each time a widget is updated; the widget
diff --git a/src/nact/nact-menubar.c b/src/nact/nact-menubar.c
index 5e2b68a..ff45224 100644
--- a/src/nact/nact-menubar.c
+++ b/src/nact/nact-menubar.c
@@ -550,7 +550,7 @@ on_base_initialize_window( BaseWindow *window, gpointer user_data )
base_window_signal_connect(
window,
G_OBJECT( window ),
- TREE_SIGNAL_SELECTION_CHANGED,
+ MAIN_SIGNAL_SELECTION_CHANGED,
G_CALLBACK( on_tree_view_selection_changed ));
base_window_signal_connect(
diff --git a/src/nact/nact-tree-view.c b/src/nact/nact-tree-view.c
index 6c01751..8fd4088 100644
--- a/src/nact/nact-tree-view.c
+++ b/src/nact/nact-tree-view.c
@@ -133,7 +133,6 @@ static gboolean on_focus_out( GtkWidget *widget, GdkEventFocus *event, BaseWin
static gboolean on_key_pressed_event( GtkWidget *widget, GdkEventKey *event, BaseWindow *window );
static gboolean on_popup_menu( GtkWidget *widget, BaseWindow *window );
static void on_selection_changed( GtkTreeSelection *selection, BaseWindow *window );
-static void on_selection_changed_cleanup_handler( BaseWindow *window, GList *selected_items );
static void on_tree_view_realized( GtkWidget *treeview, BaseWindow *window );
static void clear_selection( NactTreeView *view );
static void display_label( GtkTreeViewColumn *column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, NactTreeView *view );
@@ -396,30 +395,6 @@ class_init( NactTreeViewClass *klass )
1,
G_TYPE_BOOLEAN );
- /**
- * NactTreeView::tree-signal-selection-changed:
- *
- * This signal is emitted on the BaseWindow parent each time the selection
- * has changed in the treeview.
- *
- * Signal args:
- * - a #GList of currently selected #NAObjectItems.
- *
- * Handler prototype:
- * void ( *handler )( BaseWindow *window, GList *selected, gpointer user_data );
- */
- st_signals[ SELECTION_CHANGED ] = g_signal_new_class_handler(
- TREE_SIGNAL_SELECTION_CHANGED,
- G_TYPE_OBJECT,
- G_SIGNAL_RUN_CLEANUP,
- G_CALLBACK( on_selection_changed_cleanup_handler ),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE,
- 1,
- G_TYPE_POINTER );
-
klass->private = g_new0( NactTreeViewClassPrivate, 1 );
}
@@ -854,26 +829,11 @@ on_selection_changed( GtkTreeSelection *selection, BaseWindow *window )
g_debug( "%s: selection=%p, window=%p", thisfn, ( void * ) selection, ( void * ) window );
selected_items = get_selected_items( items_view );
- g_signal_emit_by_name( window, TREE_SIGNAL_SELECTION_CHANGED, selected_items );
+ g_signal_emit_by_name( window, MAIN_SIGNAL_SELECTION_CHANGED, selected_items );
}
}
}
-/*
- * cleanup handler for our TREE_SIGNAL_SELECTION_CHANGED signal
- */
-static void
-on_selection_changed_cleanup_handler( BaseWindow *window, GList *selected_items )
-{
- static const gchar *thisfn = "nact_tree_view_on_selection_changed_cleanup_handler";
-
- g_debug( "%s: window=%p, selected_items=%p (count=%u)",
- thisfn, ( void * ) window,
- ( void * ) selected_items, g_list_length( selected_items ));
-
- na_object_free_items( selected_items );
-}
-
static void
on_tree_view_realized( GtkWidget *treeview, BaseWindow *window )
{
@@ -1167,7 +1127,7 @@ nact_tree_view_select_row_at_path( NactTreeView *view, GtkTreePath *path )
if( !something ){
if( view->private->notify_allowed ){
- g_signal_emit_by_name( view->private->window, TREE_SIGNAL_SELECTION_CHANGED, NULL );
+ g_signal_emit_by_name( view->private->window, MAIN_SIGNAL_SELECTION_CHANGED, NULL );
}
}
}
diff --git a/src/nact/nact-tree-view.h b/src/nact/nact-tree-view.h
index 20b330c..54f9bc9 100644
--- a/src/nact/nact-tree-view.h
+++ b/src/nact/nact-tree-view.h
@@ -103,7 +103,6 @@ typedef struct {
#define TREE_SIGNAL_FOCUS_OUT "tree-signal-focus-out"
#define TREE_SIGNAL_LEVEL_ZERO_CHANGED "tree-signal-level-zero-changed"
#define TREE_SIGNAL_MODIFIED_STATUS_CHANGED "tree-signal-modified-status-changed"
-#define TREE_SIGNAL_SELECTION_CHANGED "tree-signal-selection-changed"
typedef enum {
TREE_MODE_EDITION = 0,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]