Subject: [PATCH 1/2] Add a traditional menu bar (v3.28.2)
Bug: https://bugzilla.gnome.org/749976
Bug-Debian: https://bugs.debian.org/793445
---
 data/eog-menubar.ui   | 213 ++++++++++++++++++++++++++++++++++++++++++
 data/meson.build      |   1 +
 po/POTFILES.in        |   1 +
 src/eog-application.c |  35 +++++++
 src/eog.gresource.xml |   1 +
 5 files changed, 251 insertions(+), 0 deletions(-)
 create mode 100644 data/eog-menubar.ui

diff --git a/data/eog-menubar.ui b/data/eog-menubar.ui
new file mode 100644
index 0000000..5241c75
--- /dev/null
+++ b/data/eog-menubar.ui
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="utf-8"?>
+<interface>
+  <menu id="menubar">
+    <submenu>
+      <attribute name="label" translatable="yes">_Image</attribute>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Open…</attribute>
+          <attribute name="action">win.open</attribute>
+          <attribute name="accel">&lt;Ctrl&gt;o</attribute>
+        </item>
+        <item>
+        <attribute name="label" translatable="yes">Op_en With…</attribute>
+        <attribute name="action">win.open-with</attribute>
+        </item>
+      </section>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Save</attribute>
+          <attribute name="action">win.save</attribute>
+          <attribute name="accel">&lt;Ctrl&gt;s</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Save As…</attribute>
+          <attribute name="action">win.save-as</attribute>
+          <attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;s</attribute>
+        </item>
+      </section>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">Print…</attribute>
+          <attribute name="action">win.print</attribute>
+          <attribute name="accel">&lt;Ctrl&gt;p</attribute>
+        </item>
+      </section>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">Set as _Wallpaper</attribute>
+          <attribute name="action">win.set-wallpaper</attribute>
+          <attribute name="accel">&lt;Ctrl&gt;F8</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">Show Containing _Folder</attribute>
+          <attribute name="action">win.open-folder</attribute>
+        </item>
+      </section>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">Image Properties</attribute>
+          <attribute name="action">win.properties</attribute>
+          <attribute name="accel">&lt;Alt&gt;Return</attribute>
+        </item>
+      </section>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Close</attribute>
+          <attribute name="action">win.close</attribute>
+          <attribute name="accel">&lt;Ctrl&gt;w</attribute>
+        </item>
+      </section>
+    </submenu>
+    <submenu>
+      <attribute name="label" translatable="yes">_Edit</attribute>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Undo</attribute>
+          <attribute name="action">win.undo</attribute>
+          <attribute name="accel">&lt;Ctrl&gt;z</attribute>
+        </item>
+      </section>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Copy Image</attribute>
+          <attribute name="action">win.copy</attribute>
+          <attribute name="accel">&lt;Ctrl&gt;c</attribute>
+        </item>
+      </section>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">Flip _Horizontal</attribute>
+          <attribute name="action">win.flip-horizontal</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">Flip _Vertical</attribute>
+          <attribute name="action">win.flip-vertical</attribute>
+        </item>
+      </section>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Rotate Clockwise</attribute>
+          <attribute name="action">win.rotate-90</attribute>
+          <attribute name="accel">&lt;Ctrl&gt;r</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">Rotate Counter_clockwise</attribute>
+          <attribute name="action">win.rotate-270</attribute>
+          <attribute name="accel">&lt;Ctrl&gt;&lt;Shift&gt;r</attribute>
+        </item>
+      </section>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">Move to _Trash</attribute>
+          <attribute name="action">win.move-trash</attribute>
+          <attribute name="accel">Delete</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Delete</attribute>
+          <attribute name="action">win.delete</attribute>
+          <attribute name="accel">&lt;Shift&gt;Delete</attribute>
+        </item>
+      </section>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Preferences</attribute>
+          <attribute name="action">app.preferences</attribute>
+        </item>
+      </section>
+    </submenu>
+    <submenu>
+      <attribute name="label" translatable="yes">_View</attribute>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Statusbar</attribute>
+          <attribute name="action">win.view-statusbar</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Image Gallery</attribute>
+          <attribute name="action">win.view-gallery</attribute>
+          <attribute name="accel">F9</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">Side _Pane</attribute>
+          <attribute name="action">win.view-sidebar</attribute>
+          <attribute name="accel">&lt;Ctrl&gt;F9</attribute>
+        </item>
+      </section>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">Zoom _In</attribute>
+          <attribute name="action">win.zoom-in</attribute>
+          <attribute name="accel">plus</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">Zoom _Out</attribute>
+          <attribute name="action">win.zoom-out</attribute>
+          <attribute name="accel">minus</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Best Fit</attribute>
+          <attribute name="action">win.toggle-zoom-fit</attribute>
+          <attribute name="accel">F</attribute>
+        </item>
+      </section>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Fullscreen</attribute>
+          <attribute name="action">win.view-fullscreen</attribute>
+          <attribute name="accel">F11</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">Slide Show</attribute>
+          <attribute name="action">win.view-slideshow</attribute>
+          <attribute name="accel">F5</attribute>
+        </item>
+      </section>
+    </submenu>
+    <submenu>
+      <attribute name="label" translatable="yes">_Go</attribute>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_Previous Image</attribute>
+          <attribute name="action">win.go-previous</attribute>
+          <attribute name="accel">Left</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Next Image</attribute>
+          <attribute name="action">win.go-next</attribute>
+          <attribute name="accel">Right</attribute>
+        </item>
+      </section>
+      <section>
+        <item>
+          <attribute name="label" translatable="yes">_First Image</attribute>
+          <attribute name="action">win.go-first</attribute>
+          <attribute name="accel">&lt;Alt&gt;Home</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Last Image</attribute>
+          <attribute name="action">win.go-last</attribute>
+          <attribute name="accel">&lt;Alt&gt;End</attribute>
+        </item>
+      </section>
+    </submenu>
+    <submenu>
+      <attribute name="label" translatable="yes">_Help</attribute>
+      <section>
+        <item>
+          <attribute name="action">win.show-help-overlay</attribute>
+          <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_Help</attribute>
+          <attribute name="action">win.manual</attribute>
+          <attribute name="accel">F1</attribute>
+        </item>
+        <item>
+          <attribute name="label" translatable="yes">_About</attribute>
+          <attribute name="action">app.about</attribute>
+        </item>
+      </section>
+    </submenu>
+  </menu>
+</interface>
diff --git a/data/meson.build b/data/meson.build
index 17c9140..7adcb40 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -2,6 +2,7 @@ subdir('icons')
 
 resource_data = files(
   'pixmaps/thumbnail-frame.png',
+  'eog-menubar.ui',
   'eog-details-dialog.ui',
   'eog-gear-menu.ui',
   'eog-multiple-save-as-dialog.ui',
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 31cf8f1..8bc89b4 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -3,6 +3,7 @@
 data/eog.appdata.xml.in
 data/eog-gear-menu.ui
 data/eog-details-dialog.ui
+data/eog-menubar.ui
 data/eog-multiple-save-as-dialog.ui
 data/eog-preferences-dialog.ui
 data/eog-remote-presenter.ui
diff --git a/src/eog-application.c b/src/eog-application.c
index 69a5c06..ed2a82d 100644
--- a/src/eog-application.c
+++ b/src/eog-application.c
@@ -266,6 +266,29 @@ on_extension_removed (PeasExtensionSet *set,
 	eog_application_activatable_deactivate (EOG_APPLICATION_ACTIVATABLE (exten));
 }
 
+static gboolean
+in_desktop (const gchar *name)
+{
+	const gchar *desktop_name_list;
+	gchar **names;
+	gboolean in_list = FALSE;
+	gint i;
+
+	desktop_name_list = g_getenv ("XDG_CURRENT_DESKTOP");
+	if (!desktop_name_list)
+		return FALSE;
+
+	names = g_strsplit (desktop_name_list, ":", -1);
+	for (i = 0; names[i] && !in_list; i++)
+		if (strcmp (names[i], name) == 0) {
+			in_list = TRUE;
+			break;
+		}
+	g_strfreev (names);
+
+	return in_list;
+}
+
 static void
 eog_application_startup (GApplication *application)
 {
@@ -327,6 +350,18 @@ eog_application_startup (GApplication *application)
 			  G_CALLBACK (on_extension_removed), app);
 
 	peas_extension_set_call (app->priv->extensions, "activate");
+
+	if (!in_desktop("GNOME"))
+	{
+		GtkBuilder *builder;
+		builder = gtk_builder_new_from_resource ("/org/gnome/eog/gtk/menu/menus-traditional.ui");
+
+		gtk_application_set_app_menu (GTK_APPLICATION (application), NULL);
+		gtk_application_set_menubar (GTK_APPLICATION (application),
+									G_MENU_MODEL (gtk_builder_get_object (builder, "menubar")));
+
+		g_object_unref (builder);
+	}
 }
 
 static void
diff --git a/src/eog.gresource.xml b/src/eog.gresource.xml
index 472408a..0305a13 100644
--- a/src/eog.gresource.xml
+++ b/src/eog.gresource.xml
@@ -13,6 +13,7 @@
     <file compressed="true" preprocess="xml-stripblanks">popup-menus.ui</file>
   </gresource>
   <gresource prefix="/org/gnome/eog/gtk">
+    <file alias="menu/menus-traditional.ui" compressed="true" preprocess="xml-stripblanks">eog-menubar.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">help-overlay.ui</file>
   </gresource>
 </gresources>
-- 
2.26.2

