diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-12-01 10:53:20 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-02-20 23:04:25 +0800 |
commit | 23f5773903d64a554d977ae7d0ebbaca73528f1f (patch) | |
tree | 104e1a59da8bf96b004bce204b79f47bbe0a6d13 /calendar | |
parent | 49bc4c2d765ee1780c23fdc9f42152850dabb220 (diff) | |
download | gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.gz gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.bz2 gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.lz gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.xz gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.zst gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.zip |
Coding style and whitespace cleanup.
Diffstat (limited to 'calendar')
71 files changed, 1261 insertions, 1492 deletions
diff --git a/calendar/alarm-notify/alarm-notify-dialog.c b/calendar/alarm-notify/alarm-notify-dialog.c index c9a264d880..eec926cf94 100644 --- a/calendar/alarm-notify/alarm-notify-dialog.c +++ b/calendar/alarm-notify/alarm-notify-dialog.c @@ -355,10 +355,18 @@ notified_alarms_dialog_new (void) gtk_image_set_from_icon_name ( GTK_IMAGE (image), "stock_alarm", GTK_ICON_SIZE_DIALOG); - g_signal_connect (an->edit_btn, "clicked", G_CALLBACK (edit_pressed_cb), an); - g_signal_connect (an->print_btn, "clicked", G_CALLBACK (print_pressed_cb), an); - g_signal_connect (an->snooze_btn, "clicked", G_CALLBACK (snooze_pressed_cb), an); - g_signal_connect (an->dismiss_btn, "clicked", G_CALLBACK (dismiss_pressed_cb), an); + g_signal_connect ( + an->edit_btn, "clicked", + G_CALLBACK (edit_pressed_cb), an); + g_signal_connect ( + an->print_btn, "clicked", + G_CALLBACK (print_pressed_cb), an); + g_signal_connect ( + an->snooze_btn, "clicked", + G_CALLBACK (snooze_pressed_cb), an); + g_signal_connect ( + an->dismiss_btn, "clicked", + G_CALLBACK (dismiss_pressed_cb), an); g_signal_connect ( an->dialog, "response", G_CALLBACK (dialog_response_cb), an); diff --git a/calendar/alarm-notify/alarm-notify.c b/calendar/alarm-notify/alarm-notify.c index eeca88e1b6..2c14196a68 100644 --- a/calendar/alarm-notify/alarm-notify.c +++ b/calendar/alarm-notify/alarm-notify.c @@ -153,15 +153,20 @@ alarm_notify_list_changed_cb (ESourceList *source_list, for (q = sources; q != NULL; q = q->next) { ESource *source = E_SOURCE (q->data); gchar *uri; - const gchar *alarm = e_source_get_property (source, "alarm"); + const gchar *alarm; + + alarm = e_source_get_property (source, "alarm"); if (alarm && (!g_ascii_strcasecmp (alarm, "false") || !g_ascii_strcasecmp (alarm, "never"))) continue; uri = e_source_get_uri (source); - if (!g_hash_table_lookup (an->priv->uri_client_hash[source_type], uri) && - !g_slist_find_custom (an->priv->offline_sources, uri, find_slist_source_uri_cb)) { + if (!g_hash_table_lookup ( + an->priv->uri_client_hash[source_type], uri) && + !g_slist_find_custom ( + an->priv->offline_sources, uri, + find_slist_source_uri_cb)) { debug (("Adding Calendar %s", uri)); alarm_notify_add_calendar (an, source_type, source); } @@ -209,9 +214,13 @@ alarm_notify_load_calendars (AlarmNotify *an, for (q = sources; q != NULL; q = q->next) { ESource *source = E_SOURCE (q->data); gchar *uri; - const gchar *alarm = e_source_get_property (source, "alarm"); + const gchar *alarm; + + alarm = e_source_get_property (source, "alarm"); - if (alarm && (!g_ascii_strcasecmp (alarm, "false") || !g_ascii_strcasecmp (alarm, "never"))) + if (alarm && ( + !g_ascii_strcasecmp (alarm, "false") || + !g_ascii_strcasecmp (alarm, "never"))) continue; uri = e_source_get_uri (source); @@ -421,8 +430,12 @@ client_opened_cb (GObject *source_object, if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_REPOSITORY_OFFLINE)) { if (an->priv->offline_timeout_id) g_source_remove (an->priv->offline_timeout_id); - an->priv->offline_sources = g_slist_append (an->priv->offline_sources, g_object_ref (source)); - an->priv->offline_timeout_id = g_timeout_add_seconds (5 * 60, try_open_offline_timeout_cb, an); + an->priv->offline_sources = g_slist_append ( + an->priv->offline_sources, + g_object_ref (source)); + an->priv->offline_timeout_id = + g_timeout_add_seconds ( + 5 * 60, try_open_offline_timeout_cb, an); } g_clear_error (&error); @@ -520,7 +533,9 @@ alarm_notify_add_calendar (AlarmNotify *an, client_source_type = E_CLIENT_SOURCE_TYPE_LAST; } - g_object_set_data (G_OBJECT (source), "source-type", GUINT_TO_POINTER (source_type)); + g_object_set_data ( + G_OBJECT (source), "source-type", + GUINT_TO_POINTER (source_type)); e_client_utils_open_new ( source, client_source_type, TRUE, NULL, @@ -551,7 +566,8 @@ alarm_notify_remove_calendar (AlarmNotify *an, g_hash_table_remove (priv->uri_client_hash[source_type], str_uri); } - in_offline = g_slist_find_custom (priv->offline_sources, str_uri, find_slist_source_uri_cb); + in_offline = g_slist_find_custom ( + priv->offline_sources, str_uri, find_slist_source_uri_cb); if (in_offline) { ESource *source = in_offline->data; diff --git a/calendar/alarm-notify/alarm-queue.c b/calendar/alarm-notify/alarm-queue.c index f30ce00af7..8cd052952a 100644 --- a/calendar/alarm-notify/alarm-queue.c +++ b/calendar/alarm-notify/alarm-queue.c @@ -1140,10 +1140,12 @@ on_dialog_objs_removed_async (struct _query_msg *msg) if (!id) continue; - if (g_strcmp0 (id->uid, our_id->uid) == 0&& g_strcmp0 (id->rid, our_id->rid) == 0) { + if (g_strcmp0 (id->uid, our_id->uid) == 0 && + g_strcmp0 (id->rid, our_id->rid) == 0) { tray_data->cqa = NULL; tray_data->alarm_id = NULL; - tray_icons_list = g_list_remove (tray_icons_list, tray_data); + tray_icons_list = g_list_remove ( + tray_icons_list, tray_data); tray_data = NULL; } @@ -2073,16 +2075,18 @@ free_client_alarms_cb (gpointer key, if (ca->cal_client) { debug (("Disconnecting Client")); - g_signal_handlers_disconnect_matched (ca->cal_client, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, ca); + g_signal_handlers_disconnect_matched ( + ca->cal_client, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, ca); g_object_unref (ca->cal_client); } if (ca->view) { debug (("Disconnecting Query")); - g_signal_handlers_disconnect_matched (ca->view, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, ca); + g_signal_handlers_disconnect_matched ( + ca->view, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, ca); g_object_unref (ca->view); } diff --git a/calendar/alarm-notify/config-data.c b/calendar/alarm-notify/config-data.c index c8348f89fc..3fcbe598a5 100644 --- a/calendar/alarm-notify/config-data.c +++ b/calendar/alarm-notify/config-data.c @@ -267,9 +267,11 @@ config_data_set_last_notification_time (ECalClient *cal, as_text = g_time_val_to_iso8601 (&tmval); if (as_text) { - e_source_set_property (source, "last-notified", as_text); + e_source_set_property ( + source, "last-notified", as_text); g_free (as_text); - /* pass through, thus the global last notification time is also changed */ + /* pass through, thus the global last + * notification time is also changed */ } } } @@ -342,7 +344,10 @@ config_data_save_blessed_program (const gchar *program) g_ptr_array_add (array, (gpointer) program); g_ptr_array_add (array, NULL); - g_settings_set_strv (calendar_settings, "notify-programs", (const gchar *const *) array->pdata); + + g_settings_set_strv ( + calendar_settings, "notify-programs", + (const gchar *const *) array->pdata); g_strfreev (list); g_ptr_array_free (array, TRUE); diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index e293a6e41b..6b7f5b11e2 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -162,8 +162,9 @@ calendar_config_add_notification_month_scroll_by_week (CalendarConfigChangedFunc { calendar_config_init (); - g_signal_connect (G_OBJECT (config), "changed::month-scroll-by-week", - G_CALLBACK (func), data); + g_signal_connect ( + config, "changed::month-scroll-by-week", + G_CALLBACK (func), data); } /***************************************/ @@ -266,9 +267,13 @@ calendar_config_get_hide_completed_tasks_sexp (gboolean get_completed) * the query sub-expression. */ isodate = isodate_from_time_t (t); if (!get_completed) - sexp = g_strdup_printf ("(not (completed-before? (make-time \"%s\")))", isodate); + sexp = g_strdup_printf ( + "(not (completed-before? " + "(make-time \"%s\")))", isodate); else - sexp = g_strdup_printf ("(completed-before? (make-time \"%s\"))", isodate); + sexp = g_strdup_printf ( + "(completed-before? " + "(make-time \"%s\"))", isodate); g_free (isodate); } } @@ -296,8 +301,8 @@ calendar_config_get_dir_path (void) return path; } -/* contains list of strings, locations, recently used as the second timezone in a day view. - * Free with calendar_config_free_day_second_zones. */ +/* contains list of strings, locations, recently used as the second timezone + * in a day view. Free with calendar_config_free_day_second_zones. */ GSList * calendar_config_get_day_second_zones (void) { @@ -328,7 +333,8 @@ calendar_config_free_day_second_zones (GSList *zones) } } -/* keeps max 'day_second_zones_max' zones, if 'location' is already in a list, then it'll became first there */ +/* keeps max 'day_second_zones_max' zones, if 'location' + * is already in a list, then it'll became first there */ void calendar_config_set_day_second_zone (const gchar *location) { @@ -370,13 +376,17 @@ calendar_config_set_day_second_zone (const gchar *location) g_ptr_array_add (array, l->data); g_ptr_array_add (array, NULL); - g_settings_set_strv (config, "day-second-zones", (const gchar * const *) array->pdata); + g_settings_set_strv ( + config, "day-second-zones", + (const gchar * const *) array->pdata); calendar_config_free_day_second_zones (lst); g_ptr_array_free (array, FALSE); } - g_settings_set_string (config, "day-second-zone", location ? location : ""); + g_settings_set_string ( + config, "day-second-zone", + (location != NULL) ? location : ""); } /* location of the second time zone user has selected. Free with g_free. */ @@ -431,8 +441,9 @@ calendar_config_add_notification_day_second_zone (CalendarConfigChangedFunc func { calendar_config_init (); - g_signal_connect (G_OBJECT (config), "changed::day-second-zone", - G_CALLBACK (func), data); + g_signal_connect ( + config, "changed::day-second-zone", + G_CALLBACK (func), data); } gboolean @@ -446,7 +457,8 @@ calendar_config_get_prefer_meeting (void) shell = e_shell_get_default (); shell_settings = e_shell_get_shell_settings (shell); - prefer_new_item = e_shell_settings_get_string (shell_settings, "cal-prefer-new-item"); + prefer_new_item = e_shell_settings_get_string ( + shell_settings, "cal-prefer-new-item"); prefer_meeting = g_strcmp0 (prefer_new_item, "event-meeting-new") == 0; g_free (prefer_new_item); diff --git a/calendar/gui/calendar-view-factory.c b/calendar/gui/calendar-view-factory.c index 8342475620..0d1908e79b 100644 --- a/calendar/gui/calendar-view-factory.c +++ b/calendar/gui/calendar-view-factory.c @@ -30,13 +30,15 @@ #include "calendar-view-factory.h" #include "calendar-view.h" -/* Private part of the CalendarViewFactory structure */ +#define CALENDAR_VIEW_FACTORY_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), TYPE_CALENDAR_VIEW_FACTORY, CalendarViewFactoryPrivate)) + struct _CalendarViewFactoryPrivate { /* Type of views created by this factory */ GnomeCalendarViewType view_type; }; -static void calendar_view_factory_finalize (GObject *object); static const gchar * calendar_view_factory_get_title (GalViewFactory *factory); static const gchar * @@ -46,53 +48,29 @@ static GalView * calendar_view_factory_new_view (GalViewFactory *factory, const gchar *name); -G_DEFINE_TYPE (CalendarViewFactory, calendar_view_factory, GAL_TYPE_VIEW_FACTORY) +G_DEFINE_TYPE ( + CalendarViewFactory, + calendar_view_factory, + GAL_TYPE_VIEW_FACTORY) -/* Class initialization function for the calendar view factory */ static void calendar_view_factory_class_init (CalendarViewFactoryClass *class) { GalViewFactoryClass *gal_view_factory_class; - GObjectClass *gobject_class; - gal_view_factory_class = (GalViewFactoryClass *) class; - gobject_class = (GObjectClass *) class; + g_type_class_add_private (class, sizeof (CalendarViewFactoryPrivate)); + gal_view_factory_class = GAL_VIEW_FACTORY_CLASS (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; - - gobject_class->finalize = calendar_view_factory_finalize; } -/* Object initialization class for the calendar view factory */ static void calendar_view_factory_init (CalendarViewFactory *cal_view_factory) { - CalendarViewFactoryPrivate *priv; - - priv = g_new0 (CalendarViewFactoryPrivate, 1); - cal_view_factory->priv = priv; -} - -/* Finalize method for the calendar view factory */ -static void -calendar_view_factory_finalize (GObject *object) -{ - CalendarViewFactory *cal_view_factory; - CalendarViewFactoryPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CALENDAR_VIEW_FACTORY (object)); - - cal_view_factory = CALENDAR_VIEW_FACTORY (object); - priv = cal_view_factory->priv; - - g_free (priv); - cal_view_factory->priv = NULL; - - /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (calendar_view_factory_parent_class)->finalize (object); + cal_view_factory->priv = + CALENDAR_VIEW_FACTORY_GET_PRIVATE (cal_view_factory); } /* get_title method for the calendar view factory */ diff --git a/calendar/gui/calendar-view.c b/calendar/gui/calendar-view.c index 6f9f2951f3..344f4c3856 100644 --- a/calendar/gui/calendar-view.c +++ b/calendar/gui/calendar-view.c @@ -28,7 +28,10 @@ #include "calendar-view.h" -/* Private part of the CalendarView structure */ +#define CALENDAR_VIEW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), TYPE_CALENDAR_VIEW, CalendarViewPrivate)) + struct _CalendarViewPrivate { /* Type of the view */ GnomeCalendarViewType view_type; @@ -55,6 +58,8 @@ calendar_view_class_init (CalendarViewClass *class) GalViewClass *gal_view_class; GObjectClass *object_class; + g_type_class_add_private (class, sizeof (CalendarViewPrivate)); + gal_view_class = (GalViewClass *) class; object_class = (GObjectClass *) class; @@ -73,34 +78,18 @@ calendar_view_class_init (CalendarViewClass *class) static void calendar_view_init (CalendarView *cal_view) { - CalendarViewPrivate *priv; - - priv = g_new0 (CalendarViewPrivate, 1); - cal_view->priv = priv; - - priv->title = NULL; + cal_view->priv = CALENDAR_VIEW_GET_PRIVATE (cal_view); } /* Destroy method for the calendar view */ static void calendar_view_finalize (GObject *object) { - CalendarView *cal_view; CalendarViewPrivate *priv; - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CALENDAR_VIEW (object)); - - cal_view = CALENDAR_VIEW (object); - priv = cal_view->priv; - - if (priv->title) { - g_free (priv->title); - priv->title = NULL; - } + priv = CALENDAR_VIEW_GET_PRIVATE (object); - g_free (priv); - cal_view->priv = NULL; + g_free (priv->title); /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (calendar_view_parent_class)->finalize (object); diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c index d18594e826..065d11b9b5 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -927,8 +927,9 @@ setup_select_names (Dialog *dialog) G_CALLBACK (addressbook_clicked_cb), dialog); name_selector_dialog = e_name_selector_peek_dialog (dialog->name_selector); - g_signal_connect (name_selector_dialog, "response", - G_CALLBACK (addressbook_response_cb), dialog); + g_signal_connect ( + name_selector_dialog, "response", + G_CALLBACK (addressbook_response_cb), dialog); return TRUE; } @@ -1208,8 +1209,9 @@ init_widgets (Dialog *dialog) text_buffer, "changed", G_CALLBACK (malarm_description_changed_cb), dialog); - g_signal_connect (dialog->malarm_addresses, "changed", - G_CALLBACK (malarm_addresses_changed_cb), dialog); + g_signal_connect ( + dialog->malarm_addresses, "changed", + G_CALLBACK (malarm_addresses_changed_cb), dialog); } gboolean diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c index 8aa82c29e5..377fd5ca7e 100644 --- a/calendar/gui/dialogs/calendar-setup.c +++ b/calendar/gui/dialogs/calendar-setup.c @@ -206,7 +206,9 @@ eccp_get_source_type (EConfig *ec, gtk_cell_layout_set_attributes ((GtkCellLayout *) type, cell, "text", 0, NULL); gtk_combo_box_set_model ((GtkComboBox *) type, (GtkTreeModel *) store); gtk_combo_box_set_active ((GtkComboBox *) type, active); - g_signal_connect (type, "changed", G_CALLBACK (eccp_type_changed), sdialog); + g_signal_connect ( + type, "changed", + G_CALLBACK (eccp_type_changed), sdialog); gtk_widget_show (type); gtk_table_attach (GTK_TABLE (parent), type, 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0); gtk_label_set_mnemonic_widget (GTK_LABEL (label), type); @@ -318,7 +320,9 @@ eccp_general_offline (EConfig *ec, offline_setting = gtk_check_button_new_with_mnemonic (_("Cop_y memo list contents locally for offline operation")); gtk_widget_show (offline_setting); - g_signal_connect (offline_setting, "toggled", G_CALLBACK (offline_status_changed_cb), sdialog); + g_signal_connect ( + offline_setting, "toggled", + G_CALLBACK (offline_status_changed_cb), sdialog); gtk_table_attach (GTK_TABLE (parent), offline_setting, 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0); } @@ -365,7 +369,9 @@ eccp_notify_reminders (EConfig *ec, gtk_widget_show (reminder_setting); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (reminder_setting), alarm && g_str_equal (alarm, "true")); - g_signal_connect (reminder_setting, "toggled", G_CALLBACK (alarm_status_changed_cb), sdialog); + g_signal_connect ( + reminder_setting, "toggled", + G_CALLBACK (alarm_status_changed_cb), sdialog); gtk_table_attach (GTK_TABLE (parent), reminder_setting, 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0); return reminder_setting; diff --git a/calendar/gui/dialogs/comp-editor-page.c b/calendar/gui/dialogs/comp-editor-page.c index 3d8af28153..2f4e942bf1 100644 --- a/calendar/gui/dialogs/comp-editor-page.c +++ b/calendar/gui/dialogs/comp-editor-page.c @@ -31,6 +31,10 @@ #include "comp-editor.h" #include "comp-editor-page.h" +#define COMP_EDITOR_PAGE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), TYPE_COMP_EDITOR_PAGE, CompEditorPagePrivate)) + struct _CompEditorPagePrivate { CompEditor *editor; /* not referenced */ gboolean updating; @@ -50,6 +54,8 @@ enum { static gpointer parent_class; static guint comp_editor_page_signals[LAST_SIGNAL]; +G_DEFINE_TYPE (CompEditorPage, comp_editor_page, G_TYPE_OBJECT) + static void comp_editor_page_set_property (GObject *object, guint property_id, @@ -58,7 +64,7 @@ comp_editor_page_set_property (GObject *object, { CompEditorPagePrivate *priv; - priv = COMP_EDITOR_PAGE (object)->priv; + priv = COMP_EDITOR_PAGE_GET_PRIVATE (object); switch (property_id) { case PROP_EDITOR: @@ -163,36 +169,7 @@ comp_editor_page_class_init (CompEditorPageClass *class) static void comp_editor_page_init (CompEditorPage *page) { - page->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - page, TYPE_COMP_EDITOR_PAGE, CompEditorPagePrivate); - - page->accel_group = NULL; -} - -GType -comp_editor_page_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (CompEditorPageClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) comp_editor_page_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (CompEditorPage), - 0, /* n_preallocs */ - (GInstanceInitFunc) comp_editor_page_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_OBJECT, "CompEditorPage", &type_info, 0); - } - - return type; + page->priv = COMP_EDITOR_PAGE_GET_PRIVATE (page); } /** diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index e3676e60c2..f148f1e15e 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -64,6 +64,10 @@ #include "e-util/e-alert-dialog.h" #include "e-util/e-ui-manager.h" +#define COMP_EDITOR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), TYPE_COMP_EDITOR, CompEditorPrivate)) + #define d(x) /* Private part of the CompEditor structure */ @@ -1522,7 +1526,7 @@ comp_editor_dispose (GObject *object) { CompEditorPrivate *priv; - priv = COMP_EDITOR (object)->priv; + priv = COMP_EDITOR_GET_PRIVATE (object); if (priv->shell != NULL) { g_object_remove_weak_pointer ( @@ -1602,7 +1606,7 @@ comp_editor_finalize (GObject *object) { CompEditorPrivate *priv; - priv = COMP_EDITOR (object)->priv; + priv = COMP_EDITOR_GET_PRIVATE (object); g_object_unref (priv->calendar_settings); g_free (priv->summary); @@ -1700,7 +1704,7 @@ comp_editor_drag_motion (GtkWidget *widget, CompEditorPrivate *priv; EAttachmentView *view; - priv = COMP_EDITOR (widget)->priv; + priv = COMP_EDITOR_GET_PRIVATE (widget); view = E_ATTACHMENT_VIEW (priv->attachment_view); return e_attachment_view_drag_motion (view, context, x, y, time); @@ -1718,7 +1722,7 @@ comp_editor_drag_data_received (GtkWidget *widget, CompEditorPrivate *priv; EAttachmentView *view; - priv = COMP_EDITOR (widget)->priv; + priv = COMP_EDITOR_GET_PRIVATE (widget); view = E_ATTACHMENT_VIEW (priv->attachment_view); /* Forward the data to the attachment view. Note that calling @@ -1936,8 +1940,7 @@ comp_editor_init (CompEditor *editor) express_mode = e_shell_get_express_mode (shell); meego_mode = e_shell_get_meego_mode (shell); - editor->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE ( - editor, TYPE_COMP_EDITOR, CompEditorPrivate); + editor->priv = priv = COMP_EDITOR_GET_PRIVATE (editor); g_object_weak_ref ( G_OBJECT (editor), (GWeakNotify) diff --git a/calendar/gui/dialogs/delete-comp.c b/calendar/gui/dialogs/delete-comp.c index 87330ed0dd..4ad1bf7451 100644 --- a/calendar/gui/dialogs/delete-comp.c +++ b/calendar/gui/dialogs/delete-comp.c @@ -228,7 +228,9 @@ prompt_retract_dialog (ECalComponent *comp, gtk_label_set_mnemonic_widget ((GtkLabel *) label, entry); gtk_container_add (GTK_CONTAINER (frame), sw); - g_signal_connect ((GtkToggleButton *)cb, "toggled", G_CALLBACK (cb_toggled_cb), entry); + g_signal_connect ( + cb, "toggled", + G_CALLBACK (cb_toggled_cb), entry); gtk_widget_show_all ((GtkWidget *) dialog); diff --git a/calendar/gui/dialogs/e-delegate-dialog.c b/calendar/gui/dialogs/e-delegate-dialog.c index fc7ae7d121..9b9d7b4bbd 100644 --- a/calendar/gui/dialogs/e-delegate-dialog.c +++ b/calendar/gui/dialogs/e-delegate-dialog.c @@ -34,6 +34,10 @@ #include "e-util/e-util-private.h" #include "e-delegate-dialog.h" +#define E_DELEGATE_DIALOG_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_DELEGATE_DIALOG, EDelegateDialogPrivate)) + struct _EDelegateDialogPrivate { gchar *name; gchar *address; @@ -51,68 +55,50 @@ struct _EDelegateDialogPrivate { static const gchar *section_name = "Delegate To"; -static void e_delegate_dialog_finalize (GObject *object); - static gboolean get_widgets (EDelegateDialog *edd); static void addressbook_clicked_cb (GtkWidget *widget, gpointer data); static void addressbook_response_cb (GtkWidget *widget, gint response, gpointer data); G_DEFINE_TYPE (EDelegateDialog, e_delegate_dialog, G_TYPE_OBJECT) -/* Class initialization function for the event editor */ -static void -e_delegate_dialog_class_init (EDelegateDialogClass *class) -{ - GObjectClass *gobject_class; - - gobject_class = (GObjectClass *) class; - - gobject_class->finalize = e_delegate_dialog_finalize; -} - -/* Object initialization function for the event editor */ -static void -e_delegate_dialog_init (EDelegateDialog *edd) -{ - EDelegateDialogPrivate *priv; - - priv = g_new0 (EDelegateDialogPrivate, 1); - edd->priv = priv; - - priv->address = NULL; -} - -/* Destroy handler for the event editor */ static void e_delegate_dialog_finalize (GObject *object) { - EDelegateDialog *edd; EDelegateDialogPrivate *priv; GtkWidget *dialog; - g_return_if_fail (object != NULL); - g_return_if_fail (E_IS_DELEGATE_DIALOG (object)); - - edd = E_DELEGATE_DIALOG (object); - priv = edd->priv; + priv = E_DELEGATE_DIALOG_GET_PRIVATE (object); e_name_selector_cancel_loading (priv->name_selector); g_object_unref (priv->name_selector); /* Destroy the actual dialog. */ - dialog = e_delegate_dialog_get_toplevel (edd); + dialog = e_delegate_dialog_get_toplevel (E_DELEGATE_DIALOG (object)); gtk_widget_destroy (dialog); g_free (priv->address); - priv->address = NULL; - - g_free (priv); - edd->priv = NULL; /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (e_delegate_dialog_parent_class)->finalize (object); } +static void +e_delegate_dialog_class_init (EDelegateDialogClass *class) +{ + GObjectClass *object_class; + + g_type_class_add_private (class, sizeof (EDelegateDialogPrivate)); + + object_class = G_OBJECT_CLASS (class); + object_class->finalize = e_delegate_dialog_finalize; +} + +static void +e_delegate_dialog_init (EDelegateDialog *edd) +{ + edd->priv = E_DELEGATE_DIALOG_GET_PRIVATE (edd); +} + EDelegateDialog * e_delegate_dialog_construct (EDelegateDialog *edd, const gchar *name, @@ -158,11 +144,14 @@ e_delegate_dialog_construct (EDelegateDialog *edd, e_destination_store_append_destination (destination_store, dest); g_object_unref (dest); - g_signal_connect ((priv->addressbook), "clicked", - G_CALLBACK (addressbook_clicked_cb), edd); + g_signal_connect ( + priv->addressbook, "clicked", + G_CALLBACK (addressbook_clicked_cb), edd); name_selector_dialog = e_name_selector_peek_dialog (priv->name_selector); - g_signal_connect (name_selector_dialog, "response", G_CALLBACK (addressbook_response_cb), edd); + g_signal_connect ( + name_selector_dialog, "response", + G_CALLBACK (addressbook_response_cb), edd); return edd; @@ -242,7 +231,6 @@ e_delegate_dialog_get_delegate (EDelegateDialog *edd) GList *destinations; EDestination *destination; - g_return_val_if_fail (edd != NULL, NULL); g_return_val_if_fail (E_IS_DELEGATE_DIALOG (edd), NULL); priv = edd->priv; @@ -273,7 +261,6 @@ e_delegate_dialog_get_delegate_name (EDelegateDialog *edd) GList *destinations; EDestination *destination; - g_return_val_if_fail (edd != NULL, NULL); g_return_val_if_fail (E_IS_DELEGATE_DIALOG (edd), NULL); priv = edd->priv; @@ -298,13 +285,8 @@ e_delegate_dialog_get_delegate_name (EDelegateDialog *edd) GtkWidget * e_delegate_dialog_get_toplevel (EDelegateDialog *edd) { - EDelegateDialogPrivate *priv; - - g_return_val_if_fail (edd != NULL, NULL); g_return_val_if_fail (E_IS_DELEGATE_DIALOG (edd), NULL); - priv = edd->priv; - - return priv->app; + return edd->priv->app; } diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 79e951244e..7d679e6bbf 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -43,6 +43,10 @@ #include "cancel-comp.h" #include "event-editor.h" +#define EVENT_EDITOR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), TYPE_EVENT_EDITOR, EventEditorPrivate)) + struct _EventEditorPrivate { EventPage *event_page; RecurrencePage *recur_page; @@ -117,7 +121,7 @@ create_schedule_page (CompEditor *editor) CompEditorPage *page; GtkWidget *content_area; - priv = EVENT_EDITOR (editor)->priv; + priv = EVENT_EDITOR_GET_PRIVATE (editor); priv->sched_window = gtk_dialog_new_with_buttons ( _("Free/Busy"), GTK_WINDOW (editor), GTK_DIALOG_DESTROY_WITH_PARENT, @@ -296,7 +300,7 @@ event_editor_constructor (GType type, type, n_construct_properties, construct_properties); editor = COMP_EDITOR (object); - priv = EVENT_EDITOR (object)->priv; + priv = EVENT_EDITOR_GET_PRIVATE (object); shell = comp_editor_get_shell (editor); @@ -394,7 +398,7 @@ event_editor_dispose (GObject *object) { EventEditorPrivate *priv; - priv = EVENT_EDITOR (object)->priv; + priv = EVENT_EDITOR_GET_PRIVATE (object); if (priv->event_page) { g_object_unref (priv->event_page); @@ -427,7 +431,7 @@ event_editor_constructed (GObject *object) { EventEditorPrivate *priv; - priv = EVENT_EDITOR (object)->priv; + priv = EVENT_EDITOR_GET_PRIVATE (object); g_object_bind_property ( object, "client", @@ -444,7 +448,7 @@ event_editor_show_categories (CompEditor *editor, { EventEditorPrivate *priv; - priv = EVENT_EDITOR (editor)->priv; + priv = EVENT_EDITOR_GET_PRIVATE (editor); event_page_set_show_categories (priv->event_page, visible); } @@ -455,7 +459,7 @@ event_editor_show_role (CompEditor *editor, { EventEditorPrivate *priv; - priv = EVENT_EDITOR (editor)->priv; + priv = EVENT_EDITOR_GET_PRIVATE (editor); event_page_set_view_role (priv->event_page, visible); } @@ -466,7 +470,7 @@ event_editor_show_rsvp (CompEditor *editor, { EventEditorPrivate *priv; - priv = EVENT_EDITOR (editor)->priv; + priv = EVENT_EDITOR_GET_PRIVATE (editor); event_page_set_view_rsvp (priv->event_page, visible); } @@ -477,7 +481,7 @@ event_editor_show_status (CompEditor *editor, { EventEditorPrivate *priv; - priv = EVENT_EDITOR (editor)->priv; + priv = EVENT_EDITOR_GET_PRIVATE (editor); event_page_set_view_status (priv->event_page, visible); } @@ -488,7 +492,7 @@ event_editor_show_time_zone (CompEditor *editor, { EventEditorPrivate *priv; - priv = EVENT_EDITOR (editor)->priv; + priv = EVENT_EDITOR_GET_PRIVATE (editor); event_page_set_show_timezone (priv->event_page, visible); } @@ -499,7 +503,7 @@ event_editor_show_type (CompEditor *editor, { EventEditorPrivate *priv; - priv = EVENT_EDITOR (editor)->priv; + priv = EVENT_EDITOR_GET_PRIVATE (editor); event_page_set_view_type (priv->event_page, visible); } @@ -539,8 +543,7 @@ event_editor_init (EventEditor *ee) const gchar *id; GError *error = NULL; - ee->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - ee, TYPE_EVENT_EDITOR, EventEditorPrivate); + ee->priv = EVENT_EDITOR_GET_PRIVATE (ee); ee->priv->model = E_MEETING_STORE (e_meeting_store_new ()); ee->priv->meeting_shown = TRUE; ee->priv->updating = FALSE; @@ -607,7 +610,7 @@ event_editor_edit_comp (CompEditor *editor, ECalClient *client; GSList *attendees = NULL; - priv = EVENT_EDITOR (editor)->priv; + priv = EVENT_EDITOR_GET_PRIVATE (editor); priv->updating = TRUE; delegate = (comp_editor_get_flags (COMP_EDITOR (editor)) & COMP_EDITOR_DELEGATE); @@ -717,7 +720,7 @@ event_editor_send_comp (CompEditor *editor, EventEditorPrivate *priv; ECalComponent *comp = NULL; - priv = EVENT_EDITOR (editor)->priv; + priv = EVENT_EDITOR_GET_PRIVATE (editor); /* Don't cancel more than once or when just publishing */ if (method == E_CAL_COMPONENT_METHOD_PUBLISH || diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index a5c0ac6355..086f3ef494 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -68,6 +68,10 @@ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), TYPE_EVENT_PAGE, EventPagePrivate)) +#define EVENT_PAGE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), TYPE_EVENT_PAGE, EventPagePrivate)) + enum { ALARM_NONE, ALARM_15_MINUTES, @@ -3195,8 +3199,9 @@ init_widgets (EventPage *epage) gtk_widget_hide (priv->info_hbox); /* Summary */ - g_signal_connect ((priv->summary), "changed", - G_CALLBACK (summary_changed_cb), epage); + g_signal_connect ( + priv->summary, "changed", + G_CALLBACK (summary_changed_cb), epage); /* Description */ text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->description)); @@ -3206,18 +3211,23 @@ init_widgets (EventPage *epage) e_buffer_tagger_connect (GTK_TEXT_VIEW (priv->description)); /* Start and end times */ - g_signal_connect (priv->start_time, "changed", - G_CALLBACK (start_date_changed_cb), epage); - g_signal_connect (priv->end_time, "changed", - G_CALLBACK (end_date_changed_cb), epage); + g_signal_connect ( + priv->start_time, "changed", + G_CALLBACK (start_date_changed_cb), epage); + g_signal_connect ( + priv->end_time, "changed", + G_CALLBACK (end_date_changed_cb), epage); /* Categories */ - g_signal_connect ((priv->categories_btn), "clicked", - G_CALLBACK (categories_clicked_cb), epage); + g_signal_connect ( + priv->categories_btn, "clicked", + G_CALLBACK (categories_clicked_cb), epage); /* Source selector */ - g_signal_connect ((priv->source_selector), "changed", - G_CALLBACK (source_changed_cb), epage); + g_signal_connect ( + priv->source_selector, "changed", + G_CALLBACK (source_changed_cb), epage); + /* Alarms */ priv->alarm_list_store = e_alarm_list_new (); g_signal_connect_swapped ( @@ -3231,8 +3241,9 @@ init_widgets (EventPage *epage) G_CALLBACK (comp_editor_page_changed), epage); /* Timezone changed */ - g_signal_connect ((priv->start_timezone), "changed", - G_CALLBACK (start_timezone_changed_cb), epage); + g_signal_connect ( + priv->start_timezone, "changed", + G_CALLBACK (start_timezone_changed_cb), epage); e_meeting_list_view_column_set_visible ( priv->list_view, E_MEETING_STORE_ATTENDEE_COL, TRUE); @@ -3301,7 +3312,9 @@ init_widgets (EventPage *epage) gtk_window_set_modal (GTK_WINDOW (priv->alarm_dialog), TRUE); /* Meeting List View */ - g_signal_connect (priv->list_view, "attendee_added", G_CALLBACK (attendee_added_cb), epage); + g_signal_connect ( + priv->list_view, "attendee_added", + G_CALLBACK (attendee_added_cb), epage); gtk_widget_show (GTK_WIDGET (priv->list_view)); @@ -3319,13 +3332,19 @@ init_widgets (EventPage *epage) gtk_combo_box_set_active (GTK_COMBO_BOX (priv->end_time_combo), 1); gtk_widget_hide (priv->time_hour); gtk_widget_show (priv->end_time); - g_signal_connect (priv->end_time_combo, "changed", G_CALLBACK (time_sel_changed), epage); + g_signal_connect ( + priv->end_time_combo, "changed", + G_CALLBACK (time_sel_changed), epage); update_end_time_combo ( epage); /* Hour and Minute selector */ gtk_spin_button_set_range ( (GtkSpinButton *) priv->hour_selector, 0, G_MAXINT); - g_signal_connect (priv->hour_selector, "value-changed", G_CALLBACK (hour_sel_changed), epage); - g_signal_connect (priv->minute_selector, "value-changed", G_CALLBACK (minute_sel_changed), epage); + g_signal_connect ( + priv->hour_selector, "value-changed", + G_CALLBACK (hour_sel_changed), epage); + g_signal_connect ( + priv->minute_selector, "value-changed", + G_CALLBACK (minute_sel_changed), epage); /* Add the user defined time if necessary */ priv->alarm_units = diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c index e7dd1e7f93..ae0d351618 100644 --- a/calendar/gui/dialogs/memo-editor.c +++ b/calendar/gui/dialogs/memo-editor.c @@ -38,6 +38,10 @@ #include "cancel-comp.h" #include "memo-editor.h" +#define MEMO_EDITOR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), TYPE_MEMO_EDITOR, MemoEditorPrivate)) + struct _MemoEditorPrivate { MemoPage *memo_page; @@ -69,7 +73,7 @@ memo_editor_show_categories (CompEditor *editor, { MemoEditorPrivate *priv; - priv = MEMO_EDITOR (editor)->priv; + priv = MEMO_EDITOR_GET_PRIVATE (editor); memo_page_set_show_categories (priv->memo_page, visible); } @@ -79,7 +83,7 @@ memo_editor_dispose (GObject *object) { MemoEditorPrivate *priv; - priv = MEMO_EDITOR (object)->priv; + priv = MEMO_EDITOR_GET_PRIVATE (object); if (priv->memo_page) { g_object_unref (priv->memo_page); @@ -96,7 +100,7 @@ memo_editor_constructed (GObject *object) MemoEditorPrivate *priv; CompEditor *editor; - priv = MEMO_EDITOR (object)->priv; + priv = MEMO_EDITOR_GET_PRIVATE (object); editor = COMP_EDITOR (object); priv->memo_page = memo_page_new (editor); @@ -136,8 +140,7 @@ memo_editor_init (MemoEditor *me) const gchar *id; GError *error = NULL; - me->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - me, TYPE_MEMO_EDITOR, MemoEditorPrivate); + me->priv = MEMO_EDITOR_GET_PRIVATE (me); me->priv->updating = FALSE; ui_manager = comp_editor_get_ui_manager (editor); diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index bf60445001..5348a19328 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -57,6 +57,10 @@ #include "e-send-options-utils.h" #include "memo-page.h" +#define MEMO_PAGE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), TYPE_MEMO_PAGE, MemoPagePrivate)) + /* Private part of the MemoPage structure */ struct _MemoPagePrivate { GtkBuilder *builder; @@ -190,7 +194,7 @@ memo_page_dispose (GObject *object) { MemoPagePrivate *priv; - priv = MEMO_PAGE (object)->priv; + priv = MEMO_PAGE_GET_PRIVATE (object); if (priv->open_cancellable) { g_cancellable_cancel (priv->open_cancellable); @@ -213,7 +217,7 @@ memo_page_finalize (GObject *object) { MemoPagePrivate *priv; - priv = MEMO_PAGE (object)->priv; + priv = MEMO_PAGE_GET_PRIVATE (object); if (priv->name_selector) { e_name_selector_cancel_loading (priv->name_selector); @@ -240,7 +244,7 @@ memo_page_finalize (GObject *object) static GtkWidget * memo_page_get_widget (CompEditorPage *page) { - MemoPagePrivate *priv = MEMO_PAGE (page)->priv; + MemoPagePrivate *priv = MEMO_PAGE_GET_PRIVATE (page); return priv->main; } @@ -248,7 +252,7 @@ memo_page_get_widget (CompEditorPage *page) static void memo_page_focus_main_widget (CompEditorPage *page) { - MemoPagePrivate *priv = MEMO_PAGE (page)->priv; + MemoPagePrivate *priv = MEMO_PAGE_GET_PRIVATE (page); gtk_widget_grab_focus (priv->summary_entry); } @@ -398,9 +402,7 @@ memo_page_class_init (MemoPageClass *class) static void memo_page_init (MemoPage *mpage) { - mpage->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - mpage, TYPE_MEMO_PAGE, MemoPagePrivate); - mpage->priv->open_cancellable = NULL; + mpage->priv = MEMO_PAGE_GET_PRIVATE (mpage); } /* returns whether changed info text */ diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 54dee77f44..5658cd0fb3 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -46,6 +46,10 @@ #include "e-util/e-dialog-widgets.h" #include "e-util/e-util-private.h" +#define RECURRENCE_PAGE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), TYPE_RECURRENCE_PAGE, RecurrencePagePrivate)) + enum month_num_options { MONTH_NUM_FIRST, MONTH_NUM_SECOND, @@ -297,7 +301,7 @@ recurrence_page_dispose (GObject *object) { RecurrencePagePrivate *priv; - priv = RECURRENCE_PAGE (object)->priv; + priv = RECURRENCE_PAGE_GET_PRIVATE (object); if (priv->main != NULL) { g_object_unref (priv->main); @@ -339,7 +343,7 @@ recurrence_page_finalize (GObject *object) { RecurrencePagePrivate *priv; - priv = RECURRENCE_PAGE (object)->priv; + priv = RECURRENCE_PAGE_GET_PRIVATE (object); g_signal_handlers_disconnect_matched ( E_CALENDAR (priv->preview_calendar)->calitem, @@ -383,8 +387,7 @@ recurrence_page_class_init (RecurrencePageClass *class) static void recurrence_page_init (RecurrencePage *rpage) { - rpage->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - rpage, TYPE_RECURRENCE_PAGE, RecurrencePagePrivate); + rpage->priv = RECURRENCE_PAGE_GET_PRIVATE (rpage); rpage->priv->cancellable = g_cancellable_new (); } @@ -395,7 +398,7 @@ recurrence_page_get_widget (CompEditorPage *page) { RecurrencePagePrivate *priv; - priv = RECURRENCE_PAGE (page)->priv; + priv = RECURRENCE_PAGE_GET_PRIVATE (page); return priv->main; } @@ -406,7 +409,7 @@ recurrence_page_focus_main_widget (CompEditorPage *page) { RecurrencePagePrivate *priv; - priv = RECURRENCE_PAGE (page)->priv; + priv = RECURRENCE_PAGE_GET_PRIVATE (page); gtk_widget_grab_focus (priv->recurs); } @@ -1343,8 +1346,12 @@ make_monthly_special (RecurrencePage *rpage) adj, "value-changed", G_CALLBACK (comp_editor_page_changed), rpage); - g_signal_connect (priv->month_num_combo, "changed", G_CALLBACK (month_num_combo_changed_cb), rpage); - g_signal_connect (priv->month_day_combo, "changed", G_CALLBACK (month_day_combo_changed_cb), rpage); + g_signal_connect ( + priv->month_num_combo, "changed", + G_CALLBACK (month_num_combo_changed_cb), rpage); + g_signal_connect ( + priv->month_day_combo, "changed", + G_CALLBACK (month_day_combo_changed_cb), rpage); } /* Changes the recurrence-special widget to match the interval units. @@ -2363,9 +2370,9 @@ init_widgets (RecurrencePage *rpage) priv->preview_calendar = e_calendar_new (); ecal = E_CALENDAR (priv->preview_calendar); - g_signal_connect ((ecal->calitem), "date_range_changed", - G_CALLBACK (preview_date_range_changed_cb), - rpage); + g_signal_connect ( + ecal->calitem, "date_range_changed", + G_CALLBACK (preview_date_range_changed_cb), rpage); e_calendar_item_set_max_days_sel (ecal->calitem, 0); gtk_container_add (GTK_CONTAINER (priv->preview_bin), priv->preview_calendar); @@ -2379,7 +2386,9 @@ init_widgets (RecurrencePage *rpage) /* Recurrence types */ - g_signal_connect (priv->recurs, "toggled", G_CALLBACK (type_toggled_cb), rpage); + g_signal_connect ( + priv->recurs, "toggled", + G_CALLBACK (type_toggled_cb), rpage); /* Recurrence interval */ @@ -2408,12 +2417,15 @@ init_widgets (RecurrencePage *rpage) /* Exception buttons */ - g_signal_connect ((priv->exception_add), "clicked", - G_CALLBACK (exception_add_cb), rpage); - g_signal_connect ((priv->exception_modify), "clicked", - G_CALLBACK (exception_modify_cb), rpage); - g_signal_connect ((priv->exception_delete), "clicked", - G_CALLBACK (exception_delete_cb), rpage); + g_signal_connect ( + priv->exception_add, "clicked", + G_CALLBACK (exception_add_cb), rpage); + g_signal_connect ( + priv->exception_modify, "clicked", + G_CALLBACK (exception_modify_cb), rpage); + g_signal_connect ( + priv->exception_delete, "clicked", + G_CALLBACK (exception_delete_cb), rpage); gtk_widget_set_sensitive (priv->exception_modify, FALSE); gtk_widget_set_sensitive (priv->exception_delete, FALSE); @@ -2438,8 +2450,10 @@ init_widgets (RecurrencePage *rpage) gtk_tree_view_column_add_attribute (column, cell_renderer, "text", E_DATE_TIME_LIST_COLUMN_DESCRIPTION); gtk_tree_view_append_column (GTK_TREE_VIEW (priv->exception_list), column); - g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->exception_list)), "changed", - G_CALLBACK (exception_selection_changed_cb), rpage); + g_signal_connect ( + gtk_tree_view_get_selection ( + GTK_TREE_VIEW (priv->exception_list)), "changed", + G_CALLBACK (exception_selection_changed_cb), rpage); } /** diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c index b164f87648..3fcf1749cc 100644 --- a/calendar/gui/dialogs/schedule-page.c +++ b/calendar/gui/dialogs/schedule-page.c @@ -39,6 +39,10 @@ #include "e-delegate-dialog.h" #include "schedule-page.h" +#define SCHEDULE_PAGE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), TYPE_SCHEDULE_PAGE, SchedulePagePrivate)) + /* Private part of the SchedulePage structure */ struct _SchedulePagePrivate { GtkBuilder *builder; @@ -168,7 +172,7 @@ schedule_page_dispose (GObject *object) { SchedulePagePrivate *priv; - priv = SCHEDULE_PAGE (object)->priv; + priv = SCHEDULE_PAGE_GET_PRIVATE (object); if (priv->main != NULL) { g_object_unref (priv->main); @@ -283,8 +287,7 @@ schedule_page_class_init (SchedulePageClass *class) static void schedule_page_init (SchedulePage *spage) { - spage->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - spage, TYPE_SCHEDULE_PAGE, SchedulePagePrivate); + spage->priv = SCHEDULE_PAGE_GET_PRIVATE (spage); } /* Gets the widgets from the XML file and returns if they are all available. */ @@ -328,7 +331,9 @@ init_widgets (SchedulePage *spage) priv = spage->priv; - g_signal_connect (priv->sel, "changed", G_CALLBACK (times_changed_cb), spage); + g_signal_connect ( + priv->sel, "changed", + G_CALLBACK (times_changed_cb), spage); return TRUE; } diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index 919a9c0550..c31fef6e23 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -41,6 +41,10 @@ #include "e-util/e-dialog-widgets.h" #include "e-util/e-util-private.h" +#define TASK_DETAILS_PAGE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), TYPE_TASK_DETAILS_PAGE, TaskDetailsPagePrivate)) + struct _TaskDetailsPagePrivate { GtkBuilder *builder; @@ -172,7 +176,7 @@ task_details_page_dispose (GObject *object) { TaskDetailsPagePrivate *priv; - priv = TASK_DETAILS_PAGE (object)->priv; + priv = TASK_DETAILS_PAGE_GET_PRIVATE (object); if (priv->main != NULL) { g_object_unref (priv->main); @@ -436,8 +440,7 @@ task_details_page_class_init (TaskDetailsPageClass *class) static void task_details_page_init (TaskDetailsPage *tdpage) { - tdpage->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - tdpage, TYPE_TASK_DETAILS_PAGE, TaskDetailsPagePrivate); + tdpage->priv = TASK_DETAILS_PAGE_GET_PRIVATE (tdpage); } /* Gets the widgets from the XML file and returns if they are all available. */ diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index e1d90f4d5a..927913c898 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -335,8 +335,10 @@ task_editor_init (TaskEditor *te) GTK_DIALOG (te->priv->task_details_window)); gtk_container_add ( GTK_CONTAINER (content_area), - comp_editor_page_get_widget ((CompEditorPage *) te->priv->task_details_page)); - gtk_widget_show_all (gtk_bin_get_child (GTK_BIN (te->priv->task_details_window))); + comp_editor_page_get_widget ( + (CompEditorPage *) te->priv->task_details_page)); + gtk_widget_show_all ( + gtk_bin_get_child (GTK_BIN (te->priv->task_details_window))); comp_editor_append_page ( editor, COMP_EDITOR_PAGE (te->priv->task_details_page), NULL, FALSE); @@ -430,13 +432,15 @@ task_editor_edit_comp (CompEditor *editor, ia = e_meeting_store_find_self (priv->model, &row); if (ia != NULL) - e_meeting_attendee_set_edit_level (ia, E_MEETING_ATTENDEE_EDIT_STATUS); + e_meeting_attendee_set_edit_level ( + ia, E_MEETING_ATTENDEE_EDIT_STATUS); } else if (e_cal_client_check_organizer_must_attend (client)) { EMeetingAttendee *ia; ia = e_meeting_store_find_attendee (priv->model, organizer.value, &row); if (ia != NULL) - e_meeting_attendee_set_edit_level (ia, E_MEETING_ATTENDEE_EDIT_NONE); + e_meeting_attendee_set_edit_level ( + ia, E_MEETING_ATTENDEE_EDIT_NONE); } comp_editor_set_group_item (editor, TRUE); diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 2033a46ff2..71a494541a 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -1925,8 +1925,9 @@ init_widgets (TaskPage *tpage) gtk_widget_hide (priv->info_hbox); /* Summary */ - g_signal_connect ((priv->summary), "changed", - G_CALLBACK (summary_changed_cb), tpage); + g_signal_connect ( + priv->summary, "changed", + G_CALLBACK (summary_changed_cb), tpage); /* Description */ text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->description)); @@ -1936,20 +1937,27 @@ init_widgets (TaskPage *tpage) e_buffer_tagger_connect (GTK_TEXT_VIEW (priv->description)); /* Dates */ - g_signal_connect ((priv->start_date), "changed", - G_CALLBACK (date_changed_cb), tpage); - g_signal_connect ((priv->due_date), "changed", - G_CALLBACK (date_changed_cb), tpage); + g_signal_connect ( + priv->start_date, "changed", + G_CALLBACK (date_changed_cb), tpage); + g_signal_connect ( + priv->due_date, "changed", + G_CALLBACK (date_changed_cb), tpage); /* time zone changed */ - g_signal_connect (priv->timezone, "changed", G_CALLBACK(timezone_changed_cb), tpage); + g_signal_connect ( + priv->timezone, "changed", + G_CALLBACK (timezone_changed_cb), tpage); /* Categories button */ - g_signal_connect ((priv->categories_btn), "clicked", - G_CALLBACK (categories_clicked_cb), tpage); + g_signal_connect ( + priv->categories_btn, "clicked", + G_CALLBACK (categories_clicked_cb), tpage); /* Source selector */ - g_signal_connect (priv->source_selector, "changed", G_CALLBACK (source_changed_cb), tpage); + g_signal_connect ( + priv->source_selector, "changed", + G_CALLBACK (source_changed_cb), tpage); /* Connect the default signal handler to use to make sure the "changed" * field gets set whenever a field is changed. */ @@ -1988,19 +1996,29 @@ init_widgets (TaskPage *tpage) G_CALLBACK (list_key_press), tpage); /* Add attendee button */ - g_signal_connect (priv->add, "clicked", G_CALLBACK (add_clicked_cb), tpage); + g_signal_connect ( + priv->add, "clicked", + G_CALLBACK (add_clicked_cb), tpage); /* Edit attendee button */ - g_signal_connect (priv->edit, "clicked", G_CALLBACK (edit_clicked_cb), tpage); + g_signal_connect ( + priv->edit, "clicked", + G_CALLBACK (edit_clicked_cb), tpage); /* Remove attendee button */ - g_signal_connect (priv->remove, "clicked", G_CALLBACK (remove_clicked_cb), tpage); + g_signal_connect ( + priv->remove, "clicked", + G_CALLBACK (remove_clicked_cb), tpage); /* Contacts button */ - g_signal_connect (priv->invite, "clicked", G_CALLBACK (invite_cb), tpage); + g_signal_connect ( + priv->invite, "clicked", + G_CALLBACK (invite_cb), tpage); /* Meeting List View */ - g_signal_connect (priv->list_view, "attendee_added", G_CALLBACK (attendee_added_cb), tpage); + g_signal_connect ( + priv->list_view, "attendee_added", + G_CALLBACK (attendee_added_cb), tpage); /* Set the default timezone, so the timezone entry may be hidden. */ zone = comp_editor_get_timezone (editor); diff --git a/calendar/gui/e-alarm-list.c b/calendar/gui/e-alarm-list.c index 35c3484c13..67511165cf 100644 --- a/calendar/gui/e-alarm-list.c +++ b/calendar/gui/e-alarm-list.c @@ -40,8 +40,6 @@ static GType column_types[E_ALARM_LIST_NUM_COLUMNS]; -static void e_alarm_list_init (EAlarmList *file_list); -static void e_alarm_list_class_init (EAlarmListClass *class); static void e_alarm_list_tree_model_init (GtkTreeModelIface *iface); static GtkTreeModelFlags e_alarm_list_get_flags (GtkTreeModel *tree_model); static gint e_alarm_list_get_n_columns (GtkTreeModel *tree_model); @@ -73,50 +71,18 @@ static gboolean e_alarm_list_iter_parent (GtkTreeModel *tree_model GtkTreeIter *iter, GtkTreeIter *child); -static GObjectClass *parent_class = NULL; - -GType -e_alarm_list_get_type (void) -{ - static GType alarm_list_type = 0; - - if (!alarm_list_type) { - static const GTypeInfo alarm_list_info = - { - sizeof (EAlarmListClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_alarm_list_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EAlarmList), - 0, - (GInstanceInitFunc) e_alarm_list_init, - }; - - static const GInterfaceInfo tree_model_info = - { - (GInterfaceInitFunc) e_alarm_list_tree_model_init, - NULL, - NULL - }; - - column_types[E_ALARM_LIST_COLUMN_DESCRIPTION] = G_TYPE_STRING; - - alarm_list_type = g_type_register_static (G_TYPE_OBJECT, "EAlarmList", - &alarm_list_info, 0); - g_type_add_interface_static (alarm_list_type, - GTK_TYPE_TREE_MODEL, - &tree_model_info); - } - - return alarm_list_type; -} +G_DEFINE_TYPE_WITH_CODE ( + EAlarmList, + e_alarm_list, + G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE ( + GTK_TYPE_TREE_MODEL, + e_alarm_list_tree_model_init)) static void e_alarm_list_class_init (EAlarmListClass *class) { - parent_class = g_type_class_peek_parent (class); + column_types[E_ALARM_LIST_COLUMN_DESCRIPTION] = G_TYPE_STRING; } static void diff --git a/calendar/gui/e-cal-component-preview.c b/calendar/gui/e-cal-component-preview.c index ec4f817042..ce8cdeee2d 100644 --- a/calendar/gui/e-cal-component-preview.c +++ b/calendar/gui/e-cal-component-preview.c @@ -38,6 +38,15 @@ #include <e-util/e-util.h> #include <e-util/e-categories-config.h> +#define E_CAL_COMPONENT_PREVIEW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CAL_COMPONENT_PREVIEW, ECalComponentPreviewPrivate)) + +G_DEFINE_TYPE ( + ECalComponentPreview, + e_cal_component_preview, + E_TYPE_WEB_VIEW) + struct _ECalComponentPreviewPrivate { /* information about currently showing component in a preview; * if it didn't change then the preview is not updated */ @@ -47,8 +56,6 @@ struct _ECalComponentPreviewPrivate { gint comp_sequence; }; -static gpointer parent_class; - static void clear_comp_info (ECalComponentPreview *preview) { @@ -388,15 +395,14 @@ cal_component_preview_finalize (GObject *object) clear_comp_info (E_CAL_COMPONENT_PREVIEW (object)); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_cal_component_preview_parent_class)->finalize (object); } static void -cal_component_preview_class_init (ECalComponentPreviewClass *class) +e_cal_component_preview_class_init (ECalComponentPreviewClass *class) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ECalComponentPreviewPrivate)); object_class = G_OBJECT_CLASS (class); @@ -404,38 +410,9 @@ cal_component_preview_class_init (ECalComponentPreviewClass *class) } static void -cal_component_preview_init (ECalComponentPreview *preview) -{ - preview->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - preview, E_TYPE_CAL_COMPONENT_PREVIEW, - ECalComponentPreviewPrivate); -} - -GType -e_cal_component_preview_get_type (void) +e_cal_component_preview_init (ECalComponentPreview *preview) { - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (ECalComponentPreviewClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) cal_component_preview_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ECalComponentPreview), - 0, /* n_preallocs */ - (GInstanceInitFunc) cal_component_preview_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_WEB_VIEW, "ECalComponentPreview", - &type_info, 0); - } - - return type; + preview->priv = E_CAL_COMPONENT_PREVIEW_GET_PRIVATE (preview); } GtkWidget * diff --git a/calendar/gui/e-cal-config.c b/calendar/gui/e-cal-config.c index 99a2487f98..08f0aedd89 100644 --- a/calendar/gui/e-cal-config.c +++ b/calendar/gui/e-cal-config.c @@ -27,24 +27,23 @@ #include <gtk/gtk.h> #include "e-cal-config.h" +#define E_CAL_CONFIG_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CAL_CONFIG, ECalConfigPrivate)) + static GObjectClass *ecp_parent_class; struct _ECalConfigPrivate { guint source_changed_id; }; -static void -ecp_init (ECalConfig *cfg) -{ - cfg->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - cfg, E_TYPE_CAL_CONFIG, ECalConfigPrivate); -} +G_DEFINE_TYPE (ECalConfig, e_cal_config, E_TYPE_CONFIG) static void ecp_target_free (EConfig *ec, EConfigTarget *t) { - struct _ECalConfigPrivate *p = E_CAL_CONFIG (ec)->priv; + ECalConfigPrivate *p = E_CAL_CONFIG (ec)->priv; if (ec->target == t) { switch (t->type) { @@ -89,7 +88,7 @@ static void ecp_set_target (EConfig *ec, EConfigTarget *t) { - struct _ECalConfigPrivate *p = E_CAL_CONFIG (ec)->priv; + ECalConfigPrivate *p = E_CAL_CONFIG_GET_PRIVATE (ec); ((EConfigClass *) ecp_parent_class)->set_target (ec, t); @@ -110,35 +109,21 @@ ecp_set_target (EConfig *ec, } static void -ecp_class_init (GObjectClass *klass) +e_cal_config_class_init (ECalConfigClass *class) { - ((EConfigClass *) klass)->set_target = ecp_set_target; - ((EConfigClass *) klass)->target_free = ecp_target_free; + EConfigClass *config_class; - g_type_class_add_private (klass, sizeof (struct _ECalConfigPrivate)); + g_type_class_add_private (class, sizeof (ECalConfigPrivate)); + + config_class = E_CONFIG_CLASS (class); + config_class->set_target = ecp_set_target; + config_class->target_free = ecp_target_free; } -GType -e_cal_config_get_type (void) +static void +e_cal_config_init (ECalConfig *cfg) { - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (ECalConfigClass), - NULL, NULL, - (GClassInitFunc) ecp_class_init, - NULL, NULL, - sizeof (ECalConfig), 0, - (GInstanceInitFunc) ecp_init - }; - - ecp_parent_class = g_type_class_ref (e_config_get_type ()); - type = g_type_register_static ( - e_config_get_type (), "ECalConfig", &info, 0); - } - - return type; + cfg->priv = E_CAL_CONFIG_GET_PRIVATE (cfg); } ECalConfig * diff --git a/calendar/gui/e-cal-config.h b/calendar/gui/e-cal-config.h index 28109ab394..f03220ffb8 100644 --- a/calendar/gui/e-cal-config.h +++ b/calendar/gui/e-cal-config.h @@ -21,8 +21,8 @@ * */ -#ifndef __E_CAL_CONFIG_H__ -#define __E_CAL_CONFIG_H__ +#ifndef E_CAL_CONFIG_H +#define E_CAL_CONFIG_H #include <libecal/e-cal-client.h> #include "e-util/e-config.h" diff --git a/calendar/gui/e-cal-event.c b/calendar/gui/e-cal-event.c index 176e2923b3..9683ddefe1 100644 --- a/calendar/gui/e-cal-event.c +++ b/calendar/gui/e-cal-event.c @@ -26,18 +26,7 @@ #include "e-cal-event.h" -static GObjectClass *ece_parent; - -static void -ece_init (GObject *o) -{ -} - -static void -ece_finalize (GObject *o) -{ - ((GObjectClass *) ece_parent)->finalize (o); -} +G_DEFINE_TYPE (ECalEvent, e_cal_event, E_TYPE_EVENT) static void ece_target_free (EEvent *ev, @@ -53,36 +42,21 @@ ece_target_free (EEvent *ev, break; } } - ((EEventClass *) ece_parent)->target_free (ev, t); + E_EVENT_CLASS (e_cal_event_parent_class)->target_free (ev, t); } static void -ece_class_init (GObjectClass *klass) +e_cal_event_class_init (ECalEventClass *class) { - klass->finalize = ece_finalize; - ((EEventClass *) klass)->target_free = ece_target_free; + EEventClass *event_class; + + event_class = E_EVENT_CLASS (class); + event_class->target_free = ece_target_free; } -GType -e_cal_event_get_type (void) +static void +e_cal_event_init (ECalEvent *event) { - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (ECalEventClass), - NULL, NULL, - (GClassInitFunc) ece_class_init, - NULL, NULL, - sizeof (ECalEvent), 0, - (GInstanceInitFunc) ece_init - }; - ece_parent = g_type_class_ref (e_event_get_type ()); - type = g_type_register_static ( - e_event_get_type (), "ECalEvent", &info, 0); - } - - return type; } ECalEvent * diff --git a/calendar/gui/e-cal-model-calendar.c b/calendar/gui/e-cal-model-calendar.c index 6a1493f01a..0c59a1212e 100644 --- a/calendar/gui/e-cal-model-calendar.c +++ b/calendar/gui/e-cal-model-calendar.c @@ -35,11 +35,6 @@ #include "dialogs/recur-comp.h" #include "dialogs/send-comp.h" -struct _ECalModelCalendarPrivate { - guint reserved; -}; - -static void e_cal_model_calendar_finalize (GObject *object); static gint ecmc_column_count (ETableModel *etm); static gpointer ecmc_value_at (ETableModel *etm, gint col, gint row); static void ecmc_set_value_at (ETableModel *etm, gint col, gint row, gconstpointer value); @@ -56,13 +51,10 @@ static void ecmc_fill_component_from_model (ECalModel *model, ECalModelComponent G_DEFINE_TYPE (ECalModelCalendar, e_cal_model_calendar, E_TYPE_CAL_MODEL) static void -e_cal_model_calendar_class_init (ECalModelCalendarClass *klass) +e_cal_model_calendar_class_init (ECalModelCalendarClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - ETableModelClass *etm_class = E_TABLE_MODEL_CLASS (klass); - ECalModelClass *model_class = E_CAL_MODEL_CLASS (klass); - - object_class->finalize = e_cal_model_calendar_finalize; + ETableModelClass *etm_class = E_TABLE_MODEL_CLASS (class); + ECalModelClass *model_class = E_CAL_MODEL_CLASS (class); etm_class->column_count = ecmc_column_count; etm_class->value_at = ecmc_value_at; @@ -80,32 +72,9 @@ e_cal_model_calendar_class_init (ECalModelCalendarClass *klass) static void e_cal_model_calendar_init (ECalModelCalendar *model) { - ECalModelCalendarPrivate *priv; - - priv = g_new0 (ECalModelCalendarPrivate, 1); - model->priv = priv; - e_cal_model_set_component_kind (E_CAL_MODEL (model), ICAL_VEVENT_COMPONENT); } -static void -e_cal_model_calendar_finalize (GObject *object) -{ - ECalModelCalendarPrivate *priv; - ECalModelCalendar *model = (ECalModelCalendar *) object; - - g_return_if_fail (E_IS_CAL_MODEL_CALENDAR (model)); - - priv = model->priv; - if (priv) { - g_free (priv); - model->priv = NULL; - } - - /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (e_cal_model_calendar_parent_class)->finalize (object); -} - /* ETableModel methods */ static gint ecmc_column_count (ETableModel *etm) diff --git a/calendar/gui/e-cal-model-memos.c b/calendar/gui/e-cal-model-memos.c index 261cdda058..e95cd15ed4 100644 --- a/calendar/gui/e-cal-model-memos.c +++ b/calendar/gui/e-cal-model-memos.c @@ -35,12 +35,6 @@ #define d(x) (x) -struct _ECalModelMemosPrivate { - gint dummy; -}; - -static void e_cal_model_memos_finalize (GObject *object); - static gint ecmm_column_count (ETableModel *etm); static gpointer ecmm_value_at (ETableModel *etm, gint col, gint row); static void ecmm_set_value_at (ETableModel *etm, gint col, gint row, gconstpointer value); @@ -57,13 +51,10 @@ static void ecmm_fill_component_from_model (ECalModel *model, ECalModelComponent G_DEFINE_TYPE (ECalModelMemos, e_cal_model_memos, E_TYPE_CAL_MODEL) static void -e_cal_model_memos_class_init (ECalModelMemosClass *klass) +e_cal_model_memos_class_init (ECalModelMemosClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - ETableModelClass *etm_class = E_TABLE_MODEL_CLASS (klass); - ECalModelClass *model_class = E_CAL_MODEL_CLASS (klass); - - object_class->finalize = e_cal_model_memos_finalize; + ETableModelClass *etm_class = E_TABLE_MODEL_CLASS (class); + ECalModelClass *model_class = E_CAL_MODEL_CLASS (class); etm_class->column_count = ecmm_column_count; etm_class->value_at = ecmm_value_at; @@ -81,32 +72,9 @@ e_cal_model_memos_class_init (ECalModelMemosClass *klass) static void e_cal_model_memos_init (ECalModelMemos *model) { - ECalModelMemosPrivate *priv; - - priv = g_new0 (ECalModelMemosPrivate, 1); - model->priv = priv; - e_cal_model_set_component_kind (E_CAL_MODEL (model), ICAL_VJOURNAL_COMPONENT); } -static void -e_cal_model_memos_finalize (GObject *object) -{ - ECalModelMemosPrivate *priv; - ECalModelMemos *model = (ECalModelMemos *) object; - - g_return_if_fail (E_IS_CAL_MODEL_MEMOS (model)); - - priv = model->priv; - if (priv) { - g_free (priv); - model->priv = NULL; - } - - /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (e_cal_model_memos_parent_class)->finalize (object); -} - /* ETableModel methods */ static gint ecmm_column_count (ETableModel *etm) diff --git a/calendar/gui/e-cal-model-tasks.c b/calendar/gui/e-cal-model-tasks.c index f4f41cf81e..feacc6d422 100644 --- a/calendar/gui/e-cal-model-tasks.c +++ b/calendar/gui/e-cal-model-tasks.c @@ -37,6 +37,10 @@ #include "e-cell-date-edit-text.h" #include "misc.h" +#define E_CAL_MODEL_TASKS_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CAL_MODEL_TASKS, ECalModelTasksPrivate)) + struct _ECalModelTasksPrivate { gboolean highlight_due_today; gchar *color_due_today; @@ -148,7 +152,7 @@ cal_model_tasks_finalize (GObject *object) { ECalModelTasksPrivate *priv; - priv = E_CAL_MODEL_TASKS (object)->priv; + priv = E_CAL_MODEL_TASKS_GET_PRIVATE (object); g_free (priv->color_due_today); g_free (priv->color_overdue); @@ -230,8 +234,7 @@ e_cal_model_tasks_class_init (ECalModelTasksClass *class) static void e_cal_model_tasks_init (ECalModelTasks *model) { - model->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - model, E_TYPE_CAL_MODEL_TASKS, ECalModelTasksPrivate); + model->priv = E_CAL_MODEL_TASKS_GET_PRIVATE (model); model->priv->highlight_due_today = TRUE; model->priv->highlight_overdue = TRUE; diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 2255ec4b35..20dee7f714 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -49,6 +49,14 @@ struct _ECalModelComponentPrivate { GString *categories_str; }; +#define E_CAL_MODEL_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CAL_MODEL, ECalModelPrivate)) + +#define E_CAL_MODEL_COMPONENT_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CAL_MODEL_COMPONENT, ECalModelComponentPrivate)) + typedef struct { ECalClient *client; ECalClientView *view; @@ -182,6 +190,11 @@ G_DEFINE_TYPE_WITH_CODE ( ECalModel, e_cal_model, E_TYPE_TABLE_MODEL, G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL)) +G_DEFINE_TYPE ( + ECalModelComponent, + e_cal_model_component, + G_TYPE_OBJECT) + static void cal_model_set_property (GObject *object, guint property_id, @@ -387,7 +400,7 @@ cal_model_dispose (GObject *object) { ECalModelPrivate *priv; - priv = E_CAL_MODEL (object)->priv; + priv = E_CAL_MODEL_GET_PRIVATE (object); if (priv->loading_clients) { g_cancellable_cancel (priv->loading_clients); @@ -431,7 +444,7 @@ cal_model_finalize (GObject *object) ECalModelPrivate *priv; gint ii; - priv = E_CAL_MODEL (object)->priv; + priv = E_CAL_MODEL_GET_PRIVATE (object); g_free (priv->search_sexp); g_free (priv->full_sexp); @@ -703,8 +716,7 @@ e_cal_model_class_init (ECalModelClass *class) static void e_cal_model_init (ECalModel *model) { - model->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - model, E_TYPE_CAL_MODEL, ECalModelPrivate); + model->priv = E_CAL_MODEL_GET_PRIVATE (model); /* match none by default */ model->priv->start = -1; @@ -2732,11 +2744,21 @@ get_view_cb (GObject *source_object, } else { gvd->client_data->view = view; - g_signal_connect (gvd->client_data->view, "objects-added", G_CALLBACK (client_view_objects_added_cb), gvd->model); - g_signal_connect (gvd->client_data->view, "objects-modified", G_CALLBACK (client_view_objects_modified_cb), gvd->model); - g_signal_connect (gvd->client_data->view, "objects-removed", G_CALLBACK (client_view_objects_removed_cb), gvd->model); - g_signal_connect (gvd->client_data->view, "progress", G_CALLBACK (client_view_progress_cb), gvd->model); - g_signal_connect (gvd->client_data->view, "complete", G_CALLBACK (client_view_complete_cb), gvd->model); + g_signal_connect ( + gvd->client_data->view, "objects-added", + G_CALLBACK (client_view_objects_added_cb), gvd->model); + g_signal_connect ( + gvd->client_data->view, "objects-modified", + G_CALLBACK (client_view_objects_modified_cb), gvd->model); + g_signal_connect ( + gvd->client_data->view, "objects-removed", + G_CALLBACK (client_view_objects_removed_cb), gvd->model); + g_signal_connect ( + gvd->client_data->view, "progress", + G_CALLBACK (client_view_progress_cb), gvd->model); + g_signal_connect ( + gvd->client_data->view, "complete", + G_CALLBACK (client_view_complete_cb), gvd->model); e_cal_client_view_start (gvd->client_data->view, &error); @@ -3713,43 +3735,10 @@ e_cal_model_component_finalize (GObject *object) G_OBJECT_CLASS (component_parent_class)->finalize (object); } -/* Object initialization function for the calendar component object */ static void e_cal_model_component_init (ECalModelComponent *comp) { - comp->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - comp, E_TYPE_CAL_MODEL_COMPONENT, ECalModelComponentPrivate); - - comp->dtstart = NULL; - comp->dtend = NULL; - comp->due = NULL; - comp->completed = NULL; - comp->created = NULL; - comp->lastmodified = NULL; - comp->color = NULL; - comp->priv->categories_str = NULL; -} - -GType -e_cal_model_component_get_type (void) -{ - static GType e_cal_model_component_type = 0; - - if (!e_cal_model_component_type) { - static GTypeInfo info = { - sizeof (ECalModelComponentClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) e_cal_model_component_class_init, - NULL, NULL, - sizeof (ECalModelComponent), - 0, - (GInstanceInitFunc) e_cal_model_component_init - }; - e_cal_model_component_type = g_type_register_static (G_TYPE_OBJECT, "ECalModelComponent", &info, 0); - } - - return e_cal_model_component_type; + comp->priv = E_CAL_MODEL_COMPONENT_GET_PRIVATE (comp); } /** diff --git a/calendar/gui/e-cal-model.h b/calendar/gui/e-cal-model.h index 6dd04675ed..3b4089bb25 100644 --- a/calendar/gui/e-cal-model.h +++ b/calendar/gui/e-cal-model.h @@ -310,10 +310,12 @@ void e_cal_model_update_comp_time (ECalModel *model, ECalModelComponent *comp_data, gconstpointer time_value, icalproperty_kind kind, - void (*set_func)(icalproperty *prop, struct icaltimetype v), - icalproperty * (*new_func)(struct icaltimetype v)); + void (*set_func) (icalproperty *prop, + struct icaltimetype v), + icalproperty * (*new_func) (struct icaltimetype v)); -void e_cal_model_update_status_message (ECalModel *model, +void e_cal_model_update_status_message + (ECalModel *model, const gchar *message, gdouble percent); diff --git a/calendar/gui/e-calendar-selector.c b/calendar/gui/e-calendar-selector.c index 989391625b..4add4a3e97 100644 --- a/calendar/gui/e-calendar-selector.c +++ b/calendar/gui/e-calendar-selector.c @@ -29,6 +29,10 @@ #include "e-util/e-selection.h" +#define E_CALENDAR_SELECTOR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CALENDAR_SELECTOR, ECalendarSelectorPrivate)) + struct _ECalendarSelectorPrivate { gint dummy_value; }; @@ -205,8 +209,7 @@ e_calendar_selector_class_init (ECalendarSelectorClass *class) static void e_calendar_selector_init (ECalendarSelector *selector) { - selector->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - selector, E_TYPE_CALENDAR_SELECTOR, ECalendarSelectorPrivate); + selector->priv = E_CALENDAR_SELECTOR_GET_PRIVATE (selector); gtk_drag_dest_set ( GTK_WIDGET (selector), GTK_DEST_DEFAULT_ALL, diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index ebaede4257..1788e96017 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -61,6 +61,10 @@ #include "print.h" #include "misc.h" +#define E_CALENDAR_VIEW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CALENDAR_VIEW, ECalendarViewPrivate)) + struct _ECalendarViewPrivate { /* The GnomeCalendar we are associated to */ GnomeCalendar *calendar; @@ -321,7 +325,7 @@ calendar_view_dispose (GObject *object) { ECalendarViewPrivate *priv; - priv = E_CALENDAR_VIEW (object)->priv; + priv = E_CALENDAR_VIEW_GET_PRIVATE (object); if (priv->model != NULL) { g_signal_handlers_disconnect_matched ( @@ -350,7 +354,7 @@ calendar_view_finalize (GObject *object) { ECalendarViewPrivate *priv; - priv = E_CALENDAR_VIEW (object)->priv; + priv = E_CALENDAR_VIEW_GET_PRIVATE (object); g_free (priv->default_category); @@ -916,8 +920,7 @@ e_calendar_view_init (ECalendarView *calendar_view) { GtkTargetList *target_list; - calendar_view->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - calendar_view, E_TYPE_CALENDAR_VIEW, ECalendarViewPrivate); + calendar_view->priv = E_CALENDAR_VIEW_GET_PRIVATE (calendar_view); /* Set this early to avoid a divide-by-zero during init. */ calendar_view->priv->time_divisions = 30; @@ -1462,8 +1465,9 @@ e_calendar_view_new_appointment_for (ECalendarView *cal_view, e_source_peek_name (source), NULL); - g_signal_connect ((GtkDialog *)widget, "response", G_CALLBACK (gtk_widget_destroy), - widget); + g_signal_connect ( + widget, "response", + G_CALLBACK (gtk_widget_destroy), widget); gtk_widget_show (widget); return; } @@ -1632,7 +1636,9 @@ e_calendar_view_open_event_with_flags (ECalendarView *cal_view, if (!ce) { ce = event_editor_new (client, shell, flags); - g_signal_connect (ce, "object_created", G_CALLBACK (object_created_cb), cal_view); + g_signal_connect ( + ce, "object_created", + G_CALLBACK (object_created_cb), cal_view); comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp)); @@ -2013,7 +2019,9 @@ e_calendar_view_get_tooltips (const ECalendarViewEventData *data) window = gtk_widget_get_window (pevent->tooltip); gdk_keyboard_grab (window, FALSE, GDK_CURRENT_TIME); - g_signal_connect (pevent->tooltip, "key-press-event", G_CALLBACK (tooltip_grab), data->cal_view); + g_signal_connect ( + pevent->tooltip, "key-press-event", + G_CALLBACK (tooltip_grab), data->cal_view); pevent->timeout = -1; g_object_set_data (G_OBJECT (data->cal_view), "tooltip-window", pevent->tooltip); diff --git a/calendar/gui/e-cell-date-edit-text.c b/calendar/gui/e-cell-date-edit-text.c index 61f6d9a3fd..594bcf07c8 100644 --- a/calendar/gui/e-cell-date-edit-text.c +++ b/calendar/gui/e-cell-date-edit-text.c @@ -38,6 +38,10 @@ #include "e-cell-date-edit-text.h" +#define E_CELL_DATE_EDIT_TEXT_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CELL_DATE_EDIT_TEXT, ECellDateEditTextPrivate)) + struct _ECellDateEditTextPrivate { /* The timezone to display the date in. */ @@ -53,7 +57,10 @@ enum { PROP_USE_24_HOUR_FORMAT }; -static gpointer parent_class; +G_DEFINE_TYPE ( + ECellDateEditText, + e_cell_date_edit_text, + E_TYPE_CELL_TEXT) static void cell_date_edit_text_set_property (GObject *object, @@ -226,12 +233,11 @@ cell_date_edit_text_set_value (ECellText *cell, } static void -cell_date_edit_text_class_init (ECellDateEditTextClass *class) +e_cell_date_edit_text_class_init (ECellDateEditTextClass *class) { GObjectClass *object_class; ECellTextClass *cell_text_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ECellDateEditTextPrivate)); object_class = G_OBJECT_CLASS (class); @@ -264,41 +270,14 @@ cell_date_edit_text_class_init (ECellDateEditTextClass *class) } static void -cell_date_edit_text_init (ECellDateEditText *ecd) +e_cell_date_edit_text_init (ECellDateEditText *ecd) { - ecd->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - ecd, E_TYPE_CELL_DATE_EDIT_TEXT, ECellDateEditTextPrivate); + ecd->priv = E_CELL_DATE_EDIT_TEXT_GET_PRIVATE (ecd); ecd->priv->timezone = icaltimezone_get_utc_timezone (); ecd->priv->use_24_hour_format = TRUE; } -GType -e_cell_date_edit_text_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (ECellDateEditTextClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) cell_date_edit_text_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ECellDateEditText), - 0, /* n_preallocs */ - (GInstanceInitFunc) cell_date_edit_text_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_CELL_TEXT, "ECellDateEditText", &type_info, 0); - } - - return type; -} - /** * e_cell_date_edit_text_new: * diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index b6cdc967e7..4a7fb88bb6 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -40,6 +40,10 @@ #include "e-calendar-view.h" #include "comp-util.h" +#define E_DAY_VIEW_MAIN_ITEM_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_DAY_VIEW_MAIN_ITEM, EDayViewMainItemPrivate)) + struct _EDayViewMainItemPrivate { EDayView *day_view; }; @@ -49,7 +53,10 @@ enum { PROP_DAY_VIEW }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EDayViewMainItem, + e_day_view_main_item, + GNOME_TYPE_CANVAS_ITEM) static gboolean can_draw_in_region (cairo_region_t *draw_region, @@ -927,7 +934,7 @@ day_view_main_item_dispose (GObject *object) { EDayViewMainItemPrivate *priv; - priv = E_DAY_VIEW_MAIN_ITEM (object)->priv; + priv = E_DAY_VIEW_MAIN_ITEM_GET_PRIVATE (object); if (priv->day_view != NULL) { g_object_unref (priv->day_view); @@ -935,7 +942,7 @@ day_view_main_item_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_day_view_main_item_parent_class)->dispose (object); } static void @@ -946,7 +953,8 @@ day_view_main_item_update (GnomeCanvasItem *item, GnomeCanvasItemClass *canvas_item_class; /* Chain up to parent's update() method. */ - canvas_item_class = GNOME_CANVAS_ITEM_CLASS (parent_class); + canvas_item_class = + GNOME_CANVAS_ITEM_CLASS (e_day_view_main_item_parent_class); canvas_item_class->update (item, i2c, flags); /* The item covers the entire canvas area. */ @@ -1218,12 +1226,11 @@ day_view_main_item_point (GnomeCanvasItem *item, } static void -day_view_main_item_class_init (EDayViewMainItemClass *class) +e_day_view_main_item_class_init (EDayViewMainItemClass *class) { GObjectClass *object_class; GnomeCanvasItemClass *item_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EDayViewMainItemPrivate)); object_class = G_OBJECT_CLASS (class); @@ -1251,37 +1258,9 @@ day_view_main_item_class_init (EDayViewMainItemClass *class) } static void -day_view_main_item_init (EDayViewMainItem *main_item) -{ - main_item->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - main_item, E_TYPE_DAY_VIEW_MAIN_ITEM, EDayViewMainItemPrivate); -} - -GType -e_day_view_main_item_get_type (void) +e_day_view_main_item_init (EDayViewMainItem *main_item) { - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (EDayViewMainItemClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) day_view_main_item_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EDayViewMainItem), - 0, /* n_preallocs */ - (GInstanceInitFunc) day_view_main_item_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GNOME_TYPE_CANVAS_ITEM, "EDayViewMainItem", - &type_info, 0); - } - - return type; + main_item->priv = E_DAY_VIEW_MAIN_ITEM_GET_PRIVATE (main_item); } EDayView * diff --git a/calendar/gui/e-day-view-time-item.c b/calendar/gui/e-day-view-time-item.c index 9b61f11649..f270fcca63 100644 --- a/calendar/gui/e-day-view-time-item.c +++ b/calendar/gui/e-day-view-time-item.c @@ -54,6 +54,10 @@ #define E_DVTMI_LARGE_HOUR_Y_PAD 1 #define E_DVTMI_SMALL_FONT_Y_PAD 1 +#define E_DAY_VIEW_TIME_ITEM_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_DAY_VIEW_TIME_ITEM, EDayViewTimeItemPrivate)) + struct _EDayViewTimeItemPrivate { /* The parent EDayView widget. */ EDayView *day_view; @@ -117,7 +121,10 @@ enum { PROP_DAY_VIEW }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EDayViewTimeItem, + e_day_view_time_item, + GNOME_TYPE_CANVAS_ITEM) static void day_view_time_item_set_property (GObject *object, @@ -158,7 +165,7 @@ day_view_time_item_dispose (GObject *object) { EDayViewTimeItemPrivate *priv; - priv = E_DAY_VIEW_TIME_ITEM (object)->priv; + priv = E_DAY_VIEW_TIME_ITEM_GET_PRIVATE (object); if (priv->day_view != NULL) { g_object_unref (priv->day_view); @@ -166,7 +173,7 @@ day_view_time_item_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_day_view_time_item_parent_class)->dispose (object); } static void @@ -176,19 +183,20 @@ day_view_time_item_finalize (GObject *object) time_item = E_DAY_VIEW_TIME_ITEM (object); - calendar_config_remove_notification ((CalendarConfigChangedFunc) edvti_second_zone_changed_cb, time_item); + calendar_config_remove_notification ( + (CalendarConfigChangedFunc) + edvti_second_zone_changed_cb, time_item); /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_day_view_time_item_parent_class)->finalize (object); } static void -day_view_time_item_class_init (EDayViewTimeItemClass *class) +e_day_view_time_item_class_init (EDayViewTimeItemClass *class) { GObjectClass *object_class; GnomeCanvasItemClass *item_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EDayViewTimeItemPrivate)); object_class = G_OBJECT_CLASS (class); @@ -215,15 +223,11 @@ day_view_time_item_class_init (EDayViewTimeItemClass *class) } static void -day_view_time_item_init (EDayViewTimeItem *time_item) +e_day_view_time_item_init (EDayViewTimeItem *time_item) { gchar *last; - time_item->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - time_item, E_TYPE_DAY_VIEW_TIME_ITEM, EDayViewTimeItemPrivate); - - time_item->priv->dragging_selection = FALSE; - time_item->priv->second_zone = NULL; + time_item->priv = E_DAY_VIEW_TIME_ITEM_GET_PRIVATE (time_item); last = calendar_config_get_day_second_zone (); @@ -239,40 +243,13 @@ day_view_time_item_init (EDayViewTimeItem *time_item) time_item); } -GType -e_day_view_time_item_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (EDayViewTimeItemClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) day_view_time_item_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EDayViewTimeItem), - 0, /* n_preallocs */ - (GInstanceInitFunc) day_view_time_item_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GNOME_TYPE_CANVAS_ITEM, "EDayViewTimeItem", - &type_info, 0); - } - - return type; -} - static void e_day_view_time_item_update (GnomeCanvasItem *item, const cairo_matrix_t *i2c, gint flags) { - if (GNOME_CANVAS_ITEM_CLASS (parent_class)->update) - (* GNOME_CANVAS_ITEM_CLASS (parent_class)->update) (item, i2c, flags); + if (GNOME_CANVAS_ITEM_CLASS (e_day_view_time_item_parent_class)->update) + (* GNOME_CANVAS_ITEM_CLASS (e_day_view_time_item_parent_class)->update) (item, i2c, flags); /* The item covers the entire canvas area. */ item->x1 = 0; @@ -327,16 +304,19 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item, small_font_desc = style->font_desc; context = gtk_widget_get_pango_context (GTK_WIDGET (day_view)); - large_font_metrics = pango_context_get_metrics (context, day_view->large_font_desc, - pango_context_get_language (context)); - small_font_metrics = pango_context_get_metrics (context, small_font_desc, - pango_context_get_language (context)); + large_font_metrics = pango_context_get_metrics ( + context, day_view->large_font_desc, + pango_context_get_language (context)); + small_font_metrics = pango_context_get_metrics ( + context, small_font_desc, + pango_context_get_language (context)); fg = style->fg[GTK_STATE_NORMAL]; dark = style->dark[GTK_STATE_NORMAL]; /* The start and end of the long horizontal line between hours. */ - long_line_x1 = (use_zone ? 0 : E_DVTMI_TIME_GRID_X_PAD) - x + x_offset; + long_line_x1 = + (use_zone ? 0 : E_DVTMI_TIME_GRID_X_PAD) - x + x_offset; long_line_x2 = time_item->priv->column_width - E_DVTMI_TIME_GRID_X_PAD - x - @@ -575,8 +555,10 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item, gdk_cairo_set_source_color (cr, &fg); layout = pango_cairo_create_layout (cr); pango_layout_set_text (layout, buffer, -1); - pango_layout_set_font_description (layout, day_view->large_font_desc); - pango_layout_get_pixel_size (layout, &hour_width, NULL); + pango_layout_set_font_description ( + layout, day_view->large_font_desc); + pango_layout_get_pixel_size ( + layout, &hour_width, NULL); cairo_translate ( cr, large_hour_x2 - hour_width, row_y + large_hour_y_offset); @@ -620,8 +602,10 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item, gdk_cairo_set_source_color (cr, &fg); layout = pango_cairo_create_layout (cr); pango_layout_set_text (layout, buffer, -1); - pango_layout_set_font_description (layout, day_view->small_font_desc); - pango_layout_get_pixel_size (layout, &minute_width, NULL); + pango_layout_set_font_description ( + layout, day_view->small_font_desc); + pango_layout_get_pixel_size ( + layout, &minute_width, NULL); cairo_translate ( cr, minute_x2 - minute_width, row_y + small_font_y_offset); @@ -796,11 +780,14 @@ e_day_view_time_item_show_popup_menu (EDayViewTimeItem *time_item, G_CALLBACK (gtk_widget_destroy), NULL); for (i = 0; i < G_N_ELEMENTS (divisions); i++) { - g_snprintf (buffer, sizeof (buffer), - /* TO TRANSLATORS: %02i is the number of minutes; this is a context menu entry - * to change the length of the time division in the calendar day view, e.g. - * a day is displayed in 24 "60 minute divisions" or 48 "30 minute divisions" - */ + g_snprintf ( + buffer, sizeof (buffer), + /* Translators: %02i is the number of minutes; + * this is a context menu entry to change the + * length of the time division in the calendar + * day view, e.g. a day is displayed in + * 24 "60 minute divisions" or + * 48 "30 minute divisions". */ _("%02i minute divisions"), divisions[i]); item = gtk_radio_menu_item_new_with_label (group, buffer); group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item)); @@ -808,13 +795,17 @@ e_day_view_time_item_show_popup_menu (EDayViewTimeItem *time_item, gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); if (current_divisions == divisions[i]) - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE); + gtk_check_menu_item_set_active ( + GTK_CHECK_MENU_ITEM (item), TRUE); - g_object_set_data (G_OBJECT (item), "divisions", - GINT_TO_POINTER (divisions[i])); + g_object_set_data ( + G_OBJECT (item), "divisions", + GINT_TO_POINTER (divisions[i])); - g_signal_connect (item, "toggled", - G_CALLBACK (e_day_view_time_item_on_set_divisions), time_item); + g_signal_connect ( + item, "toggled", + G_CALLBACK (e_day_view_time_item_on_set_divisions), + time_item); } item = gtk_separator_menu_item_new (); @@ -844,7 +835,9 @@ e_day_view_time_item_show_popup_menu (EDayViewTimeItem *time_item, if (!time_item->priv->second_zone) gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE); gtk_menu_shell_append (GTK_MENU_SHELL (submenu), item); - g_signal_connect (item, "toggled", G_CALLBACK (edvti_on_set_zone), time_item); + g_signal_connect ( + item, "toggled", + G_CALLBACK (edvti_on_set_zone), time_item); recent_zones = calendar_config_get_day_second_zones (); for (s = recent_zones; s != NULL; s = s->next) { @@ -872,7 +865,9 @@ e_day_view_time_item_show_popup_menu (EDayViewTimeItem *time_item, gtk_menu_shell_append (GTK_MENU_SHELL (submenu), item); item = gtk_menu_item_new_with_label (_("Select...")); - g_signal_connect (item, "activate", G_CALLBACK (edvti_on_select_zone), time_item); + g_signal_connect ( + item, "activate", + G_CALLBACK (edvti_on_select_zone), time_item); gtk_menu_shell_append (GTK_MENU_SHELL (submenu), item); gtk_widget_show_all (submenu); diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c index 9b22fbe339..17a08a06ef 100644 --- a/calendar/gui/e-day-view-top-item.c +++ b/calendar/gui/e-day-view-top-item.c @@ -36,6 +36,10 @@ #include "e-calendar-view.h" #include "e-day-view-top-item.h" +#define E_DAY_VIEW_TOP_ITEM_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_DAY_VIEW_TOP_ITEM, EDayViewTopItemPrivate)) + struct _EDayViewTopItemPrivate { /* The parent EDayView widget. */ EDayView *day_view; @@ -50,7 +54,10 @@ enum { PROP_SHOW_DATES }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EDayViewTopItem, + e_day_view_top_item, + GNOME_TYPE_CANVAS_ITEM) /* This draws a little triangle to indicate that an event extends past * the days visible on screen. */ @@ -518,7 +525,7 @@ day_view_top_item_dispose (GObject *object) { EDayViewTopItemPrivate *priv; - priv = E_DAY_VIEW_TOP_ITEM (object)->priv; + priv = E_DAY_VIEW_TOP_ITEM_GET_PRIVATE (object); if (priv->day_view != NULL) { g_object_unref (priv->day_view); @@ -526,7 +533,7 @@ day_view_top_item_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_day_view_top_item_parent_class)->dispose (object); } static void @@ -537,7 +544,8 @@ day_view_top_item_update (GnomeCanvasItem *item, GnomeCanvasItemClass *canvas_item_class; /* Chain up to parent's update() method. */ - canvas_item_class = GNOME_CANVAS_ITEM_CLASS (parent_class); + canvas_item_class = + GNOME_CANVAS_ITEM_CLASS (e_day_view_top_item_parent_class); canvas_item_class->update (item, i2c, flags); /* The item covers the entire canvas area. */ @@ -657,16 +665,19 @@ day_view_top_item_draw (GnomeCanvasItem *canvas_item, } if (show_dates) { - /* Draw the date. Set a clipping rectangle so we don't draw over the - * next day. */ + /* Draw the date. Set a clipping rectangle + * so we don't draw over the next day. */ for (day = 0; day < day_view->days_shown; day++) { - e_day_view_top_item_get_day_label (day_view, day, buffer, sizeof (buffer)); + e_day_view_top_item_get_day_label ( + day_view, day, buffer, sizeof (buffer)); clip_rect.x = day_view->day_offsets[day] - x; clip_rect.y = 2 - y; if (day_view->days_shown == 1) { gtk_widget_get_allocation ( day_view->top_canvas, &allocation); - clip_rect.width = allocation.width - day_view->day_offsets[day]; + clip_rect.width = + allocation.width - + day_view->day_offsets[day]; } else clip_rect.width = day_view->day_widths[day]; clip_rect.height = item_height - 2; @@ -676,11 +687,14 @@ day_view_top_item_draw (GnomeCanvasItem *canvas_item, gdk_cairo_rectangle (cr, &clip_rect); cairo_clip (cr); - layout = gtk_widget_create_pango_layout (GTK_WIDGET (day_view), buffer); + layout = gtk_widget_create_pango_layout ( + GTK_WIDGET (day_view), buffer); pango_layout_get_pixel_size (layout, &date_width, NULL); - date_x = day_view->day_offsets[day] + (clip_rect.width - date_width) / 2; + date_x = day_view->day_offsets[day] + + (clip_rect.width - date_width) / 2; - gdk_cairo_set_source_color (cr, &style->fg[GTK_STATE_NORMAL]); + gdk_cairo_set_source_color ( + cr, &style->fg[GTK_STATE_NORMAL]); cairo_move_to (cr, date_x - x, 3 - y); pango_cairo_show_layout (cr, layout); @@ -742,12 +756,11 @@ day_view_top_item_point (GnomeCanvasItem *item, } static void -day_view_top_item_class_init (EDayViewTopItemClass *class) +e_day_view_top_item_class_init (EDayViewTopItemClass *class) { GObjectClass *object_class; GnomeCanvasItemClass *item_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EDayViewTopItemPrivate)); object_class = G_OBJECT_CLASS (class); @@ -782,37 +795,9 @@ day_view_top_item_class_init (EDayViewTopItemClass *class) } static void -day_view_top_item_init (EDayViewTopItem *top_item) +e_day_view_top_item_init (EDayViewTopItem *top_item) { - top_item->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - top_item, E_TYPE_DAY_VIEW_TOP_ITEM, EDayViewTopItemPrivate); -} - -GType -e_day_view_top_item_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (EDayViewTopItemClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) day_view_top_item_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EDayViewTopItem), - 0, /* n_preallocs */ - (GInstanceInitFunc) day_view_top_item_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GNOME_TYPE_CANVAS_ITEM, "EDayViewTopItem", - &type_info, 0); - } - - return type; + top_item->priv = E_DAY_VIEW_TOP_ITEM_GET_PRIVATE (top_item); } void diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index cb19db0fe0..89694506f1 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -1045,27 +1045,37 @@ e_day_view_init (EDayView *day_view) 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show_all (w); - g_signal_connect_after (day_view->top_canvas, "button_press_event", - G_CALLBACK (e_day_view_on_top_canvas_button_press), day_view); - g_signal_connect (day_view->top_canvas, "button_release_event", - G_CALLBACK (e_day_view_on_top_canvas_button_release), day_view); - g_signal_connect (day_view->top_canvas, "scroll_event", - G_CALLBACK (e_day_view_on_top_canvas_scroll), day_view); - g_signal_connect (day_view->top_canvas, "motion_notify_event", - G_CALLBACK (e_day_view_on_top_canvas_motion), day_view); - g_signal_connect (day_view->top_canvas, "drag_motion", - G_CALLBACK (e_day_view_on_top_canvas_drag_motion), day_view); - g_signal_connect (day_view->top_canvas, "drag_leave", - G_CALLBACK (e_day_view_on_top_canvas_drag_leave), day_view); - - g_signal_connect (day_view->top_canvas, "drag_begin", - G_CALLBACK (e_day_view_on_drag_begin), day_view); - g_signal_connect (day_view->top_canvas, "drag_end", - G_CALLBACK (e_day_view_on_drag_end), day_view); - g_signal_connect (day_view->top_canvas, "drag_data_get", - G_CALLBACK (e_day_view_on_drag_data_get), day_view); - g_signal_connect (day_view->top_canvas, "drag_data_received", - G_CALLBACK (e_day_view_on_top_canvas_drag_data_received), day_view); + g_signal_connect_after ( + day_view->top_canvas, "button_press_event", + G_CALLBACK (e_day_view_on_top_canvas_button_press), day_view); + g_signal_connect ( + day_view->top_canvas, "button_release_event", + G_CALLBACK (e_day_view_on_top_canvas_button_release), day_view); + g_signal_connect ( + day_view->top_canvas, "scroll_event", + G_CALLBACK (e_day_view_on_top_canvas_scroll), day_view); + g_signal_connect ( + day_view->top_canvas, "motion_notify_event", + G_CALLBACK (e_day_view_on_top_canvas_motion), day_view); + g_signal_connect ( + day_view->top_canvas, "drag_motion", + G_CALLBACK (e_day_view_on_top_canvas_drag_motion), day_view); + g_signal_connect ( + day_view->top_canvas, "drag_leave", + G_CALLBACK (e_day_view_on_top_canvas_drag_leave), day_view); + + g_signal_connect ( + day_view->top_canvas, "drag_begin", + G_CALLBACK (e_day_view_on_drag_begin), day_view); + g_signal_connect ( + day_view->top_canvas, "drag_end", + G_CALLBACK (e_day_view_on_drag_end), day_view); + g_signal_connect ( + day_view->top_canvas, "drag_data_get", + G_CALLBACK (e_day_view_on_drag_data_get), day_view); + g_signal_connect ( + day_view->top_canvas, "drag_data_received", + G_CALLBACK (e_day_view_on_top_canvas_drag_data_received), day_view); canvas_group = GNOME_CANVAS_GROUP (GNOME_CANVAS (day_view->top_dates_canvas)->root); @@ -1113,42 +1123,42 @@ e_day_view_init (EDayView *day_view) 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); gtk_widget_show (day_view->main_canvas); - g_signal_connect (day_view->main_canvas, "realize", - G_CALLBACK (e_day_view_on_canvas_realized), day_view); - - g_signal_connect (day_view->main_canvas, - "button_press_event", - G_CALLBACK (e_day_view_on_main_canvas_button_press), - day_view); - g_signal_connect (day_view->main_canvas, - "button_release_event", - G_CALLBACK (e_day_view_on_main_canvas_button_release), - day_view); - g_signal_connect (day_view->main_canvas, - "scroll_event", - G_CALLBACK (e_day_view_on_main_canvas_scroll), - day_view); - g_signal_connect (day_view->main_canvas, - "motion_notify_event", - G_CALLBACK (e_day_view_on_main_canvas_motion), - day_view); - g_signal_connect (day_view->main_canvas, - "drag_motion", - G_CALLBACK (e_day_view_on_main_canvas_drag_motion), - day_view); - g_signal_connect (day_view->main_canvas, - "drag_leave", - G_CALLBACK (e_day_view_on_main_canvas_drag_leave), - day_view); - - g_signal_connect (day_view->main_canvas, "drag_begin", - G_CALLBACK (e_day_view_on_drag_begin), day_view); - g_signal_connect (day_view->main_canvas, "drag_end", - G_CALLBACK (e_day_view_on_drag_end), day_view); - g_signal_connect (day_view->main_canvas, "drag_data_get", - G_CALLBACK (e_day_view_on_drag_data_get), day_view); - g_signal_connect (day_view->main_canvas, "drag_data_received", - G_CALLBACK (e_day_view_on_main_canvas_drag_data_received), day_view); + g_signal_connect ( + day_view->main_canvas, "realize", + G_CALLBACK (e_day_view_on_canvas_realized), day_view); + + g_signal_connect ( + day_view->main_canvas, "button_press_event", + G_CALLBACK (e_day_view_on_main_canvas_button_press), day_view); + g_signal_connect ( + day_view->main_canvas, "button_release_event", + G_CALLBACK (e_day_view_on_main_canvas_button_release), + day_view); + g_signal_connect ( + day_view->main_canvas, "scroll_event", + G_CALLBACK (e_day_view_on_main_canvas_scroll), day_view); + g_signal_connect ( + day_view->main_canvas, "motion_notify_event", + G_CALLBACK (e_day_view_on_main_canvas_motion), day_view); + g_signal_connect ( + day_view->main_canvas, "drag_motion", + G_CALLBACK (e_day_view_on_main_canvas_drag_motion), day_view); + g_signal_connect ( + day_view->main_canvas, "drag_leave", + G_CALLBACK (e_day_view_on_main_canvas_drag_leave), day_view); + + g_signal_connect ( + day_view->main_canvas, "drag_begin", + G_CALLBACK (e_day_view_on_drag_begin), day_view); + g_signal_connect ( + day_view->main_canvas, "drag_end", + G_CALLBACK (e_day_view_on_drag_end), day_view); + g_signal_connect ( + day_view->main_canvas, "drag_data_get", + G_CALLBACK (e_day_view_on_drag_data_get), day_view); + g_signal_connect ( + day_view->main_canvas, "drag_data_received", + G_CALLBACK (e_day_view_on_main_canvas_drag_data_received), day_view); canvas_group = GNOME_CANVAS_GROUP (GNOME_CANVAS (day_view->main_canvas)->root); @@ -1195,8 +1205,9 @@ e_day_view_init (EDayView *day_view) 0, 1, 1, 2, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); gtk_widget_show (day_view->time_canvas); - g_signal_connect_after (day_view->time_canvas, "scroll_event", - G_CALLBACK (e_day_view_on_time_canvas_scroll), day_view); + g_signal_connect_after ( + day_view->time_canvas, "scroll_event", + G_CALLBACK (e_day_view_on_time_canvas_scroll), day_view); canvas_group = GNOME_CANVAS_GROUP (GNOME_CANVAS (day_view->time_canvas)->root); @@ -4806,8 +4817,9 @@ e_day_view_reshape_long_event (EDayView *day_view, NULL); g_object_set_data (G_OBJECT (event->canvas_item), "event-num", GINT_TO_POINTER (event_num)); g_object_set_data (G_OBJECT (event->canvas_item), "event-day", GINT_TO_POINTER (E_DAY_VIEW_LONG_EVENT)); - g_signal_connect (event->canvas_item, "event", - G_CALLBACK (e_day_view_on_text_item_event), day_view); + g_signal_connect ( + event->canvas_item, "event", + G_CALLBACK (e_day_view_on_text_item_event), day_view); g_signal_emit_by_name (G_OBJECT (day_view), "event_added", event); @@ -4992,8 +5004,9 @@ e_day_view_reshape_day_event (EDayView *day_view, NULL); g_object_set_data (G_OBJECT (event->canvas_item), "event-num", GINT_TO_POINTER (event_num)); g_object_set_data (G_OBJECT (event->canvas_item), "event-day", GINT_TO_POINTER (day)); - g_signal_connect (event->canvas_item, "event", - G_CALLBACK (e_day_view_on_text_item_event), day_view); + g_signal_connect ( + event->canvas_item, "event", + G_CALLBACK (e_day_view_on_text_item_event), day_view); g_signal_emit_by_name (G_OBJECT (day_view), "event_added", event); diff --git a/calendar/gui/e-meeting-attendee.c b/calendar/gui/e-meeting-attendee.c index 00e3f9d543..a7c4fff5d7 100644 --- a/calendar/gui/e-meeting-attendee.c +++ b/calendar/gui/e-meeting-attendee.c @@ -28,6 +28,10 @@ #include <gtk/gtk.h> #include "e-meeting-attendee.h" +#define E_MEETING_ATTENDEE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MEETING_ATTENDEE, EMeetingAttendeePrivate)) + struct _EMeetingAttendeePrivate { gchar *address; gchar *member; @@ -72,25 +76,6 @@ static void e_meeting_attendee_finalize (GObject *obj); G_DEFINE_TYPE (EMeetingAttendee, e_meeting_attendee, G_TYPE_OBJECT) -static void -e_meeting_attendee_class_init (EMeetingAttendeeClass *klass) -{ - GObjectClass *object_class; - - object_class = G_OBJECT_CLASS (klass); - - signals[CHANGED] = - g_signal_new ("changed", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EMeetingAttendeeClass, changed), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - object_class->finalize = e_meeting_attendee_finalize; -} - static gchar * string_test (gchar *string) { @@ -113,76 +98,89 @@ notify_changed (EMeetingAttendee *ia) } static void -e_meeting_attendee_init (EMeetingAttendee *ia) +e_meeting_attendee_finalize (GObject *object) { EMeetingAttendeePrivate *priv; - priv = g_new0 (EMeetingAttendeePrivate, 1); + priv = E_MEETING_ATTENDEE_GET_PRIVATE (object); - ia->priv = priv; + g_free (priv->address); + g_free (priv->member); + g_free (priv->fburi); - priv->address = string_test (NULL); - priv->member = string_test (NULL); + g_free (priv->delto); + g_free (priv->delfrom); - priv->cutype = ICAL_CUTYPE_NONE; - priv->role = ICAL_ROLE_NONE; + g_free (priv->sentby); + g_free (priv->cn); + g_free (priv->language); - priv->rsvp = FALSE; + g_array_free (priv->busy_periods, TRUE); - priv->delto = string_test (NULL); - priv->delfrom = string_test (NULL); + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (e_meeting_attendee_parent_class)->finalize (object); +} - priv->status = ICAL_PARTSTAT_NONE; +static void +e_meeting_attendee_class_init (EMeetingAttendeeClass *class) +{ + GObjectClass *object_class; - priv->sentby = string_test (NULL); - priv->cn = string_test (NULL); - priv->language = string_test (NULL); + g_type_class_add_private (class, sizeof (EMeetingAttendeePrivate)); - priv->edit_level = E_MEETING_ATTENDEE_EDIT_FULL; - priv->has_calendar_info = FALSE; + object_class = G_OBJECT_CLASS (class); + object_class->finalize = e_meeting_attendee_finalize; - priv->busy_periods = g_array_new (FALSE, FALSE, sizeof (EMeetingFreeBusyPeriod)); - priv->busy_periods_sorted = FALSE; + signals[CHANGED] = g_signal_new ( + "changed", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (EMeetingAttendeeClass, changed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); +} - g_date_clear (&priv->busy_periods_start.date, 1); - priv->busy_periods_start.hour = 0; - priv->busy_periods_start.minute = 0; +static void +e_meeting_attendee_init (EMeetingAttendee *ia) +{ + ia->priv = E_MEETING_ATTENDEE_GET_PRIVATE (ia); - g_date_clear (&priv->busy_periods_end.date, 1); - priv->busy_periods_end.hour = 0; - priv->busy_periods_end.minute = 0; + ia->priv->address = string_test (NULL); + ia->priv->member = string_test (NULL); - priv->start_busy_range_set = FALSE; - priv->end_busy_range_set = FALSE; + ia->priv->cutype = ICAL_CUTYPE_NONE; + ia->priv->role = ICAL_ROLE_NONE; - priv->longest_period_in_days = 0; -} + ia->priv->rsvp = FALSE; -static void -e_meeting_attendee_finalize (GObject *obj) -{ - EMeetingAttendee *ia = E_MEETING_ATTENDEE (obj); - EMeetingAttendeePrivate *priv; + ia->priv->delto = string_test (NULL); + ia->priv->delfrom = string_test (NULL); - priv = ia->priv; + ia->priv->status = ICAL_PARTSTAT_NONE; - g_free (priv->address); - g_free (priv->member); - g_free (priv->fburi); + ia->priv->sentby = string_test (NULL); + ia->priv->cn = string_test (NULL); + ia->priv->language = string_test (NULL); - g_free (priv->delto); - g_free (priv->delfrom); + ia->priv->edit_level = E_MEETING_ATTENDEE_EDIT_FULL; + ia->priv->has_calendar_info = FALSE; - g_free (priv->sentby); - g_free (priv->cn); - g_free (priv->language); + ia->priv->busy_periods = g_array_new (FALSE, FALSE, sizeof (EMeetingFreeBusyPeriod)); + ia->priv->busy_periods_sorted = FALSE; - g_array_free (priv->busy_periods, TRUE); + g_date_clear (&ia->priv->busy_periods_start.date, 1); + ia->priv->busy_periods_start.hour = 0; + ia->priv->busy_periods_start.minute = 0; - g_free (priv); + g_date_clear (&ia->priv->busy_periods_end.date, 1); + ia->priv->busy_periods_end.hour = 0; + ia->priv->busy_periods_end.minute = 0; - /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (e_meeting_attendee_parent_class)->finalize (obj); + ia->priv->start_busy_range_set = FALSE; + ia->priv->end_busy_range_set = FALSE; + + ia->priv->longest_period_in_days = 0; } GObject * @@ -899,7 +897,13 @@ e_meeting_attendee_add_busy_period (EMeetingAttendee *ia, priv->busy_periods_end.hour = period.end.hour; priv->busy_periods_end.minute = period.end.minute; } else { - switch (g_date_compare (&period.end.date, &priv->busy_periods_end.date)) { + gint compare; + + compare = g_date_compare ( + &period.end.date, + &priv->busy_periods_end.date); + + switch (compare) { case 0: if (period.end.hour > priv->busy_periods_end.hour || (period.end.hour == priv->busy_periods_end.hour diff --git a/calendar/gui/e-meeting-list-view.c b/calendar/gui/e-meeting-list-view.c index cd2e7fbcfd..08ff03f86f 100644 --- a/calendar/gui/e-meeting-list-view.c +++ b/calendar/gui/e-meeting-list-view.c @@ -40,6 +40,10 @@ #include <libebook/e-destination.h> #include "e-select-names-renderer.h" +#define E_MEETING_LIST_VIEW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MEETING_LIST_VIEW, EMeetingListViewPrivate)) + struct _EMeetingListViewPrivate { EMeetingStore *store; @@ -75,10 +79,11 @@ static icalparameter_role roles[] = {ICAL_ROLE_CHAIR, G_DEFINE_TYPE (EMeetingListView, e_meeting_list_view, GTK_TYPE_TREE_VIEW) static void -e_meeting_list_view_finalize (GObject *obj) +e_meeting_list_view_finalize (GObject *object) { - EMeetingListView *view = E_MEETING_LIST_VIEW (obj); - EMeetingListViewPrivate *priv = view->priv; + EMeetingListViewPrivate *priv; + + priv = E_MEETING_LIST_VIEW_GET_PRIVATE (object); if (priv->name_selector) { e_name_selector_cancel_loading (priv->name_selector); @@ -91,30 +96,29 @@ e_meeting_list_view_finalize (GObject *obj) priv->renderers = NULL; } - g_free (priv); - /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (e_meeting_list_view_parent_class)->finalize (obj); + G_OBJECT_CLASS (e_meeting_list_view_parent_class)->finalize (object); } static void -e_meeting_list_view_class_init (EMeetingListViewClass *klass) +e_meeting_list_view_class_init (EMeetingListViewClass *class) { GObjectClass *object_class; - object_class = G_OBJECT_CLASS (klass); + g_type_class_add_private (class, sizeof (EMeetingListViewPrivate)); + object_class = G_OBJECT_CLASS (class); object_class->finalize = e_meeting_list_view_finalize; - e_meeting_list_view_signals[ATTENDEE_ADDED] = - g_signal_new ("attendee_added", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMeetingListViewClass, attendee_added), - NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, - G_TYPE_POINTER); + e_meeting_list_view_signals[ATTENDEE_ADDED] = g_signal_new ( + "attendee_added", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMeetingListViewClass, attendee_added), + NULL, NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, + G_TYPE_POINTER); } static void @@ -141,28 +145,29 @@ meeting_list_view_realize_cb (EMeetingListView *view) static void e_meeting_list_view_init (EMeetingListView *view) { - EMeetingListViewPrivate *priv; ENameSelectorDialog *name_selector_dialog; gint i; - priv = g_new0 (EMeetingListViewPrivate, 1); - - view->priv = priv; + view->priv = E_MEETING_LIST_VIEW_GET_PRIVATE (view); - priv->renderers = g_hash_table_new (g_direct_hash, g_int_equal); + view->priv->renderers = g_hash_table_new (g_direct_hash, g_int_equal); - priv->name_selector = e_name_selector_new (); + view->priv->name_selector = e_name_selector_new (); for (i = 0; sections[i]; i++) - add_section (priv->name_selector, sections[i]); + add_section (view->priv->name_selector, sections[i]); - name_selector_dialog = e_name_selector_peek_dialog (view->priv->name_selector); + name_selector_dialog = + e_name_selector_peek_dialog (view->priv->name_selector); gtk_window_set_title (GTK_WINDOW (name_selector_dialog), _("Attendees")); - g_signal_connect (name_selector_dialog, "response", - G_CALLBACK (name_selector_dialog_close_cb), view); + g_signal_connect ( + name_selector_dialog, "response", + G_CALLBACK (name_selector_dialog_close_cb), view); /* postpone name_selector loading, do that only when really needed */ - g_signal_connect (view, "realize", G_CALLBACK (meeting_list_view_realize_cb), NULL); + g_signal_connect ( + view, "realize", + G_CALLBACK (meeting_list_view_realize_cb), NULL); } static GList * @@ -553,7 +558,9 @@ editing_started_cb (GtkCellRenderer *renderer, gchar *path, gpointer user_data) { - g_signal_connect (editable, "updated", G_CALLBACK(ense_update), NULL); + g_signal_connect ( + editable, "updated", + G_CALLBACK (ense_update), NULL); } static GtkCellRenderer * @@ -617,9 +624,15 @@ build_table (EMeetingListView *lview) gtk_tree_view_column_set_expand (col, TRUE); g_object_set (col, "min-width", 50, NULL); g_object_set_data (G_OBJECT (col), "mtg-store-col", GINT_TO_POINTER (E_MEETING_STORE_ATTENDEE_COL)); - g_signal_connect (renderer, "cell_edited", G_CALLBACK (attendee_edited_cb), view); - g_signal_connect (renderer, "editing-canceled", G_CALLBACK (attendee_editing_canceled_cb), view); - g_signal_connect (renderer, "editing-started", G_CALLBACK (editing_started_cb), view); + g_signal_connect ( + renderer, "cell_edited", + G_CALLBACK (attendee_edited_cb), view); + g_signal_connect ( + renderer, "editing-canceled", + G_CALLBACK (attendee_editing_canceled_cb), view); + g_signal_connect ( + renderer, "editing-started", + G_CALLBACK (editing_started_cb), view); g_hash_table_insert (edit_table, GINT_TO_POINTER (E_MEETING_STORE_ATTENDEE_COL), renderer); @@ -631,7 +644,9 @@ build_table (EMeetingListView *lview) gtk_tree_view_column_set_resizable (col, TRUE); gtk_tree_view_column_set_reorderable (col, TRUE); g_object_set_data (G_OBJECT (col), "mtg-store-col", GINT_TO_POINTER (E_MEETING_STORE_TYPE_COL)); - g_signal_connect (renderer, "edited", G_CALLBACK (type_edited_cb), view); + g_signal_connect ( + renderer, "edited", + G_CALLBACK (type_edited_cb), view); g_hash_table_insert (edit_table, GINT_TO_POINTER (E_MEETING_STORE_TYPE_COL), renderer); renderer = create_combo_cell_renderer (get_role_strings ()); @@ -642,7 +657,9 @@ build_table (EMeetingListView *lview) gtk_tree_view_column_set_resizable (col, TRUE); gtk_tree_view_column_set_reorderable (col, TRUE); g_object_set_data (G_OBJECT (col), "mtg-store-col", GINT_TO_POINTER (E_MEETING_STORE_ROLE_COL)); - g_signal_connect (renderer, "edited", G_CALLBACK (role_edited_cb), view); + g_signal_connect ( + renderer, "edited", + G_CALLBACK (role_edited_cb), view); g_hash_table_insert (edit_table, GINT_TO_POINTER (E_MEETING_STORE_ROLE_COL), renderer); renderer = create_combo_cell_renderer (get_rsvp_strings ()); @@ -654,7 +671,9 @@ build_table (EMeetingListView *lview) gtk_tree_view_column_set_resizable (col, TRUE); gtk_tree_view_column_set_reorderable (col, TRUE); g_object_set_data (G_OBJECT (col), "mtg-store-col", GINT_TO_POINTER (E_MEETING_STORE_RSVP_COL)); - g_signal_connect (renderer, "edited", G_CALLBACK (rsvp_edited_cb), view); + g_signal_connect ( + renderer, "edited", + G_CALLBACK (rsvp_edited_cb), view); g_hash_table_insert (edit_table, GINT_TO_POINTER (E_MEETING_STORE_RSVP_COL), renderer); renderer = create_combo_cell_renderer (get_status_strings ()); @@ -665,7 +684,9 @@ build_table (EMeetingListView *lview) gtk_tree_view_column_set_resizable (col, TRUE); gtk_tree_view_column_set_reorderable (col, TRUE); g_object_set_data (G_OBJECT (col), "mtg-store-col", GINT_TO_POINTER (E_MEETING_STORE_STATUS_COL)); - g_signal_connect (renderer, "edited", G_CALLBACK (status_edited_cb), view); + g_signal_connect ( + renderer, "edited", + G_CALLBACK (status_edited_cb), view); g_hash_table_insert (edit_table, GINT_TO_POINTER (E_MEETING_STORE_STATUS_COL), renderer); priv->renderers = edit_table; @@ -776,7 +797,10 @@ e_meeting_list_view_new (EMeetingStore *store) } selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view)); - g_signal_connect (selection, "changed", G_CALLBACK (row_activated_cb), view); + g_signal_connect ( + selection, "changed", + G_CALLBACK (row_activated_cb), view); + return view; } diff --git a/calendar/gui/e-meeting-store.c b/calendar/gui/e-meeting-store.c index e11d90e7bb..0fbf327236 100644 --- a/calendar/gui/e-meeting-store.c +++ b/calendar/gui/e-meeting-store.c @@ -49,6 +49,10 @@ #define ROW_VALID(store, row) \ (row >= 0 && row < store->priv->attendees->len) +#define E_MEETING_STORE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MEETING_STORE, EMeetingStorePrivate)) + struct _EMeetingStorePrivate { GPtrArray *attendees; gint stamp; @@ -739,7 +743,7 @@ meeting_store_finalize (GObject *object) EMeetingStorePrivate *priv; gint i; - priv = E_MEETING_STORE (object)->priv; + priv = E_MEETING_STORE_GET_PRIVATE (object); for (i = 0; i < priv->attendees->len; i++) g_object_unref (g_ptr_array_index (priv->attendees, i)); @@ -846,8 +850,7 @@ e_meeting_store_class_init (EMeetingStoreClass *class) static void e_meeting_store_init (EMeetingStore *store) { - store->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - store, E_TYPE_MEETING_STORE, EMeetingStorePrivate); + store->priv = E_MEETING_STORE_GET_PRIVATE (store); store->priv->attendees = g_ptr_array_new (); store->priv->refresh_queue = g_ptr_array_new (); @@ -1028,7 +1031,9 @@ e_meeting_store_add_attendee (EMeetingStore *store, g_object_ref (attendee); g_ptr_array_add (store->priv->attendees, attendee); - g_signal_connect (attendee, "changed", G_CALLBACK (attendee_changed_cb), store); + g_signal_connect ( + attendee, "changed", + G_CALLBACK (attendee_changed_cb), store); path = gtk_tree_path_new (); gtk_tree_path_append_index (path, store->priv->attendees->len - 1); @@ -1797,10 +1802,10 @@ async_read (GObject *source_object, read = g_input_stream_read_finish (istream, result, &error); - if (error || read < 0) { - g_warning ("Read finish failed: %s", error ? error->message : "Unknown error"); - if (error) - g_error_free (error); + if (error != NULL) { + g_warning ( + "Read finish failed: %s", error->message); + g_error_free (error); g_input_stream_close (istream, NULL, NULL); g_object_unref (istream); @@ -1808,6 +1813,8 @@ async_read (GObject *source_object, return; } + g_return_if_fail (read >= 0); + if (read == 0) { g_input_stream_close (istream, NULL, NULL); g_object_unref (istream); diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c index ca5bb2c15b..cfbff11d2b 100644 --- a/calendar/gui/e-meeting-time-sel.c +++ b/calendar/gui/e-meeting-time-sel.c @@ -47,6 +47,10 @@ #include "e-meeting-list-view.h" #include "e-meeting-time-sel-item.h" +#define E_MEETING_TIME_SELECTOR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MEETING_TIME_SELECTOR, EMeetingTimeSelectorPrivate)) + struct _EMeetingTimeSelectorPrivate { gint week_start_day; guint show_week_numbers : 1; @@ -362,9 +366,7 @@ e_meeting_time_selector_class_init (EMeetingTimeSelectorClass *class) static void e_meeting_time_selector_init (EMeetingTimeSelector *mts) { - mts->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - mts, E_TYPE_MEETING_TIME_SELECTOR, - EMeetingTimeSelectorPrivate); + mts->priv = E_MEETING_TIME_SELECTOR_GET_PRIVATE (mts); /* The shadow is drawn in the border so it must be >= 2 pixels. */ gtk_container_set_border_width (GTK_CONTAINER (mts), 2); @@ -448,9 +450,15 @@ e_meeting_time_selector_construct (EMeetingTimeSelector *mts, mts->model, "notify::free-busy-template", G_CALLBACK (free_busy_template_changed_cb), mts); - g_signal_connect (mts->model, "row_inserted", G_CALLBACK (row_inserted_cb), mts); - g_signal_connect (mts->model, "row_changed", G_CALLBACK (row_changed_cb), mts); - g_signal_connect (mts->model, "row_deleted", G_CALLBACK (row_deleted_cb), mts); + g_signal_connect ( + mts->model, "row_inserted", + G_CALLBACK (row_inserted_cb), mts); + g_signal_connect ( + mts->model, "row_changed", + G_CALLBACK (row_changed_cb), mts); + g_signal_connect ( + mts->model, "row_deleted", + G_CALLBACK (row_deleted_cb), mts); mts->list_view = e_meeting_list_view_new (mts->model); e_meeting_list_view_column_set_visible (mts->list_view, E_MEETING_STORE_ROLE_COL, FALSE); @@ -471,7 +479,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector *mts, #if 0 /* FIXME: do we need sorting here */ - g_signal_connect (real_table->sort_info, "sort_info_changed", G_CALLBACK (sort_info_changed_cb), mts); + g_signal_connect ( + real_table->sort_info, "sort_info_changed", + G_CALLBACK (sort_info_changed_cb), mts); #endif gtk_box_pack_start (GTK_BOX (mts->attendees_vbox), GTK_WIDGET (sw), TRUE, TRUE, 6); @@ -487,8 +497,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector *mts, gtk_table_attach (GTK_TABLE (mts), mts->display_top, 1, 4, 0, 1, GTK_EXPAND | GTK_FILL, 0, 0, 0); gtk_widget_show (mts->display_top); - g_signal_connect (mts->display_top, "realize", - G_CALLBACK (e_meeting_time_selector_on_canvas_realized), mts); + g_signal_connect ( + mts->display_top, "realize", + G_CALLBACK (e_meeting_time_selector_on_canvas_realized), mts); mts->display_main = gnome_canvas_new (); e_meeting_time_selector_update_main_canvas_scroll_region (mts); @@ -497,12 +508,15 @@ e_meeting_time_selector_construct (EMeetingTimeSelector *mts, 1, 4, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); gtk_widget_show (mts->display_main); - g_signal_connect (mts->display_main, "realize", - G_CALLBACK (e_meeting_time_selector_on_canvas_realized), mts); - g_signal_connect (mts->display_main, "size_allocate", - G_CALLBACK (e_meeting_time_selector_on_canvas_size_allocate), mts); - g_signal_connect (mts->display_main, "scroll-event", - G_CALLBACK (e_meeting_time_selector_on_canvas_scroll_event), mts); + g_signal_connect ( + mts->display_main, "realize", + G_CALLBACK (e_meeting_time_selector_on_canvas_realized), mts); + g_signal_connect ( + mts->display_main, "size_allocate", + G_CALLBACK (e_meeting_time_selector_on_canvas_size_allocate), mts); + g_signal_connect ( + mts->display_main, "scroll-event", + G_CALLBACK (e_meeting_time_selector_on_canvas_scroll_event), mts); scrollable = GTK_SCROLLABLE (mts->display_main); @@ -569,15 +583,17 @@ e_meeting_time_selector_construct (EMeetingTimeSelector *mts, GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_BUTTON)); gtk_box_pack_start (GTK_BOX (hbox), mts->add_attendees_button, TRUE, TRUE, 6); gtk_widget_show (mts->add_attendees_button); - g_signal_connect (mts->add_attendees_button, "clicked", - G_CALLBACK (e_meeting_time_selector_on_invite_others_button_clicked), mts); + g_signal_connect ( + mts->add_attendees_button, "clicked", + G_CALLBACK (e_meeting_time_selector_on_invite_others_button_clicked), mts); mts->options_button = gtk_button_new (); gtk_box_pack_start (GTK_BOX (hbox), mts->options_button, TRUE, TRUE, 6); gtk_widget_show (mts->options_button); - g_signal_connect (mts->options_button, "clicked", - G_CALLBACK (e_meeting_time_selector_on_options_button_clicked), mts); + g_signal_connect ( + mts->options_button, "clicked", + G_CALLBACK (e_meeting_time_selector_on_options_button_clicked), mts); child_hbox = gtk_hbox_new (FALSE, 2); gtk_container_add (GTK_CONTAINER (mts->options_button), child_hbox); @@ -606,8 +622,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector *mts, gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem), mts->working_hours_only); - g_signal_connect (menuitem, "toggled", - G_CALLBACK (e_meeting_time_selector_on_working_hours_toggled), mts); + g_signal_connect ( + menuitem, "toggled", + G_CALLBACK (e_meeting_time_selector_on_working_hours_toggled), mts); gtk_widget_show (menuitem); menuitem = gtk_check_menu_item_new_with_label (""); @@ -617,8 +634,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector *mts, gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem), mts->zoomed_out); - g_signal_connect (menuitem, "toggled", - G_CALLBACK (e_meeting_time_selector_on_zoomed_out_toggled), mts); + g_signal_connect ( + menuitem, "toggled", + G_CALLBACK (e_meeting_time_selector_on_zoomed_out_toggled), mts); gtk_widget_show (menuitem); menuitem = gtk_menu_item_new (); @@ -631,8 +649,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector *mts, gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("_Update free/busy")); gtk_menu_shell_append (GTK_MENU_SHELL (mts->options_menu), menuitem); - g_signal_connect (menuitem, "activate", - G_CALLBACK (e_meeting_time_selector_on_update_free_busy), mts); + g_signal_connect ( + menuitem, "activate", + G_CALLBACK (e_meeting_time_selector_on_update_free_busy), mts); gtk_widget_show (menuitem); /* Create the 3 AutoPick buttons on the left. */ @@ -649,8 +668,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector *mts, accel_key, GDK_MOD1_MASK | GDK_SHIFT_MASK, 0); gtk_box_pack_start (GTK_BOX (hbox), mts->autopick_down_button, TRUE, TRUE, 6); gtk_widget_show (mts->autopick_down_button); - g_signal_connect (mts->autopick_down_button, "clicked", - G_CALLBACK (e_meeting_time_selector_on_prev_button_clicked), mts); + g_signal_connect ( + mts->autopick_down_button, "clicked", + G_CALLBACK (e_meeting_time_selector_on_prev_button_clicked), mts); mts->autopick_button = gtk_button_new (); gtk_box_pack_start (GTK_BOX (hbox), mts->autopick_button, TRUE, TRUE, 6); @@ -667,8 +687,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector *mts, gtk_widget_show (label); gtk_widget_add_accelerator (mts->autopick_button, "clicked", mts->accel_group, accel_key, GDK_MOD1_MASK, 0); - g_signal_connect (mts->autopick_button, "clicked", - G_CALLBACK (e_meeting_time_selector_on_autopick_button_clicked), mts); + g_signal_connect ( + mts->autopick_button, "clicked", + G_CALLBACK (e_meeting_time_selector_on_autopick_button_clicked), mts); arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE); gtk_box_pack_start (GTK_BOX (child_hbox), arrow, FALSE, FALSE, 6); @@ -682,8 +703,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector *mts, accel_key, GDK_MOD1_MASK | GDK_SHIFT_MASK, 0); gtk_box_pack_start (GTK_BOX (hbox), mts->autopick_up_button, TRUE, TRUE, 6); gtk_widget_show (mts->autopick_up_button); - g_signal_connect (mts->autopick_up_button, "clicked", - G_CALLBACK (e_meeting_time_selector_on_next_button_clicked), mts); + g_signal_connect ( + mts->autopick_up_button, "clicked", + G_CALLBACK (e_meeting_time_selector_on_next_button_clicked), mts); /* Create the Autopick menu. */ mts->autopick_menu = gtk_menu_new (); @@ -696,8 +718,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector *mts, group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem)); gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("_All people and resources")); gtk_menu_shell_append (GTK_MENU_SHELL (mts->autopick_menu), menuitem); - g_signal_connect (menuitem, "toggled", - G_CALLBACK (e_meeting_time_selector_on_autopick_option_toggled), mts); + g_signal_connect ( + menuitem, "toggled", + G_CALLBACK (e_meeting_time_selector_on_autopick_option_toggled), mts); gtk_widget_show (menuitem); menuitem = gtk_radio_menu_item_new_with_label (group, ""); @@ -706,8 +729,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector *mts, group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem)); gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("All _people and one resource")); gtk_menu_shell_append (GTK_MENU_SHELL (mts->autopick_menu), menuitem); - g_signal_connect (menuitem, "toggled", - G_CALLBACK (e_meeting_time_selector_on_autopick_option_toggled), mts); + g_signal_connect ( + menuitem, "toggled", + G_CALLBACK (e_meeting_time_selector_on_autopick_option_toggled), mts); gtk_widget_show (menuitem); menuitem = gtk_radio_menu_item_new_with_label (group, ""); @@ -716,8 +740,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector *mts, group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem)); gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("_Required people")); gtk_menu_shell_append (GTK_MENU_SHELL (mts->autopick_menu), menuitem); - g_signal_connect (menuitem, "activate", - G_CALLBACK (e_meeting_time_selector_on_autopick_option_toggled), mts); + g_signal_connect ( + menuitem, "activate", + G_CALLBACK (e_meeting_time_selector_on_autopick_option_toggled), mts); gtk_widget_show (menuitem); menuitem = gtk_radio_menu_item_new_with_label (group, ""); @@ -725,8 +750,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector *mts, child = gtk_bin_get_child (GTK_BIN (menuitem)); gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("Required people and _one resource")); gtk_menu_shell_append (GTK_MENU_SHELL (mts->autopick_menu), menuitem); - g_signal_connect (menuitem, "activate", - G_CALLBACK (e_meeting_time_selector_on_autopick_option_toggled), mts); + g_signal_connect ( + menuitem, "activate", + G_CALLBACK (e_meeting_time_selector_on_autopick_option_toggled), mts); gtk_widget_show (menuitem); /* Create the date entry fields on the right. */ @@ -769,8 +795,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector *mts, gtk_table_attach (GTK_TABLE (table), mts->start_date_edit, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); gtk_widget_show (mts->start_date_edit); - g_signal_connect (mts->start_date_edit, "changed", - G_CALLBACK (e_meeting_time_selector_on_start_time_changed), mts); + g_signal_connect ( + mts->start_date_edit, "changed", + G_CALLBACK (e_meeting_time_selector_on_start_time_changed), mts); label = gtk_label_new_with_mnemonic (_("_Start time:")); gtk_label_set_mnemonic_widget (GTK_LABEL (label), (mts->start_date_edit)); @@ -809,8 +836,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector *mts, gtk_table_attach (GTK_TABLE (table), mts->end_date_edit, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); gtk_widget_show (mts->end_date_edit); - g_signal_connect (mts->end_date_edit, "changed", - G_CALLBACK (e_meeting_time_selector_on_end_time_changed), mts); + g_signal_connect ( + mts->end_date_edit, "changed", + G_CALLBACK (e_meeting_time_selector_on_end_time_changed), mts); label = gtk_label_new_with_mnemonic (_("_End time:")); gtk_label_set_mnemonic_widget (GTK_LABEL (label), (mts->end_date_edit)); @@ -885,9 +913,9 @@ e_meeting_time_selector_add_key_color (EMeetingTimeSelector *mts, gtk_box_pack_start (GTK_BOX (child_hbox), label, TRUE, TRUE, 6); gtk_widget_show (label); - g_signal_connect (darea, "draw", - G_CALLBACK (e_meeting_time_selector_draw_key_color), - color); + g_signal_connect ( + darea, "draw", + G_CALLBACK (e_meeting_time_selector_draw_key_color), color); } static gint diff --git a/calendar/gui/e-memo-list-selector.c b/calendar/gui/e-memo-list-selector.c index 4484f94298..51466da09e 100644 --- a/calendar/gui/e-memo-list-selector.c +++ b/calendar/gui/e-memo-list-selector.c @@ -30,6 +30,10 @@ #include "e-util/e-selection.h" #include "calendar/gui/comp-util.h" +#define E_MEMO_LIST_SELECTOR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MEMO_LIST_SELECTOR, EMemoListSelectorPrivate)) + struct _EMemoListSelectorPrivate { gint dummy_value; }; @@ -318,8 +322,7 @@ e_memo_list_selector_class_init (EMemoListSelectorClass *class) static void e_memo_list_selector_init (EMemoListSelector *selector) { - selector->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - selector, E_TYPE_MEMO_LIST_SELECTOR, EMemoListSelectorPrivate); + selector->priv = E_MEMO_LIST_SELECTOR_GET_PRIVATE (selector); gtk_drag_dest_set ( GTK_WIDGET (selector), GTK_DEST_DEFAULT_ALL, diff --git a/calendar/gui/e-memo-table.c b/calendar/gui/e-memo-table.c index 872408c8da..be2cd1a127 100644 --- a/calendar/gui/e-memo-table.c +++ b/calendar/gui/e-memo-table.c @@ -60,6 +60,10 @@ #include <e-util/e-icon-factory.h> #include "misc.h" +#define E_MEMO_TABLE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MEMO_TABLE, EMemoTablePrivate)) + struct _EMemoTablePrivate { gpointer shell_view; /* weak pointer */ ECalModel *model; @@ -92,6 +96,18 @@ static const gchar *icon_names[] = { "stock_insert-note" }; +/* Forward Declarations */ +static void e_memo_table_selectable_init + (ESelectableInterface *interface); + +G_DEFINE_TYPE_WITH_CODE ( + EMemoTable, + e_memo_table, + E_TYPE_TABLE, + G_IMPLEMENT_INTERFACE ( + E_TYPE_SELECTABLE, + e_memo_table_selectable_init)) + static void memo_table_emit_open_component (EMemoTable *memo_table, ECalModelComponent *comp_data) @@ -294,7 +310,7 @@ memo_table_dispose (GObject *object) { EMemoTablePrivate *priv; - priv = E_MEMO_TABLE (object)->priv; + priv = E_MEMO_TABLE_GET_PRIVATE (object); if (priv->shell_view != NULL) { g_object_remove_weak_pointer ( @@ -1059,7 +1075,7 @@ memo_table_select_all (ESelectable *selectable) } static void -memo_table_class_init (EMemoTableClass *class) +e_memo_table_class_init (EMemoTableClass *class) { GObjectClass *object_class; GtkWidgetClass *widget_class; @@ -1148,12 +1164,11 @@ memo_table_class_init (EMemoTableClass *class) } static void -memo_table_init (EMemoTable *memo_table) +e_memo_table_init (EMemoTable *memo_table) { GtkTargetList *target_list; - memo_table->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - memo_table, E_TYPE_MEMO_TABLE, EMemoTablePrivate); + memo_table->priv = E_MEMO_TABLE_GET_PRIVATE (memo_table); target_list = gtk_target_list_new (NULL, 0); e_target_list_add_calendar_targets (target_list, 0); @@ -1165,7 +1180,7 @@ memo_table_init (EMemoTable *memo_table) } static void -memo_table_selectable_init (ESelectableInterface *interface) +e_memo_table_selectable_init (ESelectableInterface *interface) { interface->update_actions = memo_table_update_actions; interface->cut_clipboard = memo_table_cut_clipboard; @@ -1175,41 +1190,6 @@ memo_table_selectable_init (ESelectableInterface *interface) interface->select_all = memo_table_select_all; } -GType -e_memo_table_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EMemoTableClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) memo_table_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMemoTable), - 0, /* n_preallocs */ - (GInstanceInitFunc) memo_table_init, - NULL /* value_table */ - }; - - static const GInterfaceInfo selectable_info = { - (GInterfaceInitFunc) memo_table_selectable_init, - (GInterfaceFinalizeFunc) NULL, - NULL /* interface_data */ - }; - - type = g_type_register_static ( - E_TYPE_TABLE, "EMemoTable", &type_info, 0); - - g_type_add_interface_static ( - type, E_TYPE_SELECTABLE, &selectable_info); - } - - return type; -} - /** * e_memo_table_new: * @shell_view: an #EShellView diff --git a/calendar/gui/e-month-view.c b/calendar/gui/e-month-view.c index ca8fe3a1de..fe0bebaf8e 100644 --- a/calendar/gui/e-month-view.c +++ b/calendar/gui/e-month-view.c @@ -27,11 +27,15 @@ #include <libecal/e-cal-time-util.h> +#define E_MONTH_VIEW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MONTH_VIEW, EMonthViewPrivate)) + struct _EMonthViewPrivate { gint placeholder; }; -static gpointer parent_class; +G_DEFINE_TYPE (EMonthView, e_month_view, E_TYPE_WEEK_VIEW) static void month_view_cursor_key_up (EWeekView *week_view) @@ -158,11 +162,10 @@ month_view_cursor_key_right (EWeekView *week_view) } static void -month_view_class_init (EMonthViewClass *class) +e_month_view_class_init (EMonthViewClass *class) { EWeekViewClass *week_view_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EMonthViewPrivate)); week_view_class = E_WEEK_VIEW_CLASS (class); @@ -173,36 +176,9 @@ month_view_class_init (EMonthViewClass *class) } static void -month_view_init (EMonthView *month_view) -{ - month_view->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - month_view, E_TYPE_MONTH_VIEW, EMonthViewPrivate); -} - -GType -e_month_view_get_type (void) +e_month_view_init (EMonthView *month_view) { - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (EMonthViewClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) month_view_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMonthView), - 0, /* n_preallocs */ - (GInstanceInitFunc) month_view_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_WEEK_VIEW, "EMonthView", &type_info, 0); - } - - return type; + month_view->priv = E_MONTH_VIEW_GET_PRIVATE (month_view); } ECalendarView * diff --git a/calendar/gui/e-select-names-editable.c b/calendar/gui/e-select-names-editable.c index 040993595a..70e1de24e2 100644 --- a/calendar/gui/e-select-names-editable.c +++ b/calendar/gui/e-select-names-editable.c @@ -31,80 +31,27 @@ #include "e-select-names-editable.h" -struct _ESelectNamesEditablePriv { - gint dummy; -}; - -static ENameSelectorEntryClass *parent_class; - -static void -esne_cell_editable_init (GtkCellEditableIface *iface) -{ -} - -static void -esne_finalize (GObject *object) -{ - ESelectNamesEditable *esne = (ESelectNamesEditable *) object; - - g_free (esne->priv); - - /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); -} +G_DEFINE_TYPE_WITH_CODE ( + ESelectNamesEditable, + e_select_names_editable, + E_TYPE_NAME_SELECTOR_ENTRY, + G_IMPLEMENT_INTERFACE ( + GTK_TYPE_CELL_EDITABLE, NULL)) static void -esne_init (ESelectNamesEditable *esne) +e_select_names_editable_class_init (ESelectNamesEditableClass *class) { - esne->priv = g_new0 (ESelectNamesEditablePriv, 1); } static void -esne_class_init (GObjectClass *klass) +e_select_names_editable_init (ESelectNamesEditable *esne) { - klass->finalize = esne_finalize; - - parent_class = E_NAME_SELECTOR_ENTRY_CLASS (g_type_class_peek_parent (klass)); -} - -GType -e_select_names_editable_get_type (void) -{ - static GType esne_type = 0; - - if (!esne_type) { - static const GTypeInfo esne_info = { - sizeof (ESelectNamesEditableClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) esne_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (ESelectNamesEditable), - 0, /* n_preallocs */ - (GInstanceInitFunc) esne_init, - }; - - static const GInterfaceInfo cell_editable_info = { - (GInterfaceInitFunc) esne_cell_editable_init, - NULL, - NULL - }; - - esne_type = g_type_register_static (E_TYPE_NAME_SELECTOR_ENTRY, "ESelectNamesEditable", &esne_info, 0); - - g_type_add_interface_static (esne_type, GTK_TYPE_CELL_EDITABLE, &cell_editable_info); - } - - return esne_type; } ESelectNamesEditable * e_select_names_editable_new (void) { - ESelectNamesEditable *esne = g_object_new (E_TYPE_SELECT_NAMES_EDITABLE, NULL); - - return esne; + return g_object_new (E_TYPE_SELECT_NAMES_EDITABLE, NULL); } gchar * diff --git a/calendar/gui/e-select-names-renderer.c b/calendar/gui/e-select-names-renderer.c index e5326c108f..b3a00d5d7e 100644 --- a/calendar/gui/e-select-names-renderer.c +++ b/calendar/gui/e-select-names-renderer.c @@ -29,7 +29,11 @@ #include "e-select-names-editable.h" #include "e-select-names-renderer.h" -struct _ESelectNamesRendererPriv { +#define E_SELECT_NAMES_RENDERER_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_SELECT_NAMES_RENDERER, ESelectNamesRendererPrivate)) + +struct _ESelectNamesRendererPrivate { ESelectNamesEditable *editable; gchar *path; @@ -50,7 +54,10 @@ enum { static gint signals[LAST_SIGNAL]; -G_DEFINE_TYPE (ESelectNamesRenderer, e_select_names_renderer, GTK_TYPE_CELL_RENDERER_TEXT) +G_DEFINE_TYPE ( + ESelectNamesRenderer, + e_select_names_renderer, + GTK_TYPE_CELL_RENDERER_TEXT) static void e_select_names_renderer_editing_done (GtkCellEditable *editable, @@ -131,7 +138,9 @@ e_select_names_renderer_start_editing (GtkCellRenderer *cell, e_select_names_editable_set_address (editable, sn_cell->priv->name, sn_cell->priv->email); gtk_widget_show (GTK_WIDGET (editable)); - g_signal_connect (editable, "editing_done", G_CALLBACK (e_select_names_renderer_editing_done), sn_cell); + g_signal_connect ( + editable, "editing_done", + G_CALLBACK (e_select_names_renderer_editing_done), sn_cell); /* Removed focus-out-event. focus out event already listen by base class. * We don't need to listen for the focus out event any more */ @@ -187,58 +196,80 @@ e_select_names_renderer_set_property (GObject *object, static void e_select_names_renderer_finalize (GObject *object) { - ESelectNamesRenderer *cell = (ESelectNamesRenderer *) object; + ESelectNamesRendererPrivate *priv; - if (cell->priv->editable) - g_object_unref (cell->priv->editable); - cell->priv->editable = NULL; + priv = E_SELECT_NAMES_RENDERER_GET_PRIVATE (object); - g_free (cell->priv->path); - g_free (cell->priv->name); - g_free (cell->priv->email); - g_free (cell->priv); + if (priv->editable != NULL) { + g_object_unref (priv->editable); + priv->editable = NULL; + } + + g_free (priv->path); + g_free (priv->name); + g_free (priv->email); /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (e_select_names_renderer_parent_class)->finalize (object); } static void -e_select_names_renderer_init (ESelectNamesRenderer *cell) -{ - cell->priv = g_new0 (ESelectNamesRendererPriv, 1); -} - -static void e_select_names_renderer_class_init (ESelectNamesRendererClass *class) { + GObjectClass *object_class; GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (class); - GObjectClass *obj_class = G_OBJECT_CLASS (class); - obj_class->finalize = e_select_names_renderer_finalize; - obj_class->get_property = e_select_names_renderer_get_property; - obj_class->set_property = e_select_names_renderer_set_property; + g_type_class_add_private (class, sizeof (ESelectNamesRendererPrivate)); - cell_class->start_editing = e_select_names_renderer_start_editing; + object_class = G_OBJECT_CLASS (class); + object_class->get_property = e_select_names_renderer_get_property; + object_class->set_property = e_select_names_renderer_set_property; + object_class->finalize = e_select_names_renderer_finalize; - g_object_class_install_property (obj_class, PROP_NAME, - g_param_spec_string ("name", "Name", "Email name.", NULL, G_PARAM_READWRITE)); + cell_class->start_editing = e_select_names_renderer_start_editing; - g_object_class_install_property (obj_class, PROP_EMAIL, - g_param_spec_string ("email", "Email", "Email address.", NULL, G_PARAM_READWRITE)); + g_object_class_install_property ( + object_class, + PROP_NAME, + g_param_spec_string ( + "name", + "Name", + "Email name.", + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_EMAIL, + g_param_spec_string ( + "email", + "Email", + "Email address.", + NULL, + G_PARAM_READWRITE)); + + signals[CELL_EDITED] = g_signal_new ( + "cell_edited", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ESelectNamesRendererClass, cell_edited), + NULL, NULL, + e_marshal_VOID__STRING_POINTER_POINTER, + G_TYPE_NONE, 3, + G_TYPE_STRING, + G_TYPE_POINTER, + G_TYPE_POINTER); +} - signals [CELL_EDITED] = g_signal_new ("cell_edited", - G_OBJECT_CLASS_TYPE (obj_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ESelectNamesRendererClass, cell_edited), - NULL, NULL, - e_marshal_VOID__STRING_POINTER_POINTER, - G_TYPE_NONE, 3, - G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_POINTER); +static void +e_select_names_renderer_init (ESelectNamesRenderer *cell) +{ + cell->priv = E_SELECT_NAMES_RENDERER_GET_PRIVATE (cell); } GtkCellRenderer * e_select_names_renderer_new (void) { - return GTK_CELL_RENDERER (g_object_new (E_TYPE_SELECT_NAMES_RENDERER, NULL)); + return g_object_new (E_TYPE_SELECT_NAMES_RENDERER, NULL); } diff --git a/calendar/gui/e-select-names-renderer.h b/calendar/gui/e-select-names-renderer.h index 6a2c4be102..2517f76d63 100644 --- a/calendar/gui/e-select-names-renderer.h +++ b/calendar/gui/e-select-names-renderer.h @@ -21,44 +21,54 @@ * */ -#ifndef __E_SELECT_NAMES_RENDERER_H__ -#define __E_SELECT_NAMES_RENDERER_H__ +#ifndef E_SELECT_NAMES_RENDERER_H +#define E_SELECT_NAMES_RENDERER_H #include <gtk/gtk.h> -G_BEGIN_DECLS +/* Standard GObject macros */ +#define E_TYPE_SELECT_NAMES_RENDERER \ + (e_select_names_renderer_get_type ()) +#define E_SELECT_NAMES_RENDERER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_SELECT_NAMES_RENDERER, ESelectNamesRenderer)) +#define E_SELECT_NAMES_RENDERER_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_SELECT_NAMES_RENDERER, ESelectNamesRendererClass)) +#define E_IS_SELECT_NAMES_RENDERER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_SELECT_NAMES_RENDERER)) +#define E_IS_SELECT_NAMES_RENDERER_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_SELECT_NAMES_RENDERER)) +#define E_SELECT_NAMES_RENDERER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_SELECT_NAMES_RENDERER, ESelectNamesRendererClass)) -#define E_TYPE_SELECT_NAMES_RENDERER (e_select_names_renderer_get_type ()) -#define E_SELECT_NAMES_RENDERER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_SELECT_NAMES_RENDERER, ESelectNamesRenderer)) -#define E_SELECT_NAMES_RENDERER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), E_TYPE_SELECT_NAMES_RENDERER, ESelectNamesRendererClass)) -#define E_IS_SELECT_NAMES_RENDERER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_SELECT_NAMES_RENDERER)) -#define E_IS_SELECT_NAMES_RENDERER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((o), E_TYPE_SELECT_NAMES_RENDERER)) -#define E_SELECT_NAMES_RENDERER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_TYPE_SELECT_NAMES_RENDERER, ESelectNamesRendererClass)) +G_BEGIN_DECLS -typedef struct _ESelectNamesRenderer ESelectNamesRenderer; +typedef struct _ESelectNamesRenderer ESelectNamesRenderer; typedef struct _ESelectNamesRendererClass ESelectNamesRendererClass; -typedef struct _ESelectNamesRendererPriv ESelectNamesRendererPriv; - -struct _ESelectNamesRenderer -{ - GtkCellRendererText parent; +typedef struct _ESelectNamesRendererPrivate ESelectNamesRendererPrivate; - ESelectNamesRendererPriv *priv; +struct _ESelectNamesRenderer { + GtkCellRendererText parent; + ESelectNamesRendererPrivate *priv; }; -struct _ESelectNamesRendererClass -{ +struct _ESelectNamesRendererClass { GtkCellRendererTextClass parent_class; - void (* cell_edited) (ESelectNamesRenderer *renderer, - const gchar *path, - GList *addresses, - GList *names); + void (*cell_edited) (ESelectNamesRenderer *renderer, + const gchar *path, + GList *addresses, + GList *names); }; -GType e_select_names_renderer_get_type (void); -GtkCellRenderer *e_select_names_renderer_new (void); +GType e_select_names_renderer_get_type (void) G_GNUC_CONST; +GtkCellRenderer * + e_select_names_renderer_new (void); G_END_DECLS -#endif /* __E_SELECT_NAMES_RENDERER_H__ */ +#endif /* E_SELECT_NAMES_RENDERER_H */ diff --git a/calendar/gui/e-task-list-selector.c b/calendar/gui/e-task-list-selector.c index ba210e8c05..fd6a7915f3 100644 --- a/calendar/gui/e-task-list-selector.c +++ b/calendar/gui/e-task-list-selector.c @@ -30,6 +30,10 @@ #include "e-util/e-selection.h" #include "calendar/gui/comp-util.h" +#define E_TASK_LIST_SELECTOR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_TASK_LIST_SELECTOR, ETaskListSelectorPrivate)) + struct _ETaskListSelectorPrivate { gint dummy_value; }; @@ -320,8 +324,7 @@ e_task_list_selector_class_init (ETaskListSelectorClass *class) static void e_task_list_selector_init (ETaskListSelector *selector) { - selector->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - selector, E_TYPE_TASK_LIST_SELECTOR, ETaskListSelectorPrivate); + selector->priv = E_TASK_LIST_SELECTOR_GET_PRIVATE (selector); gtk_drag_dest_set ( GTK_WIDGET (selector), GTK_DEST_DEFAULT_ALL, diff --git a/calendar/gui/e-task-table.c b/calendar/gui/e-task-table.c index 4b6d671af3..b314766aff 100644 --- a/calendar/gui/e-task-table.c +++ b/calendar/gui/e-task-table.c @@ -63,6 +63,10 @@ #include <e-util/e-icon-factory.h> #include "misc.h" +#define E_TASK_TABLE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_TASK_TABLE, ETaskTablePrivate)) + struct _ETaskTablePrivate { gpointer shell_view; /* weak pointer */ ECalModel *model; @@ -100,6 +104,18 @@ static const gchar *icon_names[] = { "stock_task-assigned-to" }; +/* Forward Declarations */ +static void e_task_table_selectable_init + (ESelectableInterface *interface); + +G_DEFINE_TYPE_WITH_CODE ( + ETaskTable, + e_task_table, + E_TYPE_TABLE, + G_IMPLEMENT_INTERFACE ( + E_TYPE_SELECTABLE, + e_task_table_selectable_init)) + static void task_table_emit_open_component (ETaskTable *task_table, ECalModelComponent *comp_data) @@ -414,7 +430,7 @@ task_table_dispose (GObject *object) { ETaskTablePrivate *priv; - priv = E_TASK_TABLE (object)->priv; + priv = E_TASK_TABLE_GET_PRIVATE (object); if (priv->completed_cancellable) { g_cancellable_cancel (priv->completed_cancellable); @@ -1418,7 +1434,7 @@ task_table_select_all (ESelectable *selectable) } static void -task_table_class_init (ETaskTableClass *class) +e_task_table_class_init (ETaskTableClass *class) { GObjectClass *object_class; GtkWidgetClass *widget_class; @@ -1507,12 +1523,11 @@ task_table_class_init (ETaskTableClass *class) } static void -task_table_init (ETaskTable *task_table) +e_task_table_init (ETaskTable *task_table) { GtkTargetList *target_list; - task_table->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - task_table, E_TYPE_TASK_TABLE, ETaskTablePrivate); + task_table->priv = E_TASK_TABLE_GET_PRIVATE (task_table); task_table->priv->completed_cancellable = NULL; @@ -1526,7 +1541,7 @@ task_table_init (ETaskTable *task_table) } static void -task_table_selectable_init (ESelectableInterface *interface) +e_task_table_selectable_init (ESelectableInterface *interface) { interface->update_actions = task_table_update_actions; interface->cut_clipboard = task_table_cut_clipboard; @@ -1536,41 +1551,6 @@ task_table_selectable_init (ESelectableInterface *interface) interface->select_all = task_table_select_all; } -GType -e_task_table_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (ETaskTableClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) task_table_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ETaskTable), - 0, /* n_preallocs */ - (GInstanceInitFunc) task_table_init, - NULL /* value_table */ - }; - - static const GInterfaceInfo selectable_info = { - (GInterfaceInitFunc) task_table_selectable_init, - (GInterfaceFinalizeFunc) NULL, - NULL /* interface_data */ - }; - - type = g_type_register_static ( - E_TYPE_TABLE, "ETaskTable", &type_info, 0); - - g_type_add_interface_static ( - type, E_TYPE_SELECTABLE, &selectable_info); - } - - return type; -} - /** * e_task_table_new: * @shell_view: an #EShellView diff --git a/calendar/gui/e-timezone-entry.c b/calendar/gui/e-timezone-entry.c index a3288b1115..d8429b844d 100644 --- a/calendar/gui/e-timezone-entry.c +++ b/calendar/gui/e-timezone-entry.c @@ -36,6 +36,10 @@ #include <glib/gi18n.h> #include "e-timezone-entry.h" +#define E_TIMEZONE_ENTRY_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_TIMEZONE_ENTRY, ETimezoneEntryPrivate)) + struct _ETimezoneEntryPrivate { /* The current timezone, set in e_timezone_entry_set_timezone() * or from the timezone dialog. Note that we don't copy it or @@ -216,7 +220,7 @@ timezone_entry_mnemonic_activate (GtkWidget *widget, { ETimezoneEntryPrivate *priv; - priv = E_TIMEZONE_ENTRY (widget)->priv; + priv = E_TIMEZONE_ENTRY_GET_PRIVATE (widget); if (gtk_widget_get_can_focus (widget)) { if (priv->button != NULL) @@ -232,7 +236,7 @@ timezone_entry_focus (GtkWidget *widget, { ETimezoneEntryPrivate *priv; - priv = E_TIMEZONE_ENTRY (widget)->priv; + priv = E_TIMEZONE_ENTRY_GET_PRIVATE (widget); if (direction == GTK_DIR_TAB_FORWARD) { if (gtk_widget_has_focus (priv->entry)) @@ -301,8 +305,7 @@ e_timezone_entry_init (ETimezoneEntry *timezone_entry) AtkObject *a11y; GtkWidget *widget; - timezone_entry->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - timezone_entry, E_TYPE_TIMEZONE_ENTRY, ETimezoneEntryPrivate); + timezone_entry->priv = E_TIMEZONE_ENTRY_GET_PRIVATE (timezone_entry); gtk_widget_set_can_focus (GTK_WIDGET (timezone_entry), TRUE); diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c index 8aa50a99e2..c18ab8db57 100644 --- a/calendar/gui/e-week-view-event-item.c +++ b/calendar/gui/e-week-view-event-item.c @@ -39,6 +39,10 @@ #include <text/e-text.h> +#define E_WEEK_VIEW_EVENT_ITEM_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_WEEK_VIEW_EVENT_ITEM, EWeekViewEventItemPrivate)) + struct _EWeekViewEventItemPrivate { /* The event index in the EWeekView events array. */ gint event_num; @@ -53,7 +57,10 @@ enum { PROP_SPAN_NUM }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EWeekViewEventItem, + e_week_view_event_item, + GNOME_TYPE_CANVAS_ITEM) static gboolean can_draw_in_region (cairo_region_t *draw_region, @@ -424,7 +431,8 @@ week_view_event_item_draw_icons (EWeekViewEventItem *event_item, num_icons++; } - if (e_cal_component_has_recurrences (comp) || e_cal_component_is_instance (comp)) { + if (e_cal_component_has_recurrences (comp) || + e_cal_component_is_instance (comp)) { draw_recurrence_icon = TRUE; num_icons++; } @@ -654,7 +662,8 @@ week_view_event_item_update (GnomeCanvasItem *item, week_view = E_WEEK_VIEW (parent); /* Chain up to parent's update() method. */ - canvas_item_class = GNOME_CANVAS_ITEM_CLASS (parent_class); + canvas_item_class = + GNOME_CANVAS_ITEM_CLASS (e_week_view_event_item_parent_class); canvas_item_class->update (item, i2c, flags); item->x1 = 0; @@ -1118,12 +1127,11 @@ week_view_event_item_event (GnomeCanvasItem *item, } static void -week_view_event_item_class_init (EWeekViewEventItemClass *class) +e_week_view_event_item_class_init (EWeekViewEventItemClass *class) { GObjectClass *object_class; GnomeCanvasItemClass *item_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EWeekViewEventItemPrivate)); object_class = G_OBJECT_CLASS (class); @@ -1162,43 +1170,14 @@ week_view_event_item_class_init (EWeekViewEventItemClass *class) } static void -week_view_event_item_init (EWeekViewEventItem *event_item) +e_week_view_event_item_init (EWeekViewEventItem *event_item) { - event_item->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - event_item, E_TYPE_WEEK_VIEW_EVENT_ITEM, - EWeekViewEventItemPrivate); + event_item->priv = E_WEEK_VIEW_EVENT_ITEM_GET_PRIVATE (event_item); event_item->priv->event_num = -1; event_item->priv->span_num = -1; } -GType -e_week_view_event_item_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (EWeekViewEventItemClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) week_view_event_item_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EWeekViewEventItem), - 0, /* n_preallocs */ - (GInstanceInitFunc) week_view_event_item_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GNOME_TYPE_CANVAS_ITEM, "EWeekViewEventItem", - &type_info, 0); - } - - return type; -} - gint e_week_view_event_item_get_event_num (EWeekViewEventItem *event_item) { diff --git a/calendar/gui/e-week-view-layout.c b/calendar/gui/e-week-view-layout.c index b2fc7ca158..1e7f6366b1 100644 --- a/calendar/gui/e-week-view-layout.c +++ b/calendar/gui/e-week-view-layout.c @@ -377,10 +377,13 @@ e_week_view_layout_get_day_position (gint day, if (arr[i - m] > 1) { any = TRUE; - if (wd > 6) { /* too many rows, make last shorter */ + /* too many rows, make last shorter */ + if (wd > 6) { arr[i - m] --; wd--; - } else if (wd < 6) { /* free rows left, enlarge those bigger */ + + /* free rows left, enlarge those bigger */ + } else if (wd < 6) { arr[i - m] ++; wd++; } diff --git a/calendar/gui/e-week-view-main-item.c b/calendar/gui/e-week-view-main-item.c index bca3343b67..06ebf68dbe 100644 --- a/calendar/gui/e-week-view-main-item.c +++ b/calendar/gui/e-week-view-main-item.c @@ -32,6 +32,10 @@ #include "ea-calendar.h" #include "calendar-config.h" +#define E_WEEK_VIEW_MAIN_ITEM_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_WEEK_VIEW_MAIN_ITEM, EWeekViewMainItemPrivate)) + struct _EWeekViewMainItemPrivate { EWeekView *week_view; }; @@ -41,7 +45,10 @@ enum { PROP_WEEK_VIEW }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EWeekViewMainItem, + e_week_view_main_item, + GNOME_TYPE_CANVAS_ITEM) static gint gdate_to_cal_weekdays (GDateWeekday wd) @@ -337,7 +344,7 @@ week_view_main_item_dispose (GObject *object) { EWeekViewMainItemPrivate *priv; - priv = E_WEEK_VIEW_MAIN_ITEM (object)->priv; + priv = E_WEEK_VIEW_MAIN_ITEM_GET_PRIVATE (object); if (priv->week_view != NULL) { g_object_unref (priv->week_view); @@ -345,7 +352,7 @@ week_view_main_item_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_week_view_main_item_parent_class)->dispose (object); } static void @@ -356,7 +363,8 @@ week_view_main_item_update (GnomeCanvasItem *item, GnomeCanvasItemClass *canvas_item_class; /* Chain up to parent's update() method. */ - canvas_item_class = GNOME_CANVAS_ITEM_CLASS (parent_class); + canvas_item_class = + GNOME_CANVAS_ITEM_CLASS (e_week_view_main_item_parent_class); canvas_item_class->update (item, i2c, flags); /* The item covers the entire canvas area. */ @@ -417,12 +425,11 @@ week_view_main_item_point (GnomeCanvasItem *item, } static void -week_view_main_item_class_init (EWeekViewMainItemClass *class) +e_week_view_main_item_class_init (EWeekViewMainItemClass *class) { GObjectClass *object_class; GnomeCanvasItemClass *item_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EWeekViewMainItemPrivate)); object_class = G_OBJECT_CLASS (class); @@ -450,38 +457,9 @@ week_view_main_item_class_init (EWeekViewMainItemClass *class) } static void -week_view_main_item_init (EWeekViewMainItem *main_item) -{ - main_item->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - main_item, E_TYPE_WEEK_VIEW_MAIN_ITEM, - EWeekViewMainItemPrivate); -} - -GType -e_week_view_main_item_get_type (void) +e_week_view_main_item_init (EWeekViewMainItem *main_item) { - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (EWeekViewMainItemClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) week_view_main_item_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EWeekViewMainItem), - 0, /* n_preallocs */ - (GInstanceInitFunc) week_view_main_item_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GNOME_TYPE_CANVAS_ITEM, "EWeekViewMainItem", - &type_info, 0); - } - - return type; + main_item->priv = E_WEEK_VIEW_MAIN_ITEM_GET_PRIVATE (main_item); } EWeekView * diff --git a/calendar/gui/e-week-view-titles-item.c b/calendar/gui/e-week-view-titles-item.c index 66f9930534..40d7391679 100644 --- a/calendar/gui/e-week-view-titles-item.c +++ b/calendar/gui/e-week-view-titles-item.c @@ -29,6 +29,10 @@ #include <e-util/e-util.h> #include "e-week-view-titles-item.h" +#define E_WEEK_VIEW_TITLES_ITEM_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_WEEK_VIEW_TITLES_ITEM, EWeekViewTitlesItemPrivate)) + struct _EWeekViewTitlesItemPrivate { EWeekView *week_view; }; @@ -38,7 +42,10 @@ enum { PROP_WEEK_VIEW }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EWeekViewTitlesItem, + e_week_view_titles_item, + GNOME_TYPE_CANVAS_ITEM) static void week_view_titles_item_set_property (GObject *object, @@ -80,7 +87,7 @@ week_view_titles_item_dispose (GObject *object) { EWeekViewTitlesItemPrivate *priv; - priv = E_WEEK_VIEW_TITLES_ITEM (object)->priv; + priv = E_WEEK_VIEW_TITLES_ITEM_GET_PRIVATE (object); if (priv->week_view != NULL) { g_object_unref (priv->week_view); @@ -88,7 +95,7 @@ week_view_titles_item_dispose (GObject *object) } /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (e_week_view_titles_item_parent_class)->dispose (object); } static void @@ -99,7 +106,8 @@ week_view_titles_item_update (GnomeCanvasItem *item, GnomeCanvasItemClass *canvas_item_class; /* Chain up to parent's update() method. */ - canvas_item_class = GNOME_CANVAS_ITEM_CLASS (parent_class); + canvas_item_class = + GNOME_CANVAS_ITEM_CLASS (e_week_view_titles_item_parent_class); canvas_item_class->update (item, i2c, flags); /* The item covers the entire canvas area. */ @@ -245,12 +253,11 @@ week_view_titles_item_point (GnomeCanvasItem *item, } static void -week_view_titles_item_class_init (EWeekViewTitlesItemClass *class) +e_week_view_titles_item_class_init (EWeekViewTitlesItemClass *class) { GObjectClass *object_class; GnomeCanvasItemClass *item_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EWeekViewTitlesItemPrivate)); object_class = G_OBJECT_CLASS (class); @@ -275,38 +282,9 @@ week_view_titles_item_class_init (EWeekViewTitlesItemClass *class) } static void -week_view_titles_item_init (EWeekViewTitlesItem *titles_item) -{ - titles_item->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - titles_item, E_TYPE_WEEK_VIEW_TITLES_ITEM, - EWeekViewTitlesItemPrivate); -} - -GType -e_week_view_titles_item_get_type (void) +e_week_view_titles_item_init (EWeekViewTitlesItem *titles_item) { - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (EWeekViewTitlesItemClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) week_view_titles_item_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EWeekViewTitlesItem), - 0, /* n_preallocs */ - (GInstanceInitFunc) week_view_titles_item_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - GNOME_TYPE_CANVAS_ITEM, "EWeekViewTitlesItem", - &type_info, 0); - } - - return type; + titles_item->priv = E_WEEK_VIEW_TITLES_ITEM_GET_PRIVATE (titles_item); } EWeekView * diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 45917c170c..3feacccfda 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -813,14 +813,18 @@ e_week_view_init (EWeekView *week_view) "EWeekViewMainItem::week_view", week_view, NULL); - g_signal_connect_after (week_view->main_canvas, "button_press_event", - G_CALLBACK (e_week_view_on_button_press), week_view); - g_signal_connect (week_view->main_canvas, "button_release_event", - G_CALLBACK (e_week_view_on_button_release), week_view); - g_signal_connect (week_view->main_canvas, "scroll_event", - G_CALLBACK (e_week_view_on_scroll), week_view); - g_signal_connect (week_view->main_canvas, "motion_notify_event", - G_CALLBACK (e_week_view_on_motion), week_view); + g_signal_connect_after ( + week_view->main_canvas, "button_press_event", + G_CALLBACK (e_week_view_on_button_press), week_view); + g_signal_connect ( + week_view->main_canvas, "button_release_event", + G_CALLBACK (e_week_view_on_button_release), week_view); + g_signal_connect ( + week_view->main_canvas, "scroll_event", + G_CALLBACK (e_week_view_on_scroll), week_view); + g_signal_connect ( + week_view->main_canvas, "motion_notify_event", + G_CALLBACK (e_week_view_on_motion), week_view); /* Create the buttons to jump to each days. */ pixbuf = gdk_pixbuf_new_from_xpm_data ((const gchar **) jump_xpm); @@ -832,8 +836,9 @@ e_week_view_init (EWeekView *week_view) "GnomeCanvasPixbuf::pixbuf", pixbuf, NULL); - g_signal_connect (week_view->jump_buttons[i], "event", - G_CALLBACK (e_week_view_on_jump_button_event), week_view); + g_signal_connect ( + week_view->jump_buttons[i], "event", + G_CALLBACK (e_week_view_on_jump_button_event), week_view); } week_view->focused_jump_button = E_WEEK_VIEW_JUMP_BUTTON_NO_FOCUS; @@ -3147,9 +3152,9 @@ e_week_view_reshape_event_span (EWeekView *week_view, } g_object_set_data ((GObject *)span->background_item, "event-num", GINT_TO_POINTER (event_num)); - g_signal_connect (span->background_item, "event", - G_CALLBACK (tooltip_event_cb), - week_view); + g_signal_connect ( + span->background_item, "event", + G_CALLBACK (tooltip_event_cb), week_view); gnome_canvas_item_set (span->background_item, "event_num", event_num, @@ -3188,9 +3193,9 @@ e_week_view_reshape_event_span (EWeekView *week_view, set_text_as_bold (event, span); } g_object_set_data (G_OBJECT (span->text_item), "event-num", GINT_TO_POINTER (event_num)); - g_signal_connect (span->text_item, "event", - G_CALLBACK (e_week_view_on_text_item_event), - week_view); + g_signal_connect ( + span->text_item, "event", + G_CALLBACK (e_week_view_on_text_item_event), week_view); g_signal_emit_by_name (G_OBJECT (week_view), "event_added", event); diff --git a/calendar/gui/ea-cal-view-event.c b/calendar/gui/ea-cal-view-event.c index 5111d6d27f..cd777949ab 100644 --- a/calendar/gui/ea-cal-view-event.c +++ b/calendar/gui/ea-cal-view-event.c @@ -210,7 +210,8 @@ ea_cal_view_event_new (GObject *obj) EWeekViewEvent, event_num); - if (!is_array_index_in_bounds (week_view->spans, week_view_event->spans_index)) + if (!is_array_index_in_bounds ( + week_view->spans, week_view_event->spans_index)) return NULL; /* get the first span */ diff --git a/calendar/gui/ea-cal-view.c b/calendar/gui/ea-cal-view.c index e6c3d65b9b..415e72bb0d 100644 --- a/calendar/gui/ea-cal-view.c +++ b/calendar/gui/ea-cal-view.c @@ -174,9 +174,9 @@ ea_cal_view_real_initialize (AtkObject *accessible, gcal = e_calendar_view_get_calendar (cal_view); if (gcal) - g_signal_connect (gcal, "dates_shown_changed", - G_CALLBACK (ea_cal_view_dates_change_cb), - accessible); + g_signal_connect ( + gcal, "dates_shown_changed", + G_CALLBACK (ea_cal_view_dates_change_cb), accessible); } static AtkObject * @@ -222,7 +222,9 @@ ea_cal_view_event_changed_cb (ECalendarView *cal_view, span = &g_array_index (week_view->spans, EWeekViewEventSpan, week_view_event->spans_index); if (span && span->text_item) - event_atk_obj = ea_calendar_helpers_get_accessible_for (span->text_item); + event_atk_obj = + ea_calendar_helpers_get_accessible_for ( + span->text_item); } if (event_atk_obj) { #ifdef ACC_DEBUG @@ -258,10 +260,13 @@ ea_cal_view_event_added_cb (ECalendarView *cal_view, EWeekViewEvent *week_view_event = (EWeekViewEvent *) event; EWeekView *week_view = E_WEEK_VIEW (cal_view); /* get the first span of the event */ - span = &g_array_index (week_view->spans, EWeekViewEventSpan, - week_view_event->spans_index); + span = &g_array_index ( + week_view->spans, EWeekViewEventSpan, + week_view_event->spans_index); if (span && span->text_item) - event_atk_obj = ea_calendar_helpers_get_accessible_for (span->text_item); + event_atk_obj = + ea_calendar_helpers_get_accessible_for ( + span->text_item); } if (event_atk_obj) { diff --git a/calendar/gui/ea-calendar.c b/calendar/gui/ea-calendar.c index cbea6ded02..a81fb5e7a5 100644 --- a/calendar/gui/ea-calendar.c +++ b/calendar/gui/ea-calendar.c @@ -204,9 +204,6 @@ ea_calendar_focus_watcher (GSignalInvocationHint *ihint, else /* focus out */ ea_event = NULL; -#ifdef ACC_DEBUG - printf ("EvoAcc: focus notify on week main item %p\n", (gpointer)object); -#endif atk_focus_tracker_notify (ea_event); } } diff --git a/calendar/gui/ea-day-view-cell.c b/calendar/gui/ea-day-view-cell.c index 4fe1c5bedb..419e11426e 100644 --- a/calendar/gui/ea-day-view-cell.c +++ b/calendar/gui/ea-day-view-cell.c @@ -93,7 +93,7 @@ e_day_view_cell_new (EDayView *day_view, /* EaDayViewCell */ -static void ea_day_view_cell_class_init (EaDayViewCellClass *klass); +static void ea_day_view_cell_class_init (EaDayViewCellClass *class); static const gchar * ea_day_view_cell_get_name (AtkObject *accessible); static const gchar * ea_day_view_cell_get_description (AtkObject *accessible); diff --git a/calendar/gui/ea-day-view-main-item.c b/calendar/gui/ea-day-view-main-item.c index 1ced61b7ad..19c91384da 100644 --- a/calendar/gui/ea-day-view-main-item.c +++ b/calendar/gui/ea-day-view-main-item.c @@ -272,9 +272,10 @@ ea_day_view_main_item_new (GObject *obj) /* listen for date changes of calendar */ gcal = e_calendar_view_get_calendar (E_CALENDAR_VIEW (day_view)); if (gcal) - g_signal_connect (gcal, "dates_shown_changed", - G_CALLBACK (ea_day_view_main_item_dates_change_cb), - accessible); + g_signal_connect ( + gcal, "dates_shown_changed", + G_CALLBACK (ea_day_view_main_item_dates_change_cb), + accessible); return accessible; } diff --git a/calendar/gui/ea-day-view.c b/calendar/gui/ea-day-view.c index 89e9c4b8a0..4c5ffb0199 100644 --- a/calendar/gui/ea-day-view.c +++ b/calendar/gui/ea-day-view.c @@ -283,7 +283,8 @@ ea_day_view_ref_child (AtkObject *accessible, /* Not use atk_gobject_accessible_for_object here, * we need to do special thing here */ - atk_object = ea_calendar_helpers_get_accessible_for (event->canvas_item); + atk_object = ea_calendar_helpers_get_accessible_for ( + event->canvas_item); g_object_ref (atk_object); } } diff --git a/calendar/gui/ea-gnome-calendar.c b/calendar/gui/ea-gnome-calendar.c index e1826355b5..b989506e9e 100644 --- a/calendar/gui/ea-gnome-calendar.c +++ b/calendar/gui/ea-gnome-calendar.c @@ -131,9 +131,9 @@ ea_gnome_calendar_new (GtkWidget *widget) /* listen on view type change */ - g_signal_connect (widget, "dates_shown_changed", - G_CALLBACK (ea_gcal_dates_change_cb), - accessible); + g_signal_connect ( + widget, "dates_shown_changed", + G_CALLBACK (ea_gcal_dates_change_cb), accessible); #ifdef ACC_DEBUG printf ("EvoAcc: ea-gnome-calendar created: %p\n", (gpointer)accessible); diff --git a/calendar/gui/ea-jump-button.c b/calendar/gui/ea-jump-button.c index 34a7b32ad0..11a36df54a 100644 --- a/calendar/gui/ea-jump-button.c +++ b/calendar/gui/ea-jump-button.c @@ -58,23 +58,22 @@ ea_jump_button_get_type (void) if (!type) { static GTypeInfo tinfo = { sizeof (EaJumpButtonClass), - (GBaseInitFunc) NULL, /* base init */ - (GBaseFinalizeFunc) NULL, /* base finalize */ - (GClassInitFunc) ea_jump_button_class_init, /* class init */ - (GClassFinalizeFunc) NULL, /* class finalize */ - NULL, /* class data */ - sizeof (EaJumpButton), /* instance size */ - 0, /* nb preallocs */ - (GInstanceInitFunc) NULL, /* instance init */ - NULL /* value table */ + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) ea_jump_button_class_init, + (GClassFinalizeFunc) NULL, + /* class_data */ NULL, + sizeof (EaJumpButton), + /* n_preallocs */ 0, + (GInstanceInitFunc) NULL, + /* value_table */ NULL }; - static const GInterfaceInfo atk_action_info = - { - (GInterfaceInitFunc) atk_action_interface_init, - (GInterfaceFinalizeFunc) NULL, - NULL - }; + static const GInterfaceInfo atk_action_info = { + (GInterfaceInitFunc) atk_action_interface_init, + (GInterfaceFinalizeFunc) NULL, + NULL + }; /* * Figure out the size of the class and instance @@ -82,20 +81,22 @@ ea_jump_button_get_type (void) * GNOME_TYPE_CANVAS_ITEM, in this case) */ - factory = atk_registry_get_factory (atk_get_default_registry (), - GNOME_TYPE_CANVAS_ITEM); - derived_atk_type = atk_object_factory_get_accessible_type (factory); + factory = atk_registry_get_factory ( + atk_get_default_registry (), GNOME_TYPE_CANVAS_ITEM); + derived_atk_type = + atk_object_factory_get_accessible_type (factory); g_type_query (derived_atk_type, &query); tinfo.class_size = query.class_size; tinfo.instance_size = query.instance_size; - /* we inherit the component and other interfaces from GNOME_TYPE_CANVAS_ITEM */ - type = g_type_register_static (derived_atk_type, - "EaJumpButton", &tinfo, 0); + /* we inherit the component and other + * interfaces from GNOME_TYPE_CANVAS_ITEM */ + type = g_type_register_static ( + derived_atk_type, "EaJumpButton", &tinfo, 0); - g_type_add_interface_static (type, ATK_TYPE_ACTION, - &atk_action_info); + g_type_add_interface_static ( + type, ATK_TYPE_ACTION, &atk_action_info); } return type; diff --git a/calendar/gui/ea-week-view-main-item.c b/calendar/gui/ea-week-view-main-item.c index f7a5a2a7fe..e33d630f00 100644 --- a/calendar/gui/ea-week-view-main-item.c +++ b/calendar/gui/ea-week-view-main-item.c @@ -301,9 +301,10 @@ ea_week_view_main_item_new (GObject *obj) /* listen for date changes of calendar */ gcal = e_calendar_view_get_calendar (E_CALENDAR_VIEW (week_view)); if (gcal) - g_signal_connect (gcal, "dates_shown_changed", - G_CALLBACK (ea_week_view_main_item_dates_change_cb), - accessible); + g_signal_connect ( + gcal, "dates_shown_changed", + G_CALLBACK (ea_week_view_main_item_dates_change_cb), + accessible); return accessible; } diff --git a/calendar/gui/ea-week-view.c b/calendar/gui/ea-week-view.c index 15fe1cb09f..679f201d95 100644 --- a/calendar/gui/ea-week-view.c +++ b/calendar/gui/ea-week-view.c @@ -319,13 +319,16 @@ ea_week_view_ref_child (AtkObject *accessible, /* Not use atk_gobject_accessible_for_object for event * text_item we need to do special thing here */ - atk_object = ea_calendar_helpers_get_accessible_for (span->text_item); + atk_object = + ea_calendar_helpers_get_accessible_for ( + span->text_item); } else { gint index; index = (current_day != -1) ? current_day : 0; - atk_object = ea_calendar_helpers_get_accessible_for ( + atk_object = + ea_calendar_helpers_get_accessible_for ( week_view->jump_buttons[index]); } g_object_ref (atk_object); diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index aa0aebf08a..ecfb116341 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -70,6 +70,10 @@ #define d(x) +#define GNOME_CALENDAR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), GNOME_TYPE_CALENDAR, GnomeCalendarPrivate)) + /* Private part of the GnomeCalendar structure */ struct _GnomeCalendarPrivate { ECalModel *model; @@ -501,6 +505,8 @@ gnome_calendar_class_init (GnomeCalendarClass *class) GObjectClass *object_class; GtkBindingSet *binding_set; + g_type_class_add_private (class, sizeof (GnomeCalendarPrivate)); + object_class = G_OBJECT_CLASS (class); object_class->set_property = gnome_calendar_set_property; object_class->get_property = gnome_calendar_get_property; @@ -1451,50 +1457,42 @@ setup_widgets (GnomeCalendar *gcal) static void gnome_calendar_init (GnomeCalendar *gcal) { - GnomeCalendarPrivate *priv; - - priv = g_new0 (GnomeCalendarPrivate, 1); - gcal->priv = priv; + gcal->priv = GNOME_CALENDAR_GET_PRIVATE (gcal); - priv->todo_update_lock = g_mutex_new (); - priv->dn_query_lock = g_mutex_new (); + gcal->priv->todo_update_lock = g_mutex_new (); + gcal->priv->dn_query_lock = g_mutex_new (); - priv->current_view_type = GNOME_CAL_WORK_WEEK_VIEW; - priv->range_selected = FALSE; - priv->lview_select_daten_range = TRUE; + gcal->priv->current_view_type = GNOME_CAL_WORK_WEEK_VIEW; + gcal->priv->range_selected = FALSE; + gcal->priv->lview_select_daten_range = TRUE; setup_widgets (gcal); - priv->dn_queries = NULL; - priv->sexp = g_strdup ("#t"); /* Match all */ - priv->todo_sexp = g_strdup ("#t"); - priv->memo_sexp = g_strdup ("#t"); + gcal->priv->dn_queries = NULL; + gcal->priv->sexp = g_strdup ("#t"); /* Match all */ + gcal->priv->todo_sexp = g_strdup ("#t"); + gcal->priv->memo_sexp = g_strdup ("#t"); - priv->visible_start = -1; - priv->visible_end = -1; - priv->updating = FALSE; + gcal->priv->visible_start = -1; + gcal->priv->visible_end = -1; + gcal->priv->updating = FALSE; - priv->cancellable = g_cancellable_new (); + gcal->priv->cancellable = g_cancellable_new (); } static void gnome_calendar_do_dispose (GObject *object) { - GnomeCalendar *gcal; GnomeCalendarPrivate *priv; gint ii; - g_return_if_fail (object != NULL); - g_return_if_fail (GNOME_IS_CALENDAR (object)); - - gcal = GNOME_CALENDAR (object); - priv = gcal->priv; + priv = GNOME_CALENDAR_GET_PRIVATE (object); if (priv->model != NULL) { g_signal_handlers_disconnect_by_func ( - priv->model, view_progress_cb, gcal); + priv->model, view_progress_cb, object); g_signal_handlers_disconnect_by_func ( - priv->model, view_complete_cb, gcal); + priv->model, view_complete_cb, object); g_object_unref (priv->model); priv->model = NULL; } @@ -1506,7 +1504,7 @@ gnome_calendar_do_dispose (GObject *object) } } - free_dn_queries (gcal); + free_dn_queries (GNOME_CALENDAR (object)); if (priv->sexp) { g_free (priv->sexp); @@ -1529,21 +1527,21 @@ gnome_calendar_do_dispose (GObject *object) priv->cancellable = NULL; } + /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (gnome_calendar_parent_class)->dispose (object); } static void gnome_calendar_finalize (GObject *object) { - GnomeCalendar *gcal = GNOME_CALENDAR (object); - GnomeCalendarPrivate *priv = gcal->priv; + GnomeCalendarPrivate *priv; + + priv = GNOME_CALENDAR_GET_PRIVATE (object); g_mutex_free (priv->todo_update_lock); g_mutex_free (priv->dn_query_lock); - g_free (priv); - gcal->priv = NULL; - + /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (gnome_calendar_parent_class)->finalize (object); } diff --git a/calendar/gui/tag-calendar.c b/calendar/gui/tag-calendar.c index 6a0fdcce1f..2e1e511340 100644 --- a/calendar/gui/tag-calendar.c +++ b/calendar/gui/tag-calendar.c @@ -49,7 +49,7 @@ struct calendar_tag_closure { * the calendar has no dates shown. */ static gboolean prepare_tag (ECalendar *ecal, - struct calendar_tag_closure *c, + struct calendar_tag_closure *closure, icaltimezone *zone, gboolean clear_first) { @@ -77,15 +77,17 @@ prepare_tag (ECalendar *ecal, icaltime_adjust (&end_tt, 1, 0, 0, 0); - c->calitem = ecal->calitem; + closure->calitem = ecal->calitem; - if (zone) - c->zone = zone; + if (zone != NULL) + closure->zone = zone; else - c->zone = calendar_config_get_icaltimezone (); + closure->zone = calendar_config_get_icaltimezone (); - c->start_time = icaltime_as_timet_with_zone (start_tt, c->zone); - c->end_time = icaltime_as_timet_with_zone (end_tt, c->zone); + closure->start_time = + icaltime_as_timet_with_zone (start_tt, closure->zone); + closure->end_time = + icaltime_as_timet_with_zone (end_tt, closure->zone); return TRUE; } @@ -96,9 +98,8 @@ static gboolean tag_calendar_cb (ECalComponent *comp, time_t istart, time_t iend, - gpointer data) + struct calendar_tag_closure *closure) { - struct calendar_tag_closure *c = data; struct icaltimetype start_tt, end_tt; ECalComponentTransparency transparency; guint8 style = 0; @@ -107,21 +108,21 @@ tag_calendar_cb (ECalComponent *comp, * transparent. */ e_cal_component_get_transparency (comp, &transparency); if (transparency == E_CAL_COMPONENT_TRANSP_TRANSPARENT) { - if (c->skip_transparent_events) + if (closure->skip_transparent_events) return TRUE; style = E_CALENDAR_ITEM_MARK_ITALIC; - } else if (c->recur_events_italic && e_cal_component_is_instance (comp)) { + } else if (closure->recur_events_italic && e_cal_component_is_instance (comp)) { style = E_CALENDAR_ITEM_MARK_ITALIC; } else { style = E_CALENDAR_ITEM_MARK_BOLD; } - start_tt = icaltime_from_timet_with_zone (istart, FALSE, c->zone); - end_tt = icaltime_from_timet_with_zone (iend - 1, FALSE, c->zone); + start_tt = icaltime_from_timet_with_zone (istart, FALSE, closure->zone); + end_tt = icaltime_from_timet_with_zone (iend - 1, FALSE, closure->zone); e_calendar_item_mark_days ( - c->calitem, + closure->calitem, start_tt.year, start_tt.month - 1, start_tt.day, end_tt.year, end_tt.month - 1, end_tt.day, style, TRUE); @@ -138,7 +139,8 @@ get_recur_events_italic (void) shell = e_shell_get_default (); shell_settings = e_shell_get_shell_settings (shell); - return e_shell_settings_get_boolean (shell_settings, "cal-recur-events-italic"); + return e_shell_settings_get_boolean ( + shell_settings, "cal-recur-events-italic"); } /** @@ -155,7 +157,7 @@ tag_calendar_by_client (ECalendar *ecal, ECalClient *client, GCancellable *cancellable) { - struct calendar_tag_closure *c; + struct calendar_tag_closure *closure; g_return_if_fail (E_IS_CALENDAR (ecal)); g_return_if_fail (E_IS_CAL_CLIENT (client)); @@ -167,18 +169,20 @@ tag_calendar_by_client (ECalendar *ecal, if (!e_client_is_opened (E_CLIENT (client))) return; - c = g_new0 (struct calendar_tag_closure, 1); + closure = g_new0 (struct calendar_tag_closure, 1); - if (!prepare_tag (ecal, c, NULL, TRUE)) { - g_free (c); + if (!prepare_tag (ecal, closure, NULL, TRUE)) { + g_free (closure); return; } - c->skip_transparent_events = TRUE; - c->recur_events_italic = get_recur_events_italic (); + closure->skip_transparent_events = TRUE; + closure->recur_events_italic = get_recur_events_italic (); e_cal_client_generate_instances ( - client, c->start_time, c->end_time, cancellable, tag_calendar_cb, c, g_free); + client, closure->start_time, closure->end_time, cancellable, + (ECalRecurInstanceFn) tag_calendar_cb, + closure, (GDestroyNotify) g_free); } /* Resolves TZIDs for the recurrence generator, for when the comp is not on @@ -186,15 +190,10 @@ tag_calendar_by_client (ECalendar *ecal, * be added to the server yet. */ static icaltimezone * resolve_tzid_cb (const gchar *tzid, - gpointer data) + ECalClient *client) { - ECalClient *client; icaltimezone *zone = NULL; - g_return_val_if_fail (E_IS_CAL_CLIENT (data), NULL); - - client = E_CAL_CLIENT (data); - /* Try to find the builtin timezone first. */ zone = icaltimezone_get_builtin_timezone_from_tzid (tzid); @@ -240,7 +239,7 @@ tag_calendar_by_comp (ECalendar *ecal, gboolean can_recur_events_italic, GCancellable *cancellable) { - struct calendar_tag_closure c; + struct calendar_tag_closure closure; g_return_if_fail (E_IS_CALENDAR (ecal)); g_return_if_fail (E_IS_CAL_COMPONENT (comp)); @@ -249,23 +248,30 @@ tag_calendar_by_comp (ECalendar *ecal, if (!gtk_widget_get_visible (GTK_WIDGET (ecal))) return; - if (!prepare_tag (ecal, &c, display_zone, clear_first)) + if (!prepare_tag (ecal, &closure, display_zone, clear_first)) return; - c.skip_transparent_events = FALSE; - c.recur_events_italic = can_recur_events_italic && get_recur_events_italic (); + closure.skip_transparent_events = FALSE; + closure.recur_events_italic = + can_recur_events_italic && get_recur_events_italic (); if (comp_is_on_server) { - struct calendar_tag_closure *closure = g_new0 (struct calendar_tag_closure, 1); + struct calendar_tag_closure *alloced_closure; + + alloced_closure = g_new0 (struct calendar_tag_closure, 1); - *closure = c; + *alloced_closure = closure; e_cal_client_generate_instances_for_object ( client, e_cal_component_get_icalcomponent (comp), - c.start_time, c.end_time, cancellable, tag_calendar_cb, closure, g_free); + closure.start_time, closure.end_time, cancellable, + (ECalRecurInstanceFn) tag_calendar_cb, + alloced_closure, (GDestroyNotify) g_free); } else e_cal_recur_generate_instances ( - comp, c.start_time, c.end_time, - tag_calendar_cb, &c, resolve_tzid_cb, - client, c.zone); + comp, closure.start_time, closure.end_time, + (ECalRecurInstanceFn) tag_calendar_cb, + &closure, + (ECalRecurResolveTimezoneFn) resolve_tzid_cb, + client, closure.zone); } diff --git a/calendar/gui/weekday-picker.c b/calendar/gui/weekday-picker.c index a06b249ee5..eaed5cc5ec 100644 --- a/calendar/gui/weekday-picker.c +++ b/calendar/gui/weekday-picker.c @@ -36,6 +36,10 @@ #define PADDING 2 +#define WEEKDAY_PICKER_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), TYPE_WEEKDAY_PICKER, WeekdayPickerPrivate)) + /* Private part of the WeekdayPicker structure */ struct _WeekdayPickerPrivate { /* Selected days; see weekday_picker_set_days() */ @@ -184,25 +188,6 @@ configure_items (WeekdayPicker *wp) } static void -weekday_picker_dispose (GObject *object) -{ - WeekdayPicker *wp; - WeekdayPickerPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_WEEKDAY_PICKER (object)); - - wp = WEEKDAY_PICKER (object); - priv = wp->priv; - - g_free (priv); - wp->priv = NULL; - - /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (weekday_picker_parent_class)->dispose (object); -} - -static void weekday_picker_realize (GtkWidget *widget) { WeekdayPicker *wp; @@ -351,11 +336,9 @@ weekday_picker_focus (GtkWidget *widget, static void weekday_picker_class_init (WeekdayPickerClass *class) { - GObjectClass *object_class; GtkWidgetClass *widget_class; - object_class = G_OBJECT_CLASS (class); - object_class->dispose = weekday_picker_dispose; + g_type_class_add_private (class, sizeof (WeekdayPickerPrivate)); widget_class = GTK_WIDGET_CLASS (class); widget_class->realize = weekday_picker_realize; @@ -369,7 +352,7 @@ weekday_picker_class_init (WeekdayPickerClass *class) wp_signals[CHANGED] = g_signal_new ( "changed", - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (WeekdayPickerClass, changed), NULL, NULL, @@ -487,26 +470,26 @@ create_items (WeekdayPicker *wp) priv->boxes[i] = gnome_canvas_item_new (parent, GNOME_TYPE_CANVAS_RECT, NULL); - g_signal_connect (priv->boxes[i], "event", G_CALLBACK (day_event_cb), wp); + g_signal_connect ( + priv->boxes[i], "event", + G_CALLBACK (day_event_cb), wp); priv->labels[i] = gnome_canvas_item_new (parent, GNOME_TYPE_CANVAS_TEXT, NULL); - g_signal_connect (priv->labels[i], "event", G_CALLBACK (day_event_cb), wp); + g_signal_connect ( + priv->labels[i], "event", + G_CALLBACK (day_event_cb), wp); } } static void weekday_picker_init (WeekdayPicker *wp) { - WeekdayPickerPrivate *priv; - - priv = g_new0 (WeekdayPickerPrivate, 1); - - wp->priv = priv; + wp->priv = WEEKDAY_PICKER_GET_PRIVATE (wp); create_items (wp); - priv->focus_day = -1; + wp->priv->focus_day = -1; } /** @@ -535,14 +518,9 @@ void weekday_picker_set_days (WeekdayPicker *wp, guint8 day_mask) { - WeekdayPickerPrivate *priv; - - g_return_if_fail (wp != NULL); g_return_if_fail (IS_WEEKDAY_PICKER (wp)); - priv = wp->priv; - - priv->day_mask = day_mask; + wp->priv->day_mask = day_mask; colorize_items (wp); g_signal_emit (G_OBJECT (wp), wp_signals[CHANGED], 0); @@ -560,13 +538,9 @@ weekday_picker_set_days (WeekdayPicker *wp, guint8 weekday_picker_get_days (WeekdayPicker *wp) { - WeekdayPickerPrivate *priv; - - g_return_val_if_fail (wp != NULL, 0); g_return_val_if_fail (IS_WEEKDAY_PICKER (wp), 0); - priv = wp->priv; - return priv->day_mask; + return wp->priv->day_mask; } /** @@ -582,13 +556,9 @@ void weekday_picker_set_blocked_days (WeekdayPicker *wp, guint8 blocked_day_mask) { - WeekdayPickerPrivate *priv; - - g_return_if_fail (wp != NULL); g_return_if_fail (IS_WEEKDAY_PICKER (wp)); - priv = wp->priv; - priv->blocked_day_mask = blocked_day_mask; + wp->priv->blocked_day_mask = blocked_day_mask; } /** @@ -604,13 +574,9 @@ weekday_picker_set_blocked_days (WeekdayPicker *wp, guint weekday_picker_get_blocked_days (WeekdayPicker *wp) { - WeekdayPickerPrivate *priv; - - g_return_val_if_fail (wp != NULL, 0); g_return_val_if_fail (IS_WEEKDAY_PICKER (wp), 0); - priv = wp->priv; - return priv->blocked_day_mask; + return wp->priv->blocked_day_mask; } /** @@ -625,14 +591,10 @@ void weekday_picker_set_week_start_day (WeekdayPicker *wp, gint week_start_day) { - WeekdayPickerPrivate *priv; - - g_return_if_fail (wp != NULL); g_return_if_fail (IS_WEEKDAY_PICKER (wp)); g_return_if_fail (week_start_day >= 0 && week_start_day < 7); - priv = wp->priv; - priv->week_start_day = week_start_day; + wp->priv->week_start_day = week_start_day; configure_items (wp); } @@ -649,12 +611,8 @@ weekday_picker_set_week_start_day (WeekdayPicker *wp, gint weekday_picker_get_week_start_day (WeekdayPicker *wp) { - WeekdayPickerPrivate *priv; - - g_return_val_if_fail (wp != NULL, -1); g_return_val_if_fail (IS_WEEKDAY_PICKER (wp), -1); - priv = wp->priv; - return priv->week_start_day; + return wp->priv->week_start_day; } diff --git a/calendar/importers/icalendar-importer.c b/calendar/importers/icalendar-importer.c index 3887780ed7..9432bc3256 100644 --- a/calendar/importers/icalendar-importer.c +++ b/calendar/importers/icalendar-importer.c @@ -317,7 +317,9 @@ ivcal_getwidget (EImport *ei, primary = e_source_list_peek_source_any (source_list); e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (selector), primary); - g_signal_connect (selector, "primary_selection_changed", G_CALLBACK (primary_selection_changed_cb), target); + g_signal_connect ( + selector, "primary_selection_changed", + G_CALLBACK (primary_selection_changed_cb), target); rb = gtk_radio_button_new_with_label (group, _(import_type_strings[i])); gtk_box_pack_start (GTK_BOX (hbox), rb, FALSE, FALSE, 6); @@ -1038,12 +1040,16 @@ gnome_calendar_getwidget (EImport *ei, w = gtk_check_button_new_with_label (_("Calendar Events")); gtk_toggle_button_set_active ((GtkToggleButton *) w, !done_cal); - g_signal_connect (w, "toggled", G_CALLBACK (calendar_toggle_cb), target); + g_signal_connect ( + w, "toggled", + G_CALLBACK (calendar_toggle_cb), target); gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0); w = gtk_check_button_new_with_label (_("Tasks")); gtk_toggle_button_set_active ((GtkToggleButton *) w, !done_tasks); - g_signal_connect (w, "toggled", G_CALLBACK (tasks_toggle_cb), target); + g_signal_connect ( + w, "toggled", + G_CALLBACK (tasks_toggle_cb), target); gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0); gtk_widget_show_all (hbox); @@ -1511,7 +1517,9 @@ ical_get_preview (icalcomponent *icalcomp) selection = gtk_tree_view_get_selection (tree_view); gtk_tree_selection_select_iter (selection, &iter); - g_signal_connect (selection, "changed", G_CALLBACK (preview_selection_changed_cb), preview); + g_signal_connect ( + selection, "changed", + G_CALLBACK (preview_selection_changed_cb), preview); preview_selection_changed_cb (selection, E_WEB_VIEW_PREVIEW (preview)); |