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 | |
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.
45 files changed, 843 insertions, 432 deletions
diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index 271ac5a8cc..cd16b46974 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -209,7 +209,6 @@ comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label) /** * comp_editor_new_date_edit: - * @shell_settings: an #EShellSettings * @show_date: Whether to show a date picker in the widget. * @show_time: Whether to show a time picker in the widget. * @make_time_insensitive: Whether the time field is made insensitive rather @@ -221,15 +220,12 @@ comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label) * Return value: A newly-created #EDateEdit widget. **/ GtkWidget * -comp_editor_new_date_edit (EShellSettings *shell_settings, - gboolean show_date, +comp_editor_new_date_edit (gboolean show_date, gboolean show_time, gboolean make_time_insensitive) { EDateEdit *dedit; - g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), NULL); - dedit = E_DATE_EDIT (e_date_edit_new ()); e_date_edit_set_show_date (dedit, show_date); @@ -240,29 +236,9 @@ comp_editor_new_date_edit (EShellSettings *shell_settings, e_date_edit_set_make_time_insensitive (dedit, FALSE); #endif - comp_editor_bind_date_edit_settings (GTK_WIDGET (dedit), shell_settings); - return GTK_WIDGET (dedit); } -void -comp_editor_bind_date_edit_settings (GtkWidget *dateedit, EShellSettings *shell_settings) -{ - g_return_if_fail (dateedit != NULL); - g_return_if_fail (E_IS_DATE_EDIT (dateedit)); - - if (!shell_settings) - shell_settings = e_shell_get_shell_settings (e_shell_get_default ()); - - e_binding_new ( - shell_settings, "cal-show-week-numbers", - dateedit, "show-week-numbers"); - - e_binding_new ( - shell_settings, "cal-week-start-day", - dateedit, "week-start-day"); -} - /* Returns the current time, for EDateEdit widgets and ECalendar items in the dialogs. FIXME: Should probably use the timezone from somewhere in the component diff --git a/calendar/gui/dialogs/comp-editor-util.h b/calendar/gui/dialogs/comp-editor-util.h index 78a8bab33f..6eeb8c5410 100644 --- a/calendar/gui/dialogs/comp-editor-util.h +++ b/calendar/gui/dialogs/comp-editor-util.h @@ -26,7 +26,6 @@ #define _COMP_EDITOR_UTIL_H_ #include <gtk/gtk.h> -#include <shell/e-shell-settings.h> #include "comp-editor-page.h" #include "../e-meeting-attendee.h" @@ -35,13 +34,10 @@ void comp_editor_free_dates (CompEditorPageDates *dates); void comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label); -GtkWidget * comp_editor_new_date_edit (EShellSettings *shell_settings, - gboolean show_date, +GtkWidget * comp_editor_new_date_edit (gboolean show_date, gboolean show_time, gboolean make_time_insensitive); -void comp_editor_bind_date_edit_settings (GtkWidget *dateedit, EShellSettings *shell_settings); - struct tm comp_editor_get_current_time (GtkObject *object, gpointer data); gchar *comp_editor_strip_categories (const gchar *categories); diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 23256adff0..1a5f6d67fd 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -363,25 +363,12 @@ static void event_editor_constructed (GObject *object) { EventEditorPrivate *priv; - EShellSettings *shell_settings; - EShell *shell; priv = EVENT_EDITOR_GET_PRIVATE (object); - shell = comp_editor_get_shell (COMP_EDITOR (object)); - shell_settings = e_shell_get_shell_settings (shell); - e_binding_new ( object, "client", priv->model, "client"); - - e_binding_new ( - shell_settings, "cal-free-busy-template", - priv->model, "free-busy-template"); - - e_binding_new ( - shell_settings, "cal-timezone", - priv->model, "timezone"); } static void diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 7d79a2bfb7..a74cb64991 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -2219,7 +2219,6 @@ get_widgets (EventPage *epage) /* Glade's visibility flag doesn't seem to work for custom widgets */ priv->start_time = GW ("start-time"); - comp_editor_bind_date_edit_settings (priv->start_time, NULL); gtk_widget_show (priv->start_time); priv->time_hour = GW ("time-hour"); @@ -2228,7 +2227,6 @@ get_widgets (EventPage *epage) priv->end_time_combo = GW ("end-time-combobox"); priv->end_time = GW ("end-time"); - comp_editor_bind_date_edit_settings (priv->end_time, NULL); gtk_widget_show_all (priv->time_hour); gtk_widget_hide (priv->end_time); diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index f5c6a26400..269caba5d6 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -813,7 +813,6 @@ get_widgets (MemoPage *mpage) #undef GW e_util_set_source_combo_box_list (priv->source_selector, "/apps/evolution/memos/sources"); - comp_editor_bind_date_edit_settings (priv->start_date, NULL); completion = e_category_completion_new (); gtk_entry_set_completion (GTK_ENTRY (priv->categories), completion); diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 6bb9f18e28..833ad104e3 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -1339,8 +1339,6 @@ static void make_ending_until_special (RecurrencePage *rpage) { RecurrencePagePrivate *priv = rpage->priv; - EShell *shell; - EShellSettings *shell_settings; CompEditor *editor; CompEditorFlags flags; EDateEdit *de; @@ -1352,13 +1350,9 @@ make_ending_until_special (RecurrencePage *rpage) editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); flags = comp_editor_get_flags (editor); - shell = comp_editor_get_shell (editor); - shell_settings = e_shell_get_shell_settings (shell); - /* Create the widget */ - priv->ending_date_edit = comp_editor_new_date_edit ( - shell_settings, TRUE, FALSE, FALSE); + priv->ending_date_edit = comp_editor_new_date_edit (TRUE, FALSE, FALSE); de = E_DATE_EDIT (priv->ending_date_edit); gtk_container_add (GTK_CONTAINER (priv->ending_special), @@ -2087,14 +2081,10 @@ create_exception_dialog (RecurrencePage *rpage, const gchar *title, GtkWidget ** RecurrencePagePrivate *priv; GtkWidget *dialog, *toplevel; CompEditor *editor; - EShell *shell; - EShellSettings *shell_settings; priv = rpage->priv; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); - shell = comp_editor_get_shell (editor); - shell_settings = e_shell_get_shell_settings (shell); toplevel = gtk_widget_get_toplevel (priv->main); dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (toplevel), @@ -2103,7 +2093,7 @@ create_exception_dialog (RecurrencePage *rpage, const gchar *title, GtkWidget ** GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - *date_edit = comp_editor_new_date_edit (shell_settings, TRUE, FALSE, TRUE); + *date_edit = comp_editor_new_date_edit (TRUE, FALSE, TRUE); gtk_widget_show (*date_edit); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), *date_edit, FALSE, TRUE, 6); @@ -2259,8 +2249,6 @@ static void init_widgets (RecurrencePage *rpage) { RecurrencePagePrivate *priv; - EShell *shell; - EShellSettings *shell_settings; CompEditor *editor; ECalendar *ecal; GtkAdjustment *adj; @@ -2270,22 +2258,12 @@ init_widgets (RecurrencePage *rpage) priv = rpage->priv; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); - shell = comp_editor_get_shell (editor); - shell_settings = e_shell_get_shell_settings (shell); /* Recurrence preview */ priv->preview_calendar = e_calendar_new (); ecal = E_CALENDAR (priv->preview_calendar); - e_binding_new ( - shell_settings, "cal-show-week-numbers", - ecal->calitem, "show-week-numbers"); - - e_binding_new ( - shell_settings, "cal-week-start-day", - ecal->calitem, "week-start-day"); - g_signal_connect((ecal->calitem), "date_range_changed", G_CALLBACK (preview_date_range_changed_cb), rpage); @@ -2422,12 +2400,6 @@ GtkWidget *make_exdate_date_edit (void); GtkWidget * make_exdate_date_edit (void) { - EShell *shell; - EShellSettings *shell_settings; - - shell = e_shell_get_default (); - shell_settings = e_shell_get_shell_settings (shell); - - return comp_editor_new_date_edit (shell_settings, TRUE, TRUE, FALSE); + return comp_editor_new_date_edit (TRUE, TRUE, FALSE); } diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c index 32b6dffab8..2e13cba1b9 100644 --- a/calendar/gui/dialogs/schedule-page.c +++ b/calendar/gui/dialogs/schedule-page.c @@ -380,13 +380,9 @@ SchedulePage * schedule_page_construct (SchedulePage *spage, EMeetingStore *ems) { SchedulePagePrivate *priv = spage->priv; - EShellSettings *shell_settings; - EShell *shell; CompEditor *editor; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (spage)); - shell = comp_editor_get_shell (editor); - shell_settings = e_shell_get_shell_settings (shell); priv->builder = gtk_builder_new (); e_load_ui_builder_definition (priv->builder, "schedule-page.ui"); @@ -412,18 +408,6 @@ schedule_page_construct (SchedulePage *spage, EMeetingStore *ems) gtk_widget_show (GTK_WIDGET (priv->sel)); gtk_box_pack_start (GTK_BOX (priv->main), GTK_WIDGET (priv->sel), TRUE, TRUE, 6); - e_binding_new ( - shell_settings, "cal-show-week-numbers", - priv->sel, "show-week-numbers"); - - e_binding_new ( - shell_settings, "cal-use-24-hour-format", - priv->sel, "use-24-hour-format"); - - e_binding_new ( - shell_settings, "cal-week-start-day", - priv->sel, "week-start-day"); - if (!init_widgets (spage)) { g_message ("schedule_page_construct(): " "Could not initialize the widgets!"); diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index 4a5b5b094e..c549633eb5 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -474,7 +474,6 @@ get_widgets (TaskDetailsPage *tdpage) priv->date_completed_label = GW ("date_completed_label"); priv->completed_date = GW ("completed-date"); - comp_editor_bind_date_edit_settings (priv->completed_date, NULL); gtk_widget_show (priv->completed_date); priv->url_label = GW ("url_label"); diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index a3d4baec46..7aaa3c5afe 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -202,25 +202,12 @@ static void task_editor_constructed (GObject *object) { TaskEditorPrivate *priv; - EShellSettings *shell_settings; - EShell *shell; priv = TASK_EDITOR_GET_PRIVATE (object); - shell = comp_editor_get_shell (COMP_EDITOR (object)); - shell_settings = e_shell_get_shell_settings (shell); - e_binding_new ( object, "client", priv->model, "client"); - - e_binding_new ( - shell_settings, "cal-free-busy-template", - priv->model, "free-busy-template"); - - e_binding_new ( - shell_settings, "cal-timezone", - priv->model, "timezone"); } static void diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 33413250ad..623260cf46 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -1360,10 +1360,8 @@ get_widgets (TaskPage *tpage) /* Glade's visibility flag doesn't seem to work for custom widgets */ priv->due_date = e_builder_get_widget (priv->builder, "due-date"); - comp_editor_bind_date_edit_settings (priv->due_date, NULL); gtk_widget_show (priv->due_date); priv->start_date = e_builder_get_widget (priv->builder, "start-date"); - comp_editor_bind_date_edit_settings (priv->start_date, NULL); gtk_widget_show (priv->start_date); priv->timezone = e_builder_get_widget (priv->builder, "timezone"); diff --git a/calendar/gui/e-cal-model-calendar.c b/calendar/gui/e-cal-model-calendar.c index 6df5588dae..778b72de21 100644 --- a/calendar/gui/e-cal-model-calendar.c +++ b/calendar/gui/e-cal-model-calendar.c @@ -525,11 +525,7 @@ ecmc_fill_component_from_model (ECalModel *model, ECalModelComponent *comp_data, * e_cal_model_calendar_new */ ECalModel * -e_cal_model_calendar_new (EShellSettings *shell_settings) +e_cal_model_calendar_new (void) { - g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), NULL); - - return g_object_new ( - E_TYPE_CAL_MODEL_CALENDAR, - "shell-settings", shell_settings, NULL); + return g_object_new (E_TYPE_CAL_MODEL_CALENDAR, NULL); } diff --git a/calendar/gui/e-cal-model-calendar.h b/calendar/gui/e-cal-model-calendar.h index f1027032cb..6e3b3fe617 100644 --- a/calendar/gui/e-cal-model-calendar.h +++ b/calendar/gui/e-cal-model-calendar.h @@ -71,8 +71,8 @@ struct _ECalModelCalendarClass { ECalModelClass parent_class; }; -GType e_cal_model_calendar_get_type (void); -ECalModel * e_cal_model_calendar_new (EShellSettings *shell_settings); +GType e_cal_model_calendar_get_type (void); +ECalModel * e_cal_model_calendar_new (void); G_END_DECLS diff --git a/calendar/gui/e-cal-model-memos.c b/calendar/gui/e-cal-model-memos.c index 41f63700c8..38e55ef71a 100644 --- a/calendar/gui/e-cal-model-memos.c +++ b/calendar/gui/e-cal-model-memos.c @@ -261,11 +261,7 @@ ecmm_fill_component_from_model (ECalModel *model, ECalModelComponent *comp_data, * e_cal_model_memos_new */ ECalModel * -e_cal_model_memos_new (EShellSettings *shell_settings) +e_cal_model_memos_new (void) { - g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), NULL); - - return g_object_new ( - E_TYPE_CAL_MODEL_MEMOS, - "shell-settings", shell_settings, NULL); + return g_object_new (E_TYPE_CAL_MODEL_MEMOS, NULL); } diff --git a/calendar/gui/e-cal-model-memos.h b/calendar/gui/e-cal-model-memos.h index b58faa539b..3977bbe0cb 100644 --- a/calendar/gui/e-cal-model-memos.h +++ b/calendar/gui/e-cal-model-memos.h @@ -71,7 +71,7 @@ struct _ECalModelMemosClass { }; GType e_cal_model_memos_get_type (void); -ECalModel * e_cal_model_memos_new (EShellSettings *shell_settings); +ECalModel * e_cal_model_memos_new (void); G_END_DECLS diff --git a/calendar/gui/e-cal-model-tasks.c b/calendar/gui/e-cal-model-tasks.c index e6fd01e9c9..c69e7452b9 100644 --- a/calendar/gui/e-cal-model-tasks.c +++ b/calendar/gui/e-cal-model-tasks.c @@ -133,27 +133,6 @@ cal_model_tasks_finalize (GObject *object) } static void -cal_model_tasks_constructed (GObject *object) -{ - ECalModel *model; - EShellSettings *shell_settings; - - model = E_CAL_MODEL (object); - shell_settings = e_cal_model_get_shell_settings (model); - - e_binding_new ( - shell_settings, "cal-tasks-color-due-today", - model, "color-due-today"); - - e_binding_new ( - shell_settings, "cal-tasks-color-overdue", - model, "color-overdue"); - - /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (e_cal_model_tasks_parent_class)->constructed (object); -} - -static void e_cal_model_tasks_class_init (ECalModelTasksClass *class) { GObjectClass *object_class; @@ -166,7 +145,6 @@ e_cal_model_tasks_class_init (ECalModelTasksClass *class) object_class->set_property = cal_model_tasks_set_property; object_class->get_property = cal_model_tasks_get_property; object_class->finalize = cal_model_tasks_finalize; - object_class->constructed = cal_model_tasks_constructed; table_model_class = E_TABLE_MODEL_CLASS (class); table_model_class->column_count = ecmt_column_count; @@ -1157,13 +1135,9 @@ ecmt_fill_component_from_model (ECalModel *model, ECalModelComponent *comp_data, } ECalModel * -e_cal_model_tasks_new (EShellSettings *shell_settings) +e_cal_model_tasks_new (void) { - g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), NULL); - - return g_object_new ( - E_TYPE_CAL_MODEL_TASKS, - "shell-settings", shell_settings, NULL); + return g_object_new (E_TYPE_CAL_MODEL_TASKS, NULL); } const gchar * diff --git a/calendar/gui/e-cal-model-tasks.h b/calendar/gui/e-cal-model-tasks.h index 056325547d..c0ceaaa2c5 100644 --- a/calendar/gui/e-cal-model-tasks.h +++ b/calendar/gui/e-cal-model-tasks.h @@ -79,7 +79,7 @@ struct _ECalModelTasksClass { }; GType e_cal_model_tasks_get_type (void); -ECalModel * e_cal_model_tasks_new (EShellSettings *shell_settings); +ECalModel * e_cal_model_tasks_new (void); const gchar * e_cal_model_tasks_get_color_due_today (ECalModelTasks *model); void e_cal_model_tasks_set_color_due_today diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 1004d1b2a0..eaa5df68e1 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -35,7 +35,7 @@ #include "e-cal-model.h" #include "itip-utils.h" #include "misc.h" -#include "e-util/e-binding.h" +#include "e-util/e-extensible.h" #include "e-util/e-util.h" #define E_CAL_MODEL_GET_PRIVATE(obj) \ @@ -54,8 +54,6 @@ typedef struct { } ECalModelClient; struct _ECalModelPrivate { - EShellSettings *shell_settings; - /* The list of clients we are managing. Each element is of type ECalModelClient */ GList *clients; @@ -128,7 +126,6 @@ static void remove_client (ECalModel *model, ECalModelClient *client_data); enum { PROP_0, PROP_DEFAULT_CLIENT, - PROP_SHELL_SETTINGS, PROP_TIMEZONE, PROP_USE_24_HOUR_FORMAT, PROP_WEEK_START_DAY @@ -147,17 +144,9 @@ enum { static gpointer parent_class; static guint signals[LAST_SIGNAL]; -G_DEFINE_TYPE (ECalModel, e_cal_model, E_TABLE_MODEL_TYPE) - -static void -cal_model_set_shell_settings (ECalModel *cal_model, - EShellSettings *shell_settings) -{ - g_return_if_fail (E_IS_SHELL_SETTINGS (shell_settings)); - g_return_if_fail (cal_model->priv->shell_settings == NULL); - - cal_model->priv->shell_settings = g_object_ref (shell_settings); -} +G_DEFINE_TYPE_WITH_CODE ( + ECalModel, e_cal_model, E_TABLE_MODEL_TYPE, + G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL)) static void cal_model_set_property (GObject *object, @@ -172,12 +161,6 @@ cal_model_set_property (GObject *object, g_value_get_object (value)); return; - case PROP_SHELL_SETTINGS: - cal_model_set_shell_settings ( - E_CAL_MODEL (object), - g_value_get_object (value)); - return; - case PROP_TIMEZONE: e_cal_model_set_timezone ( E_CAL_MODEL (object), @@ -214,13 +197,6 @@ cal_model_get_property (GObject *object, E_CAL_MODEL (object))); return; - case PROP_SHELL_SETTINGS: - g_value_set_object ( - value, - e_cal_model_get_shell_settings ( - E_CAL_MODEL (object))); - return; - case PROP_TIMEZONE: g_value_set_pointer ( value, @@ -253,11 +229,6 @@ cal_model_dispose (GObject *object) priv = E_CAL_MODEL_GET_PRIVATE (object); - if (priv->shell_settings != NULL) { - g_object_unref (priv->shell_settings); - priv->shell_settings = NULL; - } - if (priv->clients) { while (priv->clients != NULL) { ECalModelClient *client_data = (ECalModelClient *) priv->clients->data; @@ -316,28 +287,6 @@ cal_model_finalize (GObject *object) } static void -cal_model_constructed (GObject *object) -{ - ECalModel *model; - EShellSettings *shell_settings; - - model = E_CAL_MODEL (object); - shell_settings = e_cal_model_get_shell_settings (model); - - e_binding_new ( - shell_settings, "cal-timezone", - model, "timezone"); - - e_binding_new ( - shell_settings, "cal-use-24-hour-format", - model, "use-24-hour-format"); - - e_binding_new ( - shell_settings, "cal-week-start-day", - model, "week-start-day"); -} - -static void e_cal_model_class_init (ECalModelClass *class) { GObjectClass *object_class; @@ -351,7 +300,6 @@ e_cal_model_class_init (ECalModelClass *class) object_class->get_property = cal_model_get_property; object_class->dispose = cal_model_dispose; object_class->finalize = cal_model_finalize; - object_class->constructed = cal_model_constructed; etm_class = E_TABLE_MODEL_CLASS (class); etm_class->column_count = ecm_column_count; @@ -381,17 +329,6 @@ e_cal_model_class_init (ECalModelClass *class) g_object_class_install_property ( object_class, - PROP_SHELL_SETTINGS, - g_param_spec_object ( - "shell-settings", - _("Shell Settings"), - _("Application-wide settings"), - E_TYPE_SHELL_SETTINGS, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); - - g_object_class_install_property ( - object_class, PROP_TIMEZONE, g_param_spec_pointer ( "timezone", @@ -502,6 +439,8 @@ e_cal_model_init (ECalModel *model) model->priv->notify_modified = NULL; model->priv->notify_removed = NULL; model->priv->notify_lock = g_mutex_new (); + + e_extensible_load_extensions (E_EXTENSIBLE (model)); } /* ETableModel methods */ @@ -1376,14 +1315,6 @@ ecm_get_color_for_component (ECalModel *model, ECalModelComponent *comp_data) return assigned_colors[first_empty].color; } -EShellSettings * -e_cal_model_get_shell_settings (ECalModel *model) -{ - g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL); - - return model->priv->shell_settings; -} - icalcomponent_kind e_cal_model_get_component_kind (ECalModel *model) { diff --git a/calendar/gui/e-cal-model.h b/calendar/gui/e-cal-model.h index 2d30f1877f..ee914eef67 100644 --- a/calendar/gui/e-cal-model.h +++ b/calendar/gui/e-cal-model.h @@ -29,7 +29,6 @@ #include <table/e-table-model.h> #include <libecal/e-cal.h> #include "e-cell-date-edit-text.h" -#include <shell/e-shell-settings.h> /* Standard GObject macros */ #define E_TYPE_CAL_MODEL \ @@ -173,7 +172,6 @@ typedef time_t (*ECalModelDefaultTimeFunc) (ECalModel *model, gpointer user_data GType e_cal_model_get_type (void); GType e_cal_model_component_get_type (void); -EShellSettings *e_cal_model_get_shell_settings (ECalModel *model); icalcomponent_kind e_cal_model_get_component_kind (ECalModel *model); void e_cal_model_set_component_kind (ECalModel *model, diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 42e4c1cd7a..d41ef007a4 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -33,6 +33,7 @@ #include <libedataserver/e-time-utils.h> #include <e-util/e-util.h> #include <e-util/e-alert-dialog.h> +#include <e-util/e-extensible.h> #include <e-util/e-selection.h> #include <e-util/e-datetime-format.h> #include <e-util/e-dialog-utils.h> @@ -104,7 +105,9 @@ static guint signals[LAST_SIGNAL]; static void calendar_view_selectable_init (ESelectableInterface *interface); -G_DEFINE_ABSTRACT_TYPE_WITH_CODE (ECalendarView, e_calendar_view, GTK_TYPE_TABLE, +G_DEFINE_ABSTRACT_TYPE_WITH_CODE ( + ECalendarView, e_calendar_view, GTK_TYPE_TABLE, + G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL) G_IMPLEMENT_INTERFACE (E_TYPE_SELECTABLE, calendar_view_selectable_init)); static void @@ -873,6 +876,8 @@ e_calendar_view_init (ECalendarView *calendar_view) target_list = gtk_target_list_new (NULL, 0); e_target_list_add_calendar_targets (target_list, 0); calendar_view->priv->paste_target_list = target_list; + + e_extensible_load_extensions (E_EXTENSIBLE (calendar_view)); } static void diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 3df599f5d7..cbc71b969c 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -590,56 +590,12 @@ static void day_view_constructed (GObject *object) { ECalModel *model; - EDayView *day_view; - EShellSettings *shell_settings; - - day_view = E_DAY_VIEW (object); - model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)); - shell_settings = e_cal_model_get_shell_settings (model); - - e_binding_new ( - shell_settings, "cal-day-view-show-week-numbers", - day_view->week_number_label, "visible"); - - e_binding_new ( - shell_settings, "cal-marcus-bains-show-line", - day_view, "marcus-bains-show-line"); - - e_binding_new ( - shell_settings, "cal-marcus-bains-day-view-color", - day_view, "marcus-bains-day-view-color"); - - e_binding_new ( - shell_settings, "cal-marcus-bains-time-bar-color", - day_view, "marcus-bains-time-bar-color"); - - e_binding_new ( - shell_settings, "cal-time-divisions", - day_view, "mins-per-row"); - - e_binding_new ( - shell_settings, "cal-work-day-end-hour", - day_view, "work-day-end-hour"); - - e_binding_new ( - shell_settings, "cal-work-day-end-minute", - day_view, "work-day-end-minute"); - - e_binding_new ( - shell_settings, "cal-work-day-start-hour", - day_view, "work-day-start-hour"); - - e_binding_new ( - shell_settings, "cal-work-day-start-minute", - day_view, "work-day-start-minute"); - e_binding_new ( - shell_settings, "cal-working-days-bitset", - day_view, "working-days"); + model = e_calendar_view_get_model (E_CALENDAR_VIEW (object)); g_signal_connect_swapped ( model, "notify::week-start-day", - G_CALLBACK (day_view_notify_week_start_day_cb), day_view); + G_CALLBACK (day_view_notify_week_start_day_cb), object); } static void diff --git a/calendar/gui/e-meeting-store.c b/calendar/gui/e-meeting-store.c index 8b9f02c5a5..28f171219e 100644 --- a/calendar/gui/e-meeting-store.c +++ b/calendar/gui/e-meeting-store.c @@ -31,6 +31,7 @@ #include <libecal/e-cal-util.h> #include <libecal/e-cal-time-util.h> #include <libedataserver/e-data-server-util.h> +#include <e-util/e-extensible.h> #include "itip-utils.h" #include "e-meeting-utils.h" #include "e-meeting-attendee.h" @@ -87,7 +88,13 @@ enum { PROP_TIMEZONE }; -static gpointer parent_class; +/* Forward Declarations */ +static void ems_tree_model_init (GtkTreeModelIface *iface); + +G_DEFINE_TYPE_WITH_CODE ( + EMeetingStore, e_meeting_store, GTK_TYPE_LIST_STORE, + G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL) + G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL, ems_tree_model_init)) static icalparameter_cutype text_to_type (const gchar *type) @@ -624,15 +631,14 @@ meeting_store_finalize (GObject *object) g_mutex_free (priv->mutex); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_meeting_store_parent_class)->finalize (object); } static void -meeting_store_class_init (GObjectClass *class) +e_meeting_store_class_init (EMeetingStoreClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EMeetingStorePrivate)); object_class = G_OBJECT_CLASS (class); @@ -671,7 +677,7 @@ meeting_store_class_init (GObjectClass *class) } static void -meeting_store_init (EMeetingStore *store) +e_meeting_store_init (EMeetingStore *store) { store->priv = E_MEETING_STORE_GET_PRIVATE (store); @@ -682,41 +688,8 @@ meeting_store_init (EMeetingStore *store) store->priv->mutex = g_mutex_new (); store->priv->num_queries = 0; -} - -GType -e_meeting_store_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EMeetingStoreClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) meeting_store_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMeetingStore), - 0, /* n_preallocs */ - (GInstanceInitFunc) meeting_store_init, - NULL /* value_table */ - }; - - static const GInterfaceInfo tree_model_info = { - (GInterfaceInitFunc) ems_tree_model_init, - NULL, - NULL - }; - - type = g_type_register_static ( - GTK_TYPE_LIST_STORE, "EMeetingStore", &type_info, 0); - - g_type_add_interface_static ( - type, GTK_TYPE_TREE_MODEL, &tree_model_info); - } - return type; + e_extensible_load_extensions (E_EXTENSIBLE (store)); } GObject * diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c index 19a572d6d8..72f531bc0f 100644 --- a/calendar/gui/e-meeting-time-sel.c +++ b/calendar/gui/e-meeting-time-sel.c @@ -40,6 +40,7 @@ #include "misc/e-dateedit.h" #include "e-util/e-binding.h" +#include "e-util/e-extensible.h" #include "e-util/e-util.h" #include "e-meeting-utils.h" @@ -203,7 +204,9 @@ static void row_deleted_cb (GtkTreeModel *model, GtkTreePath *path, gpointer dat static void free_busy_template_changed_cb (EMeetingTimeSelector *mts); -G_DEFINE_TYPE (EMeetingTimeSelector, e_meeting_time_selector, GTK_TYPE_TABLE) +G_DEFINE_TYPE_WITH_CODE ( + EMeetingTimeSelector, e_meeting_time_selector, GTK_TYPE_TABLE, + G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL)) static void meeting_time_selector_set_property (GObject *object, @@ -391,6 +394,8 @@ e_meeting_time_selector_init (EMeetingTimeSelector * mts) mts->fb_refresh_not = 0; mts->style_change_idle_id = 0; + + e_extensible_load_extensions (E_EXTENSIBLE (mts)); } void diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index c319520924..23cc8e6654 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -522,19 +522,9 @@ week_view_constructed (GObject *object) { ECalModel *model; ECalendarView *calendar_view; - EShellSettings *shell_settings; calendar_view = E_CALENDAR_VIEW (object); model = e_calendar_view_get_model (calendar_view); - shell_settings = e_cal_model_get_shell_settings (model); - - e_binding_new ( - shell_settings, "cal-compress-weekend", - object, "compress-weekend"); - - e_binding_new ( - shell_settings, "cal-show-event-end-times", - object, "show-event-end-times"); g_signal_connect_swapped ( model, "notify::week-start-day", diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 8ad4ca460e..ea02e1c400 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -74,8 +74,6 @@ static GHashTable *non_intrusive_error_table = NULL; /* Private part of the GnomeCalendar structure */ struct _GnomeCalendarPrivate { - EShellSettings *shell_settings; - ECalModel *model; /* @@ -136,7 +134,6 @@ struct _GnomeCalendarPrivate { enum { PROP_0, PROP_DATE_NAVIGATOR, - PROP_SHELL_SETTINGS, PROP_VIEW }; @@ -320,16 +317,6 @@ gnome_calendar_update_time_range (GnomeCalendar *gcal) } static void -gnome_calendar_set_shell_settings (GnomeCalendar *gcal, - EShellSettings *shell_settings) -{ - g_return_if_fail (E_IS_SHELL_SETTINGS (shell_settings)); - g_return_if_fail (gcal->priv->shell_settings == NULL); - - gcal->priv->shell_settings = g_object_ref (shell_settings); -} - -static void gnome_calendar_set_property (GObject *object, guint property_id, const GValue *value, @@ -342,12 +329,6 @@ gnome_calendar_set_property (GObject *object, g_value_get_object (value)); return; - case PROP_SHELL_SETTINGS: - gnome_calendar_set_shell_settings ( - GNOME_CALENDAR (object), - g_value_get_object (value)); - return; - case PROP_VIEW: gnome_calendar_set_view ( GNOME_CALENDAR (object), @@ -371,12 +352,6 @@ gnome_calendar_get_property (GObject *object, GNOME_CALENDAR (object))); return; - case PROP_SHELL_SETTINGS: - g_value_set_object ( - value, gnome_calendar_get_shell_settings ( - GNOME_CALENDAR (object))); - return; - case PROP_VIEW: g_value_set_int ( value, gnome_calendar_get_view ( @@ -391,15 +366,12 @@ static void gnome_calendar_constructed (GObject *object) { GnomeCalendar *gcal = GNOME_CALENDAR (object); - EShellSettings *shell_settings; ECalendarView *calendar_view; ECalModel *model; GtkAdjustment *adjustment; - shell_settings = gnome_calendar_get_shell_settings (gcal); - /* Create the model for the views. */ - model = e_cal_model_calendar_new (shell_settings); + model = e_cal_model_calendar_new (); e_cal_model_set_flags (model, E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES); gcal->priv->model = model; @@ -512,17 +484,6 @@ gnome_calendar_class_init (GnomeCalendarClass *class) g_object_class_install_property ( object_class, - PROP_SHELL_SETTINGS, - g_param_spec_object ( - "shell-settings", - _("Shell Settings"), - _("Application-wide settings"), - E_TYPE_SHELL_SETTINGS, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); - - g_object_class_install_property ( - object_class, PROP_VIEW, g_param_spec_int ( "view", @@ -1412,11 +1373,6 @@ gnome_calendar_do_dispose (GObject *object) priv = gcal->priv; - if (priv->shell_settings != NULL) { - g_object_unref (priv->shell_settings); - priv->shell_settings = NULL; - } - if (priv->model != NULL) { g_signal_handlers_disconnect_by_func ( priv->model, view_progress_cb, gcal); @@ -1826,21 +1782,9 @@ non_intrusive_error_remove(GtkWidget *w, gpointer data) } GtkWidget * -gnome_calendar_new (EShellSettings *shell_settings) +gnome_calendar_new (void) { - g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), NULL); - - return g_object_new ( - GNOME_TYPE_CALENDAR, - "shell-settings", shell_settings, NULL); -} - -EShellSettings * -gnome_calendar_get_shell_settings (GnomeCalendar *gcal) -{ - g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL); - - return gcal->priv->shell_settings; + return g_object_new (GNOME_TYPE_CALENDAR, NULL); } ECalendar * diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h index b24648e2bc..8511f0f543 100644 --- a/calendar/gui/gnome-cal.h +++ b/calendar/gui/gnome-cal.h @@ -31,7 +31,6 @@ #include <gtk/gtk.h> #include <misc/e-calendar.h> #include <libecal/e-cal.h> -#include <shell/e-shell-settings.h> #include "e-cal-model.h" @@ -113,10 +112,8 @@ struct _GnomeCalendarClass { }; GType gnome_calendar_get_type (void); -GtkWidget * gnome_calendar_new (EShellSettings *shell_settings); +GtkWidget * gnome_calendar_new (void); void gnome_calendar_dispose (GnomeCalendar *gcal); -EShellSettings *gnome_calendar_get_shell_settings - (GnomeCalendar *gcal); ECalendar * gnome_calendar_get_date_navigator (GnomeCalendar *gcal); void gnome_calendar_set_date_navigator diff --git a/modules/calendar/Makefile.am b/modules/calendar/Makefile.am index 0a22b2f568..bbabb6cfb2 100644 --- a/modules/calendar/Makefile.am +++ b/modules/calendar/Makefile.am @@ -14,8 +14,20 @@ libevolution_module_calendar_la_SOURCES = \ evolution-module-calendar.c \ e-cal-attachment-handler.c \ e-cal-attachment-handler.h \ + e-cal-config-calendar-item.c \ + e-cal-config-calendar-item.h \ + e-cal-config-date-edit.c \ + e-cal-config-date-edit.h \ e-cal-config-hook.c \ e-cal-config-hook.h \ + e-cal-config-meeting-store.c \ + e-cal-config-meeting-store.h \ + e-cal-config-meeting-time-selector.c \ + e-cal-config-meeting-time-selector.h \ + e-cal-config-model.c \ + e-cal-config-model.h \ + e-cal-config-view.c \ + e-cal-config-view.h \ e-cal-event-hook.c \ e-cal-event-hook.h \ e-cal-shell-backend.c \ diff --git a/modules/calendar/e-cal-config-calendar-item.c b/modules/calendar/e-cal-config-calendar-item.c new file mode 100644 index 0000000000..5c585f94ca --- /dev/null +++ b/modules/calendar/e-cal-config-calendar-item.c @@ -0,0 +1,79 @@ +/* + * e-cal-config-calendar-item.c + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + */ + +#include "e-cal-config-calendar-item.h" + +#include <shell/e-shell.h> +#include <e-util/e-binding.h> +#include <e-util/e-extension.h> +#include <misc/e-calendar-item.h> + +static void +cal_config_calendar_item_constructed (GObject *object) +{ + EExtension *extension; + EExtensible *extensible; + EShellSettings *shell_settings; + EShell *shell; + + extension = E_EXTENSION (object); + extensible = e_extension_get_extensible (extension); + + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + + e_binding_new ( + shell_settings, "cal-show-week-numbers", + extensible, "show-week-numbers"); + + e_binding_new ( + shell_settings, "cal-week-start-day", + extensible, "week-start-day"); +} + +static void +cal_config_calendar_item_class_init (EExtensionClass *class) +{ + GObjectClass *object_class; + + object_class = G_OBJECT_CLASS (class); + object_class->constructed = cal_config_calendar_item_constructed; + + class->extensible_type = E_TYPE_CALENDAR_ITEM; +} + +void +e_cal_config_calendar_item_register_type (GTypeModule *type_module) +{ + static const GTypeInfo type_info = { + sizeof (EExtensionClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) cal_config_calendar_item_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (EExtension), + 0, /* n_preallocs */ + (GInstanceInitFunc) NULL, + NULL /* value_table */ + }; + + g_type_module_register_type ( + type_module, E_TYPE_EXTENSION, + "ECalConfigCalendarItem", &type_info, 0); +} diff --git a/modules/calendar/e-cal-config-calendar-item.h b/modules/calendar/e-cal-config-calendar-item.h new file mode 100644 index 0000000000..af12eb244a --- /dev/null +++ b/modules/calendar/e-cal-config-calendar-item.h @@ -0,0 +1,30 @@ +/* + * e-cal-config-calendar-item.h + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + */ + +#ifndef E_CAL_CONFIG_CALENDAR_ITEM_H +#define E_CAL_CONFIG_CALENDAR_ITEM_H + +#include <glib-object.h> + +G_BEGIN_DECLS + +void e_cal_config_calendar_item_register_type (GTypeModule *type_module); + +G_END_DECLS + +#endif /* E_CAL_CONFIG_CALENDAR_ITEM_H */ diff --git a/modules/calendar/e-cal-config-date-edit.c b/modules/calendar/e-cal-config-date-edit.c new file mode 100644 index 0000000000..667e749dff --- /dev/null +++ b/modules/calendar/e-cal-config-date-edit.c @@ -0,0 +1,79 @@ +/* + * e-cal-config-date-edit.c + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + */ + +#include "e-cal-config-date-edit.h" + +#include <shell/e-shell.h> +#include <e-util/e-binding.h> +#include <e-util/e-extension.h> +#include <misc/e-dateedit.h> + +static void +cal_config_date_edit_constructed (GObject *object) +{ + EExtension *extension; + EExtensible *extensible; + EShellSettings *shell_settings; + EShell *shell; + + extension = E_EXTENSION (object); + extensible = e_extension_get_extensible (extension); + + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + + e_binding_new ( + shell_settings, "cal-show-week-numbers", + extensible, "show-week-numbers"); + + e_binding_new ( + shell_settings, "cal-week-start-day", + extensible, "week-start-day"); +} + +static void +cal_config_date_edit_class_init (EExtensionClass *class) +{ + GObjectClass *object_class; + + object_class = G_OBJECT_CLASS (class); + object_class->constructed = cal_config_date_edit_constructed; + + class->extensible_type = E_TYPE_DATE_EDIT; +} + +void +e_cal_config_date_edit_register_type (GTypeModule *type_module) +{ + static const GTypeInfo type_info = { + sizeof (EExtensionClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) cal_config_date_edit_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (EExtension), + 0, /* n_preallocs */ + (GInstanceInitFunc) NULL, + NULL /* value_table */ + }; + + g_type_module_register_type ( + type_module, E_TYPE_EXTENSION, + "ECalConfigDateEdit", &type_info, 0); +} diff --git a/modules/calendar/e-cal-config-date-edit.h b/modules/calendar/e-cal-config-date-edit.h new file mode 100644 index 0000000000..33291201dc --- /dev/null +++ b/modules/calendar/e-cal-config-date-edit.h @@ -0,0 +1,30 @@ +/* + * e-cal-config-date-edit.h + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + */ + +#ifndef E_CAL_CONFIG_DATE_EDIT_H +#define E_CAL_CONFIG_DATE_EDIT_H + +#include <glib-object.h> + +G_BEGIN_DECLS + +void e_cal_config_date_edit_register_type (GTypeModule *type_module); + +G_END_DECLS + +#endif /* E_CAL_CONFIG_DATE_EDIT_H */ diff --git a/modules/calendar/e-cal-config-meeting-store.c b/modules/calendar/e-cal-config-meeting-store.c new file mode 100644 index 0000000000..7169ac4029 --- /dev/null +++ b/modules/calendar/e-cal-config-meeting-store.c @@ -0,0 +1,79 @@ +/* + * e-cal-config-meeting-store.c + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + */ + +#include "e-cal-config-meeting-store.h" + +#include <shell/e-shell.h> +#include <e-util/e-binding.h> +#include <e-util/e-extension.h> +#include <calendar/gui/e-meeting-store.h> + +static void +cal_config_meeting_store_constructed (GObject *object) +{ + EExtension *extension; + EExtensible *extensible; + EShellSettings *shell_settings; + EShell *shell; + + extension = E_EXTENSION (object); + extensible = e_extension_get_extensible (extension); + + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + + e_binding_new ( + shell_settings, "cal-free-busy-template", + extensible, "free-busy-template"); + + e_binding_new ( + shell_settings, "cal-timezone", + extensible, "timezone"); +} + +static void +cal_config_meeting_store_class_init (EExtensionClass *class) +{ + GObjectClass *object_class; + + object_class = G_OBJECT_CLASS (class); + object_class->constructed = cal_config_meeting_store_constructed; + + class->extensible_type = E_TYPE_MEETING_STORE; +} + +void +e_cal_config_meeting_store_register_type (GTypeModule *type_module) +{ + static const GTypeInfo type_info = { + sizeof (EExtensionClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) cal_config_meeting_store_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (EExtension), + 0, /* n_preallocs */ + (GInstanceInitFunc) NULL, + NULL /* value_table */ + }; + + g_type_module_register_type ( + type_module, E_TYPE_EXTENSION, + "ECalConfigMeetingStore", &type_info, 0); +} diff --git a/modules/calendar/e-cal-config-meeting-store.h b/modules/calendar/e-cal-config-meeting-store.h new file mode 100644 index 0000000000..9ad2835da8 --- /dev/null +++ b/modules/calendar/e-cal-config-meeting-store.h @@ -0,0 +1,30 @@ +/* + * e-cal-config-meeting-store.h + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + */ + +#ifndef E_CAL_CONFIG_MEETING_STORE_H +#define E_CAL_CONFIG_MEETING_STORE_H + +#include <glib-object.h> + +G_BEGIN_DECLS + +void e_cal_config_meeting_store_register_type (GTypeModule *type_module); + +G_END_DECLS + +#endif /* E_CAL_CONFIG_MEETING_STORE_H */ diff --git a/modules/calendar/e-cal-config-meeting-time-selector.c b/modules/calendar/e-cal-config-meeting-time-selector.c new file mode 100644 index 0000000000..1c45d3b9ef --- /dev/null +++ b/modules/calendar/e-cal-config-meeting-time-selector.c @@ -0,0 +1,83 @@ +/* + * e-cal-config-meeting-time-selector.c + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + */ + +#include "e-cal-config-meeting-time-selector.h" + +#include <shell/e-shell.h> +#include <e-util/e-binding.h> +#include <e-util/e-extension.h> +#include <calendar/gui/e-meeting-time-sel.h> + +static void +cal_config_meeting_time_selector_constructed (GObject *object) +{ + EExtension *extension; + EExtensible *extensible; + EShellSettings *shell_settings; + EShell *shell; + + extension = E_EXTENSION (object); + extensible = e_extension_get_extensible (extension); + + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + + e_binding_new ( + shell_settings, "cal-show-week-numbers", + extensible, "show-week-numbers"); + + e_binding_new ( + shell_settings, "cal-use-24-hour-format", + extensible, "use-24-hour-format"); + + e_binding_new ( + shell_settings, "cal-week-start-day", + extensible, "week-start-day"); +} + +static void +cal_config_meeting_time_selector_class_init (EExtensionClass *class) +{ + GObjectClass *object_class; + + object_class = G_OBJECT_CLASS (class); + object_class->constructed = cal_config_meeting_time_selector_constructed; + + class->extensible_type = E_TYPE_MEETING_TIME_SELECTOR; +} + +void +e_cal_config_meeting_time_selector_register_type (GTypeModule *type_module) +{ + static const GTypeInfo type_info = { + sizeof (EExtensionClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) cal_config_meeting_time_selector_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (EExtension), + 0, /* n_preallocs */ + (GInstanceInitFunc) NULL, + NULL /* value_table */ + }; + + g_type_module_register_type ( + type_module, E_TYPE_EXTENSION, + "ECalConfigMeetingTimeSelector", &type_info, 0); +} diff --git a/modules/calendar/e-cal-config-meeting-time-selector.h b/modules/calendar/e-cal-config-meeting-time-selector.h new file mode 100644 index 0000000000..b244263605 --- /dev/null +++ b/modules/calendar/e-cal-config-meeting-time-selector.h @@ -0,0 +1,30 @@ +/* + * e-cal-config-meeting-time-selector.h + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + */ + +#ifndef E_CAL_CONFIG_MEETING_TIME_SELECTOR_H +#define E_CAL_CONFIG_MEETING_TIME_SELECTOR_H + +#include <glib-object.h> + +G_BEGIN_DECLS + +void e_cal_config_meeting_time_selector_register_type (GTypeModule *type_module); + +G_END_DECLS + +#endif /* E_CAL_CONFIG_MEETING_TIME_SELECTOR_H */ diff --git a/modules/calendar/e-cal-config-model.c b/modules/calendar/e-cal-config-model.c new file mode 100644 index 0000000000..d176d509e9 --- /dev/null +++ b/modules/calendar/e-cal-config-model.c @@ -0,0 +1,99 @@ +/* + * e-cal-config-model.c + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + */ + +#include "e-cal-config-model.h" + +#include <shell/e-shell.h> +#include <e-util/e-binding.h> +#include <e-util/e-extension.h> +#include <calendar/gui/e-cal-model.h> +#include <calendar/gui/e-cal-model-tasks.h> + +static void +cal_config_model_constructed (GObject *object) +{ + EExtension *extension; + EExtensible *extensible; + EShellSettings *shell_settings; + EShell *shell; + + extension = E_EXTENSION (object); + extensible = e_extension_get_extensible (extension); + + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + + /*** ECalModel ***/ + + e_binding_new ( + shell_settings, "cal-timezone", + extensible, "timezone"); + + e_binding_new ( + shell_settings, "cal-use-24-hour-format", + extensible, "use-24-hour-format"); + + e_binding_new ( + shell_settings, "cal-week-start-day", + extensible, "week-start-day"); + + /*** ECalModelTasks ***/ + + if (E_IS_CAL_MODEL_TASKS (extensible)) { + + e_binding_new ( + shell_settings, "cal-tasks-color-due-today", + extensible, "color-due-today"); + + e_binding_new ( + shell_settings, "cal-tasks-color-overdue", + extensible, "color-overdue"); + } +} + +static void +cal_config_model_class_init (EExtensionClass *class) +{ + GObjectClass *object_class; + + object_class = G_OBJECT_CLASS (class); + object_class->constructed = cal_config_model_constructed; + + class->extensible_type = E_TYPE_CAL_MODEL; +} + +void +e_cal_config_model_register_type (GTypeModule *type_module) +{ + static const GTypeInfo type_info = { + sizeof (EExtensionClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) cal_config_model_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (EExtension), + 0, /* n_preallocs */ + (GInstanceInitFunc) NULL, + NULL /* value_table */ + }; + + g_type_module_register_type ( + type_module, E_TYPE_EXTENSION, + "ECalConfigModel", &type_info, 0); +} diff --git a/modules/calendar/e-cal-config-model.h b/modules/calendar/e-cal-config-model.h new file mode 100644 index 0000000000..1c1045a906 --- /dev/null +++ b/modules/calendar/e-cal-config-model.h @@ -0,0 +1,30 @@ +/* + * e-cal-config-model.h + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + */ + +#ifndef E_CAL_CONFIG_MODEL_H +#define E_CAL_CONFIG_MODEL_H + +#include <glib-object.h> + +G_BEGIN_DECLS + +void e_cal_config_model_register_type (GTypeModule *type_module); + +G_END_DECLS + +#endif /* E_CAL_CONFIG_MODEL_H */ diff --git a/modules/calendar/e-cal-config-view.c b/modules/calendar/e-cal-config-view.c new file mode 100644 index 0000000000..9783723a4e --- /dev/null +++ b/modules/calendar/e-cal-config-view.c @@ -0,0 +1,130 @@ +/* + * e-cal-config-view.c + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + */ + +#include "e-cal-config-view.h" + +#include <shell/e-shell.h> +#include <e-util/e-binding.h> +#include <e-util/e-extension.h> +#include <calendar/gui/e-day-view.h> +#include <calendar/gui/e-week-view.h> + +static void +cal_config_view_constructed (GObject *object) +{ + EExtension *extension; + EExtensible *extensible; + EShellSettings *shell_settings; + EShell *shell; + + extension = E_EXTENSION (object); + extensible = e_extension_get_extensible (extension); + + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + + /*** EDayView ***/ + + if (E_IS_DAY_VIEW (extensible)) { + + e_binding_new ( + shell_settings, "cal-day-view-show-week-numbers", + E_DAY_VIEW (extensible)->week_number_label, "visible"); + + e_binding_new ( + shell_settings, "cal-marcus-bains-show-line", + extensible, "marcus-bains-show-line"); + + e_binding_new ( + shell_settings, "cal-marcus-bains-day-view-color", + extensible, "marcus-bains-day-view-color"); + + e_binding_new ( + shell_settings, "cal-marcus-bains-time-bar-color", + extensible, "marcus-bains-time-bar-color"); + + e_binding_new ( + shell_settings, "cal-time-divisions", + extensible, "mins-per-row"); + + e_binding_new ( + shell_settings, "cal-work-day-end-hour", + extensible, "work-day-end-hour"); + + e_binding_new ( + shell_settings, "cal-work-day-end-minute", + extensible, "work-day-end-minute"); + + e_binding_new ( + shell_settings, "cal-work-day-start-hour", + extensible, "work-day-start-hour"); + + e_binding_new ( + shell_settings, "cal-work-day-start-minute", + extensible, "work-day-start-minute"); + + e_binding_new ( + shell_settings, "cal-working-days-bitset", + extensible, "working-days"); + } + + /*** EWeekView ***/ + + if (E_IS_WEEK_VIEW (extensible)) { + + e_binding_new ( + shell_settings, "cal-compress-weekend", + extensible, "compress-weekend"); + + e_binding_new ( + shell_settings, "cal-show-event-end-times", + extensible, "show-event-end-times"); + } +} + +static void +cal_config_view_class_init (EExtensionClass *class) +{ + GObjectClass *object_class; + + object_class = G_OBJECT_CLASS (class); + object_class->constructed = cal_config_view_constructed; + + class->extensible_type = E_TYPE_CALENDAR_VIEW; +} + +void +e_cal_config_view_register_type (GTypeModule *type_module) +{ + static const GTypeInfo type_info = { + sizeof (EExtensionClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) cal_config_view_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (EExtension), + 0, /* n_preallocs */ + (GInstanceInitFunc) NULL, + NULL /* value_table */ + }; + + g_type_module_register_type ( + type_module, E_TYPE_EXTENSION, + "ECalConfigView", &type_info, 0); +} diff --git a/modules/calendar/e-cal-config-view.h b/modules/calendar/e-cal-config-view.h new file mode 100644 index 0000000000..e36acddf0c --- /dev/null +++ b/modules/calendar/e-cal-config-view.h @@ -0,0 +1,31 @@ +/* + * e-cal-config-view.h + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + */ + +#ifndef E_CAL_CONFIG_VIEW_H +#define E_CAL_CONFIG_VIEW_H + +#include <glib-object.h> + +G_BEGIN_DECLS + +void e_cal_config_view_register_type (GTypeModule *type_module); + +G_END_DECLS + +#endif /* E_CAL_CONFIG_VIEW_H */ + diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c index 5506a36572..ded2d0ac8b 100644 --- a/modules/calendar/e-cal-shell-content.c +++ b/modules/calendar/e-cal-shell-content.c @@ -252,7 +252,6 @@ cal_shell_content_constructed (GObject *object) EShell *shell; EShellContent *shell_content; EShellBackend *shell_backend; - EShellSettings *shell_settings; EShellView *shell_view; EShellWindow *shell_window; EShellContent *foreign_content; @@ -281,7 +280,6 @@ cal_shell_content_constructed (GObject *object) config_dir = e_shell_backend_get_config_dir (shell_backend); shell = e_shell_window_get_shell (shell_window); - shell_settings = e_shell_get_shell_settings (shell); /* We borrow the memopad and taskpad models from the memo * and task views, loading the views if necessary. */ @@ -332,7 +330,7 @@ cal_shell_content_constructed (GObject *object) /* Add views in the order defined by GnomeCalendarViewType, such * that the notebook page number corresponds to the view type. */ - priv->calendar = gnome_calendar_new (shell_settings); + priv->calendar = gnome_calendar_new (); calendar = GNOME_CALENDAR (priv->calendar); for (ii = 0; ii < GNOME_CAL_LAST_VIEW; ii++) { diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c index 34946b7bdd..fe952eda3f 100644 --- a/modules/calendar/e-memo-shell-content.c +++ b/modules/calendar/e-memo-shell-content.c @@ -418,7 +418,7 @@ memo_shell_content_constructed (GObject *object) shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); - priv->memo_model = e_cal_model_memos_new (shell_settings); + priv->memo_model = e_cal_model_memos_new (); timezone = e_shell_settings_get_pointer ( shell_settings, "cal-timezone"); diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c index 5fb39a9738..ab813d5b2c 100644 --- a/modules/calendar/e-task-shell-content.c +++ b/modules/calendar/e-task-shell-content.c @@ -415,7 +415,7 @@ task_shell_content_constructed (GObject *object) shell = e_shell_window_get_shell (shell_window); shell_settings = e_shell_get_shell_settings (shell); - priv->task_model = e_cal_model_tasks_new (shell_settings); + priv->task_model = e_cal_model_tasks_new (); timezone = e_shell_settings_get_pointer ( shell_settings, "cal-timezone"); diff --git a/modules/calendar/evolution-module-calendar.c b/modules/calendar/evolution-module-calendar.c index f72e8a97e4..b54f6439a3 100644 --- a/modules/calendar/evolution-module-calendar.c +++ b/modules/calendar/evolution-module-calendar.c @@ -39,6 +39,13 @@ #include "e-task-shell-sidebar.h" #include "e-task-shell-view.h" +#include "e-cal-config-calendar-item.h" +#include "e-cal-config-date-edit.h" +#include "e-cal-config-meeting-store.h" +#include "e-cal-config-meeting-time-selector.h" +#include "e-cal-config-model.h" +#include "e-cal-config-view.h" + /* Module Entry Points */ void e_module_load (GTypeModule *type_module); void e_module_unload (GTypeModule *type_module); @@ -67,6 +74,13 @@ e_module_load (GTypeModule *type_module) e_task_shell_content_register_type (type_module); e_task_shell_sidebar_register_type (type_module); e_task_shell_view_register_type (type_module); + + e_cal_config_calendar_item_register_type (type_module); + e_cal_config_date_edit_register_type (type_module); + e_cal_config_meeting_store_register_type (type_module); + e_cal_config_meeting_time_selector_register_type (type_module); + e_cal_config_model_register_type (type_module); + e_cal_config_view_register_type (type_module); } G_MODULE_EXPORT void 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)); } /** |