[gnome-software] Refactor out the details shell into a seporate file



commit fd269c400d5d2d2c2dbc03227344b7457dade7da
Author: Richard Hughes <richard hughsie com>
Date:   Fri Aug 23 10:12:44 2013 +0100

    Refactor out the details shell into a seporate file
    
    This will let me do some cleverness with updating/removing.

 src/Makefile.am        |    2 +
 src/gs-shell-details.c |  332 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/gs-shell-details.h |   65 ++++++++++
 src/gs-shell.c         |   91 +++----------
 4 files changed, 419 insertions(+), 71 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index a08d7b6..8ef2c91 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -37,6 +37,8 @@ gnome_software_SOURCES =                              \
        gs-plugin.h                                     \
        gs-shell.c                                      \
        gs-shell.h                                      \
+       gs-shell-details.c                              \
+       gs-shell-details.h                              \
        gs-shell-installed.c                            \
        gs-shell-installed.h                            \
        gs-shell-overview.c                             \
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
new file mode 100644
index 0000000..daca11c
--- /dev/null
+++ b/src/gs-shell-details.c
@@ -0,0 +1,332 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2013 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <glib/gi18n.h>
+
+#include "gs-shell-details.h"
+
+static void    gs_shell_details_finalize       (GObject        *object);
+
+#define GS_SHELL_DETAILS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GS_TYPE_SHELL_DETAILS, 
GsShellDetailsPrivate))
+
+struct GsShellDetailsPrivate
+{
+       GsPluginLoader          *plugin_loader;
+       GtkBuilder              *builder;
+       GCancellable            *cancellable;
+       gboolean                 cache_valid;
+       GsApp                   *app;
+};
+
+G_DEFINE_TYPE (GsShellDetails, gs_shell_details, G_TYPE_OBJECT)
+
+/**
+ * gs_shell_details_invalidate:
+ **/
+void
+gs_shell_details_invalidate (GsShellDetails *shell_details)
+{
+       shell_details->priv->cache_valid = FALSE;
+}
+
+/**
+ * gs_shell_details_refresh:
+ **/
+void
+gs_shell_details_refresh (GsShellDetails *shell_details)
+{
+       GsAppKind kind;
+       GsAppState state;
+       GsShellDetailsPrivate *priv = shell_details->priv;
+       GtkWidget *widget;
+
+       kind = gs_app_get_kind (priv->app);
+       state = gs_app_get_state (priv->app);
+
+       /* install button */
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_install"));
+       switch (state) {
+       case GS_APP_STATE_AVAILABLE:
+               gtk_widget_set_visible (widget, TRUE);
+               gtk_widget_set_sensitive (widget, TRUE);
+               gtk_button_set_label (GTK_BUTTON (widget), _("Install"));
+               break;
+       case GS_APP_STATE_INSTALLING:
+               gtk_widget_set_visible (widget, TRUE);
+               gtk_widget_set_sensitive (widget, FALSE);
+               gtk_button_set_label (GTK_BUTTON (widget), _("Installing"));
+               break;
+       case GS_APP_STATE_INSTALLED:
+       case GS_APP_STATE_REMOVING:
+               gtk_widget_set_visible (widget, FALSE);
+               break;
+       default:
+               g_assert_not_reached ();
+       }
+
+       /* remove button */
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_remove"));
+       if (kind == GS_APP_KIND_SYSTEM) {
+               gtk_widget_set_visible (widget, FALSE);
+       } else {
+               switch (state) {
+               case GS_APP_STATE_INSTALLED:
+                       gtk_widget_set_visible (widget, TRUE);
+                       gtk_widget_set_sensitive (widget, TRUE);
+                       gtk_button_set_label (GTK_BUTTON (widget), _("Remove"));
+                       break;
+               case GS_APP_STATE_REMOVING:
+                       gtk_widget_set_visible (widget, TRUE);
+                       gtk_widget_set_sensitive (widget, FALSE);
+                       gtk_button_set_label (GTK_BUTTON (widget), _("Removing"));
+                       break;
+               case GS_APP_STATE_AVAILABLE:
+               case GS_APP_STATE_INSTALLING:
+                       gtk_widget_set_visible (widget, FALSE);
+                       break;
+               default:
+                       g_assert_not_reached ();
+               }
+       }
+}
+
+/**
+ * gs_shell_details_app_state_changed_cb:
+ **/
+static void
+gs_shell_details_app_state_changed_cb (GsApp *app, GsShellDetails *shell_details)
+{
+       gs_shell_details_refresh (shell_details);
+}
+
+/**
+ * gs_shell_details_set_app:
+ **/
+void
+gs_shell_details_set_app (GsShellDetails *shell_details, GsApp *app)
+{
+       const gchar *tmp;
+       GdkPixbuf *pixbuf;
+       GtkWidget *widget;
+       GtkWidget *widget2;
+       GsShellDetailsPrivate *priv = shell_details->priv;
+
+       /* save app */
+       if (priv->app != NULL)
+               g_object_unref (priv->app);
+       priv->app = g_object_ref (app);
+       g_signal_connect (priv->app, "state-changed",
+                         G_CALLBACK (gs_shell_details_app_state_changed_cb),
+                         shell_details);
+
+       /* change widgets */
+       tmp = gs_app_get_name (app);
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_details_title"));
+       widget2 = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_details_header"));
+       if (tmp != NULL && tmp[0] != '\0') {
+               gtk_label_set_label (GTK_LABEL (widget), tmp);
+               gtk_label_set_label (GTK_LABEL (widget2), tmp);
+               gtk_widget_set_visible (widget, TRUE);
+       } else {
+               gtk_widget_set_visible (widget, FALSE);
+               gtk_label_set_label (GTK_LABEL (widget2), "");
+       }
+       tmp = gs_app_get_summary (app);
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_details_summary"));
+       if (tmp != NULL && tmp[0] != '\0') {
+               gtk_label_set_label (GTK_LABEL (widget), tmp);
+               gtk_widget_set_visible (widget, TRUE);
+       } else {
+               gtk_widget_set_visible (widget, FALSE);
+       }
+       tmp = gs_app_get_description (app);
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_details_description"));
+       if (tmp != NULL && tmp[0] != '\0') {
+               gtk_label_set_label (GTK_LABEL (widget), tmp);
+               gtk_widget_set_visible (widget, TRUE);
+       } else {
+               gtk_widget_set_visible (widget, FALSE);
+       }
+
+       pixbuf = gs_app_get_pixbuf (app);
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_details_icon"));
+       if (pixbuf != NULL) {
+               gtk_image_set_from_pixbuf (GTK_IMAGE (widget), pixbuf);
+               gtk_widget_set_visible (widget, TRUE);
+       } else {
+               gtk_widget_set_visible (widget, FALSE);
+       }
+
+       tmp = gs_app_get_url (app);
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_details_url"));
+       if (tmp != NULL && tmp[0] != '\0') {
+               gtk_link_button_set_uri (GTK_LINK_BUTTON (widget), tmp);
+               gtk_widget_set_visible (widget, TRUE);
+       } else {
+               gtk_widget_set_visible (widget, FALSE);
+       }
+}
+
+/**
+ * gs_shell_details_finished_func:
+ **/
+static void
+gs_shell_details_finished_func (GsPluginLoader *plugin_loader, GsApp *app, gpointer user_data)
+{
+       GsShellDetails *shell_details = GS_SHELL_DETAILS (user_data);
+       gs_shell_details_refresh (shell_details);
+}
+
+/**
+ * gs_shell_details_app_remove_button_cb:
+ **/
+static void
+gs_shell_details_app_remove_button_cb (GtkWidget *widget, GsShellDetails *shell_details)
+{
+       GsShellDetailsPrivate *priv = shell_details->priv;
+       GString *markup;
+       GtkResponseType response;
+       GtkWidget *dialog;
+       GtkWindow *window;
+
+       window = GTK_WINDOW (gtk_builder_get_object (priv->builder, "window_software"));
+       markup = g_string_new ("");
+       g_string_append_printf (markup,
+                               _("Are you sure you want to remove %s?"),
+                               gs_app_get_name (priv->app));
+       g_string_prepend (markup, "<b>");
+       g_string_append (markup, "</b>");
+       dialog = gtk_message_dialog_new (window,
+                                        GTK_DIALOG_MODAL,
+                                        GTK_MESSAGE_QUESTION,
+                                        GTK_BUTTONS_CANCEL,
+                                        NULL);
+       gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), markup->str);
+       gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog),
+                                                   _("%s will be removed, and you will have to install it to 
use it again."),
+                                                   gs_app_get_name (priv->app));
+       gtk_dialog_add_button (GTK_DIALOG (dialog), _("Remove"), GTK_RESPONSE_OK);
+       response = gtk_dialog_run (GTK_DIALOG (dialog));
+       if (response == GTK_RESPONSE_OK) {
+               g_debug ("remove %s", gs_app_get_id (priv->app));
+               gs_plugin_loader_app_remove (priv->plugin_loader,
+                                            priv->app,
+                                            priv->cancellable,
+                                            gs_shell_details_finished_func,
+                                            shell_details);
+       }
+       g_string_free (markup, TRUE);
+       gtk_widget_destroy (dialog);
+}
+
+/**
+ * gs_shell_details_app_install_button_cb:
+ **/
+static void
+gs_shell_details_app_install_button_cb (GtkWidget *widget, GsShellDetails *shell_details)
+{
+       GsShellDetailsPrivate *priv = shell_details->priv;
+       gs_plugin_loader_app_install (priv->plugin_loader,
+                                     priv->app,
+                                     priv->cancellable,
+                                     gs_shell_details_finished_func,
+                                     shell_details);
+}
+
+/**
+ * gs_shell_details_setup:
+ */
+void
+gs_shell_details_setup (GsShellDetails *shell_details,
+                       GsPluginLoader *plugin_loader,
+                       GtkBuilder *builder,
+                       GCancellable *cancellable)
+{
+       GsShellDetailsPrivate *priv = shell_details->priv;
+       GtkWidget *widget;
+
+       g_return_if_fail (GS_IS_SHELL_DETAILS (shell_details));
+
+       priv->plugin_loader = g_object_ref (plugin_loader);
+       priv->builder = g_object_ref (builder);
+       priv->cancellable = g_object_ref (cancellable);
+
+       /* setup details */
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_install"));
+       g_signal_connect (widget, "clicked",
+                         G_CALLBACK (gs_shell_details_app_install_button_cb),
+                         shell_details);
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_remove"));
+       g_signal_connect (widget, "clicked",
+                         G_CALLBACK (gs_shell_details_app_remove_button_cb),
+                         shell_details);
+}
+
+/**
+ * gs_shell_details_class_init:
+ **/
+static void
+gs_shell_details_class_init (GsShellDetailsClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       object_class->finalize = gs_shell_details_finalize;
+
+       g_type_class_add_private (klass, sizeof (GsShellDetailsPrivate));
+}
+
+/**
+ * gs_shell_details_init:
+ **/
+static void
+gs_shell_details_init (GsShellDetails *shell_details)
+{
+       shell_details->priv = GS_SHELL_DETAILS_GET_PRIVATE (shell_details);
+}
+
+/**
+ * gs_shell_details_finalize:
+ **/
+static void
+gs_shell_details_finalize (GObject *object)
+{
+       GsShellDetails *shell_details = GS_SHELL_DETAILS (object);
+       GsShellDetailsPrivate *priv = shell_details->priv;
+
+       g_object_unref (priv->builder);
+       g_object_unref (priv->plugin_loader);
+       g_object_unref (priv->cancellable);
+
+       G_OBJECT_CLASS (gs_shell_details_parent_class)->finalize (object);
+}
+
+/**
+ * gs_shell_details_new:
+ **/
+GsShellDetails *
+gs_shell_details_new (void)
+{
+       GsShellDetails *shell_details;
+       shell_details = g_object_new (GS_TYPE_SHELL_DETAILS, NULL);
+       return GS_SHELL_DETAILS (shell_details);
+}
diff --git a/src/gs-shell-details.h b/src/gs-shell-details.h
new file mode 100644
index 0000000..88409c1
--- /dev/null
+++ b/src/gs-shell-details.h
@@ -0,0 +1,65 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2013 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __GS_SHELL_DETAILS_H
+#define __GS_SHELL_DETAILS_H
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+#include "gs-app.h"
+#include "gs-plugin-loader.h"
+
+G_BEGIN_DECLS
+
+#define GS_TYPE_SHELL_DETAILS          (gs_shell_details_get_type ())
+#define GS_SHELL_DETAILS(o)            (G_TYPE_CHECK_INSTANCE_CAST ((o), GS_TYPE_SHELL_DETAILS, 
GsShellDetails))
+#define GS_SHELL_DETAILS_CLASS(k)      (G_TYPE_CHECK_CLASS_CAST((k), GS_TYPE_SHELL_DETAILS, 
GsShellDetailsClass))
+#define GS_IS_SHELL_DETAILS(o)         (G_TYPE_CHECK_INSTANCE_TYPE ((o), GS_TYPE_SHELL_DETAILS))
+#define GS_IS_SHELL_DETAILS_CLASS(k)   (G_TYPE_CHECK_CLASS_TYPE ((k), GS_TYPE_SHELL_DETAILS))
+#define GS_SHELL_DETAILS_GET_CLASS(o)  (G_TYPE_INSTANCE_GET_CLASS ((o), GS_TYPE_SHELL_DETAILS, 
GsShellDetailsClass))
+
+typedef struct GsShellDetailsPrivate GsShellDetailsPrivate;
+
+typedef struct
+{
+        GObject                         parent;
+        GsShellDetailsPrivate          *priv;
+} GsShellDetails;
+
+typedef struct
+{
+       GObjectClass                     parent_class;
+} GsShellDetailsClass;
+
+GType           gs_shell_details_get_type      (void);
+
+GsShellDetails *gs_shell_details_new           (void);
+void            gs_shell_details_invalidate    (GsShellDetails         *shell_details);
+void            gs_shell_details_set_app       (GsShellDetails         *shell_details,
+                                                GsApp                  *app);
+void            gs_shell_details_refresh       (GsShellDetails         *shell_details);
+void            gs_shell_details_setup         (GsShellDetails         *shell_details,
+                                                GsPluginLoader         *plugin_loader,
+                                                GtkBuilder             *builder,
+                                                GCancellable           *cancellable);
+
+#endif /* __GS_SHELL_DETAILS_H */
diff --git a/src/gs-shell.c b/src/gs-shell.c
index e26eb14..eda7a54 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -25,6 +25,7 @@
 #include <glib/gi18n.h>
 
 #include "gs-shell.h"
+#include "gs-shell-details.h"
 #include "gs-shell-installed.h"
 #include "gs-shell-overview.h"
 #include "gs-shell-updates.h"
@@ -43,13 +44,13 @@ struct GsShellPrivate
        GsShellMode              mode;
        GsShellOverview         *shell_overview;
        GsShellUpdates          *shell_updates;
+       GsShellDetails          *shell_details;
        GtkBuilder              *builder;
        guint                    tab_back_id;
 };
 
 G_DEFINE_TYPE (GsShell, gs_shell, G_TYPE_OBJECT)
 
-static void gs_shell_set_overview_mode_ui (GsShell *shell, GsShellMode mode, GsApp *app);
 static void gs_shell_set_overview_mode (GsShell *shell, GsShellMode mode, GsApp *app, const gchar *category);
 
 /**
@@ -67,11 +68,9 @@ gs_shell_activate (GsShell *shell)
  * gs_shell_set_overview_mode_ui:
  **/
 static void
-gs_shell_set_overview_mode_ui (GsShell *shell, GsShellMode mode, GsApp *app)
+gs_shell_set_overview_mode_ui (GsShell *shell, GsShellMode mode)
 {
        GtkWidget *widget;
-       GsAppState state;
-       GsAppKind kind;
        GsShellPrivate *priv = shell->priv;
 
        priv->ignore_primary_buttons = TRUE;
@@ -103,29 +102,25 @@ gs_shell_set_overview_mode_ui (GsShell *shell, GsShellMode mode, GsApp *app)
                break;
 
        case GS_SHELL_MODE_DETAILS:
-       case GS_SHELL_MODE_CATEGORY:
                widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "buttonbox_main"));
                gtk_widget_set_visible (widget, FALSE);
                widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_details_header"));
                gtk_widget_set_visible (widget, TRUE);
                widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_back"));
                gtk_widget_set_visible (widget, TRUE);
-               if (app) {
-                       kind = gs_app_get_kind (app);
-                       state = gs_app_get_state (app);
-               } else {
-                       kind = GS_APP_KIND_UNKNOWN;
-                       state = GS_APP_STATE_UNKNOWN;
-               }
-               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_install"));
-               gtk_widget_set_visible (widget, state == GS_APP_STATE_AVAILABLE);
-               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_remove"));
-               gtk_widget_set_visible (widget, state == GS_APP_STATE_INSTALLED && kind == 
GS_APP_KIND_NORMAL);
 #ifdef SEARCH
                widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "search_bar"));
                gtk_widget_set_visible (widget, FALSE);
 #endif
                break;
+       case GS_SHELL_MODE_CATEGORY:
+               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "buttonbox_main"));
+               gtk_widget_set_visible (widget, FALSE);
+               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_details_header"));
+               gtk_widget_set_visible (widget, TRUE);
+               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_back"));
+               gtk_widget_set_visible (widget, TRUE);
+               break;
 
        default:
                g_assert_not_reached ();
@@ -186,17 +181,14 @@ gs_shell_set_overview_mode_ui (GsShell *shell, GsShellMode mode, GsApp *app)
 static void
 gs_shell_set_overview_mode (GsShell *shell, GsShellMode mode, GsApp *app, const gchar *category)
 {
-       const gchar *tmp;
-       GdkPixbuf *pixbuf;
        GsShellPrivate *priv = shell->priv;
        GtkWidget *widget;
-       GtkWidget *widget2;
 
        if (priv->ignore_primary_buttons)
                return;
 
        /* set controls */
-       gs_shell_set_overview_mode_ui (shell, mode, app);
+       gs_shell_set_overview_mode_ui (shell, mode);
 
        /* do action for mode */
        priv->mode = mode;
@@ -211,57 +203,8 @@ gs_shell_set_overview_mode (GsShell *shell, GsShellMode mode, GsApp *app, const
                gs_shell_updates_refresh (priv->shell_updates);
                break;
        case GS_SHELL_MODE_DETAILS:
-               tmp = gs_app_get_name (app);
-               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_details_title"));
-               widget2 = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_details_header"));
-               if (tmp != NULL && tmp[0] != '\0') {
-                       gtk_label_set_label (GTK_LABEL (widget), tmp);
-                       gtk_label_set_label (GTK_LABEL (widget2), tmp);
-                       gtk_widget_set_visible (widget, TRUE);
-               }
-               else {
-                       gtk_widget_set_visible (widget, FALSE);
-                       gtk_label_set_label (GTK_LABEL (widget2), "");
-               }
-               tmp = gs_app_get_summary (app);
-               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_details_summary"));
-               if (tmp != NULL && tmp[0] != '\0') {
-                       gtk_label_set_label (GTK_LABEL (widget), tmp);
-                       gtk_widget_set_visible (widget, TRUE);
-               }
-               else {
-                       gtk_widget_set_visible (widget, FALSE);
-               }
-               tmp = gs_app_get_description (app);
-               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, 
"application_details_description"));
-               if (tmp != NULL && tmp[0] != '\0') {
-                       gtk_label_set_label (GTK_LABEL (widget), tmp);
-                       gtk_widget_set_visible (widget, TRUE);
-               }
-               else {
-                       gtk_widget_set_visible (widget, FALSE);
-               }
-
-               pixbuf = gs_app_get_pixbuf (app);
-               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_details_icon"));
-               if (pixbuf != NULL) {
-                       gtk_image_set_from_pixbuf (GTK_IMAGE (widget), pixbuf);
-                       gtk_widget_set_visible (widget, TRUE);
-               }
-               else {
-                       gtk_widget_set_visible (widget, FALSE);
-               }
-
-               tmp = gs_app_get_url (app);
-               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_details_url"));
-               if (tmp != NULL && tmp[0] != '\0') {
-                       gtk_link_button_set_uri (GTK_LINK_BUTTON (widget), tmp);
-                       gtk_widget_set_visible (widget, TRUE);
-               }
-               else {
-                       gtk_widget_set_visible (widget, FALSE);
-               }
-
+               gs_shell_details_set_app (priv->shell_details, app);
+               gs_shell_details_refresh (priv->shell_details);
                break;
        case GS_SHELL_MODE_CATEGORY:
                widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_details_header"));
@@ -406,6 +349,10 @@ gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *can
                                 priv->cancellable);
        g_signal_connect (priv->shell_overview, "set-overview-mode",
                          G_CALLBACK (gs_shell_set_overview_mode_cb), shell);
+       gs_shell_details_setup (priv->shell_details,
+                               priv->plugin_loader,
+                               priv->builder,
+                               priv->cancellable);
 
        /* show main UI */
        gtk_widget_show (main_window);
@@ -445,6 +392,7 @@ gs_shell_init (GsShell *shell)
        shell->priv->shell_updates = gs_shell_updates_new ();
        shell->priv->shell_installed = gs_shell_installed_new ();
        shell->priv->shell_overview = gs_shell_overview_new ();
+       shell->priv->shell_details = gs_shell_details_new ();
        shell->priv->app_startup_mode = GS_SHELL_MODE_OVERVIEW;
        shell->priv->ignore_primary_buttons = FALSE;
 }
@@ -464,6 +412,7 @@ gs_shell_finalize (GObject *object)
        g_object_unref (priv->shell_overview);
        g_object_unref (priv->shell_updates);
        g_object_unref (priv->shell_installed);
+       g_object_unref (priv->shell_details);
 
        G_OBJECT_CLASS (gs_shell_parent_class)->finalize (object);
 }


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