Commit ef1a3645 authored by Pierre Wieser's avatar Pierre Wieser

BaseWindow::runtime_init_toplevel() is renamed as initialize_base_window()

parent e1656b4c
2011-01-22 Pierre Wieser <pwieser@trychlos.org>
* src/nact/base-window.c:
* src/nact/base-window.h
(runtime_init_toplevel): Renamed as initialize_base_window().
(class_init): Fix cclosure_marshall for signals without argument.
* src/nact/base-window.c:
* src/nact/base-window.h
(get_toplevel_name, get_ui_filename): Removed virtual functions.
......
......@@ -124,12 +124,13 @@ static gboolean is_gtk_toplevel_initialized( const BaseWindow *window, G
static void set_gtk_toplevel_initialized( const BaseWindow *window, GtkWindow *gtk_toplevel, gboolean init );
static void on_initialize_gtk_toplevel_class_handler( BaseWindow *window, GtkWindow *toplevel );
static void do_initialize_gtk_toplevel( BaseWindow *window, GtkWindow *toplevel );
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 on_all_widgets_showed_class_handler( BaseWindow *window, gpointer user_data );
/* run
*/
static void on_initialize_base_window_class_handler( BaseWindow *window );
static void do_initialize_base_window( BaseWindow *window );
static void on_all_widgets_showed_class_handler( BaseWindow *window );
static gboolean is_main_window( BaseWindow *window );
static gboolean on_delete_event( GtkWidget *widget, GdkEvent *event, BaseWindow *window );
......@@ -245,7 +246,7 @@ class_init( BaseWindowClass *klass )
klass->private = g_new0( BaseWindowClassPrivate, 1 );
klass->initialize_gtk_toplevel = do_initialize_gtk_toplevel;
klass->runtime_init_toplevel = do_initialize_base_window;
klass->initialize_base_window = do_initialize_base_window;
klass->all_widgets_showed = NULL;
klass->dialog_response = window_do_dialog_response;
klass->delete_event = window_do_delete_event;
......@@ -288,10 +289,9 @@ class_init( BaseWindowClass *klass )
G_CALLBACK( on_initialize_base_window_class_handler ),
NULL,
NULL,
g_cclosure_marshal_VOID__POINTER,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE,
1,
G_TYPE_POINTER );
0 );
/**
* nact-signal-base-window-all-widgets-showed:
......@@ -311,10 +311,9 @@ class_init( BaseWindowClass *klass )
G_CALLBACK( on_all_widgets_showed_class_handler ),
NULL,
NULL,
g_cclosure_marshal_VOID__POINTER,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE,
1,
G_TYPE_POINTER );
0 );
}
static void
......@@ -726,60 +725,6 @@ do_initialize_gtk_toplevel( BaseWindow *window, GtkWindow *toplevel )
}
}
/*
* default class handler for "nact-signal-base-window-runtime-init" message
* -> does nothing here
*/
static void
on_initialize_base_window_class_handler( BaseWindow *window, gpointer user_data )
{
static const gchar *thisfn = "base_window_on_initialize_base_window_class_handler";
g_return_if_fail( BASE_IS_WINDOW( window ));
g_debug( "%s: window=%p, user_data=%p", thisfn, ( void * ) window, ( void * ) user_data );
if( !window->private->dispose_has_run ){
if( BASE_WINDOW_GET_CLASS( window )->runtime_init_toplevel ){
BASE_WINDOW_GET_CLASS( window )->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
on_all_widgets_showed_class_handler( BaseWindow *window, gpointer user_data )
{
static const gchar *thisfn = "base_window_on_all_widgets_showed_class_handler";
g_return_if_fail( BASE_IS_WINDOW( window ));
g_debug( "%s: window=%p, user_data=%p", thisfn, ( void * ) window, ( void * ) user_data );
if( !window->private->dispose_has_run ){
if( BASE_WINDOW_GET_CLASS( window )->all_widgets_showed ){
BASE_WINDOW_GET_CLASS( window )->all_widgets_showed( window, user_data );
}
}
}
/**
* base_window_run:
* @window: this #BaseWindow object.
......@@ -811,10 +756,10 @@ base_window_run( BaseWindow *window )
g_return_val_if_fail( GTK_IS_WINDOW( window->private->gtk_toplevel ), BASE_EXIT_CODE_START_FAIL );
g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_signal_emit_by_name( window, BASE_SIGNAL_INITIALIZE_WINDOW, NULL );
g_signal_emit_by_name( window, BASE_SIGNAL_INITIALIZE_WINDOW );
gtk_widget_show_all( GTK_WIDGET( window->private->gtk_toplevel ));
g_signal_emit_by_name( window, BASE_SIGNAL_ALL_WIDGETS_SHOWED, NULL );
g_signal_emit_by_name( window, BASE_SIGNAL_ALL_WIDGETS_SHOWED );
if( is_main_window( window )){
if( GTK_IS_DIALOG( window->private->gtk_toplevel )){
......@@ -844,6 +789,59 @@ base_window_run( BaseWindow *window )
return( run_ok ? BASE_EXIT_CODE_OK : BASE_EXIT_CODE_MAIN_WINDOW );
}
/*
* default class handler for "nact-signal-base-window-runtime-init" message
* -> does nothing here
*/
static void
on_initialize_base_window_class_handler( BaseWindow *window )
{
static const gchar *thisfn = "base_window_on_initialize_base_window_class_handler";
g_return_if_fail( BASE_IS_WINDOW( window ));
g_debug( "%s: window=%p", thisfn, ( void * ) window );
if( !window->private->dispose_has_run ){
if( BASE_WINDOW_GET_CLASS( window )->initialize_base_window ){
BASE_WINDOW_GET_CLASS( window )->initialize_base_window( window );
}
}
}
static void
do_initialize_base_window( BaseWindow *window )
{
static const gchar *thisfn = "base_window_do_initialize_base_window";
g_return_if_fail( BASE_IS_WINDOW( window ));
g_debug( "%s: window=%p", thisfn, ( void * ) window );
if( !window->private->dispose_has_run ){
base_iprefs_position_window( window );
}
}
static void
on_all_widgets_showed_class_handler( BaseWindow *window )
{
static const gchar *thisfn = "base_window_on_all_widgets_showed_class_handler";
g_return_if_fail( BASE_IS_WINDOW( window ));
g_debug( "%s: window=%p", thisfn, ( void * ) window );
if( !window->private->dispose_has_run ){
if( BASE_WINDOW_GET_CLASS( window )->all_widgets_showed ){
BASE_WINDOW_GET_CLASS( window )->all_widgets_showed( window );
}
}
}
static gboolean
is_main_window( BaseWindow *window )
{
......
......@@ -95,7 +95,7 @@ typedef struct _BaseWindowClassPrivate BaseWindowClassPrivate;
/**
* BaseWindowClass:
* @initialize_gtk_toplevel: initialize the toplevel GtkWindow
* @runtime_init_toplevel: initialize the BaseWindow
* @initialize_base_window: initialize the BaseWindow
* @all_widgets_showed: all widgets have been showed
* @dialog_response:
* @delete_event:
......@@ -128,9 +128,8 @@ typedef struct {
void ( *initialize_gtk_toplevel )( BaseWindow *window, GtkWindow *toplevel );
/**
* runtime_init_toplevel:
* initialize_base_window:
* @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
......@@ -142,12 +141,11 @@ typedef struct {
* 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 );
void ( *initialize_base_window ) ( BaseWindow *window );
/**
* all_widgets_showed:
* @window: this #BaseWindow instance.
* @user_data: not used
*
* Invoked at the end of initialization process, after all connected
* handlers have themselves run.
......@@ -155,7 +153,7 @@ typedef struct {
* The derived class should invoke the virtual method of its parent class
* at the end of its processing.
*/
void ( *all_widgets_showed ) ( BaseWindow *window, gpointer user_data );
void ( *all_widgets_showed ) ( BaseWindow *window );
/**
* dialog_response:
......
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