# HG changeset patch # User Sadrul Habib Chowdhury # Date 1184967989 0 # Node ID 3c634117a7ef4b3d11c8d31edc63517200a8cbab # Parent 980d6e1b2d21da6c81f94570d61ef76476ec8931 Allow disabling the widget actions on specific widgets. This allows, for example, to search in the tree without triggering some action. diff -r 980d6e1b2d21 -r 3c634117a7ef finch/libgnt/gnttree.c --- 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; diff -r 980d6e1b2d21 -r 3c634117a7ef finch/libgnt/gntwidget.c --- 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); diff -r 980d6e1b2d21 -r 3c634117a7ef finch/libgnt/gntwidget.h --- 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 */