aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-folder.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-folder.c
parentcf89cb7e60e13f38c6530fe1ccd33f42a79d8497 (diff)
downloadgsoc2013-evolution-779e0f5058e089279c2851e18ef7003ec88bb61f.tar
gsoc2013-evolution-779e0f5058e089279c2851e18ef7003ec88bb61f.tar.gz
gsoc2013-evolution-779e0f5058e089279c2851e18ef7003ec88bb61f.tar.bz2
gsoc2013-evolution-779e0f5058e089279c2851e18ef7003ec88bb61f.tar.lz
gsoc2013-evolution-779e0f5058e089279c2851e18ef7003ec88bb61f.tar.xz
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-folder.c')
-rw-r--r--shell/e-folder.c55
1 files changed, 51 insertions, 4 deletions
diff --git a/shell/e-folder.c b/shell/e-folder.c
index 6f78e48db3..0dd6c1ff10 100644
--- a/shell/e-folder.c
+++ b/shell/e-folder.c
@@ -49,6 +49,10 @@ struct _EFolderPrivate {
unsigned int self_highlight : 1;
unsigned int is_stock : 1;
unsigned int can_sync_offline : 1;
+
+ /* Custom icon for this folder; if NULL the folder will just use the
+ icon for its type. */
+ char *custom_icon_name;
};
#define EF_CLASS(obj) \
@@ -112,6 +116,8 @@ destroy (GtkObject *object)
g_free (priv->description);
g_free (priv->physical_uri);
+ g_free (priv->custom_icon_name);
+
g_free (priv);
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
@@ -158,6 +164,7 @@ init (EFolder *folder)
priv->self_highlight = FALSE;
priv->is_stock = FALSE;
priv->can_sync_offline = FALSE;
+ priv->custom_icon_name = NULL;
folder->priv = priv;
}
@@ -267,6 +274,29 @@ e_folder_get_is_stock (EFolder *folder)
return folder->priv->is_stock;
}
+gboolean
+e_folder_get_can_sync_offline (EFolder *folder)
+{
+ g_return_val_if_fail (E_IS_FOLDER (folder), FALSE);
+
+ return folder->priv->can_sync_offline;
+}
+
+/**
+ * e_folder_get_custom_icon:
+ * @folder: An EFolder
+ *
+ * Get the name of the custom icon for @folder, or NULL if no custom icon is
+ * associated with it
+ **/
+const char *
+e_folder_get_custom_icon_name (EFolder *folder)
+{
+ g_return_val_if_fail (E_IS_FOLDER (folder), NULL);
+
+ return folder->priv->custom_icon_name;
+}
+
void
e_folder_set_name (EFolder *folder,
@@ -380,12 +410,29 @@ e_folder_set_can_sync_offline (EFolder *folder,
gtk_signal_emit (GTK_OBJECT (folder), signals[CHANGED]);
}
-gboolean
-e_folder_get_can_sync_offline (EFolder *folder)
+/**
+ * e_folder_set_custom_icon_name:
+ * @folder: An EFolder
+ * @icon_name: Name of the icon to be set (to be found in the standard
+ * Evolution icon dir)
+ *
+ * Set a custom icon for @folder (thus overriding the default icon, which is
+ * the one associated to the type of the folder).
+ **/
+void
+e_folder_set_custom_icon (EFolder *folder,
+ const char *icon_name)
{
- g_return_val_if_fail (E_IS_FOLDER (folder), FALSE);
+ g_return_if_fail (E_IS_FOLDER (folder));
- return folder->priv->can_sync_offline;
+ if (icon_name != folder->priv->custom_icon_name) {
+ g_free (folder->priv->custom_icon_name);
+
+ if (icon_name == NULL)
+ folder->priv->custom_icon_name = NULL;
+ else
+ folder->priv->custom_icon_name = g_strdup (icon_name);
+ }
}