[gnome-font-viewer/wip/cdavis/browsing-view] window: Use AdwBrowsingView instead of AdwLeaflet
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-font-viewer/wip/cdavis/browsing-view] window: Use AdwBrowsingView instead of AdwLeaflet
- Date: Tue, 11 Oct 2022 18:51:10 +0000 (UTC)
commit 92c646e0cc1be63a6666030f510575964498e182
Author: Christopher Davis <christopherdavis gnome org>
Date: Tue Oct 11 14:15:59 2022 -0400
window: Use AdwBrowsingView instead of AdwLeaflet
flatpak/org.gnome.font-viewerDevel.json | 33 +++++++++++++++++++++++++++++++
src/font-view-application.c | 2 --
src/font-view-window.c | 35 +++++++++++----------------------
src/font-view-window.ui | 26 +++++++-----------------
4 files changed, 52 insertions(+), 44 deletions(-)
---
diff --git a/flatpak/org.gnome.font-viewerDevel.json b/flatpak/org.gnome.font-viewerDevel.json
index 21420a9..46f3848 100644
--- a/flatpak/org.gnome.font-viewerDevel.json
+++ b/flatpak/org.gnome.font-viewerDevel.json
@@ -38,6 +38,39 @@
}
]
},
+ {
+ "name" : "libsass",
+ "buildsystem" : "meson",
+ "sources" : [
+ {
+ "type" : "git",
+ "url" : "https://github.com/lazka/libsass.git",
+ "branch" : "meson"
+ }
+ ]
+ },
+ {
+ "name" : "sassc",
+ "buildsystem" : "meson",
+ "sources" : [
+ {
+ "type" : "git",
+ "url" : "https://github.com/lazka/sassc.git",
+ "branch" : "meson"
+ }
+ ]
+ },
+ {
+ "name" : "libadwaita",
+ "buildsystem" : "meson",
+ "sources" : [
+ {
+ "type" : "git",
+ "url" : "https://gitlab.gnome.org/GNOME/libadwaita.git",
+ "branch" : "wip/exalm/browsing-view"
+ }
+ ]
+ },
{
"name": "gnome-font-viewer",
"buildsystem": "meson",
diff --git a/src/font-view-application.c b/src/font-view-application.c
index 7dd050f..f39810b 100644
--- a/src/font-view-application.c
+++ b/src/font-view-application.c
@@ -74,7 +74,6 @@ query_info_ready_cb (GObject *object, GAsyncResult *res, gpointer user_data)
info = g_file_query_info_finish (G_FILE (object), res, &error);
if (error != NULL) {
- font_view_window_show_overview (self->main_window);
font_view_window_show_error (self->main_window,
_("Could Not Display Font"),
error->message);
@@ -157,7 +156,6 @@ font_view_application_activate (GApplication *application)
FontViewApplication *self = FONT_VIEW_APPLICATION (application);
ensure_window (self);
- font_view_window_show_overview (self->main_window);
}
static void
diff --git a/src/font-view-window.c b/src/font-view-window.c
index 393984b..b5d9f44 100644
--- a/src/font-view-window.c
+++ b/src/font-view-window.c
@@ -51,7 +51,7 @@ struct _FontViewWindow
{
AdwApplicationWindow parent_instance;
- AdwLeaflet *leaflet;
+ AdwBrowsingView *browsing_view;
/* Overview */
GtkSearchBar *search_bar;
@@ -601,16 +601,6 @@ install_font_job (GTask *task,
g_task_return_boolean (task, TRUE);
}
-static void
-action_overview_cb (GtkWidget *widget,
- const char *action_name,
- GVariant *parameter)
-{
- FontViewWindow *self = FONT_VIEW_WINDOW (widget);
-
- font_view_window_show_overview (self);
-}
-
static void
action_install_font_cb (GtkWidget *widget,
const char *action_name,
@@ -746,10 +736,16 @@ font_widget_error_cb (FontViewWindow *self,
GError *error,
SushiFontWidget *font_widget)
{
- font_view_window_show_overview (self);
+ adw_browsing_view_pop (self->browsing_view, TRUE);
font_view_window_show_error (self, _("Could Not Display Font"), error->message);
}
+static void
+preview_hiding_cb (FontViewWindow *self)
+{
+ g_clear_object (&self->font_file);
+}
+
FontViewWindow *
font_view_window_new (FontViewApplication *app)
{
@@ -758,14 +754,6 @@ font_view_window_new (FontViewApplication *app)
NULL);
}
-void
-font_view_window_show_overview (FontViewWindow *self)
-{
- g_clear_object (&self->font_file);
-
- adw_leaflet_set_visible_child_name (self->leaflet, "overview");
-}
-
void
font_view_window_show_preview (FontViewWindow *self,
GFile *file,
@@ -798,7 +786,7 @@ font_view_window_show_preview (FontViewWindow *self,
}
gtk_toggle_button_set_active (self->info_button, FALSE);
- adw_leaflet_set_visible_child_name (self->leaflet, "preview");
+ adw_browsing_view_push_by_name (self->browsing_view, "preview", TRUE);
}
void
@@ -838,7 +826,7 @@ font_view_window_class_init (FontViewWindowClass *klass)
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/font-viewer/font-view-window.ui");
- gtk_widget_class_bind_template_child (widget_class, FontViewWindow, leaflet);
+ gtk_widget_class_bind_template_child (widget_class, FontViewWindow, browsing_view);
gtk_widget_class_bind_template_child (widget_class, FontViewWindow, search_bar);
gtk_widget_class_bind_template_child (widget_class, FontViewWindow, search_entry);
gtk_widget_class_bind_template_child (widget_class, FontViewWindow, grid_view);
@@ -855,12 +843,12 @@ font_view_window_class_init (FontViewWindowClass *klass)
gtk_widget_class_bind_template_callback (widget_class, font_widget_loaded_cb);
gtk_widget_class_bind_template_callback (widget_class, view_child_activated_cb);
+ gtk_widget_class_bind_template_callback (widget_class, preview_hiding_cb);
gtk_widget_class_bind_template_callback (widget_class, font_attribute_closure);
gtk_widget_class_bind_template_callback (widget_class, font_name_closure);
gtk_widget_class_bind_template_callback (widget_class, preview_visible_child_closure);
- gtk_widget_class_install_action (widget_class, "win.back", NULL, action_overview_cb);
gtk_widget_class_install_action (widget_class, "win.install-font", NULL, action_install_font_cb);
}
@@ -885,3 +873,4 @@ font_view_window_init (FontViewWindow *self)
if (g_str_has_suffix (APPLICATION_ID, "Devel"))
gtk_widget_add_css_class (GTK_WIDGET (self), "devel");
}
+
diff --git a/src/font-view-window.ui b/src/font-view-window.ui
index 2e6f385..1142efe 100644
--- a/src/font-view-window.ui
+++ b/src/font-view-window.ui
@@ -7,22 +7,16 @@
<property name="width-request">360</property>
<property name="height-request">294</property>
<property name="content">
- <object class="AdwLeaflet" id="leaflet">
- <property name="can-unfold">False</property>
- <property name="can-navigate-back">True</property>
+ <object class="AdwBrowsingView" id="browsing_view">
<child>
- <object class="AdwLeafletPage">
- <property name="name">overview</property>
+ <object class="AdwBrowsingViewChild">
+ <property name="title" translatable="yes">All Fonts</property>
+ <property name="child-name">overview</property>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="AdwHeaderBar">
- <property name="title-widget">
- <object class="AdwWindowTitle">
- <property name="title" translatable="yes">All Fonts</property>
- </object>
- </property>
<child type="start">
<object class="GtkToggleButton">
<property name="icon-name">edit-find-symbolic</property>
@@ -152,8 +146,9 @@
</object>
</child>
<child>
- <object class="AdwLeafletPage">
- <property name="name">preview</property>
+ <object class="AdwBrowsingViewChild">
+ <signal name="hiding" handler="preview_hiding_cb" swapped="yes"/>
+ <property name="child-name">preview</property>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
@@ -162,13 +157,6 @@
<property name="title-widget">
<object class="AdwWindowTitle" id="font_title"/>
</property>
- <child type="start">
- <object class="GtkButton">
- <property name="icon-name">go-previous-symbolic</property>
- <property name="tooltip-text" translatable="yes">Back</property>
- <property name="action-name">win.back</property>
- </object>
- </child>
<child type="end">
<object class="GtkButton" id="install_button">
<property name="label" translatable="yes">Install</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]