[gimp/tito: 28/50] Added fuzzy search. (Unfinished)
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/tito: 28/50] Added fuzzy search. (Unfinished)
- Date: Sat, 9 Nov 2013 23:20:35 +0000 (UTC)
commit 81e5a423426c6f313b700b3400e0038ae16fa0be
Author: Srihari Sriraman <srihari c42 in>
Date: Sat Sep 8 23:00:34 2012 +0530
Added fuzzy search. (Unfinished)
app/dialogs/tito-dialog.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/app/dialogs/tito-dialog.c b/app/dialogs/tito-dialog.c
index acdf789..4dd2678 100644
--- a/app/dialogs/tito-dialog.c
+++ b/app/dialogs/tito-dialog.c
@@ -556,6 +556,19 @@ static void tito_fill_history (void)
}
static gboolean
+fuzzy_search ( gchar *string,
+ gchar *key)
+{
+ gchar *remaining_string = string;
+ if ( strlen(key) == 0 || strlen(remaining_string) == 0 )
+ return TRUE;
+
+ if ( (remaining_string = strchr(string, key[0])) != NULL )
+ fuzzy_search( key+1, remaining_string+1 );
+ return FALSE;
+}
+
+static gboolean
tito_is_action_match ( GtkAction *action,
const gchar* keyword)
{
@@ -586,6 +599,8 @@ tito_is_action_match ( GtkAction *action,
if(strstr(label,key))
return TRUE;
+ if(fuzzy_search(label,key))
+ return TRUE;
if(strlen(key)>2 || strcmp(key," ")==0)
{
@@ -733,7 +748,7 @@ tito_initializer(void)
GdkWindow *par_window = gdk_screen_get_active_window(gdk_screen_get_default());
gdk_window_get_geometry (par_window, &par_x, &par_y, &par_width, &par_height, NULL);
tito_update_position();
-
+
if(first_time)
{
history_file_path= g_new(gchar, 1024);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]