[gnome-software] Only present the window when the overview is complete



commit 0a27f7be417348138fd3e675ec23351993704624
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Sep 2 20:50:46 2013 -0400

    Only present the window when the overview is complete
    
    Change GsShell to emit a signal when the overview is fully populated,
    and only present the window when that is emitted.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=707324

 src/gs-application.c |    3 ++-
 src/gs-shell.c       |   16 ++++++++++++++++
 src/gs-shell.h       |    2 ++
 3 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index 0f94683..885f2a6 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -176,7 +176,8 @@ gs_application_startup (GApplication *application)
         window = gs_shell_setup (app->shell, app->plugin_loader, app->cancellable);
         gtk_application_add_window (GTK_APPLICATION (app), window);
 
-        gtk_window_present (window);
+        g_signal_connect_swapped (app->shell, "loaded",
+                                  G_CALLBACK (gtk_window_present), window);
 }
 
 static void
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 2b8e289..9dcc868 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -60,6 +60,13 @@ struct GsShellPrivate
 
 G_DEFINE_TYPE (GsShell, gs_shell, G_TYPE_OBJECT)
 
+enum {
+        SIGNAL_LOADED,
+        SIGNAL_LAST
+};
+
+static guint signals [SIGNAL_LAST] = { 0 };
+
 /**
  * gs_shell_activate:
  **/
@@ -216,6 +223,8 @@ initial_overview_load_done (GsShellOverview *shell_overview, gpointer data)
 
        gs_shell_updates_refresh (shell->priv->shell_updates, TRUE);
        gs_shell_installed_refresh (shell->priv->shell_installed, TRUE);
+
+        g_signal_emit (shell, signals[SIGNAL_LOADED], 0);
 }
 
 static void
@@ -496,6 +505,13 @@ gs_shell_class_init (GsShellClass *klass)
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
        object_class->finalize = gs_shell_finalize;
 
+       signals [SIGNAL_LOADED] =
+                g_signal_new ("loaded",
+                              G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+                              G_STRUCT_OFFSET (GsShellClass, loaded),
+                              NULL, NULL, g_cclosure_marshal_VOID__VOID,
+                              G_TYPE_NONE, 0);
+
        g_type_class_add_private (klass, sizeof (GsShellPrivate));
 }
 
diff --git a/src/gs-shell.h b/src/gs-shell.h
index 4179aa7..548f20f 100644
--- a/src/gs-shell.h
+++ b/src/gs-shell.h
@@ -49,6 +49,8 @@ typedef struct
 typedef struct
 {
        GObjectClass                     parent_class;
+
+        void (* loaded)                 (GsShell *shell);
 } GsShellClass;
 
 typedef enum {


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