[gtranslator] Recalc message status on msg change
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator] Recalc message status on msg change
- Date: Fri, 25 Jan 2019 07:17:48 +0000 (UTC)
commit 63b0a9ed0e842a50f299a93543f9de13d4815d7e
Author: Daniel GarcĂa Moreno <dani danigm net>
Date: Fri Jan 25 08:17:03 2019 +0100
Recalc message status on msg change
Fix #48
src/gtr-msg.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/src/gtr-msg.c b/src/gtr-msg.c
index 02be5ca5..8bb0481c 100644
--- a/src/gtr-msg.c
+++ b/src/gtr-msg.c
@@ -48,6 +48,18 @@ G_DEFINE_TYPE_WITH_PRIVATE (GtrMsg, gtr_msg, G_TYPE_OBJECT)
static gchar *message_error = NULL;
+static void
+gtr_msg_recalc_status (GtrMsg *msg)
+{
+ /* Set the status */
+ if (gtr_msg_is_fuzzy (msg))
+ gtr_msg_set_status (msg, GTR_MSG_STATUS_FUZZY);
+ else if (gtr_msg_is_translated (msg))
+ gtr_msg_set_status (msg, GTR_MSG_STATUS_TRANSLATED);
+ else
+ gtr_msg_set_status (msg, GTR_MSG_STATUS_UNTRANSLATED);
+}
+
static void
gtr_msg_init (GtrMsg * msg)
{
@@ -90,13 +102,7 @@ _gtr_msg_new (po_message_iterator_t iter, po_message_t message)
_gtr_msg_set_iterator (msg, iter);
_gtr_msg_set_message (msg, message);
- /* Set the status */
- if (gtr_msg_is_fuzzy (msg))
- gtr_msg_set_status (msg, GTR_MSG_STATUS_FUZZY);
- else if (gtr_msg_is_translated (msg))
- gtr_msg_set_status (msg, GTR_MSG_STATUS_TRANSLATED);
- else
- gtr_msg_set_status (msg, GTR_MSG_STATUS_UNTRANSLATED);
+ gtr_msg_recalc_status (msg);
return msg;
}
@@ -228,6 +234,7 @@ gtr_msg_set_fuzzy (GtrMsg * msg, gboolean fuzzy)
g_return_if_fail (GTR_IS_MSG (msg));
po_message_set_fuzzy (priv->message, fuzzy);
+ gtr_msg_recalc_status (msg);
}
/**
@@ -325,6 +332,7 @@ gtr_msg_set_msgstr (GtrMsg * msg, const gchar * msgstr)
g_return_if_fail (msgstr != NULL);
po_message_set_msgstr (priv->message, msgstr);
+ gtr_msg_recalc_status (msg);
}
@@ -363,6 +371,7 @@ gtr_msg_set_msgstr_plural (GtrMsg * msg, gint index, const gchar * msgstr)
g_return_if_fail (msgstr != NULL);
po_message_set_msgstr_plural (priv->message, index, msgstr);
+ gtr_msg_recalc_status (msg);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]