From 5c80f1534b435ff5c1c9cc88eb9f5c5c1124f82a Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 3 Jan 2010 22:47:27 -0500 Subject: Coding style and whitespace cleanup. --- modules/calendar/e-cal-shell-backend.c | 52 ++++++++++++++++++++--------- modules/calendar/e-cal-shell-view.c | 61 ++++++++++++++++++---------------- 2 files changed, 69 insertions(+), 44 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 2c3d459085..e70daec074 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -109,18 +109,22 @@ cal_shell_backend_ensure_sources (EShellBackend *shell_backend) g_free (filename); if (strlen (base_uri) > 7) { - /* compare only file:// part. If user home dir name changes we do not want to create - one more group */ + /* Compare only file:// part. If user home dir name + * changes we do not want to create one more group. */ base_uri_seventh = base_uri[7]; base_uri[7] = 0; } else { base_uri_seventh = -1; } - on_this_computer = e_source_list_ensure_group (priv->source_list, _("On This Computer"), base_uri, TRUE); - contacts = e_source_list_ensure_group (priv->source_list, _("Contacts"), CONTACTS_BASE_URI, TRUE); - e_source_list_ensure_group (priv->source_list, _("On The Web"), WEB_BASE_URI, FALSE); - e_source_list_ensure_group (priv->source_list, _("Weather"), WEATHER_BASE_URI, FALSE); + on_this_computer = e_source_list_ensure_group ( + priv->source_list, _("On This Computer"), base_uri, TRUE); + contacts = e_source_list_ensure_group ( + priv->source_list, _("Contacts"), CONTACTS_BASE_URI, TRUE); + e_source_list_ensure_group ( + priv->source_list, _("On The Web"), WEB_BASE_URI, FALSE); + e_source_list_ensure_group ( + priv->source_list, _("Weather"), WEATHER_BASE_URI, FALSE); if (base_uri_seventh != -1) { base_uri[7] = base_uri_seventh; @@ -267,7 +271,11 @@ cal_shell_backend_ensure_sources (EShellBackend *shell_backend) } static void -cal_new_event (ECal *cal, ECalendarStatus status, EShell *shell, CompEditorFlags flags, gboolean all_day) +cal_shell_backend_new_event (ECal *cal, + ECalendarStatus status, + EShell *shell, + CompEditorFlags flags, + gboolean all_day) { ECalComponent *comp; CompEditor *editor; @@ -293,7 +301,10 @@ cal_shell_backend_event_new_cb (ECal *cal, ECalendarStatus status, EShell *shell) { - cal_new_event (cal, status, shell, COMP_EDITOR_USER_ORG, FALSE); + CompEditorFlags flags; + + flags = COMP_EDITOR_USER_ORG; + cal_shell_backend_new_event (cal, status, shell, flags, FALSE); g_object_unref (cal); } @@ -303,7 +314,10 @@ cal_shell_backend_event_all_day_new_cb (ECal *cal, ECalendarStatus status, EShell *shell) { - cal_new_event (cal, status, shell, COMP_EDITOR_USER_ORG, TRUE); + CompEditorFlags flags; + + flags = COMP_EDITOR_USER_ORG; + cal_shell_backend_new_event (cal, status, shell, flags, TRUE); g_object_unref (cal); } @@ -313,7 +327,10 @@ cal_shell_backend_event_meeting_new_cb (ECal *cal, ECalendarStatus status, EShell *shell) { - cal_new_event (cal, status, shell, COMP_EDITOR_USER_ORG | COMP_EDITOR_MEETING, FALSE); + CompEditorFlags flags; + + flags = COMP_EDITOR_USER_ORG | COMP_EDITOR_MEETING; + cal_shell_backend_new_event (cal, status, shell, flags, FALSE); g_object_unref (cal); } @@ -328,13 +345,17 @@ action_event_new_cb (GtkAction *action, EShellSettings *shell_settings; EShellView *shell_view; EShell *shell; + const gchar *view_name; const gchar *action_name; gchar *uid; - /* With a 'calendar' active shell view pass the new appointment request to it, - thus the event will inherit selected time from the view. */ - shell_view = e_shell_window_get_shell_view (shell_window, e_shell_window_get_active_view (shell_window)); - if (shell_view && g_ascii_strcasecmp (e_shell_view_get_name (shell_view), "calendar") == 0) { + /* With a 'calendar' active shell view pass the new appointment + * request to it, thus the event will inherit selected time from + * the view. */ + view_name = e_shell_window_get_active_view (shell_window); + shell_view = e_shell_window_get_shell_view (shell_window, view_name); + + if (shell_view && g_ascii_strcasecmp (view_name, "calendar") == 0) { EShellContent *shell_content; GnomeCalendar *gcal; GnomeCalendarViewType view_type; @@ -342,7 +363,8 @@ action_event_new_cb (GtkAction *action, shell_content = e_shell_view_get_shell_content (shell_view); - gcal = e_cal_shell_content_get_calendar (E_CAL_SHELL_CONTENT (shell_content)); + gcal = e_cal_shell_content_get_calendar ( + E_CAL_SHELL_CONTENT (shell_content)); view_type = gnome_calendar_get_view (gcal); view = gnome_calendar_get_calendar_view (gcal, view_type); diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index 5b9940b1dd..c2eac56216 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -316,49 +316,52 @@ cal_shell_view_update_actions (EShellView *shell_view) for (iter = list; iter != NULL; iter = iter->next) { ECalendarViewEvent *event = iter->data; + ECal *client; + ECalComponent *comp; + icalcomponent *icalcomp; + gchar *user_email = NULL; + gboolean user_org = FALSE; gboolean read_only = TRUE; if (!event || !event->comp_data) continue; - e_cal_is_read_only (event->comp_data->client, &read_only, NULL); + client = event->comp_data->client; + icalcomp = event->comp_data->icalcomp; + + e_cal_is_read_only (client, &read_only, NULL); editable = editable && !read_only; - if (e_cal_util_component_has_recurrences (event->comp_data->icalcomp)) - recurring = TRUE; + is_instance |= e_cal_util_component_is_instance (icalcomp); - if (e_cal_util_component_is_instance (event->comp_data->icalcomp)) { - recurring = TRUE; - is_instance = TRUE; - } + recurring |= + e_cal_util_component_is_instance (icalcomp) || + e_cal_util_component_has_recurrences (icalcomp); - if (iter == list && !iter->next) { - ECalComponent *comp; - gchar *user_email = NULL; - gboolean user_org = FALSE; + /* The following tests only apply if one event is selected. */ + if (iter != list || n_selected > 1) + continue; - comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - user_email = itip_get_comp_attendee (comp, event->comp_data->client); + comp = e_cal_component_new (); + e_cal_component_set_icalcomponent ( + comp, icalcomponent_new_clone (icalcomp)); + user_email = itip_get_comp_attendee (comp, client); - is_meeting = e_cal_util_component_has_attendee (event->comp_data->icalcomp); + is_meeting = e_cal_util_component_has_attendee (icalcomp); - if (e_cal_util_component_has_organizer (event->comp_data->icalcomp)) { - if (itip_organizer_is_user (comp, event->comp_data->client)) { - user_org = TRUE; - } - } + user_org = + e_cal_util_component_has_organizer (icalcomp) && + itip_organizer_is_user (comp, client); - if (e_cal_get_static_capability (event->comp_data->client, CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED)) { - if (e_cal_get_static_capability (event->comp_data->client, CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY)) - is_delegatable = TRUE; - else if (!user_org && !is_delegated (event->comp_data->icalcomp, user_email)) - is_delegatable = TRUE; - } + is_delegatable = + e_cal_get_static_capability ( + client, CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED) && + ((e_cal_get_static_capability ( + client, CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY)) || + (!user_org && !is_delegated (icalcomp, user_email))); - g_free (user_email); - g_object_unref (comp); - } + g_free (user_email); + g_object_unref (comp); } g_list_free (list); -- cgit v1.2.3