From 82925c6be94e9e48e4ef521a88a9feec24cf9eef Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 31 Oct 2010 16:02:30 -0400 Subject: Pass an EAlertSink to e_alert_sink_submit_alert(). Passing a random GtkWidget and then searching its ancestors for an EAlertSink turned out to be not as useful as I thought. Most of the time we know about and have access to the widget that implements EAlertSink, so just pass it directly as an EAlertSink. --- calendar/gui/dialogs/comp-editor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index eb908d1e33..af5b23d384 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -834,7 +834,7 @@ action_save_cb (GtkAction *action, if (!e_cal_is_read_only (priv->client, &read_only, NULL) || read_only) { e_alert_submit ( - GTK_WIDGET (editor), + E_ALERT_SINK (editor), "calendar:prompt-read-only-cal-editor", e_source_peek_name ( e_cal_get_source (priv->client)), @@ -1881,7 +1881,7 @@ prompt_and_save_changes (CompEditor *editor, gboolean send) case GTK_RESPONSE_YES: /* Save */ if (!e_cal_is_read_only (priv->client, &read_only, NULL) || read_only) { e_alert_submit ( - GTK_WIDGET (editor), + E_ALERT_SINK (editor), "calendar:prompt-read-only-cal-editor", e_source_peek_name ( e_cal_get_source (priv->client)), -- cgit v1.2.3 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/comp-editor.c | 308 +++++++++++++++++++++++++++++++++++-- 1 file changed, 293 insertions(+), 15 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index af5b23d384..1714ef405d 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -112,6 +113,14 @@ struct _CompEditorPrivate { below */ CompEditorFlags flags; + icaltimezone *zone; + gboolean use_24_hour_format; + + gint work_day_end_hour; + gint work_day_end_minute; + gint work_day_start_hour; + gint work_day_start_minute; + gboolean changed; gboolean needs_send; @@ -131,7 +140,13 @@ enum { PROP_FLAGS, PROP_FOCUS_TRACKER, PROP_SHELL, - PROP_SUMMARY + PROP_SUMMARY, + PROP_TIMEZONE, + PROP_USE_24_HOUR_FORMAT, + PROP_WORK_DAY_END_HOUR, + PROP_WORK_DAY_END_MINUTE, + PROP_WORK_DAY_START_HOUR, + PROP_WORK_DAY_START_MINUTE }; static const gchar *ui = @@ -731,11 +746,12 @@ action_print_cb (GtkAction *action, CompEditor *editor) { CompEditorPrivate *priv = editor->priv; - GtkPrintOperationAction print_action; ECalComponent *comp; GList *l; icalcomponent *component; icalcomponent *clone; + icaltimezone *zone; + gboolean use_24_hour_format; comp = e_cal_component_new (); component = e_cal_component_get_icalcomponent (priv->comp); @@ -745,8 +761,12 @@ action_print_cb (GtkAction *action, for (l = priv->pages; l != NULL; l = l->next) comp_editor_page_fill_component (l->data, comp); - print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG; - print_comp (comp, priv->client, print_action); + zone = comp_editor_get_timezone (editor); + use_24_hour_format = comp_editor_get_use_24_hour_format (editor); + + print_comp ( + comp, priv->client, zone, use_24_hour_format, + GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG); g_object_unref (comp); } @@ -756,11 +776,12 @@ action_print_preview_cb (GtkAction *action, CompEditor *editor) { CompEditorPrivate *priv = editor->priv; - GtkPrintOperationAction print_action; ECalComponent *comp; GList *l; icalcomponent *component; icalcomponent *clone; + icaltimezone *zone; + gboolean use_24_hour_format; comp = e_cal_component_new (); component = e_cal_component_get_icalcomponent (priv->comp); @@ -770,8 +791,12 @@ action_print_preview_cb (GtkAction *action, for (l = priv->pages; l != NULL; l = l->next) comp_editor_page_fill_component (l->data, comp); - print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW; - print_comp (comp, priv->client, print_action); + zone = comp_editor_get_timezone (editor); + use_24_hour_format = comp_editor_get_use_24_hour_format (editor); + + print_comp ( + comp, priv->client, zone, use_24_hour_format, + GTK_PRINT_OPERATION_ACTION_PREVIEW); g_object_unref (comp); } @@ -1271,6 +1296,42 @@ comp_editor_set_property (GObject *object, COMP_EDITOR (object), g_value_get_string (value)); return; + + case PROP_TIMEZONE: + comp_editor_set_timezone ( + COMP_EDITOR (object), + g_value_get_pointer (value)); + return; + + case PROP_USE_24_HOUR_FORMAT: + comp_editor_set_use_24_hour_format ( + COMP_EDITOR (object), + g_value_get_boolean (value)); + return; + + case PROP_WORK_DAY_END_HOUR: + comp_editor_set_work_day_end_hour ( + COMP_EDITOR (object), + g_value_get_int (value)); + return; + + case PROP_WORK_DAY_END_MINUTE: + comp_editor_set_work_day_end_minute ( + COMP_EDITOR (object), + g_value_get_int (value)); + return; + + case PROP_WORK_DAY_START_HOUR: + comp_editor_set_work_day_start_hour ( + COMP_EDITOR (object), + g_value_get_int (value)); + return; + + case PROP_WORK_DAY_START_MINUTE: + comp_editor_set_work_day_start_minute ( + COMP_EDITOR (object), + g_value_get_int (value)); + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -1318,6 +1379,42 @@ comp_editor_get_property (GObject *object, value, comp_editor_get_summary ( COMP_EDITOR (object))); return; + + case PROP_TIMEZONE: + g_value_set_pointer ( + value, comp_editor_get_timezone ( + COMP_EDITOR (object))); + return; + + case PROP_USE_24_HOUR_FORMAT: + g_value_set_boolean ( + value, comp_editor_get_use_24_hour_format ( + COMP_EDITOR (object))); + return; + + case PROP_WORK_DAY_END_HOUR: + g_value_set_int ( + value, comp_editor_get_work_day_end_hour ( + COMP_EDITOR (object))); + return; + + case PROP_WORK_DAY_END_MINUTE: + g_value_set_int ( + value, comp_editor_get_work_day_end_minute ( + COMP_EDITOR (object))); + return; + + case PROP_WORK_DAY_START_HOUR: + g_value_set_int ( + value, comp_editor_get_work_day_start_hour ( + COMP_EDITOR (object))); + return; + + case PROP_WORK_DAY_START_MINUTE: + g_value_set_int ( + value, comp_editor_get_work_day_start_minute ( + COMP_EDITOR (object))); + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -1605,14 +1702,81 @@ comp_editor_class_init (CompEditorClass *class) NULL, G_PARAM_READWRITE)); - signals[OBJECT_CREATED] = - g_signal_new ("object_created", - G_TYPE_FROM_CLASS (class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (CompEditorClass, object_created), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + g_object_class_install_property ( + object_class, + PROP_TIMEZONE, + g_param_spec_pointer ( + "timezone", + "Time Zone", + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_USE_24_HOUR_FORMAT, + g_param_spec_boolean ( + "use-24-hour-format", + "Use 24-hour Format", + NULL, + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_WORK_DAY_END_HOUR, + g_param_spec_int ( + "work-day-end-hour", + "Work Day End Hour", + NULL, + 0, + 23, + 0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_WORK_DAY_END_MINUTE, + g_param_spec_int ( + "work-day-end-minute", + "Work Day End Minute", + NULL, + 0, + 59, + 0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_WORK_DAY_START_HOUR, + g_param_spec_int ( + "work-day-start-hour", + "Work Day Start Hour", + NULL, + 0, + 23, + 0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_WORK_DAY_START_MINUTE, + g_param_spec_int ( + "work-day-start-minute", + "Work Day Start Minute", + NULL, + 0, + 59, + 0, + G_PARAM_READWRITE)); + + signals[OBJECT_CREATED] = g_signal_new ( + "object_created", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (CompEditorClass, object_created), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } static void @@ -2091,6 +2255,120 @@ comp_editor_get_summary (CompEditor *editor) return editor->priv->summary; } +icaltimezone * +comp_editor_get_timezone (CompEditor *editor) +{ + g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); + + return editor->priv->zone; +} + +void +comp_editor_set_timezone (CompEditor *editor, + icaltimezone *zone) +{ + g_return_if_fail (IS_COMP_EDITOR (editor)); + + editor->priv->zone = zone; + + g_object_notify (G_OBJECT (editor), "timezone"); +} + +gboolean +comp_editor_get_use_24_hour_format (CompEditor *editor) +{ + g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); + + return editor->priv->use_24_hour_format; +} + +void +comp_editor_set_use_24_hour_format (CompEditor *editor, + gboolean use_24_hour_format) +{ + g_return_if_fail (IS_COMP_EDITOR (editor)); + + editor->priv->use_24_hour_format = use_24_hour_format; + + g_object_notify (G_OBJECT (editor), "use-24-hour-format"); +} + +gint +comp_editor_get_work_day_end_hour (CompEditor *editor) +{ + g_return_val_if_fail (IS_COMP_EDITOR (editor), 0); + + return editor->priv->work_day_end_hour; +} + +void +comp_editor_set_work_day_end_hour (CompEditor *editor, + gint work_day_end_hour) +{ + g_return_if_fail (IS_COMP_EDITOR (editor)); + + editor->priv->work_day_end_hour = work_day_end_hour; + + g_object_notify (G_OBJECT (editor), "work-day-end-hour"); +} + +gint +comp_editor_get_work_day_end_minute (CompEditor *editor) +{ + g_return_val_if_fail (IS_COMP_EDITOR (editor), 0); + + return editor->priv->work_day_end_minute; +} + +void +comp_editor_set_work_day_end_minute (CompEditor *editor, + gint work_day_end_minute) +{ + g_return_if_fail (IS_COMP_EDITOR (editor)); + + editor->priv->work_day_end_minute = work_day_end_minute; + + g_object_notify (G_OBJECT (editor), "work-day-end-minute"); +} + +gint +comp_editor_get_work_day_start_hour (CompEditor *editor) +{ + g_return_val_if_fail (IS_COMP_EDITOR (editor), 0); + + return editor->priv->work_day_start_hour; +} + +void +comp_editor_set_work_day_start_hour (CompEditor *editor, + gint work_day_start_hour) +{ + g_return_if_fail (IS_COMP_EDITOR (editor)); + + editor->priv->work_day_start_hour = work_day_start_hour; + + g_object_notify (G_OBJECT (editor), "work-day-start-hour"); +} + +gint +comp_editor_get_work_day_start_minute (CompEditor *editor) +{ + g_return_val_if_fail (IS_COMP_EDITOR (editor), 0); + + return editor->priv->work_day_start_minute; +} + +void +comp_editor_set_work_day_start_minute (CompEditor *editor, + gint work_day_start_minute) +{ + g_return_if_fail (IS_COMP_EDITOR (editor)); + + editor->priv->work_day_start_minute = work_day_start_minute; + + g_object_notify (G_OBJECT (editor), "work-day-start-minute"); +} + /** * comp_editor_set_changed: * @editor: A component editor -- cgit v1.2.3 From 22b2d26d048476d4909bfcf348ce6567e0d006a0 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 6 Dec 2010 14:23:20 +0100 Subject: Free/busy meeting view doesn't work due to non-working extension --- calendar/gui/dialogs/comp-editor.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 1714ef405d..08b6ac7e8e 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -210,7 +210,8 @@ static void obj_removed_cb (ECal *client, GList *uids, CompEditor *editor); G_DEFINE_TYPE_WITH_CODE ( CompEditor, comp_editor, GTK_TYPE_WINDOW, - G_IMPLEMENT_INTERFACE (E_TYPE_ALERT_SINK, NULL)) + G_IMPLEMENT_INTERFACE (E_TYPE_ALERT_SINK, NULL); + G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL)) enum { OBJECT_CREATED, @@ -1497,6 +1498,16 @@ comp_editor_finalize (GObject *object) G_OBJECT_CLASS (comp_editor_parent_class)->finalize (object); } +static void +comp_editor_constructed (GObject *object) +{ + e_extensible_load_extensions (E_EXTENSIBLE (object)); + + /* Chain up to parent's constructed() method. */ + if (G_OBJECT_CLASS (comp_editor_parent_class)->constructed) + G_OBJECT_CLASS (comp_editor_parent_class)->constructed (object); +} + static void comp_editor_bind_gconf (CompEditor *editor) { @@ -1624,6 +1635,7 @@ comp_editor_class_init (CompEditorClass *class) object_class->get_property = comp_editor_get_property; object_class->dispose = comp_editor_dispose; object_class->finalize = comp_editor_finalize; + object_class->constructed = comp_editor_constructed; widget_class = GTK_WIDGET_CLASS (class); widget_class->delete_event = comp_editor_delete_event; @@ -3420,4 +3432,3 @@ obj_removed_cb (ECal *client, if (changed_component_dialog ((GtkWindow *) editor, priv->comp, TRUE, priv->changed)) close_dialog (editor); } - -- cgit v1.2.3 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/comp-editor.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 08b6ac7e8e..b62e5f2aa8 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -60,9 +60,6 @@ #include "e-util/e-alert-dialog.h" #include "e-util/e-ui-manager.h" -/* backward-compatibility cruft */ -#include "e-util/gtk-compat.h" - #define COMP_EDITOR_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), TYPE_COMP_EDITOR, CompEditorPrivate)) -- cgit v1.2.3 From 9bd1641646ba98139dcd1fac959165c871e0f979 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 24 Jan 2011 13:30:38 +0100 Subject: Various critical warnings about comp-editor-pages and date edit --- calendar/gui/dialogs/comp-editor.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index b62e5f2aa8..0115f85a0e 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1418,6 +1418,27 @@ comp_editor_get_property (GObject *object, G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } +static void +unref_page_cb (gpointer editor_page, gpointer comp_editor) +{ + if (IS_COMP_EDITOR_PAGE (editor_page)) { + GtkWidget *page_widget; + CompEditorPage *page = COMP_EDITOR_PAGE (editor_page); + CompEditor *editor = COMP_EDITOR (comp_editor); + + g_return_if_fail (page != NULL); + g_return_if_fail (editor != NULL); + + page_widget = comp_editor_page_get_widget (page); + g_signal_handlers_disconnect_matched ( + page_widget, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, page); + } + + g_signal_handlers_disconnect_matched ( + editor_page, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, comp_editor); + g_object_unref (editor_page); +} + static void comp_editor_dispose (GObject *object) { @@ -1464,7 +1485,7 @@ comp_editor_dispose (GObject *object) /* We want to destroy the pages after the widgets get destroyed, since they have lots of signal handlers connected to the widgets with the pages as the data. */ - g_list_foreach (priv->pages, (GFunc) g_object_unref, NULL); + g_list_foreach (priv->pages, (GFunc) unref_page_cb, object); g_list_free (priv->pages); priv->pages = NULL; @@ -2589,8 +2610,7 @@ page_unmapped_cb (GtkWidget *page_widget, return; if (page->accel_group) { - gtk_window_remove_accel_group (GTK_WINDOW (toplevel), - page->accel_group); + gtk_window_remove_accel_group (GTK_WINDOW (toplevel), page->accel_group); } } -- cgit v1.2.3 From 0109aa3a92b484ebb85c6481e5a8e39819b1f011 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 30 Jan 2011 11:32:55 -0500 Subject: More whitespace cleanup. --- calendar/gui/dialogs/comp-editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 0115f85a0e..7628f7f1bb 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -229,7 +229,7 @@ static void attachment_store_changed_cb (CompEditor *editor) { /* Mark the editor as changed so it prompts about unsaved - changes on close */ + changes on close */ comp_editor_set_changed (editor, TRUE); } -- cgit v1.2.3 From 0478e01708ab2460901f7a2fb8cae749a4e85c45 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 3 Feb 2011 10:45:03 +0100 Subject: Bug #641011 - Ugly appointment editing windows --- calendar/gui/dialogs/comp-editor.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 7628f7f1bb..eaecd1b8e8 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -2644,8 +2644,10 @@ comp_editor_append_widget (CompEditor *editor, priv->pages = g_list_append (priv->pages, page); - if (add) + if (add) { gtk_notebook_append_page (priv->notebook, page, label_widget); + gtk_container_child_set (GTK_CONTAINER (priv->notebook), page, "tab-fill", FALSE, "tab-expand", FALSE, NULL); + } /* Listen for when the page is mapped/unmapped so we can install/uninstall the appropriate GtkAccelGroup. @@ -2706,8 +2708,10 @@ comp_editor_append_page (CompEditor *editor, priv->pages = g_list_append (priv->pages, page); - if (add) + if (add) { gtk_notebook_append_page (priv->notebook, page_widget, label_widget); + gtk_container_child_set (GTK_CONTAINER (priv->notebook), page_widget, "tab-fill", FALSE, "tab-expand", FALSE, NULL); + } /* Listen for things happening on the page */ g_signal_connect_swapped ( -- cgit v1.2.3 From 7a1677520d439aee68c5ab0268a951d0b411e3a0 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 12 Feb 2011 11:37:05 -0500 Subject: Remove NULL checks for GObject methods. As of GLib 2.28 all GObject virtual methods, including constructed(), are safe to chain up to unconditionally. Remove unnecessary checks. --- calendar/gui/dialogs/comp-editor.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index eaecd1b8e8..846be18152 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1522,8 +1522,7 @@ comp_editor_constructed (GObject *object) e_extensible_load_extensions (E_EXTENSIBLE (object)); /* Chain up to parent's constructed() method. */ - if (G_OBJECT_CLASS (comp_editor_parent_class)->constructed) - G_OBJECT_CLASS (comp_editor_parent_class)->constructed (object); + G_OBJECT_CLASS (comp_editor_parent_class)->constructed (object); } static void -- cgit v1.2.3 From fcb29478f605deb787c62fc7567c5c7f897585bb Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 18 Feb 2011 19:35:59 -0500 Subject: Coding style and whitespace cleanup. --- calendar/gui/dialogs/comp-editor.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 846be18152..769263e88a 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -2645,7 +2645,9 @@ comp_editor_append_widget (CompEditor *editor, if (add) { gtk_notebook_append_page (priv->notebook, page, label_widget); - gtk_container_child_set (GTK_CONTAINER (priv->notebook), page, "tab-fill", FALSE, "tab-expand", FALSE, NULL); + gtk_container_child_set ( + GTK_CONTAINER (priv->notebook), page, + "tab-fill", FALSE, "tab-expand", FALSE, NULL); } /* Listen for when the page is mapped/unmapped so we can @@ -2708,8 +2710,11 @@ comp_editor_append_page (CompEditor *editor, priv->pages = g_list_append (priv->pages, page); if (add) { - gtk_notebook_append_page (priv->notebook, page_widget, label_widget); - gtk_container_child_set (GTK_CONTAINER (priv->notebook), page_widget, "tab-fill", FALSE, "tab-expand", FALSE, NULL); + gtk_notebook_append_page ( + priv->notebook, page_widget, label_widget); + gtk_container_child_set ( + GTK_CONTAINER (priv->notebook), page_widget, + "tab-fill", FALSE, "tab-expand", FALSE, NULL); } /* Listen for things happening on the page */ -- cgit v1.2.3 From 3d3717365d022bc9a7b2d50b0aa33927416cd165 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 24 Feb 2011 09:23:03 +0100 Subject: Bug #642954 - Doesn't commit/abort sequence on modification error --- calendar/gui/dialogs/comp-editor.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 769263e88a..2bb258b0e7 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -492,12 +492,11 @@ save_comp (CompEditor *editor) } result = e_cal_modify_object (priv->client, icalcomp, priv->mod, &error); - if (result && priv->mod == CALOBJ_MOD_THIS) { - /* FIXME do we really need to do this ? */ - if ((flags & COMP_EDITOR_DELEGATE) || + if (priv->mod == CALOBJ_MOD_THIS) { + if (result && ((flags & COMP_EDITOR_DELEGATE) || !e_cal_component_has_organizer (clone) || itip_organizer_is_user (clone, priv->client) || - itip_sentby_is_user (clone, priv->client)) + itip_sentby_is_user (clone, priv->client))) e_cal_component_commit_sequence (clone); else e_cal_component_abort_sequence (clone); -- cgit v1.2.3 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/comp-editor.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 2bb258b0e7..2d0f524c10 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -60,10 +60,6 @@ #include "e-util/e-alert-dialog.h" #include "e-util/e-ui-manager.h" -#define COMP_EDITOR_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), TYPE_COMP_EDITOR, CompEditorPrivate)) - #define d(x) /* Private part of the CompEditor structure */ @@ -1443,7 +1439,7 @@ comp_editor_dispose (GObject *object) { CompEditorPrivate *priv; - priv = COMP_EDITOR_GET_PRIVATE (object); + priv = COMP_EDITOR (object)->priv; if (priv->shell != NULL) { g_object_remove_weak_pointer ( @@ -1507,7 +1503,7 @@ comp_editor_finalize (GObject *object) { CompEditorPrivate *priv; - priv = COMP_EDITOR_GET_PRIVATE (object); + priv = COMP_EDITOR (object)->priv; g_free (priv->summary); @@ -1608,7 +1604,7 @@ comp_editor_drag_motion (GtkWidget *widget, CompEditorPrivate *priv; EAttachmentView *view; - priv = COMP_EDITOR_GET_PRIVATE (widget); + priv = COMP_EDITOR (widget)->priv; view = E_ATTACHMENT_VIEW (priv->attachment_view); return e_attachment_view_drag_motion (view, context, x, y, time); @@ -1626,7 +1622,7 @@ comp_editor_drag_data_received (GtkWidget *widget, CompEditorPrivate *priv; EAttachmentView *view; - priv = COMP_EDITOR_GET_PRIVATE (widget); + priv = COMP_EDITOR (widget)->priv; view = E_ATTACHMENT_VIEW (priv->attachment_view); /* Forward the data to the attachment view. Note that calling @@ -1835,7 +1831,7 @@ comp_editor_init (CompEditor *editor) express_mode = e_shell_get_express_mode (shell); meego_mode = e_shell_get_meego_mode (shell); - editor->priv = priv = COMP_EDITOR_GET_PRIVATE (editor); + editor->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (editor, TYPE_COMP_EDITOR, CompEditorPrivate); g_object_weak_ref ( G_OBJECT (editor), (GWeakNotify) -- cgit v1.2.3 From b22ac14482bbf215e5ad457104580c624706feda Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 1 Mar 2011 13:04:09 -0500 Subject: Fix Gtk-Doc comment notation. Seeing lots of what I assume to be doxygen syntax in comment blocks. --- calendar/gui/dialogs/comp-editor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 2d0f524c10..b6be8bd7e6 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -3193,11 +3193,11 @@ comp_editor_get_comp (CompEditor *editor) /** * comp_editor_get_current_comp + * @editor: a #CompEditor + * @correct: Set this no non-%NULL if you are interested to know if all + * pages reported success when filling component. * - * @param editor - * @param correct Set this no non-NULL if you are interested to know if - * all pages reported success when filling component. - * @return Newly allocated component, should be unref-ed by g_object_unref. + * Returns: Newly allocated component, should be unref-ed by g_object_unref(). **/ ECalComponent * comp_editor_get_current_comp (CompEditor *editor, gboolean *correct) -- cgit v1.2.3 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/comp-editor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index b6be8bd7e6..0e4250c7c1 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1831,7 +1831,8 @@ comp_editor_init (CompEditor *editor) express_mode = e_shell_get_express_mode (shell); meego_mode = e_shell_get_meego_mode (shell); - editor->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (editor, TYPE_COMP_EDITOR, CompEditorPrivate); + editor->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE ( + editor, TYPE_COMP_EDITOR, CompEditorPrivate); g_object_weak_ref ( G_OBJECT (editor), (GWeakNotify) -- cgit v1.2.3 From 5bcf04619f76183562f0649c66e7d22a7be5b35e Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 8 Mar 2011 07:39:47 -0500 Subject: Bug 644166 - Add style class to primary toolbars Requires GTK+ >= 3.0.2 since GTK_STYLE_CLASS_PRIMARY_TOOLBAR is a very recent addition. --- calendar/gui/dialogs/comp-editor.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 0e4250c7c1..1d6fa36653 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1965,6 +1965,10 @@ comp_editor_init (CompEditor *editor) gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); gtk_widget_show (widget); + gtk_style_context_add_class ( + gtk_widget_get_style_context (widget), + GTK_STYLE_CLASS_PRIMARY_TOOLBAR); + widget = e_attachment_paned_new (); gtk_container_set_border_width (GTK_CONTAINER (widget), 6); gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); -- cgit v1.2.3 From 4cfb84c573f21ca7519e24cff1c5742b715355c4 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 7 May 2011 12:22:36 -0400 Subject: Whitespace and coding style cleanups. --- calendar/gui/dialogs/comp-editor.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 1d6fa36653..1d4c74e43c 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -458,7 +458,8 @@ save_comp (CompEditor *editor) priv->comp = clone; e_cal_component_get_uid (priv->comp, &orig_uid); - /* make a copy of it, because call of e_cal_create_object rewrites the internal uid */ + /* Make a copy of it, because call of e_cal_create_object() + * rewrites the internal uid. */ orig_uid_copy = g_strdup (orig_uid); /* send timezones */ @@ -467,8 +468,8 @@ save_comp (CompEditor *editor) /* Attachments*/ - e_cal_component_set_attachment_list (priv->comp, - get_attachment_list (editor)); + e_cal_component_set_attachment_list ( + priv->comp, get_attachment_list (editor)); icalcomp = e_cal_component_get_icalcomponent (priv->comp); /* send the component to the server */ if (!cal_comp_is_on_server (priv->comp, priv->client)) { @@ -627,11 +628,15 @@ save_comp_with_send (CompEditor *editor) editor, E_CAL_COMPONENT_METHOD_REQUEST, strip_alarms); } else { - if (!comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REQUEST, strip_alarms)) + if (!comp_editor_send_comp ( + editor, E_CAL_COMPONENT_METHOD_REQUEST, + strip_alarms)) return FALSE; if (delegate) - return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REPLY, strip_alarms); + return comp_editor_send_comp ( + editor, E_CAL_COMPONENT_METHOD_REPLY, + strip_alarms); } } @@ -877,7 +882,8 @@ action_save_cb (GtkAction *action, return; if (!text.value) - if (!send_component_prompt_subject ((GtkWindow *) editor, priv->client, priv->comp)) + if (!send_component_prompt_subject ( + (GtkWindow *) editor, priv->client, priv->comp)) return; if (save_comp_with_send (editor)) { @@ -2091,7 +2097,8 @@ prompt_and_save_changes (CompEditor *editor, gboolean send) return FALSE; if (!text.value) - if (!send_component_prompt_subject ((GtkWindow *) editor, priv->client, priv->comp)) + if (!send_component_prompt_subject ( + (GtkWindow *) editor, priv->client, priv->comp)) return FALSE; if (e_cal_component_is_instance (priv->comp)) -- cgit v1.2.3 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/comp-editor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 1d4c74e43c..983b42cdee 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -841,12 +841,12 @@ action_save_cb (GtkAction *action, ECalComponentVType vtype = e_cal_component_get_vtype (editor->priv->comp); if (vtype == E_CAL_COMPONENT_EVENT) - response = em_utils_prompt_user ((GtkWindow *)widget, + response = em_utils_prompt_user ((GtkWindow *) widget, NULL, "calendar:ask-send-event-pending-download", NULL); else - response = em_utils_prompt_user ((GtkWindow *)widget, + response = em_utils_prompt_user ((GtkWindow *) widget, NULL, "calendar:ask-send-task-pending-download", NULL); @@ -2959,7 +2959,7 @@ fill_widgets (CompEditor *editor) g_signal_handlers_unblock_by_func ( store, G_CALLBACK (attachment_store_changed_cb), editor); - g_slist_foreach (attachment_list, (GFunc)g_free, NULL); + g_slist_foreach (attachment_list, (GFunc) g_free, NULL); g_slist_free (attachment_list); } @@ -3369,7 +3369,7 @@ comp_editor_get_mime_attach_list (CompEditor *editor) camel_mime_part_set_content_id (mime_part, NULL); - cal_mime_attach->encoded_data = (gchar *)buffer; + cal_mime_attach->encoded_data = (gchar *) buffer; cal_mime_attach->length = byte_array->len; cal_mime_attach->filename = g_strdup (camel_mime_part_get_filename (mime_part)); -- cgit v1.2.3 From cb97c2dc8fd97b381af048f206333d5e557892ae Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 21 May 2011 10:02:58 -0400 Subject: Coding style and whitespace cleanup. --- calendar/gui/dialogs/comp-editor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 983b42cdee..c8640b608a 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -3461,6 +3461,7 @@ obj_removed_cb (ECal *client, { CompEditorPrivate *priv = editor->priv; - if (changed_component_dialog ((GtkWindow *) editor, priv->comp, TRUE, priv->changed)) + if (changed_component_dialog ( + GTK_WINDOW (editor), priv->comp, TRUE, priv->changed)) close_dialog (editor); } -- cgit v1.2.3 From f014ab82c81078d60cb1df8c986305c2cc9948c2 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 4 Jun 2011 15:53:10 -0500 Subject: Coding style and whitespace cleanups. --- calendar/gui/dialogs/comp-editor.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index c8640b608a..cc794ae3f5 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -477,9 +477,14 @@ save_comp (CompEditor *editor) if (result) g_signal_emit_by_name (editor, "object_created"); } else { + gboolean has_recurrences; - if (e_cal_component_has_recurrences (priv->comp) && priv->mod == CALOBJ_MOD_ALL) - comp_util_sanitize_recurrence_master (priv->comp, priv->client); + has_recurrences = + e_cal_component_has_recurrences (priv->comp); + + if (has_recurrences && priv->mod == CALOBJ_MOD_ALL) + comp_util_sanitize_recurrence_master ( + priv->comp, priv->client); if (priv->mod == CALOBJ_MOD_THIS) { e_cal_component_set_rdate_list (priv->comp, NULL); @@ -904,7 +909,9 @@ action_save_cb (GtkAction *action, e_cal_component_has_recurrences (priv->comp)) { gchar *rid; rid = e_cal_component_get_recurid_as_string (priv->comp); - e_cal_remove_object_with_mod (priv->client, uid, rid, priv->mod, &error); + e_cal_remove_object_with_mod ( + priv->client, uid, rid, + priv->mod, &error); g_free (rid); } else e_cal_remove_object (priv->client, uid, &error); @@ -3020,8 +3027,8 @@ set_attendees_for_delegation (ECalComponent *comp, icalcomp = e_cal_component_get_icalcomponent (comp); for (prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY); - prop; - prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) { + prop; + prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) { const gchar *attendee = icalproperty_get_attendee (prop); const gchar *delfrom = NULL; @@ -3049,14 +3056,17 @@ get_users_from_memo_comp (ECalComponent *comp, GList **users) icalcomp = e_cal_component_get_icalcomponent (comp); for (icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY); - icalprop != NULL; - icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY)) { - if (g_str_equal (icalproperty_get_x_name (icalprop), "X-EVOLUTION-RECIPIENTS")) { + icalprop != NULL; + icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY)) { + const gchar *x_name; + + x_name = icalproperty_get_x_name (icalprop); + + if (g_str_equal (x_name, "X-EVOLUTION-RECIPIENTS")) break; - } } - if (icalprop) { + if (icalprop) { attendees = icalproperty_get_x (icalprop); emails = g_strsplit (attendees, ";", -1); -- cgit v1.2.3 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/comp-editor.c | 230 +++++++++++++++++++++++-------------- 1 file changed, 142 insertions(+), 88 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index cc794ae3f5..21ac86e9c3 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -43,6 +43,9 @@ #include #include +#include +#include + #include "../print.h" #include "../comp-util.h" #include "save-comp.h" @@ -75,13 +78,14 @@ struct _CompEditorPrivate { GtkWindowGroup *window_group; /* Client to use */ - ECal *client; + ECalClient *cal_client; /* Source client (where comp lives currently) */ - ECal *source_client; + ECalClient *source_client; /* View to listen for changes */ - ECalView *view; + ECalClientView *view; + GCancellable *view_cancellable; /* Calendar object/uid we are editing; this is an internal copy */ ECalComponent *comp; @@ -198,8 +202,8 @@ static void page_dates_changed_cb (CompEditor *editor, CompEditorPageDates *dates, CompEditorPage *page); -static void obj_modified_cb (ECal *client, GList *objs, CompEditor *editor); -static void obj_removed_cb (ECal *client, GList *uids, CompEditor *editor); +static void obj_modified_cb (ECalClientView *view, const GSList *objs, CompEditor *editor); +static void obj_removed_cb (ECalClientView *view, const GSList *uids, CompEditor *editor); G_DEFINE_TYPE_WITH_CODE ( CompEditor, comp_editor, GTK_TYPE_WINDOW, @@ -303,7 +307,7 @@ get_attachment_list (CompEditor *editor) view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); store = e_attachment_view_get_store (view); - local_store = e_cal_get_local_attachment_store (editor->priv->client); + local_store = e_cal_client_get_local_attachment_store (editor->priv->cal_client); e_cal_component_get_uid (editor->priv->comp, &comp_uid); path = g_build_path ("/", local_store, comp_uid, NULL); destination = g_file_new_for_path (path); @@ -343,6 +347,40 @@ commit_all_fields (CompEditor *editor) gtk_window_set_focus (GTK_WINDOW (editor), NULL); } +static void +changes_view_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +{ + CompEditor *editor = user_data; + ECalClientView *view = NULL; + GError *error = NULL; + + g_return_if_fail (editor != NULL); + + if (!e_cal_client_get_view_finish (E_CAL_CLIENT (source_object), result, &view, &error)) + view = NULL; + + if (view) { + editor->priv->view = view; + g_signal_connect ( + view, "objects_modified", + G_CALLBACK (obj_modified_cb), editor); + g_signal_connect ( + view, "objects_removed", + G_CALLBACK (obj_removed_cb), editor); + + e_cal_client_view_start (view, &error); + + if (error) { + g_debug ("%s: Failed to stat view: %s", G_STRFUNC, error->message); + g_error_free (error); + } + } else if (error) { + if (!g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) + g_debug ("%s: Failed to get view: %s", G_STRFUNC, error->message); + g_error_free (error); + } +} + static void listen_for_changes (CompEditor *editor) { @@ -352,6 +390,12 @@ listen_for_changes (CompEditor *editor) priv = editor->priv; /* Discard change listener */ + if (priv->view_cancellable) { + g_cancellable_cancel (priv->view_cancellable); + g_object_unref (priv->view_cancellable); + priv->view_cancellable = NULL; + } + if (priv->view) { g_signal_handlers_disconnect_matched (G_OBJECT (priv->view), G_SIGNAL_MATCH_DATA, @@ -369,21 +413,11 @@ listen_for_changes (CompEditor *editor) if (uid) { gchar *query; + priv->view_cancellable = g_cancellable_new (); query = g_strdup_printf ("(uid? \"%s\")", uid); - e_cal_get_query (priv->source_client, query, &priv->view, NULL); + e_cal_client_get_view (priv->source_client, query, priv->view_cancellable, changes_view_ready_cb, editor); g_free (query); } - - if (priv->view) { - g_signal_connect ( - priv->view, "objects_modified", - G_CALLBACK (obj_modified_cb), editor); - g_signal_connect ( - priv->view, "objects_removed", - G_CALLBACK (obj_removed_cb), editor); - - e_cal_view_start (priv->view); - } } static void @@ -391,8 +425,14 @@ send_timezone (gpointer key, gpointer value, gpointer user_data) { icaltimezone *zone = value; CompEditor *editor = user_data; + GError *error = NULL; + + e_cal_client_add_timezone_sync (editor->priv->cal_client, zone, NULL, &error); - e_cal_add_timezone (editor->priv->client, zone, NULL); + if (error) { + g_debug ("%s: Failed to add timezone: %s", G_STRFUNC, error->message); + g_error_free (error); + } } static gboolean @@ -448,8 +488,8 @@ save_comp (CompEditor *editor) /* If we are not the organizer, we don't update the sequence number */ if (!e_cal_component_has_organizer (clone) || - itip_organizer_is_user (clone, priv->client) || - itip_sentby_is_user (clone, priv->client)) + itip_organizer_is_user (clone, priv->cal_client) || + itip_sentby_is_user (clone, priv->cal_client)) e_cal_component_commit_sequence (clone); else e_cal_component_abort_sequence (clone); @@ -472,10 +512,14 @@ save_comp (CompEditor *editor) priv->comp, get_attachment_list (editor)); icalcomp = e_cal_component_get_icalcomponent (priv->comp); /* send the component to the server */ - if (!cal_comp_is_on_server (priv->comp, priv->client)) { - result = e_cal_create_object (priv->client, icalcomp, NULL, &error); - if (result) + if (!cal_comp_is_on_server (priv->comp, priv->cal_client)) { + gchar *uid = NULL; + result = e_cal_client_create_object_sync (priv->cal_client, icalcomp, &uid, NULL, &error); + if (result) { + icalcomponent_set_uid (icalcomp, uid); + g_free (uid); g_signal_emit_by_name (editor, "object_created"); + } } else { gboolean has_recurrences; @@ -484,7 +528,7 @@ save_comp (CompEditor *editor) if (has_recurrences && priv->mod == CALOBJ_MOD_ALL) comp_util_sanitize_recurrence_master ( - priv->comp, priv->client); + priv->comp, priv->cal_client); if (priv->mod == CALOBJ_MOD_THIS) { e_cal_component_set_rdate_list (priv->comp, NULL); @@ -492,13 +536,13 @@ save_comp (CompEditor *editor) e_cal_component_set_exdate_list (priv->comp, NULL); e_cal_component_set_exrule_list (priv->comp, NULL); } - result = e_cal_modify_object (priv->client, icalcomp, priv->mod, &error); + result = e_cal_client_modify_object_sync (priv->cal_client, icalcomp, priv->mod, NULL, &error); if (priv->mod == CALOBJ_MOD_THIS) { if (result && ((flags & COMP_EDITOR_DELEGATE) || !e_cal_component_has_organizer (clone) || - itip_organizer_is_user (clone, priv->client) || - itip_sentby_is_user (clone, priv->client))) + itip_organizer_is_user (clone, priv->cal_client) || + itip_sentby_is_user (clone, priv->cal_client))) e_cal_component_commit_sequence (clone); else e_cal_component_abort_sequence (clone); @@ -550,25 +594,31 @@ save_comp (CompEditor *editor) return FALSE; } else { if (priv->source_client && - !e_source_equal (e_cal_get_source (priv->client), - e_cal_get_source (priv->source_client)) && + !e_source_equal (e_client_get_source (E_CLIENT (priv->cal_client)), + e_client_get_source (E_CLIENT (priv->source_client))) && cal_comp_is_on_server (priv->comp, priv->source_client)) { /* Comp found a new home. Remove it from old one. */ + GError *error = NULL; if (e_cal_component_is_instance (priv->comp) || e_cal_component_has_recurrences (priv->comp)) - e_cal_remove_object_with_mod ( + e_cal_client_remove_object_sync ( priv->source_client, orig_uid_copy, - NULL, CALOBJ_MOD_ALL, NULL); + NULL, CALOBJ_MOD_ALL, NULL, &error); else - e_cal_remove_object ( + e_cal_client_remove_object_sync ( priv->source_client, - orig_uid_copy, NULL); + orig_uid_copy, NULL, CALOBJ_MOD_THIS, NULL, &error); + + if (error) { + g_debug ("%s: Failed to remove object: %s", G_STRFUNC, error->message); + g_error_free (error); + } /* Let priv->source_client point to new home, * so we can move it again this session. */ g_object_unref (priv->source_client); - priv->source_client = g_object_ref (priv->client); + priv->source_client = g_object_ref (priv->cal_client); listen_for_changes (editor); } @@ -608,9 +658,9 @@ save_comp_with_send (CompEditor *editor) if (!save_comp (editor)) return FALSE; - delegated = delegate && !e_cal_get_save_schedules (priv->client); + delegated = delegate && !e_cal_client_check_save_schedules (priv->cal_client); if (delegated || (send && send_component_dialog ( - (GtkWindow *) editor, priv->client, priv->comp, + (GtkWindow *) editor, priv->cal_client, priv->comp, !priv->existing_org, &strip_alarms, !priv->existing_org ? NULL : &only_new_attendees))) { if (delegated) @@ -622,8 +672,8 @@ save_comp_with_send (CompEditor *editor) (only_new_attendees ? COMP_EDITOR_SEND_TO_NEW_ATTENDEES_ONLY : 0)); - if ((itip_organizer_is_user (priv->comp, priv->client) || - itip_sentby_is_user (priv->comp, priv->client))) { + if ((itip_organizer_is_user (priv->comp, priv->cal_client) || + itip_sentby_is_user (priv->comp, priv->cal_client))) { if (e_cal_component_get_vtype (priv->comp) == E_CAL_COMPONENT_JOURNAL) return comp_editor_send_comp ( editor, E_CAL_COMPONENT_METHOD_PUBLISH, @@ -768,7 +818,7 @@ action_print_cb (GtkAction *action, use_24_hour_format = comp_editor_get_use_24_hour_format (editor); print_comp ( - comp, priv->client, zone, use_24_hour_format, + comp, priv->cal_client, zone, use_24_hour_format, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG); g_object_unref (comp); @@ -798,14 +848,14 @@ action_print_preview_cb (GtkAction *action, use_24_hour_format = comp_editor_get_use_24_hour_format (editor); print_comp ( - comp, priv->client, zone, use_24_hour_format, + comp, priv->cal_client, zone, use_24_hour_format, GTK_PRINT_OPERATION_ACTION_PREVIEW); g_object_unref (comp); } static gboolean -remove_event_dialog (ECal *client, +remove_event_dialog (ECalClient *client, ECalComponent *comp, GtkWindow *parent) { @@ -833,7 +883,7 @@ action_save_cb (GtkAction *action, EAttachmentView *view; ECalComponentText text; gboolean delegated = FALSE; - gboolean read_only, correct = FALSE; + gboolean correct = FALSE; ECalComponent *comp; view = E_ATTACHMENT_VIEW (priv->attachment_view); @@ -860,12 +910,12 @@ action_save_cb (GtkAction *action, return; } - if (!e_cal_is_read_only (priv->client, &read_only, NULL) || read_only) { + if (e_client_is_readonly (E_CLIENT (priv->cal_client))) { e_alert_submit ( E_ALERT_SINK (editor), "calendar:prompt-read-only-cal-editor", e_source_peek_name ( - e_cal_get_source (priv->client)), + e_client_get_source (E_CLIENT (priv->cal_client))), NULL); return; } @@ -873,7 +923,7 @@ action_save_cb (GtkAction *action, commit_all_fields (editor); if (e_cal_component_has_recurrences (priv->comp)) { if (!recur_component_dialog ( - priv->client, priv->comp, &priv->mod, + priv->cal_client, priv->comp, &priv->mod, GTK_WINDOW (editor), delegated)) return; } else if (e_cal_component_is_instance (priv->comp)) @@ -888,7 +938,7 @@ action_save_cb (GtkAction *action, if (!text.value) if (!send_component_prompt_subject ( - (GtkWindow *) editor, priv->client, priv->comp)) + (GtkWindow *) editor, priv->cal_client, priv->comp)) return; if (save_comp_with_send (editor)) { @@ -899,7 +949,7 @@ action_save_cb (GtkAction *action, delegate = flags & COMP_EDITOR_DELEGATE; if (delegate && !remove_event_dialog ( - priv->client, priv->comp, GTK_WINDOW (editor))) { + priv->cal_client, priv->comp, GTK_WINDOW (editor))) { const gchar *uid = NULL; GError *error = NULL; @@ -909,12 +959,10 @@ action_save_cb (GtkAction *action, e_cal_component_has_recurrences (priv->comp)) { gchar *rid; rid = e_cal_component_get_recurid_as_string (priv->comp); - e_cal_remove_object_with_mod ( - priv->client, uid, rid, - priv->mod, &error); + e_cal_client_remove_object_sync (priv->cal_client, uid, rid, priv->mod, NULL, &error); g_free (rid); } else - e_cal_remove_object (priv->client, uid, &error); + e_cal_client_remove_object_sync (priv->cal_client, uid, NULL, CALOBJ_MOD_THIS, NULL, &error); g_clear_error (&error); } @@ -1470,9 +1518,9 @@ comp_editor_dispose (GObject *object) priv->window_group = NULL; } - if (priv->client) { - g_object_unref (priv->client); - priv->client = NULL; + if (priv->cal_client) { + g_object_unref (priv->cal_client); + priv->cal_client = NULL; } if (priv->source_client) { @@ -1480,6 +1528,12 @@ comp_editor_dispose (GObject *object) priv->source_client = NULL; } + if (priv->view_cancellable) { + g_cancellable_cancel (priv->view_cancellable); + g_object_unref (priv->view_cancellable); + priv->view_cancellable = NULL; + } + if (priv->view) { g_signal_handlers_disconnect_matched (G_OBJECT (priv->view), G_SIGNAL_MATCH_DATA, @@ -1690,7 +1744,7 @@ comp_editor_class_init (CompEditorClass *class) "client", NULL, NULL, - E_TYPE_CAL, + E_TYPE_CAL_CLIENT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); @@ -2074,7 +2128,7 @@ static gboolean prompt_and_save_changes (CompEditor *editor, gboolean send) { CompEditorPrivate *priv; - gboolean read_only, correct = FALSE; + gboolean correct = FALSE; ECalComponent *comp; ECalComponentText text; @@ -2085,12 +2139,12 @@ prompt_and_save_changes (CompEditor *editor, gboolean send) switch (save_component_dialog (GTK_WINDOW (editor), priv->comp)) { case GTK_RESPONSE_YES: /* Save */ - if (!e_cal_is_read_only (priv->client, &read_only, NULL) || read_only) { + if (e_client_is_readonly (E_CLIENT (priv->cal_client))) { e_alert_submit ( E_ALERT_SINK (editor), "calendar:prompt-read-only-cal-editor", e_source_peek_name ( - e_cal_get_source (priv->client)), + e_client_get_source (E_CLIENT (priv->cal_client))), NULL); /* don't discard changes when selected readonly calendar */ return FALSE; @@ -2105,12 +2159,12 @@ prompt_and_save_changes (CompEditor *editor, gboolean send) if (!text.value) if (!send_component_prompt_subject ( - (GtkWindow *) editor, priv->client, priv->comp)) + (GtkWindow *) editor, priv->cal_client, priv->comp)) return FALSE; if (e_cal_component_is_instance (priv->comp)) if (!recur_component_dialog ( - priv->client, priv->comp, &priv->mod, + priv->cal_client, priv->comp, &priv->mod, GTK_WINDOW (editor), FALSE)) return FALSE; @@ -2815,27 +2869,27 @@ comp_editor_show_page (CompEditor *editor, CompEditorPage *page) /** * comp_editor_set_client: * @editor: A component editor - * @client: The calendar client to use + * @cal_client: The calendar client to use * * Sets the calendar client used by the editor to update components **/ void comp_editor_set_client (CompEditor *editor, - ECal *client) + ECalClient *cal_client) { g_return_if_fail (IS_COMP_EDITOR (editor)); - g_return_if_fail (client == NULL || E_IS_CAL (client)); + g_return_if_fail (cal_client == NULL || E_IS_CAL_CLIENT (cal_client)); - if (client != NULL) - g_object_ref (client); + if (cal_client != NULL) + g_object_ref (cal_client); - if (editor->priv->client != NULL) - g_object_unref (editor->priv->client); + if (editor->priv->cal_client != NULL) + g_object_unref (editor->priv->cal_client); - editor->priv->client = client; + editor->priv->cal_client = cal_client; - if (editor->priv->source_client == NULL && client != NULL) - editor->priv->source_client = g_object_ref (client); + if (editor->priv->source_client == NULL && cal_client != NULL) + editor->priv->source_client = g_object_ref (cal_client); g_object_notify (G_OBJECT (editor), "client"); } @@ -2848,12 +2902,12 @@ comp_editor_set_client (CompEditor *editor, * * Return value: The calendar client of the editor **/ -ECal * +ECalClient * comp_editor_get_client (CompEditor *editor) { g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); - return editor->priv->client; + return editor->priv->cal_client; } static void @@ -3046,7 +3100,7 @@ set_attendees_for_delegation (ECalComponent *comp, } static void -get_users_from_memo_comp (ECalComponent *comp, GList **users) +get_users_from_memo_comp (ECalComponent *comp, GSList **users) { icalcomponent *icalcomp; icalproperty *icalprop; @@ -3072,7 +3126,7 @@ get_users_from_memo_comp (ECalComponent *comp, GList **users) iter = emails; while (*iter) { - *users = g_list_append (*users, g_strdup (*iter)); + *users = g_slist_append (*users, g_strdup (*iter)); iter++; } g_strfreev (emails); @@ -3088,7 +3142,7 @@ real_send_comp (CompEditor *editor, CompEditorFlags flags; ECalComponent *send_comp = NULL; gchar *address = NULL; - GList *users = NULL; + GSList *users = NULL; g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); @@ -3101,7 +3155,7 @@ real_send_comp (CompEditor *editor, const gchar *uid = NULL; e_cal_component_get_uid (priv->comp, &uid); - if (e_cal_get_object (priv->client, uid, NULL, &icalcomp, NULL) && icalcomp) { + if (e_cal_client_get_object_sync (priv->cal_client, uid, NULL, &icalcomp, NULL, NULL) && icalcomp) { send_comp = e_cal_component_new (); if (!e_cal_component_set_icalcomponent (send_comp, icalcomp)) { icalcomponent_free (icalcomp); @@ -3122,17 +3176,17 @@ real_send_comp (CompEditor *editor, /* The user updates the delegated status to the Organizer, * so remove all other attendees. */ if (flags & COMP_EDITOR_DELEGATE) { - address = itip_get_comp_attendee (send_comp, priv->client); + address = itip_get_comp_attendee (send_comp, priv->cal_client); if (address) set_attendees_for_delegation (send_comp, address, method); } if (!e_cal_component_has_attachments (priv->comp) || - e_cal_get_static_capability (priv->client, + e_client_check_capability (E_CLIENT (priv->cal_client), CAL_STATIC_CAPABILITY_CREATE_MESSAGES)) { if (itip_send_comp ( - method, send_comp, priv->client, + method, send_comp, priv->cal_client, NULL, NULL, users, strip_alarms, priv->flags & COMP_EDITOR_SEND_TO_NEW_ATTENDEES_ONLY)) { g_object_unref (send_comp); @@ -3162,7 +3216,7 @@ real_send_comp (CompEditor *editor, } if (itip_send_comp ( - method, send_comp, priv->client, + method, send_comp, priv->cal_client, NULL, mime_attach_list, users, strip_alarms, priv->flags & COMP_EDITOR_SEND_TO_NEW_ATTENDEES_ONLY)) { gboolean saved = save_comp (editor); @@ -3279,10 +3333,10 @@ comp_editor_delete_comp (CompEditor *editor) e_cal_component_get_uid (priv->comp, &uid); if (e_cal_component_is_instance (priv->comp) || e_cal_component_has_recurrences (priv->comp)) - e_cal_remove_object_with_mod (priv->client, uid, NULL, - CALOBJ_MOD_ALL, NULL); + e_cal_client_remove_object_sync (priv->cal_client, uid, NULL, + CALOBJ_MOD_ALL, NULL, NULL); else - e_cal_remove_object (priv->client, uid, NULL); + e_cal_client_remove_object_sync (priv->cal_client, uid, NULL, CALOBJ_MOD_THIS, NULL, NULL); close_dialog (editor); } @@ -3428,8 +3482,8 @@ page_dates_changed_cb (CompEditor *editor, } static void -obj_modified_cb (ECal *client, - GList *objects, +obj_modified_cb (ECalClientView *view, + const GSList *objects, CompEditor *editor) { CompEditorPrivate *priv; @@ -3465,8 +3519,8 @@ obj_modified_cb (ECal *client, } static void -obj_removed_cb (ECal *client, - GList *uids, +obj_removed_cb (ECalClientView *view, + const GSList *uids, CompEditor *editor) { CompEditorPrivate *priv = editor->priv; -- cgit v1.2.3 From cc96d85ef9a68ab4898a9c77bffcc5097e10d7e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Vr=C3=A1til?= Date: Thu, 23 Jun 2011 09:35:26 +0200 Subject: Bug #646442 - [mail-to-task] Edit event details before adding to calendar --- calendar/gui/dialogs/comp-editor.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 21ac86e9c3..da7759523e 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -121,6 +121,8 @@ struct _CompEditorPrivate { gboolean changed; gboolean needs_send; + gboolean saved; + CalObjModType mod; gboolean existing_org; @@ -212,6 +214,7 @@ G_DEFINE_TYPE_WITH_CODE ( enum { OBJECT_CREATED, + COMP_CLOSED, LAST_SIGNAL }; @@ -624,6 +627,7 @@ save_comp (CompEditor *editor) } priv->changed = FALSE; + priv->saved = TRUE; } g_free (orig_uid_copy); @@ -1868,6 +1872,15 @@ comp_editor_class_init (CompEditorClass *class) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + + signals[COMP_CLOSED] = g_signal_new ( + "comp_closed", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (CompEditorClass, comp_closed), + NULL, NULL, + g_cclosure_marshal_VOID__BOOLEAN, + G_TYPE_NONE, 1, G_TYPE_BOOLEAN); } static void @@ -1920,6 +1933,7 @@ comp_editor_init (CompEditor *editor) priv->user_org = FALSE; priv->warned = FALSE; priv->is_group_item = FALSE; + priv->saved = FALSE; priv->ui_manager = e_ui_manager_new (); e_ui_manager_set_express_mode ( @@ -2201,6 +2215,8 @@ close_dialog (CompEditor *editor) { CompEditorPrivate *priv = editor->priv; + g_signal_emit_by_name (editor, "comp_closed", priv->saved); + /* FIXME Unfortunately we do this here because otherwise corba calls happen during destruction and we might get a change notification back when we are in an inconsistent state */ -- cgit v1.2.3 From 566d861915da77e93b097a927a79f0130de8c535 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 27 Jun 2011 18:04:57 +0200 Subject: Check for cancelled GIO operation error code too --- calendar/gui/dialogs/comp-editor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index da7759523e..88b8b4a89f 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -378,7 +378,8 @@ changes_view_ready_cb (GObject *source_object, GAsyncResult *result, gpointer us g_error_free (error); } } else if (error) { - if (!g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED)) + if (!g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) && + !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) g_debug ("%s: Failed to get view: %s", G_STRFUNC, error->message); g_error_free (error); } -- cgit v1.2.3 From cffd2dd122a582e160153777b303579e736bc09c Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 26 Jul 2011 22:30:10 +0200 Subject: Bug #655255 - Make comp-editor toolbar buttons' tooltips saner --- calendar/gui/dialogs/comp-editor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 88b8b4a89f..c51634903e 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1068,7 +1068,7 @@ static GtkActionEntry core_entries[] = { GTK_STOCK_CLOSE, NULL, NULL, - N_("Click here to close the current window"), + N_("Close the current window"), G_CALLBACK (action_close_cb) }, { "copy-clipboard", @@ -1096,7 +1096,7 @@ static GtkActionEntry core_entries[] = { GTK_STOCK_HELP, NULL, NULL, - N_("Click here to view help available"), + N_("View help"), G_CALLBACK (action_help_cb) }, { "paste-clipboard", @@ -1124,7 +1124,7 @@ static GtkActionEntry core_entries[] = { GTK_STOCK_SAVE, NULL, NULL, - N_("Click here to save the current window"), + N_("Save current changes"), G_CALLBACK (action_save_cb) }, { "select-all", @@ -1192,7 +1192,7 @@ static GtkActionEntry individual_entries[] = { "mail-attachment", N_("_Attachment..."), "m", - N_("Click here to attach a file"), + N_("Attach a file"), G_CALLBACK (action_attach_cb) } }; -- cgit v1.2.3 From 9936a6272c3f12bc95bb1a2b045e5ca8648ca575 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 3 Aug 2011 17:10:03 +0200 Subject: Remove unneeded semicolon --- calendar/gui/dialogs/comp-editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index c51634903e..1269e61cc5 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -209,7 +209,7 @@ static void obj_removed_cb (ECalClientView *view, const GSList *uids, CompEditor G_DEFINE_TYPE_WITH_CODE ( CompEditor, comp_editor, GTK_TYPE_WINDOW, - G_IMPLEMENT_INTERFACE (E_TYPE_ALERT_SINK, NULL); + G_IMPLEMENT_INTERFACE (E_TYPE_ALERT_SINK, NULL) G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL)) enum { -- cgit v1.2.3 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/comp-editor.c | 85 ++++++++++++++++++++++++++------------ 1 file changed, 58 insertions(+), 27 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 1269e61cc5..55980cbc9e 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -191,21 +191,27 @@ static const gchar *ui = " " ""; -static void comp_editor_show_help (CompEditor *editor); +static void comp_editor_show_help (CompEditor *editor); -static void real_edit_comp (CompEditor *editor, ECalComponent *comp); +static void real_edit_comp (CompEditor *editor, + ECalComponent *comp); static gboolean real_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean strip_alarms); -static gboolean prompt_and_save_changes (CompEditor *editor, gboolean send); -static void close_dialog (CompEditor *editor); +static gboolean prompt_and_save_changes (CompEditor *editor, + gboolean send); +static void close_dialog (CompEditor *editor); static void page_dates_changed_cb (CompEditor *editor, CompEditorPageDates *dates, CompEditorPage *page); -static void obj_modified_cb (ECalClientView *view, const GSList *objs, CompEditor *editor); -static void obj_removed_cb (ECalClientView *view, const GSList *uids, CompEditor *editor); +static void obj_modified_cb (ECalClientView *view, + const GSList *objs, + CompEditor *editor); +static void obj_removed_cb (ECalClientView *view, + const GSList *uids, + CompEditor *editor); G_DEFINE_TYPE_WITH_CODE ( CompEditor, comp_editor, GTK_TYPE_WINDOW, @@ -351,15 +357,21 @@ commit_all_fields (CompEditor *editor) } static void -changes_view_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +changes_view_ready_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { CompEditor *editor = user_data; ECalClientView *view = NULL; + gboolean success; GError *error = NULL; g_return_if_fail (editor != NULL); - if (!e_cal_client_get_view_finish (E_CAL_CLIENT (source_object), result, &view, &error)) + success = e_cal_client_get_view_finish ( + E_CAL_CLIENT (source_object), result, &view, &error); + + if (!success) view = NULL; if (view) { @@ -373,14 +385,18 @@ changes_view_ready_cb (GObject *source_object, GAsyncResult *result, gpointer us e_cal_client_view_start (view, &error); - if (error) { - g_debug ("%s: Failed to stat view: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to start view: %s", + G_STRFUNC, error->message); g_error_free (error); } } else if (error) { if (!g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - g_debug ("%s: Failed to get view: %s", G_STRFUNC, error->message); + g_warning ( + "%s: Failed to get view: %s", + G_STRFUNC, error->message); g_error_free (error); } } @@ -401,10 +417,9 @@ listen_for_changes (CompEditor *editor) } if (priv->view) { - g_signal_handlers_disconnect_matched (G_OBJECT (priv->view), - G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, - editor); + g_signal_handlers_disconnect_matched ( + priv->view, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, editor); g_object_unref (priv->view); priv->view = NULL; @@ -419,7 +434,10 @@ listen_for_changes (CompEditor *editor) priv->view_cancellable = g_cancellable_new (); query = g_strdup_printf ("(uid? \"%s\")", uid); - e_cal_client_get_view (priv->source_client, query, priv->view_cancellable, changes_view_ready_cb, editor); + e_cal_client_get_view ( + priv->source_client, + query, priv->view_cancellable, + changes_view_ready_cb, editor); g_free (query); } } @@ -433,8 +451,10 @@ send_timezone (gpointer key, gpointer value, gpointer user_data) e_cal_client_add_timezone_sync (editor->priv->cal_client, zone, NULL, &error); - if (error) { - g_debug ("%s: Failed to add timezone: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to add timezone: %s", + G_STRFUNC, error->message); g_error_free (error); } } @@ -518,7 +538,8 @@ save_comp (CompEditor *editor) /* send the component to the server */ if (!cal_comp_is_on_server (priv->comp, priv->cal_client)) { gchar *uid = NULL; - result = e_cal_client_create_object_sync (priv->cal_client, icalcomp, &uid, NULL, &error); + result = e_cal_client_create_object_sync ( + priv->cal_client, icalcomp, &uid, NULL, &error); if (result) { icalcomponent_set_uid (icalcomp, uid); g_free (uid); @@ -540,7 +561,8 @@ save_comp (CompEditor *editor) e_cal_component_set_exdate_list (priv->comp, NULL); e_cal_component_set_exrule_list (priv->comp, NULL); } - result = e_cal_client_modify_object_sync (priv->cal_client, icalcomp, priv->mod, NULL, &error); + result = e_cal_client_modify_object_sync ( + priv->cal_client, icalcomp, priv->mod, NULL, &error); if (priv->mod == CALOBJ_MOD_THIS) { if (result && ((flags & COMP_EDITOR_DELEGATE) || @@ -614,8 +636,10 @@ save_comp (CompEditor *editor) priv->source_client, orig_uid_copy, NULL, CALOBJ_MOD_THIS, NULL, &error); - if (error) { - g_debug ("%s: Failed to remove object: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to remove object: %s", + G_STRFUNC, error->message); g_error_free (error); } @@ -964,10 +988,14 @@ action_save_cb (GtkAction *action, e_cal_component_has_recurrences (priv->comp)) { gchar *rid; rid = e_cal_component_get_recurid_as_string (priv->comp); - e_cal_client_remove_object_sync (priv->cal_client, uid, rid, priv->mod, NULL, &error); + e_cal_client_remove_object_sync ( + priv->cal_client, uid, rid, + priv->mod, NULL, &error); g_free (rid); } else - e_cal_client_remove_object_sync (priv->cal_client, uid, NULL, CALOBJ_MOD_THIS, NULL, &error); + e_cal_client_remove_object_sync ( + priv->cal_client, uid, NULL, + CALOBJ_MOD_THIS, NULL, &error); g_clear_error (&error); } @@ -3350,10 +3378,13 @@ comp_editor_delete_comp (CompEditor *editor) e_cal_component_get_uid (priv->comp, &uid); if (e_cal_component_is_instance (priv->comp) || e_cal_component_has_recurrences (priv->comp)) - e_cal_client_remove_object_sync (priv->cal_client, uid, NULL, - CALOBJ_MOD_ALL, NULL, NULL); + e_cal_client_remove_object_sync ( + priv->cal_client, uid, NULL, + CALOBJ_MOD_ALL, NULL, NULL); else - e_cal_client_remove_object_sync (priv->cal_client, uid, NULL, CALOBJ_MOD_THIS, NULL, NULL); + e_cal_client_remove_object_sync ( + priv->cal_client, uid, NULL, + CALOBJ_MOD_THIS, NULL, NULL); close_dialog (editor); } -- cgit v1.2.3 From 2ffc7c943350675d9ee5f6862cb97aa87f0093e4 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 15 Aug 2011 19:40:00 +0200 Subject: Bug #656258 - Critical runtime warning on comp-editor close --- calendar/gui/dialogs/comp-editor.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 55980cbc9e..c94b2f5016 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1577,6 +1577,13 @@ comp_editor_dispose (GObject *object) priv->view = NULL; } + if (priv->attachment_view) { + g_signal_handlers_disconnect_matched (G_OBJECT (e_attachment_view_get_store (E_ATTACHMENT_VIEW (priv->attachment_view))), + G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, + object); + } + /* We want to destroy the pages after the widgets get destroyed, since they have lots of signal handlers connected to the widgets with the pages as the data. */ -- cgit v1.2.3 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/comp-editor.c | 96 ++++++++++++++++++++++---------------- 1 file changed, 55 insertions(+), 41 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index c94b2f5016..1d5a45af31 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -107,7 +107,7 @@ struct _CompEditorPrivate { guint32 attachment_bar_visible : 1; /* TODO use this flags for setting all the boolean variables - below */ + * below */ CompEditorFlags flags; icaltimezone *zone; @@ -238,7 +238,7 @@ static void attachment_store_changed_cb (CompEditor *editor) { /* Mark the editor as changed so it prompts about unsaved - changes on close */ + * changes on close */ comp_editor_set_changed (editor, TRUE); } @@ -348,8 +348,8 @@ get_attachment_list (CompEditor *editor) } /* This sets the focus to the toplevel, so any field being edited is committed. - FIXME: In future we may also want to check some of the fields are valid, - e.g. the EDateEdit fields. */ + * FIXME: In future we may also want to check some of the fields are valid, + * e.g. the EDateEdit fields. */ static void commit_all_fields (CompEditor *editor) { @@ -443,7 +443,9 @@ listen_for_changes (CompEditor *editor) } static void -send_timezone (gpointer key, gpointer value, gpointer user_data) +send_timezone (gpointer key, + gpointer value, + gpointer user_data) { icaltimezone *zone = value; CompEditor *editor = user_data; @@ -885,8 +887,8 @@ action_print_preview_cb (GtkAction *action, static gboolean remove_event_dialog (ECalClient *client, - ECalComponent *comp, - GtkWindow *parent) + ECalComponent *comp, + GtkWindow *parent) { GtkWidget *dialog; gboolean ret; @@ -1508,7 +1510,8 @@ comp_editor_get_property (GObject *object, } static void -unref_page_cb (gpointer editor_page, gpointer comp_editor) +unref_page_cb (gpointer editor_page, + gpointer comp_editor) { if (IS_COMP_EDITOR_PAGE (editor_page)) { GtkWidget *page_widget; @@ -1568,25 +1571,26 @@ comp_editor_dispose (GObject *object) } if (priv->view) { - g_signal_handlers_disconnect_matched (G_OBJECT (priv->view), - G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, - object); - + g_signal_handlers_disconnect_matched ( + G_OBJECT (priv->view), G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, object); g_object_unref (priv->view); priv->view = NULL; } if (priv->attachment_view) { - g_signal_handlers_disconnect_matched (G_OBJECT (e_attachment_view_get_store (E_ATTACHMENT_VIEW (priv->attachment_view))), - G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, - object); + EAttachmentStore *store; + + store = e_attachment_view_get_store ( + E_ATTACHMENT_VIEW (priv->attachment_view)); + g_signal_handlers_disconnect_matched ( + G_OBJECT (store), G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, object); } /* We want to destroy the pages after the widgets get destroyed, - since they have lots of signal handlers connected to the widgets - with the pages as the data. */ + * since they have lots of signal handlers connected to the widgets + * with the pages as the data. */ g_list_foreach (priv->pages, (GFunc) unref_page_cb, object); g_list_free (priv->pages); priv->pages = NULL; @@ -2050,7 +2054,7 @@ comp_editor_init (CompEditor *editor) /* Fine Tuning */ action = comp_editor_get_action (editor, "attach"); - g_object_set (G_OBJECT (action), "short-label", _("Attach"), NULL); + g_object_set (action, "short-label", _("Attach"), NULL); /* Desensitize the "save" action. */ action = comp_editor_get_action (editor, "save"); @@ -2175,7 +2179,8 @@ comp_editor_init (CompEditor *editor) } static gboolean -prompt_and_save_changes (CompEditor *editor, gboolean send) +prompt_and_save_changes (CompEditor *editor, + gboolean send) { CompEditorPrivate *priv; gboolean correct = FALSE; @@ -2254,8 +2259,8 @@ close_dialog (CompEditor *editor) g_signal_emit_by_name (editor, "comp_closed", priv->saved); /* FIXME Unfortunately we do this here because otherwise corba - calls happen during destruction and we might get a change - notification back when we are in an inconsistent state */ + * calls happen during destruction and we might get a change + * notification back when we are in an inconsistent state */ if (priv->view) g_signal_handlers_disconnect_matched (G_OBJECT (priv->view), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, editor); @@ -2275,7 +2280,8 @@ comp_editor_compare (CompEditor *editor_a, } void -comp_editor_set_existing_org (CompEditor *editor, gboolean existing_org) +comp_editor_set_existing_org (CompEditor *editor, + gboolean existing_org) { g_return_if_fail (IS_COMP_EDITOR (editor)); @@ -2745,9 +2751,9 @@ page_unmapped_cb (GtkWidget *page_widget, **/ void comp_editor_append_widget (CompEditor *editor, - GtkWidget *page, - const gchar *label, - gboolean add) + GtkWidget *page, + const gchar *label, + gboolean add) { CompEditorPrivate *priv; GtkWidget *label_widget = NULL; @@ -2771,7 +2777,7 @@ comp_editor_append_widget (CompEditor *editor, } /* Listen for when the page is mapped/unmapped so we can - install/uninstall the appropriate GtkAccelGroup. + * install/uninstall the appropriate GtkAccelGroup. g_signal_connect ( page, "map", G_CALLBACK (page_mapped_cb), page); @@ -2794,9 +2800,9 @@ comp_editor_append_widget (CompEditor *editor, **/ void comp_editor_append_page (CompEditor *editor, - CompEditorPage *page, - const gchar *label, - gboolean add) + CompEditorPage *page, + const gchar *label, + gboolean add) { CompEditorPrivate *priv; GtkWidget *page_widget; @@ -2843,7 +2849,7 @@ comp_editor_append_page (CompEditor *editor, G_CALLBACK (page_dates_changed_cb), editor); /* Listen for when the page is mapped/unmapped so we can - install/uninstall the appropriate GtkAccelGroup. */ + * install/uninstall the appropriate GtkAccelGroup. */ g_signal_connect ( page_widget, "map", G_CALLBACK (page_mapped_cb), page); @@ -2866,7 +2872,8 @@ comp_editor_append_page (CompEditor *editor, * Removes the page from the component editor **/ void -comp_editor_remove_page (CompEditor *editor, CompEditorPage *page) +comp_editor_remove_page (CompEditor *editor, + CompEditorPage *page) { CompEditorPrivate *priv; GtkWidget *page_widget; @@ -2902,7 +2909,8 @@ comp_editor_remove_page (CompEditor *editor, CompEditorPage *page) * **/ void -comp_editor_show_page (CompEditor *editor, CompEditorPage *page) +comp_editor_show_page (CompEditor *editor, + CompEditorPage *page) { CompEditorPrivate *priv; GtkWidget *page_widget; @@ -3009,7 +3017,8 @@ attachment_loaded_cb (EAttachment *attachment, } static void -set_attachment_list (CompEditor *editor, GSList *uri_list) +set_attachment_list (CompEditor *editor, + GSList *uri_list) { EAttachmentStore *store; EAttachmentView *view; @@ -3090,7 +3099,8 @@ fill_widgets (CompEditor *editor) } static void -real_edit_comp (CompEditor *editor, ECalComponent *comp) +real_edit_comp (CompEditor *editor, + ECalComponent *comp) { CompEditorPrivate *priv; @@ -3152,7 +3162,8 @@ set_attendees_for_delegation (ECalComponent *comp, } static void -get_users_from_memo_comp (ECalComponent *comp, GSList **users) +get_users_from_memo_comp (ECalComponent *comp, + GSList **users) { icalcomponent *icalcomp; icalproperty *icalprop; @@ -3298,7 +3309,8 @@ real_send_comp (CompEditor *editor, * Starts the editor editing the given component **/ void -comp_editor_edit_comp (CompEditor *editor, ECalComponent *comp) +comp_editor_edit_comp (CompEditor *editor, + ECalComponent *comp) { CompEditorClass *class; @@ -3328,7 +3340,8 @@ comp_editor_get_comp (CompEditor *editor) * Returns: Newly allocated component, should be unref-ed by g_object_unref(). **/ ECalComponent * -comp_editor_get_current_comp (CompEditor *editor, gboolean *correct) +comp_editor_get_current_comp (CompEditor *editor, + gboolean *correct) { CompEditorPrivate *priv; ECalComponent *comp; @@ -3361,7 +3374,8 @@ comp_editor_get_current_comp (CompEditor *editor, gboolean *correct) * **/ gboolean -comp_editor_save_comp (CompEditor *editor, gboolean send) +comp_editor_save_comp (CompEditor *editor, + gboolean send) { return prompt_and_save_changes (editor, send); } @@ -3516,7 +3530,7 @@ comp_editor_get_mime_attach_list (CompEditor *editor) static void page_dates_changed_cb (CompEditor *editor, - CompEditorPageDates *dates, + CompEditorPageDates *dates, CompEditorPage *page) { CompEditorPrivate *priv = editor->priv; -- cgit v1.2.3 From 6ea72f4fe7cd9ed44660589bf13eb153007cb62e Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 15 Sep 2011 14:54:31 +0200 Subject: Bug #659125 - Reference counting issues in calendar --- calendar/gui/dialogs/comp-editor.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 1d5a45af31..5b3b520635 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1586,6 +1586,8 @@ comp_editor_dispose (GObject *object) g_signal_handlers_disconnect_matched ( G_OBJECT (store), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, object); + g_object_unref (priv->attachment_view); + priv->attachment_view = NULL; } /* We want to destroy the pages after the widgets get destroyed, -- cgit v1.2.3 From 8a309aef81ed8364b054e49cfb94908623e2d0d4 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 26 Sep 2011 11:02:47 +0200 Subject: Bug #655252 - Need to escape the comp_uid part of a path --- calendar/gui/dialogs/comp-editor.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 5b3b520635..172e79a1fe 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -43,6 +43,7 @@ #include #include +#include #include #include @@ -300,7 +301,7 @@ get_attachment_list (CompEditor *editor) GSList *list = NULL; const gchar *comp_uid = NULL; const gchar *local_store; - gchar *path; + gchar *filename_prefix, *tmp; gint ii; struct { @@ -309,6 +310,9 @@ get_attachment_list (CompEditor *editor) GtkWindow *parent; } status; + e_cal_component_get_uid (editor->priv->comp, &comp_uid); + g_return_val_if_fail (comp_uid != NULL, NULL); + status.uris = NULL; status.done = FALSE; status.parent = g_object_ref (editor); @@ -316,17 +320,20 @@ get_attachment_list (CompEditor *editor) view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); store = e_attachment_view_get_store (view); + tmp = g_strdup (comp_uid); + e_filename_make_safe (tmp); + filename_prefix = g_strconcat (tmp, "-", NULL); + g_free (tmp); + local_store = e_cal_client_get_local_attachment_store (editor->priv->cal_client); - e_cal_component_get_uid (editor->priv->comp, &comp_uid); - path = g_build_path ("/", local_store, comp_uid, NULL); - destination = g_file_new_for_path (path); - g_free (path); + destination = g_file_new_for_path (local_store); e_attachment_store_save_async ( - store, destination, (GAsyncReadyCallback) - attachment_save_finished, &status); + store, destination, filename_prefix, + (GAsyncReadyCallback) attachment_save_finished, &status); g_object_unref (destination); + g_free (filename_prefix); /* We can't return until we have results, so crank * the main loop until the callback gets triggered. */ -- cgit v1.2.3 From 933a26b0ed9dd8337ffb5a24d7934a35adbdd0f8 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 26 Sep 2011 11:08:46 +0200 Subject: Bug #657170 - Disallow creating assigned tasks when not supported --- calendar/gui/dialogs/comp-editor.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 172e79a1fe..d5190ba8ba 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -958,6 +958,18 @@ action_save_cb (GtkAction *action, return; } + if ((comp_editor_get_flags (editor) & COMP_EDITOR_IS_ASSIGNED) != 0 + && e_cal_component_get_vtype (priv->comp) == E_CAL_COMPONENT_TODO + && e_client_check_capability (E_CLIENT (priv->cal_client), CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT)) { + e_alert_submit ( + E_ALERT_SINK (editor), + "calendar:prompt-no-task-assignment-editor", + e_source_peek_name ( + e_client_get_source (E_CLIENT (priv->cal_client))), + NULL); + return; + } + commit_all_fields (editor); if (e_cal_component_has_recurrences (priv->comp)) { if (!recur_component_dialog ( @@ -2214,6 +2226,18 @@ prompt_and_save_changes (CompEditor *editor, return FALSE; } + if ((comp_editor_get_flags (editor) & COMP_EDITOR_IS_ASSIGNED) != 0 + && e_cal_component_get_vtype (priv->comp) == E_CAL_COMPONENT_TODO + && e_client_check_capability (E_CLIENT (priv->cal_client), CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT)) { + e_alert_submit ( + E_ALERT_SINK (editor), + "calendar:prompt-no-task-assignment-editor", + e_source_peek_name ( + e_client_get_source (E_CLIENT (priv->cal_client))), + NULL); + return FALSE; + } + comp = comp_editor_get_current_comp (editor, &correct); e_cal_component_get_summary (comp, &text); g_object_unref (comp); -- cgit v1.2.3 From 53bc6ffc531d7a7188e15be245a31f301090ee15 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 10 Sep 2011 11:47:15 -0400 Subject: The EExtension framework is now in libebackend. The EModule, EExtensible and EExtension classes as well as the e_type_traverse() function have been moved to Evolution-Data-Server's libebackend library to replace e-data-server-module.c. Now Evolution-Data-Server modules use the same framework as Evolution. --- calendar/gui/dialogs/comp-editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index d5190ba8ba..42b8acef63 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -35,10 +35,10 @@ #include #include #include +#include #include #include #include -#include #include #include #include -- cgit v1.2.3 From e2b6ff7a6c1e1580c26ee0719b349151e8dad6fd Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 27 Sep 2011 01:13:42 -0400 Subject: 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. --- calendar/gui/dialogs/comp-editor.c | 1 + 1 file changed, 1 insertion(+) (limited to 'calendar/gui/dialogs/comp-editor.c') 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)) { -- cgit v1.2.3 From 5c81e944e63fd1f0e653832c23a798a23e8c07eb Mon Sep 17 00:00:00 2001 From: Punit Jain Date: Fri, 30 Sep 2011 11:54:54 +0530 Subject: Bug #656378 attachment name corruption --- calendar/gui/dialogs/comp-editor.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 27427540b6..9a60f6d382 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -3010,6 +3010,7 @@ attachment_loaded_cb (EAttachment *attachment, { GFileInfo *file_info; const gchar *display_name; + const gchar *new_name; const gchar *uid; /* Prior to 2.27.2, attachment files were named: @@ -3041,9 +3042,10 @@ attachment_loaded_cb (EAttachment *attachment, uid = g_object_get_data (G_OBJECT (attachment), "uid"); if (g_str_has_prefix (display_name, uid)) { - g_file_info_set_display_name ( - file_info, display_name + strlen (uid) + 1); + new_name = g_strdup (display_name+strlen(uid)+1); + g_file_info_set_display_name (file_info, new_name); g_object_notify (G_OBJECT (attachment), "file-info"); + g_free (new_name); } e_attachment_load_handle_error (attachment, result, parent); -- cgit v1.2.3 From 4c56856e05c6ab1468fe8ace4b73ac31b333990b Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 30 Sep 2011 15:39:57 +0200 Subject: Fix few 'may be used uninitialized' compiler warnings --- calendar/gui/dialogs/comp-editor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 9a60f6d382..9c463c66dc 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -3010,8 +3010,8 @@ attachment_loaded_cb (EAttachment *attachment, { GFileInfo *file_info; const gchar *display_name; - const gchar *new_name; const gchar *uid; + gchar *new_name; /* Prior to 2.27.2, attachment files were named: * @@ -3042,7 +3042,7 @@ attachment_loaded_cb (EAttachment *attachment, uid = g_object_get_data (G_OBJECT (attachment), "uid"); if (g_str_has_prefix (display_name, uid)) { - new_name = g_strdup (display_name+strlen(uid)+1); + new_name = g_strdup (display_name + strlen (uid) + 1); g_file_info_set_display_name (file_info, new_name); g_object_notify (G_OBJECT (attachment), "file-info"); g_free (new_name); -- cgit v1.2.3