[gnome-software: 90/110] gs-shell: Switch to AdwViewStack
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 90/110] gs-shell: Switch to AdwViewStack
- Date: Tue, 5 Oct 2021 20:32:43 +0000 (UTC)
commit b7ad09e80c5629f80f3b149df87ce6cdfbdb3ee1
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Aug 26 16:32:11 2021 -0300
gs-shell: Switch to AdwViewStack
This is the widget that AdwViewSwitcherTitle expects, and it's a
pretty trivial grep and replace.
src/gs-shell.c | 28 ++++++++++++++--------------
src/gs-shell.ui | 27 ++++++++++++---------------
2 files changed, 26 insertions(+), 29 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index b20eca683..451e4e575 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -74,9 +74,9 @@ struct _GsShell
gchar *events_info_uri;
AdwLeaflet *main_leaflet;
AdwLeaflet *details_leaflet;
- GtkStack *stack_loading;
- GtkStack *stack_main;
- GtkStack *stack_sub;
+ AdwViewStack *stack_loading;
+ AdwViewStack *stack_main;
+ AdwViewStack *stack_sub;
GsPage *page;
GBinding *sub_page_header_title_binding;
@@ -546,7 +546,7 @@ stack_notify_visible_child_cb (GObject *object,
}
g_clear_object (&shell->sub_page_header_title_binding);
- shell->sub_page_header_title_binding = g_object_bind_property (gtk_stack_get_visible_child
(shell->stack_sub), "title",
+ shell->sub_page_header_title_binding = g_object_bind_property (adw_view_stack_get_visible_child
(shell->stack_sub), "title",
shell->sub_page_header_title, "label",
G_BINDING_SYNC_CREATE);
@@ -591,11 +591,11 @@ gs_shell_change_mode (GsShell *shell,
/* switch page */
if (mode == GS_SHELL_MODE_LOADING) {
- gtk_stack_set_visible_child_name (shell->stack_loading, "loading");
+ adw_view_stack_set_visible_child_name (shell->stack_loading, "loading");
return;
}
- gtk_stack_set_visible_child_name (shell->stack_loading, "main");
+ adw_view_stack_set_visible_child_name (shell->stack_loading, "main");
if (mode == GS_SHELL_MODE_DETAILS) {
adw_leaflet_set_visible_child_name (shell->details_leaflet, "details");
} else {
@@ -604,7 +604,7 @@ gs_shell_change_mode (GsShell *shell,
* page to preserve the navigation history in the UI's state.
* First change the page, then the leaflet, to avoid load of
* the previously shown page, which will be changed shortly after. */
- gtk_stack_set_visible_child_name (mode_is_main ? shell->stack_main : shell->stack_sub,
page_name[mode]);
+ adw_view_stack_set_visible_child_name (mode_is_main ? shell->stack_main : shell->stack_sub,
page_name[mode]);
adw_leaflet_set_visible_child_name (shell->main_leaflet, mode_is_main ? "main" : "sub");
}
@@ -2148,18 +2148,18 @@ updates_page_notify_counter_cb (GObject *obj,
{
GsPage *page = GS_PAGE (obj);
GsShell *shell = GS_SHELL (user_data);
- GtkStackPage *stack_page;
+ AdwViewStackPage *stack_page;
gboolean needs_attention;
/* Update the needs-attention child property of the page in the
- * GtkStack. There’s no need to account for whether it’s the currently
+ * AdwViewStack. There’s no need to account for whether it’s the currently
* visible page, as the CSS rules do that for us. This can’t be a simple
* property binding, though, as it’s a binding between an object
* property and a child property. */
needs_attention = (gs_page_get_counter (page) > 0);
- stack_page = gtk_stack_get_page (shell->stack_main, GTK_WIDGET (page));
- gtk_stack_page_set_needs_attention (stack_page, needs_attention);
+ stack_page = adw_view_stack_get_page (shell->stack_main, GTK_WIDGET (page));
+ adw_view_stack_page_set_needs_attention (stack_page, needs_attention);
}
static void
@@ -2246,16 +2246,16 @@ gs_shell_get_mode (GsShell *shell)
{
const gchar *name;
- if (g_strcmp0 (gtk_stack_get_visible_child_name (shell->stack_loading), "loading") == 0)
+ if (g_strcmp0 (adw_view_stack_get_visible_child_name (shell->stack_loading), "loading") == 0)
return GS_SHELL_MODE_LOADING;
if (g_strcmp0 (adw_leaflet_get_visible_child_name (shell->details_leaflet), "details") == 0)
return GS_SHELL_MODE_DETAILS;
if (g_strcmp0 (adw_leaflet_get_visible_child_name (shell->main_leaflet), "main") == 0)
- name = gtk_stack_get_visible_child_name (shell->stack_main);
+ name = adw_view_stack_get_visible_child_name (shell->stack_main);
else
- name = gtk_stack_get_visible_child_name (shell->stack_sub);
+ name = adw_view_stack_get_visible_child_name (shell->stack_sub);
for (gsize i = 0; i < G_N_ELEMENTS (page_name); i++)
if (g_strcmp0 (page_name[i], name) == 0)
diff --git a/src/gs-shell.ui b/src/gs-shell.ui
index 76ac9a1b4..3470781af 100644
--- a/src/gs-shell.ui
+++ b/src/gs-shell.ui
@@ -42,13 +42,12 @@
</object>
</child>
<child>
- <object class="GtkStack" id="stack_loading">
+ <object class="AdwViewStack" id="stack_loading">
<property name="visible">True</property>
- <property name="transition-type">crossfade</property>
<property name="width-request">360</property>
<signal name="notify::visible-child" handler="stack_notify_visible_child_cb"/>
<child>
- <object class="GtkStackPage">
+ <object class="AdwViewStackPage">
<property name="name">main</property>
<property name="child">
<object class="GtkOverlay" id="overlay">
@@ -303,16 +302,15 @@
</object>
</child>
<child>
- <object class="GtkStack" id="stack_main">
+ <object class="AdwViewStack" id="stack_main">
<property name="visible">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hhomogeneous">False</property>
<property name="vhomogeneous">False</property>
- <property name="transition-type">crossfade</property>
<signal name="notify::visible-child"
handler="stack_notify_visible_child_cb"/>
<child>
- <object class="GtkStackPage">
+ <object class="AdwViewStackPage">
<property name="name">overview</property>
<property name="title" translatable="yes" comments="Translators:
A label for a button to show all available software.">Explore</property>
<property name="icon-name">explore2-symbolic</property>
@@ -324,7 +322,7 @@
</object>
</child>
<child>
- <object class="GtkStackPage">
+ <object class="AdwViewStackPage">
<property name="name">installed</property>
<!-- FIXME: Add mnemonics support when it’s supported in GTK
(same for the other pages).
See https://gitlab.gnome.org/GNOME/gtk/-/issues/3134 -->
@@ -339,7 +337,7 @@
</object>
</child>
<child>
- <object class="GtkStackPage">
+ <object class="AdwViewStackPage">
<property name="name">search</property>
<property name="child">
<object class="GsSearchPage" id="search_page">
@@ -349,7 +347,7 @@
</object>
</child>
<child>
- <object class="GtkStackPage">
+ <object class="AdwViewStackPage">
<property name="name">updates</property>
<property name="title" translatable="yes" comments="Translators:
A label for a button to show only updates which are available to install.">Updates</property>
<property
name="icon-name">emblem-synchronizing-symbolic</property>
@@ -422,16 +420,15 @@
</object>
</child>
<child>
- <object class="GtkStack" id="stack_sub">
+ <object class="AdwViewStack" id="stack_sub">
<property name="visible">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hhomogeneous">False</property>
<property name="vhomogeneous">False</property>
- <property name="transition-type">crossfade</property>
<signal name="notify::visible-child"
handler="stack_notify_visible_child_cb"/>
<child>
- <object class="GtkStackPage">
+ <object class="AdwViewStackPage">
<property name="name">moderate</property>
<property name="child">
<object class="GsModeratePage" id="moderate_page">
@@ -441,7 +438,7 @@
</object>
</child>
<child>
- <object class="GtkStackPage">
+ <object class="AdwViewStackPage">
<property name="name">category</property>
<property name="child">
<object class="GsCategoryPage" id="category_page">
@@ -452,7 +449,7 @@
</object>
</child>
<child>
- <object class="GtkStackPage">
+ <object class="AdwViewStackPage">
<property name="name">extras</property>
<property name="child">
<object class="GsExtrasPage" id="extras_page">
@@ -531,7 +528,7 @@
</object>
</child>
<child>
- <object class="GtkStackPage">
+ <object class="AdwViewStackPage">
<property name="name">loading</property>
<property name="child">
<object class="GtkOverlay">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]