Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Thu, 05 Dec 2024 13:49:00 UTC Commit: 4cf437f31c7133786642889214c7f48b1e35c935 https://github.com/geany/geany/commit/4cf437f31c7133786642889214c7f48b1e35c9...
Log Message: ----------- Remove parent argument from document_find_text() and search_show_wrap_dialog()
Since find/replace dialogs are hidden now when the wrap dialog is shown, the parent of the wrap dialog is always the main window and the parameter is unnecessary.
Modified Paths: -------------- src/document.c src/document.h src/search.c src/search.h
Modified: src/document.c 10 lines changed, 5 insertions(+), 5 deletions(-) =================================================================== @@ -2316,7 +2316,7 @@ gboolean document_search_bar_find(GeanyDocument *doc, const gchar *text, gboolea */ gint document_find_text(GeanyDocument *doc, const gchar *text, const gchar *original_text, GeanyFindFlags flags, gboolean search_backwards, GeanyMatchInfo **match_, - gboolean scroll, GtkWidget *parent) + gboolean scroll) { gint selection_end, selection_start, search_pos;
@@ -2370,12 +2370,12 @@ 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 || - search_show_wrap_dialog(parent, original_text)) + search_show_wrap_dialog(original_text)) { gint ret;
sci_set_current_position(doc->editor->sci, (search_backwards) ? sci_len : 0, FALSE); - ret = document_find_text(doc, text, original_text, flags, search_backwards, match_, scroll, parent); + ret = document_find_text(doc, text, original_text, flags, search_backwards, match_, scroll); if (ret == -1) { /* return to original cursor position if not found */ sci_set_current_position(doc->editor->sci, selection_start, FALSE); @@ -2416,7 +2416,7 @@ gint document_replace_text(GeanyDocument *doc, const gchar *find_text, const gch if (selection_end == selection_start) { /* no selection so just find the next match */ - document_find_text(doc, find_text, original_find_text, flags, search_backwards, NULL, TRUE, NULL); + document_find_text(doc, find_text, original_find_text, flags, search_backwards, NULL, TRUE); return -1; } /* there's a selection so go to the start before finding to search through it @@ -2426,7 +2426,7 @@ gint document_replace_text(GeanyDocument *doc, const gchar *find_text, const gch else sci_goto_pos(doc->editor->sci, selection_start, TRUE);
- search_pos = document_find_text(doc, find_text, original_find_text, flags, search_backwards, &match, TRUE, NULL); + search_pos = document_find_text(doc, find_text, original_find_text, flags, search_backwards, &match, TRUE); /* return if the original selected text did not match (at the start of the selection) */ if (search_pos != selection_start) {
Modified: src/document.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -261,7 +261,7 @@ gboolean document_search_bar_find(GeanyDocument *doc, const gchar *text, gboolea
gint document_find_text(GeanyDocument *doc, const gchar *text, const gchar *original_text, GeanyFindFlags flags, gboolean search_backwards, GeanyMatchInfo **match_, - gboolean scroll, GtkWidget *parent); + gboolean scroll);
gint document_replace_text(GeanyDocument *doc, const gchar *find_text, const gchar *original_find_text, const gchar *replace_text, GeanyFindFlags flags, gboolean search_backwards);
Modified: src/search.c 17 lines changed, 7 insertions(+), 10 deletions(-) =================================================================== @@ -436,7 +436,7 @@ void search_find_selection(GeanyDocument *doc, gboolean search_backwards) { setup_find_next(s); /* allow find next/prev */
- if (document_find_text(doc, s, NULL, 0, search_backwards, NULL, FALSE, NULL) > -1) + if (document_find_text(doc, s, NULL, 0, search_backwards, NULL, FALSE) > -1) editor_display_current_line(doc->editor, 0.3F); g_free(s); } @@ -1148,7 +1148,7 @@ 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 search_show_wrap_dialog(const gchar *search_text) { gboolean ret; GtkWidget *dialog; @@ -1164,12 +1164,9 @@ gboolean search_show_wrap_dialog(GtkWidget *parent, const gchar *search_text) if (visible_dialog) gtk_widget_hide(visible_dialog);
- 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), + dialog = gtk_message_dialog_new(GTK_WINDOW(main_widgets.window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, "%s", question_text); gtk_widget_set_name(dialog, "GeanyDialog"); @@ -1402,7 +1399,7 @@ on_find_dialog_response(GtkDialog *dialog, gint response, gpointer user_data) case GEANY_RESPONSE_FIND_PREVIOUS: { gint result = document_find_text(doc, search_data.text, search_data.original_text, search_data.flags, - (response == GEANY_RESPONSE_FIND_PREVIOUS), NULL, TRUE, GTK_WIDGET(find_dlg.dialog)); + (response == GEANY_RESPONSE_FIND_PREVIOUS), NULL, TRUE); ui_set_search_entry_background(find_dlg.entry, (result > -1)); check_close = search_prefs.hide_find_dialog; break; @@ -1560,7 +1557,7 @@ on_replace_dialog_response(GtkDialog *dialog, gint response, gpointer user_data) search_backwards_re); if (rep != -1) document_find_text(doc, find, original_find, search_flags_re, search_backwards_re, - NULL, TRUE, NULL); + NULL, TRUE); break; } case GEANY_RESPONSE_REPLACE: @@ -1571,7 +1568,7 @@ on_replace_dialog_response(GtkDialog *dialog, gint response, gpointer user_data) case GEANY_RESPONSE_FIND: { gint result = document_find_text(doc, find, original_find, search_flags_re, - search_backwards_re, NULL, TRUE, GTK_WIDGET(dialog)); + search_backwards_re, NULL, TRUE); ui_set_search_entry_background(replace_dlg.find_entry, (result > -1)); break; } @@ -2366,7 +2363,7 @@ void search_find_again(gboolean change_direction) { gboolean forward = ! search_data.backwards; gint result = document_find_text(doc, search_data.text, search_data.original_text, search_data.flags, - change_direction ? forward : !forward, NULL, FALSE, NULL); + change_direction ? forward : !forward, NULL, FALSE);
if (result > -1) editor_display_current_line(doc->editor, 0.3F);
Modified: src/search.h 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -27,7 +27,7 @@ #ifndef GEANY_SEARCH_H #define GEANY_SEARCH_H 1
-#include <gtk/gtk.h> +#include <glib.h>
G_BEGIN_DECLS @@ -120,7 +120,7 @@ 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); +gboolean search_show_wrap_dialog(const gchar *search_text);
void geany_match_info_free(GeanyMatchInfo *info);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).