[gnome-software] GsShellDetails: Use gs_shell_get_mode
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] GsShellDetails: Use gs_shell_get_mode
- Date: Wed, 28 Aug 2013 13:34:48 +0000 (UTC)
commit 333526e075c7d7a357419c954e1ba9a1241ac034
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Aug 28 09:33:39 2013 -0400
GsShellDetails: Use gs_shell_get_mode
We use it to ensure that we are only updating header content
if we are still the current page. In order to do this, we need
to keep a reference to the GsShell in GsShellDetails.
src/gs-shell-details.c | 9 ++++++++-
src/gs-shell-details.h | 2 ++
src/gs-shell.c | 1 +
3 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 0a2f441..e69e3e7 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -37,6 +37,7 @@ struct GsShellDetailsPrivate
GCancellable *cancellable;
gboolean cache_valid;
GsApp *app;
+ GsShell *shell;
};
G_DEFINE_TYPE (GsShellDetails, gs_shell_details, G_TYPE_OBJECT)
@@ -56,11 +57,14 @@ gs_shell_details_invalidate (GsShellDetails *shell_details)
void
gs_shell_details_refresh (GsShellDetails *shell_details)
{
+ GsShellDetailsPrivate *priv = shell_details->priv;
GsAppKind kind;
GsAppState state;
- GsShellDetailsPrivate *priv = shell_details->priv;
GtkWidget *widget;
+ if (gs_shell_get_mode (priv->shell) != GS_SHELL_MODE_DETAILS)
+ return;
+
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_details_header"));
gtk_widget_show (widget);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_back"));
@@ -264,6 +268,7 @@ gs_shell_details_app_install_button_cb (GtkWidget *widget, GsShellDetails *shell
*/
void
gs_shell_details_setup (GsShellDetails *shell_details,
+ GsShell *shell,
GsPluginLoader *plugin_loader,
GtkBuilder *builder,
GCancellable *cancellable)
@@ -273,6 +278,8 @@ gs_shell_details_setup (GsShellDetails *shell_details,
g_return_if_fail (GS_IS_SHELL_DETAILS (shell_details));
+ priv->shell = shell;
+
priv->plugin_loader = g_object_ref (plugin_loader);
priv->builder = g_object_ref (builder);
priv->cancellable = g_object_ref (cancellable);
diff --git a/src/gs-shell-details.h b/src/gs-shell-details.h
index 88409c1..cec0533 100644
--- a/src/gs-shell-details.h
+++ b/src/gs-shell-details.h
@@ -26,6 +26,7 @@
#include <gtk/gtk.h>
#include "gs-app.h"
+#include "gs-shell.h"
#include "gs-plugin-loader.h"
G_BEGIN_DECLS
@@ -58,6 +59,7 @@ 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,
+ GsShell *shell,
GsPluginLoader *plugin_loader,
GtkBuilder *builder,
GCancellable *cancellable);
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 3f53380..87c38dd 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -227,6 +227,7 @@ gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *can
priv->builder,
priv->cancellable);
gs_shell_details_setup (priv->shell_details,
+ shell,
priv->plugin_loader,
priv->builder,
priv->cancellable);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]