52#include <gdk/gdkkeysyms.h>
149static void search_read_io(GString *
string, GIOCondition condition, gpointer data);
152static void search_finished(GPid child_pid, gint status, gpointer user_data);
154static gchar **
search_get_argv(
const gchar **argv_prefix,
const gchar *dir);
195 "pref_search_hide_find_dialog", FALSE,
"check_always_wrap_search");
197 "pref_search_always_wrap", FALSE,
"check_hide_find_dialog");
199 "pref_search_current_file_dir", TRUE,
"check_fif_current_dir");
216 "fif_regexp", FALSE,
"check_regexp");
218 "fif_case_sensitive", TRUE,
"check_case");
220 "fif_match_whole_word", FALSE,
"check_wholeword");
222 "fif_invert_results", FALSE,
"check_invert");
224 "fif_recursive", FALSE,
"check_recursive");
226 "fif_extra_options",
"",
"entry_extra");
228 "fif_use_extra_options", FALSE,
"check_extra");
230 "fif_files",
"",
"entry_files");
238 "find_regexp", FALSE,
"check_regexp");
240 "find_regexp_multiline", FALSE,
"check_multiline");
242 "find_case_sensitive", FALSE,
"check_case");
244 "find_escape_sequences", FALSE,
"check_escape");
246 "find_match_whole_word", FALSE,
"check_word");
248 "find_match_word_start", FALSE,
"check_wordstart");
250 "find_close_dialog", TRUE,
"check_close");
256 "replace_regexp", FALSE,
"check_regexp");
258 "replace_regexp_multiline", FALSE,
"check_multiline");
260 "replace_case_sensitive", FALSE,
"check_case");
262 "replace_escape_sequences", FALSE,
"check_escape");
264 "replace_match_whole_word", FALSE,
"check_word");
266 "replace_match_word_start", FALSE,
"check_wordstart");
268 "replace_search_backwards", FALSE,
"check_back");
270 "replace_close_dialog", TRUE,
"check_close");
282#define FREE_WIDGET(wid) \
283 if (wid && GTK_IS_WIDGET(wid)) gtk_widget_destroy(wid);
296 GtkToggleButton *togglebutton, gpointer user_data)
298 gtk_widget_set_sensitive(GTK_WIDGET(user_data),
299 !gtk_toggle_button_get_active(togglebutton));
305 GtkWidget *checkbox1, *checkbox2, *check_regexp, *checkbox5,
306 *checkbox7, *check_multiline, *hbox, *fbox, *mbox;
308 check_regexp = gtk_check_button_new_with_mnemonic(
_(
"_Use regular expressions"));
310 gtk_button_set_focus_on_click(GTK_BUTTON(check_regexp), FALSE);
311 gtk_widget_set_tooltip_text(check_regexp,
_(
"Use Perl-like regular expressions. "
312 "For detailed information about using regular expressions, please refer to the manual."));
313 g_signal_connect(check_regexp,
"toggled",
316 checkbox7 = gtk_check_button_new_with_mnemonic(
_(
"Use _escape sequences"));
318 gtk_button_set_focus_on_click(GTK_BUTTON(checkbox7), FALSE);
319 gtk_widget_set_tooltip_text(checkbox7,
320 _(
"Replace \\\\, \\t, \\n, \\r and \\uXXXX (Unicode characters) with the "
321 "corresponding control characters"));
323 check_multiline = gtk_check_button_new_with_mnemonic(
_(
"Use multi-line matchin_g"));
324 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_multiline), FALSE);
325 gtk_widget_set_sensitive(check_multiline, FALSE);
327 gtk_button_set_focus_on_click(GTK_BUTTON(check_multiline), FALSE);
328 gtk_widget_set_tooltip_text(check_multiline,
_(
"Perform regular expression "
329 "matching on the whole buffer at once rather than line by line, allowing "
330 "matches to span multiple lines. In this mode, newline characters are part "
331 "of the input and can be captured as normal characters by the pattern."));
334 fbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
335 gtk_box_pack_start(GTK_BOX(fbox), check_regexp, FALSE, FALSE, 0);
336 gtk_box_pack_start(GTK_BOX(fbox), check_multiline, FALSE, FALSE, 0);
337 gtk_box_pack_start(GTK_BOX(fbox), checkbox7, FALSE, FALSE, 0);
341 GtkWidget *check_back = gtk_check_button_new_with_mnemonic(
_(
"Search _backwards"));
343 gtk_button_set_focus_on_click(GTK_BUTTON(check_back), FALSE);
347 checkbox1 = gtk_check_button_new_with_mnemonic(
_(
"C_ase sensitive"));
349 gtk_button_set_focus_on_click(GTK_BUTTON(checkbox1), FALSE);
351 checkbox2 = gtk_check_button_new_with_mnemonic(
_(
"Match only a _whole word"));
353 gtk_button_set_focus_on_click(GTK_BUTTON(checkbox2), FALSE);
355 checkbox5 = gtk_check_button_new_with_mnemonic(
_(
"Match from s_tart of word"));
357 gtk_button_set_focus_on_click(GTK_BUTTON(checkbox5), FALSE);
360 g_signal_connect(checkbox2,
"toggled",
364 mbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
365 gtk_box_pack_start(GTK_BOX(mbox), checkbox1, FALSE, FALSE, 0);
366 gtk_box_pack_start(GTK_BOX(mbox), checkbox2, FALSE, FALSE, 0);
367 gtk_box_pack_start(GTK_BOX(mbox), checkbox5, FALSE, FALSE, 0);
369 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
370 gtk_box_set_homogeneous(GTK_BOX(hbox), TRUE);
379 gtk_dialog_response(GTK_DIALOG(
find_dlg.dialog), GPOINTER_TO_INT(user_data));
412 GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
414 s = gtk_clipboard_wait_for_text(clipboard);
415 if (s && (strchr(s,
'\n') || strchr(s,
'\r')))
454 gboolean *setting = data;
456 *setting = gtk_expander_get_expanded(exp);
463 GtkWidget *exp, *bbox, *button, *check_close;
465 find_dlg.dialog = gtk_dialog_new_with_buttons(
_(
"Find"),
467 GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL,
NULL);
469 gtk_widget_set_name(
find_dlg.dialog,
"GeanyDialogSearch");
470 gtk_box_set_spacing(GTK_BOX(vbox), 9);
473 gtk_dialog_add_action_widget(GTK_DIALOG(
find_dlg.dialog), button,
478 gtk_dialog_add_action_widget(GTK_DIALOG(
find_dlg.dialog), button,
481 label = gtk_label_new_with_mnemonic(
_(
"_Search for:"));
482 gtk_misc_set_alignment(GTK_MISC(
label), 0, 0.5);
484 entry = gtk_combo_box_text_new_with_entry();
486 gtk_label_set_mnemonic_widget(GTK_LABEL(
label),
entry);
487 gtk_entry_set_width_chars(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(
entry))), 50);
490 g_signal_connect(gtk_bin_get_child(GTK_BIN(
entry)),
"activate",
493 g_signal_connect(gtk_bin_get_child(GTK_BIN(
entry)),
"activate-backward",
495 g_signal_connect(
find_dlg.dialog,
"response",
497 g_signal_connect(
find_dlg.dialog,
"delete-event",
498 G_CALLBACK(gtk_widget_hide_on_delete),
NULL);
500 sbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
501 gtk_box_pack_start(GTK_BOX(sbox),
label, FALSE, FALSE, 0);
502 gtk_box_pack_start(GTK_BOX(sbox),
entry, TRUE, TRUE, 0);
503 gtk_box_pack_start(GTK_BOX(vbox), sbox, TRUE, FALSE, 0);
509 exp = gtk_expander_new_with_mnemonic(
_(
"_Find All"));
510 gtk_expander_set_expanded(GTK_EXPANDER(exp),
find_dlg.all_expanded);
511 g_signal_connect_after(exp,
"activate",
514 bbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
516 button = gtk_button_new_with_mnemonic(
_(
"_Mark"));
517 gtk_widget_set_tooltip_text(button,
518 _(
"Mark all matches in the current document"));
523 button = gtk_button_new_with_mnemonic(
_(
"In Sessi_on"));
528 button = gtk_button_new_with_mnemonic(
_(
"_In Document"));
534 check_close = gtk_check_button_new_with_mnemonic(
_(
"Close _dialog"));
536 gtk_button_set_focus_on_click(GTK_BUTTON(check_close), FALSE);
537 gtk_widget_set_tooltip_text(check_close,
538 _(
"Disable this option to keep the dialog open"));
540 gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(bbox), check_close, TRUE);
543 GTK_BUTTON_BOX(gtk_dialog_get_action_area(GTK_DIALOG(
find_dlg.dialog))),
544 GTK_BUTTON_BOX(bbox));
562 g_return_if_fail(doc !=
NULL);
571 gtk_entry_set_text(GTK_ENTRY(
find_dlg.entry), sel);
581 gtk_entry_set_text(GTK_ENTRY(
find_dlg.entry), sel);
585 gtk_widget_grab_focus(
find_dlg.entry);
589 gtk_window_present(GTK_WINDOW(
find_dlg.dialog));
598 gtk_dialog_response(GTK_DIALOG(
replace_dlg.dialog), GPOINTER_TO_INT(user_data));
605 if (event->keyval == GDK_KEY_Tab)
607 gtk_widget_grab_focus(GTK_WIDGET(user_data));
616 GtkWidget *label_find, *label_replace,
617 *check_close, *button, *rbox, *fbox, *vbox, *exp, *bbox;
618 GtkSizeGroup *label_size;
620 replace_dlg.dialog = gtk_dialog_new_with_buttons(
_(
"Replace"),
622 GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL,
NULL);
624 gtk_box_set_spacing(GTK_BOX(vbox), 9);
625 gtk_widget_set_name(
replace_dlg.dialog,
"GeanyDialogSearch");
627 button = gtk_button_new_from_stock(GTK_STOCK_FIND);
628 gtk_dialog_add_action_widget(GTK_DIALOG(
replace_dlg.dialog), button,
630 button = gtk_button_new_with_mnemonic(
_(
"_Replace"));
631 gtk_button_set_image(GTK_BUTTON(button),
632 gtk_image_new_from_stock(GTK_STOCK_FIND_AND_REPLACE, GTK_ICON_SIZE_BUTTON));
633 gtk_dialog_add_action_widget(GTK_DIALOG(
replace_dlg.dialog), button,
635 button = gtk_button_new_with_mnemonic(
_(
"Replace & Fi_nd"));
636 gtk_button_set_image(GTK_BUTTON(button),
637 gtk_image_new_from_stock(GTK_STOCK_FIND_AND_REPLACE, GTK_ICON_SIZE_BUTTON));
638 gtk_dialog_add_action_widget(GTK_DIALOG(
replace_dlg.dialog), button,
641 label_find = gtk_label_new_with_mnemonic(
_(
"_Search for:"));
642 gtk_misc_set_alignment(GTK_MISC(label_find), 0, 0.5);
644 label_replace = gtk_label_new_with_mnemonic(
_(
"Replace wit_h:"));
645 gtk_misc_set_alignment(GTK_MISC(label_replace), 0, 0.5);
647 replace_dlg.find_combobox = gtk_combo_box_text_new_with_entry();
650 gtk_label_set_mnemonic_widget(GTK_LABEL(label_find),
replace_dlg.find_combobox);
651 gtk_entry_set_width_chars(GTK_ENTRY(
replace_dlg.find_entry), 50);
654 replace_dlg.replace_combobox = gtk_combo_box_text_new_with_entry();
657 gtk_label_set_mnemonic_widget(GTK_LABEL(label_replace),
replace_dlg.replace_combobox);
658 gtk_entry_set_width_chars(GTK_ENTRY(
replace_dlg.replace_entry), 50);
665 g_signal_connect(
replace_dlg.find_entry,
"activate",
667 g_signal_connect(
replace_dlg.replace_entry,
"activate",
671 g_signal_connect(
replace_dlg.dialog,
"delete-event",
672 G_CALLBACK(gtk_widget_hide_on_delete),
NULL);
674 fbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
675 gtk_box_pack_start(GTK_BOX(fbox), label_find, FALSE, FALSE, 0);
676 gtk_box_pack_start(GTK_BOX(fbox),
replace_dlg.find_combobox, TRUE, TRUE, 0);
678 rbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
679 gtk_box_pack_start(GTK_BOX(rbox), label_replace, FALSE, FALSE, 0);
680 gtk_box_pack_start(GTK_BOX(rbox),
replace_dlg.replace_combobox, TRUE, TRUE, 0);
682 label_size = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
683 gtk_size_group_add_widget(label_size, label_find);
684 gtk_size_group_add_widget(label_size, label_replace);
685 g_object_unref(G_OBJECT(label_size));
687 gtk_box_pack_start(GTK_BOX(vbox), fbox, TRUE, FALSE, 0);
688 gtk_box_pack_start(GTK_BOX(vbox), rbox, TRUE, FALSE, 0);
693 exp = gtk_expander_new_with_mnemonic(
_(
"Re_place All"));
694 gtk_expander_set_expanded(GTK_EXPANDER(exp),
replace_dlg.all_expanded);
695 g_signal_connect_after(exp,
"activate",
698 bbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
700 button = gtk_button_new_with_mnemonic(
_(
"In Sessi_on"));
705 button = gtk_button_new_with_mnemonic(
_(
"_In Document"));
710 button = gtk_button_new_with_mnemonic(
_(
"In Se_lection"));
711 gtk_widget_set_tooltip_text(button,
712 _(
"Replace all matches found in the currently selected text"));
718 check_close = gtk_check_button_new_with_mnemonic(
_(
"Close _dialog"));
720 gtk_button_set_focus_on_click(GTK_BUTTON(check_close), FALSE);
721 gtk_widget_set_tooltip_text(check_close,
722 _(
"Disable this option to keep the dialog open"));
724 gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(bbox), check_close, TRUE);
727 GTK_BUTTON_BOX(gtk_dialog_get_action_area(GTK_DIALOG(
replace_dlg.dialog))),
728 GTK_BUTTON_BOX(bbox));
749 gtk_entry_set_text(GTK_ENTRY(
replace_dlg.find_entry), sel);
759 gtk_entry_set_text(GTK_ENTRY(
replace_dlg.find_entry), sel);
767 gtk_window_present(GTK_WINDOW(
replace_dlg.dialog));
777 gtk_widget_set_sensitive(GTK_WIDGET(user_data),
778 gtk_toggle_button_get_active(togglebutton));
787 entry = gtk_bin_get_child(GTK_BIN(fcombo));
789 selection = gtk_combo_box_get_active(GTK_COMBO_BOX(mode_combo));
793 gtk_entry_set_text(GTK_ENTRY(
entry),
"");
794 gtk_widget_set_sensitive(fcombo, FALSE);
798 gtk_widget_set_sensitive(fcombo, TRUE);
807 gtk_entry_set_text(GTK_ENTRY(
entry), patterns);
812 gtk_entry_set_text(GTK_ENTRY(
entry),
"");
815 gtk_widget_set_sensitive(fcombo, FALSE);
824 GtkCellRenderer *renderer;
829 store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_BOOLEAN);
830 gtk_list_store_append(store, &iter);
831 gtk_list_store_set(store, &iter, 0,
_(
"all"), 1, TRUE, -1);
832 gtk_list_store_append(store, &iter);
833 gtk_list_store_set(store, &iter, 0,
_(
"project"), 1,
app->
project !=
NULL, -1);
834 gtk_list_store_append(store, &iter);
835 gtk_list_store_set(store, &iter, 0,
_(
"custom"), 1, TRUE, -1);
837 combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
838 g_object_unref(store);
839 gtk_widget_set_tooltip_text(combo,
_(
"All: search all files in the directory\n"
840 "Project: use file patterns defined in the project settings\n"
841 "Custom: specify file patterns manually"));
843 renderer = gtk_cell_renderer_text_new();
844 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, TRUE);
845 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer,
"text", 0,
"sensitive", 1,
NULL);
854 GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(
fif_dlg.files_mode_combo));
858 if (gtk_tree_model_get_iter_from_string(model, &iter,
"1"))
859 gtk_list_store_set(GTK_LIST_STORE(model), &iter, 1,
app->
project !=
NULL, -1);
866 GtkWidget *
label, *label1, *label2, *label3, *checkbox1, *checkbox2, *check_wholeword,
867 *check_recursive, *check_extra, *entry_extra, *check_regexp, *combo_files_mode;
868 GtkWidget *dbox, *sbox, *lbox, *rbox, *hbox, *vbox, *ebox;
869 GtkSizeGroup *size_group;
871 fif_dlg.dialog = gtk_dialog_new_with_buttons(
873 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
NULL);
875 gtk_box_set_spacing(GTK_BOX(vbox), 9);
876 gtk_widget_set_name(
fif_dlg.dialog,
"GeanyDialogSearch");
878 gtk_dialog_add_button(GTK_DIALOG(
fif_dlg.dialog), GTK_STOCK_FIND, GTK_RESPONSE_ACCEPT);
879 gtk_dialog_set_default_response(GTK_DIALOG(
fif_dlg.dialog),
880 GTK_RESPONSE_ACCEPT);
882 label = gtk_label_new_with_mnemonic(
_(
"_Search for:"));
883 gtk_misc_set_alignment(GTK_MISC(
label), 0, 0.5);
885 combo = gtk_combo_box_text_new_with_entry();
886 entry = gtk_bin_get_child(GTK_BIN(combo));
888 gtk_label_set_mnemonic_widget(GTK_LABEL(
label),
entry);
889 gtk_entry_set_width_chars(GTK_ENTRY(
entry), 50);
890 gtk_entry_set_activates_default(GTK_ENTRY(
entry), TRUE);
893 sbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
894 gtk_box_pack_start(GTK_BOX(sbox),
label, FALSE, FALSE, 0);
895 gtk_box_pack_start(GTK_BOX(sbox), combo, TRUE, TRUE, 0);
898 size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
899 gtk_size_group_add_widget(size_group,
label);
901 label3 = gtk_label_new_with_mnemonic(
_(
"File _patterns:"));
902 gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5);
905 gtk_label_set_mnemonic_widget(GTK_LABEL(label3), combo_files_mode);
907 fif_dlg.files_mode_combo = combo_files_mode;
909 fcombo = gtk_combo_box_text_new_with_entry();
910 entry = gtk_bin_get_child(GTK_BIN(fcombo));
912 gtk_entry_set_activates_default(GTK_ENTRY(
entry), TRUE);
913 gtk_widget_set_tooltip_text(
entry,
914 _(
"Space separated list of file patterns (e.g. *.c *.h)"));
921 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
922 gtk_box_pack_start(GTK_BOX(hbox), label3, FALSE, FALSE, 0);
923 gtk_box_pack_start(GTK_BOX(hbox), combo_files_mode, FALSE, FALSE, 0);
924 gtk_box_pack_start(GTK_BOX(hbox), fcombo, TRUE, TRUE, 0);
926 label1 = gtk_label_new_with_mnemonic(
_(
"_Directory:"));
927 gtk_misc_set_alignment(GTK_MISC(label1), 0, 0.5);
929 dir_combo = gtk_combo_box_text_new_with_entry();
932 gtk_entry_set_activates_default(GTK_ENTRY(
entry), TRUE);
933 gtk_label_set_mnemonic_widget(GTK_LABEL(label1),
entry);
934 gtk_entry_set_width_chars(GTK_ENTRY(
entry), 50);
938 g_signal_connect(gtk_bin_get_child(GTK_BIN(fcombo)),
"key-press-event",
943 gtk_box_pack_start(GTK_BOX(dbox), label1, FALSE, FALSE, 0);
945 label2 = gtk_label_new_with_mnemonic(
_(
"E_ncoding:"));
946 gtk_misc_set_alignment(GTK_MISC(label2), 0, 0.5);
949 gtk_label_set_mnemonic_widget(GTK_LABEL(label2), e_combo);
950 fif_dlg.encoding_combo = e_combo;
952 ebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
953 gtk_box_pack_start(GTK_BOX(ebox), label2, FALSE, FALSE, 0);
954 gtk_box_pack_start(GTK_BOX(ebox), e_combo, TRUE, TRUE, 0);
956 gtk_size_group_add_widget(size_group, label1);
957 gtk_size_group_add_widget(size_group, label2);
958 gtk_size_group_add_widget(size_group, label3);
959 g_object_unref(G_OBJECT(size_group));
961 gtk_box_pack_start(GTK_BOX(vbox), sbox, TRUE, FALSE, 0);
962 gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, FALSE, 0);
963 gtk_box_pack_start(GTK_BOX(vbox), dbox, TRUE, FALSE, 0);
964 gtk_box_pack_start(GTK_BOX(vbox), ebox, TRUE, FALSE, 0);
966 check_regexp = gtk_check_button_new_with_mnemonic(
_(
"_Use regular expressions"));
968 gtk_button_set_focus_on_click(GTK_BUTTON(check_regexp), FALSE);
969 gtk_widget_set_tooltip_text(check_regexp,
_(
"See grep's manual page for more information"));
971 check_recursive = gtk_check_button_new_with_mnemonic(
_(
"_Recurse in subfolders"));
973 gtk_button_set_focus_on_click(GTK_BUTTON(check_recursive), FALSE);
975 checkbox1 = gtk_check_button_new_with_mnemonic(
_(
"C_ase sensitive"));
977 gtk_button_set_focus_on_click(GTK_BUTTON(checkbox1), FALSE);
978 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox1), TRUE);
980 check_wholeword = gtk_check_button_new_with_mnemonic(
_(
"Match only a _whole word"));
982 gtk_button_set_focus_on_click(GTK_BUTTON(check_wholeword), FALSE);
984 checkbox2 = gtk_check_button_new_with_mnemonic(
_(
"_Invert search results"));
986 gtk_button_set_focus_on_click(GTK_BUTTON(checkbox2), FALSE);
987 gtk_widget_set_tooltip_text(checkbox2,
988 _(
"Invert the sense of matching, to select non-matching lines"));
990 lbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
995 rbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
1000 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
1005 check_extra = gtk_check_button_new_with_mnemonic(
_(
"E_xtra options:"));
1007 gtk_button_set_focus_on_click(GTK_BUTTON(check_extra), FALSE);
1009 entry_extra = gtk_entry_new();
1011 gtk_entry_set_activates_default(GTK_ENTRY(entry_extra), TRUE);
1012 gtk_widget_set_sensitive(entry_extra, FALSE);
1013 gtk_widget_set_tooltip_text(entry_extra,
_(
"Other options to pass to Grep"));
1017 g_signal_connect(check_extra,
"toggled",
1020 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
1021 gtk_box_pack_start(GTK_BOX(hbox), check_extra, FALSE, FALSE, 0);
1022 gtk_box_pack_start(GTK_BOX(hbox), entry_extra, TRUE, TRUE, 0);
1025 g_signal_connect(
fif_dlg.dialog,
"response",
1027 g_signal_connect(
fif_dlg.dialog,
"delete-event",
1028 G_CALLBACK(gtk_widget_hide_on_delete),
NULL);
1052 gchar *cur_dir =
NULL;
1070 entry = gtk_bin_get_child(GTK_BIN(
fif_dlg.search_combo));
1072 gtk_entry_set_text(GTK_ENTRY(
entry),
text);
1085 cur_dir = g_strdup(dir);
1090 static gchar *last_cur_dir =
NULL;
1095 if (doc == last_doc && cur_dir &&
utils_str_equal(cur_dir, last_cur_dir))
1102 SETPTR(last_cur_dir, g_strdup(cur_dir));
1106 if (!cur_dir &&
EMPTY(gtk_entry_get_text(GTK_ENTRY(
entry))))
1113 cur_dir = g_get_current_dir();
1118 gtk_entry_set_text(GTK_ENTRY(
entry), cur_dir);
1132 gtk_widget_grab_focus(
fif_dlg.dir_combo);
1134 gtk_widget_grab_focus(
fif_dlg.search_combo);
1139 gtk_widget_show(
fif_dlg.dialog);
1141 gtk_window_present(GTK_WINDOW(
fif_dlg.dialog));
1148 GtkWidget *
dialog = GTK_WIDGET(user_data);
1149 GtkToggleButton *chk_regexp = GTK_TOGGLE_BUTTON(
1152 if (togglebutton == chk_regexp)
1154 gboolean regex_set = gtk_toggle_button_get_active(chk_regexp);
1160 const char *back_button[2] = {
"btn_previous" ,
"check_back" };
1163 gtk_widget_set_sensitive(check_escape, ! regex_set);
1165 gtk_widget_set_sensitive(check_word, ! regex_set);
1166 gtk_widget_set_sensitive(check_wordstart, ! regex_set);
1167 gtk_widget_set_sensitive(check_multiline, regex_set);
1176 info->
flags = flags;
1177 info->
start = start;
1187 g_slice_free1(
sizeof *info, info);
1199 GSList *matches =
NULL;
1215 matches = g_slist_prepend(matches, info);
1225 return g_slist_reverse(matches);
1235 GSList *
match, *matches;
1237 g_return_val_if_fail(
DOC_VALID(doc), 0);
1242 if (G_UNLIKELY(
EMPTY(search_text)))
1260 g_slist_free(matches);
1298 gtk_window_get_position(GTK_WINDOW(
find_dlg.dialog),
1303 if (response == GTK_RESPONSE_CANCEL || response == GTK_RESPONSE_DELETE_EVENT)
1308 gboolean check_close =
settings.find_close_dialog;
1318 search_data.text = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(user_data)))));
1328 gtk_widget_grab_focus(
find_dlg.entry);
1337 g_regex_unref(regex);
1339 else if (
settings.find_escape_sequences)
1373 ngettext(
"Found %d match for \"%s\".",
1374 "Found %d matches for \"%s\".",
count),
1402 GeanyFindFlags search_flags_re, gboolean search_replace_escape_re,
1403 const gchar *find,
const gchar *replace,
1404 const gchar *original_find,
const gchar *original_replace)
1406 guint n, page_count, rep_count = 0, file_count = 0;
1410 for (n = 0; n < page_count; n++)
1415 reps =
document_replace_all(tmp_doc, find, replace, original_find, original_replace, search_flags_re);
1420 if (file_count == 0)
1430 rep_count, file_count);
1444 gboolean search_backwards_re, search_replace_escape_re;
1445 gchar *find, *replace, *original_find =
NULL, *original_replace =
NULL;
1447 gtk_window_get_position(GTK_WINDOW(
replace_dlg.dialog),
1452 if (response == GTK_RESPONSE_CANCEL || response == GTK_RESPONSE_DELETE_EVENT)
1458 search_backwards_re =
settings.replace_search_backwards;
1459 search_replace_escape_re =
settings.replace_escape_sequences;
1460 find = g_strdup(gtk_entry_get_text(GTK_ENTRY(
replace_dlg.find_entry)));
1461 replace = g_strdup(gtk_entry_get_text(GTK_ENTRY(
replace_dlg.replace_entry)));
1468 && (strcmp(find, replace) == 0))
1471 original_find = g_strdup(find);
1472 original_replace = g_strdup(replace);
1478 g_regex_unref(regex);
1483 else if (search_replace_escape_re)
1498 search_backwards_re);
1506 search_backwards_re);
1512 search_backwards_re,
NULL, TRUE, GTK_WIDGET(
dialog));
1517 if (!
document_replace_all(doc, find, replace, original_find, original_replace, search_flags_re))
1522 replace_in_session(doc, search_flags_re, search_replace_escape_re, find, replace, original_find, original_replace);
1539 g_free(original_find);
1540 g_free(original_replace);
1548 g_free(original_find);
1549 g_free(original_replace);
1555 GString *gstr = g_string_new(
"-nHI");
1558 g_string_append_c(gstr,
'v');
1560 g_string_append_c(gstr,
'i');
1562 g_string_append_c(gstr,
'w');
1564 g_string_append_c(gstr,
'r');
1567 g_string_append_c(gstr,
'F');
1569 g_string_append_c(gstr,
'E');
1571 if (
settings.fif_use_extra_options)
1573 g_strstrip(
settings.fif_extra_options);
1575 if (*
settings.fif_extra_options != 0)
1577 g_string_append_c(gstr,
' ');
1578 g_string_append(gstr,
settings.fif_extra_options);
1587 tmp = g_string_new(
settings.fif_files);
1589 g_string_prepend_c(tmp,
' ');
1591 g_string_append(gstr, tmp->str);
1592 g_string_free(tmp, TRUE);
1600 G_GNUC_UNUSED gpointer user_data)
1606 if (response == GTK_RESPONSE_ACCEPT)
1609 const gchar *search_text =
1610 gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(
search_combo))));
1612 const gchar *utf8_dir =
1613 gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(
dir_combo))));
1617 if (G_UNLIKELY(
EMPTY(utf8_dir)))
1619 else if (!
EMPTY(search_text))
1630 gtk_widget_hide(
fif_dlg.dialog);
1632 g_string_free(opts, TRUE);
1638 gtk_widget_hide(
fif_dlg.dialog);
1646 gchar **argv_prefix, **argv;
1647 gchar *command_grep;
1648 gchar *command_line, *dir;
1649 gchar *search_text =
NULL;
1651 gboolean ret = FALSE;
1652 gssize utf8_text_len;
1654 if (
EMPTY(utf8_search_text) || ! utf8_dir)
return TRUE;
1657 if (command_grep ==
NULL)
1661 command_line = g_strdup_printf(
"\"%s\" %s --", command_grep, opts);
1662 g_free(command_grep);
1667 utf8_text_len = strlen(utf8_search_text);
1668 if (enc !=
NULL && g_utf8_validate(utf8_search_text, utf8_text_len,
NULL))
1670 search_text = g_convert(utf8_search_text, utf8_text_len, enc,
"UTF-8",
NULL,
NULL,
NULL);
1672 if (search_text ==
NULL)
1673 search_text = g_strdup(utf8_search_text);
1675 argv_prefix = g_new(gchar*, 3);
1676 argv_prefix[0] = search_text;
1683 argv_prefix[1] = g_strdup(
".");
1684 argv_prefix[2] =
NULL;
1689 argv_prefix[1] =
NULL;
1691 g_strfreev(argv_prefix);
1695 g_free(command_line);
1700 gtk_list_store_clear(
msgwindow.store_msg);
1713 utf8_str = g_strdup_printf(
_(
"%s %s -- %s (in directory: %s)"),
1723 g_error_free(
error);
1738 if (g_pattern_match_string(item->data, str))
1750 guint prefix_len, list_len, i, j;
1752 GSList *
list, *item, *patterns =
NULL;
1755 g_return_val_if_fail(dir !=
NULL,
NULL);
1757 prefix_len = g_strv_length((gchar**)argv_prefix);
1762 g_error_free(
error);
1768 argv = g_new(gchar*, prefix_len + list_len + 1);
1770 for (i = 0, j = 0; i < prefix_len; i++)
1772 if (g_str_has_prefix(argv_prefix[i],
"--include="))
1774 const gchar *pat = &(argv_prefix[i][10]);
1776 patterns = g_slist_prepend(patterns, g_pattern_spec_new(pat));
1779 argv[j++] = g_strdup(argv_prefix[i]);
1789 argv[j++] = item->data;
1794 g_pattern_spec_free(pat->data);
1795 g_slist_free(patterns);
1800 argv[j++] = item->data;
1809static void read_fif_io(gchar *msg, GIOCondition condition, gchar *enc, gint msg_color)
1811 if (condition & (G_IO_IN | G_IO_PRI))
1813 gchar *utf8_msg =
NULL;
1819 if (! g_utf8_validate(msg, -1,
NULL))
1821 utf8_msg = g_convert(msg, -1,
"UTF-8", enc,
NULL,
NULL,
NULL);
1823 if (utf8_msg ==
NULL)
1831 if (utf8_msg != msg)
1851 const gchar *msg =
_(
"Search failed.");
1861 g_warning(
"Find in Files: The command failed unexpectedly (signal received).");
1868 switch (exit_status)
1872 gint
count = gtk_tree_model_iter_n_children(
1875 "Search completed with %d match.",
1876 "Search completed with %d matches.",
count);
1883 msg =
_(
"No matches found.");
1902 rflags |= G_REGEX_MULTILINE;
1904 rflags |= G_REGEX_CASELESS;
1907 geany_debug(
"%s: Unsupported regex flags found!", G_STRFUNC);
1910 regex = g_regex_new(str, rflags, 0, &
error);
1914 g_error_free(
error);
1923 const gint start =
match->matches[nth].start;
1924 const gint end =
match->matches[nth].end;
1925 return g_strndup(&
text[start], end - start);
1933 guint document_length;
1938 if (document_length <= 0)
1941 g_return_val_if_fail(
pos <= document_length, -1);
1947 g_regex_match_full(regex,
text, -1,
pos, 0, &minfo,
NULL);
1959 if (g_regex_match_full(regex,
text, end - start,
pos - start, 0, &minfo,
NULL))
1971 g_match_info_free(minfo);
1977 if (g_match_info_matches(minfo))
1982 SETPTR(
match->match_text, g_match_info_fetch(minfo, 0));
1986 gint start = -1, end = -1;
1988 g_match_info_fetch_pos(minfo, (gint)i, &start, &end);
1989 match->matches[i].start = offset + start;
1990 match->matches[i].end = offset + end;
1996 g_match_info_free(minfo);
2019 if (ret != -1 && match_)
2035 if (ret != -1 && match_)
2049 if (ret ==
pos &&
match->matches[0].start ==
match->matches[0].end)
2054 if (ret != -1 && match_)
2059 g_regex_unref(regex);
2076 str = g_string_new(replace_text);
2079 gchar *
ptr = &str->str[i];
2090 if (c ==
'\\' || !isdigit(c))
2092 g_string_erase(str, i, 1);
2097 g_string_erase(str, i, 2);
2100 g_string_insert(str, i, grp);
2105 g_string_free(str, TRUE);
2119 if (ret != -1 && match_)
2139 if (ret != -1 && match_)
2144 g_regex_unref(regex);
2151 gchar *buffer, *short_file_name;
2154 gint prev_line = -1;
2155 GSList *
match, *matches;
2157 g_return_val_if_fail(
DOC_VALID(doc), 0);
2159 short_file_name = g_path_get_basename(
DOC_FILENAME(doc));
2171 if (
line != prev_line)
2175 "%s:%d: %s", short_file_name,
line + 1, g_strstrip(buffer));
2183 g_slist_free(matches);
2184 g_free(short_file_name);
2196 g_return_if_fail(doc !=
NULL);
2198 if (G_UNLIKELY(
EMPTY(search_text)))
2205 gtk_list_store_clear(
msgwindow.store_msg);
2225 ui_set_statusbar(FALSE,
_(
"No matches found for \"%s\"."), original_search_text);
2231 "Found %d match for \"%s\".",
"Found %d matches for \"%s\".",
count),
2232 count, original_search_text);
2234 "Found %d match for \"%s\".",
"Found %d matches for \"%s\".",
count),
2235 count, original_search_text);
2248 GSList *
match, *matches;
2260 info->
start += offset;
2261 info->
end += offset;
2264 offset += replace_len - (info->
end - info->
start);
2276 g_slist_free(matches);
2286 g_return_if_fail(doc !=
NULL);
2292 change_direction ? forward : !forward,
NULL, FALSE,
NULL);
#define SCI_GETCHARACTERPOINTER
#define SCI_GETRANGEPOINTER
GeanyDocument * document_get_current(void)
Finds the current document.
gint document_find_text(GeanyDocument *doc, const gchar *text, const gchar *original_text, GeanyFindFlags flags, gboolean search_backwards, GeanyMatchInfo **match_, gboolean scroll, GtkWidget *parent)
GeanyDocument * document_get_from_page(guint page_num)
Finds the document for the given notebook page page_num.
gint document_replace_text(GeanyDocument *doc, const gchar *find_text, const gchar *original_find_text, const gchar *replace_text, GeanyFindFlags flags, gboolean search_backwards)
GPtrArray * documents_array
void document_replace_sel(GeanyDocument *doc, const gchar *find_text, const gchar *replace_text, const gchar *original_find_text, const gchar *original_replace_text, GeanyFindFlags flags)
gint document_replace_all(GeanyDocument *doc, const gchar *find_text, const gchar *replace_text, const gchar *original_find_text, const gchar *original_replace_text, GeanyFindFlags flags)
Document related actions: new, save, open, etc.
#define DOC_VALID(doc_ptr)
Null-safe way to check GeanyDocument::is_valid.
#define DOC_FILENAME(doc)
Returns the filename of the document passed or GEANY_STRING_UNTITLED (e.g.
#define documents
Wraps GeanyData::documents_array so it can be used with C array syntax.
gchar * editor_get_default_selection(GeanyEditor *editor, gboolean use_current_word, const gchar *wordchars)
void editor_indicator_clear(GeanyEditor *editor, gint indic)
Deletes all currently set indicators matching indic in the editor window.
void editor_display_current_line(GeanyEditor *editor, gfloat percent_of_view)
void editor_indicator_set_on_range(GeanyEditor *editor, gint indic, gint start, gint end)
Sets an indicator on the range specified by start and end.
@ GEANY_INDICATOR_SEARCH
Indicator used to highlight search results in the document.
const gchar * encodings_get_charset_from_index(gint idx)
Gets the character set name of the specified index e.g.
GeanyEncodingIndex encodings_get_idx_from_charset(const gchar *charset)
Encoding conversion and Byte Order Mark (BOM) handling.
GeanyEncodingIndex
List of known and supported encodings.
void error(const errorSelection selection, const char *const format,...)
static bool match(const unsigned char *line, const char *word)
void configuration_add_pref_group(struct StashGroup *group, gboolean for_prefs_dialog)
void geany_debug(gchar const *format,...)
void msgwin_set_messages_dir(const gchar *messages_dir)
Sets the Messages path for opening any parsed filenames without absolute path from message lines.
void msgwin_msg_add(gint msg_color, gint line, GeanyDocument *doc, const gchar *format,...)
Adds a formatted message in the messages tab treeview in the messages window.
void msgwin_msg_add_string(gint msg_color, gint line, GeanyDocument *doc, const gchar *string)
Adds a new message in the messages tab treeview in the messages window.
Message window functions (status, compiler, messages windows).
@ MSG_STATUS
Index of the status message tab.
@ MSG_MESSAGE
Index of the messages tab.
@ COLOR_BLACK
Color black.
@ COLOR_DARK_RED
Color dark red.
GeanyToolPrefs tool_prefs
gchar * sci_get_line(ScintillaObject *sci, gint line_num)
Gets line contents.
gint sci_get_line_count(ScintillaObject *sci)
Gets the total number of lines.
gint sci_replace_target(ScintillaObject *sci, const gchar *text, gboolean regex)
void sci_set_target_start(ScintillaObject *sci, gint start)
gchar * sci_get_selection_contents(ScintillaObject *sci)
Gets selected text.
gint sci_search_next(ScintillaObject *sci, gint flags, const gchar *text)
gint sci_get_length(ScintillaObject *sci)
Gets the length of all text.
gint sci_get_current_position(ScintillaObject *sci)
Gets the cursor position.
void sci_set_selection(ScintillaObject *sci, gint anchorPos, gint currentPos)
gint sci_find_text(ScintillaObject *sci, gint flags, struct Sci_TextToFind *ttf)
Finds text in the document.
gboolean sci_has_selection(ScintillaObject *sci)
Checks if there's a selection.
gint sci_search_prev(ScintillaObject *sci, gint flags, const gchar *text)
void sci_set_target_end(ScintillaObject *sci, gint end)
gint sci_get_line_end_position(ScintillaObject *sci, gint line)
Gets the position at the end of a line.
gint sci_get_line_from_position(ScintillaObject *sci, gint position)
Gets the line number from position.
gint sci_get_position_from_line(ScintillaObject *sci, gint line)
Gets the position for the start of line.
Wrapper functions for the Scintilla editor widget SCI_* messages.
gboolean fif_invert_results
static void create_find_dialog(void)
void search_show_find_in_files_dialog(const gchar *dir)
Shows the Find in Files dialog.
static GtkWidget * create_fif_file_mode_combo(void)
static struct @105 settings
static gboolean pattern_list_match(GSList *patterns, const gchar *str)
static void search_read_io(GString *string, GIOCondition condition, gpointer data)
static void create_fif_dialog(void)
static void setup_find_next(const gchar *text)
gboolean replace_escape_sequences
static gchar * get_regex_match_string(const gchar *text, const GeanyMatchInfo *match, guint nth)
static GString * get_grep_options(void)
gboolean find_regexp_multiline
static void on_find_entry_activate_backward(GtkEntry *entry, gpointer user_data)
static void set_dialog_position(GtkWidget *dialog, gint *position)
static void on_expander_activated(GtkExpander *exp, gpointer data)
gboolean replace_match_whole_word
static void send_replace_dialog_response(GtkButton *button, gpointer user_data)
gint search_mark_all(GeanyDocument *doc, const gchar *search_text, GeanyFindFlags flags)
static GeanyFindFlags int_search_flags(gint match_case, gint whole_word, gint regexp, gint multiline, gint word_start)
static struct @108 fif_dlg
gboolean replace_close_dialog
gboolean find_close_dialog
static void create_replace_dialog(void)
static gboolean search_find_in_files(const gchar *utf8_search_text, const gchar *dir, const gchar *opts, const gchar *enc)
static void update_file_patterns(GtkWidget *mode_combo, GtkWidget *fcombo)
void search_find_usage(const gchar *search_text, const gchar *original_search_text, GeanyFindFlags flags, gboolean in_session)
GtkWidget * files_mode_combo
static void on_find_in_files_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)
static void on_widget_toggled_set_insensitive(GtkToggleButton *togglebutton, gpointer user_data)
static void replace_in_session(GeanyDocument *doc, GeanyFindFlags search_flags_re, gboolean search_replace_escape_re, const gchar *find, const gchar *replace, const gchar *original_find, const gchar *original_replace)
GtkWidget * replace_entry
void search_show_find_dialog(void)
gboolean find_match_word_start
static gint find_document_usage(GeanyDocument *doc, const gchar *search_text, GeanyFindFlags flags)
static GSList * find_range(ScintillaObject *sci, GeanyFindFlags flags, struct Sci_TextToFind *ttf)
gboolean fif_match_whole_word
static gchar ** search_get_argv(const gchar **argv_prefix, const gchar *dir)
gboolean replace_regexp_multiline
gchar * fif_extra_options
gboolean find_escape_sequences
static gint geany_find_flags_to_sci_flags(GeanyFindFlags flags)
static void init_prefs(void)
static GRegex * compile_regex(const gchar *str, GeanyFindFlags sflags)
static struct @106 find_dlg
GtkWidget * encoding_combo
static void search_finished(GPid child_pid, gint status, gpointer user_data)
gboolean fif_case_sensitive
static void on_replace_find_entry_activate(GtkEntry *entry, gpointer user_data)
static struct @107 replace_dlg
static void on_replace_entry_activate(GtkEntry *entry, gpointer user_data)
void geany_match_info_free(GeanyMatchInfo *info)
void search_find_selection(GeanyDocument *doc, gboolean search_backwards)
gint search_find_text(ScintillaObject *sci, GeanyFindFlags flags, struct Sci_TextToFind *ttf, GeanyMatchInfo **match_)
void search_finalize(void)
guint search_replace_range(ScintillaObject *sci, struct Sci_TextToFind *ttf, GeanyFindFlags flags, const gchar *replace_text)
static StashGroup * fif_prefs
gboolean find_match_whole_word
void search_show_find_in_files_dialog_full(const gchar *text, const gchar *dir)
GeanySearchData search_data
static void on_find_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)
void search_find_again(gboolean change_direction)
static void read_fif_io(gchar *msg, GIOCondition condition, gchar *enc, gint msg_color)
gboolean replace_search_backwards
static void search_read_io_stderr(GString *string, GIOCondition condition, gpointer data)
gint search_replace_match(ScintillaObject *sci, const GeanyMatchInfo *match, const gchar *replace_text)
static void send_find_dialog_response(GtkButton *button, gpointer user_data)
static StashGroup * find_prefs
gboolean fif_use_extra_options
@ GEANY_RESPONSE_FIND_PREVIOUS
@ GEANY_RESPONSE_FIND_IN_SESSION
@ GEANY_RESPONSE_REPLACE_IN_SEL
@ GEANY_RESPONSE_REPLACE_IN_SESSION
@ GEANY_RESPONSE_REPLACE_AND_FIND
@ GEANY_RESPONSE_REPLACE_IN_FILE
@ GEANY_RESPONSE_FIND_IN_FILE
static void on_replace_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)
gint search_find_next(ScintillaObject *sci, const gchar *str, GeanyFindFlags flags, GeanyMatchInfo **match_)
static void on_widget_toggled_set_sensitive(GtkToggleButton *togglebutton, gpointer user_data)
static void on_find_replace_checkbutton_toggled(GtkToggleButton *togglebutton, gpointer user_data)
static StashGroup * replace_prefs
static GeanyMatchInfo * match_info_new(GeanyFindFlags flags, gint start, gint end)
GeanySearchPrefs search_prefs
GtkWidget * replace_combobox
GtkWidget * find_combobox
gboolean find_case_sensitive
static void on_find_entry_activate(GtkEntry *entry, gpointer user_data)
static void update_fif_file_mode_combo(void)
gint search_find_prev(ScintillaObject *sci, const gchar *str, GeanyFindFlags flags, GeanyMatchInfo **match_)
gboolean replace_match_word_start
gboolean replace_case_sensitive
static gint find_regex(ScintillaObject *sci, guint pos, GRegex *regex, gboolean multiline, GeanyMatchInfo *match)
static gboolean on_widget_key_pressed_set_focus(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
void search_show_replace_dialog(void)
static GtkWidget * add_find_checkboxes(GtkDialog *dialog)
gboolean spawn_with_callbacks(const gchar *working_directory, const gchar *command_line, gchar **argv, gchar **envp, SpawnFlags spawn_flags, GIOFunc stdin_cb, gpointer stdin_data, SpawnReadFunc stdout_cb, gpointer stdout_data, gsize stdout_max_length, SpawnReadFunc stderr_cb, gpointer stderr_data, gsize stderr_max_length, GChildWatchFunc exit_cb, gpointer exit_data, GPid *child_pid, GError **error)
<simplesect kind="geany:skip"></simplesect> Executes a child program and setups callbacks.
Portable and convenient process spawning and communication.
#define SPAWN_WIFEXITED(status)
non-zero if the child exited normally
#define SPAWN_WIFSIGNALED(status)
non-zero if the child exited due to signal
#define SPAWN_WEXITSTATUS(status)
exit status of a child if exited normally
stash_group_add_boolean(group, &china_enabled, "china", TRUE)
stash_group_update(group, dialog)
stash_group_add_toggle_button(group, &want_handle, "handle", TRUE, "check_handle")
gtk_container_add(GTK_CONTAINER(dialog->vbox), check_button)
ui_hookup_widget(dialog, check_button, "check_handle")
gtk_widget_show_all(dialog)
stash_group_display(group, dialog)
void stash_group_add_integer(StashGroup *group, gint *setting, const gchar *key_name, gint default_value)
Adds integer setting.
void stash_group_add_combo_box(StashGroup *group, gint *setting, const gchar *key_name, gint default_value, StashWidgetID widget_id)
Adds a GtkComboBox widget pref.
StashGroup * stash_group_new(const gchar *name)
Creates a new group.
void stash_group_add_entry(StashGroup *group, gchar **setting, const gchar *key_name, const gchar *default_value, StashWidgetID widget_id)
Adds a GtkEntry widget pref.
Lightweight library for reading/writing GKeyFile settings and synchronizing widgets with C variables.
struct GeanyProject * project
Currently active project or NULL if none is open.
Structure for representing an open tab with all its properties.
gboolean changed
Whether this document has been changed since it was last saved.
gchar * encoding
The encoding of the document, must be a valid string representation of an encoding,...
GeanyEditor * editor
The editor associated with the document.
ScintillaObject * sci
The Scintilla editor GtkWidget.
GtkWidget * window
Main window.
GtkWidget * notebook
Document notebook.
GStrv file_patterns
Array of filename extension patterns.
gchar * base_path
Base path of the project directory (in UTF-8, maybe relative).
gboolean hide_find_dialog
gboolean replace_and_find_by_default
gboolean use_current_word
Use current word for default search text.
gboolean use_current_file_dir
GeanyFindSelOptions find_selection_type
struct Sci_CharacterRange chrg
struct Sci_CharacterRange chrgText
Defines internationalization macros.
#define ngettext(String, PluralString, Number)
void ui_progress_bar_start(const gchar *text)
Starts a constantly pulsing progressbar in the right corner of the statusbar (if the statusbar is vis...
GtkWidget * ui_dialog_vbox_new(GtkDialog *dialog)
Makes a fixed border for dialogs without increasing the button box border.
gboolean ui_encodings_combo_box_set_active_encoding(GtkComboBox *combo, gint enc)
void ui_save_buttons_toggle(gboolean enable)
GtkWidget * ui_path_box_new(const gchar *title, GtkFileChooserAction action, GtkEntry *entry)
Creates a GtkHBox with entry packed into it and an open button which runs a file chooser,...
void ui_combo_box_prepend_text_once(GtkComboBoxText *combo, const gchar *text)
void ui_hbutton_box_copy_layout(GtkButtonBox *master, GtkButtonBox *copy)
void ui_entry_add_activate_backward_signal(GtkEntry *entry)
GtkWidget * ui_create_encodings_combo_box(gboolean has_detect, gint default_enc)
GeanyMainWidgets main_widgets
void ui_entry_add_clear_icon(GtkEntry *entry)
Adds a small clear icon to the right end of the passed entry.
void ui_set_statusbar(gboolean log, const gchar *format,...)
Displays text on the statusbar.
gint ui_encodings_combo_box_get_active_encoding(GtkComboBox *combo)
void ui_progress_bar_stop(void)
Stops a running progress bar and hides the widget again.
void ui_combo_box_add_to_history(GtkComboBoxText *combo_entry, const gchar *text, gint history_len)
Prepends text to the drop down list, removing a duplicate element in the list if found.
GtkWidget * ui_button_new_with_image(const gchar *stock_id, const gchar *text)
Creates a GtkButton with custom text and a stock image similar to gtk_button_new_from_stock().
void ui_set_search_entry_background(GtkWidget *widget, gboolean success)
GtkWidget * ui_lookup_widget(GtkWidget *widget, const gchar *widget_name)
Returns a widget from a name in a component, usually created by Glade.
User Interface general utility functions.
guint utils_string_replace_all(GString *haystack, const gchar *needle, const gchar *replace)
Replaces all occurrences of needle in haystack with replace.
gchar * utils_get_current_file_dir_utf8(void)
GSList * utils_get_file_list(const gchar *path, guint *length, GError **error)
Gets a sorted list of files from the specified directory.
gboolean utils_str_replace_escape(gchar *string, gboolean keep_backslash)
gboolean utils_str_equal(const gchar *a, const gchar *b)
NULL-safe string comparison.
const gchar * utils_get_default_dir_utf8(void)
void utils_free_pointers(gsize arg_count,...)
gchar * utils_get_locale_from_utf8(const gchar *utf8_text)
Converts the given UTF-8 encoded string into locale encoding.
General utility functions, non-GTK related.
#define foreach_slist(node, list)
Iterates all the nodes in list.
#define SETPTR(ptr, result)
Assigns result to ptr, then frees the old value.
#define EMPTY(ptr)
Returns TRUE if ptr is NULL or *ptr is FALSE.
#define foreach_range(i, size)
Iterates from 0 to size.