[Xfce4-commits] [apps/xfce4-terminal] 01/01: Allow setting of empty shortcut for goto-tab actions

noreply at xfce.org noreply at xfce.org
Wed Oct 26 13:11:20 CEST 2016


This is an automated email from the git hooks/post-receive script.

f2404 pushed a commit to branch master
in repository apps/xfce4-terminal.

commit 3caa248c58fb6f1a941b7c0237605d900e342908
Author: Igor <f2404 at yandex.ru>
Date:   Wed Oct 26 14:10:20 2016 +0300

    Allow setting of empty shortcut for goto-tab actions
    
    Also prevent them from being unintentionally overriden with empty value.
---
 terminal/terminal-app.c    | 3 +--
 terminal/terminal-window.c | 4 +++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/terminal/terminal-app.c b/terminal/terminal-app.c
index f268cbe..b9b2497 100644
--- a/terminal/terminal-app.c
+++ b/terminal/terminal-app.c
@@ -270,7 +270,6 @@ static gboolean
 terminal_app_accel_map_load (gpointer user_data)
 {
   TerminalApp *app = TERMINAL_APP (user_data);
-  GtkAccelKey  key;
   gchar       *path;
   gchar        name[50];
   guint        i;
@@ -294,7 +293,7 @@ terminal_app_accel_map_load (gpointer user_data)
   for (i = 1; i < 10; i++)
     {
       g_snprintf (name, sizeof (name), "<Actions>/terminal-window/goto-tab-%d", i);
-      if (!gtk_accel_map_lookup_entry (name, &key) || key.accel_key == 0)
+      if (!gtk_accel_map_lookup_entry (name, NULL))
         gtk_accel_map_change_entry (name, GDK_KEY_0 + i, GDK_MOD1_MASK, FALSE);
     }
 
diff --git a/terminal/terminal-window.c b/terminal/terminal-window.c
index c468af8..0fdabdc 100644
--- a/terminal/terminal-window.c
+++ b/terminal/terminal-window.c
@@ -796,6 +796,7 @@ terminal_window_rebuild_tabs_menu (TerminalWindow *window)
   GtkRadioAction *radio_action;
   gchar           name[50];
   GSList         *lp;
+  GtkAccelKey     key = {0};
 
   if (window->tabs_menu_merge_id != 0)
     {
@@ -853,7 +854,8 @@ terminal_window_rebuild_tabs_menu (TerminalWindow *window)
 
       /* set an accelerator path */
       g_snprintf (name, sizeof (name), "<Actions>/terminal-window/goto-tab-%d", n + 1);
-      gtk_action_set_accel_path (GTK_ACTION (radio_action), name);
+      if (gtk_accel_map_lookup_entry (name, &key) && key.accel_key != 0)
+        gtk_action_set_accel_path (GTK_ACTION (radio_action), name);
 
       /* store */
       window->tabs_menu_actions = g_slist_prepend (window->tabs_menu_actions, radio_action);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list