[gnome-font-viewer] font-view: use basename in header bar when no family name
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-font-viewer] font-view: use basename in header bar when no family name
- Date: Sun, 1 Dec 2019 23:39:34 +0000 (UTC)
commit 519715d9b036563e467c813f69fbefff2042d89d
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sun Dec 1 15:25:36 2019 -0800
font-view: use basename in header bar when no family name
Instead of displaying an empty header bar, fall back to the basename
of the file we're viewing.
src/font-view.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/font-view.c b/src/font-view.c
index 2c7e02d..26679cb 100644
--- a/src/font-view.c
+++ b/src/font-view.c
@@ -1033,7 +1033,13 @@ font_widget_loaded_cb (SushiFontWidget *font_widget,
uri = sushi_font_widget_get_uri (font_widget);
self->font_file = g_file_new_for_uri (uri);
- gtk_header_bar_set_title (GTK_HEADER_BAR (self->header), face->family_name);
+ if (face->family_name) {
+ gtk_header_bar_set_title (GTK_HEADER_BAR (self->header), face->family_name);
+ } else {
+ g_autofree gchar *basename = g_file_get_basename (self->font_file);
+ gtk_header_bar_set_title (GTK_HEADER_BAR (self->header), basename);
+ }
+
gtk_header_bar_set_subtitle (GTK_HEADER_BAR (self->header), face->style_name);
install_button_refresh_appearance (self, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]