[tali] menus: Update for GNOME 3.32 recommendations
- From: Jeremy Bicha <jbicha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tali] menus: Update for GNOME 3.32 recommendations
- Date: Thu, 6 Dec 2018 18:29:08 +0000 (UTC)
commit 2850a3afbb90200e6a3a3ea701a084dab1c373da
Author: Jeremy Bicha <jbicha ubuntu com>
Date: Thu Dec 6 10:29:56 2018 -0500
menus: Update for GNOME 3.32 recommendations
https://gitlab.gnome.org/GNOME/Initiatives/wikis/App-Menu-Retirement
data/tali-menus.ui | 7 +------
src/gyahtzee.c | 14 ++++++++++++++
src/tali.gresource.xml | 2 +-
3 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/data/tali-menus.ui b/data/tali-menus.ui
index 2eb1e7c..46eaa87 100644
--- a/data/tali-menus.ui
+++ b/data/tali-menus.ui
@@ -23,14 +23,9 @@
<attribute name="accel">F1</attribute>
</item>
<item>
- <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="label" translatable="yes">_About Tali</attribute>
<attribute name="action">app.about</attribute>
</item>
- <item>
- <attribute name="label" translatable="yes">_Quit</attribute>
- <attribute name="action">app.quit</attribute>
- <attribute name="accel"><Primary>q</attribute>
- </item>
</section>
</menu>
</interface>
diff --git a/src/gyahtzee.c b/src/gyahtzee.c
index 450e4d8..124ab65 100644
--- a/src/gyahtzee.c
+++ b/src/gyahtzee.c
@@ -724,6 +724,10 @@ GyahtzeeCreateMainWindow (GApplication *app, gpointer user_data)
GtkWidget *tmp;
GtkWidget *dicebox;
GtkWidget *undo_button;
+ GtkWidget *menu_button;
+ GtkWidget *icon;
+ GtkBuilder *builder;
+ GMenuModel *appmenu;
int i, j;
window = gtk_application_window_new (application);
@@ -764,6 +768,16 @@ GyahtzeeCreateMainWindow (GApplication *app, gpointer user_data)
gtk_widget_show (undo_button);
gtk_header_bar_pack_start (GTK_HEADER_BAR (hbar), undo_button);
+ builder = gtk_builder_new_from_resource("/org/gnome/tali/ui/menus.ui");
+ appmenu = (GMenuModel *) gtk_builder_get_object(builder, "app-menu");
+
+ menu_button = gtk_menu_button_new();
+ icon = gtk_image_new_from_icon_name("open-menu-symbolic", GTK_ICON_SIZE_BUTTON);
+ gtk_button_set_image(GTK_BUTTON(menu_button), icon);
+ gtk_menu_button_set_menu_model(GTK_MENU_BUTTON(menu_button), appmenu);
+ gtk_widget_show (GTK_WIDGET (menu_button));
+ gtk_header_bar_pack_end (GTK_HEADER_BAR (hbar), menu_button);
+
/*---- Content ----*/
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
diff --git a/src/tali.gresource.xml b/src/tali.gresource.xml
index 74f94a2..a88deba 100644
--- a/src/tali.gresource.xml
+++ b/src/tali.gresource.xml
@@ -4,7 +4,7 @@
<file preprocess="xml-stripblanks" alias="tali.ui">../data/tali.ui</file>
<file alias="tali.css">../data/tali.css</file>
</gresource> -->
- <gresource prefix="/org/gnome/tali/gtk">
+ <gresource prefix="/org/gnome/tali/ui">
<file preprocess="xml-stripblanks" alias="menus.ui">../data/tali-menus.ui</file>
</gresource>
</gresources>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]