aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--filter/ChangeLog11
-rw-r--r--filter/filter-option.c19
-rw-r--r--filter/filter-system-flag.c24
-rw-r--r--filter/filtertypes.xml2
-rw-r--r--filter/libfilter-i18n.h36
5 files changed, 65 insertions, 27 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index a1b483dc4a..dfc3602574 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,3 +1,14 @@
+2001-01-10 Jeffrey Stedfast <fejj@helixcode.com>
+
+ * filter-option.c (get_widget): Attach to the "activate" signal -
+ this should now make it so that a filter-option will "remember"
+ what a user changed.
+
+ * filter-system-flag.c (get_widget): Don't reset fsf->value to the
+ first system flag, this should already be defaulted to the
+ appropriate flag. This should fix the problem of always defaulting
+ to the first menu option and thus "forgetting" the user's settings.
+
2001-01-04 Jeffrey Stedfast <fejj@helixcode.com>
* filter-system-flag.c: comment out some of the system flags as we
diff --git a/filter/filter-option.c b/filter/filter-option.c
index 658136f0cb..3b3660dd5c 100644
--- a/filter/filter-option.c
+++ b/filter/filter-option.c
@@ -239,6 +239,14 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
return 0;
}
+static void
+option_changed (GtkWidget *widget, FilterElement *fe)
+{
+ FilterOption *fo = (FilterOption *)fe;
+
+ fo->current = gtk_object_get_data (GTK_OBJECT (widget), "option");
+}
+
static GtkWidget *
get_widget (FilterElement *fe)
{
@@ -246,6 +254,7 @@ get_widget (FilterElement *fe)
GtkWidget *menu;
GtkWidget *omenu;
GtkWidget *item;
+ GtkWidget *first = NULL;
GList *l = fo->options;
struct _filter_option *op;
int index = 0, current = 0;
@@ -253,12 +262,16 @@ get_widget (FilterElement *fe)
menu = gtk_menu_new ();
while (l) {
op = l->data;
- item = gtk_menu_item_new_with_label (_(op->title));
+ item = gtk_menu_item_new_with_label (op->title);
gtk_object_set_data (GTK_OBJECT (item), "option", op);
+ gtk_signal_connect (GTK_OBJECT (item), "activate", option_changed, fe);
gtk_menu_append (GTK_MENU (menu), item);
gtk_widget_show (item);
if (op == fo->current) {
current = index;
+ first = item;
+ } else if (!first) {
+ first = item;
}
l = g_list_next (l);
@@ -267,6 +280,10 @@ get_widget (FilterElement *fe)
omenu = gtk_option_menu_new ();
gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
+
+ if (first)
+ gtk_signal_emit_by_name (GTK_OBJECT (first), "activate", fe);
+
gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), current);
return omenu;
diff --git a/filter/filter-system-flag.c b/filter/filter-system-flag.c
index f1eb2a5b10..3667876e23 100644
--- a/filter/filter-system-flag.c
+++ b/filter/filter-system-flag.c
@@ -69,12 +69,12 @@ struct _system_flag {
};
static struct _system_flag *
-find_option (const char *name)
+find_option (const char *value)
{
struct _system_flag *flag;
for (flag = system_flags; flag->title; flag++) {
- if (!g_strcasecmp (name, flag->value))
+ if (!g_strcasecmp (value, flag->value))
return flag;
}
@@ -215,26 +215,36 @@ static GtkWidget *
get_widget (FilterElement *fe)
{
FilterSystemFlag *fsf = (FilterSystemFlag *) fe;
- GtkWidget *omenu, *menu, *item;
+ GtkWidget *omenu, *menu, *item, *first = NULL;
struct _system_flag *flag;
int index = 0, current = 0;
- fsf->value = system_flags[0].value;
-
menu = gtk_menu_new ();
for (flag = system_flags; flag->title; flag++) {
item = gtk_menu_item_new_with_label (flag->title);
gtk_object_set_data (GTK_OBJECT (item), "flag", flag);
- gtk_signal_connect (GTK_OBJECT (item), "select", item_selected, fe);
+ gtk_signal_connect (GTK_OBJECT (item), "activate", item_selected, fe);
+
gtk_menu_append (GTK_MENU (menu), item);
+
gtk_widget_show (item);
- if (!strcmp (fsf->value, flag->value))
+
+ if (fsf->value && !g_strcasecmp (fsf->value, flag->value)) {
current = index;
+ first = item;
+ } else if (!first) {
+ first = item;
+ }
+
index++;
}
omenu = gtk_option_menu_new ();
gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
+
+ if (first)
+ gtk_signal_emit_by_name (GTK_OBJECT (first), "activate", fe);
+
gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), current);
return omenu;
diff --git a/filter/filtertypes.xml b/filter/filtertypes.xml
index 0eb9ca242d..e0837cf09e 100644
--- a/filter/filtertypes.xml
+++ b/filter/filtertypes.xml
@@ -423,7 +423,7 @@
(match-all (system-flag ${flag}))
</code>
</option>
- <option value="is-not">
+ <option value="is not">
<title>is not</title>
<code>
(match-all (not (system-flag ${flag})))
diff --git a/filter/libfilter-i18n.h b/filter/libfilter-i18n.h
index 7654341b07..b38f69c314 100644
--- a/filter/libfilter-i18n.h
+++ b/filter/libfilter-i18n.h
@@ -1,44 +1,44 @@
/* Automatically generated. Do not edit. */
-char *s = N_("after");
char *s = N_("Assign Colour");
char *s = N_("Assign Score");
-char *s = N_("before");
-char *s = N_("contains");
char *s = N_("Copy to Folder");
char *s = N_("Date received");
char *s = N_("Date sent");
char *s = N_("Delete");
-char *s = N_("does not contain");
-char *s = N_("does not end with");
-char *s = N_("does not exist");
-char *s = N_("does not sound like");
-char *s = N_("does not start with");
-char *s = N_("ends with");
-char *s = N_("exists");
char *s = N_("Expression");
char *s = N_("Forward to Address");
-char *s = N_("is");
-char *s = N_("is greater than");
-char *s = N_("is less than");
-char *s = N_("is not");
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_("on or after");
-char *s = N_("on or before");
char *s = N_("Priority");
char *s = N_("Recipients");
char *s = N_("Regex Match");
char *s = N_("Sender");
char *s = N_("Set Status");
-char *s = N_("sounds like");
char *s = N_("Source");
char *s = N_("Specific header");
-char *s = N_("starts with");
char *s = N_("Status");
char *s = N_("Stop Processing");
char *s = N_("Subject");
+char *s = N_("after");
+char *s = N_("before");
+char *s = N_("contains");
+char *s = N_("does not contain");
+char *s = N_("does not end with");
+char *s = N_("does not exist");
+char *s = N_("does not sound like");
+char *s = N_("does not start with");
+char *s = N_("ends with");
+char *s = N_("exists");
+char *s = N_("is greater than");
+char *s = N_("is less than");
+char *s = N_("is not");
+char *s = N_("is");
+char *s = N_("on or after");
+char *s = N_("on or before");
+char *s = N_("sounds like");
+char *s = N_("starts with");
char *s = N_("was after");
char *s = N_("was before");