Do ignore empty recipients when checking names
[modest] / src / modest-protocol.c
index e3d7d39..48c5f28 100644 (file)
@@ -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;
 }