diff options
author | Christopher Davis <christopherdavis@gnome.org> | 2022-10-11 14:15:59 -0400 |
---|---|---|
committer | Christopher Davis <christopherdavis@gnome.org> | 2022-10-11 15:01:58 -0400 |
commit | fea943745e7d9c3093cb64642ce165270e548458 (patch) | |
tree | 4147c6d12b21bf4da30f2351081d87d3a8a49314 | |
parent | a2c1079360f6d1e22551197638e966ab630e6b7b (diff) | |
download | gnome-font-viewer-fea943745e7d9c3093cb64642ce165270e548458.tar.gz |
window: Use AdwBrowsingView instead of AdwLeafletwip/cdavis/browsing-view
-rw-r--r-- | flatpak/org.gnome.font-viewerDevel.json | 33 | ||||
-rw-r--r-- | src/font-view-application.c | 2 | ||||
-rw-r--r-- | src/font-view-window.c | 36 | ||||
-rw-r--r-- | src/font-view-window.ui | 26 |
4 files changed, 53 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 @@ -39,6 +39,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", "builddir" : true, 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..ec953da 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; @@ -602,16 +602,6 @@ install_font_job (GTask *task, } 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, GVariant *parameter) @@ -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_hidden_cb (FontViewWindow *self) +{ + g_clear_object (&self->font_file); +} + FontViewWindow * font_view_window_new (FontViewApplication *app) { @@ -759,14 +755,6 @@ font_view_window_new (FontViewApplication *app) } 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, int face_index) @@ -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_hidden_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,5 @@ 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..9fc5a6c 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="hidden" handler="preview_hidden_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> |