aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2001-03-03 07:38:12 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-03-03 07:38:12 +0800
commit7c3a6662fe5da0353f31c4385e97f6b19c35e511 (patch)
treeb1134e7ed2f5cd5f40e8378f00a7c5dc140d842e
parentab118da377d6ec04736c538e5efce5cc2f49d45c (diff)
downloadgsoc2013-evolution-7c3a6662fe5da0353f31c4385e97f6b19c35e511.tar
gsoc2013-evolution-7c3a6662fe5da0353f31c4385e97f6b19c35e511.tar.gz
gsoc2013-evolution-7c3a6662fe5da0353f31c4385e97f6b19c35e511.tar.bz2
gsoc2013-evolution-7c3a6662fe5da0353f31c4385e97f6b19c35e511.tar.lz
gsoc2013-evolution-7c3a6662fe5da0353f31c4385e97f6b19c35e511.tar.xz
gsoc2013-evolution-7c3a6662fe5da0353f31c4385e97f6b19c35e511.tar.zst
gsoc2013-evolution-7c3a6662fe5da0353f31c4385e97f6b19c35e511.zip
Added option menu to vfolder editor.
2001-03-03 Not Zed <NotZed@Ximian.com> * filter.glade: Added option menu to vfolder editor. 2001-03-02 Not Zed <NotZed@Ximian.com> * 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
-rw-r--r--filter/ChangeLog14
-rw-r--r--filter/filter-editor.c5
-rw-r--r--filter/filter-rule.c39
-rw-r--r--filter/filter.glade267
-rw-r--r--filter/vfolder-rule.c43
5 files changed, 160 insertions, 208 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index 382b815c4c..3cecbeb156 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,3 +1,17 @@
+2001-03-03 Not Zed <NotZed@Ximian.com>
+
+ * filter.glade: Added option menu to vfolder editor.
+
+2001-03-02 Not Zed <NotZed@Ximian.com>
+
+ * 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!!!
+
2001-02-28 Not Zed <NotZed@Ximian.com>
* filter-rule.c (filter_rule_clone): New function to clone rules.
diff --git a/filter/filter-editor.c b/filter/filter-editor.c
index 5e06870fe4..5fa1796e3f 100644
--- a/filter/filter-editor.c
+++ b/filter/filter-editor.c
@@ -429,10 +429,11 @@ select_source (GtkMenuItem *mi, struct _editor_data *data)
set_sensitive (data);
}
+/* these strings must not be internationalised!!!! */
static char *source_names[] = {
- N_("incoming"),
+ "incoming",
/*"demand",*/
- N_("outgoing")
+ "outgoing"
};
GtkWidget *
diff --git a/filter/filter-rule.c b/filter/filter-rule.c
index c5d36d3496..f99c79e89b 100644
--- a/filter/filter-rule.c
+++ b/filter/filter-rule.c
@@ -144,6 +144,9 @@ filter_rule_clone(FilterRule *base, RuleContext *f)
xmlNodePtr xml;
FilterRule *rule;
+ g_assert(IS_FILTER_RULE(base));
+ g_assert(IS_RULE_CONTEXT(f));
+
/* TODO: do this more directly/efficiently */
xml = filter_rule_xml_encode(base);
rule = gtk_type_new(((GtkObject *)base)->klass->type);
@@ -156,6 +159,8 @@ filter_rule_clone(FilterRule *base, RuleContext *f)
void
filter_rule_set_name (FilterRule *fr, const char *name)
{
+ g_assert(IS_FILTER_RULE(fr));
+
g_free (fr->name);
fr->name = g_strdup (name);
}
@@ -163,6 +168,8 @@ filter_rule_set_name (FilterRule *fr, const char *name)
void
filter_rule_set_source (FilterRule *fr, const char *source)
{
+ g_assert(IS_FILTER_RULE(fr));
+
g_free (fr->source);
fr->source = g_strdup (source);
}
@@ -170,6 +177,8 @@ filter_rule_set_source (FilterRule *fr, const char *source)
xmlNodePtr
filter_rule_xml_encode (FilterRule *fr)
{
+ g_assert(IS_FILTER_RULE(fr));
+
return ((FilterRuleClass *) ((GtkObject *) fr)->klass)->xml_encode(fr);
}
@@ -188,7 +197,7 @@ xml_encode (FilterRule *fr)
xmlSetProp (node, "grouping", "any");
break;
}
-
+
if (fr->source) {
xmlSetProp (node, "source", fr->source);
} else {
@@ -197,12 +206,13 @@ xml_encode (FilterRule *fr)
}
if (fr->name) {
- gchar *encstr;
+ char *encstr;
+
work = xmlNewNode (NULL, "title");
- encstr = e_utf8_xml1_encode (fr->name);
- xmlNodeSetContent (work, encstr);
- g_free (encstr);
- xmlAddChild (node, work);
+ encstr = e_utf8_xml1_encode(fr->name);
+ xmlNodeSetContent(work, encstr);
+ g_free(encstr);
+ xmlAddChild(node, work);
}
set = xmlNewNode (NULL, "partset");
@@ -247,6 +257,10 @@ load_set (xmlNodePtr node, FilterRule *fr, RuleContext *f)
int
filter_rule_xml_decode (FilterRule *fr, xmlNodePtr node, RuleContext *f)
{
+ g_assert(IS_FILTER_RULE(fr));
+ g_assert(IS_RULE_CONTEXT(f));
+ g_assert(node != NULL);
+
return ((FilterRuleClass *) ((GtkObject *) fr)->klass)->xml_decode(fr, node, f);
}
@@ -299,12 +313,18 @@ xml_decode (FilterRule *fr, xmlNodePtr node, RuleContext *f)
void
filter_rule_add_part (FilterRule *fr, FilterPart *fp)
{
+ g_assert(IS_FILTER_RULE(fr));
+ g_assert(IS_FILTER_PART(fp));
+
fr->parts = g_list_append (fr->parts, fp);
}
void
filter_rule_remove_part (FilterRule *fr, FilterPart *fp)
{
+ g_assert(IS_FILTER_RULE(fr));
+ g_assert(IS_FILTER_PART(fp));
+
fr->parts = g_list_remove (fr->parts, fp);
}
@@ -312,6 +332,10 @@ void
filter_rule_replace_part (FilterRule *fr, FilterPart *fp, FilterPart *new)
{
GList *l;
+
+ g_assert(IS_FILTER_RULE(fr));
+ g_assert(IS_FILTER_PART(fp));
+ g_assert(IS_FILTER_PART(new));
l = g_list_find (fr->parts, fp);
if (l) {
@@ -324,6 +348,9 @@ filter_rule_replace_part (FilterRule *fr, FilterPart *fp, FilterPart *new)
void
filter_rule_build_code (FilterRule *fr, GString *out)
{
+ g_assert(IS_FILTER_RULE(fr));
+ g_assert(out != NULL);
+
return ((FilterRuleClass *) ((GtkObject *) fr)->klass)->build_code(fr, out);
}
diff --git a/filter/filter.glade b/filter/filter.glade
index 96eeb3dc63..259234acbe 100644
--- a/filter/filter.glade
+++ b/filter/filter.glade
@@ -459,219 +459,72 @@ Outgoing
</child>
<widget>
- <class>GtkHBox</class>
- <name>hbox3</name>
+ <class>GtkVBox</class>
+ <name>vbox3</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow3</name>
- <width>256</width>
- <height>125</height>
- <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
- <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
- <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
- <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
+ <class>GtkOptionMenu</class>
+ <name>source_option</name>
+ <can_focus>True</can_focus>
+ <items>specific folders only
+with all local folders
+with all active remote folders
+with all local and active remote folders
+</items>
+ <initial_choice>0</initial_choice>
<child>
<padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
+ <expand>False</expand>
+ <fill>False</fill>
</child>
-
- <widget>
- <class>GtkViewport</class>
- <name>viewport3</name>
- <shadow_type>GTK_SHADOW_IN</shadow_type>
-
- <widget>
- <class>GtkList</class>
- <name>source_list</name>
- <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
- </widget>
- </widget>
</widget>
<widget>
- <class>GtkVBox</class>
- <name>vbox3</name>
+ <class>GtkHBox</class>
+ <name>hbox3</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
+ <expand>True</expand>
+ <fill>True</fill>
</child>
<widget>
- <class>GtkVButtonBox</class>
- <name>vbuttonbox3</name>
- <layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
- <spacing>0</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>6</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
+ <class>GtkScrolledWindow</class>
+ <name>scrolledwindow3</name>
+ <width>256</width>
+ <height>125</height>
+ <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
+ <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
+ <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
+ <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<child>
<padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
+ <expand>True</expand>
+ <fill>True</fill>
</child>
<widget>
- <class>GtkButton</class>
- <name>source_add</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Add</label>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>source_remove</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Remove</label>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
-</widget>
-
-<widget>
- <class>GnomeDialog</class>
- <name>vfolder_source</name>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>False</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox3</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area3</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button16</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button17</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button18</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>vfolder_source_frame</name>
- <label>vFolder Sources</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox3</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
-
- <widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow3</name>
- <width>256</width>
- <height>125</height>
- <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
- <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
- <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
- <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkViewport</class>
- <name>viewport3</name>
- <shadow_type>GTK_SHADOW_IN</shadow_type>
-
- <widget>
- <class>GtkList</class>
- <name>source_list</name>
- <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
+ <class>GtkViewport</class>
+ <name>viewport3</name>
+ <shadow_type>GTK_SHADOW_IN</shadow_type>
+
+ <widget>
+ <class>GtkList</class>
+ <name>source_list</name>
+ <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
+ </widget>
</widget>
</widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox3</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
<widget>
- <class>GtkVButtonBox</class>
- <name>vbuttonbox3</name>
- <layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
+ <class>GtkVBox</class>
+ <name>vbox3</name>
+ <homogeneous>False</homogeneous>
<spacing>0</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>6</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>False</expand>
@@ -679,19 +532,35 @@ Outgoing
</child>
<widget>
- <class>GtkButton</class>
- <name>source_add</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Add</label>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>source_remove</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Remove</label>
+ <class>GtkVButtonBox</class>
+ <name>vbuttonbox3</name>
+ <layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
+ <spacing>0</spacing>
+ <child_min_width>85</child_min_width>
+ <child_min_height>27</child_min_height>
+ <child_ipad_x>6</child_ipad_x>
+ <child_ipad_y>0</child_ipad_y>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>source_add</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <label>Add</label>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>source_remove</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <label>Remove</label>
+ </widget>
</widget>
</widget>
</widget>
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);