* Fixes NB#97149, MMC user created folders have a different icon
authorSergio Villar Senin <svillar@igalia.com>
Mon, 12 Jan 2009 10:48:54 +0000 (10:48 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Mon, 12 Jan 2009 10:48:54 +0000 (10:48 +0000)
pmo-trunk-r7097

src/gnome/modest-icon-names.h
src/hildon2/modest-icon-names.h
src/maemo/modest-icon-names.h
src/modest-tny-folder.c
src/widgets/modest-folder-view.c

index fc3530e..43172eb 100644 (file)
@@ -80,7 +80,7 @@
 /* #define MODEST_FOLDER_ICON_LOCAL_FOLDERS    PIXMAP_PREFIX "qgn_list_gene_fldr_cls.png" */
 #define MODEST_FOLDER_ICON_LOCAL_FOLDERS       "computer"
 #define MODEST_FOLDER_ICON_MMC                  "media-flash"
-
+#define MODEST_FOLDER_ICON_MMC_FOLDER           MODEST_FOLDER_ICON_NORMAL
 
 /* toolbar */
 #define  MODEST_TOOLBAR_ICON_MAIL_SEND         PIXMAP_PREFIX "qgn_list_messagin_sent.png"
index e0b33af..b93f367 100644 (file)
@@ -74,7 +74,7 @@
 #define MODEST_FOLDER_ICON_NORMAL              "general_folder"
 #define MODEST_FOLDER_ICON_LOCAL_FOLDERS       "general_device_root_folder"
 #define MODEST_FOLDER_ICON_MMC                  "general_removable_memory_card"
-
+#define MODEST_FOLDER_ICON_MMC_FOLDER           "general_removable_memory_card"
 
 /* toolbar */
 #define  MODEST_TOOLBAR_ICON_MAIL_SEND         "email_message_send"
index 5ab97e1..896a51c 100644 (file)
@@ -74,7 +74,7 @@
 #define MODEST_FOLDER_ICON_NORMAL              "qgn_list_gene_fldr_cls"
 #define MODEST_FOLDER_ICON_LOCAL_FOLDERS       "qgn_list_shell_mydevice"
 #define MODEST_FOLDER_ICON_MMC                  "qgn_list_gene_mmc"
-
+#define MODEST_FOLDER_ICON_MMC_FOLDER           MODEST_FOLDER_ICON_NORMAL
 
 /* toolbar */
 #define  MODEST_TOOLBAR_ICON_MAIL_SEND         "qgn_toolb_messagin_send"
index 8188eeb..f29fef7 100644 (file)
@@ -255,9 +255,9 @@ gboolean
 modest_tny_folder_is_memory_card_folder   (TnyFolder *folder)
 {
        g_return_val_if_fail (folder, FALSE);
-       
-       /* The merge folder is a special case, 
-        * used to merge the per-account local outbox folders. 
+
+       /* The merge folder is a special case,
+        * used to merge the per-account local outbox folders.
         * and can have no get_account() implementation.
         */
        if (TNY_IS_MERGE_FOLDER (folder))
@@ -268,15 +268,15 @@ modest_tny_folder_is_memory_card_folder   (TnyFolder *folder)
                return FALSE;
 
        const gchar* account_id = tny_account_get_id (account);
-       if (!account_id) {      
+       if (!account_id) {
                g_object_unref (account);
                return FALSE;
        }
 
        g_object_unref (account);
-       
+
        return (strcmp (account_id, MODEST_MMC_ACCOUNT_ID) == 0);
-}      
+}
 
 gboolean
 modest_tny_folder_is_remote_folder   (TnyFolder *folder)
index b6b8e9f..eddc33f 100644 (file)
@@ -777,7 +777,7 @@ get_composite_icons (const gchar *icon_code,
        return retval;
 }
 
-static ThreePixbufs*
+static inline ThreePixbufs*
 get_folder_icons (TnyFolderType type, GObject *instance)
 {
        static GdkPixbuf *inbox_pixbuf = NULL, *outbox_pixbuf = NULL,
@@ -819,6 +819,8 @@ get_folder_icons (TnyFolderType type, GObject *instance)
        }
 
        switch (type) {
+               const gchar *icon_code;
+
        case TNY_FOLDER_TYPE_INVALID:
                g_warning ("%s: BUG: TNY_FOLDER_TYPE_INVALID", __FUNCTION__);
                break;
@@ -886,7 +888,13 @@ get_folder_icons (TnyFolderType type, GObject *instance)
                break;
        case TNY_FOLDER_TYPE_NORMAL:
        default:
-               retval = get_composite_icons (MODEST_FOLDER_ICON_NORMAL,
+               /* Memory card folders could have an special icon */
+               if (modest_tny_folder_is_memory_card_folder (TNY_FOLDER (instance)))
+                       icon_code = MODEST_FOLDER_ICON_MMC_FOLDER;
+               else
+                       icon_code = MODEST_FOLDER_ICON_NORMAL;
+
+               retval = get_composite_icons (icon_code,
                                              &normal_pixbuf,
                                              &normal_pixbuf_open,
                                              &normal_pixbuf_close);