[nautilus-actions] Fix initialization structure for delayed widgets
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Fix initialization structure for delayed widgets
- Date: Tue, 6 Dec 2011 19:58:29 +0000 (UTC)
commit 9a62db1949c901c31c01fc2d83d232d298f8f647
Author: Pierre Wieser <pwieser trychlos org>
Date: Tue Dec 6 20:57:55 2011 +0100
Fix initialization structure for delayed widgets
ChangeLog | 14 +++
src/nact/nact-main-tab.h | 2 +
src/nact/nact-main-window.c | 1 -
src/nact/nact-main-window.h | 197 +++++++++++++++++++++++++++++--------------
src/nact/nact-tree-model.c | 13 ++-
src/nact/nact-tree-view.c | 6 +-
6 files changed, 161 insertions(+), 72 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c62f4ea..8bab8df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2011-12-06 Pierre Wieser <pwieser trychlos org>
+
+ * src/nact/nact-main-tab.h:
+ * src/nact/nact-main-window.h: Fix comments.
+
+ * src/nact/nact-main-window.c: Fix typo.
+
+ * src/nact/nact-tree-model.c (nact_tree_model_new):
+ No more connect to base-window-initialize-gtk signal.
+ Initialize model without waiting for signal triggering.
+
+ * src/nact/nact-tree-view.c (instance_constructed):
+ No more connect to base-window-initialize-gtk signal.
+
2011-12-05 Pierre Wieser <pwieser trychlos org>
* src/core/na-importer-ask.c (import_ask_new):
diff --git a/src/nact/nact-main-tab.h b/src/nact/nact-main-tab.h
index dba0cf0..6bb713a 100644
--- a/src/nact/nact-main-tab.h
+++ b/src/nact/nact-main-tab.h
@@ -44,6 +44,8 @@
*/
/* signals
+ *
+ * TAB_UPDATABLE_SIGNAL_ITEM_UPDATED: see definition in nact-main-window.c
*/
#define TAB_UPDATABLE_SIGNAL_ITEM_UPDATED "nact-tab-updatable-item-updated"
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index 782004c..50630d7 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -203,7 +203,6 @@ static gboolean on_base_is_willing_to_quit( const BaseWindow *window, gconstpo
static gboolean on_delete_event( GtkWidget *toplevel, GdkEvent *event, NactMainWindow *window );
static gboolean warn_modified( NactMainWindow *window );
-
GType
nact_main_window_get_type( void )
{
diff --git a/src/nact/nact-main-window.h b/src/nact/nact-main-window.h
index e49b560..7c96f10 100644
--- a/src/nact/nact-main-window.h
+++ b/src/nact/nact-main-window.h
@@ -49,70 +49,141 @@
*
* NactApplication NactMainWindow NactTreeView NactTreeModel NactMenubar
* |
- * +- nact_main_window_new()
+ * +-> nact_main_window_new()
* | |
- * | +----- connect to base-init-gtk-toplevel
- * | | base-init-window
- * | | base-all-widgets-showed
- * | | pivot-items-changed
- * | | tab-item-updated
- * | |
- * | +----- nact_tree_view_new()
- * | | |
- * | | +-------------- connect to base-init-gtk-toplevel
- * | | base-init-window
- * | | base-all-widgets-showed
+ * | +-> 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]
+ * | | |
+ * | | +-> nact_menubar_new()
+ * | | | |
+ * | | | +-> NactMenubar::nact_menubar_new()
+ * | | | | |
+ * | | | | +-> nact_sort_buttons_new()
+ * | | | | +-> connect to base-init-window [window]
+ * | | | | |
+ * | | | | <-
+ * | | | <-
+ * | | |
+ * | | +-> nact_clipboard_new()
+ * | | |
+ * | | <-
+ * | <-
+ * |
+ * +-> base_application_run()
* | |
- * | +----- connect to tree-selection-changed
- * | | tree-modified-count-changed
+ * | +-> base_window_init()
+ * | | |
+ * | | +-> setup builder
+ * | | +-> load gtk toplevel
+ * | | +-> emit signal base-initial-load-gtk-toplevel
+ * | | |
+ * | | | 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()
+ * | | <-
* | |
- * | +----- nact_menubar_new()
- * | |
- * | +---------------------------------------------------- connect to base-init-window
- * |
- * emit 'base-init-gtk-toplevel'
- * |
- * +--------- init gtk toplevel in each tab
- * | init gtk toplevel in statusbar
- * |
- * +-------------------------- nact_tree_model_new()
- * | |
- * | +------------------- connect to base-init-window
- * | attach the model to the view
- * emit 'base-init-window'
- * |
- * +--------- init runtime window in each tab
- * | init sort buttons
- * | connect to delete-event
- * |
- * +-------------------------- connect to treeview events
- * | nact_tree_ieditable_initialize()
- * | |
- * | +-- register as iduplicable consumer
- * | connect to iduplicable signals
- * |
- * +------------------------------------------------ connect to dnd events
- * |
- * +---------------------------------------------------------------- instanciate UI manager
- * | connect to tree signals
- * emit 'base-all-widgets-showed'
- * |
- * +--------- na_updater_load_items()
- * | |
- * | +-- check and set items modification/validity status
- * | | +-> which generates lot of iduplicable events
- * | |
- * | +-- check and set items writability status
- * |
- * +--------- na_tree_view_fill()
- * | +-> which generates lot of selection-changed events
- * |
- * | all widgets showed on all tab
- * | all widgets showed on sort buttons
- * |
- * +-------------------------- grab focus
- * | allow notifications
- * | select first row (if any)
+ * | +-> base_window_run()
+ * | | |
+ * | | +-> emit signal base-runtime-init
+ * | | |
+ * | | | 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
+ * | | | <-
+ * | | |
+ * | | | 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
+ * | | | | | | |
+ * | | | | | | <-
+ * | | | | | <-
+ * | | | | <-
+ * | | | <-
+ * | | |
+ * | | | X-> NactTreeView::on_base_initialize_view()
+ * | | | |
+ * | | | +- connect to selection-changed [selection]
+ * | | | |
+ * | | | +- nact_tree_ieditable_initialize()
+ * | | | |
+ * | | | <-
+ * | | |
+ * | | |
+ * | | +-> gtk_widget_show_all()
+ * | | +-> emit signal base-all-widgets-showed
+ * | | |
+ * | | | 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
+ * | | |
+ * | | +-> BaseWindowClass:run()
+ * | | | |
+ * | | | +-> do_run()
+ * | | | | |
+ * | | | | +-> gtk_main()
+ * | | | |
+ * | | | <-
+ * | | <-
+ * | <-
* |
* [X] End of initialization process
*
@@ -152,8 +223,8 @@
*
* MAIN_SIGNAL_ITEM_UPDATED
* The signal is sent on the BaseWindow after a data has been modified elsewhere
- * that in a tab: either the label the label has been edited inline in the tree
- * view, or a new i/o provider has been identified. The relevant NAObject has
+ * that in a tab: either the label has been edited inline in the tree view,
+ * or a new i/o provider has been identified. The relevant NAObject has
* been updated accordingly.
* Args:
* - an OR-ed list of modified flags, or 0 if not relevant
diff --git a/src/nact/nact-tree-model.c b/src/nact/nact-tree-model.c
index 8a77efe..c280fc3 100644
--- a/src/nact/nact-tree-model.c
+++ b/src/nact/nact-tree-model.c
@@ -336,11 +336,6 @@ nact_tree_model_new( BaseWindow *window, GtkTreeView *treeview, NactTreeMode mod
model->private->mode = mode;
model->private->clipboard = nact_clipboard_new( window );
- /* connect to some signal of interest
- */
- base_window_signal_connect( window,
- G_OBJECT( window ), BASE_SIGNAL_INITIALIZE_WINDOW, G_CALLBACK( on_initialize_model ));
-
g_object_set_data( G_OBJECT( window ), WINDOW_DATA_TREE_MODEL, model );
/* attach the model to the tree view
@@ -348,6 +343,14 @@ nact_tree_model_new( BaseWindow *window, GtkTreeView *treeview, NactTreeMode mod
gtk_tree_view_set_model( treeview, GTK_TREE_MODEL( model ));
g_object_unref( model );
+ /* This function used (Gtk2) to connect to base-runtime-init signal in
+ * order to initialize the model.
+ * With Gtk3, we are only called from NactMainWindow::on_base_runtime_init()
+ * callback, so too late to connect to this signal. We so called directly
+ * the function
+ */
+ on_initialize_model( window, NULL );
+
return( model );
}
diff --git a/src/nact/nact-tree-view.c b/src/nact/nact-tree-view.c
index 96a7454..a69820f 100644
--- a/src/nact/nact-tree-view.c
+++ b/src/nact/nact-tree-view.c
@@ -66,14 +66,17 @@ struct _NactTreeViewPrivate {
/* runtime data
*
* Rationale:
+ *
* In Gtk2, we used to nact_tree_view_new() from
* nact_main_window:on_instance_constructed().
* This let us connect to on-base-initialize-gtk signal before it was
* emitted, and so initialize the treeview on the handler.
+ *
* With Gtk3, we have to wait until the Gtk hierarchy of NactMainWindow
* be actually built in order to be able to access to the embedded
* GtkTreeView. As a consequence, nact_tree_view_new() has to be delayed
* until nact_main_window_on_initialize_gtk().
+ *
* And so we no more can rely on the on-base-initialize-gtk signal to
* initialize the view. So force a call to the handler from
* on_base_initialize_view() handler.
@@ -578,9 +581,6 @@ instance_constructed( GObject *object )
g_debug( "%s: object=%p", thisfn, ( void * ) object );
base_window_signal_connect( self->private->window,
- G_OBJECT( self->private->window ), BASE_SIGNAL_INITIALIZE_GTK, G_CALLBACK( on_base_initialize_gtk ));
-
- base_window_signal_connect( self->private->window,
G_OBJECT( self->private->window ), BASE_SIGNAL_INITIALIZE_WINDOW, G_CALLBACK( on_base_initialize_view ));
base_window_signal_connect( self->private->window,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]