[gtranslator] Find and replace never change the fuzzy state
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator] Find and replace never change the fuzzy state
- Date: Sat, 13 Oct 2018 11:33:52 +0000 (UTC)
commit a228c564bbc7e46bc3187d513378b037a3829f73
Author: Daniel GarcĂa Moreno <danigm wadobo com>
Date: Sat Oct 13 13:33:12 2018 +0200
Find and replace never change the fuzzy state
Close #1
src/gtr-actions-search.c | 8 ++++++++
src/gtr-tab.c | 14 +++++++++++++-
src/gtr-tab.h | 2 ++
3 files changed, 23 insertions(+), 1 deletion(-)
---
diff --git a/src/gtr-actions-search.c b/src/gtr-actions-search.c
index aad2537a..f13bad94 100644
--- a/src/gtr-actions-search.c
+++ b/src/gtr-actions-search.c
@@ -427,11 +427,15 @@ do_replace (GtrSearchDialog * dialog, GtrWindow * window)
gchar *unescaped_replace_text;
gchar *selected_text = NULL;
gboolean match_case;
+ GtrTab *tab;
view = gtr_window_get_active_view (window);
if (view == NULL)
return;
+ tab = gtr_window_get_active_tab (window);
+ gtr_tab_find_replace (tab, TRUE);
+
search_entry_text = gtr_search_dialog_get_search_text (dialog);
g_return_if_fail ((search_entry_text) != NULL);
g_return_if_fail ((*search_entry_text) != '\0');
@@ -457,6 +461,7 @@ do_replace (GtrSearchDialog * dialog, GtrWindow * window)
do_find (dialog, window);
g_free (unescaped_search_text);
g_free (selected_text);
+ gtr_tab_find_replace (tab, FALSE);
return;
}
@@ -471,6 +476,7 @@ do_replace (GtrSearchDialog * dialog, GtrWindow * window)
g_free (unescaped_replace_text);
do_find (dialog, window);
+ gtr_tab_find_replace (tab, FALSE);
}
static void
@@ -487,6 +493,7 @@ do_replace_all (GtrSearchDialog * dialog, GtrWindow * window)
gint count = 0;
tab = gtr_window_get_active_tab (window);
+ gtr_tab_find_replace (tab, TRUE);
/* Get only translated textviews */
views = gtr_window_get_all_views (window, FALSE, TRUE);
@@ -550,6 +557,7 @@ do_replace_all (GtrSearchDialog * dialog, GtrWindow * window)
FALSE);
restore_last_searched_data (dialog, tab);
+ gtr_tab_find_replace (tab, FALSE);
}
static void
diff --git a/src/gtr-tab.c b/src/gtr-tab.c
index 092eac12..0fbbea21 100644
--- a/src/gtr-tab.c
+++ b/src/gtr-tab.c
@@ -73,6 +73,7 @@ typedef struct
GtkWidget *progress_untrans;
GtrProgress *progress;
+ gboolean find_replace_flag;
GtrPo *po;
@@ -282,6 +283,7 @@ gtr_message_translation_update (GtkTextBuffer * textbuffer, GtrTab * tab)
unmark_fuzzy = g_settings_get_boolean (priv->editor_settings,
GTR_SETTINGS_UNMARK_FUZZY_WHEN_CHANGED);
+ unmark_fuzzy = unmark_fuzzy && !priv->find_replace_flag;
if (gtr_msg_is_fuzzy (msg) && unmark_fuzzy)
gtr_msg_set_fuzzy (msg, FALSE);
@@ -512,7 +514,7 @@ update_status (GtrTab * tab, GtrMsg * msg, gpointer useless)
fuzzy = gtr_msg_is_fuzzy (msg);
translated = gtr_msg_is_translated (msg);
- if ((status == GTR_MSG_STATUS_FUZZY) && !fuzzy)
+ if ((status == GTR_MSG_STATUS_FUZZY) && !fuzzy && !priv->find_replace_flag)
{
_gtr_po_increase_decrease_fuzzy (priv->po, FALSE);
if (translated)
@@ -647,6 +649,7 @@ gtr_tab_init (GtrTab * tab)
if (priv->autosave_interval <= 0)
priv->autosave_interval = 1;
+ priv->find_replace_flag = FALSE;
priv->progress = gtr_progress_new ();
gtk_widget_show (GTK_WIDGET (priv->progress));
gtk_container_add (GTK_CONTAINER (priv->progress_box), GTK_WIDGET (priv->progress));
@@ -1808,3 +1811,12 @@ gtr_tab_sort_by (GtrTab *tab,
gtr_message_table_sort_by (GTR_MESSAGE_TABLE (priv->message_table), sort);
}
+void
+gtr_tab_find_replace (GtrTab *tab,
+ gboolean set)
+{
+ GtrTabPrivate *priv;
+ priv = gtr_tab_get_instance_private (tab);
+ priv->find_replace_flag = set;
+}
+
diff --git a/src/gtr-tab.h b/src/gtr-tab.h
index d151f2ae..a08ab5ec 100644
--- a/src/gtr-tab.h
+++ b/src/gtr-tab.h
@@ -157,6 +157,8 @@ void gtr_tab_set_progress (GtrTab *tab, gint trans, gint untrans, gint fuzzy);
void gtr_tab_sort_by (GtrTab *tab, GtrMessageTableSortBy sort);
+void gtr_tab_find_replace (GtrTab *tab, gboolean set);
+
/* Semi-public methods */
gchar *_gtr_tab_get_name (GtrTab * tab);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]