diff options
author | Vasily_Makarov <danilka.pro@gmail.com> | 2011-06-15 18:24:14 +0400 |
---|---|---|
committer | Vasily_Makarov <danilka.pro@gmail.com> | 2011-06-15 18:24:14 +0400 |
commit | 6c0a4a2bc3809ee49d55fdff7c55c25d3e6ad4a5 (patch) | |
tree | 8a43922891e4f5eb7909d8d2b80f64235760e18d /saedit/search.h | |
parent | 34dbe2ca8daae2595ee6ff37632a15e68fcc7fc2 (diff) | |
download | evol-tools-6c0a4a2bc3809ee49d55fdff7c55c25d3e6ad4a5.tar.gz evol-tools-6c0a4a2bc3809ee49d55fdff7c55c25d3e6ad4a5.tar.bz2 evol-tools-6c0a4a2bc3809ee49d55fdff7c55c25d3e6ad4a5.tar.xz evol-tools-6c0a4a2bc3809ee49d55fdff7c55c25d3e6ad4a5.zip |
saedit: Review code and add some features
Diffstat (limited to 'saedit/search.h')
-rw-r--r-- | saedit/search.h | 60 |
1 files changed, 7 insertions, 53 deletions
diff --git a/saedit/search.h b/saedit/search.h index eacdc56..5d2b5ff 100644 --- a/saedit/search.h +++ b/saedit/search.h @@ -9,58 +9,12 @@ | | \*=======================================*/ -GtkWidget *find_entry; +#ifndef SEARCH_H +#define SEARCH_H -static gboolean find_text() { - gboolean found; - gchar *text = gtk_entry_get_text(find_entry); +gboolean search_find_text(gchar *text); +gboolean search_find_next(); +void search_find_dialog_show(GtkWindow *parent, + GtkWidget *text_view); - GtkTextIter m_start, m_end, start; - gtk_text_buffer_get_selection_bounds(source_buffer, NULL, &start); - found = gtk_source_iter_forward_search(&start, text, 0, &m_start, &m_end, NULL); - - if (!found) { - gtk_text_buffer_get_start_iter(source_buffer, &start); - found = gtk_source_iter_forward_search(&start, text, 0, &m_start, &m_end, NULL); - } - if (found) { - gtk_text_buffer_place_cursor(source_buffer, &m_start); - gtk_text_buffer_move_mark_by_name(source_buffer, "selection_bound", &m_end); - gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (source_view), - gtk_text_buffer_get_insert (source_buffer), - 0.25, - FALSE, - 0.0, - 0.0); - return TRUE; - } else - return FALSE; -} - -static GtkWidget *show_find_dialog() { - GtkWidget *dialog; - GtkWidget *vbox; - GtkWidget *entry; - GtkWidget *content_area; - GtkWidget *label; - - dialog = gtk_dialog_new_with_buttons (_("Find"), - win, - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_FIND, - GTK_RESPONSE_NONE, - NULL); - gtk_widget_set_size_request(dialog, 240, 80); - gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); - content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); - - entry = gtk_entry_new(); - gtk_container_add(GTK_CONTAINER(content_area), entry); - find_entry = entry; - - g_signal_connect(dialog, - "response", - G_CALLBACK(find_text), - NULL); - gtk_widget_show_all(dialog); -} +#endif |