diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-03-20 08:32:47 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-03-20 23:49:46 +0800 |
commit | 8ffcfb4e106bb0081714455239cfe13a524c365f (patch) | |
tree | 4b024139c27a0c44ec915ad531058b834ca6adcb /widgets | |
parent | 7c51d1c1a631a4a8daf26dd44a0aed41eb4726e0 (diff) | |
download | gsoc2013-evolution-8ffcfb4e106bb0081714455239cfe13a524c365f.tar gsoc2013-evolution-8ffcfb4e106bb0081714455239cfe13a524c365f.tar.gz gsoc2013-evolution-8ffcfb4e106bb0081714455239cfe13a524c365f.tar.bz2 gsoc2013-evolution-8ffcfb4e106bb0081714455239cfe13a524c365f.tar.lz gsoc2013-evolution-8ffcfb4e106bb0081714455239cfe13a524c365f.tar.xz gsoc2013-evolution-8ffcfb4e106bb0081714455239cfe13a524c365f.tar.zst gsoc2013-evolution-8ffcfb4e106bb0081714455239cfe13a524c365f.zip |
Add extensions to configure calender widgets.
Make ECalendarItem, ECalendarView, ECalModel, EDateEdit, EMeetingStore,
and EMeetingTimeSelector extensible and register extensions to
automatically bind every instance to the appropriate EShellSettings.
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/misc/e-calendar-item.c | 7 | ||||
-rw-r--r-- | widgets/misc/e-calendar-item.h | 24 | ||||
-rw-r--r-- | widgets/misc/e-dateedit.c | 39 |
3 files changed, 33 insertions, 37 deletions
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c index def7019c21..4d7506e05d 100644 --- a/widgets/misc/e-calendar-item.c +++ b/widgets/misc/e-calendar-item.c @@ -35,6 +35,7 @@ #include <glib/gi18n.h> #include <libedataserver/e-data-server-util.h> #include <e-util/e-util.h> +#include <e-util/e-extensible.h> static const gint e_calendar_item_days_in_month[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 @@ -228,7 +229,9 @@ enum { static guint e_calendar_item_signals[LAST_SIGNAL] = { 0 }; -G_DEFINE_TYPE (ECalendarItem, e_calendar_item, GNOME_TYPE_CANVAS_ITEM) +G_DEFINE_TYPE_WITH_CODE ( + ECalendarItem, e_calendar_item, GNOME_TYPE_CANVAS_ITEM, + G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL)) static void e_calendar_item_class_init (ECalendarItemClass *class) @@ -844,6 +847,8 @@ e_calendar_item_realize (GnomeCanvasItem *item) calitem = E_CALENDAR_ITEM (item); e_calendar_item_style_set (GTK_WIDGET(item->canvas), calitem); + + e_extensible_load_extensions (E_EXTENSIBLE (calitem)); } static void diff --git a/widgets/misc/e-calendar-item.h b/widgets/misc/e-calendar-item.h index 6a3b74fccb..4aab58ea2e 100644 --- a/widgets/misc/e-calendar-item.h +++ b/widgets/misc/e-calendar-item.h @@ -109,12 +109,24 @@ typedef void (*ECalendarItemStyleCallback) (ECalendarItem *calitem, typedef struct tm (*ECalendarItemGetTimeCallback) (ECalendarItem *calitem, gpointer data); -#define E_CALENDAR_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - e_calendar_item_get_type (), ECalendarItem)) -#define E_CALENDAR_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k),\ - e_calendar_item_get_type ())) -#define E_IS_CALENDAR_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \ - e_calendar_item_get_type ())) +/* Standard GObject macros */ +#define E_TYPE_CALENDAR_ITEM \ + (e_calendar_item_get_type ()) +#define E_CALENDAR_ITEM(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_CALENDAR_ITEM, ECalendarItem)) +#define E_CALENDAR_ITEM_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_CALENDAR_ITEM, ECalendarItemClass)) +#define E_IS_CALENDAR_ITEM(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_CALENDAR_ITEM)) +#define E_IS_CALENDAR_ITEM_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_CALENDAR_ITEM)) +#define E_CALENDAR_ITEM_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_CALENDAR_ITEM, ECalendarItemClass)) struct _ECalendarItem { diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c index db63ffaaf8..03c8f2fd47 100644 --- a/widgets/misc/e-dateedit.c +++ b/widgets/misc/e-dateedit.c @@ -41,6 +41,7 @@ #include <libedataserver/e-data-server-util.h> #include <e-util/e-util.h> #include <e-util/e-binding.h> +#include <e-util/e-extensible.h> #include "e-calendar.h" #define E_DATE_EDIT_GET_PRIVATE(obj) \ @@ -205,9 +206,12 @@ static gboolean e_date_edit_set_time_internal (EDateEdit *dedit, gint hour, gint minute); -static gpointer parent_class; static gint signals[LAST_SIGNAL]; +G_DEFINE_TYPE_WITH_CODE ( + EDateEdit, e_date_edit, GTK_TYPE_HBOX, + G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL)) + static void date_edit_set_property (GObject *object, guint property_id, @@ -334,16 +338,15 @@ date_edit_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_date_edit_parent_class)->dispose (object); } static void -date_edit_class_init (EDateEditClass *class) +e_date_edit_class_init (EDateEditClass *class) { GObjectClass *object_class; GtkWidgetClass *widget_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EDateEditPrivate)); object_class = G_OBJECT_CLASS (class); @@ -448,7 +451,7 @@ date_edit_class_init (EDateEditClass *class) } static void -date_edit_init (EDateEdit *dedit) +e_date_edit_init (EDateEdit *dedit) { dedit->priv = E_DATE_EDIT_GET_PRIVATE (dedit); @@ -476,32 +479,8 @@ date_edit_init (EDateEdit *dedit) /* Set it to the current time. */ e_date_edit_set_time (dedit, 0); -} - -GType -e_date_edit_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EDateEditClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) date_edit_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EDateEdit), - 0, /* n_preallocs */ - (GInstanceInitFunc) date_edit_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GTK_TYPE_HBOX, "EDateEdit", &type_info, 0); - } - return type; + e_extensible_load_extensions (E_EXTENSIBLE (dedit)); } /** |