[gnome-software] Add a GsShellMode of UPDATED which shows a historical update



commit 96aecf2f12210d10b0813bbcf497c87f99b239da
Author: Richard Hughes <richard hughsie com>
Date:   Thu Sep 12 14:56:12 2013 +0100

    Add a GsShellMode of UPDATED which shows a historical update
    
    This allows us to see what was done in an offline-update and re-uses the UPDATES page.

 src/gs-application.c   |    2 ++
 src/gs-plugin.h        |    4 ++++
 src/gs-shell-updates.c |    4 +++-
 src/gs-shell-updates.h |    3 ++-
 src/gs-shell.c         |   13 ++++++++++---
 src/gs-shell.h         |    4 +++-
 6 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index 3d35ea7..fcd4cb8 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -248,6 +248,8 @@ gs_application_command_line (GApplication        *application,
                        gs_shell_set_mode (app->shell, GS_SHELL_MODE_INSTALLED);
                } else if (g_strcmp0 (mode, "overview") == 0) {
                        gs_shell_set_mode (app->shell, GS_SHELL_MODE_OVERVIEW);
+               } else if (g_strcmp0 (mode, "updated") == 0) {
+                       gs_shell_set_mode (app->shell, GS_SHELL_MODE_UPDATED);
                } else {
                        g_warning ("Mode '%s' not recognised", mode);
                }
diff --git a/src/gs-plugin.h b/src/gs-plugin.h
index b509c23..598d061 100644
--- a/src/gs-plugin.h
+++ b/src/gs-plugin.h
@@ -122,6 +122,10 @@ gboolean    gs_plugin_add_updates                  (GsPlugin       *plugin,
                                                         GList          **list,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
+gboolean        gs_plugin_add_updates_historical       (GsPlugin       *plugin,
+                                                        GList          **list,
+                                                        GCancellable   *cancellable,
+                                                        GError         **error);
 gboolean        gs_plugin_add_categories               (GsPlugin       *plugin,
                                                         GList          **list,
                                                         GCancellable   *cancellable,
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index 1e39162..882895a 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -128,7 +128,9 @@ out:
  * gs_shell_updates_refresh:
  **/
 void
-gs_shell_updates_refresh (GsShellUpdates *shell_updates, gboolean scroll_up)
+gs_shell_updates_refresh (GsShellUpdates *shell_updates,
+                         gboolean show_historical,
+                         gboolean scroll_up)
 {
        GsShellUpdatesPrivate *priv = shell_updates->priv;
        GtkWidget *widget;
diff --git a/src/gs-shell-updates.h b/src/gs-shell-updates.h
index 38aa180..c408649 100644
--- a/src/gs-shell-updates.h
+++ b/src/gs-shell-updates.h
@@ -55,7 +55,8 @@ GType          gs_shell_updates_get_type      (void);
 GsShellUpdates *gs_shell_updates_new           (void);
 void            gs_shell_updates_invalidate    (GsShellUpdates         *shell_updates);
 void            gs_shell_updates_refresh       (GsShellUpdates         *shell_updates,
-                                                gboolean               scroll_up);
+                                                gboolean                show_historical,
+                                                gboolean                scroll_up);
 void            gs_shell_updates_setup         (GsShellUpdates         *shell_updates,
                                                 GsShell                *shell,
                                                 GsPluginLoader         *plugin_loader,
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 1b2fa3e..0689686 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -122,9 +122,13 @@ gs_shell_change_mode (GsShell *shell, GsShellMode mode, GsApp *app, GsCategory *
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), mode == GS_SHELL_MODE_UPDATES);
        priv->ignore_primary_buttons = FALSE;
 
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "buttonbox_main"));
+       gtk_widget_set_visible (widget, mode != GS_SHELL_MODE_UPDATED);
+
        /* switch page */
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "notebook_main"));
-       gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), mode);
+       gtk_notebook_set_current_page (GTK_NOTEBOOK (widget),
+                                      mode == GS_SHELL_MODE_UPDATED ? GS_SHELL_MODE_UPDATES : mode);
 
        /* do action for mode */
        priv->mode = mode;
@@ -141,7 +145,10 @@ gs_shell_change_mode (GsShell *shell, GsShellMode mode, GsApp *app, GsCategory *
                gs_shell_search_refresh (priv->shell_search, text);
                break;
        case GS_SHELL_MODE_UPDATES:
-               gs_shell_updates_refresh (priv->shell_updates, scroll_up);
+               gs_shell_updates_refresh (priv->shell_updates, FALSE, scroll_up);
+               break;
+       case GS_SHELL_MODE_UPDATED:
+               gs_shell_updates_refresh (priv->shell_updates, TRUE, scroll_up);
                break;
        case GS_SHELL_MODE_DETAILS:
                gs_shell_details_set_app (priv->shell_details, app);
@@ -222,7 +229,7 @@ initial_overview_load_done (GsShellOverview *shell_overview, gpointer data)
 
        g_signal_handlers_disconnect_by_func (shell_overview, initial_overview_load_done, data);
 
-       gs_shell_updates_refresh (shell->priv->shell_updates, TRUE);
+       gs_shell_updates_refresh (shell->priv->shell_updates, FALSE, TRUE);
        gs_shell_installed_refresh (shell->priv->shell_installed, TRUE);
 
        g_signal_emit (shell, signals[SIGNAL_LOADED], 0);
diff --git a/src/gs-shell.h b/src/gs-shell.h
index 0f1e7b4..d56e1c7 100644
--- a/src/gs-shell.h
+++ b/src/gs-shell.h
@@ -59,7 +59,9 @@ typedef enum {
        GS_SHELL_MODE_SEARCH,
        GS_SHELL_MODE_UPDATES,
        GS_SHELL_MODE_DETAILS,
-       GS_SHELL_MODE_CATEGORY
+       GS_SHELL_MODE_CATEGORY,
+       GS_SHELL_MODE_UPDATED,
+       GS_SHELL_MODE_LAST
 } GsShellMode;
 
 GType           gs_shell_get_type              (void);


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