[nautilus-actions] BaseWindow::on_initialize_base_window_class_handler() successively invoke each derived class
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] BaseWindow::on_initialize_base_window_class_handler() successively invoke each derived class
- Date: Mon, 24 Jan 2011 19:40:41 +0000 (UTC)
commit 99fbb51697aa2c3636c8b46f958f046b958a68ae
Author: Pierre Wieser <pwieser trychlos org>
Date: Sat Jan 22 15:26:24 2011 +0100
BaseWindow::on_initialize_base_window_class_handler() successively invoke each derived class
ChangeLog | 6 ++-
src/nact/base-window.c | 89 +++++++++++++++++++-----------------------------
src/nact/base-window.h | 14 +++++++-
3 files changed, 52 insertions(+), 57 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 15ec8cd..3275d7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,11 @@
2011-01-22 Pierre Wieser <pwieser trychlos org>
- * src/nact/base-window.c (on_initialize_gtk_toplevel_class_handler):
+ * src/nact/base-window.c (on_initialize_gtk_toplevel_class_handler,
+ on_initialize_base_window_class_handler):
Succssively invoke all derived class methods.
- * src/nact/base-window.h (initial_load_toplevel): Update comment.
+ * src/nact/base-window.h (initial_load_toplevel, runtime_init_toplevel):
+ Update comments.
* src/nact/base-application.c (appli_initialize_manage_options):
Successively invoke all derived class methods.
diff --git a/src/nact/base-window.c b/src/nact/base-window.c
index df0fcee..13e65d0 100644
--- a/src/nact/base-window.c
+++ b/src/nact/base-window.c
@@ -125,16 +125,14 @@ static gboolean on_delete_event( GtkWidget *widget, GdkEvent *event, Bas
static void on_initialize_gtk_toplevel_class_handler( BaseWindow *window, gpointer user_data );
static void do_initialize_gtk_toplevel( BaseWindow *window, gpointer user_data );
+static void on_initialize_base_window_class_handler( BaseWindow *window, gpointer user_data );
+static void do_initialize_base_window( BaseWindow *window, gpointer user_data );
-static void v_runtime_init_toplevel( BaseWindow *window, gpointer user_data );
static void v_all_widgets_showed( BaseWindow *window, gpointer user_data );
static gboolean v_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window );
static gchar *v_get_toplevel_name( const BaseWindow *window );
static gchar *v_get_iprefs_window_id( const BaseWindow *window );
-static void on_runtime_init_toplevel( BaseWindow *window, gpointer user_data );
-
-static void window_do_runtime_init_toplevel( BaseWindow *window, gpointer user_data );
static void window_do_all_widgets_showed( BaseWindow *window, gpointer user_data );
static gboolean window_do_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window );
static gboolean window_do_delete_event( BaseWindow *window, GtkWindow *toplevel, GdkEvent *event );
@@ -247,7 +245,7 @@ class_init( BaseWindowClass *klass )
klass->private = g_new0( BaseWindowClassPrivate, 1 );
klass->initial_load_toplevel = do_initialize_gtk_toplevel;
- klass->runtime_init_toplevel = window_do_runtime_init_toplevel;
+ klass->runtime_init_toplevel = do_initialize_base_window;
klass->all_widgets_showed = window_do_all_widgets_showed;
klass->dialog_response = window_do_dialog_response;
klass->delete_event = window_do_delete_event;
@@ -259,8 +257,8 @@ class_init( BaseWindowClass *klass )
/**
* base-window-initialize-gtk:
*
- * The signal is emitted by the #BaseWindow instance when it loads
- * for the first time the Gtk toplevel widget from the GtkBuilder.
+ * The signal is emitted by the #BaseWindow instance when it has
+ * loaded for the first time the Gtk toplevel widget from the GtkBuilder.
*/
st_signals[ INITIALIZE_GTK ] =
g_signal_new_class_handler(
@@ -276,18 +274,18 @@ class_init( BaseWindowClass *klass )
G_TYPE_POINTER );
/**
- * nact-signal-base-window-runtime-init:
+ * base-window-initialize-window:
*
- * The signal is emitted by the #BaseWindow instance when it is
- * about to display the toplevel widget. Is is so time to initialize
- * it with runtime values.
+ * The signal is emitted by the #BaseWindow instance after the toplevel
+ * GtkWindow has been initialized, before actually displaying the window.
+ * Is is so time to initialize it with runtime values.
*/
st_signals[ INITIALIZE_BASE ] =
g_signal_new_class_handler(
BASE_SIGNAL_INITIALIZE_WINDOW,
G_TYPE_FROM_CLASS( klass ),
G_SIGNAL_RUN_LAST,
- G_CALLBACK( v_runtime_init_toplevel ),
+ G_CALLBACK( on_initialize_base_window_class_handler ),
NULL,
NULL,
g_cclosure_marshal_VOID__POINTER,
@@ -354,12 +352,6 @@ instance_init( GTypeInstance *instance, gpointer klass )
self->private->dispose_has_run = FALSE;
self->private->signals = NULL;
self->private->save_window_position = TRUE;
-
- base_window_signal_connect(
- self,
- G_OBJECT( instance ),
- BASE_SIGNAL_INITIALIZE_WINDOW,
- G_CALLBACK( on_runtime_init_toplevel ));
}
static void
@@ -997,25 +989,42 @@ do_initialize_gtk_toplevel( BaseWindow *window, gpointer user_data )
* -> does nothing here
*/
static void
-v_runtime_init_toplevel( BaseWindow *window, gpointer user_data )
+on_initialize_base_window_class_handler( BaseWindow *window, gpointer user_data )
{
- static const gchar *thisfn = "base_window_v_runtime_init_toplevel";
+ static const gchar *thisfn = "base_window_on_initialize_base_window_class_handler";
+ GObjectClass *class;
- 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 ){
+ g_debug( "%s: window=%p, user_data=%p", thisfn, ( void * ) window, ( void * ) user_data );
- if( BASE_WINDOW_GET_CLASS( window )->runtime_init_toplevel ){
- BASE_WINDOW_GET_CLASS( window )->runtime_init_toplevel( window, user_data );
+ if( !window->private->dispose_has_run ){
- } else {
- window_do_runtime_init_toplevel( window, user_data );
+ for( class = G_OBJECT_GET_CLASS( window ) ; BASE_IS_WINDOW_CLASS( class ) ; class = g_type_class_peek_parent( class )){
+ if( BASE_WINDOW_CLASS( class )->runtime_init_toplevel ){
+ BASE_WINDOW_CLASS( class )->runtime_init_toplevel( window, user_data );
+ }
}
}
}
static void
+do_initialize_base_window( BaseWindow *window, gpointer user_data )
+{
+ static const gchar *thisfn = "base_window_do_initialize_base_window";
+
+ g_return_if_fail( BASE_IS_WINDOW( window ));
+
+ g_debug( "%s: window=%p, user_data=%p, parent_window=%p",
+ thisfn, ( void * ) window, ( void * ) user_data, ( void * ) window->private->parent );
+
+ if( !window->private->dispose_has_run ){
+
+ base_iprefs_position_window( window );
+ }
+}
+
+static void
v_all_widgets_showed( BaseWindow *window, gpointer user_data )
{
static const gchar *thisfn = "base_window_v_all_widgets_showed";
@@ -1095,34 +1104,6 @@ v_get_iprefs_window_id( const BaseWindow *window )
}
static void
-on_runtime_init_toplevel( BaseWindow *window, gpointer user_data )
-{
- static const gchar *thisfn = "base_window_on_runtime_init_toplevel";
-
- g_debug( "%s: window=%p, user_data=%p, parent_window=%p",
- thisfn, ( void * ) window, ( void * ) user_data, ( void * ) window->private->parent );
- g_return_if_fail( BASE_IS_WINDOW( window ));
-
- if( !window->private->dispose_has_run ){
-
- base_iprefs_position_window( window );
- }
-}
-
-static void
-window_do_runtime_init_toplevel( BaseWindow *window, gpointer user_data )
-{
- static const gchar *thisfn = "base_window_do_runtime_init_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 */
- }
-}
-
-static void
window_do_all_widgets_showed( BaseWindow *window, gpointer user_data )
{
static const gchar *thisfn = "base_window_do_all_widgets_showed";
diff --git a/src/nact/base-window.h b/src/nact/base-window.h
index 884cc23..509edc5 100644
--- a/src/nact/base-window.h
+++ b/src/nact/base-window.h
@@ -118,7 +118,7 @@ typedef struct {
* @user_data: not used
*
* Invoked when the toplevel GtkWindow is allocated for the firt time
- * by the GtkBuilder.
+ * by the GtkBuilder, after all connected handlers have themselves run.
*
* The BaseWindow class takes care of successively invoking the
* initial_load_toplevel() method of each derived class, starting from
@@ -133,6 +133,18 @@ typedef struct {
/**
* runtime_init_toplevel:
* @window: this #BaseWindow instance.
+ * @user_data: not used
+ *
+ * Invoked after the GtkWindow toplevel has been initialized, before
+ * actually dsplaying the widget, and after all connected handlers
+ * have themselves run.
+ *
+ * The BaseWindow class takes care of successively invoking the
+ * runtime_init_toplevel() method of each derived class, starting from
+ * the topmost derived class, up to the BaseWindow itself.
+ *
+ * The BaseWindow base class implementation of this method, which is
+ * so called last, reset last size and position of the window.
*/
void ( *runtime_init_toplevel )( BaseWindow *window, gpointer user_data );
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]