aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-11-06 06:51:55 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-11-06 06:51:55 +0800
commitc7f67942ca864e5d158102eab7f26f6285a05b05 (patch)
tree2a14cae4df16ab9b0019edd6098abec3d75bd1e7
parent394f4bee4a7a2fe5f12cb96b636aca99abd11184 (diff)
downloadgsoc2013-evolution-c7f67942ca864e5d158102eab7f26f6285a05b05.tar
gsoc2013-evolution-c7f67942ca864e5d158102eab7f26f6285a05b05.tar.gz
gsoc2013-evolution-c7f67942ca864e5d158102eab7f26f6285a05b05.tar.bz2
gsoc2013-evolution-c7f67942ca864e5d158102eab7f26f6285a05b05.tar.lz
gsoc2013-evolution-c7f67942ca864e5d158102eab7f26f6285a05b05.tar.xz
gsoc2013-evolution-c7f67942ca864e5d158102eab7f26f6285a05b05.tar.zst
gsoc2013-evolution-c7f67942ca864e5d158102eab7f26f6285a05b05.zip
Ported.
2002-11-05 Jeffrey Stedfast <fejj@ximian.com> * filter-filter.c: Ported. * filter-source.c (get_widget): Don't use e_utf8_to_gtk_string. * filter-option.c (xml_create): Don't use e_utf8_xml1_decode. * filter-input.c (xml_encode): Don't use e_utf8_xml1_encode. (xml_decode): Don't use e_utf8_xml1_decode. (entry_changed): Don't use e_utf8_gtk_entry_get_text. (get_widget): Don't use e_utf8_gtk_entry_set_text. * filter-file.c (xml_encode): Don't use e_utf8_xml1_encode shit. (xml_decode): Don't use e_utf8_xml1_decode. (entry_changed): Don't use e_utf8_gtk_entry_get_text. (get_widget): Don't use e_utf8_gtk_entry_set_text. svn path=/trunk/; revision=18570
-rw-r--r--filter/ChangeLog18
-rw-r--r--filter/filter-file.c31
-rw-r--r--filter/filter-filter.c232
-rw-r--r--filter/filter-filter.h40
-rw-r--r--filter/filter-folder.c3
-rw-r--r--filter/filter-input.c43
-rw-r--r--filter/filter-label.c4
-rw-r--r--filter/filter-option.c36
-rw-r--r--filter/filter-source.c7
9 files changed, 202 insertions, 212 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index ee69d731b3..f0204d6835 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,5 +1,23 @@
2002-11-05 Jeffrey Stedfast <fejj@ximian.com>
+ * filter-filter.c: Ported.
+
+ * filter-source.c (get_widget): Don't use e_utf8_to_gtk_string.
+
+ * filter-option.c (xml_create): Don't use e_utf8_xml1_decode.
+
+ * filter-input.c (xml_encode): Don't use e_utf8_xml1_encode.
+ (xml_decode): Don't use e_utf8_xml1_decode.
+ (entry_changed): Don't use e_utf8_gtk_entry_get_text.
+ (get_widget): Don't use e_utf8_gtk_entry_set_text.
+
+ * filter-file.c (xml_encode): Don't use e_utf8_xml1_encode shit.
+ (xml_decode): Don't use e_utf8_xml1_decode.
+ (entry_changed): Don't use e_utf8_gtk_entry_get_text.
+ (get_widget): Don't use e_utf8_gtk_entry_set_text.
+
+2002-11-05 Jeffrey Stedfast <fejj@ximian.com>
+
* vfolder-rule.c: Ported.
* vfolder-editor.c: Ported.
diff --git a/filter/filter-file.c b/filter/filter-file.c
index 6cec675f14..b06dc3eddb 100644
--- a/filter/filter-file.c
+++ b/filter/filter-file.c
@@ -35,7 +35,6 @@
#include <libgnomeui/gnome-dialog.h>
#include <libgnomeui/gnome-dialog-util.h>
#include <libgnomeui/gnome-file-entry.h>
-#include <gal/widgets/e-unicode.h>
#include "filter-file.h"
#include "e-util/e-sexp.h"
@@ -214,7 +213,7 @@ xml_encode (FilterElement *fe)
{
FilterFile *file = (FilterFile *) fe;
xmlNodePtr cur, value;
- char *encstr, *type;
+ char *type;
type = file->type ? file->type : "file";
@@ -225,9 +224,7 @@ xml_encode (FilterElement *fe)
xmlSetProp (value, "type", type);
cur = xmlNewChild (value, NULL, type, NULL);
- encstr = e_utf8_xml1_encode (file->path);
- xmlNodeSetContent (cur, encstr);
- g_free (encstr);
+ xmlNodeSetContent (cur, file->path);
return value;
}
@@ -252,19 +249,13 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
n = node->childs;
if (!strcmp (n->name, type)) {
- char *decstr;
-
str = xmlNodeGetContent (n);
- if (str) {
-
- decstr = e_utf8_xml1_decode (str);
- xmlFree (str);
- } else
- decstr = g_strdup ("");
-
- d(printf (" '%s'\n", decstr));
+ if (str)
+ file->path = g_strdup (str);
+ else
+ file->path = g_strdup ("");
- file->path = decstr;
+ d(printf (" '%s'\n", file->path));
} else {
g_warning ("Unknown node type '%s' encountered decoding a %s\n", n->name, type);
}
@@ -276,12 +267,12 @@ static void
entry_changed (GtkEntry *entry, FilterElement *fe)
{
FilterFile *file = (FilterFile *) fe;
- char *new;
+ const char *new;
- new = e_utf8_gtk_entry_get_text (entry);
+ new = gtk_entry_get_text (entry);
g_free (file->path);
- file->path = new;
+ file->path = g_strdup (new);
}
static GtkWidget *
@@ -295,7 +286,7 @@ get_widget (FilterElement *fe)
gnome_file_entry_set_modal (GNOME_FILE_ENTRY (fileentry), TRUE);
entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (fileentry));
- e_utf8_gtk_entry_set_text (GTK_ENTRY (entry), file->path);
+ gtk_entry_set_text (GTK_ENTRY (entry), file->path);
g_signal_connect (entry, "changed", entry_changed, fe);
diff --git a/filter/filter-filter.c b/filter/filter-filter.c
index 0aae6b9805..6ef66fc650 100644
--- a/filter/filter-filter.c
+++ b/filter/filter-filter.c
@@ -1,5 +1,6 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2000-2001 Ximian Inc.
+ * Copyright (C) 2000-2002 Ximian Inc.
*
* Authors: Not Zed <notzed@ximian.com>
* Jeffrey Stedfast <fejj@ximian.com>
@@ -19,10 +20,12 @@
* Boston, MA 02111-1307, USA.
*/
+
+#ifdef HAVE_CONFIG_H
#include <config.h>
+#endif
#include <string.h>
-#include <glib.h>
#include <gtk/gtkframe.h>
#include <gtk/gtkhbox.h>
#include <gtk/gtkmenuitem.h>
@@ -32,108 +35,96 @@
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-stock.h>
-#include <gal/widgets/e-unicode.h>
#include "filter-filter.h"
#include "filter-context.h"
#define d(x)
-static int validate(FilterRule *);
+static int validate(FilterRule *fr);
static int filter_eq(FilterRule *fr, FilterRule *cm);
-static xmlNodePtr xml_encode (FilterRule *);
-static int xml_decode (FilterRule *, xmlNodePtr, struct _RuleContext *f);
+static xmlNodePtr xml_encode (FilterRule *fr);
+static int xml_decode (FilterRule *fr, xmlNodePtr, RuleContext *rc);
static void rule_copy (FilterRule *dest, FilterRule *src);
/*static void build_code(FilterRule *, GString *out);*/
-static GtkWidget *get_widget (FilterRule *fr, struct _RuleContext *f);
-
-static void filter_filter_class_init (FilterFilterClass *class);
-static void filter_filter_init (FilterFilter *gspaper);
-static void filter_filter_finalise (GtkObject *obj);
+static GtkWidget *get_widget (FilterRule *fr, RuleContext *rc);
-#define _PRIVATE(x) (((FilterFilter *)(x))->priv)
+static void filter_filter_class_init (FilterFilterClass *klass);
+static void filter_filter_init (FilterFilter *ff);
+static void filter_filter_finalise (GObject *obj);
-struct _FilterFilterPrivate {
-};
-static FilterRuleClass *parent_class;
-
-enum {
- LAST_SIGNAL
-};
+static FilterRuleClass *parent_class = NULL;
-static guint signals[LAST_SIGNAL] = { 0 };
-guint
+GType
filter_filter_get_type (void)
{
- static guint type = 0;
+ static GType type = 0;
if (!type) {
- GtkTypeInfo type_info = {
- "FilterFilter",
- sizeof(FilterFilter),
- sizeof(FilterFilterClass),
- (GtkClassInitFunc)filter_filter_class_init,
- (GtkObjectInitFunc)filter_filter_init,
- (GtkArgSetFunc)NULL,
- (GtkArgGetFunc)NULL
+ static const GTypeInfo info = {
+ sizeof (FilterFilterClass),
+ NULL, /* base_class_init */
+ NULL, /* base_class_finalize */
+ (GClassInitFunc) filter_filter_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (FilterFilter),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) filter_filter_init,
};
- type = gtk_type_unique(filter_rule_get_type (), &type_info);
+ type = g_type_register_static (FILTER_TYPE_RULE, "FilterFilter", &info, 0);
}
return type;
}
static void
-filter_filter_class_init (FilterFilterClass *class)
+filter_filter_class_init (FilterFilterClass *klass)
{
- GtkObjectClass *object_class;
- FilterRuleClass *filter_rule = (FilterRuleClass *)class;
+ GObjectClass *object_class = G_OBJCT_CLASS (klass);
+ FilterRuleClass *fr_class = (FilterRuleClass *) klass;
- object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class (filter_rule_get_type ());
+ parent_class = g_type_class_ref (FILTER_TYPE_RULE);
object_class->finalize = filter_filter_finalise;
/* override methods */
- filter_rule->validate = validate;
- filter_rule->eq = filter_eq;
- filter_rule->xml_encode = xml_encode;
- filter_rule->xml_decode = xml_decode;
- /*filter_rule->build_code = build_code;*/
- filter_rule->copy = rule_copy;
- filter_rule->get_widget = get_widget;
-
- /* signals */
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
+ fr_class->validate = validate;
+ fr_class->eq = filter_eq;
+ fr_class->xml_encode = xml_encode;
+ fr_class->xml_decode = xml_decode;
+ /*fr_class->build_code = build_code;*/
+ fr_class->copy = rule_copy;
+ fr_class->get_widget = get_widget;
}
static void
-filter_filter_init (FilterFilter *o)
+filter_filter_init (FilterFilter *ff)
{
- o->priv = g_malloc0 (sizeof (*o->priv));
+ ;
}
static void
unref_list (GList *l)
{
while (l) {
- gtk_object_unref (GTK_OBJECT (l->data));
- l = g_list_next (l);
+ g_object_unref (l->data);
+ l = l->next;
}
}
static void
-filter_filter_finalise (GtkObject *obj)
+filter_filter_finalise (GObject *obj)
{
- FilterFilter *o = (FilterFilter *)obj;
+ FilterFilter *ff = (FilterFilter *) obj;
- unref_list (o->actions);
+ unref_list (ff->actions);
+ g_list_free (ff->actions);
- ((GtkObjectClass *)(parent_class))->finalize (obj);
+ G_OBJECT_CLASS (parent_class)->finalize (obj);
}
/**
@@ -146,24 +137,23 @@ filter_filter_finalise (GtkObject *obj)
FilterFilter *
filter_filter_new (void)
{
- FilterFilter *o = (FilterFilter *)gtk_type_new(filter_filter_get_type ());
- return o;
+ return (FilterFilter *) g_object_new (FILTER_TYPE_FILTER, NULL, NULL);
}
void
filter_filter_add_action (FilterFilter *fr, FilterPart *fp)
{
fr->actions = g_list_append (fr->actions, fp);
-
- filter_rule_emit_changed((FilterRule *)fr);
+
+ filter_rule_emit_changed ((FilterRule *) fr);
}
void
filter_filter_remove_action (FilterFilter *fr, FilterPart *fp)
{
fr->actions = g_list_remove (fr->actions, fp);
-
- filter_rule_emit_changed((FilterRule *)fr);
+
+ filter_rule_emit_changed ((FilterRule *) fr);
}
void
@@ -177,8 +167,8 @@ filter_filter_replace_action (FilterFilter *fr, FilterPart *fp, FilterPart *new)
} else {
fr->actions = g_list_append (fr->actions, new);
}
-
- filter_rule_emit_changed((FilterRule *)fr);
+
+ filter_rule_emit_changed ((FilterRule *) fr);
}
void
@@ -190,63 +180,63 @@ filter_filter_build_action (FilterFilter *fr, GString *out)
}
static int
-validate(FilterRule *fr)
+validate (FilterRule *fr)
{
- int valid;
+ FilterFilter *ff = (FilterFilter *) fr;
GList *parts;
- FilterFilter *ff = (FilterFilter *)fr;
-
- valid = ((FilterRuleClass *)(parent_class))->validate(fr);
-
+ int valid;
+
+ valid = FILTER_RULE_CLASS (parent_class)->validate (fr);
+
/* validate rule actions */
parts = ff->actions;
while (parts && valid) {
- valid = filter_part_validate((FilterPart *)parts->data);
+ valid = filter_part_validate ((FilterPart *) parts->data);
parts = parts->next;
}
-
+
return valid;
}
static int
-list_eq(GList *al, GList *bl)
+list_eq (GList *al, GList *bl)
{
int truth = TRUE;
-
+
while (truth && al && bl) {
FilterPart *a = al->data, *b = bl->data;
-
- truth = filter_part_eq(a, b);
+
+ truth = filter_part_eq (a, b);
al = al->next;
bl = bl->next;
}
-
+
return truth && al == NULL && bl == NULL;
}
static int
-filter_eq(FilterRule *fr, FilterRule *cm)
+filter_eq (FilterRule *fr, FilterRule *cm)
{
- return ((FilterRuleClass *)(parent_class))->eq(fr, cm)
- && list_eq(((FilterFilter *)fr)->actions, ((FilterFilter *)cm)->actions);
+ return FILTER_RULE_CLASS (parent_class)->eq (fr, cm)
+ && list_eq (((FilterFilter *) fr)->actions, ((FilterFilter *) cm)->actions);
}
static xmlNodePtr
xml_encode (FilterRule *fr)
{
+ FilterFilter *ff = (FilterFilter *) fr;
xmlNodePtr node, set, work;
GList *l;
- FilterFilter *ff = (FilterFilter *)fr;
- node = ((FilterRuleClass *)(parent_class))->xml_encode (fr);
+ node = FILTER_RULE_CLASS (parent_class)->xml_encode (fr);
g_assert (node != NULL);
set = xmlNewNode (NULL, "actionset");
xmlAddChild (node, set);
l = ff->actions;
while (l) {
- work = filter_part_xml_encode ((FilterPart *)l->data);
+ work = filter_part_xml_encode ((FilterPart *) l->data);
xmlAddChild (set, work);
- l = g_list_next (l);
+ l = l->next;
}
return node;
@@ -254,7 +244,7 @@ xml_encode (FilterRule *fr)
}
static void
-load_set (xmlNodePtr node, FilterFilter *ff, RuleContext *f)
+load_set (xmlNodePtr node, FilterFilter *ff, RuleContext *rc)
{
xmlNodePtr work;
char *rulename;
@@ -264,7 +254,7 @@ load_set (xmlNodePtr node, FilterFilter *ff, RuleContext *f)
while (work) {
if (!strcmp (work->name, "part")) {
rulename = xmlGetProp (work, "name");
- part = filter_context_find_action ((FilterContext *)f, rulename);
+ part = filter_context_find_action ((FilterContext *) rc, rulename);
if (part) {
part = filter_part_clone (part);
filter_part_xml_decode (part, work);
@@ -274,27 +264,27 @@ load_set (xmlNodePtr node, FilterFilter *ff, RuleContext *f)
}
xmlFree (rulename);
} else {
- g_warning ("Unknwon xml node in part: %s", work->name);
+ g_warning ("Unknown xml node in part: %s", work->name);
}
work = work->next;
}
}
static int
-xml_decode (FilterRule *fr, xmlNodePtr node, struct _RuleContext *f)
+xml_decode (FilterRule *fr, xmlNodePtr node, RuleContext *rc)
{
+ FilterFilter *ff = (FilterFilter *) fr;
xmlNodePtr work;
- FilterFilter *ff = (FilterFilter *)fr;
int result;
- result = ((FilterRuleClass *)(parent_class))->xml_decode (fr, node, f);
+ result = FILTER_RULE_CLASS (parent_class)->xml_decode (fr, node, rc);
if (result != 0)
return result;
work = node->childs;
while (work) {
if (!strcmp (work->name, "actionset")) {
- load_set (work, ff, f);
+ load_set (work, ff, rc);
}
work = work->next;
}
@@ -321,17 +311,17 @@ rule_copy (FilterRule *dest, FilterRule *src)
while (node) {
FilterPart *part = node->data;
- gtk_object_ref (GTK_OBJECT (part));
+ g_object_ref (part);
fdest->actions = g_list_append (fdest->actions, part);
node = node->next;
}
- ((FilterRuleClass *)(parent_class))->copy (dest, src);
+ FILTER_RULE_CLASS (parent_class)->copy (dest, src);
}
/*static void build_code(FilterRule *fr, GString *out)
{
- return ((FilterRuleClass *)(parent_class))->build_code(fr, out);
+ return FILTER_RULE_CLASS (parent_class)->build_code (fr, out);
}*/
struct _part_data {
@@ -344,7 +334,7 @@ struct _part_data {
static void
option_activate (GtkMenuItem *item, struct _part_data *data)
{
- FilterPart *part = gtk_object_get_data (GTK_OBJECT (item), "part");
+ FilterPart *part = g_object_get_data (item, "part");
FilterPart *newpart;
/* dont update if we haven't changed */
@@ -357,15 +347,15 @@ option_activate (GtkMenuItem *item, struct _part_data *data)
gtk_container_remove (GTK_CONTAINER (data->container), data->partwidget);
newpart = filter_part_clone (part);
- filter_part_copy_values(newpart, data->part);
- filter_filter_replace_action ((FilterFilter *)data->fr, data->part, newpart);
- gtk_object_unref (GTK_OBJECT (data->part));
+ filter_part_copy_values (newpart, data->part);
+ filter_filter_replace_action ((FilterFilter *) data->fr, data->part, newpart);
+ g_object_unref (data->part);
data->part = newpart;
data->partwidget = filter_part_get_widget (newpart);
if (data->partwidget)
gtk_box_pack_start (GTK_BOX (data->container), data->partwidget, FALSE, FALSE, 0);
- gtk_object_set_data (GTK_OBJECT (data->container), "part", newpart);
+ g_object_set_data (data->container, "part", newpart);
}
static GtkWidget *
@@ -395,14 +385,14 @@ get_rule_part_widget (FilterContext *f, FilterPart *newpart, FilterRule *fr)
while ((part = filter_context_next_action (f, part))) {
item = gtk_menu_item_new_with_label (_(part->title));
- gtk_object_set_data (GTK_OBJECT (item), "part", part);
- gtk_signal_connect (GTK_OBJECT (item), "activate", option_activate, data);
+ g_object_set_data (item, "part", part);
+ g_signal_connect (item, "activate", option_activate, data);
gtk_menu_append (GTK_MENU (menu), item);
gtk_widget_show (item);
- if (!strcmp (newpart->title, part->title)) {
+ if (!strcmp (newpart->title, part->title))
current = index;
- }
+
index++;
}
@@ -412,9 +402,9 @@ get_rule_part_widget (FilterContext *f, FilterPart *newpart, FilterRule *fr)
gtk_widget_show (omenu);
gtk_box_pack_start (GTK_BOX (hbox), omenu, FALSE, FALSE, 0);
- if (p) {
+ if (p)
gtk_box_pack_start (GTK_BOX (hbox), p, FALSE, FALSE, 0);
- }
+
gtk_widget_show_all (hbox);
return hbox;
@@ -433,16 +423,16 @@ less_parts (GtkWidget *button, struct _rule_data *data)
GtkWidget *rule;
GList *l;
- l = ((FilterFilter *)data->fr)->actions;
+ l = ((FilterFilter *) data->fr)->actions;
if (g_list_length (l) < 2)
return;
- rule = gtk_object_get_data (GTK_OBJECT (button), "rule");
- part = gtk_object_get_data (GTK_OBJECT (rule), "part");
+ rule = g_object_get_data (button, "rule");
+ part = g_object_get_data (rule, "part");
/* remove the part from the list */
- filter_filter_remove_action ((FilterFilter *)data->fr, part);
- gtk_object_unref (GTK_OBJECT (part));
+ filter_filter_remove_action ((FilterFilter *) data->fr, part);
+ g_object_unref (part);
/* and from the display */
gtk_container_remove (GTK_CONTAINER (data->parts), rule);
@@ -460,10 +450,10 @@ attach_rule (GtkWidget *rule, struct _rule_data *data, FilterPart *part, int row
pixmap = gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_REMOVE);
remove = gnome_pixmap_button (pixmap, _("Remove"));
- gtk_object_set_data (GTK_OBJECT (remove), "rule", rule);
- gtk_object_set_data (GTK_OBJECT (rule), "part", part);
+ g_object_set_data (remove, "rule", rule);
+ g_object_set_data (rule, "part", part);
/*gtk_button_set_relief (GTK_BUTTON (remove), GTK_RELIEF_NONE);*/
- gtk_signal_connect (GTK_OBJECT (remove), "clicked", less_parts, data);
+ g_signal_connect (remove, "clicked", less_parts, data);
gtk_table_attach (GTK_TABLE (data->parts), remove, 1, 2, row, row + 1,
0, 0, 0, 0);
gtk_widget_show (remove);
@@ -475,13 +465,13 @@ more_parts (GtkWidget *button, struct _rule_data *data)
FilterPart *new;
/* create a new rule entry, use the first type of rule */
- new = filter_context_next_action ((FilterContext *)data->f, NULL);
+ new = filter_context_next_action ((FilterContext *) data->f, NULL);
if (new) {
GtkWidget *w;
guint16 rows;
new = filter_part_clone (new);
- filter_filter_add_action ((FilterFilter *)data->fr, new);
+ filter_filter_add_action ((FilterFilter *) data->fr, new);
w = get_rule_part_widget (data->f, new, data->fr);
rows = GTK_TABLE (data->parts)->nrows;
@@ -491,7 +481,7 @@ more_parts (GtkWidget *button, struct _rule_data *data)
}
static GtkWidget *
-get_widget (FilterRule *fr, struct _RuleContext *f)
+get_widget (FilterRule *fr, RuleContext *rc)
{
GtkWidget *widget;
GtkWidget *parts, *inframe;
@@ -505,9 +495,9 @@ get_widget (FilterRule *fr, struct _RuleContext *f)
FilterPart *part;
struct _rule_data *data;
FilterFilter *ff = (FilterFilter *)fr;
- gint rows, i = 0;
+ int rows, i = 0;
- widget = ((FilterRuleClass *)(parent_class))->get_widget (fr, f);
+ widget = FILTER_RULE_CLASS (parent_class)->get_widget (fr, rc);
/* and now for the action area */
frame = gtk_frame_new (_("Then"));
@@ -517,7 +507,7 @@ get_widget (FilterRule *fr, struct _RuleContext *f)
rows = g_list_length (ff->actions);
parts = gtk_table_new (rows, 2, FALSE);
data = g_malloc0 (sizeof (*data));
- data->f = (FilterContext *)f;
+ data->f = (FilterContext *) rc;
data->fr = fr;
data->parts = parts;
@@ -526,7 +516,7 @@ get_widget (FilterRule *fr, struct _RuleContext *f)
pixmap = gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_ADD);
add = gnome_pixmap_button (pixmap, _("Add action"));
/* gtk_button_set_relief (GTK_BUTTON (add), GTK_RELIEF_NONE); */
- gtk_signal_connect (GTK_OBJECT (add), "clicked", more_parts, data);
+ g_signal_connect (add, "clicked", more_parts, data);
gtk_box_pack_start (GTK_BOX (hbox), add, FALSE, FALSE, 3);
gtk_box_pack_start (GTK_BOX (inframe), hbox, FALSE, FALSE, 3);
@@ -535,9 +525,9 @@ get_widget (FilterRule *fr, struct _RuleContext *f)
while (l) {
part = l->data;
d(printf ("adding action %s\n", part->title));
- w = get_rule_part_widget ((FilterContext *)f, part, fr);
+ w = get_rule_part_widget ((FilterContext *) rc, part, fr);
attach_rule (w, data, part, i++);
- l = g_list_next (l);
+ l = l->next;
}
hadj = gtk_adjustment_new (0.0, 0.0, 1.0, 1.0 ,1.0, 1.0);
diff --git a/filter/filter-filter.h b/filter/filter-filter.h
index 54c4a144f4..1fcff3fa3a 100644
--- a/filter/filter-filter.h
+++ b/filter/filter-filter.h
@@ -1,7 +1,9 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2000 Ximian Inc.
+ * Copyright (C) 2000-2002 Ximian Inc.
*
* Authors: Not Zed <notzed@lostzed.mmc.com.au>
+ * Jeffrey Stedfast <fejj@ximian.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
@@ -18,42 +20,44 @@
* Boston, MA 02111-1307, USA.
*/
+
#ifndef _FILTER_FILTER_H
#define _FILTER_FILTER_H
#include "filter-rule.h"
-#define FILTER_FILTER(obj) GTK_CHECK_CAST (obj, filter_filter_get_type (), FilterFilter)
-#define FILTER_FILTER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_filter_get_type (), FilterFilterClass)
-#define IS_FILTER_FILTER(obj) GTK_CHECK_TYPE (obj, filter_filter_get_type ())
+#define FILTER_TYPE_FILTER (filter_filter_get_type ())
+#define FILTER_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FILTER_TYPE_FILTER, FilterFilter))
+#define FILTER_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FILTER_TYPE_FILTER, FilterFilterClass))
+#define IS_FILTER_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FILTER_TYPE_FILTER))
+#define IS_FILTER_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FILTER_TYPE_FILTER))
+#define FILTER_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FILTER_TYPE_FILTER, FilterFilterClass))
-typedef struct _FilterFilter FilterFilter;
-typedef struct _FilterFilterClass FilterFilterClass;
+typedef struct _FilterFilter FilterFilter;
+typedef struct _FilterFilterClass FilterFilterClass;
struct _FilterFilter {
- FilterRule parent;
- struct _FilterFilterPrivate *priv;
-
+ FilterRule parent_object;
+
GList *actions;
};
struct _FilterFilterClass {
FilterRuleClass parent_class;
-
+
/* virtual methods */
-
+
/* signals */
};
-guint filter_filter_get_type (void);
-FilterFilter *filter_filter_new (void);
+GType filter_filter_get_type (void);
+FilterFilter *filter_filter_new (void);
/* methods */
-void filter_filter_add_action (FilterFilter *fr, FilterPart *fp);
-void filter_filter_remove_action (FilterFilter *fr, FilterPart *fp);
-void filter_filter_replace_action (FilterFilter *fr, FilterPart *fp, FilterPart *new);
+void filter_filter_add_action (FilterFilter *fr, FilterPart *fp);
+void filter_filter_remove_action (FilterFilter *fr, FilterPart *fp);
+void filter_filter_replace_action (FilterFilter *fr, FilterPart *fp, FilterPart *new);
-void filter_filter_build_action (FilterFilter *fr, GString *out);
+void filter_filter_build_action (FilterFilter *fr, GString *out);
#endif /* ! _FILTER_FILTER_H */
-
diff --git a/filter/filter-folder.c b/filter/filter-folder.c
index ab6531e0f8..c86e0140c4 100644
--- a/filter/filter-folder.c
+++ b/filter/filter-folder.c
@@ -29,7 +29,6 @@
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-dialog.h>
#include <libgnomeui/gnome-dialog-util.h>
-#include <gal/widgets/e-unicode.h>
#include "filter-folder.h"
#include "shell/evolution-folder-selector-button.h"
@@ -51,7 +50,7 @@ static void filter_folder_init (FilterFolder *ff);
static void filter_folder_finalise (GObject *obj);
-static FilterElementClass *parent_class;
+static FilterElementClass *parent_class = NULL;
extern EvolutionShellClient *global_shell_client;
diff --git a/filter/filter-input.c b/filter/filter-input.c
index 693c56fef0..59e34d3664 100644
--- a/filter/filter-input.c
+++ b/filter/filter-input.c
@@ -34,7 +34,6 @@
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-dialog.h>
#include <libgnomeui/gnome-dialog-util.h>
-#include <gal/widgets/e-unicode.h>
#include "filter-input.h"
#include "e-util/e-sexp.h"
@@ -255,15 +254,12 @@ xml_encode (FilterElement *fe)
xmlSetProp (value, "type", type);
l = fi->values;
while (l) {
- xmlNodePtr cur;
+ xmlNodePtr cur;
char *str = l->data;
- char *encstr;
cur = xmlNewChild (value, NULL, type, NULL);
- encstr = e_utf8_xml1_encode (str);
- xmlNodeSetContent (cur, encstr);
- g_free (encstr);
- l = g_list_next (l);
+ xmlNodeSetContent (cur, str);
+ l = l->next;
}
return value;
@@ -288,16 +284,12 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
n = node->childs;
while (n) {
if (!strcmp (n->name, type)) {
- gchar *decstr;
- str = xmlNodeGetContent (n);
- if (str) {
- decstr = e_utf8_xml1_decode (str);
- xmlFree (str);
- } else
- decstr = g_strdup("");
+ if (!(str = xmlNodeGetContent (n)))
+ str = xmlStrdup ("");
- d(printf (" '%s'\n", decstr));
- fi->values = g_list_append (fi->values, decstr);
+ d(printf (" '%s'\n", str));
+ fi->values = g_list_append (fi->values, g_strdup (str));
+ xmlFree (str);
} else {
g_warning ("Unknown node type '%s' encountered decoding a %s\n", n->name, type);
}
@@ -310,22 +302,22 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
static void
entry_changed (GtkEntry *entry, FilterElement *fe)
{
- char *new;
- FilterInput *fi = (FilterInput *)fe;
+ FilterInput *fi = (FilterInput *) fe;
+ const char *new;
GList *l;
- new = e_utf8_gtk_entry_get_text (entry);
+ new = gtk_entry_get_text (entry);
/* NOTE: entry only supports a single value ... */
l = fi->values;
while (l) {
g_free (l->data);
- l = g_list_next (l);
+ l = l->next;
}
g_list_free (fi->values);
- fi->values = g_list_append (NULL, new);
+ fi->values = g_list_append (NULL, g_strdup (new));
}
static GtkWidget *
@@ -335,9 +327,8 @@ get_widget (FilterElement *fe)
FilterInput *fi = (FilterInput *)fe;
entry = gtk_entry_new ();
- if (fi->values && fi->values->data) {
- e_utf8_gtk_entry_set_text (GTK_ENTRY (entry), fi->values->data);
- }
+ if (fi->values && fi->values->data)
+ gtk_entry_set_text (GTK_ENTRY (entry), (const char *) fi->values->data);
g_signal_connect (entry, "changed", entry_changed, fe);
@@ -353,12 +344,12 @@ build_code (FilterElement *fe, GString *out, struct _FilterPart *ff)
static void
format_sexp (FilterElement *fe, GString *out)
{
+ FilterInput *fi = (FilterInput *) fe;
GList *l;
- FilterInput *fi = (FilterInput *)fe;
l = fi->values;
while (l) {
e_sexp_encode_string (out, l->data);
- l = g_list_next (l);
+ l = l->next;
}
}
diff --git a/filter/filter-label.c b/filter/filter-label.c
index de82f04b52..105dd353cf 100644
--- a/filter/filter-label.c
+++ b/filter/filter-label.c
@@ -34,8 +34,6 @@
#include <libgnomeui/gnome-dialog.h>
#include <libgnomeui/gnome-dialog-util.h>
#include <libgnomeui/gnome-file-entry.h>
-#include <gal/widgets/e-unicode.h>
-#include <gal/util/e-unicode-i18n.h>
#include <bonobo/bonobo-object.h>
#include <bonobo/bonobo-generic-factory.h>
@@ -187,7 +185,7 @@ xml_create (FilterElement *fe, xmlNodePtr node)
if (db == CORBA_OBJECT_NIL
|| (title = btitle = bonobo_config_get_string (db, labels[i].path, NULL)) == NULL) {
btitle = NULL;
- title = U_(labels[i].title);
+ title = _(labels[i].title);
}
filter_option_add (fo, labels[i].value, title, NULL);
diff --git a/filter/filter-option.c b/filter/filter-option.c
index 8d3429ca69..8b9f008aca 100644
--- a/filter/filter-option.c
+++ b/filter/filter-option.c
@@ -31,7 +31,6 @@
#include <gtk/gtkoptionmenu.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
-#include <gal/widgets/e-unicode.h>
#include "filter-option.h"
#include "filter-part.h"
@@ -199,7 +198,7 @@ xml_create (FilterElement *fe, xmlNodePtr node)
{
FilterOption *fo = (FilterOption *)fe;
xmlNodePtr n, work;
-
+
/* parent implementation */
FILTER_ELEMENT_CLASS (parent_class)->xml_create (fe, node);
@@ -207,31 +206,34 @@ xml_create (FilterElement *fe, xmlNodePtr node)
while (n) {
if (!strcmp (n->name, "option")) {
char *tmp, *value, *title = NULL, *code = NULL;
-
+
value = xmlGetProp (n, "value");
work = n->childs;
while (work) {
if (!strcmp (work->name, "title")) {
if (!title) {
- tmp = xmlNodeGetContent(work);
- title = e_utf8_xml1_decode(tmp);
- if (tmp)
- xmlFree(tmp);
+ if (!(tmp = xmlNodeGetContent (work)))
+ tmp = xmlStrdup ("");
+
+ title = g_strdup (tmp);
+ xmlFree (tmp);
}
} else if (!strcmp (work->name, "code")) {
if (!code) {
- tmp = xmlNodeGetContent(work);
- code = e_utf8_xml1_decode(tmp);
- if (tmp)
- xmlFree(tmp);
+ if (!(tmp = xmlNodeGetContent (work)))
+ tmp = xmlStrdup ("");
+
+ code = g_strdup (tmp);
+ xmlFree (tmp);
}
}
work = work->next;
}
- filter_option_add(fo, value, title, code);
- xmlFree(value);
- g_free(title);
- g_free(code);
+
+ filter_option_add (fo, value, title, code);
+ xmlFree (value);
+ g_free (title);
+ g_free (code);
} else {
g_warning ("Unknown xml node within optionlist: %s\n", n->name);
}
@@ -357,8 +359,8 @@ clone (FilterElement *fe)
l = fo->options;
while (l) {
op = l->data;
- filter_option_add(new, op->value, op->title, op->code);
- l = g_list_next (l);
+ filter_option_add (new, op->value, op->title, op->code);
+ l = l->next;
}
d(printf ("cloning option code %p, current = %p\n", new, new->current));
diff --git a/filter/filter-source.c b/filter/filter-source.c
index 4d9aa4f6f8..2264af49dc 100644
--- a/filter/filter-source.c
+++ b/filter/filter-source.c
@@ -30,7 +30,6 @@
#include <gtk/gtk.h>
#include <gnome.h>
-#include <gal/widgets/e-unicode.h>
#include <e-util/e-url.h>
#include <e-util/e-sexp.h>
#include <bonobo/bonobo-object.h>
@@ -262,7 +261,7 @@ get_widget (FilterElement *fe)
for (i = fs->priv->sources; i != NULL; i = g_list_next (i)) {
SourceInfo *info = (SourceInfo *) i->data;
- char *label, *native_label;
+ char *label;
if (info->url != NULL) {
if (first == NULL)
@@ -274,10 +273,8 @@ get_widget (FilterElement *fe)
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);
+ item = gtk_menu_item_new_with_label (label);
g_free (label);
- g_free (native_label);
g_object_set_data (item, "source", info);
g_signal_connect (item, "activate", source_changed, fs);