* src/modest-tny-folder.c:
authorJose Dapena Paz <jdapena@igalia.com>
Wed, 5 Sep 2007 19:46:31 +0000 (19:46 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Wed, 5 Sep 2007 19:46:31 +0000 (19:46 +0000)
* (modest_tny_folder_guess_folder_type_from_name): fixed
  this function. We were downcasing the name, but not the
  strings we were comparing with (fixes NB#65059).

pmo-trunk-r3221

src/modest-tny-folder.c

index 62cf9f7..e885244 100644 (file)
@@ -45,17 +45,23 @@ modest_tny_folder_guess_folder_type_from_name (const gchar* name)
 {
        gint  type;
        gchar *folder;
+       gchar *dc_outbox = NULL;
+       gchar *dc_sent = NULL;
+       gchar *dc_drafts = NULL;
 
        g_return_val_if_fail (name, TNY_FOLDER_TYPE_UNKNOWN);
        
        type = TNY_FOLDER_TYPE_UNKNOWN;
        folder = g_utf8_strdown (name, strlen(name));
+       dc_outbox = g_utf8_strdown (_("mcen_me_folder_outbox"), -1);
+       dc_sent = g_utf8_strdown (_("mcen_me_folder_sent"), -1);
+       dc_drafts = g_utf8_strdown (_("mcen_me_folder_drafts"), -1);
 
 //     if (strcmp (folder, "inbox") == 0 ||
 //         strcmp (folder, _("inbox")) == 0 ||
 //         strcmp (folder, _("mcen_me_folder_inbox")) == 0)
 //             type = TNY_FOLDER_TYPE_INBOX;
-       if (strcmp (folder, _("mcen_me_folder_outbox")) == 0)
+       if (strcmp (folder, dc_outbox) == 0)
                type = TNY_FOLDER_TYPE_OUTBOX;
 //     else if (g_str_has_prefix(folder, "junk") ||
 //              g_str_has_prefix(folder, _("junk")))
@@ -63,9 +69,9 @@ modest_tny_folder_guess_folder_type_from_name (const gchar* name)
 //     else if (g_str_has_prefix(folder, "trash") ||
 //              g_str_has_prefix(folder, _("trash")))
 //             type = TNY_FOLDER_TYPE_TRASH;
-       else if (strcmp (folder, _("mcen_me_folder_sent")) == 0)
+       else if (strcmp (folder, dc_sent) == 0)
                type = TNY_FOLDER_TYPE_SENT;
-       else if (strcmp (folder, _("mcen_me_folder_drafts")) == 0)
+       else if (strcmp (folder, dc_drafts) == 0)
                type = TNY_FOLDER_TYPE_DRAFTS;
 //     else if (g_str_has_prefix(folder, "notes") ||
 //              g_str_has_prefix(folder, _("notes")))
@@ -78,6 +84,9 @@ modest_tny_folder_guess_folder_type_from_name (const gchar* name)
 //             type = TNY_FOLDER_TYPE_CALENDAR;
        
        g_free (folder);
+       g_free (dc_outbox);
+       g_free (dc_sent);
+       g_free (dc_drafts);
        return type;
 }