aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorHans Petter Jansson <hpj@ximian.com>2004-01-10 03:50:12 +0800
committerHans Petter <hansp@src.gnome.org>2004-01-10 03:50:12 +0800
commit46e6941d4f3f568a45432927ca3bf393fc2902ed (patch)
tree3ac355b835759d461542c1e17841eed4d75e818e /calendar
parentface7b1e90bde0643042d643dc633c9fe0de21cf (diff)
downloadgsoc2013-evolution-46e6941d4f3f568a45432927ca3bf393fc2902ed.tar
gsoc2013-evolution-46e6941d4f3f568a45432927ca3bf393fc2902ed.tar.gz
gsoc2013-evolution-46e6941d4f3f568a45432927ca3bf393fc2902ed.tar.bz2
gsoc2013-evolution-46e6941d4f3f568a45432927ca3bf393fc2902ed.tar.lz
gsoc2013-evolution-46e6941d4f3f568a45432927ca3bf393fc2902ed.tar.xz
gsoc2013-evolution-46e6941d4f3f568a45432927ca3bf393fc2902ed.tar.zst
gsoc2013-evolution-46e6941d4f3f568a45432927ca3bf393fc2902ed.zip
Call calendar_config_new_calendar(). (rename_calendar_cb): Remove.
2003-01-09 Hans Petter Jansson <hpj@ximian.com> * gui/calendar-component.c (new_calendar_cb): Call calendar_config_new_calendar(). (rename_calendar_cb): Remove. (edit_calendar_cb): Implement properties callback. (fill_popup_menu_cb): Add "Properties..." item and remove "Rename". * gui/dialogs/Makefile.am (libcal_dialogs_la_SOURCES): Add calendar-config.[ch] and remove new-calendar.[ch]. (glade_DATA): Add calendar-config.glade and remove new-calendar.glade. * gui/dialogs/calendar-config.[ch]: Implement calendar creation and editing. * gui/dialogs/calendar-config.glade: Add GUI for above. svn path=/trunk/; revision=24135
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog17
-rw-r--r--calendar/gui/calendar-commands.c1
-rw-r--r--calendar/gui/calendar-component.c28
-rw-r--r--calendar/gui/dialogs/Makefile.am6
-rw-r--r--calendar/gui/dialogs/calendar-config.c634
-rw-r--r--calendar/gui/dialogs/calendar-config.glade901
-rw-r--r--calendar/gui/dialogs/calendar-config.h (renamed from calendar/gui/dialogs/new-calendar.h)13
-rw-r--r--calendar/gui/dialogs/new-calendar.c268
8 files changed, 1568 insertions, 300 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 1387594e13..b0e64ccbac 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,20 @@
+2003-01-09 Hans Petter Jansson <hpj@ximian.com>
+
+ * gui/calendar-component.c (new_calendar_cb): Call
+ calendar_config_new_calendar().
+ (rename_calendar_cb): Remove.
+ (edit_calendar_cb): Implement properties callback.
+ (fill_popup_menu_cb): Add "Properties..." item and remove "Rename".
+
+ * gui/dialogs/Makefile.am (libcal_dialogs_la_SOURCES): Add
+ calendar-config.[ch] and remove new-calendar.[ch].
+ (glade_DATA): Add calendar-config.glade and remove new-calendar.glade.
+
+ * gui/dialogs/calendar-config.[ch]: Implement calendar creation and
+ editing.
+
+ * gui/dialogs/calendar-config.glade: Add GUI for above.
+
2004-01-09 JP Rosevear <jpr@ximian.com>
* gui/tasks-component.c (impl_upgradeFromVersion): return the
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index ce6c5651b3..4039e7ec81 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -59,7 +59,6 @@
#include "goto.h"
#include "print.h"
#include "dialogs/cal-prefs-dialog.h"
-#include "dialogs/new-calendar.h"
#include "itip-utils.h"
#include "evolution-shell-component-utils.h"
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index f3a077459f..3e2dd6b37f 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -39,7 +39,7 @@
#include "e-comp-editor-registry.h"
#include "comp-util.h"
#include "common/authentication.h"
-#include "dialogs/new-calendar.h"
+#include "dialogs/calendar-config.h"
#include "dialogs/comp-editor.h"
#include "dialogs/copy-source-dialog.h"
#include "dialogs/event-editor.h"
@@ -373,15 +373,14 @@ delete_calendar_cb (GtkWidget *widget, CalendarComponent *comp)
static void
new_calendar_cb (GtkWidget *widget, CalendarComponent *comp)
{
- new_calendar_dialog (GTK_WINDOW (gtk_widget_get_toplevel (widget)));
+ calendar_config_new_calendar (GTK_WINDOW (gtk_widget_get_toplevel (widget)));
}
static void
-rename_calendar_cb (GtkWidget *widget, CalendarComponent *comp)
+edit_calendar_cb (GtkWidget *widget, CalendarComponent *comp)
{
CalendarComponentPrivate *priv;
ESource *selected_source;
- GtkWidget *dialog, *entry;
priv = comp->priv;
@@ -389,22 +388,7 @@ rename_calendar_cb (GtkWidget *widget, CalendarComponent *comp)
if (!selected_source)
return;
- /* create the dialog to prompt the user for the new name */
- dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (widget)),
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_OK_CANCEL,
- _("Rename this calendar to"));
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
- entry = gtk_entry_new ();
- gtk_entry_set_text (GTK_ENTRY (entry), e_source_peek_name (selected_source));
- gtk_widget_show (entry);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), entry, TRUE, FALSE, 6);
-
- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
- e_source_set_name (selected_source, gtk_entry_get_text (GTK_ENTRY (entry)));
-
- gtk_widget_destroy (dialog);
+ calendar_config_edit_calendar (GTK_WINDOW (gtk_widget_get_toplevel (widget)), selected_source);
}
static void
@@ -419,8 +403,8 @@ fill_popup_menu_cb (ESourceSelector *selector, GtkMenu *menu, CalendarComponent
G_CALLBACK (new_calendar_cb), comp, TRUE);
add_popup_menu_item (menu, _("Copy"), EVOLUTION_IMAGESDIR "/folder-copy-16.png",
G_CALLBACK (copy_calendar_cb), comp, sensitive);
- add_popup_menu_item (menu, _("Rename"), NULL, G_CALLBACK (rename_calendar_cb), comp, sensitive);
add_popup_menu_item (menu, _("Delete"), GTK_STOCK_DELETE, G_CALLBACK (delete_calendar_cb), comp, sensitive);
+ add_popup_menu_item (menu, _("Properties..."), NULL, G_CALLBACK (edit_calendar_cb), comp, sensitive);
}
static void
@@ -808,7 +792,7 @@ impl_requestCreateItem (PortableServer_Servant servant,
comp = get_default_event (priv->create_ecal, FALSE);
is_meeting = TRUE;
} else if (strcmp (item_type_name, CREATE_CALENDAR_ID) == 0) {
- new_calendar_dialog (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (priv->calendar))));
+ calendar_config_new_calendar (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (priv->calendar))));
return;
} else {
bonobo_exception_set (ev, ex_GNOME_Evolution_Component_UnknownType);
diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am
index 7e3b76fd97..1749aa5482 100644
--- a/calendar/gui/dialogs/Makefile.am
+++ b/calendar/gui/dialogs/Makefile.am
@@ -37,6 +37,8 @@ libcal_dialogs_la_SOURCES = \
alarm-page.h \
cal-prefs-dialog.c \
cal-prefs-dialog.h \
+ calendar-config.c \
+ calendar-config.h \
cancel-comp.c \
cancel-comp.h \
changed-comp.c \
@@ -61,8 +63,6 @@ libcal_dialogs_la_SOURCES = \
event-page.h \
meeting-page.c \
meeting-page.h \
- new-calendar.c \
- new-calendar.h \
new-task-list.c \
new-task-list.h \
recurrence-page.c \
@@ -86,10 +86,10 @@ glade_DATA = \
alarm-options.glade \
alarm-page.glade \
cal-prefs-dialog.glade \
+ calendar-config.glade \
e-delegate-dialog.glade \
event-page.glade \
meeting-page.glade \
- new-calendar.glade \
new-task-list.glade \
recurrence-page.glade \
schedule-page.glade \
diff --git a/calendar/gui/dialogs/calendar-config.c b/calendar/gui/dialogs/calendar-config.c
new file mode 100644
index 0000000000..a5066c41d3
--- /dev/null
+++ b/calendar/gui/dialogs/calendar-config.c
@@ -0,0 +1,634 @@
+/* Evolution calendar - Calendar properties dialogs
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * Author: Hans Petter Jansson <hpj@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 <string.h>
+#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 <libgnomeui/gnome-druid.h>
+#include <libgnomeui/gnome-druid-page.h>
+#include <glade/glade.h>
+#include <libedataserver/e-source-list.h>
+#include <e-util/e-dialog-utils.h>
+#include <e-util/e-url.h>
+#include "calendar-config.h"
+
+#define GLADE_FILE_NAME "calendar-config.glade"
+
+static gchar *
+print_uri_noproto (EUri *uri)
+{
+ gchar *uri_noproto;
+
+ if (uri->port != 0)
+ uri_noproto = g_strdup_printf (
+ "%s%s%s%s%s%s%s:%d%s%s%s",
+ uri->user ? uri->user : "",
+ uri->authmech ? ";auth=" : "",
+ uri->authmech ? uri->authmech : "",
+ uri->passwd ? ":" : "",
+ uri->passwd ? uri->passwd : "",
+ uri->user ? "@" : "",
+ uri->host ? uri->host : "",
+ uri->port,
+ uri->path ? uri->path : "",
+ uri->query ? "?" : "",
+ uri->query ? uri->query : "");
+ else
+ uri_noproto = g_strdup_printf (
+ "%s%s%s%s%s%s%s%s%s%s",
+ uri->user ? uri->user : "",
+ uri->authmech ? ";auth=" : "",
+ uri->authmech ? uri->authmech : "",
+ uri->passwd ? ":" : "",
+ uri->passwd ? uri->passwd : "",
+ uri->user ? "@" : "",
+ uri->host ? uri->host : "",
+ uri->path ? uri->path : "",
+ uri->query ? "?" : "",
+ uri->query ? uri->query : "");
+
+ return uri_noproto;
+}
+
+static gboolean
+source_group_is_remote (ESourceGroup *group)
+{
+ EUri *uri;
+ gboolean is_remote = FALSE;
+
+ uri = e_uri_new (e_source_group_peek_base_uri (group));
+ if (!uri)
+ return FALSE;
+
+ if (uri->protocol && uri->protocol [0] && strcmp (uri->protocol, "file"))
+ is_remote = TRUE;
+
+ e_uri_free (uri);
+ return is_remote;
+}
+
+static gboolean
+source_is_remote (ESource *source)
+{
+ gchar *uri_str;
+ EUri *uri;
+ gboolean is_remote = FALSE;
+
+ uri_str = e_source_get_uri (source);
+ if (!uri_str)
+ return FALSE;
+
+ uri = e_uri_new (uri_str);
+ g_free (uri_str);
+
+ if (!uri)
+ return FALSE;
+
+ if (uri->protocol && uri->protocol [0] && strcmp (uri->protocol, "file"))
+ is_remote = TRUE;
+
+ e_uri_free (uri);
+ return is_remote;
+}
+
+static gboolean
+validate_remote_uri (const gchar *source_location, gboolean interactive, GtkWidget *parent)
+{
+ EUri *uri;
+
+ if (!source_location || !strlen (source_location)) {
+ if (interactive)
+ e_notice (parent, GTK_MESSAGE_ERROR,
+ _("You must specify a location to get the calendar from."));
+ return FALSE;
+ }
+
+ uri = e_uri_new (source_location);
+ if (!uri) {
+ if (interactive)
+ e_notice (parent, GTK_MESSAGE_ERROR,
+ _("The source location '%s' is not well-formed."),
+ source_location);
+ return FALSE;
+ }
+
+ /* Make sure we're in agreement with the protocol. Note that EUri sets it
+ * to 'file' if none was specified in the input URI. We don't want to
+ * silently translate an explicit file:// into http:// though. */
+ if (uri->protocol &&
+ strcmp (uri->protocol, "http") &&
+ strcmp (uri->protocol, "webcal")) {
+ e_uri_free (uri);
+
+ if (interactive)
+ e_notice (parent, GTK_MESSAGE_ERROR,
+ _("The source location '%s' is not a webcal source."),
+ source_location);
+ return FALSE;
+ }
+
+ e_uri_free (uri);
+ return TRUE;
+}
+
+static void
+source_group_menu_add_groups (GtkMenuShell *menu_shell, ESourceList *source_list)
+{
+ GSList *groups, *sl;
+
+ groups = e_source_list_peek_groups (source_list);
+ for (sl = groups; sl; sl = g_slist_next (sl)) {
+ GtkWidget *menu_item;
+ ESourceGroup *group = sl->data;
+
+ menu_item = gtk_menu_item_new_with_label (e_source_group_peek_name (group));
+ gtk_widget_show (menu_item);
+ gtk_menu_shell_append (menu_shell, menu_item);
+ }
+}
+
+static ESource *
+create_new_source_with_group (GtkWindow *parent,
+ ESourceGroup *group,
+ const char *source_name,
+ const char *source_location)
+{
+ ESource *source;
+
+ 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 NULL;
+ }
+
+ if (source_group_is_remote (group)) {
+ EUri *uri;
+ gchar *relative_uri;
+
+ /* Remote source */
+
+ if (!source_location || !strlen (source_location)) {
+ e_notice (parent, GTK_MESSAGE_ERROR,
+ _("The group '%s' is remote. You must specify a location "
+ "to get the calendar from"),
+ e_source_group_peek_name (group));
+ return NULL;
+ }
+
+ if (!validate_remote_uri (source_location, TRUE, GTK_WIDGET (parent)))
+ return NULL;
+
+ /* Our relative_uri is everything but protocol, which is supplied by parent group */
+ uri = e_uri_new (source_location);
+ relative_uri = print_uri_noproto (uri);
+ e_uri_free (uri);
+
+ /* Create source */
+ source = e_source_new (source_name, relative_uri);
+
+ g_free (relative_uri);
+ } else {
+ char *new_dir;
+
+ /* Local 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 NULL;
+ }
+
+ source = e_source_new (source_name, source_name);
+ g_free (new_dir);
+ }
+
+ e_source_group_add_source (group, source, -1);
+ return source;
+}
+
+typedef struct
+{
+ GladeXML *gui_xml;
+
+ /* Main widgets */
+ GtkWidget *window;
+ GtkWidget *druid;
+
+ /* Source selection */
+ ESourceList *source_list;
+ GtkWidget *group_optionmenu;
+
+ /* ESource we're currently editing (if any) */
+ ESource *source;
+
+ /* Source group we're creating/editing source in */
+ ESourceGroup *source_group;
+
+ /* General page fields */
+ GtkWidget *name_entry;
+
+ /* Location page fields */
+ GtkWidget *uri_entry;
+ GtkWidget *refresh_spin;
+}
+SourceDialog;
+
+static void
+source_to_dialog (SourceDialog *source_dialog)
+{
+ ESource *source = source_dialog->source;
+
+ g_signal_handlers_block_matched (source_dialog->name_entry, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, source_dialog);
+ g_signal_handlers_block_matched (source_dialog->uri_entry, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, source_dialog);
+ g_signal_handlers_block_matched (source_dialog->refresh_spin, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, source_dialog);
+
+ gtk_entry_set_text (GTK_ENTRY (source_dialog->name_entry), source ? e_source_peek_name (source) : "");
+ if (source && source_is_remote (source)) {
+ gchar *uri_str;
+ const gchar *refresh_str;
+
+ uri_str = e_source_get_uri (source);
+ gtk_entry_set_text (GTK_ENTRY (source_dialog->uri_entry), uri_str);
+ g_free (uri_str);
+
+ refresh_str = e_source_get_property (source, "refresh");
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (source_dialog->refresh_spin),
+ refresh_str ? atoi (refresh_str) : 30);
+ } else {
+ gtk_entry_set_text (GTK_ENTRY (source_dialog->uri_entry), "");
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (source_dialog->refresh_spin), 30);
+ }
+
+ g_signal_handlers_unblock_matched (source_dialog->name_entry, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, source_dialog);
+ g_signal_handlers_unblock_matched (source_dialog->uri_entry, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, source_dialog);
+ g_signal_handlers_unblock_matched (source_dialog->refresh_spin, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, source_dialog);
+}
+
+static void
+dialog_to_source (SourceDialog *source_dialog)
+{
+ ESource *source = source_dialog->source;
+
+ g_return_if_fail (source != NULL);
+
+ e_source_set_name (source, gtk_entry_get_text (GTK_ENTRY (source_dialog->name_entry)));
+ if (source_is_remote (source)) {
+ EUri *uri;
+ gchar *relative_uri;
+ gchar *refresh_str;
+
+ /* Our relative_uri is everything but protocol, which is supplied by parent group */
+ uri = e_uri_new (gtk_entry_get_text (GTK_ENTRY (source_dialog->uri_entry)));
+ if (!uri) {
+ g_warning ("Invalid remote URI!");
+ return;
+ }
+
+ relative_uri = print_uri_noproto (uri);
+ e_uri_free (uri);
+
+ refresh_str = g_strdup_printf ("%d",
+ gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (source_dialog->refresh_spin)));
+
+ e_source_set_property (source, "refresh", refresh_str);
+ g_free (refresh_str);
+ }
+}
+
+static gboolean
+general_page_verify (SourceDialog *source_dialog)
+{
+ const gchar *name;
+
+ if (!source_dialog->source_group && !source_dialog->source)
+ return FALSE;
+
+ name = gtk_entry_get_text (GTK_ENTRY (source_dialog->name_entry));
+ if (!name || !name [0])
+ return FALSE;
+
+ return TRUE;
+}
+
+static gboolean
+remote_page_verify (SourceDialog *source_dialog)
+{
+ const gchar *uri;
+
+ uri = gtk_entry_get_text (GTK_ENTRY (source_dialog->uri_entry));
+ if (!uri || !uri [0])
+ return FALSE;
+
+ if (!validate_remote_uri (uri, FALSE, NULL))
+ return FALSE;
+
+ return TRUE;
+}
+
+static gboolean
+source_dialog_is_valid (SourceDialog *source_dialog)
+{
+ if (!general_page_verify (source_dialog))
+ return FALSE;
+
+ if (((source_dialog->source && source_is_remote (source_dialog->source)) ||
+ (source_dialog->source_group && source_group_is_remote (source_dialog->source_group))) &&
+ !remote_page_verify (source_dialog))
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+editor_set_buttons_sensitive (SourceDialog *source_dialog, gboolean sensitive)
+{
+ gtk_widget_set_sensitive (glade_xml_get_widget (source_dialog->gui_xml, "ok-button"), sensitive);
+}
+
+static void
+general_page_modified (SourceDialog *source_dialog)
+{
+ if (source_dialog->druid) {
+ gnome_druid_set_buttons_sensitive (GNOME_DRUID (source_dialog->druid),
+ TRUE, /* Back */
+ general_page_verify (source_dialog), /* Next */
+ TRUE, /* Cancel */
+ FALSE); /* Help */
+ } else {
+ editor_set_buttons_sensitive (source_dialog, source_dialog_is_valid (source_dialog));
+ }
+}
+
+static void
+remote_page_modified (SourceDialog *source_dialog)
+{
+ if (source_dialog->druid) {
+ gnome_druid_set_buttons_sensitive (GNOME_DRUID (source_dialog->druid),
+ TRUE, /* Back */
+ remote_page_verify (source_dialog), /* Next */
+ TRUE, /* Cancel */
+ FALSE); /* Help */
+ } else {
+ editor_set_buttons_sensitive (source_dialog, source_dialog_is_valid (source_dialog));
+ }
+}
+
+static void
+source_group_changed (SourceDialog *source_dialog)
+{
+ source_dialog->source_group =
+ g_slist_nth (e_source_list_peek_groups (source_dialog->source_list),
+ gtk_option_menu_get_history (GTK_OPTION_MENU (source_dialog->group_optionmenu)))->data;
+}
+
+static void
+general_page_prepare (GtkWidget *page, GtkWidget *druid, SourceDialog *source_dialog)
+{
+ general_page_modified (source_dialog);
+ gtk_widget_grab_focus (source_dialog->name_entry);
+}
+
+static void
+remote_page_prepare (GtkWidget *page, GtkWidget *druid, SourceDialog *source_dialog)
+{
+ remote_page_modified (source_dialog);
+ gtk_widget_grab_focus (source_dialog->uri_entry);
+}
+
+static gboolean
+general_page_forward (GtkWidget *page, GtkWidget *widget, SourceDialog *source_dialog)
+{
+ GtkWidget *finish_page = glade_xml_get_widget (source_dialog->gui_xml, "finish-page");
+
+ if (!source_group_is_remote (source_dialog->source_group)) {
+ gnome_druid_set_page (GNOME_DRUID (source_dialog->druid), GNOME_DRUID_PAGE (finish_page));
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
+finish_page_back (GtkWidget *page, GtkWidget *widget, SourceDialog *source_dialog)
+{
+ GtkWidget *general_page = glade_xml_get_widget (source_dialog->gui_xml, "general-page");
+
+ if (!source_group_is_remote (source_dialog->source_group)) {
+ gnome_druid_set_page (GNOME_DRUID (source_dialog->druid), GNOME_DRUID_PAGE (general_page));
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void
+new_calendar_finish (SourceDialog *source_dialog)
+{
+ source_dialog->source =
+ create_new_source_with_group (GTK_WINDOW (source_dialog->window), source_dialog->source_group,
+ gtk_entry_get_text (GTK_ENTRY (source_dialog->name_entry)),
+ gtk_entry_get_text (GTK_ENTRY (source_dialog->uri_entry)));
+ dialog_to_source (source_dialog);
+
+ gtk_widget_destroy (source_dialog->window);
+}
+
+static void
+new_calendar_cancel (SourceDialog *source_dialog)
+{
+ gtk_widget_destroy (source_dialog->window);
+}
+
+static void
+source_dialog_destroy (SourceDialog *source_dialog)
+{
+ g_object_unref (source_dialog->gui_xml);
+
+ if (source_dialog->source)
+ g_object_unref (source_dialog->source);
+
+ g_free (source_dialog);
+}
+
+gboolean
+calendar_config_new_calendar (GtkWindow *parent)
+{
+ SourceDialog *source_dialog = g_new0 (SourceDialog, 1);
+ GConfClient *gconf_client;
+ GtkWidget *page;
+
+ source_dialog->gui_xml = glade_xml_new (EVOLUTION_GLADEDIR "/" GLADE_FILE_NAME, "calendar-druid-window", NULL);
+ if (!source_dialog->gui_xml) {
+ g_warning (G_STRLOC ": Cannot load Glade file.");
+ g_free (source_dialog);
+ return FALSE;
+ }
+
+ source_dialog->window = glade_xml_get_widget (source_dialog->gui_xml, "calendar-druid-window");
+ source_dialog->druid = glade_xml_get_widget (source_dialog->gui_xml, "druid");
+
+ /* General page */
+ page = glade_xml_get_widget (source_dialog->gui_xml, "general-page");
+ source_dialog->name_entry = glade_xml_get_widget (source_dialog->gui_xml, "name-entry");
+ g_signal_connect_swapped (source_dialog->name_entry, "changed",
+ G_CALLBACK (general_page_modified), source_dialog);
+ g_signal_connect_after (page, "prepare",
+ G_CALLBACK (general_page_prepare), source_dialog);
+ g_signal_connect_after (page, "next",
+ G_CALLBACK (general_page_forward), source_dialog);
+
+ gconf_client = gconf_client_get_default ();
+ source_dialog->source_list =
+ e_source_list_new_for_gconf (gconf_client, "/apps/evolution/calendar/sources");
+ source_dialog->group_optionmenu =
+ glade_xml_get_widget (source_dialog->gui_xml, "group-optionmenu");
+ if (!GTK_IS_MENU (gtk_option_menu_get_menu (GTK_OPTION_MENU (source_dialog->group_optionmenu)))) {
+ GtkWidget *menu = gtk_menu_new ();
+ gtk_option_menu_set_menu (GTK_OPTION_MENU (source_dialog->group_optionmenu), menu);
+ gtk_widget_show (menu);
+ }
+
+ /* NOTE: This assumes that we have sources. If they don't exist, they're set up
+ * on startup of the calendar component. */
+ source_group_menu_add_groups (GTK_MENU_SHELL (gtk_option_menu_get_menu (
+ GTK_OPTION_MENU (source_dialog->group_optionmenu))), source_dialog->source_list);
+ gtk_option_menu_set_history (GTK_OPTION_MENU (source_dialog->group_optionmenu), 0);
+ source_dialog->source_group = e_source_list_peek_groups (source_dialog->source_list)->data;
+ g_signal_connect_swapped (source_dialog->group_optionmenu, "changed",
+ G_CALLBACK (source_group_changed), source_dialog);
+
+ /* Remote page */
+ page = glade_xml_get_widget (source_dialog->gui_xml, "remote-page");
+ source_dialog->uri_entry = glade_xml_get_widget (source_dialog->gui_xml, "uri-entry");
+ source_dialog->refresh_spin = glade_xml_get_widget (source_dialog->gui_xml, "refresh-spin");
+ g_signal_connect_swapped (source_dialog->uri_entry, "changed",
+ G_CALLBACK (remote_page_modified), source_dialog);
+ g_signal_connect_swapped (source_dialog->refresh_spin, "changed",
+ G_CALLBACK (remote_page_modified), source_dialog);
+ g_signal_connect_after (page, "prepare",
+ G_CALLBACK (remote_page_prepare), source_dialog);
+
+ /* Finish page */
+ page = glade_xml_get_widget (source_dialog->gui_xml, "finish-page");
+ g_signal_connect_swapped (page, "finish",
+ G_CALLBACK (new_calendar_finish), source_dialog);
+ g_signal_connect_after (page, "back",
+ G_CALLBACK (finish_page_back), source_dialog);
+ g_signal_connect_swapped (source_dialog->druid, "cancel",
+ G_CALLBACK (new_calendar_cancel), source_dialog);
+ g_object_weak_ref (G_OBJECT (source_dialog->window),
+ (GWeakNotify) source_dialog_destroy, source_dialog);
+
+ /* Prepare and show dialog */
+ source_to_dialog (source_dialog);
+
+ gtk_window_set_type_hint (GTK_WINDOW (source_dialog->window), GDK_WINDOW_TYPE_HINT_DIALOG);
+ gtk_window_set_modal (GTK_WINDOW (source_dialog->window), TRUE);
+
+ gtk_widget_show_all (source_dialog->window);
+
+ return TRUE;
+}
+
+static void
+edit_calendar_finish (SourceDialog *source_dialog)
+{
+ dialog_to_source (source_dialog);
+ gtk_widget_destroy (source_dialog->window);
+}
+
+static void
+edit_calendar_cancel (SourceDialog *source_dialog)
+{
+ gtk_widget_destroy (source_dialog->window);
+}
+
+gboolean
+calendar_config_edit_calendar (GtkWindow *parent, ESource *source)
+{
+ SourceDialog *source_dialog = g_new0 (SourceDialog, 1);
+
+ g_return_val_if_fail (source != NULL, FALSE);
+
+ source_dialog->gui_xml = glade_xml_new (EVOLUTION_GLADEDIR "/" GLADE_FILE_NAME, "calendar-editor-window", NULL);
+ if (!source_dialog->gui_xml) {
+ g_warning (G_STRLOC ": Cannot load Glade file.");
+ g_free (source_dialog);
+ return FALSE;
+ }
+
+ source_dialog->source = source;
+ g_object_ref (source);
+
+ source_dialog->window = glade_xml_get_widget (source_dialog->gui_xml, "calendar-editor-window");
+
+ /* General page */
+ source_dialog->name_entry = glade_xml_get_widget (source_dialog->gui_xml, "name-entry");
+ g_signal_connect_swapped (source_dialog->name_entry, "changed",
+ G_CALLBACK (general_page_modified), source_dialog);
+
+ /* Remote page */
+ source_dialog->uri_entry = glade_xml_get_widget (source_dialog->gui_xml, "uri-entry");
+ source_dialog->refresh_spin = glade_xml_get_widget (source_dialog->gui_xml, "refresh-spin");
+ g_signal_connect_swapped (source_dialog->uri_entry, "changed",
+ G_CALLBACK (remote_page_modified), source_dialog);
+ g_signal_connect_swapped (source_dialog->refresh_spin, "changed",
+ G_CALLBACK (remote_page_modified), source_dialog);
+
+ /* Finishing */
+ g_signal_connect_swapped (glade_xml_get_widget (source_dialog->gui_xml, "ok-button"), "clicked",
+ G_CALLBACK (edit_calendar_finish), source_dialog);
+ g_signal_connect_swapped (glade_xml_get_widget (source_dialog->gui_xml, "cancel-button"), "clicked",
+ G_CALLBACK (edit_calendar_cancel), source_dialog);
+ g_object_weak_ref (G_OBJECT (source_dialog->window),
+ (GWeakNotify) source_dialog_destroy, source_dialog);
+
+ /* Prepare and show dialog */
+ source_to_dialog (source_dialog);
+
+ gtk_window_set_type_hint (GTK_WINDOW (source_dialog->window), GDK_WINDOW_TYPE_HINT_DIALOG);
+ gtk_window_set_modal (GTK_WINDOW (source_dialog->window), TRUE);
+
+ gtk_widget_show_all (source_dialog->window);
+
+ if (!source_is_remote (source_dialog->source))
+ gtk_widget_hide (glade_xml_get_widget (source_dialog->gui_xml, "remote-page"));
+
+ return TRUE;
+}
diff --git a/calendar/gui/dialogs/calendar-config.glade b/calendar/gui/dialogs/calendar-config.glade
new file mode 100644
index 0000000000..6428d63429
--- /dev/null
+++ b/calendar/gui/dialogs/calendar-config.glade
@@ -0,0 +1,901 @@
+<?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="GtkWindow" id="calendar-editor-window">
+ <property name="title" translatable="yes">Calendar Properties</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox37">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkNotebook" id="account-editor-notebook">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="show_tabs">True</property>
+ <property name="show_border">True</property>
+ <property name="tab_pos">GTK_POS_TOP</property>
+ <property name="scrollable">False</property>
+ <property name="enable_popup">False</property>
+
+ <child>
+ <widget class="GtkVBox" id="general-page">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox100">
+ <property name="border_width">3</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">4</property>
+
+ <child>
+ <widget class="GtkLabel" id="label431">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Display name:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment45">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0.9</property>
+ <property name="yscale">1</property>
+
+ <child>
+ <widget class="GtkEntry" id="name-entry">
+ <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>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="account-editor-general-ldap-vbox">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label331">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">General</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="remote-page">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">4</property>
+ <property name="column_spacing">4</property>
+
+ <child>
+ <widget class="GtkLabel" id="label557">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Source URL:</property>
+ <property name="use_underline">True</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>
+ <property name="mnemonic_widget">uri-entry</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="uri-entry">
+ <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">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label558">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Refresh Interval:</property>
+ <property name="use_underline">True</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">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox121">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">4</property>
+
+ <child>
+ <widget class="GtkSpinButton" id="refresh-spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">30 1 9999 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label559">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">minute(s)</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.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </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_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label556">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Remote</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.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHSeparator" id="hseparator10">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox120">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkHButtonBox" id="hbuttonbox20">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkButton" id="cancel-button">
+ <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>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="ok-button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</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>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+<widget class="GtkWindow" id="calendar-druid-window">
+ <property name="title" translatable="yes">New Calendar</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+
+ <child>
+ <widget class="GnomeDruid" id="druid">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="show_help">False</property>
+
+ <child>
+ <widget class="GnomeDruidPageEdge" id="druidpagestart1">
+ <property name="visible">True</property>
+ <property name="position">GNOME_EDGE_START</property>
+ <property name="title" translatable="yes">Calendar Creation Assistant</property>
+ <property name="text" translatable="yes">This assistant will help you create a new calendar.
+
+Depending on the type of calendar you create, additional
+parameters may be required. Please contact your system
+administrator if you need help finding this information.</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GnomeDruidPageStandard" id="general-page">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Step 1: Folder Characteristics</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="druid-vbox6">
+ <property name="border_width">16</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox21">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label198">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Specifying a display name and group is the first step in setting up a calendar.</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">7.45058e-09</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">3</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHSeparator" id="hseparator5">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table15">
+ <property name="border_width">3</property>
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">3</property>
+
+ <child>
+ <widget class="GtkEntry" id="name-entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_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">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label199">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Display name:</property>
+ <property name="use_underline">True</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>
+ <property name="mnemonic_widget">name-entry</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label555">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">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">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkOptionMenu" id="group-optionmenu">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="history">-1</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkNotebook" id="notebook15">
+ <property name="visible">True</property>
+ <property name="show_tabs">False</property>
+ <property name="show_border">False</property>
+ <property name="tab_pos">GTK_POS_TOP</property>
+ <property name="scrollable">False</property>
+ <property name="enable_popup">False</property>
+
+ <child>
+ <widget class="GtkLabel" id="label207">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">This is the name that will appear in your Evolution folder list. It is for display purposes only. </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="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label208">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">label163</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label215">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Selecting this option will let you change Evolution's default settings for LDAP
+searches, and for creating and editing contacts. </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.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label210">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">label164</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">GTK_PACK_END</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>
+ </child>
+
+ <child>
+ <widget class="GnomeDruidPageStandard" id="remote-page">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Step 2: Remote Folder Parameters</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="druid-vbox10">
+ <property name="border_width">16</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox74">
+ <property name="border_width">16</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox75">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label560">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">You're creating a folder in a group that's stored in a remote location. This requires you
+to specify additional parameters.</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">7.45058e-09</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">3</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHSeparator" id="hseparator12">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table37">
+ <property name="border_width">3</property>
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">3</property>
+
+ <child>
+ <widget class="GtkEntry" id="uri-entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_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">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label561">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Source URL:</property>
+ <property name="use_underline">True</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>
+ <property name="mnemonic_widget">uri-entry</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label567">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Refresh Interval:</property>
+ <property name="use_underline">True</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">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox122">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">4</property>
+
+ <child>
+ <widget class="GtkSpinButton" id="refresh-spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">30 1 9999 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label568">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">minute(s)</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="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </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_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</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>
+ </child>
+
+ <child>
+ <widget class="GnomeDruidPageEdge" id="finish-page">
+ <property name="visible">True</property>
+ <property name="position">GNOME_EDGE_FINISH</property>
+ <property name="title" translatable="yes">Finished</property>
+ <property name="text" translatable="yes">Congratulations, you are finished setting up this calendar.
+
+Please click the &quot;Finish&quot; button to save the settings you have entered here.</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
diff --git a/calendar/gui/dialogs/new-calendar.h b/calendar/gui/dialogs/calendar-config.h
index 86c819796e..977c502474 100644
--- a/calendar/gui/dialogs/new-calendar.h
+++ b/calendar/gui/dialogs/calendar-config.h
@@ -1,8 +1,8 @@
-/* Evolution calendar - New calendar dialog
+/* Evolution calendar - Calendar properties dialogs.
*
- * Copyright (C) 2003 Novell, Inc.
+ * Copyright (C) 2004 Novell, Inc.
*
- * Author: Rodrigo Moya <rodrigo@ximian.com>
+ * Author: Hans Petter Jansson <hpj@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
@@ -18,11 +18,12 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifndef NEW_CALENDAR_H
-#define NEW_CALENDAR_H
+#ifndef CALENDAR_CONFIG_H
+#define CALENDAR_CONFIG_H
#include <gtk/gtkwindow.h>
-gboolean new_calendar_dialog (GtkWindow *parent);
+gboolean calendar_config_new_calendar (GtkWindow *parent);
+gboolean calendar_config_edit_calendar (GtkWindow *parent, ESource *source);
#endif
diff --git a/calendar/gui/dialogs/new-calendar.c b/calendar/gui/dialogs/new-calendar.c
deleted file mode 100644
index 5cbbd99516..0000000000
--- a/calendar/gui/dialogs/new-calendar.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/* Evolution calendar - New calendar dialog
- *
- * Copyright (C) 2003 Novell, Inc.
- *
- * Author: Rodrigo Moya <rodrigo@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 <string.h>
-#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 <libedataserver/e-source-list.h>
-#include <e-util/e-dialog-utils.h>
-#include <e-util/e-url.h>
-#include "new-calendar.h"
-
-static gchar *
-print_uri_noproto (EUri *uri)
-{
- gchar *uri_noproto;
-
- if (uri->port != 0)
- uri_noproto = g_strdup_printf (
- "%s%s%s%s%s%s%s:%d%s%s%s",
- uri->user ? uri->user : "",
- uri->authmech ? ";auth=" : "",
- uri->authmech ? uri->authmech : "",
- uri->passwd ? ":" : "",
- uri->passwd ? uri->passwd : "",
- uri->user ? "@" : "",
- uri->host ? uri->host : "",
- uri->port,
- uri->path ? uri->path : "",
- uri->query ? "?" : "",
- uri->query ? uri->query : "");
- else
- uri_noproto = g_strdup_printf (
- "%s%s%s%s%s%s%s%s%s%s",
- uri->user ? uri->user : "",
- uri->authmech ? ";auth=" : "",
- uri->authmech ? uri->authmech : "",
- uri->passwd ? ":" : "",
- uri->passwd ? uri->passwd : "",
- uri->user ? "@" : "",
- uri->host ? uri->host : "",
- uri->path ? uri->path : "",
- uri->query ? "?" : "",
- uri->query ? uri->query : "");
-
- return uri_noproto;
-}
-
-static gboolean
-group_is_remote (ESourceGroup *group)
-{
- EUri *uri;
- gboolean is_remote = FALSE;
-
- uri = e_uri_new (e_source_group_peek_base_uri (group));
- if (!uri)
- return FALSE;
-
- if (uri->protocol && strcmp (uri->protocol, "file"))
- is_remote = TRUE;
-
- e_uri_free (uri);
- return is_remote;
-}
-
-static gboolean
-create_new_source_with_group (GtkWindow *parent,
- ESourceGroup *group,
- const char *source_name,
- const char *source_location)
-{
- ESource *source;
-
- 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;
- }
-
- if (group_is_remote (group)) {
- EUri *uri;
- gchar *relative_uri;
- char *cache_dir;
-
- /* Remote source */
-
- if (!source_location || !strlen (source_location)) {
- e_notice (parent, GTK_MESSAGE_ERROR,
- _("The group '%s' is remote. You must specify a location "
- "to get the calendar from"),
- e_source_group_peek_name (group));
- return FALSE;
- }
-
- uri = e_uri_new (source_location);
- if (!uri) {
- e_notice (parent, GTK_MESSAGE_ERROR,
- _("The source location '%s' is not well-formed."),
- source_location);
- return FALSE;
- }
-
- /* Make sure we're in agreement with the protocol. Note that EUri sets it
- * to 'file' if none was specified in the input URI. We don't want to
- * silently translate an explicit file:// into http:// though. */
- if (uri->protocol &&
- strcmp (uri->protocol, "http") &&
- strcmp (uri->protocol, "webcal")) {
- e_uri_free (uri);
- e_notice (parent, GTK_MESSAGE_ERROR,
- _("The source location '%s' is not a webcal source."),
- source_location);
- return FALSE;
- }
-
- /* Our relative_uri is everything but protocol, which is supplied by parent group */
- relative_uri = print_uri_noproto (uri);
- e_uri_free (uri);
-
- /* Set up cache dir */
- cache_dir = g_build_filename (g_get_home_dir (),
- "/.evolution/calendar/webcal/",
- source_name, NULL);
- if (e_mkdir_hier (cache_dir, 0700)) {
- g_free (relative_uri);
- g_free (cache_dir);
- e_notice (parent, GTK_MESSAGE_ERROR,
- _("Could not create cache for new calendar"));
- return FALSE;
- }
-
- /* Create source */
- source = e_source_new (source_name, relative_uri);
-
- g_free (relative_uri);
- g_free (cache_dir);
- } else {
- char *new_dir;
-
- /* Local 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);
- g_free (new_dir);
- }
-
- e_source_group_add_source (group, source, -1);
- 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, *cal_location;
- 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 (G_STRLOC ": 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");
- cal_location = glade_xml_get_widget (xml, "calendar-location");
-
- /* 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) {
- const char *name;
- const char *location;
-
- name = gtk_entry_get_text (GTK_ENTRY (cal_name));
- location = gtk_entry_get_text (GTK_ENTRY (cal_location));
- 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,
- location))
- 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);
- g_object_unref (xml);
-
- return result;
-}