Commit 1bae8704 authored by Pierre Wieser's avatar Pierre Wieser

BaseWindow::on_all_widgets_showed_class_handler() successively invoke each derived class

parent 99fbb516
2011-01-22 Pierre Wieser <pwieser@trychlos.org> 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): on_initialize_base_window_class_handler,
on_all_widgets_showed_class_handler):
Succssively invoke all derived class methods. Succssively invoke all derived class methods.
* src/nact/base-window.h (initial_load_toplevel, runtime_init_toplevel): * src/nact/base-window.h (initial_load_toplevel, runtime_init_toplevel,
Update comments. @all_widgets_showed): Update comments.
* src/nact/base-application.c (appli_initialize_manage_options): * src/nact/base-application.c (appli_initialize_manage_options):
Successively invoke all derived class methods. Successively invoke all derived class methods.
......
...@@ -127,13 +127,12 @@ static void on_initialize_gtk_toplevel_class_handler( BaseWindow *wi ...@@ -127,13 +127,12 @@ static void on_initialize_gtk_toplevel_class_handler( BaseWindow *wi
static void do_initialize_gtk_toplevel( 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 on_initialize_base_window_class_handler( BaseWindow *window, gpointer user_data );
static void do_initialize_base_window( BaseWindow *window, gpointer user_data ); static void do_initialize_base_window( BaseWindow *window, gpointer user_data );
static void on_all_widgets_showed_class_handler( 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 gboolean v_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window );
static gchar *v_get_toplevel_name( const BaseWindow *window ); static gchar *v_get_toplevel_name( const BaseWindow *window );
static gchar *v_get_iprefs_window_id( const BaseWindow *window ); static gchar *v_get_iprefs_window_id( const BaseWindow *window );
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_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window );
static gboolean window_do_delete_event( BaseWindow *window, GtkWindow *toplevel, GdkEvent *event ); static gboolean window_do_delete_event( BaseWindow *window, GtkWindow *toplevel, GdkEvent *event );
static gboolean window_do_is_willing_to_quit( const BaseWindow *window ); static gboolean window_do_is_willing_to_quit( const BaseWindow *window );
...@@ -246,7 +245,7 @@ class_init( BaseWindowClass *klass ) ...@@ -246,7 +245,7 @@ class_init( BaseWindowClass *klass )
klass->initial_load_toplevel = do_initialize_gtk_toplevel; klass->initial_load_toplevel = do_initialize_gtk_toplevel;
klass->runtime_init_toplevel = do_initialize_base_window; klass->runtime_init_toplevel = do_initialize_base_window;
klass->all_widgets_showed = window_do_all_widgets_showed; klass->all_widgets_showed = NULL;
klass->dialog_response = window_do_dialog_response; klass->dialog_response = window_do_dialog_response;
klass->delete_event = window_do_delete_event; klass->delete_event = window_do_delete_event;
klass->get_toplevel_name = NULL; klass->get_toplevel_name = NULL;
...@@ -308,7 +307,7 @@ class_init( BaseWindowClass *klass ) ...@@ -308,7 +307,7 @@ class_init( BaseWindowClass *klass )
BASE_SIGNAL_ALL_WIDGETS_SHOWED, BASE_SIGNAL_ALL_WIDGETS_SHOWED,
G_TYPE_FROM_CLASS( klass ), G_TYPE_FROM_CLASS( klass ),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_CALLBACK( v_all_widgets_showed ), G_CALLBACK( on_all_widgets_showed_class_handler ),
NULL, NULL,
NULL, NULL,
g_cclosure_marshal_VOID__POINTER, g_cclosure_marshal_VOID__POINTER,
...@@ -1025,20 +1024,21 @@ do_initialize_base_window( BaseWindow *window, gpointer user_data ) ...@@ -1025,20 +1024,21 @@ do_initialize_base_window( BaseWindow *window, gpointer user_data )
} }
static void static void
v_all_widgets_showed( BaseWindow *window, gpointer user_data ) on_all_widgets_showed_class_handler( BaseWindow *window, gpointer user_data )
{ {
static const gchar *thisfn = "base_window_v_all_widgets_showed"; static const gchar *thisfn = "base_window_on_all_widgets_showed_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 )); 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 )->all_widgets_showed ){ if( !window->private->dispose_has_run ){
BASE_WINDOW_GET_CLASS( window )->all_widgets_showed( window, user_data );
} else { for( class = G_OBJECT_GET_CLASS( window ) ; BASE_IS_WINDOW_CLASS( class ) ; class = g_type_class_peek_parent( class )){
window_do_all_widgets_showed( window, user_data ); if( BASE_WINDOW_CLASS( class )->all_widgets_showed ){
BASE_WINDOW_CLASS( class )->all_widgets_showed( window, user_data );
}
} }
} }
} }
...@@ -1103,19 +1103,6 @@ v_get_iprefs_window_id( const BaseWindow *window ) ...@@ -1103,19 +1103,6 @@ v_get_iprefs_window_id( const BaseWindow *window )
return( id ); return( id );
} }
static void
window_do_all_widgets_showed( BaseWindow *window, gpointer user_data )
{
static const gchar *thisfn = "base_window_do_all_widgets_showed";
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 */
}
}
/* /*
* return TRUE to quit the dialog loop * return TRUE to quit the dialog loop
*/ */
......
...@@ -95,8 +95,8 @@ typedef struct _BaseWindowClassPrivate BaseWindowClassPrivate; ...@@ -95,8 +95,8 @@ typedef struct _BaseWindowClassPrivate BaseWindowClassPrivate;
/** /**
* BaseWindowClass: * BaseWindowClass:
* @initial_load_toplevel: initialize the toplevel GtkWindow * @initial_load_toplevel: initialize the toplevel GtkWindow
* @runtime_init_toplevel: * @runtime_init_toplevel: initialize the BaseWindow
* @all_widgets_showed: * @all_widgets_showed: all widgets have been showed
* @dialog_response: * @dialog_response:
* @delete_event: * @delete_event:
* @get_toplevel_name: * @get_toplevel_name:
...@@ -128,7 +128,7 @@ typedef struct { ...@@ -128,7 +128,7 @@ typedef struct {
* so called last, set this GtkWindow toplevel window transient for * so called last, set this GtkWindow toplevel window transient for
* its parent window. * its parent window.
*/ */
void ( *initial_load_toplevel )( BaseWindow *window, gpointer user_data ); void ( *initial_load_toplevel )( BaseWindow *window, gpointer user_data );
/** /**
* runtime_init_toplevel: * runtime_init_toplevel:
...@@ -146,19 +146,27 @@ typedef struct { ...@@ -146,19 +146,27 @@ typedef struct {
* The BaseWindow base class implementation of this method, which is * The BaseWindow base class implementation of this method, which is
* so called last, reset last size and position of the window. * so called last, reset last size and position of the window.
*/ */
void ( *runtime_init_toplevel )( BaseWindow *window, gpointer user_data ); void ( *runtime_init_toplevel )( BaseWindow *window, gpointer user_data );
/** /**
* all_widgets_showed: * all_widgets_showed:
* @window: this #BaseWindow instance. * @window: this #BaseWindow instance.
* @user_data: not used
*
* Invoked at the end of initialization process, after all connected
* handlers have themselves run.
*
* The BaseWindow class takes care of successively invoking the
* all_widgets_showed() method of each derived class, starting from
* the topmost derived class, up to the BaseWindow itself.
*/ */
void ( *all_widgets_showed ) ( BaseWindow *window, gpointer user_data ); void ( *all_widgets_showed ) ( BaseWindow *window, gpointer user_data );
/** /**
* dialog_response: * dialog_response:
* @window: this #BaseWindow instance. * @window: this #BaseWindow instance.
*/ */
gboolean ( *dialog_response ) ( GtkDialog *dialog, gint code, BaseWindow *window ); gboolean ( *dialog_response ) ( GtkDialog *dialog, gint code, BaseWindow *window );
/** /**
* delete_event: * delete_event:
...@@ -169,7 +177,7 @@ typedef struct { ...@@ -169,7 +177,7 @@ typedef struct {
* can so implement the virtual function, without having to take * can so implement the virtual function, without having to take
* care of the signal itself. * care of the signal itself.
*/ */
gboolean ( *delete_event ) ( BaseWindow *window, GtkWindow *toplevel, GdkEvent *event ); gboolean ( *delete_event ) ( BaseWindow *window, GtkWindow *toplevel, GdkEvent *event );
/** /**
* window_get_toplevel_name: * window_get_toplevel_name:
...@@ -177,7 +185,7 @@ typedef struct { ...@@ -177,7 +185,7 @@ typedef struct {
* *
* Pure virtual function. * Pure virtual function.
*/ */
gchar * ( *get_toplevel_name ) ( const BaseWindow *window ); gchar * ( *get_toplevel_name ) ( const BaseWindow *window );
/** /**
* get_iprefs_window_id: * get_iprefs_window_id:
...@@ -189,7 +197,7 @@ typedef struct { ...@@ -189,7 +197,7 @@ typedef struct {
* This delegates to #BaseWindow-derived classes the NactIPrefs * This delegates to #BaseWindow-derived classes the NactIPrefs
* interface virtual function. * interface virtual function.
*/ */
gchar * ( *get_iprefs_window_id ) ( const BaseWindow *window ); gchar * ( *get_iprefs_window_id ) ( const BaseWindow *window );
/** /**
* get_ui_filename: * get_ui_filename:
...@@ -204,7 +212,7 @@ typedef struct { ...@@ -204,7 +212,7 @@ typedef struct {
* Returns: the filename of the XML definition, to be g_free() by * Returns: the filename of the XML definition, to be g_free() by
* the caller. * the caller.
*/ */
gchar * ( *get_ui_filename ) ( const BaseWindow *window ); gchar * ( *get_ui_filename ) ( const BaseWindow *window );
/** /**
* is_willing_to_quit: * is_willing_to_quit:
...@@ -219,7 +227,7 @@ typedef struct { ...@@ -219,7 +227,7 @@ typedef struct {
* Returns: the filename of the XML definition, to be g_free() by * Returns: the filename of the XML definition, to be g_free() by
* the caller. * the caller.
*/ */
gboolean ( *is_willing_to_quit ) ( const BaseWindow *window ); gboolean ( *is_willing_to_quit ) ( const BaseWindow *window );
} }
BaseWindowClass; BaseWindowClass;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment