Eliminate some useless gobject boilerplate.

If we had external users of this filter then they might expect some of
these macros to exist. But since this is just internal, that's just
unneeded noise.
This commit is contained in:
Carl Worth 2010-02-04 17:26:00 -08:00
parent 3767c6f9f9
commit 2bc0af15aa

View file

@ -24,14 +24,8 @@
#include <xapian.h> #include <xapian.h>
/* Oh, how I wish that gobject didn't require so much noisy boilerplate! */ /* Oh, how I wish that gobject didn't require so much noisy boilerplate!
#define NOTMUCH_TYPE_FILTER_DISCARD_UUENCODE (notmuch_filter_discard_uuencode_get_type ()) * (Though I have at least eliminated some of the stock set...) */
#define NOTMUCH_FILTER_DISCARD_UUENCODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NOTMUCH_TYPE_FILTER_DISCARD_UUENCODE, NotmuchFilterDiscardUuencode))
#define NOTMUCH_FILTER_DISCARD_UUENCODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NOTMUCH_TYPE_FILTER_DISCARD_UUENCODE, NotmuchFilterDiscardUuencodeClass))
#define NOTMUCH_IS_FILTER_DISCARD_UUENCODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NOTMUCH_TYPE_FILTER_DISCARD_UUENCODE))
#define NOTMUCH_IS_FILTER_DISCARD_UUENCODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NOTMUCH_TYPE_FILTER_DISCARD_UUENCODE))
#define NOTMUCH_FILTER_DISCARD_UUENCODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NOTMUCH_TYPE_FILTER_DISCARD_UUENCODE, NotmuchFilterDiscardUuencodeClass))
typedef struct _NotmuchFilterDiscardUuencode NotmuchFilterDiscardUuencode; typedef struct _NotmuchFilterDiscardUuencode NotmuchFilterDiscardUuencode;
typedef struct _NotmuchFilterDiscardUuencodeClass NotmuchFilterDiscardUuencodeClass; typedef struct _NotmuchFilterDiscardUuencodeClass NotmuchFilterDiscardUuencodeClass;
@ -69,12 +63,8 @@ struct _NotmuchFilterDiscardUuencodeClass {
GMimeFilterClass parent_class; GMimeFilterClass parent_class;
}; };
GType notmuch_filter_discard_uuencode_get_type (void);
GMimeFilter *notmuch_filter_discard_uuencode_new (void); GMimeFilter *notmuch_filter_discard_uuencode_new (void);
static void notmuch_filter_discard_uuencode_class_init (NotmuchFilterDiscardUuencodeClass *klass);
static void notmuch_filter_discard_uuencode_init (NotmuchFilterDiscardUuencode *filter, NotmuchFilterDiscardUuencodeClass *klass);
static void notmuch_filter_discard_uuencode_finalize (GObject *object); static void notmuch_filter_discard_uuencode_finalize (GObject *object);
static GMimeFilter *filter_copy (GMimeFilter *filter); static GMimeFilter *filter_copy (GMimeFilter *filter);
@ -87,31 +77,6 @@ static void filter_reset (GMimeFilter *filter);
static GMimeFilterClass *parent_class = NULL; static GMimeFilterClass *parent_class = NULL;
GType
notmuch_filter_discard_uuencode_get_type (void)
{
static GType type = 0;
if (!type) {
static const GTypeInfo info = {
sizeof (NotmuchFilterDiscardUuencodeClass),
NULL, /* base_class_init */
NULL, /* base_class_finalize */
(GClassInitFunc) notmuch_filter_discard_uuencode_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (NotmuchFilterDiscardUuencode),
0, /* n_preallocs */
(GInstanceInitFunc) notmuch_filter_discard_uuencode_init,
NULL /* value_table */
};
type = g_type_register_static (GMIME_TYPE_FILTER, "NotmuchFilterDiscardUuencode", &info, (GTypeFlags) 0);
}
return type;
}
static void static void
notmuch_filter_discard_uuencode_class_init (NotmuchFilterDiscardUuencodeClass *klass) notmuch_filter_discard_uuencode_class_init (NotmuchFilterDiscardUuencodeClass *klass)
{ {
@ -128,13 +93,6 @@ notmuch_filter_discard_uuencode_class_init (NotmuchFilterDiscardUuencodeClass *k
filter_class->reset = filter_reset; filter_class->reset = filter_reset;
} }
static void
notmuch_filter_discard_uuencode_init (NotmuchFilterDiscardUuencode *filter, NotmuchFilterDiscardUuencodeClass *klass)
{
(void) klass;
filter->state = 0;
}
static void static void
notmuch_filter_discard_uuencode_finalize (GObject *object) notmuch_filter_discard_uuencode_finalize (GObject *object)
{ {
@ -240,9 +198,27 @@ filter_reset (GMimeFilter *gmime_filter)
GMimeFilter * GMimeFilter *
notmuch_filter_discard_uuencode_new (void) notmuch_filter_discard_uuencode_new (void)
{ {
static GType type = 0;
NotmuchFilterDiscardUuencode *filter; NotmuchFilterDiscardUuencode *filter;
filter = (NotmuchFilterDiscardUuencode *) g_object_newv (NOTMUCH_TYPE_FILTER_DISCARD_UUENCODE, 0, NULL); if (!type) {
static const GTypeInfo info = {
sizeof (NotmuchFilterDiscardUuencodeClass),
NULL, /* base_class_init */
NULL, /* base_class_finalize */
(GClassInitFunc) notmuch_filter_discard_uuencode_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (NotmuchFilterDiscardUuencode),
0, /* n_preallocs */
NULL, /* instance_init */
NULL /* value_table */
};
type = g_type_register_static (GMIME_TYPE_FILTER, "NotmuchFilterDiscardUuencode", &info, (GTypeFlags) 0);
}
filter = (NotmuchFilterDiscardUuencode *) g_object_newv (type, 0, NULL);
filter->state = 0; filter->state = 0;
return (GMimeFilter *) filter; return (GMimeFilter *) filter;