[gnome-font-viewer/wip/cdavis/remove-primary-menu] Font-view: Remove primary menu
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-font-viewer/wip/cdavis/remove-primary-menu] Font-view: Remove primary menu
- Date: Mon, 18 Jul 2022 22:35:28 +0000 (UTC)
commit 78a12cd456ffac0b4fbd3ecb878f0a20a5b8f44c
Author: Christopher Davis <christopherdavis gnome org>
Date: Mon Jul 18 18:34:16 2022 -0400
Font-view: Remove primary menu
Instead of having a primary menu with only one item,
we should just use a single button for the about window.
Closes #47
src/font-view-app-menu.ui | 10 ----------
src/font-view.c | 22 +++++++---------------
src/gnome-font-viewer.gresource.xml | 2 +-
src/info-symbolic.svg | 1 +
4 files changed, 9 insertions(+), 26 deletions(-)
---
diff --git a/src/font-view.c b/src/font-view.c
index c8934c5..3268405 100644
--- a/src/font-view.c
+++ b/src/font-view.c
@@ -75,7 +75,7 @@ struct _FontViewApplication
GtkWidget *search_bar;
GtkWidget *search_entry;
GtkWidget *search_toggle;
- GtkWidget *menu_button;
+ GtkWidget *about_button;
GtkFilter *filter;
GtkSorter *sorter;
@@ -1016,7 +1016,7 @@ font_view_application_do_open (FontViewApplication *self,
}
gtk_widget_hide (self->search_toggle);
- gtk_widget_hide (self->menu_button);
+ gtk_widget_hide (self->about_button);
uri = g_file_get_uri (file);
@@ -1084,7 +1084,7 @@ font_view_application_do_overview (FontViewApplication *self)
}
gtk_widget_show (self->search_toggle);
- gtk_widget_show (self->menu_button);
+ gtk_widget_show (self->about_button);
font_view_ensure_model (self);
GtkWidget *title = adw_window_title_new (_ ("All Fonts"), NULL);
@@ -1204,10 +1204,8 @@ search_text_changed (GtkEntry *entry, FontViewApplication *self)
static void
ensure_window (FontViewApplication *self)
{
- g_autoptr (GtkBuilder) builder = NULL;
GtkWidget *swin, *box;
GtkApplicationWindow *window;
- GMenuModel *menu;
if (self->main_window)
return;
@@ -1234,17 +1232,11 @@ ensure_window (FontViewApplication *self)
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_stack_add_named (GTK_STACK (self->stack), box, "overview");
- builder = gtk_builder_new ();
- gtk_builder_add_from_resource (
- builder, "/org/gnome/font-viewer/font-view-app-menu.ui", NULL);
- menu = G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu"));
+ self->about_button = gtk_button_new_from_icon_name ("info-symbolic");
+ gtk_actionable_set_action_name (GTK_ACTIONABLE (self->about_button), "app.about");
+ gtk_widget_set_tooltip_text (self->about_button, _("About Fonts"));
- self->menu_button = gtk_menu_button_new ();
- gtk_menu_button_set_icon_name (GTK_MENU_BUTTON (self->menu_button),
- "open-menu-symbolic");
- gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (self->menu_button), menu);
-
- gtk_header_bar_pack_end (GTK_HEADER_BAR (self->header), self->menu_button);
+ gtk_header_bar_pack_start (GTK_HEADER_BAR (self->header), self->about_button);
self->search_bar = gtk_search_bar_new ();
gtk_box_append (GTK_BOX (box), self->search_bar);
diff --git a/src/gnome-font-viewer.gresource.xml b/src/gnome-font-viewer.gresource.xml
index 2a4ea62..545ec0c 100644
--- a/src/gnome-font-viewer.gresource.xml
+++ b/src/gnome-font-viewer.gresource.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/font-viewer">
- <file preprocess="xml-stripblanks">font-view-app-menu.ui</file>
+ <file alias="icons/scalable/actions/info-symbolic.svg">info-symbolic.svg</file>
<file>style.css</file>
</gresource>
</gresources>
diff --git a/src/info-symbolic.svg b/src/info-symbolic.svg
new file mode 100644
index 0000000..65d5d5d
--- /dev/null
+++ b/src/info-symbolic.svg
@@ -0,0 +1 @@
+<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M7.906 1A7.002 7.002 0 0 0 1 8c0
3.867 3.133 7 7 7s7-3.133 7-7-3.133-7-7-7h-.094zM7.5 4h1c.277 0 .5.223.5.5v1c0 .277-.223.5-.5.5h-1a.498.498 0
0 1-.5-.5v-1c0-.277.223-.5.5-.5zM7 7h2v5H7zm0 0" fill="#2e3436"/></svg>
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]