diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-09-27 13:13:42 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-09-27 21:31:13 +0800 |
commit | e2b6ff7a6c1e1580c26ee0719b349151e8dad6fd (patch) | |
tree | d2d2ce8eb509717d412ad3171059e470ff0e7030 /calendar | |
parent | c520043a094d81d222aa0c3e23b0035ddb89d0bf (diff) | |
download | gsoc2013-evolution-e2b6ff7a6c1e1580c26ee0719b349151e8dad6fd.tar.gz gsoc2013-evolution-e2b6ff7a6c1e1580c26ee0719b349151e8dad6fd.tar.zst gsoc2013-evolution-e2b6ff7a6c1e1580c26ee0719b349151e8dad6fd.zip |
Miscellaneous cleanups from the account-mgmt branch.
Reducing diff noise so I can see important changes easier when comparing
branches. A few API changes, but nothing that affects functionality.
Diffstat (limited to 'calendar')
29 files changed, 419 insertions, 333 deletions
diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c index 3256e39780..e612b0c56c 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -37,6 +37,10 @@ #include "alarm-queue.h" #include "config-data.h" +#define ALARM_NOTIFY_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), TYPE_ALARM_NOTIFY, AlarmNotifyPrivate)) + #define APPLICATION_ID "org.gnome.EvolutionAlarmNotify" struct _AlarmNotifyPrivate { @@ -55,7 +59,13 @@ typedef struct { GList *removals; } ProcessRemovalsData; -G_DEFINE_TYPE (AlarmNotify, alarm_notify, GTK_TYPE_APPLICATION) +/* Forward Declarations */ +static void alarm_notify_initable_init (GInitableIface *interface); + +G_DEFINE_TYPE_WITH_CODE ( + AlarmNotify, alarm_notify, GTK_TYPE_APPLICATION, + G_IMPLEMENT_INTERFACE ( + G_TYPE_INITABLE, alarm_notify_initable_init)) static void process_removal_in_hash (const gchar *uri, @@ -212,7 +222,7 @@ alarm_notify_finalize (GObject *object) AlarmNotifyPrivate *priv; gint ii; - priv = ALARM_NOTIFY (object)->priv; + priv = ALARM_NOTIFY_GET_PRIVATE (object); for (ii = 0; ii < E_CAL_CLIENT_SOURCE_TYPE_LAST; ii++) { g_hash_table_foreach ( @@ -264,6 +274,15 @@ alarm_notify_activate (GApplication *application) * if there are no handlers connected to this signal. */ } +static gboolean +alarm_notify_initable (GInitable *initable, + GCancellable *cancellable, + GError **error) +{ + /* XXX Just return TRUE for now. We'll have use for this soon. */ + return TRUE; +} + static void alarm_notify_class_init (AlarmNotifyClass *class) { @@ -281,12 +300,18 @@ alarm_notify_class_init (AlarmNotifyClass *class) } static void +alarm_notify_initable_init (GInitableIface *interface) +{ + /* XXX Awkward name since we're missing an 'E' prefix. */ + interface->init = alarm_notify_initable; +} + +static void alarm_notify_init (AlarmNotify *an) { gint ii; - an->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - an, TYPE_ALARM_NOTIFY, AlarmNotifyPrivate); + an->priv = ALARM_NOTIFY_GET_PRIVATE (an); an->priv->mutex = g_mutex_new (); an->priv->selected_calendars = config_data_get_calendars ( "/apps/evolution/calendar/sources"); @@ -317,10 +342,11 @@ alarm_notify_get_selected_calendars (AlarmNotify *an) * Returns: a newly-created #AlarmNotify **/ AlarmNotify * -alarm_notify_new (void) +alarm_notify_new (GCancellable *cancellable, + GError **error) { - return g_object_new ( - TYPE_ALARM_NOTIFY, + return g_initable_new ( + TYPE_ALARM_NOTIFY, cancellable, error, "application-id", APPLICATION_ID, NULL); } diff --git a/calendar/gui/alarm-notify/alarm-notify.h b/calendar/gui/alarm-notify/alarm-notify.h index 51837d21d5..f95a4d6b33 100644 --- a/calendar/gui/alarm-notify/alarm-notify.h +++ b/calendar/gui/alarm-notify/alarm-notify.h @@ -65,7 +65,8 @@ struct _AlarmNotifyClass { }; GType alarm_notify_get_type (void); -AlarmNotify * alarm_notify_new (void); +AlarmNotify * alarm_notify_new (GCancellable *cancellable, + GError **error); void alarm_notify_add_calendar (AlarmNotify *an, ECalClientSourceType source_type, ESource *source, diff --git a/calendar/gui/alarm-notify/notify-main.c b/calendar/gui/alarm-notify/notify-main.c index 225dde4c26..b1775d8d23 100644 --- a/calendar/gui/alarm-notify/notify-main.c +++ b/calendar/gui/alarm-notify/notify-main.c @@ -27,6 +27,7 @@ #include <config.h> #endif +#include <stdlib.h> #include <glib/gi18n.h> #include "alarm-notify.h" @@ -50,6 +51,7 @@ main (gint argc, { AlarmNotify *alarm_notify_service; gint exit_status; + GError *error = NULL; #ifdef G_OS_WIN32 gchar *path; @@ -87,7 +89,13 @@ main (gint argc, g_warning ("Could not set PATH for Evolution Alarm Notifier"); #endif - alarm_notify_service = alarm_notify_new (); + alarm_notify_service = alarm_notify_new (NULL, &error); + + if (error != NULL) { + g_printerr ("%s\n", error->message); + g_error_free (error); + exit (EXIT_FAILURE); + } exit_status = g_application_run ( G_APPLICATION (alarm_notify_service), argc, argv); diff --git a/calendar/gui/dialogs/alarm-dialog.h b/calendar/gui/dialogs/alarm-dialog.h index d99d47f15f..42c72d685a 100644 --- a/calendar/gui/dialogs/alarm-dialog.h +++ b/calendar/gui/dialogs/alarm-dialog.h @@ -35,7 +35,9 @@ G_BEGIN_DECLS -gboolean alarm_dialog_run (GtkWidget *parent, ECalClient *cal_client, ECalComponentAlarm *alarm); +gboolean alarm_dialog_run (GtkWidget *parent, + ECalClient *cal_client, + ECalComponentAlarm *alarm); G_END_DECLS diff --git a/calendar/gui/dialogs/alarm-list-dialog.h b/calendar/gui/dialogs/alarm-list-dialog.h index 163582c556..5746664c1f 100644 --- a/calendar/gui/dialogs/alarm-list-dialog.h +++ b/calendar/gui/dialogs/alarm-list-dialog.h @@ -36,9 +36,13 @@ G_BEGIN_DECLS -gboolean alarm_list_dialog_run (GtkWidget *parent, ECalClient *cal_client, EAlarmList *list_store); -GtkWidget *alarm_list_dialog_peek (ECalClient *cal_client, EAlarmList *list_store); -void alarm_list_dialog_set_client (GtkWidget *dlg_box, ECalClient *cal_client); +gboolean alarm_list_dialog_run (GtkWidget *parent, + ECalClient *cal_client, + EAlarmList *list_store); +GtkWidget * alarm_list_dialog_peek (ECalClient *cal_client, + EAlarmList *list_store); +void alarm_list_dialog_set_client (GtkWidget *dlg_box, + ECalClient *cal_client); G_END_DECLS diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 42b8acef63..27427540b6 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -3243,6 +3243,7 @@ real_send_comp (CompEditor *editor, g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); priv = editor->priv; + flags = comp_editor_get_flags (editor); if (priv->mod == CALOBJ_MOD_ALL && e_cal_component_is_instance (priv->comp)) { diff --git a/calendar/gui/dialogs/copy-source-dialog.h b/calendar/gui/dialogs/copy-source-dialog.h index d9475f742c..5ac51406de 100644 --- a/calendar/gui/dialogs/copy-source-dialog.h +++ b/calendar/gui/dialogs/copy-source-dialog.h @@ -27,10 +27,12 @@ #define COPY_SOURCE_DIALOG_H #include <gtk/gtk.h> -#include <libedataserver/e-source.h> -#include <libecal/e-cal-client.h> #include <libecal/e-cal-util.h> +#include <libecal/e-cal-client.h> +#include <libedataserver/e-source.h> -void copy_source_dialog (GtkWindow *parent, ESource *source, ECalClientSourceType type); +void copy_source_dialog (GtkWindow *parent, + ESource *source, + ECalClientSourceType type); -#endif +#endif /* COPY_SOURCE_DIALOG_H */ diff --git a/calendar/gui/dialogs/e-delegate-dialog.c b/calendar/gui/dialogs/e-delegate-dialog.c index af61f807a8..fc7ae7d121 100644 --- a/calendar/gui/dialogs/e-delegate-dialog.c +++ b/calendar/gui/dialogs/e-delegate-dialog.c @@ -124,7 +124,6 @@ e_delegate_dialog_construct (EDelegateDialog *edd, ENameSelectorModel *name_selector_model; ENameSelectorDialog *name_selector_dialog; - g_return_val_if_fail (edd != NULL, NULL); g_return_val_if_fail (E_IS_DELEGATE_DIALOG (edd), NULL); priv = edd->priv; @@ -228,8 +227,10 @@ e_delegate_dialog_new (const gchar *name, { EDelegateDialog *edd; - edd = E_DELEGATE_DIALOG (g_object_new (E_TYPE_DELEGATE_DIALOG, NULL)); - return e_delegate_dialog_construct (E_DELEGATE_DIALOG (edd), name, address); + edd = g_object_new (E_TYPE_DELEGATE_DIALOG, NULL); + + return e_delegate_dialog_construct ( + E_DELEGATE_DIALOG (edd), name, address); } gchar * diff --git a/calendar/gui/dialogs/e-delegate-dialog.h b/calendar/gui/dialogs/e-delegate-dialog.h index 032901c8bc..5fb672bd5e 100644 --- a/calendar/gui/dialogs/e-delegate-dialog.h +++ b/calendar/gui/dialogs/e-delegate-dialog.h @@ -21,28 +21,38 @@ * */ -#ifndef __E_DELEGATE_DIALOG_H__ -#define __E_DELEGATE_DIALOG_H__ +#ifndef E_DELEGATE_DIALOG_H +#define E_DELEGATE_DIALOG_H #include <gtk/gtk.h> - - -#define E_TYPE_DELEGATE_DIALOG (e_delegate_dialog_get_type ()) -#define E_DELEGATE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_DELEGATE_DIALOG, EDelegateDialog)) -#define E_DELEGATE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_DELEGATE_DIALOG, \ - EDelegateDialogClass)) -#define E_IS_DELEGATE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_DELEGATE_DIALOG)) -#define E_IS_DELEGATE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_DELEGATE_DIALOG)) - -typedef struct _EDelegateDialog EDelegateDialog; -typedef struct _EDelegateDialogClass EDelegateDialogClass; -typedef struct _EDelegateDialogPrivate EDelegateDialogPrivate; +/* Standard GObject macros */ +#define E_TYPE_DELEGATE_DIALOG \ + (e_delegate_dialog_get_type ()) +#define E_DELEGATE_DIALOG(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_DELEGATE_DIALOG, EDelegateDialog)) +#define E_DELEGATE_DIALOG_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_DELEGATE_DIALOG, EDelegateDialogClass)) +#define E_IS_DELEGATE_DIALOG(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_DELEGATE_DIALOG)) +#define E_IS_DELEGATE_DIALOG_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_DELEGATE_DIALOG)) +#define E_DELEGATE_DIALOG_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_DELEGATE_DIALOG, EDelegateDialogClass)) + +G_BEGIN_DECLS + +typedef struct _EDelegateDialog EDelegateDialog; +typedef struct _EDelegateDialogClass EDelegateDialogClass; +typedef struct _EDelegateDialogPrivate EDelegateDialogPrivate; struct _EDelegateDialog { GObject object; - - /* Private data */ EDelegateDialogPrivate *priv; }; @@ -50,24 +60,21 @@ struct _EDelegateDialogClass { GObjectClass parent_class; }; -GType e_delegate_dialog_get_type (void); - -EDelegateDialog * e_delegate_dialog_construct (EDelegateDialog *etd, - const gchar *name, - const gchar *address); - -EDelegateDialog * e_delegate_dialog_new (const gchar *name, - const gchar *address); - -gchar * e_delegate_dialog_get_delegate (EDelegateDialog *etd); - -gchar * e_delegate_dialog_get_delegate_name (EDelegateDialog *etd); - -void e_delegate_dialog_set_delegate (EDelegateDialog *etd, - const gchar *address); - -GtkWidget * e_delegate_dialog_get_toplevel (EDelegateDialog *etd); - - - -#endif /* __E_DELEGATE_DIALOG_H__ */ +GType e_delegate_dialog_get_type (void); +EDelegateDialog * + e_delegate_dialog_construct (EDelegateDialog *etd, + const gchar *name, + const gchar *address); +EDelegateDialog * + e_delegate_dialog_new (const gchar *name, + const gchar *address); +gchar * e_delegate_dialog_get_delegate (EDelegateDialog *etd); +gchar * e_delegate_dialog_get_delegate_name + (EDelegateDialog *etd); +void e_delegate_dialog_set_delegate (EDelegateDialog *etd, + const gchar *address); +GtkWidget * e_delegate_dialog_get_toplevel (EDelegateDialog *etd); + +G_END_DECLS + +#endif /* E_DELEGATE_DIALOG_H */ diff --git a/calendar/gui/dialogs/e-send-options-utils.c b/calendar/gui/dialogs/e-send-options-utils.c index f8e933574c..780554812d 100644 --- a/calendar/gui/dialogs/e-send-options-utils.c +++ b/calendar/gui/dialogs/e-send-options-utils.c @@ -28,6 +28,7 @@ #include "e-send-options-utils.h" +#include <stdlib.h> #include <string.h> void diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index f89b67056d..29352642e7 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -730,8 +730,9 @@ event_editor_send_comp (CompEditor *editor, gboolean result; client = e_meeting_store_get_client (priv->model); - result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, - client, NULL, NULL, NULL, strip_alarms, FALSE); + result = itip_send_comp ( + E_CAL_COMPONENT_METHOD_CANCEL, comp, + client, NULL, NULL, NULL, strip_alarms, FALSE); g_object_unref (comp); if (!result) diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 653f0215ac..e92c9872d0 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -2916,11 +2916,12 @@ epage_client_opened_cb (GObject *source_object, E_SOURCE_COMBO_BOX (priv->source_selector), e_client_get_source (E_CLIENT (old_client))); - dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, - GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - _("Unable to open the calendar '%s': %s"), - e_source_peek_name (source), - error ? error->message : _("Unknown error")); + dialog = gtk_message_dialog_new ( + NULL, GTK_DIALOG_MODAL, + GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, + _("Unable to open the calendar '%s': %s"), + e_source_peek_name (source), + error->message); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); @@ -2952,7 +2953,8 @@ epage_client_opened_cb (GObject *source_object, sensitize_widgets (epage); - alarm_list_dialog_set_client (priv->alarm_list_dlg_widget, cal_client); + alarm_list_dialog_set_client ( + priv->alarm_list_dlg_widget, cal_client); } } diff --git a/calendar/gui/dialogs/select-source-dialog.h b/calendar/gui/dialogs/select-source-dialog.h index 6d64fb825a..2ef8e0e625 100644 --- a/calendar/gui/dialogs/select-source-dialog.h +++ b/calendar/gui/dialogs/select-source-dialog.h @@ -30,6 +30,8 @@ #include <libedataserver/e-source.h> #include <libecal/e-cal-client.h> -ESource *select_source_dialog (GtkWindow *parent, ECalClientSourceType type, ESource *except_source); +ESource * select_source_dialog (GtkWindow *parent, + ECalClientSourceType type, + ESource *except_source); #endif diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 31593e0a04..1942224f7f 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -472,8 +472,9 @@ task_editor_send_comp (CompEditor *editor, gboolean result; client = e_meeting_store_get_client (priv->model); - result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, - client, NULL, NULL, NULL, strip_alarms, FALSE); + result = itip_send_comp ( + E_CAL_COMPONENT_METHOD_CANCEL, comp, + client, NULL, NULL, NULL, strip_alarms, FALSE); g_object_unref (comp); if (!result) diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index e0aa030358..05f1f87c05 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -1758,11 +1758,12 @@ tpage_client_opened_cb (GObject *source_object, E_SOURCE_COMBO_BOX (priv->source_selector), e_client_get_source (E_CLIENT (old_client))); - dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, - GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - _("Unable to open tasks in '%s': %s"), - e_source_peek_name (source), - error ? error->message : _("Unknown error")); + dialog = gtk_message_dialog_new ( + NULL, GTK_DIALOG_MODAL, + GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, + _("Unable to open tasks in '%s': %s"), + e_source_peek_name (source), + error->message); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); diff --git a/calendar/gui/e-cal-model-calendar.c b/calendar/gui/e-cal-model-calendar.c index 1254a8711b..6a1493f01a 100644 --- a/calendar/gui/e-cal-model-calendar.c +++ b/calendar/gui/e-cal-model-calendar.c @@ -369,8 +369,10 @@ ecmc_set_value_at (ETableModel *etm, } } - itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, send_comp ? send_comp : comp, - comp_data->client, NULL, NULL, NULL, strip_alarms, FALSE); + itip_send_comp ( + E_CAL_COMPONENT_METHOD_REQUEST, + send_comp ? send_comp : comp, comp_data->client, + NULL, NULL, NULL, strip_alarms, FALSE); if (send_comp) g_object_unref (send_comp); diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 637d0f504e..4428d31cbd 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -1609,6 +1609,7 @@ ecm_get_color_for_component (ECalModel *model, ESource *source; const gchar *color_spec; gint i, first_empty = 0; + static AssignedColorData assigned_colors[] = { { "#BECEDD", NULL }, /* 190 206 221 Blue */ { "#E2F0EF", NULL }, /* 226 240 239 Light Blue */ @@ -1650,8 +1651,9 @@ ecm_get_color_for_component (ECalModel *model, } /* return the first unused color */ - assigned_colors[first_empty].uris = g_list_append (assigned_colors[first_empty].uris, - g_strdup (e_client_get_uri (E_CLIENT (comp_data->client)))); + assigned_colors[first_empty].uris = g_list_append ( + assigned_colors[first_empty].uris, + g_strdup (e_client_get_uri (E_CLIENT (comp_data->client)))); return assigned_colors[first_empty].color; } @@ -2039,7 +2041,7 @@ e_cal_model_get_client_list (ECalModel *model) /** * e_cal_model_get_client_for_uri: - * @model: A calendar model. + * @model: an #ECalModel * @uri: Uri for the client to get. */ ECalClient * @@ -2123,8 +2125,8 @@ search_by_id_and_client (ECalModelPrivate *priv, static void remove_all_for_id_and_client (ECalModel *model, - ECalClient *client, - const ECalComponentId *id) + ECalClient *client, + const ECalComponentId *id) { ECalModelComponent *comp_data; @@ -2883,13 +2885,15 @@ client_opened_cb (GObject *source_object, } if (error != NULL) { - const gchar *uri; + ESource *source; - uri = e_client_get_uri (E_CLIENT (client)); + source = e_client_get_source (E_CLIENT (client)); e_cal_model_remove_client (model, client); g_warning ( "%s: Failed to open '%s': %s", - G_STRFUNC, uri, error->message); + G_STRFUNC, + e_source_peek_name (source), + error->message); g_error_free (error); e_cal_model_update_status_message (model, NULL, -1.0); return; @@ -2958,9 +2962,13 @@ add_new_client (ECalModel *model, if (e_client_is_opened (E_CLIENT (client))) { update_e_cal_view_for_client (model, client_data); } else { + ESource *source; + const gchar *display_name; gchar *msg; - msg = g_strdup_printf (_("Opening %s"), e_client_get_uri (E_CLIENT (client))); + source = e_client_get_source (E_CLIENT (client)); + display_name = e_source_peek_name (source); + msg = g_strdup_printf (_("Opening %s"), display_name); e_cal_model_update_status_message (model, msg, -1.0); g_free (msg); @@ -3388,6 +3396,91 @@ e_cal_model_create_component_with_defaults (ECalModel *model, } /** + * Returns information about attendees in the component. + * If there are no attendees, the function returns NULL. + * + * The information is like "Status: Accepted: X Declined: Y ...". + * + * Free returned pointer with g_free. + **/ +gchar * +e_cal_model_get_attendees_status_info (ECalModel *model, + ECalComponent *comp, + ECalClient *cal_client) +{ + struct _values { + icalparameter_partstat status; + const gchar *caption; + gint count; + } values[] = { + { ICAL_PARTSTAT_ACCEPTED, N_("Accepted"), 0 }, + { ICAL_PARTSTAT_DECLINED, N_("Declined"), 0 }, + { ICAL_PARTSTAT_TENTATIVE, N_("Tentative"), 0 }, + { ICAL_PARTSTAT_DELEGATED, N_("Delegated"), 0 }, + { ICAL_PARTSTAT_NEEDSACTION, N_("Needs action"), 0 }, + { ICAL_PARTSTAT_NONE, N_("Other"), 0 }, + { ICAL_PARTSTAT_X, NULL, -1 } + }; + + GSList *attendees = NULL, *a; + gboolean have = FALSE; + gchar *res = NULL; + gint i; + + g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL); + + if (!comp || !e_cal_component_has_attendees (comp) || + !itip_organizer_is_user_ex (comp, cal_client, TRUE)) + return NULL; + + e_cal_component_get_attendee_list (comp, &attendees); + + for (a = attendees; a; a = a->next) { + ECalComponentAttendee *att = a->data; + + if (att && att->cutype == ICAL_CUTYPE_INDIVIDUAL && + (att->role == ICAL_ROLE_CHAIR || + att->role == ICAL_ROLE_REQPARTICIPANT || + att->role == ICAL_ROLE_OPTPARTICIPANT)) { + have = TRUE; + + for (i = 0; values[i].count != -1; i++) { + if (att->status == values[i].status || values[i].status == ICAL_PARTSTAT_NONE) { + values[i].count++; + break; + } + } + } + } + + if (have) { + GString *str = g_string_new (""); + + for (i = 0; values[i].count != -1; i++) { + if (values[i].count > 0) { + if (str->str && *str->str) + g_string_append (str, " "); + + g_string_append_printf (str, "%s: %d", _(values[i].caption), values[i].count); + } + } + + g_string_prepend (str, ": "); + + /* To Translators: 'Status' here means the state of the attendees, the resulting string will be in a form: + * Status: Accepted: X Declined: Y ... */ + g_string_prepend (str, _("Status")); + + res = g_string_free (str, FALSE); + } + + if (attendees) + e_cal_component_free_attendee_list (attendees); + + return res; +} + +/** * e_cal_model_get_color_for_component */ const gchar * diff --git a/calendar/gui/e-cal-model.h b/calendar/gui/e-cal-model.h index a514c95ab2..6dd04675ed 100644 --- a/calendar/gui/e-cal-model.h +++ b/calendar/gui/e-cal-model.h @@ -263,6 +263,10 @@ void e_cal_model_set_search_query (ECalModel *model, icalcomponent * e_cal_model_create_component_with_defaults (ECalModel *model, gboolean all_day); +gchar * e_cal_model_get_attendees_status_info + (ECalModel *model, + ECalComponent *comp, + ECalClient *cal_client); const gchar * e_cal_model_get_color_for_component (ECalModel *model, ECalModelComponent *comp_data); diff --git a/calendar/gui/e-calendar-selector.c b/calendar/gui/e-calendar-selector.c index c71e3b99aa..989391625b 100644 --- a/calendar/gui/e-calendar-selector.c +++ b/calendar/gui/e-calendar-selector.c @@ -26,13 +26,17 @@ #include <libecal/e-cal-client.h> #include <libedataserverui/e-client-utils.h> + #include "e-util/e-selection.h" struct _ECalendarSelectorPrivate { gint dummy_value; }; -static gpointer parent_class; +G_DEFINE_TYPE ( + ECalendarSelector, + e_calendar_selector, + E_TYPE_SOURCE_SELECTOR) static gboolean calendar_selector_update_single_object (ECalClient *client, @@ -170,7 +174,8 @@ calendar_selector_data_dropped (ESourceSelector *selector, icalcomponent_set_uid (icalcomp, uid); } - e_client_utils_open_new (destination, E_CLIENT_SOURCE_TYPE_EVENTS, FALSE, NULL, + e_client_utils_open_new ( + destination, E_CLIENT_SOURCE_TYPE_EVENTS, FALSE, NULL, e_client_utils_authenticate_handler, NULL, client_opened_cb, icalcomp); @@ -187,11 +192,10 @@ exit: } static void -calendar_selector_class_init (ECalendarSelectorClass *class) +e_calendar_selector_class_init (ECalendarSelectorClass *class) { ESourceSelectorClass *source_selector_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ECalendarSelectorPrivate)); source_selector_class = E_SOURCE_SELECTOR_CLASS (class); @@ -199,7 +203,7 @@ calendar_selector_class_init (ECalendarSelectorClass *class) } static void -calendar_selector_init (ECalendarSelector *selector) +e_calendar_selector_init (ECalendarSelector *selector) { selector->priv = G_TYPE_INSTANCE_GET_PRIVATE ( selector, E_TYPE_CALENDAR_SELECTOR, ECalendarSelectorPrivate); @@ -211,33 +215,6 @@ calendar_selector_init (ECalendarSelector *selector) e_drag_dest_add_calendar_targets (GTK_WIDGET (selector)); } -GType -e_calendar_selector_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (ECalendarSelectorClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) calendar_selector_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ECalendarSelector), - 0, /* n_preallocs */ - (GInstanceInitFunc) calendar_selector_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_SOURCE_SELECTOR, "ECalendarSelector", - &type_info, 0); - } - - return type; -} - GtkWidget * e_calendar_selector_new (ESourceList *source_list) { diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index b70df8b019..84046e7aac 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -218,12 +218,15 @@ calendar_view_delete_event (ECalendarView *cal_view, const gchar *uid; gchar *rid = NULL; - if ((itip_organizer_is_user (comp, event->comp_data->client) || itip_sentby_is_user (comp, event->comp_data->client)) + if ((itip_organizer_is_user (comp, event->comp_data->client) || + itip_sentby_is_user (comp, event->comp_data->client)) && cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)), event->comp_data->client, comp, TRUE)) - itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, - event->comp_data->client, NULL, NULL, NULL, TRUE, FALSE); + itip_send_comp ( + E_CAL_COMPONENT_METHOD_CANCEL, + comp, event->comp_data->client, NULL, NULL, + NULL, TRUE, FALSE); e_cal_component_get_uid (comp, &uid); if (!uid || !*uid) { @@ -473,11 +476,14 @@ calendar_view_cut_clipboard (ESelectable *selectable) comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - if ((itip_organizer_is_user (comp, event->comp_data->client) || itip_sentby_is_user (comp, event->comp_data->client)) + if ((itip_organizer_is_user (comp, event->comp_data->client) || + itip_sentby_is_user (comp, event->comp_data->client)) && cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)), event->comp_data->client, comp, TRUE)) - itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, - event->comp_data->client, NULL, NULL, NULL, TRUE, FALSE); + itip_send_comp ( + E_CAL_COMPONENT_METHOD_CANCEL, + comp, event->comp_data->client, NULL, NULL, + NULL, TRUE, FALSE); e_cal_component_get_uid (comp, &uid); if (e_cal_component_is_instance (comp)) { @@ -1058,11 +1064,16 @@ e_calendar_view_add_event (ECalendarView *cal_view, g_free (uid); } - if ((itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp, client)) && - send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)), - client, comp, TRUE, &strip_alarms, NULL)) { - itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, - client, NULL, NULL, NULL, strip_alarms, FALSE); + if ((itip_organizer_is_user (comp, client) || + itip_sentby_is_user (comp, client)) && + send_component_dialog ( + (GtkWindow *) gtk_widget_get_toplevel ( + GTK_WIDGET (cal_view)), + client, comp, TRUE, &strip_alarms, NULL)) { + itip_send_comp ( + E_CAL_COMPONENT_METHOD_REQUEST, + comp, client, NULL, NULL, NULL, strip_alarms, + FALSE); } } else { g_message (G_STRLOC ": Could not create the object! %s", error ? error->message : ""); @@ -1339,7 +1350,8 @@ e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view) e_cal_component_free_datetime (&dt); - if ((itip_organizer_is_user (comp, event->comp_data->client) || itip_sentby_is_user (comp, event->comp_data->client)) + if ((itip_organizer_is_user (comp, event->comp_data->client) || + itip_sentby_is_user (comp, event->comp_data->client)) && cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)), event->comp_data->client, comp, TRUE) && !e_cal_client_check_save_schedules (event->comp_data->client)) { @@ -1354,7 +1366,11 @@ e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view) e_cal_component_free_datetime (&range.datetime); } - itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, event->comp_data->client, NULL, NULL, NULL, TRUE, FALSE); + + itip_send_comp ( + E_CAL_COMPONENT_METHOD_CANCEL, + comp, event->comp_data->client, NULL, NULL, + NULL, TRUE, FALSE); } if (is_instance) @@ -1437,8 +1453,14 @@ e_calendar_view_new_appointment_for (ECalendarView *cal_view, if (e_client_is_readonly (E_CLIENT (default_client))) { GtkWidget *widget; + ESource *source; + + source = e_client_get_source (E_CLIENT (default_client)); - widget = e_alert_dialog_new_for_args (parent, "calendar:prompt-read-only-cal", e_source_peek_name (e_client_get_source (E_CLIENT (default_client))), NULL); + widget = e_alert_dialog_new_for_args ( + parent, "calendar:prompt-read-only-cal", + e_source_peek_name (source), + NULL); g_signal_connect ((GtkDialog *)widget, "response", G_CALLBACK (gtk_widget_destroy), widget); @@ -1653,7 +1675,9 @@ e_calendar_view_edit_appointment (ECalendarView *cal_view, ECalComponent *comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp)); flags |= COMP_EDITOR_MEETING; - if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp, client) || !e_cal_component_has_attendees (comp)) + if (itip_organizer_is_user (comp, client) || + itip_sentby_is_user (comp, client) || + !e_cal_component_has_attendees (comp)) flags |= COMP_EDITOR_USER_ORG; g_object_unref (comp); } @@ -1662,7 +1686,8 @@ e_calendar_view_edit_appointment (ECalendarView *cal_view, } void -e_calendar_view_modify_and_send (ECalComponent *comp, +e_calendar_view_modify_and_send (ECalendarView *cal_view, + ECalComponent *comp, ECalClient *client, CalObjModType mod, GtkWindow *toplevel, @@ -1671,12 +1696,15 @@ e_calendar_view_modify_and_send (ECalComponent *comp, gboolean only_new_attendees = FALSE; GError *error = NULL; + g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view)); + e_cal_component_commit_sequence (comp); if (e_cal_client_modify_object_sync (client, e_cal_component_get_icalcomponent (comp), mod, NULL, &error)) { gboolean strip_alarms = TRUE; - if ((itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp, client)) && + if ((itip_organizer_is_user (comp, client) || + itip_sentby_is_user (comp, client)) && send_component_dialog (toplevel, client, comp, new, &strip_alarms, &only_new_attendees)) { ECalComponent *send_comp = NULL; @@ -1699,7 +1727,10 @@ e_calendar_view_modify_and_send (ECalComponent *comp, } } - itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, send_comp ? send_comp : comp, client, NULL, NULL, NULL, strip_alarms, only_new_attendees); + itip_send_comp ( + E_CAL_COMPONENT_METHOD_REQUEST, + send_comp ? send_comp : comp, client, NULL, + NULL, NULL, strip_alarms, only_new_attendees); if (send_comp) g_object_unref (send_comp); @@ -1784,84 +1815,6 @@ e_calendar_view_move_tip (GtkWidget *widget, gtk_widget_show (widget); } -/** - * Returns information about attendees in the component. If no attendees, then returns NULL. - * The information is like "Status: Accepted: X Declined: Y ...". - * Free returned pointer with g_free. - **/ -gchar * -e_calendar_view_get_attendees_status_info (ECalComponent *comp, - ECalClient *client) -{ - struct _values { - icalparameter_partstat status; - const gchar *caption; - gint count; - } values[] = { - { ICAL_PARTSTAT_ACCEPTED, N_("Accepted"), 0 }, - { ICAL_PARTSTAT_DECLINED, N_("Declined"), 0 }, - { ICAL_PARTSTAT_TENTATIVE, N_("Tentative"), 0 }, - { ICAL_PARTSTAT_DELEGATED, N_("Delegated"), 0 }, - { ICAL_PARTSTAT_NEEDSACTION, N_("Needs action"), 0 }, - { ICAL_PARTSTAT_NONE, N_("Other"), 0 }, - { ICAL_PARTSTAT_X, NULL, -1 } - }; - - GSList *attendees = NULL, *a; - gboolean have = FALSE; - gchar *res = NULL; - gint i; - - if (!comp || !e_cal_component_has_attendees (comp) || !itip_organizer_is_user_ex (comp, client, TRUE)) - return NULL; - - e_cal_component_get_attendee_list (comp, &attendees); - - for (a = attendees; a; a = a->next) { - ECalComponentAttendee *att = a->data; - - if (att && att->cutype == ICAL_CUTYPE_INDIVIDUAL && - (att->role == ICAL_ROLE_CHAIR || - att->role == ICAL_ROLE_REQPARTICIPANT || - att->role == ICAL_ROLE_OPTPARTICIPANT)) { - have = TRUE; - - for (i = 0; values[i].count != -1; i++) { - if (att->status == values[i].status || values[i].status == ICAL_PARTSTAT_NONE) { - values[i].count++; - break; - } - } - } - } - - if (have) { - GString *str = g_string_new (""); - - for (i = 0; values[i].count != -1; i++) { - if (values[i].count > 0) { - if (str->str && *str->str) - g_string_append (str, " "); - - g_string_append_printf (str, "%s: %d", _(values[i].caption), values[i].count); - } - } - - g_string_prepend (str, ": "); - - /* To Translators: 'Status' here means the state of the attendees, the resulting string will be in a form: - * Status: Accepted: X Declined: Y ... */ - g_string_prepend (str, _("Status")); - - res = g_string_free (str, FALSE); - } - - if (attendees) - e_cal_component_free_attendee_list (attendees); - - return res; -} - /* * It is expected to show the tooltips in this below format * @@ -1873,7 +1826,8 @@ e_calendar_view_get_attendees_status_info (ECalComponent *comp, */ gboolean -e_calendar_view_get_tooltips (const ECalendarViewEventData *data) +e_calendar_view_get_tooltips (ECalendarView *cal_view, + const ECalendarViewEventData *data) { GtkWidget *label, *box, *hbox, *ebox, *frame; const gchar *str; @@ -1888,9 +1842,14 @@ e_calendar_view_get_tooltips (const ECalendarViewEventData *data) GdkWindow *window; ECalComponent *newcomp = e_cal_component_new (); icaltimezone *zone, *default_zone; + ECalModel *model; ECalClient *client = NULL; gboolean free_text = FALSE; + g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), FALSE); + + model = e_calendar_view_get_model (cal_view); + /* Delete any stray tooltip if left */ if (widget) gtk_widget_destroy (widget); @@ -2023,7 +1982,8 @@ e_calendar_view_get_tooltips (const ECalendarViewEventData *data) g_free (tmp2); g_free (tmp1); - tmp = e_calendar_view_get_attendees_status_info (newcomp, pevent->comp_data->client); + tmp = e_cal_model_get_attendees_status_info ( + model, newcomp, pevent->comp_data->client); if (tmp) { hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start ((GtkBox *) hbox, gtk_label_new (tmp), FALSE, FALSE, 0); diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h index decfdfffbf..7ebcef7d1c 100644 --- a/calendar/gui/e-calendar-view.h +++ b/calendar/gui/e-calendar-view.h @@ -235,18 +235,21 @@ void e_calendar_view_new_appointment_full gboolean meeting, gboolean no_past_date); void e_calendar_view_new_appointment (ECalendarView *cal_view); -void e_calendar_view_edit_appointment (ECalendarView *cal_view, +void e_calendar_view_edit_appointment + (ECalendarView *cal_view, ECalClient *client, icalcomponent *icalcomp, EEditEventMode mode); void e_calendar_view_open_event (ECalendarView *cal_view); -void e_calendar_view_modify_and_send (ECalComponent *comp, +void e_calendar_view_modify_and_send (ECalendarView *cal_view, + ECalComponent *comp, ECalClient *client, CalObjModType mod, GtkWindow *toplevel, gboolean new); -gboolean e_calendar_view_get_tooltips (const ECalendarViewEventData *data); +gboolean e_calendar_view_get_tooltips (ECalendarView *cal_view, + const ECalendarViewEventData *data); void e_calendar_view_move_tip (GtkWidget *widget, gint x, @@ -256,9 +259,6 @@ const gchar * e_calendar_view_get_icalcomponent_summary (ECalClient *ecal, icalcomponent *icalcomp, gboolean *free_text); -gchar * e_calendar_view_get_attendees_status_info - (ECalComponent *comp, - ECalClient *client); void e_calendar_view_emit_user_created (ECalendarView *cal_view); diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index efad7dbc6f..8af5ffb3fa 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -739,7 +739,9 @@ process_component (EDayView *day_view, /* Add the object */ add_event_data.day_view = day_view; add_event_data.comp_data = comp_data; - e_day_view_add_event (comp, comp_data->instance_start, comp_data->instance_end, &add_event_data); + e_day_view_add_event ( + comp, comp_data->instance_start, + comp_data->instance_end, &add_event_data); g_object_unref (comp); g_free (rid); @@ -4225,7 +4227,8 @@ e_day_view_finish_long_event_resize (EDayView *day_view) comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - if (e_cal_component_has_attendees (comp) && !itip_organizer_is_user (comp, client)) { + if (e_cal_component_has_attendees (comp) && + !itip_organizer_is_user (comp, client)) { g_object_unref (comp); e_day_view_abort_resize (day_view); return; @@ -4297,7 +4300,10 @@ e_day_view_finish_long_event_resize (EDayView *day_view) mod = CALOBJ_MOD_THIS; toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view))); - e_calendar_view_modify_and_send (comp, client, mod, toplevel, TRUE); + + e_calendar_view_modify_and_send ( + E_CALENDAR_VIEW (day_view), + comp, client, mod, toplevel, TRUE); out: day_view->resize_drag_pos = E_CALENDAR_VIEW_POS_NONE; @@ -4343,7 +4349,8 @@ e_day_view_finish_resize (EDayView *day_view) comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - if (e_cal_component_has_attendees (comp) && !itip_organizer_is_user (comp, client)) { + if (e_cal_component_has_attendees (comp) && + !itip_organizer_is_user (comp, client)) { g_object_unref (comp); e_day_view_abort_resize (day_view); return; @@ -4413,7 +4420,11 @@ e_day_view_finish_resize (EDayView *day_view) toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view))); e_cal_component_commit_sequence (comp); - e_calendar_view_modify_and_send (comp, client, mod, toplevel, TRUE); + + e_calendar_view_modify_and_send ( + E_CALENDAR_VIEW (day_view), + comp, client, mod, toplevel, TRUE); + out: g_object_unref (comp); } @@ -4558,7 +4569,9 @@ e_day_view_add_event (ECalComponent *comp, e_calendar_view_get_timezone (E_CALENDAR_VIEW (add_event_data->day_view)))) event.different_timezone = TRUE; - if (!e_cal_component_has_attendees (comp) || itip_organizer_is_user (comp, event.comp_data->client) || itip_sentby_is_user (comp, event.comp_data->client)) + if (!e_cal_component_has_attendees (comp) || + itip_organizer_is_user (comp, event.comp_data->client) || + itip_sentby_is_user (comp, event.comp_data->client)) event.is_editable = TRUE; else event.is_editable = FALSE; @@ -5099,9 +5112,11 @@ e_day_view_add_new_event_in_selected_range (EDayView *day_view, const gchar *uid; AddEventData add_event_data; - /* Check if the client is read only */ model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)); + client = e_cal_model_get_default_client (model); + + /* Check if the client is read only */ if (e_client_is_readonly (E_CLIENT (client))) return FALSE; @@ -6488,7 +6503,8 @@ e_day_view_change_event_time (EDayView *day_view, comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - if (e_cal_component_has_attendees (comp) && !itip_organizer_is_user (comp, client)) { + if (e_cal_component_has_attendees (comp) && + !itip_organizer_is_user (comp, client)) { g_object_unref (comp); return; } @@ -6537,7 +6553,10 @@ e_day_view_change_event_time (EDayView *day_view, toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view))); e_cal_component_commit_sequence (comp); - e_calendar_view_modify_and_send (comp, client, mod, toplevel, TRUE); + + e_calendar_view_modify_and_send ( + E_CALENDAR_VIEW (day_view), + comp, client, mod, toplevel, TRUE); out: g_object_unref (comp); @@ -6861,7 +6880,10 @@ e_day_view_on_editing_stopped (EDayView *day_view, /* FIXME When sending here, what exactly should we send? */ toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view))); - e_calendar_view_modify_and_send (comp, client, mod, toplevel, FALSE); + + e_calendar_view_modify_and_send ( + E_CALENDAR_VIEW (day_view), + comp, client, mod, toplevel, FALSE); } } @@ -7863,13 +7885,13 @@ e_day_view_on_drag_data_get (GtkWidget *widget, comp_str = icalcomponent_as_ical_string_r (vcal); if (comp_str) { - ESource *source = e_client_get_source (E_CLIENT (event->comp_data->client)); - const gchar *source_uid = e_source_peek_uid (source); + ESource *source; + const gchar *source_uid; GdkAtom target; gchar *tmp; - if (!source_uid) - source_uid = ""; + source = e_client_get_source (E_CLIENT (event->comp_data->client)); + source_uid = e_source_peek_uid (source); tmp = g_strconcat (source_uid, "\n", comp_str, NULL); target = gtk_selection_data_get_target (selection_data); @@ -7984,7 +8006,8 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget, comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - if (e_cal_component_has_attendees (comp) && !itip_organizer_is_user (comp, client)) { + if (e_cal_component_has_attendees (comp) && + !itip_organizer_is_user (comp, client)) { g_object_unref (comp); return; } @@ -8055,7 +8078,10 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget, mod = CALOBJ_MOD_THIS; toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view))); - e_calendar_view_modify_and_send (comp, client, mod, toplevel, FALSE); + + e_calendar_view_modify_and_send ( + E_CALENDAR_VIEW (day_view), + comp, client, mod, toplevel, FALSE); g_object_unref (comp); @@ -8234,7 +8260,8 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget, comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - if (e_cal_component_has_attendees (comp) && !itip_organizer_is_user (comp, client)) { + if (e_cal_component_has_attendees (comp) && + !itip_organizer_is_user (comp, client)) { g_object_unref (comp); return; } @@ -8282,7 +8309,10 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget, mod = CALOBJ_MOD_THIS; toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view))); - e_calendar_view_modify_and_send (comp, client, mod, toplevel, FALSE); + + e_calendar_view_modify_and_send ( + E_CALENDAR_VIEW (day_view), + comp, client, mod, toplevel, FALSE); g_object_unref (comp); diff --git a/calendar/gui/e-meeting-store.c b/calendar/gui/e-meeting-store.c index 7e5fbf215e..833c6a821e 100644 --- a/calendar/gui/e-meeting-store.c +++ b/calendar/gui/e-meeting-store.c @@ -1984,7 +1984,9 @@ download_with_libsoup (const gchar *uri, g_object_set_data_full (G_OBJECT (msg), "orig-uri", g_strdup (uri), g_free); session = soup_session_async_new (); - g_signal_connect (session, "authenticate", G_CALLBACK (soup_authenticate), NULL); + g_signal_connect ( + session, "authenticate", + G_CALLBACK (soup_authenticate), NULL); proxy = e_proxy_new (); e_proxy_setup_proxy (proxy); diff --git a/calendar/gui/e-memo-list-selector.c b/calendar/gui/e-memo-list-selector.c index 5fff33d188..4484f94298 100644 --- a/calendar/gui/e-memo-list-selector.c +++ b/calendar/gui/e-memo-list-selector.c @@ -34,7 +34,10 @@ struct _EMemoListSelectorPrivate { gint dummy_value; }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EMemoListSelector, + e_memo_list_selector, + E_TYPE_SOURCE_SELECTOR) static gboolean memo_list_selector_update_single_object (ECalClient *client, @@ -302,11 +305,10 @@ memo_list_selector_data_dropped (ESourceSelector *selector, } static void -memo_list_selector_class_init (EMemoListSelectorClass *class) +e_memo_list_selector_class_init (EMemoListSelectorClass *class) { ESourceSelectorClass *source_selector_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EMemoListSelectorPrivate)); source_selector_class = E_SOURCE_SELECTOR_CLASS (class); @@ -314,7 +316,7 @@ memo_list_selector_class_init (EMemoListSelectorClass *class) } static void -memo_list_selector_init (EMemoListSelector *selector) +e_memo_list_selector_init (EMemoListSelector *selector) { selector->priv = G_TYPE_INSTANCE_GET_PRIVATE ( selector, E_TYPE_MEMO_LIST_SELECTOR, EMemoListSelectorPrivate); @@ -326,33 +328,6 @@ memo_list_selector_init (EMemoListSelector *selector) e_drag_dest_add_calendar_targets (GTK_WIDGET (selector)); } -GType -e_memo_list_selector_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (EMemoListSelectorClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) memo_list_selector_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMemoListSelector), - 0, /* n_preallocs */ - (GInstanceInitFunc) memo_list_selector_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_SOURCE_SELECTOR, "EMemoListSelector", - &type_info, 0); - } - - return type; -} - GtkWidget * e_memo_list_selector_new (ESourceList *source_list) { diff --git a/calendar/gui/e-task-list-selector.c b/calendar/gui/e-task-list-selector.c index 7e091599cf..ba210e8c05 100644 --- a/calendar/gui/e-task-list-selector.c +++ b/calendar/gui/e-task-list-selector.c @@ -34,7 +34,10 @@ struct _ETaskListSelectorPrivate { gint dummy_value; }; -static gpointer parent_class; +G_DEFINE_TYPE ( + ETaskListSelector, + e_task_list_selector, + E_TYPE_SOURCE_SELECTOR) static gboolean task_list_selector_update_single_object (ECalClient *client, @@ -304,11 +307,10 @@ task_list_selector_data_dropped (ESourceSelector *selector, } static void -task_list_selector_class_init (ETaskListSelectorClass *class) +e_task_list_selector_class_init (ETaskListSelectorClass *class) { ESourceSelectorClass *source_selector_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (ETaskListSelectorPrivate)); source_selector_class = E_SOURCE_SELECTOR_CLASS (class); @@ -316,7 +318,7 @@ task_list_selector_class_init (ETaskListSelectorClass *class) } static void -task_list_selector_init (ETaskListSelector *selector) +e_task_list_selector_init (ETaskListSelector *selector) { selector->priv = G_TYPE_INSTANCE_GET_PRIVATE ( selector, E_TYPE_TASK_LIST_SELECTOR, ETaskListSelectorPrivate); @@ -328,33 +330,6 @@ task_list_selector_init (ETaskListSelector *selector) e_drag_dest_add_calendar_targets (GTK_WIDGET (selector)); } -GType -e_task_list_selector_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (ETaskListSelectorClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) task_list_selector_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ETaskListSelector), - 0, /* n_preallocs */ - (GInstanceInitFunc) task_list_selector_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_SOURCE_SELECTOR, "ETaskListSelector", - &type_info, 0); - } - - return type; -} - GtkWidget * e_task_list_selector_new (ESourceList *source_list) { diff --git a/calendar/gui/e-task-table.c b/calendar/gui/e-task-table.c index ec49cd1478..0a38889e2d 100644 --- a/calendar/gui/e-task-table.c +++ b/calendar/gui/e-task-table.c @@ -712,6 +712,7 @@ task_table_query_tooltip (GtkWidget *widget, model = e_task_table_get_model (task_table); comp_data = e_cal_model_get_component_at (model, row); + if (!comp_data || !comp_data->icalcomp) return FALSE; @@ -850,8 +851,8 @@ task_table_query_tooltip (GtkWidget *widget, e_cal_component_free_datetime (&dtstart); e_cal_component_free_datetime (&dtdue); - tmp = e_calendar_view_get_attendees_status_info ( - new_comp, comp_data->client); + tmp = e_cal_model_get_attendees_status_info ( + model, new_comp, comp_data->client); if (tmp) { l = gtk_label_new (tmp); gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5); diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index a98ff42776..036b6192f5 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -3901,7 +3901,10 @@ e_week_view_change_event_time (EWeekView *week_view, toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (week_view))); e_cal_component_commit_sequence (comp); - e_calendar_view_modify_and_send (comp, client, mod, toplevel, TRUE); + + e_calendar_view_modify_and_send ( + E_CALENDAR_VIEW (week_view), + comp, client, mod, toplevel, TRUE); out: g_object_unref (comp); @@ -4112,7 +4115,10 @@ e_week_view_on_editing_stopped (EWeekView *week_view, /* FIXME When sending here, what exactly should we send? */ toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (week_view))); - e_calendar_view_modify_and_send (comp, client, mod, toplevel, FALSE); + + e_calendar_view_modify_and_send ( + E_CALENDAR_VIEW (week_view), + comp, client, mod, toplevel, FALSE); } } diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 654eb1898a..66c90fb1c2 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -138,9 +138,9 @@ struct _GnomeCalendarPrivate { enum { PROP_0, PROP_DATE_NAVIGATOR, - PROP_VIEW, PROP_MEMO_TABLE, - PROP_TASK_TABLE + PROP_TASK_TABLE, + PROP_VIEW }; enum { @@ -341,12 +341,6 @@ gnome_calendar_set_property (GObject *object, g_value_get_object (value)); return; - case PROP_VIEW: - gnome_calendar_set_view ( - GNOME_CALENDAR (object), - g_value_get_int (value)); - return; - case PROP_MEMO_TABLE: gnome_calendar_set_memo_table ( GNOME_CALENDAR (object), @@ -358,6 +352,12 @@ gnome_calendar_set_property (GObject *object, GNOME_CALENDAR (object), g_value_get_object (value)); return; + + case PROP_VIEW: + gnome_calendar_set_view ( + GNOME_CALENDAR (object), + g_value_get_int (value)); + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -376,12 +376,6 @@ gnome_calendar_get_property (GObject *object, GNOME_CALENDAR (object))); return; - case PROP_VIEW: - g_value_set_int ( - value, gnome_calendar_get_view ( - GNOME_CALENDAR (object))); - return; - case PROP_MEMO_TABLE: g_value_set_object ( value, gnome_calendar_get_memo_table ( @@ -393,6 +387,12 @@ gnome_calendar_get_property (GObject *object, value, gnome_calendar_get_task_table ( GNOME_CALENDAR (object))); return; + + case PROP_VIEW: + g_value_set_int ( + value, gnome_calendar_get_view ( + GNOME_CALENDAR (object))); + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -528,18 +528,6 @@ gnome_calendar_class_init (GnomeCalendarClass *class) g_object_class_install_property ( object_class, - PROP_VIEW, - g_param_spec_int ( - "view", - "View", - NULL, - GNOME_CAL_DAY_VIEW, - GNOME_CAL_LIST_VIEW, - GNOME_CAL_DAY_VIEW, - G_PARAM_READWRITE)); - - g_object_class_install_property ( - object_class, PROP_MEMO_TABLE, g_param_spec_object ( "memo-table", @@ -558,6 +546,18 @@ gnome_calendar_class_init (GnomeCalendarClass *class) E_TYPE_TASK_TABLE, G_PARAM_READWRITE)); + g_object_class_install_property ( + object_class, + PROP_VIEW, + g_param_spec_int ( + "view", + "View", + NULL, + GNOME_CAL_DAY_VIEW, + GNOME_CAL_LIST_VIEW, + GNOME_CAL_DAY_VIEW, + G_PARAM_READWRITE)); + signals[DATES_SHOWN_CHANGED] = g_signal_new ("dates_shown_changed", G_TYPE_FROM_CLASS (object_class), diff --git a/calendar/importers/icalendar-importer.c b/calendar/importers/icalendar-importer.c index 739a23cf1d..449cab0d24 100644 --- a/calendar/importers/icalendar-importer.c +++ b/calendar/importers/icalendar-importer.c @@ -335,7 +335,7 @@ ivcal_getwidget (EImport *ei, if (!group) group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rb)); if (first == NULL) { - g_datalist_set_data_full(&target->data, "primary-source", g_object_ref(primary), g_object_unref); + g_datalist_set_data_full(&target->data, "primary-source", g_object_ref (primary), g_object_unref); g_datalist_set_data(&target->data, "primary-type", GINT_TO_POINTER(import_type_map[i])); first = rb; } @@ -867,7 +867,8 @@ open_default_source (ICalIntelligentImporter *ici, e_import_status (ici->ei, ici->target, _("Opening calendar"), 0); - e_client_utils_open_new (source, source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS ? E_CLIENT_SOURCE_TYPE_EVENTS : E_CLIENT_SOURCE_TYPE_TASKS, FALSE, ici->cancellable, + e_client_utils_open_new ( + source, source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS ? E_CLIENT_SOURCE_TYPE_EVENTS : E_CLIENT_SOURCE_TYPE_TASKS, FALSE, ici->cancellable, e_client_utils_authenticate_handler, NULL, default_source_opened_cb, odsd); |