changeset 18566:3c634117a7ef

Allow disabling the widget actions on specific widgets. This allows, for example, to search in the tree without triggering some action.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 20 Jul 2007 21:46:29 +0000
parents 980d6e1b2d21
children 2a431f30af2a
files finch/libgnt/gnttree.c finch/libgnt/gntwidget.c finch/libgnt/gntwidget.h
diffstat 3 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/gnttree.c	Fri Jul 20 21:41:05 2007 +0000
+++ b/finch/libgnt/gnttree.c	Fri Jul 20 21:46:29 2007 +0000
@@ -804,6 +804,8 @@
 			redraw_tree(tree);
 			g_source_remove(tree->priv->search_timeout);
 			tree->priv->search_timeout = g_timeout_add(SEARCH_TIMEOUT, search_timeout, tree);
+		} else {
+			gnt_bindable_perform_action_key(GNT_BINDABLE(tree), text);
 		}
 		return TRUE;
 	} else if (text[0] == ' ' && text[1] == 0) {
@@ -914,6 +916,7 @@
 	GntTree *tree = GNT_TREE(bindable);
 	if (tree->priv->search)
 		return FALSE;
+	GNT_WIDGET_SET_FLAGS(GNT_WIDGET(tree), GNT_WIDGET_DISABLE_ACTIONS);
 	tree->priv->search = g_string_new(NULL);
 	tree->priv->search_timeout = g_timeout_add(SEARCH_TIMEOUT, search_timeout, tree);
 	return TRUE;
@@ -925,6 +928,7 @@
 	GntTree *tree = GNT_TREE(bindable);
 	if (tree->priv->search == NULL)
 		return FALSE;
+	GNT_WIDGET_UNSET_FLAGS(GNT_WIDGET(tree), GNT_WIDGET_DISABLE_ACTIONS);
 	end_search(tree);
 	redraw_tree(tree);
 	return TRUE;
--- a/finch/libgnt/gntwidget.c	Fri Jul 20 21:41:05 2007 +0000
+++ b/finch/libgnt/gntwidget.c	Fri Jul 20 21:46:29 2007 +0000
@@ -393,7 +393,8 @@
 	if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_CAN_TAKE_FOCUS))
 		return FALSE;
 
-	if (gnt_bindable_perform_action_key(GNT_BINDABLE(widget), keys))
+	if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_DISABLE_ACTIONS) &&
+			gnt_bindable_perform_action_key(GNT_BINDABLE(widget), keys))
 		return TRUE;
 
 	keys = gnt_bindable_remap_keys(GNT_BINDABLE(widget), keys);
--- a/finch/libgnt/gntwidget.h	Fri Jul 20 21:41:05 2007 +0000
+++ b/finch/libgnt/gntwidget.h	Fri Jul 20 21:46:29 2007 +0000
@@ -65,6 +65,7 @@
 	GNT_WIDGET_GROW_Y         = 1 << 9,
 	GNT_WIDGET_INVISIBLE      = 1 << 10,
 	GNT_WIDGET_TRANSIENT      = 1 << 11,
+	GNT_WIDGET_DISABLE_ACTIONS = 1 << 12,
 } GntWidgetFlags;
 
 /* XXX: This will probably move elsewhere */