[gnome-software] GsShell: Improve back stack
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] GsShell: Improve back stack
- Date: Sun, 1 Sep 2013 02:08:48 +0000 (UTC)
commit 17b093637b94662fefafde5f560c694d7068e836
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Aug 31 19:20:46 2013 -0400
GsShell: Improve back stack
Future-proof this a bit, by also supporting going back
to an app page - this may be used in the future when we
get 'related' links on the app details page.
src/gs-shell.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 6547f77..12cebc1 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -166,12 +166,26 @@ save_back_entry (GsShell *shell)
entry = g_new0 (BackEntry, 1);
entry->mode = priv->mode;
- if (priv->mode == GS_SHELL_MODE_CATEGORY)
+ if (priv->mode == GS_SHELL_MODE_CATEGORY) {
entry->category = gs_shell_category_get_category (priv->shell_category);
+ g_object_ref (entry->category);
+ }
+ else if (priv->mode == GS_SHELL_MODE_DETAILS) {
+ entry->app = gs_shell_details_get_app (priv->shell_details);
+ g_object_ref (entry->app);
+ }
priv->back_entry_stack = g_slist_prepend (priv->back_entry_stack, entry);
}
+static void
+free_back_entry (BackEntry *entry)
+{
+ g_clear_object (&entry->category);
+ g_clear_object (&entry->app);
+ g_free (entry);
+}
+
/**
* gs_shell_back_button_cb:
**/
@@ -187,7 +201,7 @@ gs_shell_back_button_cb (GtkWidget *widget, GsShell *shell)
gs_shell_change_mode (shell, entry->mode, entry->app, entry->category);
- g_free (entry);
+ free_back_entry (entry);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]