[Xfce4-commits] [apps/xfce4-terminal] 01/01: Properly enable/disable F1 shortcut
noreply at xfce.org
noreply at xfce.org
Thu Aug 11 17:21:07 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 0209a8480475cd7ee23d1b5aea3f7f72ad4d8b4a
Author: Igor <f2404 at yandex.ru>
Date: Thu Aug 11 18:20:58 2016 +0300
Properly enable/disable F1 shortcut
---
terminal/terminal-screen.c | 20 -------------------
terminal/terminal-window.c | 50 ++++++++++++++++++++++++++++++++++------------
2 files changed, 37 insertions(+), 33 deletions(-)
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index d033b5d..aae9f88 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -93,8 +93,6 @@ static void terminal_screen_set_property (GObject
GParamSpec *pspec);
static void terminal_screen_realize (GtkWidget *widget);
static void terminal_screen_unrealize (GtkWidget *widget);
-static gboolean terminal_screen_key_press_event (GtkWidget *widget,
- GdkEventKey *event);
static void terminal_screen_preferences_changed (TerminalPreferences *preferences,
GParamSpec *pspec,
TerminalScreen *screen);
@@ -208,7 +206,6 @@ 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:
@@ -459,23 +456,6 @@ terminal_screen_unrealize (GtkWidget *widget)
-static gboolean
-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);
-
- return ret;
-}
-
-
-
static void
terminal_screen_preferences_changed (TerminalPreferences *preferences,
GParamSpec *pspec,
diff --git a/terminal/terminal-window.c b/terminal/terminal-window.c
index 2b65432..0efbd28 100644
--- a/terminal/terminal-window.c
+++ b/terminal/terminal-window.c
@@ -211,6 +211,10 @@ static void terminal_window_move_tab (GtkNotebook
gboolean move_left);
static void terminal_window_tab_info_free (TerminalWindowTabInfo *tab_info);
+static void terminal_window_preferences_changed (TerminalPreferences *preferences,
+ GParamSpec *pspec,
+ TerminalWindow *window);
+
static guint window_signals[LAST_SIGNAL];
@@ -323,7 +327,10 @@ terminal_window_init (TerminalWindow *window)
GdkScreen *screen;
GdkVisual *visual;
+ /* watch preferences changes */
window->preferences = terminal_preferences_get ();
+ g_signal_connect (G_OBJECT (window->preferences), "notify",
+ G_CALLBACK (terminal_window_preferences_changed), window);
window->font = NULL;
window->zoom = TERMINAL_ZOOM_LEVEL_DEFAULT;
@@ -425,6 +432,9 @@ terminal_window_finalize (GObject *object)
{
TerminalWindow *window = TERMINAL_WINDOW (object);
+ /* detach from preferences */
+ g_signal_handlers_disconnect_by_func (window->preferences,
+ G_CALLBACK (terminal_window_preferences_changed), window);
g_object_unref (G_OBJECT (window->preferences));
g_object_unref (G_OBJECT (window->action_group));
g_object_unref (G_OBJECT (window->ui_manager));
@@ -1949,19 +1959,8 @@ static void
terminal_window_action_contents (GtkAction *action,
TerminalWindow *window)
{
- 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);
+ /* open the Terminal user manual */
+ xfce_dialog_show_help (GTK_WINDOW (window), "terminal", NULL, NULL);
}
@@ -2041,6 +2040,31 @@ terminal_window_tab_info_free (TerminalWindowTabInfo *tab_info)
+static void
+terminal_window_preferences_changed (TerminalPreferences *preferences,
+ GParamSpec *pspec,
+ TerminalWindow *window)
+{
+ const gchar *name;
+ gboolean set;
+
+ terminal_return_if_fail (TERMINAL_IS_WINDOW (window));
+ terminal_return_if_fail (TERMINAL_IS_PREFERENCES (preferences));
+ terminal_return_if_fail (window->preferences == preferences);
+
+ /* get name */
+ name = g_param_spec_get_name (pspec);
+ terminal_assert (name != NULL);
+
+ if (strcmp ("shortcuts-no-helpkey", name) == 0)
+ {
+ g_object_get (G_OBJECT (window->preferences), name, &set, NULL);
+ gtk_accel_map_change_entry ("<Actions>/terminal-window/contents", set ? 0 : GDK_KEY_F1, 0, TRUE);
+ }
+}
+
+
+
/**
* terminal_window_new:
* @fullscreen: Whether to set the window to fullscreen.
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list