[Xfce4-commits] [apps/xfce4-terminal] 01/01: Enable/disable F1 shortcut even more properly

noreply at xfce.org noreply at xfce.org
Thu Aug 11 18:18:28 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 7ba04d8f4bb332f7f06c109b9e7d90b656ad3d04
Author: Igor <f2404 at yandex.ru>
Date:   Thu Aug 11 19:18:22 2016 +0300

    Enable/disable F1 shortcut even more properly
---
 terminal/terminal-app.c    | 14 +++++++++++---
 terminal/terminal-window.c | 35 -----------------------------------
 2 files changed, 11 insertions(+), 38 deletions(-)

diff --git a/terminal/terminal-app.c b/terminal/terminal-app.c
index 437d5e4..980b6eb 100644
--- a/terminal/terminal-app.c
+++ b/terminal/terminal-app.c
@@ -130,6 +130,8 @@ terminal_app_init (TerminalApp *app)
   app->preferences = terminal_preferences_get ();
   g_signal_connect_swapped (G_OBJECT (app->preferences), "notify::shortcuts-no-menukey",
                             G_CALLBACK (terminal_app_update_accels), app);
+  g_signal_connect_swapped (G_OBJECT (app->preferences), "notify::shortcuts-no-helpkey",
+                            G_CALLBACK (terminal_app_update_accels), app);
   g_signal_connect_swapped (G_OBJECT (app->preferences), "notify::shortcuts-no-mnemonics",
                             G_CALLBACK (terminal_app_update_mnemonics), app);
 
@@ -192,15 +194,21 @@ terminal_app_finalize (GObject *object)
 static void
 terminal_app_update_accels (TerminalApp *app)
 {
-  gboolean no_menukey;
+  gboolean no_key;
 
   g_object_get (G_OBJECT (app->preferences),
-                "shortcuts-no-menukey", &no_menukey,
+                "shortcuts-no-menukey", &no_key,
                 NULL);
   g_object_set (G_OBJECT (gtk_settings_get_default ()),
                 "gtk-menu-bar-accel",
-                no_menukey ? NULL : app->initial_menu_bar_accel,
+                no_key ? NULL : app->initial_menu_bar_accel,
+                NULL);
+
+  g_object_get (G_OBJECT (app->preferences),
+                "shortcuts-no-helpkey", &no_key,
                 NULL);
+  gtk_accel_map_change_entry ("<Actions>/terminal-window/contents",
+                              no_key ? 0 : GDK_KEY_F1, 0, TRUE);
 }
 
 
diff --git a/terminal/terminal-window.c b/terminal/terminal-window.c
index 0efbd28..dc41d11 100644
--- a/terminal/terminal-window.c
+++ b/terminal/terminal-window.c
@@ -211,10 +211,6 @@ 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];
@@ -327,10 +323,7 @@ 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;
@@ -432,9 +425,6 @@ 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));
@@ -2040,31 +2030,6 @@ 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