From 02b6ad38a4e0e221276c28d84baa0ff6534443d2 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Mon, 10 Dec 2007 12:29:21 +0000 Subject: [PATCH] * use the correctly sized icons for various things; added a parameter to modest_platform_get_icon to do this. now, the window (editor/viewer) icons don't look blurry anymore. improved fix for NB#78393 pmo-trunk-r3891 --- src/gnome/modest-platform.c | 2 +- src/maemo/modest-main-window.c | 2 +- src/maemo/modest-msg-edit-window.c | 14 +- src/maemo/modest-msg-view-window.c | 14 +- src/maemo/modest-platform.c | 16 +- src/modest-defs.h | 4 + src/modest-platform.h | 3 +- src/widgets/modest-folder-view.c | 355 +++++++++++++++++-------------- src/widgets/modest-header-view-render.c | 18 +- 9 files changed, 218 insertions(+), 210 deletions(-) diff --git a/src/gnome/modest-platform.c b/src/gnome/modest-platform.c index a38b5c5..e5cf17f 100644 --- a/src/gnome/modest-platform.c +++ b/src/gnome/modest-platform.c @@ -113,7 +113,7 @@ modest_platform_show_uri_popup (const gchar *uri) } GdkPixbuf* -modest_platform_get_icon (const gchar *name) +modest_platform_get_icon (const gchar *name, guint icon_size) { GError *err = NULL; GdkPixbuf* pixbuf; diff --git a/src/maemo/modest-main-window.c b/src/maemo/modest-main-window.c index e11601c..a687ecd 100644 --- a/src/maemo/modest-main-window.c +++ b/src/maemo/modest-main-window.c @@ -1238,7 +1238,7 @@ modest_main_window_new (void) G_CALLBACK (modest_main_window_on_show), folder_win); /* Set window icon */ - window_icon = modest_platform_get_icon (MODEST_APP_ICON); + window_icon = modest_platform_get_icon (MODEST_APP_ICON, MODEST_ICON_SIZE_BIG); if (window_icon) { gtk_window_set_icon (GTK_WINDOW (self), window_icon); g_object_unref (window_icon); diff --git a/src/maemo/modest-msg-edit-window.c b/src/maemo/modest-msg-edit-window.c index cd535c7..abb28bc 100644 --- a/src/maemo/modest-msg-edit-window.c +++ b/src/maemo/modest-msg-edit-window.c @@ -743,19 +743,9 @@ init_window (ModestMsgEditWindow *obj) gtk_container_add (GTK_CONTAINER (frame), priv->scroll_area); /* Set window icon */ - window_icon = modest_platform_get_icon (MODEST_APP_MSG_EDIT_ICON); + window_icon = modest_platform_get_icon (MODEST_APP_MSG_EDIT_ICON, MODEST_ICON_SIZE_BIG); if (window_icon) { - /* scale the icon, because it won't be shown unless it's - * 64 x 54 -- hildon quirk. this looks a bit ugly now, - * so waiting for correctly sized icons, then this scaling - * code can disappear -- djcb - */ - GdkPixbuf *scaled = - gdk_pixbuf_scale_simple (window_icon, 64, 54, GDK_INTERP_BILINEAR); - if (scaled) { - gtk_window_set_icon (GTK_WINDOW (obj), scaled); - g_object_unref (scaled); - } + gtk_window_set_icon (GTK_WINDOW (obj), window_icon); g_object_unref (window_icon); } } diff --git a/src/maemo/modest-msg-view-window.c b/src/maemo/modest-msg-view-window.c index 5159c34..72214e2 100644 --- a/src/maemo/modest-msg-view-window.c +++ b/src/maemo/modest-msg-view-window.c @@ -424,19 +424,9 @@ modest_msg_view_window_init (ModestMsgViewWindow *obj) init_window (MODEST_MSG_VIEW_WINDOW(obj)); /* Set window icon */ - window_icon = modest_platform_get_icon (MODEST_APP_MSG_VIEW_ICON); + window_icon = modest_platform_get_icon (MODEST_APP_MSG_VIEW_ICON, MODEST_ICON_SIZE_BIG); if (window_icon) { - /* scale the icon, because it won't be shown unless it's - * 64 x 54 -- hildon quirk. this looks a bit ugly now, - * so waiting for correctly sized icons, then this scaling - * code can disappear -- djcb - */ - GdkPixbuf *scaled = - gdk_pixbuf_scale_simple (window_icon, 64, 54, GDK_INTERP_BILINEAR); - if (scaled) { - gtk_window_set_icon (GTK_WINDOW (obj), scaled); - g_object_unref (scaled); - } + gtk_window_set_icon (GTK_WINDOW (obj), window_icon); g_object_unref (window_icon); } diff --git a/src/maemo/modest-platform.c b/src/maemo/modest-platform.c index 12954c5..72e2ac5 100644 --- a/src/maemo/modest-platform.c +++ b/src/maemo/modest-platform.c @@ -477,7 +477,7 @@ modest_platform_show_uri_popup (const gchar *uri) GdkPixbuf* -modest_platform_get_icon (const gchar *name) +modest_platform_get_icon (const gchar *name, guint icon_size) { GError *err = NULL; GdkPixbuf* pixbuf = NULL; @@ -491,20 +491,8 @@ modest_platform_get_icon (const gchar *name) if (!name || strlen(name) == 0) return NULL; -#if 0 /* do we still need this? */ - if (g_str_has_suffix (name, ".png")) { /*FIXME: hack*/ - pixbuf = gdk_pixbuf_new_from_file (name, &err); - if (!pixbuf) { - g_printerr ("modest: error loading icon '%s': %s\n", - name, err->message); - g_error_free (err); - return NULL; - } - return pixbuf; - } -#endif /* */ current_theme = gtk_icon_theme_get_default (); - pixbuf = gtk_icon_theme_load_icon (current_theme, name, 26, + pixbuf = gtk_icon_theme_load_icon (current_theme, name, icon_size, GTK_ICON_LOOKUP_NO_SVG, &err); if (!pixbuf) { diff --git a/src/modest-defs.h b/src/modest-defs.h index 2742683..65dd89f 100644 --- a/src/modest-defs.h +++ b/src/modest-defs.h @@ -77,6 +77,10 @@ #define MODEST_PROVIDER_DATA_FILE PREFIX "/share/modest/provider-data/modest-provider-data.keyfile" #define MODEST_MAEMO_PROVIDER_DATA_FILE PREFIX "/share/modest/provider-data/maemo-provider-data.keyfile" + +#define MODEST_ICON_SIZE_SMALL 26 +#define MODEST_ICON_SIZE_BIG 64 + /* configuration key definitions for modest */ #define MODEST_ACCOUNT_NAMESPACE MODEST_CONF_NAMESPACE "/accounts" #define MODEST_CONF_DEFAULT_ACCOUNT MODEST_CONF_NAMESPACE "/default_account" diff --git a/src/modest-platform.h b/src/modest-platform.h index a671e73..455a724 100644 --- a/src/modest-platform.h +++ b/src/modest-platform.h @@ -127,10 +127,11 @@ gboolean modest_platform_show_uri_popup (const gchar *uri); /** * modest_platform_get_icon: * @name: the name of the icon + * @size: the icon size, use MODEST_ICON_SMALL or MODEST_ICON_BIG * * this function returns an icon, or NULL in case of error */ -GdkPixbuf* modest_platform_get_icon (const gchar *name); +GdkPixbuf* modest_platform_get_icon (const gchar *name, guint icon_size); /** diff --git a/src/widgets/modest-folder-view.c b/src/widgets/modest-folder-view.c index f91f587..876888c 100644 --- a/src/widgets/modest-folder-view.c +++ b/src/widgets/modest-folder-view.c @@ -536,22 +536,25 @@ get_folder_icons (TnyFolderType type, GObject *instance) TNY_ACCOUNT (instance))) { if (!avirt_pixbuf) - avirt_pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (MODEST_FOLDER_ICON_LOCAL_FOLDERS)); - + avirt_pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (MODEST_FOLDER_ICON_LOCAL_FOLDERS, + MODEST_ICON_SIZE_SMALL)); + if (!avirt_pixbuf_open) { - GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp"); - avirt_pixbuf_open = gdk_pixbuf_copy (avirt_pixbuf); - gdk_pixbuf_composite (emblem, avirt_pixbuf_open, 0, 0, - MIN (gdk_pixbuf_get_width (emblem), - gdk_pixbuf_get_width (avirt_pixbuf_open)), - MIN (gdk_pixbuf_get_height (emblem), - gdk_pixbuf_get_height (avirt_pixbuf_open)), - 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); - g_object_unref (emblem); + GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp", + MODEST_ICON_SIZE_SMALL); + avirt_pixbuf_open = gdk_pixbuf_copy (avirt_pixbuf); + gdk_pixbuf_composite (emblem, avirt_pixbuf_open, 0, 0, + MIN (gdk_pixbuf_get_width (emblem), + gdk_pixbuf_get_width (avirt_pixbuf_open)), + MIN (gdk_pixbuf_get_height (emblem), + gdk_pixbuf_get_height (avirt_pixbuf_open)), + 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); + g_object_unref (emblem); } if (!avirt_pixbuf_close) { - GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp"); + GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp", + MODEST_ICON_SIZE_SMALL); avirt_pixbuf_close = gdk_pixbuf_copy (avirt_pixbuf); gdk_pixbuf_composite (emblem, avirt_pixbuf_close, 0, 0, MIN (gdk_pixbuf_get_width (emblem), @@ -573,10 +576,12 @@ get_folder_icons (TnyFolderType type, GObject *instance) if (!strcmp (account_id, MODEST_MMC_ACCOUNT_ID)) { if (!ammc_pixbuf) - ammc_pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (MODEST_FOLDER_ICON_MMC)); - + ammc_pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (MODEST_FOLDER_ICON_MMC, + MODEST_ICON_SIZE_SMALL)); + if (!ammc_pixbuf_open) { - GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp"); + GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp", + MODEST_ICON_SIZE_SMALL); ammc_pixbuf_open = gdk_pixbuf_copy (ammc_pixbuf); gdk_pixbuf_composite (emblem, ammc_pixbuf_open, 0, 0, MIN (gdk_pixbuf_get_width (emblem), @@ -588,7 +593,8 @@ get_folder_icons (TnyFolderType type, GObject *instance) } if (!ammc_pixbuf_close) { - GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp"); + GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp", + MODEST_ICON_SIZE_SMALL); ammc_pixbuf_close = gdk_pixbuf_copy (ammc_pixbuf); gdk_pixbuf_composite (emblem, ammc_pixbuf_close, 0, 0, MIN (gdk_pixbuf_get_width (emblem), @@ -607,10 +613,11 @@ get_folder_icons (TnyFolderType type, GObject *instance) } else { if (!anorm_pixbuf) - anorm_pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (MODEST_FOLDER_ICON_ACCOUNT)); - + anorm_pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (MODEST_FOLDER_ICON_ACCOUNT, + MODEST_ICON_SIZE_SMALL)); if (!anorm_pixbuf_open) { - GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp"); + GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp", + MODEST_ICON_SIZE_SMALL); anorm_pixbuf_open = gdk_pixbuf_copy (anorm_pixbuf); gdk_pixbuf_composite (emblem, anorm_pixbuf_open, 0, 0, MIN (gdk_pixbuf_get_width (emblem), @@ -622,7 +629,8 @@ get_folder_icons (TnyFolderType type, GObject *instance) } if (!anorm_pixbuf_close) { - GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp"); + GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp", + MODEST_ICON_SIZE_SMALL); anorm_pixbuf_close = gdk_pixbuf_copy (anorm_pixbuf); gdk_pixbuf_composite (emblem, anorm_pixbuf_close, 0, 0, MIN (gdk_pixbuf_get_width (emblem), @@ -645,56 +653,62 @@ get_folder_icons (TnyFolderType type, GObject *instance) case TNY_FOLDER_TYPE_INBOX: if (!inbox_pixbuf) - inbox_pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (MODEST_FOLDER_ICON_INBOX)); + inbox_pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (MODEST_FOLDER_ICON_INBOX, + MODEST_ICON_SIZE_SMALL)); if (!inbox_pixbuf_open) { - GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp"); - inbox_pixbuf_open = gdk_pixbuf_copy (inbox_pixbuf); - gdk_pixbuf_composite (emblem, inbox_pixbuf_open, 0, 0, - MIN (gdk_pixbuf_get_width (emblem), - gdk_pixbuf_get_width (inbox_pixbuf_open)), - MIN (gdk_pixbuf_get_height (emblem), - gdk_pixbuf_get_height (inbox_pixbuf_open)), - 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); - g_object_unref (emblem); + GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp", + MODEST_ICON_SIZE_SMALL); + inbox_pixbuf_open = gdk_pixbuf_copy (inbox_pixbuf); + gdk_pixbuf_composite (emblem, inbox_pixbuf_open, 0, 0, + MIN (gdk_pixbuf_get_width (emblem), + gdk_pixbuf_get_width (inbox_pixbuf_open)), + MIN (gdk_pixbuf_get_height (emblem), + gdk_pixbuf_get_height (inbox_pixbuf_open)), + 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); + g_object_unref (emblem); } - + if (!inbox_pixbuf_close) { - GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp"); - inbox_pixbuf_close = gdk_pixbuf_copy (inbox_pixbuf); - gdk_pixbuf_composite (emblem, inbox_pixbuf_close, 0, 0, - MIN (gdk_pixbuf_get_width (emblem), - gdk_pixbuf_get_width (inbox_pixbuf_close)), - MIN (gdk_pixbuf_get_height (emblem), - gdk_pixbuf_get_height (inbox_pixbuf_close)), - 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); - g_object_unref (emblem); + GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp", + MODEST_ICON_SIZE_SMALL); + inbox_pixbuf_close = gdk_pixbuf_copy (inbox_pixbuf); + gdk_pixbuf_composite (emblem, inbox_pixbuf_close, 0, 0, + MIN (gdk_pixbuf_get_width (emblem), + gdk_pixbuf_get_width (inbox_pixbuf_close)), + MIN (gdk_pixbuf_get_height (emblem), + gdk_pixbuf_get_height (inbox_pixbuf_close)), + 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); + g_object_unref (emblem); } - + pixbuf = g_object_ref (inbox_pixbuf); pixbuf_open = g_object_ref (inbox_pixbuf_open); pixbuf_close = g_object_ref (inbox_pixbuf_close); - + break; case TNY_FOLDER_TYPE_OUTBOX: - if (!outbox_pixbuf) - outbox_pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (MODEST_FOLDER_ICON_OUTBOX)); - - if (!outbox_pixbuf_open) { - GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp"); - outbox_pixbuf_open = gdk_pixbuf_copy (outbox_pixbuf); - gdk_pixbuf_composite (emblem, outbox_pixbuf_open, 0, 0, - MIN (gdk_pixbuf_get_width (emblem), - gdk_pixbuf_get_width (outbox_pixbuf_open)), - MIN (gdk_pixbuf_get_height (emblem), - gdk_pixbuf_get_height (outbox_pixbuf_open)), - 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); - g_object_unref (emblem); + if (!outbox_pixbuf) + outbox_pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (MODEST_FOLDER_ICON_OUTBOX, + MODEST_ICON_SIZE_SMALL)); + + if (!outbox_pixbuf_open) { + GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp", + MODEST_ICON_SIZE_SMALL); + outbox_pixbuf_open = gdk_pixbuf_copy (outbox_pixbuf); + gdk_pixbuf_composite (emblem, outbox_pixbuf_open, 0, 0, + MIN (gdk_pixbuf_get_width (emblem), + gdk_pixbuf_get_width (outbox_pixbuf_open)), + MIN (gdk_pixbuf_get_height (emblem), + gdk_pixbuf_get_height (outbox_pixbuf_open)), + 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); + g_object_unref (emblem); } if (!outbox_pixbuf_close) { - GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp"); + GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp", + MODEST_ICON_SIZE_SMALL); outbox_pixbuf_close = gdk_pixbuf_copy (outbox_pixbuf); gdk_pixbuf_composite (emblem, outbox_pixbuf_close, 0, 0, MIN (gdk_pixbuf_get_width (emblem), @@ -713,101 +727,110 @@ get_folder_icons (TnyFolderType type, GObject *instance) break; case TNY_FOLDER_TYPE_JUNK: if (!junk_pixbuf) - junk_pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (MODEST_FOLDER_ICON_JUNK)); - + junk_pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (MODEST_FOLDER_ICON_JUNK, + MODEST_ICON_SIZE_SMALL)); if (!junk_pixbuf_open) { - GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp"); - junk_pixbuf_open = gdk_pixbuf_copy (junk_pixbuf); - gdk_pixbuf_composite (emblem, junk_pixbuf_open, 0, 0, - MIN (gdk_pixbuf_get_width (emblem), - gdk_pixbuf_get_width (junk_pixbuf_open)), - MIN (gdk_pixbuf_get_height (emblem), - gdk_pixbuf_get_height (junk_pixbuf_open)), - 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); - g_object_unref (emblem); + GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp", + MODEST_ICON_SIZE_SMALL); + junk_pixbuf_open = gdk_pixbuf_copy (junk_pixbuf); + gdk_pixbuf_composite (emblem, junk_pixbuf_open, 0, 0, + MIN (gdk_pixbuf_get_width (emblem), + gdk_pixbuf_get_width (junk_pixbuf_open)), + MIN (gdk_pixbuf_get_height (emblem), + gdk_pixbuf_get_height (junk_pixbuf_open)), + 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); + g_object_unref (emblem); } - + if (!junk_pixbuf_close) { - GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp"); - junk_pixbuf_close = gdk_pixbuf_copy (junk_pixbuf); - gdk_pixbuf_composite (emblem, junk_pixbuf_close, 0, 0, - MIN (gdk_pixbuf_get_width (emblem), - gdk_pixbuf_get_width (junk_pixbuf_close)), - MIN (gdk_pixbuf_get_height (emblem), - gdk_pixbuf_get_height (junk_pixbuf_close)), - 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); - g_object_unref (emblem); + GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp", + MODEST_ICON_SIZE_SMALL); + junk_pixbuf_close = gdk_pixbuf_copy (junk_pixbuf); + gdk_pixbuf_composite (emblem, junk_pixbuf_close, 0, 0, + MIN (gdk_pixbuf_get_width (emblem), + gdk_pixbuf_get_width (junk_pixbuf_close)), + MIN (gdk_pixbuf_get_height (emblem), + gdk_pixbuf_get_height (junk_pixbuf_close)), + 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); + g_object_unref (emblem); } - - + + pixbuf = g_object_ref (junk_pixbuf); pixbuf_open = g_object_ref (junk_pixbuf_open); pixbuf_close = g_object_ref (junk_pixbuf_close); - + break; - case TNY_FOLDER_TYPE_SENT: - if (!sent_pixbuf) - sent_pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (MODEST_FOLDER_ICON_SENT)); - - if (!sent_pixbuf_open) { - GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp"); - sent_pixbuf_open = gdk_pixbuf_copy (sent_pixbuf); - gdk_pixbuf_composite (emblem, sent_pixbuf_open, 0, 0, - MIN (gdk_pixbuf_get_width (emblem), - gdk_pixbuf_get_width (sent_pixbuf_open)), - MIN (gdk_pixbuf_get_height (emblem), - gdk_pixbuf_get_height (sent_pixbuf_open)), - 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); - g_object_unref (emblem); - } - - if (!sent_pixbuf_close) { - GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp"); - sent_pixbuf_close = gdk_pixbuf_copy (sent_pixbuf); - gdk_pixbuf_composite (emblem, sent_pixbuf_close, 0, 0, - MIN (gdk_pixbuf_get_width (emblem), - gdk_pixbuf_get_width (sent_pixbuf_close)), - MIN (gdk_pixbuf_get_height (emblem), - gdk_pixbuf_get_height (sent_pixbuf_close)), - 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); - g_object_unref (emblem); - } + case TNY_FOLDER_TYPE_SENT: + if (!sent_pixbuf) + sent_pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (MODEST_FOLDER_ICON_SENT, + MODEST_ICON_SIZE_SMALL)); + + if (!sent_pixbuf_open) { + GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp", + MODEST_ICON_SIZE_SMALL); + sent_pixbuf_open = gdk_pixbuf_copy (sent_pixbuf); + gdk_pixbuf_composite (emblem, sent_pixbuf_open, 0, 0, + MIN (gdk_pixbuf_get_width (emblem), + gdk_pixbuf_get_width (sent_pixbuf_open)), + MIN (gdk_pixbuf_get_height (emblem), + gdk_pixbuf_get_height (sent_pixbuf_open)), + 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); + g_object_unref (emblem); + } + + if (!sent_pixbuf_close) { + GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp", + MODEST_ICON_SIZE_SMALL); + sent_pixbuf_close = gdk_pixbuf_copy (sent_pixbuf); + gdk_pixbuf_composite (emblem, sent_pixbuf_close, 0, 0, + MIN (gdk_pixbuf_get_width (emblem), + gdk_pixbuf_get_width (sent_pixbuf_close)), + MIN (gdk_pixbuf_get_height (emblem), + gdk_pixbuf_get_height (sent_pixbuf_close)), + 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); + g_object_unref (emblem); + } + pixbuf = g_object_ref (sent_pixbuf); pixbuf_open = g_object_ref (sent_pixbuf_open); pixbuf_close = g_object_ref (sent_pixbuf_close); - + break; + case TNY_FOLDER_TYPE_TRASH: if (!trash_pixbuf) - trash_pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (MODEST_FOLDER_ICON_TRASH)); - + trash_pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (MODEST_FOLDER_ICON_TRASH, + MODEST_ICON_SIZE_SMALL)); if (!trash_pixbuf_open) { - GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp"); - trash_pixbuf_open = gdk_pixbuf_copy (trash_pixbuf); - gdk_pixbuf_composite (emblem, trash_pixbuf_open, 0, 0, - MIN (gdk_pixbuf_get_width (emblem), - gdk_pixbuf_get_width (trash_pixbuf_open)), - MIN (gdk_pixbuf_get_height (emblem), - gdk_pixbuf_get_height (trash_pixbuf_open)), - 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); - g_object_unref (emblem); + GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp", + MODEST_ICON_SIZE_SMALL); + trash_pixbuf_open = gdk_pixbuf_copy (trash_pixbuf); + gdk_pixbuf_composite (emblem, trash_pixbuf_open, 0, 0, + MIN (gdk_pixbuf_get_width (emblem), + gdk_pixbuf_get_width (trash_pixbuf_open)), + MIN (gdk_pixbuf_get_height (emblem), + gdk_pixbuf_get_height (trash_pixbuf_open)), + 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); + g_object_unref (emblem); } - + if (!trash_pixbuf_close) { - GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp"); - trash_pixbuf_close = gdk_pixbuf_copy (trash_pixbuf); - gdk_pixbuf_composite (emblem, trash_pixbuf_close, 0, 0, - MIN (gdk_pixbuf_get_width (emblem), - gdk_pixbuf_get_width (trash_pixbuf_close)), - MIN (gdk_pixbuf_get_height (emblem), - gdk_pixbuf_get_height (trash_pixbuf_close)), - 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); - g_object_unref (emblem); + GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp", + MODEST_ICON_SIZE_SMALL); + trash_pixbuf_close = gdk_pixbuf_copy (trash_pixbuf); + gdk_pixbuf_composite (emblem, trash_pixbuf_close, 0, 0, + MIN (gdk_pixbuf_get_width (emblem), + gdk_pixbuf_get_width (trash_pixbuf_close)), + MIN (gdk_pixbuf_get_height (emblem), + gdk_pixbuf_get_height (trash_pixbuf_close)), + 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); + g_object_unref (emblem); } - - + + pixbuf = g_object_ref (trash_pixbuf); pixbuf_open = g_object_ref (trash_pixbuf_open); pixbuf_close = g_object_ref (trash_pixbuf_close); @@ -815,10 +838,12 @@ get_folder_icons (TnyFolderType type, GObject *instance) break; case TNY_FOLDER_TYPE_DRAFTS: if (!draft_pixbuf) - draft_pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (MODEST_FOLDER_ICON_DRAFTS)); - + draft_pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (MODEST_FOLDER_ICON_DRAFTS, + MODEST_ICON_SIZE_SMALL)); + if (!draft_pixbuf_open) { - GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp"); + GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp", + MODEST_ICON_SIZE_SMALL); draft_pixbuf_open = gdk_pixbuf_copy (draft_pixbuf); gdk_pixbuf_composite (emblem, draft_pixbuf_open, 0, 0, MIN (gdk_pixbuf_get_width (emblem), @@ -830,7 +855,8 @@ get_folder_icons (TnyFolderType type, GObject *instance) } if (!draft_pixbuf_close) { - GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp"); + GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp", + MODEST_ICON_SIZE_SMALL); draft_pixbuf_close = gdk_pixbuf_copy (draft_pixbuf); gdk_pixbuf_composite (emblem, draft_pixbuf_close, 0, 0, MIN (gdk_pixbuf_get_width (emblem), @@ -849,34 +875,37 @@ get_folder_icons (TnyFolderType type, GObject *instance) break; case TNY_FOLDER_TYPE_NORMAL: default: - if (!normal_pixbuf) - normal_pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (MODEST_FOLDER_ICON_NORMAL)); - - if (!normal_pixbuf_open) { - GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp"); - normal_pixbuf_open = gdk_pixbuf_copy (normal_pixbuf); - gdk_pixbuf_composite (emblem, normal_pixbuf_open, 0, 0, - MIN (gdk_pixbuf_get_width (emblem), - gdk_pixbuf_get_width (normal_pixbuf_open)), - MIN (gdk_pixbuf_get_height (emblem), - gdk_pixbuf_get_height (normal_pixbuf_open)), - 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); - g_object_unref (emblem); - } - - if (!normal_pixbuf_close) { - GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp"); - normal_pixbuf_close = gdk_pixbuf_copy (normal_pixbuf); - gdk_pixbuf_composite (emblem, normal_pixbuf_close, 0, 0, - MIN (gdk_pixbuf_get_width (emblem), - gdk_pixbuf_get_width (normal_pixbuf_close)), - MIN (gdk_pixbuf_get_height (emblem), - gdk_pixbuf_get_height (normal_pixbuf_close)), - 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); - g_object_unref (emblem); - } - - + if (!normal_pixbuf) + normal_pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (MODEST_FOLDER_ICON_NORMAL, + MODEST_ICON_SIZE_SMALL)); + + if (!normal_pixbuf_open) { + GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp", + MODEST_ICON_SIZE_SMALL); + normal_pixbuf_open = gdk_pixbuf_copy (normal_pixbuf); + gdk_pixbuf_composite (emblem, normal_pixbuf_open, 0, 0, + MIN (gdk_pixbuf_get_width (emblem), + gdk_pixbuf_get_width (normal_pixbuf_open)), + MIN (gdk_pixbuf_get_height (emblem), + gdk_pixbuf_get_height (normal_pixbuf_open)), + 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); + g_object_unref (emblem); + } + + if (!normal_pixbuf_close) { + GdkPixbuf *emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp", + MODEST_ICON_SIZE_SMALL); + normal_pixbuf_close = gdk_pixbuf_copy (normal_pixbuf); + gdk_pixbuf_composite (emblem, normal_pixbuf_close, 0, 0, + MIN (gdk_pixbuf_get_width (emblem), + gdk_pixbuf_get_width (normal_pixbuf_close)), + MIN (gdk_pixbuf_get_height (emblem), + gdk_pixbuf_get_height (normal_pixbuf_close)), + 0, 0, 1, 1, GDK_INTERP_NEAREST, 255); + g_object_unref (emblem); + } + + pixbuf = g_object_ref (normal_pixbuf); pixbuf_open = g_object_ref (normal_pixbuf_open); pixbuf_close = g_object_ref (normal_pixbuf_close); diff --git a/src/widgets/modest-header-view-render.c b/src/widgets/modest-header-view-render.c index 7c41c95..6cc8e9a 100644 --- a/src/widgets/modest-header-view-render.c +++ b/src/widgets/modest-header-view-render.c @@ -78,29 +78,35 @@ get_pixbuf_for_flag (TnyHeaderFlags flag) switch (flag) { case TNY_HEADER_FLAG_DELETED: if (G_UNLIKELY(!deleted_pixbuf)) - deleted_pixbuf = modest_platform_get_icon (MODEST_HEADER_ICON_DELETED); + deleted_pixbuf = modest_platform_get_icon (MODEST_HEADER_ICON_DELETED, + MODEST_ICON_SIZE_SMALL); return deleted_pixbuf; case TNY_HEADER_FLAG_SEEN: if (G_UNLIKELY(!seen_pixbuf)) - seen_pixbuf = modest_platform_get_icon (MODEST_HEADER_ICON_READ); + seen_pixbuf = modest_platform_get_icon (MODEST_HEADER_ICON_READ, + MODEST_ICON_SIZE_SMALL); return seen_pixbuf; case TNY_HEADER_FLAG_ATTACHMENTS: if (G_UNLIKELY(!attachments_pixbuf)) - attachments_pixbuf = modest_platform_get_icon (MODEST_HEADER_ICON_ATTACH); + attachments_pixbuf = modest_platform_get_icon (MODEST_HEADER_ICON_ATTACH, + MODEST_ICON_SIZE_SMALL); return attachments_pixbuf; case TNY_HEADER_FLAG_HIGH_PRIORITY: if (G_UNLIKELY(!high_pixbuf)) - high_pixbuf = modest_platform_get_icon (MODEST_HEADER_ICON_HIGH); + high_pixbuf = modest_platform_get_icon (MODEST_HEADER_ICON_HIGH, + MODEST_ICON_SIZE_SMALL); return high_pixbuf; case TNY_HEADER_FLAG_LOW_PRIORITY: if (G_UNLIKELY(!low_pixbuf)) - low_pixbuf = modest_platform_get_icon (MODEST_HEADER_ICON_LOW); + low_pixbuf = modest_platform_get_icon (MODEST_HEADER_ICON_LOW, + MODEST_ICON_SIZE_SMALL); return low_pixbuf; case TNY_HEADER_FLAG_NORMAL_PRIORITY: return NULL; default: if (G_UNLIKELY(!unread_pixbuf)) - unread_pixbuf = modest_platform_get_icon (MODEST_HEADER_ICON_UNREAD); + unread_pixbuf = modest_platform_get_icon (MODEST_HEADER_ICON_UNREAD, + MODEST_ICON_SIZE_SMALL); return unread_pixbuf; } } -- 1.7.9.5