diff options
author | Sabri Ünal <libreajans@gmail.com> | 2023-01-02 13:50:22 +0300 |
---|---|---|
committer | Sébastien Wilmet <swilmet@informatique-libre.be> | 2023-01-06 13:56:52 +0100 |
commit | c7d6e485012312628197eaadde70def7ea7e847c (patch) | |
tree | 7c5a70ce350cb8247cff511e4d2f5e88c119d21d | |
parent | c4a56cebcfb208b79259e4e87c2e53dd91a3c451 (diff) | |
download | gedit-c7d6e485012312628197eaadde70def7ea7e847c.tar.gz |
help-overlay: Remove excessive action
We don't need an extra action to show help-overlay.
It already managed by GTK.
Source: https://docs.gtk.org/gtk4/class.Application.html#automatic-resources
-rw-r--r-- | gedit/gedit-app.c | 16 | ||||
-rw-r--r-- | gedit/gedit-commands-help.c | 31 | ||||
-rw-r--r-- | gedit/gedit-commands-private.h | 1 | ||||
-rw-r--r-- | gedit/resources/gedit.gresource.xml.in | 2 | ||||
-rw-r--r-- | gedit/resources/gtk/menus-traditional.ui | 2 | ||||
-rw-r--r-- | gedit/resources/gtk/menus.ui | 2 | ||||
-rw-r--r-- | gedit/resources/ui/gedit-shortcuts.ui | 2 |
7 files changed, 4 insertions, 52 deletions
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c index 4dc8c292d..5c26b9541 100644 --- a/gedit/gedit-app.c +++ b/gedit/gedit-app.c @@ -429,20 +429,6 @@ preferences_activated (GSimpleAction *action, } static void -keyboard_shortcuts_activated (GSimpleAction *action, - GVariant *parameter, - gpointer user_data) -{ - GtkApplication *app; - GeditWindow *window; - - app = GTK_APPLICATION (user_data); - window = GEDIT_WINDOW (gtk_application_get_active_window (app)); - - _gedit_cmd_help_keyboard_shortcuts (window); -} - -static void help_activated (GSimpleAction *action, GVariant *parameter, gpointer user_data) @@ -482,7 +468,6 @@ static GActionEntry app_entries[] = { { "new-window", new_window_activated, NULL, NULL, NULL }, { "new-document", new_document_activated, NULL, NULL, NULL }, { "preferences", preferences_activated, NULL, NULL, NULL }, - { "shortcuts", keyboard_shortcuts_activated, NULL, NULL, NULL }, { "help", help_activated, NULL, NULL, NULL }, { "about", about_activated, NULL, NULL, NULL }, { "quit", quit_activated, NULL, NULL, NULL } @@ -697,7 +682,6 @@ gedit_app_startup (GApplication *application) add_accelerator (GTK_APPLICATION (application), "app.new-window", "<Primary>N"); add_accelerator (GTK_APPLICATION (application), "app.quit", "<Primary>Q"); add_accelerator (GTK_APPLICATION (application), "app.help", "F1"); - add_accelerator (GTK_APPLICATION (application), "app.shortcuts", "<Primary>question"); add_accelerator (GTK_APPLICATION (application), "win.hamburger-menu", "F10"); add_accelerator (GTK_APPLICATION (application), "win.open", "<Primary>O"); diff --git a/gedit/gedit-commands-help.c b/gedit/gedit-commands-help.c index 6a5d12e2e..41b6ed866 100644 --- a/gedit/gedit-commands-help.c +++ b/gedit/gedit-commands-help.c @@ -33,37 +33,6 @@ #include "gedit-dirs.h" void -_gedit_cmd_help_keyboard_shortcuts (GeditWindow *window) -{ - static GtkWidget *shortcuts_window; - - gedit_debug (DEBUG_COMMANDS); - - if (shortcuts_window == NULL) - { - GtkBuilder *builder; - - builder = gtk_builder_new_from_resource ("/org/gnome/gedit/ui/gedit-shortcuts.ui"); - shortcuts_window = GTK_WIDGET (gtk_builder_get_object (builder, "shortcuts-gedit")); - - g_signal_connect (shortcuts_window, - "destroy", - G_CALLBACK (gtk_widget_destroyed), - &shortcuts_window); - - g_object_unref (builder); - } - - if (GTK_WINDOW (window) != gtk_window_get_transient_for (GTK_WINDOW (shortcuts_window))) - { - gtk_window_set_transient_for (GTK_WINDOW (shortcuts_window), GTK_WINDOW (window)); - } - - gtk_widget_show_all (shortcuts_window); - gtk_window_present (GTK_WINDOW (shortcuts_window)); -} - -void _gedit_cmd_help_contents (GeditWindow *window) { gedit_debug (DEBUG_COMMANDS); diff --git a/gedit/gedit-commands-private.h b/gedit/gedit-commands-private.h index 0c2f0d7f4..dce602e23 100644 --- a/gedit/gedit-commands-private.h +++ b/gedit/gedit-commands-private.h @@ -156,7 +156,6 @@ void _gedit_cmd_documents_next_tab_group (GSimpleAction *action, GVariant *parameter, gpointer user_data); -void _gedit_cmd_help_keyboard_shortcuts (GeditWindow *window); void _gedit_cmd_help_contents (GeditWindow *window); void _gedit_cmd_help_about (GeditWindow *window); diff --git a/gedit/resources/gedit.gresource.xml.in b/gedit/resources/gedit.gresource.xml.in index a5905110e..756d9c977 100644 --- a/gedit/resources/gedit.gresource.xml.in +++ b/gedit/resources/gedit.gresource.xml.in @@ -12,7 +12,7 @@ <file preprocess="xml-stripblanks">ui/gedit-tab-label.ui</file> <file preprocess="xml-stripblanks">ui/gedit-view-frame.ui</file> <file preprocess="xml-stripblanks">ui/gedit-window.ui</file> - <file preprocess="xml-stripblanks">ui/gedit-shortcuts.ui</file> + <file preprocess="xml-stripblanks" alias="gtk/help-overlay.ui">ui/gedit-shortcuts.ui</file> <file preprocess="xml-stripblanks">ui/gedit-statusbar.ui</file> <file>css/gedit-style.css</file> <file>css/gedit.adwaita.css</file> diff --git a/gedit/resources/gtk/menus-traditional.ui b/gedit/resources/gtk/menus-traditional.ui index 45cc40f5b..e4fd1881b 100644 --- a/gedit/resources/gtk/menus-traditional.ui +++ b/gedit/resources/gtk/menus-traditional.ui @@ -113,7 +113,7 @@ <attribute name="id">help-section</attribute> <item> <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute> - <attribute name="action">app.shortcuts</attribute> + <attribute name="action">win.show-help-overlay</attribute> </item> <item> <attribute name="label" translatable="yes">_Help</attribute> diff --git a/gedit/resources/gtk/menus.ui b/gedit/resources/gtk/menus.ui index 5ff01edd7..898a2d5e8 100644 --- a/gedit/resources/gtk/menus.ui +++ b/gedit/resources/gtk/menus.ui @@ -117,7 +117,7 @@ <attribute name="id">app-section</attribute> <item> <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute> - <attribute name="action">app.shortcuts</attribute> + <attribute name="action">win.show-help-overlay</attribute> </item> <item> <attribute name="label" translatable="yes">_Help</attribute> diff --git a/gedit/resources/ui/gedit-shortcuts.ui b/gedit/resources/ui/gedit-shortcuts.ui index 0d2f59d77..cfa4ab39f 100644 --- a/gedit/resources/ui/gedit-shortcuts.ui +++ b/gedit/resources/ui/gedit-shortcuts.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> <!-- interface-requires gtk+ 3.17 --> - <object class="GtkShortcutsWindow" id="shortcuts-gedit"> + <object class="GtkShortcutsWindow" id="help_overlay"> <property name="modal">1</property> <child> <object class="GtkShortcutsSection"> |