aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2003-10-22 02:51:30 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2003-10-22 02:51:30 +0800
commit21743ac2cfa2d2ddcd539e9b7695cc8dd720ef36 (patch)
tree0111dbe4d8a6d5617f5e5406001b0024e4293169 /calendar/gui
parent653cfffc0e00dfb59b36813c1b45c53d3f773c65 (diff)
downloadgsoc2013-evolution-21743ac2cfa2d2ddcd539e9b7695cc8dd720ef36.tar
gsoc2013-evolution-21743ac2cfa2d2ddcd539e9b7695cc8dd720ef36.tar.gz
gsoc2013-evolution-21743ac2cfa2d2ddcd539e9b7695cc8dd720ef36.tar.bz2
gsoc2013-evolution-21743ac2cfa2d2ddcd539e9b7695cc8dd720ef36.tar.lz
gsoc2013-evolution-21743ac2cfa2d2ddcd539e9b7695cc8dd720ef36.tar.xz
gsoc2013-evolution-21743ac2cfa2d2ddcd539e9b7695cc8dd720ef36.tar.zst
gsoc2013-evolution-21743ac2cfa2d2ddcd539e9b7695cc8dd720ef36.zip
Merge new-ui-branch into the trunk.
svn path=/trunk/; revision=22966
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/dialogs/alarm-page.c16
-rw-r--r--calendar/gui/dialogs/comp-editor-util.c1
-rw-r--r--calendar/gui/dialogs/comp-editor.c40
-rw-r--r--calendar/gui/dialogs/delete-error.c25
-rw-r--r--calendar/gui/dialogs/delete-error.h2
-rw-r--r--calendar/gui/dialogs/e-delegate-dialog.c26
-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.c12
-rw-r--r--calendar/gui/dialogs/meeting-page.etspec21
-rw-r--r--calendar/gui/dialogs/new-calendar.c150
-rw-r--r--calendar/gui/dialogs/new-calendar.glade193
-rw-r--r--calendar/gui/dialogs/new-calendar.h28
-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
17 files changed, 490 insertions, 103 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-util.c b/calendar/gui/dialogs/comp-editor-util.c
index ce3cbc42f6..d06234edda 100644
--- a/calendar/gui/dialogs/comp-editor-util.c
+++ b/calendar/gui/dialogs/comp-editor-util.c
@@ -31,7 +31,6 @@
#include <bonobo-activation/bonobo-activation.h>
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-widget.h>
-#include <ebook/e-destination.h>
#include <e-util/e-time-utils.h>
#include <cal-util/timeutil.h>
#include "../calendar-config.h"
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index f9c9919338..2bbcf92df3 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,8 @@ save_comp (CompEditor *editor)
CompEditorPrivate *priv;
CalComponent *clone;
GList *l;
- CalClientResult result;
+ gboolean result;
+ GError *error = NULL;
priv = editor->priv;
@@ -321,32 +323,24 @@ 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)) {
+ result = cal_client_create_object (priv->client, cal_component_get_icalcomponent (priv->comp), NULL, &error);
+ } else {
+ result = cal_client_modify_object (priv->client, cal_component_get_icalcomponent (priv->comp), priv->mod, &error);
+ }
+
+ 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 (error ? error->message : _("Could not update object"));
dlg = gnome_error_dialog (msg);
gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
+
g_free (msg);
+ if (error)
+ g_error_free (error);
return FALSE;
} else {
@@ -391,7 +385,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 +1436,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 +1446,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/e-delegate-dialog.c b/calendar/gui/dialogs/e-delegate-dialog.c
index 85c17bbd4b..709ea41178 100644
--- a/calendar/gui/dialogs/e-delegate-dialog.c
+++ b/calendar/gui/dialogs/e-delegate-dialog.c
@@ -33,7 +33,7 @@
#include <glade/glade.h>
#include <gal/util/e-util.h>
#include <widgets/misc/e-map.h>
-#include <ebook/e-destination.h>
+#include <addressbook/util/eab-destination.h>
#include "Evolution-Addressbook-SelectNames.h"
#include "e-delegate-dialog.h"
@@ -126,8 +126,8 @@ EDelegateDialog *
e_delegate_dialog_construct (EDelegateDialog *edd, const char *name, const char *address)
{
EDelegateDialogPrivate *priv;
- EDestination *dest;
- EDestination *destv[2] = {NULL, NULL};
+ EABDestination *dest;
+ EABDestination *destv[2] = {NULL, NULL};
Bonobo_Control corba_control;
CORBA_Environment ev;
char *str;
@@ -178,13 +178,13 @@ e_delegate_dialog_construct (EDelegateDialog *edd, const char *name, const char
gtk_widget_show (priv->entry);
gtk_box_pack_start (GTK_BOX (priv->hbox), priv->entry, TRUE, TRUE, 6);
- dest = e_destination_new ();
+ dest = eab_destination_new ();
destv[0] = dest;
if (name != NULL && *name)
- e_destination_set_name (dest, name);
+ eab_destination_set_name (dest, name);
if (address != NULL && *address)
- e_destination_set_email (dest, address);
- str = e_destination_exportv(destv);
+ eab_destination_set_email (dest, address);
+ str = eab_destination_exportv(destv);
bonobo_widget_set_property (BONOBO_WIDGET (priv->entry), "destinations", TC_CORBA_string, str, NULL);
g_free(str);
g_object_unref((dest));
@@ -256,7 +256,7 @@ char *
e_delegate_dialog_get_delegate (EDelegateDialog *edd)
{
EDelegateDialogPrivate *priv;
- EDestination **destv;
+ EABDestination **destv;
char *string = NULL;
g_return_val_if_fail (edd != NULL, NULL);
@@ -265,11 +265,11 @@ e_delegate_dialog_get_delegate (EDelegateDialog *edd)
priv = edd->priv;
bonobo_widget_get_property (BONOBO_WIDGET (priv->entry), "destinations", TC_CORBA_string, &string, NULL);
- destv = e_destination_importv (string);
+ destv = eab_destination_importv (string);
if (destv && destv[0] != NULL) {
g_free (priv->address);
- priv->address = g_strdup (e_destination_get_email (destv[0]));
+ priv->address = g_strdup (eab_destination_get_email (destv[0]));
g_free (destv);
}
@@ -283,7 +283,7 @@ char *
e_delegate_dialog_get_delegate_name (EDelegateDialog *edd)
{
EDelegateDialogPrivate *priv;
- EDestination **destv;
+ EABDestination **destv;
char *string = NULL;
g_return_val_if_fail (edd != NULL, NULL);
@@ -292,13 +292,13 @@ e_delegate_dialog_get_delegate_name (EDelegateDialog *edd)
priv = edd->priv;
bonobo_widget_get_property (BONOBO_WIDGET (priv->entry), "destinations", TC_CORBA_string, &string, NULL);
- destv = e_destination_importv (string);
+ destv = eab_destination_importv (string);
g_message ("importv: [%s]", string);
if (destv && destv[0] != NULL) {
g_free (priv->name);
- priv->name = g_strdup (e_destination_get_name (destv[0]));
+ priv->name = g_strdup (eab_destination_get_name (destv[0]));
g_free (destv);
}
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index 978a2dbb22..861a52c203 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -122,13 +122,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 6c8212e93c..800b0d56c6 100644
--- a/calendar/gui/dialogs/meeting-page.c
+++ b/calendar/gui/dialogs/meeting-page.c
@@ -35,6 +35,7 @@
#include <glade/glade.h>
#include <libgnomeui/gnome-stock-icons.h>
#include <gal/util/e-util.h>
+#include <gal/e-table/e-table.h>
#include <gal/widgets/e-unicode.h>
#include <gal/widgets/e-popup-menu.h>
#include <gal/widgets/e-gui-utils.h>
@@ -693,7 +694,9 @@ meeting_page_construct (MeetingPage *mpage, EMeetingStore *ems,
CalClient *client)
{
MeetingPagePrivate *priv;
- const char *backend_address;
+ ETable *real_table;
+ gchar *filename;
+ char *backend_address;
EIterator *it;
EAccount *def_account;
GList *address_strings = NULL, *l;
@@ -716,7 +719,8 @@ meeting_page_construct (MeetingPage *mpage, EMeetingStore *ems,
}
/* 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();
@@ -743,7 +747,8 @@ meeting_page_construct (MeetingPage *mpage, EMeetingStore *ems,
}
}
g_object_unref(it);
-
+ g_free (backend_address);
+
if (address_strings)
gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), address_strings);
else
@@ -753,6 +758,7 @@ meeting_page_construct (MeetingPage *mpage, EMeetingStore *ems,
g_free (l->data);
g_list_free (address_strings);
+ /* The etable displaying attendees and their status */
g_object_ref((ems));
priv->model = ems;
diff --git a/calendar/gui/dialogs/meeting-page.etspec b/calendar/gui/dialogs/meeting-page.etspec
new file mode 100644
index 0000000000..96bc480fe9
--- /dev/null
+++ b/calendar/gui/dialogs/meeting-page.etspec
@@ -0,0 +1,21 @@
+<ETableSpecification click-to-add="true" click-to-add-end="true" _click-to-add-message="Click here to add an attendee" draw-grid="true">
+ <ETableColumn model_col= "0" _title="Attendee" expansion="2.0" minimum_width="10" resizable="true" cell="string" compare="string"/>
+ <ETableColumn model_col= "1" _title="Member" expansion="2.0" minimum_width="10" resizable="true" cell="string" compare="string"/>
+ <ETableColumn model_col= "2" _title="Type" expansion="1.0" minimum_width="10" resizable="true" cell="typeedit" compare="string"/>
+ <ETableColumn model_col= "3" _title="Role" expansion="1.0" minimum_width="10" resizable="true" cell="roleedit" compare="string"/>
+ <ETableColumn model_col= "4" _title="RSVP" expansion="1.0" minimum_width="10" resizable="true" cell="rsvpedit" compare="string"/>
+ <ETableColumn model_col= "5" _title="Delegated To" expansion="2.0" minimum_width="10" resizable="true" cell="string" compare="string"/>
+ <ETableColumn model_col= "6" _title="Delegated From" expansion="2.0" minimum_width="10" resizable="true" cell="string" compare="string"/>
+ <ETableColumn model_col= "7" _title="Status" expansion="1.0" minimum_width="10" resizable="true" cell="statusedit" compare="string"/>
+ <ETableColumn model_col= "8" _title="Common Name" expansion="2.0" minimum_width="10" resizable="true" cell="string" compare="string"/>
+ <ETableColumn model_col= "9" _title="Language" expansion="2.0" minimum_width="10" resizable="true" cell="string" compare="string"/>
+
+ <ETableState>
+ <column source="0"/>
+ <column source="2"/>
+ <column source="3"/>
+ <column source="4"/>
+ <column source="7"/>
+ <grouping></grouping>
+ </ETableState>
+</ETableSpecification>
diff --git a/calendar/gui/dialogs/new-calendar.c b/calendar/gui/dialogs/new-calendar.c
new file mode 100644
index 0000000000..aa647b55b2
--- /dev/null
+++ b/calendar/gui/dialogs/new-calendar.c
@@ -0,0 +1,150 @@
+/* Evolution calendar - Send calendar component dialog
+ *
+ * Copyright (C) 2001 Ximian, Inc.
+ *
+ * Author: JP Rosevear <jpr@ximian.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <bonobo/bonobo-i18n.h>
+#include <gtk/gtkdialog.h>
+#include <gtk/gtkentry.h>
+#include <gtk/gtkmenu.h>
+#include <gtk/gtkmenuitem.h>
+#include <gtk/gtkmessagedialog.h>
+#include <gtk/gtkoptionmenu.h>
+#include <glade/glade.h>
+#include <e-util/e-dialog-utils.h>
+#include <e-util/e-source-list.h>
+#include "new-calendar.h"
+
+static gboolean
+create_new_source_with_group (GtkWindow *parent,
+ ESourceGroup *group,
+ const char *source_name)
+{
+ ESource *source;
+ char *new_dir;
+
+ if (e_source_group_peek_source_by_name (group, source_name)) {
+ e_notice (parent, GTK_MESSAGE_ERROR,
+ _("Source with name '%s' already exists in the selected group"),
+ source_name);
+ return FALSE;
+ }
+
+ /* create the new source */
+ new_dir = g_build_filename (e_source_group_peek_base_uri (group),
+ source_name, NULL);
+ if (e_mkdir_hier (new_dir, 0700)) {
+ g_free (new_dir);
+ e_notice (parent, GTK_MESSAGE_ERROR,
+ _("Could not create directory for new calendar"));
+ return FALSE;
+ }
+
+ source = e_source_new (source_name, source_name);
+ e_source_group_add_source (group, source, -1);
+
+ g_free (new_dir);
+
+ return TRUE;
+}
+
+/**
+ * new_calendar_dialog
+ *
+ * Displays a dialog that allows the user to create a new calendar.
+ */
+gboolean
+new_calendar_dialog (GtkWindow *parent)
+{
+ GtkWidget *dialog, *cal_group, *cal_name;
+ GladeXML *xml;
+ ESourceList *source_list;
+ GConfClient *gconf_client;
+ GSList *groups, *sl;
+ gboolean result = FALSE, retry = TRUE;
+
+ /* load the Glade file */
+ xml = glade_xml_new (EVOLUTION_GLADEDIR "/new-calendar.glade", "new-calendar-dialog", NULL);
+ if (!xml) {
+ g_warning ("new_calendar_dialog(): cannot load Glade file");
+ return FALSE;
+ }
+
+ dialog = glade_xml_get_widget (xml, "new-calendar-dialog");
+ cal_group = glade_xml_get_widget (xml, "calendar-group");
+ cal_name = glade_xml_get_widget (xml, "calendar-name");
+
+ /* set up widgets */
+ gconf_client = gconf_client_get_default ();
+ source_list = e_source_list_new_for_gconf (gconf_client, "/apps/evolution/calendar/sources");
+
+ groups = e_source_list_peek_groups (source_list);
+ for (sl = groups; sl != NULL; sl = sl->next) {
+ GtkWidget *menu_item, *menu;
+ ESourceGroup *group = sl->data;
+
+ menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (cal_group));
+ if (!GTK_IS_MENU (menu)) {
+ menu = gtk_menu_new ();
+ gtk_option_menu_set_menu (GTK_OPTION_MENU (cal_group), menu);
+ gtk_widget_show (menu);
+ }
+
+ menu_item = gtk_menu_item_new_with_label (e_source_group_peek_name (group));
+ gtk_widget_show (menu_item);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
+ }
+
+ if (groups)
+ gtk_option_menu_set_history (GTK_OPTION_MENU (cal_group), 0);
+
+ /* run the dialog */
+ do {
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
+ char *name;
+
+ name = gtk_entry_get_text (GTK_ENTRY (cal_name));
+ sl = g_slist_nth (groups, gtk_option_menu_get_history (GTK_OPTION_MENU (cal_group)));
+ if (sl) {
+ if (create_new_source_with_group (GTK_WINDOW (dialog),
+ sl->data,
+ name))
+ retry = FALSE;
+ } else {
+ e_notice (dialog, GTK_MESSAGE_ERROR,
+ _("A group must be selected"));
+ continue;
+ }
+ } else
+ retry = FALSE; /* user pressed Cancel */
+ } while (retry);
+
+ /* free memory */
+ g_object_unref (gconf_client);
+ g_object_unref (source_list);
+ gtk_widget_destroy (dialog);
+
+ /* free memory */
+ g_object_unref (xml);
+
+ return result;
+}
diff --git a/calendar/gui/dialogs/new-calendar.glade b/calendar/gui/dialogs/new-calendar.glade
new file mode 100644
index 0000000000..42717a87a8
--- /dev/null
+++ b/calendar/gui/dialogs/new-calendar.glade
@@ -0,0 +1,193 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+<requires lib="gnome"/>
+
+<widget class="GtkDialog" id="new-calendar-dialog">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Add New Calendar</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_CENTER</property>
+ <property name="modal">False</property>
+ <property name="resizable">False</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">True</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="cancelbutton1">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-6</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="okbutton1">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-ok</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-5</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">3</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Calendar Group</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_padding">6</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Calendar Name</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_padding">6</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkOptionMenu" id="calendar-group">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="history">-1</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_padding">6</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="calendar-name">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_padding">6</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Calendar options&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_padding">6</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
diff --git a/calendar/gui/dialogs/new-calendar.h b/calendar/gui/dialogs/new-calendar.h
new file mode 100644
index 0000000000..9890f9e1f8
--- /dev/null
+++ b/calendar/gui/dialogs/new-calendar.h
@@ -0,0 +1,28 @@
+/* Evolution calendar - Send calendar component dialog
+ *
+ * Copyright (C) 2001 Ximian, Inc.
+ *
+ * Author: JP Rosevear <jpr@ximian.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef NEW_CALENDAR_H
+#define NEW_CALENDAR_H
+
+#include <gtk/gtkwindow.h>
+
+gboolean new_calendar_dialog (GtkWindow *parent);
+
+#endif
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 8cad77360b..06c2d57131 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 4ef971fe85..339fdca80d 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -112,13 +112,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 : "");
}