aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/ChangeLog15
-rw-r--r--shell/GNOME_Evolution_Shell.oaf.in89
-rw-r--r--shell/Makefile.am4
-rw-r--r--shell/e-shell-config-default-folders.c191
-rw-r--r--shell/e-shell-config-default-folders.h33
-rw-r--r--shell/e-shell-config-offline.c191
-rw-r--r--shell/e-shell-config-offline.h32
-rw-r--r--shell/e-shell-config.c169
-rw-r--r--shell/e-shell-config.h2
9 files changed, 533 insertions, 193 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index b5b6589d38..0d8ee5a331 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,18 @@
+2002-05-13 Ettore Perazzoli <ettore@ximian.com>
+
+ * e-shell-config.c: Handle the e-shell-config-offline and
+ e-shell-config-default-folders pages.
+
+ * e-shell-config-offline.h: New.
+ * e-shell-config-offline.c: New.
+
+ * e-shell-config-default-folders.h: New.
+ * e-shell-config-default-folders.c: New. Moved default folder
+ page configuration in from e-shell-config.c.
+
+ * GNOME_Evolution_Shell.oaf.in: Add
+ GNOME_Evolution_Shell_Config_OfflineFolders_Control.
+
2002-05-13 Christopher James Lahey <clahey@ximian.com>
* e-storage-set-view.c (etree_set_value_at): Added a signal when
diff --git a/shell/GNOME_Evolution_Shell.oaf.in b/shell/GNOME_Evolution_Shell.oaf.in
index 65e5892d9b..e1da511b32 100644
--- a/shell/GNOME_Evolution_Shell.oaf.in
+++ b/shell/GNOME_Evolution_Shell.oaf.in
@@ -1,51 +1,78 @@
<oaf_info>
-<oaf_server iid="OAFIID:GNOME_Evolution_Shell"
- type="exe"
- location="evolution">
+ <oaf_server iid="OAFIID:GNOME_Evolution_Shell"
+ type="exe"
+ location="evolution">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution/Shell:1.0"/>
- </oaf_attribute>
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME/Evolution/Shell:1.0"/>
+ </oaf_attribute>
- <oaf_attribute name="description" type="string"
- _value="The Evolution shell."/>
-</oaf_server>
+ <oaf_attribute name="description" type="string"
+ _value="The Evolution shell."/>
+ </oaf_server>
-<oaf_server iid="OAFIID:GNOME_Evolution_Shell_Config_Factory"
- type="exe"
- location="evolution-exchange-storage">
+ <oaf_server iid="OAFIID:GNOME_Evolution_Shell_Config_Factory"
+ type="exe"
+ location="evolution-exchange-storage">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/GenericFactory:1.0"/>
- </oaf_attribute>
-</oaf_server>
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME/GenericFactory:1.0"/>
+ </oaf_attribute>
+ </oaf_server>
-<oaf_server iid="OAFIID:GNOME_Evolution_Shell_Config_DefaultFolders_Control"
- type="factory"
- location="OAFIID:GNOME_Evolution_Shell_Config_Factory">
+ <oaf_server iid="OAFIID:GNOME_Evolution_Shell_Config_DefaultFolders_Control"
+ type="factory"
+ location="OAFIID:GNOME_Evolution_Shell_Config_Factory">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution/ConfigControl:1.0"/>
- </oaf_attribute>
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME/Evolution/ConfigControl:1.0"/>
+ </oaf_attribute>
- <oaf_attribute name="evolution:config_item:title" type="string"
+ <oaf_attribute name="evolution:config_item:title" type="string"
_value="Default Folders"/>
- <oaf_attribute name="evolution:config_item:description" type="string"
+ <oaf_attribute name="evolution:config_item:description" type="string"
_value="This page can be used to configure default folders"/>
- <oaf_attribute name="evolution:config_item:icon_name" type="string"
+ <oaf_attribute name="evolution:config_item:icon_name" type="string"
value="folder-settings.png"/>
- <oaf_attribute name="evolution:config_item:priority" type="string" value="-9"/>
+ <oaf_attribute name="evolution:config_item:priority" type="string" value="-9"/>
- <oaf_attribute name="evolution:config_item:type" type="stringv">
- <item value="shell"/>
- </oaf_attribute>
+ <oaf_attribute name="evolution:config_item:type" type="stringv">
+ <item value="shell"/>
+ </oaf_attribute>
- <oaf_attribute name="description" type="string"
+ <oaf_attribute name="description" type="string"
_value="Configuration control for Evolution default folders."/>
-</oaf_server>
+ </oaf_server>
+
+ <oaf_server iid="OAFIID:GNOME_Evolution_Shell_Config_OfflineFolders_Control"
+ type="factory"
+ location="OAFIID:GNOME_Evolution_Shell_Config_Factory">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME/Evolution/ConfigControl:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="evolution:config_item:title" type="string"
+ _value="Offline Folders"/>
+
+ <oaf_attribute name="evolution:config_item:description" type="string"
+ _value="This page can be used to configure synchronization of folders for offline usage"/>
+
+ <oaf_attribute name="evolution:config_item:icon_name" type="string"
+ value="folder-settings.png"/>
+
+ <oaf_attribute name="evolution:config_item:priority" type="string" value="-9"/>
+
+ <oaf_attribute name="evolution:config_item:type" type="stringv">
+ <item value="shell"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ _value="Configuration control for Evolution's offline folders."/>
+ </oaf_server>
</oaf_info>
diff --git a/shell/Makefile.am b/shell/Makefile.am
index c86fff6633..90f6707c3c 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -152,6 +152,10 @@ evolution_SOURCES = \
e-shell-about-box.h \
e-shell-config.c \
e-shell-config.h \
+ e-shell-config-offline.c \
+ e-shell-config-offline.h \
+ e-shell-config-default-folders.c \
+ e-shell-config-default-folders.h \
e-shell-constants.h \
e-shell-folder-commands.c \
e-shell-folder-commands.h \
diff --git a/shell/e-shell-config-default-folders.c b/shell/e-shell-config-default-folders.c
new file mode 100644
index 0000000000..52a23837e3
--- /dev/null
+++ b/shell/e-shell-config-default-folders.c
@@ -0,0 +1,191 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-shell-config-default-folders.c - Configuration page for specifying default
+ * folders.
+ *
+ * Copyright (C) 2002 Ximian, Inc.
+ *
+ * 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.
+ *
+ * Author: Dan Winship <danw@ximian.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "e-shell-config-default-folders.h"
+
+#include "evolution-config-control.h"
+#include "evolution-folder-selector-button.h"
+
+#include <glade/glade-xml.h>
+#include <gtk/gtktogglebutton.h>
+#include <gtk/gtksignal.h>
+
+#include <libgnome/gnome-i18n.h>
+
+
+typedef struct {
+ GladeXML *glade;
+ EvolutionConfigControl *config_control;
+
+ char *mail_uri, *mail_path;
+ char *contacts_uri, *contacts_path;
+ char *calendar_uri, *calendar_path;
+ char *tasks_uri, *tasks_path;
+
+ Bonobo_ConfigDatabase db;
+ EvolutionShellClient *shell_client;
+} EvolutionDefaultFolderConfig;
+
+static void
+folder_selected (EvolutionFolderSelectorButton *button,
+ GNOME_Evolution_Folder *folder,
+ EvolutionDefaultFolderConfig *dfc)
+{
+ char **uri_ptr, **path_ptr;
+
+ uri_ptr = gtk_object_get_data (GTK_OBJECT (button), "uri_ptr");
+ path_ptr = gtk_object_get_data (GTK_OBJECT (button), "path_ptr");
+
+ g_free (*uri_ptr);
+ g_free (*path_ptr);
+ *uri_ptr = g_strdup (folder->physicalUri);
+ *path_ptr = g_strdup (folder->evolutionUri);
+
+ evolution_config_control_changed (dfc->config_control);
+}
+
+GtkWidget *e_shell_config_default_folder_selector_button_new (char *widget_name, char *string1, char *string2, int int1, int int2);
+
+GtkWidget *
+e_shell_config_default_folder_selector_button_new (char *widget_name,
+ char *string1,
+ char *string2,
+ int int1, int int2)
+{
+ return (GtkWidget *)gtk_type_new (EVOLUTION_TYPE_FOLDER_SELECTOR_BUTTON);
+}
+
+static void
+config_control_apply_cb (EvolutionConfigControl *control,
+ EvolutionDefaultFolderConfig *dfc)
+{
+ bonobo_config_set_string (dfc->db, "/DefaultFolders/mail_path", dfc->mail_path, NULL);
+ bonobo_config_set_string (dfc->db, "/DefaultFolders/mail_uri", dfc->mail_uri, NULL);
+ bonobo_config_set_string (dfc->db, "/DefaultFolders/contacts_path", dfc->contacts_path, NULL);
+ bonobo_config_set_string (dfc->db, "/DefaultFolders/contacts_uri", dfc->contacts_uri, NULL);
+ bonobo_config_set_string (dfc->db, "/DefaultFolders/calendar_path", dfc->calendar_path, NULL);
+ bonobo_config_set_string (dfc->db, "/DefaultFolders/calendar_uri", dfc->calendar_uri, NULL);
+ bonobo_config_set_string (dfc->db, "/DefaultFolders/tasks_path", dfc->tasks_path, NULL);
+ bonobo_config_set_string (dfc->db, "/DefaultFolders/tasks_uri", dfc->tasks_uri, NULL);
+}
+
+static void
+config_control_destroy_cb (EvolutionConfigControl *config_control,
+ EvolutionDefaultFolderConfig *dfc)
+{
+ g_free (dfc->mail_uri);
+ g_free (dfc->mail_path);
+ g_free (dfc->contacts_uri);
+ g_free (dfc->contacts_path);
+ g_free (dfc->calendar_uri);
+ g_free (dfc->calendar_path);
+ g_free (dfc->tasks_uri);
+ g_free (dfc->tasks_path);
+
+ gtk_object_unref (GTK_OBJECT (dfc->glade));
+ bonobo_object_unref (BONOBO_OBJECT (dfc->shell_client));
+ g_free (dfc);
+}
+
+static const char *mail_types[] = { "mail", NULL };
+static const char *contacts_types[] = { "contacts", "ldap-contacts", NULL };
+static const char *calendar_types[] = { "calendar", NULL };
+static const char *tasks_types[] = { "tasks", NULL };
+
+static void
+setup_folder_selector (EvolutionDefaultFolderConfig *dfc,
+ const char *widget_name,
+ char **path_ptr, char *path_dbpath,
+ char **uri_ptr, char *uri_dbpath,
+ const char **types)
+{
+ GtkWidget *button;
+
+ *path_ptr = bonobo_config_get_string (dfc->db, path_dbpath, NULL);
+ *uri_ptr = bonobo_config_get_string (dfc->db, uri_dbpath, NULL);
+
+ button = glade_xml_get_widget (dfc->glade, widget_name);
+ evolution_folder_selector_button_construct (
+ EVOLUTION_FOLDER_SELECTOR_BUTTON (button),
+ dfc->shell_client, _("Select Default Folder"),
+ *uri_ptr, types);
+ gtk_object_set_data (GTK_OBJECT (button), "uri_ptr", uri_ptr);
+ gtk_object_set_data (GTK_OBJECT (button), "path_ptr", path_ptr);
+ gtk_signal_connect (GTK_OBJECT (button), "selected",
+ GTK_SIGNAL_FUNC (folder_selected),
+ dfc);
+}
+
+BonoboObject *
+e_shell_config_default_folders_create_control (EShell *shell)
+{
+ GNOME_Evolution_Shell shell_dup;
+ CORBA_Environment ev;
+ EvolutionDefaultFolderConfig *dfc;
+ GtkWidget *widget;
+
+ dfc = g_new0 (EvolutionDefaultFolderConfig, 1);
+ dfc->db = e_shell_get_config_db (shell);
+
+ CORBA_exception_init (&ev);
+ shell_dup = CORBA_Object_duplicate (bonobo_object_corba_objref (BONOBO_OBJECT (shell)), &ev);
+ CORBA_exception_free (&ev);
+ dfc->shell_client = evolution_shell_client_new (shell_dup);
+
+ dfc->glade = glade_xml_new (EVOLUTION_GLADEDIR "/e-shell-config-default-folders.glade", NULL);
+
+ setup_folder_selector (dfc, "default_mail_button",
+ &dfc->mail_path, "/DefaultFolders/mail_path",
+ &dfc->mail_uri, "/DefaultFolders/mail_uri",
+ mail_types);
+ setup_folder_selector (dfc, "default_contacts_button",
+ &dfc->contacts_path, "/DefaultFolders/contacts_path",
+ &dfc->contacts_uri, "/DefaultFolders/contacts_uri",
+ contacts_types);
+ setup_folder_selector (dfc, "default_calendar_button",
+ &dfc->calendar_path, "/DefaultFolders/calendar_path",
+ &dfc->calendar_uri, "/DefaultFolders/calendar_uri",
+ calendar_types);
+ setup_folder_selector (dfc, "default_tasks_button",
+ &dfc->tasks_path, "/DefaultFolders/tasks_path",
+ &dfc->tasks_uri, "/DefaultFolders/tasks_uri",
+ tasks_types);
+
+ widget = glade_xml_get_widget (dfc->glade, "default_folders_vbox");
+ gtk_widget_ref (widget);
+ gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
+ gtk_widget_show (widget);
+ dfc->config_control = evolution_config_control_new (widget);
+ gtk_widget_unref (widget);
+
+ gtk_signal_connect (GTK_OBJECT (dfc->config_control), "apply",
+ GTK_SIGNAL_FUNC (config_control_apply_cb), dfc);
+ gtk_signal_connect (GTK_OBJECT (dfc->config_control), "destroy",
+ GTK_SIGNAL_FUNC (config_control_destroy_cb), dfc);
+
+ return BONOBO_OBJECT (dfc->config_control);
+}
diff --git a/shell/e-shell-config-default-folders.h b/shell/e-shell-config-default-folders.h
new file mode 100644
index 0000000000..57e39590c7
--- /dev/null
+++ b/shell/e-shell-config-default-folders.h
@@ -0,0 +1,33 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-shell-config-default-folders.h - Configuration page for specifying default
+ * folders.
+ *
+ * Copyright (C) 2002 Ximian, Inc.
+ *
+ * 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.
+ *
+ * Author: Dan Winship <danw@ximian.com>
+ */
+
+#ifndef E_SHELL_CONFIG_DEFAULT_FOLDERS_H
+#define E_SHELL_CONFIG_DEFAULT_FOLDERS_H
+
+#include "e-shell.h"
+
+#include <bonobo/bonobo-object.h>
+
+BonoboObject *e_shell_config_default_folders_create_control (EShell *shell);
+
+#endif /* E_SHELL_CONFIG_DEFAULT_FOLDERS_H */
diff --git a/shell/e-shell-config-offline.c b/shell/e-shell-config-offline.c
new file mode 100644
index 0000000000..c021bf5b1a
--- /dev/null
+++ b/shell/e-shell-config-offline.c
@@ -0,0 +1,191 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-shell-config-offline.c - Configuration page for offline synchronization.
+ *
+ * Copyright (C) 2002 Ximian, Inc.
+ *
+ * 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.
+ *
+ * Author: Ettore Perazzoli <ettore@ximian.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include "e-shell-config-offline.h"
+
+#include "evolution-config-control.h"
+#include "e-storage-set-view.h"
+
+#include "Evolution.h"
+
+#include <bonobo-conf/Bonobo_Config.h>
+#include <bonobo/bonobo-exception.h>
+
+#include <gal/widgets/e-scroll-frame.h>
+#include <gtk/gtkwidget.h>
+
+
+struct _PageData {
+ EShell *shell;
+ GtkWidget *storage_set_view;
+ EvolutionConfigControl *config_control;
+};
+typedef struct _PageData PageData;
+
+
+/* Callbacks. */
+
+static void
+config_control_destroy_callback (GtkObject *object,
+ void *data)
+{
+ PageData *page_data;
+
+ page_data = (PageData *) data;
+ gtk_widget_destroy (page_data->storage_set_view);
+ g_free (page_data);
+}
+
+static void
+config_control_apply_callback (EvolutionConfigControl *config_control,
+ void *data)
+{
+ CORBA_Environment ev;
+ CORBA_sequence_CORBA_string *paths;
+ CORBA_any any;
+ PageData *page_data;
+ GList *checked_paths;
+ GList *p;
+ int i;
+
+ page_data = (PageData *) data;
+
+ checked_paths = e_storage_set_view_get_checkboxes_list (E_STORAGE_SET_VIEW (page_data->storage_set_view));
+
+ paths = CORBA_sequence_CORBA_string__alloc ();
+ paths->_maximum = paths->_length = g_list_length (checked_paths);
+ paths->_buffer = CORBA_sequence_CORBA_string_allocbuf (paths->_maximum);
+
+ for (p = checked_paths, i = 0; p != NULL; p = p->next, i ++)
+ paths->_buffer[i] = CORBA_string_dup ((const char *) p->data);
+
+ any._type = TC_CORBA_sequence_CORBA_string;
+ any._value = paths;
+
+ CORBA_exception_init (&ev);
+
+ Bonobo_ConfigDatabase_setValue (e_shell_get_config_db (page_data->shell),
+ "/OfflineFolders/paths", &any, &ev);
+ if (BONOBO_EX (&ev))
+ g_warning ("Cannot set /OfflineFolders/paths from ConfigDatabase -- %s", BONOBO_EX_ID (&ev));
+
+ CORBA_exception_free (&ev);
+
+ g_list_free (checked_paths);
+}
+
+static void
+storage_set_view_checkboxes_changed_callback (EStorageSetView *storage_set_view,
+ void *data)
+{
+ PageData *page_data;
+
+ page_data = (PageData *) data;
+ evolution_config_control_changed (page_data->config_control);
+}
+
+
+/* Construction. */
+
+static void
+init_storage_set_view_status_from_config (EStorageSetView *storage_set_view,
+ EShell *shell)
+{
+ Bonobo_ConfigDatabase config_db;
+ CORBA_Environment ev;
+ CORBA_any *any;
+ CORBA_sequence_CORBA_string *sequence;
+ GList *list;
+ int i;
+
+ config_db = e_shell_get_config_db (shell);
+ g_assert (config_db != CORBA_OBJECT_NIL);
+
+ CORBA_exception_init (&ev);
+
+ any = Bonobo_ConfigDatabase_getValue (config_db, "/OfflineFolders/paths", "", &ev);
+ if (BONOBO_EX (&ev)) {
+ g_warning ("Cannot get /OfflineFolders/paths from ConfigDatabase -- %s", BONOBO_EX_ID (&ev));
+ CORBA_exception_free (&ev);
+ return;
+ }
+
+ if (! CORBA_TypeCode_equal (any->_type, TC_CORBA_sequence_CORBA_string, &ev) || BONOBO_EX (&ev)) {
+ g_warning ("/OfflineFolders/Paths in ConfigDatabase is not the expected type");
+ CORBA_exception_free (&ev);
+ return;
+ }
+
+ sequence = (CORBA_sequence_CORBA_string *) any->_value;
+
+ list = NULL;
+ for (i = 0; i < sequence->_length; i ++)
+ list = g_list_prepend (list, sequence->_buffer[i]);
+
+ e_storage_set_view_set_checkboxes_list (storage_set_view, list);
+
+ g_list_free (list);
+ CORBA_free (any);
+
+ CORBA_exception_free (&ev);
+}
+
+BonoboObject *
+e_shell_config_offline_create_control (EShell *shell)
+{
+ PageData *page_data;
+ GtkWidget *scroll_frame;
+
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
+
+ page_data = g_new (PageData, 1);
+ page_data->shell = shell;
+
+ page_data->storage_set_view = e_storage_set_new_view (e_shell_get_storage_set (shell), NULL);
+ e_storage_set_view_set_show_checkboxes (E_STORAGE_SET_VIEW (page_data->storage_set_view), TRUE);
+ gtk_widget_show (page_data->storage_set_view);
+
+ init_storage_set_view_status_from_config (E_STORAGE_SET_VIEW (page_data->storage_set_view), shell);
+ gtk_signal_connect (GTK_OBJECT (page_data->storage_set_view), "checkboxes_changed",
+ GTK_SIGNAL_FUNC (storage_set_view_checkboxes_changed_callback), page_data);
+
+ scroll_frame = e_scroll_frame_new (NULL, NULL);
+ e_scroll_frame_set_shadow_type (E_SCROLL_FRAME (scroll_frame), GTK_SHADOW_IN);
+ e_scroll_frame_set_policy (E_SCROLL_FRAME (scroll_frame),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_container_add (GTK_CONTAINER (scroll_frame), page_data->storage_set_view);
+ gtk_widget_show (scroll_frame);
+
+ page_data->config_control = evolution_config_control_new (scroll_frame);
+
+ gtk_signal_connect (GTK_OBJECT (page_data->config_control), "destroy",
+ GTK_SIGNAL_FUNC (config_control_destroy_callback), page_data);
+ gtk_signal_connect (GTK_OBJECT (page_data->config_control), "apply",
+ GTK_SIGNAL_FUNC (config_control_apply_callback), page_data);
+
+ return BONOBO_OBJECT (page_data->config_control);
+}
diff --git a/shell/e-shell-config-offline.h b/shell/e-shell-config-offline.h
new file mode 100644
index 0000000000..8b7b0af222
--- /dev/null
+++ b/shell/e-shell-config-offline.h
@@ -0,0 +1,32 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-shell-config-offline.h - Configuration page for offline synchronization.
+ *
+ * Copyright (C) 2002 Ximian, Inc.
+ *
+ * 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.
+ *
+ * Author: Ettore Perazzoli <ettore@ximian.com>
+ */
+
+#ifndef E_SHELL_CONFIG_OFFLINE_H
+#define E_SHELL_CONFIG_OFFLINE_H
+
+#include "e-shell.h"
+
+#include <bonobo/bonobo-object.h>
+
+BonoboObject *e_shell_config_offline_create_control (EShell *shell);
+
+#endif /* E_SHELL_CONFIG_OFFLINE_H */
diff --git a/shell/e-shell-config.c b/shell/e-shell-config.c
index 73103cd98d..77f4804594 100644
--- a/shell/e-shell-config.c
+++ b/shell/e-shell-config.c
@@ -23,171 +23,19 @@
#endif
#include "e-shell-config.h"
+
+#include "e-shell-config-default-folders.h"
+#include "e-shell-config-offline.h"
#include "evolution-config-control.h"
#include "evolution-folder-selector-button.h"
#include <bonobo/bonobo-generic-factory.h>
-#include <glade/glade-xml.h>
-#include <gtk/gtktogglebutton.h>
+
#define E_SHELL_CONFIG_FACTORY_OAFIID "OAFIID:GNOME_Evolution_Shell_Config_Factory"
-
#define E_SHELL_CONFIG_DEFAULT_FOLDERS_OAFIID "OAFIID:GNOME_Evolution_Shell_Config_DefaultFolders_Control"
-typedef struct {
- GladeXML *glade;
- EvolutionConfigControl *config_control;
-
- char *mail_uri, *mail_path;
- char *contacts_uri, *contacts_path;
- char *calendar_uri, *calendar_path;
- char *tasks_uri, *tasks_path;
-
- Bonobo_ConfigDatabase db;
- EvolutionShellClient *shell_client;
-} EvolutionDefaultFolderConfig;
-
-static void
-folder_selected (EvolutionFolderSelectorButton *button,
- GNOME_Evolution_Folder *folder,
- EvolutionDefaultFolderConfig *dfc)
-{
- char **uri_ptr, **path_ptr;
-
- uri_ptr = gtk_object_get_data (GTK_OBJECT (button), "uri_ptr");
- path_ptr = gtk_object_get_data (GTK_OBJECT (button), "path_ptr");
-
- g_free (*uri_ptr);
- g_free (*path_ptr);
- *uri_ptr = g_strdup (folder->physicalUri);
- *path_ptr = g_strdup (folder->evolutionUri);
-
- evolution_config_control_changed (dfc->config_control);
-}
-
-GtkWidget *e_shell_config_default_folder_selector_button_new (char *widget_name, char *string1, char *string2, int int1, int int2);
-
-GtkWidget *
-e_shell_config_default_folder_selector_button_new (char *widget_name,
- char *string1,
- char *string2,
- int int1, int int2)
-{
- return (GtkWidget *)gtk_type_new (EVOLUTION_TYPE_FOLDER_SELECTOR_BUTTON);
-}
-
-static void
-config_control_apply_cb (EvolutionConfigControl *control,
- EvolutionDefaultFolderConfig *dfc)
-{
- bonobo_config_set_string (dfc->db, "/DefaultFolders/mail_path", dfc->mail_path, NULL);
- bonobo_config_set_string (dfc->db, "/DefaultFolders/mail_uri", dfc->mail_uri, NULL);
- bonobo_config_set_string (dfc->db, "/DefaultFolders/contacts_path", dfc->contacts_path, NULL);
- bonobo_config_set_string (dfc->db, "/DefaultFolders/contacts_uri", dfc->contacts_uri, NULL);
- bonobo_config_set_string (dfc->db, "/DefaultFolders/calendar_path", dfc->calendar_path, NULL);
- bonobo_config_set_string (dfc->db, "/DefaultFolders/calendar_uri", dfc->calendar_uri, NULL);
- bonobo_config_set_string (dfc->db, "/DefaultFolders/tasks_path", dfc->tasks_path, NULL);
- bonobo_config_set_string (dfc->db, "/DefaultFolders/tasks_uri", dfc->tasks_uri, NULL);
-}
-
-static void
-config_control_destroy_cb (EvolutionConfigControl *config_control,
- EvolutionDefaultFolderConfig *dfc)
-{
- g_free (dfc->mail_uri);
- g_free (dfc->mail_path);
- g_free (dfc->contacts_uri);
- g_free (dfc->contacts_path);
- g_free (dfc->calendar_uri);
- g_free (dfc->calendar_path);
- g_free (dfc->tasks_uri);
- g_free (dfc->tasks_path);
-
- gtk_object_unref (GTK_OBJECT (dfc->glade));
- bonobo_object_unref (BONOBO_OBJECT (dfc->shell_client));
- g_free (dfc);
-}
-
-static const char *mail_types[] = { "mail", NULL };
-static const char *contacts_types[] = { "contacts", "ldap-contacts", NULL };
-static const char *calendar_types[] = { "calendar", NULL };
-static const char *tasks_types[] = { "tasks", NULL };
-
-static void
-setup_folder_selector (EvolutionDefaultFolderConfig *dfc,
- const char *widget_name,
- char **path_ptr, char *path_dbpath,
- char **uri_ptr, char *uri_dbpath,
- const char **types)
-{
- GtkWidget *button;
-
- *path_ptr = bonobo_config_get_string (dfc->db, path_dbpath, NULL);
- *uri_ptr = bonobo_config_get_string (dfc->db, uri_dbpath, NULL);
-
- button = glade_xml_get_widget (dfc->glade, widget_name);
- evolution_folder_selector_button_construct (
- EVOLUTION_FOLDER_SELECTOR_BUTTON (button),
- dfc->shell_client, _("Select Default Folder"),
- *uri_ptr, types);
- gtk_object_set_data (GTK_OBJECT (button), "uri_ptr", uri_ptr);
- gtk_object_set_data (GTK_OBJECT (button), "path_ptr", path_ptr);
- gtk_signal_connect (GTK_OBJECT (button), "selected",
- GTK_SIGNAL_FUNC (folder_selected),
- dfc);
-}
-
-static BonoboObject *
-default_folders_config_control_new (EShell *shell)
-{
- GNOME_Evolution_Shell shell_dup;
- CORBA_Environment ev;
- EvolutionDefaultFolderConfig *dfc;
- GtkWidget *widget;
-
- dfc = g_new0 (EvolutionDefaultFolderConfig, 1);
- dfc->db = e_shell_get_config_db (shell);
-
- CORBA_exception_init (&ev);
- shell_dup = CORBA_Object_duplicate (bonobo_object_corba_objref (BONOBO_OBJECT (shell)), &ev);
- CORBA_exception_free (&ev);
- dfc->shell_client = evolution_shell_client_new (shell_dup);
-
- dfc->glade = glade_xml_new (EVOLUTION_GLADEDIR "/e-shell-config-default-folders.glade", NULL);
-
- setup_folder_selector (dfc, "default_mail_button",
- &dfc->mail_path, "/DefaultFolders/mail_path",
- &dfc->mail_uri, "/DefaultFolders/mail_uri",
- mail_types);
- setup_folder_selector (dfc, "default_contacts_button",
- &dfc->contacts_path, "/DefaultFolders/contacts_path",
- &dfc->contacts_uri, "/DefaultFolders/contacts_uri",
- contacts_types);
- setup_folder_selector (dfc, "default_calendar_button",
- &dfc->calendar_path, "/DefaultFolders/calendar_path",
- &dfc->calendar_uri, "/DefaultFolders/calendar_uri",
- calendar_types);
- setup_folder_selector (dfc, "default_tasks_button",
- &dfc->tasks_path, "/DefaultFolders/tasks_path",
- &dfc->tasks_uri, "/DefaultFolders/tasks_uri",
- tasks_types);
-
- widget = glade_xml_get_widget (dfc->glade, "default_folders_vbox");
- gtk_widget_ref (widget);
- gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
- gtk_widget_show (widget);
- dfc->config_control = evolution_config_control_new (widget);
- gtk_widget_unref (widget);
-
- gtk_signal_connect (GTK_OBJECT (dfc->config_control), "apply",
- GTK_SIGNAL_FUNC (config_control_apply_cb), dfc);
- gtk_signal_connect (GTK_OBJECT (dfc->config_control), "destroy",
- GTK_SIGNAL_FUNC (config_control_destroy_cb), dfc);
-
- return BONOBO_OBJECT (dfc->config_control);
-}
-
static BonoboObject *
config_control_factory_cb (BonoboGenericFactory *factory,
@@ -195,11 +43,9 @@ config_control_factory_cb (BonoboGenericFactory *factory,
gpointer shell)
{
if (!strcmp (component_id, E_SHELL_CONFIG_DEFAULT_FOLDERS_OAFIID))
- return default_folders_config_control_new (shell);
- else {
- g_assert_not_reached ();
- return NULL;
- }
+ return e_shell_config_default_folders_create_control (shell);
+ else
+ return e_shell_config_offline_create_control (shell);
}
gboolean
@@ -220,4 +66,3 @@ e_shell_config_factory_register (EShell *shell)
}
return TRUE;
}
-
diff --git a/shell/e-shell-config.h b/shell/e-shell-config.h
index e2f209c5c4..9ba17b78d7 100644
--- a/shell/e-shell-config.h
+++ b/shell/e-shell-config.h
@@ -23,6 +23,8 @@
#include "e-shell.h"
+#include <glib.h>
+
gboolean e_shell_config_factory_register (EShell *shell);
#endif