/* * A helper function simply increments the "translated" variable of the * po-file. */ static void determine_translation_status (GtrMsg * msg, GtrPo * po) { GtrPoPrivate *priv = gtr_po_get_instance_private (po); if (gtr_msg_is_fuzzy (msg)) priv->fuzzy++; else if (gtr_msg_is_translated (msg)) priv->translated++; }
/** * gtr_po_get_prev_fuzzy_or_untrans: * @po: a #GtrPo * * Return value: (transfer none) (element-type Gtranslator.Msg): * a pointer to the previously fuzzy or * untranslated message or NULL if there is not previously * fuzzy or untranslated message. **/ GList * gtr_po_get_prev_fuzzy_or_untrans (GtrPo * po) { GList *msg; GtrPoPrivate *priv = gtr_po_get_instance_private (po); msg = priv->current; while ((msg = g_list_previous (msg))) { if (gtr_msg_is_fuzzy (msg->data) || !gtr_msg_is_translated (msg->data)) return msg; } return NULL; }
/** * gtr_po_get_next_fuzzy: * @po: a #GtrPo * * Return value: (transfer none) (element-type Gtranslator.Msg): * a pointer to the next fuzzy message **/ GList * gtr_po_get_next_fuzzy (GtrPo * po) { GList *msg; GtrPoPrivate *priv = gtr_po_get_instance_private (po); msg = priv->current; while ((msg = g_list_next (msg))) { if (gtr_msg_is_fuzzy (msg->data)) return msg; } return NULL; }
/* * Toggle the sticky status */ void gtr_message_status_toggle_fuzzy (GtkAction * action, GtrWindow * window) { GtrTab *current; GtrPo *po; GList *msg; current = gtr_window_get_active_tab (window); po = gtr_tab_get_po (current); msg = gtr_po_get_current_message (po); if (gtr_msg_is_fuzzy (msg->data)) gtr_msg_set_fuzzy (msg->data, FALSE); else gtr_msg_set_fuzzy (msg->data, TRUE); /* * Emit that message was changed. */ g_signal_emit_by_name (current, "message_changed", msg->data); }
static void colorize_cell (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) { GtrMsg *msg; GdkRGBA translated, fuzzy, untranslated; GtkStyleContext *style_context; style_context = gtk_widget_get_style_context (GTK_WIDGET (data)); gtk_style_context_lookup_color (style_context, "theme_fg_color", &translated); gtk_style_context_lookup_color (style_context, "warning_color", &fuzzy); gtk_style_context_lookup_color (style_context, "error_color", &untranslated); gtk_tree_model_get (tree_model, iter, GTR_MESSAGE_TABLE_MODEL_POINTER_COLUMN, &msg, -1); if (gtr_msg_is_fuzzy (msg)) { g_object_set (cell, "foreground-rgba", &fuzzy, NULL); g_object_set (cell, "style", PANGO_STYLE_ITALIC, NULL); g_object_set (cell, "weight", PANGO_WEIGHT_NORMAL, NULL); } else if (gtr_msg_is_translated (msg)) { g_object_set (cell, "foreground-rgba", &translated, NULL); g_object_set (cell, "style", PANGO_STYLE_NORMAL, NULL); g_object_set (cell, "weight", PANGO_WEIGHT_NORMAL, NULL); } else { g_object_set (cell, "foreground-rgba", &untranslated, NULL); g_object_set (cell, "style", PANGO_STYLE_NORMAL, NULL); g_object_set (cell, "weight", PANGO_WEIGHT_BOLD, NULL); } }