[gnome-software/wip/temp/ubuntu-xenial-rebased-corrected: 185/331] Revert "Terminate immediately on close"



commit aacfda6e9e94f2e89e76a411936de4e400648668
Author: William Hua <william hua canonical com>
Date:   Tue Apr 5 12:08:31 2016 +0100

    Revert "Terminate immediately on close"
    
    This reverts commit 0ea65a85eb9fd2e71295f694aa4fb30aae773956.

 src/gs-application.c |    1 +
 src/gs-shell.c       |   22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index d313e96..327330c 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -769,6 +769,7 @@ gs_application_new (void)
        return g_object_new (GS_APPLICATION_TYPE,
                             "application-id", "org.gnome.Software",
                             "flags", G_APPLICATION_HANDLES_OPEN,
+                            "inactivity-timeout", 12000,
                             NULL);
 }
 
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 68eb415..c6528e5 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -604,6 +604,25 @@ window_button_press_event (GtkWidget *win, GdkEventButton *event, GsShell *shell
        return GDK_EVENT_STOP;
 }
 
+static gboolean
+main_window_closed_cb (GtkWidget *dialog, GdkEvent *event, gpointer user_data)
+{
+       GsShell *shell = user_data;
+       GsShellPrivate *priv = gs_shell_get_instance_private (shell);
+       BackEntry *entry;
+
+       /* When the window is closed, reset the initial mode to overview */
+       priv->mode = GS_SHELL_MODE_OVERVIEW;
+
+       /* ... and clear any remaining entries in the back button stack */
+       while ((entry = g_queue_pop_head (priv->back_entry_stack)) != NULL) {
+               free_back_entry (entry);
+       }
+
+       gtk_widget_hide (dialog);
+       return TRUE;
+}
+
 /**
  * gs_shell_updates_changed_cb:
  */
@@ -700,6 +719,9 @@ gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *can
        gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
                                           GS_DATA G_DIR_SEPARATOR_S "icons");
 
+       g_signal_connect (priv->main_window, "delete-event",
+                         G_CALLBACK (main_window_closed_cb), shell);
+
        /* fix up the header bar */
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "header"));
        if (gs_utils_is_current_desktop ("Unity")) {


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