[gnome-font-viewer/wip/ewlsh/gtk4: 13/17] font-view: Use AdwWindowTitle for window titles
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-font-viewer/wip/ewlsh/gtk4: 13/17] font-view: Use AdwWindowTitle for window titles
- Date: Sat, 12 Feb 2022 01:17:34 +0000 (UTC)
commit f63d4bcae2cc31f0f9d33a72f6316a6a67574c7c
Author: Christopher Davis <christopherdavis gnome org>
Date: Fri Feb 11 16:57:13 2022 -0800
font-view: Use AdwWindowTitle for window titles
This prevents us from having to roll our own title
widgets, and gives us proper styling and behavior.
src/font-view.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
---
diff --git a/src/font-view.c b/src/font-view.c
index a94069b..b444460 100644
--- a/src/font-view.c
+++ b/src/font-view.c
@@ -890,6 +890,7 @@ font_widget_loaded_cb (SushiFontWidget *font_widget, gpointer user_data)
{
FontViewApplication *self = user_data;
FT_Face face = sushi_font_widget_get_ft_face (font_widget);
+ GtkWidget *title = adw_window_title_new (NULL, NULL);
const gchar *uri;
if (face == NULL)
@@ -899,16 +900,14 @@ font_widget_loaded_cb (SushiFontWidget *font_widget, gpointer user_data)
self->font_file = g_file_new_for_uri (uri);
if (face->family_name) {
- GtkWidget *label = gtk_label_new (face->family_name);
- gtk_header_bar_set_title_widget (GTK_HEADER_BAR (self->header), label);
+ adw_window_title_set_title (ADW_WINDOW_TITLE (title), face->family_name);
} else {
g_autofree gchar *basename = g_file_get_basename (self->font_file);
- GtkWidget *label = gtk_label_new (basename);
- gtk_header_bar_set_title_widget (GTK_HEADER_BAR (self->header), label);
+ adw_window_title_set_title (ADW_WINDOW_TITLE (title), basename);
}
- // gtk_header_bar_set_subtitle (GTK_HEADER_BAR (self->header),
- // face->style_name);
+ adw_window_title_set_subtitle (ADW_WINDOW_TITLE (title), face->style_name);
+ gtk_header_bar_set_title_widget (GTK_HEADER_BAR (self->header), title);
install_button_refresh_appearance (self, NULL);
}
@@ -1090,11 +1089,8 @@ font_view_application_do_overview (FontViewApplication *self)
gtk_widget_show (self->menu_button);
font_view_ensure_model (self);
- GtkWidget *title_label = gtk_label_new (_ ("All Fonts"));
- gtk_header_bar_set_title_widget (GTK_HEADER_BAR (self->header),
- title_label);
- // TODO: GTK4 - Setup subtitle
- // gtk_header_bar_set_subtitle (GTK_HEADER_BAR (self->header), NULL);
+ GtkWidget *title = adw_window_title_new (_ ("All Fonts"), NULL);
+ gtk_header_bar_set_title_widget (GTK_HEADER_BAR (self->header), title);
if (self->grid_view == NULL) {
GtkWidget *grid_view;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]