Added varargs get_translation function and sort the code to use it
authorJose Dapena Paz <jdapena@igalia.com>
Mon, 15 Dec 2008 13:39:57 +0000 (13:39 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Mon, 15 Dec 2008 13:39:57 +0000 (13:39 +0000)
pmo-drop-split-view-r6844

src/modest-protocol.c
src/modest-protocol.h

index 03eaa8b..48c5f28 100644 (file)
@@ -358,9 +358,26 @@ modest_protocol_get_translation (ModestProtocol *self,
                                 const gchar *id,
                                 ...)
 {
+       va_list args;
+       gchar *result;
+
+       g_return_val_if_fail (MODEST_IS_PROTOCOL (self), NULL);
+
+       va_start (args, id);
+       result = modest_protocol_va_get_translation (self, id, args);
+       va_end (args);
+
+       return result;
+}
+
+gchar *
+modest_protocol_va_get_translation (ModestProtocol *self,
+                                   const gchar *id,
+                                   va_list args)
+{
        ModestProtocolPrivate *priv;
        ModestProtocolTranslation *translation;
-       va_list orig, dest;
+       va_list dest;
        gchar *result;
 
        g_return_val_if_fail (MODEST_IS_PROTOCOL (self), NULL);
@@ -372,10 +389,9 @@ modest_protocol_get_translation (ModestProtocol *self,
                return NULL;
        g_return_val_if_fail (translation->translation_func != NULL, NULL);
 
-       va_start (orig, id);
-       G_VA_COPY (dest, orig);
+       G_VA_COPY (dest, args);
        result = translation->translation_func (translation->userdata, dest);
-       va_end (orig);
+       va_end (dest);
 
        return result;
 }
index 6a113cf..b8899d3 100644 (file)
@@ -182,6 +182,21 @@ modest_protocol_get_translation (ModestProtocol *protocol,
                                 const gchar *id,
                                 ...);
 
+/**
+ * modest_protocol_va_get_translation:
+ * @protocol: a @ModestProtocol
+ * @id: the id for the translation set
+ * @args: a @va_list of the parameters for the translation
+ *
+ * applies the translation with parameters to obtain the full string expected.
+ *
+ * Returns: a newly allocated string
+ */
+gchar *
+modest_protocol_va_get_translation (ModestProtocol *protocol,
+                                   const gchar *id,
+                                   va_list args);
+
 G_END_DECLS
 
 #endif /* __MODEST_PROTOCOL_H__ */