[Xfce4-commits] [apps/xfce4-terminal] 01/01: Add option to disable F1 (help) shortcut key

noreply at xfce.org noreply at xfce.org
Tue Jul 19 14:28:43 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 0510011dbc792e356af2239ffe4406c70ebd7c2c
Author: Igor <f2404 at yandex.ru>
Date:   Tue Jul 19 15:27:49 2016 +0300

    Add option to disable F1 (help) shortcut key
    
    Fixes #10718
---
 terminal/terminal-preferences-dialog.c |  2 +-
 terminal/terminal-preferences.c        | 13 +++++++++++++
 terminal/terminal-preferences.glade    | 16 ++++++++++++++++
 terminal/terminal-screen.c             | 18 ++++++++++++++++++
 terminal/terminal-window.c             | 15 +++++++++++++--
 5 files changed, 61 insertions(+), 3 deletions(-)

diff --git a/terminal/terminal-preferences-dialog.c b/terminal/terminal-preferences-dialog.c
index a7b3b9c..d250fb5 100644
--- a/terminal/terminal-preferences-dialog.c
+++ b/terminal/terminal-preferences-dialog.c
@@ -143,7 +143,7 @@ terminal_preferences_dialog_init (TerminalPreferencesDialog *dialog)
                                        "misc-cursor-shape", "misc-cursor-blinks",
                                        "font-allow-bold", "misc-menubar-default",
                                        "misc-toolbar-default", "misc-borders-default",
-                                       "misc-tab-close-middle-click",
+                                       "misc-tab-close-middle-click", "shortcuts-no-helpkey",
                                        "shortcuts-no-mnemonics", "shortcuts-no-menukey",
                                        "binding-backspace", "binding-delete",
                                        "background-mode", "background-image-style",
diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c
index dd8fc2f..c807267 100644
--- a/terminal/terminal-preferences.c
+++ b/terminal/terminal-preferences.c
@@ -96,6 +96,7 @@ enum
   PROP_SCROLLING_ON_KEYSTROKE,
   PROP_SCROLLING_SINGLE_LINE,
   PROP_SCROLLING_UNLIMITED,
+  PROP_SHORTCUTS_NO_HELPKEY,
   PROP_SHORTCUTS_NO_MENUKEY,
   PROP_SHORTCUTS_NO_MNEMONICS,
   PROP_TITLE_INITIAL,
@@ -858,6 +859,18 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
                             G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
   /**
+   * TerminalPreferences:shortcuts-no-helpkey:
+   *
+   * Disable help shortcut key (F1).
+   **/
+  preferences_props[PROP_SHORTCUTS_NO_HELPKEY] =
+      g_param_spec_boolean ("shortcuts-no-helpkey",
+                            NULL,
+                            "ShortcutsNoHelpkey",
+                            FALSE,
+                            G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  /**
    * TerminalPreferences:shortcuts-no-menukey:
    *
    * Disable menu shortcut key (F10 by default).
diff --git a/terminal/terminal-preferences.glade b/terminal/terminal-preferences.glade
index 0ee5001..36ad249 100644
--- a/terminal/terminal-preferences.glade
+++ b/terminal/terminal-preferences.glade
@@ -2914,6 +2914,22 @@ when double clicking:</property>
                                 <property name="position">1</property>
                               </packing>
                             </child>
+                            <child>
+                              <object class="GtkCheckButton" id="shortcuts-no-helpkey">
+                                <property name="label" translatable="yes">Disable _help window shortcut key (F1 by default)</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="halign">start</property>
+                                <property name="use_underline">True</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">2</property>
+                              </packing>
+                            </child>
                           </object>
                         </child>
                       </object>
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 3d620a5..db9ef69 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -93,6 +93,8 @@ static void       terminal_screen_set_property                  (GObject
                                                                  GParamSpec            *pspec);
 static void       terminal_screen_realize                       (GtkWidget             *widget);
 static void       terminal_screen_unrealize                     (GtkWidget             *widget);
+static void       terminal_screen_key_press_event               (GtkWidget             *widget,
+                                                                 GdkEventKey           *event);
 static void       terminal_screen_preferences_changed           (TerminalPreferences   *preferences,
                                                                  GParamSpec            *pspec,
                                                                  TerminalScreen        *screen);
@@ -202,6 +204,7 @@ terminal_screen_class_init (TerminalScreenClass *klass)
   gtkwidget_class = GTK_WIDGET_CLASS (klass);
   gtkwidget_class->realize = terminal_screen_realize;
   gtkwidget_class->unrealize = terminal_screen_unrealize;
+  gtkwidget_class->key_press_event = terminal_screen_key_press_event;
 
   /**
    * TerminalScreen:custom-title:
@@ -453,6 +456,21 @@ terminal_screen_unrealize (GtkWidget *widget)
 
 
 static void
+terminal_screen_key_press_event (GtkWidget   *widget,
+                                 GdkEventKey *event)
+{
+  gboolean ret;
+  TerminalScreen *screen = TERMINAL_SCREEN (widget);
+
+  terminal_return_if_fail (TERMINAL_IS_SCREEN (screen));
+
+  /* propagate to the terminal */
+  g_signal_emit_by_name (G_OBJECT (screen->terminal), "key-press-event", event, &ret);
+}
+
+
+
+static void
 terminal_screen_preferences_changed (TerminalPreferences *preferences,
                                      GParamSpec          *pspec,
                                      TerminalScreen      *screen)
diff --git a/terminal/terminal-window.c b/terminal/terminal-window.c
index 7254a99..fb148a1 100644
--- a/terminal/terminal-window.c
+++ b/terminal/terminal-window.c
@@ -1765,8 +1765,19 @@ static void
 terminal_window_action_contents (GtkAction       *action,
                                  TerminalWindow  *window)
 {
-  /* open the Terminal user manual */
-  xfce_dialog_show_help (GTK_WINDOW (window), "terminal", NULL, NULL);
+  gboolean shortcuts_no_helpkey;
+  gboolean ret;
+
+  g_object_get (G_OBJECT (window->preferences),
+                "shortcuts-no-helpkey", &shortcuts_no_helpkey,
+                NULL);
+
+  if (!shortcuts_no_helpkey)
+    /* open the Terminal user manual */
+    xfce_dialog_show_help (GTK_WINDOW (window), "terminal", NULL, NULL);
+  else
+    /* propagate to the terminal */
+    g_signal_emit_by_name (G_OBJECT (window->active), "key-press-event", gtk_get_current_event (), &ret);
 }
 
 

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


More information about the Xfce4-commits mailing list