diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-01-04 06:03:13 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-01-04 06:03:13 +0800 |
commit | de51c2f598c39b47979be68bc35ae992da0a40ad (patch) | |
tree | c3c0288c558e07d58249151f15183433571cbb66 | |
parent | 9159b2df56c5861445b6fe98af8348e31e7483d0 (diff) | |
download | gsoc2013-evolution-de51c2f598c39b47979be68bc35ae992da0a40ad.tar.gz gsoc2013-evolution-de51c2f598c39b47979be68bc35ae992da0a40ad.tar.zst gsoc2013-evolution-de51c2f598c39b47979be68bc35ae992da0a40ad.zip |
Get the account name because that is the string we'd like to use for
2002-01-03 Jeffrey Stedfast <fejj@ximian.com>
* filter-source.c (filter_source_get_sources): Get the account
name because that is the string we'd like to use for display.
(get_widget): Generate the account label the same as we do for the
composer's From optionmenu.
(filter_source_finalize): Free the account_name.
(clone): Pass along the account_name member to filter_add_source
svn path=/trunk/; revision=15241
-rw-r--r-- | filter/ChangeLog | 9 | ||||
-rw-r--r-- | filter/filter-source.c | 48 | ||||
-rw-r--r-- | filter/libfilter-i18n.h | 10 |
3 files changed, 40 insertions, 27 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog index 5b880e4125..2e8788bd8c 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -1,3 +1,12 @@ +2002-01-03 Jeffrey Stedfast <fejj@ximian.com> + + * filter-source.c (filter_source_get_sources): Get the account + name because that is the string we'd like to use for display. + (get_widget): Generate the account label the same as we do for the + composer's From optionmenu. + (filter_source_finalize): Free the account_name. + (clone): Pass along the account_name member to filter_add_source + 2002-01-02 Jeffrey Stedfast <fejj@ximian.com> * vfoldertypes.xml: Make the date comparisons read the same as the diff --git a/filter/filter-source.c b/filter/filter-source.c index 9574163344..cbab6e254f 100644 --- a/filter/filter-source.c +++ b/filter/filter-source.c @@ -39,14 +39,15 @@ typedef struct _SourceInfo SourceInfo; struct _SourceInfo { - gchar *name; - gchar *address; - gchar *url; + char *account_name; + char *name; + char *address; + char *url; }; struct _FilterSourcePrivate { GList *sources; - gchar *current_url; + char *current_url; }; static FilterElementClass *parent_class = NULL; @@ -68,7 +69,8 @@ static GtkWidget *get_widget(FilterElement *fe); static void build_code(FilterElement *fe, GString *out, struct _FilterPart *ff); static void format_sexp(FilterElement *, GString *); -static void filter_source_add_source (FilterSource *fs, const gchar *name, const gchar *addr, const gchar *url); +static void filter_source_add_source (FilterSource *fs, const char *account_name, const char *name, + const char *addr, const char *url); static void filter_source_get_sources (FilterSource *fs); @@ -133,6 +135,7 @@ filter_source_finalize (GtkObject *obj) while (i) { SourceInfo *info = i->data; + g_free (info->account_name); g_free (info->name); g_free (info->address); g_free (info->url); @@ -183,7 +186,6 @@ static gint xml_decode (FilterElement *fe, xmlNodePtr node) { FilterSource *fs = (FilterSource *) fe; - gchar *value; node = node->childs; if (node && node->name && !strcmp (node->name, "uri")) { @@ -207,7 +209,7 @@ clone (FilterElement *fe) for (i = fs->priv->sources; i != NULL; i = g_list_next (i)) { SourceInfo *info = (SourceInfo *) i->data; - filter_source_add_source (cpy, info->name, info->address, info->url); + filter_source_add_source (cpy, info->account_name, info->name, info->address, info->url); } return (FilterElement *) cpy; @@ -231,7 +233,7 @@ get_widget (FilterElement *fe) GtkWidget *item; GList *i; SourceInfo *first = NULL; - gint index, current_index; + int index, current_index; if (fs->priv->sources == NULL) filter_source_get_sources (fs); @@ -243,14 +245,18 @@ get_widget (FilterElement *fe) for (i = fs->priv->sources; i != NULL; i = g_list_next (i)) { SourceInfo *info = (SourceInfo *) i->data; - gchar *label, *native_label; + char *label, *native_label; if (info->url != NULL) { - if (first == NULL) first = info; - label = g_strdup_printf ("%s <%s>", info->name, info->address); + if (info->account_name && strcmp (info->account_name, info->address)) + label = g_strdup_printf ("%s <%s> (%s)", info->name, + info->address, info->account_name); + else + label = g_strdup_printf ("%s <%s>", info->name, info->address); + native_label = e_utf8_to_gtk_string (GTK_WIDGET (menu), label); item = gtk_menu_item_new_with_label (native_label); g_free (label); @@ -303,12 +309,15 @@ format_sexp (FilterElement *fe, GString *out) static void -filter_source_add_source (FilterSource *fs, const gchar *name, const gchar *addr, const gchar *url) +filter_source_add_source (FilterSource *fs, const char *account_name, const char *name, + const char *addr, const char *url) { SourceInfo *info; + g_return_if_fail (fs && IS_FILTER_SOURCE (fs)); - + info = g_new0 (SourceInfo, 1); + info->account_name = g_strdup (account_name); info->name = g_strdup (name); info->address = g_strdup (addr); info->url = g_strdup (url); @@ -321,7 +330,7 @@ filter_source_get_sources (FilterSource *fs) { Bonobo_ConfigDatabase db; CORBA_Environment ev; - gint i, len; + int i, len; CORBA_exception_init (&ev); db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); @@ -336,11 +345,12 @@ filter_source_get_sources (FilterSource *fs) len = bonobo_config_get_long_with_default (db, "/Mail/Accounts/num", 0, NULL); for (i = 0; i < len; ++i) { - gchar *path; - gchar *name; - gchar *addr; - gchar *url; + char *path, *account_name, *name, *addr, *url; + path = g_strdup_printf ("/Mail/Accounts/account_name_%d", i); + account_name = bonobo_config_get_string (db, path, NULL); + g_free (path); + path = g_strdup_printf ("/Mail/Accounts/identity_name_%d", i); name = bonobo_config_get_string (db, path, NULL); g_free (path); @@ -353,7 +363,7 @@ filter_source_get_sources (FilterSource *fs) url = bonobo_config_get_string (db, path, NULL); g_free (path); - filter_source_add_source (fs, name, addr, url); + filter_source_add_source (fs, account_name, name, addr, url); g_free (name); g_free (addr); diff --git a/filter/libfilter-i18n.h b/filter/libfilter-i18n.h index 892c288dab..03fd35443f 100644 --- a/filter/libfilter-i18n.h +++ b/filter/libfilter-i18n.h @@ -1,9 +1,7 @@ /* Automatically generated. Do not edit. */ -char *s = N_("after"); char *s = N_("Assign Color"); char *s = N_("Assign Score"); char *s = N_("Attachments"); -char *s = N_("before"); char *s = N_("contains"); char *s = N_("Copy to Folder"); char *s = N_("Date received"); @@ -24,18 +22,16 @@ char *s = N_("exists"); char *s = N_("Expression"); char *s = N_("Important"); char *s = N_("is"); +char *s = N_("is after"); +char *s = N_("is before"); char *s = N_("is greater than"); char *s = N_("is less than"); char *s = N_("is not"); char *s = N_("Mailing list"); char *s = N_("Message Body"); char *s = N_("Message Header"); -char *s = N_("Message was received"); -char *s = N_("Message was sent"); char *s = N_("Move to Folder"); char *s = N_("Needs Reply"); -char *s = N_("on or after"); -char *s = N_("on or before"); char *s = N_("Read"); char *s = N_("Recipients"); char *s = N_("Regex Match"); @@ -51,5 +47,3 @@ char *s = N_("starts with"); char *s = N_("Status"); char *s = N_("Stop Processing"); char *s = N_("Subject"); -char *s = N_("was after"); -char *s = N_("was before"); |