[gnome-software] When loading a specific mode at startup don't wait for the overview to load



commit 0a5fbd45ca1671484915a8845db78a66b4d3a681
Author: Richard Hughes <richard hughsie com>
Date:   Thu Sep 12 14:52:42 2013 +0100

    When loading a specific mode at startup don't wait for the overview to load

 src/gs-application.c |    5 ++++-
 src/gs-shell.c       |   12 +++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index 622f8b3..3d35ea7 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -247,10 +247,13 @@ gs_application_command_line (GApplication      *application,
                } else if (g_strcmp0 (mode, "installed") == 0) {
                        gs_shell_set_mode (app->shell, GS_SHELL_MODE_INSTALLED);
                } else if (g_strcmp0 (mode, "overview") == 0) {
-                       /* this is the default */
+                       gs_shell_set_mode (app->shell, GS_SHELL_MODE_OVERVIEW);
                } else {
                        g_warning ("Mode '%s' not recognised", mode);
                }
+       } else {
+               /* this is the default */
+               gs_shell_set_mode (app->shell, GS_SHELL_MODE_OVERVIEW);
        }
 
        g_free (argv);
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 9c606a5..1b2fa3e 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -462,7 +462,6 @@ gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *can
        /* load content */
        g_signal_connect (priv->shell_overview, "refreshed",
                          G_CALLBACK (initial_overview_load_done), shell);
-       gs_shell_change_mode (shell, GS_SHELL_MODE_OVERVIEW, NULL, NULL, TRUE);
 
        return GTK_WINDOW (main_window);
 }
@@ -473,6 +472,17 @@ gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *can
 void
 gs_shell_set_mode (GsShell *shell, GsShellMode mode)
 {
+       guint matched;
+
+       /* if we're loading a different mode at startup then don't wait for
+        * the overview page to load before showing content */
+       if (mode != GS_SHELL_MODE_OVERVIEW) {
+               matched = g_signal_handlers_disconnect_by_func (shell->priv->shell_overview,
+                                                               initial_overview_load_done,
+                                                               shell);
+               if (matched > 0)
+                       g_signal_emit (shell, signals[SIGNAL_LOADED], 0);
+       }
        gs_shell_change_mode (shell, mode, NULL, NULL, TRUE);
 }
 


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