Commit bc71ae6d authored by Pierre Wieser's avatar Pierre Wieser

base_window_is_willing_to_quit() successively invoke each derived class

parent 1bae8704
......@@ -2,11 +2,11 @@
* src/nact/base-window.c (on_initialize_gtk_toplevel_class_handler,
on_initialize_base_window_class_handler,
on_all_widgets_showed_class_handler):
on_all_widgets_showed_class_handler, base_window_is_willing_to_quit):
Succssively invoke all derived class methods.
* src/nact/base-window.h (initial_load_toplevel, runtime_init_toplevel,
@all_widgets_showed): Update comments.
all_widgets_showed, is_willing_to_quit): Update comments.
* src/nact/base-application.c (appli_initialize_manage_options):
Successively invoke all derived class methods.
......
......@@ -888,15 +888,19 @@ base_window_get_widget( const BaseWindow *window, const gchar *name )
gboolean
base_window_is_willing_to_quit( const BaseWindow *window )
{
gboolean willing_to = TRUE;
gboolean willing_to;
GObjectClass *class;
g_return_val_if_fail( BASE_IS_WINDOW( window ), willing_to );
willing_to = TRUE;
if( !window->private->dispose_has_run ){
g_return_val_if_fail( BASE_IS_WINDOW( window ), TRUE );
if( BASE_WINDOW_GET_CLASS( window )->is_willing_to_quit ){
if( !window->private->dispose_has_run ){
willing_to = BASE_WINDOW_GET_CLASS( window )->is_willing_to_quit( window );
for( class = G_OBJECT_GET_CLASS( window ) ; willing_to && BASE_IS_WINDOW_CLASS( class ) ; class = g_type_class_peek_parent( class )){
if( BASE_WINDOW_CLASS( class )->is_willing_to_quit ){
willing_to = BASE_WINDOW_CLASS( class )->is_willing_to_quit( window );
}
}
}
......
......@@ -102,7 +102,7 @@ typedef struct _BaseWindowClassPrivate BaseWindowClassPrivate;
* @get_toplevel_name:
* @get_iprefs_window_id:
* @get_ui_filename:
* @is_willing_to_quit:
* @is_willing_to_quit: asks if the window is willing to quit
*
* This defines the virtual method a derived class may, should or must implement.
*/
......@@ -218,14 +218,18 @@ typedef struct {
* is_willing_to_quit:
* @window: this #BaseWindow instance.
*
* Asks the derived class for the filename of the XML definition of
* the user interface for this window. This XML definition must be
* suitable in order to be loaded via GtkBuilder.
* Invoked (e.g. by the session manager) when the application
* has been asked for to terminate itself.
*
* Defaults to application UI filename.
* The BaseWindow class takes care of successively invoking the
* is_willing_to_quit() method of each derived class, starting from
* the topmost derived class, up to the BaseWindow itself.
*
* Returns: the filename of the XML definition, to be g_free() by
* the caller.
* As soon as one of these method returns %FALSE, the loop is
* stopped.
*
* The derived method should return %TRUE if it is willing to quit,
* %FALSE else.
*/
gboolean ( *is_willing_to_quit ) ( const BaseWindow *window );
}
......
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