[gnome-software] GsApplication: Don't stay running as a service when not asked to



commit c2affda6dc9462b5b85b414727c22efcd5aa8448
Author: Kalev Lember <kalevlember gmail com>
Date:   Wed May 14 17:54:34 2014 +0200

    GsApplication: Don't stay running as a service when not asked to
    
    Only stay running as a session service when we were started with
    --gapplication-service; otherwise make sure to actually exit the app
    when the user chooses Quit.
    
    Without having a way to actually exit the app, it's difficult to run it
    under valgrind to debug memory leaks.

 src/gs-application.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index c85d654..e445803 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -265,14 +265,23 @@ quit_activated (GSimpleAction *action,
                GVariant      *parameter,
                gpointer       app)
 {
+       GApplicationFlags flags;
        GList *windows;
        GtkWidget *window;
 
-       windows = gtk_application_get_windows (GTK_APPLICATION (app));
-       if (windows) {
-               window = windows->data;
-               gtk_widget_hide (window);
+       flags = g_application_get_flags (app);
+
+       if (flags & G_APPLICATION_IS_SERVICE) {
+               windows = gtk_application_get_windows (GTK_APPLICATION (app));
+               if (windows) {
+                       window = windows->data;
+                       gtk_widget_hide (window);
+               }
+
+               return;
        }
+
+       g_application_quit (G_APPLICATION (app));
 }
 
 static void


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