SF.net SVN: geany: [1911] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Sep 27 11:13:59 UTC 2007


Revision: 1911
          http://geany.svn.sourceforge.net/geany/?rev=1911&view=rev
Author:   ntrel
Date:     2007-09-27 04:13:59 -0700 (Thu, 27 Sep 2007)

Log Message:
-----------
Add enable_vte_bash_keys keybindings.conf hidden pref in [Settings].
Refactor keybindings_init().

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/keybindings.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-09-26 19:56:45 UTC (rev 1910)
+++ trunk/ChangeLog	2007-09-27 11:13:59 UTC (rev 1911)
@@ -1,3 +1,10 @@
+2007-09-27  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/keybindings.c:
+   Add enable_vte_bash_keys keybindings.conf hidden pref in [Settings].
+   Refactor keybindings_init().
+
+
 2007-09-26  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
 
  * src/keybindings.c:

Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c	2007-09-26 19:56:45 UTC (rev 1910)
+++ trunk/src/keybindings.c	2007-09-27 11:13:59 UTC (rev 1911)
@@ -46,7 +46,8 @@
 #include "vte.h"
 
 
-const gboolean swap_alt_tab_order = FALSE;
+static const gboolean swap_alt_tab_order = FALSE;
+static gboolean enable_vte_bash_keys;
 
 
 /* simple convenience function to allocate and fill the struct */
@@ -105,15 +106,8 @@
 static void keybindings_add_accels();
 
 
-void keybindings_init(void)
+static void init_default_kb()
 {
-	gchar *configfile = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "keybindings.conf", NULL);
-	gchar *val;
-	guint i;
-	guint key;
-	GdkModifierType mods;
-	GKeyFile *config = g_key_file_new();
-
 	// init all fields of keys with default values
 	keys[GEANY_KEYS_MENU_NEW] = fill(cb_func_file_action,
 		GDK_n, GDK_CONTROL_MASK, "menu_new", _("New"));
@@ -324,7 +318,18 @@
 		0, 0, "popup_gototagdeclaration", _("Go to Tag Declaration"));
 	keys[GEANY_KEYS_POPUP_CONTEXTACTION] = fill(cb_func_current_word,
 		0, 0, "popup_contextaction", _("Context Action"));
+}
 
+
+static void load_user_kb()
+{
+	gchar *configfile = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "keybindings.conf", NULL);
+	gchar *val;
+	guint i;
+	guint key;
+	GdkModifierType mods;
+	GKeyFile *config = g_key_file_new();
+
 	// now load user defined keys
 	if (g_key_file_load_from_file(config, configfile, G_KEY_FILE_KEEP_COMMENTS, NULL))
 	{
@@ -340,7 +345,18 @@
 			g_free(val);
 		}
 	}
+	enable_vte_bash_keys =
+		utils_get_setting_boolean(config, "Settings", "enable_vte_bash_keys", TRUE);
+	g_free(configfile);
+	g_key_file_free(config);
+}
 
+
+void keybindings_init(void)
+{
+	init_default_kb();
+	load_user_kb();
+
 	// set section name
 	keys[GEANY_KEYS_MENU_NEW]->section = _("File menu");
 	keys[GEANY_KEYS_MENU_UNDO]->section = _("Edit menu");
@@ -354,9 +370,6 @@
 	keys[GEANY_KEYS_EDIT_TOGGLECASE]->section = _("Editing commands");
 	keys[GEANY_KEYS_EDIT_AUTOCOMPLETE]->section = _("Tag commands");
 
-	g_free(configfile);
-	g_key_file_free(config);
-
 	keybindings_add_accels();
 }
 
@@ -728,7 +741,7 @@
 		event->state -= GDK_MOD2_MASK;
 
 	// special cases
-	if (check_vte(event, keyval))
+	if (enable_vte_bash_keys && check_vte(event, keyval))
 		return FALSE;
 	if (check_construct_completion(event))
 		return TRUE;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list