From 7c3a6662fe5da0353f31c4385e97f6b19c35e511 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Fri, 2 Mar 2001 23:38:12 +0000 Subject: Added option menu to vfolder editor. 2001-03-03 Not Zed * filter.glade: Added option menu to vfolder editor. 2001-03-02 Not Zed * vfolder-rule.c (get_widget): Setup the data on the base source opiton menu, and make hte option menu reflect the source. (select_source_with): Set the source type for this rule. e.g. these folders, "with ..." * filter-editor.c: Removed the N_() stuff from the source_names array, they must not be internationalised!!! svn path=/trunk/; revision=8533 --- filter/vfolder-rule.c | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'filter/vfolder-rule.c') diff --git a/filter/vfolder-rule.c b/filter/vfolder-rule.c index 322e3eabb7..8c58d0ba5e 100644 --- a/filter/vfolder-rule.c +++ b/filter/vfolder-rule.c @@ -258,6 +258,14 @@ select_source(GtkWidget *w, GtkWidget *child, struct _source_data *data) set_sensitive(data); } +static void +select_source_with(GtkWidget *w, struct _source_data *data) +{ + char *source = gtk_object_get_data((GtkObject *)w, "source"); + + filter_rule_set_source((FilterRule *)data->vr, source); +} + static void source_add(GtkWidget *widget, struct _source_data *data) { const char *allowed_types[] = { "mail", NULL }; @@ -313,6 +321,14 @@ static void source_remove(GtkWidget *widget, struct _source_data *data) set_sensitive(data); } +/* DO NOT internationalise these strings */ +const char *source_names[] = { + "specific", + "local", + "remote_active", + "local_remote_active" +}; + static GtkWidget *get_widget(FilterRule *fr, struct _RuleContext *f) { GtkWidget *widget, *frame, *w; @@ -320,7 +336,7 @@ static GtkWidget *get_widget(FilterRule *fr, struct _RuleContext *f) const char *source; VfolderRule *vr = (VfolderRule *)fr; struct _source_data *data; - int i; + int i, row; GList *l; widget = ((FilterRuleClass *)(parent_class))->get_widget(fr, f); @@ -354,6 +370,31 @@ static GtkWidget *get_widget(FilterRule *fr, struct _RuleContext *f) } gtk_list_append_items(data->list, l); gtk_signal_connect((GtkObject *)w, "select_child", select_source, data); + + w = glade_xml_get_widget (gui, "source_option"); + l = GTK_MENU_SHELL (GTK_OPTION_MENU (w)->menu)->children; + i = 0; + row = 0; + while (l) { + GtkWidget *b = GTK_WIDGET (l->data); + + /* make sure that the glade is in sync with the source list! */ + if (i < sizeof (source_names) / sizeof (source_names[0])) { + gtk_object_set_data (GTK_OBJECT (b), "source", (char *)source_names[i]); + if (fr->source && strcmp(source_names[i], fr->source) == 0) { + row = i; + } + } else { + g_warning("Glade file " FILTER_GLADEDIR "/filter.glade out of sync with editor code"); + } + gtk_signal_connect (GTK_OBJECT (b), "activate", select_source_with, data); + + i++; + l = l->next; + } + + gtk_option_menu_set_history(GTK_OPTION_MENU(w), row); + set_sensitive(data); gtk_box_pack_start(GTK_BOX(widget), frame, TRUE, TRUE, 3); -- cgit