From bad8aff04f274c58c584bd5f7e8a396918aa9fb4 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 3 Nov 2010 16:35:02 +0100 Subject: Bug #612181 - Show recurring events in italic in date navigator --- calendar/gui/dialogs/recurrence-page.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/dialogs/recurrence-page.c') diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 4014cfbc92..f5ef574efd 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -271,7 +271,7 @@ preview_recur (RecurrencePage *rpage) fill_component (rpage, comp); tag_calendar_by_comp (E_CALENDAR (priv->preview_calendar), comp, - client, zone, TRUE, FALSE); + client, zone, TRUE, FALSE, FALSE); g_object_unref (comp); } -- cgit From 1f17dab6b0d9c5413dea38dcc95e7a7bb5b4bd9b Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 2 Nov 2010 11:49:38 -0400 Subject: Move calendar preferences to the calendar module. Continue replacing the use of calendar-config functions with GObject property bindings to EShellSettings properties. --- calendar/gui/dialogs/recurrence-page.c | 54 ++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 15 deletions(-) (limited to 'calendar/gui/dialogs/recurrence-page.c') diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index f5ef574efd..dd8cda94fa 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -36,7 +36,6 @@ #include #include #include -#include "../calendar-config.h" #include "../tag-calendar.h" #include "../weekday-picker.h" #include "comp-editor-util.h" @@ -190,6 +189,9 @@ struct _RecurrencePagePrivate { /* For the recurrence preview, the actual widget */ GtkWidget *preview_calendar; + + /* This just holds some settings we need */ + EMeetingStore *meeting_store; }; @@ -324,6 +326,11 @@ recurrence_page_dispose (GObject *object) priv->exception_list_store = NULL; } + if (priv->meeting_store != NULL) { + g_object_unref (priv->meeting_store); + priv->meeting_store = NULL; + } + /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (recurrence_page_parent_class)->dispose (object); } @@ -436,7 +443,7 @@ clear_widgets (RecurrencePage *rpage) g_signal_handlers_unblock_matched (priv->interval_unit_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); priv->ending_date_tt = icaltime_today (); - priv->ending_count = calendar_config_get_default_count (); + priv->ending_count = 2; g_signal_handlers_block_matched (priv->ending_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); e_dialog_combo_box_set (priv->ending_combo, @@ -672,7 +679,7 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) r.interval = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON (priv->interval_value)); r.week_start = ICAL_SUNDAY_WEEKDAY - + calendar_config_get_week_start_day (); + + e_meeting_store_get_week_start_day (priv->meeting_store); /* Frequency-specific data */ @@ -947,6 +954,7 @@ make_weekly_special (RecurrencePage *rpage) GtkWidget *hbox; GtkWidget *label; WeekdayPicker *wp; + gint week_start_day; priv = rpage->priv; @@ -972,7 +980,8 @@ make_weekly_special (RecurrencePage *rpage) /* Set the weekdays */ - weekday_picker_set_week_start_day (wp, calendar_config_get_week_start_day ()); + week_start_day = e_meeting_store_get_week_start_day (priv->meeting_store); + weekday_picker_set_week_start_day (wp, week_start_day); weekday_picker_set_days (wp, priv->weekday_day_mask); g_signal_connect_swapped ( @@ -1381,9 +1390,11 @@ make_ending_until_special (RecurrencePage *rpage) /* Make sure the EDateEdit widget uses our timezones to get the current time. */ - e_date_edit_set_get_time_callback (de, - (EDateEditGetTimeCallback) comp_editor_get_current_time, - rpage, NULL); + e_date_edit_set_get_time_callback ( + de, + (EDateEditGetTimeCallback) comp_editor_get_current_time, + g_object_ref (editor), + (GDestroyNotify) g_object_unref); } /* Creates the special contents for the occurrence count case */ @@ -1504,7 +1515,7 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r) e_cal_component_get_dtstart (priv->comp, &dt); if (dt.value->is_date) - to_zone = calendar_config_get_icaltimezone (); + to_zone = e_meeting_store_get_timezone (priv->meeting_store); else if (dt.tzid == NULL) to_zone = icaltimezone_get_utc_timezone (); else @@ -2282,9 +2293,11 @@ init_widgets (RecurrencePage *rpage) priv->preview_calendar); gtk_widget_show (priv->preview_calendar); - e_calendar_item_set_get_time_callback (ecal->calitem, - (ECalendarItemGetTimeCallback) comp_editor_get_current_time, - rpage, NULL); + e_calendar_item_set_get_time_callback ( + ecal->calitem, + (ECalendarItemGetTimeCallback) comp_editor_get_current_time, + g_object_ref (editor), + (GDestroyNotify) g_object_unref); /* Recurrence types */ @@ -2334,6 +2347,11 @@ init_widgets (RecurrencePage *rpage) gtk_tree_view_set_model (GTK_TREE_VIEW (priv->exception_list), GTK_TREE_MODEL (priv->exception_list_store)); + g_object_bind_property ( + editor, "use-24-hour-format", + priv->exception_list_store, "use-24-hour-format", + G_BINDING_SYNC_CREATE); + /* View */ column = gtk_tree_view_column_new (); gtk_tree_view_column_set_title (column, _("Date/Time")); @@ -2356,11 +2374,15 @@ init_widgets (RecurrencePage *rpage) * created. **/ RecurrencePage * -recurrence_page_construct (RecurrencePage *rpage) +recurrence_page_construct (RecurrencePage *rpage, + EMeetingStore *meeting_store) { - RecurrencePagePrivate *priv = rpage->priv; + RecurrencePagePrivate *priv; CompEditor *editor; + priv = rpage->priv; + priv->meeting_store = g_object_ref (meeting_store); + editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); priv->builder = gtk_builder_new (); @@ -2390,14 +2412,16 @@ recurrence_page_construct (RecurrencePage *rpage) * be created. **/ RecurrencePage * -recurrence_page_new (CompEditor *editor) +recurrence_page_new (EMeetingStore *meeting_store, + CompEditor *editor) { RecurrencePage *rpage; + g_return_val_if_fail (E_IS_MEETING_STORE (meeting_store), NULL); g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); rpage = g_object_new (TYPE_RECURRENCE_PAGE, "editor", editor, NULL); - if (!recurrence_page_construct (rpage)) { + if (!recurrence_page_construct (rpage, meeting_store)) { g_object_unref (rpage); g_return_val_if_reached (NULL); } -- cgit From 753c60fc67a0a56a5f119c14ffa54ea9af95c208 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 9 Nov 2010 08:48:33 -0500 Subject: Drop backward-compatibility cruft. --- calendar/gui/dialogs/recurrence-page.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'calendar/gui/dialogs/recurrence-page.c') diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index dd8cda94fa..a0be04810b 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -46,9 +46,6 @@ #include "e-util/e-dialog-widgets.h" #include "e-util/e-util-private.h" -/* backward-compatibility cruft */ -#include "e-util/gtk-compat.h" - #define RECURRENCE_PAGE_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), TYPE_RECURRENCE_PAGE, RecurrencePagePrivate)) -- cgit From 2c31a5bc23cf5a092c0621bf34554ffb2b6ae2ec Mon Sep 17 00:00:00 2001 From: Kjartan Maraas Date: Tue, 8 Feb 2011 11:57:50 -0500 Subject: Bug 641756 - Fix warnings from GCC 4.6 GCC learned how to find dead assignments. --- calendar/gui/dialogs/recurrence-page.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'calendar/gui/dialogs/recurrence-page.c') diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index a0be04810b..e8deefae36 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -2096,13 +2096,10 @@ create_exception_dialog (RecurrencePage *rpage, const gchar *title, GtkWidget ** { RecurrencePagePrivate *priv; GtkWidget *dialog, *toplevel; - CompEditor *editor; GtkWidget *container; priv = rpage->priv; - editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); - toplevel = gtk_widget_get_toplevel (priv->main); dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (toplevel), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, -- cgit From 1301cf02efdacd20fb5ce3e2554ae15b8f146e8a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 25 Feb 2011 16:20:41 +0100 Subject: Bug #614480 - Avoid using G_TYPE_INSTANCE_GET_PRIVATE repeatedly --- calendar/gui/dialogs/recurrence-page.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'calendar/gui/dialogs/recurrence-page.c') diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index e8deefae36..3fd4811b16 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -46,10 +46,6 @@ #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, @@ -301,7 +297,7 @@ recurrence_page_dispose (GObject *object) { RecurrencePagePrivate *priv; - priv = RECURRENCE_PAGE_GET_PRIVATE (object); + priv = RECURRENCE_PAGE (object)->priv; if (priv->main != NULL) { g_object_unref (priv->main); @@ -337,7 +333,7 @@ recurrence_page_finalize (GObject *object) { RecurrencePagePrivate *priv; - priv = RECURRENCE_PAGE_GET_PRIVATE (object); + priv = RECURRENCE_PAGE (object)->priv; g_signal_handlers_disconnect_matched ( E_CALENDAR (priv->preview_calendar)->calitem, @@ -381,7 +377,7 @@ recurrence_page_class_init (RecurrencePageClass *class) static void recurrence_page_init (RecurrencePage *rpage) { - rpage->priv = RECURRENCE_PAGE_GET_PRIVATE (rpage); + rpage->priv = G_TYPE_INSTANCE_GET_PRIVATE (rpage, TYPE_RECURRENCE_PAGE, RecurrencePagePrivate); } /* get_widget handler for the recurrence page */ @@ -390,7 +386,7 @@ recurrence_page_get_widget (CompEditorPage *page) { RecurrencePagePrivate *priv; - priv = RECURRENCE_PAGE_GET_PRIVATE (page); + priv = RECURRENCE_PAGE (page)->priv; return priv->main; } @@ -401,7 +397,7 @@ recurrence_page_focus_main_widget (CompEditorPage *page) { RecurrencePagePrivate *priv; - priv = RECURRENCE_PAGE_GET_PRIVATE (page); + priv = RECURRENCE_PAGE (page)->priv; gtk_widget_grab_focus (priv->recurs); } -- cgit From c6fd77460f5baf88528f5da2ffb99e86a2885ff0 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 5 Mar 2011 12:33:49 -0500 Subject: Coding style and whitespace cleanup. --- calendar/gui/dialogs/recurrence-page.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'calendar/gui/dialogs/recurrence-page.c') diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 3fd4811b16..e602157660 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -377,7 +377,8 @@ 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 = G_TYPE_INSTANCE_GET_PRIVATE ( + rpage, TYPE_RECURRENCE_PAGE, RecurrencePagePrivate); } /* get_widget handler for the recurrence page */ -- cgit From 8a186c3588d3598857c36e2122fa68d01eba30fd Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 8 May 2011 13:24:42 -0400 Subject: Coding style cleanups. --- calendar/gui/dialogs/recurrence-page.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/dialogs/recurrence-page.c') diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index e602157660..8d2701fab2 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -1412,7 +1412,7 @@ make_ending_count_special (RecurrencePage *rpage) adj = GTK_ADJUSTMENT (gtk_adjustment_new (1, 1, 10000, 1, 10, 0)); priv->ending_count_spin = gtk_spin_button_new (adj, 1, 0); - gtk_spin_button_set_numeric ((GtkSpinButton *)priv->ending_count_spin, TRUE); + gtk_spin_button_set_numeric ((GtkSpinButton *) priv->ending_count_spin, TRUE); gtk_box_pack_start (GTK_BOX (hbox), priv->ending_count_spin, FALSE, FALSE, 6); -- cgit From 38790d8478e906a5c59d0c4a5216f297f305bfeb Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 14 Jun 2011 08:54:20 +0200 Subject: Do not use deprecated EBook/ECal API --- calendar/gui/dialogs/recurrence-page.c | 41 +++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'calendar/gui/dialogs/recurrence-page.c') diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 8d2701fab2..bf8f1c191c 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -212,7 +212,7 @@ preview_recur (RecurrencePage *rpage) { RecurrencePagePrivate *priv = rpage->priv; CompEditor *editor; - ECal *client; + ECalClient *client; ECalComponent *comp; ECalComponentDateTime cdt; GSList *l; @@ -236,8 +236,8 @@ preview_recur (RecurrencePage *rpage) e_cal_component_get_dtstart (priv->comp, &cdt); if (cdt.tzid != NULL) { - /* FIXME Will e_cal_get_timezone really not return builtin zones? */ - if (!e_cal_get_timezone (client, cdt.tzid, &zone, NULL)) + /* FIXME Will e_cal_client_get_timezone_sync really not return builtin zones? */ + if (!e_cal_client_get_timezone_sync (client, cdt.tzid, &zone, NULL, NULL)) zone = icaltimezone_get_builtin_timezone_from_tzid (cdt.tzid); } e_cal_component_set_dtstart (comp, &cdt); @@ -586,7 +586,7 @@ sensitize_buttons (RecurrencePage *rpage) gboolean read_only, sensitize = TRUE; gint selected_rows; icalcomponent *icalcomp; - ECal *client; + ECalClient *client; const gchar *uid; if (priv->comp == NULL) @@ -602,27 +602,26 @@ sensitize_buttons (RecurrencePage *rpage) selected_rows = gtk_tree_selection_count_selected_rows ( gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->exception_list))); - if (!e_cal_is_read_only (client, &read_only, NULL)) - read_only = TRUE; + read_only = e_client_is_readonly (E_CLIENT (client)); if (!read_only) { e_cal_component_get_uid (priv->comp, &uid); - if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_CONV_TO_RECUR) && e_cal_get_object (client, uid, NULL, &icalcomp, NULL)) { + if (e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_NO_CONV_TO_RECUR) && e_cal_client_get_object_sync (client, uid, NULL, &icalcomp, NULL, NULL)) { read_only = TRUE; icalcomponent_free (icalcomp); } if (!read_only) { - GList *list; + GSList *list = NULL; /* see if we have detached instances */ - if (e_cal_get_objects_for_uid (client, uid, &list, NULL)) { - if (list && g_list_length (list) > 1) + if (e_cal_client_get_objects_for_uid_sync (client, uid, &list, NULL, NULL)) { + if (list && g_slist_length (list) > 1) read_only = TRUE; - g_list_foreach (list, (GFunc) g_object_unref, NULL); - g_list_free (list); + g_slist_foreach (list, (GFunc) g_object_unref, NULL); + g_slist_free (list); } } } @@ -1485,7 +1484,7 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r) { RecurrencePagePrivate *priv = rpage->priv; CompEditor *editor; - ECal *client; + ECalClient *client; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); client = comp_editor_get_client (editor); @@ -1512,9 +1511,16 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r) to_zone = e_meeting_store_get_timezone (priv->meeting_store); else if (dt.tzid == NULL) to_zone = icaltimezone_get_utc_timezone (); - else + else { + GError *error = NULL; /* FIXME Error checking? */ - e_cal_get_timezone (client, dt.tzid, &to_zone, NULL); + e_cal_client_get_timezone_sync (client, dt.tzid, &to_zone, NULL, &error); + + if (error) { + g_debug ("%s: Failed to get timezone: %s", G_STRFUNC, error->message); + g_error_free (error); + } + } from_zone = icaltimezone_get_utc_timezone (); icaltimezone_convert_time (&r->until, from_zone, to_zone); @@ -2069,7 +2075,7 @@ type_toggled_cb (GtkToggleButton *toggle, { RecurrencePagePrivate *priv = rpage->priv; CompEditor *editor; - ECal *client; + ECalClient *client; gboolean read_only; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); @@ -2079,8 +2085,7 @@ type_toggled_cb (GtkToggleButton *toggle, sensitize_buttons (rpage); /* enable/disable the 'Add' button */ - if (!e_cal_is_read_only (client, &read_only, NULL)) - read_only = TRUE; + read_only = e_client_is_readonly (E_CLIENT (client)); if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->recurs)) || read_only) gtk_widget_set_sensitive (priv->exception_add, FALSE); -- cgit From 5da21ceee424eb238278bdec258b0c6d8725ae21 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 2 Aug 2011 15:23:52 +0200 Subject: Bug #655190 - Sluggish performance interacting with calendar/tasks --- calendar/gui/dialogs/recurrence-page.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'calendar/gui/dialogs/recurrence-page.c') diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index bf8f1c191c..8e52250dfa 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -185,6 +185,8 @@ struct _RecurrencePagePrivate { /* This just holds some settings we need */ EMeetingStore *meeting_store; + + GCancellable *cancellable; }; @@ -266,7 +268,7 @@ preview_recur (RecurrencePage *rpage) fill_component (rpage, comp); tag_calendar_by_comp (E_CALENDAR (priv->preview_calendar), comp, - client, zone, TRUE, FALSE, FALSE); + client, zone, TRUE, FALSE, FALSE, priv->cancellable); g_object_unref (comp); } @@ -324,6 +326,12 @@ recurrence_page_dispose (GObject *object) priv->meeting_store = NULL; } + if (priv->cancellable) { + g_cancellable_cancel (priv->cancellable); + g_object_unref (priv->cancellable); + priv->cancellable = NULL; + } + /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (recurrence_page_parent_class)->dispose (object); } @@ -379,6 +387,8 @@ recurrence_page_init (RecurrencePage *rpage) { rpage->priv = G_TYPE_INSTANCE_GET_PRIVATE ( rpage, TYPE_RECURRENCE_PAGE, RecurrencePagePrivate); + + rpage->priv->cancellable = g_cancellable_new (); } /* get_widget handler for the recurrence page */ -- cgit From f59681796df8fe0138a1754abbe8ec781bc1535e Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 1 Jul 2011 00:07:26 -0400 Subject: Coding style and whitespace cleanup. --- calendar/gui/dialogs/recurrence-page.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'calendar/gui/dialogs/recurrence-page.c') diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 8e52250dfa..c22138f6b9 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -1526,8 +1526,10 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r) /* FIXME Error checking? */ e_cal_client_get_timezone_sync (client, dt.tzid, &to_zone, NULL, &error); - if (error) { - g_debug ("%s: Failed to get timezone: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to get timezone: %s", + G_STRFUNC, error->message); g_error_free (error); } } -- cgit From df385fa05b527bbc72392e33f2f4786393702d3e Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 26 Aug 2011 14:22:58 +0200 Subject: Changing source in CompEditor blocks UI --- calendar/gui/dialogs/recurrence-page.c | 128 ++++++++++++++++++++++++--------- 1 file changed, 96 insertions(+), 32 deletions(-) (limited to 'calendar/gui/dialogs/recurrence-page.c') diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index c22138f6b9..fa18e0d9f1 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -588,22 +588,15 @@ sensitize_recur_widgets (RecurrencePage *rpage) } static void -sensitize_buttons (RecurrencePage *rpage) +update_with_readonly (RecurrencePage *rpage, gboolean read_only) { RecurrencePagePrivate *priv = rpage->priv; CompEditor *editor; CompEditorFlags flags; - gboolean read_only, sensitize = TRUE; gint selected_rows; - icalcomponent *icalcomp; - ECalClient *client; - const gchar *uid; - - if (priv->comp == NULL) - return; + gboolean sensitize = TRUE; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); - client = comp_editor_get_client (editor); flags = comp_editor_get_flags (editor); if (flags & COMP_EDITOR_MEETING) @@ -612,39 +605,110 @@ sensitize_buttons (RecurrencePage *rpage) selected_rows = gtk_tree_selection_count_selected_rows ( gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->exception_list))); - read_only = e_client_is_readonly (E_CLIENT (client)); + if (!read_only) + sensitize_recur_widgets (rpage); + else + gtk_widget_set_sensitive (priv->params, FALSE); - if (!read_only) { - e_cal_component_get_uid (priv->comp, &uid); + gtk_widget_set_sensitive (priv->recurs, !read_only && sensitize); + gtk_widget_set_sensitive (priv->exception_add, !read_only && e_cal_component_has_recurrences (priv->comp) && sensitize); + gtk_widget_set_sensitive (priv->exception_modify, !read_only && selected_rows > 0 && sensitize); + gtk_widget_set_sensitive (priv->exception_delete, !read_only && selected_rows > 0 && sensitize); +} - if (e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_NO_CONV_TO_RECUR) && e_cal_client_get_object_sync (client, uid, NULL, &icalcomp, NULL, NULL)) { - read_only = TRUE; - icalcomponent_free (icalcomp); +static void +rpage_get_objects_for_uid_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +{ + ECalClient *client = E_CAL_CLIENT (source_object); + RecurrencePage *rpage = user_data; + GSList *ecalcomps = NULL; + GError *error = NULL; + + if (result && !e_cal_client_get_objects_for_uid_finish (client, result, &ecalcomps, &error)) { + ecalcomps = NULL; + if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || + g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + return; } + } - if (!read_only) { - GSList *list = NULL; + update_with_readonly (rpage, g_slist_length (ecalcomps) > 1); - /* see if we have detached instances */ - if (e_cal_client_get_objects_for_uid_sync (client, uid, &list, NULL, NULL)) { - if (list && g_slist_length (list) > 1) - read_only = TRUE; + g_slist_foreach (ecalcomps, (GFunc) g_object_unref, NULL); + g_slist_free (ecalcomps); +} - g_slist_foreach (list, (GFunc) g_object_unref, NULL); - g_slist_free (list); - } +static void +rpage_get_object_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +{ + ECalClient *client = E_CAL_CLIENT (source_object); + RecurrencePage *rpage = user_data; + icalcomponent *icalcomp = NULL; + const gchar *uid = NULL; + GError *error = NULL; + + if (result && !e_cal_client_get_object_finish (client, result, &icalcomp, &error)) { + icalcomp = NULL; + if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || + g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + return; } } - if (!read_only) - sensitize_recur_widgets (rpage); - else - gtk_widget_set_sensitive (priv->params, FALSE); + if (icalcomp) { + icalcomponent_free (icalcomp); + update_with_readonly (rpage, TRUE); + return; + } - gtk_widget_set_sensitive (priv->recurs, !read_only && sensitize); - gtk_widget_set_sensitive (priv->exception_add, !read_only && e_cal_component_has_recurrences (priv->comp) && sensitize); - gtk_widget_set_sensitive (priv->exception_modify, !read_only && selected_rows > 0 && sensitize); - gtk_widget_set_sensitive (priv->exception_delete, !read_only && selected_rows > 0 && sensitize); + if (rpage->priv->comp) + e_cal_component_get_uid (rpage->priv->comp, &uid); + + if (!uid || !*uid) { + update_with_readonly (rpage, FALSE); + return; + } + + /* see if we have detached instances */ + e_cal_client_get_objects_for_uid (client, uid, rpage->priv->cancellable, rpage_get_objects_for_uid_cb, rpage); +} + +static void +sensitize_buttons (RecurrencePage *rpage) +{ + RecurrencePagePrivate *priv = rpage->priv; + CompEditor *editor; + ECalClient *client; + const gchar *uid; + + if (priv->comp == NULL) + return; + + editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); + client = comp_editor_get_client (editor); + + if (e_client_is_readonly (E_CLIENT (client))) { + update_with_readonly (rpage, TRUE); + return; + } + + if (priv->cancellable) { + g_cancellable_cancel (priv->cancellable); + g_object_unref (priv->cancellable); + } + priv->cancellable = g_cancellable_new (); + + e_cal_component_get_uid (priv->comp, &uid); + if (!uid || !*uid) { + update_with_readonly (rpage, FALSE); + return; + } + + if (e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_NO_CONV_TO_RECUR)) { + e_cal_client_get_object (client, uid, NULL, priv->cancellable, rpage_get_object_cb, rpage); + } else { + rpage_get_object_cb (G_OBJECT (client), NULL, rpage); + } } #if 0 -- cgit From fcbbdfbd18e15b4ee8322a0217cf03a689a5e033 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 16 Aug 2011 11:25:56 -0400 Subject: Coding style and whitespace cleanup. --- calendar/gui/dialogs/recurrence-page.c | 106 ++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 48 deletions(-) (limited to 'calendar/gui/dialogs/recurrence-page.c') diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index fa18e0d9f1..6f201b596f 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -463,7 +463,8 @@ clear_widgets (RecurrencePage *rpage) /* Appends an exception date to the list */ static void -append_exception (RecurrencePage *rpage, ECalComponentDateTime *datetime) +append_exception (RecurrencePage *rpage, + ECalComponentDateTime *datetime) { RecurrencePagePrivate *priv; GtkTreeView *view; @@ -478,7 +479,8 @@ append_exception (RecurrencePage *rpage, ECalComponentDateTime *datetime) /* Fills in the exception widgets with the data from the calendar component */ static void -fill_exception_widgets (RecurrencePage *rpage, ECalComponent *comp) +fill_exception_widgets (RecurrencePage *rpage, + ECalComponent *comp) { GSList *list, *l; @@ -588,7 +590,8 @@ sensitize_recur_widgets (RecurrencePage *rpage) } static void -update_with_readonly (RecurrencePage *rpage, gboolean read_only) +update_with_readonly (RecurrencePage *rpage, + gboolean read_only) { RecurrencePagePrivate *priv = rpage->priv; CompEditor *editor; @@ -617,7 +620,9 @@ update_with_readonly (RecurrencePage *rpage, gboolean read_only) } static void -rpage_get_objects_for_uid_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +rpage_get_objects_for_uid_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ECalClient *client = E_CAL_CLIENT (source_object); RecurrencePage *rpage = user_data; @@ -639,7 +644,9 @@ rpage_get_objects_for_uid_cb (GObject *source_object, GAsyncResult *result, gpoi } static void -rpage_get_object_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +rpage_get_object_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { ECalClient *client = E_CAL_CLIENT (source_object); RecurrencePage *rpage = user_data; @@ -711,24 +718,12 @@ sensitize_buttons (RecurrencePage *rpage) } } -#if 0 -/* Encondes a position/weekday pair into the proper format for - * icalrecurrencetype.by_day. Not needed at present. - */ -static short -nth_weekday (gint pos, icalrecurrencetype_weekday weekday) -{ - g_assert (pos > 0 && pos <= 5); - - return (pos << 3) | (gint) weekday; -} -#endif - /* Gets the simple recurrence data from the recurrence widgets and stores it in * the calendar component. */ static void -simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) +simple_recur_to_comp (RecurrencePage *rpage, + ECalComponent *comp) { RecurrencePagePrivate *priv; struct icalrecurrencetype r; @@ -820,8 +815,8 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) break; /* Outlook 2000 uses BYDAY=TU;BYSETPOS=2, and will not - accept BYDAY=2TU. So we now use the same as Outlook - by default. */ + * accept BYDAY=2TU. So we now use the same as Outlook + * by default. */ case MONTH_DAY_MON: r.by_day[0] = ICAL_MONDAY_WEEKDAY; r.by_set_pos[0] = month_num; @@ -890,7 +885,7 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) g_return_if_fail (E_IS_DATE_EDIT (priv->ending_date_edit)); /* We only allow a DATE value to be set for the UNTIL property, - since we don't support sub-day recurrences. */ + * since we don't support sub-day recurrences. */ date_set = e_date_edit_get_date (E_DATE_EDIT (priv->ending_date_edit), &r.until.year, &r.until.month, @@ -921,7 +916,8 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) * custom recurrence, it leaves it intact. */ static gboolean -fill_component (RecurrencePage *rpage, ECalComponent *comp) +fill_component (RecurrencePage *rpage, + ECalComponent *comp) { RecurrencePagePrivate *priv; gboolean recurs; @@ -1058,7 +1054,11 @@ make_weekly_special (RecurrencePage *rpage) /* Creates the subtree for the monthly recurrence number */ static void -make_recur_month_num_subtree (GtkTreeStore *store, GtkTreeIter *par, const gchar *title, gint start, gint end) +make_recur_month_num_subtree (GtkTreeStore *store, + GtkTreeIter *par, + const gchar *title, + gint start, + gint end) { GtkTreeIter iter, parent; gint i; @@ -1071,12 +1071,13 @@ make_recur_month_num_subtree (GtkTreeStore *store, GtkTreeIter *par, const gchar gtk_tree_store_set (store, &iter, 0, _(e_cal_recur_nth[i]), 1, i + 1, -1); } } + static void -only_leaf_sensitive (GtkCellLayout *cell_layout, - GtkCellRenderer *cell, - GtkTreeModel *tree_model, - GtkTreeIter *iter, - gpointer data) +only_leaf_sensitive (GtkCellLayout *cell_layout, + GtkCellRenderer *cell, + GtkTreeModel *tree_model, + GtkTreeIter *iter, + gpointer data) { gboolean sensitive; @@ -1184,8 +1185,8 @@ make_recur_month_combobox (void) { static const gchar *options[] = { /* For Translator : 'day' is part of the sentence of the form 'appointment recurs/Every [x] month(s) on the [first] [day] [forever]' - (dropdown menu options are in[square brackets]). This means that after 'first', either the string 'day' or - the name of a week day (like 'Monday' or 'Friday') always follow. */ + * (dropdown menu options are in[square brackets]). This means that after 'first', either the string 'day' or + * the name of a week day (like 'Monday' or 'Friday') always follow. */ N_("day"), N_("Monday"), N_("Tuesday"), @@ -1209,7 +1210,8 @@ make_recur_month_combobox (void) } static void -month_num_combo_changed_cb (GtkComboBox *combo, RecurrencePage *rpage) +month_num_combo_changed_cb (GtkComboBox *combo, + RecurrencePage *rpage) { GtkTreeIter iter; RecurrencePagePrivate *priv; @@ -1269,7 +1271,8 @@ month_num_combo_changed_cb (GtkComboBox *combo, RecurrencePage *rpage) * are 1-31 while a Sunday is the 1st through 5th. */ static void -month_day_combo_changed_cb (GtkComboBox *combo, RecurrencePage *rpage) +month_day_combo_changed_cb (GtkComboBox *combo, + RecurrencePage *rpage) { RecurrencePagePrivate *priv; enum month_num_options month_num; @@ -1403,7 +1406,8 @@ make_recurrence_special (RecurrencePage *rpage) /* Counts the elements in the by_xxx fields of an icalrecurrencetype */ static gint -count_by_xxx (gshort *field, gint max_elements) +count_by_xxx (gshort *field, + gint max_elements) { gint i; @@ -1456,7 +1460,7 @@ make_ending_until_special (RecurrencePage *rpage) G_CALLBACK (comp_editor_page_changed), rpage); /* Make sure the EDateEdit widget uses our timezones to get the - current time. */ + * current time. */ e_date_edit_set_get_time_callback ( de, (EDateEditGetTimeCallback) comp_editor_get_current_time, @@ -1554,7 +1558,8 @@ make_ending_special (RecurrencePage *rpage) * component. */ static void -fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r) +fill_ending_date (RecurrencePage *rpage, + struct icalrecurrencetype *r) { RecurrencePagePrivate *priv = rpage->priv; CompEditor *editor; @@ -1635,7 +1640,8 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r) * no rdates or exrules (exdates are handled just fine elsewhere). */ static gboolean -recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) +recurrence_page_fill_widgets (CompEditorPage *page, + ECalComponent *comp) { RecurrencePage *rpage; RecurrencePagePrivate *priv; @@ -1867,8 +1873,8 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) enum month_day_options month_day; /* Outlook 2000 uses BYDAY=TU;BYSETPOS=2, and will not - accept BYDAY=2TU. So we now use the same as Outlook - by default. */ + * accept BYDAY=2TU. So we now use the same as Outlook + * by default. */ weekday = icalrecurrencetype_day_day_of_week (r->by_day[0]); pos = icalrecurrencetype_day_position (r->by_day[0]); @@ -1988,7 +1994,8 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) /* fill_component handler for the recurrence page */ static gboolean -recurrence_page_fill_component (CompEditorPage *page, ECalComponent *comp) +recurrence_page_fill_component (CompEditorPage *page, + ECalComponent *comp) { RecurrencePage *rpage; @@ -1998,7 +2005,8 @@ recurrence_page_fill_component (CompEditorPage *page, ECalComponent *comp) /* set_dates handler for the recurrence page */ static void -recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates) +recurrence_page_set_dates (CompEditorPage *page, + CompEditorPageDates *dates) { RecurrencePage *rpage; RecurrencePagePrivate *priv; @@ -2088,7 +2096,7 @@ get_widgets (RecurrencePage *rpage) return FALSE; /* Get the GtkAccelGroup from the toplevel window, so we can install - it when the notebook page is mapped. */ + * it when the notebook page is mapped. */ toplevel = gtk_widget_get_toplevel (priv->main); accel_groups = gtk_accel_groups_from_object (G_OBJECT (toplevel)); if (accel_groups) @@ -2170,7 +2178,9 @@ type_toggled_cb (GtkToggleButton *toggle, } static GtkWidget * -create_exception_dialog (RecurrencePage *rpage, const gchar *title, GtkWidget **date_edit) +create_exception_dialog (RecurrencePage *rpage, + const gchar *title, + GtkWidget **date_edit) { RecurrencePagePrivate *priv; GtkWidget *dialog, *toplevel; @@ -2357,7 +2367,7 @@ 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_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); @@ -2373,7 +2383,7 @@ 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 */ @@ -2402,11 +2412,11 @@ init_widgets (RecurrencePage *rpage) /* Exception buttons */ - g_signal_connect((priv->exception_add), "clicked", + g_signal_connect ((priv->exception_add), "clicked", G_CALLBACK (exception_add_cb), rpage); - g_signal_connect((priv->exception_modify), "clicked", + g_signal_connect ((priv->exception_modify), "clicked", G_CALLBACK (exception_modify_cb), rpage); - g_signal_connect((priv->exception_delete), "clicked", + g_signal_connect ((priv->exception_delete), "clicked", G_CALLBACK (exception_delete_cb), rpage); gtk_widget_set_sensitive (priv->exception_modify, FALSE); -- cgit From 5ddad039926944120fa8f138f3a0039292d736de Mon Sep 17 00:00:00 2001 From: Paul Menzel Date: Thu, 29 Sep 2011 11:59:34 +0200 Subject: Remove Ctrl + l ( ) character from source files From ccc980da1fd84ebfca25cf8caf9a5d62333099fc Mon Sep 17 00:00:00 2001 From: Paul Menzel Date: Wed, 28 Sep 2011 10:18:18 +0200 Subject: [PATCH] Remove Ctrl + l ( ) character from source files The following commits git show aac3f2c8 git show 1510304c git show 13cabd9e git show 350a7a33 git show 9b7cc54d git show e6972011 git show 1d3a7938 git show 934524b9 git show b2954936 git show a7f677b5 git show 4369c400 git show d509f47a git show a6d5818f git show c3876df7 git show 4583098b git show 2831ada5 git show 4e1bce59 git show 1609f699 git show 4e4c1676 git show d6fade43 among others(?) introduced several occurrences of Ctrl + l ( ). Probably this was caused by the used editor. These control characters can be searched for using the following command [1]. $ git grep ^L [1] http://unstableme.blogspot.com/2009/10/grep-and-print-control-characters-in.html --- calendar/gui/dialogs/recurrence-page.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'calendar/gui/dialogs/recurrence-page.c') diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 6f201b596f..54dee77f44 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -189,8 +189,6 @@ struct _RecurrencePagePrivate { GCancellable *cancellable; }; - - static void recurrence_page_finalize (GObject *object); static gboolean fill_component (RecurrencePage *rpage, ECalComponent *comp); @@ -2075,8 +2073,6 @@ recurrence_page_set_dates (CompEditorPage *page, preview_recur (rpage); } - - /* Gets the widgets from the XML file and returns if they are all available. */ static gboolean get_widgets (RecurrencePage *rpage) -- cgit