gtranslator r3724 - in trunk: data src



Author: icq
Date: Mon Sep 22 09:45:02 2008
New Revision: 3724
URL: http://svn.gnome.org/viewvc/gtranslator?rev=3724&view=rev

Log:
2008-08-23  Ignacio Casal Quinteiro  <nacho resa gmail com>

	* data/gtr-toolbar.xml:
	* data/gtranslator-ui.xml:
	* actions-go.c
	(gtranslator_message_go_to_next_fuzzy_or_untranslated),
	(gtranslator_message_go_to_prev_fuzzy_or_untranslated):
	* actions.h:
	* po.c (gtranslator_po_get_next_fuzzy_or_untrans),
	(gtranslator_po_get_prev_fuzzy_or_untrans):
	* po.h:
	* tab.c (gtranslator_tab_go_to_next_fuzzy_or_untrans),
	(gtranslator_tab_go_to_prev_fuzzy_or_untrans):
	* tab.h:
	* window.c (set_sensitive_according_to_message):
	Now you can jump to next/prev fuzzy or untranslated message. I
	know we are under feature freeze but this is really useful
	and it was really easy to implement.

Modified:
   trunk/data/ChangeLog
   trunk/data/gtr-toolbar.xml
   trunk/data/gtranslator-ui.xml
   trunk/src/ChangeLog
   trunk/src/actions-go.c
   trunk/src/actions.h
   trunk/src/po.c
   trunk/src/po.h
   trunk/src/tab.c
   trunk/src/tab.h
   trunk/src/window.c

Modified: trunk/data/gtr-toolbar.xml
==============================================================================
--- trunk/data/gtr-toolbar.xml	(original)
+++ trunk/data/gtr-toolbar.xml	Mon Sep 22 09:45:02 2008
@@ -20,6 +20,8 @@
     <toolitem name="GoPreviousFuzzy"/>
     <toolitem name="GoNextUntranslated"/>
     <toolitem name="GoPreviousUntranslated"/>
+    <toolitem name="GoNextFuzzyUntranslated"/>
+    <toolitem name="GoPreviousFuzzyUntranslated"/>
     <toolitem name="SearchFind"/>
     <toolitem name="SearchReplace"/>
 

Modified: trunk/data/gtranslator-ui.xml
==============================================================================
--- trunk/data/gtranslator-ui.xml	(original)
+++ trunk/data/gtranslator-ui.xml	Mon Sep 22 09:45:02 2008
@@ -72,6 +72,9 @@
       <separator/>
       <menuitem name="GoNextUntranslatedMenu" action="GoNextUntranslated"/>
       <menuitem name="GoPreviousUntranslatedMenu" action="GoPreviousUntranslated"/>
+      <separator/>
+      <menuitem name="GoNextFuzzyUntranslatedMenu" action="GoNextFuzzyUntranslated"/>
+      <menuitem name="GoPreviousFuzzyUntranslatedMenu" action="GoPreviousFuzzyUntranslated"/>
     </menu>
 
     <menu name="SearchMenu" action="Search">

Modified: trunk/src/actions-go.c
==============================================================================
--- trunk/src/actions-go.c	(original)
+++ trunk/src/actions-go.c	Mon Sep 22 09:45:02 2008
@@ -135,3 +135,31 @@
 	if (gtranslator_tab_go_to_prev_untrans (current))
 		set_sensitive_according_to_message (window, po);
 }
+
+void
+gtranslator_message_go_to_next_fuzzy_or_untranslated (GtkAction *action,
+						      GtranslatorWindow *window)
+{
+	GtranslatorTab *current;
+	GtranslatorPo *po;
+	GList *msg;
+	
+	current = gtranslator_window_get_active_tab (window);
+	po = gtranslator_tab_get_po (current);
+	if (gtranslator_tab_go_to_next_fuzzy_or_untrans (current))
+		set_sensitive_according_to_message (window, po);
+}
+
+void
+gtranslator_message_go_to_prev_fuzzy_or_untranslated (GtkAction *action,
+						      GtranslatorWindow *window)
+{
+	GtranslatorTab *current;
+	GtranslatorPo *po;
+	GList *msg;
+	
+	current = gtranslator_window_get_active_tab (window);
+	po = gtranslator_tab_get_po (current);
+	if (gtranslator_tab_go_to_prev_fuzzy_or_untrans (current))
+		set_sensitive_according_to_message (window, po);
+}
\ No newline at end of file

Modified: trunk/src/actions.h
==============================================================================
--- trunk/src/actions.h	(original)
+++ trunk/src/actions.h	Mon Sep 22 09:45:02 2008
@@ -122,6 +122,14 @@
                                                 (GtkAction *action,
 						 GtranslatorWindow *window);
 
+void       gtranslator_message_go_to_next_fuzzy_or_untranslated
+						(GtkAction *action,
+						 GtranslatorWindow *window);
+
+void       gtranslator_message_go_to_prev_fuzzy_or_untranslated
+						(GtkAction *action,
+						 GtranslatorWindow *window);
+
 /*Search*/
 void       _gtranslator_actions_search_find     (GtkAction   *action,
 						 GtranslatorWindow *window);

Modified: trunk/src/po.c
==============================================================================
--- trunk/src/po.c	(original)
+++ trunk/src/po.c	Mon Sep 22 09:45:02 2008
@@ -1068,6 +1068,52 @@
 }
 
 /**
+ * gtranslator_po_get_next_fuzzy_or_untrans:
+ * @po: a #GtranslatorPo
+ *
+ * Return value: a pointer to the next fuzzy or untranslated message
+ * or NULL if there is not next fuzzy or untranslated message.
+ **/
+GList *
+gtranslator_po_get_next_fuzzy_or_untrans (GtranslatorPo *po)
+{
+	GList *msg;
+	
+	msg = po->priv->current;
+	while (msg = g_list_next (msg))
+	{
+		if (gtranslator_msg_is_fuzzy (msg->data) ||
+		    !gtranslator_msg_is_translated (msg->data))
+			return msg;
+	}
+	
+	return NULL;
+}
+
+/**
+ * gtranslator_po_get_prev_fuzzy_or_untrans:
+ * @po: a #GtranslatorPo
+ *
+ * Return value: a pointer to the previously fuzzy or untranslated message
+ * or NULL if there is not previously fuzzy or untranslated message.
+ **/
+GList *
+gtranslator_po_get_prev_fuzzy_or_untrans (GtranslatorPo *po)
+{
+	GList *msg;
+	
+	msg = po->priv->current;
+	while (msg = g_list_previous (msg))
+	{
+		if (gtranslator_msg_is_fuzzy (msg->data) ||
+		    !gtranslator_msg_is_translated (msg->data))
+			return msg;
+	}
+	
+	return NULL;
+}
+
+/**
  * gtranslator_po_get_header:
  * @po: a #GtranslatorPo
  *

Modified: trunk/src/po.h
==============================================================================
--- trunk/src/po.h	(original)
+++ trunk/src/po.h	Mon Sep 22 09:45:02 2008
@@ -133,6 +133,10 @@
 
 GList           *gtranslator_po_get_prev_untrans	(GtranslatorPo *po);
 
+GList           *gtranslator_po_get_next_fuzzy_or_untrans (GtranslatorPo *po);
+
+GList           *gtranslator_po_get_prev_fuzzy_or_untrans (GtranslatorPo *po);
+
 GtranslatorHeader  
 		*gtranslator_po_get_header		(GtranslatorPo *po);
 

Modified: trunk/src/tab.c
==============================================================================
--- trunk/src/tab.c	(original)
+++ trunk/src/tab.c	Mon Sep 22 09:45:02 2008
@@ -1645,4 +1645,58 @@
 	}
 	
 	return FALSE;
+}
+
+/**
+ * gtranslator_tab_go_to_next_fuzzy_or_untrans:
+ * @tab: a #GtranslatorTab
+ *
+ * If there is a next fuzzy or untranslated message it jumps to it.
+ *
+ * Returns: TRUE if there is a next fuzzy or untranslated message.
+ */
+gboolean
+gtranslator_tab_go_to_next_fuzzy_or_untrans (GtranslatorTab *tab)
+{
+	GtranslatorPo *po;
+	GList *msg;
+	
+	po = gtranslator_tab_get_po (tab);
+	
+	msg = gtranslator_po_get_next_fuzzy_or_untrans (po);
+	if(msg != NULL)
+	{
+		gtranslator_tab_message_go_to (tab, msg, FALSE,
+					       GTR_TAB_MOVE_NONE);
+		return TRUE;
+	}
+	
+	return FALSE;
+}
+
+/**
+ * gtranslator_tab_go_to_prev_fuzzy_or_untrans:
+ * @tab: a #GtranslatorTab
+ *
+ * If there is a prev fuzzy or untranslated message it jumps to it.
+ *
+ * Returns: TRUE if there is a prev fuzzy or untranslated message.
+ */
+gboolean
+gtranslator_tab_go_to_prev_fuzzy_or_untrans (GtranslatorTab *tab)
+{
+	GtranslatorPo *po;
+	GList *msg;
+	
+	po = gtranslator_tab_get_po (tab);
+	
+	msg = gtranslator_po_get_prev_fuzzy_or_untrans (po);
+	if(msg != NULL)
+	{
+		gtranslator_tab_message_go_to (tab, msg, FALSE,
+					       GTR_TAB_MOVE_NONE);
+		return TRUE;
+	}
+	
+	return FALSE;
 }
\ No newline at end of file

Modified: trunk/src/tab.h
==============================================================================
--- trunk/src/tab.h	(original)
+++ trunk/src/tab.h	Mon Sep 22 09:45:02 2008
@@ -155,6 +155,10 @@
 gboolean               gtranslator_tab_go_to_next_untrans  (GtranslatorTab *tab);
 
 gboolean               gtranslator_tab_go_to_prev_untrans  (GtranslatorTab *tab);
+
+gboolean               gtranslator_tab_go_to_next_fuzzy_or_untrans (GtranslatorTab *tab);
+
+gboolean               gtranslator_tab_go_to_prev_fuzzy_or_untrans (GtranslatorTab *tab);
 							    
 gboolean              _gtranslator_tab_can_close           (GtranslatorTab *tab);
 

Modified: trunk/src/window.c
==============================================================================
--- trunk/src/window.c	(original)
+++ trunk/src/window.c	Mon Sep 22 09:45:02 2008
@@ -236,6 +236,12 @@
 	{ "GoPreviousUntranslated", GTK_STOCK_GO_BACK, N_("Previ_ous Untranslated"),
 	  "<alt>Page_Up", N_("Go to the previous untranslated message"),
           G_CALLBACK (gtranslator_message_go_to_prev_untranslated) },
+	{ "GoNextFuzzyUntranslated", GTK_STOCK_GO_FORWARD, N_("Next Fu_zzy or Untranslated"),
+	  "<control><shift>Page_Down", N_("Go to the next fuzzy or untranslated message"),
+          G_CALLBACK (gtranslator_message_go_to_next_fuzzy_or_untranslated) },
+	{ "GoPreviousFuzzyUntranslated", GTK_STOCK_GO_BACK, N_("Pre_vious Fuzzy or Untranslated"),
+	  "<control><shift>Page_Up", N_("Go to the previous fuzzy or untranslated message"),
+          G_CALLBACK (gtranslator_message_go_to_prev_fuzzy_or_untranslated) },
 
 	/* Search menu*/
 	{ "SearchFind", GTK_STOCK_FIND, NULL, "<control>F",
@@ -601,6 +607,16 @@
 					     "GoPreviousUntranslated");
 	gtk_action_set_sensitive (action, 
 				  gtranslator_po_get_prev_untrans(po) != NULL);
+	
+	action = gtk_action_group_get_action(window->priv->action_group,
+					     "GoNextFuzzyUntranslated");
+	gtk_action_set_sensitive (action, 
+				  gtranslator_po_get_next_fuzzy_or_untrans (po) != NULL);
+	
+	action = gtk_action_group_get_action(window->priv->action_group,
+					     "GoPreviousFuzzyUntranslated");
+	gtk_action_set_sensitive (action, 
+				  gtranslator_po_get_prev_fuzzy_or_untrans (po) != NULL);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]