* Fixes NB#94467, do not show special icons for remote folders
[modest] / src / widgets / modest-folder-view.c
index d710beb..97c5805 100644 (file)
@@ -429,32 +429,34 @@ format_compact_style (gchar **item_name,
                      gboolean *use_markup)
 {
        TnyFolder *folder;
-       GString *buffer;
-       TnyAccount *account;
        gboolean is_special;
        TnyFolderType folder_type;
-       const gchar *folder_name;
-       gboolean concat_folder_name = FALSE;
 
        if (!TNY_IS_FOLDER (instance))
                return;
 
        folder = (TnyFolder *) instance;
-       account = tny_folder_get_account (folder);
-       if (account == NULL)
-               return;
-
-       folder_name = tny_folder_get_name (folder);
-       if (g_str_has_suffix (*item_name, folder_name)) {
-               gchar *offset = g_strrstr (*item_name, folder_name);
-               *offset = '\0';
-               concat_folder_name = TRUE;
-       }
 
        folder_type = tny_folder_get_folder_type (folder);
        is_special = (get_cmp_pos (folder_type, folder)!= 4);
 
        if (!is_special) {
+               TnyAccount *account = tny_folder_get_account (folder);
+               const gchar *folder_name;
+               gboolean concat_folder_name = FALSE;
+               GString *buffer;
+
+               /* Should not happen */
+               if (account == NULL)
+                       return;
+
+               folder_name = tny_folder_get_name (folder);
+               if (g_str_has_suffix (*item_name, folder_name)) {
+                       gchar *offset = g_strrstr (*item_name, folder_name);
+                       *offset = '\0';
+                       concat_folder_name = TRUE;
+               }
+
                buffer = g_string_new ("");
                buffer = g_string_append (buffer, tny_account_get_name (account));
                buffer = g_string_append (buffer, MODEST_FOLDER_PATH_SEPARATOR);
@@ -465,14 +467,13 @@ format_compact_style (gchar **item_name,
                        if (bold) buffer = g_string_append (buffer, "</span>");
                }
                g_free (*item_name);
+               g_object_unref (account);
+
                *item_name = g_string_free (buffer, FALSE);
                *use_markup = bold;
        } else {
                *use_markup = FALSE;
        }
-
-
-       g_object_unref (account);
 }
 
 static void
@@ -799,6 +800,16 @@ get_folder_icons (TnyFolderType type, GObject *instance)
                type = modest_tny_folder_guess_folder_type (TNY_FOLDER (instance));
        }
 
+       /* Remote folders should not be treated as special folders */
+       if (TNY_IS_FOLDER_STORE (instance) &&
+           type != TNY_FOLDER_TYPE_INBOX &&
+           modest_tny_folder_store_is_remote (TNY_FOLDER_STORE (instance))) {
+               return get_composite_icons (MODEST_FOLDER_ICON_NORMAL,
+                                           &normal_pixbuf,
+                                           &normal_pixbuf_open,
+                                           &normal_pixbuf_close);
+       }
+
        switch (type) {
        case TNY_FOLDER_TYPE_INVALID:
                g_warning ("%s: BUG: TNY_FOLDER_TYPE_INVALID", __FUNCTION__);