aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-categories-config.c
diff options
context:
space:
mode:
Diffstat (limited to 'e-util/e-categories-config.c')
-rw-r--r--e-util/e-categories-config.c61
1 files changed, 54 insertions, 7 deletions
diff --git a/e-util/e-categories-config.c b/e-util/e-categories-config.c
index eb8e07b0c7..8d84826077 100644
--- a/e-util/e-categories-config.c
+++ b/e-util/e-categories-config.c
@@ -18,6 +18,7 @@
#include "e-categories-master-list-wombat.h"
typedef struct {
+ char *filename;
GdkPixmap *pixmap;
GdkBitmap *mask;
} icon_data_t;
@@ -158,8 +159,8 @@ void
e_categories_config_get_icon_for (const char *category, GdkPixmap **pixmap, GdkBitmap **mask)
{
icon_data_t *icon_data;
- char *tmp;
char *icon_file;
+ char *tmp;
g_return_if_fail (category != NULL);
g_return_if_fail (pixmap != NULL);
@@ -179,13 +180,59 @@ e_categories_config_get_icon_for (const char *category, GdkPixmap **pixmap, GdkB
tmp = g_strdup_printf ("General/Categories/%s/Icon", category);
icon_file = config_get_string (tmp);
g_free (tmp);
+
+ if (icon_file) {
+ /* add new pixmap from file to the list */
+ icon_data = g_new (icon_data_t, 1);
+ icon_data->filename = icon_file;
+ icon_data->pixmap = gdk_pixmap_create_from_xpm (NULL, &icon_data->mask, NULL, icon_file);
+ g_hash_table_insert (cat_icons, (gpointer) category, (gpointer) icon_data);
+
+ *pixmap = icon_data->pixmap;
+ if (*mask)
+ *mask = icon_data->mask;
+ }
+ else {
+ *pixmap = NULL;
+ if (mask != NULL)
+ *mask = NULL;
+ }
+}
+
+/**
+ * e_categories_config_get_icon_file_for
+ * @category: Category for which to get the icon file
+ */
+const char *
+e_categories_config_get_icon_file_for (const char *category)
+{
+ icon_data_t *icon_data;
+ char *icon_file;
+ char *tmp;
+
+ g_return_val_if_fail (category != NULL, NULL);
+
+ if (!initialized)
+ initialize_categories_config ();
+
+ icon_data = g_hash_table_lookup (cat_icons, category);
+ if (icon_data != NULL)
+ return (const char *) icon_data->filename;
+
+ /* not found, so look in the configuration */
+ tmp = g_strdup_printf ("General/Categories/%s/Icon", category);
+ icon_file = config_get_string (tmp);
+ g_free (tmp);
+
if (icon_file) {
- g_free (icon_file);
+ /* add new pixmap from file to the list */
+ icon_data = g_new (icon_data_t, 1);
+ icon_data->filename = icon_file;
+ icon_data->pixmap = gdk_pixmap_create_from_xpm (NULL, &icon_data->mask, NULL, icon_file);
+ g_hash_table_insert (cat_icons, (gpointer) category, (gpointer) icon_data);
}
- *pixmap = NULL;
- if (mask != NULL)
- *mask = NULL;
+ return (const char *) icon_file;
}
/**
@@ -211,11 +258,13 @@ e_categories_config_set_icon_for (const char *category, const char *pixmap_file)
gdk_pixmap_unref (icon_data->pixmap);
gdk_bitmap_unref (icon_data->mask);
+ g_free (icon_data->filename);
g_free (icon_data);
}
/* add new pixmap from file to the list */
icon_data = g_new (icon_data_t, 1);
+ icon_data->filename = g_strdup (pixmap_file);
icon_data->pixmap = gdk_pixmap_create_from_xpm (NULL, &icon_data->mask, NULL, pixmap_file);
g_hash_table_insert (cat_icons, (gpointer) category, (gpointer) icon_data);
@@ -242,8 +291,6 @@ e_categories_config_open_dialog_for_entry (GtkEntry *entry)
char *categories;
GnomeDialog *dialog;
int result;
- GString *cat_icons;
- GString *cat_colors;
ECategoriesMasterList *ecml;
g_return_if_fail (entry != NULL);
ons'>+4 * - flat layoutdinoex2003-07-261-48/+48 * - don't package ~/GNUSstepdinoex2003-06-181-8/+0 * - remove empty dirsdinoex2003-06-101-0/+10 * - Add WITH_GNUSTEP_DEVELdinoex2003-06-011-3/+3 * - Use libobjc.sodinoex2003-04-131-25/+8 * - add stamp.makedinoex2003-03-051-1/+2 * - Update for gnustep 1.5.2 and gui 0.8.4dinoex2003-02-272-1/+12 * - retire pkg-commentdinoex2003-02-211-1/+0 * - add COMMENTdinoex2003-02-211-0/+1 * - Catch up implicit dependency of ffcalldinoex2003-01-251-1/+2 * - Avoid installation of Clock and PGP in GNUSTEP_USER_DIRdinoex2003-01-204-0/+74 * - Update to use gnustep-back instead of gnustep-xgpsdinoex2003-01-201-13/+0 * - use new backend as defaultdinoex2003-01-021-5/+5 * - update MASTER_SITESdinoex2002-12-041-1/+2 * Fix package build on bento caused by gnustep-make-1.5.1dinoex2002-11-271-45/+0 * remove obsolete dirdinoex2002-11-131-6/+0 * - use PKGNAMESUFFIXdinoex2002-10-301-0/+3 * Update MASTER_SITESdinoex2002-10-301-2/+1 * support for gnustep-back, option GNUSTEP_GUI_DEVELdinoex2002-10-291-6/+16 * - Update to 1.0.3dinoex2002-10-263-24/+48 * Remove USE_NEWGCC, which is no longer supported or required.kris2002-08-311-1/+0 * - Take Maintainershipdinoex2002-06-081-1/+1 * Update to: Pantomime-1.0.4dinoex2002-06-043-19/+22 * Add new MASTER_SITESpat2002-03-301-1/+2