[nautilus-actions] base_window_is_willing_to_quit() successively invoke each derived class
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] base_window_is_willing_to_quit() successively invoke each derived class
- Date: Mon, 24 Jan 2011 19:40:51 +0000 (UTC)
commit bc71ae6da60a9eb2959a292e7d426700cb7a63c2
Author: Pierre Wieser <pwieser trychlos org>
Date: Sat Jan 22 15:38:23 2011 +0100
base_window_is_willing_to_quit() successively invoke each derived class
ChangeLog | 4 ++--
src/nact/base-window.c | 14 +++++++++-----
src/nact/base-window.h | 18 +++++++++++-------
3 files changed, 22 insertions(+), 14 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 886112f..1f6c42b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/src/nact/base-window.c b/src/nact/base-window.c
index 6c6e6df..acc9288 100644
--- a/src/nact/base-window.c
+++ b/src/nact/base-window.c
@@ -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 );
+ }
}
}
diff --git a/src/nact/base-window.h b/src/nact/base-window.h
index fae3a96..573b444 100644
--- a/src/nact/base-window.h
+++ b/src/nact/base-window.h
@@ -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 );
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]