diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-11-06 04:47:24 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-11-06 04:47:24 +0800 |
commit | 96669b4af8ecc871dbfd405271293f29f38a05f3 (patch) | |
tree | bfe7084583e6d965a5ebd65c8199e24ad7ba1390 | |
parent | 12db8c46874e98b39ad026972527e422e4c228eb (diff) | |
download | gsoc2013-evolution-96669b4af8ecc871dbfd405271293f29f38a05f3.tar gsoc2013-evolution-96669b4af8ecc871dbfd405271293f29f38a05f3.tar.gz gsoc2013-evolution-96669b4af8ecc871dbfd405271293f29f38a05f3.tar.bz2 gsoc2013-evolution-96669b4af8ecc871dbfd405271293f29f38a05f3.tar.lz gsoc2013-evolution-96669b4af8ecc871dbfd405271293f29f38a05f3.tar.xz gsoc2013-evolution-96669b4af8ecc871dbfd405271293f29f38a05f3.tar.zst gsoc2013-evolution-96669b4af8ecc871dbfd405271293f29f38a05f3.zip |
Ported.
2002-11-05 Jeffrey Stedfast <fejj@ximian.com>
* score-rule.c: Ported.
* score-editor.c: Ported. Again, thise code seems to be unused.
* score-context.c: Ported. Although it seems this code isn't
really used anywhere?
svn path=/trunk/; revision=18562
-rw-r--r-- | filter/ChangeLog | 9 | ||||
-rw-r--r-- | filter/filter-editor.c | 10 | ||||
-rw-r--r-- | filter/score-context.c | 75 | ||||
-rw-r--r-- | filter/score-context.h | 31 | ||||
-rw-r--r-- | filter/score-editor.c | 112 | ||||
-rw-r--r-- | filter/score-editor.h | 35 | ||||
-rw-r--r-- | filter/score-rule.c | 88 | ||||
-rw-r--r-- | filter/score-rule.h | 34 |
8 files changed, 192 insertions, 202 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog index c2241812e3..c4d6be9187 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -1,3 +1,12 @@ +2002-11-05 Jeffrey Stedfast <fejj@ximian.com> + + * score-rule.c: Ported. + + * score-editor.c: Ported. Again, thise code seems to be unused. + + * score-context.c: Ported. Although it seems this code isn't + really used anywhere? + 2002-11-04 Jeffrey Stedfast <fejj@ximian.com> * filter-part.c: Ported. diff --git a/filter/filter-editor.c b/filter/filter-editor.c index ae5d47563b..60e38c3bff 100644 --- a/filter/filter-editor.c +++ b/filter/filter-editor.c @@ -42,7 +42,7 @@ static void filter_editor_init (FilterEditor *fe); static void filter_editor_finalise (GObject *obj); -static GnomeDialogClass *parent_class = NULL; +static RuleEditorClass *parent_class = NULL; GtkType @@ -75,7 +75,7 @@ filter_editor_class_init (FilterEditorClass *klass) GtkObjectClass *object_class = (GtkObjectClass *) klass; RuleEditorClass *re_class = (RuleEditorClass *) klass; - parent_class = gtk_type_class (gnome_dialog_get_type ()); + parent_class = gtk_type_class (rule_editor_get_type ()); gobject_class->finalize = filter_editor_finalise; @@ -86,16 +86,12 @@ filter_editor_class_init (FilterEditorClass *klass) static void filter_editor_init (FilterEditor *fe) { - fe->priv = g_malloc0 (sizeof (*fe->priv)); + ; } static void filter_editor_finalise (GObject *obj) { - FilterEditor *fe = (FilterEditor *) obj; - - g_free (fe->priv); - G_OBJECT_CLASS (parent_class)->finalize (obj); } diff --git a/filter/score-context.c b/filter/score-context.c index 4c892bc8d3..dd3663ffab 100644 --- a/filter/score-context.c +++ b/filter/score-context.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,75 +20,71 @@ * Boston, MA 02111-1307, USA. */ + #ifdef HAVE_CONFIG_H #include <config.h> #endif -#include <gtk/gtkobject.h> - #include "score-context.h" #include "score-rule.h" -static void score_context_class_init (ScoreContextClass *class); -static void score_context_init (ScoreContext *gspaper); -static void score_context_finalise (GtkObject *obj); +static void score_context_class_init (ScoreContextClass *klass); +static void score_context_init (ScoreContext *sc); +static void score_context_finalise (GObject *obj); + -static RuleContextClass *parent_class; +static RuleContextClass *parent_class = NULL; -guint + +GType score_context_get_type (void) { - static guint type = 0; + static GType type = 0; if (!type) { - GtkTypeInfo type_info = { - "ScoreContext", - sizeof(ScoreContext), - sizeof(ScoreContextClass), - (GtkClassInitFunc)score_context_class_init, - (GtkObjectInitFunc)score_context_init, - (GtkArgSetFunc)NULL, - (GtkArgGetFunc)NULL + static const GTypeInfo info = { + sizeof (ScoreContextClass), + NULL, /* base_class_init */ + NULL, /* base_class_finalize */ + (GClassInitFunc) score_context_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (ScoreContext), + 0, /* n_preallocs */ + (GInstanceInitFunc) score_context_init, }; - type = gtk_type_unique(rule_context_get_type (), &type_info); + type = g_type_register_static (RULE_TYPE_CONTEXT, "ScoreContext", &info, 0); } return type; } static void -score_context_class_init (ScoreContextClass *class) +score_context_class_init (ScoreContextClass *klass) { - GtkObjectClass *object_class; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + parent_class = g_type_class_ref (rule_context_get_type ()); - object_class = (GtkObjectClass *)class; - parent_class = gtk_type_class(rule_context_get_type ()); - object_class->finalize = score_context_finalise; - /* override methods */ - } static void -score_context_init (ScoreContext *o) +score_context_init (ScoreContext *sc) { - rule_context_add_part_set((RuleContext *)o, "partset", filter_part_get_type(), - rule_context_add_part, rule_context_next_part); + rule_context_add_part_set ((RuleContext *) sc, "partset", filter_part_get_type (), + rule_context_add_part, rule_context_next_part); - rule_context_add_rule_set((RuleContext *)o, "ruleset", score_rule_get_type(), - rule_context_add_rule, rule_context_next_rule); + rule_context_add_rule_set ((RuleContext *) sc, "ruleset", score_rule_get_type (), + rule_context_add_rule, rule_context_next_rule); } static void -score_context_finalise(GtkObject *obj) +score_context_finalise (GObject *obj) { - ScoreContext *o = (ScoreContext *)obj; - - o = o; - - ((GtkObjectClass *)(parent_class))->finalize(obj); + G_OBJECT_CLASS (parent_class)->finalize (obj); } /** @@ -97,8 +95,7 @@ score_context_finalise(GtkObject *obj) * Return value: A new #ScoreContext object. **/ ScoreContext * -score_context_new(void) +score_context_new (void) { - ScoreContext *o = (ScoreContext *)gtk_type_new(score_context_get_type ()); - return o; + return (ScoreContext *) g_object_new (SCORE_TYPE_CONTEXT, NULL, NULL); } diff --git a/filter/score-context.h b/filter/score-context.h index 3d636797f3..7a76ac8d32 100644 --- a/filter/score-context.h +++ b/filter/score-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 @@ -23,29 +25,34 @@ #include "rule-context.h" -#define SCORE_CONTEXT(obj) GTK_CHECK_CAST (obj, score_context_get_type (), ScoreContext) -#define SCORE_CONTEXT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, score_context_get_type (), ScoreContextClass) -#define IS_SCORE_CONTEXT(obj) GTK_CHECK_TYPE (obj, score_context_get_type ()) +#define SCORE_TYPE_CONTEXT (score_context_get_type ()) +#define SCORE_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SCORE_TYPE_CONTEXT, ScoreContext)) +#define SCORE_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SCORE_TYPE_CONTEXT, ScoreContextClass)) +#define IS_SCORE_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SCORE_TYPE_CONTEXT)) +#define IS_SCORE_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SCORE_TYPE_CONTEXT)) +#define SCORE_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SCORE_TYPE_CONTEXT, ScoreContextClass)) -typedef struct _ScoreContext ScoreContext; -typedef struct _ScoreContextClass ScoreContextClass; +typedef struct _ScoreContext ScoreContext; +typedef struct _ScoreContextClass ScoreContextClass; struct _ScoreContext { - RuleContext parent; + RuleContext parent_object; + }; struct _ScoreContextClass { RuleContextClass parent_class; - + /* virtual methods */ - + /* signals */ }; -guint score_context_get_type (void); -ScoreContext *score_context_new (void); + +GType score_context_get_type (void); + +ScoreContext *score_context_new (void); /* methods */ #endif /* ! _SCORE_CONTEXT_H */ - diff --git a/filter/score-editor.c b/filter/score-editor.c index ab24afd499..e5023260ba 100644 --- a/filter/score-editor.c +++ b/filter/score-editor.c @@ -1,5 +1,6 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * Copyright (C) 2001 Ximian Inc. + * Copyright (C) 2001-2002 Ximian Inc. * * Authors: Not Zed <notzed@lostzed.mmc.com.au> * Jeffrey Stedfast <fejj@ximian.com> @@ -19,94 +20,77 @@ * Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H #include <config.h> +#endif -#include <glib.h> #include <gtk/gtkframe.h> #include <libgnome/gnome-defs.h> #include <libgnome/gnome-i18n.h> -#include <glade/glade.h> -#include <gal/widgets/e-unicode.h> #include "score-editor.h" -#include "score-context.h" #include "score-rule.h" #define d(x) static FilterRule * create_rule(RuleEditor *re); -static void score_editor_class_init (ScoreEditorClass *class); -static void score_editor_init (ScoreEditor *gspaper); -static void score_editor_finalise (GtkObject *obj); - -#define _PRIVATE(x) (((ScoreEditor *)(x))->priv) - -struct _ScoreEditorPrivate { -}; +static void score_editor_class_init (ScoreEditorClass *klass); +static void score_editor_init (ScoreEditor *se); +static void score_editor_finalise (GObject *obj); -static RuleEditorClass *parent_class; -enum { - LAST_SIGNAL -}; +static RuleEditorClass *parent_class = NULL; -static guint signals[LAST_SIGNAL] = { 0 }; -guint +GtkType score_editor_get_type (void) { - static guint type = 0; + static GtkType type = 0; if (!type) { - GtkTypeInfo type_info = { + static const GtkTypeInfo info = { "ScoreEditor", - sizeof(ScoreEditor), - sizeof(ScoreEditorClass), - (GtkClassInitFunc)score_editor_class_init, - (GtkObjectInitFunc)score_editor_init, - (GtkArgSetFunc)NULL, - (GtkArgGetFunc)NULL + sizeof (ScoreEditor), + sizeof (ScoreEditorClass), + (GtkClassInitFunc) score_editor_class_init, + (GtkObjectInitFunc) score_editor_init, + /* reserved_1 */ NULL, + /* reserved_2 */ NULL, + (GtkClassInitFunc) NULL, }; - type = gtk_type_unique (rule_editor_get_type (), &type_info); + type = gtk_type_unique (RULE_TYPE_EDITOR, &info); } return type; } static void -score_editor_class_init (ScoreEditorClass *class) +score_editor_class_init (ScoreEditorClass *klass) { - GtkObjectClass *object_class = (GtkObjectClass *)class; - RuleEditorClass *re_class = (RuleEditorClass *)class; - + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + RuleEditorClass *re_class = (RuleEditorClass *) klass; + parent_class = gtk_type_class (rule_editor_get_type ()); - object_class->finalize = score_editor_finalise; - + gobject_class->finalize = score_editor_finalise; + /* override methods */ re_class->create_rule = create_rule; - - /* signals */ - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); } static void -score_editor_init (ScoreEditor *o) +score_editor_init (ScoreEditor *se) { - o->priv = g_malloc0 (sizeof (*o->priv)); + ; } static void -score_editor_finalise(GtkObject *obj) +score_editor_finalise (GObject *obj) { - ScoreEditor *o = (ScoreEditor *)obj; - - g_free(o->priv); - - ((GtkObjectClass *)(parent_class))->finalize(obj); + G_OBJECT_CLASS (parent_class)->finalize (obj); } /** @@ -117,33 +101,33 @@ score_editor_finalise(GtkObject *obj) * Return value: A new #ScoreEditor object. **/ ScoreEditor * -score_editor_new(ScoreContext *f) +score_editor_new (ScoreContext *sc) { + ScoreEditor *se = (ScoreEditor *) gtk_type_new (score_editor_get_type ()); GladeXML *gui; - ScoreEditor *o = (ScoreEditor *)gtk_type_new (score_editor_get_type ()); GtkWidget *w; - - gui = glade_xml_new(FILTER_GLADEDIR "/filter.glade", "rule_editor"); - rule_editor_construct((RuleEditor *)o, (RuleContext *)f, gui, NULL); - - w = glade_xml_get_widget(gui, "rule_frame"); - gtk_frame_set_label((GtkFrame *)w, _("Score Rules")); - - gtk_object_unref((GtkObject *)gui); - return o; + gui = glade_xml_new (FILTER_GLADEDIR "/filter.glade", "rule_editor"); + rule_editor_construct ((RuleEditor *) se, (RuleContext *) sc, gui, NULL); + + w = glade_xml_get_widget (gui, "rule_frame"); + gtk_frame_set_label ((GtkFrame *) w, _("Score Rules")); + + g_object_unref (gui); + + return se; } static FilterRule * -create_rule(RuleEditor *re) +create_rule (RuleEditor *re) { - FilterRule *rule = filter_rule_new(); + FilterRule *rule = filter_rule_new (); FilterPart *part; - + /* create a rule with 1 part in it */ - rule = (FilterRule *)score_rule_new (); - part = rule_context_next_part(re->context, NULL); - filter_rule_add_part(rule, filter_part_clone(part)); - + rule = (FilterRule *) score_rule_new (); + part = rule_context_next_part (re->context, NULL); + filter_rule_add_part (rule, filter_part_clone (part)); + return rule; } diff --git a/filter/score-editor.h b/filter/score-editor.h index 5c25dd9ecc..d0de0434da 100644 --- a/filter/score-editor.h +++ b/filter/score-editor.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,36 +20,39 @@ * Boston, MA 02111-1307, USA. */ + #ifndef _SCORE_EDITOR_H #define _SCORE_EDITOR_H #include "rule-editor.h" +#include "score-context.h" -#define SCORE_EDITOR(obj) GTK_CHECK_CAST (obj, score_editor_get_type (), ScoreEditor) -#define SCORE_EDITOR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, score_editor_get_type (), ScoreEditorClass) -#define IS_SCORE_EDITOR(obj) GTK_CHECK_TYPE (obj, score_editor_get_type ()) +#define SCORE_TYPE_EDITOR (score_editor_get_type ()) +#define SCORE_EDITOR(obj) (GTK_CHECK_CAST ((obj), SCORE_TYPE_EDITOR, ScoreEditor)) +#define SCORE_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SCORE_TYPE_EDITOR, ScoreEditorClass)) +#define IS_SCORE_EDITOR(obj) (GTK_CHECK_TYPE ((obj), SCORE_TYPE_EDITOR)) +#define IS_SCORE_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SCORE_TYPE_EDITOR)) +#define SCORE_EDITOR_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), SCORE_TYPE_EDITOR, ScoreEditorClass)) -typedef struct _ScoreEditor ScoreEditor; -typedef struct _ScoreEditorClass ScoreEditorClass; +typedef struct _ScoreEditor ScoreEditor; +typedef struct _ScoreEditorClass ScoreEditorClass; struct _ScoreEditor { - RuleEditor parent; - - struct _ScoreEditorPrivate *priv; + RuleEditor parent_object; + }; struct _ScoreEditorClass { RuleEditorClass parent_class; - + /* virtual methods */ - + /* signals */ }; -struct _ScoreContext; -guint score_editor_get_type (void); -ScoreEditor *score_editor_new (struct _ScoreContext *f); +GType score_editor_get_type (void); -#endif /* ! _SCORE_EDITOR_H */ +ScoreEditor *score_editor_new (ScoreContext *sc); +#endif /* ! _SCORE_EDITOR_H */ diff --git a/filter/score-rule.c b/filter/score-rule.c index 2975a3854d..e003ffd395 100644 --- a/filter/score-rule.c +++ b/filter/score-rule.c @@ -1,5 +1,6 @@ +/* -*- 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> @@ -19,11 +20,13 @@ * Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H #include <config.h> +#endif #include <string.h> -#include <glib.h> #include <gtk/gtkbox.h> #include <gtk/gtkframe.h> #include <gtk/gtkhbox.h> @@ -40,53 +43,45 @@ static int xml_decode(FilterRule *, xmlNodePtr, struct _RuleContext *f); /*static void build_code(FilterRule *, GString *out);*/ static GtkWidget *get_widget(FilterRule *fr, struct _RuleContext *f); -static void score_rule_class_init (ScoreRuleClass *class); -static void score_rule_init (ScoreRule *gspaper); -static void score_rule_finalise (GtkObject *obj); - -#define _PRIVATE(x) (((ScoreRule *)(x))->priv) +static void score_rule_class_init (ScoreRuleClass *klass); +static void score_rule_init (ScoreRule *sr); +static void score_rule_finalise (GObject *obj); -struct _ScoreRulePrivate { -}; -static FilterRuleClass *parent_class; +static FilterRuleClass *parent_class = NULL; -enum { - LAST_SIGNAL -}; -static guint signals[LAST_SIGNAL] = { 0 }; - -guint +GType score_rule_get_type (void) { - static guint type = 0; + static GType type = 0; if (!type) { - GtkTypeInfo type_info = { - "ScoreRule", - sizeof(ScoreRule), - sizeof(ScoreRuleClass), - (GtkClassInitFunc)score_rule_class_init, - (GtkObjectInitFunc)score_rule_init, - (GtkArgSetFunc)NULL, - (GtkArgGetFunc)NULL + static const GTypeInfo info = { + sizeof (ScoreRuleClass), + NULL, /* base_class_init */ + NULL, /* base_class_finalize */ + (GClassInitFunc) score_rule_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (ScoreRule), + 0, /* n_preallocs */ + (GInstanceInitFunc) score_rule_init, }; - type = gtk_type_unique (filter_rule_get_type (), &type_info); + type = g_type_register_static (FILTER_TYPE_RULE, "ScoreRule", &info, 0); } return type; } static void -score_rule_class_init (ScoreRuleClass *class) +score_rule_class_init (ScoreRuleClass *klass) { - GtkObjectClass *object_class; - FilterRuleClass *rule_class = (FilterRuleClass *)class; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + FilterRuleClass *rule_class = (FilterRuleClass *) klass; - object_class = (GtkObjectClass *)class; - parent_class = gtk_type_class (filter_rule_get_type ()); + parent_class = g_type_class_ref (FILTER_TYPE_RULE); object_class->finalize = score_rule_finalise; @@ -95,26 +90,18 @@ score_rule_class_init (ScoreRuleClass *class) rule_class->xml_decode = xml_decode; /* rule_class->build_code = build_code;*/ rule_class->get_widget = get_widget; - - /* signals */ - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); } static void -score_rule_init (ScoreRule *o) +score_rule_init (ScoreRule *sr) { - o->priv = g_malloc0 (sizeof (*o->priv)); + ; } static void -score_rule_finalise (GtkObject *obj) +score_rule_finalise (GObject *obj) { - ScoreRule *o = (ScoreRule *)obj; - - o = o; - - ((GtkObjectClass *)(parent_class))->finalize (obj); + G_OBJECT_CLASS (parent_class)->finalize (obj); } /** @@ -127,8 +114,7 @@ score_rule_finalise (GtkObject *obj) ScoreRule * score_rule_new (void) { - ScoreRule *o = (ScoreRule *)gtk_type_new (score_rule_get_type ()); - return o; + return (ScoreRule *) g_object_new (SCORE_TYPE_RULE, NULL, NULL); } static xmlNodePtr @@ -138,7 +124,7 @@ xml_encode (FilterRule *fr) xmlNodePtr node, value; char number[16]; - node = ((FilterRuleClass *)(parent_class))->xml_encode (fr); + node = FILTER_RULE_CLASS (parent_class)->xml_encode (fr); sprintf (number, "%d", sr->score); value = xmlNewNode (NULL, "score"); xmlSetProp (value, "value", number); @@ -150,12 +136,12 @@ xml_encode (FilterRule *fr) static int xml_decode (FilterRule *fr, xmlNodePtr node, struct _RuleContext *f) { - ScoreRule *sr = (ScoreRule *)fr; + ScoreRule *sr = (ScoreRule *) fr; xmlNodePtr value; int result; char *str; - result = ((FilterRuleClass *)(parent_class))->xml_decode (fr, node, f); + result = FILTER_RULE_CLASS (parent_class)->xml_decode (fr, node, f); if (result != 0) return result; @@ -199,15 +185,15 @@ get_widget (FilterRule *fr, struct _RuleContext *f) ScoreRule *sr = (ScoreRule *)fr; GtkWidget *spin; - widget = ((FilterRuleClass *)(parent_class))->get_widget (fr, f); + widget = FILTER_RULE_CLASS (parent_class)->get_widget (fr, f); frame = gtk_frame_new (_("Score")); hbox = gtk_hbox_new (FALSE, 3); label = gtk_label_new (_("Score")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 3); - adj = (GtkAdjustment *)gtk_adjustment_new ((float) sr->score, -3.0, 3.0, 1.0, 1.0, 1.0); - gtk_signal_connect (GTK_OBJECT (adj), "value_changed", spin_changed, sr); + adj = (GtkAdjustment *) gtk_adjustment_new ((float) sr->score, -3.0, 3.0, 1.0, 1.0, 1.0); + g_signal_connect (adj, "value_changed", spin_changed, sr); spin = gtk_spin_button_new (adj, 1.0, 0); gtk_box_pack_start (GTK_BOX (hbox), spin, FALSE, FALSE, 3); diff --git a/filter/score-rule.h b/filter/score-rule.h index bc7be4d043..fbd8f649de 100644 --- a/filter/score-rule.h +++ b/filter/score-rule.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,37 +20,41 @@ * Boston, MA 02111-1307, USA. */ + #ifndef _SCORE_RULE_H #define _SCORE_RULE_H #include "filter-rule.h" -#define SCORE_RULE(obj) GTK_CHECK_CAST (obj, score_rule_get_type (), ScoreRule) -#define SCORE_RULE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, score_rule_get_type (), ScoreRuleClass) -#define IS_SCORE_RULE(obj) GTK_CHECK_TYPE (obj, score_rule_get_type ()) +#define SCORE_TYPE_RULE (score_rule_get_type ()) +#define SCORE_RULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SCORE_TYPE_RULE, ScoreRule)) +#define SCORE_RULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SCORE_TYPE_RULE, ScoreRuleClass)) +#define IS_SCORE_RULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SCORE_TYPE_RULE)) +#define IS_SCORE_RULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SCORE_TYPE_RULE)) +#define SCORE_RULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SCORE_TYPE_RULE, ScoreRuleClass)) -typedef struct _ScoreRule ScoreRule; -typedef struct _ScoreRuleClass ScoreRuleClass; +typedef struct _ScoreRule ScoreRule; +typedef struct _ScoreRuleClass ScoreRuleClass; struct _ScoreRule { - FilterRule parent; - struct _ScoreRulePrivate *priv; - + FilterRule parent_object; + int score; }; struct _ScoreRuleClass { FilterRuleClass parent_class; - + /* virtual methods */ - + /* signals */ }; -guint score_rule_get_type (void); -ScoreRule *score_rule_new (void); + +GType score_rule_get_type (void); + +ScoreRule *score_rule_new (void); /* methods */ #endif /* ! _SCORE_RULE_H */ - |