comparison finch/libgnt/gntfilesel.c @ 18868:d470282d49da

Fix typeahead searching in the file-dialog.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 11 Aug 2007 04:12:09 +0000
parents 5e1412f4e67a
children 70a3aa1f2dd5
comparison
equal deleted inserted replaced
18867:1d96cfd8879f 18868:d470282d49da
353 if (!gnt_file_sel_set_current_location(sel, path)) { 353 if (!gnt_file_sel_set_current_location(sel, path)) {
354 gnt_tree_set_selected(tree, str); 354 gnt_tree_set_selected(tree, str);
355 } else if (strcmp(str, "..") == 0) { 355 } else if (strcmp(str, "..") == 0) {
356 gnt_tree_set_selected(tree, dir); 356 gnt_tree_set_selected(tree, dir);
357 } 357 }
358 gnt_bindable_perform_action_named(GNT_BINDABLE(tree), "end-search", NULL);
358 g_free(dir); 359 g_free(dir);
359 g_free(str); 360 g_free(str);
360 g_free(path); 361 g_free(path);
361 return TRUE; 362 return TRUE;
362 } 363 }
493 GntWidget *tree; 494 GntWidget *tree;
494 495
495 if (!sel->multiselect) 496 if (!sel->multiselect)
496 return FALSE; 497 return FALSE;
497 tree = sel->dirsonly ? sel->dirs : sel->files; 498 tree = sel->dirsonly ? sel->dirs : sel->files;
498 if (!gnt_widget_has_focus(tree)) 499 if (!gnt_widget_has_focus(tree) ||
499 return FALSE; 500 gnt_tree_is_searching(GNT_TREE(tree)))
500 501 return FALSE;
501 file = gnt_tree_get_selection_data(sel->dirsonly ? GNT_TREE(sel->dirs) : GNT_TREE(sel->files)); 502
503 file = gnt_tree_get_selection_data(GNT_TREE(tree));
502 504
503 str = gnt_file_sel_get_selected_file(sel); 505 str = gnt_file_sel_get_selected_file(sel);
504 if ((find = g_list_find_custom(sel->tags, str, (GCompareFunc)g_utf8_collate)) != NULL) { 506 if ((find = g_list_find_custom(sel->tags, str, (GCompareFunc)g_utf8_collate)) != NULL) {
505 g_free(find->data); 507 g_free(find->data);
506 sel->tags = g_list_delete_link(sel->tags, find); 508 sel->tags = g_list_delete_link(sel->tags, find);
524 GList *iter; 526 GList *iter;
525 527
526 if (!sel->multiselect) 528 if (!sel->multiselect)
527 return FALSE; 529 return FALSE;
528 tree = sel->dirsonly ? sel->dirs : sel->files; 530 tree = sel->dirsonly ? sel->dirs : sel->files;
529 if (!gnt_widget_has_focus(tree)) 531 if (!gnt_widget_has_focus(tree) ||
532 gnt_tree_is_searching(GNT_TREE(tree)))
530 return FALSE; 533 return FALSE;
531 534
532 g_list_foreach(sel->tags, (GFunc)g_free, NULL); 535 g_list_foreach(sel->tags, (GFunc)g_free, NULL);
533 g_list_free(sel->tags); 536 g_list_free(sel->tags);
534 sel->tags = NULL; 537 sel->tags = NULL;
544 { 547 {
545 char *path, *dir; 548 char *path, *dir;
546 GntFileSel *sel = GNT_FILE_SEL(bind); 549 GntFileSel *sel = GNT_FILE_SEL(bind);
547 if (!gnt_widget_has_focus(sel->dirs) && 550 if (!gnt_widget_has_focus(sel->dirs) &&
548 !gnt_widget_has_focus(sel->files)) 551 !gnt_widget_has_focus(sel->files))
552 return FALSE;
553 if (gnt_tree_is_searching(GNT_TREE(sel->dirs)) ||
554 gnt_tree_is_searching(GNT_TREE(sel->files)))
549 return FALSE; 555 return FALSE;
550 556
551 path = g_build_filename(sel->current, "..", NULL); 557 path = g_build_filename(sel->current, "..", NULL);
552 dir = g_path_get_basename(sel->current); 558 dir = g_path_get_basename(sel->current);
553 if (gnt_file_sel_set_current_location(sel, path)) 559 if (gnt_file_sel_set_current_location(sel, path))