Blame SOURCES/0001-Revert-Revert-Revert-the-introduction-of-the-amtk-li.patch

76a060
From 7295e3ca5b6ce5061666c2da4c339853f0d16efc Mon Sep 17 00:00:00 2001
76a060
From: Jordan Petridis <jordan@centricular.com>
76a060
Date: Sat, 10 Apr 2021 01:57:50 +0300
76a060
Subject: [PATCH] Revert "Revert "Revert the introduction of the amtk library""
76a060
76a060
This reverts commit 18369a6958664f10b68c9edb749dbd3af7cc731a.
76a060
76a060
amtk is now archived.
76a060
---
76a060
 .gitignore                     |   1 +
76a060
 README.md                      |   1 -
76a060
 flatpak/org.gnome.Devhelp.json |  45 ++++++
76a060
 flatpak/org.gnome.Devhelp.yml  |  45 ------
76a060
 meson.build                    |   2 +-
76a060
 po/POTFILES.in                 |   3 +
76a060
 src/dh-app.c                   | 255 ++++++++++-----------------------
76a060
 src/dh-app.h                   |   2 -
76a060
 src/dh-main.c                  |   3 -
76a060
 src/dh-window.c                | 255 ++++++---------------------------
76a060
 src/dh-window.ui               | 245 +++++++++++++++++++++++++++++++
76a060
 src/dh.gresource.xml           |   5 +
76a060
 src/help-overlay.ui            | 117 +++++++++++++++
76a060
 src/menus.ui                   |  58 ++++++++
76a060
 14 files changed, 599 insertions(+), 438 deletions(-)
76a060
 create mode 100644 flatpak/org.gnome.Devhelp.json
76a060
 delete mode 100644 flatpak/org.gnome.Devhelp.yml
76a060
 create mode 100644 src/dh-window.ui
76a060
 create mode 100644 src/help-overlay.ui
76a060
 create mode 100644 src/menus.ui
76a060
76a060
\ No newline at end of file
76a060
diff --git a/README.md b/README.md
76a060
index 6057f78b..2d83a3c2 100644
76a060
--- a/README.md
76a060
+++ b/README.md
76a060
@@ -1,54 +1,53 @@
76a060
 Devhelp
76a060
 =======
76a060
 
76a060
 The Devhelp web page:
76a060
 
76a060
 https://wiki.gnome.org/Apps/Devhelp
76a060
 
76a060
 Installation of the Devhelp Flatpak
76a060
 -----------------------------------
76a060
 
76a060
 - [Devhelp on Flathub](https://flathub.org/apps/details/org.gnome.Devhelp)
76a060
 
76a060
 How to contribute
76a060
 -----------------
76a060
 
76a060
 See the [HACKING](HACKING) file.
76a060
 
76a060
 Dependencies
76a060
 ------------
76a060
 
76a060
 - GLib
76a060
 - GTK
76a060
 - WebKitGTK
76a060
-- [Amtk](https://wiki.gnome.org/Projects/Amtk)
76a060
 - gsettings-desktop-schemas
76a060
 
76a060
 Description
76a060
 -----------
76a060
 
76a060
 Devhelp is a developer tool for browsing and searching API documentation.
76a060
 It provides an easy way to navigate through libraries and to search by
76a060
 function, struct, or macro.
76a060
 
76a060
 The documentation must be installed locally, so an internet connection is
76a060
 not needed to use Devhelp.
76a060
 
76a060
 Devhelp works natively with GTK-Doc, so the GTK and GNOME libraries are
76a060
 well supported. But other development platforms can be supported as well,
76a060
 as long as the API documentation is available in HTML and a `*.devhelp2`
76a060
 index file is generated.
76a060
 
76a060
 Devhelp integrates with other applications such as Glade, Builder or
76a060
 Anjuta, and plugins are available for different text editors (gedit, Vim,
76a060
 Emacs, Geany, …).
76a060
 
76a060
 Integration with other developer tools
76a060
 --------------------------------------
76a060
 
76a060
 Devhelp provides some command line options, such as `--search` and
76a060
 `--search-assistant`. A text editor plugin can for example launch the command
76a060
 `devhelp --search function_name` when a keyboard shortcut is pressed, with the
76a060
 `function_name` under the cursor.
76a060
 
76a060
 Devhelp also provides a shared library, to integrate the GTK widgets inside an
76a060
diff --git a/flatpak/org.gnome.Devhelp.json b/flatpak/org.gnome.Devhelp.json
76a060
new file mode 100644
76a060
index 00000000..a2d1372d
76a060
--- /dev/null
76a060
+++ b/flatpak/org.gnome.Devhelp.json
76a060
@@ -0,0 +1,45 @@
76a060
+{
76a060
+    "app-id" : "org.gnome.Devhelp",
76a060
+    "runtime" : "org.gnome.Sdk",
76a060
+    "runtime-version" : "master",
76a060
+    "sdk" : "org.gnome.Sdk",
76a060
+    "command" : "devhelp",
76a060
+    "tags" : [
76a060
+        "nightly"
76a060
+    ],
76a060
+    "desktop-file-name-prefix" : "(Nightly) ",
76a060
+    "finish-args" : [
76a060
+        "--share=ipc",
76a060
+        "--socket=x11",
76a060
+        "--socket=wayland",
76a060
+        "--device=dri",
76a060
+        "--filesystem=host:ro"
76a060
+    ],
76a060
+    "cleanup" : [
76a060
+        "/include",
76a060
+        "/lib/pkgconfig",
76a060
+        "/share/pkgconfig",
76a060
+        "share/aclocal",
76a060
+        "man",
76a060
+        "share/man",
76a060
+        "*.la",
76a060
+        "*.a"
76a060
+    ],
76a060
+    "modules" : [
76a060
+        {
76a060
+            "name" : "devhelp",
76a060
+            "buildsystem" : "meson",
76a060
+            "config-opts" : [
76a060
+                "-Dflatpak_build=true"
76a060
+            ],
76a060
+            "run-tests" : true,
76a060
+            "sources" : [
76a060
+                {
76a060
+                    "type" : "git",
76a060
+                    "url" : "https://gitlab.gnome.org/GNOME/devhelp.git",
76a060
+                    "branch" : "master"
76a060
+                }
76a060
+            ]
76a060
+        }
76a060
+    ]
76a060
+}
76a060
diff --git a/flatpak/org.gnome.Devhelp.yml b/flatpak/org.gnome.Devhelp.yml
76a060
deleted file mode 100644
76a060
index 49b838b7..00000000
76a060
--- a/flatpak/org.gnome.Devhelp.yml
76a060
+++ /dev/null
76a060
@@ -1,45 +0,0 @@
76a060
-app-id: org.gnome.Devhelp
76a060
-runtime: org.gnome.Sdk
76a060
-runtime-version: master
76a060
-sdk: org.gnome.Sdk
76a060
-command: devhelp
76a060
-tags:
76a060
-  - nightly
76a060
-desktop-file-name-prefix: "(Nightly) "
76a060
-
76a060
-finish-args:
76a060
-  # X11 + XShm access
76a060
-  - --share=ipc
76a060
-  - --socket=x11
76a060
-  # Wayland access
76a060
-  - --socket=wayland
76a060
-  # OpenGL for Webkit
76a060
-  - --device=dri
76a060
-  # We want full fs access to see the API docs installed by traditional Linux
76a060
-  # distro packages.
76a060
-  - --filesystem=host:ro
76a060
-
76a060
-build-options:
76a060
-  cflags: -O2 -g
76a060
-  cxxflags: -O2 -g
76a060
-
76a060
-cleanup:
76a060
-  - /share/man
76a060
-  - /lib/pkgconfig
76a060
-  - /include
76a060
-
76a060
-modules:
76a060
-  - name: amtk
76a060
-    buildsystem: meson
76a060
-    run-tests: true
76a060
-    sources:
76a060
-      - type: git
76a060
-        url: https://gitlab.gnome.org/GNOME/amtk.git
76a060
-
76a060
-  - name: devhelp
76a060
-    buildsystem: meson
76a060
-    config-opts: [ "-Dflatpak_build=true" ]
76a060
-    run-tests: true
76a060
-    sources:
76a060
-      - type: git
76a060
-        url: https://gitlab.gnome.org/GNOME/devhelp.git
76a060
diff --git a/meson.build b/meson.build
76a060
index bdd66056..d71d748d 100644
76a060
--- a/meson.build
76a060
+++ b/meson.build
76a060
@@ -35,61 +35,61 @@ LIBDEVHELP_API_VERSION_FULL = '3.0'
76a060
 #    changed since the last update, increment CURRENT and set REVISION
76a060
 #    to 0.
76a060
 # 3. If any exported functions or data have been added since the last
76a060
 #    public release, increment AGE.
76a060
 # 4. If any exported functions or data have been removed since the last
76a060
 #    public release, set AGE to 0.
76a060
 #
76a060
 # When incrementing the API version (usually for a new major package version),
76a060
 # set CURRENT, REVISION and AGE to 0 since it's like a new library.
76a060
 lt_current = 6
76a060
 lt_revision = 3
76a060
 lt_age = 0
76a060
 LIBDEVHELP_LT_VERSION = '@0@.@1@.@2@'.format(lt_current, lt_revision, lt_age)
76a060
 
76a060
 LIBDEVHELP_PUBLIC_DEPS = [
76a060
   dependency('gio-2.0', version: '>= 2.64'),
76a060
   dependency('gtk+-3.0', version: '>= 3.22'),
76a060
   dependency('webkit2gtk-4.0', version: '>= 2.26'),
76a060
 ]
76a060
 LIBDEVHELP_PRIVATE_DEPS = [
76a060
   dependency('gsettings-desktop-schemas'),
76a060
 ]
76a060
 LIBDEVHELP_DEPS = [
76a060
   LIBDEVHELP_PUBLIC_DEPS,
76a060
   LIBDEVHELP_PRIVATE_DEPS,
76a060
   meson.get_compiler('c').find_library('m'),
76a060
 ]
76a060
 
76a060
 DEVHELP_APP_DEPS = [
76a060
   LIBDEVHELP_DEPS,
76a060
-  dependency('amtk-5', version: '>= 5.0'),
76a060
+  dependency('gsettings-desktop-schemas'),
76a060
 ]
76a060
 
76a060
 # config.h
76a060
 
76a060
 config_data = configuration_data()
76a060
 GETTEXT_PACKAGE_NAME = meson.project_name()
76a060
 config_data.set_quoted('GETTEXT_PACKAGE', GETTEXT_PACKAGE_NAME)
76a060
 config_data.set_quoted('DATADIR', get_option('prefix') / get_option('datadir'))
76a060
 config_data.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir'))
76a060
 config_data.set_quoted('PACKAGE_VERSION', meson.project_version())
76a060
 config_data.set_quoted('LIBDEVHELP_API_VERSION', LIBDEVHELP_API_VERSION)
76a060
 config_data.set10('FLATPAK_BUILD', get_option('flatpak_build'))
76a060
 
76a060
 configure_file(
76a060
   output: 'config.h',
76a060
   configuration: config_data
76a060
 )
76a060
 
76a060
 # Misc
76a060
 
76a060
 # For #include <devhelp/something.h> or #include "config.h".
76a060
 ROOT_INCLUDE_DIR = include_directories('.')
76a060
 
76a060
 add_project_arguments(
76a060
   '-DG_LOG_DOMAIN="@0@"'.format(meson.project_name()),
76a060
   language: 'c'
76a060
 )
76a060
 
76a060
 #####
76a060
 # CFLAGS
76a060
diff --git a/po/POTFILES.in b/po/POTFILES.in
76a060
index db463e9e..cd6e6ed8 100644
76a060
--- a/po/POTFILES.in
76a060
+++ b/po/POTFILES.in
76a060
@@ -15,30 +15,33 @@ devhelp/dh-book-manager.c
76a060
 devhelp/dh-book-tree.c
76a060
 devhelp/dh-completion.c
76a060
 devhelp/dh-error.c
76a060
 devhelp/dh-init.c
76a060
 devhelp/dh-keyword-model.c
76a060
 devhelp/dh-link.c
76a060
 devhelp/dh-notebook.c
76a060
 devhelp/dh-parser.c
76a060
 devhelp/dh-profile-builder.c
76a060
 devhelp/dh-profile.c
76a060
 devhelp/dh-search-bar.c
76a060
 devhelp/dh-search-context.c
76a060
 devhelp/dh-settings-builder.c
76a060
 devhelp/dh-settings.c
76a060
 devhelp/dh-sidebar.c
76a060
 devhelp/dh-tab.c
76a060
 devhelp/dh-tab-label.c
76a060
 devhelp/dh-util-lib.c
76a060
 devhelp/dh-web-view.c
76a060
 plugins/gedit-plugin/devhelp.plugin.desktop.in
76a060
 plugins/gedit-plugin/devhelp.py
76a060
 src/dh-app.c
76a060
 src/dh-assistant.c
76a060
 src/dh-assistant.ui
76a060
 src/dh-main.c
76a060
 src/dh-preferences.c
76a060
 src/dh-preferences.ui
76a060
 src/dh-settings-app.c
76a060
 src/dh-util-app.c
76a060
 src/dh-window.c
76a060
+src/dh-window.ui
76a060
+src/help-overlay.ui
76a060
+src/menus.ui
76a060
diff --git a/src/dh-app.c b/src/dh-app.c
76a060
index 9ceae7f0..da97158c 100644
76a060
--- a/src/dh-app.c
76a060
+++ b/src/dh-app.c
76a060
@@ -1,200 +1,48 @@
76a060
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
76a060
 /* SPDX-FileCopyrightText: 2002 CodeFactory AB
76a060
  * SPDX-FileCopyrightText: 2002 Mikael Hallendal <micke@imendio.com>
76a060
  * SPDX-FileCopyrightText: 2004-2008 Imendio AB
76a060
  * SPDX-FileCopyrightText: 2012 Aleksander Morgado <aleksander@gnu.org>
76a060
  * SPDX-FileCopyrightText: 2017, 2018 Sébastien Wilmet <swilmet@gnome.org>
76a060
  * SPDX-License-Identifier: GPL-3.0-or-later
76a060
  */
76a060
 
76a060
 #include "config.h"
76a060
 #include "dh-app.h"
76a060
 #include <glib/gi18n.h>
76a060
-#include <amtk/amtk.h>
76a060
 #include "dh-assistant.h"
76a060
 #include "dh-preferences.h"
76a060
 #include "dh-settings-app.h"
76a060
 #include "dh-util-app.h"
76a060
 
76a060
-struct _DhAppPrivate {
76a060
-        /* AmtkActionInfoStore for actions that are present in a menu. */
76a060
-        AmtkActionInfoStore *menu_action_info_store;
76a060
-};
76a060
-
76a060
-G_DEFINE_TYPE_WITH_PRIVATE (DhApp, dh_app, GTK_TYPE_APPLICATION);
76a060
-
76a060
-/* This function adds the AmtkActionInfo's for the GActions that are present in
76a060
- * a menu.
76a060
- */
76a060
-static void
76a060
-add_menu_action_infos (DhApp *app)
76a060
-{
76a060
-        const gchar *accels[] = {NULL, NULL, NULL, NULL};
76a060
-        AmtkActionInfo *action_info;
76a060
-
76a060
-        const AmtkActionInfoEntry entries[] = {
76a060
-                /* action, icon, label, accel, tooltip */
76a060
-
76a060
-                /* Actions related to the whole application */
76a060
-                { "app.new-window", NULL, N_("New _Window"), "<Control>n",
76a060
-                  N_("Open a new window") },
76a060
-                { "app.preferences", NULL, N_("_Preferences") },
76a060
-                { "win.shortcuts-window", NULL, N_("_Keyboard Shortcuts"), "<Control>question",
76a060
-                  N_("Show keyboard shortcuts") },
76a060
-                { "app.help", NULL, N_("_Help"), "F1",
76a060
-                  N_("Show help") },
76a060
-                { "app.about", NULL, N_("_About Devhelp") },
76a060
-                { "app.quit", NULL, N_("_Quit"), "<Control>q",
76a060
-                  N_("Close all windows (quit the application)") },
76a060
-
76a060
-                /* Actions related to the current main window */
76a060
-                { "win.show-sidebar", NULL, N_("_Side Panel"), "F9",
76a060
-                  N_("Toggle side panel visibility") },
76a060
-                { "win.print", NULL, N_("_Print"), "<Control>p" },
76a060
-                { "win.find", NULL, N_("_Find"), "<Control>f",
76a060
-                  N_("Find in current page") },
76a060
-                { "win.zoom-in", NULL, N_("_Larger Text"), NULL,
76a060
-                  N_("Larger text") },
76a060
-                { "win.zoom-out", NULL, N_("S_maller Text"), NULL,
76a060
-                  N_("Smaller text") },
76a060
-                { "win.zoom-default", NULL, N_("_Normal Size"), NULL,
76a060
-                  N_("Normal size") },
76a060
-                { NULL }
76a060
-        };
76a060
-
76a060
-        g_assert (app->priv->menu_action_info_store == NULL);
76a060
-        app->priv->menu_action_info_store = amtk_action_info_store_new ();
76a060
-
76a060
-        amtk_action_info_store_add_entries (app->priv->menu_action_info_store,
76a060
-                                            entries, -1,
76a060
-                                            GETTEXT_PACKAGE);
76a060
-
76a060
-        /* The same as in Epiphany. */
76a060
-        accels[0] = "<Control>minus";
76a060
-        accels[1] = "<Control>KP_Subtract";
76a060
-        action_info = amtk_action_info_store_lookup (app->priv->menu_action_info_store, "win.zoom-out");
76a060
-        amtk_action_info_set_accels (action_info, accels);
76a060
-
76a060
-        /* The same as in Epiphany. */
76a060
-        accels[0] = "<Control>0";
76a060
-        accels[1] = "<Control>KP_0";
76a060
-        action_info = amtk_action_info_store_lookup (app->priv->menu_action_info_store, "win.zoom-default");
76a060
-        amtk_action_info_set_accels (action_info, accels);
76a060
-
76a060
-        /* For "<Control>equal": Epiphany also has this keyboard shortcut for
76a060
-         * zoom-in. On keyboards the = and + are usually on the same key, but +
76a060
-         * is less convenient to type because Shift must be pressed too.
76a060
-         * Apparently it's usual on Windows to press Ctrl+= to zoom in.
76a060
-         * https://bugzilla.gnome.org/show_bug.cgi?id=743704
76a060
-         */
76a060
-        accels[0] = "<Control>plus";
76a060
-        accels[1] = "<Control>equal";
76a060
-        accels[2] = "<Control>KP_Add";
76a060
-        action_info = amtk_action_info_store_lookup (app->priv->menu_action_info_store, "win.zoom-in");
76a060
-        amtk_action_info_set_accels (action_info, accels);
76a060
-
76a060
-        amtk_action_info_store_set_all_accels_to_app (app->priv->menu_action_info_store,
76a060
-                                                      GTK_APPLICATION (app));
76a060
-}
76a060
-
76a060
-/* This function adds the AmtkActionInfo's for other GActions (GActions that are
76a060
- * not present in a menu).
76a060
- */
76a060
-static void
76a060
-add_other_action_infos (DhApp *app)
76a060
-{
76a060
-        AmtkActionInfoStore *store;
76a060
-        AmtkActionInfo *action_info;
76a060
-        const gchar *accels[] = {NULL, NULL, NULL, NULL};
76a060
-
76a060
-        const AmtkActionInfoEntry entries[] = {
76a060
-                /* action, icon, label, accel, tooltip */
76a060
-                { "win.new-tab", NULL, NULL, "<Control>t", N_("Open a new tab") },
76a060
-                { "win.close-tab", NULL, NULL, "<Control>w", N_("Close the current tab") },
76a060
-                { "win.go-back", NULL, NULL, NULL, N_("Go back") },
76a060
-                { "win.go-forward", NULL, NULL, NULL, N_("Go forward") },
76a060
-                { "win.focus-search", NULL, NULL, NULL, N_("Focus global search") },
76a060
-                { NULL }
76a060
-        };
76a060
-
76a060
-        store = amtk_action_info_store_new ();
76a060
-        amtk_action_info_store_add_entries (store, entries, -1, GETTEXT_PACKAGE);
76a060
-
76a060
-        accels[0] = "<Alt>Left";
76a060
-        accels[1] = "Back";
76a060
-        action_info = amtk_action_info_store_lookup (store, "win.go-back");
76a060
-        amtk_action_info_set_accels (action_info, accels);
76a060
-
76a060
-        accels[0] = "<Alt>Right";
76a060
-        accels[1] = "Forward";
76a060
-        action_info = amtk_action_info_store_lookup (store, "win.go-forward");
76a060
-        amtk_action_info_set_accels (action_info, accels);
76a060
-
76a060
-        accels[0] = "<Control>k";
76a060
-        accels[1] = "<Control>s";
76a060
-        accels[2] = "<Control>l";
76a060
-        action_info = amtk_action_info_store_lookup (store, "win.focus-search");
76a060
-        amtk_action_info_set_accels (action_info, accels);
76a060
-
76a060
-        amtk_action_info_store_set_all_accels_to_app (store, GTK_APPLICATION (app));
76a060
-        g_object_unref (store);
76a060
-}
76a060
-
76a060
-/* This function adds the AmtkActionInfo's for things that have no related
76a060
- * GActions.
76a060
- */
76a060
-static void
76a060
-add_no_gaction_action_infos (void)
76a060
-{
76a060
-        AmtkActionInfoStore *store;
76a060
-
76a060
-        const AmtkActionInfoEntry entries[] = {
76a060
-                /* action, icon, label, accel, tooltip */
76a060
-                { "no-gaction-open-menu", NULL, NULL, "F10", N_("Open the menu") },
76a060
-                { "no-gaction-prev-tab", NULL, NULL, "<Control>Page_Up", N_("Previous tab") },
76a060
-                { "no-gaction-next-tab", NULL, NULL, "<Control>Page_Down", N_("Next tab") },
76a060
-                { NULL }
76a060
-        };
76a060
-
76a060
-        store = amtk_action_info_store_new ();
76a060
-        amtk_action_info_store_add_entries (store, entries, -1, GETTEXT_PACKAGE);
76a060
-        g_object_unref (store);
76a060
-}
76a060
-
76a060
-static void
76a060
-add_action_infos (DhApp *app)
76a060
-{
76a060
-        add_menu_action_infos (app);
76a060
-        add_other_action_infos (app);
76a060
-        add_no_gaction_action_infos ();
76a060
-}
76a060
+G_DEFINE_TYPE (DhApp, dh_app, GTK_TYPE_APPLICATION);
76a060
 
76a060
 static DhAssistant *
76a060
 get_active_assistant_window (DhApp *app)
76a060
 {
76a060
         GList *windows;
76a060
         GList *l;
76a060
 
76a060
         windows = gtk_application_get_windows (GTK_APPLICATION (app));
76a060
 
76a060
         for (l = windows; l != NULL; l = l->next) {
76a060
                 GtkWindow *cur_window = GTK_WINDOW (l->data);
76a060
 
76a060
                 if (DH_IS_ASSISTANT (cur_window))
76a060
                         return DH_ASSISTANT (cur_window);
76a060
         }
76a060
 
76a060
         return NULL;
76a060
 }
76a060
 
76a060
 static void
76a060
 save_active_main_window_gsettings (DhApp *app)
76a060
 {
76a060
         DhWindow *active_window;
76a060
         DhSettingsApp *settings;
76a060
 
76a060
         active_window = dh_app_get_active_main_window (app, FALSE);
76a060
         if (active_window == NULL)
76a060
                 return;
76a060
 
76a060
         settings = dh_settings_app_get_singleton ();
76a060
@@ -202,62 +50,60 @@ save_active_main_window_gsettings (DhApp *app)
76a060
                                       dh_settings_app_peek_window_settings (settings));
76a060
 }
76a060
 
76a060
 static void
76a060
 save_active_assistant_window_gsettings (DhApp *app)
76a060
 {
76a060
         DhAssistant *active_assistant;
76a060
         DhSettingsApp *settings;
76a060
 
76a060
         active_assistant = get_active_assistant_window (app);
76a060
         if (active_assistant == NULL)
76a060
                 return;
76a060
 
76a060
         settings = dh_settings_app_get_singleton ();
76a060
         dh_util_window_settings_save (GTK_WINDOW (active_assistant),
76a060
                                       dh_settings_app_peek_assistant_settings (settings));
76a060
 }
76a060
 
76a060
 static void
76a060
 new_window_cb (GSimpleAction *action,
76a060
                GVariant      *parameter,
76a060
                gpointer       user_data)
76a060
 {
76a060
         DhApp *app = DH_APP (user_data);
76a060
         GtkWidget *new_window;
76a060
 
76a060
         save_active_main_window_gsettings (app);
76a060
 
76a060
         new_window = dh_window_new (GTK_APPLICATION (app));
76a060
         gtk_widget_show_all (new_window);
76a060
-
76a060
-        amtk_action_info_store_check_all_used (app->priv->menu_action_info_store);
76a060
 }
76a060
 
76a060
 static void
76a060
 preferences_cb (GSimpleAction *action,
76a060
                 GVariant      *parameter,
76a060
                 gpointer       user_data)
76a060
 {
76a060
         DhApp *app = DH_APP (user_data);
76a060
         GtkWindow *parent_window;
76a060
 
76a060
         parent_window = (GtkWindow *) dh_app_get_active_main_window (app, FALSE);
76a060
         dh_preferences_show_dialog (parent_window);
76a060
 }
76a060
 
76a060
 static void
76a060
 help_cb (GSimpleAction *action,
76a060
          GVariant      *parameter,
76a060
          gpointer       user_data)
76a060
 {
76a060
         DhApp *app = DH_APP (user_data);
76a060
         GtkWindow *window;
76a060
         GError *error = NULL;
76a060
 
76a060
         window = (GtkWindow *) dh_app_get_active_main_window (app, FALSE);
76a060
 
76a060
         gtk_show_uri_on_window (window, "help:devhelp", GDK_CURRENT_TIME, &error);
76a060
 
76a060
         if (error != NULL) {
76a060
                 g_warning ("Failed to open the documentation: %s", error->message);
76a060
                 g_clear_error (&error);
76a060
@@ -364,127 +210,195 @@ raise_cb (GSimpleAction *action,
76a060
           GVariant      *parameter,
76a060
           gpointer       user_data)
76a060
 {
76a060
         DhApp *app = DH_APP (user_data);
76a060
         GtkWindow *window;
76a060
 
76a060
         window = gtk_application_get_active_window (GTK_APPLICATION (app));
76a060
         if (window == NULL)
76a060
                 window = (GtkWindow *) dh_app_get_active_main_window (app, TRUE);
76a060
 
76a060
         gtk_window_present (window);
76a060
 }
76a060
 
76a060
 static void
76a060
 add_action_entries (DhApp *app)
76a060
 {
76a060
         const GActionEntry app_entries[] = {
76a060
                 /* General actions */
76a060
                 { "new-window", new_window_cb },
76a060
                 { "preferences", preferences_cb },
76a060
                 { "help", help_cb },
76a060
                 { "about", about_cb },
76a060
                 { "quit", quit_cb },
76a060
 
76a060
                 /* Additional commandline-specific actions */
76a060
                 { "search", search_cb, "s" },
76a060
                 { "search-assistant", search_assistant_cb, "s" },
76a060
                 { "raise", raise_cb },
76a060
         };
76a060
 
76a060
-        amtk_action_map_add_action_entries_check_dups (G_ACTION_MAP (app),
76a060
-                                                       app_entries,
76a060
-                                                       G_N_ELEMENTS (app_entries),
76a060
-                                                       app);
76a060
+        g_action_map_add_action_entries (G_ACTION_MAP (app),
76a060
+                                         app_entries,
76a060
+                                         G_N_ELEMENTS (app_entries),
76a060
+                                         app);
76a060
 }
76a060
 
76a060
 static void
76a060
 setup_go_to_tab_accelerators (GtkApplication *app)
76a060
 {
76a060
         const gchar *accels[] = {NULL, NULL};
76a060
         gint key_num;
76a060
 
76a060
         for (key_num = 1; key_num <= 9; key_num++) {
76a060
                 gchar *accel;
76a060
                 gchar *detailed_action_name;
76a060
 
76a060
                 accel = g_strdup_printf ("<Alt>%d", key_num);
76a060
                 accels[0] = accel;
76a060
 
76a060
                 detailed_action_name = g_strdup_printf ("win.go-to-tab(uint16 %d)", key_num - 1);
76a060
 
76a060
                 gtk_application_set_accels_for_action (app, detailed_action_name, accels);
76a060
 
76a060
                 g_free (accel);
76a060
                 g_free (detailed_action_name);
76a060
         }
76a060
 
76a060
         /* On a typical keyboard the 0 is after 9, so it's the equivalent of 10
76a060
          * (9 starting from 0).
76a060
          */
76a060
         accels[0] = "<Alt>0";
76a060
         gtk_application_set_accels_for_action (app, "win.go-to-tab(uint16 9)", accels);
76a060
 }
76a060
 
76a060
 static void
76a060
-setup_additional_accelerators (GtkApplication *app)
76a060
+setup_accelerators (GtkApplication *app)
76a060
 {
76a060
-        const gchar *accels[] = {NULL, NULL};
76a060
+        const gchar *accels[] = {NULL, NULL, NULL, NULL};
76a060
 
76a060
         setup_go_to_tab_accelerators (app);
76a060
 
76a060
+        accels[0] = "<Control>0";
76a060
+        gtk_application_set_accels_for_action (app, "win.zoom-default", accels);
76a060
+
76a060
+        accels[0] = "<Control>minus";
76a060
+        gtk_application_set_accels_for_action (app, "win.zoom-out", accels);
76a060
+
76a060
+        /* For "<Control>equal": Epiphany also has this keyboard shortcut for
76a060
+         * zoom-in. On keyboards the = and + are usually on the same key, but +
76a060
+         * is less convenient to type because Shift must be pressed too.
76a060
+         * Apparently it's usual on Windows to press Ctrl+= to zoom in.
76a060
+         * https://bugzilla.gnome.org/show_bug.cgi?id=743704
76a060
+         */
76a060
+        accels[0] = "<Control>plus";
76a060
+        accels[1] = "<Control>equal";
76a060
+        gtk_application_set_accels_for_action (app, "win.zoom-in", accels);
76a060
+        accels[1] = NULL;
76a060
+
76a060
+        accels[0] = "<Control>f";
76a060
+        gtk_application_set_accels_for_action (app, "win.find", accels);
76a060
+
76a060
         accels[0] = "<Control>c";
76a060
         gtk_application_set_accels_for_action (app, "win.copy", accels);
76a060
 
76a060
+        accels[0] = "<Control>p";
76a060
+        gtk_application_set_accels_for_action (app, "win.print", accels);
76a060
+
76a060
+        accels[0] = "<Control>t";
76a060
+        gtk_application_set_accels_for_action (app, "win.new-tab", accels);
76a060
+
76a060
+        accels[0] = "<Control>n";
76a060
+        gtk_application_set_accels_for_action (app, "app.new-window", accels);
76a060
+
76a060
         accels[0] = "<Control>Page_Down";
76a060
         gtk_application_set_accels_for_action (app, "win.next-tab", accels);
76a060
 
76a060
         accels[0] = "<Control>Page_Up";
76a060
         gtk_application_set_accels_for_action (app, "win.prev-tab", accels);
76a060
 
76a060
+        accels[0] = "<Control>w";
76a060
+        gtk_application_set_accels_for_action (app, "win.close-tab", accels);
76a060
+
76a060
+        accels[0] = "<Control>q";
76a060
+        gtk_application_set_accels_for_action (app, "app.quit", accels);
76a060
+
76a060
+        accels[0] = "F1";
76a060
+        gtk_application_set_accels_for_action (app, "app.help", accels);
76a060
+
76a060
+        accels[0] = "F9";
76a060
+        gtk_application_set_accels_for_action (app, "win.show-sidebar", accels);
76a060
+
76a060
         accels[0] = "F10";
76a060
         gtk_application_set_accels_for_action (app, "win.show-window-menu", accels);
76a060
+
76a060
+        accels[0] = "<Alt>Right";
76a060
+        accels[1] = "Forward";
76a060
+        gtk_application_set_accels_for_action (app, "win.go-forward", accels);
76a060
+
76a060
+        accels[0] = "<Alt>Left";
76a060
+        accels[1] = "Back";
76a060
+        gtk_application_set_accels_for_action (app, "win.go-back", accels);
76a060
+
76a060
+        accels[0] = "<Control>k";
76a060
+        accels[1] = "<Control>s";
76a060
+        accels[2] = "<Control>l";
76a060
+        gtk_application_set_accels_for_action (app, "win.focus-search", accels);
76a060
+}
76a060
+
76a060
+static void
76a060
+set_app_menu_if_needed (GtkApplication *app)
76a060
+{
76a060
+        GMenu *manual_app_menu;
76a060
+
76a060
+        manual_app_menu = gtk_application_get_menu_by_id (app, "manual-app-menu");
76a060
+
76a060
+        /* Have the g_return in all cases, to catch problems in all cases. */
76a060
+        g_return_if_fail (manual_app_menu != NULL);
76a060
+
76a060
+        if (gtk_application_prefers_app_menu (app))
76a060
+                gtk_application_set_app_menu (app, G_MENU_MODEL (manual_app_menu));
76a060
 }
76a060
 
76a060
 static void
76a060
 dh_app_startup (GApplication *application)
76a060
 {
76a060
         DhApp *app = DH_APP (application);
76a060
 
76a060
         g_application_set_resource_base_path (application, "/org/gnome/devhelp");
76a060
 
76a060
         if (G_APPLICATION_CLASS (dh_app_parent_class)->startup != NULL)
76a060
                 G_APPLICATION_CLASS (dh_app_parent_class)->startup (application);
76a060
 
76a060
-        add_action_infos (app);
76a060
         add_action_entries (app);
76a060
-        setup_additional_accelerators (GTK_APPLICATION (app));
76a060
+        setup_accelerators (GTK_APPLICATION (app));
76a060
+        set_app_menu_if_needed (GTK_APPLICATION (app));
76a060
 }
76a060
 
76a060
 static void
76a060
 dh_app_activate (GApplication *app)
76a060
 {
76a060
         g_action_group_activate_action (G_ACTION_GROUP (app), "new-window", NULL);
76a060
 }
76a060
 
76a060
 static gboolean option_version;
76a060
 
76a060
 static GOptionEntry options[] = {
76a060
         { "new-window", 'n',
76a060
           0, G_OPTION_ARG_NONE, NULL,
76a060
           N_("Opens a new Devhelp window"),
76a060
           NULL
76a060
         },
76a060
         { "search", 's',
76a060
           0, G_OPTION_ARG_STRING, NULL,
76a060
           N_("Search for a keyword"),
76a060
           N_("KEYWORD")
76a060
         },
76a060
         { "search-assistant", 'a',
76a060
           0, G_OPTION_ARG_STRING, NULL,
76a060
           N_("Search and display any hit in the assistant window"),
76a060
           N_("KEYWORD")
76a060
         },
76a060
         { "version", 'v',
76a060
           0, G_OPTION_ARG_NONE, &option_version,
76a060
           N_("Display the version and exit"),
76a060
           NULL
76a060
@@ -523,89 +437,74 @@ dh_app_command_line (GApplication            *g_app,
76a060
         options_dict = g_application_command_line_get_options_dict (command_line);
76a060
 
76a060
         g_variant_dict_lookup (options_dict, "new-window", "b", &option_new_window);
76a060
         g_variant_dict_lookup (options_dict, "search", "&s", &option_search);
76a060
         g_variant_dict_lookup (options_dict, "search-assistant", "&s", &option_search_assistant);
76a060
         g_variant_dict_lookup (options_dict, "quit", "b", &option_quit);
76a060
 
76a060
         if (option_quit) {
76a060
                 g_action_group_activate_action (G_ACTION_GROUP (app), "quit", NULL);
76a060
                 return 0;
76a060
         }
76a060
 
76a060
         if (option_new_window)
76a060
                 g_action_group_activate_action (G_ACTION_GROUP (app), "new-window", NULL);
76a060
 
76a060
         if (option_search != NULL)
76a060
                 g_action_group_activate_action (G_ACTION_GROUP (app),
76a060
                                                 "search",
76a060
                                                 g_variant_new_string (option_search));
76a060
 
76a060
         if (option_search_assistant != NULL)
76a060
                 g_action_group_activate_action (G_ACTION_GROUP (app),
76a060
                                                 "search-assistant",
76a060
                                                 g_variant_new_string (option_search_assistant));
76a060
 
76a060
         g_action_group_activate_action (G_ACTION_GROUP (app), "raise", NULL);
76a060
 
76a060
         return 0;
76a060
 }
76a060
 
76a060
-static void
76a060
-dh_app_dispose (GObject *object)
76a060
-{
76a060
-        DhApp *app = DH_APP (object);
76a060
-
76a060
-        g_clear_object (&app->priv->menu_action_info_store);
76a060
-
76a060
-        G_OBJECT_CLASS (dh_app_parent_class)->dispose (object);
76a060
-}
76a060
-
76a060
 static void
76a060
 dh_app_class_init (DhAppClass *klass)
76a060
 {
76a060
-        GObjectClass *object_class = G_OBJECT_CLASS (klass);
76a060
         GApplicationClass *application_class = G_APPLICATION_CLASS (klass);
76a060
 
76a060
-        object_class->dispose = dh_app_dispose;
76a060
-
76a060
         application_class->startup = dh_app_startup;
76a060
         application_class->activate = dh_app_activate;
76a060
         application_class->handle_local_options = dh_app_handle_local_options;
76a060
         application_class->command_line = dh_app_command_line;
76a060
 }
76a060
 
76a060
 static void
76a060
 dh_app_init (DhApp *app)
76a060
 {
76a060
-        app->priv = dh_app_get_instance_private (app);
76a060
-
76a060
         /* Translators: please don't translate "Devhelp" (it's marked as
76a060
          * translatable for transliteration only).
76a060
          */
76a060
         g_set_application_name (_("Devhelp"));
76a060
         gtk_window_set_default_icon_name ("org.gnome.Devhelp");
76a060
 
76a060
         g_application_add_main_option_entries (G_APPLICATION (app), options);
76a060
 }
76a060
 
76a060
 DhApp *
76a060
 dh_app_new (void)
76a060
 {
76a060
         return g_object_new (DH_TYPE_APP,
76a060
                              "application-id", "org.gnome.Devhelp",
76a060
                              "flags", G_APPLICATION_HANDLES_COMMAND_LINE,
76a060
                              NULL);
76a060
 }
76a060
 
76a060
 /* Returns: (transfer none) (nullable). */
76a060
 DhWindow *
76a060
 dh_app_get_active_main_window (DhApp    *app,
76a060
                                gboolean  create_if_none)
76a060
 {
76a060
         GList *windows;
76a060
         GList *l;
76a060
 
76a060
         g_return_val_if_fail (DH_IS_APP (app), NULL);
76a060
 
76a060
         windows = gtk_application_get_windows (GTK_APPLICATION (app));
76a060
 
76a060
diff --git a/src/dh-app.h b/src/dh-app.h
76a060
index d7ce15ba..5be3d939 100644
76a060
--- a/src/dh-app.h
76a060
+++ b/src/dh-app.h
76a060
@@ -1,44 +1,42 @@
76a060
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
76a060
 /* SPDX-FileCopyrightText: 2012 Aleksander Morgado <aleksander@gnu.org>
76a060
  * SPDX-FileCopyrightText: 2017 Sébastien Wilmet <swilmet@gnome.org>
76a060
  * SPDX-License-Identifier: GPL-3.0-or-later
76a060
  */
76a060
 
76a060
 #ifndef DH_APP_H
76a060
 #define DH_APP_H
76a060
 
76a060
 #include <gtk/gtk.h>
76a060
 #include "dh-window.h"
76a060
 
76a060
 G_BEGIN_DECLS
76a060
 
76a060
 #define DH_TYPE_APP         (dh_app_get_type ())
76a060
 #define DH_APP(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), DH_TYPE_APP, DhApp))
76a060
 #define DH_APP_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), DH_TYPE_APP, DhAppClass))
76a060
 #define DH_IS_APP(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), DH_TYPE_APP))
76a060
 #define DH_IS_APP_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), DH_TYPE_APP))
76a060
 #define DH_APP_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DH_TYPE_APP, DhAppClass))
76a060
 
76a060
 typedef struct _DhApp        DhApp;
76a060
 typedef struct _DhAppClass   DhAppClass;
76a060
-typedef struct _DhAppPrivate DhAppPrivate;
76a060
 
76a060
 struct _DhApp {
76a060
         GtkApplication parent_instance;
76a060
-        DhAppPrivate *priv;
76a060
 };
76a060
 
76a060
 struct _DhAppClass {
76a060
         GtkApplicationClass parent_class;
76a060
 };
76a060
 
76a060
 GType           dh_app_get_type                 (void) G_GNUC_CONST;
76a060
 
76a060
 DhApp *         dh_app_new                      (void);
76a060
 
76a060
 DhWindow *      dh_app_get_active_main_window   (DhApp    *app,
76a060
                                                  gboolean  create_if_none);
76a060
 
76a060
 G_END_DECLS
76a060
 
76a060
 #endif /* DH_APP_H */
76a060
diff --git a/src/dh-main.c b/src/dh-main.c
76a060
index 50d21974..f28aefde 100644
76a060
--- a/src/dh-main.c
76a060
+++ b/src/dh-main.c
76a060
@@ -1,36 +1,33 @@
76a060
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
76a060
 /* SPDX-FileCopyrightText: 2001-2003 CodeFactory AB
76a060
  * SPDX-FileCopyrightText: 2001-2008 Imendio AB
76a060
  * SPDX-License-Identifier: GPL-3.0-or-later
76a060
  */
76a060
 
76a060
 #include "config.h"
76a060
 #include <locale.h>
76a060
 #include <glib/gi18n.h>
76a060
 #include <devhelp/devhelp.h>
76a060
-#include <amtk/amtk.h>
76a060
 #include "dh-app.h"
76a060
 #include "dh-settings-app.h"
76a060
 
76a060
 int
76a060
 main (int argc, char **argv)
76a060
 {
76a060
         DhApp *application;
76a060
         gint status;
76a060
 
76a060
         setlocale (LC_ALL, "");
76a060
         textdomain (GETTEXT_PACKAGE);
76a060
 
76a060
         dh_init ();
76a060
-        amtk_init ();
76a060
 
76a060
         application = dh_app_new ();
76a060
         status = g_application_run (G_APPLICATION (application), argc, argv);
76a060
         g_object_unref (application);
76a060
 
76a060
-        amtk_finalize ();
76a060
         dh_finalize ();
76a060
         dh_settings_app_unref_singleton ();
76a060
 
76a060
         return status;
76a060
 }
76a060
diff --git a/src/dh-window.c b/src/dh-window.c
76a060
index 6dea6209..f29d5d62 100644
76a060
--- a/src/dh-window.c
76a060
+++ b/src/dh-window.c
76a060
@@ -1,96 +1,109 @@
76a060
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
76a060
 /* SPDX-FileCopyrightText: 2001-2008 Imendio AB
76a060
  * SPDX-FileCopyrightText: 2012 Aleksander Morgado <aleksander@gnu.org>
76a060
  * SPDX-FileCopyrightText: 2012 Thomas Bechtold <toabctl@gnome.org>
76a060
  * SPDX-FileCopyrightText: 2015-2020 Sébastien Wilmet <swilmet@gnome.org>
76a060
  * SPDX-License-Identifier: GPL-3.0-or-later
76a060
  */
76a060
 
76a060
 #include "dh-window.h"
76a060
 #include <glib/gi18n.h>
76a060
 #include <webkit2/webkit2.h>
76a060
 #include <devhelp/devhelp.h>
76a060
-#include <amtk/amtk.h>
76a060
 #include "dh-settings-app.h"
76a060
 #include "dh-util-app.h"
76a060
 
76a060
 typedef struct {
76a060
         GtkHeaderBar *header_bar;
76a060
-        GtkMenuButton *menu_button;
76a060
+        GtkMenuButton *window_menu_button;
76a060
+        GMenuModel *window_menu_plus_app_menu;
76a060
+
76a060
+        GtkPaned *hpaned;
76a060
+        GtkWidget *grid_sidebar;
76a060
+        GtkWidget *grid_documents;
76a060
 
76a060
         DhSidebar *sidebar;
76a060
         DhSearchBar *search_bar;
76a060
         DhNotebook *notebook;
76a060
 } DhWindowPrivate;
76a060
 
76a060
 G_DEFINE_TYPE_WITH_PRIVATE (DhWindow, dh_window, GTK_TYPE_APPLICATION_WINDOW);
76a060
 
76a060
 static gboolean
76a060
 dh_window_delete_event (GtkWidget   *widget,
76a060
                         GdkEventAny *event)
76a060
 {
76a060
         DhSettingsApp *settings;
76a060
 
76a060
         settings = dh_settings_app_get_singleton ();
76a060
         dh_util_window_settings_save (GTK_WINDOW (widget),
76a060
                                       dh_settings_app_peek_window_settings (settings));
76a060
 
76a060
         if (GTK_WIDGET_CLASS (dh_window_parent_class)->delete_event == NULL)
76a060
                 return GDK_EVENT_PROPAGATE;
76a060
 
76a060
         return GTK_WIDGET_CLASS (dh_window_parent_class)->delete_event (widget, event);
76a060
 }
76a060
 
76a060
 static void
76a060
 dh_window_dispose (GObject *object)
76a060
 {
76a060
         DhWindowPrivate *priv = dh_window_get_instance_private (DH_WINDOW (object));
76a060
 
76a060
         priv->header_bar = NULL;
76a060
-        priv->menu_button = NULL;
76a060
+        priv->window_menu_button = NULL;
76a060
         priv->sidebar = NULL;
76a060
         priv->search_bar = NULL;
76a060
         priv->notebook = NULL;
76a060
 
76a060
         G_OBJECT_CLASS (dh_window_parent_class)->dispose (object);
76a060
 }
76a060
 
76a060
 static void
76a060
 dh_window_class_init (DhWindowClass *klass)
76a060
 {
76a060
         GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
76a060
         GObjectClass *object_class = G_OBJECT_CLASS (klass);
76a060
 
76a060
         widget_class->delete_event = dh_window_delete_event;
76a060
 
76a060
         object_class->dispose = dh_window_dispose;
76a060
+
76a060
+        /* Bind class to template */
76a060
+        gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/devhelp/dh-window.ui");
76a060
+        gtk_widget_class_bind_template_child_private (widget_class, DhWindow, header_bar);
76a060
+        gtk_widget_class_bind_template_child_private (widget_class, DhWindow, window_menu_button);
76a060
+        gtk_widget_class_bind_template_child_private (widget_class, DhWindow, window_menu_plus_app_menu);
76a060
+        gtk_widget_class_bind_template_child_private (widget_class, DhWindow, hpaned);
76a060
+        gtk_widget_class_bind_template_child_private (widget_class, DhWindow, grid_sidebar);
76a060
+        gtk_widget_class_bind_template_child_private (widget_class, DhWindow, grid_documents);
76a060
 }
76a060
 
76a060
 /* Can return NULL during initialization and finalization, so it's better to
76a060
  * handle the NULL case with the return value of this function.
76a060
  */
76a060
 static DhWebView *
76a060
 get_active_web_view (DhWindow *window)
76a060
 {
76a060
         DhWindowPrivate *priv = dh_window_get_instance_private (window);
76a060
 
76a060
         return dh_notebook_get_active_web_view (priv->notebook);
76a060
 }
76a060
 
76a060
 static void
76a060
 update_window_title (DhWindow *window)
76a060
 {
76a060
         DhWindowPrivate *priv = dh_window_get_instance_private (window);
76a060
         DhWebView *web_view;
76a060
         const gchar *title;
76a060
 
76a060
         web_view = get_active_web_view (window);
76a060
         if (web_view == NULL)
76a060
                 return;
76a060
 
76a060
         title = dh_web_view_get_devhelp_title (web_view);
76a060
         gtk_header_bar_set_title (priv->header_bar, title);
76a060
 }
76a060
 
76a060
 static void
76a060
 update_zoom_actions_sensitivity (DhWindow *window)
76a060
@@ -198,62 +211,67 @@ go_to_tab_cb (GSimpleAction *action,
76a060
         gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), tab_num);
76a060
 }
76a060
 
76a060
 static void
76a060
 print_cb (GSimpleAction *action,
76a060
           GVariant      *parameter,
76a060
           gpointer       user_data)
76a060
 {
76a060
         DhWindow *window = DH_WINDOW (user_data);
76a060
         DhWebView *web_view;
76a060
         WebKitPrintOperation *print_operation;
76a060
 
76a060
         web_view = get_active_web_view (window);
76a060
         if (web_view == NULL)
76a060
                 return;
76a060
 
76a060
         print_operation = webkit_print_operation_new (WEBKIT_WEB_VIEW (web_view));
76a060
         webkit_print_operation_run_dialog (print_operation, GTK_WINDOW (window));
76a060
         g_object_unref (print_operation);
76a060
 }
76a060
 
76a060
 static void
76a060
 close_tab_cb (GSimpleAction *action,
76a060
               GVariant      *parameter,
76a060
               gpointer       user_data)
76a060
 {
76a060
         DhWindow *window = DH_WINDOW (user_data);
76a060
         DhWindowPrivate *priv = dh_window_get_instance_private (window);
76a060
         gint page_num;
76a060
 
76a060
-        page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (priv->notebook));
76a060
-        gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), page_num);
76a060
+        /* FIXME: the code here closes the current *tab*, but in help-overlay.ui
76a060
+         * it is documented as "Close the current window". Look for example at
76a060
+         * what gedit does, or other GNOME apps with a GtkNotebook plus Ctrl+W
76a060
+         * shortcut, and do the same.
76a060
+         */
76a060
+        page_num = gtk_notebook_get_current_page (priv->notebook);
76a060
+        gtk_notebook_remove_page (priv->notebook, page_num);
76a060
 }
76a060
 
76a060
 static void
76a060
 copy_cb (GSimpleAction *action,
76a060
          GVariant      *parameter,
76a060
          gpointer       user_data)
76a060
 {
76a060
         DhWindow *window = DH_WINDOW (user_data);
76a060
         DhWindowPrivate *priv = dh_window_get_instance_private (window);
76a060
         GtkWidget *widget;
76a060
 
76a060
         widget = gtk_window_get_focus (GTK_WINDOW (window));
76a060
 
76a060
         if (GTK_IS_EDITABLE (widget)) {
76a060
                 gtk_editable_copy_clipboard (GTK_EDITABLE (widget));
76a060
         } else if (GTK_IS_TREE_VIEW (widget) &&
76a060
                    gtk_widget_is_ancestor (widget, GTK_WIDGET (priv->sidebar))) {
76a060
                 DhLink *link;
76a060
 
76a060
                 link = dh_sidebar_get_selected_link (priv->sidebar);
76a060
                 if (link != NULL) {
76a060
                         GtkClipboard *clipboard;
76a060
 
76a060
                         clipboard = gtk_widget_get_clipboard (widget, GDK_SELECTION_CLIPBOARD);
76a060
                         gtk_clipboard_set_text (clipboard, dh_link_get_name (link), -1);
76a060
                         dh_link_unref (link);
76a060
                 }
76a060
         } else {
76a060
                 DhWebView *web_view;
76a060
 
76a060
@@ -327,285 +345,108 @@ focus_search_cb (GSimpleAction *action,
76a060
 
76a060
         dh_sidebar_set_search_focus (priv->sidebar);
76a060
 }
76a060
 
76a060
 static void
76a060
 go_back_cb (GSimpleAction *action,
76a060
             GVariant      *parameter,
76a060
             gpointer       user_data)
76a060
 {
76a060
         DhWindow *window = DH_WINDOW (user_data);
76a060
         DhWebView *web_view;
76a060
 
76a060
         web_view = get_active_web_view (window);
76a060
         if (web_view != NULL)
76a060
                 webkit_web_view_go_back (WEBKIT_WEB_VIEW (web_view));
76a060
 }
76a060
 
76a060
 static void
76a060
 go_forward_cb (GSimpleAction *action,
76a060
                GVariant      *parameter,
76a060
                gpointer       user_data)
76a060
 {
76a060
         DhWindow *window = DH_WINDOW (user_data);
76a060
         DhWebView *web_view;
76a060
 
76a060
         web_view = get_active_web_view (window);
76a060
         if (web_view != NULL)
76a060
                 webkit_web_view_go_forward (WEBKIT_WEB_VIEW (web_view));
76a060
 }
76a060
 
76a060
-static void
76a060
-shortcuts_window_cb (GSimpleAction *action,
76a060
-                     GVariant      *parameter,
76a060
-                     gpointer       user_data)
76a060
-{
76a060
-        DhWindow *app_window = DH_WINDOW (user_data);
76a060
-        GtkShortcutsWindow *shortcuts_window;
76a060
-        GtkContainer *section;
76a060
-        GtkContainer *group;
76a060
-        AmtkFactory *factory;
76a060
-
76a060
-        shortcuts_window = amtk_shortcuts_window_new (GTK_WINDOW (app_window));
76a060
-
76a060
-        section = amtk_shortcuts_section_new (NULL);
76a060
-        g_object_set (section,
76a060
-                      "max-height", 10,
76a060
-                      NULL);
76a060
-
76a060
-        factory = amtk_factory_new (NULL);
76a060
-        amtk_factory_set_default_flags (factory, AMTK_FACTORY_IGNORE_GACTION);
76a060
-
76a060
-        group = amtk_shortcuts_group_new (_("Search"));
76a060
-        gtk_container_add (group, amtk_factory_create_shortcut (factory, "win.focus-search"));
76a060
-        gtk_container_add (group, amtk_factory_create_shortcut (factory, "win.find"));
76a060
-        gtk_container_add (section, GTK_WIDGET (group));
76a060
-
76a060
-        group = amtk_shortcuts_group_new (_("History"));
76a060
-        gtk_container_add (group, amtk_factory_create_shortcut (factory, "win.go-back"));
76a060
-        gtk_container_add (group, amtk_factory_create_shortcut (factory, "win.go-forward"));
76a060
-        gtk_container_add (section, GTK_WIDGET (group));
76a060
-
76a060
-        group = amtk_shortcuts_group_new (_("Zoom"));
76a060
-        gtk_container_add (group, amtk_factory_create_shortcut (factory, "win.zoom-in"));
76a060
-        gtk_container_add (group, amtk_factory_create_shortcut (factory, "win.zoom-out"));
76a060
-        gtk_container_add (group, amtk_factory_create_shortcut (factory, "win.zoom-default"));
76a060
-        gtk_container_add (section, GTK_WIDGET (group));
76a060
-
76a060
-        group = amtk_shortcuts_group_new (_("Tabs and Windows"));
76a060
-        gtk_container_add (group, amtk_factory_create_shortcut (factory, "win.new-tab"));
76a060
-        gtk_container_add (group, amtk_factory_create_shortcut (factory, "app.new-window"));
76a060
-        gtk_container_add (group, amtk_factory_create_shortcut (factory, "no-gaction-prev-tab"));
76a060
-        gtk_container_add (group, amtk_factory_create_shortcut (factory, "no-gaction-next-tab"));
76a060
-        gtk_container_add (group, amtk_factory_create_shortcut (factory, "win.close-tab"));
76a060
-        gtk_container_add (group, amtk_factory_create_shortcut (factory, "app.quit"));
76a060
-        gtk_container_add (section, GTK_WIDGET (group));
76a060
-
76a060
-        group = amtk_shortcuts_group_new (_("Miscellaneous"));
76a060
-        gtk_container_add (group, amtk_factory_create_shortcut (factory, "win.print"));
76a060
-        gtk_container_add (group, amtk_factory_create_shortcut (factory, "win.show-sidebar"));
76a060
-        gtk_container_add (section, GTK_WIDGET (group));
76a060
-
76a060
-        group = amtk_shortcuts_group_new (_("General"));
76a060
-        gtk_container_add (group, amtk_factory_create_shortcut (factory, "app.help"));
76a060
-        gtk_container_add (group, amtk_factory_create_shortcut (factory, "no-gaction-open-menu"));
76a060
-        gtk_container_add (group, amtk_factory_create_shortcut (factory, "win.shortcuts-window"));
76a060
-        gtk_container_add (section, GTK_WIDGET (group));
76a060
-
76a060
-        g_object_unref (factory);
76a060
-
76a060
-        gtk_container_add (GTK_CONTAINER (shortcuts_window), GTK_WIDGET (section));
76a060
-        gtk_widget_show_all (GTK_WIDGET (shortcuts_window));
76a060
-}
76a060
-
76a060
 static void
76a060
 add_actions (DhWindow *window)
76a060
 {
76a060
         DhWindowPrivate *priv = dh_window_get_instance_private (window);
76a060
         GPropertyAction *property_action;
76a060
 
76a060
         const GActionEntry win_entries[] = {
76a060
                 /* Tabs */
76a060
                 { "new-tab", new_tab_cb },
76a060
                 { "next-tab", next_tab_cb },
76a060
                 { "prev-tab", prev_tab_cb },
76a060
                 { "go-to-tab", go_to_tab_cb, "q" },
76a060
                 { "print", print_cb },
76a060
                 { "close-tab", close_tab_cb },
76a060
 
76a060
                 /* Edit */
76a060
                 { "copy", copy_cb },
76a060
                 { "find", find_cb },
76a060
 
76a060
                 /* View */
76a060
                 { "zoom-in", zoom_in_cb },
76a060
                 { "zoom-out", zoom_out_cb },
76a060
                 { "zoom-default", zoom_default_cb },
76a060
                 { "focus-search", focus_search_cb },
76a060
 
76a060
                 /* Go */
76a060
                 { "go-back", go_back_cb },
76a060
                 { "go-forward", go_forward_cb },
76a060
-
76a060
-                /* Help */
76a060
-                { "shortcuts-window", shortcuts_window_cb },
76a060
         };
76a060
 
76a060
-        amtk_action_map_add_action_entries_check_dups (G_ACTION_MAP (window),
76a060
-                                                       win_entries,
76a060
-                                                       G_N_ELEMENTS (win_entries),
76a060
-                                                       window);
76a060
+        g_action_map_add_action_entries (G_ACTION_MAP (window),
76a060
+                                         win_entries,
76a060
+                                         G_N_ELEMENTS (win_entries),
76a060
+                                         window);
76a060
 
76a060
         property_action = g_property_action_new ("show-sidebar",
76a060
-                                                 priv->sidebar,
76a060
+                                                 priv->grid_sidebar,
76a060
                                                  "visible");
76a060
         g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (property_action));
76a060
         g_object_unref (property_action);
76a060
 
76a060
         property_action = g_property_action_new ("show-window-menu",
76a060
-                                                 priv->menu_button,
76a060
+                                                 priv->window_menu_button,
76a060
                                                  "active");
76a060
         g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (property_action));
76a060
         g_object_unref (property_action);
76a060
 }
76a060
 
76a060
-static GMenuModel *
76a060
-create_menu (void)
76a060
-{
76a060
-        GMenu *menu;
76a060
-        GMenu *section;
76a060
-        AmtkFactory *factory;
76a060
-
76a060
-        menu = g_menu_new ();
76a060
-        factory = amtk_factory_new (NULL);
76a060
-
76a060
-        section = g_menu_new ();
76a060
-        amtk_gmenu_append_item (section, amtk_factory_create_gmenu_item (factory, "app.new-window"));
76a060
-        amtk_gmenu_append_section (menu, NULL, section);
76a060
-
76a060
-        section = g_menu_new ();
76a060
-        amtk_gmenu_append_item (section, amtk_factory_create_gmenu_item (factory, "win.show-sidebar"));
76a060
-        amtk_gmenu_append_section (menu, NULL, section);
76a060
-
76a060
-        section = g_menu_new ();
76a060
-        amtk_gmenu_append_item (section, amtk_factory_create_gmenu_item (factory, "win.print"));
76a060
-        amtk_gmenu_append_item (section, amtk_factory_create_gmenu_item (factory, "win.find"));
76a060
-        amtk_gmenu_append_section (menu, NULL, section);
76a060
-
76a060
-        section = g_menu_new ();
76a060
-        amtk_gmenu_append_item (section, amtk_factory_create_gmenu_item (factory, "win.zoom-in"));
76a060
-        amtk_gmenu_append_item (section, amtk_factory_create_gmenu_item (factory, "win.zoom-out"));
76a060
-        amtk_gmenu_append_item (section, amtk_factory_create_gmenu_item (factory, "win.zoom-default"));
76a060
-        amtk_gmenu_append_section (menu, NULL, section);
76a060
-
76a060
-        section = g_menu_new ();
76a060
-        amtk_gmenu_append_item (section, amtk_factory_create_gmenu_item (factory, "app.preferences"));
76a060
-        amtk_gmenu_append_item (section, amtk_factory_create_gmenu_item (factory, "win.shortcuts-window"));
76a060
-        amtk_gmenu_append_item (section, amtk_factory_create_gmenu_item (factory, "app.help"));
76a060
-        amtk_gmenu_append_item (section, amtk_factory_create_gmenu_item (factory, "app.about"));
76a060
-        /* Keep the Quit menu item. The GNOME goal recommends to remove it:
76a060
-         * https://gitlab.gnome.org/GNOME/Initiatives/wikis/App-Menu-Retirement
76a060
-         * “There is no need for the Quit menu item and the recommendation is to
76a060
-         * remove it from all locations.”
76a060
-         * In Devhelp, there *is* a need for the Quit menu item: after
76a060
-         * installing/uninstalling books on the filesystem, it may be necessary
76a060
-         * to restart Devhelp because the file monitoring is not perfect, see
76a060
-         * the class description of DhBookListDirectory. Instead of closing the
76a060
-         * Devhelp windows one by one, it's simpler to quit the whole
76a060
-         * application at once. But this can be fixed by adding a “reload books”
76a060
-         * action.
76a060
-         * Another use-case with the Quit menu item is when the app bugs, just
76a060
-         * restarting the app will most probably fix the problem (and then the
76a060
-         * user needs to avoid repeating the actions that make the app to bug).
76a060
-         */
76a060
-        amtk_gmenu_append_item (section, amtk_factory_create_gmenu_item (factory, "app.quit"));
76a060
-        amtk_gmenu_append_section (menu, NULL, section);
76a060
-
76a060
-        g_object_unref (factory);
76a060
-        g_menu_freeze (menu);
76a060
-
76a060
-        return G_MENU_MODEL (menu);
76a060
-}
76a060
-
76a060
-static void
76a060
-init_header_bar (DhWindow *window)
76a060
-{
76a060
-        DhWindowPrivate *priv = dh_window_get_instance_private (window);
76a060
-        GtkWidget *back_forward_hbox;
76a060
-        GtkStyleContext *style_context;
76a060
-        GtkWidget *back_button;
76a060
-        GtkWidget *forward_button;
76a060
-        GMenuModel *menu;
76a060
-        GtkWidget *new_tab_button;
76a060
-
76a060
-        g_assert (priv->header_bar == NULL);
76a060
-        g_assert (priv->menu_button == NULL);
76a060
-
76a060
-        priv->header_bar = GTK_HEADER_BAR (gtk_header_bar_new ());
76a060
-        gtk_header_bar_set_show_close_button (priv->header_bar, TRUE);
76a060
-
76a060
-        /* Back/forward buttons */
76a060
-        back_forward_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
76a060
-        style_context = gtk_widget_get_style_context (back_forward_hbox);
76a060
-        // Test also in RTL (right-to-left) text. It needs to be a GtkBox.
76a060
-        gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_LINKED);
76a060
-
76a060
-        back_button = gtk_button_new_from_icon_name ("go-previous-symbolic", GTK_ICON_SIZE_BUTTON);
76a060
-        gtk_actionable_set_action_name (GTK_ACTIONABLE (back_button), "win.go-back");
76a060
-        gtk_widget_set_tooltip_text (back_button, _("Back"));
76a060
-
76a060
-        forward_button = gtk_button_new_from_icon_name ("go-next-symbolic", GTK_ICON_SIZE_BUTTON);
76a060
-        gtk_actionable_set_action_name (GTK_ACTIONABLE (forward_button), "win.go-forward");
76a060
-        gtk_widget_set_tooltip_text (forward_button, _("Forward"));
76a060
-
76a060
-        gtk_container_add (GTK_CONTAINER (back_forward_hbox), back_button);
76a060
-        gtk_container_add (GTK_CONTAINER (back_forward_hbox), forward_button);
76a060
-        gtk_header_bar_pack_start (priv->header_bar, back_forward_hbox);
76a060
-
76a060
-        /* Menu */
76a060
-        priv->menu_button = GTK_MENU_BUTTON (gtk_menu_button_new ());
76a060
-        gtk_menu_button_set_direction (priv->menu_button, GTK_ARROW_NONE);
76a060
-        gtk_header_bar_pack_end (priv->header_bar, GTK_WIDGET (priv->menu_button));
76a060
-
76a060
-        menu = create_menu ();
76a060
-        gtk_menu_button_set_menu_model (priv->menu_button, menu);
76a060
-        g_object_unref (menu);
76a060
-
76a060
-        /* New tab button */
76a060
-        new_tab_button = gtk_button_new_from_icon_name ("tab-new-symbolic", GTK_ICON_SIZE_BUTTON);
76a060
-        gtk_actionable_set_action_name (GTK_ACTIONABLE (new_tab_button), "win.new-tab");
76a060
-        gtk_widget_set_tooltip_text (new_tab_button, _("New Tab"));
76a060
-        gtk_header_bar_pack_end (priv->header_bar, new_tab_button);
76a060
-
76a060
-        gtk_widget_show_all (GTK_WIDGET (priv->header_bar));
76a060
-}
76a060
-
76a060
 static void
76a060
 web_view_title_notify_cb (DhWebView  *web_view,
76a060
                           GParamSpec *param_spec,
76a060
                           DhWindow   *window)
76a060
 {
76a060
         if (web_view == get_active_web_view (window))
76a060
                 update_window_title (window);
76a060
 }
76a060
 
76a060
 static void
76a060
 web_view_zoom_level_notify_cb (DhWebView  *web_view,
76a060
                                GParamSpec *pspec,
76a060
                                DhWindow   *window)
76a060
 {
76a060
         if (web_view == get_active_web_view (window))
76a060
                 update_zoom_actions_sensitivity (window);
76a060
 }
76a060
 
76a060
 static void
76a060
 notebook_page_added_after_cb (GtkNotebook *notebook,
76a060
                               GtkWidget   *child,
76a060
                               guint        page_num,
76a060
                               DhWindow    *window)
76a060
 {
76a060
         DhTab *tab;
76a060
         DhWebView *web_view;
76a060
         WebKitBackForwardList *back_forward_list;
76a060
 
76a060
         g_return_if_fail (DH_IS_TAB (child));
76a060
 
76a060
@@ -628,118 +469,116 @@ notebook_page_added_after_cb (GtkNotebook *notebook,
76a060
                                  G_CALLBACK (update_back_forward_actions_sensitivity),
76a060
                                  window,
76a060
                                  G_CONNECT_AFTER | G_CONNECT_SWAPPED);
76a060
 }
76a060
 
76a060
 static void
76a060
 notebook_page_removed_after_cb (GtkNotebook *notebook,
76a060
                                 GtkWidget   *child,
76a060
                                 guint        page_num,
76a060
                                 DhWindow    *window)
76a060
 {
76a060
         if (gtk_notebook_get_n_pages (notebook) == 0)
76a060
                 gtk_window_close (GTK_WINDOW (window));
76a060
 }
76a060
 
76a060
 static void
76a060
 notebook_switch_page_after_cb (GtkNotebook *notebook,
76a060
                                GtkWidget   *new_page,
76a060
                                guint        new_page_num,
76a060
                                DhWindow    *window)
76a060
 {
76a060
         update_window_title (window);
76a060
         update_zoom_actions_sensitivity (window);
76a060
         update_back_forward_actions_sensitivity (window);
76a060
 }
76a060
 
76a060
 static void
76a060
 dh_window_init (DhWindow *window)
76a060
 {
76a060
         DhWindowPrivate *priv = dh_window_get_instance_private (window);
76a060
-        GtkPaned *hpaned;
76a060
+        GtkApplication *app;
76a060
         DhSettingsApp *settings;
76a060
         GSettings *paned_settings;
76a060
-        GtkWidget *contents_vgrid;
76a060
 
76a060
-        /* Header bar */
76a060
-        init_header_bar (window);
76a060
-        gtk_window_set_titlebar (GTK_WINDOW (window), GTK_WIDGET (priv->header_bar));
76a060
+        gtk_widget_init_template (GTK_WIDGET (window));
76a060
+
76a060
+        add_actions (window);
76a060
 
76a060
-        /* Horizontal paned */
76a060
-        hpaned = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL));
76a060
+        app = GTK_APPLICATION (g_application_get_default ());
76a060
+        if (!gtk_application_prefers_app_menu (app)) {
76a060
+                gtk_menu_button_set_menu_model (priv->window_menu_button,
76a060
+                                                priv->window_menu_plus_app_menu);
76a060
+        }
76a060
 
76a060
         settings = dh_settings_app_get_singleton ();
76a060
         paned_settings = dh_settings_app_peek_paned_settings (settings);
76a060
         g_settings_bind (paned_settings, "position",
76a060
-                         hpaned, "position",
76a060
+                         priv->hpaned, "position",
76a060
                          G_SETTINGS_BIND_DEFAULT |
76a060
                          G_SETTINGS_BIND_NO_SENSITIVITY);
76a060
 
76a060
-        /* Left side of hpaned */
76a060
+        /* Sidebar */
76a060
         priv->sidebar = dh_sidebar_new2 (NULL);
76a060
-
76a060
-        /* Right side of hpaned */
76a060
-        contents_vgrid = gtk_grid_new ();
76a060
-        gtk_orientable_set_orientation (GTK_ORIENTABLE (contents_vgrid), GTK_ORIENTATION_VERTICAL);
76a060
+        gtk_widget_show (GTK_WIDGET (priv->sidebar));
76a060
+        gtk_container_add (GTK_CONTAINER (priv->grid_sidebar),
76a060
+                           GTK_WIDGET (priv->sidebar));
76a060
 
76a060
         // DhNotebook
76a060
         priv->notebook = dh_notebook_new (NULL);
76a060
+        gtk_widget_show (GTK_WIDGET (priv->notebook));
76a060
 
76a060
         dh_application_window_bind_sidebar_and_notebook (priv->sidebar, priv->notebook);
76a060
 
76a060
         g_signal_connect_after (priv->notebook,
76a060
                                 "page-added",
76a060
                                 G_CALLBACK (notebook_page_added_after_cb),
76a060
                                 window);
76a060
 
76a060
         g_signal_connect_after (priv->notebook,
76a060
                                 "page-removed",
76a060
                                 G_CALLBACK (notebook_page_removed_after_cb),
76a060
                                 window);
76a060
 
76a060
         g_signal_connect_after (priv->notebook,
76a060
                                 "switch-page",
76a060
                                 G_CALLBACK (notebook_switch_page_after_cb),
76a060
                                 window);
76a060
 
76a060
         // DhSearchBar
76a060
         priv->search_bar = dh_search_bar_new (priv->notebook);
76a060
+        gtk_widget_show (GTK_WIDGET (priv->search_bar));
76a060
 
76a060
-        /* Packing */
76a060
-        gtk_container_add (GTK_CONTAINER (contents_vgrid),
76a060
+        gtk_container_add (GTK_CONTAINER (priv->grid_documents),
76a060
                            GTK_WIDGET (priv->search_bar));
76a060
-        gtk_container_add (GTK_CONTAINER (contents_vgrid),
76a060
+        gtk_container_add (GTK_CONTAINER (priv->grid_documents),
76a060
                            GTK_WIDGET (priv->notebook));
76a060
-        gtk_paned_pack1 (hpaned, GTK_WIDGET (priv->sidebar), FALSE, FALSE);
76a060
-        gtk_paned_add2 (hpaned, contents_vgrid);
76a060
-        gtk_widget_show_all (GTK_WIDGET (hpaned));
76a060
-        gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (hpaned));
76a060
 
76a060
         add_actions (window);
76a060
 
76a060
         dh_notebook_open_new_tab (priv->notebook, NULL, TRUE);
76a060
 
76a060
         /* Focus search in sidebar by default. */
76a060
         dh_sidebar_set_search_focus (priv->sidebar);
76a060
 }
76a060
 
76a060
 GtkWidget *
76a060
 dh_window_new (GtkApplication *application)
76a060
 {
76a060
         DhWindow *window;
76a060
         DhSettingsApp *settings;
76a060
 
76a060
         g_return_val_if_fail (GTK_IS_APPLICATION (application), NULL);
76a060
 
76a060
         window = g_object_new (DH_TYPE_WINDOW,
76a060
                                "application", application,
76a060
                                NULL);
76a060
 
76a060
         settings = dh_settings_app_get_singleton ();
76a060
         gtk_widget_realize (GTK_WIDGET (window));
76a060
         dh_util_window_settings_restore (GTK_WINDOW (window),
76a060
                                          dh_settings_app_peek_window_settings (settings));
76a060
 
76a060
         return GTK_WIDGET (window);
76a060
 }
76a060
 
76a060
 void
76a060
diff --git a/src/dh-window.ui b/src/dh-window.ui
76a060
new file mode 100644
76a060
index 00000000..cff68898
76a060
--- /dev/null
76a060
+++ b/src/dh-window.ui
76a060
@@ -0,0 +1,245 @@
76a060
+
76a060
+<interface>
76a060
+  
76a060
+  <menu id="window_menu_simple">
76a060
+    <section>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">_Side Panel</attribute>
76a060
+        <attribute name="action">win.show-sidebar</attribute>
76a060
+      </item>
76a060
+    </section>
76a060
+    <section>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">_Print</attribute>
76a060
+        <attribute name="action">win.print</attribute>
76a060
+      </item>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">_Find</attribute>
76a060
+        <attribute name="action">win.find</attribute>
76a060
+      </item>
76a060
+    </section>
76a060
+    <section>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">_Larger Text</attribute>
76a060
+        <attribute name="action">win.zoom-in</attribute>
76a060
+      </item>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">S_maller Text</attribute>
76a060
+        <attribute name="action">win.zoom-out</attribute>
76a060
+      </item>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">_Normal Size</attribute>
76a060
+        <attribute name="action">win.zoom-default</attribute>
76a060
+      </item>
76a060
+    </section>
76a060
+  </menu>
76a060
+  <menu id="window_menu_plus_app_menu">
76a060
+    <section>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">New _Window</attribute>
76a060
+        <attribute name="action">app.new-window</attribute>
76a060
+      </item>
76a060
+    </section>
76a060
+    <section>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">_Side Panel</attribute>
76a060
+        <attribute name="action">win.show-sidebar</attribute>
76a060
+      </item>
76a060
+    </section>
76a060
+    <section>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">_Print</attribute>
76a060
+        <attribute name="action">win.print</attribute>
76a060
+      </item>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">_Find</attribute>
76a060
+        <attribute name="action">win.find</attribute>
76a060
+      </item>
76a060
+    </section>
76a060
+    <section>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">_Larger Text</attribute>
76a060
+        <attribute name="action">win.zoom-in</attribute>
76a060
+      </item>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">S_maller Text</attribute>
76a060
+        <attribute name="action">win.zoom-out</attribute>
76a060
+      </item>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">_Normal Size</attribute>
76a060
+        <attribute name="action">win.zoom-default</attribute>
76a060
+      </item>
76a060
+    </section>
76a060
+    <section>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">_Preferences</attribute>
76a060
+        <attribute name="action">app.preferences</attribute>
76a060
+      </item>
76a060
+    </section>
76a060
+    <section>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
76a060
+        <attribute name="action">win.show-help-overlay</attribute>
76a060
+      </item>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">_Help</attribute>
76a060
+        <attribute name="action">app.help</attribute>
76a060
+      </item>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">_About Devhelp</attribute>
76a060
+        <attribute name="action">app.about</attribute>
76a060
+      </item>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">_Quit</attribute>
76a060
+        <attribute name="action">app.quit</attribute>
76a060
+      </item>
76a060
+    </section>
76a060
+  </menu>
76a060
+  <template class="DhWindow" parent="GtkApplicationWindow">
76a060
+    <property name="can_focus">False</property>
76a060
+    <property name="has_focus">False</property>
76a060
+    <property name="is_focus">False</property>
76a060
+    <child type="titlebar">
76a060
+      <object class="GtkHeaderBar" id="header_bar">
76a060
+        <property name="visible">True</property>
76a060
+        <property name="can_focus">False</property>
76a060
+        <property name="vexpand">False</property>
76a060
+        <property name="show_close_button">True</property>
76a060
+        <child>
76a060
+          <object class="GtkBox" id="box">
76a060
+            <property name="visible">True</property>
76a060
+            <property name="valign">center</property>
76a060
+            <property name="can_focus">False</property>
76a060
+            <style>
76a060
+              <class name="linked"/>
76a060
+            </style>
76a060
+            <child>
76a060
+              <object class="GtkButton" id="back_button">
76a060
+                <property name="visible">True</property>
76a060
+                <property name="valign">center</property>
76a060
+                <property name="can_focus">False</property>
76a060
+                <property name="tooltip_text" translatable="yes">Back</property>
76a060
+                <property name="action_name">win.go-back</property>
76a060
+                <style>
76a060
+                  <class name="image-button"/>
76a060
+                </style>
76a060
+                <child>
76a060
+                  <object class="GtkImage" id="back_button_image">
76a060
+                    <property name="visible">True</property>
76a060
+                    <property name="icon_size">1</property>
76a060
+                    <property name="icon_name">go-previous-symbolic</property>
76a060
+                  </object>
76a060
+                </child>
76a060
+              </object>
76a060
+            </child>
76a060
+            <child>
76a060
+              <object class="GtkButton" id="forward_button">
76a060
+                <property name="visible">True</property>
76a060
+                <property name="valign">center</property>
76a060
+                <property name="can_focus">False</property>
76a060
+                <property name="tooltip_text" translatable="yes">Forward</property>
76a060
+                <property name="action_name">win.go-forward</property>
76a060
+                <style>
76a060
+                  <class name="image-button"/>
76a060
+                </style>
76a060
+                <child>
76a060
+                  <object class="GtkImage" id="forward_button_image">
76a060
+                    <property name="visible">True</property>
76a060
+                    <property name="icon_size">1</property>
76a060
+                    <property name="icon_name">go-next-symbolic</property>
76a060
+                  </object>
76a060
+                </child>
76a060
+              </object>
76a060
+            </child>
76a060
+          </object>
76a060
+          <packing>
76a060
+            <property name="pack_type">start</property>
76a060
+          </packing>
76a060
+        </child>
76a060
+        <child>
76a060
+          <object class="GtkMenuButton" id="window_menu_button">
76a060
+            <property name="visible">True</property>
76a060
+            <property name="valign">center</property>
76a060
+            <property name="can_focus">False</property>
76a060
+            <property name="menu_model">window_menu_simple</property>
76a060
+            <property name="use_popover">True</property>
76a060
+            <style>
76a060
+              <class name="image-button"/>
76a060
+            </style>
76a060
+            <child>
76a060
+              <object class="GtkImage" id="window_menu_image">
76a060
+                <property name="visible">True</property>
76a060
+                <property name="icon_size">1</property>
76a060
+                <property name="icon_name">open-menu-symbolic</property>
76a060
+              </object>
76a060
+            </child>
76a060
+          </object>
76a060
+          <packing>
76a060
+            <property name="pack_type">end</property>
76a060
+          </packing>
76a060
+        </child>
76a060
+        <child>
76a060
+          <object class="GtkButton" id="new_tab_button">
76a060
+            <property name="visible">True</property>
76a060
+            <property name="valign">center</property>
76a060
+            <property name="can_focus">False</property>
76a060
+            <property name="tooltip_text" translatable="yes">New Tab</property>
76a060
+            <property name="action_name">win.new-tab</property>
76a060
+            <style>
76a060
+              <class name="image-button"/>
76a060
+            </style>
76a060
+            <child>
76a060
+              <object class="GtkImage" id="new_tab_button_image">
76a060
+                <property name="visible">True</property>
76a060
+                <property name="icon_size">1</property>
76a060
+                <property name="icon_name">tab-new-symbolic</property>
76a060
+              </object>
76a060
+            </child>
76a060
+          </object>
76a060
+          <packing>
76a060
+            <property name="pack_type">end</property>
76a060
+          </packing>
76a060
+        </child>
76a060
+      </object>
76a060
+    </child>
76a060
+    <child>
76a060
+      <object class="GtkGrid" id="grid">
76a060
+        <property name="visible">True</property>
76a060
+        <property name="can_focus">False</property>
76a060
+        <property name="has_focus">False</property>
76a060
+        <property name="is_focus">False</property>
76a060
+        <child>
76a060
+          <object class="GtkPaned" id="hpaned">
76a060
+            <property name="visible">True</property>
76a060
+            <property name="can_focus">True</property>
76a060
+            <property name="has_focus">False</property>
76a060
+            <property name="is_focus">False</property>
76a060
+            <child>
76a060
+              <object class="GtkGrid" id="grid_sidebar">
76a060
+                <property name="visible">True</property>
76a060
+                <style>
76a060
+                  <class name="sidebar"/>
76a060
+                </style>
76a060
+              </object>
76a060
+              <packing>
76a060
+		<property name="shrink">False</property>
76a060
+	      </packing>
76a060
+            </child>
76a060
+            <child>
76a060
+              <object class="GtkGrid" id="grid_documents">
76a060
+                <property name="visible">True</property>
76a060
+                <property name="orientation">vertical</property>
76a060
+              </object>
76a060
+            </child>
76a060
+          </object>
76a060
+          <packing>
76a060
+            <property name="left_attach">0</property>
76a060
+            <property name="top_attach">1</property>
76a060
+            <property name="width">1</property>
76a060
+            <property name="height">1</property>
76a060
+          </packing>
76a060
+        </child>
76a060
+      </object>
76a060
+    </child>
76a060
+  </template>
76a060
+</interface>
76a060
diff --git a/src/dh.gresource.xml b/src/dh.gresource.xml
76a060
index 78fda590..d59c7663 100644
76a060
--- a/src/dh.gresource.xml
76a060
+++ b/src/dh.gresource.xml
76a060
@@ -1,15 +1,20 @@
76a060
 
76a060
 
76a060
   SPDX-FileCopyrightText: 2013 Thomas Bechtold <thomasbechtold@jpberlin.de>
76a060
   SPDX-FileCopyrightText: 2013 Ignacio Casal Quinteiro <ignacio.casal@nice-software.com>
76a060
   SPDX-FileCopyrightText: 2016 Frédéric Péters <fpeters@0d.be>
76a060
   SPDX-FileCopyrightText: 2018 Günther Wagner <info@gunibert.de>
76a060
   SPDX-FileCopyrightText: 2018 Sébastien Wilmet <swilmet@gnome.org>
76a060
   SPDX-License-Identifier: GPL-3.0-or-later
76a060
 -->
76a060
 <gresources>
76a060
   <gresource prefix="/org/gnome/devhelp">
76a060
     <file preprocess="xml-stripblanks">dh-assistant.ui</file>
76a060
     <file preprocess="xml-stripblanks">dh-preferences.ui</file>
76a060
+    <file preprocess="xml-stripblanks">dh-window.ui</file>
76a060
+  </gresource>
76a060
+  <gresource prefix="/org/gnome/devhelp/gtk">
76a060
+    <file preprocess="xml-stripblanks">help-overlay.ui</file>
76a060
+    <file preprocess="xml-stripblanks">menus.ui</file>
76a060
   </gresource>
76a060
 </gresources>
76a060
diff --git a/src/help-overlay.ui b/src/help-overlay.ui
76a060
new file mode 100644
76a060
index 00000000..80eea36c
76a060
--- /dev/null
76a060
+++ b/src/help-overlay.ui
76a060
@@ -0,0 +1,117 @@
76a060
+
76a060
+<interface>
76a060
+  <requires lib="gtk+" version="3.20"/>
76a060
+  <object class="GtkShortcutsWindow" id="help_overlay">
76a060
+    <property name="modal">1</property>
76a060
+    <child>
76a060
+      <object class="GtkShortcutsSection">
76a060
+        <property name="visible">1</property>
76a060
+        <property name="section-name">shortcuts</property>
76a060
+        <property name="max-height">10</property>
76a060
+        <child>
76a060
+          <object class="GtkShortcutsGroup">
76a060
+            <property name="visible">1</property>
76a060
+            <property name="title" translatable="yes" context="shortcut window">General</property>
76a060
+            <child>
76a060
+              <object class="GtkShortcutsShortcut">
76a060
+                <property name="visible">1</property>
76a060
+                <property name="accelerator"><Control>K</property>
76a060
+                <property name="title" translatable="yes" context="shortcut window">Focus global search</property>
76a060
+              </object>
76a060
+            </child>
76a060
+            <child>
76a060
+              <object class="GtkShortcutsShortcut">
76a060
+                <property name="visible">1</property>
76a060
+                <property name="accelerator"><Control>F</property>
76a060
+                <property name="title" translatable="yes" context="shortcut window">Find in current page</property>
76a060
+              </object>
76a060
+            </child>
76a060
+            <child>
76a060
+              <object class="GtkShortcutsShortcut">
76a060
+                <property name="visible">1</property>
76a060
+                <property name="accelerator"><Control>N</property>
76a060
+                <property name="title" translatable="yes" context="shortcut window">Open a new window</property>
76a060
+              </object>
76a060
+            </child>
76a060
+            <child>
76a060
+              <object class="GtkShortcutsShortcut">
76a060
+                <property name="visible">1</property>
76a060
+                <property name="accelerator"><Control>T</property>
76a060
+                <property name="title" translatable="yes" context="shortcut window">Open a new tab</property>
76a060
+              </object>
76a060
+            </child>
76a060
+            <child>
76a060
+              <object class="GtkShortcutsShortcut">
76a060
+                <property name="visible">1</property>
76a060
+                <property name="accelerator">F9</property>
76a060
+                <property name="title" translatable="yes" context="shortcut window">Toggle side panel visibility</property>
76a060
+              </object>
76a060
+            </child>
76a060
+            <child>
76a060
+              <object class="GtkShortcutsShortcut">
76a060
+                <property name="visible">1</property>
76a060
+                <property name="accelerator"><alt>Left</property>
76a060
+                <property name="title" translatable="yes" context="shortcut window">Go back</property>
76a060
+              </object>
76a060
+            </child>
76a060
+            <child>
76a060
+              <object class="GtkShortcutsShortcut">
76a060
+                <property name="visible">1</property>
76a060
+                <property name="accelerator"><alt>Right</property>
76a060
+                <property name="title" translatable="yes" context="shortcut window">Go forward</property>
76a060
+              </object>
76a060
+            </child>
76a060
+            <child>
76a060
+              <object class="GtkShortcutsShortcut">
76a060
+                <property name="visible">1</property>
76a060
+                <property name="accelerator"><Control>P</property>
76a060
+                <property name="title" translatable="yes" context="shortcut window">Print</property>
76a060
+              </object>
76a060
+            </child>
76a060
+            <child>
76a060
+              <object class="GtkShortcutsShortcut">
76a060
+                <property name="visible">1</property>
76a060
+                <property name="accelerator"><Control>W</property>
76a060
+                <property name="title" translatable="yes" context="shortcut window">Close the current window</property>
76a060
+              </object>
76a060
+            </child>
76a060
+            <child>
76a060
+              <object class="GtkShortcutsShortcut">
76a060
+                <property name="visible">1</property>
76a060
+                <property name="accelerator"><Control>Q</property>
76a060
+                <property name="title" translatable="yes" context="shortcut window">Close all windows</property>
76a060
+              </object>
76a060
+            </child>
76a060
+          </object>
76a060
+        </child>
76a060
+        <child>
76a060
+          <object class="GtkShortcutsGroup">
76a060
+            <property name="visible">1</property>
76a060
+            <property name="title" translatable="yes" context="shortcut window">Zoom</property>
76a060
+            <child>
76a060
+              <object class="GtkShortcutsShortcut">
76a060
+                <property name="visible">1</property>
76a060
+                <property name="accelerator"><ctrl>plus</property>
76a060
+                <property name="title" translatable="yes" context="shortcut window">Zoom in</property>
76a060
+              </object>
76a060
+            </child>
76a060
+            <child>
76a060
+              <object class="GtkShortcutsShortcut">
76a060
+                <property name="visible">1</property>
76a060
+                <property name="accelerator"><ctrl>minus</property>
76a060
+                <property name="title" translatable="yes" context="shortcut window">Zoom out</property>
76a060
+              </object>
76a060
+            </child>
76a060
+            <child>
76a060
+              <object class="GtkShortcutsShortcut">
76a060
+                <property name="visible">1</property>
76a060
+                <property name="accelerator"><ctrl>0</property>
76a060
+                <property name="title" translatable="yes" context="shortcut window">Reset Zoom</property>
76a060
+              </object>
76a060
+            </child>
76a060
+          </object>
76a060
+        </child>
76a060
+      </object>
76a060
+    </child>
76a060
+  </object>
76a060
+</interface>
76a060
diff --git a/src/menus.ui b/src/menus.ui
76a060
new file mode 100644
76a060
index 00000000..a2d53483
76a060
--- /dev/null
76a060
+++ b/src/menus.ui
76a060
@@ -0,0 +1,58 @@
76a060
+
76a060
+
76a060
+  This file is part of Devhelp.
76a060
+
76a060
+  Copyright (C) 2010 Imendio AB
76a060
+  Copyright (C) 2012 Aleksander Morgado <aleksander@gnu.org>
76a060
+  Copyright (C) 2017, 2018 Sébastien Wilmet <swilmet@gnome.org>
76a060
+
76a060
+  Devhelp is free software: you can redistribute it and/or modify
76a060
+  it under the terms of the GNU General Public License as published
76a060
+  by the Free Software Foundation, either version 3 of the License,
76a060
+  or (at your option) any later version.
76a060
+
76a060
+  Devhelp is distributed in the hope that it will be useful,
76a060
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
76a060
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
76a060
+  GNU General Public License for more details.
76a060
+
76a060
+  You should have received a copy of the GNU General Public License
76a060
+  along with Devhelp.  If not, see <http://www.gnu.org/licenses/>.
76a060
+-->
76a060
+
76a060
+<interface>
76a060
+  <requires lib="gtk+" version="3.0"/>
76a060
+  
76a060
+  <menu id="manual-app-menu">
76a060
+    <section>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">New _Window</attribute>
76a060
+        <attribute name="action">app.new-window</attribute>
76a060
+      </item>
76a060
+    </section>
76a060
+    <section>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">_Preferences</attribute>
76a060
+        <attribute name="action">app.preferences</attribute>
76a060
+      </item>
76a060
+    </section>
76a060
+    <section>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
76a060
+        <attribute name="action">win.show-help-overlay</attribute>
76a060
+      </item>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">_Help</attribute>
76a060
+        <attribute name="action">app.help</attribute>
76a060
+      </item>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">_About</attribute>
76a060
+        <attribute name="action">app.about</attribute>
76a060
+      </item>
76a060
+      <item>
76a060
+        <attribute name="label" translatable="yes">_Quit</attribute>
76a060
+        <attribute name="action">app.quit</attribute>
76a060
+      </item>
76a060
+    </section>
76a060
+  </menu>
76a060
+</interface>
76a060
-- 
76a060
2.31.1
76a060