Revision: 708 Author: ntrel Date: 2006-08-12 14:38:36 -0700 (Sat, 12 Aug 2006) ViewCVS: http://svn.sourceforge.net/geany/?rev=708&view=rev
Log Message: ----------- Add select directory button for Find in files
Modified Paths: -------------- trunk/ChangeLog trunk/src/search.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2006-08-12 21:36:55 UTC (rev 707) +++ trunk/ChangeLog 2006-08-12 21:38:36 UTC (rev 708) @@ -13,6 +13,9 @@ * src/search.c: Enable case sensitive when regex search enabled. Some label text changes for the dialogs. Use hbox packing in Find and Find in files dialogs. + Add select directory button for Find in files. + * src/utils.c, src/utils.h: + Add wrappers for converting between utf8 and locale encoding.
2006-08-11 Nick Treleaven nick.treleaven@btinternet.com
Modified: trunk/src/search.c =================================================================== --- trunk/src/search.c 2006-08-12 21:36:55 UTC (rev 707) +++ trunk/src/search.c 2006-08-12 21:38:36 UTC (rev 708) @@ -85,7 +85,9 @@ static void on_find_in_files_dialog_response(GtkDialog *dialog, gint response, gpointer user_data);
+static void on_open_dir_dialog_clicked(GtkButton *button, gpointer user_data);
+ void search_init() { widgets.find_dialog = NULL; @@ -351,6 +353,7 @@ static GtkWidget *combo = NULL; static GtkWidget *entry1; GtkWidget *entry2; // the child GtkEntry of combo + GtkWidget *dirbtn, *openimg; gint idx = document_get_cur_idx(); gchar *sel = NULL; gchar *cur_dir; @@ -383,9 +386,16 @@ g_object_set_data_full(G_OBJECT(widgets.find_in_files_dialog), "entry_dir", gtk_widget_ref(entry1), (GDestroyNotify)gtk_widget_unref);
+ dirbtn = gtk_button_new(); + openimg = gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON); + gtk_container_add(GTK_CONTAINER(dirbtn), openimg); + g_signal_connect(G_OBJECT(dirbtn), "clicked", G_CALLBACK(on_open_dir_dialog_clicked), + NULL); + dbox = gtk_hbox_new(FALSE, 6); gtk_box_pack_start(GTK_BOX(dbox), label1, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(dbox), entry1, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(dbox), dirbtn, FALSE, FALSE, 0);
label = gtk_label_new(_("Search for:")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -469,6 +479,35 @@ }
+static void on_open_dir_dialog_clicked(GtkButton *button, gpointer user_data) +{ + GtkWidget *dialog = gtk_file_chooser_dialog_new(_("Select folder"), + GTK_WINDOW(app->window), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_OK, NULL); + GtkWidget *entry_dir = lookup_widget(widgets.find_in_files_dialog, "entry_dir"); + gchar *dir_locale; + const gchar *entry_text; + + entry_text = gtk_entry_get_text(GTK_ENTRY(entry_dir)); + dir_locale = utils_get_locale_from_utf8(entry_text); + if (g_file_test(dir_locale, G_FILE_TEST_IS_DIR)) + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), dir_locale); + g_free(dir_locale); + + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) + { + gchar *dir_utf8; + dir_locale = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog)); + dir_utf8 = utils_get_utf8_from_locale(dir_locale); + g_free(dir_locale); + gtk_entry_set_text(GTK_ENTRY(entry_dir), dir_utf8); + g_free(dir_utf8); + } + gtk_widget_destroy(dialog); +} + + static void on_find_replace_checkbutton_toggled(GtkToggleButton *togglebutton, gpointer user_data) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.