comparison finch/libgnt/gnttree.c @ 26440:8df78c06d10e

Save the world. Patch from Arunan Bala to save the world. But instead of saving the cheerleader, he's using g_timeout_add_seconds where possible in place of g_timeout_add. Closes #8831.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 05 Apr 2009 08:42:00 +0000
parents c67d43408daa
children 28795b39d745
comparison
equal deleted inserted replaced
26439:c67d43408daa 26440:8df78c06d10e
26 #include "gntutils.h" 26 #include "gntutils.h"
27 27
28 #include <string.h> 28 #include <string.h>
29 #include <ctype.h> 29 #include <ctype.h>
30 30
31 #define SEARCH_TIMEOUT 4000 /* 4 secs */ 31 #define SEARCH_TIMEOUT_S 4 /* 4 secs */
32 #define SEARCHING(tree) (tree->priv->search && tree->priv->search->len > 0) 32 #define SEARCHING(tree) (tree->priv->search && tree->priv->search->len > 0)
33 33
34 #define COLUMN_INVISIBLE(tree, index) (tree->columns[index].flags & GNT_TREE_COLUMN_INVISIBLE) 34 #define COLUMN_INVISIBLE(tree, index) (tree->columns[index].flags & GNT_TREE_COLUMN_INVISIBLE)
35 #define BINARY_DATA(tree, index) (tree->columns[index].flags & GNT_TREE_COLUMN_BINARY_DATA) 35 #define BINARY_DATA(tree, index) (tree->columns[index].flags & GNT_TREE_COLUMN_BINARY_DATA)
36 #define RIGHT_ALIGNED(tree, index) (tree->columns[index].flags & GNT_TREE_COLUMN_RIGHT_ALIGNED) 36 #define RIGHT_ALIGNED(tree, index) (tree->columns[index].flags & GNT_TREE_COLUMN_RIGHT_ALIGNED)
819 redraw_tree(tree); 819 redraw_tree(tree);
820 } else { 820 } else {
821 gnt_bindable_perform_action_key(GNT_BINDABLE(tree), text); 821 gnt_bindable_perform_action_key(GNT_BINDABLE(tree), text);
822 } 822 }
823 g_source_remove(tree->priv->search_timeout); 823 g_source_remove(tree->priv->search_timeout);
824 tree->priv->search_timeout = g_timeout_add(SEARCH_TIMEOUT, search_timeout, tree); 824 tree->priv->search_timeout = g_timeout_add_seconds(SEARCH_TIMEOUT_S, search_timeout, tree);
825 return TRUE; 825 return TRUE;
826 } else if (text[0] == ' ' && text[1] == 0) { 826 } else if (text[0] == ' ' && text[1] == 0) {
827 /* Space pressed */ 827 /* Space pressed */
828 GntTreeRow *row = tree->current; 828 GntTreeRow *row = tree->current;
829 if (row && row->child) 829 if (row && row->child)
931 GntTree *tree = GNT_TREE(bindable); 931 GntTree *tree = GNT_TREE(bindable);
932 if (tree->priv->search) 932 if (tree->priv->search)
933 return FALSE; 933 return FALSE;
934 GNT_WIDGET_SET_FLAGS(GNT_WIDGET(tree), GNT_WIDGET_DISABLE_ACTIONS); 934 GNT_WIDGET_SET_FLAGS(GNT_WIDGET(tree), GNT_WIDGET_DISABLE_ACTIONS);
935 tree->priv->search = g_string_new(NULL); 935 tree->priv->search = g_string_new(NULL);
936 tree->priv->search_timeout = g_timeout_add(SEARCH_TIMEOUT, search_timeout, tree); 936 tree->priv->search_timeout = g_timeout_add_seconds(SEARCH_TIMEOUT_S, search_timeout, tree);
937 return TRUE; 937 return TRUE;
938 } 938 }
939 939
940 static gboolean 940 static gboolean
941 end_search_action(GntBindable *bindable, GList *list) 941 end_search_action(GntBindable *bindable, GList *list)