aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-11-02 07:22:57 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-11-02 07:22:57 +0800
commite033f54a9044a4288c923e9b2c6d9477da076d26 (patch)
treee49c07744c18ba0663e15418843a5cc8e6485842
parent9bfc63718a9752a4e55cf03f5440dd82df63a758 (diff)
downloadgsoc2013-evolution-e033f54a9044a4288c923e9b2c6d9477da076d26.tar
gsoc2013-evolution-e033f54a9044a4288c923e9b2c6d9477da076d26.tar.gz
gsoc2013-evolution-e033f54a9044a4288c923e9b2c6d9477da076d26.tar.bz2
gsoc2013-evolution-e033f54a9044a4288c923e9b2c6d9477da076d26.tar.lz
gsoc2013-evolution-e033f54a9044a4288c923e9b2c6d9477da076d26.tar.xz
gsoc2013-evolution-e033f54a9044a4288c923e9b2c6d9477da076d26.tar.zst
gsoc2013-evolution-e033f54a9044a4288c923e9b2c6d9477da076d26.zip
Ported to GObject.
2002-11-01 Jeffrey Stedfast <fejj@ximian.com> * filter-element.c: Ported to GObject. * filter-input.c: Same. * filter-code.c: This too. * filter-colour.c: And this. * filter-datespec.c: You guessed it. * filter-file.c: And again... svn path=/trunk/; revision=18493
-rw-r--r--filter/ChangeLog4
-rw-r--r--filter/filter-context.h5
-rw-r--r--filter/filter-datespec.c176
-rw-r--r--filter/filter-datespec.h29
-rw-r--r--filter/filter-file.c106
-rw-r--r--filter/filter-file.h19
-rw-r--r--filter/filter-input.h1
7 files changed, 175 insertions, 165 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index 3f2da28ff4..c41b423058 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -8,6 +8,10 @@
* filter-colour.c: And this.
+ * filter-datespec.c: You guessed it.
+
+ * filter-file.c: And again...
+
2002-10-30 Dan Winship <danw@ximian.com>
* rule-editor.c (rule_add): Adjust default rule editor size to
diff --git a/filter/filter-context.h b/filter/filter-context.h
index d9d78af2af..93feb3b8b2 100644
--- a/filter/filter-context.h
+++ b/filter/filter-context.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,6 +20,7 @@
* Boston, MA 02111-1307, USA.
*/
+
#ifndef _FILTER_CONTEXT_H
#define _FILTER_CONTEXT_H
diff --git a/filter/filter-datespec.c b/filter/filter-datespec.c
index 9ee3b3e2a6..a0ac318f6f 100644
--- a/filter/filter-datespec.c
+++ b/filter/filter-datespec.c
@@ -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,7 +20,10 @@
* Boston, MA 02111-1307, USA.
*/
+
+#ifdef HAVE_CONFIG_H
#include <config.h>
+#endif
#include <string.h>
#include <stdlib.h>
@@ -45,7 +50,7 @@
#define d(x)
static gboolean validate (FilterElement *fe);
-static int date_eq(FilterElement *fe, FilterElement *cm);
+static int 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);
@@ -53,17 +58,17 @@ static GtkWidget *get_widget (FilterElement *fe);
static void build_code (FilterElement *fe, GString *out, struct _FilterPart *fds);
static void format_sexp (FilterElement *, GString *);
-static void filter_datespec_class_init (FilterDatespecClass *class);
-static void filter_datespec_init (FilterDatespec *gspaper);
-static void filter_datespec_finalise (GtkObject *obj);
+static void filter_datespec_class_init (FilterDatespecClass *klass);
+static void filter_datespec_init (FilterDatespec *fd);
+static void filter_datespec_finalise (GObject *obj);
#define PRIV(x) (((FilterDatespec *)(x))->priv)
typedef struct _timespan {
guint32 seconds;
- const gchar *singular;
- const gchar *plural;
- gfloat max;
+ const char *singular;
+ const char *plural;
+ float max;
} timespan;
static const timespan timespans[] = {
@@ -88,65 +93,66 @@ struct _FilterDatespecPrivate {
static FilterElementClass *parent_class;
-guint
+GType
filter_datespec_get_type (void)
{
- static guint type = 0;
+ static GType type = 0;
if (!type) {
- GtkTypeInfo type_info = {
- "FilterDatespec",
- sizeof (FilterDatespec),
+ static const GTypeInfo info = {
sizeof (FilterDatespecClass),
- (GtkClassInitFunc) filter_datespec_class_init,
- (GtkObjectInitFunc) filter_datespec_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
+ NULL, /* base_class_init */
+ NULL, /* base_class_finalize */
+ (GClassInitFunc) filter_datespec_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (FilterDatespec),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) filter_datespec_init,
};
- type = gtk_type_unique (filter_element_get_type (), &type_info);
+ type = g_type_register_static (FILTER_TYPE_ELEMENT, "FilterDatespec", &info, 0);
}
return type;
}
static void
-filter_datespec_class_init (FilterDatespecClass *class)
+filter_datespec_class_init (FilterDatespecClass *klass)
{
- GtkObjectClass *object_class;
- FilterElementClass *filter_element = (FilterElementClass *)class;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ FilterElementClass *fe_class = FILTER_ELEMENT_CLASS (klass);
- object_class = (GtkObjectClass *)class;
- parent_class = gtk_type_class (filter_element_get_type ());
+ parent_class = g_type_class_ref (FILTER_TYPE_ELEMENT);
object_class->finalize = filter_datespec_finalise;
/* override methods */
- filter_element->validate = validate;
- filter_element->eq = date_eq;
- filter_element->xml_create = xml_create;
- filter_element->xml_encode = xml_encode;
- filter_element->xml_decode = xml_decode;
- filter_element->get_widget = get_widget;
- filter_element->build_code = build_code;
- filter_element->format_sexp = format_sexp;
+ fe_class->validate = validate;
+ fe_class->eq = date_eq;
+ fe_class->xml_create = xml_create;
+ fe_class->xml_encode = xml_encode;
+ fe_class->xml_decode = xml_decode;
+ fe_class->get_widget = get_widget;
+ fe_class->build_code = build_code;
+ fe_class->format_sexp = format_sexp;
}
static void
-filter_datespec_init (FilterDatespec *o)
+filter_datespec_init (FilterDatespec *fd)
{
- o->priv = g_malloc0 (sizeof (*o->priv));
- o->type = FDST_UNKNOWN;
+ fd->priv = g_malloc0 (sizeof (*fd->priv));
+ fd->type = FDST_UNKNOWN;
}
static void
-filter_datespec_finalise(GtkObject *obj)
+filter_datespec_finalise (GtkObject *obj)
{
- FilterDatespec *o = (FilterDatespec *)obj;
+ FilterDatespec *fd = (FilterDatespec *) obj;
- g_free (o->priv);
+ g_free (fd->priv);
- ((GtkObjectClass *)(parent_class))->finalize(obj);
+ G_OBJECT_CLASS (parent_class)->finalize (obj);
}
/**
@@ -159,8 +165,7 @@ filter_datespec_finalise(GtkObject *obj)
FilterDatespec *
filter_datespec_new (void)
{
- FilterDatespec *o = (FilterDatespec *)gtk_type_new (filter_datespec_get_type ());
- return o;
+ return (FilterDatespec *) g_object_new (FILTER_TYPE_DATESPEC, NULL, NULL);
}
static gboolean
@@ -179,11 +184,11 @@ validate (FilterElement *fe)
}
static int
-date_eq(FilterElement *fe, FilterElement *cm)
+date_eq (FilterElement *fe, FilterElement *cm)
{
FilterDatespec *fd = (FilterDatespec *)fe, *cd = (FilterDatespec *)cm;
-
- return ((FilterElementClass *)(parent_class))->eq(fe, cm)
+
+ return FILTER_ELEMENT_CLASS (parent_class)->eq(fe, cm)
&& (fd->type == cd->type)
&& (fd->value == cd->value);
}
@@ -192,7 +197,7 @@ static void
xml_create (FilterElement *fe, xmlNodePtr node)
{
/* parent implementation */
- ((FilterElementClass *)(parent_class))->xml_create(fe, node);
+ FILTER_ELEMENT_CLASS (parent_class)->xml_create (fe, node);
}
static xmlNodePtr
@@ -200,7 +205,7 @@ xml_encode (FilterElement *fe)
{
xmlNodePtr value, work;
FilterDatespec *fds = (FilterDatespec *)fe;
- gchar str[32];
+ char str[32];
d(printf ("Encoding datespec as xml\n"));
@@ -222,7 +227,7 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
{
FilterDatespec *fds = (FilterDatespec *)fe;
xmlNodePtr n;
- gchar *val;
+ char *val;
d(printf ("Decoding datespec from xml %p\n", fe));
@@ -242,28 +247,30 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
}
n = n->next;
}
+
return 0;
}
-static int get_best_span(time_t val)
+static int
+get_best_span (time_t val)
{
int i;
-
+
for (i=N_TIMESPANS-1;i>=0;i--) {
if (val % timespans[i].seconds == 0)
return i;
}
-
+
return 0;
}
/* sets button label */
static void
-set_button(FilterDatespec *fds)
+set_button (FilterDatespec *fds)
{
char buf[128];
char *label = buf;
-
+
switch (fds->type) {
case FDST_UNKNOWN:
label = _("<click here to select a date>");
@@ -273,7 +280,7 @@ set_button(FilterDatespec *fds)
break;
case FDST_SPECIFIED: {
struct tm tm;
-
+
localtime_r(&fds->value, &tm);
/* strftime for date filter display, only needs to show a day date (i.e. no time) */
strftime(buf, sizeof(buf), _("%d-%b-%Y"), &tm);
@@ -283,10 +290,10 @@ set_button(FilterDatespec *fds)
label = _("now");
else {
int span, count;
-
+
span = get_best_span(fds->value);
count = fds->value / timespans[span].seconds;
-
+
if (count == 1)
/* 1 (minute|day|...) ago (singular time ago) */
sprintf(buf, _("%d %s ago"), count, timespans[span].singular);
@@ -296,20 +303,20 @@ set_button(FilterDatespec *fds)
}
break;
}
-
+
gtk_label_set_text((GtkLabel *)fds->priv->label_button, label);
}
static void
-get_values(FilterDatespec *fds)
+get_values (FilterDatespec *fds)
{
struct _FilterDatespecPrivate *p = PRIV(fds);
-
+
switch(fds->priv->type) {
case FDST_SPECIFIED: {
guint year, month, day;
struct tm tm;
-
+
gtk_calendar_get_date((GtkCalendar *)p->calendar_specify, &year, &month, &day);
memset(&tm, 0, sizeof(tm));
tm.tm_mday = day;
@@ -320,7 +327,7 @@ get_values(FilterDatespec *fds)
break; }
case FDST_X_AGO: {
int val;
-
+
val = gtk_spin_button_get_value_as_int((GtkSpinButton *)p->spin_relative);
fds->value = timespans[p->span].seconds * val;
break; }
@@ -328,43 +335,45 @@ get_values(FilterDatespec *fds)
default:
break;
}
-
+
fds->type = p->type;
}
static void
-set_values(FilterDatespec *fds)
+set_values (FilterDatespec *fds)
{
struct _FilterDatespecPrivate *p = PRIV(fds);
-
+
p->type = fds->type==FDST_UNKNOWN ? FDST_NOW : fds->type;
-
+
switch (p->type) {
case FDST_NOW:
case FDST_UNKNOWN:
/* noop */
break;
- case FDST_SPECIFIED: {
+ case FDST_SPECIFIED:
+ {
struct tm tm;
-
+
localtime_r(&fds->value, &tm);
gtk_calendar_select_month((GtkCalendar*)p->calendar_specify, tm.tm_mon, tm.tm_year + 1900);
gtk_calendar_select_day((GtkCalendar*)p->calendar_specify, tm.tm_mday);
- break; }
+ break;
+ }
case FDST_X_AGO:
p->span = get_best_span(fds->value);
gtk_spin_button_set_value((GtkSpinButton*)p->spin_relative, fds->value/timespans[p->span].seconds);
gtk_option_menu_set_history((GtkOptionMenu*)p->option_relative, p->span);
break;
}
-
+
gtk_notebook_set_page((GtkNotebook*)p->notebook_type, p->type);
gtk_option_menu_set_history((GtkOptionMenu*)p->option_type, p->type);
}
static void
-set_option_type(GtkMenu *menu, FilterDatespec *fds)
+set_option_type (GtkMenu *menu, FilterDatespec *fds)
{
GtkWidget *w;
@@ -375,10 +384,10 @@ set_option_type(GtkMenu *menu, FilterDatespec *fds)
}
static void
-set_option_relative(GtkMenu *menu, FilterDatespec *fds)
+set_option_relative (GtkMenu *menu, FilterDatespec *fds)
{
GtkWidget *w;
-
+
w = gtk_menu_get_active(menu);
fds->priv->span = g_list_index(GTK_MENU_SHELL(menu)->children, w);
}
@@ -388,7 +397,7 @@ dialogue_clicked(GnomeDialog *gd, int button, FilterDatespec *fds)
{
if (button != 0)
return;
-
+
get_values(fds);
set_button(fds);
}
@@ -400,33 +409,31 @@ button_clicked (GtkButton *button, FilterDatespec *fds)
struct _FilterDatespecPrivate *p = PRIV(fds);
GtkWidget *w, *x;
GladeXML *gui;
-
+
gui = glade_xml_new(FILTER_GLADEDIR "/filter.glade", "filter_datespec");
w = glade_xml_get_widget(gui, "filter_datespec");
-
+
gd = (GnomeDialog *) gnome_dialog_new (_("Select a time to compare against"),
GNOME_STOCK_BUTTON_OK,
GNOME_STOCK_BUTTON_CANCEL,
NULL);
-
+
p->notebook_type = glade_xml_get_widget(gui, "notebook_type");
p->option_type = glade_xml_get_widget(gui, "option_type");
p->calendar_specify = glade_xml_get_widget(gui, "calendar_specify");
p->spin_relative = glade_xml_get_widget(gui, "spin_relative");
p->option_relative = glade_xml_get_widget(gui, "option_relative");
-
+
set_values(fds);
-
- gtk_signal_connect((GtkObject *)GTK_OPTION_MENU(p->option_type)->menu, "deactivate", set_option_type, fds);
- gtk_signal_connect((GtkObject *)GTK_OPTION_MENU(p->option_relative)->menu, "deactivate", set_option_relative, fds);
-
+
+ g_signal_connect (GTK_OPTION_MENU (p->option_type)->menu, "deactivate", set_option_type, fds);
+ g_signal_connect (GTK_OPTION_MENU (p->option_relative)->menu, "deactivate", set_option_relative, fds);
+
gtk_box_pack_start ((GtkBox *)gd->vbox, w, TRUE, TRUE, 3);
-
- gtk_signal_connect((GtkObject *)gd, "clicked", dialogue_clicked, fds);
-
+
+ g_signal_connect (gd, "clicked", dialogue_clicked, fds);
+
gnome_dialog_run_and_close(gd);
-
- return;
}
static GtkWidget *
@@ -445,6 +452,7 @@ get_widget (FilterElement *fe)
gtk_widget_show (button);
gtk_widget_show (fds->priv->label_button);
+
return button;
}
diff --git a/filter/filter-datespec.h b/filter/filter-datespec.h
index 5d20380a47..6290ab34b5 100644
--- a/filter/filter-datespec.h
+++ b/filter/filter-datespec.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,18 +20,22 @@
* Boston, MA 02111-1307, USA.
*/
+
#ifndef _FILTER_DATESPEC_H
#define _FILTER_DATESPEC_H
#include <time.h>
#include "filter-element.h"
-#define FILTER_DATESPEC(obj) GTK_CHECK_CAST (obj, filter_datespec_get_type (), FilterDatespec)
-#define FILTER_DATESPEC_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_datespec_get_type (), FilterDatespecClass)
-#define IS_FILTER_DATESPEC(obj) GTK_CHECK_TYPE (obj, filter_datespec_get_type ())
+#define FILTER_TYPE_DATESPEC (filter_datespec_get_type ())
+#define FILTER_DATESPEC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FILTER_TYPE_DATESPEC, FilterDatespec))
+#define FILTER_DATESPEC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FILTER_TYPE_DATESPEC, FilterDatespecClass))
+#define IS_FILTER_DATESPEC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FILTER_TYPE_DATESPEC))
+#define IS_FILTER_DATESPEC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FILTER_TYPE_DATESPEC))
+#define FILTER_DATESPEC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FILTER_TYPE_DATESPEC, FilterDatespecClass))
-typedef struct _FilterDatespec FilterDatespec;
-typedef struct _FilterDatespecClass FilterDatespecClass;
+typedef struct _FilterDatespec FilterDatespec;
+typedef struct _FilterDatespecClass FilterDatespecClass;
typedef enum _FilterDatespec_type {
FDST_UNKNOWN = -1,
@@ -41,14 +47,14 @@ typedef enum _FilterDatespec_type {
struct _FilterDatespec {
FilterElement parent;
struct _FilterDatespecPrivate *priv;
-
+
FilterDatespec_type type;
-
+
/* either a timespan, an absolute time, or 0
* depending on type -- the above mapping to
* (X_AGO, SPECIFIED, NOW)
*/
-
+
time_t value;
};
@@ -60,10 +66,9 @@ struct _FilterDatespecClass {
/* signals */
};
-guint filter_datespec_get_type (void);
-FilterDatespec *filter_datespec_new (void);
+GType filter_datespec_get_type (void);
+FilterDatespec *filter_datespec_new (void);
/* methods */
#endif /* ! _FILTER_DATESPEC_H */
-
diff --git a/filter/filter-file.c b/filter/filter-file.c
index 4b4eb69904..6cec675f14 100644
--- a/filter/filter-file.c
+++ b/filter/filter-file.c
@@ -28,7 +28,6 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <gtk/gtkobject.h>
#include <gtk/gtkwidget.h>
#include <libgnome/gnome-defs.h>
@@ -44,48 +43,41 @@
#define d(x)
static gboolean validate (FilterElement *fe);
-static int 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 GtkWidget *get_widget(FilterElement *fe);
-static void build_code(FilterElement *fe, GString *out, struct _FilterPart *ff);
-static void format_sexp(FilterElement *, GString *);
+static int 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 GtkWidget *get_widget (FilterElement *fe);
+static void build_code (FilterElement *fe, GString *out, struct _FilterPart *ff);
+static void format_sexp (FilterElement *, GString *);
-static void filter_file_class_init (FilterFileClass *class);
-static void filter_file_init (FilterFile *gspaper);
-static void filter_file_finalise (GtkObject *obj);
+static void filter_file_class_init (FilterFileClass *klass);
+static void filter_file_init (FilterFile *ff);
+static void filter_file_finalise (GObject *obj);
-#define _PRIVATE(x) (((FilterFile *)(x))->priv)
-
-struct _FilterFilePrivate {
-};
static FilterElementClass *parent_class;
-enum {
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-GtkType
+GType
filter_file_get_type (void)
{
- static GtkType type = 0;
+ static GType type = 0;
if (!type) {
- GtkTypeInfo type_info = {
- "FilterFile",
- sizeof (FilterFile),
+ static const GTypeInfo info = {
sizeof (FilterFileClass),
- (GtkClassInitFunc) filter_file_class_init,
- (GtkObjectInitFunc) filter_file_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
+ NULL, /* base_class_init */
+ NULL, /* base_class_finalize */
+ (GClassInitFunc) filter_file_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (FilterFile),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) filter_file_init,
};
- type = gtk_type_unique (filter_element_get_type (), &type_info);
+ type = g_type_register_static (FILTER_TYPE_ELEMENT, "FilterFile", &info, 0);
}
return type;
@@ -94,45 +86,39 @@ filter_file_get_type (void)
static void
filter_file_class_init (FilterFileClass *klass)
{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
- FilterElementClass *filter_element = (FilterElementClass *) klass;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ FilterElementClass *fe_class = FILTER_ELEMENT_CLASS (klass);
- parent_class = gtk_type_class (filter_element_get_type ());
+ parent_class = g_type_class_ref (FILTER_TYPE_ELEMENT);
object_class->finalize = filter_file_finalise;
/* override methods */
- filter_element->validate = validate;
- filter_element->eq = file_eq;
- filter_element->xml_create = xml_create;
- filter_element->xml_encode = xml_encode;
- filter_element->xml_decode = xml_decode;
- filter_element->get_widget = get_widget;
- filter_element->build_code = build_code;
- filter_element->format_sexp = format_sexp;
-
- /* signals */
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
+ fe_class->validate = validate;
+ fe_class->eq = file_eq;
+ fe_class->xml_create = xml_create;
+ fe_class->xml_encode = xml_encode;
+ fe_class->xml_decode = xml_decode;
+ fe_class->get_widget = get_widget;
+ fe_class->build_code = build_code;
+ fe_class->format_sexp = format_sexp;
}
static void
-filter_file_init (FilterFile *o)
+filter_file_init (FilterFile *ff)
{
- o->priv = g_malloc0 (sizeof (*o->priv));
+ ;
}
static void
-filter_file_finalise (GtkObject *obj)
+filter_file_finalise (GObject *obj)
{
- FilterFile *o = (FilterFile *) obj;
-
- xmlFree (o->type);
- g_free (o->path);
+ FilterFile *ff = (FilterFile *) obj;
- g_free (o->priv);
+ xmlFree (ff->type);
+ g_free (ff->path);
- ((GtkObjectClass *)(parent_class))->finalize (obj);
+ G_OBJECT_CLASS (parent_class)->finalize (obj);
}
/**
@@ -145,7 +131,7 @@ filter_file_finalise (GtkObject *obj)
FilterFile *
filter_file_new (void)
{
- return (FilterFile *) gtk_type_new (filter_file_get_type ());
+ return (FilterFile *) g_object_new (FILTER_TYPE_FILE, NULL, NULL);
}
@@ -209,10 +195,10 @@ file_eq (FilterElement *fe, FilterElement *cm)
{
FilterFile *ff = (FilterFile *)fe, *cf = (FilterFile *)cm;
- return ((FilterElementClass *)(parent_class))->eq(fe, cm)
- && ((ff->path && cf->path && strcmp(ff->path, cf->path) == 0)
+ return FILTER_ELEMENT_CLASS (parent_class)->eq (fe, cm)
+ && ((ff->path && cf->path && strcmp (ff->path, cf->path) == 0)
|| (ff->path == NULL && cf->path == NULL))
- && ((ff->type && cf->type && strcmp(ff->type, cf->type) == 0)
+ && ((ff->type && cf->type && strcmp (ff->type, cf->type) == 0)
|| (ff->type == NULL && cf->type == NULL));
}
@@ -220,7 +206,7 @@ static void
xml_create (FilterElement *fe, xmlNodePtr node)
{
/* parent implementation */
- ((FilterElementClass *)(parent_class))->xml_create (fe, node);
+ FILTER_ELEMENT_CLASS (parent_class)->xml_create (fe, node);
}
static xmlNodePtr
@@ -311,7 +297,7 @@ get_widget (FilterElement *fe)
entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (fileentry));
e_utf8_gtk_entry_set_text (GTK_ENTRY (entry), file->path);
- gtk_signal_connect (GTK_OBJECT (entry), "changed", entry_changed, fe);
+ g_signal_connect (entry, "changed", entry_changed, fe);
return fileentry;
}
diff --git a/filter/filter-file.h b/filter/filter-file.h
index 173e35c5fb..a3e28d0b5c 100644
--- a/filter/filter-file.h
+++ b/filter/filter-file.h
@@ -31,16 +31,18 @@ extern "C" {
#include "filter-element.h"
-#define FILTER_FILE(obj) GTK_CHECK_CAST (obj, filter_file_get_type (), FilterFile)
-#define FILTER_FILE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_file_get_type (), FilterFileClass)
-#define IS_FILTER_FILE(obj) GTK_CHECK_TYPE (obj, filter_file_get_type ())
+#define FILTER_TYPE_FILE (filter_file_get_type ())
+#define FILTER_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FILTER_TYPE_FILE, FilterFile))
+#define FILTER_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FILTER_TYPE_FILE, FilterFileClass))
+#define IS_FILTER_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FILTER_TYPE_FILE))
+#define IS_FILTER_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FILTER_TYPE_FILE))
+#define FILTER_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FILTER_TYPE_FILE, FilterFileClass))
-typedef struct _FilterFile FilterFile;
-typedef struct _FilterFileClass FilterFileClass;
+typedef struct _FilterFile FilterFile;
+typedef struct _FilterFileClass FilterFileClass;
struct _FilterFile {
- FilterElement parent;
- struct _FilterFilePrivate *priv;
+ FilterElement parent_object;
char *type;
char *path;
@@ -54,7 +56,8 @@ struct _FilterFileClass {
/* signals */
};
-GtkType filter_file_get_type (void);
+
+GType filter_file_get_type (void);
FilterFile *filter_file_new (void);
diff --git a/filter/filter-input.h b/filter/filter-input.h
index 760548c3b3..7a7b4761de 100644
--- a/filter/filter-input.h
+++ b/filter/filter-input.h
@@ -20,6 +20,7 @@
* Boston, MA 02111-1307, USA.
*/
+
#ifndef _FILTER_INPUT_H
#define _FILTER_INPUT_H