aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-11-21 03:49:55 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-11-21 03:49:55 +0800
commit83f24bfbbf99c544c9ee7ca909f8b40ba25b979c (patch)
tree98d7705fb811680b8a4f8e2a7de051d5bfa11068
parent4cbc116b10caf9f533ab399fbf8a2c5fa450315d (diff)
downloadgsoc2013-evolution-83f24bfbbf99c544c9ee7ca909f8b40ba25b979c.tar
gsoc2013-evolution-83f24bfbbf99c544c9ee7ca909f8b40ba25b979c.tar.gz
gsoc2013-evolution-83f24bfbbf99c544c9ee7ca909f8b40ba25b979c.tar.bz2
gsoc2013-evolution-83f24bfbbf99c544c9ee7ca909f8b40ba25b979c.tar.lz
gsoc2013-evolution-83f24bfbbf99c544c9ee7ca909f8b40ba25b979c.tar.xz
gsoc2013-evolution-83f24bfbbf99c544c9ee7ca909f8b40ba25b979c.tar.zst
gsoc2013-evolution-83f24bfbbf99c544c9ee7ca909f8b40ba25b979c.zip
gconfify.
2002-11-20 Jeffrey Stedfast <fejj@ximian.com> * filter-label.c (xml_create): gconfify. svn path=/trunk/; revision=18861
-rw-r--r--filter/ChangeLog4
-rw-r--r--filter/filter-label.c64
2 files changed, 42 insertions, 26 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index cb0d1991e0..c2d3ec49f5 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,3 +1,7 @@
+2002-11-20 Jeffrey Stedfast <fejj@ximian.com>
+
+ * filter-label.c (xml_create): gconfify.
+
2002-11-18 Jeffrey Stedfast <fejj@ximian.com>
* rule-editor.c: Updated to use GtkTreeView.
diff --git a/filter/filter-label.c b/filter/filter-label.c
index d6521a94d8..bd83c32d90 100644
--- a/filter/filter-label.c
+++ b/filter/filter-label.c
@@ -30,6 +30,7 @@
#include <gtk/gtk.h>
#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-dialog.h>
#include <libgnomeui/gnome-dialog-util.h>
@@ -113,41 +114,41 @@ filter_label_new (void)
return (FilterLabel *) g_object_new (FILTER_TYPE_LABEL, NULL, NULL);
}
-
static struct {
- char *path;
char *title;
char *value;
} labels[] = {
- { "/Mail/Labels/label_0", N_("Important"), "important" },
- { "/Mail/Labels/label_1", N_("Work"), "work" },
- { "/Mail/Labels/label_2", N_("Personal"), "personal" },
- { "/Mail/Labels/label_3", N_("To Do"), "todo" },
- { "/Mail/Labels/label_4", N_("Later"), "later" },
+ { N_("Important"), "important" },
+ { N_("Work"), "work" },
+ { N_("Personal"), "personal" },
+ { N_("To Do"), "todo" },
+ { N_("Later"), "later" },
};
-int filter_label_count(void)
+int filter_label_count (void)
{
- return sizeof(labels)/sizeof(labels[0]);
+ return sizeof (labels) / sizeof (labels[0]);
}
-const char *filter_label_label(int i)
+const char *
+filter_label_label (int i)
{
- if (i<0 || i >= sizeof(labels)/sizeof(labels[0]))
+ if (i < 0 || i >= sizeof (labels) / sizeof (labels[0]))
return NULL;
else
return labels[i].value;
}
-int filter_label_index(const char *label)
+int
+filter_label_index (const char *label)
{
int i;
-
- for (i=0;i<sizeof(labels)/sizeof(labels[0]);i++) {
- if (strcmp(labels[i].value, label) == 0)
+
+ for (i = 0; i < sizeof (labels) / sizeof (labels[0]); i++) {
+ if (strcmp (labels[i].value, label) == 0)
return i;
}
-
+
return -1;
}
@@ -155,17 +156,28 @@ static void
xml_create (FilterElement *fe, xmlNodePtr node)
{
FilterOption *fo = (FilterOption *) fe;
- int i;
-
- FILTER_ELEMENT_CLASS (parent_class)->xml_create (fe, node);
+ GConfClient *gconf;
+ GSList *list, *l;
+ const char *p;
+ char *title;
+ int i = 0;
- /* FIXME: probably use gconf_client_get_list() here? */
-
- /* just hardcode some stuff for now */
- for (i=0;i<sizeof(labels)/sizeof(labels[0]);i++) {
- const char *title;
+ FILTER_ELEMENT_CLASS (parent_class)->xml_create (fe, node);
+
+ gconf = gconf_client_get_default ();
+#warning "do we have to free the list data returned from gconf_client_get_list() ???"
+ l = list = gconf_client_get_list (gconf, "/apps/evolution/mail/labels", GCONF_VALUE_STRING, NULL);
+ while (l != NULL && i < 5) {
+ title = (char *) l->data;
+ if ((p = strrchr (title, ':')))
+ title = g_strndup (title, p - title);
+ else
+ title = g_strdup (title);
+
+ filter_option_add (fo, labels[i++].value, title, NULL);
+ g_free (title);
- title = _(labels[i].title);
- filter_option_add(fo, labels[i].value, title, NULL);
+ l = l->next;
}
+ g_slist_free (list);
}