[gthumb] removed the application menu



commit 0eed0090fa1a3af4bc5f90dc0d25c3c2b1f495da
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Mon Oct 22 20:10:14 2018 +0200

    removed the application menu

 gthumb/gth-application.c             | 25 +++++++------------------
 gthumb/gth-browser-actions-entries.h | 15 +++------------
 gthumb/gth-browser.c                 | 18 ++++--------------
 gthumb/gth-browser.h                 |  4 +---
 gthumb/resources/gears-menu.ui       |  6 +-----
 5 files changed, 16 insertions(+), 52 deletions(-)
---
diff --git a/gthumb/gth-application.c b/gthumb/gth-application.c
index f91f1f90..b79915ef 100644
--- a/gthumb/gth-application.c
+++ b/gthumb/gth-application.c
@@ -145,29 +145,18 @@ static const GActionEntry app_menu_entries[] = {
 
 
 static void
-_gth_application_initialize_app_menu (GApplication *application)
+_gth_application_initialize_app_actions (GApplication *application)
 {
+       const char * const new_window_accel[] = { "<Primary>n", NULL };
+       const char * const quit_accel[] = { "<Primary>q", NULL };
+
        g_action_map_add_action_entries (G_ACTION_MAP (application),
                                         app_menu_entries,
                                         G_N_ELEMENTS (app_menu_entries),
                                         application);
 
-       if (gtk_application_prefers_app_menu (GTK_APPLICATION (application))) {
-               GtkBuilder *builder;
-
-               builder = _gtk_builder_new_from_resource ("app-menu.ui");
-               gtk_application_set_app_menu (GTK_APPLICATION (application),
-                                             G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu")));
-
-               g_object_unref (builder);
-       }
-       else {
-               const char * const new_window_accel[] = { "<Primary>n", NULL };
-               const char * const quit_accel[] = { "<Primary>q", NULL };
-
-               gtk_application_set_accels_for_action (GTK_APPLICATION (application), "app.new-window", 
new_window_accel);
-               gtk_application_set_accels_for_action (GTK_APPLICATION (application), "app.quit", quit_accel);
-       }
+       gtk_application_set_accels_for_action (GTK_APPLICATION (application), "app.new-window", 
new_window_accel);
+       gtk_application_set_accels_for_action (GTK_APPLICATION (application), "app.quit", quit_accel);
 }
 
 
@@ -185,7 +174,7 @@ gth_application_startup (GApplication *application)
 
        g_object_set (gtk_settings_get_default (), "gtk-application-prefer-dark-theme", TRUE, NULL);
 
-       _gth_application_initialize_app_menu (application);
+       _gth_application_initialize_app_actions (application);
        gth_pref_initialize ();
        migrate_data ();
        gth_main_initialize ();
diff --git a/gthumb/gth-browser-actions-entries.h b/gthumb/gth-browser-actions-entries.h
index fb228db8..b4782e77 100644
--- a/gthumb/gth-browser-actions-entries.h
+++ b/gthumb/gth-browser-actions-entries.h
@@ -81,20 +81,11 @@ static const GthAccelerator gth_browser_accelerators[] = {
 };
 
 
-static const GthMenuEntry gears_preferences_action_entries[] = {
-       { N_("_Preferences"), "app.preferences" }
-};
-
-
-static const GthMenuEntry gears_help_action_entries[] = {
+static const GthMenuEntry gears_app_action_entries[] = {
+       { N_("_Preferences"), "app.preferences" },
        { N_("Keyboard Shortcuts"), "app.shortcuts" },
        { N_("_Help"), "app.help" },
-       { N_("_About"), "app.about" }
-};
-
-
-static const GthMenuEntry gears_close_action_entries[] = {
-       { N_("_Quit"), "app.quit" }
+       { N_("_About gThumb"), "app.about" }
 };
 
 
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 4a607e58..d914b6b3 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -4543,9 +4543,7 @@ gth_browser_init (GthBrowser *browser)
                gth_browser_add_menu_manager_for_menu (browser, GTH_BROWSER_MENU_MANAGER_GEARS, G_MENU 
(menu));
                gth_browser_add_menu_manager_for_menu (browser, 
GTH_BROWSER_MENU_MANAGER_GEARS_FOLDER_ACTIONS, G_MENU (gtk_builder_get_object (builder, "folder-actions")));
                gth_browser_add_menu_manager_for_menu (browser, GTH_BROWSER_MENU_MANAGER_GEARS_OTHER_ACTIONS, 
G_MENU (gtk_builder_get_object (builder, "other-actions")));
-               gth_browser_add_menu_manager_for_menu (browser, 
GTH_BROWSER_MENU_MANAGER_GEARS_PREFERENCES_ACTIONS, G_MENU (gtk_builder_get_object (builder, 
"preferences-actions")));
-               gth_browser_add_menu_manager_for_menu (browser, GTH_BROWSER_MENU_MANAGER_GEARS_HELP_ACTIONS, 
G_MENU (gtk_builder_get_object (builder, "help-actions")));
-               gth_browser_add_menu_manager_for_menu (browser, GTH_BROWSER_MENU_MANAGER_GEARS_CLOSE_ACTIONS, 
G_MENU (gtk_builder_get_object (builder, "close-actions")));
+               gth_browser_add_menu_manager_for_menu (browser, GTH_BROWSER_MENU_MANAGER_GEARS_APP_ACTIONS, 
G_MENU (gtk_builder_get_object (builder, "app-actions")));
                _gtk_window_add_accelerators_from_menu ((GTK_WINDOW (browser)), menu);
                g_object_unref (builder);
 
@@ -4558,17 +4556,9 @@ gth_browser_init (GthBrowser *browser)
                gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), 
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_EDITOR_APPLY]);
                gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), 
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_EDITOR_COMMANDS]);
 
-               if (! gtk_application_prefers_app_menu (gtk_window_get_application (GTK_WINDOW (browser)))) {
-                       gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_GEARS_PREFERENCES_ACTIONS),
-                                                        gears_preferences_action_entries,
-                                                        G_N_ELEMENTS (gears_preferences_action_entries));
-                       gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_GEARS_HELP_ACTIONS),
-                                                        gears_help_action_entries,
-                                                        G_N_ELEMENTS (gears_help_action_entries));
-                       gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_GEARS_CLOSE_ACTIONS),
-                                                        gears_close_action_entries,
-                                                        G_N_ELEMENTS (gears_close_action_entries));
-               }
+               gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_GEARS_APP_ACTIONS),
+                                                gears_app_action_entries,
+                                                G_N_ELEMENTS (gears_app_action_entries));
 
                /* browser navigation */
 
diff --git a/gthumb/gth-browser.h b/gthumb/gth-browser.h
index b589264c..9910d938 100644
--- a/gthumb/gth-browser.h
+++ b/gthumb/gth-browser.h
@@ -37,9 +37,7 @@ G_BEGIN_DECLS
 #define GTH_BROWSER_MENU_MANAGER_GEARS                         "gears"
 #define GTH_BROWSER_MENU_MANAGER_GEARS_FOLDER_ACTIONS          "gears.folder-actions"
 #define GTH_BROWSER_MENU_MANAGER_GEARS_OTHER_ACTIONS           "gears.other-actions"
-#define GTH_BROWSER_MENU_MANAGER_GEARS_PREFERENCES_ACTIONS     "gears.preferences-actions"
-#define GTH_BROWSER_MENU_MANAGER_GEARS_HELP_ACTIONS            "gears.help-actions"
-#define GTH_BROWSER_MENU_MANAGER_GEARS_CLOSE_ACTIONS           "gears.close-actions"
+#define GTH_BROWSER_MENU_MANAGER_GEARS_APP_ACTIONS             "gears.app-actions"
 #define GTH_BROWSER_MENU_MANAGER_FILE                          "file"
 #define GTH_BROWSER_MENU_MANAGER_FILE_SCREEN_ACTIONS           "file.screen-actions"
 #define GTH_BROWSER_MENU_MANAGER_FILE_OPEN_ACTIONS             "file.open-actions"
diff --git a/gthumb/resources/gears-menu.ui b/gthumb/resources/gears-menu.ui
index f66d380d..a7aef5df 100644
--- a/gthumb/resources/gears-menu.ui
+++ b/gthumb/resources/gears-menu.ui
@@ -44,11 +44,7 @@
     </section>
     <section id="other-actions">
     </section>
-    <section id="preferences-actions">
-    </section>
-    <section id="help-actions">
-    </section>
-    <section id="close-actions">
+    <section id="app-actions">
     </section>
   </menu>
 </interface>


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