46 |
#define SEARCH_FLAG_REGULAR_EXPRESSION 0x2 |
#define SEARCH_FLAG_REGULAR_EXPRESSION 0x2 |
47 |
#define SEARCH_FLAG_WHOLE_WORD 0x4 |
#define SEARCH_FLAG_WHOLE_WORD 0x4 |
48 |
#define SEARCH_FLAG_SUBDIRS 0x8 |
#define SEARCH_FLAG_SUBDIRS 0x8 |
49 |
|
#define SEARCH_FLAG_FROM_CURSOR 0xc |
50 |
|
|
51 |
extern GArray *FileProperties; |
extern GArray *FileProperties; |
52 |
extern GtkWidget *MainNotebook; |
extern GtkWidget *MainNotebook; |
225 |
|
|
226 |
|
|
227 |
/* Adds all the data from the array of file_results to a GtkTreeStore |
/* Adds all the data from the array of file_results to a GtkTreeStore |
228 |
and puts them in the SearchTree. Also, calculates the longest |
and puts them in the SearchTree. */ |
|
common base directory and stores that information on the store. */ |
|
229 |
void display_search_results (GArray *array) |
void display_search_results (GArray *array) |
230 |
{ |
{ |
231 |
gint i, j; |
gint i, j; |
232 |
GtkTreeStore *store; |
GtkTreeStore *store; |
|
gchar *base_dir; |
|
233 |
|
|
234 |
START_FCN |
START_FCN |
235 |
|
|
368 |
return (rep_nb); |
return (rep_nb); |
369 |
} |
} |
370 |
|
|
|
|
|
|
/* Callback function for the GtkList 'List' */ |
|
|
|
|
|
void goto_search (GtkList *MyList, |
|
|
GtkWidget *Widget) |
|
|
{ |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Used to set up Search preferences */ |
|
|
|
|
|
void refresh_search (GtkWidget *Widget, gchar *Data) |
|
|
{ |
|
|
} |
|
|
|
|
371 |
/* expands a reg exp file pattern to a list of files */ |
/* expands a reg exp file pattern to a list of files */ |
372 |
/* this returned list is an array of strings, with |pre| |
/* this returned list is an array of strings, with |pre| |
373 |
NULL entries before the results, a bunch of results, |
NULL entries before the results, a bunch of results, |
376 |
{ |
{ |
377 |
gchar **answer; |
gchar **answer; |
378 |
wordexp_t word; |
wordexp_t word; |
|
gchar *output; |
|
379 |
|
|
380 |
START_FCN |
START_FCN |
381 |
|
|
422 |
return answer; |
return answer; |
423 |
} |
} |
424 |
|
|
425 |
struct line_match *parse_grep_output_line (gchar *line) |
struct line_match *parse_grep_output_line (gchar *line, gint line_offset) |
426 |
{ |
{ |
427 |
struct line_match *rv = (struct line_match *) g_malloc (sizeof (struct line_match)); |
struct line_match *rv = (struct line_match *) g_malloc (sizeof (struct line_match)); |
428 |
gchar *colon; |
gchar *colon; |
433 |
if (colon) |
if (colon) |
434 |
{ |
{ |
435 |
colon[0] = '\0'; |
colon[0] = '\0'; |
436 |
rv->line = atoi (line); |
rv->line = atoi (line) + line_offset; |
437 |
colon[0] = ':'; |
colon[0] = ':'; |
438 |
colon++; |
colon++; |
439 |
rv->text = g_strdup (colon); |
rv->text = g_strdup (colon); |
449 |
return rv; |
return rv; |
450 |
} |
} |
451 |
|
|
452 |
struct file_results parse_grep_output (gchar *output, GtkWidget *widget, const gchar *filename) |
struct file_results parse_grep_output (gchar *output, GtkWidget *widget, |
453 |
|
const gchar *filename, gint line_offset) |
454 |
{ |
{ |
455 |
struct file_results rv; |
struct file_results rv; |
456 |
gchar *next; |
gchar *next; |
478 |
while ((next = strchr (output, '\n'))) |
while ((next = strchr (output, '\n'))) |
479 |
{ |
{ |
480 |
next[0] = '\0'; |
next[0] = '\0'; |
481 |
g_ptr_array_add (rv.results, parse_grep_output_line (output)); |
g_ptr_array_add (rv.results, |
482 |
|
parse_grep_output_line (output, line_offset)); |
483 |
next[0] = '\n'; |
next[0] = '\n'; |
484 |
output = next + 1; |
output = next + 1; |
485 |
} |
} |
568 |
|
|
569 |
answers = run_program_with_args ("grep", args, NULL); |
answers = run_program_with_args ("grep", args, NULL); |
570 |
|
|
571 |
rv = parse_grep_output (answers, NULL, filename); |
rv = parse_grep_output (answers, NULL, filename, 0); |
572 |
|
|
573 |
g_free (answers); |
g_free (answers); |
574 |
g_free (mypattern); |
g_free (mypattern); |
586 |
struct file_results rv; |
struct file_results rv; |
587 |
gchar *text; |
gchar *text; |
588 |
gchar *mypattern; |
gchar *mypattern; |
589 |
|
gint offset; |
590 |
|
|
591 |
START_FCN |
START_FCN |
592 |
|
|
593 |
text = get_text (FPROPS (page, Buffer)); |
if (flags & SEARCH_FLAG_FROM_CURSOR) |
594 |
|
{ |
595 |
|
text = get_text_from_cursor (FPROPS (page, Buffer)); |
596 |
|
offset = get_line_of_cursor (FPROPS (page, Buffer)); |
597 |
|
} |
598 |
|
else |
599 |
|
{ |
600 |
|
text = get_text (FPROPS (page, Buffer)); |
601 |
|
offset = 0; |
602 |
|
} |
603 |
|
|
604 |
args[i++] = "grep"; |
args[i++] = "grep"; |
605 |
|
|
634 |
|
|
635 |
answers = run_program_with_args ("grep", args, text); |
answers = run_program_with_args ("grep", args, text); |
636 |
|
|
637 |
rv = parse_grep_output (answers, FPROPS (page, Text), FPROPS (page, Name)); |
rv = parse_grep_output (answers, |
638 |
|
FPROPS (page, Text), FPROPS (page, Name), offset); |
639 |
|
|
640 |
g_free (answers); |
g_free (answers); |
641 |
g_free (text); |
g_free (text); |
653 |
if (response == GTK_RESPONSE_ACCEPT) |
if (response == GTK_RESPONSE_ACCEPT) |
654 |
{ |
{ |
655 |
GtkWidget *widget; |
GtkWidget *widget; |
|
gint where; |
|
656 |
gint page; |
gint page; |
657 |
gchar *pattern = NULL; |
gchar *pattern = NULL; |
|
gchar *directory = NULL; |
|
|
gchar *filepattern = NULL; |
|
|
gchar **expanded_files; |
|
658 |
gint i, flags; |
gint i, flags; |
659 |
|
gboolean all_open_documents; |
660 |
struct file_results output; |
struct file_results output; |
661 |
|
|
662 |
if (SearchResults) |
if (SearchResults) |
690 |
flags |= SEARCH_FLAG_WHOLE_WORD; |
flags |= SEARCH_FLAG_WHOLE_WORD; |
691 |
} |
} |
692 |
|
|
693 |
widget = g_object_get_data (G_OBJECT (dialog), "subdirs"); |
widget = g_object_get_data (G_OBJECT (dialog), "from_cursor"); |
694 |
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) |
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) |
695 |
{ |
{ |
696 |
flags |= SEARCH_FLAG_SUBDIRS; |
flags |= SEARCH_FLAG_FROM_CURSOR; |
697 |
} |
} |
698 |
|
|
699 |
widget = g_object_get_data (G_OBJECT (dialog), "text"); |
widget = g_object_get_data (G_OBJECT (dialog), "all"); |
700 |
|
all_open_documents = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); |
701 |
|
|
702 |
|
widget = g_object_get_data (G_OBJECT (dialog), "text"); |
703 |
pattern = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget))); |
pattern = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget))); |
704 |
|
|
705 |
where = 0; |
page = gtk_notebook_get_current_page (GTK_NOTEBOOK (MainNotebook)); |
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON ( |
|
|
g_object_get_data (G_OBJECT (dialog), "where_current")))) |
|
|
{ |
|
|
where = 0; |
|
|
} |
|
|
else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON ( |
|
|
g_object_get_data (G_OBJECT (dialog), "where_all")))) |
|
|
{ |
|
|
where = 1; |
|
|
} |
|
|
else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON ( |
|
|
g_object_get_data (G_OBJECT (dialog), "where_files")))) |
|
|
{ |
|
|
where = 2; |
|
|
} |
|
706 |
|
|
707 |
switch (where) |
if (all_open_documents) |
708 |
{ |
{ |
|
case 0: |
|
|
page = gtk_notebook_get_current_page (GTK_NOTEBOOK (MainNotebook)); |
|
|
|
|
|
output = run_grep_on_text (pattern, page, flags); |
|
|
if (output.results) |
|
|
g_array_append_val (SearchResults, output); |
|
|
|
|
|
break; |
|
|
case 1: |
|
709 |
for (i = 0; i < OpenedFilesCnt; i++) |
for (i = 0; i < OpenedFilesCnt; i++) |
710 |
{ |
{ |
711 |
output = run_grep_on_text (pattern, i, flags); |
output = run_grep_on_text (pattern, i, flags); |
712 |
if (output.results) |
if (output.results) |
713 |
g_array_append_val (SearchResults, output); |
g_array_append_val (SearchResults, output); |
714 |
} |
} |
715 |
|
} |
716 |
break; |
else |
717 |
case 2: |
{ |
718 |
widget = g_object_get_data (G_OBJECT (dialog), "directory"); |
output = run_grep_on_text (pattern, page, flags); |
719 |
directory = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget))); |
if (output.results) |
720 |
widget = g_object_get_data (G_OBJECT (dialog), "file-pattern"); |
g_array_append_val (SearchResults, output); |
721 |
filepattern = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget))); |
} |
722 |
expanded_files = get_files_for_search (directory, filepattern, flags); |
|
723 |
|
display_search_results (SearchResults); |
724 |
for (i = 0; expanded_files[i]; i++) |
} |
725 |
|
|
726 |
|
gtk_widget_destroy (GTK_WIDGET (dialog)); |
727 |
|
|
728 |
|
END_FCN |
729 |
|
} |
730 |
|
|
731 |
|
void search_in_files_callback (GtkDialog *dialog, gint response, gpointer data) |
732 |
|
{ |
733 |
|
START_FCN |
734 |
|
|
735 |
|
if (response == GTK_RESPONSE_ACCEPT) |
736 |
|
{ |
737 |
|
GtkWidget *widget; |
738 |
|
gchar *pattern = NULL; |
739 |
|
gchar *directory = NULL; |
740 |
|
gchar *filepattern = NULL; |
741 |
|
gchar **expanded_files; |
742 |
|
gint i, flags; |
743 |
|
struct file_results output; |
744 |
|
|
745 |
|
if (SearchResults) |
746 |
|
{ |
747 |
|
for (i = 0; i < SearchResults->len; i++) |
748 |
{ |
{ |
749 |
output = run_grep_on_file (pattern, expanded_files[i], 0); |
g_free (g_array_index (SearchResults, struct file_results, i).path); |
750 |
if (output.results) |
g_ptr_array_free (g_array_index (SearchResults, struct file_results, i).results, TRUE); |
|
g_array_append_val (SearchResults, output); |
|
751 |
} |
} |
752 |
|
|
753 |
g_strfreev (expanded_files); |
g_array_free (SearchResults, FALSE); |
754 |
g_free (filepattern); |
} |
755 |
g_free (directory); |
SearchResults = g_array_new (FALSE, FALSE, sizeof (struct file_results)); |
756 |
break; |
|
757 |
|
flags = 0; |
758 |
|
widget = g_object_get_data (G_OBJECT (dialog), "case"); |
759 |
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) |
760 |
|
{ |
761 |
|
flags |= SEARCH_FLAG_CASE_SENSITIVE; |
762 |
|
} |
763 |
|
|
764 |
|
widget = g_object_get_data (G_OBJECT (dialog), "regexp"); |
765 |
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) |
766 |
|
{ |
767 |
|
flags |= SEARCH_FLAG_REGULAR_EXPRESSION; |
768 |
|
} |
769 |
|
|
770 |
|
widget = g_object_get_data (G_OBJECT (dialog), "word"); |
771 |
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) |
772 |
|
{ |
773 |
|
flags |= SEARCH_FLAG_WHOLE_WORD; |
774 |
|
} |
775 |
|
/* |
776 |
|
widget = g_object_get_data (G_OBJECT (dialog), "subdirs"); |
777 |
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) |
778 |
|
{ |
779 |
|
flags |= SEARCH_FLAG_SUBDIRS; |
780 |
|
}*/ |
781 |
|
|
782 |
|
widget = g_object_get_data (G_OBJECT (dialog), "text"); |
783 |
|
|
784 |
|
pattern = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget))); |
785 |
|
|
786 |
|
widget = g_object_get_data (G_OBJECT (dialog), "directory"); |
787 |
|
directory = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget))); |
788 |
|
widget = g_object_get_data (G_OBJECT (dialog), "file-pattern"); |
789 |
|
filepattern = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget))); |
790 |
|
expanded_files = get_files_for_search (directory, filepattern, flags); |
791 |
|
|
792 |
|
for (i = 0; expanded_files[i]; i++) |
793 |
|
{ |
794 |
|
output = run_grep_on_file (pattern, expanded_files[i], 0); |
795 |
|
if (output.results) |
796 |
|
g_array_append_val (SearchResults, output); |
797 |
} |
} |
798 |
|
|
799 |
|
g_strfreev (expanded_files); |
800 |
|
g_free (filepattern); |
801 |
|
g_free (directory); |
802 |
|
|
803 |
display_search_results (SearchResults); |
display_search_results (SearchResults); |
804 |
} |
} |
805 |
|
|
807 |
|
|
808 |
END_FCN |
END_FCN |
809 |
} |
} |
|
|
|
810 |
/* Display a Search Dialog window */ |
/* Display a Search Dialog window */ |
811 |
|
|
812 |
void search (void) |
void search (void) |
813 |
{ |
{ |
814 |
static GtkWidget *SearchWindow = NULL; |
static GtkWidget *SearchWindow = NULL; |
815 |
GtkWidget *main_vbox, *vbox, *hbox; |
GtkWidget *main_vbox, *hbox; |
816 |
GtkWidget *widget, *radio1; |
GtkWidget *widget; |
|
gchar *text; |
|
817 |
|
|
818 |
if (SearchWindow) |
if (SearchWindow) |
819 |
{ |
{ |
852 |
gtk_container_add (GTK_CONTAINER (main_vbox), hbox); |
gtk_container_add (GTK_CONTAINER (main_vbox), hbox); |
853 |
|
|
854 |
widget = gtk_label_new_with_mnemonic ("_Search for:"); |
widget = gtk_label_new_with_mnemonic ("_Search for:"); |
855 |
|
gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5); |
856 |
gtk_container_add (GTK_CONTAINER (hbox), widget); |
gtk_container_add (GTK_CONTAINER (hbox), widget); |
857 |
|
|
858 |
widget = gtk_entry_new (); |
widget = gtk_entry_new (); |
859 |
gtk_container_add (GTK_CONTAINER (hbox), widget); |
gtk_container_add (GTK_CONTAINER (hbox), widget); |
860 |
g_object_set_data (G_OBJECT (SearchWindow), "text", widget); |
g_object_set_data (G_OBJECT (SearchWindow), "text", widget); |
861 |
|
|
862 |
vbox = gtk_vbox_new (FALSE, 6); |
widget = gtk_check_button_new_with_mnemonic ("Match c_ase"); |
863 |
gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0); |
gtk_box_pack_start (GTK_BOX (main_vbox), widget, FALSE, FALSE, 0); |
864 |
|
g_object_set_data (G_OBJECT (SearchWindow), "case", widget); |
865 |
|
|
866 |
|
widget = gtk_check_button_new_with_mnemonic ("Match _whole word only"); |
867 |
|
gtk_box_pack_start (GTK_BOX (main_vbox), widget, FALSE, FALSE, 0); |
868 |
|
g_object_set_data (G_OBJECT (SearchWindow), "word", widget); |
869 |
|
|
870 |
|
widget = gtk_check_button_new_with_mnemonic ("Search text is a _regular expression"); |
871 |
|
gtk_box_pack_start (GTK_BOX (main_vbox), widget, FALSE, FALSE, 0); |
872 |
|
g_object_set_data (G_OBJECT (SearchWindow), "regexp", widget); |
873 |
|
|
874 |
|
widget = gtk_check_button_new_with_mnemonic ("S_tart search at cursor"); |
875 |
|
gtk_box_pack_start (GTK_BOX (main_vbox), widget, FALSE, FALSE, 0); |
876 |
|
g_object_set_data (G_OBJECT (SearchWindow), "from_cursor", widget); |
877 |
|
|
878 |
|
widget = gtk_check_button_new_with_mnemonic ("Search in all _open documents"); |
879 |
|
gtk_box_pack_start (GTK_BOX (main_vbox), widget, FALSE, FALSE, 0); |
880 |
|
g_object_set_data (G_OBJECT (SearchWindow), "all", widget); |
881 |
|
|
882 |
|
gtk_widget_show_all (SearchWindow); |
883 |
|
} |
884 |
|
|
885 |
|
/* Display a Search in Files dialog window */ |
886 |
|
|
887 |
|
void search_in_files (void) |
888 |
|
{ |
889 |
|
static GtkWidget *SearchFilesWindow = NULL; |
890 |
|
GtkWidget *main_vbox, *hbox; |
891 |
|
GtkWidget *widget; |
892 |
|
GtkSizeGroup *size_group_label, *size_group_text; |
893 |
|
|
894 |
|
if (SearchFilesWindow) |
895 |
|
{ |
896 |
|
gtk_window_present (GTK_WINDOW (SearchFilesWindow)); |
897 |
|
return; |
898 |
|
} |
899 |
|
|
900 |
|
SearchFilesWindow = gtk_dialog_new_with_buttons ( |
901 |
|
"Search in Files", |
902 |
|
GTK_WINDOW (MainWindow), |
903 |
|
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, |
904 |
|
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, |
905 |
|
GTK_STOCK_FIND, GTK_RESPONSE_ACCEPT, |
906 |
|
NULL); |
907 |
|
gtk_widget_realize (SearchFilesWindow); |
908 |
|
gtk_window_set_resizable (GTK_WINDOW (SearchFilesWindow), FALSE); |
909 |
|
gdk_window_set_functions (SearchFilesWindow->window, |
910 |
|
GDK_FUNC_MOVE | GDK_FUNC_MINIMIZE); |
911 |
|
g_signal_connect_swapped (G_OBJECT(SearchFilesWindow), "delete-event", |
912 |
|
(GtkSignalFunc) gtk_widget_destroy, |
913 |
|
G_OBJECT(SearchFilesWindow)); |
914 |
|
g_signal_connect_swapped (G_OBJECT (SearchFilesWindow), "destroy", |
915 |
|
G_CALLBACK (g_nullify_pointer), |
916 |
|
&SearchFilesWindow); |
917 |
|
|
918 |
|
size_group_label = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); |
919 |
|
size_group_text = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); |
920 |
|
|
921 |
|
main_vbox = gtk_vbox_new (FALSE, 12); |
922 |
|
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (SearchFilesWindow)->vbox), 12); |
923 |
|
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 6); |
924 |
|
gtk_container_set_border_width (GTK_CONTAINER (SearchFilesWindow), 6); |
925 |
|
gtk_container_add (GTK_CONTAINER ( |
926 |
|
GTK_DIALOG (SearchFilesWindow)->vbox), main_vbox); |
927 |
|
|
928 |
|
gtk_dialog_set_default_response (GTK_DIALOG (SearchFilesWindow), |
929 |
|
GTK_RESPONSE_ACCEPT); |
930 |
|
|
931 |
|
g_signal_connect (G_OBJECT (SearchFilesWindow), "response", |
932 |
|
G_CALLBACK (search_in_files_callback), NULL); |
933 |
|
|
934 |
|
hbox = gtk_hbox_new (FALSE, 12); |
935 |
|
gtk_container_add (GTK_CONTAINER (main_vbox), hbox); |
936 |
|
|
937 |
radio1 = gtk_radio_button_new_with_mnemonic (NULL, "Search in current _buffer"); |
widget = gtk_label_new_with_mnemonic ("_Search for:"); |
938 |
gtk_container_add (GTK_CONTAINER (vbox), radio1); |
gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5); |
939 |
g_object_set_data (G_OBJECT (SearchWindow), "where_current", radio1); |
gtk_container_add (GTK_CONTAINER (hbox), widget); |
940 |
|
gtk_size_group_add_widget (size_group_label, widget); |
941 |
widget = gtk_radio_button_new_with_mnemonic_from_widget ( |
|
942 |
GTK_RADIO_BUTTON (radio1), |
widget = gtk_entry_new (); |
943 |
"Search in _all open buffers"); |
gtk_container_add (GTK_CONTAINER (hbox), widget); |
944 |
gtk_container_add (GTK_CONTAINER (vbox), widget); |
g_object_set_data (G_OBJECT (SearchFilesWindow), "text", widget); |
945 |
g_object_set_data (G_OBJECT (SearchWindow), "where_all", widget); |
gtk_size_group_add_widget (size_group_text, widget); |
946 |
|
|
947 |
hbox = gtk_hbox_new (FALSE, 12); |
hbox = gtk_hbox_new (FALSE, 12); |
948 |
gtk_container_add (GTK_CONTAINER (vbox), hbox); |
gtk_container_add (GTK_CONTAINER (main_vbox), hbox); |
949 |
|
|
950 |
widget = gtk_radio_button_new_with_mnemonic_from_widget ( |
widget = gtk_label_new_with_mnemonic ("Search in these _files: "); |
951 |
GTK_RADIO_BUTTON (radio1), |
gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5); |
|
"Search in these _files: "); |
|
952 |
gtk_container_add (GTK_CONTAINER (hbox), widget); |
gtk_container_add (GTK_CONTAINER (hbox), widget); |
953 |
g_object_set_data (G_OBJECT (SearchWindow), "where_files", widget); |
gtk_size_group_add_widget (size_group_label, widget); |
954 |
|
|
955 |
widget = gtk_entry_new (); |
widget = gtk_entry_new (); |
956 |
gtk_entry_set_text (GTK_ENTRY (widget), "*"); |
gtk_entry_set_text (GTK_ENTRY (widget), "*"); |
957 |
gtk_container_add (GTK_CONTAINER (hbox), widget); |
gtk_container_add (GTK_CONTAINER (hbox), widget); |
958 |
g_object_set_data (G_OBJECT (SearchWindow), "file-pattern", widget); |
g_object_set_data (G_OBJECT (SearchFilesWindow), "file-pattern", widget); |
959 |
|
gtk_size_group_add_widget (size_group_text, widget); |
960 |
|
|
961 |
|
hbox = gtk_hbox_new (FALSE, 12); |
962 |
|
gtk_container_add (GTK_CONTAINER (main_vbox), hbox); |
963 |
|
|
964 |
|
widget = gtk_label_new_with_mnemonic ("Search in this _directory: "); |
965 |
|
gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5); |
966 |
|
gtk_container_add (GTK_CONTAINER (hbox), widget); |
967 |
|
gtk_size_group_add_widget (size_group_label, widget); |
968 |
|
|
969 |
widget = gtk_entry_new (); |
widget = gtk_entry_new (); |
970 |
gtk_entry_set_text (GTK_ENTRY (widget), DIRECTORY); |
gtk_entry_set_text (GTK_ENTRY (widget), DIRECTORY); |
971 |
gtk_container_add (GTK_CONTAINER (hbox), widget); |
gtk_container_add (GTK_CONTAINER (hbox), widget); |
972 |
g_object_set_data (G_OBJECT (SearchWindow), "directory", widget); |
g_object_set_data (G_OBJECT (SearchFilesWindow), "directory", widget); |
973 |
|
gtk_size_group_add_widget (size_group_text, widget); |
974 |
|
|
975 |
widget = gtk_check_button_new_with_mnemonic ("Match c_ase"); |
widget = gtk_check_button_new_with_mnemonic ("Match c_ase"); |
976 |
gtk_box_pack_start (GTK_BOX (main_vbox), widget, FALSE, FALSE, 0); |
gtk_box_pack_start (GTK_BOX (main_vbox), widget, FALSE, FALSE, 0); |
977 |
g_object_set_data (G_OBJECT (SearchWindow), "case", widget); |
g_object_set_data (G_OBJECT (SearchFilesWindow), "case", widget); |
978 |
|
|
979 |
widget = gtk_check_button_new_with_mnemonic ("Match whole wor_d only"); |
widget = gtk_check_button_new_with_mnemonic ("Match _whole word only"); |
|
gtk_box_pack_start (GTK_BOX (main_vbox), widget, FALSE, FALSE, 0); |
|
|
g_object_set_data (G_OBJECT (SearchWindow), "word", widget); |
|
|
/* |
|
|
widget = gtk_check_button_new_with_mnemonic ("_Wrap around"); |
|
980 |
gtk_box_pack_start (GTK_BOX (main_vbox), widget, FALSE, FALSE, 0); |
gtk_box_pack_start (GTK_BOX (main_vbox), widget, FALSE, FALSE, 0); |
981 |
g_object_set_data (G_OBJECT (SearchWindow), "wrap", widget); |
g_object_set_data (G_OBJECT (SearchFilesWindow), "word", widget); |
982 |
*/ |
|
983 |
widget = gtk_check_button_new_with_mnemonic ("Text is a _regular expression"); |
widget = gtk_check_button_new_with_mnemonic |
984 |
|
(_("Search text is a _regular expression")); |
985 |
gtk_box_pack_start (GTK_BOX (main_vbox), widget, FALSE, FALSE, 0); |
gtk_box_pack_start (GTK_BOX (main_vbox), widget, FALSE, FALSE, 0); |
986 |
g_object_set_data (G_OBJECT (SearchWindow), "regexp", widget); |
g_object_set_data (G_OBJECT (SearchFilesWindow), "regexp", widget); |
987 |
/* |
/* |
988 |
widget = gtk_check_button_new_with_mnemonic ("Search s_ubdirectories"); |
widget = gtk_check_button_new_with_mnemonic ("Search s_ubdirectories"); |
989 |
gtk_box_pack_start (GTK_BOX (main_vbox), widget, FALSE, FALSE, 0); |
gtk_box_pack_start (GTK_BOX (main_vbox), widget, FALSE, FALSE, 0); |
990 |
g_object_set_data (G_OBJECT (SearchWindow), "subdirs", widget); |
g_object_set_data (G_OBJECT (SearchFilesWindow), "subdirs", widget); |
991 |
*/ |
*/ |
992 |
gtk_widget_show_all (SearchWindow); |
gtk_widget_show_all (SearchFilesWindow); |
993 |
} |
} |
994 |
|
|
995 |
void show_cursor_on_screen (GtkTextView *view) |
void show_cursor_on_screen (GtkTextView *view) |