[nautilus-actions] Gracefully terminates the application on SMClient 'quit' signal



commit edf39bd9a683f216622c05a3962afe9e31a66368
Author: Pierre Wieser <pwieser trychlos org>
Date:   Tue Nov 24 19:20:59 2009 +0100

    Gracefully terminates the application on SMClient 'quit' signal

 ChangeLog                                |    7 ++++++-
 nautilus-actions/nact/base-application.c |   20 ++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 905e93b..ab2b6ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-11-24 Pierre Wieser <pwieser trychlos org>
+
+	* nautilus-actions/nact/base-application.c:
+	Gracefully terminates the application on SMClient quit signal.
+
 2009-11-23 Pierre Wieser <pwieser trychlos org>
 
 	* nautilus-actions/nact/nautilus-actions-config-tool.ui:
@@ -18,7 +23,7 @@
 	Returns TRUE if application is willing to quit on logout.
 
 	* nautilus-actions/nact/nact-main-window.c:
-	Ask the user for a confirmation when sessions ends will modifications
+	Ask the user for a confirmation when sessions ends while modifications
 	are pending.
 
 	* nautilus-actions/nact/nact-main-menubar.c:
diff --git a/nautilus-actions/nact/base-application.c b/nautilus-actions/nact/base-application.c
index 1105d8a..5471ab1 100644
--- a/nautilus-actions/nact/base-application.c
+++ b/nautilus-actions/nact/base-application.c
@@ -115,6 +115,7 @@ static gboolean       application_do_initialize_application( BaseApplication *ap
 static gboolean       check_for_unique_app( BaseApplication *application );
 /*static UniqueResponse on_unique_message_received( UniqueApp *app, UniqueCommand command, UniqueMessageData *message, guint time, gpointer user_data );*/
 
+static void           client_quit_cb( EggSMClient *client, BaseApplication *application );
 static void           client_quit_requested_cb( EggSMClient *client, BaseApplication *application );
 static gint           display_dlg( BaseApplication *application, GtkMessageType type_message, GtkButtonsType type_buttons, const gchar *first, const gchar *second );
 static void           display_error_message( BaseApplication *application );
@@ -1042,6 +1043,12 @@ application_do_initialize_session_manager( BaseApplication *application )
 	        G_CALLBACK( client_quit_requested_cb ),
 	        application );
 
+	g_signal_connect(
+			application->private->sm_client,
+	        "quit",
+	        G_CALLBACK( client_quit_cb ),
+	        application );
+
 	return( ret );
 }
 
@@ -1178,6 +1185,19 @@ on_unique_message_received(
 }*/
 
 static void
+client_quit_cb( EggSMClient *client, BaseApplication *application )
+{
+	static const gchar *thisfn = "base_application_client_quit_cb";
+
+	g_debug( "%s: client=%p, application=%p", thisfn, ( void * ) client, ( void * ) application );
+
+	if( BASE_IS_WINDOW( application->private->main_window )){
+		g_object_unref( application->private->main_window );
+		application->private->main_window = NULL;
+	}
+}
+
+static void
 client_quit_requested_cb( EggSMClient *client, BaseApplication *application )
 {
 	static const gchar *thisfn = "base_application_client_quit_requested_cb";



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]