Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Wed, 04 Dec 2024 20:22:09 UTC Commit: 83c1ad8ae46b7b1b684176b5030109064a052491 https://github.com/geany/geany/commit/83c1ad8ae46b7b1b684176b5030109064a0524...
Log Message: ----------- Move show_wrap_search_dialog() to search.h
This will allow the wrap dialog access search and replace dialogs in the following commits.
Modified Paths: -------------- src/document.c src/search.c src/search.h
Modified: src/document.c 38 lines changed, 1 insertions(+), 37 deletions(-) =================================================================== @@ -2307,42 +2307,6 @@ gboolean document_search_bar_find(GeanyDocument *doc, const gchar *text, gboolea }
-/* like dialogs_show_question_full() but makes the non-cancel button default */ -static gboolean show_wrap_search_dialog(GtkWidget *parent, const gchar *search_text) -{ - gboolean ret; - GtkWidget *dialog; - GtkWidget *btn; - gchar *question_text; - - if (parent == NULL && main_status.main_window_realized) - parent = main_widgets.window; - - question_text = g_strdup_printf(_(""%s" was not found."), search_text); - - dialog = gtk_message_dialog_new(GTK_WINDOW(parent), - GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, - GTK_BUTTONS_NONE, "%s", question_text); - gtk_widget_set_name(dialog, "GeanyDialog"); - gtk_window_set_title(GTK_WINDOW(dialog), _("Question")); - gtk_window_set_icon_name(GTK_WINDOW(dialog), "geany"); - - gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), - "%s", _("Wrap search and find again?")); - - gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_NO); - btn = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_FIND, GTK_RESPONSE_YES); - gtk_widget_grab_default(btn); - - ret = gtk_dialog_run(GTK_DIALOG(dialog)); - - gtk_widget_destroy(dialog); - g_free(question_text); - - return ret == GTK_RESPONSE_YES; -} - - /* General search function, used from the find dialog. * Returns -1 on failure or the start position of the matching text. * Will skip past any selection, ignoring it. @@ -2406,7 +2370,7 @@ gint document_find_text(GeanyDocument *doc, const gchar *text, const gchar *orig
/* we searched only part of the document, so ask whether to wraparound. */ if (search_prefs.always_wrap || - show_wrap_search_dialog(parent, original_text)) + search_show_wrap_dialog(parent, original_text)) { gint ret;
Modified: src/search.c 37 lines changed, 36 insertions(+), 1 deletions(-) =================================================================== @@ -49,7 +49,6 @@ #include <string.h> #include <ctype.h>
-#include <gtk/gtk.h> #include <gdk/gdkkeysyms.h>
enum @@ -1148,6 +1147,42 @@ void search_show_find_in_files_dialog_full(const gchar *text, const gchar *dir) }
+/* like dialogs_show_question_full() but makes the non-cancel button default */ +gboolean search_show_wrap_dialog(GtkWidget *parent, const gchar *search_text) +{ + gboolean ret; + GtkWidget *dialog; + GtkWidget *btn; + gchar *question_text; + + if (parent == NULL) + parent = main_widgets.window; + + question_text = g_strdup_printf(_(""%s" was not found."), search_text); + + dialog = gtk_message_dialog_new(GTK_WINDOW(parent), + GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, + GTK_BUTTONS_NONE, "%s", question_text); + gtk_widget_set_name(dialog, "GeanyDialog"); + gtk_window_set_title(GTK_WINDOW(dialog), _("Question")); + gtk_window_set_icon_name(GTK_WINDOW(dialog), "geany"); + + gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), + "%s", _("Wrap search and find again?")); + + gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_NO); + btn = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_FIND, GTK_RESPONSE_YES); + gtk_widget_grab_default(btn); + + ret = gtk_dialog_run(GTK_DIALOG(dialog)); + + gtk_widget_destroy(dialog); + g_free(question_text); + + return ret == GTK_RESPONSE_YES; +} + + static void on_find_replace_checkbutton_toggled(GtkToggleButton *togglebutton, gpointer user_data) {
Modified: src/search.h 4 lines changed, 3 insertions(+), 1 deletions(-) =================================================================== @@ -27,7 +27,7 @@ #ifndef GEANY_SEARCH_H #define GEANY_SEARCH_H 1
-#include <glib.h> +#include <gtk/gtk.h>
G_BEGIN_DECLS @@ -120,6 +120,8 @@ void search_show_replace_dialog(void);
void search_show_find_in_files_dialog_full(const gchar *text, const gchar *dir);
+gboolean search_show_wrap_dialog(GtkWidget *parent, const gchar *search_text); + void geany_match_info_free(GeanyMatchInfo *info);
gint search_find_prev(struct _ScintillaObject *sci, const gchar *str, GeanyFindFlags flags, GeanyMatchInfo **match_);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).