[gnome-software/wip/rancell/reviews] Quit when the main window is closed



commit fdce1e5da1b0a4cf067e7cf621539ee402b1ba6c
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 26189eb..a2d3317 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -567,6 +567,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:
  */
@@ -588,6 +595,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]