aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui/dialogs')
-rw-r--r--calendar/gui/dialogs/alarm-page.c16
-rw-r--r--calendar/gui/dialogs/comp-editor.c38
-rw-r--r--calendar/gui/dialogs/delete-error.c25
-rw-r--r--calendar/gui/dialogs/delete-error.h2
-rw-r--r--calendar/gui/dialogs/event-editor.c5
-rw-r--r--calendar/gui/dialogs/event-page.c23
-rw-r--r--calendar/gui/dialogs/meeting-page.c8
-rw-r--r--calendar/gui/dialogs/recurrence-page.c6
-rw-r--r--calendar/gui/dialogs/schedule-page.c23
-rw-r--r--calendar/gui/dialogs/task-editor.c5
-rw-r--r--calendar/gui/dialogs/task-page.c17
11 files changed, 79 insertions, 89 deletions
diff --git a/calendar/gui/dialogs/alarm-page.c b/calendar/gui/dialogs/alarm-page.c
index 785734ad8c..919ed9a2c8 100644
--- a/calendar/gui/dialogs/alarm-page.c
+++ b/calendar/gui/dialogs/alarm-page.c
@@ -677,10 +677,9 @@ add_clicked_cb (GtkButton *button, gpointer data)
action = e_dialog_option_menu_get (priv->action, action_map);
cal_component_alarm_set_action (alarm, action);
if (action == CAL_ALARM_EMAIL && !cal_component_alarm_has_attendees (alarm)) {
- const char *email;
+ char *email;
- email = cal_client_get_alarm_email_address (COMP_EDITOR_PAGE (apage)->client);
- if (email != NULL) {
+ if (!cal_client_get_alarm_email_address (COMP_EDITOR_PAGE (apage)->client, &email, NULL)) {
CalComponentAttendee *a;
GSList attendee_list;
@@ -689,6 +688,7 @@ add_clicked_cb (GtkButton *button, gpointer data)
attendee_list.data = a;
attendee_list.next = NULL;
cal_component_alarm_set_attendee_list (alarm, &attendee_list);
+ g_free (email);
g_free (a);
}
}
@@ -741,7 +741,7 @@ button_options_clicked_cb (GtkWidget *widget, gpointer data)
AlarmPage *apage;
AlarmPagePrivate *priv;
gboolean repeat;
- const char *email;
+ char *email;
apage = ALARM_PAGE (data);
priv = apage->priv;
@@ -751,9 +751,11 @@ button_options_clicked_cb (GtkWidget *widget, gpointer data)
repeat = !cal_client_get_static_capability (COMP_EDITOR_PAGE (apage)->client,
CAL_STATIC_CAPABILITY_NO_ALARM_REPEAT);
- email = cal_client_get_alarm_email_address (COMP_EDITOR_PAGE (apage)->client);
- if (!alarm_options_dialog_run (priv->alarm, email, repeat))
- g_message ("button_options_clicked_cb(): Could not create the alarm options dialog");
+
+ if (cal_client_get_alarm_email_address (COMP_EDITOR_PAGE (apage)->client, &email, NULL)) {
+ if (!alarm_options_dialog_run (priv->alarm, email, repeat))
+ g_message ("button_options_clicked_cb(): Could not create the alarm options dialog");
+ }
}
/* Hooks the widget signals */
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index f9c9919338..183be702ab 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -41,6 +41,7 @@
#include <e-util/e-dialog-utils.h>
#include <evolution-shell-component-utils.h>
#include "../print.h"
+#include "../comp-util.h"
#include "save-comp.h"
#include "delete-comp.h"
#include "send-comp.h"
@@ -294,7 +295,7 @@ save_comp (CompEditor *editor)
CompEditorPrivate *priv;
CalComponent *clone;
GList *l;
- CalClientResult result;
+ gboolean result;
priv = editor->priv;
@@ -321,28 +322,19 @@ save_comp (CompEditor *editor)
priv->updating = TRUE;
- if (cal_component_is_instance (priv->comp))
- result = cal_client_update_object_with_mod (priv->client, priv->comp, priv->mod);
- else
- result = cal_client_update_object (priv->client, priv->comp);
- if (result != CAL_CLIENT_RESULT_SUCCESS) {
+ if (!cal_comp_is_on_server (priv->comp, priv->client)) {
+ /* FIXME Better error handling */
+ result = cal_client_create_object (priv->client, cal_component_get_icalcomponent (priv->comp), NULL, NULL);
+ } else {
+ /* FIXME Better error handling */
+ result = cal_client_modify_object (priv->client, cal_component_get_icalcomponent (priv->comp), priv->mod, NULL);
+ }
+
+ if (!result) {
GtkWidget *dlg;
char *msg;
- switch (result) {
- case CAL_CLIENT_RESULT_INVALID_OBJECT :
- msg = g_strdup (_("Could not update invalid object"));
- break;
- case CAL_CLIENT_RESULT_NOT_FOUND :
- msg = g_strdup (_("Object not found, not updated"));
- break;
- case CAL_CLIENT_RESULT_PERMISSION_DENIED :
- msg = g_strdup (_("You don't have permissions to update this object"));
- break;
- default :
- msg = g_strdup (_("Could not update object"));
- break;
- }
+ msg = g_strdup (_("Could not update object"));
dlg = gnome_error_dialog (msg);
gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
@@ -391,7 +383,7 @@ delete_comp (CompEditor *editor)
cal_component_get_uid (priv->comp, &uid);
priv->updating = TRUE;
- cal_client_remove_object (priv->client, uid);
+ cal_client_remove_object (priv->client, uid, NULL);
priv->updating = FALSE;
close_dialog (editor);
}
@@ -1442,7 +1434,6 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data)
CompEditor *editor = COMP_EDITOR (data);
CompEditorPrivate *priv;
CalComponent *comp = NULL;
- CalClientGetStatus status;
const char *edit_uid;
priv = editor->priv;
@@ -1453,8 +1444,7 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data)
if (changed_component_dialog ((GtkWindow *) editor, priv->comp, FALSE, priv->changed)) {
icalcomponent *icalcomp;
- status = cal_client_get_object (priv->client, uid, &icalcomp);
- if (status == CAL_CLIENT_GET_SUCCESS) {
+ if (!cal_client_get_object (priv->client, uid, NULL, &icalcomp, NULL)) {
comp = cal_component_new ();
if (cal_component_set_icalcomponent (comp, icalcomp))
comp_editor_edit_comp (editor, comp);
diff --git a/calendar/gui/dialogs/delete-error.c b/calendar/gui/dialogs/delete-error.c
index 947aab1e97..edbcaf9880 100644
--- a/calendar/gui/dialogs/delete-error.c
+++ b/calendar/gui/dialogs/delete-error.c
@@ -38,13 +38,16 @@
*
**/
void
-delete_error_dialog (CalClientResult result, CalComponentVType vtype)
+delete_error_dialog (GError *error, CalComponentVType vtype)
{
GtkWidget *dialog;
const char *str;
- switch (result) {
- case CAL_CLIENT_RESULT_CORBA_ERROR:
+ if (!error)
+ return;
+
+ switch (error->code) {
+ case E_CALENDAR_STATUS_CORBA_EXCEPTION:
switch (vtype) {
case CAL_COMPONENT_EVENT:
str = _("The event could not be deleted due to a corba error");
@@ -60,7 +63,7 @@ delete_error_dialog (CalClientResult result, CalComponentVType vtype)
break;
}
break;
- case CAL_CLIENT_RESULT_PERMISSION_DENIED:
+ case E_CALENDAR_STATUS_PERMISSION_DENIED:
switch (vtype) {
case CAL_COMPONENT_EVENT:
str = _("The event could not be deleted because permission was denied");
@@ -76,24 +79,24 @@ delete_error_dialog (CalClientResult result, CalComponentVType vtype)
break;
}
break;
- case CAL_CLIENT_RESULT_INVALID_OBJECT:
+ case E_CALENDAR_STATUS_OTHER_ERROR:
switch (vtype) {
case CAL_COMPONENT_EVENT:
- str = _("The event could not be deleted because it was invalid");
+ str = _("The event could not be deleted due to an error");
break;
case CAL_COMPONENT_TODO:
- str = _("The task could not be deleted because it was invalid");
+ str = _("The task could not be deleted due to an error");
break;
case CAL_COMPONENT_JOURNAL:
- str = _("The journal entry could not be deleted because it was invalid");
+ str = _("The journal entry could not be deleted due to an error");
break;
default:
- str = _("The item could not be deleted because it was invalid");
+ str = _("The item could not be deleted due to an error");
break;
}
break;
- case CAL_CLIENT_RESULT_SUCCESS:
- case CAL_CLIENT_RESULT_NOT_FOUND:
+ case E_CALENDAR_STATUS_OK:
+ case E_CALENDAR_STATUS_OBJECT_NOT_FOUND:
default:
/* If not found, we don't care - its gone anyhow */
return;
diff --git a/calendar/gui/dialogs/delete-error.h b/calendar/gui/dialogs/delete-error.h
index dcef2fa3be..4ac8cf4515 100644
--- a/calendar/gui/dialogs/delete-error.h
+++ b/calendar/gui/dialogs/delete-error.h
@@ -25,6 +25,6 @@
#include <cal-client/cal-client.h>
#include <cal-util/cal-component.h>
-void delete_error_dialog (CalClientResult result, CalComponentVType vtype);
+void delete_error_dialog (GError *error, CalComponentVType vtype);
#endif
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index a67f2b14f9..18a30db63e 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -121,13 +121,14 @@ static void
set_menu_sens (EventEditor *ee)
{
EventEditorPrivate *priv;
- gboolean sens, existing, user, read_only;
+ gboolean sens, existing, user, read_only = TRUE;
priv = ee->priv;
existing = comp_editor_get_existing_org (COMP_EDITOR (ee));
user = comp_editor_get_user_org (COMP_EDITOR (ee));
- read_only = cal_client_is_read_only (comp_editor_get_cal_client (COMP_EDITOR (ee)));
+
+ cal_client_is_read_only (comp_editor_get_cal_client (COMP_EDITOR (ee)), &read_only, NULL);
sens = priv->meeting_shown;
comp_editor_set_ui_prop (COMP_EDITOR (ee),
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index b55e67dedd..8813081f4d 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -270,7 +270,6 @@ update_time (EventPage *epage, CalComponentDateTime *start_date, CalComponentDat
EventPagePrivate *priv;
struct icaltimetype *start_tt, *end_tt, implied_tt;
icaltimezone *start_zone = NULL, *end_zone = NULL;
- CalClientGetStatus status;
gboolean all_day_event;
priv = epage->priv;
@@ -280,24 +279,22 @@ update_time (EventPage *epage, CalComponentDateTime *start_date, CalComponentDat
first. */
start_zone = icaltimezone_get_builtin_timezone_from_tzid (start_date->tzid);
if (!start_zone) {
- status = cal_client_get_timezone (COMP_EDITOR_PAGE (epage)->client,
- start_date->tzid,
- &start_zone);
/* FIXME: Handle error better. */
- if (status != CAL_CLIENT_GET_SUCCESS)
+ if (!cal_client_get_timezone (COMP_EDITOR_PAGE (epage)->client,
+ start_date->tzid, &start_zone, NULL)) {
g_warning ("Couldn't get timezone from server: %s",
- start_date->tzid ? start_date->tzid : "");
+ start_date->tzid ? start_date->tzid : "");
+ }
}
end_zone = icaltimezone_get_builtin_timezone_from_tzid (end_date->tzid);
if (!end_zone) {
- status = cal_client_get_timezone (COMP_EDITOR_PAGE (epage)->client,
- end_date->tzid,
- &end_zone);
- /* FIXME: Handle error better. */
- if (status != CAL_CLIENT_GET_SUCCESS)
- g_warning ("Couldn't get timezone from server: %s",
- end_date->tzid ? end_date->tzid : "");
+ if (!cal_client_get_timezone (COMP_EDITOR_PAGE (epage)->client,
+ end_date->tzid, &end_zone, NULL)) {
+ /* FIXME: Handle error better. */
+ g_warning ("Couldn't get timezone from server: %s",
+ end_date->tzid ? end_date->tzid : "");
+ }
}
/* If both times are DATE values, we set the 'All Day Event' checkbox.
diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c
index e603978520..cab0f3df8a 100644
--- a/calendar/gui/dialogs/meeting-page.c
+++ b/calendar/gui/dialogs/meeting-page.c
@@ -497,7 +497,7 @@ get_widgets (MeetingPage *mpage)
/* For making the user the organizer */
priv->organizer_table = GW ("organizer-table");
priv->organizer = GW ("organizer");
- gtk_combo_set_value_in_list (GTK_COMBO (priv->organizer), FALSE, FALSE);
+ gtk_combo_set_value_in_list (GTK_COMBO (priv->organizer), TRUE, FALSE);
/* For showing existing organizers */
priv->existing_organizer_table = GW ("existing-organizer-table");
@@ -790,7 +790,7 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm,
MeetingPagePrivate *priv;
ETable *real_table;
gchar *filename;
- const char *backend_address;
+ char *backend_address;
EIterator *it;
EAccount *def_account;
GList *address_strings = NULL, *l;
@@ -812,7 +812,8 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm,
}
/* Address information */
- backend_address = cal_client_get_cal_address (client);
+ if (!cal_client_get_cal_address (client, &backend_address, NULL))
+ return NULL;
priv->accounts = itip_addresses_get ();
def_account = itip_addresses_get_default();
@@ -839,6 +840,7 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm,
}
}
g_object_unref(it);
+ g_free (backend_address);
if (address_strings)
gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), address_strings);
diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c
index 275ba26c44..4599001c27 100644
--- a/calendar/gui/dialogs/recurrence-page.c
+++ b/calendar/gui/dialogs/recurrence-page.c
@@ -852,7 +852,8 @@ preview_recur (RecurrencePage *rpage)
cal_component_get_dtstart (priv->comp, &cdt);
if (cdt.tzid != NULL) {
- if (cal_client_get_timezone (COMP_EDITOR_PAGE (rpage)->client, cdt.tzid, &zone) != CAL_CLIENT_GET_SUCCESS)
+ /* FIXME Will cal_client_get_timezone really not return builtin zones? */
+ if (!cal_client_get_timezone (COMP_EDITOR_PAGE (rpage)->client, cdt.tzid, &zone, NULL))
zone = icaltimezone_get_builtin_timezone_from_tzid (cdt.tzid);
}
cal_component_set_dtstart (comp, &cdt);
@@ -1448,7 +1449,8 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r)
else if (dt.tzid == NULL)
to_zone = icaltimezone_get_utc_timezone ();
else
- cal_client_get_timezone (client, dt.tzid, &to_zone);
+ /* FIXME Error checking? */
+ cal_client_get_timezone (client, dt.tzid, &to_zone, NULL);
from_zone = icaltimezone_get_utc_timezone ();
icaltimezone_convert_time (&r->until, from_zone, to_zone);
diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c
index 2163d51f1e..eb1813195c 100644
--- a/calendar/gui/dialogs/schedule-page.c
+++ b/calendar/gui/dialogs/schedule-page.c
@@ -208,7 +208,6 @@ update_time (SchedulePage *spage, CalComponentDateTime *start_date, CalComponent
SchedulePagePrivate *priv;
struct icaltimetype start_tt, end_tt;
icaltimezone *start_zone = NULL, *end_zone = NULL;
- CalClientGetStatus status;
gboolean all_day;
priv = spage->priv;
@@ -218,24 +217,22 @@ update_time (SchedulePage *spage, CalComponentDateTime *start_date, CalComponent
first. */
start_zone = icaltimezone_get_builtin_timezone_from_tzid (start_date->tzid);
if (!start_zone) {
- status = cal_client_get_timezone (COMP_EDITOR_PAGE (spage)->client,
- start_date->tzid,
- &start_zone);
- /* FIXME: Handle error better. */
- if (status != CAL_CLIENT_GET_SUCCESS)
+ if (!cal_client_get_timezone (COMP_EDITOR_PAGE (spage)->client,
+ start_date->tzid, &start_zone, NULL)) {
+ /* FIXME: Handle error better. */
g_warning ("Couldn't get timezone from server: %s",
start_date->tzid ? start_date->tzid : "");
+ }
}
end_zone = icaltimezone_get_builtin_timezone_from_tzid (end_date->tzid);
if (!end_zone) {
- status = cal_client_get_timezone (COMP_EDITOR_PAGE (spage)->client,
- end_date->tzid,
- &end_zone);
- /* FIXME: Handle error better. */
- if (status != CAL_CLIENT_GET_SUCCESS)
- g_warning ("Couldn't get timezone from server: %s",
- end_date->tzid ? end_date->tzid : "");
+ if (!cal_client_get_timezone (COMP_EDITOR_PAGE (spage)->client,
+ end_date->tzid, &end_zone, NULL)) {
+ /* FIXME: Handle error better. */
+ g_warning ("Couldn't get timezone from server: %s",
+ end_date->tzid ? end_date->tzid : "");
+ }
}
start_tt = *start_date->value;
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index eaf4c2eaca..2e1b4745d8 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -111,13 +111,14 @@ static void
set_menu_sens (TaskEditor *te)
{
TaskEditorPrivate *priv;
- gboolean sens, existing, user, read_only;
+ gboolean sens, existing, user, read_only = TRUE;
priv = te->priv;
existing = comp_editor_get_existing_org (COMP_EDITOR (te));
user = comp_editor_get_user_org (COMP_EDITOR (te));
- read_only = cal_client_is_read_only (comp_editor_get_cal_client (COMP_EDITOR (te)));
+
+ cal_client_is_read_only (comp_editor_get_cal_client (COMP_EDITOR (te)), &read_only, NULL);
sens = cal_client_get_static_capability (comp_editor_get_cal_client (COMP_EDITOR (te)),
CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT)
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index 760b3e6f9e..fb7558ce5a 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -253,7 +253,6 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
CalComponentText text;
CalComponentDateTime d;
CalComponentClassification cl;
- CalClientGetStatus get_tz_status;
GSList *l;
const char *categories;
icaltimezone *zone, *default_zone;
@@ -317,12 +316,10 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
if (!zone)
zone = icaltimezone_get_builtin_timezone_from_tzid (d.tzid);
if (!zone) {
- get_tz_status = cal_client_get_timezone (page->client, d.tzid,
- &zone);
- /* FIXME: Handle error better. */
- if (get_tz_status != CAL_CLIENT_GET_SUCCESS)
- g_warning ("Couldn't get timezone from server: %s",
- d.tzid ? d.tzid : "");
+ if (!cal_client_get_timezone (page->client, d.tzid, &zone, NULL))
+ /* FIXME: Handle error better. */
+ g_warning ("Couldn't get timezone from server: %s",
+ d.tzid ? d.tzid : "");
}
e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->due_timezone),
zone);
@@ -359,10 +356,8 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
if (!zone)
zone = icaltimezone_get_builtin_timezone_from_tzid (d.tzid);
if (!zone) {
- get_tz_status = cal_client_get_timezone (page->client, d.tzid,
- &zone);
- /* FIXME: Handle error better. */
- if (get_tz_status != CAL_CLIENT_GET_SUCCESS)
+ if (!cal_client_get_timezone (page->client, d.tzid, &zone, NULL))
+ /* FIXME: Handle error better. */
g_warning ("Couldn't get timezone from server: %s",
d.tzid ? d.tzid : "");
}