aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-06-27 03:01:39 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-06-27 03:01:39 +0800
commit45dbd798eaa6468a5595568de2bbb8b3e3fde0ee (patch)
tree8aec2ba4a87430192aeaca60f8c560e7e6ecc112
parente923d2eea9e325677c57f88e1209765acb306846 (diff)
downloadgsoc2013-evolution-45dbd798eaa6468a5595568de2bbb8b3e3fde0ee.tar
gsoc2013-evolution-45dbd798eaa6468a5595568de2bbb8b3e3fde0ee.tar.gz
gsoc2013-evolution-45dbd798eaa6468a5595568de2bbb8b3e3fde0ee.tar.bz2
gsoc2013-evolution-45dbd798eaa6468a5595568de2bbb8b3e3fde0ee.tar.lz
gsoc2013-evolution-45dbd798eaa6468a5595568de2bbb8b3e3fde0ee.tar.xz
gsoc2013-evolution-45dbd798eaa6468a5595568de2bbb8b3e3fde0ee.tar.zst
gsoc2013-evolution-45dbd798eaa6468a5595568de2bbb8b3e3fde0ee.zip
Added a #include <gnome-xml/parser.h> as this was needed (since we used
2000-06-26 Jeffrey Stedfast <fejj@helixcode.com> * filter-editor.c: Added a #include <gnome-xml/parser.h> as this was needed (since we used the xml parser...) (druid_dialogue_clicked): Do we want to use struct filter_option or do we instead want to use struct filter_optionrule as we had before? Since the function we pass the data to expects filter_option, I suspect that that is what we want. * filter-format.h (filter_description_html_write): Renamed from description_html_write in order to match function name in filter-format.c * filter-druid.c (option_name_changed): Fixed a memory leak (Free'd a filter description list). * filter-arg-types.c (arg_folder_edit_values): Free'd GList data in argin->values. * filter-driver.c (filter_driver_set_rules): Added code to free an xmlDoc and some other data. * filter-arg.h: Add prototypes for filter_arg_write_html() and filter_arg_write_text(); * filter-arg-types.c: Lets see if we can't get rid of some of these warnings... (use some casts to make warnings go away) (arg_address_edit_value): Lets make sure that ad exists before looking at member data. svn path=/trunk/; revision=3741
-rw-r--r--filter/ChangeLog30
-rw-r--r--filter/filter-arg-types.c96
-rw-r--r--filter/filter-arg.c95
-rw-r--r--filter/filter-arg.h4
-rw-r--r--filter/filter-driver.c10
-rw-r--r--filter/filter-druid.c29
-rw-r--r--filter/filter-editor.c72
-rw-r--r--filter/filter-format.h3
8 files changed, 187 insertions, 152 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index 12cb41c142..6c681b235e 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,3 +1,33 @@
+2000-06-26 Jeffrey Stedfast <fejj@helixcode.com>
+
+ * filter-editor.c: Added a #include <gnome-xml/parser.h> as this
+ was needed (since we used the xml parser...)
+ (druid_dialogue_clicked): Do we want to use struct filter_option
+ or do we instead want to use struct filter_optionrule as we had before?
+ Since the function we pass the data to expects filter_option, I suspect
+ that that is what we want.
+
+ * filter-format.h (filter_description_html_write): Renamed from
+ description_html_write in order to match function name in
+ filter-format.c
+
+ * filter-druid.c (option_name_changed): Fixed a memory leak (Free'd
+ a filter description list).
+
+ * filter-arg-types.c (arg_folder_edit_values): Free'd GList data in
+ argin->values.
+
+ * filter-driver.c (filter_driver_set_rules): Added code to free an
+ xmlDoc and some other data.
+
+ * filter-arg.h: Add prototypes for filter_arg_write_html() and
+ filter_arg_write_text();
+
+ * filter-arg-types.c: Lets see if we can't get rid of some of these
+ warnings... (use some casts to make warnings go away)
+ (arg_address_edit_value): Lets make sure that ad exists before looking
+ at member data.
+
2000-06-16 Dan Winship <danw@helixcode.com>
* filter-driver.c (do_delete, filter_driver_run): Update for Camel
diff --git a/filter/filter-arg-types.c b/filter/filter-arg-types.c
index 95a7933828..6671210f7e 100644
--- a/filter/filter-arg-types.c
+++ b/filter/filter-arg-types.c
@@ -61,14 +61,14 @@ filter_arg_string_get_type (void)
static void
arg_string_write_html(FilterArg *argin, GtkHTML *html, GtkHTMLStream *stream)
{
- FilterArgString *arg = (FilterArgString *)argin;
+ /*FilterArgString *arg = (FilterArgString *)argin;*/
/* empty */
}
static void
arg_string_write_text(FilterArg *argin, GString *string)
{
- FilterArgString *arg = (FilterArgString *)argin;
+ /*FilterArgString *arg = (FilterArgString *)argin;*/
GList *l;
char *a;
@@ -140,7 +140,7 @@ static xmlNodePtr
arg_string_values_get_xml(FilterArg *argin)
{
xmlNodePtr value;
- FilterArgString *arg = (FilterArgString *)argin;
+ /*FilterArgString *arg = (FilterArgString *)argin;*/
GList *l;
char *a;
@@ -181,7 +181,7 @@ arg_string_values_add_xml(FilterArg *arg, xmlNodePtr node)
static char *
arg_string_get_value_as_string(FilterArg *argin, void *data)
{
- FilterArgString *arg = (FilterArgString *)argin;
+ /*FilterArgString *arg = (FilterArgString *)argin;*/
char *a = (char *)data;
return a;
@@ -282,14 +282,14 @@ filter_arg_address_get_type (void)
static void
arg_address_write_html(FilterArg *argin, GtkHTML *html, GtkHTMLStream *stream)
{
- FilterArgAddress *arg = (FilterArgAddress *)argin;
+ /*FilterArgAddress *arg = (FilterArgAddress *)argin;*/
/* empty */
}
static void
arg_address_write_text(FilterArg *argin, GString *string)
{
- FilterArgAddress *arg = (FilterArgAddress *)argin;
+ /*FilterArgAddress *arg = (FilterArgAddress *)argin;*/
GList *l;
struct filter_arg_address *a;
@@ -317,37 +317,35 @@ static int
arg_address_edit_value(FilterArg *arg, int index)
{
GnomeDialog *dialogue;
- GtkHBox *hbox;
- GtkLabel *label;
- GtkEntry *entry;
+ GtkWidget *hbox;
+ GtkWidget *label;
+ GtkWidget *entry;
char *text = NULL;
char *newtext;
- struct filter_arg_address *ad;
+ struct filter_arg_address *ad = NULL;
dialogue = (GnomeDialog *)gnome_dialog_new("Edit value", "Ok", "Cancel", 0);
- hbox = (GtkHBox *)gtk_hbox_new(FALSE, 0);
- label = (GtkLabel *)gtk_label_new("Folder name");
- gtk_box_pack_start((GtkBox *)hbox, (GtkWidget *)label, FALSE, FALSE, 0);
- entry = (GtkEntry *)gtk_entry_new();
- gtk_box_pack_start((GtkBox *)hbox, (GtkWidget *)entry, TRUE, TRUE, 0);
- if (index>=0
- && (ad = filter_arg_get_value(arg, index))) {
+ hbox = gtk_hbox_new(FALSE, 0);
+ label = gtk_label_new("Folder name");
+ gtk_box_pack_start(GTK_BOX (hbox), label, FALSE, FALSE, 0);
+ entry = gtk_entry_new();
+ gtk_box_pack_start(GTK_BOX (hbox), entry, TRUE, TRUE, 0);
+ if (index >= 0 && (ad = filter_arg_get_value(arg, index))) {
text = ad->email;
}
if (text) {
- gtk_entry_set_text(entry, text);
+ gtk_entry_set_text(GTK_ENTRY (entry), text);
}
- gtk_box_pack_start((GtkBox *)dialogue->vbox, (GtkWidget *)hbox, TRUE, TRUE, 0);
- gtk_widget_show_all((GtkWidget *)hbox);
- gtk_object_ref((GtkObject *)entry); /* so we can get the text back afterwards */
+ gtk_box_pack_start(GTK_BOX (dialogue->vbox), hbox, TRUE, TRUE, 0);
+ gtk_widget_show_all(hbox);
+ gtk_object_ref(GTK_OBJECT (entry)); /* so we can get the text back afterwards */
if (gnome_dialog_run_and_close(dialogue) == 0) {
GList *node;
- newtext = g_strdup(gtk_entry_get_text(entry));
- gtk_object_unref((GtkObject *)entry);
- if (index>=0
- && (node = g_list_find(arg->values, ad))) {
+ newtext = g_strdup(gtk_entry_get_text(GTK_ENTRY (entry)));
+ gtk_object_unref(GTK_OBJECT (entry));
+ if (index >= 0 && ad && (node = g_list_find(arg->values, ad))) {
ad = node->data;
g_free(ad->email);
ad->email = newtext;
@@ -366,7 +364,7 @@ static xmlNodePtr
arg_address_values_get_xml(FilterArg *argin)
{
xmlNodePtr value;
- FilterArgAddress *arg = (FilterArgAddress *)argin;
+ /*FilterArgAddress *arg = (FilterArgAddress *)argin;*/
GList *l;
struct filter_arg_address *a;
@@ -416,7 +414,7 @@ arg_address_values_add_xml(FilterArg *arg, xmlNodePtr node)
static char *
arg_address_get_value_as_string(FilterArg *argin, void *data)
{
- FilterArgAddress *arg = (FilterArgAddress *)argin;
+ /*FilterArgAddress *arg = (FilterArgAddress *)argin;*/
struct filter_arg_address *a = (struct filter_arg_address *)data;
printf("geting address as string : %s %s\n", a->email, a->name);
@@ -534,14 +532,14 @@ filter_arg_folder_get_type (void)
static void
arg_folder_write_html(FilterArg *argin, GtkHTML *html, GtkHTMLStream *stream)
{
- FilterArgFolder *arg = (FilterArgFolder *)argin;
+ /*FilterArgFolder *arg = (FilterArgFolder *)argin;*/
/* empty */
}
static void
arg_folder_write_text(FilterArg *argin, GString *string)
{
- FilterArgFolder *arg = (FilterArgFolder *)argin;
+ /*FilterArgFolder *arg = (FilterArgFolder *)argin;*/
GList *l;
char *a;
@@ -562,45 +560,47 @@ arg_folder_write_text(FilterArg *argin, GString *string)
static void
arg_folder_edit_values(FilterArg *argin)
{
- FilterArgFolder *arg = (FilterArgFolder *)argin;
+ /*FilterArgFolder *arg = (FilterArgFolder *)argin;*/
GList *l;
char *a, *start, *ptr, *ptrend, *ptrgap;
char outbuf[128], *outptr; /* FIXME: dont use a bounded buffer! */
- GString *string = g_string_new("");
GtkWidget *dialogue;
GtkWidget *text;
+ guint i;
- dialogue = gnome_dialog_new("Edit addresses",
- "Ok", "Cancel", NULL);
+ dialogue = gnome_dialog_new("Edit addresses", "Ok", "Cancel", NULL);
text = gtk_text_new(NULL, NULL);
- gtk_object_ref((GtkObject *)text);
+ gtk_object_ref(GTK_OBJECT (text));
l = argin->values;
while (l) {
a = l->data;
- gtk_text_insert(text, NULL, NULL, NULL, a, strlen(a));
- gtk_text_insert(text, NULL, NULL, NULL, "\n", 1);
+ gtk_text_insert(GTK_TEXT (text), NULL, NULL, NULL, a, strlen(a));
+ gtk_text_insert(GTK_TEXT (text), NULL, NULL, NULL, "\n", 1);
l = g_list_next(l);
}
- gtk_box_pack_start(GNOME_DIALOG(dialogue)->vbox, text, TRUE, TRUE, 2);
+ gtk_box_pack_start(GTK_BOX (GNOME_DIALOG(dialogue)->vbox), text, TRUE, TRUE, 2);
gtk_widget_show(text);
- gtk_text_set_editable(text, 1);
+ gtk_text_set_editable(GTK_TEXT (text), TRUE);
- gnome_dialog_run_and_close(dialogue);
+ gnome_dialog_run_and_close(GNOME_DIALOG (dialogue));
- /* FIXME: free current values */
+ for (i = 0; i < g_list_length (argin->values); i++)
+ g_free (g_list_nth_data (argin->values, i));
+ g_list_free (argin->values);
+
argin->values = NULL;
ptr = GTK_TEXT(text)->text.ch;
- ptrend = ptr+GTK_TEXT(text)->text_end;
- ptrgap = ptr+GTK_TEXT(text)->gap_position;
+ ptrend = ptr + GTK_TEXT(text)->text_end;
+ ptrgap = ptr + GTK_TEXT(text)->gap_position;
start = ptr;
outptr = outbuf;
- while (ptr<ptrend) {
+ while (ptr < ptrend) {
printf("%c", *ptr);
if (*ptr == '\n') {
- int len = outptr-outbuf;
+ int len = outptr - outbuf;
char *new;
printf("(len = %d)", len);
@@ -621,14 +621,14 @@ arg_folder_edit_values(FilterArg *argin)
ptr += GTK_TEXT(text)->gap_size;
}
}
- if (outptr>outbuf) {
+ if (outptr > outbuf) {
int len = outptr-outbuf;
char *new;
printf("(lastlen = %d)", len);
new = g_malloc(len+1);
- new[len]=0;
+ new[len] = 0;
memcpy(new, start, len);
argin->values = g_list_append(argin->values, new);
}
@@ -639,7 +639,7 @@ static xmlNodePtr
arg_folder_values_get_xml(FilterArg *argin)
{
xmlNodePtr value;
- FilterArgFolder *arg = (FilterArgFolder *)argin;
+ /*FilterArgFolder *arg = (FilterArgFolder *)argin;*/
GList *l;
char *a;
@@ -687,7 +687,7 @@ arg_folder_values_add_xml(FilterArg *arg, xmlNodePtr node)
static char *
arg_folder_get_value_as_string(FilterArg *argin, void *data)
{
- FilterArgFolder *arg = (FilterArgFolder *)argin;
+ /*FilterArgFolder *arg = (FilterArgFolder *)argin;*/
char *a = (char *)data;
return a;
diff --git a/filter/filter-arg.c b/filter/filter-arg.c
index ece10efbba..8514f26b43 100644
--- a/filter/filter-arg.c
+++ b/filter/filter-arg.c
@@ -115,7 +115,7 @@ free_value_nothing(FilterArg *arg, void *v)
static gint
compare_pointers(gpointer a, gpointer b)
{
- return a==b;
+ return a == b;
}
static void
@@ -213,6 +213,7 @@ filter_arg_write_html(FilterArg *arg, GtkHTML *html, GtkHTMLStream *stream)
{
((FilterArgClass *)(arg->object.klass))->write_html(arg, html, stream);
}
+
void
filter_arg_write_text(FilterArg *arg, GString *string)
{
@@ -284,10 +285,10 @@ filter_arg_get_count(FilterArg *arg)
void *
filter_arg_get_value(FilterArg *arg, int index)
{
- int count=0;
+ int count = 0;
GList *l;
- for (l = arg->values;l && count<index;l=g_list_next(l))
+ for (l = arg->values; l && count < index; l = g_list_next(l))
count++;
if (l)
return l->data;
@@ -297,8 +298,6 @@ filter_arg_get_value(FilterArg *arg, int index)
char *
filter_arg_get_value_as_string(FilterArg *arg, int index)
{
- int count=0;
- GList *l;
void *data;
data = filter_arg_get_value(arg, index);
@@ -322,8 +321,7 @@ struct filter_arg_edit {
static void
filter_arg_edit_add(GtkWidget *w, struct filter_arg_edit *edata)
{
- GtkListItem *listitem;
- GList *items = NULL;
+ GtkWidget *listitem;
int i;
printf("adding new item\n");
@@ -333,10 +331,10 @@ filter_arg_edit_add(GtkWidget *w, struct filter_arg_edit *edata)
i = filter_arg_edit_value(edata->arg, -1);
if (i>=0) {
gtk_list_remove_items_no_unref(edata->list, edata->items);
- listitem = (GtkListItem *)gtk_list_item_new_with_label(filter_arg_get_value_as_string(edata->arg, i));
- gtk_object_set_data((GtkObject *)listitem, "arg_i", filter_arg_get_value(edata->arg, i));
+ listitem = gtk_list_item_new_with_label(filter_arg_get_value_as_string(edata->arg, i));
+ gtk_object_set_data(GTK_OBJECT (listitem), "arg_i", filter_arg_get_value(edata->arg, i));
edata->items = g_list_append(edata->items, listitem);
- gtk_widget_show((GtkWidget *)listitem);
+ gtk_widget_show(listitem);
/* this api is nonsense */
gtk_list_append_items(edata->list, g_list_copy(edata->items));
@@ -388,7 +386,7 @@ filter_arg_edit_edit(GtkWidget *w, struct filter_arg_edit *edata)
/* yurck */
if (edata->item_current
- && (name = gtk_object_get_data((GtkObject *)edata->item_current, "arg_i"))
+ && (name = gtk_object_get_data(GTK_OBJECT (edata->item_current), "arg_i"))
&& (i = g_list_index(edata->arg->values, name)) >= 0
&& (i = filter_arg_edit_value(edata->arg, i)) >= 0) {
@@ -399,12 +397,11 @@ filter_arg_edit_edit(GtkWidget *w, struct filter_arg_edit *edata)
static void
filter_arg_edit_delete(GtkWidget *w, struct filter_arg_edit *edata)
{
- GtkListItem *listitem;
char *name;
/* yurck */
- if (edata->item_current
- && (name = gtk_object_get_data((GtkObject *)edata->item_current, "arg_i"))) {
+ name = gtk_object_get_data(GTK_OBJECT (edata->item_current), "arg_i");
+ if (edata->item_current && name) {
filter_arg_remove(edata->arg, name);
fill_list(edata);
}
@@ -421,7 +418,7 @@ edit_sensitise(struct filter_arg_edit *edata)
static void
filter_arg_edit_select(GtkWidget *w, GtkListItem *list, struct filter_arg_edit *edata)
{
- edata->item_current = list;
+ edata->item_current = GTK_WIDGET (list);
edit_sensitise(edata);
printf ("node = %p\n", g_list_find(edata->items, edata->item_current));
@@ -440,7 +437,7 @@ filter_arg_edit_clicked(GnomeDialog *d, int button, struct filter_arg_edit *edat
struct _FilterArgPrivate *p = _PRIVATE(edata->arg);
printf("window finished\n");
- if (button==0) {
+ if (button == 0) {
gtk_signal_emit(GTK_OBJECT(edata->arg), signals[CHANGED]);
} else {
/* cancel button, restore old values ... */
@@ -448,9 +445,9 @@ filter_arg_edit_clicked(GnomeDialog *d, int button, struct filter_arg_edit *edat
while (edata->arg->values) {
filter_arg_remove(edata->arg, edata->arg->values->data);
}
- filter_arg_values_add_xml(edata->arg, p->oldargs);
+ filter_arg_values_add_xml(edata->arg, (xmlNodePtr) p->oldargs);
}
- xmlFreeNodeList(p->oldargs);
+ xmlFreeNodeList((xmlNodePtr) p->oldargs);
p->oldargs = NULL;
p->dialogue = NULL;
gnome_dialog_close(d);
@@ -465,8 +462,8 @@ filter_arg_edit_destroy(GnomeDialog *d, struct filter_arg_edit *edata)
while (edata->arg->values) {
filter_arg_remove(edata->arg, edata->arg->values->data);
}
- filter_arg_values_add_xml(edata->arg, p->oldargs);
- xmlFreeNodeList(p->oldargs);
+ filter_arg_values_add_xml(edata->arg, (xmlNodePtr) p->oldargs);
+ xmlFreeNodeList((xmlNodePtr) p->oldargs);
p->oldargs = NULL;
}
@@ -480,13 +477,10 @@ filter_arg_edit_destroy(GnomeDialog *d, struct filter_arg_edit *edata)
void
filter_arg_edit_values_1(FilterArg *arg)
{
- GList *vales;
- GtkList *list;
- GtkListItem *listitem;
- int count, i;
+ GtkWidget *list;
GnomeDialog *dialogue;
- GtkHBox *hbox;
- GtkVBox *vbox;
+ GtkWidget *hbox;
+ GtkWidget *vbox;
GtkWidget *button;
GtkWidget *scrolled_window, *frame;
struct filter_arg_edit * edata;
@@ -499,7 +493,7 @@ filter_arg_edit_values_1(FilterArg *arg)
}
/* copy the current state */
- p->oldargs= filter_arg_values_get_xml(arg);
+ p->oldargs = filter_arg_values_get_xml(arg);
edata = g_malloc0(sizeof(*edata));
edata->item_current = NULL;
@@ -508,56 +502,57 @@ filter_arg_edit_values_1(FilterArg *arg)
dialogue = (GnomeDialog *)gnome_dialog_new("Edit values", "Ok", "Cancel", 0);
edata->dialogue = dialogue;
- p->dialogue = dialogue;
+ p->dialogue = GTK_WIDGET (dialogue);
- hbox = (GtkHBox *)gtk_hbox_new(FALSE, 0);
+ hbox = gtk_hbox_new(FALSE, 0);
- list = (GtkList *)gtk_list_new();
- edata->list = list;
+ list = gtk_list_new();
+ edata->list = GTK_LIST (list);
edata->items = NULL;
fill_list(edata);
scrolled_window = gtk_scrolled_window_new(NULL, NULL);
frame = gtk_frame_new("Option values");
- gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window), (GtkWidget *)list);
+ gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window), list);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_container_set_focus_vadjustment(GTK_CONTAINER (list), gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_window)));
+ gtk_container_set_focus_vadjustment(GTK_CONTAINER (list),
+ gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_window)));
gtk_container_add(GTK_CONTAINER(frame), scrolled_window);
gtk_widget_set_usize(frame, 200, 300);
- gtk_box_pack_start((GtkBox *)hbox, frame, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX (hbox), frame, TRUE, TRUE, 0);
/* buttons */
- vbox = (GtkVBox *)gtk_vbox_new(FALSE, 0);
+ vbox = gtk_vbox_new(FALSE, 0);
button = gtk_button_new_with_label ("Add");
- gtk_box_pack_start((GtkBox *)vbox, button, FALSE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX (vbox), button, FALSE, TRUE, 0);
edata->add = button;
button = gtk_button_new_with_label ("Remove");
- gtk_box_pack_start((GtkBox *)vbox, button, FALSE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX (vbox), button, FALSE, TRUE, 0);
edata->remove = button;
button = gtk_button_new_with_label ("Edit");
- gtk_box_pack_start((GtkBox *)vbox, button, FALSE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX (vbox), button, FALSE, TRUE, 0);
edata->edit = button;
- gtk_box_pack_start((GtkBox *)hbox, (GtkWidget *)vbox, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
- gtk_signal_connect((GtkObject *)edata->add, "clicked", filter_arg_edit_add, edata);
- gtk_signal_connect((GtkObject *)edata->edit, "clicked", filter_arg_edit_edit, edata);
- gtk_signal_connect((GtkObject *)edata->remove, "clicked", filter_arg_edit_delete, edata);
- gtk_signal_connect((GtkObject *)edata->list, "select_child", filter_arg_edit_select, edata);
- gtk_signal_connect((GtkObject *)edata->list, "unselect_child", filter_arg_edit_unselect, edata);
+ gtk_signal_connect(GTK_OBJECT (edata->add), "clicked", filter_arg_edit_add, edata);
+ gtk_signal_connect(GTK_OBJECT (edata->edit), "clicked", filter_arg_edit_edit, edata);
+ gtk_signal_connect(GTK_OBJECT (edata->remove), "clicked", filter_arg_edit_delete, edata);
+ gtk_signal_connect(GTK_OBJECT (edata->list), "select_child", filter_arg_edit_select, edata);
+ gtk_signal_connect(GTK_OBJECT (edata->list), "unselect_child", filter_arg_edit_unselect, edata);
- gtk_widget_show(GTK_WIDGET(list));
- gtk_widget_show_all(GTK_WIDGET(hbox));
- gtk_box_pack_start((GtkBox *)dialogue->vbox, (GtkWidget *)hbox, TRUE, TRUE, 0);
+ gtk_widget_show(list);
+ gtk_widget_show_all(hbox);
+ gtk_box_pack_start(GTK_BOX (dialogue->vbox), hbox, TRUE, TRUE, 0);
- gtk_signal_connect((GtkObject *)dialogue, "clicked", filter_arg_edit_clicked, edata);
- gtk_signal_connect((GtkObject *)dialogue, "destroy", filter_arg_edit_destroy, edata);
+ gtk_signal_connect(GTK_OBJECT (dialogue), "clicked", filter_arg_edit_clicked, edata);
+ gtk_signal_connect(GTK_OBJECT (dialogue), "destroy", filter_arg_edit_destroy, edata);
edit_sensitise(edata);
- gtk_widget_show(dialogue);
+ gtk_widget_show(GTK_WIDGET (dialogue));
}
diff --git a/filter/filter-arg.h b/filter/filter-arg.h
index 7790123569..c7b038a996 100644
--- a/filter/filter-arg.h
+++ b/filter/filter-arg.h
@@ -72,6 +72,10 @@ FilterArg *filter_arg_clone(FilterArg *arg);
void filter_arg_copy (FilterArg *dst, FilterArg *src);
void filter_arg_value_add(FilterArg *a, void *v);
+void filter_arg_write_html(FilterArg *arg, GtkHTML *html,
+ GtkHTMLStream *stream);
+void filter_arg_write_text(FilterArg *arg, GString *string);
+
void filter_arg_edit_values(FilterArg *arg);
int filter_arg_edit_value(FilterArg *arg, int index);
diff --git a/filter/filter-driver.c b/filter/filter-driver.c
index 4a445e75be..92d337f958 100644
--- a/filter/filter-driver.c
+++ b/filter/filter-driver.c
@@ -180,7 +180,7 @@ filter_driver_finalise (GtkObject *obj)
FilterDriver *
filter_driver_new (void)
{
- FilterDriver *new = FILTER_DRIVER ( gtk_type_new (filter_driver_get_type ()));
+ FilterDriver *new = FILTER_DRIVER (gtk_type_new (filter_driver_get_type ()));
return new;
}
@@ -208,6 +208,10 @@ int filter_driver_set_rules(FilterDriver *d, const char *description, const char
filt = xmlParseFile(filter);
p->options = filter_load_optionset(filt, p->rules);
+#warning "Zucchi: is this safe? Doesn't seem to cause problems..."
+ filter_load_ruleset_free (p->rules);
+ xmlFreeDoc (desc);
+
return 0;
}
@@ -494,7 +498,7 @@ close_folder(void *key, void *value, void *data)
FilterDriver *d = data;
struct _FilterDriverPrivate *p = _PRIVATE(d);
- printf("closing folder: %s\n", key);
+ printf("closing folder: %s\n", (char *) key);
g_free(key);
camel_folder_sync(f, FALSE, p->ex);
@@ -566,7 +570,7 @@ filter_driver_run(FilterDriver *d, CamelFolder *source, CamelFolder *inbox)
while (m) {
GList *n = m->next;
- printf("matched: %s\n", m->data);
+ printf("matched: %s\n", (char *) m->data);
/* for all matching id's, so we can work out what to default */
if (g_hash_table_lookup(p->processed, m->data) == NULL) {
diff --git a/filter/filter-druid.c b/filter/filter-druid.c
index 75c948bfdd..9b0b03749d 100644
--- a/filter/filter-druid.c
+++ b/filter/filter-druid.c
@@ -107,7 +107,7 @@ object_destroy(FilterDruid *obj)
/* FIXME: free lists? */
- GTK_OBJECT_CLASS(filter_druid_parent)->destroy(obj);
+ GTK_OBJECT_CLASS(filter_druid_parent)->destroy(GTK_OBJECT (obj));
}
static void
@@ -254,7 +254,7 @@ html_write_options(GtkHTML *html, struct filter_option *option, char *def)
GList *
fill_rules(GList *rules, struct filter_option *option, int type)
{
- GList *optionl, *rulel;
+ GList *rulel;
GtkWidget *listitem, *hbox, *checkbox, *label;
GList *items = NULL;
@@ -295,8 +295,8 @@ fill_rules(GList *rules, struct filter_option *option, int type)
GList *
fill_options(GList *options)
{
- GList *optionl, *rulel, *optionrulel;
- GtkWidget *listitem, *hbox, *checkbox, *label;
+ GList *optionl;
+ GtkWidget *listitem;
GList *items = NULL;
optionl = options;
@@ -324,7 +324,7 @@ select_rule_child(GtkList *list, GtkWidget *child, FilterDruid *f)
struct filter_rule *fr = gtk_object_get_data(GTK_OBJECT(child), "rule");
int state;
struct filter_optionrule *rule;
- struct _FilterDruidPrivate *p = _PRIVATE(f);
+ /*struct _FilterDruidPrivate *p = _PRIVATE(f);*/
w = gtk_object_get_data(GTK_OBJECT(child), "checkbox");
state = !(int) gtk_object_get_data(GTK_OBJECT(child), "checkstate");
@@ -422,7 +422,7 @@ arg_changed(FilterArg *arg, FilterDruid *f)
printf("value changed!!!\n");
- orig = gtk_object_get_data(arg, "origin");
+ orig = gtk_object_get_data(GTK_OBJECT (arg), "origin");
if (orig) {
filter_arg_copy(orig, arg);
update_display(f, 0);
@@ -440,13 +440,10 @@ arg_link_clicked(GtkHTML *html, const char *url, FilterDruid *f)
FilterArg *arg;
void *dummy;
- if (sscanf(url+4, "%p %p", &dummy, &arg)==2
- && arg) {
- FilterArg *orig;
-
+ if ((sscanf(url+4, "%p %p", &dummy, &arg) == 2) && arg) {
printf("arg = %p\n", arg);
- gtk_signal_connect((GtkObject *)arg, "changed", arg_changed, f);
+ gtk_signal_connect(GTK_OBJECT (arg), "changed", arg_changed, f);
filter_arg_edit_values(arg);
}
}
@@ -457,7 +454,7 @@ option_name_changed(GtkEntry *entry, FilterDruid *f)
{
struct filter_desc *desc;
- printf("name chaned: %s\n", gtk_entry_get_text(entry));
+ printf("name changed: %s\n", gtk_entry_get_text(entry));
if (f->option_current) {
/* FIXME: lots of memory leaks */
@@ -466,6 +463,8 @@ option_name_changed(GtkEntry *entry, FilterDruid *f)
desc->type = FILTER_XML_TEXT;
desc->vartype = -1;
desc->varname = NULL;
+#warning "Zucchi: is this correct?"
+ filter_description_free (f->option_current->description);
f->option_current->description = g_list_append(NULL, desc);
}
}
@@ -606,8 +605,8 @@ filter_druid_set_rules(FilterDruid *f, GList *options, GList *rules, struct filt
static void
build_druid(FilterDruid *d)
{
- GtkWidget *vbox, *frame, *scrolled_window, *list, *html, *hbox, *label;
- GtkWidget *frame1, *table;
+ GtkWidget *vbox, *frame, *scrolled_window, *list, *html, *label;
+ GtkWidget *table;
struct _FilterDruidPrivate *p = _PRIVATE(d);
#if 0
@@ -619,7 +618,7 @@ build_druid(FilterDruid *d)
gnome_dialog_set_default((GnomeDialog *)d, 1);
#endif
- p->notebook = d;
+ p->notebook = GTK_WIDGET (d);
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(p->notebook), FALSE);
gtk_notebook_set_show_border(GTK_NOTEBOOK(p->notebook), FALSE);
diff --git a/filter/filter-editor.c b/filter/filter-editor.c
index 1f88cc7542..bd039db21b 100644
--- a/filter/filter-editor.c
+++ b/filter/filter-editor.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <gnome-xml/parser.h>
#include "filter-druid.h"
#include "filter-editor.h"
@@ -74,9 +75,9 @@ object_destroy(FilterEditor *obj)
struct _FilterEditorPrivate *p = _PRIVATE(obj);
if (p->druid_druid)
- gtk_object_unref((GtkObject *)p->druid_dialogue);
+ gtk_object_unref(GTK_OBJECT (p->druid_dialogue));
- GTK_OBJECT_CLASS(filter_editor_parent)->destroy(obj);
+ GTK_OBJECT_CLASS(filter_editor_parent)->destroy(GTK_OBJECT (obj));
}
static void
@@ -138,7 +139,9 @@ druid_dialogue_clicked(GnomeDialog *d, int button, FilterEditor *e)
case 2:
printf("Finish!\n");
if (p->druid_druid->option_current) {
- struct filrt_optionrule *or;
+#warning "what is going on here?"
+ /* FIXME: should this be struct filter_option?? */
+ struct filter_option *or;
printf("refcount = %d\n", ((GtkObject *)p->druid_druid)->ref_count);
@@ -148,7 +151,9 @@ druid_dialogue_clicked(GnomeDialog *d, int button, FilterEditor *e)
node = g_list_find(e->useroptions, p->druid_option);
if (node) {
- /* fixme: free old one */
+ /* FIXME: free old one */
+ /* we need to know what type or is supposed to be before
+ we can free old data */
node->data = or;
} else {
g_warning("Cannot find node I edited, appending instead");
@@ -167,9 +172,10 @@ druid_dialogue_clicked(GnomeDialog *d, int button, FilterEditor *e)
}
filter_druid_set_page(p->druid_druid, page);
- gnome_dialog_set_sensitive(p->druid_dialogue, 0, page>0);
- gnome_dialog_set_sensitive(p->druid_dialogue, 1, page<4);
- gnome_dialog_set_sensitive(p->druid_dialogue, 2, page==4); /* FIXME: make this depenedant on when the rules are actually done */
+ gnome_dialog_set_sensitive(GNOME_DIALOG (p->druid_dialogue), 0, page > 0);
+ gnome_dialog_set_sensitive(GNOME_DIALOG (p->druid_dialogue), 1, page < 4);
+ /* FIXME: make this depenedant on when the rules are actually done */
+ gnome_dialog_set_sensitive(GNOME_DIALOG (p->druid_dialogue), 2, page == 4);
}
static void
@@ -177,7 +183,7 @@ druid_dialogue_option_selected(FilterDruid *f, struct filter_option *option, Fil
{
struct _FilterEditorPrivate *p = _PRIVATE(e);
- gnome_dialog_set_sensitive(p->druid_dialogue, 1, TRUE);
+ gnome_dialog_set_sensitive(GNOME_DIALOG (p->druid_dialogue), 1, TRUE);
}
static void
@@ -192,10 +198,7 @@ add_or_edit(FilterEditor *e, struct filter_option *option)
return;
}
- dialogue = gnome_dialog_new (option
- ? _("Edit Filter")
- : _("Create filter"),
- NULL);
+ dialogue = GNOME_DIALOG (gnome_dialog_new (option ? _("Edit Filter") : _("Create filter"), NULL));
p->druid_dialogue = dialogue;
{
const char *pixmaps[] = {
@@ -214,8 +217,7 @@ add_or_edit(FilterEditor *e, struct filter_option *option)
};
if (option)
names[2] = N_("Apply");
- gnome_dialog_append_buttons_with_pixmaps(GNOME_DIALOG (dialogue),
- names, pixmaps);
+ gnome_dialog_append_buttons_with_pixmaps(dialogue, names, pixmaps);
}
gnome_dialog_set_close(dialogue, FALSE);
@@ -224,9 +226,9 @@ add_or_edit(FilterEditor *e, struct filter_option *option)
gnome_dialog_set_sensitive(dialogue, 2, FALSE);
gnome_dialog_set_default(dialogue, 1);
- gtk_signal_connect(GTK_OBJECT(dialogue), "clicked", druid_dialogue_clicked, e);
+ gtk_signal_connect(GTK_OBJECT (dialogue), "clicked", druid_dialogue_clicked, e);
- druid = filter_druid_new();
+ druid = FILTER_DRUID (filter_druid_new());
p->druid_druid = druid;
@@ -236,7 +238,7 @@ add_or_edit(FilterEditor *e, struct filter_option *option)
"forwards to customise it.</p>"));
filter_druid_set_rules(druid, e->systemoptions, e->rules, option);
- gtk_box_pack_start(dialogue->vbox, druid, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX (dialogue->vbox), GTK_WIDGET (druid), TRUE, TRUE, 0);
if (option) {
druid_dialogue_clicked(dialogue, 1, e);
@@ -244,10 +246,10 @@ add_or_edit(FilterEditor *e, struct filter_option *option)
p->druid_option = option;
- gtk_signal_connect(druid, "option_selected", druid_dialogue_option_selected, e);
+ gtk_signal_connect(GTK_OBJECT (druid), "option_selected", druid_dialogue_option_selected, e);
- gtk_widget_show(druid);
- gtk_widget_show(dialogue);
+ gtk_widget_show(GTK_WIDGET (druid));
+ gtk_widget_show(GTK_WIDGET (dialogue));
}
static void
@@ -294,8 +296,8 @@ build_editor(FilterEditor *e)
hbox = gtk_hbox_new(FALSE, 3);
- p->druid = (GtkWidget *)filter_druid_new();
- gtk_box_pack_start((GtkBox *)hbox, p->druid, TRUE, TRUE, 0);
+ p->druid = FILTER_DRUID (filter_druid_new());
+ gtk_box_pack_start(GTK_BOX (hbox), GTK_WIDGET (p->druid), TRUE, TRUE, 0);
vbox = gtk_vbox_new(FALSE, 0);
@@ -305,23 +307,23 @@ build_editor(FilterEditor *e)
p->up = gtk_button_new_with_label ("Up");
p->down = gtk_button_new_with_label ("Down");
- gtk_box_pack_start((GtkBox *)vbox, p->edit, FALSE, TRUE, 0);
- gtk_box_pack_start((GtkBox *)vbox, p->add, FALSE, TRUE, 3);
- gtk_box_pack_start((GtkBox *)vbox, p->remove, FALSE, TRUE, 0);
- gtk_box_pack_start((GtkBox *)vbox, p->up, FALSE, TRUE, 3);
- gtk_box_pack_start((GtkBox *)vbox, p->down, FALSE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX (vbox), p->edit, FALSE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX (vbox), p->add, FALSE, TRUE, 3);
+ gtk_box_pack_start(GTK_BOX (vbox), p->remove, FALSE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX (vbox), p->up, FALSE, TRUE, 3);
+ gtk_box_pack_start(GTK_BOX (vbox), p->down, FALSE, TRUE, 0);
- gtk_box_pack_start((GtkBox *)hbox, vbox, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
- gtk_box_pack_start((GtkBox *)e->parent.vbox, hbox, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX (e->parent.vbox), hbox, TRUE, TRUE, 0);
- gtk_signal_connect(p->druid, "option_selected", druid_option_selected, e);
+ gtk_signal_connect(GTK_OBJECT (p->druid), "option_selected", druid_option_selected, e);
- gtk_signal_connect(p->edit, "clicked", edit_clicked, e);
- gtk_signal_connect(p->add, "clicked", add_clicked, e);
- gtk_signal_connect(p->remove, "clicked", remove_clicked, e);
- gtk_signal_connect(p->up, "clicked", up_clicked, e);
- gtk_signal_connect(p->down, "clicked", down_clicked, e);
+ gtk_signal_connect(GTK_OBJECT (p->edit), "clicked", edit_clicked, e);
+ gtk_signal_connect(GTK_OBJECT (p->add), "clicked", add_clicked, e);
+ gtk_signal_connect(GTK_OBJECT (p->remove), "clicked", remove_clicked, e);
+ gtk_signal_connect(GTK_OBJECT (p->up), "clicked", up_clicked, e);
+ gtk_signal_connect(GTK_OBJECT (p->down), "clicked", down_clicked, e);
filter_druid_set_default_html(p->druid, "<h2>Filtering Rules</h2>"
"<p>Select one of the rules above to <i>view</i>, and "
diff --git a/filter/filter-format.h b/filter/filter-format.h
index bdd047164e..82c5d9fb13 100644
--- a/filter/filter-format.h
+++ b/filter/filter-format.h
@@ -5,6 +5,7 @@
#include <glib.h>
char *filter_description_text(GList *description, GList *args);
-void description_html_write(GList *description, GList *args, GtkHTML *html, GtkHTMLStream *stream);
+void filter_description_html_write(GList *description, GList *args,
+ GtkHTML *html, GtkHTMLStream *stream);
#endif /* _FILTER_FORMAT_H */