X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-protocol.c;h=48c5f286173ac7140ebf35d7de8bde45f88b8e73;hp=e3d7d391ab8a233769f9ca2af6fc2e63907dad09;hb=ab49ff67c832b064136f47917ad9de4ceb74d45a;hpb=627c4af6ac85444cc3256fa568baf4a8d62178ae diff --git a/src/modest-protocol.c b/src/modest-protocol.c index e3d7d39..48c5f28 100644 --- a/src/modest-protocol.c +++ b/src/modest-protocol.c @@ -183,10 +183,10 @@ modest_protocol_finalize (GObject *obj) g_free (priv->display_name); priv->display_name = NULL; - g_hash_table_destroy (priv->properties); + g_hash_table_unref (priv->properties); priv->properties = NULL; - g_hash_table_destroy (priv->translations); + g_hash_table_unref (priv->translations); priv->translations = NULL; G_OBJECT_CLASS (parent_class)->finalize (obj); @@ -350,7 +350,7 @@ modest_protocol_set_translation (ModestProtocol *self, translation->userdata = userdata; translation->data_destroy_func = data_destroy_func; - g_hash_table_replace (priv->translations, (gpointer) id, (gpointer) translation); + g_hash_table_replace (priv->translations, g_strdup(id), (gpointer) translation); } gchar * @@ -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; }