diff options
author | Hans Petter Jansson <hpj@ximian.com> | 2002-12-07 03:38:26 +0800 |
---|---|---|
committer | Hans Petter <hansp@src.gnome.org> | 2002-12-07 03:38:26 +0800 |
commit | 7bb980e76d7207855e87ffefbffaa304dd779372 (patch) | |
tree | ff1524650853ff2749729a8edf5bf9f20c75a3a5 /calendar | |
parent | 4b1cfd51be51cc0ff40a5439ea9bf008f71405e8 (diff) | |
download | gsoc2013-evolution-7bb980e76d7207855e87ffefbffaa304dd779372.tar gsoc2013-evolution-7bb980e76d7207855e87ffefbffaa304dd779372.tar.gz gsoc2013-evolution-7bb980e76d7207855e87ffefbffaa304dd779372.tar.bz2 gsoc2013-evolution-7bb980e76d7207855e87ffefbffaa304dd779372.tar.lz gsoc2013-evolution-7bb980e76d7207855e87ffefbffaa304dd779372.tar.xz gsoc2013-evolution-7bb980e76d7207855e87ffefbffaa304dd779372.tar.zst gsoc2013-evolution-7bb980e76d7207855e87ffefbffaa304dd779372.zip |
Create a non-abstract enumeration type derived from GEnum.
2002-12-06 Hans Petter Jansson <hpj@ximian.com>
* cal-client/cal-client.c (cal_client_open_status_enum_get_type):
Create a non-abstract enumeration type derived from GEnum.
(cal_client_set_mode_status_enum_get_type): Ditto.
(cal_mode_enum_get_type): Ditto.
(cal_client_class_init): Use our enumerations and not the abstract
one.
(cal_client_finalize): Don't destroy factories, since the CalClient
doesn't own them anymore. They're shared between CalClients now.
(get_factories): Implement. Move the factory setup code here from
cal_client_construct (), and cache the factories. This is hopefully
temporary, until wombat goes away or is fixed.
(cal_client_construct): Most of the code moved to get_factories ().
* cal-client/cal-client.h: Add enumeration type macros and protos.
* gui/cal-search-bar.c (cal_search_bar_get_type): Removed in favour
of E_MAKE_TYPE, which uses GObject calls.
(cal_search_bar_class_init): Use g_type_class_peek_parent ().
* gui/calendar-model.c (calendar_model_get_type):
(calendar_model_class_init): Ditto, like above file.
* gui/calendar-view.c (calendar_view_get_type):
(calendar_view_class_init): Ditto.
* gui/e-calendar-table.c (e_calendar_table_get_type):
(e_calendar_table_class_init): Ditto.
* gui/e-comp-editor-registry.c (e_comp_editor_registry_get_type):
(class_init): Ditto.
* gui/e-day-view-main-item.c (e_day_view_main_item_get_type):
(e_day_view_main_item_class_init): Ditto.
* gui/e-day-view-time-item.c (e_day_view_time_item_get_type):
(e_day_view_time_item_class_init): Ditto.
* gui/e-day-view-top-item.c (e_day_view_top_item_get_type):
(e_day_view_top_item_class_init): Ditto.
* gui/e-day-view.c (e_day_view_get_type):
(e_day_view_class_init): Ditto.
* gui/e-itip-control.c (e_itip_control_get_type):
(class_init): Ditto.
* gui/e-meeting-attendee.c (e_meeting_attendee_get_type):
(class_init): Ditto.
* gui/e-meeting-model.c (e_meeting_model_get_type):
(class_init): Ditto.
* gui/e-meeting-time-sel-item.c
(e_meeting_time_selector_item_get_type):
(e_meeting_time_selector_item_class_init): Ditto.
* gui/e-meeting-time-sel.c
(e_meeting_time_selector_get_type):
(e_meeting_time_selector_class_init): Ditto.
* gui/e-timezone-entry.c (e_timezone_entry_get_type):
(e_timezone_entry_class_init): Ditto.
* gui/e-week-view-event-item.c (e_week_view_event_item_get_type):
(e_week_view_event_item_class_init): Ditto.
* gui/e-week-view-main-item.c (e_week_view_main_item_get_type):
(e_week_view_main_item_class_init): Ditto.
* gui/e-week-view-titles-item.c (e_week_view_titles_item_get_type):
(e_week_view_titles_item_class_init): Ditto.
* gui/gnome-cal.c (gnome_calendar_get_type):
(gnome_calendar_class_init): Ditto.
* gui/weekday-picker.c (weekday_picker_get_type):
(weekday_picker_class_init): Ditto.
* gui/e-week-view.c (e_week_view_get_type):
(e_week_view_class_init): Ditto, but parent_class init was moved
from get_type() to class_init().
* gui/calendar-view-factory.c (calendar_view_factory_get_type):
(calendar_view_factory_class_init): Ditto, and set up finalize
callback instead of destroy.
(calendar_view_factory_finalize): It's a GObject, so implement this.
(celendar_view_factory_destroy): Move code to _finalize() and remove.
* gui/main.c (init_bonobo): Remove extraneous bonobo_activation_init().
svn path=/trunk/; revision=19043
Diffstat (limited to 'calendar')
27 files changed, 269 insertions, 612 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index f895ecf5a9..b4035b3d53 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,77 @@ +2002-12-06 Hans Petter Jansson <hpj@ximian.com> + + * cal-client/cal-client.c (cal_client_open_status_enum_get_type): + Create a non-abstract enumeration type derived from GEnum. + (cal_client_set_mode_status_enum_get_type): Ditto. + (cal_mode_enum_get_type): Ditto. + (cal_client_class_init): Use our enumerations and not the abstract + one. + (cal_client_finalize): Don't destroy factories, since the CalClient + doesn't own them anymore. They're shared between CalClients now. + (get_factories): Implement. Move the factory setup code here from + cal_client_construct (), and cache the factories. This is hopefully + temporary, until wombat goes away or is fixed. + (cal_client_construct): Most of the code moved to get_factories (). + + * cal-client/cal-client.h: Add enumeration type macros and protos. + + * gui/cal-search-bar.c (cal_search_bar_get_type): Removed in favour + of E_MAKE_TYPE, which uses GObject calls. + (cal_search_bar_class_init): Use g_type_class_peek_parent (). + + * gui/calendar-model.c (calendar_model_get_type): + (calendar_model_class_init): Ditto, like above file. + * gui/calendar-view.c (calendar_view_get_type): + (calendar_view_class_init): Ditto. + * gui/e-calendar-table.c (e_calendar_table_get_type): + (e_calendar_table_class_init): Ditto. + * gui/e-comp-editor-registry.c (e_comp_editor_registry_get_type): + (class_init): Ditto. + * gui/e-day-view-main-item.c (e_day_view_main_item_get_type): + (e_day_view_main_item_class_init): Ditto. + * gui/e-day-view-time-item.c (e_day_view_time_item_get_type): + (e_day_view_time_item_class_init): Ditto. + * gui/e-day-view-top-item.c (e_day_view_top_item_get_type): + (e_day_view_top_item_class_init): Ditto. + * gui/e-day-view.c (e_day_view_get_type): + (e_day_view_class_init): Ditto. + * gui/e-itip-control.c (e_itip_control_get_type): + (class_init): Ditto. + * gui/e-meeting-attendee.c (e_meeting_attendee_get_type): + (class_init): Ditto. + * gui/e-meeting-model.c (e_meeting_model_get_type): + (class_init): Ditto. + * gui/e-meeting-time-sel-item.c + (e_meeting_time_selector_item_get_type): + (e_meeting_time_selector_item_class_init): Ditto. + * gui/e-meeting-time-sel.c + (e_meeting_time_selector_get_type): + (e_meeting_time_selector_class_init): Ditto. + * gui/e-timezone-entry.c (e_timezone_entry_get_type): + (e_timezone_entry_class_init): Ditto. + * gui/e-week-view-event-item.c (e_week_view_event_item_get_type): + (e_week_view_event_item_class_init): Ditto. + * gui/e-week-view-main-item.c (e_week_view_main_item_get_type): + (e_week_view_main_item_class_init): Ditto. + * gui/e-week-view-titles-item.c (e_week_view_titles_item_get_type): + (e_week_view_titles_item_class_init): Ditto. + * gui/gnome-cal.c (gnome_calendar_get_type): + (gnome_calendar_class_init): Ditto. + * gui/weekday-picker.c (weekday_picker_get_type): + (weekday_picker_class_init): Ditto. + + * gui/e-week-view.c (e_week_view_get_type): + (e_week_view_class_init): Ditto, but parent_class init was moved + from get_type() to class_init(). + + * gui/calendar-view-factory.c (calendar_view_factory_get_type): + (calendar_view_factory_class_init): Ditto, and set up finalize + callback instead of destroy. + (calendar_view_factory_finalize): It's a GObject, so implement this. + (celendar_view_factory_destroy): Move code to _finalize() and remove. + + * gui/main.c (init_bonobo): Remove extraneous bonobo_activation_init(). + 2002-11-27 Not Zed <NotZed@Ximian.com> * gui/itip-utils.[ch]: run fix.sh over this. diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c index d6d92b6239..ddf3617072 100644 --- a/calendar/cal-client/cal-client.c +++ b/calendar/cal-client/cal-client.c @@ -143,6 +143,67 @@ cal_client_get_type (void) return cal_client_type; } +GType +cal_client_open_status_enum_get_type (void) +{ + static GType cal_client_open_status_enum_type = 0; + + if (!cal_client_open_status_enum_type) { + static GEnumValue values [] = { + { CAL_CLIENT_OPEN_SUCCESS, "CalClientOpenSuccess", "success" }, + { CAL_CLIENT_OPEN_ERROR, "CalClientOpenError", "error" }, + { CAL_CLIENT_OPEN_NOT_FOUND, "CalClientOpenNotFound", "not-found" }, + { CAL_CLIENT_OPEN_PERMISSION_DENIED, "CalClientOpenPermissionDenied", "denied" }, + { CAL_CLIENT_OPEN_METHOD_NOT_SUPPORTED, "CalClientOpenMethodNotSupported", "unsupported" }, + { -1, NULL, NULL } + }; + + cal_client_open_status_enum_type = g_enum_register_static ("CalClientOpenStatusEnum", values); + } + + return cal_client_open_status_enum_type; +} + +GType +cal_client_set_mode_status_enum_get_type (void) +{ + static GType cal_client_set_mode_status_enum_type = 0; + + if (!cal_client_set_mode_status_enum_type) { + static GEnumValue values [] = { + { CAL_CLIENT_SET_MODE_SUCCESS, "CalClientSetModeSuccess", "success" }, + { CAL_CLIENT_SET_MODE_ERROR, "CalClientSetModeError", "error" }, + { CAL_CLIENT_SET_MODE_NOT_SUPPORTED, "CalClientSetModeNotSupported", "unsupported" }, + { -1, NULL, NULL } + }; + + cal_client_set_mode_status_enum_type = + g_enum_register_static ("CalClientSetModeStatusEnum", values); + } + + return cal_client_set_mode_status_enum_type; +} + +GType +cal_mode_enum_get_type (void) +{ + static GType cal_mode_enum_type = 0; + + if (!cal_mode_enum_type) { + static GEnumValue values [] = { + { CAL_MODE_INVALID, "CalModeInvalid", "invalid" }, + { CAL_MODE_LOCAL, "CalModeLocal", "local" }, + { CAL_MODE_REMOTE, "CalModeRemote", "remote" }, + { CAL_MODE_ANY, "CalModeAny", "any" }, + { -1, NULL, NULL } + }; + + cal_mode_enum_type = g_enum_register_static ("CalModeEnum", values); + } + + return cal_mode_enum_type; +} + /* Class initialization function for the calendar client */ static void cal_client_class_init (CalClientClass *klass) @@ -161,7 +222,7 @@ cal_client_class_init (CalClientClass *klass) NULL, NULL, g_cclosure_marshal_VOID__ENUM, G_TYPE_NONE, 1, - G_TYPE_ENUM); + CAL_CLIENT_OPEN_STATUS_ENUM_TYPE); cal_client_signals[CAL_SET_MODE] = g_signal_new ("cal_set_mode", G_TYPE_FROM_CLASS (klass), @@ -170,8 +231,8 @@ cal_client_class_init (CalClientClass *klass) NULL, NULL, cal_util_marshal_VOID__ENUM_ENUM, G_TYPE_NONE, 2, - G_TYPE_ENUM, - G_TYPE_ENUM); + CAL_CLIENT_SET_MODE_STATUS_ENUM_TYPE, + CAL_MODE_ENUM_TYPE); cal_client_signals[OBJ_UPDATED] = g_signal_new ("obj_updated", G_TYPE_FROM_CLASS (klass), @@ -372,7 +433,7 @@ cal_client_finalize (GObject *object) } priv->w_client = NULL; - destroy_factories (client); + /* destroy_factories (client); */ destroy_cal (client); priv->load_state = CAL_CLIENT_LOAD_NOT_LOADED; @@ -645,29 +706,17 @@ client_forget_password_cb (WombatClient *w_client, -/** - * cal_client_construct: - * @client: A calendar client. - * - * Constructs a calendar client object by contacting all available - * calendar factories. - * - * Return value: The same object as the @client argument, or NULL if the - * calendar factory could not be contacted. - **/ -CalClient * -cal_client_construct (CalClient *client) +static GList * +get_factories (void) { - CalClientPrivate *priv; + static GList *factories = NULL; GNOME_Evolution_Calendar_CalFactory factory; Bonobo_ServerInfoList *servers; CORBA_Environment ev; int i; - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); - - priv = client->priv; + if (factories != NULL) + return factories; CORBA_exception_init (&ev); @@ -689,18 +738,47 @@ cal_client_construct (CalClient *client) factory = (GNOME_Evolution_Calendar_CalFactory) bonobo_activation_activate_from_id (info->iid, 0, NULL, &ev); if (BONOBO_EX (&ev)) { +#if 0 g_warning ("cal_client_construct: Could not activate calendar server %s", info->iid); CORBA_free (servers); CORBA_exception_free (&ev); return NULL; +#endif } - - priv->factories = g_list_prepend (priv->factories, factory); + else + factories = g_list_prepend (factories, factory); } CORBA_free (servers); - CORBA_exception_free (&ev); + return factories; +} + +/** + * cal_client_construct: + * @client: A calendar client. + * + * Constructs a calendar client object by contacting all available + * calendar factories. + * + * Return value: The same object as the @client argument, or NULL if the + * calendar factory could not be contacted. + **/ +CalClient * +cal_client_construct (CalClient *client) +{ + CalClientPrivate *priv; + GNOME_Evolution_Calendar_CalFactory factory; + Bonobo_ServerInfoList *servers; + CORBA_Environment ev; + int i; + + g_return_val_if_fail (client != NULL, NULL); + g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); + + priv = client->priv; + priv->factories = get_factories (); + return client; } diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h index 3d6a4fe85d..3ea0b1a213 100644 --- a/calendar/cal-client/cal-client.h +++ b/calendar/cal-client/cal-client.h @@ -36,6 +36,10 @@ G_BEGIN_DECLS #define IS_CAL_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_CLIENT_TYPE)) #define IS_CAL_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_CLIENT_TYPE)) +#define CAL_CLIENT_OPEN_STATUS_ENUM_TYPE (cal_client_open_status_enum_get_type ()) +#define CAL_CLIENT_SET_MODE_STATUS_ENUM_TYPE (cal_client_set_mode_status_enum_get_type ()) +#define CAL_MODE_ENUM_TYPE (cal_mode_enum_get_type ()) + typedef struct _CalClient CalClient; typedef struct _CalClientClass CalClientClass; @@ -122,6 +126,10 @@ typedef gchar * (* CalClientAuthFunc) (CalClient *client, GType cal_client_get_type (void); +GType cal_client_open_status_enum_get_type (void); +GType cal_client_set_mode_status_enum_get_type (void); +GType cal_mode_enum_get_type (void); + CalClient *cal_client_construct (CalClient *client); CalClient *cal_client_new (void); diff --git a/calendar/gui/cal-search-bar.c b/calendar/gui/cal-search-bar.c index e19c99e78f..4201442914 100644 --- a/calendar/gui/cal-search-bar.c +++ b/calendar/gui/cal-search-bar.c @@ -31,6 +31,7 @@ #include <gtk/gtksignal.h> #include <libgnome/gnome-i18n.h> #include <gal/widgets/e-unicode.h> +#include <gal/util/e-util.h> #include "cal-search-bar.h" @@ -85,36 +86,8 @@ static guint cal_search_bar_signals[LAST_SIGNAL] = { 0 }; -/** - * cal_search_bar_get_type: - * - * Registers the #CalSearchBar class if necessary and returns the type ID - * associated to it. - * - * Return value: The type ID of the #CalSearchBar class. - **/ -GtkType -cal_search_bar_get_type (void) -{ - static GtkType cal_search_bar_type = 0; - - if (!cal_search_bar_type) { - static const GtkTypeInfo cal_search_bar_info = { - "CalSearchBar", - sizeof (CalSearchBar), - sizeof (CalSearchBarClass), - (GtkClassInitFunc) cal_search_bar_class_init, - (GtkObjectInitFunc) cal_search_bar_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - cal_search_bar_type = gtk_type_unique (E_SEARCH_BAR_TYPE, &cal_search_bar_info); - } - - return cal_search_bar_type; -} +E_MAKE_TYPE (cal_search_bar, "CalSearchBar", CalSearchBar, cal_search_bar_class_init, + cal_search_bar_init, E_SEARCH_BAR_TYPE); /* Class initialization function for the calendar search bar */ static void @@ -126,7 +99,7 @@ cal_search_bar_class_init (CalSearchBarClass *class) e_search_bar_class = (ESearchBarClass *) class; object_class = (GtkObjectClass *) class; - parent_class = gtk_type_class (E_SEARCH_BAR_TYPE); + parent_class = g_type_class_peek_parent (class); cal_search_bar_signals[SEXP_CHANGED] = gtk_signal_new ("sexp_changed", diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c index 01fa60784c..a9cc62577b 100644 --- a/calendar/gui/calendar-model.c +++ b/calendar/gui/calendar-model.c @@ -144,28 +144,9 @@ static ETableModelClass *parent_class; * * Return value: The type ID of the #CalendarModel class. **/ -GtkType -calendar_model_get_type (void) -{ - static GtkType calendar_model_type = 0; - - if (!calendar_model_type) { - static GtkTypeInfo calendar_model_info = { - "CalendarModel", - sizeof (CalendarModel), - sizeof (CalendarModelClass), - (GtkClassInitFunc) calendar_model_class_init, - (GtkObjectInitFunc) calendar_model_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - calendar_model_type = gtk_type_unique (E_TABLE_MODEL_TYPE, &calendar_model_info); - } - return calendar_model_type; -} +E_MAKE_TYPE (calendar_model, "CalendarModel", CalendarModel, calendar_model_class_init, + calendar_model_init, E_TABLE_MODEL_TYPE); /* Class initialization function for the calendar table model */ static void @@ -177,7 +158,7 @@ calendar_model_class_init (CalendarModelClass *class) object_class = (GtkObjectClass *) class; etm_class = (ETableModelClass *) class; - parent_class = gtk_type_class (E_TABLE_MODEL_TYPE); + parent_class = g_type_class_peek_parent (class); object_class->destroy = calendar_model_destroy; diff --git a/calendar/gui/calendar-view-factory.c b/calendar/gui/calendar-view-factory.c index e4521e4436..f8d2d92ce3 100644 --- a/calendar/gui/calendar-view-factory.c +++ b/calendar/gui/calendar-view-factory.c @@ -39,7 +39,7 @@ struct _CalendarViewFactoryPrivate { static void calendar_view_factory_class_init (CalendarViewFactoryClass *class); static void calendar_view_factory_init (CalendarViewFactory *cal_view_factory); -static void calendar_view_factory_destroy (GtkObject *object); +static void calendar_view_factory_finalize (GObject *object); static const char *calendar_view_factory_get_title (GalViewFactory *factory); static const char *calendar_view_factory_get_type_code (GalViewFactory *factory); @@ -49,55 +49,26 @@ static GalViewFactoryClass *parent_class = NULL; -/** - * calendar_view_factory_get_type: - * - * Registers the #CalendarViewFactory class if necessary, and returns the type - * ID associated to it. - * - * Return value: The type ID of the #CalendarViewFactory class. - **/ -GtkType -calendar_view_factory_get_type (void) -{ - static GtkType calendar_view_factory_type; - - if (!calendar_view_factory_type) { - static const GtkTypeInfo calendar_view_factory_info = { - "CalendarViewFactory", - sizeof (CalendarViewFactory), - sizeof (CalendarViewFactoryClass), - (GtkClassInitFunc) calendar_view_factory_class_init, - (GtkObjectInitFunc) calendar_view_factory_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - calendar_view_factory_type = gtk_type_unique (GAL_VIEW_FACTORY_TYPE, - &calendar_view_factory_info); - } - - return calendar_view_factory_type; -} +E_MAKE_TYPE (calendar_view_factory, "CalendarViewFactory", CalendarViewFactory, + calendar_view_factory_class_init, calendar_view_factory_init, GAL_VIEW_FACTORY_TYPE); /* Class initialization function for the calendar view factory */ static void calendar_view_factory_class_init (CalendarViewFactoryClass *class) { GalViewFactoryClass *gal_view_factory_class; - GtkObjectClass *object_class; + GObjectClass *gobject_class; - parent_class = gtk_type_class (GAL_VIEW_FACTORY_TYPE); + parent_class = g_type_class_peek_parent (class); gal_view_factory_class = (GalViewFactoryClass *) class; - object_class = (GtkObjectClass *) class; + gobject_class = (GObjectClass *) class; gal_view_factory_class->get_title = calendar_view_factory_get_title; gal_view_factory_class->get_type_code = calendar_view_factory_get_type_code; gal_view_factory_class->new_view = calendar_view_factory_new_view; - object_class->destroy = calendar_view_factory_destroy; + gobject_class->finalize = calendar_view_factory_finalize; } /* Object initialization class for the calendar view factory */ @@ -110,9 +81,9 @@ calendar_view_factory_init (CalendarViewFactory *cal_view_factory) cal_view_factory->priv = priv; } -/* Destroy method for the calendar view factory */ +/* Finalize method for the calendar view factory */ static void -calendar_view_factory_destroy (GtkObject *object) +calendar_view_factory_finalize (GObject *object) { CalendarViewFactory *cal_view_factory; CalendarViewFactoryPrivate *priv; @@ -126,8 +97,8 @@ calendar_view_factory_destroy (GtkObject *object) g_free (priv); cal_view_factory->priv = NULL; - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); + if (G_OBJECT_CLASS (parent_class)->finalize) + (* G_OBJECT_CLASS (parent_class)->finalize) (object); } diff --git a/calendar/gui/calendar-view.c b/calendar/gui/calendar-view.c index ebaf1ee9c5..f46f3cc117 100644 --- a/calendar/gui/calendar-view.c +++ b/calendar/gui/calendar-view.c @@ -53,36 +53,8 @@ static GalViewClass *parent_class = NULL; -/** - * calendar_view_get_type: - * - * Registers the #CalendarView class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #CalendarView class. - **/ -GtkType -calendar_view_get_type (void) -{ - static GtkType calendar_view_type; - - if (!calendar_view_type) { - static const GtkTypeInfo calendar_view_info = { - "CalendarView", - sizeof (CalendarView), - sizeof (CalendarViewClass), - (GtkClassInitFunc) calendar_view_class_init, - (GtkObjectInitFunc) calendar_view_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - calendar_view_type = gtk_type_unique (GAL_VIEW_TYPE, &calendar_view_info); - } - - return calendar_view_type; -} +E_MAKE_TYPE (calendar_view, "CalendarView", CalendarView, calendar_view_class_init, + calendar_view_init, GAL_VIEW_TYPE); /* Class initialization function for the calendar view */ static void @@ -91,7 +63,7 @@ calendar_view_class_init (CalendarViewClass *class) GalViewClass *gal_view_class; GtkObjectClass *object_class; - parent_class = gtk_type_class (GAL_VIEW_TYPE); + parent_class = g_type_class_peek_parent (class); gal_view_class = (GalViewClass *) class; object_class = (GtkObjectClass *) class; diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 29fe7910b0..9026316c5e 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -125,32 +125,8 @@ static GdkPixbuf* icon_pixbufs[E_CALENDAR_MODEL_NUM_ICONS] = { 0 }; static GtkTableClass *parent_class; static GdkAtom clipboard_atom = GDK_NONE; - -GtkType -e_calendar_table_get_type (void) -{ - static GtkType e_calendar_table_type = 0; - - if (!e_calendar_table_type){ - GtkTypeInfo e_calendar_table_info = { - "ECalendarTable", - sizeof (ECalendarTable), - sizeof (ECalendarTableClass), - (GtkClassInitFunc) e_calendar_table_class_init, - (GtkObjectInitFunc) e_calendar_table_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - parent_class = gtk_type_class (GTK_TYPE_TABLE); - e_calendar_table_type = gtk_type_unique (GTK_TYPE_TABLE, - &e_calendar_table_info); - } - - return e_calendar_table_type; -} - +E_MAKE_TYPE (e_calendar_table, "ECalendarTable", ECalendarTable, e_calendar_table_class_init, + e_calendar_table_init, GTK_TYPE_TABLE); static void e_calendar_table_class_init (ECalendarTableClass *class) diff --git a/calendar/gui/e-comp-editor-registry.c b/calendar/gui/e-comp-editor-registry.c index ba02d3271e..c5d621fa76 100644 --- a/calendar/gui/e-comp-editor-registry.c +++ b/calendar/gui/e-comp-editor-registry.c @@ -25,6 +25,7 @@ #endif #include <gnome.h> +#include <gal/util/e-util.h> #include "e-comp-editor-registry.h" struct _ECompEditorRegistryPrivate { @@ -65,7 +66,7 @@ class_init (ECompEditorRegistryClass *klass) object_class = GTK_OBJECT_CLASS (klass); - parent_class = gtk_type_class (gtk_object_get_type ()); + parent_class = g_type_class_peek_parent (klass); object_class->destroy = destroy; } @@ -84,28 +85,8 @@ init (ECompEditorRegistry *reg) -GtkType -e_comp_editor_registry_get_type (void) -{ - static GtkType type = 0; - - if (type == 0) { - static const GtkTypeInfo info = { - "ECompEditorRegistry", - sizeof (ECompEditorRegistry), - sizeof (ECompEditorRegistryClass), - (GtkClassInitFunc) class_init, - (GtkObjectInitFunc) init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (gtk_object_get_type (), &info); - } - - return type; -} +E_MAKE_TYPE (e_comp_editor_registry, "ECompEditorRegistry", ECompEditorRegistry, + class_init, init, gtk_object_get_type ()); GtkObject * e_comp_editor_registry_new (void) diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index 2966b440e2..98b72510ae 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -81,30 +81,8 @@ enum { ARG_DAY_VIEW }; - -GtkType -e_day_view_main_item_get_type (void) -{ - static GtkType e_day_view_main_item_type = 0; - - if (!e_day_view_main_item_type) { - GtkTypeInfo e_day_view_main_item_info = { - "EDayViewMainItem", - sizeof (EDayViewMainItem), - sizeof (EDayViewMainItemClass), - (GtkClassInitFunc) e_day_view_main_item_class_init, - (GtkObjectInitFunc) e_day_view_main_item_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - e_day_view_main_item_type = gtk_type_unique (gnome_canvas_item_get_type (), &e_day_view_main_item_info); - } - - return e_day_view_main_item_type; -} - +E_MAKE_TYPE (e_day_view_main_item, "EDayViewMainItem", EDayViewMainItem, + e_day_view_main_item_class_init, e_day_view_main_item_init, GNOME_TYPE_CANVAS_ITEM); static void e_day_view_main_item_class_init (EDayViewMainItemClass *class) @@ -112,7 +90,7 @@ e_day_view_main_item_class_init (EDayViewMainItemClass *class) GtkObjectClass *object_class; GnomeCanvasItemClass *item_class; - parent_class = gtk_type_class (gnome_canvas_item_get_type()); + parent_class = g_type_class_peek_parent (class); object_class = (GtkObjectClass *) class; item_class = (GnomeCanvasItemClass *) class; diff --git a/calendar/gui/e-day-view-time-item.c b/calendar/gui/e-day-view-time-item.c index 10a1e00dc8..276c6062e4 100644 --- a/calendar/gui/e-day-view-time-item.c +++ b/calendar/gui/e-day-view-time-item.c @@ -103,30 +103,8 @@ enum { ARG_DAY_VIEW }; - -GtkType -e_day_view_time_item_get_type (void) -{ - static GtkType e_day_view_time_item_type = 0; - - if (!e_day_view_time_item_type) { - GtkTypeInfo e_day_view_time_item_info = { - "EDayViewTimeItem", - sizeof (EDayViewTimeItem), - sizeof (EDayViewTimeItemClass), - (GtkClassInitFunc) e_day_view_time_item_class_init, - (GtkObjectInitFunc) e_day_view_time_item_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - e_day_view_time_item_type = gtk_type_unique (gnome_canvas_item_get_type (), &e_day_view_time_item_info); - } - - return e_day_view_time_item_type; -} - +E_MAKE_TYPE (e_day_view_time_item, "EDayViewTimeItem", EDayViewTimeItem, + e_day_view_time_item_class_init, e_day_view_time_item_init, GNOME_TYPE_CANVAS_ITEM); static void e_day_view_time_item_class_init (EDayViewTimeItemClass *class) @@ -134,7 +112,7 @@ e_day_view_time_item_class_init (EDayViewTimeItemClass *class) GtkObjectClass *object_class; GnomeCanvasItemClass *item_class; - parent_class = gtk_type_class (gnome_canvas_item_get_type()); + parent_class = g_type_class_peek_parent (class); object_class = (GtkObjectClass *) class; item_class = (GnomeCanvasItemClass *) class; diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c index 09ba416e86..e35b08d830 100644 --- a/calendar/gui/e-day-view-top-item.c +++ b/calendar/gui/e-day-view-top-item.c @@ -79,30 +79,8 @@ enum { ARG_DAY_VIEW }; - -GtkType -e_day_view_top_item_get_type (void) -{ - static GtkType e_day_view_top_item_type = 0; - - if (!e_day_view_top_item_type) { - GtkTypeInfo e_day_view_top_item_info = { - "EDayViewTopItem", - sizeof (EDayViewTopItem), - sizeof (EDayViewTopItemClass), - (GtkClassInitFunc) e_day_view_top_item_class_init, - (GtkObjectInitFunc) e_day_view_top_item_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - e_day_view_top_item_type = gtk_type_unique (gnome_canvas_item_get_type (), &e_day_view_top_item_info); - } - - return e_day_view_top_item_type; -} - +E_MAKE_TYPE (e_day_view_top_item, "EDayViewTopItem", EDayViewTopItem, e_day_view_top_item_class_init, + e_day_view_top_item_init, GNOME_TYPE_CANVAS_ITEM); static void e_day_view_top_item_class_init (EDayViewTopItemClass *class) @@ -110,7 +88,7 @@ e_day_view_top_item_class_init (EDayViewTopItemClass *class) GtkObjectClass *object_class; GnomeCanvasItemClass *item_class; - parent_class = gtk_type_class (gnome_canvas_item_get_type()); + parent_class = g_type_class_peek_parent (class); object_class = (GtkObjectClass *) class; item_class = (GnomeCanvasItemClass *) class; diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index e7d1888d34..2528cfbed3 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -476,32 +476,8 @@ static gboolean e_day_view_layout_timeout_cb (gpointer data); static GtkTableClass *parent_class; static GdkAtom clipboard_atom = GDK_NONE; - -GtkType -e_day_view_get_type (void) -{ - static GtkType e_day_view_type = 0; - - if (!e_day_view_type){ - GtkTypeInfo e_day_view_info = { - "EDayView", - sizeof (EDayView), - sizeof (EDayViewClass), - (GtkClassInitFunc) e_day_view_class_init, - (GtkObjectInitFunc) e_day_view_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - parent_class = gtk_type_class (GTK_TYPE_TABLE); - e_day_view_type = gtk_type_unique (GTK_TYPE_TABLE, - &e_day_view_info); - } - - return e_day_view_type; -} - +E_MAKE_TYPE (e_day_view, "EDayView", EDayView, e_day_view_class_init, + e_day_view_init, GTK_TYPE_TABLE); static void e_day_view_class_init (EDayViewClass *class) @@ -509,6 +485,7 @@ e_day_view_class_init (EDayViewClass *class) GtkObjectClass *object_class; GtkWidgetClass *widget_class; + parent_class = g_type_class_peek_parent (class); object_class = (GtkObjectClass *) class; widget_class = (GtkWidgetClass *) class; diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index 03e4c476a7..168ed4359b 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -106,30 +106,8 @@ static void ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, static GtkVBoxClass *parent_class = NULL; - -GtkType -e_itip_control_get_type (void) -{ - static GtkType type = 0; - - if (type == 0) { - static const GtkTypeInfo info = - { - "EItipControl", - sizeof (EItipControl), - sizeof (EItipControlClass), - (GtkClassInitFunc) class_init, - (GtkObjectInitFunc) init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (gtk_vbox_get_type (), &info); - } - - return type; -} +E_MAKE_TYPE (e_itip_control, "EItipControl", EItipControl, class_init, init, + GTK_TYPE_VBOX); static void class_init (EItipControlClass *klass) @@ -138,7 +116,7 @@ class_init (EItipControlClass *klass) object_class = GTK_OBJECT_CLASS (klass); - parent_class = gtk_type_class (gtk_vbox_get_type ()); + parent_class = g_type_class_peek_parent (klass); object_class->destroy = destroy; } diff --git a/calendar/gui/e-meeting-attendee.c b/calendar/gui/e-meeting-attendee.c index cfc4a25805..5dc49022af 100644 --- a/calendar/gui/e-meeting-attendee.c +++ b/calendar/gui/e-meeting-attendee.c @@ -26,6 +26,7 @@ #include <stdlib.h> #include <gtk/gtk.h> +#include <gal/util/e-util.h> #include "e-meeting-attendee.h" struct _EMeetingAttendeePrivate { @@ -72,31 +73,8 @@ static void destroy (GtkObject *obj); static GtkObjectClass *parent_class = NULL; - -GtkType -e_meeting_attendee_get_type (void) -{ - static GtkType type = 0; - - if (type == 0) - { - static const GtkTypeInfo info = - { - "EMeetingAttendee", - sizeof (EMeetingAttendee), - sizeof (EMeetingAttendeeClass), - (GtkClassInitFunc) class_init, - (GtkObjectInitFunc) init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (gtk_object_get_type (), &info); - } - - return type; -} +E_MAKE_TYPE (e_meeting_attendee, "EMeetingAttendee", EMeetingAttendee, + class_init, init, GTK_TYPE_OBJECT); static void class_init (EMeetingAttendeeClass *klass) @@ -105,7 +83,7 @@ class_init (EMeetingAttendeeClass *klass) object_class = GTK_OBJECT_CLASS (klass); - parent_class = gtk_type_class (gtk_object_get_type ()); + parent_class = g_type_class_peek_parent (klass); signals[CHANGED] = gtk_signal_new ("changed", diff --git a/calendar/gui/e-meeting-model.c b/calendar/gui/e-meeting-model.c index fd1ffa50df..7ae89e06c6 100644 --- a/calendar/gui/e-meeting-model.c +++ b/calendar/gui/e-meeting-model.c @@ -132,30 +132,8 @@ static void table_destroy_list_cb (ETableScrolled *etable, gpointer data); static ETableModelClass *parent_class = NULL; -GtkType -e_meeting_model_get_type (void) -{ - static GtkType type = 0; - - if (type == 0) - { - static const GtkTypeInfo info = - { - "EMeetingModel", - sizeof (EMeetingModel), - sizeof (EMeetingModelClass), - (GtkClassInitFunc) class_init, - (GtkObjectInitFunc) init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (e_table_model_get_type (), &info); - } - - return type; -} +E_MAKE_TYPE (e_meeting_model, "EMeetingModel", EMeetingModel, + class_init, init, E_TABLE_MODEL_TYPE); static void book_open_cb (EBook *book, EBookStatus status, gpointer data) @@ -649,7 +627,7 @@ class_init (EMeetingModelClass *klass) object_class = GTK_OBJECT_CLASS (klass); etm_class = E_TABLE_MODEL_CLASS (klass); - parent_class = gtk_type_class (E_TABLE_MODEL_TYPE); + parent_class = g_type_class_peek_parent (klass); object_class->destroy = destroy; diff --git a/calendar/gui/e-meeting-time-sel-item.c b/calendar/gui/e-meeting-time-sel-item.c index 64d5594271..7476ff694a 100644 --- a/calendar/gui/e-meeting-time-sel-item.c +++ b/calendar/gui/e-meeting-time-sel-item.c @@ -104,30 +104,9 @@ enum { ARG_MEETING_TIME_SELECTOR }; - -GtkType -e_meeting_time_selector_item_get_type (void) -{ - static GtkType e_meeting_time_selector_item_type = 0; - - if (!e_meeting_time_selector_item_type) { - GtkTypeInfo e_meeting_time_selector_item_info = { - "EMeetingTimeSelectorItem", - sizeof (EMeetingTimeSelectorItem), - sizeof (EMeetingTimeSelectorItemClass), - (GtkClassInitFunc) e_meeting_time_selector_item_class_init, - (GtkObjectInitFunc) e_meeting_time_selector_item_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - e_meeting_time_selector_item_type = gtk_type_unique (gnome_canvas_item_get_type (), &e_meeting_time_selector_item_info); - } - - return e_meeting_time_selector_item_type; -} - +E_MAKE_TYPE (e_meeting_time_selector_item, "EMeetingTimeSelectorItem", EMeetingTimeSelectorItem, + e_meeting_time_selector_item_class_init, e_meeting_time_selector_item_init, + GNOME_TYPE_CANVAS_ITEM); static void e_meeting_time_selector_item_class_init (EMeetingTimeSelectorItemClass *mts_item_class) @@ -135,7 +114,7 @@ e_meeting_time_selector_item_class_init (EMeetingTimeSelectorItemClass *mts_item GtkObjectClass *object_class; GnomeCanvasItemClass *item_class; - parent_class = gtk_type_class (gnome_canvas_item_get_type()); + parent_class = g_type_class_peek_parent (mts_item_class); object_class = (GtkObjectClass *) mts_item_class; item_class = (GnomeCanvasItemClass *) mts_item_class; diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c index ff33015604..2e8adf17f4 100644 --- a/calendar/gui/e-meeting-time-sel.c +++ b/calendar/gui/e-meeting-time-sel.c @@ -218,31 +218,9 @@ static void sort_info_changed_cb (ETableSortInfo *info, gpointer data); static GtkTableClass *parent_class; - -GtkType -e_meeting_time_selector_get_type (void) -{ - static guint e_meeting_time_selector_type = 0; - - if (!e_meeting_time_selector_type) { - GtkTypeInfo e_meeting_time_selector_info = - { - "EMeetingTimeSelector", - sizeof (EMeetingTimeSelector), - sizeof (EMeetingTimeSelectorClass), - (GtkClassInitFunc) e_meeting_time_selector_class_init, - (GtkObjectInitFunc) e_meeting_time_selector_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - e_meeting_time_selector_type = gtk_type_unique (GTK_TYPE_TABLE, - &e_meeting_time_selector_info); - } - return e_meeting_time_selector_type; -} - +E_MAKE_TYPE (e_meeting_time_selector, "EMeetingTimeSelector", EMeetingTimeSelector, + e_meeting_time_selector_class_init, e_meeting_time_selector_init, + GTK_TYPE_TABLE); static void e_meeting_time_selector_class_init (EMeetingTimeSelectorClass * klass) @@ -250,7 +228,7 @@ e_meeting_time_selector_class_init (EMeetingTimeSelectorClass * klass) GtkObjectClass *object_class; GtkWidgetClass *widget_class; - parent_class = gtk_type_class (gtk_table_get_type()); + parent_class = g_type_class_peek_parent (klass); object_class = (GtkObjectClass *) klass; widget_class = (GtkWidgetClass *) klass; diff --git a/calendar/gui/e-timezone-entry.c b/calendar/gui/e-timezone-entry.c index 95c81b2e84..5365820dcf 100644 --- a/calendar/gui/e-timezone-entry.c +++ b/calendar/gui/e-timezone-entry.c @@ -34,6 +34,7 @@ #include <gtk/gtkentry.h> #include <gtk/gtksignal.h> #include <gnome.h> +#include <gal/util/e-util.h> #include <gal/widgets/e-unicode.h> #include <widgets/e-timezone-dialog/e-timezone-dialog.h> #include "e-timezone-entry.h" @@ -87,34 +88,8 @@ static void e_timezone_entry_set_entry_visibility (ETimezoneEntry *tentry); static GtkHBoxClass *parent_class; static guint timezone_entry_signals[LAST_SIGNAL] = { 0 }; - -/** - * e_timezone_entry_get_type: - * - * Returns the GtkType for the ETimezoneEntry widget - */ -guint -e_timezone_entry_get_type (void) -{ - static guint timezone_entry_type = 0; - - if (!timezone_entry_type){ - GtkTypeInfo timezone_entry_info = { - "ETimezoneEntry", - sizeof (ETimezoneEntry), - sizeof (ETimezoneEntryClass), - (GtkClassInitFunc) e_timezone_entry_class_init, - (GtkObjectInitFunc) e_timezone_entry_init, - NULL, - NULL, - }; - - timezone_entry_type = gtk_type_unique (gtk_hbox_get_type (), &timezone_entry_info); - } - - return timezone_entry_type; -} - +E_MAKE_TYPE (e_timezone_entry, "ETimezoneEntry", ETimezoneEntry, + e_timezone_entry_class_init, e_timezone_entry_init, GTK_TYPE_HBOX); static void e_timezone_entry_class_init (ETimezoneEntryClass *class) @@ -123,7 +98,7 @@ e_timezone_entry_class_init (ETimezoneEntryClass *class) object_class = (GtkObjectClass*) class; - parent_class = gtk_type_class (gtk_hbox_get_type ()); + parent_class = g_type_class_peek_parent (class); timezone_entry_signals[CHANGED] = gtk_signal_new ("changed", diff --git a/calendar/gui/e-timezone-entry.h b/calendar/gui/e-timezone-entry.h index 36ac0fc3ab..4f94cd88a1 100644 --- a/calendar/gui/e-timezone-entry.h +++ b/calendar/gui/e-timezone-entry.h @@ -62,7 +62,7 @@ struct _ETimezoneEntryClass { void (* changed) (ETimezoneEntry *tentry); }; -guint e_timezone_entry_get_type (void); +GType e_timezone_entry_get_type (void); GtkWidget* e_timezone_entry_new (void); icaltimezone* e_timezone_entry_get_timezone (ETimezoneEntry *tentry); diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c index 529e0541b8..1cc1cbe637 100644 --- a/calendar/gui/e-week-view-event-item.c +++ b/calendar/gui/e-week-view-event-item.c @@ -98,30 +98,9 @@ enum { ARG_SPAN_NUM }; - -GtkType -e_week_view_event_item_get_type (void) -{ - static GtkType e_week_view_event_item_type = 0; - - if (!e_week_view_event_item_type) { - GtkTypeInfo e_week_view_event_item_info = { - "EWeekViewEventItem", - sizeof (EWeekViewEventItem), - sizeof (EWeekViewEventItemClass), - (GtkClassInitFunc) e_week_view_event_item_class_init, - (GtkObjectInitFunc) e_week_view_event_item_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - e_week_view_event_item_type = gtk_type_unique (gnome_canvas_item_get_type (), &e_week_view_event_item_info); - } - - return e_week_view_event_item_type; -} - +E_MAKE_TYPE (e_week_view_event_item, "EWeekViewEventItem", EWeekViewEventItem, + e_week_view_event_item_class_init, e_week_view_event_item_init, + GNOME_TYPE_CANVAS_ITEM); static void e_week_view_event_item_class_init (EWeekViewEventItemClass *class) @@ -129,7 +108,7 @@ e_week_view_event_item_class_init (EWeekViewEventItemClass *class) GtkObjectClass *object_class; GnomeCanvasItemClass *item_class; - parent_class = gtk_type_class (gnome_canvas_item_get_type()); + parent_class = g_type_class_peek_parent (class); object_class = (GtkObjectClass *) class; item_class = (GnomeCanvasItemClass *) class; diff --git a/calendar/gui/e-week-view-main-item.c b/calendar/gui/e-week-view-main-item.c index 594f227bab..d5d1e82d8b 100644 --- a/calendar/gui/e-week-view-main-item.c +++ b/calendar/gui/e-week-view-main-item.c @@ -72,30 +72,9 @@ enum { ARG_WEEK_VIEW }; - -GtkType -e_week_view_main_item_get_type (void) -{ - static GtkType e_week_view_main_item_type = 0; - - if (!e_week_view_main_item_type) { - GtkTypeInfo e_week_view_main_item_info = { - "EWeekViewMainItem", - sizeof (EWeekViewMainItem), - sizeof (EWeekViewMainItemClass), - (GtkClassInitFunc) e_week_view_main_item_class_init, - (GtkObjectInitFunc) e_week_view_main_item_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - e_week_view_main_item_type = gtk_type_unique (gnome_canvas_item_get_type (), &e_week_view_main_item_info); - } - - return e_week_view_main_item_type; -} - +E_MAKE_TYPE (e_week_view_main_item, "EWeekViewMainItem", EWeekViewMainItem, + e_week_view_main_item_class_init, e_week_view_main_item_init, + GNOME_TYPE_CANVAS_ITEM); static void e_week_view_main_item_class_init (EWeekViewMainItemClass *class) @@ -103,7 +82,7 @@ e_week_view_main_item_class_init (EWeekViewMainItemClass *class) GtkObjectClass *object_class; GnomeCanvasItemClass *item_class; - parent_class = gtk_type_class (gnome_canvas_item_get_type()); + parent_class = g_type_class_peek_parent (class); object_class = (GtkObjectClass *) class; item_class = (GnomeCanvasItemClass *) class; diff --git a/calendar/gui/e-week-view-titles-item.c b/calendar/gui/e-week-view-titles-item.c index 0be7228cf9..2e2fe085ee 100644 --- a/calendar/gui/e-week-view-titles-item.c +++ b/calendar/gui/e-week-view-titles-item.c @@ -61,30 +61,9 @@ enum { ARG_WEEK_VIEW }; - -GtkType -e_week_view_titles_item_get_type (void) -{ - static GtkType e_week_view_titles_item_type = 0; - - if (!e_week_view_titles_item_type) { - GtkTypeInfo e_week_view_titles_item_info = { - "EWeekViewTitlesItem", - sizeof (EWeekViewTitlesItem), - sizeof (EWeekViewTitlesItemClass), - (GtkClassInitFunc) e_week_view_titles_item_class_init, - (GtkObjectInitFunc) e_week_view_titles_item_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - e_week_view_titles_item_type = gtk_type_unique (gnome_canvas_item_get_type (), &e_week_view_titles_item_info); - } - - return e_week_view_titles_item_type; -} - +E_MAKE_TYPE (e_week_view_titles_item, "EWeekViewTitlesItem", EWeekViewTitlesItem, + e_week_view_titles_item_class_init, e_week_view_titles_item_init, + GNOME_TYPE_CANVAS_ITEM); static void e_week_view_titles_item_class_init (EWeekViewTitlesItemClass *class) @@ -92,7 +71,7 @@ e_week_view_titles_item_class_init (EWeekViewTitlesItemClass *class) GtkObjectClass *object_class; GnomeCanvasItemClass *item_class; - parent_class = gtk_type_class (gnome_canvas_item_get_type()); + parent_class = g_type_class_peek_parent (class); object_class = (GtkObjectClass *) class; item_class = (GnomeCanvasItemClass *) class; diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 88a6565e16..7028915b0b 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -243,32 +243,8 @@ static gboolean e_week_view_layout_timeout_cb (gpointer data); static GtkTableClass *parent_class; static GdkAtom clipboard_atom = GDK_NONE; - -GtkType -e_week_view_get_type (void) -{ - static GtkType e_week_view_type = 0; - - if (!e_week_view_type){ - GtkTypeInfo e_week_view_info = { - "EWeekView", - sizeof (EWeekView), - sizeof (EWeekViewClass), - (GtkClassInitFunc) e_week_view_class_init, - (GtkObjectInitFunc) e_week_view_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - parent_class = gtk_type_class (GTK_TYPE_TABLE); - e_week_view_type = gtk_type_unique (GTK_TYPE_TABLE, - &e_week_view_info); - } - - return e_week_view_type; -} - +E_MAKE_TYPE (e_week_view, "EWeekView", EWeekView, e_week_view_class_init, + e_week_view_init, GTK_TYPE_TABLE); static void e_week_view_class_init (EWeekViewClass *class) @@ -276,6 +252,7 @@ e_week_view_class_init (EWeekViewClass *class) GtkObjectClass *object_class; GtkWidgetClass *widget_class; + parent_class = g_type_class_peek_parent (class); object_class = (GtkObjectClass *) class; widget_class = (GtkWidgetClass *) class; diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index a527369594..c66caaf844 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -195,28 +195,8 @@ static GtkVBoxClass *parent_class; -GtkType -gnome_calendar_get_type (void) -{ - static GtkType gnome_calendar_type = 0; - - if (!gnome_calendar_type) { - static const GtkTypeInfo gnome_calendar_info = { - "GnomeCalendar", - sizeof (GnomeCalendar), - sizeof (GnomeCalendarClass), - (GtkClassInitFunc) gnome_calendar_class_init, - (GtkObjectInitFunc) gnome_calendar_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - gnome_calendar_type = gtk_type_unique (GTK_TYPE_VBOX, &gnome_calendar_info); - } - - return gnome_calendar_type; -} +E_MAKE_TYPE (gnome_calendar, "GnomeCalendar", GnomeCalendar, gnome_calendar_class_init, + gnome_calendar_init, GTK_TYPE_VBOX); /* Class initialization function for the gnome calendar */ static void @@ -226,7 +206,7 @@ gnome_calendar_class_init (GnomeCalendarClass *class) object_class = (GtkObjectClass *) class; - parent_class = gtk_type_class (GTK_TYPE_VBOX); + parent_class = g_type_class_peek_parent (class); gnome_calendar_signals[DATES_SHOWN_CHANGED] = gtk_signal_new ("dates_shown_changed", @@ -1385,6 +1365,7 @@ gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic) gal_view_collection_load (collection); } + g_print ("Making GAL view instance.\n"); priv->view_instance = gal_view_instance_new (collection, cal_client_get_uri (priv->client)); priv->view_menus = gal_view_menus_new (priv->view_instance); diff --git a/calendar/gui/main.c b/calendar/gui/main.c index 2b21346300..750d893b5f 100644 --- a/calendar/gui/main.c +++ b/calendar/gui/main.c @@ -59,8 +59,6 @@ init_bonobo (int argc, char **argv) bonobo_activation_popt_options, 0, NULL) != 0) g_error (_("Could not initialize GNOME")); - bonobo_activation_init (argc, argv); - if (bonobo_init (&argc, argv) == FALSE) g_error (_("Could not initialize Bonobo")); diff --git a/calendar/gui/weekday-picker.c b/calendar/gui/weekday-picker.c index 087c7000da..f4311574fd 100644 --- a/calendar/gui/weekday-picker.c +++ b/calendar/gui/weekday-picker.c @@ -27,6 +27,7 @@ #include <libgnome/gnome-i18n.h> #include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include <libgnomecanvas/gnome-canvas-text.h> +#include <gal/util/e-util.h> #include "weekday-picker.h" @@ -76,36 +77,8 @@ static guint wp_signals[LAST_SIGNAL]; -/** - * weekday_picker_get_type: - * - * Registers the #WeekdayPicker class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #WeekdayPicker class. - **/ -GtkType -weekday_picker_get_type (void) -{ - static GtkType weekday_picker_type = 0; - - if (!weekday_picker_type) { - static const GtkTypeInfo weekday_picker_info = { - "WeekdayPicker", - sizeof (WeekdayPicker), - sizeof (WeekdayPickerClass), - (GtkClassInitFunc) weekday_picker_class_init, - (GtkObjectInitFunc) weekday_picker_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - weekday_picker_type = gtk_type_unique (GNOME_TYPE_CANVAS, &weekday_picker_info); - } - - return weekday_picker_type; -} +E_MAKE_TYPE (weekday_picker, "WeekdayPicker", WeekdayPicker, + weekday_picker_class_init, weekday_picker_init, GNOME_TYPE_CANVAS); /* Class initialization function for the weekday picker */ static void @@ -117,7 +90,7 @@ weekday_picker_class_init (WeekdayPickerClass *class) object_class = (GtkObjectClass *) class; widget_class = (GtkWidgetClass *) class; - parent_class = gtk_type_class (GNOME_TYPE_CANVAS); + parent_class = g_type_class_peek_parent (class); wp_signals[CHANGED] = gtk_signal_new ("changed", |