[nautilus-actions] Let NactMainWindow manage its own termination
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Let NactMainWindow manage its own termination
- Date: Thu, 3 Feb 2011 00:52:00 +0000 (UTC)
commit 955795078fa76c29df48876674bb72ee4bb76538
Author: Pierre Wieser <pwieser trychlos org>
Date: Thu Feb 3 01:46:48 2011 +0100
Let NactMainWindow manage its own termination
ChangeLog | 9 +++++++++
src/nact/nact-main-menubar-file.c | 7 +------
src/nact/nact-main-window.c | 32 +++++++++++++++++++++++++++++++-
src/nact/nact-main-window.h | 2 ++
4 files changed, 43 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bfc4bfc..354740d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2011-02-02 Pierre Wieser <pwieser trychlos org>
+ Termination of the main window is managed in NactMainWindow.
+
+ * src/nact/nact-main-window.c:
+ * src/nact/nact-main-window.h (nact_main_window_quit): New function.
+
+ * src/nact/nact-main-menubar-file.c: Updated accordingly.
+
+ Move a NASettings getter to NAUpdater
+
* src/core/na-updater.c:
* src/core/na-updater.h (na_updater_should_pasted_be_relabeled): New function.
diff --git a/src/nact/nact-main-menubar-file.c b/src/nact/nact-main-menubar-file.c
index dab2257..18b999a 100644
--- a/src/nact/nact-main-menubar-file.c
+++ b/src/nact/nact-main-menubar-file.c
@@ -425,16 +425,11 @@ void
nact_main_menubar_file_on_quit( GtkAction *gtk_action, NactMainWindow *window )
{
static const gchar *thisfn = "nact_main_menubar_file_on_quit";
- gboolean has_modified;
g_debug( "%s: item=%p, window=%p", thisfn, ( void * ) gtk_action, ( void * ) window );
g_return_if_fail( GTK_IS_ACTION( gtk_action ) || gtk_action == NULL );
- g_return_if_fail( NACT_IS_MAIN_WINDOW( window ));
- has_modified = nact_main_window_has_modified_items( window );
- if( !has_modified || nact_window_warn_modified( NACT_WINDOW( window ))){
- g_object_unref( window );
- }
+ nact_main_window_quit( window );
}
/**
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index a5d4041..c1a0319 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -1136,6 +1136,36 @@ reload_items( NactMainWindow *window )
nact_iactions_list_bis_select_first_row( NACT_IACTIONS_LIST( window ));
}
+/**
+ * nact_main_window_quit:
+ * @window: the #NactMainWindow main window.
+ *
+ * Quit the window, thus terminating the application.
+ *
+ * Returns: %TRUE if the application will terminate, and the @window object
+ * is no more valid; %FALSE if the application will continue to run.
+ */
+gboolean
+nact_main_window_quit( NactMainWindow *window )
+{
+ static const gchar *thisfn = "nact_main_window_quit";
+ gboolean has_modified;
+ gboolean terminated;
+
+ g_return_if_fail( NACT_IS_MAIN_WINDOW( window ));
+ g_debug( "%s: window=%p (%s)", thisfn, ( void * ) window, G_OBJECT_TYPE_NAME( window ));
+
+ terminated = FALSE;
+ has_modified = nact_main_window_has_modified_items( window );
+
+ if( !has_modified || nact_window_warn_modified( NACT_WINDOW( window ))){
+ g_object_unref( window );
+ terminated = TRUE;
+ }
+
+ return( terminated );
+}
+
static gboolean
base_is_willing_to_quit( const BaseWindow *window )
{
@@ -1172,7 +1202,7 @@ on_delete_event( GtkWidget *toplevel, GdkEvent *event, NactMainWindow *window )
g_debug( "%s: toplevel=%p, event=%p, window=%p",
thisfn, ( void * ) toplevel, ( void * ) event, ( void * ) window );
- nact_main_menubar_file_on_quit( NULL, window );
+ nact_main_window_quit( window );
return( TRUE );
}
diff --git a/src/nact/nact-main-window.h b/src/nact/nact-main-window.h
index c91edc6..63afe59 100644
--- a/src/nact/nact-main-window.h
+++ b/src/nact/nact-main-window.h
@@ -96,6 +96,8 @@ void nact_main_window_move_to_deleted ( NactMainWindow *window, GLi
void nact_main_window_reload ( NactMainWindow *window );
gboolean nact_main_window_remove_deleted ( NactMainWindow *window, GSList **messages );
+void nact_main_window_quit ( NactMainWindow *window );
+
G_END_DECLS
#endif /* __NACT_MAIN_WINDOW_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]