[latexila/wip/app-menu: 2/6] Add an app menu



commit af779e1be190184afdb7b08b8c59eb28a0a86119
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Nov 6 11:27:00 2015 +0100

    Add an app menu
    
    Better late than never. It's redundant with the menubar, but it's better
    to keep the items in the menubar too because the app menu is difficult
    to discover. The app menu is just to make GNOME people happy (but IIRC
    I've never received any complaints about the lack of app menu in
    LaTeXila).

 po/POTFILES.in             |    1 +
 src/latexila.gresource.xml |    1 +
 src/latexila_app.vala      |   13 ++++++++++++-
 src/ui/Makefile.am         |    4 +++-
 src/ui/app_menu.ui         |   39 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 56 insertions(+), 2 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e7c31ef..addb6a1 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -62,5 +62,6 @@ src/structure.vala
 src/symbols.vala
 src/symbols_view.vala
 src/tab_info_bar.vala
+[type: gettext/glade]src/ui/app_menu.ui
 [type: gettext/glade]src/ui/preferences_dialog.ui
 src/utils.vala
diff --git a/src/latexila.gresource.xml b/src/latexila.gresource.xml
index a2878c8..1a7dc1e 100644
--- a/src/latexila.gresource.xml
+++ b/src/latexila.gresource.xml
@@ -2,6 +2,7 @@
 
 <gresources>
   <gresource prefix="/org/gnome/latexila">
+    <file>ui/app_menu.ui</file>
     <file>ui/latexila.adwaita.css</file>
   </gresource>
 
diff --git a/src/latexila_app.vala b/src/latexila_app.vala
index 8455ee1..5275597 100644
--- a/src/latexila_app.vala
+++ b/src/latexila_app.vala
@@ -1,7 +1,7 @@
 /*
  * This file is part of LaTeXila.
  *
- * Copyright © 2010-2012 Sébastien Wilmet
+ * Copyright © 2010-2015 Sébastien Wilmet
  *
  * LaTeXila is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -124,6 +124,7 @@ public class LatexilaApp : Gtk.Application
         Latexila.utils_register_icons ();
         StockIcons.register_stock_icons ();
         setup_theme_extensions ();
+        setup_app_menu ();
 
         AppSettings.get_default ();
         create_window ();
@@ -195,6 +196,16 @@ public class LatexilaApp : Gtk.Application
         }
     }
 
+    private void setup_app_menu ()
+    {
+        Gtk.Builder builder =
+            new Gtk.Builder.from_resource ("/org/gnome/latexila/ui/app_menu.ui");
+        builder.set_translation_domain (Config.GETTEXT_PACKAGE);
+        unowned GLib.MenuModel app_menu = builder.get_object ("app_menu")
+            as GLib.MenuModel;
+        set_app_menu (app_menu);
+    }
+
     private void reopen_files ()
     {
         GLib.Settings editor_settings =
diff --git a/src/ui/Makefile.am b/src/ui/Makefile.am
index c1251b9..5bfddc1 100644
--- a/src/ui/Makefile.am
+++ b/src/ui/Makefile.am
@@ -4,6 +4,8 @@ dist_ui_DATA =                  \
        preferences_dialog.ui   \
        ui.xml
 
-EXTRA_DIST = latexila.adwaita.css
+EXTRA_DIST =                   \
+       app_menu.ui             \
+       latexila.adwaita.css
 
 -include $(top_srcdir)/git.mk
diff --git a/src/ui/app_menu.ui b/src/ui/app_menu.ui
new file mode 100644
index 0000000..295c1a8
--- /dev/null
+++ b/src/ui/app_menu.ui
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<interface>
+  <menu id="app_menu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_New Window</attribute>
+        <attribute name="action">app.new_window</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Preferences</attribute>
+        <attribute name="action">app.preferences</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Manage Build Tools</attribute>
+        <attribute name="action">app.manage_build_tools</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Help</attribute>
+        <attribute name="action">app.help</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">LaTeXila _Fundraiser</attribute>
+        <attribute name="action">app.fundraiser</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_About</attribute>
+        <attribute name="action">app.about</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Quit</attribute>
+        <attribute name="action">app.quit</attribute>
+      </item>
+    </section>
+  </menu>
+</interface>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]