Branch: refs/heads/master Author: Nick Treleaven nick.treleaven@btinternet.com Committer: Nick Treleaven nick.treleaven@btinternet.com Date: Mon, 25 Mar 2013 15:57:56 UTC Commit: 4fcce9cc003816b78d6d3ad21edecd8e4961536e https://github.com/geany/geany/commit/4fcce9cc003816b78d6d3ad21edecd8e496153...
Log Message: ----------- Add symbol list Find in Files popup menu item
Modified Paths: -------------- src/search.c src/search.h src/symbols.c
Modified: src/search.c 22 files changed, 16 insertions(+), 6 deletions(-) =================================================================== @@ -1021,6 +1021,12 @@ static void create_fif_dialog(void) * by using the current file's path */ void search_show_find_in_files_dialog(const gchar *dir) { + search_show_find_in_files_dialog_full(NULL, dir); +} + + +void search_show_find_in_files_dialog_full(const gchar *text, const gchar *dir) +{ GtkWidget *entry; /* for child GtkEntry of a GtkComboBoxEntry */ GeanyDocument *doc = document_get_current(); gchar *sel = NULL; @@ -1031,18 +1037,22 @@ void search_show_find_in_files_dialog(const gchar *dir) { create_fif_dialog(); gtk_widget_show_all(fif_dlg.dialog); - if (doc) + if (doc && !text) sel = editor_get_default_selection(doc->editor, search_prefs.use_current_word, NULL); } stash_group_display(fif_prefs, fif_dlg.dialog);
- /* only set selection if the dialog is not already visible, or has just been created */ - if (doc && ! sel && ! gtk_widget_get_visible(fif_dlg.dialog)) - sel = editor_get_default_selection(doc->editor, search_prefs.use_current_word, NULL); + if (!text) + { + /* only set selection if the dialog is not already visible, or has just been created */ + if (doc && ! sel && ! gtk_widget_get_visible(fif_dlg.dialog)) + sel = editor_get_default_selection(doc->editor, search_prefs.use_current_word, NULL);
+ text = sel; + } entry = gtk_bin_get_child(GTK_BIN(fif_dlg.search_combo)); - if (sel) - gtk_entry_set_text(GTK_ENTRY(entry), sel); + if (text) + gtk_entry_set_text(GTK_ENTRY(entry), text); g_free(sel);
/* add project's base path directory to the dir list, we do this here once
Modified: src/search.h 2 files changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -78,6 +78,8 @@ enum GeanyFindSelOptions
void search_show_find_in_files_dialog(const gchar *dir);
+void search_show_find_in_files_dialog_full(const gchar *text, const gchar *dir); +
struct _ScintillaObject; struct Sci_TextToFind;
Modified: src/symbols.c 12 files changed, 11 insertions(+), 1 deletions(-) =================================================================== @@ -103,6 +103,7 @@ enum /* Geany tag files */ GtkWidget *sort_by_appearance; GtkWidget *find_usage; GtkWidget *find_doc_usage; + GtkWidget *find_in_files; } symbol_menu;
@@ -2312,7 +2313,11 @@ static void on_find_usage(GtkWidget *widget, gboolean in_session) gtk_tree_model_get(model, &iter, SYMBOLS_COLUMN_TAG, &tag, -1); if (tag) { - search_find_usage(tag->name, tag->name, SCFIND_WHOLEWORD | SCFIND_MATCHCASE, in_session); + if (widget == symbol_menu.find_in_files) + search_show_find_in_files_dialog_full(tag->name, NULL); + else + search_find_usage(tag->name, tag->name, SCFIND_WHOLEWORD | SCFIND_MATCHCASE, in_session); + tm_tag_unref(tag); } } @@ -2366,6 +2371,11 @@ static void create_taglist_popup_menu(void) gtk_container_add(GTK_CONTAINER(menu), item); g_signal_connect(item, "activate", G_CALLBACK(on_find_usage), GINT_TO_POINTER(FALSE));
+ symbol_menu.find_in_files = item = ui_image_menu_item_new(GTK_STOCK_FIND, _("Find in F_iles")); + gtk_widget_show(item); + gtk_container_add(GTK_CONTAINER(menu), item); + g_signal_connect(item, "activate", G_CALLBACK(on_find_usage), NULL); + g_signal_connect(menu, "show", G_CALLBACK(on_symbol_tree_menu_show), NULL);
sidebar_add_common_menu_items(GTK_MENU(menu));
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).