aboutsummaryrefslogtreecommitdiffstats
path: root/filter
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-05-27 23:13:25 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-05-29 00:13:23 +0800
commitfad4af8a3d4c6f50f7bcceca8d545eb17d6fd056 (patch)
treeae78be371695c3dc18847b87d3f014f985aa3a40 /filter
parent6f5464f34ceec9e5701e3e3e651a40f9e6b3a072 (diff)
downloadgsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.tar.gz
gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.tar.zst
gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.zip
Prefer GLib basic types over C types.
Diffstat (limited to 'filter')
-rw-r--r--filter/filter-code.c6
-rw-r--r--filter/filter-colour.c30
-rw-r--r--filter/filter-datespec.c56
-rw-r--r--filter/filter-element.c16
-rw-r--r--filter/filter-element.h8
-rw-r--r--filter/filter-file.c32
-rw-r--r--filter/filter-file.h8
-rw-r--r--filter/filter-input.c44
-rw-r--r--filter/filter-input.h6
-rw-r--r--filter/filter-int.c30
-rw-r--r--filter/filter-int.h12
-rw-r--r--filter/filter-option.c54
-rw-r--r--filter/filter-option.h16
-rw-r--r--filter/filter-part.c48
-rw-r--r--filter/filter-part.h18
-rw-r--r--filter/filter-rule.c98
-rw-r--r--filter/filter-rule.h26
-rw-r--r--filter/rule-context.c112
-rw-r--r--filter/rule-context.h52
-rw-r--r--filter/rule-editor.c52
-rw-r--r--filter/rule-editor.h18
21 files changed, 371 insertions, 371 deletions
diff --git a/filter/filter-code.c b/filter/filter-code.c
index fb0880b260..c0f0420d19 100644
--- a/filter/filter-code.c
+++ b/filter/filter-code.c
@@ -80,7 +80,7 @@ filter_code_class_init (FilterCodeClass *klass)
static void
filter_code_init (FilterCode *fc)
{
- ((FilterInput *) fc)->type = (char *)xmlStrdup ((const unsigned char *)"code");
+ ((FilterInput *) fc)->type = (gchar *)xmlStrdup ((const guchar *)"code");
}
static void
@@ -104,7 +104,7 @@ filter_code_new (gboolean raw_code)
if (fc && raw_code) {
xmlFree (((FilterInput *) fc)->type);
- ((FilterInput *) fc)->type = (char *)xmlStrdup ((const unsigned char *)"rawcode");
+ ((FilterInput *) fc)->type = (gchar *)xmlStrdup ((const guchar *)"rawcode");
}
return fc;
@@ -123,7 +123,7 @@ build_code (FilterElement *fe, GString *out, struct _FilterPart *ff)
l = fi->values;
while (l) {
- g_string_append(out, (char *)l->data);
+ g_string_append(out, (gchar *)l->data);
l = g_list_next(l);
}
diff --git a/filter/filter-colour.c b/filter/filter-colour.c
index a5cc3534ad..c175829a5e 100644
--- a/filter/filter-colour.c
+++ b/filter/filter-colour.c
@@ -32,10 +32,10 @@
#define d(x)
-static int colour_eq (FilterElement *fe, FilterElement *cm);
+static gint colour_eq (FilterElement *fe, FilterElement *cm);
static void xml_create (FilterElement *fe, xmlNodePtr node);
static xmlNodePtr xml_encode (FilterElement *fe);
-static int xml_decode (FilterElement *fe, xmlNodePtr node);
+static gint xml_decode (FilterElement *fe, xmlNodePtr node);
static GtkWidget *get_widget (FilterElement *fe);
static void build_code (FilterElement *fe, GString *out, struct _FilterPart *ff);
static void format_sexp (FilterElement *, GString *);
@@ -143,10 +143,10 @@ xml_encode (FilterElement *fe)
g_snprintf (spec, sizeof (spec), "#%04x%04x%04x",
fc->color.red, fc->color.green, fc->color.blue);
- value = xmlNewNode(NULL, (const unsigned char *)"value");
- xmlSetProp(value, (const unsigned char *)"type", (const unsigned char *)"colour");
- xmlSetProp(value, (const unsigned char *)"name", (unsigned char *)fe->name);
- xmlSetProp(value, (const unsigned char *)"spec", (unsigned char *)spec);
+ value = xmlNewNode(NULL, (const guchar *)"value");
+ xmlSetProp(value, (const guchar *)"type", (const guchar *)"colour");
+ xmlSetProp(value, (const guchar *)"name", (guchar *)fe->name);
+ xmlSetProp(value, (const guchar *)"spec", (guchar *)spec);
return value;
}
@@ -158,22 +158,22 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
xmlChar *prop;
xmlFree (fe->name);
- fe->name = (char *)xmlGetProp(node, (const unsigned char *)"name");
+ fe->name = (gchar *)xmlGetProp(node, (const guchar *)"name");
- prop = xmlGetProp(node, (const unsigned char *)"spec");
+ prop = xmlGetProp(node, (const guchar *)"spec");
if (prop != NULL) {
- gdk_color_parse((char *)prop, &fc->color);
+ gdk_color_parse((gchar *)prop, &fc->color);
xmlFree (prop);
} else {
/* try reading the old RGB properties */
- prop = xmlGetProp(node, (const unsigned char *)"red");
- sscanf((char *)prop, "%" G_GINT16_MODIFIER "x", &fc->color.red);
+ prop = xmlGetProp(node, (const guchar *)"red");
+ sscanf((gchar *)prop, "%" G_GINT16_MODIFIER "x", &fc->color.red);
xmlFree (prop);
- prop = xmlGetProp(node, (const unsigned char *)"green");
- sscanf((char *)prop, "%" G_GINT16_MODIFIER "x", &fc->color.green);
+ prop = xmlGetProp(node, (const guchar *)"green");
+ sscanf((gchar *)prop, "%" G_GINT16_MODIFIER "x", &fc->color.green);
xmlFree (prop);
- prop = xmlGetProp(node, (const unsigned char *)"blue");
- sscanf((char *)prop, "%" G_GINT16_MODIFIER "x", &fc->color.blue);
+ prop = xmlGetProp(node, (const guchar *)"blue");
+ sscanf((gchar *)prop, "%" G_GINT16_MODIFIER "x", &fc->color.blue);
xmlFree (prop);
}
diff --git a/filter/filter-datespec.c b/filter/filter-datespec.c
index d0a7b591a5..4ab85d36bf 100644
--- a/filter/filter-datespec.c
+++ b/filter/filter-datespec.c
@@ -46,10 +46,10 @@
#define d(x)
static gboolean validate (FilterElement *fe);
-static int date_eq (FilterElement *fe, FilterElement *cm);
+static gint date_eq (FilterElement *fe, FilterElement *cm);
static void xml_create (FilterElement *fe, xmlNodePtr node);
static xmlNodePtr xml_encode (FilterElement *fe);
-static int xml_decode (FilterElement *fe, xmlNodePtr node);
+static gint xml_decode (FilterElement *fe, xmlNodePtr node);
static GtkWidget *get_widget (FilterElement *fe);
static void build_code (FilterElement *fe, GString *out, struct _FilterPart *fds);
static void format_sexp (FilterElement *, GString *);
@@ -62,10 +62,10 @@ static void filter_datespec_finalise (GObject *obj);
typedef struct _timespan {
guint32 seconds;
- const char *past_singular;
- const char *past_plural;
- const char *future_singular;
- const char *future_plural;
+ const gchar *past_singular;
+ const gchar *past_plural;
+ const gchar *future_singular;
+ const gchar *future_plural;
float max;
} timespan;
@@ -97,7 +97,7 @@ struct _FilterDatespecPrivate {
GtkWidget *label_button;
GtkWidget *notebook_type, *combobox_type, *calendar_specify, *spin_relative, *combobox_relative, *combobox_past_future;
FilterDatespec_type type;
- int span;
+ gint span;
};
static FilterElementClass *parent_class;
@@ -217,19 +217,19 @@ xml_encode (FilterElement *fe)
{
xmlNodePtr value, work;
FilterDatespec *fds = (FilterDatespec *)fe;
- char str[32];
+ gchar str[32];
d(printf ("Encoding datespec as xml\n"));
- value = xmlNewNode (NULL, (const unsigned char *)"value");
- xmlSetProp (value, (const unsigned char *)"name", (unsigned char *)fe->name);
- xmlSetProp (value, (const unsigned char *)"type", (const unsigned char *)"datespec");
+ value = xmlNewNode (NULL, (const guchar *)"value");
+ xmlSetProp (value, (const guchar *)"name", (guchar *)fe->name);
+ xmlSetProp (value, (const guchar *)"type", (const guchar *)"datespec");
- work = xmlNewChild (value, NULL, (const unsigned char *)"datespec", NULL);
+ work = xmlNewChild (value, NULL, (const guchar *)"datespec", NULL);
sprintf (str, "%d", fds->type);
- xmlSetProp (work, (const unsigned char *)"type", (unsigned char *)str);
+ xmlSetProp (work, (const guchar *)"type", (guchar *)str);
sprintf (str, "%d", (int)fds->value);
- xmlSetProp (work, (const unsigned char *)"value", (unsigned char *)str);
+ xmlSetProp (work, (const guchar *)"value", (guchar *)str);
return value;
}
@@ -244,16 +244,16 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
d(printf ("Decoding datespec from xml %p\n", fe));
xmlFree (fe->name);
- fe->name = (char *)xmlGetProp (node, (const unsigned char *)"name");
+ fe->name = (gchar *)xmlGetProp (node, (const guchar *)"name");
n = node->children;
while (n) {
- if (!strcmp ((char *)n->name, "datespec")) {
- val = xmlGetProp (n, (const unsigned char *)"type");
- fds->type = atoi ((char *)val);
+ if (!strcmp ((gchar *)n->name, "datespec")) {
+ val = xmlGetProp (n, (const guchar *)"type");
+ fds->type = atoi ((gchar *)val);
xmlFree (val);
- val = xmlGetProp (n, (const unsigned char *)"value");
- fds->value = atoi ((char *)val);
+ val = xmlGetProp (n, (const guchar *)"value");
+ fds->value = atoi ((gchar *)val);
xmlFree (val);
break;
}
@@ -266,7 +266,7 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
static int
get_best_span (time_t val)
{
- int i;
+ gint i;
for (i=N_TIMESPANS-1;i>=0;i--) {
if (val % timespans[i].seconds == 0)
@@ -280,8 +280,8 @@ get_best_span (time_t val)
static void
set_button (FilterDatespec *fds)
{
- char buf[128];
- char *label = buf;
+ gchar buf[128];
+ gchar *label = buf;
switch (fds->type) {
case FDST_UNKNOWN:
@@ -301,7 +301,7 @@ set_button (FilterDatespec *fds)
if (fds->value == 0)
label = _("now");
else {
- int span, count;
+ gint span, count;
span = get_best_span(fds->value);
count = fds->value / timespans[span].seconds;
@@ -312,7 +312,7 @@ set_button (FilterDatespec *fds)
if (fds->value == 0)
label = _("now");
else {
- int span, count;
+ gint span, count;
span = get_best_span(fds->value);
count = fds->value / timespans[span].seconds;
@@ -344,7 +344,7 @@ get_values (FilterDatespec *fds)
break; }
case FDST_X_FUTURE:
case FDST_X_AGO: {
- int val;
+ gint val;
val = gtk_spin_button_get_value_as_int((GtkSpinButton *)p->spin_relative);
fds->value = timespans[p->span].seconds * val;
@@ -360,7 +360,7 @@ get_values (FilterDatespec *fds)
static void
set_values (FilterDatespec *fds)
{
- int note_type;
+ gint note_type;
struct _FilterDatespecPrivate *p = PRIV(fds);
@@ -430,7 +430,7 @@ button_clicked (GtkButton *button, FilterDatespec *fds)
GtkWidget *toplevel;
GtkDialog *dialog;
GladeXML *gui;
- char *filter_glade = g_build_filename (EVOLUTION_GLADEDIR,
+ gchar *filter_glade = g_build_filename (EVOLUTION_GLADEDIR,
"filter.glade",
NULL);
diff --git a/filter/filter-element.c b/filter/filter-element.c
index 1fa0a14ee8..f2d65d63b4 100644
--- a/filter/filter-element.c
+++ b/filter/filter-element.c
@@ -31,14 +31,14 @@
#include "filter-element.h"
struct _element_type {
- char *name;
+ gchar *name;
FilterElementFunc create;
- void *data;
+ gpointer data;
};
static gboolean validate (FilterElement *fe);
-static int element_eq(FilterElement *fe, FilterElement *cm);
+static gint element_eq(FilterElement *fe, FilterElement *cm);
static void xml_create(FilterElement *fe, xmlNodePtr node);
static FilterElement *clone(FilterElement *fe);
static void copy_value(FilterElement *de, FilterElement *se);
@@ -122,7 +122,7 @@ filter_element_validate (FilterElement *fe)
return FILTER_ELEMENT_GET_CLASS (fe)->validate (fe);
}
-int
+gint
filter_element_eq (FilterElement *fe, FilterElement *cm)
{
FilterElementClass *klass;
@@ -168,7 +168,7 @@ filter_element_xml_encode (FilterElement *fe)
*
* Return value:
**/
-int
+gint
filter_element_xml_decode (FilterElement *fe, xmlNodePtr node)
{
return FILTER_ELEMENT_GET_CLASS (fe)->xml_decode (fe, node);
@@ -254,7 +254,7 @@ element_eq (FilterElement *fe, FilterElement *cm)
static void
xml_create (FilterElement *fe, xmlNodePtr node)
{
- fe->name = (char *)xmlGetProp (node, (const unsigned char *)"name");
+ fe->name = (gchar *)xmlGetProp (node, (const guchar *)"name");
}
static FilterElement *
@@ -288,7 +288,7 @@ copy_value(FilterElement *de, FilterElement *se)
if (((FilterInput *)se)->values)
filter_input_set_value((FilterInput*)de, ((FilterInput *)se)->values->data);
} else if (IS_FILTER_INT(de)) {
- ((FilterInt *)de)->val = atoi((char *) ((FilterInput *)se)->values->data);
+ ((FilterInt *)de)->val = atoi((gchar *) ((FilterInput *)se)->values->data);
}
} else if (IS_FILTER_COLOUR(se)) {
if (IS_FILTER_COLOUR(de)) {
@@ -312,7 +312,7 @@ copy_value(FilterElement *de, FilterElement *se)
} else if (IS_FILTER_INPUT(de)) {
FilterInt *s = (FilterInt *)se;
FilterInput *d = (FilterInput *)de;
- char *v;
+ gchar *v;
v = g_strdup_printf("%d", s->val);
filter_input_set_value(d, v);
diff --git a/filter/filter-element.h b/filter/filter-element.h
index 76894542a2..4c105a77c3 100644
--- a/filter/filter-element.h
+++ b/filter/filter-element.h
@@ -38,12 +38,12 @@
typedef struct _FilterElement FilterElement;
typedef struct _FilterElementClass FilterElementClass;
-typedef FilterElement *(*FilterElementFunc)(void *data);
+typedef FilterElement *(*FilterElementFunc)(gpointer data);
struct _FilterElement {
GObject parent_object;
- char *name;
+ gchar *name;
gpointer data;
};
@@ -54,11 +54,11 @@ struct _FilterElementClass {
/* virtual methods */
gboolean (*validate) (FilterElement *fe);
- int (*eq) (FilterElement *fe, FilterElement *cm);
+ gint (*eq) (FilterElement *fe, FilterElement *cm);
void (*xml_create) (FilterElement *, xmlNodePtr);
xmlNodePtr (*xml_encode) (FilterElement *);
- int (*xml_decode) (FilterElement *, xmlNodePtr);
+ gint (*xml_decode) (FilterElement *, xmlNodePtr);
FilterElement *(*clone) (FilterElement *fe);
void (*copy_value)(FilterElement *fe, FilterElement *se);
diff --git a/filter/filter-file.c b/filter/filter-file.c
index 2c0ac87c7f..0d421042e6 100644
--- a/filter/filter-file.c
+++ b/filter/filter-file.c
@@ -38,10 +38,10 @@
#define d(x)
static gboolean validate (FilterElement *fe);
-static int file_eq (FilterElement *fe, FilterElement *cm);
+static gint file_eq (FilterElement *fe, FilterElement *cm);
static void xml_create (FilterElement *fe, xmlNodePtr node);
static xmlNodePtr xml_encode (FilterElement *fe);
-static int xml_decode (FilterElement *fe, xmlNodePtr node);
+static gint xml_decode (FilterElement *fe, xmlNodePtr node);
static GtkWidget *get_widget (FilterElement *fe);
static void build_code (FilterElement *fe, GString *out, struct _FilterPart *ff);
static void format_sexp (FilterElement *, GString *);
@@ -131,18 +131,18 @@ filter_file_new (void)
FilterFile *
-filter_file_new_type_name (const char *type)
+filter_file_new_type_name (const gchar *type)
{
FilterFile *file;
file = filter_file_new ();
- file->type = (char *)xmlStrdup ((xmlChar *)type);
+ file->type = (gchar *)xmlStrdup ((xmlChar *)type);
return file;
}
void
-filter_file_set_path (FilterFile *file, const char *path)
+filter_file_set_path (FilterFile *file, const gchar *path)
{
g_free (file->path);
file->path = g_strdup (path);
@@ -214,12 +214,12 @@ xml_encode (FilterElement *fe)
d(printf ("Encoding %s as xml\n", type));
- value = xmlNewNode (NULL, (const unsigned char *)"value");
- xmlSetProp (value, (const unsigned char *)"name", (unsigned char *)fe->name);
- xmlSetProp (value, (const unsigned char *)"type", (unsigned char *)type);
+ value = xmlNewNode (NULL, (const guchar *)"value");
+ xmlSetProp (value, (const guchar *)"name", (guchar *)fe->name);
+ xmlSetProp (value, (const guchar *)"type", (guchar *)type);
- cur = xmlNewChild (value, NULL, (unsigned char *)type, NULL);
- xmlNodeSetContent (cur, (unsigned char *)file->path);
+ cur = xmlNewChild (value, NULL, (guchar *)type, NULL);
+ xmlNodeSetContent (cur, (guchar *)file->path);
return value;
}
@@ -228,11 +228,11 @@ static int
xml_decode (FilterElement *fe, xmlNodePtr node)
{
FilterFile *file = (FilterFile *)fe;
- char *name, *str, *type;
+ gchar *name, *str, *type;
xmlNodePtr n;
- name = (char *)xmlGetProp (node, (const unsigned char *)"name");
- type = (char *)xmlGetProp (node, (const unsigned char *)"type");
+ name = (gchar *)xmlGetProp (node, (const guchar *)"name");
+ type = (gchar *)xmlGetProp (node, (const guchar *)"type");
d(printf("Decoding %s from xml %p\n", type, fe));
d(printf ("Name = %s\n", name));
@@ -247,8 +247,8 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
n = node->children;
while (n != NULL) {
- if (!strcmp ((char *)n->name, type)) {
- str = (char *)xmlNodeGetContent (n);
+ if (!strcmp ((gchar *)n->name, type)) {
+ str = (gchar *)xmlNodeGetContent (n);
file->path = g_strdup (str ? str : "");
xmlFree (str);
@@ -268,7 +268,7 @@ static void
filename_changed (GtkWidget *widget, FilterElement *fe)
{
FilterFile *file = (FilterFile *) fe;
- const char *new;
+ const gchar *new;
new = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
g_free (file->path);
diff --git a/filter/filter-file.h b/filter/filter-file.h
index 02dabdb2e8..3aa30adbf1 100644
--- a/filter/filter-file.h
+++ b/filter/filter-file.h
@@ -44,8 +44,8 @@ typedef struct _FilterFileClass FilterFileClass;
struct _FilterFile {
FilterElement parent_object;
- char *type;
- char *path;
+ gchar *type;
+ gchar *path;
};
struct _FilterFileClass {
@@ -61,10 +61,10 @@ GType filter_file_get_type (void);
FilterFile *filter_file_new (void);
-FilterFile *filter_file_new_type_name (const char *type);
+FilterFile *filter_file_new_type_name (const gchar *type);
/* methods */
-void filter_file_set_path (FilterFile *file, const char *path);
+void filter_file_set_path (FilterFile *file, const gchar *path);
#ifdef __cplusplus
}
diff --git a/filter/filter-input.c b/filter/filter-input.c
index 30d6ed9c45..5eeed60de7 100644
--- a/filter/filter-input.c
+++ b/filter/filter-input.c
@@ -39,10 +39,10 @@
#define d(x)
static gboolean validate (FilterElement *fe);
-static int input_eq (FilterElement *fe, FilterElement *cm);
+static gint input_eq (FilterElement *fe, FilterElement *cm);
static void xml_create (FilterElement *fe, xmlNodePtr node);
static xmlNodePtr xml_encode (FilterElement *fe);
-static int xml_decode (FilterElement *fe, xmlNodePtr node);
+static gint xml_decode (FilterElement *fe, xmlNodePtr node);
static GtkWidget *get_widget (FilterElement *fe);
static void build_code (FilterElement *fe, GString *out, struct _FilterPart *ff);
static void format_sexp (FilterElement *, GString *);
@@ -132,12 +132,12 @@ filter_input_new (void)
}
FilterInput *
-filter_input_new_type_name (const char *type)
+filter_input_new_type_name (const gchar *type)
{
FilterInput *fi;
fi = filter_input_new ();
- fi->type = (char *)xmlStrdup ((xmlChar *)type);
+ fi->type = (gchar *)xmlStrdup ((xmlChar *)type);
d(printf("new type %s = %p\n", type, fi));
@@ -145,7 +145,7 @@ filter_input_new_type_name (const char *type)
}
void
-filter_input_set_value (FilterInput *fi, const char *value)
+filter_input_set_value (FilterInput *fi, const gchar *value)
{
GList *l;
@@ -168,15 +168,15 @@ validate (FilterElement *fe)
gboolean valid = TRUE;
if (fi->values && !strcmp (fi->type, "regex")) {
- const char *pattern;
+ const gchar *pattern;
regex_t regexpat;
- int regerr;
+ gint regerr;
pattern = fi->values->data;
if ((regerr = regcomp (&regexpat, pattern, REG_EXTENDED | REG_NEWLINE | REG_ICASE))) {
size_t reglen;
- char *regmsg;
+ gchar *regmsg;
/* regerror gets called twice to get the full error string
length to do proper posix error reporting */
@@ -203,10 +203,10 @@ validate (FilterElement *fe)
static int
list_eq (GList *al, GList *bl)
{
- int truth = TRUE;
+ gint truth = TRUE;
while (truth && al && bl) {
- truth = strcmp ((char *) al->data, (char *) bl->data) == 0;
+ truth = strcmp ((gchar *) al->data, (gchar *) bl->data) == 0;
al = al->next;
bl = bl->next;
}
@@ -243,15 +243,15 @@ xml_encode (FilterElement *fe)
d(printf ("Encoding %s as xml\n", type));
- value = xmlNewNode (NULL, (const unsigned char *)"value");
- xmlSetProp (value, (const unsigned char *)"name", (unsigned char *)fe->name);
- xmlSetProp (value, (const unsigned char *)"type", (unsigned char *)type);
+ value = xmlNewNode (NULL, (const guchar *)"value");
+ xmlSetProp (value, (const guchar *)"name", (guchar *)fe->name);
+ xmlSetProp (value, (const guchar *)"type", (guchar *)type);
l = fi->values;
while (l) {
xmlNodePtr cur;
xmlChar *str = l->data;
- cur = xmlNewChild (value, NULL, (unsigned char *)type, NULL);
+ cur = xmlNewChild (value, NULL, (guchar *)type, NULL);
str = xmlEncodeEntitiesReentrant (NULL, str);
xmlNodeSetContent (cur, str);
@@ -267,7 +267,7 @@ static int
xml_decode (FilterElement *fe, xmlNodePtr node)
{
FilterInput *fi = (FilterInput *)fe;
- char *name, *str, *type;
+ gchar *name, *str, *type;
xmlNodePtr n;
GList *l;
@@ -279,8 +279,8 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
g_list_free (fi->values);
fi->values = NULL;
- name = (char *)xmlGetProp (node, (const unsigned char *)"name");
- type = (char *)xmlGetProp (node, (const unsigned char *)"type");
+ name = (gchar *)xmlGetProp (node, (const guchar *)"name");
+ type = (gchar *)xmlGetProp (node, (const guchar *)"type");
d(printf("Decoding %s from xml %p\n", type, fe));
d(printf ("Name = %s\n", name));
@@ -290,9 +290,9 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
fi->type = type;
n = node->children;
while (n) {
- if (!strcmp ((char *)n->name, type)) {
- if (!(str = (char *)xmlNodeGetContent (n)))
- str = (char *)xmlStrdup ((const unsigned char *)"");
+ if (!strcmp ((gchar *)n->name, type)) {
+ if (!(str = (gchar *)xmlNodeGetContent (n)))
+ str = (gchar *)xmlStrdup ((const guchar *)"");
d(printf (" '%s'\n", str));
fi->values = g_list_append (fi->values, g_strdup (str));
@@ -310,7 +310,7 @@ static void
entry_changed (GtkEntry *entry, FilterElement *fe)
{
FilterInput *fi = (FilterInput *) fe;
- const char *new;
+ const gchar *new;
GList *l;
new = gtk_entry_get_text (entry);
@@ -337,7 +337,7 @@ get_widget (FilterElement *fe)
entry = gtk_entry_new ();
if (fi->values && fi->values->data)
- gtk_entry_set_text (GTK_ENTRY (entry), (const char *) fi->values->data);
+ gtk_entry_set_text (GTK_ENTRY (entry), (const gchar *) fi->values->data);
g_signal_connect (entry, "changed", G_CALLBACK (entry_changed), fe);
diff --git a/filter/filter-input.h b/filter/filter-input.h
index ac71847a76..9a5e181eaa 100644
--- a/filter/filter-input.h
+++ b/filter/filter-input.h
@@ -39,7 +39,7 @@ typedef struct _FilterInputClass FilterInputClass;
struct _FilterInput {
FilterElement parent_object;
- char *type; /* name of type */
+ gchar *type; /* name of type */
GList *values; /* strings */
};
@@ -54,9 +54,9 @@ struct _FilterInputClass {
GType filter_input_get_type (void);
FilterInput *filter_input_new (void);
-FilterInput *filter_input_new_type_name (const char *type);
+FilterInput *filter_input_new_type_name (const gchar *type);
/* methods */
-void filter_input_set_value (FilterInput *fi, const char *value);
+void filter_input_set_value (FilterInput *fi, const gchar *value);
#endif /* ! _FILTER_INPUT_H */
diff --git a/filter/filter-int.c b/filter/filter-int.c
index 170657e2dd..220e12fb38 100644
--- a/filter/filter-int.c
+++ b/filter/filter-int.c
@@ -32,11 +32,11 @@
#define d(x)
-static int int_eq (FilterElement *fe, FilterElement *cm);
+static gint int_eq (FilterElement *fe, FilterElement *cm);
static FilterElement *int_clone(FilterElement *fe);
static void xml_create (FilterElement *fe, xmlNodePtr node);
static xmlNodePtr xml_encode (FilterElement *fe);
-static int xml_decode (FilterElement *fe, xmlNodePtr node);
+static gint xml_decode (FilterElement *fe, xmlNodePtr node);
static GtkWidget *get_widget (FilterElement *fe);
static void build_code (FilterElement *fe, GString *out, struct _FilterPart *ff);
static void format_sexp (FilterElement *fe, GString *out);
@@ -125,7 +125,7 @@ filter_int_new (void)
}
FilterInt *
-filter_int_new_type (const char *type, int min, int max)
+filter_int_new_type (const gchar *type, gint min, gint max)
{
FilterInt *fi;
@@ -139,7 +139,7 @@ filter_int_new_type (const char *type, int min, int max)
}
void
-filter_int_set_value (FilterInt *fi, int val)
+filter_int_set_value (FilterInt *fi, gint val)
{
fi->val = val;
}
@@ -176,19 +176,19 @@ xml_encode (FilterElement *fe)
{
xmlNodePtr value;
FilterInt *fs = (FilterInt *)fe;
- char intval[32];
- const char *type;
+ gchar intval[32];
+ const gchar *type;
type = fs->type?fs->type:"integer";
d(printf("Encoding %s as xml\n", type));
- value = xmlNewNode (NULL, (const unsigned char *)"value");
- xmlSetProp (value, (const unsigned char *)"name", (unsigned char *)fe->name);
- xmlSetProp (value, (const unsigned char *)"type", (unsigned char *)type);
+ value = xmlNewNode (NULL, (const guchar *)"value");
+ xmlSetProp (value, (const guchar *)"name", (guchar *)fe->name);
+ xmlSetProp (value, (const guchar *)"type", (guchar *)type);
sprintf(intval, "%d", fs->val);
- xmlSetProp (value, (unsigned char *)type, (unsigned char *)intval);
+ xmlSetProp (value, (guchar *)type, (guchar *)intval);
return value;
}
@@ -197,23 +197,23 @@ static int
xml_decode (FilterElement *fe, xmlNodePtr node)
{
FilterInt *fs = (FilterInt *)fe;
- char *name, *type;
- char *intval;
+ gchar *name, *type;
+ gchar *intval;
d(printf("Decoding integer from xml %p\n", fe));
- name = (char *)xmlGetProp (node, (const unsigned char *)"name");
+ name = (gchar *)xmlGetProp (node, (const guchar *)"name");
d(printf ("Name = %s\n", name));
xmlFree (fe->name);
fe->name = name;
- type = (char *)xmlGetProp(node, (const unsigned char *)"type");
+ type = (gchar *)xmlGetProp(node, (const guchar *)"type");
d(printf ("Type = %s\n", type));
g_free(fs->type);
fs->type = g_strdup(type);
xmlFree(type);
- intval = (char *)xmlGetProp (node, (unsigned char *)(fs->type ? fs->type : "integer"));
+ intval = (gchar *)xmlGetProp (node, (guchar *)(fs->type ? fs->type : "integer"));
if (intval) {
d(printf ("Value = %s\n", intval));
fs->val = atoi (intval);
diff --git a/filter/filter-int.h b/filter/filter-int.h
index 60e1b2bf85..4167bc8cf3 100644
--- a/filter/filter-int.h
+++ b/filter/filter-int.h
@@ -38,10 +38,10 @@ typedef struct _FilterIntClass FilterIntClass;
struct _FilterInt {
FilterElement parent_object;
- char *type;
- int val;
- int min;
- int max;
+ gchar *type;
+ gint val;
+ gint min;
+ gint max;
};
struct _FilterIntClass {
@@ -54,8 +54,8 @@ struct _FilterIntClass {
GType filter_int_get_type (void);
FilterInt *filter_int_new (void);
-FilterInt *filter_int_new_type (const char *type, int min, int max);
-void filter_int_set_value (FilterInt *fi, int val);
+FilterInt *filter_int_new_type (const gchar *type, gint min, gint max);
+void filter_int_set_value (FilterInt *fi, gint val);
/* methods */
diff --git a/filter/filter-option.c b/filter/filter-option.c
index f4b208c59d..5341705986 100644
--- a/filter/filter-option.c
+++ b/filter/filter-option.c
@@ -37,10 +37,10 @@
#define d(x)
-static int option_eq (FilterElement *fe, FilterElement *cm);
+static gint option_eq (FilterElement *fe, FilterElement *cm);
static void xml_create (FilterElement *fe, xmlNodePtr node);
static xmlNodePtr xml_encode (FilterElement *fe);
-static int xml_decode (FilterElement *fe, xmlNodePtr node);
+static gint xml_decode (FilterElement *fe, xmlNodePtr node);
static FilterElement *clone (FilterElement *fe);
static GtkWidget *get_widget (FilterElement *fe);
static void build_code (FilterElement *fe, GString *out, struct _FilterPart *ff);
@@ -108,7 +108,7 @@ filter_option_init (FilterOption *fo)
}
static void
-free_option (struct _filter_option *o, void *data)
+free_option (struct _filter_option *o, gpointer data)
{
g_free (o->title);
g_free (o->value);
@@ -142,7 +142,7 @@ filter_option_new (void)
}
static struct _filter_option *
-find_option (FilterOption *fo, const char *name)
+find_option (FilterOption *fo, const gchar *name)
{
GList *l = fo->options;
struct _filter_option *op;
@@ -159,7 +159,7 @@ find_option (FilterOption *fo, const char *name)
}
void
-filter_option_set_current (FilterOption *option, const char *name)
+filter_option_set_current (FilterOption *option, const gchar *name)
{
g_return_if_fail (IS_FILTER_OPTION(option));
@@ -168,7 +168,7 @@ filter_option_set_current (FilterOption *option, const char *name)
/* used by implementers to add additional options */
struct _filter_option *
-filter_option_add(FilterOption *fo, const char *value, const char *title, const char *code, gboolean is_dynamic)
+filter_option_add(FilterOption *fo, const gchar *value, const gchar *title, const gchar *code, gboolean is_dynamic)
{
struct _filter_option *op;
@@ -188,7 +188,7 @@ filter_option_add(FilterOption *fo, const char *value, const char *title, const
return op;
}
-const char *
+const gchar *
filter_option_get_current (FilterOption *option)
{
g_return_val_if_fail (IS_FILTER_OPTION (option), NULL);
@@ -232,24 +232,24 @@ xml_create (FilterElement *fe, xmlNodePtr node)
n = node->children;
while (n) {
- if (!strcmp ((char *)n->name, "option")) {
- char *tmp, *value, *title = NULL, *code = NULL;
+ if (!strcmp ((gchar *)n->name, "option")) {
+ gchar *tmp, *value, *title = NULL, *code = NULL;
- value = (char *)xmlGetProp (n, (const unsigned char *)"value");
+ value = (gchar *)xmlGetProp (n, (const guchar *)"value");
work = n->children;
while (work) {
- if (!strcmp ((char *)work->name, "title") || !strcmp ((char *)work->name, "_title")) {
+ if (!strcmp ((gchar *)work->name, "title") || !strcmp ((gchar *)work->name, "_title")) {
if (!title) {
- if (!(tmp = (char *)xmlNodeGetContent (work)))
- tmp = (char *)xmlStrdup ((const unsigned char *)"");
+ if (!(tmp = (gchar *)xmlNodeGetContent (work)))
+ tmp = (gchar *)xmlStrdup ((const guchar *)"");
title = g_strdup (tmp);
xmlFree (tmp);
}
- } else if (!strcmp ((char *)work->name, "code")) {
+ } else if (!strcmp ((gchar *)work->name, "code")) {
if (!code) {
- if (!(tmp = (char*)xmlNodeGetContent (work)))
- tmp = (char *)xmlStrdup ((const unsigned char *)"");
+ if (!(tmp = (gchar *)xmlNodeGetContent (work)))
+ tmp = (gchar *)xmlStrdup ((const guchar *)"");
code = g_strdup (tmp);
xmlFree (tmp);
@@ -262,7 +262,7 @@ xml_create (FilterElement *fe, xmlNodePtr node)
xmlFree (value);
g_free (title);
g_free (code);
- } else if (g_str_equal ((char *)n->name, "dynamic")) {
+ } else if (g_str_equal ((gchar *)n->name, "dynamic")) {
if (fo->dynamic_func) {
g_warning ("Only one 'dynamic' node is acceptable in the optionlist '%s'", fe->name);
} else {
@@ -274,12 +274,12 @@ xml_create (FilterElement *fe, xmlNodePtr node)
*/
xmlChar *fn;
- fn = xmlGetProp (n, (const unsigned char *)"func");
+ fn = xmlGetProp (n, (const guchar *)"func");
if (fn && *fn) {
GSList *items, *i;
struct _filter_option *op;
- fo->dynamic_func = g_strdup ((const char *)fn);
+ fo->dynamic_func = g_strdup ((const gchar *)fn);
/* get options now, to have them available when reading saved rules */
items = get_dynamic_options (fo);
@@ -313,11 +313,11 @@ xml_encode (FilterElement *fe)
FilterOption *fo = (FilterOption *)fe;
d(printf ("Encoding option as xml\n"));
- value = xmlNewNode (NULL, (const unsigned char *)"value");
- xmlSetProp (value, (const unsigned char *)"name", (unsigned char *)fe->name);
- xmlSetProp (value, (const unsigned char *)"type", (unsigned char *)fo->type);
+ value = xmlNewNode (NULL, (const guchar *)"value");
+ xmlSetProp (value, (const guchar *)"name", (guchar *)fe->name);
+ xmlSetProp (value, (const guchar *)"type", (guchar *)fo->type);
if (fo->current)
- xmlSetProp (value, (const unsigned char *)"value", (unsigned char *)fo->current->value);
+ xmlSetProp (value, (const guchar *)"value", (guchar *)fo->current->value);
return value;
}
@@ -326,12 +326,12 @@ static int
xml_decode (FilterElement *fe, xmlNodePtr node)
{
FilterOption *fo = (FilterOption *)fe;
- char *value;
+ gchar *value;
d(printf ("Decoding option from xml\n"));
xmlFree (fe->name);
- fe->name = (char *)xmlGetProp (node, (const unsigned char *)"name");
- value = (char *)xmlGetProp (node, (const unsigned char *)"value");
+ fe->name = (gchar *)xmlGetProp (node, (const guchar *)"name");
+ value = (gchar *)xmlGetProp (node, (const guchar *)"value");
if (value) {
fo->current = find_option (fo, value);
xmlFree (value);
@@ -379,7 +379,7 @@ get_widget (FilterElement *fe)
GtkWidget *combobox;
GList *l;
struct _filter_option *op;
- int index = 0, current = 0;
+ gint index = 0, current = 0;
if (fo->dynamic_func) {
/* it is dynamically filled, thus remove all dynamics and put there the fresh ones */
diff --git a/filter/filter-option.h b/filter/filter-option.h
index 8a4931a009..9fa1670951 100644
--- a/filter/filter-option.h
+++ b/filter/filter-option.h
@@ -37,9 +37,9 @@ typedef struct _FilterOption FilterOption;
typedef struct _FilterOptionClass FilterOptionClass;
struct _filter_option {
- char *title; /* button title */
- char *value; /* value, if it has one */
- char *code; /* used to string code segments together */
+ gchar *title; /* button title */
+ gchar *value; /* value, if it has one */
+ gchar *code; /* used to string code segments together */
gboolean is_dynamic; /* whether is the option dynamic, FALSE if static */
};
@@ -47,11 +47,11 @@ struct _filter_option {
struct _FilterOption {
FilterElement parent_object;
- const char *type; /* static memory, type name written to xml */
+ const gchar *type; /* static memory, type name written to xml */
GList *options;
struct _filter_option *current;
- char *dynamic_func; /* name of the dynamic fill func, called in get_widget */
+ gchar *dynamic_func; /* name of the dynamic fill func, called in get_widget */
};
struct _FilterOptionClass {
@@ -66,10 +66,10 @@ GType filter_option_get_type (void);
FilterOption *filter_option_new (void);
/* methods */
-void filter_option_set_current (FilterOption *option, const char *name);
-const char *filter_option_get_current (FilterOption *option);
+void filter_option_set_current (FilterOption *option, const gchar *name);
+const gchar *filter_option_get_current (FilterOption *option);
-struct _filter_option *filter_option_add (FilterOption *fo, const char *name, const char *title, const char *code, gboolean is_dynamic);
+struct _filter_option *filter_option_add (FilterOption *fo, const gchar *name, const gchar *title, const gchar *code, gboolean is_dynamic);
void filter_option_remove_all (FilterOption *fo);
#endif /* ! _FILTER_OPTION_H */
diff --git a/filter/filter-part.c b/filter/filter-part.c
index 799e7fcb36..2247810e6c 100644
--- a/filter/filter-part.c
+++ b/filter/filter-part.c
@@ -136,10 +136,10 @@ filter_part_validate (FilterPart *fp)
return correct;
}
-int
+gint
filter_part_eq (FilterPart *fp, FilterPart *fc)
{
- int truth;
+ gint truth;
GList *al, *bl;
truth = ((fp->name && fc->name && strcmp(fp->name, fc->name) == 0)
@@ -163,22 +163,22 @@ filter_part_eq (FilterPart *fp, FilterPart *fc)
return truth && al == NULL && bl == NULL;
}
-int
+gint
filter_part_xml_create (FilterPart *ff, xmlNodePtr node, RuleContext *rc)
{
xmlNodePtr n;
- char *type, *str;
+ gchar *type, *str;
FilterElement *el;
- str = (char *)xmlGetProp (node, (const unsigned char *)"name");
+ str = (gchar *)xmlGetProp (node, (const guchar *)"name");
ff->name = g_strdup (str);
if (str)
xmlFree (str);
n = node->children;
while (n) {
- if (!strcmp ((char *)n->name, "input")) {
- type = (char *)xmlGetProp (n, (const unsigned char *)"type");
+ if (!strcmp ((gchar *)n->name, "input")) {
+ type = (gchar *)xmlGetProp (n, (const guchar *)"type");
d(printf ("creating new element type input '%s'\n", type));
if (type != NULL
&& (el = rule_context_new_element(rc, type)) != NULL) {
@@ -189,16 +189,16 @@ filter_part_xml_create (FilterPart *ff, xmlNodePtr node, RuleContext *rc)
} else {
g_warning ("Invalid xml format, missing/unknown input type");
}
- } else if (!strcmp ((char *)n->name, "title") || !strcmp ((char *)n->name, "_title")) {
+ } else if (!strcmp ((gchar *)n->name, "title") || !strcmp ((gchar *)n->name, "_title")) {
if (!ff->title) {
- str = (char *)xmlNodeGetContent (n);
+ str = (gchar *)xmlNodeGetContent (n);
ff->title = g_strdup (str);
if (str)
xmlFree (str);
}
- } else if (!strcmp ((char *)n->name, "code")) {
+ } else if (!strcmp ((gchar *)n->name, "code")) {
if (!ff->code) {
- str = (char *)xmlNodeGetContent (n);
+ str = (gchar *)xmlNodeGetContent (n);
ff->code = g_strdup (str);
if (str)
xmlFree (str);
@@ -221,8 +221,8 @@ filter_part_xml_encode (FilterPart *fp)
g_return_val_if_fail (fp != NULL, NULL);
- part = xmlNewNode (NULL, (const unsigned char *)"part");
- xmlSetProp (part, (const unsigned char *)"name", (unsigned char *)fp->name);
+ part = xmlNewNode (NULL, (const guchar *)"part");
+ xmlSetProp (part, (const guchar *)"name", (guchar *)fp->name);
l = fp->elements;
while (l) {
fe = l->data;
@@ -235,20 +235,20 @@ filter_part_xml_encode (FilterPart *fp)
}
-int
+gint
filter_part_xml_decode (FilterPart *fp, xmlNodePtr node)
{
FilterElement *fe;
xmlNodePtr n;
- char *name;
+ gchar *name;
g_return_val_if_fail (fp != NULL, -1);
g_return_val_if_fail (node != NULL, -1);
n = node->children;
while (n) {
- if (!strcmp ((char *)n->name, "value")) {
- name = (char *)xmlGetProp (n, (const unsigned char *)"name");
+ if (!strcmp ((gchar *)n->name, "value")) {
+ name = (gchar *)xmlGetProp (n, (const guchar *)"name");
d(printf ("finding element part %p %s = %p\n", name, name, fe));
fe = filter_part_find_element (fp, name);
d(printf ("finding element part %p %s = %p\n", name, name, fe));
@@ -315,7 +315,7 @@ filter_part_copy_values (FilterPart *dst, FilterPart *src)
}
FilterElement *
-filter_part_find_element (FilterPart *ff, const char *name)
+filter_part_find_element (FilterPart *ff, const gchar *name)
{
GList *l = ff->elements;
FilterElement *fe;
@@ -412,7 +412,7 @@ filter_part_build_code_list (GList *l, GString *out)
* Return value:
**/
FilterPart *
-filter_part_find_list (GList *l, const char *name)
+filter_part_find_list (GList *l, const gchar *name)
{
FilterPart *part;
@@ -469,11 +469,11 @@ filter_part_next_list (GList *l, FilterPart *last)
* Expands the variables in string @str based on the values of the part.
**/
void
-filter_part_expand_code (FilterPart *ff, const char *source, GString *out)
+filter_part_expand_code (FilterPart *ff, const gchar *source, GString *out)
{
- const char *newstart, *start, *end;
- char *name = alloca (32);
- int len, namelen = 32;
+ const gchar *newstart, *start, *end;
+ gchar *name = alloca (32);
+ gint len, namelen = 32;
FilterElement *fe;
start = source;
@@ -505,7 +505,7 @@ filter_part_expand_code (FilterPart *ff, const char *source, GString *out)
}
#if 0
-int main(int argc, char **argv)
+gint main(gint argc, gchar **argv)
{
GtkWidget *dialog, *w;
xmlDocPtr system;
diff --git a/filter/filter-part.h b/filter/filter-part.h
index 1827433b1c..10337b95df 100644
--- a/filter/filter-part.h
+++ b/filter/filter-part.h
@@ -45,9 +45,9 @@ struct _FilterPart {
GObject parent_object;
struct _FilterPartPrivate *priv;
- char *name;
- char *title;
- char *code;
+ gchar *name;
+ gchar *title;
+ gchar *code;
GList *elements;
};
@@ -64,25 +64,25 @@ FilterPart *filter_part_new (void);
/* methods */
gboolean filter_part_validate (FilterPart *fp);
-int filter_part_eq (FilterPart *fp, FilterPart *fc);
+gint filter_part_eq (FilterPart *fp, FilterPart *fc);
-int filter_part_xml_create (FilterPart *ff, xmlNodePtr node, struct _RuleContext *rc);
+gint filter_part_xml_create (FilterPart *ff, xmlNodePtr node, struct _RuleContext *rc);
xmlNodePtr filter_part_xml_encode (FilterPart *fe);
-int filter_part_xml_decode (FilterPart *fe, xmlNodePtr node);
+gint filter_part_xml_decode (FilterPart *fe, xmlNodePtr node);
FilterPart *filter_part_clone (FilterPart *fp);
void filter_part_copy_values (FilterPart *dfp, FilterPart *sfp);
-FilterElement *filter_part_find_element (FilterPart *ff, const char *name);
+FilterElement *filter_part_find_element (FilterPart *ff, const gchar *name);
GtkWidget *filter_part_get_widget (FilterPart *ff);
void filter_part_build_code (FilterPart *ff, GString *out);
-void filter_part_expand_code (FilterPart *ff, const char *str, GString *out);
+void filter_part_expand_code (FilterPart *ff, const gchar *str, GString *out);
/* static functions */
void filter_part_build_code_list (GList *l, GString *out);
-FilterPart *filter_part_find_list (GList *l, const char *name);
+FilterPart *filter_part_find_list (GList *l, const gchar *name);
FilterPart *filter_part_next_list (GList *l, FilterPart *last);
#endif /* ! _FILTER_PART_H */
diff --git a/filter/filter-rule.c b/filter/filter-rule.c
index cdc9f374f1..00610c48ea 100644
--- a/filter/filter-rule.c
+++ b/filter/filter-rule.c
@@ -36,10 +36,10 @@
#define d(x)
-static int validate(FilterRule *);
-static int rule_eq(FilterRule *fr, FilterRule *cm);
+static gint validate(FilterRule *);
+static gint rule_eq(FilterRule *fr, FilterRule *cm);
static xmlNodePtr xml_encode (FilterRule *);
-static int xml_decode (FilterRule *, xmlNodePtr, RuleContext *);
+static gint xml_decode (FilterRule *, xmlNodePtr, RuleContext *);
static void build_code (FilterRule *, GString * out);
static void rule_copy (FilterRule *dest, FilterRule *src);
static GtkWidget *get_widget (FilterRule * fr, struct _RuleContext *f);
@@ -51,7 +51,7 @@ static void filter_rule_finalise (GObject *obj);
#define _PRIVATE(x) (((FilterRule *)(x))->priv)
struct _FilterRulePrivate {
- int frozen;
+ gint frozen;
};
static GObjectClass *parent_class = NULL;
@@ -166,7 +166,7 @@ filter_rule_clone (FilterRule *base)
}
void
-filter_rule_set_name (FilterRule *fr, const char *name)
+filter_rule_set_name (FilterRule *fr, const gchar *name)
{
g_return_if_fail (IS_FILTER_RULE (fr));
@@ -181,7 +181,7 @@ filter_rule_set_name (FilterRule *fr, const char *name)
}
void
-filter_rule_set_source (FilterRule *fr, const char *source)
+filter_rule_set_source (FilterRule *fr, const gchar *source)
{
g_return_if_fail (IS_FILTER_RULE (fr));
@@ -195,7 +195,7 @@ filter_rule_set_source (FilterRule *fr, const char *source)
filter_rule_emit_changed (fr);
}
-int
+gint
filter_rule_validate (FilterRule *fr)
{
g_return_val_if_fail (IS_FILTER_RULE (fr), 0);
@@ -206,7 +206,7 @@ filter_rule_validate (FilterRule *fr)
static int
validate (FilterRule *fr)
{
- int valid = TRUE;
+ gint valid = TRUE;
GList *parts;
if (!fr->name || !*fr->name) {
@@ -230,7 +230,7 @@ validate (FilterRule *fr)
return valid;
}
-int
+gint
filter_rule_eq (FilterRule *fr, FilterRule *cm)
{
g_return_val_if_fail (IS_FILTER_RULE (fr), 0);
@@ -243,7 +243,7 @@ filter_rule_eq (FilterRule *fr, FilterRule *cm)
static int
list_eq(GList *al, GList *bl)
{
- int truth = TRUE;
+ gint truth = TRUE;
while (truth && al && bl) {
FilterPart *a = al->data, *b = bl->data;
@@ -283,16 +283,16 @@ xml_encode (FilterRule *fr)
xmlNodePtr node, set, work;
GList *l;
- node = xmlNewNode (NULL, (const unsigned char *)"rule");
+ node = xmlNewNode (NULL, (const guchar *)"rule");
- xmlSetProp (node, (const unsigned char *)"enabled", (const unsigned char *)(fr->enabled ? "true" : "false"));
+ xmlSetProp (node, (const guchar *)"enabled", (const guchar *)(fr->enabled ? "true" : "false"));
switch (fr->grouping) {
case FILTER_GROUP_ALL:
- xmlSetProp (node, (const unsigned char *)"grouping", (const unsigned char *)"all");
+ xmlSetProp (node, (const guchar *)"grouping", (const guchar *)"all");
break;
case FILTER_GROUP_ANY:
- xmlSetProp (node, (const unsigned char *)"grouping", (const unsigned char *)"any");
+ xmlSetProp (node, (const guchar *)"grouping", (const guchar *)"any");
break;
}
@@ -300,37 +300,37 @@ xml_encode (FilterRule *fr)
case FILTER_THREAD_NONE:
break;
case FILTER_THREAD_ALL:
- xmlSetProp(node, (const unsigned char *)"threading", (const unsigned char *)"all");
+ xmlSetProp(node, (const guchar *)"threading", (const guchar *)"all");
break;
case FILTER_THREAD_REPLIES:
- xmlSetProp(node, (const unsigned char *)"threading", (const unsigned char *)"replies");
+ xmlSetProp(node, (const guchar *)"threading", (const guchar *)"replies");
break;
case FILTER_THREAD_REPLIES_PARENTS:
- xmlSetProp(node, (const unsigned char *)"threading", (const unsigned char *)"replies_parents");
+ xmlSetProp(node, (const guchar *)"threading", (const guchar *)"replies_parents");
break;
case FILTER_THREAD_SINGLE:
- xmlSetProp(node, (const unsigned char *)"threading", (const unsigned char *)"single");
+ xmlSetProp(node, (const guchar *)"threading", (const guchar *)"single");
break;
}
if (fr->source) {
- xmlSetProp (node, (const unsigned char *)"source", (unsigned char *)fr->source);
+ xmlSetProp (node, (const guchar *)"source", (guchar *)fr->source);
} else {
/* set to the default filter type */
- xmlSetProp (node, (const unsigned char *)"source", (const unsigned char *)"incoming");
+ xmlSetProp (node, (const guchar *)"source", (const guchar *)"incoming");
}
if (fr->name) {
- char *escaped = g_markup_escape_text (fr->name, -1);
+ gchar *escaped = g_markup_escape_text (fr->name, -1);
- work = xmlNewNode (NULL, (const unsigned char *)"title");
- xmlNodeSetContent (work, (unsigned char *)escaped);
+ work = xmlNewNode (NULL, (const guchar *)"title");
+ xmlNodeSetContent (work, (guchar *)escaped);
xmlAddChild (node, work);
g_free (escaped);
}
- set = xmlNewNode (NULL, (const unsigned char *)"partset");
+ set = xmlNewNode (NULL, (const guchar *)"partset");
xmlAddChild (node, set);
l = fr->parts;
while (l) {
@@ -346,13 +346,13 @@ static void
load_set (xmlNodePtr node, FilterRule *fr, RuleContext *f)
{
xmlNodePtr work;
- char *rulename;
+ gchar *rulename;
FilterPart *part;
work = node->children;
while (work) {
- if (!strcmp ((char *)work->name, "part")) {
- rulename = (char *)xmlGetProp (work, (const unsigned char *)"name");
+ if (!strcmp ((gchar *)work->name, "part")) {
+ rulename = (gchar *)xmlGetProp (work, (const guchar *)"name");
part = rule_context_find_part (f, rulename);
if (part) {
part = filter_part_clone (part);
@@ -369,10 +369,10 @@ load_set (xmlNodePtr node, FilterRule *fr, RuleContext *f)
}
}
-int
+gint
filter_rule_xml_decode (FilterRule *fr, xmlNodePtr node, RuleContext *f)
{
- int res;
+ gint res;
g_return_val_if_fail (IS_FILTER_RULE (fr), 0);
g_return_val_if_fail (IS_RULE_CONTEXT (f), 0);
@@ -391,15 +391,15 @@ static int
xml_decode (FilterRule *fr, xmlNodePtr node, RuleContext *f)
{
xmlNodePtr work;
- char *grouping;
- char *source;
+ gchar *grouping;
+ gchar *source;
if (fr->name) {
g_free (fr->name);
fr->name = NULL;
}
- grouping = (char *)xmlGetProp (node, (const unsigned char *)"enabled");
+ grouping = (gchar *)xmlGetProp (node, (const guchar *)"enabled");
if (!grouping)
fr->enabled = TRUE;
else {
@@ -407,7 +407,7 @@ xml_decode (FilterRule *fr, xmlNodePtr node, RuleContext *f)
xmlFree (grouping);
}
- grouping = (char *)xmlGetProp (node, (const unsigned char *)"grouping");
+ grouping = (gchar *)xmlGetProp (node, (const guchar *)"grouping");
if (!strcmp (grouping, "any"))
fr->grouping = FILTER_GROUP_ANY;
else
@@ -416,7 +416,7 @@ xml_decode (FilterRule *fr, xmlNodePtr node, RuleContext *f)
fr->threading = FILTER_THREAD_NONE;
if (f->flags & RULE_CONTEXT_THREADING
- && (grouping = (char *)xmlGetProp (node, (const unsigned char *)"threading"))) {
+ && (grouping = (gchar *)xmlGetProp (node, (const guchar *)"threading"))) {
if (!strcmp(grouping, "all"))
fr->threading = FILTER_THREAD_ALL;
else if (!strcmp(grouping, "replies"))
@@ -429,7 +429,7 @@ xml_decode (FilterRule *fr, xmlNodePtr node, RuleContext *f)
}
g_free (fr->source);
- source = (char *)xmlGetProp (node, (const unsigned char *)"source");
+ source = (gchar *)xmlGetProp (node, (const guchar *)"source");
if (source) {
fr->source = g_strdup (source);
xmlFree (source);
@@ -440,13 +440,13 @@ xml_decode (FilterRule *fr, xmlNodePtr node, RuleContext *f)
work = node->children;
while (work) {
- if (!strcmp ((char *)work->name, "partset")) {
+ if (!strcmp ((gchar *)work->name, "partset")) {
load_set (work, fr, f);
- } else if (!strcmp ((char *)work->name, "title") || !strcmp ((char *)work->name, "_title")) {
+ } else if (!strcmp ((gchar *)work->name, "title") || !strcmp ((gchar *)work->name, "_title")) {
if (!fr->name) {
- char *str, *decstr = NULL;
+ gchar *str, *decstr = NULL;
- str = (char *)xmlNodeGetContent (work);
+ str = (gchar *)xmlNodeGetContent (work);
if (str) {
decstr = g_strdup (_(str));
xmlFree (str);
@@ -626,7 +626,7 @@ part_combobox_changed (GtkComboBox *combobox, struct _part_data *data)
{
FilterPart *part = NULL;
FilterPart *newpart;
- int index, i;
+ gint index, i;
index = gtk_combo_box_get_active (combobox);
for (i = 0, part = rule_context_next_part (data->f, part); part && i < index; i++, part = rule_context_next_part (data->f, part)) {
@@ -662,7 +662,7 @@ get_rule_part_widget (RuleContext *f, FilterPart *newpart, FilterRule *fr)
GtkWidget *combobox;
GtkWidget *hbox;
GtkWidget *p;
- int index = 0, current = 0;
+ gint index = 0, current = 0;
struct _part_data *data;
data = g_malloc0 (sizeof (*data));
@@ -732,7 +732,7 @@ less_parts (GtkWidget *button, struct _rule_data *data)
}
static void
-attach_rule (GtkWidget *rule, struct _rule_data *data, FilterPart *part, int row)
+attach_rule (GtkWidget *rule, struct _rule_data *data, FilterPart *part, gint row)
{
GtkWidget *remove;
@@ -784,7 +784,7 @@ more_parts (GtkWidget *button, struct _rule_data *data)
new = rule_context_next_part (data->f, NULL);
if (new) {
GtkWidget *w;
- int rows;
+ gint rows;
new = filter_part_clone (new);
filter_rule_add_part (data->fr, new);
@@ -845,7 +845,7 @@ get_widget (FilterRule *fr, struct _RuleContext *f)
gchar *text;
FilterPart *part;
struct _rule_data *data;
- int rows, i;
+ gint rows, i;
/* this stuff should probably be a table, but the
rule parts need to be a vbox */
@@ -919,7 +919,7 @@ get_widget (FilterRule *fr, struct _RuleContext *f)
gtk_box_pack_start (GTK_BOX (hbox), add, FALSE, FALSE, 0);
if (f->flags & RULE_CONTEXT_GROUPING) {
- const char *thread_types[] = { N_("If all conditions are met"), N_("If any conditions are met") };
+ const gchar *thread_types[] = { N_("If all conditions are met"), N_("If any conditions are met") };
label = gtk_label_new_with_mnemonic (_("_Find items:"));
combobox = gtk_combo_box_new_text ();
@@ -939,7 +939,7 @@ get_widget (FilterRule *fr, struct _RuleContext *f)
}
if (f->flags & RULE_CONTEXT_THREADING) {
- const char *thread_types[] = { N_("None"), N_("All related"), N_("Replies"), N_("Replies and parents"), N_("No reply or parent") };
+ const gchar *thread_types[] = { N_("None"), N_("All related"), N_("Replies"), N_("Replies and parents"), N_("No reply or parent") };
label = gtk_label_new_with_mnemonic (_("I_nclude threads"));
combobox = gtk_combo_box_new_text ();
@@ -989,7 +989,7 @@ get_widget (FilterRule *fr, struct _RuleContext *f)
}
FilterRule *
-filter_rule_next_list (GList *l, FilterRule *last, const char *source)
+filter_rule_next_list (GList *l, FilterRule *last, const gchar *source)
{
GList *node = l;
@@ -1018,7 +1018,7 @@ filter_rule_next_list (GList *l, FilterRule *last, const char *source)
}
FilterRule *
-filter_rule_find_list (GList * l, const char *name, const char *source)
+filter_rule_find_list (GList * l, const gchar *name, const gchar *source)
{
while (l) {
FilterRule *rule = l->data;
@@ -1034,7 +1034,7 @@ filter_rule_find_list (GList * l, const char *name, const char *source)
#ifdef FOR_TRANSLATIONS_ONLY
-static char *list[] = {
+static gchar *list[] = {
N_("Incoming"), N_("Outgoing")
};
#endif
diff --git a/filter/filter-rule.h b/filter/filter-rule.h
index 24419fec09..ecada873d1 100644
--- a/filter/filter-rule.h
+++ b/filter/filter-rule.h
@@ -65,13 +65,13 @@ struct _FilterRule {
GObject parent_object;
struct _FilterRulePrivate *priv;
- char *name;
- char *source;
+ gchar *name;
+ gchar *source;
enum _filter_grouping_t grouping;
enum _filter_threading_t threading;
- unsigned int system:1; /* this is a system rule, cannot be edited/deleted */
+ guint system:1; /* this is a system rule, cannot be edited/deleted */
GList *parts;
gboolean enabled;
@@ -81,11 +81,11 @@ struct _FilterRuleClass {
GObjectClass parent_class;
/* virtual methods */
- int (*validate) (FilterRule *);
- int (*eq) (FilterRule *fr, FilterRule *cm);
+ gint (*validate) (FilterRule *);
+ gint (*eq) (FilterRule *fr, FilterRule *cm);
xmlNodePtr (*xml_encode) (FilterRule *);
- int (*xml_decode) (FilterRule *, xmlNodePtr, struct _RuleContext *);
+ gint (*xml_decode) (FilterRule *, xmlNodePtr, struct _RuleContext *);
void (*build_code) (FilterRule *, GString *out);
@@ -104,14 +104,14 @@ FilterRule *filter_rule_new (void);
FilterRule *filter_rule_clone (FilterRule *base);
/* methods */
-void filter_rule_set_name (FilterRule *fr, const char *name);
-void filter_rule_set_source (FilterRule *fr, const char *source);
+void filter_rule_set_name (FilterRule *fr, const gchar *name);
+void filter_rule_set_source (FilterRule *fr, const gchar *source);
-int filter_rule_validate (FilterRule *fr);
-int filter_rule_eq (FilterRule *fr, FilterRule *cm);
+gint filter_rule_validate (FilterRule *fr);
+gint filter_rule_eq (FilterRule *fr, FilterRule *cm);
xmlNodePtr filter_rule_xml_encode (FilterRule *fr);
-int filter_rule_xml_decode (FilterRule *fr, xmlNodePtr node, struct _RuleContext *f);
+gint filter_rule_xml_decode (FilterRule *fr, xmlNodePtr node, struct _RuleContext *f);
void filter_rule_copy (FilterRule *dest, FilterRule *src);
@@ -129,8 +129,8 @@ void filter_rule_build_action(FilterRule *fr, GString *out);
void filter_rule_emit_changed (FilterRule *fr);
/* static functions */
-FilterRule *filter_rule_next_list (GList *l, FilterRule *last, const char *source);
-FilterRule *filter_rule_find_list (GList *l, const char *name, const char *source);
+FilterRule *filter_rule_next_list (GList *l, FilterRule *last, const gchar *source);
+FilterRule *filter_rule_find_list (GList *l, const gchar *name, const gchar *source);
#endif /* ! _FILTER_RULE_H */
diff --git a/filter/rule-context.c b/filter/rule-context.c
index 4bd364f0b8..e9dc71a150 100644
--- a/filter/rule-context.c
+++ b/filter/rule-context.c
@@ -54,12 +54,12 @@
#define d(x)
-static int load(RuleContext *rc, const char *system, const char *user);
-static int save(RuleContext *rc, const char *user);
-static int revert(RuleContext *rc, const char *user);
-static GList *rename_uri(RuleContext *rc, const char *olduri, const char *newuri, GCompareFunc cmp);
-static GList *delete_uri(RuleContext *rc, const char *uri, GCompareFunc cmp);
-static FilterElement *new_element(RuleContext *rc, const char *name);
+static gint load(RuleContext *rc, const gchar *system, const gchar *user);
+static gint save(RuleContext *rc, const gchar *user);
+static gint revert(RuleContext *rc, const gchar *user);
+static GList *rename_uri(RuleContext *rc, const gchar *olduri, const gchar *newuri, GCompareFunc cmp);
+static GList *delete_uri(RuleContext *rc, const gchar *uri, GCompareFunc cmp);
+static FilterElement *new_element(RuleContext *rc, const gchar *name);
static void rule_context_class_init(RuleContextClass *klass);
static void rule_context_init(RuleContext *rc);
@@ -68,7 +68,7 @@ static void rule_context_finalise(GObject *obj);
#define _PRIVATE(x)(((RuleContext *)(x))->priv)
struct _RuleContextPrivate {
- int frozen;
+ gint frozen;
};
static GObjectClass *parent_class = NULL;
@@ -168,14 +168,14 @@ rule_context_init(RuleContext *rc)
}
static void
-free_part_set(struct _part_set_map *map, void *data)
+free_part_set(struct _part_set_map *map, gpointer data)
{
g_free(map->name);
g_free(map);
}
static void
-free_rule_set(struct _rule_set_map *map, void *data)
+free_rule_set(struct _rule_set_map *map, gpointer data)
{
g_free(map->name);
g_free(map);
@@ -220,7 +220,7 @@ rule_context_new(void)
}
void
-rule_context_add_part_set(RuleContext *rc, const char *setname, GType part_type, RCPartFunc append, RCNextPartFunc next)
+rule_context_add_part_set(RuleContext *rc, const gchar *setname, GType part_type, RCPartFunc append, RCNextPartFunc next)
{
struct _part_set_map *map;
@@ -237,7 +237,7 @@ rule_context_add_part_set(RuleContext *rc, const char *setname, GType part_type,
}
void
-rule_context_add_rule_set(RuleContext *rc, const char *setname, GType rule_type, RCRuleFunc append, RCNextRuleFunc next)
+rule_context_add_rule_set(RuleContext *rc, const gchar *setname, GType rule_type, RCRuleFunc append, RCNextRuleFunc next)
{
struct _rule_set_map *map;
@@ -261,7 +261,7 @@ rule_context_add_rule_set(RuleContext *rc, const char *setname, GType rule_type,
* Set the text error for the context, or NULL to clear it.
**/
static void
-rule_context_set_error(RuleContext *rc, char *error)
+rule_context_set_error(RuleContext *rc, gchar *error)
{
g_return_if_fail (rc);
@@ -279,10 +279,10 @@ rule_context_set_error(RuleContext *rc, char *error)
*
* Return value:
**/
-int
-rule_context_load(RuleContext *rc, const char *system, const char *user)
+gint
+rule_context_load(RuleContext *rc, const gchar *system, const gchar *user)
{
- int res;
+ gint res;
g_return_val_if_fail (rc, -1);
@@ -296,7 +296,7 @@ rule_context_load(RuleContext *rc, const char *system, const char *user)
}
static int
-load(RuleContext *rc, const char *system, const char *user)
+load(RuleContext *rc, const gchar *system, const gchar *user)
{
xmlNodePtr set, rule, root;
xmlDocPtr systemdoc, userdoc;
@@ -315,7 +315,7 @@ load(RuleContext *rc, const char *system, const char *user)
}
root = xmlDocGetRootElement(systemdoc);
- if (root == NULL || strcmp((char *)root->name, "filterdescription")) {
+ if (root == NULL || strcmp((gchar *)root->name, "filterdescription")) {
rule_context_set_error(rc, g_strdup_printf("Unable to load system rules '%s': Invalid format", system));
xmlFreeDoc(systemdoc);
return -1;
@@ -335,7 +335,7 @@ load(RuleContext *rc, const char *system, const char *user)
d(printf("loading parts ...\n"));
rule = set->children;
while (rule) {
- if (!strcmp((char *)rule->name, "part")) {
+ if (!strcmp((gchar *)rule->name, "part")) {
FilterPart *part = FILTER_PART(g_object_new(part_map->type, NULL, NULL));
if (filter_part_xml_create(part, rule, rc) == 0) {
@@ -352,7 +352,7 @@ load(RuleContext *rc, const char *system, const char *user)
rule = set->children;
while (rule) {
d(printf("checking node: %s\n", rule->name));
- if (!strcmp((char *)rule->name, "rule")) {
+ if (!strcmp((gchar *)rule->name, "rule")) {
FilterRule *part = FILTER_RULE(g_object_new(rule_map->type, NULL, NULL));
if (filter_rule_xml_decode(part, rule, rc) == 0) {
@@ -381,7 +381,7 @@ load(RuleContext *rc, const char *system, const char *user)
rule = set->children;
while (rule) {
d(printf("checking node: %s\n", rule->name));
- if (!strcmp((char *)rule->name, "rule")) {
+ if (!strcmp((gchar *)rule->name, "rule")) {
FilterRule *part = FILTER_RULE(g_object_new(rule_map->type, NULL, NULL));
if (filter_rule_xml_decode(part, rule, rc) == 0) {
@@ -413,8 +413,8 @@ load(RuleContext *rc, const char *system, const char *user)
*
* Return value:
**/
-int
-rule_context_save(RuleContext *rc, const char *user)
+gint
+rule_context_save(RuleContext *rc, const gchar *user)
{
g_return_val_if_fail (rc, -1);
g_return_val_if_fail (user, -1);
@@ -423,23 +423,23 @@ rule_context_save(RuleContext *rc, const char *user)
}
static int
-save(RuleContext *rc, const char *user)
+save(RuleContext *rc, const gchar *user)
{
xmlDocPtr doc;
xmlNodePtr root, rules, work;
GList *l;
FilterRule *rule;
struct _rule_set_map *map;
- int ret;
+ gint ret;
- doc = xmlNewDoc((const unsigned char *)"1.0");
+ doc = xmlNewDoc((const guchar *)"1.0");
/* FIXME: set character encoding to UTF-8? */
- root = xmlNewDocNode(doc, NULL, (const unsigned char *)"filteroptions", NULL);
+ root = xmlNewDocNode(doc, NULL, (const guchar *)"filteroptions", NULL);
xmlDocSetRootElement(doc, root);
l = rc->rule_set_list;
while (l) {
map = l->data;
- rules = xmlNewDocNode(doc, NULL, (unsigned char *)map->name, NULL);
+ rules = xmlNewDocNode(doc, NULL, (guchar *)map->name, NULL);
xmlAddChild(root, rules);
rule = NULL;
while ((rule = map->next(rc, rule, NULL))) {
@@ -469,8 +469,8 @@ save(RuleContext *rc, const char *user)
*
* Return value:
**/
-int
-rule_context_revert(RuleContext *rc, const char *user)
+gint
+rule_context_revert(RuleContext *rc, const gchar *user)
{
g_return_val_if_fail (rc, 0);
@@ -481,18 +481,18 @@ rule_context_revert(RuleContext *rc, const char *user)
struct _revert_data {
GHashTable *rules;
- int rank;
+ gint rank;
};
static void
-revert_rule_remove(void *key, FilterRule *frule, RuleContext *rc)
+revert_rule_remove(gpointer key, FilterRule *frule, RuleContext *rc)
{
rule_context_remove_rule(rc, frule);
g_object_unref(frule);
}
static void
-revert_source_remove(void *key, struct _revert_data *rest_data, RuleContext *rc)
+revert_source_remove(gpointer key, struct _revert_data *rest_data, RuleContext *rc)
{
g_hash_table_foreach(rest_data->rules, (GHFunc)revert_rule_remove, rc);
g_hash_table_destroy(rest_data->rules);
@@ -500,7 +500,7 @@ revert_source_remove(void *key, struct _revert_data *rest_data, RuleContext *rc)
}
static guint
-source_hashf(const char *a)
+source_hashf(const gchar *a)
{
if (a)
return g_str_hash(a);
@@ -508,14 +508,14 @@ source_hashf(const char *a)
}
static int
-source_eqf(const char *a, const char *b)
+source_eqf(const gchar *a, const gchar *b)
{
return((a && b && strcmp(a, b) == 0))
|| (a == NULL && b == NULL);
}
static int
-revert(RuleContext *rc, const char *user)
+revert(RuleContext *rc, const gchar *user)
{
xmlNodePtr set, rule;
/*struct _part_set_map *part_map;*/
@@ -561,7 +561,7 @@ revert(RuleContext *rc, const char *user)
rule = set->children;
while (rule) {
d(printf("checking node: %s\n", rule->name));
- if (!strcmp((char *)rule->name, "rule")) {
+ if (!strcmp((gchar *)rule->name, "rule")) {
FilterRule *part = FILTER_RULE(g_object_new(rule_map->type, NULL, NULL));
if (filter_rule_xml_decode(part, rule, rc) == 0) {
@@ -606,7 +606,7 @@ revert(RuleContext *rc, const char *user)
}
FilterPart *
-rule_context_find_part(RuleContext *rc, const char *name)
+rule_context_find_part(RuleContext *rc, const gchar *name)
{
g_return_val_if_fail (rc, NULL);
g_return_val_if_fail (name, NULL);
@@ -616,7 +616,7 @@ rule_context_find_part(RuleContext *rc, const char *name)
}
FilterPart *
-rule_context_create_part(RuleContext *rc, const char *name)
+rule_context_create_part(RuleContext *rc, const gchar *name)
{
FilterPart *part;
@@ -638,7 +638,7 @@ rule_context_next_part(RuleContext *rc, FilterPart *last)
}
FilterRule *
-rule_context_next_rule(RuleContext *rc, FilterRule *last, const char *source)
+rule_context_next_rule(RuleContext *rc, FilterRule *last, const gchar *source)
{
g_return_val_if_fail (rc, NULL);
@@ -646,7 +646,7 @@ rule_context_next_rule(RuleContext *rc, FilterRule *last, const char *source)
}
FilterRule *
-rule_context_find_rule(RuleContext *rc, const char *name, const char *source)
+rule_context_find_rule(RuleContext *rc, const gchar *name, const gchar *source)
{
g_return_val_if_fail (name, NULL);
g_return_val_if_fail (rc, NULL);
@@ -680,11 +680,11 @@ rule_context_add_rule(RuleContext *rc, FilterRule *new)
}
static void
-new_rule_response(GtkWidget *dialog, int button, RuleContext *context)
+new_rule_response(GtkWidget *dialog, gint button, RuleContext *context)
{
if (button == GTK_RESPONSE_OK) {
FilterRule *rule = g_object_get_data((GObject *) dialog, "rule");
- char *user = g_object_get_data((GObject *) dialog, "path");
+ gchar *user = g_object_get_data((GObject *) dialog, "path");
if (!filter_rule_validate(rule)) {
/* no need to popup a dialog because the validate code does that. */
@@ -708,7 +708,7 @@ new_rule_response(GtkWidget *dialog, int button, RuleContext *context)
/* add a rule, with a gui, asking for confirmation first ... optionally save to path */
void
-rule_context_add_rule_gui(RuleContext *rc, FilterRule *rule, const char *title, const char *path)
+rule_context_add_rule_gui(RuleContext *rc, FilterRule *rule, const gchar *title, const gchar *path)
{
GtkDialog *dialog;
GtkWidget *widget;
@@ -764,10 +764,10 @@ rule_context_remove_rule(RuleContext *rc, FilterRule *rule)
}
void
-rule_context_rank_rule(RuleContext *rc, FilterRule *rule, const char *source, int rank)
+rule_context_rank_rule(RuleContext *rc, FilterRule *rule, const gchar *source, gint rank)
{
GList *node;
- int i = 0, index = 0;
+ gint i = 0, index = 0;
g_return_if_fail (rc);
g_return_if_fail (rule);
@@ -800,11 +800,11 @@ rule_context_rank_rule(RuleContext *rc, FilterRule *rule, const char *source, in
g_signal_emit(rc, signals[CHANGED], 0);
}
-int
-rule_context_get_rank_rule(RuleContext *rc, FilterRule *rule, const char *source)
+gint
+rule_context_get_rank_rule(RuleContext *rc, FilterRule *rule, const gchar *source)
{
GList *node;
- int i = 0;
+ gint i = 0;
g_return_val_if_fail (rc, -1);
g_return_val_if_fail (rule, -1);
@@ -830,10 +830,10 @@ rule_context_get_rank_rule(RuleContext *rc, FilterRule *rule, const char *source
}
FilterRule *
-rule_context_find_rank_rule(RuleContext *rc, int rank, const char *source)
+rule_context_find_rank_rule(RuleContext *rc, gint rank, const gchar *source)
{
GList *node;
- int i = 0;
+ gint i = 0;
g_return_val_if_fail (rc, NULL);
@@ -858,25 +858,25 @@ rule_context_find_rank_rule(RuleContext *rc, int rank, const char *source)
}
static GList *
-delete_uri(RuleContext *rc, const char *uri, GCompareFunc cmp)
+delete_uri(RuleContext *rc, const gchar *uri, GCompareFunc cmp)
{
return NULL;
}
GList *
-rule_context_delete_uri(RuleContext *rc, const char *uri, GCompareFunc cmp)
+rule_context_delete_uri(RuleContext *rc, const gchar *uri, GCompareFunc cmp)
{
return RULE_CONTEXT_GET_CLASS(rc)->delete_uri(rc, uri, cmp);
}
static GList *
-rename_uri(RuleContext *rc, const char *olduri, const char *newuri, GCompareFunc cmp)
+rename_uri(RuleContext *rc, const gchar *olduri, const gchar *newuri, GCompareFunc cmp)
{
return NULL;
}
GList *
-rule_context_rename_uri(RuleContext *rc, const char *olduri, const char *newuri, GCompareFunc cmp)
+rule_context_rename_uri(RuleContext *rc, const gchar *olduri, const gchar *newuri, GCompareFunc cmp)
{
return RULE_CONTEXT_GET_CLASS(rc)->rename_uri(rc, olduri, newuri, cmp);
}
@@ -897,7 +897,7 @@ rule_context_free_uri_list(RuleContext *rc, GList *uris)
}
static FilterElement *
-new_element(RuleContext *rc, const char *type)
+new_element(RuleContext *rc, const gchar *type)
{
if (!strcmp (type, "string")) {
return (FilterElement *) filter_input_new ();
@@ -941,7 +941,7 @@ new_element(RuleContext *rc, const char *type)
* Return value:
**/
FilterElement *
-rule_context_new_element(RuleContext *rc, const char *name)
+rule_context_new_element(RuleContext *rc, const gchar *name)
{
if (name == NULL)
return NULL;
diff --git a/filter/rule-context.h b/filter/rule-context.h
index 539c5b3b56..63c9abaa67 100644
--- a/filter/rule-context.h
+++ b/filter/rule-context.h
@@ -52,7 +52,7 @@ struct _RuleContext {
GObject parent_object;
struct _RuleContextPrivate *priv;
- char *error; /* string version of error */
+ gchar *error; /* string version of error */
guint32 flags; /* capability flags */
@@ -71,14 +71,14 @@ struct _RuleContextClass {
GObjectClass parent_class;
/* virtual methods */
- int (*load) (RuleContext *rc, const char *system, const char *user);
- int (*save) (RuleContext *rc, const char *user);
- int (*revert) (RuleContext *rc, const char *user);
+ gint (*load) (RuleContext *rc, const gchar *system, const gchar *user);
+ gint (*save) (RuleContext *rc, const gchar *user);
+ gint (*revert) (RuleContext *rc, const gchar *user);
- GList *(*delete_uri) (RuleContext *rc, const char *uri, GCompareFunc cmp);
- GList *(*rename_uri) (RuleContext *rc, const char *olduri, const char *newuri, GCompareFunc cmp);
+ GList *(*delete_uri) (RuleContext *rc, const gchar *uri, GCompareFunc cmp);
+ GList *(*rename_uri) (RuleContext *rc, const gchar *olduri, const gchar *newuri, GCompareFunc cmp);
- FilterElement *(*new_element)(RuleContext *rc, const char *name);
+ FilterElement *(*new_element)(RuleContext *rc, const gchar *name);
/* signals */
void (*rule_added) (RuleContext *rc, FilterRule *rule);
@@ -89,17 +89,17 @@ struct _RuleContextClass {
typedef void (*RCPartFunc) (RuleContext *rc, FilterPart *part);
typedef void (*RCRuleFunc) (RuleContext *rc, FilterRule *part);
typedef FilterPart * (*RCNextPartFunc) (RuleContext *rc, FilterPart *part);
-typedef FilterRule * (*RCNextRuleFunc) (RuleContext *rc, FilterRule *rule, const char *source);
+typedef FilterRule * (*RCNextRuleFunc) (RuleContext *rc, FilterRule *rule, const gchar *source);
struct _part_set_map {
- char *name;
+ gchar *name;
GType type;
RCPartFunc append;
RCNextPartFunc next;
};
struct _rule_set_map {
- char *name;
+ gchar *name;
GType type;
RCRuleFunc append;
RCNextRuleFunc next;
@@ -111,38 +111,38 @@ GType rule_context_get_type (void);
RuleContext *rule_context_new (void);
/* io */
-int rule_context_load (RuleContext *rc, const char *system, const char *user);
-int rule_context_save (RuleContext *rc, const char *user);
-int rule_context_revert (RuleContext *rc, const char *user);
+gint rule_context_load (RuleContext *rc, const gchar *system, const gchar *user);
+gint rule_context_save (RuleContext *rc, const gchar *user);
+gint rule_context_revert (RuleContext *rc, const gchar *user);
void rule_context_add_part (RuleContext *rc, FilterPart *new);
-FilterPart *rule_context_find_part (RuleContext *rc, const char *name);
-FilterPart *rule_context_create_part (RuleContext *rc, const char *name);
+FilterPart *rule_context_find_part (RuleContext *rc, const gchar *name);
+FilterPart *rule_context_create_part (RuleContext *rc, const gchar *name);
FilterPart *rule_context_next_part (RuleContext *rc, FilterPart *last);
-FilterRule *rule_context_next_rule (RuleContext *rc, FilterRule *last, const char *source);
-FilterRule *rule_context_find_rule (RuleContext *rc, const char *name, const char *source);
-FilterRule *rule_context_find_rank_rule (RuleContext *rc, int rank, const char *source);
+FilterRule *rule_context_next_rule (RuleContext *rc, FilterRule *last, const gchar *source);
+FilterRule *rule_context_find_rule (RuleContext *rc, const gchar *name, const gchar *source);
+FilterRule *rule_context_find_rank_rule (RuleContext *rc, gint rank, const gchar *source);
void rule_context_add_rule (RuleContext *rc, FilterRule *new);
-void rule_context_add_rule_gui (RuleContext *rc, FilterRule *rule, const char *title, const char *path);
+void rule_context_add_rule_gui (RuleContext *rc, FilterRule *rule, const gchar *title, const gchar *path);
void rule_context_remove_rule (RuleContext *rc, FilterRule *rule);
/* get/set the rank (position) of a rule */
-void rule_context_rank_rule (RuleContext *rc, FilterRule *rule, const char *source, int rank);
-int rule_context_get_rank_rule (RuleContext *rc, FilterRule *rule, const char *source);
+void rule_context_rank_rule (RuleContext *rc, FilterRule *rule, const gchar *source, gint rank);
+gint rule_context_get_rank_rule (RuleContext *rc, FilterRule *rule, const gchar *source);
/* setup type for set parts */
-void rule_context_add_part_set (RuleContext *rc, const char *setname, GType part_type,
+void rule_context_add_part_set (RuleContext *rc, const gchar *setname, GType part_type,
RCPartFunc append, RCNextPartFunc next);
-void rule_context_add_rule_set (RuleContext *rc, const char *setname, GType rule_type,
+void rule_context_add_rule_set (RuleContext *rc, const gchar *setname, GType rule_type,
RCRuleFunc append, RCNextRuleFunc next);
/* dynamic element types */
-FilterElement *rule_context_new_element(RuleContext *rc, const char *name);
+FilterElement *rule_context_new_element(RuleContext *rc, const gchar *name);
/* uri's disappear/renamed externally */
-GList *rule_context_delete_uri (RuleContext *rc, const char *uri, GCompareFunc cmp);
-GList *rule_context_rename_uri (RuleContext *rc, const char *olduri, const char *newuri, GCompareFunc cmp);
+GList *rule_context_delete_uri (RuleContext *rc, const gchar *uri, GCompareFunc cmp);
+GList *rule_context_rename_uri (RuleContext *rc, const gchar *olduri, const gchar *newuri, GCompareFunc cmp);
void rule_context_free_uri_list (RuleContext *rc, GList *uris);
diff --git a/filter/rule-editor.c b/filter/rule-editor.c
index 07ea3fd1e4..4a1e831451 100644
--- a/filter/rule-editor.c
+++ b/filter/rule-editor.c
@@ -35,11 +35,11 @@
#include "e-util/e-util-private.h"
#include "rule-editor.h"
-static int enable_undo = 0;
+static gint enable_undo = 0;
#define d(x)
-static void set_source (RuleEditor *re, const char *source);
+static void set_source (RuleEditor *re, const gchar *source);
static void set_sensitive (RuleEditor *re);
static FilterRule *create_rule (RuleEditor *re);
@@ -164,11 +164,11 @@ rule_editor_destroy (GtkObject *obj)
* Return value: A new #RuleEditor object.
**/
RuleEditor *
-rule_editor_new (RuleContext *rc, const char *source, const char *label)
+rule_editor_new (RuleContext *rc, const gchar *source, const gchar *label)
{
RuleEditor *re = (RuleEditor *) g_object_new (RULE_TYPE_EDITOR, NULL);
GladeXML *gui;
- char *filter_glade = g_build_filename (EVOLUTION_GLADEDIR,
+ gchar *filter_glade = g_build_filename (EVOLUTION_GLADEDIR,
"filter.glade",
NULL);
@@ -191,7 +191,7 @@ rule_editor_set_sensitive (RuleEditor *re)
/* used internally by implementations */
void
-rule_editor_set_source (RuleEditor *re, const char *source)
+rule_editor_set_source (RuleEditor *re, const gchar *source)
{
RULE_EDITOR_GET_CLASS (re)->set_source (re, source);
}
@@ -231,7 +231,7 @@ editor_destroy (RuleEditor *re, GObject *deadbeef)
}
static void
-rule_editor_add_undo (RuleEditor *re, int type, FilterRule *rule, int rank, int newrank)
+rule_editor_add_undo (RuleEditor *re, gint type, FilterRule *rule, gint rank, gint newrank)
{
RuleEditorUndo *undo;
@@ -299,7 +299,7 @@ rule_editor_play_undo (RuleEditor *re)
}
static void
-editor_response (GtkWidget *dialog, int button, RuleEditor *re)
+editor_response (GtkWidget *dialog, gint button, RuleEditor *re)
{
if (button == GTK_RESPONSE_CANCEL) {
if (enable_undo)
@@ -320,7 +320,7 @@ editor_response (GtkWidget *dialog, int button, RuleEditor *re)
}
static void
-add_editor_response (GtkWidget *dialog, int button, RuleEditor *re)
+add_editor_response (GtkWidget *dialog, gint button, RuleEditor *re)
{
GtkTreeSelection *selection;
GtkTreePath *path;
@@ -399,12 +399,12 @@ rule_add (GtkWidget *widget, RuleEditor *re)
}
static void
-edit_editor_response (GtkWidget *dialog, int button, RuleEditor *re)
+edit_editor_response (GtkWidget *dialog, gint button, RuleEditor *re)
{
FilterRule *rule;
GtkTreePath *path;
GtkTreeIter iter;
- int pos;
+ gint pos;
if (button == GTK_RESPONSE_OK) {
if (!filter_rule_validate (re->edit)) {
@@ -485,7 +485,7 @@ rule_delete (GtkWidget *widget, RuleEditor *re)
GtkTreeSelection *selection;
GtkTreePath *path;
GtkTreeIter iter;
- int pos, len;
+ gint pos, len;
update_selected_rule(re);
@@ -536,7 +536,7 @@ rule_delete (GtkWidget *widget, RuleEditor *re)
}
static void
-rule_move (RuleEditor *re, int from, int to)
+rule_move (RuleEditor *re, gint from, gint to)
{
GtkTreeSelection *selection;
GtkTreePath *path;
@@ -580,7 +580,7 @@ rule_move (RuleEditor *re, int from, int to)
static void
rule_top (GtkWidget *widget, RuleEditor *re)
{
- int pos;
+ gint pos;
update_selected_rule(re);
@@ -593,7 +593,7 @@ rule_top (GtkWidget *widget, RuleEditor *re)
static void
rule_up (GtkWidget *widget, RuleEditor *re)
{
- int pos;
+ gint pos;
update_selected_rule(re);
@@ -606,7 +606,7 @@ rule_up (GtkWidget *widget, RuleEditor *re)
static void
rule_down (GtkWidget *widget, RuleEditor *re)
{
- int pos;
+ gint pos;
update_selected_rule(re);
@@ -619,8 +619,8 @@ rule_down (GtkWidget *widget, RuleEditor *re)
static void
rule_bottom (GtkWidget *widget, RuleEditor *re)
{
- int pos;
- int index = -1, count = 0;
+ gint pos;
+ gint index = -1, count = 0;
FilterRule *rule = NULL;
update_selected_rule(re);
@@ -655,7 +655,7 @@ static void
set_sensitive (RuleEditor *re)
{
FilterRule *rule = NULL;
- int index = -1, count = 0;
+ gint index = -1, count = 0;
while ((rule = rule_context_next_rule (re->context, rule, re->source))) {
if (rule == re->current)
@@ -725,7 +725,7 @@ double_click (GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *colum
}
static void
-set_source (RuleEditor *re, const char *source)
+set_source (RuleEditor *re, const gchar *source)
{
FilterRule *rule = NULL;
GtkTreeIter iter;
@@ -746,7 +746,7 @@ set_source (RuleEditor *re, const char *source)
}
static void
-rule_able_toggled (GtkCellRendererToggle *renderer, char *arg1, gpointer user_data)
+rule_able_toggled (GtkCellRendererToggle *renderer, gchar *arg1, gpointer user_data)
{
GtkWidget *table = user_data;
GtkTreeSelection *selection;
@@ -772,11 +772,11 @@ rule_able_toggled (GtkCellRendererToggle *renderer, char *arg1, gpointer user_da
gtk_tree_path_free (path);
}
-GtkWidget *rule_editor_treeview_new (char *widget_name, char *string1, char *string2,
- int int1, int int2);
+GtkWidget *rule_editor_treeview_new (gchar *widget_name, gchar *string1, gchar *string2,
+ gint int1, gint int2);
GtkWidget *
-rule_editor_treeview_new (char *widget_name, char *string1, char *string2, int int1, int int2)
+rule_editor_treeview_new (gchar *widget_name, gchar *string1, gchar *string2, gint int1, gint int2)
{
GtkWidget *table, *scrolled;
GtkTreeSelection *selection;
@@ -826,11 +826,11 @@ rule_editor_treeview_new (char *widget_name, char *string1, char *string2, int i
}
void
-rule_editor_construct (RuleEditor *re, RuleContext *context, GladeXML *gui, const char *source, const char *label)
+rule_editor_construct (RuleEditor *re, RuleContext *context, GladeXML *gui, const gchar *source, const gchar *label)
{
GtkWidget *w;
- int i;
- char *tmp;
+ gint i;
+ gchar *tmp;
re->context = context;
g_object_ref (context);
diff --git a/filter/rule-editor.h b/filter/rule-editor.h
index 40cc90ef90..e5017eac25 100644
--- a/filter/rule-editor.h
+++ b/filter/rule-editor.h
@@ -53,10 +53,10 @@ struct _RuleEditor {
GtkWidget *dialog;
- char *source;
+ gchar *source;
struct _RuleEditorUndo *undo_log; /* cancel/undo log */
- unsigned int undo_active:1; /* we're performing undo */
+ guint undo_active:1; /* we're performing undo */
struct _RuleEditorPrivate *priv;
};
@@ -66,7 +66,7 @@ struct _RuleEditorClass {
/* virtual methods */
void (*set_sensitive) (RuleEditor *);
- void (*set_source) (RuleEditor *, const char *source);
+ void (*set_source) (RuleEditor *, const gchar *source);
FilterRule *(*create_rule) (RuleEditor *);
@@ -83,19 +83,19 @@ enum {
struct _RuleEditorUndo {
struct _RuleEditorUndo *next;
- unsigned int type;
+ guint type;
FilterRule *rule;
- int rank;
- int newrank;
+ gint rank;
+ gint newrank;
};
GType rule_editor_get_type(void);
-RuleEditor *rule_editor_new(RuleContext *rc, const char *source, const char *label);
+RuleEditor *rule_editor_new(RuleContext *rc, const gchar *source, const gchar *label);
-void rule_editor_construct(RuleEditor *re, RuleContext *context, GladeXML *gui, const char *source, const char *label);
+void rule_editor_construct(RuleEditor *re, RuleContext *context, GladeXML *gui, const gchar *source, const gchar *label);
/* methods */
-void rule_editor_set_source(RuleEditor *re, const char *source);
+void rule_editor_set_source(RuleEditor *re, const gchar *source);
/* calculates the sensitivity of the editor */
void rule_editor_set_sensitive(RuleEditor *re);
/* used internally to create a new rule appropriate for the editor */