[gnome-software/wip/temp/ubuntu-xenial-rebased: 122/326] Quit when the main window is closed



commit a1adb5d92cad84dd406d35546796c1cb44e0edec
Author: William Hua <william hua canonical com>
Date:   Tue Mar 1 16:07:34 2016 -0500

    Quit when the main window is closed

 src/gs-shell.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 73319a8..75a0e2f 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -674,6 +674,13 @@ gs_shell_monitor_permission (GsShell *shell)
                                  G_CALLBACK (on_permission_changed), shell);
 }
 
+static void
+gs_shell_main_window_hidden_cb (GtkWidget *widget,
+                               gpointer   user_data)
+{
+       g_action_group_activate_action (G_ACTION_GROUP (g_application_get_default ()), "quit", NULL);
+}
+
 /**
  * gs_shell_setup:
  */
@@ -695,6 +702,8 @@ gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *can
        /* get UI */
        priv->builder = gtk_builder_new_from_resource ("/org/gnome/Software/gnome-software.ui");
        priv->main_window = GTK_WINDOW (gtk_builder_get_object (priv->builder, "window_software"));
+       g_signal_connect (priv->main_window, "hide",
+                         G_CALLBACK (gs_shell_main_window_hidden_cb), shell);
        g_signal_connect (priv->main_window, "map",
                          G_CALLBACK (gs_shell_main_window_mapped_cb), shell);
 


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