pidgin: f1dabaef: Check if a key is already bound before a...

wabz at pidgin.im wabz at pidgin.im
Sun May 11 03:30:54 EDT 2008


-----------------------------------------------------------------
Revision: f1dabaefda9742c6d71cba71697771bf74710f8a
Ancestor: 9df9174bb1a0b9508ebd9632ea5b21b818b0f8cf
Author: wabz at pidgin.im
Date: 2008-05-11T07:20:42
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/f1dabaefda9742c6d71cba71697771bf74710f8a

Modified files:
        ChangeLog ChangeLog.API finch/libgnt/gntbindable.c
        finch/libgnt/gntbindable.h finch/libgnt/gntmenu.c

ChangeLog: 

Check if a key is already bound before assigning a menu trigger

-------------- next part --------------
============================================================
--- ChangeLog	79712a51bc722eb8813ca8646c6c114727695154
+++ ChangeLog	92794a3345d87a90ba23a0c2167036421d499fa0
@@ -53,6 +53,7 @@ version 2.x.x:
 
 	Finch:
 	* New default binding ctrl+x to open context menus.
+	* Menu triggers and other bindings will no longer conflict.
 
 version 2.4.1 (03/31/2008):
 	http://developer.pidgin.im/query?status=closed&milestone=2.4.1
============================================================
--- ChangeLog.API	59e457c99f6c9e707a625a2ca616494d3aedc2ef
+++ ChangeLog.API	1dfd50fb1c8d050baf5190621918d010c0269b6a
@@ -11,6 +11,9 @@ version 2.x.x:
 		* Callbacks to Purple::Util::fetch_url and the
 		  Purple::Request::* functions can now be specified as both
 		  strings (the name of the callback function) and as coderefs.
+	Finch:
+		libgnt:
+		* Added gnt_bindable_check_key to check if a keystroke is bound.
 
 version 2.4.0 (02/29/2008):
 	libpurple:
============================================================
--- finch/libgnt/gntbindable.c	46ad1068f38cce19561ac9242954eb744753e6d6
+++ finch/libgnt/gntbindable.c	616c134da67b11e4f1fe9a085f8c4b16bed29042
@@ -339,6 +339,13 @@ gnt_bindable_perform_action_key(GntBinda
 	return FALSE;
 }
 
+gboolean
+gnt_bindable_check_key(GntBindable *bindable, const char *keys) {
+	GntBindableClass *klass = GNT_BINDABLE_CLASS(GNT_BINDABLE_GET_CLASS(bindable));
+	GntBindableActionParam *param = g_hash_table_lookup(klass->bindings, keys);
+	return (param && param->action);
+}
+
 static void
 register_binding(GntBindableClass *klass, const char *name, const char *trigger, GList *list)
 {
============================================================
--- finch/libgnt/gntbindable.h	fb55171a25f5d1fedc6c404855c1ca7f7b2694a5
+++ finch/libgnt/gntbindable.h	f7bcdb12cc86496846cca806a94fa5c6eff21a99
@@ -149,6 +149,16 @@ gboolean gnt_bindable_perform_action_key
 gboolean gnt_bindable_perform_action_key(GntBindable *bindable, const char *keys);
 
 /**
+ * Discover if a key is bound.
+ *
+ * @param bindable  The bindable object.
+ * @param keys      The key to check for.
+ *
+ * @return  @c TRUE if the the key has an action associated with it.
+ */
+gboolean gnt_bindable_check_key(GntBindable *bindable, const char *keys);
+
+/**
  * Perform an action on a bindable object.
  *
  * @param bindable  The bindable object.
============================================================
--- finch/libgnt/gntmenu.c	49a42b604cbcc4cedd3a3b258596b127a93edeab
+++ finch/libgnt/gntmenu.c	6c3920c01483614d44a692e2ab9f00f169096ecc
@@ -168,7 +168,8 @@ assign_triggers(GntMenu *menu)
 			continue;
 		while (*text) {
 			char ch = tolower(*text++);
-			if (ch == ' ' || bools[(int)GET_VAL(ch)])
+			char t[2] = {ch, '\0'};
+			if (ch == ' ' || bools[(int)GET_VAL(ch)] || gnt_bindable_check_key(GNT_BINDABLE(menu), t))
 				continue;
 			trigger = ch;
 			break;


More information about the Commits mailing list