[gnome-software/wip/kalev/metadata-download-progress] WIP: Metadata download progress



commit dab150fe7fcc1b31a4cf1c6def4be3b2f5ee5f36
Author: Kalev Lember <klember redhat com>
Date:   Mon Aug 10 21:19:03 2015 +0200

    WIP: Metadata download progress
    
    XXX: unfinished
    
    
https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/software/version2/software-setup-progress.png

 src/gs-shell-overview.c  |   46 ++++++++++++++++++++++++++++++++++++--
 src/gs-shell-overview.ui |   54 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+), 3 deletions(-)
---
diff --git a/src/gs-shell-overview.c b/src/gs-shell-overview.c
index 37c8908..172efd9 100644
--- a/src/gs-shell-overview.c
+++ b/src/gs-shell-overview.c
@@ -335,9 +335,6 @@ gs_shell_overview_get_categories_cb (GObject *source_object,
        }
 out:
        gs_plugin_list_free (list);
-       if (has_category) {
-               priv->empty = FALSE;
-       }
        gtk_widget_set_visible (priv->category_heading, has_category);
 
        priv->loading_categories = FALSE;
@@ -487,6 +484,27 @@ gs_shell_overview_switch_to (GsShellOverview *shell, gboolean scroll_up)
        gs_shell_overview_load (shell);
 }
 
+static void
+status_changed_cb (GsPluginLoader *plugin_loader,
+                   GsApp *app,
+                   GsPluginStatus status,
+                   GsShellOverview *shell_overview)
+{
+       GsShellOverviewPrivate *priv = shell_overview->priv;
+       GtkWidget *widget;
+
+       // XXX: what happens if we start in another mode and get the downloading status change?
+       if (gs_shell_get_mode (priv->shell) != GS_SHELL_MODE_OVERVIEW)
+               return;
+
+       if (!priv->cache_valid && status == GS_PLUGIN_STATUS_DOWNLOADING) {
+               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "search_bar"));
+               gtk_widget_hide (widget);
+
+               gtk_stack_set_visible_child_name (GTK_STACK (priv->stack_overview), "downloading");
+       }
+}
+
 void
 gs_shell_overview_setup (GsShellOverview *shell_overview,
                         GsShell *shell,
@@ -508,6 +526,11 @@ gs_shell_overview_setup (GsShellOverview *shell_overview,
        /* avoid a ref cycle */
        priv->shell = shell;
 
+       // XXX: disconnect signal too
+       g_signal_connect (priv->plugin_loader, "status-changed",
+                         G_CALLBACK (status_changed_cb),
+                         shell_overview);
+
        adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->scrolledwindow_overview));
        gtk_container_set_focus_vadjustment (GTK_CONTAINER (priv->box_overview), adj);
 
@@ -555,6 +578,23 @@ static void
 gs_shell_overview_refreshed (GsShellOverview *shell)
 {
        GsShellOverviewPrivate *priv = shell->priv;
+       GtkWidget *widget;
+
+g_print ("gs_shell_overview_refreshed\n");
+#if 0
+       gtk_stack_set_visible_child_name (GTK_STACK (priv->stack_overview), "downloading");
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "buttonbox_main"));
+       gtk_widget_set_sensitive (widget, FALSE);
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "search_bar"));
+       gtk_widget_hide (widget);
+
+       return;
+#endif
+
+       if (gs_shell_get_mode (priv->shell) == GS_SHELL_MODE_OVERVIEW) {
+               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "search_bar"));
+               gtk_widget_show (widget);
+       }
 
        if (priv->empty) {
                gtk_stack_set_visible_child_name (GTK_STACK (priv->stack_overview), "no-results");
diff --git a/src/gs-shell-overview.ui b/src/gs-shell-overview.ui
index 2165a02..e035e13 100644
--- a/src/gs-shell-overview.ui
+++ b/src/gs-shell-overview.ui
@@ -206,6 +206,60 @@
           </packing>
         </child>
         <child>
+          <object class="GtkBox" id="downloading_box">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <property name="valign">center</property>
+            <property name="spacing">16</property>
+            <child>
+              <object class="GtkImage" id="downloading_icon">
+                <property name="visible">True</property>
+                <property name="icon_name">gnome-software-symbolic</property>
+                <property name="pixel-size">128</property>
+                <property name="margin_bottom">32</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkProgressBar" id="downloading_progressbar">
+                <property name="visible">True</property>
+                <property name="width_request">280</property>
+                <property name="halign">center</property>
+                <property name="fraction">0.3</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="downloading_label">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">Software catalog is being downloaded</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="name">downloading</property>
+          </packing>
+        </child>
+        <child>
           <object class="GtkGrid" id="noresults_grid_overview">
             <property name="visible">True</property>
             <property name="hexpand">True</property>


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