check response_id in search_response_cb

This commit is contained in:
Daniel Micay 2012-05-22 04:55:42 -04:00
parent 72aecb23f0
commit a1768c4094
1 changed files with 10 additions and 8 deletions

18
term.c
View File

@ -18,15 +18,17 @@ typedef struct search_dialog_info {
} search_dialog_info;
static void search_response_cb(GtkDialog *dialog, gint response_id, search_dialog_info *info) {
GRegex *regex = vte_terminal_search_get_gregex(VTE_TERMINAL(info->vte));
if (regex) g_regex_unref(regex);
regex = g_regex_new(gtk_entry_get_text(GTK_ENTRY(info->entry)), 0, 0, NULL);
vte_terminal_search_set_gregex(VTE_TERMINAL(info->vte), regex);
if (response_id == GTK_RESPONSE_ACCEPT) {
GRegex *regex = vte_terminal_search_get_gregex(VTE_TERMINAL(info->vte));
if (regex) g_regex_unref(regex);
regex = g_regex_new(gtk_entry_get_text(GTK_ENTRY(info->entry)), 0, 0, NULL);
vte_terminal_search_set_gregex(VTE_TERMINAL(info->vte), regex);
if (info->direction == search_forward) {
vte_terminal_search_find_next(VTE_TERMINAL(info->vte));
} else {
vte_terminal_search_find_previous(VTE_TERMINAL(info->vte));
if (info->direction == search_forward) {
vte_terminal_search_find_next(VTE_TERMINAL(info->vte));
} else {
vte_terminal_search_find_previous(VTE_TERMINAL(info->vte));
}
}
free(info);