aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-storage-set-view.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2002-07-10 01:06:19 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2002-07-10 01:06:19 +0800
commit779e0f5058e089279c2851e18ef7003ec88bb61f (patch)
tree93f0fd3b5d40fb2f137559a99df776c322e3e919 /shell/e-storage-set-view.c
parentcf89cb7e60e13f38c6530fe1ccd33f42a79d8497 (diff)
downloadgsoc2013-evolution-779e0f5058e089279c2851e18ef7003ec88bb61f.tar.gz
gsoc2013-evolution-779e0f5058e089279c2851e18ef7003ec88bb61f.tar.zst
gsoc2013-evolution-779e0f5058e089279c2851e18ef7003ec88bb61f.zip
Call e_icon_factory_init().
* main.c (main): Call e_icon_factory_init(). * e-local-storage.c (setup_folder_as_stock): New arg @icon_name; if not NULL, set up a custom icon for the folder. (setup_stock_folders): Set up custom icons for inbox and outbox. * e-storage-set-view.c (get_pixbuf_for_folder): If the folder has a custom icon, return the custom icon. * e-folder.c: New member custom_icon_name. (init): Initialize to NULL. (destroy): Free. (e_folder_get_custom_icon): New. (e_folder_set_custom_icon): New. svn path=/trunk/; revision=17391
Diffstat (limited to 'shell/e-storage-set-view.c')
-rw-r--r--shell/e-storage-set-view.c72
1 files changed, 38 insertions, 34 deletions
diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c
index 7bfb88e04f..a166796025 100644
--- a/shell/e-storage-set-view.c
+++ b/shell/e-storage-set-view.c
@@ -253,53 +253,57 @@ static GdkPixbuf *
get_pixbuf_for_folder (EStorageSetView *storage_set_view,
EFolder *folder)
{
- GdkPixbuf *scaled_pixbuf;
const char *type_name;
EStorageSetViewPrivate *priv;
+ EFolderTypeRegistry *folder_type_registry;
+ EStorageSet *storage_set;
+ GdkPixbuf *icon_pixbuf;
+ GdkPixbuf *scaled_pixbuf;
+ const char *custom_icon_name;
+ int icon_pixbuf_width, icon_pixbuf_height;
priv = storage_set_view->priv;
-
- type_name = e_folder_get_type_string (folder);
-
- scaled_pixbuf = g_hash_table_lookup (priv->type_name_to_pixbuf, type_name);
- if (scaled_pixbuf == NULL) {
- EFolderTypeRegistry *folder_type_registry;
- EStorageSet *storage_set;
- GdkPixbuf *icon_pixbuf;
- int icon_pixbuf_width, icon_pixbuf_height;
+ custom_icon_name = e_folder_get_custom_icon_name (folder);
+ if (custom_icon_name != NULL)
+ return e_icon_factory_get_icon (custom_icon_name, TRUE);
- storage_set = priv->storage_set;
- folder_type_registry = e_storage_set_get_folder_type_registry (storage_set);
+ type_name = e_folder_get_type_string (folder);
- icon_pixbuf = e_folder_type_registry_get_icon_for_type (folder_type_registry,
- type_name, TRUE);
+ scaled_pixbuf = g_hash_table_lookup (priv->type_name_to_pixbuf, type_name);
+ if (scaled_pixbuf != NULL)
+ return scaled_pixbuf;
- if (icon_pixbuf == NULL)
- return NULL;
+ storage_set = priv->storage_set;
+ folder_type_registry = e_storage_set_get_folder_type_registry (storage_set);
- icon_pixbuf_width = gdk_pixbuf_get_width (icon_pixbuf);
- icon_pixbuf_height = gdk_pixbuf_get_height (icon_pixbuf);
+ icon_pixbuf = e_folder_type_registry_get_icon_for_type (folder_type_registry,
+ type_name, TRUE);
- if (icon_pixbuf_width == E_SHELL_MINI_ICON_SIZE && icon_pixbuf_height == E_SHELL_MINI_ICON_SIZE) {
- scaled_pixbuf = gdk_pixbuf_ref (icon_pixbuf);
- } else {
- scaled_pixbuf = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (icon_pixbuf),
- gdk_pixbuf_get_has_alpha (icon_pixbuf),
- gdk_pixbuf_get_bits_per_sample (icon_pixbuf),
- E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE);
-
- gdk_pixbuf_scale (icon_pixbuf, scaled_pixbuf,
- 0, 0, E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE,
- 0.0, 0.0,
- (double) E_SHELL_MINI_ICON_SIZE / gdk_pixbuf_get_width (icon_pixbuf),
- (double) E_SHELL_MINI_ICON_SIZE / gdk_pixbuf_get_height (icon_pixbuf),
- GDK_INTERP_HYPER);
- }
+ if (icon_pixbuf == NULL)
+ return NULL;
- g_hash_table_insert (priv->type_name_to_pixbuf, g_strdup (type_name), scaled_pixbuf);
+ icon_pixbuf_width = gdk_pixbuf_get_width (icon_pixbuf);
+ icon_pixbuf_height = gdk_pixbuf_get_height (icon_pixbuf);
+
+ if (icon_pixbuf_width == E_SHELL_MINI_ICON_SIZE && icon_pixbuf_height == E_SHELL_MINI_ICON_SIZE) {
+ scaled_pixbuf = gdk_pixbuf_ref (icon_pixbuf);
+ } else {
+ scaled_pixbuf = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (icon_pixbuf),
+ gdk_pixbuf_get_has_alpha (icon_pixbuf),
+ gdk_pixbuf_get_bits_per_sample (icon_pixbuf),
+ E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE);
+
+ gdk_pixbuf_scale (icon_pixbuf, scaled_pixbuf,
+ 0, 0, E_SHELL_MINI_ICON_SIZE, E_SHELL_MINI_ICON_SIZE,
+ 0.0, 0.0,
+ (double) E_SHELL_MINI_ICON_SIZE / gdk_pixbuf_get_width (icon_pixbuf),
+ (double) E_SHELL_MINI_ICON_SIZE / gdk_pixbuf_get_height (icon_pixbuf),
+ GDK_INTERP_HYPER);
}
+ g_hash_table_insert (priv->type_name_to_pixbuf, g_strdup (type_name), scaled_pixbuf);
+
return scaled_pixbuf;
}