aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addressbook/ChangeLog115
-rw-r--r--addressbook/gui/component/Makefile.am4
-rw-r--r--addressbook/gui/component/addressbook-component.c32
-rw-r--r--addressbook/gui/component/addressbook-config.c1123
-rw-r--r--addressbook/gui/component/addressbook-config.h24
-rw-r--r--addressbook/gui/component/addressbook-storage.c737
-rw-r--r--addressbook/gui/component/addressbook-storage.h82
-rw-r--r--addressbook/gui/component/addressbook.c241
-rw-r--r--addressbook/gui/component/addressbook.h3
-rw-r--r--addressbook/gui/component/component-factory.c3
-rw-r--r--addressbook/gui/component/ldap-config.glade497
-rw-r--r--addressbook/gui/component/new-addressbook.c158
-rw-r--r--addressbook/gui/component/new-addressbook.h30
-rw-r--r--addressbook/gui/component/select-names/e-select-names-manager.c13
-rw-r--r--addressbook/gui/component/select-names/e-select-names.c14
15 files changed, 1003 insertions, 2073 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index b168e848b0..e8dd2bf4f2 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,118 @@
+2003-12-01 Hans Petter Jansson <hpj@ximian.com>
+
+ * gui/component/Makefile.am (libevolution_addressbook_la_SOURCES):
+ Remove addressbook-storage.[ch] and new-addressbook.[ch].
+
+ * gui/component/addressbook-storage.[ch]: Removed from repository.
+
+ * gui/component/new-addressbook.[ch]: Removed from repository.
+
+ * gui/component/addressbook-component.c (load_uri_for_selection):
+ Set source_uid property on view control, not folder_uri.
+ (new_addressbook_cb): Call addressbook_config_create_new_source ().
+ (edit_addressbook_cb): Implement.
+ (fill_popup_menu_callback): Hook up edit_addressbook_cb ().
+ (addressbook_component_init): Create the LDAP source group.
+
+ * gui/component/addressbook-config.c (AddressbookSourceDialog):
+ Take out the NEW_ADVANCED_UI stuff and add ESource related vars.
+ (ldap_unparse_auth)
+ (ldap_parse_auth)
+ (ldap_unparse_scope)
+ (ldap_unparse_ssl)
+ (ldap_parse_ssl): Moved here from addressbook-storage.c.
+ (addressbook_dialog_get_source)
+ (addressbook_dialog_set_source)
+ (objectclasses_create_server_table)
+ (objectclasses_create_evolution_table)
+ (objectclasses_add_foreach)
+ (objectclasses_add)
+ (objectclasses_sever_double_click)
+ (objectclasses_remove_foreach)
+ (objectclasses_remove)
+ (objectclasses_evolution_double_click)
+ (objectclasses_restore_default)
+ (server_selection_model_changed)
+ (evolution_selection_model_changed)
+ (setup_objectclasses_tab): Nuke aging, unfinished NEW_ADVANCED_UI.
+ (add_source_clicked)
+ (edit_source_clicked)
+ (delete_server)
+ (delete_source_clicked)
+ (ldap_config_control_destroy_callback)
+ (ldap_config_control_apply_callback)
+ (sources_selection_changed)
+ (sources_table_row_activated)
+ (ldap_dialog_new)
+ (addressbook_dialog_create_sources_table)
+ (ldap_config_control_new)
+ (addressbook_config_control_new): Nuke config control.
+ (create_source_dir)
+ (dialog_to_source)
+ (dialog_to_temp_source)
+ (source_to_uri_parts)
+ (source_to_dialog)
+ (source_group_changed_cb)
+ (source_group_menu_add_groups)
+ (folder_page_forward)
+ (finish_page_back): Implement.
+ (addressbook_ldap_init): Take ESource instead of AddressbookSource.
+ (addressbook_ldap_auth): Don't take a source, not needed.
+ (addressbook_root_dse_query): Ditto.
+ (addressbook_source_dialog_destroy): Clean up destroy function.
+ (addressbook_add_server_druid_finish): Clean up, create ESource.
+ (general_tab_check): If it's not LDAP, these options don't matter.
+ (do_ldap_root_dse_query): Source no longer needed here.
+ (query_for_supported_bases): Use a temp source generated from
+ current dialog settings.
+ (display_name_page_prepare): Renamed to folder_page_prepare ().
+ (druid_display_name_page_modify_cb): Renamed to
+ druid_folder_page_modify_cb ().
+ (addressbook_add_server_druid): Set up source list, group selector.
+ Make LDAP pages optional, dependent on selected group. Use ESource.
+ (edit_dialog_store_change): Remove config control list stuff,
+ export settings to ESource.
+ (addressbook_edit_server_dialog): Renamed to
+ addressbook_config_edit_source (), which takes an ESource. Remove
+ config control list stuff, make LDAP pages show up only if we have
+ an LDAP source. Remove NEW_ADVANCED_UI cruft.
+ (addressbook_config_create_new_source): Just call
+ addressbook_add_server_druid ().
+
+ * gui/component/addressbook-config.h: Move LDAP enums here, from
+ addressbook-storage.h.
+
+ * gui/component/addressbook.c (control_activate_cb): uri -> source
+ (addressbook_view_clear): Unref source list.
+ (book_open_cb): Use ESource.
+ (load_uri_auth_cb): Renamed to load_source_auth_cb (), manipulate
+ ESource instead of URI.
+ (get_remember_password): Implement.
+ (set_remember_password): Implement.
+ (addressbook_authenticate): Use ESource properties.
+ (load_uri_cb): Renamed to load_source_cb (), ESource adaptation.
+ (addressbook_load_uri): Renamed to addressbook_load_source (), takes
+ ESource.
+ (addressbook_load_default_book): ESource adaptation.
+ (get_prop): folder_uri property -> source_uid property.
+ (set_prop): folder_uri property -> source_uid property. Find ESource
+ by UID.
+ (addressbook_new_control): Set up source_uid property and ESourceList.
+
+ * gui/component/component-factory.c (factory): Disable config control.
+
+ * gui/component/ldap-config.glade: Druid and notebook dialogs
+ generalized to deal with local sources as well as LDAP. This file
+ should probably be renamed...
+
+ * gui/component/select-names/e-select-names-manager.c
+ (load_completion_books): Use addressbook_load_source (). However, this
+ needs a bit more work to get source UIDs instead of URIs.
+
+ * gui/component/select-names/e-select-names.c
+ (addressbook_model_set_uri): Use addressbook_load_source (). However,
+ this needs a bit more work to get source UIDs instead of URIs.
+
2003-11-26 JP Rosevear <jpr@ximian.com>
* gui/widgets/Makefile.am: turn on deprecated gtk and libgnomeui
diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am
index e004146d5a..ff21bb08d1 100644
--- a/addressbook/gui/component/Makefile.am
+++ b/addressbook/gui/component/Makefile.am
@@ -33,12 +33,8 @@ libevolution_addressbook_la_SOURCES = \
addressbook-component.h \
addressbook-config.c \
addressbook-config.h \
- addressbook-storage.c \
- addressbook-storage.h \
addressbook.c \
addressbook.h \
- new-addressbook.c \
- new-addressbook.h \
component-factory.c
# $(top_builddir)/addressbook/printing/libecontactprint.la
diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c
index 97de5eeda4..046b1f5a00 100644
--- a/addressbook/gui/component/addressbook-component.c
+++ b/addressbook/gui/component/addressbook-component.c
@@ -28,7 +28,7 @@
#include "addressbook-component.h"
#include "addressbook.h"
-#include "new-addressbook.h"
+#include "addressbook-config.h"
#include "widgets/misc/e-source-selector.h"
#include "addressbook/gui/widgets/eab-gui-util.h"
@@ -64,9 +64,8 @@ load_uri_for_selection (ESourceSelector *selector,
ESource *selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (selector));
if (selected_source != NULL) {
- char *uri = e_source_get_uri (selected_source);
- bonobo_control_set_property (view_control, NULL, "folder_uri", TC_CORBA_string, uri, NULL);
- g_free (uri);
+ bonobo_control_set_property (view_control, NULL, "source_uid", TC_CORBA_string,
+ e_source_peek_uid (selected_source), NULL);
}
}
@@ -100,9 +99,25 @@ add_popup_menu_item (GtkMenu *menu, const char *label, const char *pixmap,
/* Folder popup menu callbacks */
static void
-new_addressbook_cb (GtkWidget *widget, ESourceSelector *selector)
+new_addressbook_cb (GtkWidget *widget, AddressbookComponent *comp)
{
- new_addressbook_dialog (GTK_WINDOW (gtk_widget_get_toplevel (widget)));
+ addressbook_config_create_new_source (gtk_widget_get_toplevel (widget));
+}
+
+static void
+edit_addressbook_cb (GtkWidget *widget, AddressbookComponent *comp)
+{
+ AddressbookComponentPrivate *priv;
+ ESource *selected_source;
+
+ priv = comp->priv;
+
+ selected_source =
+ e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->source_selector));
+ if (!selected_source)
+ return;
+
+ addressbook_config_edit_source (gtk_widget_get_toplevel (widget), selected_source);
}
static void
@@ -123,6 +138,7 @@ static void
fill_popup_menu_callback (ESourceSelector *selector, GtkMenu *menu, AddressbookComponent *comp)
{
add_popup_menu_item (menu, _("New Addressbook"), NULL, G_CALLBACK (new_addressbook_cb), comp);
+ add_popup_menu_item (menu, _("Properties..."), NULL, G_CALLBACK (edit_addressbook_cb), comp);
add_popup_menu_item (menu, _("Delete"), GTK_STOCK_DELETE, G_CALLBACK (delete_addressbook_cb), comp);
add_popup_menu_item (menu, _("Rename"), NULL, NULL, NULL);
}
@@ -356,6 +372,10 @@ addressbook_component_init (AddressbookComponent *component)
g_free (new_dir);
g_free (base_uri);
+
+ /* Create the LDAP source group */
+ group = e_source_group_new (_("On LDAP Servers"), "ldap://");
+ e_source_list_add_group (priv->source_list, group, -1);
}
component->priv = priv;
diff --git a/addressbook/gui/component/addressbook-config.c b/addressbook/gui/component/addressbook-config.c
index 21b7c2fbf5..bc6b406787 100644
--- a/addressbook/gui/component/addressbook-config.c
+++ b/addressbook/gui/component/addressbook-config.c
@@ -6,7 +6,6 @@
**/
/*#define STANDALONE*/
-/*#define NEW_ADVANCED_UI*/
#include <config.h>
@@ -29,7 +28,6 @@
#include "addressbook.h"
#include "addressbook-component.h"
#include "addressbook-config.h"
-#include "addressbook-storage.h"
#include "evolution-config-control.h"
#include <shell/e-folder-list.h>
@@ -50,19 +48,9 @@
#define CONFIG_CONTROL_FACTORY_ID "OAFIID:GNOME_Evolution_Addressbook_ConfigControlFactory"
#define LDAP_CONFIG_CONTROL_ID "OAFIID:GNOME_Evolution_LDAPStorage_ConfigControl"
-#ifdef HAVE_LDAP
-GtkWidget* addressbook_dialog_create_sources_table (char *name, char *string1, char *string2,
- int num1, int num2);
GtkWidget* supported_bases_create_table (char *name, char *string1, char *string2,
int num1, int num2);
-#ifdef NEW_ADVANCED_UI
-GtkWidget* objectclasses_create_server_table (char *name, char *string1, char *string2,
- int num1, int num2);
-GtkWidget* objectclasses_create_evolution_table (char *name, char *string1, char *string2,
- int num1, int num2);
-#endif
-
/* default objectclasses */
#define TOP "top"
#define PERSON "person"
@@ -98,33 +86,25 @@ add_focus_handler (GtkWidget *widget, GtkWidget *notebook, int page_num)
(GConnectFlags)0);
}
-typedef struct _AddressbookDialog AddressbookDialog;
typedef struct _AddressbookSourceDialog AddressbookSourceDialog;
typedef void (*ModifyFunc)(GtkWidget *item, AddressbookSourceDialog *dialog);
-struct _AddressbookDialog {
- EvolutionConfigControl *config_control;
- GtkWidget *page;
-
- GladeXML *gui;
-
- GtkWidget *sourcesTable;
- GtkTreeModel *sourcesModel;
- GtkTreeSelection *sourcesSelection;
- GtkWidget *addSource;
- GtkWidget *editSource;
- GtkWidget *deleteSource;
-
-};
-
-
struct _AddressbookSourceDialog {
- AddressbookDialog *addressbook_dialog;
GladeXML *gui;
GtkWidget *window;
GtkWidget *druid; /* only used (obviously) in the druid */
+ /* Source selection (druid only) */
+ ESourceList *source_list;
+ GtkWidget *group_optionmenu;
+
+ /* ESource we're currently editing (editor only) */
+ ESource *source;
+
+ /* Source group we're creating/editing a source in */
+ ESourceGroup *source_group;
+
/* info page fields */
ModifyFunc general_modify_func;
GtkWidget *host;
@@ -155,47 +135,279 @@ struct _AddressbookSourceDialog {
gboolean schema_query_successful;
-#ifdef NEW_ADVANCED_UI
- /* objectclasses tab fields */
- GPtrArray *server_objectclasses; /* the objectclasses available on the server */
- GPtrArray *evolution_objectclasses; /* the objectclasses evolution will use */
- GPtrArray *default_objectclasses; /* the objectclasses we default to (actually the
- intersection between defaults and server_objectclasses) */
- ModifyFunc objectclasses_modify_func;
- GtkWidget *objectclasses_server_table;
- ETableModel *objectclasses_server_model;
- GtkWidget *objectclasses_evolution_table;
- ETableModel *objectclasses_evolution_model;
- GtkWidget *objectclasses_add_button;
- GtkWidget *objectclasses_remove_button;
-
- /* refs we keep around so we can add/hide the tabs */
- GtkWidget *objectclasses_tab;
- GtkWidget *objectclasses_label;
- GtkWidget *mappings_tab;
- GtkWidget *mappings_label;
- GtkWidget *dn_customization_tab;
- GtkWidget *dn_customization_label;
-#endif
-
/* stuff for the account editor window */
- GtkTreeIter *source_model_row;
GtkWidget *ok_button;
GtkWidget *cancel_button;
GtkWidget *advanced_button_notebook;
GtkWidget *notebook; /* the toplevel notebook */
gboolean advanced;
-
};
+
+#ifdef HAVE_LDAP
+
+static char *
+ldap_unparse_auth (AddressbookLDAPAuthType auth_type)
+{
+ switch (auth_type) {
+ case ADDRESSBOOK_LDAP_AUTH_NONE:
+ return "none";
+ case ADDRESSBOOK_LDAP_AUTH_SIMPLE_EMAIL:
+ return "ldap/simple-email";
+ case ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN:
+ return "ldap/simple-binddn";
+ default:
+ g_assert(0);
+ return "none";
+ }
+}
+
+static AddressbookLDAPAuthType
+ldap_parse_auth (const char *auth)
+{
+ if (!auth)
+ return ADDRESSBOOK_LDAP_AUTH_NONE;
+
+ if (!strcmp (auth, "ldap/simple-email") || !strcmp (auth, "simple"))
+ return ADDRESSBOOK_LDAP_AUTH_SIMPLE_EMAIL;
+ else if (!strcmp (auth, "ldap/simple-binddn"))
+ return ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN;
+ else
+ return ADDRESSBOOK_LDAP_AUTH_NONE;
+}
+
+static char *
+ldap_unparse_scope (AddressbookLDAPScopeType scope_type)
+{
+ switch (scope_type) {
+ case ADDRESSBOOK_LDAP_SCOPE_BASE:
+ return "base";
+ case ADDRESSBOOK_LDAP_SCOPE_ONELEVEL:
+ return "one";
+ case ADDRESSBOOK_LDAP_SCOPE_SUBTREE:
+ return "sub";
+ default:
+ g_assert(0);
+ return "";
+ }
+}
+
+static char *
+ldap_unparse_ssl (AddressbookLDAPSSLType ssl_type)
+{
+ switch (ssl_type) {
+ case ADDRESSBOOK_LDAP_SSL_NEVER:
+ return "never";
+ case ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE:
+ return "whenever_possible";
+ case ADDRESSBOOK_LDAP_SSL_ALWAYS:
+ return "always";
+ default:
+ g_assert(0);
+ return "";
+ }
+}
+
+static AddressbookLDAPSSLType
+ldap_parse_ssl (const char *ssl)
+{
+ if (!ssl)
+ return ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE; /* XXX good default? */
+
+ if (!strcmp (ssl, "always"))
+ return ADDRESSBOOK_LDAP_SSL_ALWAYS;
+ else if (!strcmp (ssl, "never"))
+ return ADDRESSBOOK_LDAP_SSL_NEVER;
+ else
+ return ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE;
+}
+
+#endif
+
+
+
+static gboolean
+create_source_dir (AddressbookSourceDialog *dialog, ESource *source)
+{
+ gchar *new_dir;
+ gint result;
+
+ new_dir = g_build_filename (e_source_group_peek_base_uri (dialog->source_group),
+ e_source_peek_name (source), NULL);
+ g_print ("Making %s\n", new_dir);
+ result = e_mkdir_hier (new_dir + sizeof ("file://") - 1, 0700);
+ g_free (new_dir);
+
+ if (result) {
+ e_notice (NULL /* FIXME: parent */, GTK_MESSAGE_ERROR,
+ _("Could not create a directory for the new addressbook."));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void
+dialog_to_source (AddressbookSourceDialog *dialog, ESource *source, gboolean temporary)
+{
+ gchar *str;
+
+ g_assert (source);
+
+ e_source_set_name (source, gtk_entry_get_text (GTK_ENTRY (dialog->display_name)));
+
+ if (!strcmp ("ldap://", e_source_group_peek_base_uri (dialog->source_group))) {
+#ifdef HAVE_LDAP
+ e_source_set_property (source, "email_addr", gtk_entry_get_text (GTK_ENTRY (dialog->email)));
+ e_source_set_property (source, "binddn", gtk_entry_get_text (GTK_ENTRY (dialog->binddn)));
+ e_source_set_property (source, "limit", gtk_entry_get_text (GTK_ENTRY (dialog->limit_spinbutton)));
+ e_source_set_property (source, "ssl", ldap_unparse_ssl (dialog->ssl));
+ e_source_set_property (source, "auth", ldap_unparse_auth (dialog->auth));
+
+ str = g_strdup_printf ("%s:%s/%s?" /* trigraph prevention */ "?%s",
+ gtk_entry_get_text (GTK_ENTRY (dialog->host)),
+ gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (dialog->port_combo)->entry)),
+ gtk_entry_get_text (GTK_ENTRY (dialog->rootdn)),
+ ldap_unparse_scope (dialog->scope));
+ e_source_set_relative_uri (source, str);
+ g_free (str);
+#endif
+ } else {
+ const gchar *relative_uri;
+
+ relative_uri = e_source_peek_relative_uri (source);
+ if (!relative_uri || !strlen (relative_uri)) {
+ e_source_set_relative_uri (source, e_source_peek_name (source));
+
+ if (!temporary && !create_source_dir (dialog, source))
+ return;
+ }
+ }
+
+ if (!temporary && !e_source_peek_group (source))
+ e_source_group_add_source (dialog->source_group, source, -1);
+}
+
+static ESource *
+dialog_to_temp_source (AddressbookSourceDialog *dialog)
+{
+ ESource *source;
+
+ source = e_source_new ("", "");
+ dialog_to_source (dialog, source, TRUE);
+
+ return source;
+}
+
+#ifdef HAVE_LDAP
+static gboolean
+source_to_uri_parts (ESource *source, gchar **host, gchar **rootdn,
+ AddressbookLDAPScopeType *scope, gint *port)
+{
+ gchar *uri;
+ LDAPURLDesc *lud;
+ gint ldap_error;
+
+ g_assert (source);
+
+ uri = e_source_get_uri (source);
+ ldap_error = ldap_url_parse ((gchar *) uri, &lud);
+ g_free (uri);
+
+ if (ldap_error != LDAP_SUCCESS)
+ return FALSE;
+
+ if (host)
+ *host = g_strdup (lud->lud_host ? lud->lud_host : "");
+ if (rootdn)
+ *rootdn = g_strdup (lud->lud_dn ? lud->lud_dn : "");
+ if (port)
+ *port = lud->lud_port ? lud->lud_port : LDAP_PORT;
+ if (scope)
+ *scope = lud->lud_scope == LDAP_SCOPE_BASE ? ADDRESSBOOK_LDAP_SCOPE_BASE :
+ lud->lud_scope == LDAP_SCOPE_ONELEVEL ? ADDRESSBOOK_LDAP_SCOPE_ONELEVEL :
+ lud->lud_scope == LDAP_SCOPE_SUBTREE ? ADDRESSBOOK_LDAP_SCOPE_SUBTREE :
+ ADDRESSBOOK_LDAP_SCOPE_ONELEVEL;
+
+ ldap_free_urldesc (lud);
+ return TRUE;
+}
+#endif
+
+#define SOURCE_PROP_STRING(source, prop) \
+ (source && e_source_get_property (source, prop) ? e_source_get_property (source, prop) : "")
+
+static void
+source_to_dialog (AddressbookSourceDialog *dialog)
+{
+ ESource *source = dialog->source;
+
+ gtk_entry_set_text (GTK_ENTRY (dialog->display_name), source ? e_source_peek_name (source) : "");
+
+#ifdef HAVE_LDAP
+ gtk_entry_set_text (GTK_ENTRY (dialog->email), SOURCE_PROP_STRING (source, "email_addr"));
+ gtk_entry_set_text (GTK_ENTRY (dialog->binddn), SOURCE_PROP_STRING (source, "binddn"));
+ gtk_entry_set_text (GTK_ENTRY (dialog->limit_spinbutton),
+ source && e_source_get_property (source, "limit") ?
+ e_source_get_property (source, "limit") : "100");
+
+ dialog->auth = source && e_source_get_property (source, "auth") ?
+ ldap_parse_auth (e_source_get_property (source, "auth")) : ADDRESSBOOK_LDAP_AUTH_NONE;
+ dialog->ssl = source && e_source_get_property (source, "ssl") ?
+ ldap_parse_ssl (e_source_get_property (source, "ssl")) : ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE;
+
+ if (source && !strcmp ("ldap://", e_source_group_peek_base_uri (dialog->source_group))) {
+ gchar *host;
+ gchar *rootdn;
+ AddressbookLDAPScopeType scope;
+ gint port;
+
+ if (source_to_uri_parts (source, &host, &rootdn, &scope, &port)) {
+ gchar *port_str;
+
+ gtk_entry_set_text (GTK_ENTRY (dialog->host), host);
+ gtk_entry_set_text (GTK_ENTRY (dialog->rootdn), rootdn);
+
+ dialog->scope = scope;
+
+ port_str = g_strdup_printf ("%d", port);
+ gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (dialog->port_combo)->entry), port_str);
+ g_free (port_str);
+
+ g_free (host);
+ g_free (rootdn);
+ }
+ }
+
+ gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->auth_optionmenu), dialog->auth);
+ if (dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE) {
+ gtk_notebook_set_current_page (GTK_NOTEBOOK(dialog->auth_label_notebook), dialog->auth - 1);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK(dialog->auth_entry_notebook), dialog->auth - 1);
+ }
+ gtk_widget_set_sensitive (dialog->auth_label_notebook, dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE);
+ gtk_widget_set_sensitive (dialog->auth_entry_notebook, dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE);
+
+ gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->scope_optionmenu), dialog->scope);
+ gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->ssl_optionmenu), dialog->ssl);
+#endif
+}
+
+#ifdef HAVE_LDAP
+
/* ldap api foo */
static LDAP *
-addressbook_ldap_init (GtkWidget *window, AddressbookSource *source)
+addressbook_ldap_init (GtkWidget *window, ESource *source)
{
- LDAP *ldap = ldap_init (source->host, atoi(source->port));
+ LDAP *ldap;
+ gchar *host;
+ gint port;
+ if (!source_to_uri_parts (source, &host, NULL, NULL, &port))
+ return NULL;
+
+ ldap = ldap_init (host, port);
if (!ldap) {
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW(window),
@@ -205,19 +417,18 @@ addressbook_ldap_init (GtkWidget *window, AddressbookSource *source)
_("Failed to connect to LDAP server"));
g_signal_connect (dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL);
gtk_widget_show (dialog);
-
- return NULL;
}
/* XXX do TLS if it's configured in */
+ g_free (host);
return ldap;
}
-static int
-addressbook_ldap_auth (GtkWidget *window, AddressbookSource *source, LDAP *ldap)
+static gint
+addressbook_ldap_auth (GtkWidget *window, LDAP *ldap)
{
- int ldap_error;
+ gint ldap_error;
/* XXX use auth info from source */
ldap_error = ldap_simple_bind_s (ldap, NULL, NULL);
@@ -231,12 +442,12 @@ addressbook_ldap_auth (GtkWidget *window, AddressbookSource *source, LDAP *ldap)
g_signal_connect (dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL);
gtk_widget_show (dialog);
}
- return ldap_error;
+ return ldap_error;
}
static int
-addressbook_root_dse_query (GtkWindow *window, AddressbookSource *source, LDAP *ldap, char **attrs, LDAPMessage **resp)
+addressbook_root_dse_query (GtkWindow *window, LDAP *ldap, char **attrs, LDAPMessage **resp)
{
int ldap_error;
struct timeval timeout;
@@ -263,106 +474,14 @@ addressbook_root_dse_query (GtkWindow *window, AddressbookSource *source, LDAP *
return ldap_error;
}
-
-static AddressbookSource *
-addressbook_dialog_get_source (AddressbookSourceDialog *dialog)
-{
- AddressbookSource *source = g_new0 (AddressbookSource, 1);
-
- source->name = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->display_name)));
- source->host = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->host)));
- source->email_addr = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->email)));
- source->binddn = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->binddn)));
- source->port = g_strdup (gtk_entry_get_text (GTK_ENTRY (GTK_COMBO(dialog->port_combo)->entry)));
- source->rootdn = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->rootdn)));
- source->limit = atoi(gtk_entry_get_text (GTK_ENTRY (dialog->limit_spinbutton)));
- source->scope = dialog->scope;
- source->auth = dialog->auth;
- source->ssl = dialog->ssl;
-
- addressbook_storage_init_source_uri (source);
-
- return source;
-}
-
-static void
-addressbook_source_dialog_set_source (AddressbookSourceDialog *dialog, AddressbookSource *source)
-{
- char *string;
- gtk_entry_set_text (GTK_ENTRY (dialog->display_name), source && source->name ? source->name : "");
- gtk_entry_set_text (GTK_ENTRY (dialog->host), source && source->host ? source->host : "");
- gtk_entry_set_text (GTK_ENTRY (dialog->email), source && source->email_addr ? source->email_addr : "");
- gtk_entry_set_text (GTK_ENTRY (dialog->binddn), source && source->binddn ? source->binddn : "");
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO(dialog->port_combo)->entry), source ? source->port : LDAP_PORT_STRING);
- gtk_entry_set_text (GTK_ENTRY (dialog->rootdn), source && source->rootdn ? source->rootdn : "");
-
- string = g_strdup_printf ("%d", source ? source->limit : 100);
- gtk_entry_set_text (GTK_ENTRY (dialog->limit_spinbutton), string);
- g_free (string);
-
- dialog->auth = source ? source->auth : ADDRESSBOOK_LDAP_AUTH_NONE;
- gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->auth_optionmenu), dialog->auth);
- if (dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE) {
- gtk_notebook_set_current_page (GTK_NOTEBOOK(dialog->auth_label_notebook), dialog->auth - 1);
- gtk_notebook_set_current_page (GTK_NOTEBOOK(dialog->auth_entry_notebook), dialog->auth - 1);
- }
- gtk_widget_set_sensitive (dialog->auth_label_notebook, dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE);
- gtk_widget_set_sensitive (dialog->auth_entry_notebook, dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE);
-
- dialog->scope = source ? source->scope : ADDRESSBOOK_LDAP_SCOPE_ONELEVEL;
- gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->scope_optionmenu), dialog->scope);
-
- dialog->ssl = source ? source->ssl : ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE;
- gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->ssl_optionmenu), dialog->ssl);
-}
+#endif
static void
addressbook_source_dialog_destroy (gpointer data, GObject *where_object_was)
{
AddressbookSourceDialog *dialog = data;
-#ifdef NEW_ADVANCED_UI
-#define IF_UNREF(x) if (x) g_object_unref ((x))
-
- int i;
-
- if (dialog->server_objectclasses) {
- for (i = 0; i < dialog->server_objectclasses->len; i ++)
- ldap_objectclass_free (g_ptr_array_index (dialog->server_objectclasses, i));
- g_ptr_array_free (dialog->server_objectclasses, TRUE);
- }
-
- if (dialog->evolution_objectclasses) {
- for (i = 0; i < dialog->evolution_objectclasses->len; i ++)
- ldap_objectclass_free (g_ptr_array_index (dialog->evolution_objectclasses, i));
- g_ptr_array_free (dialog->evolution_objectclasses, TRUE);
- }
-
- if (dialog->default_objectclasses) {
- for (i = 0; i < dialog->default_objectclasses->len; i ++)
- ldap_objectclass_free (g_ptr_array_index (dialog->default_objectclasses, i));
- g_ptr_array_free (dialog->default_objectclasses, TRUE);
- }
-
- IF_UNREF (dialog->objectclasses_server_model);
- IF_UNREF (dialog->objectclasses_evolution_model);
-
- IF_UNREF (dialog->objectclasses_tab);
- IF_UNREF (dialog->objectclasses_label);
- IF_UNREF (dialog->mappings_tab);
- IF_UNREF (dialog->mappings_label);
- IF_UNREF (dialog->dn_customization_tab);
- IF_UNREF (dialog->dn_customization_label);
-
-#undef IF_UNREF
-#endif
-
- if (dialog->source_model_row) {
- gtk_tree_iter_free (dialog->source_model_row);
- dialog->source_model_row = NULL;
- }
g_object_unref (dialog->gui);
-
g_free (dialog);
}
@@ -375,21 +494,8 @@ addressbook_add_server_druid_cancel (GtkWidget *widget, AddressbookSourceDialog
static void
addressbook_add_server_druid_finish (GnomeDruidPage *druid_page, GtkWidget *gnome_druid, AddressbookSourceDialog *sdialog)
{
- AddressbookSource *source = addressbook_dialog_get_source (sdialog);
- AddressbookDialog *dialog = sdialog->addressbook_dialog;
- GtkTreeIter iter;
-
- printf ("in finish (%s,%s)\n", source->name, source->host);
-
- gtk_list_store_append (GTK_LIST_STORE (dialog->sourcesModel), &iter);
-
- gtk_list_store_set (GTK_LIST_STORE (dialog->sourcesModel), &iter,
- 0, source->name,
- 1, source->host,
- 2, source,
- -1);
-
- evolution_config_control_changed (dialog->config_control);
+ sdialog->source = e_source_new ("", "");
+ dialog_to_source (sdialog, sdialog->source, FALSE);
/* tear down the widgets */
gtk_widget_destroy (sdialog->window);
@@ -471,6 +577,9 @@ general_tab_check (AddressbookSourceDialog *dialog)
gboolean valid = TRUE;
const char *string;
+ if (strcmp ("ldap://", e_source_group_peek_base_uri (dialog->source_group)))
+ return TRUE;
+
string = gtk_entry_get_text (GTK_ENTRY (dialog->host));
if (!string || !string[0])
valid = FALSE;
@@ -616,6 +725,9 @@ druid_connecting_page_prepare (GnomeDruidPage *dpage, GtkWidget *gdruid, Address
}
+
+#ifdef HAVE_LDAP
+
/* searching page */
static ETableMemoryStoreColumnInfo bases_table_columns[] = {
E_TABLE_MEMORY_STORE_STRING,
@@ -647,9 +759,9 @@ supported_bases_create_table (char *name, char *string1, char *string2, int num1
}
static gboolean
-do_ldap_root_dse_query (GtkWidget *dialog, ETableModel *model, AddressbookSource *source, char ***rvalues)
+do_ldap_root_dse_query (GtkWidget *dialog, ETableModel *model, ESource *source, char ***rvalues)
{
- LDAP* ldap;
+ LDAP *ldap;
char *attrs[2];
int ldap_error;
char **values;
@@ -660,13 +772,13 @@ do_ldap_root_dse_query (GtkWidget *dialog, ETableModel *model, AddressbookSource
if (!ldap)
return FALSE;
- if (LDAP_SUCCESS != addressbook_ldap_auth (dialog, source, ldap))
+ if (LDAP_SUCCESS != addressbook_ldap_auth (dialog, ldap))
goto fail;
attrs[0] = "namingContexts";
attrs[1] = NULL;
- ldap_error = addressbook_root_dse_query (GTK_WINDOW (dialog), source, ldap, attrs, &resp);
+ ldap_error = addressbook_root_dse_query (GTK_WINDOW (dialog), ldap, attrs, &resp);
if (ldap_error != LDAP_SUCCESS)
goto fail;
@@ -710,13 +822,15 @@ static void
query_for_supported_bases (GtkWidget *button, AddressbookSourceDialog *sdialog)
{
ESelectionModel *selection_model;
- AddressbookSource *source = addressbook_dialog_get_source (sdialog);
+ ESource *source;
GtkWidget *dialog;
GtkWidget *supported_bases_table;
ETableModel *model;
int id;
char **values;
+ source = dialog_to_temp_source (sdialog);
+
dialog = glade_xml_get_widget (sdialog->gui, "supported-bases-dialog");
supported_bases_table = glade_xml_get_widget (sdialog->gui, "supported-bases-table");
@@ -752,7 +866,7 @@ query_for_supported_bases (GtkWidget *button, AddressbookSourceDialog *sdialog)
e_table_memory_store_clear (E_TABLE_MEMORY_STORE (model));
}
- addressbook_source_free (source);
+ g_object_unref (source);
}
static void
@@ -822,6 +936,8 @@ druid_searching_page_prepare (GnomeDruidPage *dpage, GtkWidget *gdruid, Addressb
FALSE /* help */);
}
+#endif
+
/* display name page */
static gboolean
@@ -838,7 +954,7 @@ display_name_check (AddressbookSourceDialog *dialog)
}
static void
-display_name_page_prepare (GtkWidget *page, GtkWidget *gnome_druid, AddressbookSourceDialog *dialog)
+folder_page_prepare (GtkWidget *page, GtkWidget *gnome_druid, AddressbookSourceDialog *dialog)
{
if (!dialog->display_name_changed) {
const char *server_name = gtk_entry_get_text (GTK_ENTRY (dialog->host));
@@ -853,214 +969,111 @@ display_name_page_prepare (GtkWidget *page, GtkWidget *gnome_druid, AddressbookS
}
static void
-druid_display_name_page_modify_cb (GtkWidget *item, AddressbookSourceDialog *dialog)
+druid_folder_page_modify_cb (GtkWidget *item, AddressbookSourceDialog *dialog)
{
dialog->display_name_changed = TRUE;
- display_name_page_prepare (NULL, NULL, dialog);
+ folder_page_prepare (NULL, NULL, dialog);
}
-#ifdef NEW_ADVANCED_UI
-/* objectclasses page */
-static ETableMemoryStoreColumnInfo objectclasses_table_columns[] = {
- E_TABLE_MEMORY_STORE_STRING,
- E_TABLE_MEMORY_STORE_TERMINATOR
-};
-
-#define OBJECTCLASSES_TABLE_SPEC \
-"<ETableSpecification cursor-mode=\"line\" no-headers=\"true\"> \
- <ETableColumn model_col= \"0\" _title=\"Objectclass\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableState> \
- <column source=\"0\"/> \
- <grouping> <leaf column=\"0\" ascending=\"true\"/> </grouping> \
- </ETableState> \
-</ETableSpecification>"
-
-GtkWidget*
-objectclasses_create_server_table (char *name, char *string1, char *string2,
- int num1, int num2)
-{
- GtkWidget *table;
- ETableModel *model;
-
- model = e_table_memory_store_new (objectclasses_table_columns);
-
- table = e_table_scrolled_new (model, NULL, OBJECTCLASSES_TABLE_SPEC, NULL);
-
- g_object_set_data (G_OBJECT (table), "model", model);
-
- return table;
-}
-
-GtkWidget*
-objectclasses_create_evolution_table (char *name, char *string1, char *string2,
- int num1, int num2)
-{
- GtkWidget *table;
- ETableModel *model;
-
- model = e_table_memory_store_new (objectclasses_table_columns);
-
- table = e_table_scrolled_new (model, NULL, OBJECTCLASSES_TABLE_SPEC, NULL);
-
- g_object_set_data (G_OBJECT (table), "model", model);
-
- return table;
-}
-
-static void
-objectclasses_add_foreach (int model_row, AddressbookSourceDialog *dialog)
-{
- LDAPObjectClass *oc = e_table_memory_get_data (E_TABLE_MEMORY (dialog->objectclasses_server_model), model_row);
- e_table_memory_store_remove (E_TABLE_MEMORY_STORE (dialog->objectclasses_server_model), model_row);
- /* XXX remove from the server array */
- e_table_memory_store_insert (E_TABLE_MEMORY_STORE (dialog->objectclasses_evolution_model),
- -1, oc, oc->oc_names[0]);
- /* XXX add to the evolution array */
-}
static void
-objectclasses_add (GtkWidget *item, AddressbookSourceDialog *dialog)
+source_group_changed_cb (GtkWidget *widget, AddressbookSourceDialog *sdialog)
{
- ESelectionModel *esm = e_table_get_selection_model (e_table_scrolled_get_table (E_TABLE_SCROLLED(dialog->objectclasses_server_table)));
-
- e_selection_model_foreach (esm, (EForeachFunc)objectclasses_add_foreach, dialog);
- dialog->objectclasses_modify_func (item, dialog);
+ sdialog->source_group = g_slist_nth (e_source_list_peek_groups (sdialog->source_list),
+ gtk_option_menu_get_history (GTK_OPTION_MENU (sdialog->group_optionmenu)))->data;
}
static void
-objectclasses_server_double_click (ETable *et, int row, int col, GdkEvent *event, AddressbookSourceDialog *dialog)
+source_group_menu_add_groups (GtkMenuShell *menu_shell, ESourceList *source_list)
{
- objectclasses_add_foreach (row, dialog);
- dialog->objectclasses_modify_func (GTK_WIDGET (et), dialog);
-}
+ GSList *groups, *sl;
-static void
-objectclasses_remove_foreach (int model_row, AddressbookSourceDialog *dialog)
-{
- LDAPObjectClass *oc = e_table_memory_get_data (E_TABLE_MEMORY (dialog->objectclasses_evolution_model), model_row);
- e_table_memory_store_remove (E_TABLE_MEMORY_STORE (dialog->objectclasses_evolution_model), model_row);
- /* XXX remove from the evolution array */
- e_table_memory_store_insert (E_TABLE_MEMORY_STORE (dialog->objectclasses_server_model),
- -1, oc, oc->oc_names[0]);
- /* XXX add to the server array */
-}
+ groups = e_source_list_peek_groups (source_list);
+ for (sl = groups; sl; sl = g_slist_next (sl)) {
+ GtkWidget *menu_item;
+ ESourceGroup *group = sl->data;
-static void
-objectclasses_remove (GtkWidget *item, AddressbookSourceDialog *dialog)
-{
- ESelectionModel *esm = e_table_get_selection_model (e_table_scrolled_get_table (E_TABLE_SCROLLED(dialog->objectclasses_evolution_table)));
-
- e_selection_model_foreach (esm, (EForeachFunc)objectclasses_add_foreach, dialog);
-
- dialog->objectclasses_modify_func (item, dialog);
-}
+#ifndef HAVE_LDAP
+ /* If LDAP isn't configured, skip LDAP groups */
+ if (!strcmp ("ldap://", e_source_group_peek_base_uri (group)))
+ continue;
+#endif
-static void
-objectclasses_evolution_double_click (ETable *et, int row, int col, GdkEvent *event, AddressbookSourceDialog *dialog)
-{
- objectclasses_remove_foreach (row, dialog);
- dialog->objectclasses_modify_func (GTK_WIDGET (et), dialog);
+ 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 void
-objectclasses_restore_default (GtkWidget *item, AddressbookSourceDialog *dialog)
+static gboolean
+folder_page_forward (GtkWidget *page, GtkWidget *widget, AddressbookSourceDialog *sdialog)
{
- int i;
+ GtkWidget *finish_page = glade_xml_get_widget (sdialog->gui, "add-server-druid-finish-page");
- dialog->objectclasses_modify_func (item, dialog);
-
- /* clear out our evolution list */
- for (i = 0; i < dialog->evolution_objectclasses->len; i ++) {
- g_ptr_array_add (dialog->server_objectclasses, g_ptr_array_index (dialog->evolution_objectclasses, i));
+ if (strcmp ("ldap://", e_source_group_peek_base_uri (sdialog->source_group))) {
+ gnome_druid_set_page (GNOME_DRUID (sdialog->druid), GNOME_DRUID_PAGE (finish_page));
+ return TRUE;
}
- g_ptr_array_set_size (dialog->evolution_objectclasses, 0);
- e_table_memory_store_clear (E_TABLE_MEMORY_STORE (dialog->objectclasses_evolution_model));
-
- for (i = 0; i < dialog->default_objectclasses->len; i++) {
- LDAPObjectClass *oc = g_ptr_array_index (dialog->default_objectclasses, i);
- g_ptr_array_add (dialog->evolution_objectclasses, oc);
- e_table_memory_store_insert (E_TABLE_MEMORY_STORE (dialog->objectclasses_evolution_model),
- i, oc, oc->oc_names[0]);
- }
-}
-
-static void
-server_selection_model_changed (ESelectionModel *selection_model, AddressbookSourceDialog *dialog)
-{
- gtk_widget_set_sensitive (dialog->objectclasses_add_button,
- e_selection_model_selected_count (selection_model) > 0);
+ return FALSE;
}
-static void
-evolution_selection_model_changed (ESelectionModel *selection_model, AddressbookSourceDialog *dialog)
+static gboolean
+finish_page_back (GtkWidget *page, GtkWidget *widget, AddressbookSourceDialog *sdialog)
{
- gtk_widget_set_sensitive (dialog->objectclasses_remove_button,
- e_selection_model_selected_count (selection_model) > 0);
-}
+ GtkWidget *folder_page = glade_xml_get_widget (sdialog->gui, "add-server-druid-folder-page");
+
+ if (strcmp ("ldap://", e_source_group_peek_base_uri (sdialog->source_group))) {
+ gnome_druid_set_page (GNOME_DRUID (sdialog->druid), GNOME_DRUID_PAGE (folder_page));
+ return TRUE;
+ }
-static void
-setup_objectclasses_tab (AddressbookSourceDialog *dialog, GtkSignalFunc modify_func)
-{
- ETable *table;
- GtkWidget *restore_default;
- ESelectionModel *esm;
-
- dialog->server_objectclasses = g_ptr_array_new ();
- dialog->evolution_objectclasses = g_ptr_array_new ();
- dialog->default_objectclasses = g_ptr_array_new ();
-
- dialog->objectclasses_modify_func = modify_func;
-
- dialog->objectclasses_server_table = glade_xml_get_widget (dialog->gui, "objectclasses-server-table");
- dialog->objectclasses_server_model = g_object_get_data (G_OBJECT (dialog->objectclasses_server_table), "model");
-
- dialog->objectclasses_evolution_table = glade_xml_get_widget (dialog->gui, "objectclasses-evolution-table");
- dialog->objectclasses_evolution_model = g_object_get_data (G_OBJECT (dialog->objectclasses_evolution_table), "model");
-
- table = e_table_scrolled_get_table (E_TABLE_SCROLLED(dialog->objectclasses_server_table));
- g_signal_connect (table, "double_click",
- G_CALLBACK (objectclasses_server_double_click), dialog);
- esm = e_table_get_selection_model (table);
- g_signal_connect (esm, "selection_changed",
- server_selection_model_changed, dialog);
-
- table = e_table_scrolled_get_table (E_TABLE_SCROLLED(dialog->objectclasses_evolution_table));
- g_signal_connect (table, "double_click",
- G_CALLBACK (objectclasses_evolution_double_click), dialog);
- esm = e_table_get_selection_model (table);
- g_signal_connect (esm, "selection_changed",
- evolution_selection_model_changed, dialog);
-
- dialog->objectclasses_add_button = glade_xml_get_widget (dialog->gui, "objectclasses-add-button");
- g_signal_connect (dialog->objectclasses_add_button, "clicked",
- G_CALLBACK(objectclasses_add), dialog);
-
- dialog->objectclasses_remove_button = glade_xml_get_widget (dialog->gui, "objectclasses-remove-button");
- g_signal_connect (dialog->objectclasses_remove_button, "clicked",
- G_CALLBACK(objectclasses_remove), dialog);
-
- restore_default = glade_xml_get_widget (dialog->gui, "objectclasses-default-button");
- g_signal_connect (restore_default, "clicked",
- G_CALLBACK(objectclasses_restore_default), dialog);
+ return FALSE;
}
-#endif
-
static AddressbookSourceDialog *
-addressbook_add_server_druid (AddressbookDialog *dialog)
+addressbook_add_server_druid (void)
{
AddressbookSourceDialog *sdialog = g_new0 (AddressbookSourceDialog, 1);
GtkWidget *page;
-
- sdialog->addressbook_dialog = dialog;
+ GConfClient *gconf_client;
sdialog->gui = glade_xml_new (EVOLUTION_GLADEDIR "/" GLADE_FILE_NAME, NULL, NULL);
sdialog->window = glade_xml_get_widget (sdialog->gui, "account-druid-window");
sdialog->druid = glade_xml_get_widget (sdialog->gui, "account-druid");
+ /* general page */
+ page = glade_xml_get_widget (sdialog->gui, "add-server-druid-folder-page");
+ sdialog->display_name = glade_xml_get_widget (sdialog->gui, "druid-display-name-entry");
+ g_signal_connect (sdialog->display_name, "changed",
+ G_CALLBACK (druid_folder_page_modify_cb), sdialog);
+ g_signal_connect_after (page, "prepare",
+ G_CALLBACK (folder_page_prepare), sdialog);
+ g_signal_connect_after (page, "next",
+ G_CALLBACK (folder_page_forward), sdialog);
+
+ gconf_client = gconf_client_get_default ();
+ sdialog->source_list = e_source_list_new_for_gconf (gconf_client, "/apps/evolution/addressbook/sources");
+ sdialog->group_optionmenu = glade_xml_get_widget (sdialog->gui, "druid-group-option-menu");
+ if (!GTK_IS_MENU (gtk_option_menu_get_menu (GTK_OPTION_MENU (sdialog->group_optionmenu)))) {
+ GtkWidget *menu = gtk_menu_new ();
+ gtk_option_menu_set_menu (GTK_OPTION_MENU (sdialog->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 Addressbook component. */
+ source_group_menu_add_groups (GTK_MENU_SHELL (gtk_option_menu_get_menu (
+ GTK_OPTION_MENU (sdialog->group_optionmenu))), sdialog->source_list);
+ gtk_option_menu_set_history (GTK_OPTION_MENU (sdialog->group_optionmenu), 0);
+ sdialog->source_group = e_source_list_peek_groups (sdialog->source_list)->data;
+ g_signal_connect (sdialog->group_optionmenu, "changed",
+ G_CALLBACK (source_group_changed_cb), sdialog);
+
+#ifdef HAVE_LDAP
+
/* info page */
page = glade_xml_get_widget (sdialog->gui, "add-server-druid-info-page");
reparent_to_vbox (sdialog, "account-druid-general-vbox", "general-tab");
@@ -1082,24 +1095,21 @@ addressbook_add_server_druid (AddressbookDialog *dialog)
g_signal_connect_after (page, "prepare",
G_CALLBACK(druid_searching_page_prepare), sdialog);
- /* display name page */
- page = glade_xml_get_widget (sdialog->gui, "add-server-druid-display-name-page");
- sdialog->display_name = glade_xml_get_widget (sdialog->gui, "druid-display-name-entry");
- g_signal_connect (sdialog->display_name, "changed",
- G_CALLBACK(druid_display_name_page_modify_cb), sdialog);
- g_signal_connect_after (page, "prepare",
- G_CALLBACK(display_name_page_prepare), sdialog);
+#endif
+ /* finish page */
page = glade_xml_get_widget (sdialog->gui, "add-server-druid-finish-page");
g_signal_connect (page, "finish",
G_CALLBACK(addressbook_add_server_druid_finish), sdialog);
+ g_signal_connect_after (page, "back",
+ G_CALLBACK (finish_page_back), sdialog);
g_signal_connect (sdialog->druid, "cancel",
G_CALLBACK(addressbook_add_server_druid_cancel), sdialog);
g_object_weak_ref (G_OBJECT (sdialog->window),
addressbook_source_dialog_destroy, sdialog);
/* make sure we fill in the default values */
- addressbook_source_dialog_set_source (sdialog, NULL);
+ source_to_dialog (sdialog);
gtk_window_set_type_hint (GTK_WINDOW (sdialog->window), GDK_WINDOW_TYPE_HINT_DIALOG);
gtk_window_set_modal (GTK_WINDOW (sdialog->window), TRUE);
@@ -1115,14 +1125,16 @@ editor_modify_cb (GtkWidget *item, AddressbookSourceDialog *dialog)
gboolean valid = TRUE;
valid = display_name_check (dialog);
+#ifdef HAVE_LDAP
if (valid)
valid = general_tab_check (dialog);
-#if 0
if (valid)
valid = connecting_tab_check (dialog);
+#if 0
if (valid)
valid = searching_tab_check (dialog);
#endif
+#endif
gtk_widget_set_sensitive (dialog->ok_button, valid);
}
@@ -1291,32 +1303,13 @@ edit_dialog_switch_page (GtkNotebook *notebook,
static gboolean
edit_dialog_store_change (AddressbookSourceDialog *sdialog)
{
- AddressbookSource *source = addressbook_dialog_get_source (sdialog);
- AddressbookDialog *dialog = sdialog->addressbook_dialog;
- AddressbookSource *old_source;
+ dialog_to_source (sdialog, sdialog->source, FALSE);
/* check the display name for uniqueness */
if (FALSE /* XXX */) {
return FALSE;
}
- /* store the new source in the addressbook dialog */
- gtk_tree_model_get (dialog->sourcesModel,
- sdialog->source_model_row,
- 2, &old_source,
- -1);
- addressbook_source_free (old_source);
-
- gtk_list_store_set (GTK_LIST_STORE (dialog->sourcesModel),
- sdialog->source_model_row,
- 0, source->name,
- 1, source->host,
- 2, source,
- -1);
-
- /* and let the config control know about the change */
- evolution_config_control_changed (dialog->config_control);
-
return TRUE;
}
@@ -1334,39 +1327,28 @@ edit_dialog_ok_clicked (GtkWidget *item, AddressbookSourceDialog *sdialog)
}
}
-static AddressbookSourceDialog*
-addressbook_edit_server_dialog (GtkTreeModel *model,
- GtkTreePath *path,
- GtkTreeIter *model_row,
- gpointer data)
+void
+addressbook_config_edit_source (GtkWidget *parent, ESource *source)
{
- AddressbookDialog *dialog = data;
- AddressbookSource *source;
AddressbookSourceDialog *sdialog = g_new0 (AddressbookSourceDialog, 1);
GtkWidget *general_tab_help;
-#ifdef NEW_ADVANCED_UI
- GtkWidget *fewer_options_button, *more_options_button;
-#endif
-
- gtk_tree_model_get (model, model_row,
- 2, &source,
- -1);
-
- sdialog->addressbook_dialog = dialog;
- sdialog->source_model_row = gtk_tree_iter_copy (model_row);
sdialog->gui = glade_xml_new (EVOLUTION_GLADEDIR "/" GLADE_FILE_NAME, NULL, NULL);
-
sdialog->window = glade_xml_get_widget (sdialog->gui, "account-editor-window");
- /* general tab */
- general_tab_help = glade_xml_get_widget (dialog->gui, "general-tab-help");
- reparent_to_vbox (sdialog, "account-editor-general-vbox", "general-tab");
- setup_general_tab (sdialog, editor_modify_cb);
+ sdialog->source = source;
+ sdialog->source_group = e_source_peek_group (source);
+
sdialog->display_name = glade_xml_get_widget (sdialog->gui, "account-editor-display-name-entry");
g_signal_connect (sdialog->display_name, "changed",
G_CALLBACK (editor_modify_cb), sdialog);
- add_focus_handler (sdialog->display_name, general_tab_help, 4);
+
+#ifdef HAVE_LDAP
+
+ /* general tab */
+ general_tab_help = glade_xml_get_widget (sdialog->gui, "general-tab-help");
+ reparent_to_vbox (sdialog, "account-editor-general-ldap-vbox", "general-tab");
+ setup_general_tab (sdialog, editor_modify_cb);
/* connecting tab */
reparent_to_vbox (sdialog, "account-editor-connecting-vbox", "connecting-tab");
@@ -1376,18 +1358,6 @@ addressbook_edit_server_dialog (GtkTreeModel *model,
reparent_to_vbox (sdialog, "account-editor-searching-vbox", "searching-tab");
setup_searching_tab (sdialog, editor_modify_cb);
-#ifdef NEW_ADVANCED_UI
- /* objectclasses tab */
- reparent_to_vbox (sdialog, "account-editor-objectclasses-vbox", "objectclasses-tab");
- setup_objectclasses_tab (sdialog, editor_modify_cb);
-
- /* mappings tab */
- reparent_to_vbox (sdialog, "account-editor-mappings-vbox", "mappings-tab");
- /* XXX setup_mappings_tab */
-
- /* dn customization tab */
- reparent_to_vbox (sdialog, "account-editor-dn-customization-vbox", "dn-customization-tab");
- /* XXX setup_dn_customization_tab */
#endif
sdialog->notebook = glade_xml_get_widget (sdialog->gui, "account-editor-notebook");
@@ -1395,45 +1365,24 @@ addressbook_edit_server_dialog (GtkTreeModel *model,
sdialog->ok_button = glade_xml_get_widget (sdialog->gui, "account-editor-ok-button");
sdialog->cancel_button = glade_xml_get_widget (sdialog->gui, "account-editor-cancel-button");
-#if NEW_ADVANCED_UI
- sdialog->advanced_button_notebook = glade_xml_get_widget (sdialog->gui, "account-editor-advanced-button-notebook");
- fewer_options_button = glade_xml_get_widget (sdialog->gui, "account-editor-fewer-options-button");
- more_options_button = glade_xml_get_widget (sdialog->gui, "account-editor-more-options-button");
-#endif
-
-#ifdef NEW_ADVANCED_UI
- sdialog->objectclasses_label = glade_xml_get_widget (sdialog->gui, "account-editor-objectclasses-label");
- g_object_ref (sdialog->objectclasses_label);
- sdialog->objectclasses_tab = glade_xml_get_widget (sdialog->gui, "account-editor-objectclasses-vbox");
- g_object_ref (sdialog->objectclasses_tab);
- sdialog->mappings_label = glade_xml_get_widget (sdialog->gui, "account-editor-mappings-label");
- g_object_ref (sdialog->mappings_label);
- sdialog->mappings_tab = glade_xml_get_widget (sdialog->gui, "account-editor-mappings-vbox");
- g_object_ref (sdialog->mappings_tab);
- sdialog->dn_customization_label = glade_xml_get_widget (sdialog->gui, "account-editor-dn-customization-label");
- g_object_ref (sdialog->dn_customization_label);
- sdialog->dn_customization_tab = glade_xml_get_widget (sdialog->gui, "account-editor-dn-customization-vbox");
- g_object_ref (sdialog->dn_customization_tab);
+#ifdef HAVE_LDAP
+ if (strcmp ("ldap://", e_source_group_peek_base_uri (sdialog->source_group))) {
+ gtk_widget_hide (glade_xml_get_widget (sdialog->gui, "account-editor-general-ldap-vbox"));
+ gtk_widget_hide (glade_xml_get_widget (sdialog->gui, "account-editor-connecting-vbox"));
+ gtk_widget_hide (glade_xml_get_widget (sdialog->gui, "account-editor-searching-vbox"));
+ } else {
+ add_focus_handler (sdialog->display_name, general_tab_help, 4);
+ }
+#else
+ gtk_widget_hide (glade_xml_get_widget (sdialog->gui, "account-editor-general-ldap-vbox"));
+ gtk_widget_hide (glade_xml_get_widget (sdialog->gui, "account-editor-connecting-vbox"));
+ gtk_widget_hide (glade_xml_get_widget (sdialog->gui, "account-editor-searching-vbox"));
#endif
- addressbook_source_dialog_set_source (sdialog, source);
+ source_to_dialog (sdialog);
set_advanced_button_state (sdialog);
-#ifdef NEW_ADVANCED_UI
- g_signal_connect (fewer_options_button,
- "clicked", advanced_button_clicked, sdialog);
- g_signal_connect (more_options_button,
- "clicked", advanced_button_clicked, sdialog);
-
-#endif
-
-#ifdef NEW_ADVANCED_UI
- /* set up a signal handler to query for schema info if the user switches to the advanced tabs */
- g_signal_connect (sdialog->notebook, "switch_page",
- G_CALLBACK (edit_dialog_switch_page), sdialog);
-#endif
-
g_signal_connect (sdialog->ok_button,
"clicked", G_CALLBACK(edit_dialog_ok_clicked), sdialog);
g_signal_connect (sdialog->cancel_button,
@@ -1447,287 +1396,17 @@ addressbook_edit_server_dialog (GtkTreeModel *model,
gtk_window_set_modal (GTK_WINDOW (sdialog->window), TRUE);
gtk_widget_show (sdialog->window);
-
- return sdialog;
-}
-
-static void
-add_source_clicked (GtkWidget *widget, AddressbookDialog *dialog)
-{
- addressbook_add_server_druid (dialog);
-}
-
-static void
-edit_source_clicked (GtkWidget *widget, AddressbookDialog *dialog)
-{
- gtk_tree_selection_selected_foreach (dialog->sourcesSelection,
- (GtkTreeSelectionForeachFunc)addressbook_edit_server_dialog,
- dialog);
-}
-
-static void
-delete_server (GtkTreeModel *model,
- GtkTreePath *path,
- GtkTreeIter *model_row,
- gpointer data)
-{
- AddressbookDialog *dialog = data;
-
- gtk_list_store_remove (GTK_LIST_STORE (dialog->sourcesModel),
- model_row);
-}
-
-static void
-delete_source_clicked (GtkWidget *widget, AddressbookDialog *dialog)
-{
- gtk_tree_selection_selected_foreach (dialog->sourcesSelection,
- delete_server,
- dialog);
-
- evolution_config_control_changed (dialog->config_control);
-}
-
-static void
-ldap_config_control_destroy_callback (gpointer data,
- GObject *where_object_was)
-{
- AddressbookDialog *dialog;
-
- dialog = (AddressbookDialog *) data;
-
- g_object_unref (dialog->gui);
-
- /* XXX free more stuff here */
-
- g_free (dialog);
-}
-
-static void
-ldap_config_control_apply_callback (EvolutionConfigControl *config_control,
- void *data)
-{
- AddressbookDialog *dialog;
- GtkTreeIter iter;
-
- dialog = (AddressbookDialog *) data;
-
- addressbook_storage_clear_sources();
-
- if (! gtk_tree_model_get_iter_first (dialog->sourcesModel,
- &iter))
- return;
-
- do {
- AddressbookSource *source;
-
- gtk_tree_model_get (dialog->sourcesModel,
- &iter,
- 2, &source,
- -1);
-
- addressbook_storage_add_source (addressbook_source_copy (source));
- } while (gtk_tree_model_iter_next (dialog->sourcesModel, &iter));
-
- addressbook_storage_write_sources();
-}
-
-static void
-sources_selection_changed (GtkTreeSelection *selection, AddressbookDialog *dialog)
-{
- gboolean sensitive;
- GtkTreeIter iter;
-
- sensitive = gtk_tree_selection_get_selected (selection, NULL, &iter);
-
- gtk_widget_set_sensitive (dialog->editSource, sensitive);
- gtk_widget_set_sensitive (dialog->deleteSource, sensitive);
-}
-
-static void
-sources_table_row_activated (GtkTreeView *tree_view, GtkTreePath *path,
- GtkTreeViewColumn *column, AddressbookDialog *dialog)
-{
- GtkTreeIter iter;
- gtk_tree_model_get_iter (dialog->sourcesModel, &iter, path);
- addressbook_edit_server_dialog (dialog->sourcesModel, NULL, &iter, dialog);
-}
-
-
-static AddressbookDialog *
-ldap_dialog_new (void)
-{
- AddressbookDialog *dialog;
- GList *l;
- GtkWidget *scrolled;
-
- dialog = g_new0 (AddressbookDialog, 1);
-
- dialog->gui = glade_xml_new (EVOLUTION_GLADEDIR "/" GLADE_FILE_NAME, NULL, NULL);
-
- scrolled = glade_xml_get_widget (dialog->gui, "sourcesTable");
- dialog->sourcesTable = g_object_get_data (G_OBJECT (scrolled), "table");
- dialog->sourcesModel = g_object_get_data (G_OBJECT (scrolled), "model");
- dialog->sourcesSelection = g_object_get_data (G_OBJECT (scrolled), "selection");
-
- g_signal_connect (dialog->sourcesTable, "row_activated",
- G_CALLBACK (sources_table_row_activated), dialog);
-
-
- dialog->addSource = glade_xml_get_widget (dialog->gui, "addSource");
- g_signal_connect (dialog->addSource, "clicked",
- G_CALLBACK (add_source_clicked),
- dialog);
-
- dialog->editSource = glade_xml_get_widget (dialog->gui, "editSource");
- g_signal_connect (dialog->editSource, "clicked",
- G_CALLBACK (edit_source_clicked),
- dialog);
-
- dialog->deleteSource = glade_xml_get_widget (dialog->gui, "deleteSource");
- g_signal_connect (dialog->deleteSource, "clicked",
- G_CALLBACK (delete_source_clicked),
- dialog);
-
- l = addressbook_storage_get_sources ();
- for (; l != NULL; l = l->next) {
- AddressbookSource *source;
- GtkTreeIter iter;
-
- source = addressbook_source_copy ((AddressbookSource*)l->data);
-
- gtk_list_store_append (GTK_LIST_STORE (dialog->sourcesModel), &iter);
-
- gtk_list_store_set (GTK_LIST_STORE (dialog->sourcesModel), &iter,
- 0, source->name,
- 1, source->host,
- 2, source,
- -1);
- }
-
- g_signal_connect (dialog->sourcesSelection, "changed",
- G_CALLBACK (sources_selection_changed), dialog);
-
- sources_selection_changed (dialog->sourcesSelection, dialog);
-
- dialog->page = glade_xml_get_widget (dialog->gui, "addressbook-sources");
-
- gtk_widget_show_all (dialog->page);
-
- return dialog;
-}
-
-GtkWidget*
-addressbook_dialog_create_sources_table (char *name, char *string1, char *string2, int num1, int num2)
-{
- GtkWidget *table, *scrolled;
- GtkTreeSelection *selection;
- GtkCellRenderer *renderer;
- GtkListStore *model;
-
- scrolled = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled), GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-
- model = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
- table = gtk_tree_view_new_with_model ((GtkTreeModel *) model);
-
- renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_insert_column_with_attributes ((GtkTreeView *) table, -1, _("Account Name"),
- renderer, "text", 0, NULL);
- gtk_tree_view_insert_column_with_attributes ((GtkTreeView *) table, -1, _("Server Name"),
- renderer, "text", 1, NULL);
-
- selection = gtk_tree_view_get_selection ((GtkTreeView *) table);
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
- gtk_tree_view_set_headers_visible ((GtkTreeView *) table, TRUE);
-
- gtk_container_add (GTK_CONTAINER (scrolled), table);
-
- g_object_set_data (G_OBJECT (scrolled), "model", model);
- g_object_set_data (G_OBJECT (scrolled), "selection", selection);
- g_object_set_data (G_OBJECT (scrolled), "table", table);
-
- gtk_widget_show (scrolled);
- gtk_widget_show (table);
-
- return scrolled;
-}
-#endif /* HAVE_LDAP */
-
-static EvolutionConfigControl *
-ldap_config_control_new (void)
-{
- GtkWidget *control_widget;
- EvolutionConfigControl *control;
-
-#ifdef HAVE_LDAP
- AddressbookDialog *dialog;
-
- dialog = ldap_dialog_new ();
-
- control_widget = dialog->page;
-
- gtk_widget_ref (control_widget);
-
- gtk_container_remove (GTK_CONTAINER (control_widget->parent), control_widget);
-#else
- control_widget = gtk_label_new (_("LDAP was not enabled in this build of Evolution"));
- gtk_widget_set_sensitive (control_widget, FALSE);
- gtk_widget_show (control_widget);
-#endif
-
- control = evolution_config_control_new (control_widget);
-
-#ifdef HAVE_LDAP
- dialog->config_control = control;
- g_signal_connect (dialog->config_control, "apply",
- G_CALLBACK (ldap_config_control_apply_callback), dialog);
- g_object_weak_ref (G_OBJECT (dialog->config_control),
- ldap_config_control_destroy_callback, dialog);
-
- gtk_widget_unref (dialog->page);
-#endif
-
- return control;
-}
-
-
-EvolutionConfigControl *
-addressbook_config_control_new (void)
-{
- return ldap_config_control_new ();
}
void
-addressbook_config_create_new_source (const char *new_source, GtkWidget *parent)
+addressbook_config_create_new_source (GtkWidget *parent)
{
-#ifdef HAVE_LDAP
-#if 0
AddressbookSourceDialog *dialog;
- GladeXML *gui;
-
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/" GLADE_FILE_NAME, NULL, NULL);
-
- dialog = addressbook_source_dialog (gui, NULL, parent);
-
- gtk_entry_set_text (GTK_ENTRY (dialog->name), new_source);
- dialog->id = gtk_dialog_run (GTK_DIALOG (dialog->dialog));
-
- gtk_widget_hide (dialog->dialog);
-
- g_object_unref (dialog->gui);
-
- if (dialog->id == GTK_RESPONSE_OK) {
- /* Ok was clicked */
- addressbook_storage_add_source (addressbook_source_copy(dialog->source));
- addressbook_storage_write_sources();
- }
-#endif
-#endif /* HAVE_LDAP */
+ dialog = addressbook_add_server_druid ();
}
+#if 0
#ifdef STANDALONE
int
main(int argc, char **argv)
@@ -1757,3 +1436,5 @@ main(int argc, char **argv)
return 0;
}
#endif
+
+#endif
diff --git a/addressbook/gui/component/addressbook-config.h b/addressbook/gui/component/addressbook-config.h
index c1f88e3425..b5800bc123 100644
--- a/addressbook/gui/component/addressbook-config.h
+++ b/addressbook/gui/component/addressbook-config.h
@@ -25,12 +25,28 @@
#ifndef __ADDRESSBOOK_CONFIG_H__
#define __ADDRESSBOOK_CONFIG_H__
-#include "addressbook-storage.h"
#include "evolution-config-control.h"
-EvolutionConfigControl *addressbook_config_control_new (void);
+typedef enum {
+ ADDRESSBOOK_LDAP_AUTH_NONE,
+ ADDRESSBOOK_LDAP_AUTH_SIMPLE_EMAIL,
+ ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN,
+} AddressbookLDAPAuthType;
-void addressbook_config_create_new_source (const char *new_source,
- GtkWidget *parent);
+typedef enum {
+ ADDRESSBOOK_LDAP_SCOPE_ONELEVEL,
+ ADDRESSBOOK_LDAP_SCOPE_SUBTREE,
+ ADDRESSBOOK_LDAP_SCOPE_BASE,
+ ADDRESSBOOK_LDAP_SCOPE_LAST
+} AddressbookLDAPScopeType;
+
+typedef enum {
+ ADDRESSBOOK_LDAP_SSL_ALWAYS,
+ ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE,
+ ADDRESSBOOK_LDAP_SSL_NEVER
+} AddressbookLDAPSSLType;
+
+void addressbook_config_edit_source (GtkWidget *parent, ESource *source);
+void addressbook_config_create_new_source (GtkWidget *parent);
#endif /* __ADDRESSBOOK_CONFIG_H__ */
diff --git a/addressbook/gui/component/addressbook-storage.c b/addressbook/gui/component/addressbook-storage.c
deleted file mode 100644
index f877dd3cd6..0000000000
--- a/addressbook/gui/component/addressbook-storage.c
+++ /dev/null
@@ -1,737 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-ldap-storage.c
- *
- * Copyright (C) 2000 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: Chris Toshok
- */
-
-/* The addressbook-sources.xml file goes like this:
-
- <?xml version="1.0"?>
- <addressbooks>
- <contactserver>
- <name>LDAP Server</name>
- <host>ldap.server.com</host>
- <port>389</port>
- <rootdn></rootdn>
- <authmethod>simple</authmethod>
- <emailaddr>toshok@blubag.com</emailaddr>
- <limit>100</limit>
- <rememberpass/>
- </contactserver>
- </addressbooks>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "addressbook-storage.h"
-
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <ctype.h>
-#include <unistd.h>
-
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-
-#include <libgnome/gnome-i18n.h>
-#include <libgnome/gnome-util.h>
-#include <bonobo/bonobo-object.h>
-
-#include <gal/util/e-util.h>
-#include <gal/util/e-xml-utils.h>
-#include <libgnome/gnome-i18n.h>
-
-#include "evolution-shell-component.h"
-
-#include "addressbook-config.h"
-
-#define ADDRESSBOOK_SOURCES_XML "addressbook-sources.xml"
-
-#ifdef HAVE_LDAP
-static gboolean load_source_data (const char *file_path);
-#endif
-
-static gboolean save_source_data (const char *file_path);
-static void deregister_storage (void);
-
-static GList *sources;
-static EvolutionStorage *storage;
-static char *storage_path;
-static GNOME_Evolution_Shell corba_shell;
-
-void
-addressbook_storage_setup (EvolutionShellComponent *shell_component,
- const char *evolution_homedir)
-{
- EvolutionShellClient *shell_client;
-
- shell_client = evolution_shell_component_get_owner (shell_component);
- if (shell_client == CORBA_OBJECT_NIL) {
- g_warning ("We have no shell!?");
- return;
- }
-
- corba_shell = evolution_shell_client_corba_objref (shell_client);
-
- sources = NULL;
-
- if (storage_path)
- g_free (storage_path);
- storage_path = g_build_filename (evolution_homedir, ADDRESSBOOK_SOURCES_XML, NULL);
-#ifdef HAVE_LDAP
- if (!load_source_data (storage_path))
- deregister_storage ();
-#endif
-}
-
-void
-addressbook_storage_cleanup (void)
-{
- if (storage != NULL) {
- bonobo_object_unref (storage);
- storage = NULL;
- }
-}
-
-#ifdef HAVE_LDAP
-static void
-notify_listener (const Bonobo_Listener listener,
- GNOME_Evolution_Storage_Result corba_result)
-{
- CORBA_any any;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- any._type = TC_GNOME_Evolution_Storage_Result;
- any._value = &corba_result;
-
- Bonobo_Listener_event (listener, "result", &any, &ev);
-
- CORBA_exception_free (&ev);
-}
-
-static void
-remove_ldap_folder (EvolutionStorage *storage, const Bonobo_Listener listener,
- const CORBA_char *path, const CORBA_char *physical_uri,
- gpointer data)
-{
-
- addressbook_storage_remove_source (path + 1);
- addressbook_storage_write_sources();
-
- notify_listener (listener, GNOME_Evolution_Storage_OK);
-}
-
-static void
-create_ldap_folder (EvolutionStorage *storage, const Bonobo_Listener listener,
- const CORBA_char *path, const CORBA_char *type,
- const CORBA_char *description, const CORBA_char *parent_physical_uri,
- gpointer data)
-{
- if (strcmp (type, "contacts")) {
- notify_listener (listener, GNOME_Evolution_Storage_UNSUPPORTED_TYPE);
- return;
- }
-
- if (strcmp (parent_physical_uri, "")) {/* ldap servers can't have subfolders */
- notify_listener (listener, GNOME_Evolution_Storage_INVALID_URI);
- return;
- }
- addressbook_config_create_new_source (path + 1, NULL);
-
- notify_listener (listener, GNOME_Evolution_Storage_OK);
-}
-#endif
-
-
-EvolutionStorage *
-addressbook_get_other_contact_storage (void)
-{
-#ifdef HAVE_LDAP
- EvolutionStorageResult result;
-
- if (storage == NULL) {
- storage = evolution_storage_new (_("Other Contacts"), FALSE);
- g_signal_connect (storage,
- "remove_folder",
- G_CALLBACK (remove_ldap_folder), NULL);
- g_signal_connect (storage,
- "create_folder",
- G_CALLBACK (create_ldap_folder), NULL);
- result = evolution_storage_register_on_shell (storage, corba_shell);
- switch (result) {
- case EVOLUTION_STORAGE_OK:
- break;
- case EVOLUTION_STORAGE_ERROR_GENERIC :
- g_warning("register_storage: generic error");
- break;
- case EVOLUTION_STORAGE_ERROR_CORBA :
- g_warning("register_storage: corba error");
- break;
- case EVOLUTION_STORAGE_ERROR_ALREADYREGISTERED :
- g_warning("register_storage: already registered error");
- break;
- case EVOLUTION_STORAGE_ERROR_EXISTS :
- g_warning("register_storage: already exists error");
- break;
- default:
- g_warning("register_storage: other error");
- break;
- }
- }
-#endif
-
- return storage;
-}
-
-static void
-deregister_storage (void)
-{
- if (evolution_storage_deregister_on_shell (storage, corba_shell) !=
- EVOLUTION_STORAGE_OK) {
- g_warning("couldn't deregister storage");
- }
-
- storage = NULL;
-}
-
-#ifdef HAVE_LDAP
-static char *
-get_string_value (xmlNode *node,
- const char *name)
-{
- xmlNode *p;
- xmlChar *xml_string;
- char *retval;
-
- p = e_xml_get_child_by_name (node, (xmlChar *) name);
- if (p == NULL)
- return NULL;
-
- p = e_xml_get_child_by_name (p, (xmlChar *) "text");
- if (p == NULL) /* there's no text between the tags, return the empty string */
- return g_strdup("");
-
- xml_string = xmlNodeListGetString (node->doc, p, 1);
- retval = g_strdup ((char *) xml_string);
- xmlFree (xml_string);
-
- return retval;
-}
-
-static int
-get_integer_value (xmlNode *node,
- const char *name,
- int defval)
-{
- xmlNode *p;
- xmlChar *xml_string;
- int retval;
-
- p = e_xml_get_child_by_name (node, (xmlChar *) name);
- if (p == NULL)
- return defval;
-
- p = e_xml_get_child_by_name (p, (xmlChar *) "text");
- if (p == NULL) /* there's no text between the tags, return the default */
- return defval;
-
- xml_string = xmlNodeListGetString (node->doc, p, 1);
- retval = atoi (xml_string);
- xmlFree (xml_string);
-
- return retval;
-}
-#endif
-
-static char *
-ldap_unparse_auth (AddressbookLDAPAuthType auth_type)
-{
- switch (auth_type) {
- case ADDRESSBOOK_LDAP_AUTH_NONE:
- return "none";
- case ADDRESSBOOK_LDAP_AUTH_SIMPLE_EMAIL:
- return "ldap/simple-email";
- case ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN:
- return "ldap/simple-binddn";
- default:
- g_assert(0);
- return "none";
- }
-}
-
-#ifdef HAVE_LDAP
-static AddressbookLDAPAuthType
-ldap_parse_auth (const char *auth)
-{
- if (!auth)
- return ADDRESSBOOK_LDAP_AUTH_NONE;
-
- if (!strcmp (auth, "ldap/simple-email") || !strcmp (auth, "simple"))
- return ADDRESSBOOK_LDAP_AUTH_SIMPLE_EMAIL;
- else if (!strcmp (auth, "ldap/simple-binddn"))
- return ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN;
- else
- return ADDRESSBOOK_LDAP_AUTH_NONE;
-}
-#endif
-
-static char *
-ldap_unparse_scope (AddressbookLDAPScopeType scope_type)
-{
- switch (scope_type) {
- case ADDRESSBOOK_LDAP_SCOPE_BASE:
- return "base";
- case ADDRESSBOOK_LDAP_SCOPE_ONELEVEL:
- return "one";
- case ADDRESSBOOK_LDAP_SCOPE_SUBTREE:
- return "sub";
- default:
- g_assert(0);
- return "";
- }
-}
-
-#ifdef HAVE_LDAP
-static AddressbookLDAPScopeType
-ldap_parse_scope (const char *scope)
-{
- if (!scope)
- return ADDRESSBOOK_LDAP_SCOPE_SUBTREE; /* XXX good default? */
-
- if (!strcmp (scope, "base"))
- return ADDRESSBOOK_LDAP_SCOPE_BASE;
- else if (!strcmp (scope, "one"))
- return ADDRESSBOOK_LDAP_SCOPE_ONELEVEL;
- else
- return ADDRESSBOOK_LDAP_SCOPE_SUBTREE;
-}
-#endif
-
-static char *
-ldap_unparse_ssl (AddressbookLDAPSSLType ssl_type)
-{
- switch (ssl_type) {
- case ADDRESSBOOK_LDAP_SSL_NEVER:
- return "never";
- case ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE:
- return "whenever_possible";
- case ADDRESSBOOK_LDAP_SSL_ALWAYS:
- return "always";
- default:
- g_assert(0);
- return "";
- }
-}
-
-#ifdef HAVE_LDAP
-static AddressbookLDAPSSLType
-ldap_parse_ssl (const char *ssl)
-{
- if (!ssl)
- return ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE; /* XXX good default? */
-
- if (!strcmp (ssl, "always"))
- return ADDRESSBOOK_LDAP_SSL_ALWAYS;
- else if (!strcmp (ssl, "never"))
- return ADDRESSBOOK_LDAP_SSL_NEVER;
- else
- return ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE;
-}
-#endif
-
-const char*
-addressbook_storage_auth_type_to_string (AddressbookLDAPAuthType auth_type)
-{
- return ldap_unparse_auth (auth_type);
-}
-
-void
-addressbook_storage_init_source_uri (AddressbookSource *source)
-{
- GString *str;
-
- if (source->uri)
- g_free (source->uri);
-
- str = g_string_new ("ldap://");
-
- g_string_append_printf (str, "%s:%s/%s?"/*trigraph prevention*/"?%s",
- source->host,
- source->port,
- source->rootdn,
- ldap_unparse_scope (source->scope));
-
- g_string_append_printf (str, ";limit=%d", source->limit);
-
- g_string_append_printf (str, ";ssl=%s", ldap_unparse_ssl (source->ssl));
-
-#if 0
- g_string_append_printf (str, ";timeout=%d", source->timeout);
-#endif
-
- source->uri = str->str;
-
- g_string_free (str, FALSE);
-}
-
-#ifdef HAVE_LDAP
-static gboolean
-load_source_data (const char *file_path)
-{
- xmlDoc *doc;
- xmlNode *root;
- xmlNode *child;
-
- addressbook_get_other_contact_storage();
-
- tryagain:
- doc = xmlParseFile (file_path);
- if (doc == NULL) {
- /* Check to see if a addressbook-sources.xml.new file
- exists. If it does, rename it and try loading it */
- char *new_path = g_strdup_printf ("%s.new", file_path);
- struct stat sb;
-
- if (stat (new_path, &sb) == 0) {
- int rv;
-
- rv = rename (new_path, file_path);
- g_free (new_path);
-
- if (rv < 0) {
- g_error ("Failed to rename %s: %s\n",
- file_path,
- strerror(errno));
- return FALSE;
- } else
- goto tryagain;
- }
-
- g_free (new_path);
- return FALSE;
- }
-
- root = xmlDocGetRootElement (doc);
- if (root == NULL || strcmp (root->name, "addressbooks") != 0) {
- xmlFreeDoc (doc);
- return FALSE;
- }
-
- for (child = root->children; child; child = child->next) {
- char *path, *value;
- AddressbookSource *source;
-
- source = g_new0 (AddressbookSource, 1);
-
- if (!strcmp (child->name, "contactserver")) {
- source->port = get_string_value (child, "port");
- source->host = get_string_value (child, "host");
- source->rootdn = get_string_value (child, "rootdn");
- value = get_string_value (child, "scope");
- source->scope = ldap_parse_scope (value);
- g_free (value);
- value = get_string_value (child, "authmethod");
- source->auth = ldap_parse_auth (value);
- g_free (value);
- value = get_string_value (child, "ssl");
- source->ssl = ldap_parse_ssl (value);
- g_free (value);
- source->email_addr = get_string_value (child, "emailaddr");
- source->binddn = get_string_value (child, "binddn");
- source->limit = get_integer_value (child, "limit", 100);
- }
- else if (!strcmp (child->name, "text")) {
- if (child->content) {
- int i;
- for (i = 0; i < strlen (child->content); i++) {
- if (!isspace (child->content[i])) {
- g_warning ("illegal text in contactserver list.");
- break;
- }
- }
- }
- g_free (source);
- continue;
- }
- else {
- g_warning ("unknown node '%s' in %s", child->name, file_path);
- g_free (source);
- continue;
- }
-
- addressbook_storage_init_source_uri (source);
-
- source->name = get_string_value (child, "name");
- source->description = get_string_value (child, "description");
-
- path = g_strdup_printf ("/%s", source->name);
- evolution_storage_new_folder (storage, path, source->name,
- "contacts/ldap", source->uri,
- source->description, NULL, 0, FALSE, 0);
-
- sources = g_list_append (sources, source);
-
- g_free (path);
- }
-
- if (g_list_length (sources) == 0)
- deregister_storage();
-
- xmlFreeDoc (doc);
- return TRUE;
-}
-#endif
-
-static void
-ldap_source_foreach(AddressbookSource *source, xmlNode *root)
-{
- xmlNode *source_root = xmlNewNode (NULL,
- (xmlChar *) "contactserver");
-
- xmlAddChild (root, source_root);
-
- xmlNewChild (source_root, NULL, (xmlChar *) "name",
- (xmlChar *) source->name);
- xmlNewChild (source_root, NULL, (xmlChar *) "description",
- (xmlChar *) source->description);
-
- xmlNewChild (source_root, NULL, (xmlChar *) "port",
- (xmlChar *) source->port);
- xmlNewChild (source_root, NULL, (xmlChar *) "host",
- (xmlChar *) source->host);
- xmlNewChild (source_root, NULL, (xmlChar *) "rootdn",
- (xmlChar *) source->rootdn);
- xmlNewChild (source_root, NULL, (xmlChar *) "scope",
- (xmlChar *) ldap_unparse_scope(source->scope));
- xmlNewChild (source_root, NULL, (xmlChar *) "authmethod",
- (xmlChar *) ldap_unparse_auth(source->auth));
- xmlNewChild (source_root, NULL, (xmlChar *) "ssl",
- (xmlChar *) ldap_unparse_ssl(source->ssl));
-
- if (source->limit != 100) {
- char *string;
- string = g_strdup_printf ("%d", source->limit);
- xmlNewChild (source_root, NULL, (xmlChar *) "limit",
- (xmlChar *) string);
- g_free (string);
- }
-
- if (source->auth != ADDRESSBOOK_LDAP_AUTH_NONE) {
- if (source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN)
- xmlNewChild (source_root, NULL, (xmlChar *) "binddn",
- (xmlChar *) source->binddn);
- else
- xmlNewChild (source_root, NULL, (xmlChar *) "emailaddr",
- (xmlChar *) source->email_addr);
-
- if (source->remember_passwd)
- xmlNewChild (source_root, NULL, (xmlChar *) "rememberpass",
- NULL);
- }
-}
-
-static gboolean
-save_source_data (const char *file_path)
-{
- xmlDoc *doc;
- xmlNode *root;
- int fd, rv;
- xmlChar *buf;
- int buf_size;
- char *new_path = g_strdup_printf ("%s.new", file_path);
-
- doc = xmlNewDoc ((xmlChar *) "1.0");
- root = xmlNewDocNode (doc, NULL, (xmlChar *) "addressbooks", NULL);
- xmlDocSetRootElement (doc, root);
-
- g_list_foreach (sources, (GFunc)ldap_source_foreach, root);
-
- fd = open (new_path, O_CREAT | O_TRUNC | O_WRONLY, 0600);
- fchmod (fd, 0600);
-
- xmlDocDumpMemory (doc, &buf, &buf_size);
-
- if (buf == NULL) {
- g_error ("Failed to write %s: xmlBufferCreate() == NULL", file_path);
- return FALSE;
- }
-
- rv = write (fd, buf, buf_size);
- xmlFree (buf);
- close (fd);
-
- if (0 > rv) {
- g_error ("Failed to write new %s: %s\n", file_path, strerror(errno));
- unlink (new_path);
- return FALSE;
- }
- else {
- if (0 > rename (new_path, file_path)) {
- g_error ("Failed to rename %s: %s\n", file_path, strerror(errno));
- unlink (new_path);
- return FALSE;
- }
- return TRUE;
- }
-}
-
-void
-addressbook_storage_add_source (AddressbookSource *source)
-{
- char *path;
-
- sources = g_list_append (sources, source);
-
- /* And then to the ui */
- addressbook_get_other_contact_storage();
- path = g_strdup_printf ("/%s", source->name);
- evolution_storage_new_folder (storage, path, source->name, "contacts/ldap",
- source->uri, source->description, NULL, 0, FALSE, 0);
-
- g_free (path);
-}
-
-void
-addressbook_storage_remove_source (const char *name)
-{
- char *path;
- AddressbookSource *source = NULL;
- GList *l;
-
- /* remove it from our hashtable */
- for (l = sources; l; l = l->next) {
- AddressbookSource *s = l->data;
- if (!strcmp (s->name, name)) {
- source = s;
- break;
- }
- }
-
- if (!source)
- return;
-
- sources = g_list_remove_link (sources, l);
- g_list_free_1 (l);
-
- addressbook_source_free (source);
-
- /* and then from the ui */
- path = g_strdup_printf ("/%s", name);
- evolution_storage_removed_folder (storage, path);
-
- if (g_list_length (sources) == 0)
- deregister_storage ();
-
- g_free (path);
-}
-
-GList *
-addressbook_storage_get_sources ()
-{
- return sources;
-}
-
-AddressbookSource *
-addressbook_storage_get_source_by_uri (const char *uri)
-{
- GList *l;
-
- for (l = sources; l ; l = l->next) {
- AddressbookSource *source = l->data;
- if (!strcmp (uri, source->uri))
- return source;
- }
-
- return NULL;
-}
-
-void
-addressbook_source_free (AddressbookSource *source)
-{
- g_free (source->name);
- g_free (source->description);
- g_free (source->uri);
- g_free (source->host);
- g_free (source->port);
- g_free (source->rootdn);
- g_free (source->email_addr);
- g_free (source->binddn);
-
- g_free (source);
-}
-
-static void
-addressbook_source_foreach (AddressbookSource *source, gpointer data)
-{
- char *path = g_strdup_printf ("/%s", source->name);
-
- evolution_storage_removed_folder (storage, path);
-
- g_free (path);
-
- addressbook_source_free (source);
-}
-
-void
-addressbook_storage_clear_sources (void)
-{
- g_list_foreach (sources, (GFunc)addressbook_source_foreach, NULL);
- g_list_free (sources);
- deregister_storage ();
- sources = NULL;
-}
-
-void
-addressbook_storage_write_sources (void)
-{
- save_source_data (storage_path);
-}
-
-AddressbookSource *
-addressbook_source_copy (const AddressbookSource *source)
-{
- AddressbookSource *copy;
-
- copy = g_new0 (AddressbookSource, 1);
- copy->name = g_strdup (source->name);
- copy->description = g_strdup (source->description);
- copy->uri = g_strdup (source->uri);
-
- copy->host = g_strdup (source->host);
- copy->port = g_strdup (source->port);
- copy->rootdn = g_strdup (source->rootdn);
- copy->scope = source->scope;
- copy->auth = source->auth;
- copy->ssl = source->ssl;
- copy->email_addr = g_strdup (source->email_addr);
- copy->binddn = g_strdup (source->binddn);
- copy->remember_passwd = source->remember_passwd;
- copy->limit = source->limit;
-
- return copy;
-}
diff --git a/addressbook/gui/component/addressbook-storage.h b/addressbook/gui/component/addressbook-storage.h
deleted file mode 100644
index 9a26abebd6..0000000000
--- a/addressbook/gui/component/addressbook-storage.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* addressbook-storage.h
- *
- * Copyright (C) 2000 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: Chris Toshok
- */
-
-#ifndef __ADDRESSBOOK_STORAGE_H__
-#define __ADDRESSBOOK_STORAGE_H__
-
-#include "evolution-shell-component.h"
-#include "evolution-storage.h"
-
-typedef enum {
- ADDRESSBOOK_LDAP_AUTH_NONE,
- ADDRESSBOOK_LDAP_AUTH_SIMPLE_EMAIL,
- ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN,
-} AddressbookLDAPAuthType;
-
-typedef enum {
- ADDRESSBOOK_LDAP_SCOPE_ONELEVEL,
- ADDRESSBOOK_LDAP_SCOPE_SUBTREE,
- ADDRESSBOOK_LDAP_SCOPE_BASE,
- ADDRESSBOOK_LDAP_SCOPE_LAST
-} AddressbookLDAPScopeType;
-
-typedef enum {
- ADDRESSBOOK_LDAP_SSL_ALWAYS,
- ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE,
- ADDRESSBOOK_LDAP_SSL_NEVER
-} AddressbookLDAPSSLType;
-
-typedef struct {
- char *name;
- char *description;
- char *host;
- char *port;
- char *rootdn;
- AddressbookLDAPScopeType scope;
- AddressbookLDAPAuthType auth;
- AddressbookLDAPSSLType ssl;
- char *email_addr; /* used in AUTH_SIMPLE_EMAIL */
- char *binddn; /* used in AUTH_SIMPLE_BINDDN */
- gboolean remember_passwd;
- int limit;
-
- char *uri; /* filled in from the above */
-} AddressbookSource;
-
-void addressbook_storage_setup (EvolutionShellComponent *shell_component,
- const char *evolution_homedir);
-void addressbook_storage_cleanup (void);
-
-EvolutionStorage *addressbook_get_other_contact_storage (void);
-GList *addressbook_storage_get_sources (void);
-AddressbookSource *addressbook_storage_get_source_by_uri (const char *uri);
-void addressbook_storage_clear_sources (void);
-void addressbook_storage_write_sources (void);
-AddressbookSource *addressbook_source_copy (const AddressbookSource *source);
-void addressbook_source_free (AddressbookSource *source);
-void addressbook_storage_init_source_uri (AddressbookSource *source);
-
-void addressbook_storage_add_source (AddressbookSource *source);
-void addressbook_storage_remove_source (const char *name);
-const char* addressbook_storage_auth_type_to_string (AddressbookLDAPAuthType auth_type);
-
-#endif /* __ADDRESSBOOK_STORAGE_H__ */
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index ddf7b8616a..f2f921c606 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -63,9 +63,9 @@ static GdkPixbuf *progress_icon[2] = { NULL, NULL };
#define d(x)
-#define PROPERTY_FOLDER_URI "folder_uri"
+#define PROPERTY_SOURCE_UID "source_uid"
-#define PROPERTY_FOLDER_URI_IDX 1
+#define PROPERTY_SOURCE_UID_IDX 1
typedef struct {
gint refs;
@@ -77,7 +77,9 @@ typedef struct {
EvolutionActivityClient *activity;
BonoboControl *control;
BonoboPropertyBag *properties;
- char *uri;
+ GConfClient *gconf_client;
+ ESourceList *source_list;
+ ESource *source;
char *passwd;
gboolean ignore_search_changes;
gboolean failed_to_load;
@@ -87,7 +89,7 @@ static void addressbook_view_ref (AddressbookView *);
static void addressbook_view_unref (AddressbookView *);
static void addressbook_authenticate (EBook *book, gboolean previous_failure,
- AddressbookSource *source, EBookCallback cb, gpointer closure);
+ ESource *source, EBookCallback cb, gpointer closure);
static void book_open_cb (EBook *book, EBookStatus status, gpointer closure);
@@ -402,12 +404,12 @@ control_activate_cb (BonoboControl *control,
/* if the book failed to load, we kick off another
load here */
- if (view->failed_to_load && view->uri) {
+ if (view->failed_to_load && view->source) {
EBook *book;
book = e_book_new ();
- addressbook_load_uri (book, view->uri, book_open_cb, view);
+ addressbook_load_source (book, view->source, book_open_cb, view);
}
} else {
bonobo_ui_component_unset_container (uic, NULL);
@@ -441,8 +443,10 @@ addressbook_view_clear (AddressbookView *view)
g_free(view->passwd);
view->passwd = NULL;
- g_free(view->uri);
- view->uri = NULL;
+ if (view->source_list) {
+ g_object_unref (view->source_list);
+ view->source_list = NULL;
+ }
if (view->ecml_changed_id != 0) {
g_signal_handler_disconnect (get_master_list(),
@@ -485,44 +489,40 @@ book_open_cb (EBook *book, EBookStatus status, gpointer closure)
char *label_string;
GtkWidget *warning_dialog;
GtkWidget *href = NULL;
- AddressbookSource *source = NULL;
+ gchar *uri;
view->failed_to_load = TRUE;
- if (!strncmp (view->uri, "file:", 5)) {
+ uri = e_source_get_uri (view->source);
+
+ if (!strncmp (uri, "file:", 5)) {
label_string =
_("We were unable to open this addressbook. Please check that the\n"
"path exists and that you have permission to access it.");
}
- else {
- source = addressbook_storage_get_source_by_uri (view->uri);
-
- if (source) {
- /* special case for ldap: contact folders so we can tell the user about openldap */
+ else if (!strncmp (uri, "ldap:", 5)) {
+ /* special case for ldap: contact folders so we can tell the user about openldap */
#if HAVE_LDAP
- label_string =
- _("We were unable to open this addressbook. This either\n"
- "means you have entered an incorrect URI, or the LDAP server\n"
- "is unreachable.");
+ label_string =
+ _("We were unable to open this addressbook. This either\n"
+ "means you have entered an incorrect URI, or the LDAP server\n"
+ "is unreachable.");
#else
- label_string =
- _("This version of Evolution does not have LDAP support\n"
- "compiled in to it. If you want to use LDAP in Evolution\n"
- "you must compile the program from the CVS sources after\n"
- "retrieving OpenLDAP from the link below.\n");
- href = gnome_href_new ("http://www.openldap.org/", "OpenLDAP at http://www.openldap.org/");
+ label_string =
+ _("This version of Evolution does not have LDAP support\n"
+ "compiled in to it. If you want to use LDAP in Evolution\n"
+ "you must compile the program from the CVS sources after\n"
+ "retrieving OpenLDAP from the link below.\n");
+ href = gnome_href_new ("http://www.openldap.org/", "OpenLDAP at http://www.openldap.org/");
#endif
- }
- else {
- /* other network folders */
- label_string =
- _("We were unable to open this addressbook. This either\n"
- "means you have entered an incorrect URI, or the server\n"
- "is unreachable.");
- }
+ } else {
+ /* other network folders */
+ label_string =
+ _("We were unable to open this addressbook. This either\n"
+ "means you have entered an incorrect URI, or the server\n"
+ "is unreachable.");
}
-
warning_dialog = gtk_message_dialog_new (
NULL /* XXX */,
0,
@@ -543,6 +543,8 @@ book_open_cb (EBook *book, EBookStatus status, gpointer closure)
href, FALSE, FALSE, 0);
gtk_widget_show_all (warning_dialog);
+
+ g_free (uri);
}
}
@@ -564,9 +566,9 @@ get_prop (BonoboPropertyBag *bag,
switch (arg_id) {
- case PROPERTY_FOLDER_URI_IDX:
- if (view && view->uri)
- BONOBO_ARG_SET_STRING (arg, view->uri);
+ case PROPERTY_SOURCE_UID_IDX:
+ if (view && view->source)
+ BONOBO_ARG_SET_STRING (arg, e_source_peek_uid (view->source));
else
BONOBO_ARG_SET_STRING (arg, "");
break;
@@ -578,15 +580,14 @@ get_prop (BonoboPropertyBag *bag,
typedef struct {
EBookCallback cb;
- char *clean_uri;
- AddressbookSource *source;
+ ESource *source;
gpointer closure;
-} LoadUriData;
+} LoadSourceData;
static void
-load_uri_auth_cb (EBook *book, EBookStatus status, gpointer closure)
+load_source_auth_cb (EBook *book, EBookStatus status, gpointer closure)
{
- LoadUriData *data = closure;
+ LoadSourceData *data = closure;
if (status != E_BOOK_ERROR_OK) {
if (status == E_BOOK_ERROR_CANCELLED) {
@@ -600,40 +601,65 @@ load_uri_auth_cb (EBook *book, EBookStatus status, gpointer closure)
g_signal_connect (dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL);
gtk_widget_show (dialog);
data->cb (book, E_BOOK_ERROR_OK, data->closure);
- g_free (data->clean_uri);
g_free (data);
return;
}
else {
- e_passwords_forget_password ("Addressbook", data->clean_uri);
- addressbook_authenticate (book, TRUE, data->source, load_uri_auth_cb, closure);
+ gchar *uri = e_source_get_uri (data->source);
+
+ e_passwords_forget_password ("Addressbook", uri);
+ addressbook_authenticate (book, TRUE, data->source, load_source_auth_cb, closure);
+
+ g_free (uri);
return;
}
}
data->cb (book, status, data->closure);
- g_free (data->clean_uri);
+ g_object_unref (data->source);
g_free (data);
}
+static gboolean
+get_remember_password (ESource *source)
+{
+ const gchar *value;
+
+ value = e_source_get_property (source, "remember_password");
+ if (value && !strcasecmp (value, "true"))
+ return TRUE;
+
+ return FALSE;
+}
+
+static void
+set_remember_password (ESource *source, gboolean value)
+{
+ e_source_set_property (source, "remember_password",
+ value ? "true" : "false");
+}
+
static void
-addressbook_authenticate (EBook *book, gboolean previous_failure, AddressbookSource *source,
+addressbook_authenticate (EBook *book, gboolean previous_failure, ESource *source,
EBookCallback cb, gpointer closure)
{
- LoadUriData *load_uri_data = closure;
const char *password = NULL;
char *pass_dup = NULL;
- char *semicolon;
-
- load_uri_data->clean_uri = g_strdup (e_book_get_uri (book));
+ const gchar *auth;
+ const gchar *user;
+ gchar *uri = e_source_get_uri (source);
- semicolon = strchr (load_uri_data->clean_uri, ';');
+ password = e_passwords_get_password ("Addressbook", uri);
- if (semicolon)
- *semicolon = '\0';
+ auth = e_source_get_property (source, "auth");
- password = e_passwords_get_password ("Addressbook", load_uri_data->clean_uri);
+ if (auth && !strcmp ("ldap/simple-binddn", auth))
+ user = e_source_get_property (source, "binddn");
+ else
+ user = e_source_get_property (source, "email_addr");
+ if (!user)
+ user = "";
if (!password) {
char *prompt;
@@ -647,91 +673,82 @@ addressbook_authenticate (EBook *book, gboolean previous_failure, AddressbookSou
failed_auth = "";
}
+ prompt = g_strdup_printf (_("%sEnter password for %s (user %s)"),
+ failed_auth, e_source_peek_name (source), user);
- if (source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN)
- prompt = g_strdup_printf (_("%sEnter password for %s (user %s)"),
- failed_auth, source->name, source->binddn);
- else
- prompt = g_strdup_printf (_("%sEnter password for %s (user %s)"),
- failed_auth, source->name, source->email_addr);
- remember = source->remember_passwd;
- pass_dup = e_passwords_ask_password (prompt, "Addressbook", load_uri_data->clean_uri, prompt, TRUE,
+ remember = get_remember_password (source);
+ pass_dup = e_passwords_ask_password (prompt, "Addressbook", uri, prompt, TRUE,
E_PASSWORDS_REMEMBER_FOREVER, &remember,
NULL);
- if (remember != source->remember_passwd) {
- source->remember_passwd = remember;
- addressbook_storage_write_sources ();
- }
+ if (remember != get_remember_password (source))
+ set_remember_password (source, remember);
+
g_free (prompt);
}
if (password || pass_dup) {
- char *user;
-
- if (source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN)
- user = source->binddn;
- else
- user = source->email_addr;
- if (!user)
- user = "";
e_book_async_authenticate_user (book, user, password ? password : pass_dup,
- addressbook_storage_auth_type_to_string (source->auth),
+ e_source_get_property (source, "auth"),
cb, closure);
g_free (pass_dup);
- return;
}
else {
/* they hit cancel */
cb (book, E_BOOK_ERROR_CANCELLED, closure);
}
+
+ g_free (uri);
}
static void
-load_uri_cb (EBook *book, EBookStatus status, gpointer closure)
+load_source_cb (EBook *book, EBookStatus status, gpointer closure)
{
- LoadUriData *load_uri_data = closure;
+ LoadSourceData *load_source_data = closure;
if (status == E_BOOK_ERROR_OK && book != NULL) {
+ const gchar *auth;
- /* check if the addressbook needs authentication */
-
- load_uri_data->source = addressbook_storage_get_source_by_uri (e_book_get_uri (book));
+ auth = e_source_get_property (load_source_data->source, "auth");
- if (load_uri_data->source &&
- load_uri_data->source->auth != ADDRESSBOOK_LDAP_AUTH_NONE) {
+ /* check if the addressbook needs authentication */
- addressbook_authenticate (book, FALSE, load_uri_data->source,
- load_uri_auth_cb, closure);
+ if (auth && strcmp (auth, "none")) {
+ addressbook_authenticate (book, FALSE, load_source_data->source,
+ load_source_auth_cb, closure);
return;
}
}
- load_uri_data->cb (book, status, load_uri_data->closure);
- g_free (load_uri_data);
+ load_source_data->cb (book, status, load_source_data->closure);
+ g_object_unref (load_source_data->source);
+ g_free (load_source_data);
}
void
-addressbook_load_uri (EBook *book, const char *uri,
- EBookCallback cb, gpointer closure)
+addressbook_load_source (EBook *book, ESource *source,
+ EBookCallback cb, gpointer closure)
{
- LoadUriData *load_uri_data = g_new0 (LoadUriData, 1);
+ LoadSourceData *load_source_data = g_new0 (LoadSourceData, 1);
- load_uri_data->cb = cb;
- load_uri_data->closure = closure;
+ load_source_data->cb = cb;
+ load_source_data->closure = closure;
+ load_source_data->source = g_object_ref (source);
- e_book_async_load_uri (book, uri, load_uri_cb, load_uri_data);
+ e_book_async_load_source (book, source, load_source_cb, load_source_data);
}
void
addressbook_load_default_book (EBookCallback cb, gpointer closure)
{
- LoadUriData *load_uri_data = g_new (LoadUriData, 1);
+ LoadSourceData *load_source_data = g_new (LoadSourceData, 1);
- load_uri_data->cb = cb;
- load_uri_data->closure = closure;
+ /* FIXME: We need to get the source for the default book */
- e_book_async_get_default_addressbook (load_uri_cb, load_uri_data);
+ load_source_data->cb = cb;
+ load_source_data->closure = closure;
+
+ e_book_async_get_default_addressbook (load_source_cb, load_source_data);
}
static void
@@ -742,23 +759,28 @@ set_prop (BonoboPropertyBag *bag,
gpointer user_data)
{
AddressbookView *view = user_data;
+ const gchar *uid;
switch (arg_id) {
- case PROPERTY_FOLDER_URI_IDX:
- if (view->uri) {
+ case PROPERTY_SOURCE_UID_IDX:
+ if (view->book) {
/* we've already had a uri set on this view, so unload it */
e_book_async_unload_uri (view->book);
- g_free (view->uri);
+ view->source = NULL;
} else {
view->book = e_book_new ();
}
view->failed_to_load = FALSE;
- view->uri = g_strdup(BONOBO_ARG_GET_STRING (arg));
-
- addressbook_load_uri (view->book, view->uri, book_open_cb, view);
+ uid = BONOBO_ARG_GET_STRING (arg);
+ view->source = e_source_list_peek_source_by_uid (view->source_list, uid);
+
+ if (view->source)
+ addressbook_load_source (view->book, view->source, book_open_cb, view);
+ else
+ g_warning ("Could not find source by UID '%s'!", uid);
break;
@@ -1097,9 +1119,9 @@ addressbook_new_control (void)
view->properties = bonobo_property_bag_new (get_prop, set_prop, view);
bonobo_property_bag_add (view->properties,
- PROPERTY_FOLDER_URI, PROPERTY_FOLDER_URI_IDX,
+ PROPERTY_SOURCE_UID, PROPERTY_SOURCE_UID_IDX,
BONOBO_ARG_STRING, NULL,
- _("URI of the contacts that the control will display"), 0);
+ _("UID of the contacts source that the view will display"), 0);
bonobo_control_set_properties (view->control,
bonobo_object_corba_objref (BONOBO_OBJECT (view->properties)),
@@ -1116,8 +1138,11 @@ addressbook_new_control (void)
g_signal_connect (view->view, "command_state_change",
G_CALLBACK(update_command_state), view);
-
- view->uri = NULL;
+
+ view->gconf_client = gconf_client_get_default ();
+ view->source_list = e_source_list_new_for_gconf (view->gconf_client,
+ "/apps/evolution/addressbook/sources");
+ view->source = NULL;
g_signal_connect (view->control, "activate",
G_CALLBACK (control_activate_cb), view);
diff --git a/addressbook/gui/component/addressbook.h b/addressbook/gui/component/addressbook.h
index 5e6ff05f64..fb05287133 100644
--- a/addressbook/gui/component/addressbook.h
+++ b/addressbook/gui/component/addressbook.h
@@ -9,7 +9,10 @@
/* use this instead of e_book_load_uri everywhere where you want the
authentication to be handled for you. */
+#if 0
void addressbook_load_uri (EBook *book, const char *uri, EBookCallback cb, gpointer closure);
+#endif
+void addressbook_load_source (EBook *book, ESource *source, EBookCallback cb, gpointer closure);
void addressbook_load_default_book (EBookCallback open_response, gpointer closure);
BonoboControl *addressbook_new_control (void);
diff --git a/addressbook/gui/component/component-factory.c b/addressbook/gui/component/component-factory.c
index ae7ee670b8..a230db4277 100644
--- a/addressbook/gui/component/component-factory.c
+++ b/addressbook/gui/component/component-factory.c
@@ -64,8 +64,11 @@ factory (BonoboGenericFactory *factory,
}
if (strcmp (component_id, ADDRESS_POPUP_ID) == 0)
return BONOBO_OBJECT (eab_popup_control_new ());
+#if 0
+ /* Config control is dead */
if (strcmp (component_id, LDAP_STORAGE_CONFIG_CONTROL_ID) == 0)
return BONOBO_OBJECT (addressbook_config_control_new ());
+#endif
if (strcmp (component_id, SELECT_NAMES_ID) == 0)
return BONOBO_OBJECT (e_select_names_bonobo_new ());
#if HAVE_NSS
diff --git a/addressbook/gui/component/ldap-config.glade b/addressbook/gui/component/ldap-config.glade
index 494c34d3ca..d7b5972ad5 100644
--- a/addressbook/gui/component/ldap-config.glade
+++ b/addressbook/gui/component/ldap-config.glade
@@ -102,13 +102,19 @@
</child>
<child>
- <widget class="GtkHSeparator" id="hseparator12">
+ <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">False</property>
- <property name="fill">False</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
</packing>
</child>
</widget>
@@ -278,7 +284,7 @@
</widget>
<widget class="GtkWindow" id="account-druid-window">
- <property name="title" translatable="yes">Add LDAP Server</property>
+ <property name="title" translatable="yes">New Addressbook</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
@@ -295,7 +301,7 @@
<widget class="GnomeDruidPageEdge" id="druidpagestart1">
<property name="visible">True</property>
<property name="position">GNOME_EDGE_START</property>
- <property name="title" translatable="yes">LDAP Configuration Assistant</property>
+ <property name="title" translatable="yes">Addressbook Creation Assistant</property>
<property name="text" translatable="yes">This assistant will help you to access online directory services
using LDAP (Lightweight Directory Access Protocol) servers.
@@ -304,29 +310,28 @@ Adding a new LDAP server requires some specialized information about the server.
</child>
<child>
- <widget class="GnomeDruidPageStandard" id="add-server-druid-info-page">
+ <widget class="GnomeDruidPageStandard" id="add-server-druid-folder-page">
<property name="visible">True</property>
- <property name="title" translatable="yes">Step 1: Server Information</property>
+ <property name="title" translatable="yes">Step 1: Folder Characteristics</property>
<child internal-child="vbox">
- <widget class="GtkVBox" id="druid-vbox1">
- <property name="border_width">3</property>
+ <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">3</property>
+ <property name="spacing">6</property>
<child>
- <widget class="GtkVBox" id="account-druid-general-vbox">
+ <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="label158">
+ <widget class="GtkLabel" id="label198">
<property name="visible">True</property>
- <property name="label" translatable="yes">The first step in configuring an LDAP server is to provide its name, and your log in
-information. Please ask your system administrator if you are unsure of this information.</property>
+ <property name="label" translatable="yes">Specifying a display name and group is the first step in setting up an addressbook.</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -345,13 +350,213 @@ information. Please ask your system administrator if you are unsure of this info
</child>
<child>
- <widget class="GtkHSeparator" id="hseparator2">
+ <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="druid-display-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">druid-display-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="druid-group-option-menu">
+ <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>
@@ -367,30 +572,29 @@ information. Please ask your system administrator if you are unsure of this info
</child>
<child>
- <widget class="GnomeDruidPageStandard" id="add-server-druid-connecting-page">
+ <widget class="GnomeDruidPageStandard" id="add-server-druid-info-page">
<property name="visible">True</property>
- <property name="title" translatable="yes">Step 2: Connecting to Server</property>
+ <property name="title" translatable="yes">Step 2: Server Information</property>
<child internal-child="vbox">
- <widget class="GtkVBox" id="druid-vbox2">
+ <widget class="GtkVBox" id="druid-vbox1">
<property name="border_width">3</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">3</property>
<child>
- <widget class="GtkVBox" id="account-druid-connecting-vbox">
+ <widget class="GtkVBox" id="account-druid-general-vbox">
<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="label174">
+ <widget class="GtkLabel" id="label158">
<property name="visible">True</property>
- <property name="label" translatable="yes">Now, you must specify how you want to connect to the LDAP server. The SSL (Secure Sockets Layer)
-and TLS (Transport Layer Security) protocols are used by some servers to cryptographically protect
-your connection. Ask your system administrator if your LDAP server uses these protocols.</property>
+ <property name="label" translatable="yes">You have decided to configure an LDAP server. The first step in doing this is to provide its name and your
+log in information. Please ask your system administrator if you are unsure of this information.</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -409,7 +613,7 @@ your connection. Ask your system administrator if your LDAP server uses these pr
</child>
<child>
- <widget class="GtkHSeparator" id="hseparator3">
+ <widget class="GtkHSeparator" id="hseparator2">
<property name="visible">True</property>
</widget>
<packing>
@@ -431,38 +635,38 @@ your connection. Ask your system administrator if your LDAP server uses these pr
</child>
<child>
- <widget class="GnomeDruidPageStandard" id="add-server-druid-searching-page">
+ <widget class="GnomeDruidPageStandard" id="add-server-druid-connecting-page">
<property name="visible">True</property>
- <property name="title" translatable="yes">Step 3: Searching the Directory</property>
+ <property name="title" translatable="yes">Step 3: Connecting to Server</property>
<child internal-child="vbox">
- <widget class="GtkVBox" id="vbox23">
+ <widget class="GtkVBox" id="druid-vbox2">
<property name="border_width">3</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">3</property>
<child>
- <widget class="GtkVBox" id="account-druid-searching-vbox">
+ <widget class="GtkVBox" id="account-druid-connecting-vbox">
<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="label254">
+ <widget class="GtkLabel" id="label174">
<property name="visible">True</property>
- <property name="label" translatable="yes">The options on this page control how many entries should be included in your
-searches, and how long a search should take. Ask your system administrator if you
-need to change these options.</property>
+ <property name="label" translatable="yes">Now, you must specify how you want to connect to the LDAP server. The SSL (Secure Sockets Layer)
+and TLS (Transport Layer Security) protocols are used by some servers to cryptographically protect
+your connection. Ask your system administrator if your LDAP server uses these protocols.</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="xalign">7.45058e-09</property>
<property name="yalign">0.5</property>
- <property name="xpad">0</property>
+ <property name="xpad">3</property>
<property name="ypad">0</property>
</widget>
<packing>
@@ -473,7 +677,7 @@ need to change these options.</property>
</child>
<child>
- <widget class="GtkHSeparator" id="hseparator7">
+ <widget class="GtkHSeparator" id="hseparator3">
<property name="visible">True</property>
</widget>
<packing>
@@ -495,36 +699,38 @@ need to change these options.</property>
</child>
<child>
- <widget class="GnomeDruidPageStandard" id="add-server-druid-display-name-page">
+ <widget class="GnomeDruidPageStandard" id="add-server-druid-searching-page">
<property name="visible">True</property>
- <property name="title" translatable="yes">Step 4: Display Name</property>
+ <property name="title" translatable="yes">Step 4: Searching the Directory</property>
<child internal-child="vbox">
- <widget class="GtkVBox" id="druid-vbox5">
+ <widget class="GtkVBox" id="vbox23">
<property name="border_width">3</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">3</property>
<child>
- <widget class="GtkVBox" id="vbox21">
+ <widget class="GtkVBox" id="account-druid-searching-vbox">
<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">
+ <widget class="GtkLabel" id="label254">
<property name="visible">True</property>
- <property name="label" translatable="yes">Specifying a display name is the last required step in configuring an LDAP server.</property>
+ <property name="label" translatable="yes">The options on this page control how many entries should be included in your
+searches, and how long a search should take. Ask your system administrator if you
+need to change these options.</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="xalign">0.5</property>
<property name="yalign">0.5</property>
- <property name="xpad">3</property>
+ <property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
@@ -535,7 +741,7 @@ need to change these options.</property>
</child>
<child>
- <widget class="GtkHSeparator" id="hseparator5">
+ <widget class="GtkHSeparator" id="hseparator7">
<property name="visible">True</property>
</widget>
<packing>
@@ -544,167 +750,6 @@ need to change these options.</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">1</property>
- <property name="n_columns">2</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">3</property>
- <property name="column_spacing">3</property>
-
- <child>
- <widget class="GtkEntry" id="druid-display-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">0</property>
- <property name="bottom_attach">1</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">druid-display-name-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>
- </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 for this server 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>
@@ -722,8 +767,7 @@ searches, and for creating and editing contacts. </property>
<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 LDAP server. You
-are now ready to access this directory.
+ <property name="text" translatable="yes">Congratulations, you are finished setting up this addressbook.
Please click the &quot;Finish&quot; button to save the settings you have entered here.</property>
</widget>
@@ -983,7 +1027,7 @@ Please click the &quot;Finish&quot; button to save the settings you have entered
<widget class="GtkTable" id="table36">
<property name="border_width">6</property>
<property name="visible">True</property>
- <property name="n_rows">3</property>
+ <property name="n_rows">4</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
@@ -1007,8 +1051,8 @@ Please click the &quot;Finish&quot; button to save the settings you have entered
<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="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@@ -1031,8 +1075,8 @@ Please click the &quot;Finish&quot; button to save the settings you have entered
<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="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@@ -1054,8 +1098,8 @@ Please click the &quot;Finish&quot; button to save the settings you have entered
<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="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
@@ -1109,8 +1153,8 @@ Please click the &quot;Finish&quot; button to save the settings you have entered
<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="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
@@ -1206,8 +1250,8 @@ Please click the &quot;Finish&quot; button to save the settings you have entered
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
@@ -1300,12 +1344,25 @@ Please click the &quot;Finish&quot; button to save the settings you have entered
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkHSeparator" id="hseparator12">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</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>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
diff --git a/addressbook/gui/component/new-addressbook.c b/addressbook/gui/component/new-addressbook.c
deleted file mode 100644
index 4323ca6b1c..0000000000
--- a/addressbook/gui/component/new-addressbook.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* new-addressbook.c - Create a new addressbook
- *
- * 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 <glade/glade.h>
-#include <libedataserver/e-source-list.h>
-#include <e-util/e-dialog-utils.h>
-#include <e-util/e-url.h>
-#include "new-addressbook.h"
-
-static gboolean
-create_new_source_with_group (GtkWindow *parent,
- ESourceGroup *group,
- const char *source_name,
- const char *source_location)
-{
- ESource *source;
- char *new_dir;
-
- if (e_source_group_peek_source_by_name (group, source_name)) {
- e_notice (parent, GTK_MESSAGE_ERROR,
- _("Source with name '%s' already exists in the selected group"),
- source_name);
- return FALSE;
- }
-
- /* 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_addressbook_dialog (GtkWindow *parent)
-{
- GtkWidget *dialog, *ab_group, *ab_name, *ab_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-addressbook.glade", "new-addressbook-dialog", NULL);
- if (!xml) {
- g_warning (G_STRLOC ": cannot load Glade file");
- return FALSE;
- }
-
- dialog = glade_xml_get_widget (xml, "new-addressbook-dialog");
- ab_group = glade_xml_get_widget (xml, "addressbook-group");
- ab_name = glade_xml_get_widget (xml, "addressbook-name");
-
- /* set up widgets */
- gconf_client = gconf_client_get_default ();
- source_list = e_source_list_new_for_gconf (gconf_client, "/apps/evolution/addressbook/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 (ab_group));
- if (!GTK_IS_MENU (menu)) {
- menu = gtk_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (ab_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 (ab_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 (ab_name));
- location = gtk_entry_get_text (GTK_ENTRY (ab_location));
- sl = g_slist_nth (groups, gtk_option_menu_get_history (GTK_OPTION_MENU (ab_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);
-
- /* free memory */
- g_object_unref (xml);
-
- return result;
-}
diff --git a/addressbook/gui/component/new-addressbook.h b/addressbook/gui/component/new-addressbook.h
deleted file mode 100644
index 9860872a00..0000000000
--- a/addressbook/gui/component/new-addressbook.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* new-addressbook.h - Create a new addressbook
- *
- * 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.
- */
-
-#ifndef NEW_ADDRESSBOOK_H
-#define NEW_ADDRESSBOOK_H
-
-#include <gtk/gtkwindow.h>
-
-gboolean new_addressbook_dialog (GtkWindow *parent);
-
-#endif
diff --git a/addressbook/gui/component/select-names/e-select-names-manager.c b/addressbook/gui/component/select-names/e-select-names-manager.c
index e095f7308f..a3001efbd1 100644
--- a/addressbook/gui/component/select-names/e-select-names-manager.c
+++ b/addressbook/gui/component/select-names/e-select-names-manager.c
@@ -399,9 +399,20 @@ load_completion_books (ESelectNamesManager *manager)
for (f = folders; f && f->physical_uri; f++) {
EBook *book = e_book_new ();
+ ESourceGroup *group;
+ ESource *source;
+
g_object_ref (manager); /* ref ourself before our async call */
- addressbook_load_uri (book, f->physical_uri, (EBookCallback)open_book_cb, manager);
+ /* FIXME: Store source UIDs in folder list and use those to get sources */
+ group = e_source_group_new ("", f->physical_uri);
+ source = e_source_new ("", "");
+ e_source_set_group (source, group);
+
+ addressbook_load_source (book, source, (EBookCallback)open_book_cb, manager);
+
+ g_object_unref (group);
+ g_object_unref (source);
}
e_folder_list_free_items (folders);
}
diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c
index 4423107fca..b533696cfa 100644
--- a/addressbook/gui/component/select-names/e-select-names.c
+++ b/addressbook/gui/component/select-names/e-select-names.c
@@ -34,7 +34,6 @@
#include <addressbook/gui/widgets/e-addressbook-table-adapter.h>
#include <addressbook/util/eab-book-util.h>
#include <addressbook/gui/component/addressbook-component.h>
-#include <addressbook/gui/component/addressbook-storage.h>
#include <addressbook/gui/component/addressbook.h>
#include <shell/evolution-shell-client.h>
#include <shell/evolution-folder-selector-button.h>
@@ -133,6 +132,8 @@ static void
addressbook_model_set_uri(ESelectNames *e_select_names, EABModel *model, const char *uri)
{
EBook *book;
+ ESourceGroup *group;
+ ESource *source;
/* If uri == the current uri, then we don't have to do anything */
book = eab_model_get_ebook (model);
@@ -147,7 +148,16 @@ addressbook_model_set_uri(ESelectNames *e_select_names, EABModel *model, const c
g_object_ref(e_select_names);
g_object_ref(model);
- addressbook_load_uri(book, uri, (EBookCallback) set_book, e_select_names);
+
+ /* FIXME: Store source UIDs in last_used etc. and use that to get sources */
+ group = e_source_group_new ("", uri);
+ source = e_source_new ("", "");
+ e_source_set_group (source, group);
+
+ addressbook_load_source (book, source, (EBookCallback) set_book, e_select_names);
+
+ g_object_unref (group);
+ g_object_unref (source);
}
static void *