aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui/component')
-rw-r--r--addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in136
-rw-r--r--addressbook/gui/component/Makefile.am130
-rw-r--r--addressbook/gui/component/addressbook-component.c527
-rw-r--r--addressbook/gui/component/addressbook-component.h62
-rw-r--r--addressbook/gui/component/addressbook-config.c1252
-rw-r--r--addressbook/gui/component/addressbook-config.h51
-rw-r--r--addressbook/gui/component/addressbook-migrate.c1213
-rw-r--r--addressbook/gui/component/addressbook-migrate.h31
-rw-r--r--addressbook/gui/component/addressbook-view.c1533
-rw-r--r--addressbook/gui/component/addressbook-view.h63
-rw-r--r--addressbook/gui/component/addressbook.c334
-rw-r--r--addressbook/gui/component/addressbook.h34
-rw-r--r--addressbook/gui/component/apps_evolution_addressbook.schemas.in82
-rw-r--r--addressbook/gui/component/autocompletion-config.c218
-rw-r--r--addressbook/gui/component/autocompletion-config.h32
-rw-r--r--addressbook/gui/component/component-factory.c75
-rw-r--r--addressbook/gui/component/ldap-config.glade1454
-rw-r--r--addressbook/gui/component/openldap-extract.h1426
18 files changed, 0 insertions, 8653 deletions
diff --git a/addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in b/addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in
deleted file mode 100644
index 823d5bd89f..0000000000
--- a/addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in
+++ /dev/null
@@ -1,136 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_Factory:@VERSION@"
- type="shlib"
- location="@COMPONENTDIR_IN_SERVER_FILE@/libevolution-addressbook@SOEXT@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution Address Book"/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_VCard_Control:@VERSION@"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_Factory:@VERSION@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:Bonobo/Control:1.0"/>
- <item value="IDL:Bonobo/PersistStream:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="bonobo:supported_mime_types" type="stringv">
- <item value="text/vcard"/>
- <item value="text/x-vcard"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution Address Book card viewer"/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_Component:@VERSION@"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_Factory:@VERSION@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution/Component:@VERSION@"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution Address Book component"/>
-
- <oaf_attribute name="evolution:component_alias" type="string" value="contacts"/>
-
- <oaf_attribute name="evolution:menu_label" type="string" _value="C_ontacts"/>
- <oaf_attribute name="evolution:menu_accelerator" type="string" value="*Control*2"/>
- <oaf_attribute name="evolution:button_label" type="string" _value="Contacts"/>
- <oaf_attribute name="evolution:button_tooltips" type="string" _value="Contacts"/>
- <oaf_attribute name="evolution:button_sort_order" type="string" value="-9"/>
- <oaf_attribute name="evolution:button_icon" type="string" value="x-office-address-book"/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_AddressWidget:@VERSION@"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_Factory:@VERSION@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:BonoboControl/address-widget:@VERSION@"/>
- <item value="IDL:GNOME/Control:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution Address Book address viewer"/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_AddressPopup:@VERSION@"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_Factory:@VERSION@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:BonoboControl/address-widget:@VERSION@"/>
- <item value="IDL:GNOME/Control:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution Address Book address popup"/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_SMime_CertificateManager_ConfigControl:@VERSION@"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_Factory:@VERSION@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution/ConfigControl:@VERSION@"/>
- </oaf_attribute>
-
- <oaf_attribute name="evolution2:config_item:title" type="string"
- _value="Certificates"/>
-
- <oaf_attribute name="evolution2:config_item:description" type="string"
- _value="Manage your S/MIME certificates here"/>
-
- <oaf_attribute name="evolution2:config_item:icon_name" type="string"
- value="preferences-certificates"/>
-
- <oaf_attribute name="evolution2:config_item:priority" type="string" value="-6"/>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution S/MIME Certificate Management Control"/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_Autocompletion_ConfigControl:@VERSION@"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_Factory:@VERSION@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution/ConfigControl:@VERSION@"/>
- </oaf_attribute>
-
- <oaf_attribute name="evolution2:config_item:title" type="string"
- _value="Autocompletion"/>
-
- <oaf_attribute name="evolution2:config_item:description" type="string"
- _value="Configure autocomplete here"/>
-
- <oaf_attribute name="evolution2:config_item:icon_name" type="string"
- value="preferences-autocompletion"/>
-
- <oaf_attribute name="evolution2:config_item:type" type="stringv">
- <item value="contacts"/>
- </oaf_attribute>
-
- <oaf_attribute name="evolution2:config_item:priority" type="string" value="-9"/>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution folder settings configuration control"/>
-</oaf_server>
-
-</oaf_info>
diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am
deleted file mode 100644
index 6e43acd60c..0000000000
--- a/addressbook/gui/component/Makefile.am
+++ /dev/null
@@ -1,130 +0,0 @@
-if OS_WIN32
-WIN32_BOOTSTRAP_LIBS = $(top_builddir)/win32/libevolution-mail-shared.la
-endif
-
-AM_CPPFLAGS = \
- -DG_LOG_DOMAIN=\"evolution-addressbook\" \
- -I$(top_srcdir) \
- -I$(top_srcdir)/widgets \
- -I$(top_srcdir)/shell \
- -I$(top_builddir)/shell \
- -I$(top_srcdir)/widgets/misc \
- -I$(top_srcdir)/addressbook/util \
- -I$(top_srcdir)/addressbook/gui/contact-editor \
- -I$(top_srcdir)/addressbook/gui/contact-list-editor \
- -I$(top_srcdir)/addressbook/gui/widgets \
- -I$(top_srcdir)/a11y/addressbook \
- -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
- -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
- -DEVOLUTION_UIDIR=\""$(evolutionuidir)"\" \
- -DPREFIX=\""$(prefix)"\" \
- $(LDAP_CFLAGS) \
- $(EVOLUTION_ADDRESSBOOK_CFLAGS)
-
-component_LTLIBRARIES = libevolution-addressbook.la
-
-libevolution_addressbook_la_SOURCES = \
- addressbook-component.c \
- addressbook-component.h \
- addressbook-config.c \
- addressbook-config.h \
- addressbook-migrate.c \
- addressbook-migrate.h \
- autocompletion-config.c \
- autocompletion-config.h \
- addressbook.c \
- addressbook.h \
- addressbook-view.c \
- addressbook-view.h \
- component-factory.c
-
-# $(top_builddir)/addressbook/printing/libecontactprint.la
-
-if ENABLE_SMIME
-SMIME_LIB=$(top_builddir)/smime/gui/libevolution-smime.la
-endif
-
-libevolution_addressbook_la_LIBADD = \
- $(SMIME_LIB) \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/addressbook/printing/libecontactprint.la \
- $(top_builddir)/shell/libeshell.la \
- $(top_builddir)/addressbook/gui/merging/libeabbookmerging.la \
- $(top_builddir)/addressbook/gui/widgets/libeabwidgets.la \
- $(top_builddir)/filter/libfilter.la \
- $(top_builddir)/addressbook/util/libeabutil.la \
- $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.la \
- $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.la \
- $(top_builddir)/widgets/table/libetable.la \
- $(top_builddir)/widgets/text/libetext.la \
- $(top_builddir)/widgets/misc/libemiscwidgets.la \
- $(top_builddir)/widgets/misc/libefilterbar.la \
- $(top_builddir)/widgets/menus/libmenus.la \
- $(top_builddir)/a11y/addressbook/libevolution-addressbook-a11y.la \
- $(top_builddir)/addressbook/importers/libevolution-addressbook-importers.la \
- $(WIN32_BOOTSTRAP_LIBS) \
- $(EVOLUTION_ADDRESSBOOK_LIBS) $(LDAP_LIBS)
-
-
-libevolution_addressbook_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
-
-# GConf schemas
-
-schemadir = $(GCONF_SCHEMA_FILE_DIR)
-schema_in_files = apps_evolution_addressbook.schemas.in
-schema_DATA = $(schema_in_files:.schemas.in=.schemas)
-
-@INTLTOOL_SCHEMAS_RULE@
-
-if OS_WIN32
-install-data-local:
- if test -z "$(DESTDIR)" ; then \
- for p in $(schema_DATA) ; do \
- (echo set GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE); \
- echo $(GCONFTOOL) --makefile-install-rule $$p) >_temp.bat; \
- cmd /c _temp.bat; \
- done \
- fi
-else
-install-data-local:
- if test -z "$(DESTDIR)" ; then \
- for p in $(schema_DATA) ; do \
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $$p; \
- done \
- fi
-endif
-
-server_in_files = GNOME_Evolution_Addressbook.server.in.in
-server_DATA = $(server_in_files:.server.in.in=.server)
-@EVO_SERVER_RULE@
-@INTLTOOL_SERVER_RULE@
-
-glade_DATA = \
- ldap-config.glade
-
-BUILT_SOURCES = $(server_DATA)
-CLEANFILES = $(BUILT_SOURCES)
-
-DISTCLEANFILES = $(schema_DATA)
-
-EXTRA_DIST = \
- $(glade_DATA) \
- $(schema_in_files) \
- $(server_in_files) \
- openldap-extract.h
-
-dist-hook:
- cd $(distdir); rm -f $(BUILT_SOURCES)
-
-if ENABLE_PURIFY
-PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
-
-all-local: evolution-addressbook.pure
-
-evolution-addressbook.pure: evolution-addressbook
- @rm -f evolution-addressbook.pure
- $(PLINK) $(evolution_addressbook_LDFLAGS) $(evolution_addressbook_OBJECTS) $(evolution_addressbook_LDADD) $(LIBS)
-
-endif
-
--include $(top_srcdir)/git.mk
diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c
deleted file mode 100644
index 9bf63376fb..0000000000
--- a/addressbook/gui/component/addressbook-component.c
+++ /dev/null
@@ -1,527 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-/* EPFIXME: Add autocompletion setting. */
-
-#include <config.h>
-
-#include "addressbook-component.h"
-#include "addressbook-config.h"
-#include "addressbook-migrate.h"
-#include "addressbook-view.h"
-#include "addressbook/gui/contact-editor/eab-editor.h"
-#include "addressbook/gui/widgets/eab-gui-util.h"
-#include "e-util/e-plugin.h"
-#include "e-util/e-import.h"
-#include "addressbook/gui/widgets/eab-popup.h"
-#include "addressbook/gui/widgets/eab-menu.h"
-#include "addressbook/gui/widgets/eab-config.h"
-#include "addressbook/importers/evolution-addressbook-importers.h"
-
-#include "misc/e-task-bar.h"
-#include "misc/e-info-label.h"
-
-#include "shell/e-component-view.h"
-
-#include <string.h>
-#include <gtk/gtk.h>
-#include <glib/gi18n-lib.h>
-#include <gconf/gconf-client.h>
-#include <e-util/e-util.h>
-#include <libedataserver/e-url.h>
-
-#ifdef ENABLE_SMIME
-#include "smime/gui/component.h"
-#endif
-
-#define LDAP_BASE_URI "ldap://"
-#define PERSONAL_RELATIVE_URI "system"
-
-#define PARENT_TYPE bonobo_object_get_type ()
-static BonoboObjectClass *parent_class = NULL;
-
-struct _AddressbookComponentPrivate {
- GConfClient *gconf_client;
- gchar *base_directory;
- GList *views;
-};
-
-static void
-ensure_sources (AddressbookComponent *component)
-{
- ESourceList *source_list;
- ESourceGroup *on_this_computer;
- ESource *personal_source;
- gchar *base_uri, *base_uri_proto, base_uri_proto_seventh;
- const gchar *base_dir;
-
- personal_source = NULL;
-
- if (!e_book_get_addressbooks (&source_list, NULL)) {
- g_warning ("Could not get addressbook source list from GConf!");
- return;
- }
-
- base_dir = addressbook_component_peek_base_directory (component);
- base_uri = g_build_filename (base_dir, "local", NULL);
-
- base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
- if (strlen (base_uri_proto) >= 7) {
- /* compare only file:// part. If user home dir name changes we do not want to create
- one more group */
- base_uri_proto_seventh = base_uri_proto[7];
- base_uri_proto[7] = 0;
- } else {
- base_uri_proto_seventh = -1;
- }
-
- on_this_computer = e_source_list_ensure_group (source_list, _("On This Computer"), base_uri_proto, TRUE);
- e_source_list_ensure_group (source_list, _("On LDAP Servers"), LDAP_BASE_URI, FALSE);
-
- if (base_uri_proto_seventh != -1) {
- base_uri_proto[7] = base_uri_proto_seventh;
- }
-
- if (on_this_computer) {
- /* make sure "Personal" shows up as a source under
- this group */
- GSList *sources = e_source_group_peek_sources (on_this_computer);
- GSList *s;
- for (s = sources; s; s = s->next) {
- ESource *source = E_SOURCE (s->data);
- const gchar *relative_uri;
-
- relative_uri = e_source_peek_relative_uri (source);
- if (relative_uri == NULL)
- continue;
- if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) {
- personal_source = source;
- break;
- }
- }
- /* Make sure we have the correct base uri. This can change when user's
- homedir name changes */
- if (strcmp (base_uri_proto, e_source_group_peek_base_uri (on_this_computer))) {
- e_source_group_set_base_uri (on_this_computer, base_uri_proto);
-
- /* *sigh* . We shouldn't need this sync call here as set_base_uri
- call results in synching to gconf, but that happens in idle loop
- and too late to prevent user seeing "Can not Open ... because of invalid uri" error.*/
- e_source_list_sync (source_list,NULL);
- }
- }
-
- if (personal_source) {
- /* ensure the source name is in current locale, not read from configuration */
- e_source_set_name (personal_source, _("Personal"));
- } else {
- /* Create the default Person addressbook */
- ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
- e_source_group_add_source (on_this_computer, source, -1);
- g_object_unref (source);
-
- e_source_set_property (source, "completion", "true");
-
- personal_source = source;
- }
-
- g_object_unref (on_this_computer);
- g_free (base_uri_proto);
- g_free (base_uri);
-}
-
-static void
-view_destroyed_cb (gpointer data, GObject *where_the_object_was)
-{
- AddressbookComponent *addressbook_component = data;
- AddressbookComponentPrivate *priv;
- GList *l;
-
- priv = addressbook_component->priv;
-
- for (l = priv->views; l; l = l->next) {
- AddressbookView *view = l->data;
- if (G_OBJECT (view) == where_the_object_was) {
- priv->views = g_list_remove (priv->views, view);
- break;
- }
- }
-}
-
-/* Evolution::Component CORBA methods. */
-
-static GNOME_Evolution_ComponentView
-impl_createView (PortableServer_Servant servant,
- GNOME_Evolution_ShellView parent,
- CORBA_boolean select_item,
- CORBA_Environment *ev)
-{
- AddressbookComponent *addressbook_component = ADDRESSBOOK_COMPONENT (bonobo_object_from_servant (servant));
- AddressbookComponentPrivate *priv = addressbook_component->priv;
- AddressbookView *view = addressbook_view_new ();
- EComponentView *component_view;
-
- g_object_weak_ref (G_OBJECT (view), view_destroyed_cb, addressbook_component);
- priv->views = g_list_append (priv->views, view);
-
- component_view = e_component_view_new_controls (parent, "contacts",
- bonobo_control_new (addressbook_view_peek_sidebar (view)),
- addressbook_view_peek_folder_view (view),
- bonobo_control_new (addressbook_view_peek_statusbar (view)));
-
- return BONOBO_OBJREF(component_view);
-
-}
-
-static GNOME_Evolution_CreatableItemTypeList *
-impl__get_userCreatableItems (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- GNOME_Evolution_CreatableItemTypeList *list = GNOME_Evolution_CreatableItemTypeList__alloc ();
-
- list->_length = 3;
- list->_maximum = list->_length;
- list->_buffer = GNOME_Evolution_CreatableItemTypeList_allocbuf (list->_length);
-
- CORBA_sequence_set_release (list, FALSE);
-
- list->_buffer[0].id = (gchar *) "contact";
- list->_buffer[0].description = _("New Contact");
- list->_buffer[0].menuDescription = (gchar *) C_("New", "_Contact");
- list->_buffer[0].tooltip = _("Create a new contact");
- list->_buffer[0].menuShortcut = 'c';
- list->_buffer[0].iconName = (gchar *) "contact-new";
- list->_buffer[0].type = GNOME_Evolution_CREATABLE_OBJECT;
-
- list->_buffer[1].id = (gchar *) "contact_list";
- list->_buffer[1].description = _("New Contact List");
- list->_buffer[1].menuDescription = (gchar *) C_("New", "Contact _List");
- list->_buffer[1].tooltip = _("Create a new contact list");
- list->_buffer[1].menuShortcut = 'l';
- list->_buffer[1].iconName = (gchar *) "stock_contact-list";
- list->_buffer[1].type = GNOME_Evolution_CREATABLE_OBJECT;
-
- list->_buffer[2].id = (gchar *) "address_book";
- list->_buffer[2].description = _("New Address Book");
- list->_buffer[2].menuDescription = (gchar *) C_("New", "Address _Book");
- list->_buffer[2].tooltip = _("Create a new address book");
- list->_buffer[2].menuShortcut = '\0';
- list->_buffer[2].iconName = (gchar *) "address-book-new";
- list->_buffer[2].type = GNOME_Evolution_CREATABLE_FOLDER;
-
- return list;
-}
-
-static void
-book_loaded_cb (EBook *book, EBookStatus status, gpointer data)
-{
- EContact *contact;
- gchar *item_type_name = data;
-
- if (status != E_BOOK_ERROR_OK) {
- /* XXX we really need a dialog here, but we don't have
- access to the ESource so we can't use
- eab_load_error_dialog. fun! */
- return;
- }
-
- contact = e_contact_new ();
-
- if (!strcmp (item_type_name, "contact")) {
- eab_show_contact_editor (book, contact, TRUE, TRUE);
- }
- else if (!strcmp (item_type_name, "contact_list")) {
- eab_show_contact_list_editor (book, contact, TRUE, TRUE);
- }
-
- g_object_unref (book);
- g_object_unref (contact);
-
- g_free (item_type_name);
-}
-
-static void
-impl_requestCreateItem (PortableServer_Servant servant,
- const CORBA_char *item_type_name,
- CORBA_Environment *ev)
-{
- EBook *book;
- GConfClient *gconf_client;
- ESourceList *source_list;
- gchar *uid;
-
- if (!item_type_name ||
- (strcmp (item_type_name, "address_book") &&
- strcmp (item_type_name, "contact") &&
- strcmp (item_type_name, "contact_list"))) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_UnknownType, NULL);
- return;
- }
-
- if (!strcmp (item_type_name, "address_book")) {
- addressbook_config_create_new_source (NULL);
- return;
- }
-
- gconf_client = gconf_client_get_default();
- uid = gconf_client_get_string (gconf_client, "/apps/evolution/addressbook/display/primary_addressbook",
- NULL);
- g_object_unref (gconf_client);
- if (!e_book_get_addressbooks (&source_list, NULL)) {
- g_warning ("Could not get addressbook source list from GConf!");
- g_free (uid);
- return;
- }
- if (uid) {
- ESource *source = e_source_list_peek_source_by_uid(source_list, uid);
- if (source) {
- book = e_book_new (source, NULL);
- }
- else {
- book = e_book_new_default_addressbook (NULL);
- }
- g_free (uid);
- }
- else {
- book = e_book_new_default_addressbook (NULL);
- }
-
- e_book_async_open (book, FALSE, book_loaded_cb, g_strdup (item_type_name));
-}
-
-static void
-impl_handleURI (PortableServer_Servant servant,
- const gchar * uri,
- CORBA_Environment *ev)
-{
- AddressbookComponent *addressbook_component = ADDRESSBOOK_COMPONENT (bonobo_object_from_servant (servant));
- AddressbookComponentPrivate *priv;
- AddressbookView *view = NULL;
-
- GList *l;
- gchar *src_uid = NULL;
- gchar *contact_uid = NULL;
-
- priv = addressbook_component->priv;
- l = g_list_last (priv->views);
- if (!l)
- return;
-
- view = l->data;
-
- if (!strncmp (uri, "contacts:", 9)) {
- EUri *euri = e_uri_new (uri);
- const gchar *p;
- gchar *header, *content;
- gsize len, clen;
-
- p = euri->query;
- if (p) {
- while (*p) {
- len = strcspn (p, "=&");
-
- /* If it's malformed, give up. */
- if (p[len] != '=')
- break;
-
- header = (gchar *) p;
- header[len] = '\0';
- p += len + 1;
-
- clen = strcspn (p, "&");
-
- content = g_strndup (p, clen);
-
- if (!g_ascii_strcasecmp (header, "source-uid")) {
- src_uid = g_strdup (content);
- } else if (!g_ascii_strcasecmp (header, "contact-uid")) {
- contact_uid = g_strdup (content);
- }
-
- g_free (content);
-
- p += clen;
- if (*p == '&') {
- p++;
- if (!strcmp (p, "amp;"))
- p += 4;
- }
- }
-
- addressbook_view_edit_contact (view, src_uid, contact_uid);
-
- g_free (src_uid);
- g_free (contact_uid);
- }
- e_uri_free (euri);
- }
-
-}
-
-static void
-impl_upgradeFromVersion (PortableServer_Servant servant, short major, short minor, short revision, CORBA_Environment *ev)
-{
- GError *err = NULL;
-
- if (!addressbook_migrate (addressbook_component_peek (), major, minor, revision, &err)) {
- GNOME_Evolution_Component_UpgradeFailed *failedex;
-
- failedex = GNOME_Evolution_Component_UpgradeFailed__alloc();
- failedex->what = CORBA_string_dup(_("Failed upgrading Address Book settings or folders."));
- failedex->why = CORBA_string_dup(err->message);
- CORBA_exception_set(ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_UpgradeFailed, failedex);
- }
-
- if (err)
- g_error_free(err);
-}
-
-static CORBA_boolean
-impl_requestQuit (PortableServer_Servant servant, CORBA_Environment *ev)
-{
- return eab_editor_request_close_all ();
-}
-
-/* GObject methods. */
-
-static void
-impl_dispose (GObject *object)
-{
- AddressbookComponentPrivate *priv = ADDRESSBOOK_COMPONENT (object)->priv;
- GList *l;
-
- if (priv->gconf_client != NULL) {
- g_object_unref (priv->gconf_client);
- priv->gconf_client = NULL;
- }
-
- for (l = priv->views; l; l = l->next) {
- AddressbookView *view = l->data;
- g_object_weak_unref (G_OBJECT (view), view_destroyed_cb, ADDRESSBOOK_COMPONENT (object));
- }
- g_list_free (priv->views);
- priv->views = NULL;
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-static void
-impl_finalize (GObject *object)
-{
- AddressbookComponentPrivate *priv = ADDRESSBOOK_COMPONENT (object)->priv;
-
- g_free (priv);
-
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-/* Initialization. */
-
-static void
-addressbook_component_class_init (AddressbookComponentClass *class)
-{
- POA_GNOME_Evolution_Component__epv *epv = &class->epv;
- GObjectClass *object_class = G_OBJECT_CLASS (class);
-
- bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-
- epv->createView = impl_createView;
- epv->_get_userCreatableItems = impl__get_userCreatableItems;
- epv->requestCreateItem = impl_requestCreateItem;
- epv->upgradeFromVersion = impl_upgradeFromVersion;
- epv->requestQuit = impl_requestQuit;
- epv->handleURI = impl_handleURI;
-
- object_class->dispose = impl_dispose;
- object_class->finalize = impl_finalize;
-
- parent_class = g_type_class_peek_parent (class);
-}
-
-static void
-addressbook_component_init (AddressbookComponent *component)
-{
- AddressbookComponentPrivate *priv;
- static gint first = TRUE;
-
- priv = g_new0 (AddressbookComponentPrivate, 1);
-
- /* EPFIXME: Should use a custom one instead? */
- priv->gconf_client = gconf_client_get_default ();
-
- priv->base_directory = g_build_filename (e_get_user_data_dir (), "addressbook", NULL);
-
- component->priv = priv;
-
- ensure_sources (component);
-
-#ifdef ENABLE_SMIME
- smime_component_init ();
-#endif
-
- if (first) {
- EImportClass *klass;
-
- first = FALSE;
- e_plugin_hook_register_type(eab_popup_hook_get_type());
- e_plugin_hook_register_type(eab_menu_hook_get_type());
- e_plugin_hook_register_type(eab_config_hook_get_type());
-
- klass = g_type_class_ref(e_import_get_type());
- e_import_class_add_importer(klass, evolution_ldif_importer_peek(), NULL, NULL);
- e_import_class_add_importer(klass, evolution_vcard_importer_peek(), NULL, NULL);
- e_import_class_add_importer(klass, evolution_csv_outlook_importer_peek(), NULL, NULL);
- e_import_class_add_importer(klass, evolution_csv_mozilla_importer_peek(), NULL, NULL);
- e_import_class_add_importer(klass, evolution_csv_evolution_importer_peek(), NULL, NULL);
- }
-}
-
-/* Public API. */
-
-AddressbookComponent *
-addressbook_component_peek (void)
-{
- static AddressbookComponent *component = NULL;
-
- if (component == NULL)
- component = g_object_new (addressbook_component_get_type (), NULL);
-
- return component;
-}
-
-GConfClient*
-addressbook_component_peek_gconf_client (AddressbookComponent *component)
-{
- g_return_val_if_fail (ADDRESSBOOK_IS_COMPONENT (component), NULL);
-
- return component->priv->gconf_client;
-}
-
-const gchar *
-addressbook_component_peek_base_directory (AddressbookComponent *component)
-{
- g_return_val_if_fail (ADDRESSBOOK_IS_COMPONENT (component), NULL);
-
- return component->priv->base_directory;
-}
-
-BONOBO_TYPE_FUNC_FULL (AddressbookComponent, GNOME_Evolution_Component, PARENT_TYPE, addressbook_component)
diff --git a/addressbook/gui/component/addressbook-component.h b/addressbook/gui/component/addressbook-component.h
deleted file mode 100644
index e5119295b3..0000000000
--- a/addressbook/gui/component/addressbook-component.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _ADDRESSBOOK_COMPONENT_H_
-#define _ADDRESSBOOK_COMPONENT_H_
-
-#include <bonobo/bonobo-object.h>
-
-#include "Evolution.h"
-#include "e-activity-handler.h"
-#include <libedataserver/e-source-list.h>
-
-#define ADDRESSBOOK_TYPE_COMPONENT (addressbook_component_get_type ())
-#define ADDRESSBOOK_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ADDRESSBOOK_TYPE_COMPONENT, AddressbookComponent))
-#define ADDRESSBOOK_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ADDRESSBOOK_TYPE_COMPONENT, AddressbookComponentClass))
-#define ADDRESSBOOK_IS_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ADDRESSBOOK_TYPE_COMPONENT))
-#define ADDRESSBOOK_IS_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), ADDRESSBOOK_TYPE_COMPONENT))
-
-typedef struct _AddressbookComponent AddressbookComponent;
-typedef struct _AddressbookComponentPrivate AddressbookComponentPrivate;
-typedef struct _AddressbookComponentClass AddressbookComponentClass;
-
-struct _AddressbookComponent {
- BonoboObject parent;
-
- AddressbookComponentPrivate *priv;
-};
-
-struct _AddressbookComponentClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_Component__epv epv;
-};
-
-GType addressbook_component_get_type (void);
-
-AddressbookComponent *addressbook_component_peek (void);
-
-GConfClient *addressbook_component_peek_gconf_client (AddressbookComponent *component);
-const gchar *addressbook_component_peek_base_directory (AddressbookComponent *component);
-
-#endif /* _ADDRESSBOOK_COMPONENT_H_ */
diff --git a/addressbook/gui/component/addressbook-config.c b/addressbook/gui/component/addressbook-config.c
deleted file mode 100644
index 248a9de9ea..0000000000
--- a/addressbook/gui/component/addressbook-config.c
+++ /dev/null
@@ -1,1252 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Chris Toshok <toshok@ximian.com>
- * Chris Lahey <clahey@ximian.com>
- * Michael Zucchi <notzed@ximian.com>
- * And no doubt others ...
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-/*#define STANDALONE*/
-
-#include <config.h>
-
-#include <string.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-
-#include <bonobo/bonobo-generic-factory.h>
-
-#ifdef G_OS_WIN32
-/* Include <windows.h> early and work around DATADIR lossage */
-#define DATADIR crap_DATADIR
-#include <windows.h>
-#undef DATADIR
-#endif
-
-#include <glade/glade.h>
-
-#include "addressbook.h"
-#include "addressbook-component.h"
-#include "addressbook-config.h"
-
-#include "e-util/e-error.h"
-#include "e-util/e-util-private.h"
-
-#include "addressbook/gui/widgets/eab-config.h"
-
-#define d(x)
-
-#ifdef HAVE_LDAP
-#ifndef G_OS_WIN32
-#include <ldap.h>
-#ifndef SUNLDAP
-#include <ldap_schema.h>
-#endif
-#else
-#include <winldap.h>
-#include "openldap-extract.h"
-#endif
-#endif
-
-#define LDAP_PORT_STRING "389"
-#define LDAPS_PORT_STRING "636"
-
-#define GLADE_FILE_NAME "ldap-config.glade"
-#define CONFIG_CONTROL_FACTORY_ID "OAFIID:GNOME_Evolution_Addressbook_ConfigControlFactory:" BASE_VERSION
-#define LDAP_CONFIG_CONTROL_ID "OAFIID:GNOME_Evolution_LDAPStorage_ConfigControl:" BASE_VERSION
-
-GtkWidget* supported_bases_create_table (gchar *name, gchar *string1, gchar *string2,
- gint num1, gint num2);
-
-/* default objectclasses */
-#define TOP "top"
-#define PERSON "person"
-#define ORGANIZATIONALPERSON "organizationalPerson"
-#define INETORGPERSON "inetOrgPerson"
-#define EVOLUTIONPERSON "evolutionPerson"
-#define CALENTRY "calEntry"
-
-
-typedef struct _AddressbookSourceDialog AddressbookSourceDialog;
-
-struct _AddressbookSourceDialog {
- GladeXML *gui;
-
- EABConfig *config; /* the config manager */
-
- GtkWidget *window;
-
- /* Source selection (druid only) */
- ESourceList *source_list;
- GSList *menu_source_groups;
-
- /* ESource we're currently editing */
- ESource *source;
- /* The original source in edit mode. Also used to flag when we are in edit mode. */
- ESource *original_source;
-
- /* Source group we're creating/editing a source in */
- ESourceGroup *source_group;
-
- /* info page fields */
- GtkWidget *host;
- GtkWidget *auth_combobox;
- AddressbookLDAPAuthType auth;
- GtkWidget *auth_principal;
-
- /* connecting page fields */
- GtkWidget *port_comboentry;
- GtkWidget *ssl_combobox;
- AddressbookLDAPSSLType ssl;
-
- /* searching page fields */
- GtkWidget *rootdn;
- AddressbookLDAPScopeType scope;
- GtkWidget *scope_combobox;
- GtkWidget *search_filter;
- GtkWidget *timeout_scale;
- GtkWidget *limit_spinbutton;
- GtkWidget *canbrowsecheck;
-
- /* display name page fields */
- GtkWidget *display_name;
-};
-
-
-
-#ifdef HAVE_LDAP
-
-static const gchar *
-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_return_val_if_reached ("none");
- }
-}
-
-static AddressbookLDAPAuthType
-ldap_parse_auth (const gchar *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 const gchar *
-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_return_val_if_reached ("");
- }
-}
-
-static const gchar *
-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_return_val_if_reached ("");
- }
-}
-
-static AddressbookLDAPSSLType
-ldap_parse_ssl (const gchar *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;
-}
-
-static const gchar *
-ldap_get_ssl_tooltip (AddressbookLDAPSSLType ssl_type)
-{
- switch (ssl_type) {
- case ADDRESSBOOK_LDAP_SSL_ALWAYS:
- return _("Selecting this option means that Evolution will only connect to your LDAP server if your LDAP server supports SSL.");
- case ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE:
- return _("Selecting this option means that Evolution will only connect to your LDAP server if your LDAP server supports TLS.");
- case ADDRESSBOOK_LDAP_SSL_NEVER:
- return _("Selecting this option means that your server does not support either SSL or TLS. This means that your connection will be insecure, and that you will be vulnerable to security exploits.");
- }
-
- return NULL;
-}
-
-static gboolean
-source_to_uri_parts (ESource *source, gchar **host, gchar **rootdn, AddressbookLDAPScopeType *scope, gchar **search_filter, gint *port)
-{
- gchar *uri;
- LDAPURLDesc *lud;
- gint ldap_error;
-
- g_return_val_if_fail (source, FALSE);
-
- 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;
- if (search_filter && lud->lud_filter)
- *search_filter = g_strdup (lud->lud_filter);
-
- ldap_free_urldesc (lud);
- return TRUE;
-}
-
-static gboolean
-source_group_is_remote (ESourceGroup *group)
-{
- return strncmp ("ldap:", e_source_group_peek_base_uri (group), 5) == 0;
-}
-
-/* ldap api foo */
-static LDAP *
-addressbook_ldap_init (GtkWidget *window, ESource *source)
-{
- LDAP *ldap;
- gchar *host;
- gint port;
- gint ldap_error;
- gint protocol_version = LDAP_VERSION3;
-
- if (!source_to_uri_parts (source, &host, NULL, NULL, NULL, &port))
- return NULL;
-
- if (!(ldap = ldap_init (host, port))) {
- e_error_run ((GtkWindow *) window, "addressbook:ldap-init", NULL);
- goto done;
- }
-
- ldap_error = ldap_set_option (ldap, LDAP_OPT_PROTOCOL_VERSION, &protocol_version);
- if (LDAP_SUCCESS != ldap_error)
- g_warning ("failed to set protocol version to LDAPv3");
-
- /* XXX do TLS if it's configured in */
-
- done:
- g_free (host);
- return ldap;
-}
-
-static gint
-addressbook_ldap_auth (GtkWidget *window, LDAP *ldap)
-{
- gint ldap_error;
-
- /* XXX use auth info from source */
- ldap_error = ldap_simple_bind_s (ldap, NULL, NULL);
- if (LDAP_SUCCESS != ldap_error)
- e_error_run ((GtkWindow *) window, "addressbook:ldap-auth", NULL);
-
- return ldap_error;
-}
-
-static gint
-addressbook_root_dse_query (AddressbookSourceDialog *dialog, LDAP *ldap,
- const gchar **attrs, LDAPMessage **resp)
-{
- gint ldap_error;
- struct timeval timeout;
-
- timeout.tv_sec = (gint) gtk_adjustment_get_value (GTK_RANGE(dialog->timeout_scale)->adjustment);
- timeout.tv_usec = 0;
-
- ldap_error = ldap_search_ext_s (ldap,
- LDAP_ROOT_DSE, LDAP_SCOPE_BASE,
- "(objectclass=*)",
- (gchar **) attrs, 0, NULL, NULL, &timeout, LDAP_NO_LIMIT, resp);
- if (LDAP_SUCCESS != ldap_error)
- e_error_run (GTK_WINDOW (dialog->window), "addressbook:ldap-search-base", NULL);
-
- return ldap_error;
-}
-
-/* searching page */
-GtkWidget*
-supported_bases_create_table (gchar *name, gchar *string1, gchar *string2, gint num1, gint num2)
-{
- GtkWidget *table, *scrolled;
- GtkTreeSelection *selection;
- GtkCellRenderer *renderer;
- GtkListStore *model;
-
- scrolled = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled), GTK_SHADOW_IN);
-
- model = gtk_list_store_new (1, G_TYPE_STRING);
- table = gtk_tree_view_new_with_model ((GtkTreeModel *) model);
- g_object_unref (model);
- renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_insert_column_with_attributes ((GtkTreeView *) table, -1, _("Base"), renderer, "text", 0, NULL);
- gtk_tree_view_set_headers_visible ((GtkTreeView *) table, FALSE);
- selection = gtk_tree_view_get_selection ((GtkTreeView *) table);
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
-
- gtk_container_add (GTK_CONTAINER (scrolled), table);
- g_object_set_data((GObject *)scrolled, "table", table);
-
- return scrolled;
-}
-
-static gboolean
-do_ldap_root_dse_query (AddressbookSourceDialog *sdialog, GtkListStore *model, ESource *source)
-{
- LDAP *ldap;
- const gchar *attrs[2];
- gint ldap_error;
- gchar **values;
- LDAPMessage *resp;
- gint i;
-
- ldap = addressbook_ldap_init (sdialog->window, source);
- if (!ldap)
- return FALSE;
-
- if (LDAP_SUCCESS != addressbook_ldap_auth (sdialog->window, ldap))
- goto fail;
-
- attrs[0] = "namingContexts";
- attrs[1] = NULL;
-
- ldap_error = addressbook_root_dse_query (sdialog, ldap, attrs, &resp);
-
- if (ldap_error != LDAP_SUCCESS)
- goto fail;
-
- values = ldap_get_values (ldap, resp, "namingContexts");
- if (!values || values[0] == NULL || strlen (values[0]) == 0) {
- e_error_run (GTK_WINDOW (sdialog->window), "addressbook:ldap-search-base", NULL);
- goto fail;
- }
-
- for (i = 0; values[i]; i++) {
- GtkTreeIter iter;
-
- gtk_list_store_append (model, &iter);
- gtk_list_store_set (model, &iter, 0, values[i], -1);
- }
-
- ldap_value_free (values);
- ldap_unbind_s (ldap);
- return TRUE;
-
- fail:
- ldap_unbind_s (ldap);
- return FALSE;
-}
-
-static void
-search_base_selection_model_changed (GtkTreeSelection *selection, GtkWidget *dialog)
-{
- gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
- GTK_RESPONSE_OK,
- gtk_tree_selection_get_selected(selection, NULL, NULL));
-}
-
-static void
-query_for_supported_bases (GtkWidget *button, AddressbookSourceDialog *sdialog)
-{
- GtkTreeSelection *selection;
- GtkTreeModel *model;
- GtkTreeView *table;
- GtkWidget *dialog;
- GtkWidget *supported_bases_table;
- GladeXML *gui;
- GtkTreeIter iter;
- gchar *gladefile;
-
- gladefile = g_build_filename (EVOLUTION_GLADEDIR,
- GLADE_FILE_NAME,
- NULL);
- gui = glade_xml_new (gladefile, "supported-bases-dialog", NULL);
- g_free (gladefile);
-
- dialog = glade_xml_get_widget (gui, "supported-bases-dialog");
-
- gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (sdialog->window));
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
-
- gtk_widget_ensure_style (dialog);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 12);
-
- supported_bases_table = glade_xml_get_widget (gui, "supported-bases-table");
- gtk_widget_show_all (supported_bases_table);
-
- table = g_object_get_data (G_OBJECT (supported_bases_table), "table");
- model = gtk_tree_view_get_model (table);
- selection = gtk_tree_view_get_selection (table);
- g_signal_connect (selection, "changed", G_CALLBACK (search_base_selection_model_changed), dialog);
- search_base_selection_model_changed (selection, dialog);
-
- if (do_ldap_root_dse_query (sdialog, GTK_LIST_STORE (model), sdialog->source)) {
- gtk_widget_show (dialog);
-
- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK
- && gtk_tree_selection_get_selected (selection, &model, &iter)) {
- gchar *dn;
-
- gtk_tree_model_get (model, &iter, 0, &dn, -1);
- gtk_entry_set_text((GtkEntry *)sdialog->rootdn, dn);
- g_free(dn);
- }
- }
-
- gtk_widget_destroy (dialog);
-}
-
-#endif /* HAVE_LDAP */
-
-GtkWidget*
-addressbook_config_create_new_source (GtkWidget *parent)
-{
- return addressbook_config_edit_source(parent, NULL);
-}
-
-/* ********************************************************************** */
-
-static void
-eabc_type_changed(GtkComboBox *dropdown, AddressbookSourceDialog *sdialog)
-{
- gint id = gtk_combo_box_get_active(dropdown);
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- model = gtk_combo_box_get_model(dropdown);
- if (id == -1 || !gtk_tree_model_iter_nth_child(model, &iter, NULL, id))
- return;
-
- /* TODO: when we change the group type, we lose all of the pre-filled dialog info */
-
- gtk_tree_model_get(model, &iter, 1, &sdialog->source_group, -1);
- /* HACK: doesn't work if you don't do this */
- e_source_set_absolute_uri(sdialog->source, NULL);
- e_source_set_group(sdialog->source, sdialog->source_group);
-
- /* BIG HACK: We load the defaults for each type here.
- I guess plugins will have to use the do it in their factory callbacks */
- if (!strncmp(e_source_group_peek_base_uri(sdialog->source_group), "groupwise:", 10)) {
- GSList *l;
- ESource *source;
- gchar *tmp;
-
- l = e_source_group_peek_sources(sdialog->source_group);
- if (l && l->data ) {
- source = l->data;
- e_source_set_property(sdialog->source, "auth", e_source_get_property(source, "auth"));
- e_source_set_property(sdialog->source, "user", e_source_get_property(source, "user"));
- e_source_set_property(sdialog->source, "user_ssl", e_source_get_property(source, "use_ssl"));
- }
-
- e_source_set_property(sdialog->source, "auth-domain", "Groupwise");
- tmp = g_strconcat (";", e_source_peek_name(sdialog->source), NULL);
- e_source_set_relative_uri (sdialog->source, tmp);
- g_free (tmp);
-#ifdef HAVE_LDAP
- } else if (!strncmp(e_source_group_peek_base_uri(sdialog->source_group), "ldap:", 5)) {
- gchar *tmp;
-
- tmp = g_strdup_printf ("%s:%s/%s?" /* trigraph prevention */ "?%s",
- "", LDAP_PORT_STRING,
- "",
- "one");
- e_source_set_relative_uri (sdialog->source, tmp);
- g_free (tmp);
- e_source_set_property(sdialog->source, "timeout", "3");
- e_source_set_property(sdialog->source, "limit", "100");
-#endif
- } else {
- e_source_set_relative_uri (sdialog->source, e_source_peek_uid (sdialog->source));
- }
-
- e_config_target_changed((EConfig *)sdialog->config, E_CONFIG_TARGET_CHANGED_REBUILD);
-}
-
-static GtkWidget *
-eabc_general_type(EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data)
-{
- AddressbookSourceDialog *sdialog = data;
- GtkComboBox *dropdown;
- GtkCellRenderer *cell;
- GtkListStore *store;
- GtkTreeIter iter;
- GSList *l;
- GtkWidget *w, *label;
- gint i, row = 0;
-
- if (old)
- return old;
-
- w = gtk_hbox_new(FALSE, 6);
- label = gtk_label_new_with_mnemonic(_("_Type:"));
- gtk_box_pack_start((GtkBox *)w, label, FALSE, FALSE, 0);
-
- dropdown = (GtkComboBox *)gtk_combo_box_new();
- cell = gtk_cell_renderer_text_new();
- store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_POINTER);
- i = 0;
- for (l=sdialog->menu_source_groups;l;l=g_slist_next(l)) {
- ESourceGroup *group = l->data;
-
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter, 0, e_source_group_peek_name(group), 1, group, -1);
- if (e_source_peek_group(sdialog->source) == group)
- row = i;
- i++;
- }
-
- gtk_cell_layout_pack_start((GtkCellLayout *)dropdown, cell, TRUE);
- gtk_cell_layout_set_attributes((GtkCellLayout *)dropdown, cell, "text", 0, NULL);
- gtk_combo_box_set_model(dropdown, (GtkTreeModel *)store);
- gtk_combo_box_set_active(dropdown, -1);
- gtk_combo_box_set_active(dropdown, row);
- g_signal_connect(dropdown, "changed", G_CALLBACK(eabc_type_changed), sdialog);
- gtk_widget_show((GtkWidget *)dropdown);
- gtk_box_pack_start((GtkBox *)w, (GtkWidget *)dropdown, TRUE, TRUE, 0);
- gtk_label_set_mnemonic_widget((GtkLabel *)label, (GtkWidget *)dropdown);
-
- gtk_box_pack_start((GtkBox *)parent, (GtkWidget *)w, FALSE, FALSE, 0);
-
- gtk_widget_show_all(w);
-
- return (GtkWidget *)w;
-}
-
-static void
-name_changed_cb(GtkWidget *w, AddressbookSourceDialog *sdialog)
-{
- e_source_set_name (sdialog->source, gtk_entry_get_text (GTK_ENTRY (sdialog->display_name)));
-}
-
-static void
-offline_status_changed_cb (GtkWidget *widget, AddressbookSourceDialog *sdialog)
-{
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
- e_source_set_property (sdialog->source, "offline_sync", "1");
- else
- e_source_set_property (sdialog->source, "offline_sync", "0");
-
-}
-
-static GtkWidget *
-eabc_general_name(EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data)
-{
- AddressbookSourceDialog *sdialog = data;
- const gchar *uri;
- GtkWidget *w;
- GladeXML *gui;
- gchar *gladefile;
-
- if (old)
- return old;
-
- gladefile = g_build_filename (EVOLUTION_GLADEDIR,
- GLADE_FILE_NAME,
- NULL);
- gui = glade_xml_new (gladefile, item->label, NULL);
- g_free (gladefile);
-
- w = glade_xml_get_widget(gui, item->label);
- gtk_box_pack_start((GtkBox *)parent, w, FALSE, FALSE, 0);
-
- sdialog->display_name = glade_xml_get_widget (gui, "account-editor-display-name-entry");
- g_signal_connect(sdialog->display_name, "changed", G_CALLBACK(name_changed_cb), sdialog);
- gtk_entry_set_text((GtkEntry *)sdialog->display_name, e_source_peek_name(sdialog->source));
-
- /* Hardcoded: groupwise can't edit the name (or anything else) */
- if (sdialog->original_source) {
- uri = e_source_group_peek_base_uri (sdialog->source_group);
- if (uri && strncmp(uri, "groupwise:", 10) == 0) {
- gtk_widget_set_sensitive (GTK_WIDGET(sdialog->display_name), FALSE);
- }
- }
-
- g_object_unref(gui);
-
- return w;
-}
-
-static GtkWidget *
-eabc_general_offline(EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data)
-{
- AddressbookSourceDialog *sdialog = data;
- GtkWidget *offline_setting;
- const gchar *offline_sync;
- gboolean is_local_book;
-
- is_local_book = g_str_has_prefix (e_source_group_peek_base_uri (sdialog->source_group), "file:");
- offline_sync = e_source_get_property (sdialog->source, "offline_sync");
- if (old)
- return old;
- else {
- offline_setting = gtk_check_button_new_with_mnemonic (_("Copy _book content locally for offline operation"));
- gtk_widget_show (offline_setting);
- gtk_container_add (GTK_CONTAINER (parent), offline_setting);
- g_signal_connect (offline_setting, "toggled", G_CALLBACK (offline_status_changed_cb), sdialog);
-
- }
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (offline_setting), (offline_sync && g_str_equal (offline_sync, "1")) ? TRUE : FALSE);
- if (is_local_book)
- gtk_widget_hide (offline_setting);
- return offline_setting;
-
-}
-
-#ifdef HAVE_LDAP
-static gchar *
-form_ldap_search_filter (GtkWidget *w)
-{
- gchar *filter;
- const gchar *search_filter = gtk_entry_get_text ((GtkEntry *) w);
-
- /* this function can be used to format the search filter entered */
- if ((strlen (search_filter) !=0) && *search_filter != '(' && *(search_filter + (strlen (search_filter-1))) != ')')
- filter = g_strdup_printf ("(%s)", search_filter);
- else
- filter = g_strdup_printf ("%s", search_filter);
-
- return filter;
-}
-
-static void
-url_changed(AddressbookSourceDialog *sdialog)
-{
- gchar *str, *search_filter;
-
- search_filter = form_ldap_search_filter (sdialog->search_filter);
- str = g_strdup_printf ("%s:%s/%s?" /* trigraph prevention */ "?%s?%s",
- gtk_entry_get_text (GTK_ENTRY (sdialog->host)),
- gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (sdialog->port_comboentry)))),
- gtk_entry_get_text (GTK_ENTRY (sdialog->rootdn)),
- ldap_unparse_scope (sdialog->scope),
- search_filter);
- e_source_set_relative_uri (sdialog->source, str);
- g_free (search_filter);
- g_free (str);
-}
-
-static void
-host_changed_cb(GtkWidget *w, AddressbookSourceDialog *sdialog)
-{
- url_changed(sdialog);
-}
-
-static void
-port_entry_changed_cb(GtkWidget *w, AddressbookSourceDialog *sdialog)
-{
- const gchar *port = gtk_entry_get_text((GtkEntry *)w);
-
- if (!strcmp (port, LDAPS_PORT_STRING)) {
- sdialog->ssl = ADDRESSBOOK_LDAP_SSL_ALWAYS;
- gtk_combo_box_set_active (GTK_COMBO_BOX (sdialog->ssl_combobox), sdialog->ssl);
- gtk_widget_set_sensitive (sdialog->ssl_combobox, FALSE);
- } else {
- gtk_widget_set_sensitive (sdialog->ssl_combobox, TRUE);
- }
-
- url_changed(sdialog);
-}
-
-static void
-ssl_combobox_changed_cb(GtkWidget *w, AddressbookSourceDialog *sdialog)
-{
- sdialog->ssl = gtk_combo_box_get_active (GTK_COMBO_BOX (w));
- e_source_set_property (sdialog->source, "ssl", ldap_unparse_ssl (sdialog->ssl));
-
- gtk_widget_set_tooltip_text (sdialog->ssl_combobox, ldap_get_ssl_tooltip (sdialog->ssl));
-}
-
-static GtkWidget *
-eabc_general_host(EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data)
-{
- AddressbookSourceDialog *sdialog = data;
- const gchar *tmp;
- GtkWidget *w;
- gchar *uri, port[16];
- LDAPURLDesc *lud;
- GladeXML *gui;
- gchar *gladefile;
-
- if (!source_group_is_remote(sdialog->source_group))
- return NULL;
-
- gladefile = g_build_filename (EVOLUTION_GLADEDIR,
- GLADE_FILE_NAME,
- NULL);
- gui = glade_xml_new (gladefile, item->label, NULL);
- g_free (gladefile);
-
- w = glade_xml_get_widget(gui, item->label);
- gtk_box_pack_start((GtkBox *)parent, w, FALSE, FALSE, 0);
-
- uri = e_source_get_uri(sdialog->source);
- if (ldap_url_parse(uri, &lud) != LDAP_SUCCESS)
- lud = NULL;
- g_free(uri);
-
- sdialog->host = glade_xml_get_widget (gui, "server-name-entry");
- gtk_entry_set_text((GtkEntry *)sdialog->host, lud && lud->lud_host ? lud->lud_host : "");
- g_signal_connect (sdialog->host, "changed", G_CALLBACK (host_changed_cb), sdialog);
-
- sdialog->port_comboentry = glade_xml_get_widget (gui, "port-comboentry");
- gtk_widget_set_has_tooltip (sdialog->port_comboentry, TRUE);
- gtk_widget_set_tooltip_text (sdialog->port_comboentry, _("This is the port on the LDAP server that Evolution will try to connect to. A list of standard ports has been provided. Ask your system administrator what port you should specify."));
- sprintf(port, "%u", lud && lud->lud_port? lud->lud_port : LDAP_PORT);
- gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (sdialog->port_comboentry))), port);
- g_signal_connect (gtk_bin_get_child (GTK_BIN (sdialog->port_comboentry)), "changed", G_CALLBACK (port_entry_changed_cb), sdialog);
-
- if (lud)
- ldap_free_urldesc (lud);
-
- sdialog->ssl_combobox = glade_xml_get_widget (gui, "ssl-combobox");
- gtk_widget_set_has_tooltip (sdialog->ssl_combobox, TRUE);
- tmp = e_source_get_property (sdialog->source, "ssl");
- sdialog->ssl = tmp ? ldap_parse_ssl (tmp) : ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE;
- gtk_combo_box_set_active (GTK_COMBO_BOX (sdialog->ssl_combobox), sdialog->ssl);
- gtk_widget_set_tooltip_text (sdialog->ssl_combobox, ldap_get_ssl_tooltip (sdialog->ssl));
- gtk_widget_set_sensitive (sdialog->ssl_combobox, strcmp (port, LDAPS_PORT_STRING) != 0);
- g_signal_connect (sdialog->ssl_combobox, "changed", G_CALLBACK (ssl_combobox_changed_cb), sdialog);
-
- g_object_unref(gui);
-
- return w;
-}
-
-static void
-auth_entry_changed_cb(GtkWidget *w, AddressbookSourceDialog *sdialog)
-{
- const gchar *principal = gtk_entry_get_text((GtkEntry *)w);
-
- /* seems messy ... but the api is */
- switch (sdialog->auth) {
- case ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN:
- e_source_set_property(sdialog->source, "email_addr", NULL);
- e_source_set_property(sdialog->source, "binddn", principal);
- break;
- case ADDRESSBOOK_LDAP_AUTH_SIMPLE_EMAIL:
- e_source_set_property(sdialog->source, "binddn", NULL);
- e_source_set_property(sdialog->source, "email_addr", principal);
- break;
- case ADDRESSBOOK_LDAP_AUTH_NONE:
- default:
- e_source_set_property(sdialog->source, "email_addr", NULL);
- e_source_set_property(sdialog->source, "binddn", NULL);
- break;
- }
-}
-
-static void
-auth_combobox_changed_cb(GtkWidget *w, AddressbookSourceDialog *sdialog)
-{
- sdialog->auth = gtk_combo_box_get_active (GTK_COMBO_BOX (w));
- e_source_set_property (sdialog->source, "auth", ldap_unparse_auth (sdialog->auth));
-
- /* make sure the right property is set for the auth - ugh, funny api */
- auth_entry_changed_cb(sdialog->auth_principal, sdialog);
-}
-
-static GtkWidget *
-eabc_general_auth(EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data)
-{
- AddressbookSourceDialog *sdialog = data;
- GtkWidget *w;
- const gchar *tmp;
- GladeXML *gui;
- gchar *gladefile;
-
- if (!source_group_is_remote(sdialog->source_group))
- return NULL;
-
- gladefile = g_build_filename (EVOLUTION_GLADEDIR,
- GLADE_FILE_NAME,
- NULL);
- gui = glade_xml_new (gladefile, item->label, NULL);
- g_free (gladefile);
-
- w = glade_xml_get_widget(gui, item->label);
- gtk_box_pack_start((GtkBox *)parent, w, FALSE, FALSE, 0);
-
- sdialog->auth_combobox = glade_xml_get_widget (gui, "auth-combobox");
- gtk_widget_set_has_tooltip (sdialog->auth_combobox, TRUE);
- gtk_widget_set_tooltip_text (sdialog->auth_combobox, _("This is the method Evolution will use to authenticate you. Note that setting this to \"Email Address\" requires anonymous access to your LDAP server."));
- tmp = e_source_get_property(sdialog->source, "auth");
- sdialog->auth = tmp ? ldap_parse_auth(tmp) : ADDRESSBOOK_LDAP_AUTH_NONE;
- gtk_combo_box_set_active (GTK_COMBO_BOX (sdialog->auth_combobox), sdialog->auth);
- g_signal_connect (sdialog->auth_combobox, "changed", G_CALLBACK(auth_combobox_changed_cb), sdialog);
-
- sdialog->auth_principal = glade_xml_get_widget (gui, "auth-entry");
- switch (sdialog->auth) {
- case ADDRESSBOOK_LDAP_AUTH_SIMPLE_EMAIL:
- tmp = e_source_get_property(sdialog->source, "email_addr");
- break;
- case ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN:
- tmp = e_source_get_property(sdialog->source, "binddn");
- break;
- case ADDRESSBOOK_LDAP_AUTH_NONE:
- default:
- tmp = "";
- break;
- }
- gtk_entry_set_text((GtkEntry *)sdialog->auth_principal, tmp?tmp:"");
- g_signal_connect (sdialog->auth_principal, "changed", G_CALLBACK (auth_entry_changed_cb), sdialog);
-
- g_object_unref(gui);
-
- return w;
-}
-
-static void
-rootdn_changed_cb(GtkWidget *w, AddressbookSourceDialog *sdialog)
-{
- url_changed(sdialog);
-}
-
-static void
-search_filter_changed_cb (GtkWidget *w, AddressbookSourceDialog *sdialog)
-{
- url_changed (sdialog);
-}
-
-static void
-scope_combobox_changed_cb(GtkWidget *w, AddressbookSourceDialog *sdialog)
-{
- sdialog->scope = gtk_combo_box_get_active (GTK_COMBO_BOX (w));
- url_changed(sdialog);
-}
-
-static GtkWidget *
-eabc_details_search(EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data)
-{
- AddressbookSourceDialog *sdialog = data;
- GtkWidget *w;
- LDAPURLDesc *lud;
- gchar *uri;
- GladeXML *gui;
- gchar *gladefile;
-
- if (!source_group_is_remote(sdialog->source_group))
- return NULL;
-
- gladefile = g_build_filename (EVOLUTION_GLADEDIR,
- GLADE_FILE_NAME,
- NULL);
- gui = glade_xml_new (gladefile, item->label, NULL);
- g_free (gladefile);
-
- w = glade_xml_get_widget(gui, item->label);
- gtk_box_pack_start((GtkBox *)parent, w, FALSE, FALSE, 0);
-
- uri = e_source_get_uri(sdialog->source);
- if (ldap_url_parse(uri, &lud) != LDAP_SUCCESS)
- lud = NULL;
- g_free(uri);
-
- sdialog->rootdn = glade_xml_get_widget (gui, "rootdn-entry");
- gtk_entry_set_text((GtkEntry *)sdialog->rootdn, lud && lud->lud_dn ? lud->lud_dn : "");
- g_signal_connect (sdialog->rootdn, "changed", G_CALLBACK (rootdn_changed_cb), sdialog);
-
- sdialog->scope_combobox = glade_xml_get_widget (gui, "scope-combobox");
- gtk_widget_set_has_tooltip (sdialog->scope_combobox, TRUE);
- gtk_widget_set_tooltip_text (sdialog->scope_combobox, _("The search scope defines how deep you would like the search to extend down the directory tree. A search scope of \"sub\" will include all entries below your search base. A search scope of \"one\" will only include the entries one level beneath your base."));
- if (lud) {
- switch (lud->lud_scope) {
- case LDAP_SCOPE_BASE:
- sdialog->scope = ADDRESSBOOK_LDAP_SCOPE_BASE;
- break;
- default:
- case LDAP_SCOPE_ONELEVEL:
- sdialog->scope = ADDRESSBOOK_LDAP_SCOPE_ONELEVEL;
- break;
- case LDAP_SCOPE_SUBTREE:
- sdialog->scope = ADDRESSBOOK_LDAP_SCOPE_SUBTREE;
- break;
- }
- }
- gtk_combo_box_set_active (GTK_COMBO_BOX (sdialog->scope_combobox), sdialog->scope);
- g_signal_connect (sdialog->scope_combobox, "changed", G_CALLBACK(scope_combobox_changed_cb), sdialog);
-
- sdialog->search_filter = glade_xml_get_widget (gui, "search-filter-entry");
- gtk_entry_set_text((GtkEntry *)sdialog->search_filter, lud && lud->lud_filter ? lud->lud_filter : "");
- g_signal_connect (sdialog->search_filter, "changed", G_CALLBACK (search_filter_changed_cb), sdialog);
-
- g_signal_connect (glade_xml_get_widget(gui, "rootdn-button"), "clicked",
- G_CALLBACK(query_for_supported_bases), sdialog);
-
- if (lud)
- ldap_free_urldesc (lud);
-
- g_object_unref(gui);
-
- return w;
-}
-
-static void
-timeout_changed_cb(GtkWidget *w, AddressbookSourceDialog *sdialog)
-{
- gchar *timeout;
-
- timeout = g_strdup_printf("%f", gtk_adjustment_get_value(((GtkRange *)sdialog->timeout_scale)->adjustment));
- e_source_set_property(sdialog->source, "timeout", timeout);
- g_free(timeout);
-}
-
-static void
-limit_changed_cb(GtkWidget *w, AddressbookSourceDialog *sdialog)
-{
- gchar limit[16];
-
- sprintf(limit, "%d", gtk_spin_button_get_value_as_int((GtkSpinButton *)sdialog->limit_spinbutton));
- e_source_set_property(sdialog->source, "limit", limit);
-}
-
-static void
-canbrowse_toggled_cb (GtkWidget *toggle_button, ESource *source)
-{
- if (!source || !toggle_button)
- return;
-
- e_source_set_property (source, "can-browse", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle_button)) ? "1" : NULL);
-}
-
-static GtkWidget *
-eabc_details_limit(EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data)
-{
- AddressbookSourceDialog *sdialog = data;
- GtkWidget *w;
- const gchar *tmp;
- GladeXML *gui;
- gchar *gladefile;
-
- if (!source_group_is_remote(sdialog->source_group))
- return NULL;
-
- gladefile = g_build_filename (EVOLUTION_GLADEDIR,
- GLADE_FILE_NAME,
- NULL);
- gui = glade_xml_new (gladefile, item->label, NULL);
- g_free (gladefile);
-
- w = glade_xml_get_widget(gui, item->label);
- gtk_box_pack_start((GtkBox *)parent, w, FALSE, FALSE, 0);
-
- sdialog->timeout_scale = glade_xml_get_widget (gui, "timeout-scale");
- tmp = e_source_get_property(sdialog->source, "timeout");
- gtk_adjustment_set_value(((GtkRange *)sdialog->timeout_scale)->adjustment, tmp?g_strtod(tmp, NULL):3.0);
- g_signal_connect (GTK_RANGE(sdialog->timeout_scale)->adjustment, "value_changed", G_CALLBACK (timeout_changed_cb), sdialog);
-
- sdialog->limit_spinbutton = glade_xml_get_widget (gui, "download-limit-spinbutton");
- tmp = e_source_get_property(sdialog->source, "limit");
- gtk_spin_button_set_value((GtkSpinButton *)sdialog->limit_spinbutton, tmp?g_strtod(tmp, NULL):100.0);
- g_signal_connect (sdialog->limit_spinbutton, "value_changed", G_CALLBACK (limit_changed_cb), sdialog);
-
- sdialog->canbrowsecheck = glade_xml_get_widget (gui, "canbrowsecheck");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sdialog->canbrowsecheck), e_source_get_property (sdialog->source, "can-browse") && strcmp (e_source_get_property (sdialog->source, "can-browse"), "1") == 0);
- g_signal_connect (sdialog->canbrowsecheck, "toggled", G_CALLBACK (canbrowse_toggled_cb), sdialog->source);
-
- g_object_unref(gui);
-
- return w;
-}
-#endif
-
-static EConfigItem eabc_items[] = {
- { E_CONFIG_BOOK, (gchar *) (gchar *) "", },
- { E_CONFIG_PAGE, (gchar *) "00.general", (gchar *) N_("General") },
- { E_CONFIG_SECTION, (gchar *) "00.general/10.display", (gchar *) N_("Address Book") },
- { E_CONFIG_ITEM, (gchar *) "00.general/10.display/10.name", (gchar *) "hbox122", eabc_general_name },
- { E_CONFIG_ITEM, (gchar *) "00.general/10.display/20.offline", NULL, eabc_general_offline },
-#ifdef HAVE_LDAP
- { E_CONFIG_SECTION, (gchar *) "00.general/20.server", (gchar *) N_("Server Information") },
- { E_CONFIG_ITEM, (gchar *) "00.general/20.server/00.host", (gchar *) "table31", eabc_general_host },
- { E_CONFIG_SECTION, (gchar *) "00.general/30.auth", (gchar *) N_("Authentication") },
- { E_CONFIG_ITEM, (gchar *) "00.general/30.auth/00.auth", (gchar *) "table32", eabc_general_auth },
-
- { E_CONFIG_PAGE, (gchar *) "10.details", (gchar *) N_("Details") },
- { E_CONFIG_SECTION, (gchar *) "10.details/00.search", (gchar *) N_("Searching") },
- { E_CONFIG_ITEM, (gchar *) "10.details/00.search/00.search", (gchar *) "table33", eabc_details_search },
- { E_CONFIG_SECTION, (gchar *) "10.details/10.limit", (gchar *) N_("Downloading") },
- { E_CONFIG_ITEM, (gchar *) "10.details/10.limit/00.limit", (gchar *) "table34", eabc_details_limit },
-#endif
- { 0 },
-};
-
-/* items needed for the 'new addressbook' window */
-static EConfigItem eabc_new_items[] = {
- { E_CONFIG_ITEM, (gchar *) "00.general/10.display/00.type", NULL, eabc_general_type },
- { 0 },
-};
-
-static void
-eabc_commit(EConfig *ec, GSList *items, gpointer data)
-{
- AddressbookSourceDialog *sdialog = data;
- xmlNodePtr xml;
-#if d(!)0
- gchar *txt;
-#endif
- if (sdialog->original_source) {
- d(printf("committing addressbook changes\n"));
-
- /* these api's kinda suck */
- xml = xmlNewNode(NULL, (const guchar *)"dummy");
- e_source_dump_to_xml_node(sdialog->source, xml);
- e_source_update_from_xml_node(sdialog->original_source, xml->children, NULL);
- xmlFreeNode(xml);
-#if d(!)0
- txt = e_source_to_standalone_xml(sdialog->original_source);
- printf("source is now:\n%s\n", txt);
- g_free(txt);
-#endif
- } else {
- d(printf("committing new source\n"));
- e_source_group_add_source(sdialog->source_group, sdialog->source, -1);
- e_source_list_sync(sdialog->source_list, NULL);
- }
-
-#if d(!)0
- txt = e_source_to_standalone_xml(sdialog->source);
- printf("running source is now:\n%s\n", txt);
- g_free(txt);
-#endif
-}
-
-static void
-eabc_free(EConfig *ec, GSList *items, gpointer data)
-{
- AddressbookSourceDialog *sdialog = data;
-
- g_slist_free(items);
-
- g_object_unref(sdialog->source);
- if (sdialog->original_source)
- g_object_unref(sdialog->original_source);
- if (sdialog->source_list)
- g_object_unref(sdialog->source_list);
- g_slist_free(sdialog->menu_source_groups);
-
- g_object_unref(sdialog->gui);
-
- g_free(sdialog);
-}
-
-static gboolean
-eabc_check_complete(EConfig *ec, const gchar *pageid, gpointer data)
-{
- AddressbookSourceDialog *sdialog = data;
- gint valid = TRUE;
- const gchar *tmp;
- ESource *source;
-
- d(printf("check complete, pageid = '%s'\n", pageid?pageid:"<all>"));
- /* have name, and unique */
- tmp = e_source_peek_name(sdialog->source);
- valid = tmp && tmp[0] != 0
- && ((source = e_source_group_peek_source_by_name(sdialog->source_group, tmp)) == NULL
- || source == sdialog->original_source);
-
-#ifdef HAVE_LDAP
- if (valid && source_group_is_remote(sdialog->source_group)) {
- gchar *uri = e_source_get_uri(sdialog->source);
- LDAPURLDesc *lud;
-
- /* check host and port set */
- if (ldap_url_parse(uri, &lud) == LDAP_SUCCESS) {
- valid = lud->lud_host != NULL
- && lud->lud_host[0] != 0
- && lud->lud_port != 0;
- ldap_free_urldesc (lud);
- } else
- valid = FALSE;
- g_free(uri);
-
- /* check auth name provided if auth set */
- if (valid && (tmp = e_source_get_property(sdialog->source, "auth"))) {
- switch (ldap_parse_auth(tmp)) {
- case ADDRESSBOOK_LDAP_AUTH_SIMPLE_EMAIL:
- tmp = e_source_get_property(sdialog->source, "email_addr");
- break;
- case ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN:
- tmp = e_source_get_property(sdialog->source, "binddn");
- break;
- default:
- tmp = "dummy";
- break;
- }
- valid = tmp && tmp[0];
- }
-
- /* check timeout isn't too short (why don't we just force it?) */
- if (valid) {
- tmp = e_source_get_property(sdialog->source, "timeout");
- valid = tmp && g_strtod(tmp, NULL) > 0.0;
- }
- }
-#endif
- return valid;
-}
-
-/* debug only: */
-#if d(!)0
-static void
-source_changed(ESource *source, AddressbookSourceDialog *sdialog)
-{
- gchar *xml;
-
- xml = e_source_to_standalone_xml(source);
- printf("source changed:\n%s\n", xml);
- g_free(xml);
-}
-#endif
-
-GtkWidget*
-addressbook_config_edit_source (GtkWidget *parent, ESource *source)
-{
- AddressbookSourceDialog *sdialog = g_new0 (AddressbookSourceDialog, 1);
- EABConfig *ec;
- gint i;
- GSList *items = NULL;
- EABConfigTargetSource *target;
- gchar *xml;
- gchar *gladefile;
-
- gladefile = g_build_filename (EVOLUTION_GLADEDIR,
- GLADE_FILE_NAME,
- NULL);
- sdialog->gui = glade_xml_new (gladefile, "account-editor-notebook", NULL);
- g_free (gladefile);
-
- if (source) {
- sdialog->original_source = source;
- g_object_ref(source);
- sdialog->source_group = e_source_peek_group (source);
- xml = e_source_to_standalone_xml(source);
- sdialog->source = e_source_new_from_standalone_xml(xml);
- g_free(xml);
- } else {
- GConfClient *gconf;
- GSList *l;
-
- sdialog->source = e_source_new("", "");
- gconf = gconf_client_get_default();
- sdialog->source_list = e_source_list_new_for_gconf(gconf, "/apps/evolution/addressbook/sources");
- l = e_source_list_peek_groups(sdialog->source_list);
- if (!l) {
- g_warning ("Address Book source groups are missing! Check your GConf setup.");
- g_object_unref (gconf);
- g_free (sdialog);
- return NULL;
- }
-
- sdialog->menu_source_groups = g_slist_copy(l);
-#ifndef HAVE_LDAP
- for (;l;l = g_slist_next(l))
- if (!strncmp("ldap:", e_source_group_peek_base_uri(l->data), 5))
- sdialog->menu_source_groups = g_slist_remove (sdialog->menu_source_groups, l->data);
-#endif
- sdialog->source_group = (ESourceGroup *)sdialog->menu_source_groups->data;
- for (i=0;eabc_new_items[i].path;i++)
- items = g_slist_prepend(items, &eabc_new_items[i]);
- g_object_unref(gconf);
- }
-
- /* HACK: doesn't work if you don't do this */
- e_source_set_group(sdialog->source, sdialog->source_group);
-
-#if d(!)0
- xml = e_source_to_standalone_xml(sdialog->source);
- printf("but working standalone xml: %s\n", xml);
- g_free(xml);
- g_signal_connect(sdialog->source, "changed", source_changed, sdialog);
-#endif
-
- sdialog->config = ec = eab_config_new(E_CONFIG_BOOK, "com.novell.evolution.addressbook.config.accountEditor");
-
- for (i=0;eabc_items[i].path;i++) {
- if (eabc_items[i].label)
- eabc_items[i].label = gettext(eabc_items[i].label);
- items = g_slist_prepend(items, &eabc_items[i]);
- }
-
- e_config_add_items((EConfig *)ec, items, eabc_commit, NULL, eabc_free, sdialog);
- e_config_add_page_check((EConfig *)ec, NULL, eabc_check_complete, sdialog);
-
- target = eab_config_target_new_source(ec, sdialog->source);
- e_config_set_target((EConfig *)ec, (EConfigTarget *)target);
-
- if (source)
- sdialog->window = e_config_create_window((EConfig *)ec, NULL, _("Address Book Properties"));
- else
- sdialog->window = e_config_create_window((EConfig *)ec, NULL, _("New Address Book"));
-
- /* forces initial validation */
- if (!sdialog->original_source)
- e_config_target_changed((EConfig *)ec, E_CONFIG_TARGET_CHANGED_STATE);
-
- return sdialog->window;
-}
diff --git a/addressbook/gui/component/addressbook-config.h b/addressbook/gui/component/addressbook-config.h
deleted file mode 100644
index 0cfcb95b56..0000000000
--- a/addressbook/gui/component/addressbook-config.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Chris Toshok <toshok@ximian.com>
- * Chris Lahey <clahey@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef __ADDRESSBOOK_CONFIG_H__
-#define __ADDRESSBOOK_CONFIG_H__
-
-#include "evolution-config-control.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;
-
-GtkWidget* addressbook_config_edit_source (GtkWidget *parent, ESource *source);
-GtkWidget* addressbook_config_create_new_source (GtkWidget *parent);
-
-#endif /* __ADDRESSBOOK_CONFIG_H__ */
diff --git a/addressbook/gui/component/addressbook-migrate.c b/addressbook/gui/component/addressbook-migrate.c
deleted file mode 100644
index 424a39c730..0000000000
--- a/addressbook/gui/component/addressbook-migrate.c
+++ /dev/null
@@ -1,1213 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Chris Toshok <toshok@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#include <config.h>
-
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#include <glib.h>
-#include <glib/gstdio.h>
-
-#include <gtk/gtk.h>
-
-#include <libebook/e-destination.h>
-#include <libebook/e-book.h>
-#include <glib/gi18n.h>
-
-#include <libedataserver/e-xml-utils.h>
-
-#include "e-util/e-util.h"
-#include "e-util/e-util-private.h"
-#include "e-util/e-xml-utils.h"
-#include "e-util/e-folder-map.h"
-
-#include "addressbook-migrate.h"
-
-/*#define SLOW_MIGRATION*/
-
-typedef struct {
- /* this hash table maps old folder uris to new uids. It's
- build in migrate_contact_folder and it's used in
- migrate_completion_folders. */
- GHashTable *folder_uid_map;
-
- ESourceList *source_list;
-
- AddressbookComponent *component;
-
- GtkWidget *window;
- GtkWidget *label;
- GtkWidget *folder_label;
- GtkWidget *progress;
-} MigrationContext;
-
-static void
-setup_progress_dialog (MigrationContext *context)
-{
- GtkWidget *vbox, *hbox;
-
- context->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title (GTK_WINDOW (context->window), _("Migrating..."));
- gtk_window_set_modal (GTK_WINDOW (context->window), TRUE);
- gtk_container_set_border_width (GTK_CONTAINER (context->window), 6);
-
- vbox = gtk_vbox_new (FALSE, 6);
- gtk_widget_show (vbox);
- gtk_container_add (GTK_CONTAINER (context->window), vbox);
-
- context->label = gtk_label_new ("");
- gtk_label_set_line_wrap (GTK_LABEL (context->label), TRUE);
- gtk_widget_show (context->label);
- gtk_box_pack_start (GTK_BOX (vbox), context->label, TRUE, TRUE, 0);
-
- hbox = gtk_hbox_new (FALSE, 6);
- gtk_widget_show (hbox);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
-
- context->folder_label = gtk_label_new ("");
- gtk_widget_show (context->folder_label);
- gtk_box_pack_start (GTK_BOX (hbox), context->folder_label, TRUE, TRUE, 0);
-
- context->progress = gtk_progress_bar_new ();
- gtk_widget_show (context->progress);
- gtk_box_pack_start (GTK_BOX (hbox), context->progress, TRUE, TRUE, 0);
-
- gtk_widget_show (context->window);
-}
-
-static void
-dialog_close (MigrationContext *context)
-{
- gtk_widget_destroy (context->window);
-}
-
-static void
-dialog_set_label (MigrationContext *context, const gchar *str)
-{
- gtk_label_set_text (GTK_LABEL (context->label), str);
-
- while (gtk_events_pending ())
- gtk_main_iteration ();
-
-#ifdef SLOW_MIGRATION
- sleep (1);
-#endif
-}
-
-static void
-dialog_set_folder_name (MigrationContext *context, const gchar *folder_name)
-{
- gchar *text;
-
- text = g_strdup_printf (_("Migrating '%s':"), folder_name);
- gtk_label_set_text (GTK_LABEL (context->folder_label), text);
- g_free (text);
-
- gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (context->progress), 0.0);
-
- while (gtk_events_pending ())
- gtk_main_iteration ();
-
-#ifdef SLOW_MIGRATION
- sleep (1);
-#endif
-}
-
-static void
-dialog_set_progress (MigrationContext *context, double percent)
-{
- gchar text[5];
-
- snprintf (text, sizeof (text), "%d%%", (gint) (percent * 100.0f));
-
- gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (context->progress), percent);
- gtk_progress_bar_set_text (GTK_PROGRESS_BAR (context->progress), text);
-
- while (gtk_events_pending ())
- gtk_main_iteration ();
-
-#ifdef SLOW_MIGRATION
- sleep (1);
-#endif
-}
-
-static gboolean
-check_for_conflict (ESourceGroup *group, gchar *name)
-{
- GSList *sources;
- GSList *s;
-
- sources = e_source_group_peek_sources (group);
-
- for (s = sources; s; s = s->next) {
- ESource *source = E_SOURCE (s->data);
-
- if (!strcmp (e_source_peek_name (source), name))
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gchar *
-get_source_name (ESourceGroup *group, const gchar *path)
-{
-#ifndef G_OS_WIN32
- gchar **p = g_strsplit (path, "/", 0);
-#else
- gchar **p = g_strsplit_set (path, "\\/", 0);
-#endif
- gint i, j, starting_index;
- gint num_elements;
- gboolean conflict;
- GString *s = g_string_new ("");
-
- for (i = 0; p[i]; i ++);
-
- num_elements = i;
- i--;
-
- /* p[i] is now the last path element */
-
- /* check if it conflicts */
- starting_index = i;
- do {
- g_string_assign (s, "");
- for (j = starting_index; j < num_elements; j += 2) {
- if (j != starting_index)
- g_string_append_c (s, '_');
- g_string_append (s, p[j]);
- }
-
- conflict = check_for_conflict (group, s->str);
-
- /* if there was a conflict back up 2 levels (skipping the /subfolder/ element) */
- if (conflict)
- starting_index -= 2;
-
- /* we always break out if we can't go any further,
- regardless of whether or not we conflict. */
- if (starting_index < 0)
- break;
-
- } while (conflict);
-
- g_strfreev (p);
-
- return g_string_free (s, FALSE);
-}
-
-static void
-migrate_contacts (MigrationContext *context, EBook *old_book, EBook *new_book)
-{
- EBookQuery *query = e_book_query_any_field_contains ("");
- GList *l, *contacts;
- gint num_added = 0;
- gint num_contacts;
-
- /* both books are loaded, start the actual migration */
- e_book_get_contacts (old_book, query, &contacts, NULL);
- e_book_query_unref (query);
-
- num_contacts = g_list_length (contacts);
- for (l = contacts; l; l = l->next) {
- EContact *contact = l->data;
- GError *e = NULL;
- GList *attrs, *attr;
-
- /* do some last minute massaging of the contact's attributes */
-
- attrs = e_vcard_get_attributes (E_VCARD (contact));
- for (attr = attrs; attr;) {
- EVCardAttribute *a = attr->data;
-
- /* evo 1.4 used the non-standard X-EVOLUTION-OFFICE attribute,
- evo 1.5 uses the third element in the ORG list attribute. */
- if (!strcmp ("X-EVOLUTION-OFFICE", e_vcard_attribute_get_name (a))) {
- GList *v = e_vcard_attribute_get_values (a);
- GList *next_attr;
-
- if (v && v->data)
- e_contact_set (contact, E_CONTACT_OFFICE, v->data);
-
- next_attr = attr->next;
- e_vcard_remove_attribute (E_VCARD (contact), a);
- attr = next_attr;
- }
- /* evo 1.4 didn't put TYPE=VOICE in for phone numbers.
- evo 1.5 does.
-
- so we search through the attribute params for
- either TYPE=VOICE or TYPE=FAX. If we find
- either we do nothing. If we find neither, we
- add TYPE=VOICE.
- */
- else if (!strcmp ("TEL", e_vcard_attribute_get_name (a))) {
- GList *params, *param;
- gboolean found = FALSE;
-
- params = e_vcard_attribute_get_params (a);
- for (param = params; param; param = param->next) {
- EVCardAttributeParam *p = param->data;
- if (!strcmp (EVC_TYPE, e_vcard_attribute_param_get_name (p))) {
- GList *v = e_vcard_attribute_param_get_values (p);
- while (v && v->data) {
- if (!strcmp ("VOICE", v->data)
- || !strcmp ("FAX", v->data)) {
- found = TRUE;
- break;
- }
- v = v->next;
- }
- }
- }
-
- if (!found)
- e_vcard_attribute_add_param_with_value (a,
- e_vcard_attribute_param_new (EVC_TYPE),
- "VOICE");
- attr = attr->next;
- }
- /* Replace "POSTAL" (1.4) addresses with "OTHER" (1.5) */
- else if (!strcmp ("ADR", e_vcard_attribute_get_name (a))) {
- GList *params, *param;
- gboolean found = FALSE;
- EVCardAttributeParam *p;
-
- params = e_vcard_attribute_get_params (a);
- for (param = params; param; param = param->next) {
- p = param->data;
- if (!strcmp (EVC_TYPE, e_vcard_attribute_param_get_name (p))) {
- GList *v = e_vcard_attribute_param_get_values (p);
- while (v && v->data ) {
- if (!strcmp ("POSTAL", v->data)) {
- found = TRUE;
- break;
- }
- v = v->next;
- }
- if (found)
- break;
- }
- }
-
- if (found) {
- e_vcard_attribute_param_remove_values (p);
- e_vcard_attribute_param_add_value (p, "OTHER");
- }
-
- attr = attr->next;
- }
- /* this is kinda gross. The new vcard parser
- needs ';'s to be escaped by \'s. but the
- 1.4 vcard generator would put unescaped xml
- (including entities like &gt;) in the value
- of attributes, so we need to go through and
- escape those ';'s. */
- else if (!strcmp ("EMAIL", e_vcard_attribute_get_name (a))) {
- GList *params;
- GList *v = e_vcard_attribute_get_values (a);
-
- /* Add TYPE=OTHER if there is no type set */
- params = e_vcard_attribute_get_params (a);
- if (!params)
- e_vcard_attribute_add_param_with_value (a,
- e_vcard_attribute_param_new (EVC_TYPE),
- "OTHER");
-
- if (v && v->data) {
- if (!strncmp ((gchar *)v->data, "<?xml", 5)) {
- /* k, this is the nasty part. we glomb all the
- value strings back together again (if there is
- more than one), then work our magic */
- GString *str = g_string_new ("");
- while (v) {
- g_string_append (str, v->data);
- if (v->next)
- g_string_append_c (str, ';');
- v = v->next;
- }
-
- e_vcard_attribute_remove_values (a);
- e_vcard_attribute_add_value (a, str->str);
- g_string_free (str, TRUE);
- }
- }
-
- attr = attr->next;
- }
- else {
- attr = attr->next;
- }
- }
-
- if (!e_book_add_contact (new_book,
- contact,
- &e))
- g_warning ("contact add failed: `%s'", e->message);
-
- num_added ++;
-
- dialog_set_progress (context, (double)num_added / num_contacts);
- }
-
- g_list_foreach (contacts, (GFunc)g_object_unref, NULL);
- g_list_free (contacts);
-}
-
-static void
-migrate_contact_folder_to_source (MigrationContext *context, gchar *old_path, ESource *new_source)
-{
- gchar *old_uri = g_filename_to_uri (old_path, NULL, NULL);
- GError *e = NULL;
-
- EBook *old_book = NULL, *new_book = NULL;
- ESource *old_source;
- ESourceGroup *group;
-
- group = e_source_group_new ("", old_uri);
- old_source = e_source_new ("", "");
- e_source_group_add_source (group, old_source, -1);
-
- dialog_set_folder_name (context, e_source_peek_name (new_source));
-
- old_book = e_book_new (old_source, &e);
- if (!old_book
- || !e_book_open (old_book, TRUE, &e)) {
- g_warning ("failed to load source book for migration: `%s'", e->message);
- goto finish;
- }
-
- new_book = e_book_new (new_source, &e);
- if (!new_book
- || !e_book_open (new_book, FALSE, &e)) {
- g_warning ("failed to load destination book for migration: `%s'", e->message);
- goto finish;
- }
-
- migrate_contacts (context, old_book, new_book);
-
- finish:
- g_object_unref (old_source);
- g_object_unref (group);
- if (old_book)
- g_object_unref (old_book);
- if (new_book)
- g_object_unref (new_book);
- g_free (old_uri);
-}
-
-static void
-migrate_contact_folder (MigrationContext *context, gchar *old_path, ESourceGroup *dest_group, gchar *source_name)
-{
- ESource *new_source;
-
- new_source = e_source_new (source_name, source_name);
- e_source_set_relative_uri (new_source, e_source_peek_uid (new_source));
- e_source_group_add_source (dest_group, new_source, -1);
-
- g_hash_table_insert (context->folder_uid_map, g_strdup (old_path), g_strdup (e_source_peek_uid (new_source)));
-
- migrate_contact_folder_to_source (context, old_path, new_source);
-
- g_object_unref (new_source);
-}
-
-#define LDAP_BASE_URI "ldap://"
-#define PERSONAL_RELATIVE_URI "system"
-
-static void
-create_groups (MigrationContext *context,
- ESourceGroup **on_this_computer,
- ESourceGroup **on_ldap_servers,
- ESource **personal_source)
-{
- GSList *groups;
- ESourceGroup *group;
- gchar *base_uri, *base_uri_proto;
- const gchar *base_dir;
-
- *on_this_computer = NULL;
- *on_ldap_servers = NULL;
- *personal_source = NULL;
-
- base_dir = addressbook_component_peek_base_directory (context->component);
- base_uri = g_build_filename (base_dir, "local", NULL);
-
- base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
-
- groups = e_source_list_peek_groups (context->source_list);
- if (groups) {
- /* groups are already there, we need to search for things... */
- GSList *g;
-
- for (g = groups; g; g = g->next) {
-
- group = E_SOURCE_GROUP (g->data);
-
- if (!*on_this_computer && !strcmp (base_uri_proto, e_source_group_peek_base_uri (group)))
- *on_this_computer = g_object_ref (group);
- else if (!*on_ldap_servers && !strcmp (LDAP_BASE_URI, e_source_group_peek_base_uri (group)))
- *on_ldap_servers = g_object_ref (group);
- }
- }
-
- if (*on_this_computer) {
- /* make sure "Personal" shows up as a source under
- this group */
- GSList *sources = e_source_group_peek_sources (*on_this_computer);
- GSList *s;
- for (s = sources; s; s = s->next) {
- ESource *source = E_SOURCE (s->data);
- const gchar *relative_uri;
-
- relative_uri = e_source_peek_relative_uri (source);
- if (relative_uri == NULL)
- continue;
- if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) {
- *personal_source = g_object_ref (source);
- break;
- }
- }
- }
- else {
- /* create the local source group */
- group = e_source_group_new (_("On This Computer"), base_uri_proto);
- e_source_list_add_group (context->source_list, group, -1);
-
- *on_this_computer = group;
- }
-
- if (!*personal_source) {
- /* Create the default Person addressbook */
- ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
- e_source_group_add_source (*on_this_computer, source, -1);
-
- e_source_set_property (source, "completion", "true");
-
- *personal_source = source;
- }
-
- if (!*on_ldap_servers) {
- /* Create the LDAP source group */
- group = e_source_group_new (_("On LDAP Servers"), LDAP_BASE_URI);
- e_source_list_add_group (context->source_list, group, -1);
-
- *on_ldap_servers = group;
- }
-
- g_free (base_uri_proto);
- g_free (base_uri);
-}
-
-static gboolean
-migrate_local_folders (MigrationContext *context, ESourceGroup *on_this_computer, ESource *personal_source)
-{
- gchar *old_path = NULL;
- GSList *dirs, *l;
- gchar *local_contact_folder = NULL;
-
- old_path = g_strdup_printf ("%s/evolution/local", g_get_home_dir ());
-
- dirs = e_folder_map_local_folders (old_path, "contacts");
-
- /* migrate the local addressbook first, to local/system */
- local_contact_folder = g_build_filename (g_get_home_dir (),
- "evolution", "local", "Contacts",
- NULL);
-
- for (l = dirs; l; l = l->next) {
- gchar *source_name;
- /* we handle the system folder differently */
- if (personal_source && !strcmp ((gchar *)l->data, local_contact_folder)) {
- g_hash_table_insert (context->folder_uid_map, g_strdup (l->data), g_strdup (e_source_peek_uid (personal_source)));
- migrate_contact_folder_to_source (context, local_contact_folder, personal_source);
- continue;
- }
-
- source_name = get_source_name (on_this_computer, (gchar *)l->data);
- migrate_contact_folder (context, l->data, on_this_computer, source_name);
- g_free (source_name);
- }
-
- g_slist_foreach (dirs, (GFunc)g_free, NULL);
- g_slist_free (dirs);
- g_free (local_contact_folder);
- g_free (old_path);
-
- return TRUE;
-}
-
-static gchar *
-get_string_child (xmlNode *node,
- const gchar *name)
-{
- xmlNode *p;
- xmlChar *xml_string;
- gchar *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 ((gchar *) xml_string);
- xmlFree (xml_string);
-
- return retval;
-}
-
-static gint
-get_integer_child (xmlNode *node,
- const gchar *name,
- gint defval)
-{
- xmlNode *p;
- xmlChar *xml_string;
- gint 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 ((gchar *)xml_string);
- xmlFree (xml_string);
-
- return retval;
-}
-
-static gboolean
-migrate_ldap_servers (MigrationContext *context, ESourceGroup *on_ldap_servers)
-{
- gchar *sources_xml = g_strdup_printf ("%s/evolution/addressbook-sources.xml",
- g_get_home_dir ());
-
- printf ("trying to migrate from %s\n", sources_xml);
-
- if (g_file_test (sources_xml, G_FILE_TEST_EXISTS)) {
- xmlDoc *doc = xmlParseFile (sources_xml);
- xmlNode *root;
- xmlNode *child;
- gint num_contactservers;
- gint servernum;
-
- if (!doc)
- return FALSE;
-
- root = xmlDocGetRootElement (doc);
- if (root == NULL || strcmp ((const gchar *)root->name, "addressbooks") != 0) {
- xmlFreeDoc (doc);
- return FALSE;
- }
-
- /* count the number of servers, so we can give progress */
- num_contactservers = 0;
- for (child = root->children; child; child = child->next) {
- if (!strcmp ((const gchar *)child->name, "contactserver")) {
- num_contactservers++;
- }
- }
- printf ("found %d contact servers to migrate\n", num_contactservers);
-
- dialog_set_folder_name (context, _("LDAP Servers"));
-
- servernum = 0;
- for (child = root->children; child; child = child->next) {
- if (!strcmp ((const gchar *)child->name, "contactserver")) {
- gchar *port, *host, *rootdn, *scope, *authmethod, *ssl;
- gchar *emailaddr, *binddn, *limitstr;
- gint limit;
- gchar *name, *description;
- GString *uri = g_string_new ("");
- ESource *source;
-
- name = get_string_child (child, "name");
- description = get_string_child (child, "description");
- port = get_string_child (child, "port");
- host = get_string_child (child, "host");
- rootdn = get_string_child (child, "rootdn");
- scope = get_string_child (child, "scope");
- authmethod = get_string_child (child, "authmethod");
- ssl = get_string_child (child, "ssl");
- emailaddr = get_string_child (child, "emailaddr");
- binddn = get_string_child (child, "binddn");
- limit = get_integer_child (child, "limit", 100);
- limitstr = g_strdup_printf ("%d", limit);
-
- g_string_append_printf (uri,
- "%s:%s/%s?"/*trigraph prevention*/"?%s",
- host, port, rootdn, scope);
-
- source = e_source_new (name, uri->str);
- e_source_set_property (source, "description", description);
- e_source_set_property (source, "limit", limitstr);
- e_source_set_property (source, "ssl", ssl);
- e_source_set_property (source, "auth", authmethod);
- if (emailaddr)
- e_source_set_property (source, "email_addr", emailaddr);
- if (binddn)
- e_source_set_property (source, "binddn", binddn);
-
- e_source_group_add_source (on_ldap_servers, source, -1);
-
- g_string_free (uri, TRUE);
- g_free (port);
- g_free (host);
- g_free (rootdn);
- g_free (scope);
- g_free (authmethod);
- g_free (ssl);
- g_free (emailaddr);
- g_free (binddn);
- g_free (limitstr);
- g_free (name);
- g_free (description);
-
- servernum++;
- dialog_set_progress (context, (double)servernum/num_contactservers);
- }
- }
-
- xmlFreeDoc (doc);
- }
-
- g_free (sources_xml);
-
- return TRUE;
-}
-
-static ESource*
-get_source_by_name (ESourceList *source_list, const gchar *name)
-{
- GSList *groups;
- GSList *g;
-
- groups = e_source_list_peek_groups (source_list);
- if (!groups)
- return NULL;
-
- for (g = groups; g; g = g->next) {
- GSList *sources;
- GSList *s;
- ESourceGroup *group = E_SOURCE_GROUP (g->data);
-
- sources = e_source_group_peek_sources (group);
- if (!sources)
- continue;
-
- for (s = sources; s; s = s->next) {
- ESource *source = E_SOURCE (s->data);
- const gchar *source_name = e_source_peek_name (source);
-
- if (!strcmp (name, source_name))
- return source;
- }
- }
-
- return NULL;
-}
-
-static gboolean
-migrate_completion_folders (MigrationContext *context)
-{
- gchar *uris_xml = gconf_client_get_string (addressbook_component_peek_gconf_client (context->component),
- "/apps/evolution/addressbook/completion/uris",
- NULL);
-
- printf ("trying to migrate completion folders\n");
-
- if (uris_xml) {
- xmlDoc *doc = xmlParseMemory (uris_xml, strlen (uris_xml));
- xmlNode *root;
- xmlNode *child;
-
- if (!doc)
- return FALSE;
-
- dialog_set_folder_name (context, _("Autocompletion Settings"));
-
- root = xmlDocGetRootElement (doc);
- if (root == NULL || strcmp ((const gchar *)root->name, "EvolutionFolderList") != 0) {
- xmlFreeDoc (doc);
- return FALSE;
- }
-
- for (child = root->children; child; child = child->next) {
- if (!strcmp ((const gchar *)child->name, "folder")) {
- gchar *physical_uri = e_xml_get_string_prop_by_name (child, (const guchar *)"physical-uri");
- ESource *source = NULL;
-
- /* if the physical uri is file://...
- we look it up in our folder_uid_map
- hashtable. If it's a folder we
- converted over, we should get back
- a uid we can search for.
-
- if the physical_uri is anything
- else, we strip off the args
- (anything after;) before searching
- for the uri. */
-
- if (!strncmp (physical_uri, "file://", 7)) {
- gchar *filename = g_filename_from_uri (physical_uri, NULL, NULL);
- gchar *uid = NULL;
-
- if (filename)
- uid = g_hash_table_lookup (context->folder_uid_map,
- filename);
- g_free (filename);
- if (uid)
- source = e_source_list_peek_source_by_uid (context->source_list, uid);
- }
- else {
- gchar *name = e_xml_get_string_prop_by_name (child, (const guchar *)"display-name");
-
- source = get_source_by_name (context->source_list, name);
-
- g_free (name);
- }
-
- if (source) {
- e_source_set_property (source, "completion", "true");
- }
- else {
- g_warning ("found completion folder with uri `%s' that "
- "doesn't correspond to anything we migrated.", physical_uri);
- }
-
- g_free (physical_uri);
- }
- }
-
- g_free (uris_xml);
- }
- else {
- g_message ("no completion folder settings to migrate");
- }
-
- return TRUE;
-}
-
-static void
-migrate_contact_lists_for_local_folders (MigrationContext *context, ESourceGroup *on_this_computer)
-{
- GSList *sources, *s;
-
- sources = e_source_group_peek_sources (on_this_computer);
- for (s = sources; s; s = s->next) {
- ESource *source = s->data;
- EBook *book;
- EBookQuery *query;
- GList *l, *contacts;
- gint num_contacts, num_converted;
-
- dialog_set_folder_name (context, e_source_peek_name (source));
-
- book = e_book_new (source, NULL);
- if (!book
- || !e_book_open (book, TRUE, NULL)) {
- gchar *uri = e_source_get_uri (source);
- g_warning ("failed to migrate contact lists for source %s", uri);
- g_free (uri);
- continue;
- }
-
- query = e_book_query_any_field_contains ("");
- e_book_get_contacts (book, query, &contacts, NULL);
- e_book_query_unref (query);
-
- num_converted = 0;
- num_contacts = g_list_length (contacts);
- for (l = contacts; l; l = l->next) {
- EContact *contact = l->data;
- GError *e = NULL;
- GList *attrs, *attr;
- gboolean converted = FALSE;
-
- attrs = e_contact_get_attributes (contact, E_CONTACT_EMAIL);
- for (attr = attrs; attr; attr = attr->next) {
- EVCardAttribute *a = attr->data;
- GList *v = e_vcard_attribute_get_values (a);
-
- if (v && v->data) {
- if (!strncmp ((gchar *)v->data, "<?xml", 5)) {
- EDestination *dest = e_destination_import ((gchar *)v->data);
-
- e_destination_export_to_vcard_attribute (dest, a);
-
- g_object_unref (dest);
-
- converted = TRUE;
- }
- }
- }
-
- if (converted) {
- e_contact_set_attributes (contact, E_CONTACT_EMAIL, attrs);
-
- if (!e_book_commit_contact (book,
- contact,
- &e))
- g_warning ("contact commit failed: `%s'", e->message);
- }
-
- num_converted ++;
-
- dialog_set_progress (context, (double)num_converted / num_contacts);
- }
-
- g_list_foreach (contacts, (GFunc)g_object_unref, NULL);
- g_list_free (contacts);
-
- g_object_unref (book);
- }
-}
-
-static void
-migrate_company_phone_for_local_folders (MigrationContext *context, ESourceGroup *on_this_computer)
-{
- GSList *sources, *s;
-
- sources = e_source_group_peek_sources (on_this_computer);
- for (s = sources; s; s = s->next) {
- ESource *source = s->data;
- EBook *book;
- EBookQuery *query;
- GList *l, *contacts;
- gint num_contacts, num_converted;
-
- dialog_set_folder_name (context, e_source_peek_name (source));
-
- book = e_book_new (source, NULL);
- if (!book
- || !e_book_open (book, TRUE, NULL)) {
- gchar *uri = e_source_get_uri (source);
- g_warning ("failed to migrate company phone numbers for source %s", uri);
- g_free (uri);
- continue;
- }
-
- query = e_book_query_any_field_contains ("");
- e_book_get_contacts (book, query, &contacts, NULL);
- e_book_query_unref (query);
-
- num_converted = 0;
- num_contacts = g_list_length (contacts);
- for (l = contacts; l; l = l->next) {
- EContact *contact = l->data;
- GError *e = NULL;
- GList *attrs, *attr;
- gboolean converted = FALSE;
- gint num_work_voice = 0;
-
- attrs = e_vcard_get_attributes (E_VCARD (contact));
- for (attr = attrs; attr;) {
- EVCardAttribute *a = attr->data;
- GList *next_attr = attr->next;
-
- if (!strcmp ("TEL", e_vcard_attribute_get_name (a))) {
- GList *params, *param;
- gboolean found_voice = FALSE;
- gboolean found_work = FALSE;
-
- params = e_vcard_attribute_get_params (a);
- for (param = params; param; param = param->next) {
- EVCardAttributeParam *p = param->data;
- if (!strcmp (EVC_TYPE, e_vcard_attribute_param_get_name (p))) {
- GList *v = e_vcard_attribute_param_get_values (p);
- while (v && v->data) {
- if (!strcmp ("VOICE", v->data))
- found_voice = TRUE;
- else if (!strcmp ("WORK", v->data))
- found_work = TRUE;
- v = v->next;
- }
- }
-
- if (found_work && found_voice)
- num_work_voice++;
-
- if (num_work_voice == 3) {
- GList *v = e_vcard_attribute_get_values (a);
-
- if (v && v->data)
- e_contact_set (contact, E_CONTACT_PHONE_COMPANY, v->data);
-
- e_vcard_remove_attribute (E_VCARD (contact), a);
-
- converted = TRUE;
- break;
- }
- }
- }
-
- attr = next_attr;
-
- if (converted)
- break;
- }
-
- if (converted) {
- if (!e_book_commit_contact (book,
- contact,
- &e))
- g_warning ("contact commit failed: `%s'", e->message);
- }
-
- num_converted ++;
-
- dialog_set_progress (context, (double)num_converted / num_contacts);
- }
-
- g_list_foreach (contacts, (GFunc)g_object_unref, NULL);
- g_list_free (contacts);
-
- g_object_unref (book);
- }
-}
-
-static void
-migrate_pilot_data (const gchar *old_path, const gchar *new_path)
-{
- const gchar *dent;
- const gchar *ext;
- gchar *filename;
- GDir *dir;
-
- if (!(dir = g_dir_open (old_path, 0, NULL)))
- return;
-
- while ((dent = g_dir_read_name (dir))) {
- if ((!strncmp (dent, "pilot-map-", 10) &&
- ((ext = strrchr (dent, '.')) && !strcmp (ext, ".xml"))) ||
- (!strncmp (dent, "pilot-sync-evolution-addressbook-", 33) &&
- ((ext = strrchr (dent, '.')) && !strcmp (ext, ".db")))) {
- /* src and dest file formats are identical for both map and changelog files */
- guchar inbuf[4096];
- gsize nread, nwritten;
- gint fd0, fd1;
- gssize n;
-
- filename = g_build_filename (old_path, dent, NULL);
- if ((fd0 = g_open (filename, O_RDONLY | O_BINARY, 0)) == -1) {
- g_free (filename);
- continue;
- }
-
- g_free (filename);
- filename = g_build_filename (new_path, dent, NULL);
- if ((fd1 = g_open (filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666)) == -1) {
- g_free (filename);
- close (fd0);
- continue;
- }
-
- do {
- do {
- n = read (fd0, inbuf, sizeof (inbuf));
- } while (n == -1 && errno == EINTR);
-
- if (n < 1)
- break;
-
- nread = n;
- nwritten = 0;
- do {
- do {
- n = write (fd1, inbuf + nwritten, nread - nwritten);
- } while (n == -1 && errno == EINTR);
-
- if (n > 0)
- nwritten += n;
- } while (nwritten < nread && n != -1);
-
- if (n == -1)
- break;
- } while (1);
-
- if (n != -1)
- n = fsync (fd1);
-
- if (n == -1) {
- g_warning ("Failed to migrate %s: %s", dent, g_strerror (errno));
- g_unlink (filename);
- }
-
- close (fd0);
- close (fd1);
- g_free (filename);
- }
- }
-
- g_dir_close (dir);
-}
-
-static MigrationContext*
-migration_context_new (AddressbookComponent *component)
-{
- MigrationContext *context = g_new (MigrationContext, 1);
-
- /* set up the mapping from old uris to new uids */
- context->folder_uid_map = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify)g_free, (GDestroyNotify)g_free);
-
- e_book_get_addressbooks (&context->source_list, NULL);
-
- context->component = component;
-
- return context;
-}
-
-static void
-migration_context_free (MigrationContext *context)
-{
- e_source_list_sync (context->source_list, NULL);
-
- g_hash_table_destroy (context->folder_uid_map);
-
- g_object_unref (context->source_list);
-
- g_free (context);
-}
-
-gint
-addressbook_migrate (AddressbookComponent *component, gint major, gint minor, gint revision, GError **err)
-{
- ESourceGroup *on_this_computer;
- ESourceGroup *on_ldap_servers;
- ESource *personal_source;
- MigrationContext *context = migration_context_new (component);
- gboolean need_dialog = FALSE;
-
- printf ("addressbook_migrate (%d.%d.%d)\n", major, minor, revision);
-
- /* we call this unconditionally now - create_groups either
- creates the groups/sources or it finds the necessary
- groups/sources. */
- create_groups (context, &on_this_computer, &on_ldap_servers, &personal_source);
-
- /* figure out if we need the dialog displayed */
- if (major == 1
- /* we only need the most recent upgrade point here.
- further decomposition will happen below. */
- && (minor < 5 || (minor == 5 && revision <= 10)))
- need_dialog = TRUE;
-
- if (need_dialog)
- setup_progress_dialog (context);
-
- if (major == 1) {
-
- if (minor < 5 || (minor == 5 && revision <= 2)) {
- /* initialize our dialog */
- dialog_set_label (context,
- _("The location and hierarchy of the Evolution contact "
- "folders has changed since Evolution 1.x.\n\nPlease be "
- "patient while Evolution migrates your folders..."));
-
- if (on_this_computer)
- migrate_local_folders (context, on_this_computer, personal_source);
- if (on_ldap_servers)
- migrate_ldap_servers (context, on_ldap_servers);
-
- migrate_completion_folders (context);
- }
-
- if (minor < 5 || (minor == 5 && revision <= 7)) {
- dialog_set_label (context,
- _("The format of mailing list contacts has changed.\n\n"
- "Please be patient while Evolution migrates your "
- "folders..."));
-
- migrate_contact_lists_for_local_folders (context, on_this_computer);
- }
-
- if (minor < 5 || (minor == 5 && revision <= 8)) {
- dialog_set_label (context,
- _("The way Evolution stores some phone numbers has changed.\n\n"
- "Please be patient while Evolution migrates your "
- "folders..."));
-
- migrate_company_phone_for_local_folders (context, on_this_computer);
- }
-
- if (minor < 5 || (minor == 5 && revision <= 10)) {
- gchar *old_path, *new_path;
-
- dialog_set_label (context, _("Evolution's Palm Sync changelog and map files have changed.\n\n"
- "Please be patient while Evolution migrates your Pilot Sync data..."));
-
- old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Contacts", NULL);
- new_path = g_build_filename (addressbook_component_peek_base_directory (component),
- "local", "system", NULL);
- migrate_pilot_data (old_path, new_path);
- g_free (new_path);
- g_free (old_path);
- }
-
- /* we only need to do this next step if people ran
- older versions of 1.5. We need to clear out the
- absolute URI's that were assigned to ESources
- during one phase of development, as they take
- precedent over relative uris (but aren't updated
- when editing an ESource). */
- if (minor == 5 && revision <= 11) {
- GSList *g;
- for (g = e_source_list_peek_groups (context->source_list); g; g = g->next) {
- ESourceGroup *group = g->data;
- GSList *s;
-
- for (s = e_source_group_peek_sources (group); s; s = s->next) {
- ESource *source = s->data;
- e_source_set_absolute_uri (source, NULL);
- }
- }
- }
- }
-
- if (need_dialog)
- dialog_close (context);
-
- if (on_this_computer)
- g_object_unref (on_this_computer);
- if (on_ldap_servers)
- g_object_unref (on_ldap_servers);
- if (personal_source)
- g_object_unref (personal_source);
-
- migration_context_free (context);
-
- return TRUE;
-}
diff --git a/addressbook/gui/component/addressbook-migrate.h b/addressbook/gui/component/addressbook-migrate.h
deleted file mode 100644
index 0386d611e6..0000000000
--- a/addressbook/gui/component/addressbook-migrate.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Chris Toshok (toshok@ximian.com)
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _ADDRESSBOOK_MIGRATE_H_
-#define _ADDRESSBOOK_MIGRATE_H_
-
-#include "addressbook-component.h"
-
-gint addressbook_migrate (AddressbookComponent *component, gint major, gint minor, gint revision, GError **err);
-
-#endif /* _ADDRESSBOOK_MIGRATE_H_ */
diff --git a/addressbook/gui/component/addressbook-view.c b/addressbook/gui/component/addressbook-view.c
deleted file mode 100644
index 6a66a94913..0000000000
--- a/addressbook/gui/component/addressbook-view.c
+++ /dev/null
@@ -1,1533 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Chris Toshok <toshok@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <gdk/gdkkeysyms.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-exception.h>
-#include <e-util/e-util.h>
-#include <libedataserverui/e-source-selector.h>
-#include <libedataserverui/e-passwords.h>
-
-#include "e-util/e-error.h"
-#include "e-util/e-request.h"
-#include "misc/e-task-bar.h"
-#include "misc/e-info-label.h"
-
-#include "e-util/e-icon-factory.h"
-#include "e-util/e-util-private.h"
-#include "shell/e-user-creatable-items-handler.h"
-
-#include "evolution-shell-component-utils.h"
-#include "e-activity-handler.h"
-#include "e-contact-editor.h"
-#include "addressbook-config.h"
-#include "addressbook.h"
-#include "addressbook-view.h"
-#include "addressbook-component.h"
-#include "addressbook/gui/widgets/e-addressbook-view.h"
-#include "addressbook/gui/widgets/eab-gui-util.h"
-#include "addressbook/gui/merging/eab-contact-merging.h"
-#include "addressbook/printing/e-contact-print.h"
-#include "addressbook/util/eab-book-util.h"
-#include "addressbook/gui/widgets/eab-popup.h"
-#include "addressbook/gui/widgets/eab-menu.h"
-
-#define PARENT_TYPE G_TYPE_OBJECT
-static GObjectClass *parent_class = NULL;
-
-#define d(x)
-
-struct _AddressbookViewPrivate {
- GtkWidget *notebook;
- BonoboControl *folder_view_control;
-
- GtkWidget *statusbar_widget;
- EActivityHandler *activity_handler;
-
- GtkWidget *info_widget;
- GtkWidget *sidebar_widget;
- GtkWidget *selector;
-
- GConfClient *gconf_client;
-
- GHashTable *uid_to_view;
- GHashTable *uid_to_editor;
-
- EBook *book;
- guint activity_id;
- ESourceList *source_list;
- gchar *passwd;
- EUserCreatableItemsHandler *creatable_items_handler;
-
- EABMenu *menu;
-};
-
-enum DndTargetType {
- DND_TARGET_TYPE_VCARD_LIST,
- DND_TARGET_TYPE_SOURCE_VCARD_LIST
-};
-#define VCARD_TYPE "text/x-vcard"
-#define SOURCE_VCARD_TYPE "text/x-source-vcard"
-static GtkTargetEntry drag_types[] = {
- { (gchar *) SOURCE_VCARD_TYPE, 0, DND_TARGET_TYPE_SOURCE_VCARD_LIST },
- { (gchar *) VCARD_TYPE, 0, DND_TARGET_TYPE_VCARD_LIST }
-};
-static gint num_drag_types = sizeof(drag_types) / sizeof(drag_types[0]);
-
-static void set_status_message (EABView *eav, const gchar *message, AddressbookView *view);
-static void search_result (EABView *eav, EBookViewStatus status, AddressbookView *view);
-
-static void activate_source (AddressbookView *view, ESource *source);
-
-static void addressbook_view_init (AddressbookView *view);
-static void addressbook_view_class_init (AddressbookViewClass *klass);
-static void addressbook_view_dispose (GObject *object);
-
-static ESource *find_first_source (ESourceList *source_list);
-static ESource *get_primary_source (AddressbookView *view);
-
-typedef struct {
- GtkWidget *editor;
- gchar *uid;
- AddressbookView *view;
-} EditorUidClosure;
-
-static void
-editor_weak_notify (gpointer data, GObject *o)
-{
- EditorUidClosure *closure = data;
- AddressbookViewPrivate *priv = closure->view->priv;
-
- g_hash_table_remove (priv->uid_to_editor,
- closure->uid);
-}
-
-static EABView *
-get_current_view (AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
-
- return EAB_VIEW (gtk_notebook_get_nth_page (GTK_NOTEBOOK (priv->notebook),
- gtk_notebook_get_current_page (GTK_NOTEBOOK (priv->notebook))));
-}
-
-static void
-save_all_contacts_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
-
- if (v)
- eab_view_save_as (v, TRUE);
-}
-
-static void
-save_contact_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_save_as(v, FALSE);
-}
-
-static void
-view_contact_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_view(v);
-}
-
-static void
-delete_contact_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_delete_selection(v, TRUE);
-}
-
-static void
-print_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_print (v, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
-}
-
-static void
-print_preview_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_print (v, GTK_PRINT_OPERATION_ACTION_PREVIEW);
-}
-
-static void
-stop_loading_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_stop(v);
-}
-
-static void
-cut_contacts_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_cut(v);
-}
-
-static void
-copy_contacts_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_copy(v);
-}
-
-static void
-paste_contacts_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_paste(v);
-}
-
-static void
-select_all_contacts_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_select_all (v);
-}
-
-static void
-send_contact_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_send (v);
-}
-
-static void
-send_contact_to_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_send_to (v);
-}
-
-static void
-copy_all_contacts_to_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
-
- if (v)
- eab_view_copy_to_folder (v, TRUE);
-}
-
-static void
-copy_contact_to_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_copy_to_folder (v, FALSE);
-}
-
-static void
-move_all_contacts_to_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_move_to_folder (v, TRUE);
-}
-
-static void
-move_contact_to_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_move_to_folder (v, FALSE);
-}
-
-static void
-forget_passwords_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- e_passwords_forget_passwords();
-}
-
-static void
-new_addressbook_folder (AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- addressbook_config_create_new_source (gtk_widget_get_toplevel(priv->notebook));
-}
-
-static void
-new_folder_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- new_addressbook_folder (view);
-}
-
-static void
-delete_addressbook_folder (AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- ESource *selected_source;
- EBook *book;
- GError *error = NULL;
- GtkWindow *toplevel;
-
- selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->selector));
- if (!selected_source)
- return;
- toplevel = (GtkWindow *) gtk_widget_get_toplevel (priv->notebook);
-
- if (e_error_run (toplevel, "addressbook:ask-delete-addressbook",
- e_source_peek_name(selected_source), NULL) != GTK_RESPONSE_YES)
- return;
-
- /* Remove local data */
- book = e_book_new (selected_source, &error);
- if (book) {
- if (e_book_remove (book, NULL)) {
- if (e_source_selector_source_is_selected (E_SOURCE_SELECTOR (priv->selector),
- selected_source))
- e_source_selector_unselect_source (E_SOURCE_SELECTOR (priv->selector),
- selected_source);
-
- e_source_group_remove_source (e_source_peek_group (selected_source), selected_source);
-
- e_source_list_sync (priv->source_list, NULL);
- }
- else {
- e_error_run (toplevel, "addressbook:remove-addressbook", NULL);
- }
- g_object_unref (book);
- }
- else {
- g_warning ("error removing addressbook : %s", error->message);
- g_error_free (error);
- }
-}
-
-static void
-delete_folder_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- if (view)
- delete_addressbook_folder (view);
-
-}
-
-static void
-edit_addressbook_folder (AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- ESource *selected_source;
- const gchar *uid;
- EditorUidClosure *closure;
-
- selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->selector));
- if (!selected_source)
- return;
-
- uid = e_source_peek_uid (selected_source);
-
- closure = g_hash_table_lookup (priv->uid_to_editor, uid);
- if (!closure) {
- gchar *uid_copy = g_strdup (uid);
-
- closure = g_new (EditorUidClosure, 1);
- closure->editor = addressbook_config_edit_source (gtk_widget_get_toplevel(priv->notebook), selected_source);
- closure->uid = uid_copy;
- closure->view = view;
-
- g_hash_table_insert (priv->uid_to_editor,
- uid_copy,
- closure);
-
- g_object_weak_ref (G_OBJECT (closure->editor),
- editor_weak_notify, closure);
- }
-
- gtk_window_present (GTK_WINDOW (closure->editor));
-
-}
-
-static void
-edit_folder_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- if (view)
- edit_addressbook_folder (view);
-
-}
-
-static void
-rename_addressbook_folder (AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- ESource *source;
- const gchar *old_name;
- gchar *prompt, *new_name;
- gboolean done = FALSE;
-
- source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->selector));
- old_name = e_source_peek_name(source);
- prompt = g_strdup_printf (_("Rename the \"%s\" folder to:"), old_name);
-
- while (!done) {
- new_name = e_request_string (NULL, _("Rename Folder"), prompt, old_name);
- if (new_name == NULL || !strcmp (old_name, new_name)) {
- done = TRUE;
- } else if (strchr(new_name, '/') != NULL) {
- e_error_run (NULL,
- "addressbook:no-rename-folder", old_name, new_name, _("Folder names cannot contain '/'"), NULL);
- done = TRUE;
- } else if (e_source_group_peek_source_by_name(e_source_peek_group(source), new_name)) {
- e_error_run (NULL, "addressbook:no-rename-folder-exists", old_name, new_name, NULL);
- } else {
- e_source_set_name (source, new_name);
- done = TRUE;
- }
- }
- g_free (new_name);
-
-}
-
-static void
-rename_folder_cb (BonoboUIComponent *uih, gpointer user_data, const gchar *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- if (view)
- rename_addressbook_folder (view);
-}
-
-static gboolean
-folder_can_delete (AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- ESource *source;
- const gchar *source_uri;
-
- source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->selector));
- if (source) {
- source_uri = e_source_peek_relative_uri (source);
- if (source_uri && !strcmp("system", source_uri))
- return 0;
- else
- return 1;
- }
- else
- return 0;
-}
-
-static void
-set_status_message (EABView *eav, const gchar *message, AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- EActivityHandler *activity_handler = priv->activity_handler;
-
- if (!message || !*message) {
- if (priv->activity_id != 0) {
- e_activity_handler_operation_finished (activity_handler, priv->activity_id);
- priv->activity_id = 0;
- }
- } else if (priv->activity_id == 0) {
- gchar *clientid = g_strdup_printf ("%p", (gpointer) view);
-
- priv->activity_id = e_activity_handler_operation_started (
- activity_handler, clientid, message, TRUE);
-
- g_free (clientid);
- } else {
- e_activity_handler_operation_progressing (activity_handler, priv->activity_id, message, -1.0);
- }
-
-}
-
-static void
-set_folder_bar_message (EABView *eav, const gchar *message, AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- EABView *current_view = get_current_view (view);
-
- if (eav == current_view) {
- ESource *source = eav->source;
-
- if (source) {
- const gchar *name = e_source_peek_name (source);
-
- e_info_label_set_info((EInfoLabel*)priv->info_widget, name, message);
- }
- }
-}
-
-static void
-search_result (EABView *eav, EBookViewStatus status, AddressbookView *view)
-{
- eab_search_result_dialog (NULL /* XXX */, status);
-}
-
-static void
-update_command_state (EABView *eav, AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- BonoboUIComponent *uic;
- EABMenuTargetSelect *target;
-
- if (eav != get_current_view (view))
- return;
-
- g_object_ref (view);
-
- target = eab_view_get_menu_target(eav, priv->menu);
- e_menu_update_target((EMenu *)priv->menu, target);
-
- uic = bonobo_control_get_ui_component (priv->folder_view_control);
-
- /* TODO: this stuff can mostly be made to use the target bits instead */
-
- if (bonobo_ui_component_get_container (uic) != CORBA_OBJECT_NIL) {
-#define SET_SENSITIVE(verb,f) \
- bonobo_ui_component_set_prop (uic, (verb), "sensitive", (f)(eav) ? "1" : "0", NULL)
-
- SET_SENSITIVE ("/commands/ContactsSaveAsVCard", eab_view_can_save_as);
- SET_SENSITIVE ("/commands/ContactsView", eab_view_can_view);
-
- /* Print Contact */
- SET_SENSITIVE ("/commands/ContactsPrint", eab_view_can_print);
- SET_SENSITIVE ("/commands/ContactsPrintPreview", eab_view_can_print);
-
- /* Delete Contact */
- SET_SENSITIVE ("/commands/ContactDelete", eab_view_can_delete);
- SET_SENSITIVE ("/commands/ContactsCut", eab_view_can_cut);
-
- SET_SENSITIVE ("/commands/ContactsCopy", eab_view_can_copy);
- SET_SENSITIVE ("/commands/ContactsPaste", eab_view_can_paste);
- SET_SENSITIVE ("/commands/ContactsSelectAll", eab_view_can_select_all);
- SET_SENSITIVE ("/commands/ContactsSendContactToOther", eab_view_can_send);
- SET_SENSITIVE ("/commands/ContactsSendMessageToContact", eab_view_can_send_to);
- SET_SENSITIVE ("/commands/ContactsMoveToFolder", eab_view_can_move_to_folder);
- SET_SENSITIVE ("/commands/ContactsCopyToFolder", eab_view_can_copy_to_folder);
-
- bonobo_ui_component_set_prop (uic, ("/commands/FolderDelete"), "sensitive", folder_can_delete(view) ? "1" : "0", NULL);
-
- /* Stop */
- SET_SENSITIVE ("/commands/ContactStop", eab_view_can_stop);
-#undef SET_SENSITIVE
- }
-
- g_object_unref (view);
-}
-
-static BonoboUIVerb verbs [] = {
- BONOBO_UI_UNSAFE_VERB ("ContactsPrint", print_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsPrintPreview", print_preview_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsSaveAsVCard", save_contact_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsView", view_contact_cb),
-
- BONOBO_UI_UNSAFE_VERB ("ContactDelete", delete_contact_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactStop", stop_loading_cb),
-
- BONOBO_UI_UNSAFE_VERB ("ContactsCut", cut_contacts_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsCopy", copy_contacts_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsPaste", paste_contacts_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsSelectAll", select_all_contacts_cb),
-
- BONOBO_UI_UNSAFE_VERB ("ContactsSendContactToOther", send_contact_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsSendMessageToContact", send_contact_to_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsMoveToFolder", move_contact_to_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsCopyToFolder", copy_contact_to_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsForgetPasswords", forget_passwords_cb),
- /* ContactsViewPreview is a toggle */
-
- BONOBO_UI_UNSAFE_VERB ("FolderCreate", new_folder_cb),
- BONOBO_UI_UNSAFE_VERB ("FolderCopy", copy_all_contacts_to_cb),
- BONOBO_UI_UNSAFE_VERB ("FolderMove", move_all_contacts_to_cb),
- BONOBO_UI_UNSAFE_VERB ("FolderSave", save_all_contacts_cb),
- BONOBO_UI_UNSAFE_VERB ("FolderDelete", delete_folder_cb),
- BONOBO_UI_UNSAFE_VERB ("FolderRename", rename_folder_cb),
- BONOBO_UI_UNSAFE_VERB ("ChangeFolderProperties", edit_folder_cb),
-
- BONOBO_UI_VERB_END
-};
-
-static EPixmap pixmaps [] = {
- E_PIXMAP ("/commands/ChangeFolderProperties", "document-properties", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ContactDelete", "edit-delete", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ContactsCopy", "edit-copy", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ContactsCut", "edit-cut", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ContactsPaste", "edit-paste", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ContactsPrint", "document-print", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ContactsPrintPreview", "document-print-preview", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ContactsSaveAsVCard", "document-save-as", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ContactsSendContactToOther", "mail-forward", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/ContactsSendMessageToContact", "mail-message-new", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/FolderCopy", "edit-copy", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/FolderDelete", "edit-delete", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/FolderMove", "folder-move", GTK_ICON_SIZE_MENU),
- E_PIXMAP ("/commands/FolderSave", "document-save-as", GTK_ICON_SIZE_MENU),
-
- E_PIXMAP ("/Toolbar/ContactsPrint", "document-print", GTK_ICON_SIZE_LARGE_TOOLBAR),
- E_PIXMAP ("/Toolbar/ContactDelete", "edit-delete", GTK_ICON_SIZE_LARGE_TOOLBAR),
-
- E_PIXMAP_END
-};
-
-static void
-control_activate (BonoboControl *control,
- BonoboUIComponent *uic,
- AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- Bonobo_UIContainer remote_ui_container;
- EABView *v = get_current_view (view);
- gchar *xmlfile;
-
- remote_ui_container = bonobo_control_get_remote_ui_container (control, NULL);
- bonobo_ui_component_set_container (uic, remote_ui_container, NULL);
- bonobo_object_release_unref (remote_ui_container, NULL);
-
- bonobo_ui_component_add_verb_list_with_data (
- uic, verbs, view);
-
- bonobo_ui_component_freeze (uic, NULL);
-
- xmlfile = g_build_filename (EVOLUTION_UIDIR,
- "evolution-addressbook.xml",
- NULL);
- bonobo_ui_util_set_ui (uic, PREFIX,
- xmlfile,
- "evolution-addressbook", NULL);
- g_free (xmlfile);
-
- if (v)
- eab_view_setup_menus (v, uic);
-
- e_pixmaps_update (uic, pixmaps);
-
- e_user_creatable_items_handler_activate (priv->creatable_items_handler, uic);
-
- bonobo_ui_component_thaw (uic, NULL);
-
- if (v)
- update_command_state (v, view);
-}
-
-static void
-control_activate_cb (BonoboControl *control,
- gboolean activate,
- AddressbookView *view)
-{
- BonoboUIComponent *uic;
- EABView *v = get_current_view (view);
-
- uic = bonobo_control_get_ui_component (control);
- g_return_if_fail (uic != NULL);
-
- if (activate) {
- control_activate (control, uic, view);
- e_menu_activate((EMenu *)view->priv->menu, uic, activate);
- if (activate && v && v->model)
- eab_model_force_folder_bar_message (v->model);
- } else {
- e_menu_activate((EMenu *)view->priv->menu, uic, activate);
- bonobo_ui_component_unset_container (uic, NULL);
- eab_view_discard_menus (v);
- }
-}
-
-static void
-gather_uids_foreach (gchar *key,
- gpointer value,
- GList **list)
-{
- (*list) = g_list_prepend (*list, key);
-}
-
-static void
-source_list_changed_cb (ESourceList *source_list, AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- GList *uids, *l;
- EABView *v;
-
- uids = NULL;
- g_hash_table_foreach (priv->uid_to_view, (GHFunc)gather_uids_foreach, &uids);
- for (l = uids; l; l = l->next) {
- gchar *uid = l->data;
- if (e_source_list_peek_source_by_uid (source_list, uid)) {
- /* the source still exists, do nothing */
- }
- else {
- /* the source no longer exists, remove its
- view remove it from our hash table. */
- v = g_hash_table_lookup (priv->uid_to_view,
- uid);
- gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook),
- gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook),
- GTK_WIDGET (v)));
- g_hash_table_remove (priv->uid_to_view, uid);
- }
- }
- g_list_free (uids);
-
- uids = NULL;
- g_hash_table_foreach (priv->uid_to_editor, (GHFunc)gather_uids_foreach, &uids);
- for (l = uids; l; l = l->next) {
- gchar *uid = l->data;
- if (e_source_list_peek_source_by_uid (source_list, uid)) {
- /* the source still exists, do nothing */
- }
- else {
- /* the source no longer exists, remove its
- editor remove it from our hash table. */
- EditorUidClosure *closure = g_hash_table_lookup (priv->uid_to_editor,
- uid);
- g_object_weak_unref (G_OBJECT (closure->editor),
- editor_weak_notify, closure);
- gtk_widget_destroy (closure->editor);
- g_hash_table_remove (priv->uid_to_editor, uid);
- }
- }
- g_list_free (uids);
-
- /* make sure we've got the current view selected and updated
- properly */
- v = get_current_view (view);
- if (v) {
- eab_view_setup_menus (v, bonobo_control_get_ui_component (priv->folder_view_control));
- update_command_state (v, view);
- }
-}
-
-static void
-load_uri_for_selection (ESourceSelector *selector,
- AddressbookView *view,
- gboolean force)
-{
- ESource *selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (selector));
- ESource *primary = get_primary_source (view);
-
- if (selected_source != NULL &&
- ((primary && (!g_str_equal (e_source_peek_uid (primary),e_source_peek_uid (selected_source) )))||force))
- activate_source (view, selected_source);
-}
-
-static ESource *
-find_first_source (ESourceList *source_list)
-{
- GSList *groups, *sources, *l, *m;
-
- groups = e_source_list_peek_groups (source_list);
- for (l = groups; l; l = l->next) {
- ESourceGroup *group = l->data;
-
- sources = e_source_group_peek_sources (group);
- for (m = sources; m; m = m->next) {
- ESource *source = m->data;
-
- return source;
- }
- }
-
- return NULL;
-}
-
-static void
-save_primary_selection (AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- ESource *source;
-
- source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->selector));
- if (!source)
- return;
-
- /* Save the selection for next time we start up */
- gconf_client_set_string (priv->gconf_client,
- "/apps/evolution/addressbook/display/primary_addressbook",
- e_source_peek_uid (source), NULL);
-}
-
-static ESource *
-get_primary_source (AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- ESource *source;
- gchar *uid;
-
- uid = gconf_client_get_string (priv->gconf_client,
- "/apps/evolution/addressbook/display/primary_addressbook",
- NULL);
- if (uid) {
- source = e_source_list_peek_source_by_uid (priv->source_list, uid);
- g_free (uid);
- } else {
- /* Try to create a default if there isn't one */
- source = find_first_source (priv->source_list);
- }
-
- return source;
-}
-
-static void
-load_primary_selection (AddressbookView *view)
-{
- AddressbookViewPrivate *priv = view->priv;
- ESource *source;
-
- source = get_primary_source (view);
- if (source)
- e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (priv->selector), source);
-}
-
-/* Folder popup menu callbacks */
-typedef struct {
- AddressbookView *view;
- ESource *selected_source;
- GtkWidget *toplevel;
-} BookRemovedClosure;
-
-static void
-book_removed (EBook *book, EBookStatus status, gpointer data)
-{
- BookRemovedClosure *closure = data;
- AddressbookView *view = closure->view;
- AddressbookViewPrivate *priv = view->priv;
- ESource *source = closure->selected_source;
- GtkWidget *toplevel = closure->toplevel;
-
- g_free (closure);
-
- g_object_unref (book);
-
- if (E_BOOK_ERROR_OK == status) {
- /* Remove source */
- if (e_source_selector_source_is_selected (E_SOURCE_SELECTOR (priv->selector),
- source))
- e_source_selector_unselect_source (E_SOURCE_SELECTOR (priv->selector),
- source);
-
- e_source_group_remove_source (e_source_peek_group (source), source);
-
- e_source_list_sync (priv->source_list, NULL);
- }
- else {
- e_error_run (GTK_WINDOW (toplevel),
- "addressbook:remove-addressbook",
- NULL);
- }
-}
-
-static void
-delete_addressbook_cb(EPopup *ep, EPopupItem *pitem, gpointer data)
-{
- AddressbookView *view = data;
- AddressbookViewPrivate *priv = view->priv;
- ESource *selected_source;
- EBook *book;
- GError *error = NULL;
- GtkWindow *toplevel;
-
- selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->selector));
- if (!selected_source)
- return;
-
- toplevel = (GtkWindow *)gtk_widget_get_toplevel(ep->target->widget);
-
- if (e_error_run (toplevel, "addressbook:ask-delete-addressbook", e_source_peek_name(selected_source), NULL) != GTK_RESPONSE_YES)
- return;
-
- /* Remove local data */
- book = e_book_new (selected_source, &error);
- if (book) {
- BookRemovedClosure *closure = g_new (BookRemovedClosure, 1);
-
- closure->toplevel = (GtkWidget *)toplevel;
- closure->view = view;
- closure->selected_source = selected_source;
-
- if (e_book_async_remove (book, book_removed, closure)) {
- e_error_run (toplevel, "addressbook:remove-addressbook", NULL);
- g_free (closure);
- g_object_unref (book);
- }
- }
-}
-
-static void
-new_addressbook_cb(EPopup *ep, EPopupItem *pitem, gpointer data)
-{
- addressbook_config_create_new_source (gtk_widget_get_toplevel(ep->target->widget));
-}
-
-static void
-rename_addressbook_cb (EPopup *ep, EPopupItem *pitem, gpointer data)
-{
- AddressbookView *view = data;
- ESourceSelector *selector;
-
- selector = E_SOURCE_SELECTOR (view->priv->selector);
- e_source_selector_edit_primary_selection (selector);
-}
-
-static void
-save_addressbook_cb(EPopup *ep, EPopupItem *pitem, gpointer data)
-{
- AddressbookView *view = data;
- EABView *v = get_current_view (view);
- if (v)
- eab_view_save_as (v, TRUE);
-}
-
-static void
-edit_addressbook_cb(EPopup *ep, EPopupItem *pitem, gpointer data)
-{
- AddressbookView *view = data;
- if (view)
- edit_addressbook_folder (view);
-}
-
-/* Callbacks. */
-
-static void
-primary_source_selection_changed_callback (ESourceSelector *selector,
- AddressbookView *view)
-{
- load_uri_for_selection (selector, view, FALSE);
- save_primary_selection (view);
-}
-
-static EPopupItem abv_source_popups[] = {
- { E_POPUP_ITEM, (gchar *) "10.new", (gchar *) N_("_New Address Book"), new_addressbook_cb, NULL, (gchar *) "address-book-new", 0, 0 },
- { E_POPUP_ITEM, (gchar *) "20.saveasvcard", (gchar *) N_("Save As vCard..."), save_addressbook_cb, NULL, (gchar *) "document-save-as", 0, EAB_POPUP_SOURCE_PRIMARY },
- { E_POPUP_ITEM, (gchar *) "25.rename", (gchar *) N_("_Rename..."), rename_addressbook_cb, NULL, NULL, 0, EAB_POPUP_SOURCE_PRIMARY },
-
- { E_POPUP_BAR, (gchar *) "30.bar" },
- { E_POPUP_ITEM, (gchar *) "30.delete", (gchar *) N_("_Delete"), delete_addressbook_cb, NULL, (gchar *) "edit-delete", 0, EAB_POPUP_SOURCE_USER|EAB_POPUP_SOURCE_PRIMARY },
-
- { E_POPUP_BAR, (gchar *) "99.bar" },
- { E_POPUP_ITEM, (gchar *) "99.properties", (gchar *) N_("_Properties"), edit_addressbook_cb, NULL, (gchar *) "document-properties", 0, EAB_POPUP_SOURCE_PRIMARY },
-};
-
-static void
-abv_source_popup_free(EPopup *ep, GSList *list, gpointer data)
-{
- g_slist_free(list);
-}
-
-static gboolean
-popup_event_callback(ESourceSelector *selector, ESource *source, GdkEventButton *event, AddressbookView *view)
-{
- EABPopup *ep;
- EABPopupTargetSource *t;
- GSList *menus = NULL;
- gint i;
- GtkMenu *menu;
-
- /** @HookPoint-EABPopup:Addressbook Source Selector Context Menu
- * @Id: org.gnome.evolution.addressbook.source.popup
- * @Class: org.gnome.evolution.addresbook.popup:1.0
- * @Target: EABPopupTargetSource
- *
- * The context menu on the source selector in the contacts window.
- */
-
- ep = eab_popup_new("org.gnome.evolution.addressbook.source.popup");
- t = eab_popup_target_new_source(ep, selector);
- t->target.widget = (GtkWidget *)view->priv->notebook;
-
- for (i=0;i<sizeof(abv_source_popups)/sizeof(abv_source_popups[0]);i++)
- menus = g_slist_prepend(menus, &abv_source_popups[i]);
-
- e_popup_add_items((EPopup *)ep, menus, NULL, abv_source_popup_free, view);
-
- menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0);
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event?event->button:0, event?event->time:gtk_get_current_event_time());
-
- return TRUE;
-}
-
-typedef struct
-{
- guint remove_from_source : 1;
- guint copy_done : 1;
- gint pending_removals;
-
- EContact *current_contact;
- GList *remaining_contacts;
-
- EBook *source_book;
- EBook *target_book;
-}
-MergeContext;
-
-static void
-destroy_merge_context (MergeContext *merge_context)
-{
- if (merge_context->source_book)
- g_object_unref (merge_context->source_book);
- if (merge_context->target_book)
- g_object_unref (merge_context->target_book);
-
- g_free (merge_context);
-}
-
-static void
-removed_contact_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- MergeContext *merge_context = closure;
-
- merge_context->pending_removals--;
-
- if (merge_context->copy_done && merge_context->pending_removals == 0) {
- /* Finished */
-
- destroy_merge_context (merge_context);
- }
-}
-
-static void
-merged_contact_cb (EBook *book, EBookStatus status, const gchar *id, gpointer closure)
-{
- MergeContext *merge_context = closure;
-
- if (merge_context->remove_from_source && status == E_BOOK_ERROR_OK) {
- /* Remove previous contact from source */
-
- e_book_async_remove_contact (merge_context->source_book, merge_context->current_contact,
- removed_contact_cb, merge_context);
- merge_context->pending_removals++;
- }
-
- g_object_unref (merge_context->current_contact);
-
- if (merge_context->remaining_contacts) {
- /* Copy next contact */
-
- merge_context->current_contact = merge_context->remaining_contacts->data;
- merge_context->remaining_contacts = g_list_delete_link (merge_context->remaining_contacts,
- merge_context->remaining_contacts);
- eab_merging_book_add_contact (merge_context->target_book, merge_context->current_contact,
- merged_contact_cb, merge_context);
- } else if (merge_context->pending_removals == 0) {
- /* Finished */
-
- destroy_merge_context (merge_context);
- } else {
- /* Finished, but have pending removals */
-
- merge_context->copy_done = TRUE;
- }
-}
-
-static gboolean
-selector_tree_data_dropped (ESourceSelector *selector,
- GtkSelectionData *data,
- ESource *destination,
- GdkDragAction action,
- guint info,
- AddressbookView *view)
-{
- EBook *source_book, *target_book;
- MergeContext *merge_context = NULL;
- GList *contactlist;
- EABView *v;
-
- target_book = e_book_new (destination, NULL);
- if (!target_book) {
- g_message (G_STRLOC ":Couldn't create EBook.");
- return FALSE;
- }
- e_book_open (target_book, FALSE, NULL);
-
- eab_book_and_contact_list_from_string ((gchar *)data->data, &source_book, &contactlist);
-
- v = get_current_view (view);
- g_object_get (v->model, "book",&source_book, NULL);
-
- /* Set up merge context */
-
- merge_context = g_new0 (MergeContext, 1);
-
- merge_context->source_book = source_book;
- merge_context->target_book = target_book;
-
- merge_context->current_contact = contactlist->data;
- merge_context->remaining_contacts = g_list_delete_link (contactlist, contactlist);
-
- merge_context->remove_from_source = action == GDK_ACTION_MOVE ? TRUE : FALSE;
-
- /* Start merge */
-
- eab_merging_book_add_contact (target_book, merge_context->current_contact,
- merged_contact_cb, merge_context);
-
- return TRUE;
-}
-
-static void
-destroy_callback(gpointer data, GObject *where_object_was)
-{
- AddressbookView *view = data;
- g_object_unref (view);
-}
-
-GType
-addressbook_view_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (AddressbookViewClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) addressbook_view_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EABView),
- 0, /* n_preallocs */
- (GInstanceInitFunc) addressbook_view_init,
- };
-
- type = g_type_register_static (PARENT_TYPE, "AddressbookView", &info, 0);
- }
-
- return type;
-}
-
-static void
-addressbook_view_class_init (AddressbookViewClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->dispose = addressbook_view_dispose;
-
- parent_class = g_type_class_peek_parent (klass);
-}
-
-static gboolean
-source_selector_key_press_event_callback (GtkWidget *widget, GdkEventKey *event, AddressbookView *view)
-{
- if (event->keyval == GDK_Delete) {
- /* suppress delete key press in a source selector */
- return TRUE;
- }
- return FALSE;
-}
-
-static void
-addressbook_view_init (AddressbookView *view)
-{
- AddressbookViewPrivate *priv;
- GtkWidget *selector_scrolled_window;
- AtkObject *a11y;
-
- view->priv =
- priv = g_new0 (AddressbookViewPrivate, 1);
-
- priv->gconf_client = addressbook_component_peek_gconf_client (addressbook_component_peek ());
-
- priv->uid_to_view = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify)g_free, (GDestroyNotify)g_object_unref);
- priv->uid_to_editor = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify)g_free, (GDestroyNotify)g_free);
-
- priv->notebook = gtk_notebook_new ();
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
- gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
-
- g_object_weak_ref (G_OBJECT (priv->notebook), destroy_callback, view);
-
- /* Create the control. */
- priv->folder_view_control = bonobo_control_new (priv->notebook);
-
- gtk_widget_show (priv->notebook);
-
- e_book_get_addressbooks (&priv->source_list, NULL);
- g_signal_connect (priv->source_list,
- "changed",
- G_CALLBACK (source_list_changed_cb), view);
-
- priv->creatable_items_handler = e_user_creatable_items_handler_new ("contacts", NULL, NULL);
- priv->menu = eab_menu_new("org.gnome.evolution.addressbook.view");
-
- g_signal_connect (priv->folder_view_control, "activate",
- G_CALLBACK (control_activate_cb), view);
-
- priv->activity_handler = e_activity_handler_new ();
-
- priv->statusbar_widget = e_task_bar_new ();
- gtk_widget_show (priv->statusbar_widget);
-
- e_activity_handler_attach_task_bar (priv->activity_handler,
- E_TASK_BAR (priv->statusbar_widget));
-
- priv->info_widget = e_info_label_new("x-office-address-book");
- e_info_label_set_info((EInfoLabel*)priv->info_widget, _("Contacts"), "");
- gtk_widget_show (priv->info_widget);
-
- priv->selector = e_source_selector_new (priv->source_list);
-
- g_signal_connect (
- priv->selector, "data-dropped",
- G_CALLBACK (selector_tree_data_dropped), view);
- gtk_drag_dest_set (priv->selector, GTK_DEST_DEFAULT_ALL, drag_types, num_drag_types, GDK_ACTION_COPY | GDK_ACTION_MOVE);
- a11y = gtk_widget_get_accessible (GTK_WIDGET (priv->selector));
- atk_object_set_name (a11y, _("Contact Source Selector"));
-
- e_source_selector_show_selection (E_SOURCE_SELECTOR (priv->selector), FALSE);
- gtk_widget_show (priv->selector);
-
- selector_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (selector_scrolled_window), GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (selector_scrolled_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (selector_scrolled_window), priv->selector);
- gtk_widget_show (selector_scrolled_window);
-
- priv->sidebar_widget = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX (priv->sidebar_widget), priv->info_widget, FALSE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX (priv->sidebar_widget), selector_scrolled_window, TRUE, TRUE, 0);
- gtk_widget_show (priv->sidebar_widget);
-
- g_signal_connect_object (priv->selector, "primary_selection_changed",
- G_CALLBACK (primary_source_selection_changed_callback),
- G_OBJECT (view), 0);
- g_signal_connect_after (priv->selector, "key_press_event",
- G_CALLBACK (source_selector_key_press_event_callback),
- G_OBJECT (view));
- g_signal_connect_object (priv->selector, "popup_event",
- G_CALLBACK (popup_event_callback),
- G_OBJECT (view), 0);
-
- load_primary_selection (view);
- load_uri_for_selection (E_SOURCE_SELECTOR (priv->selector), view, TRUE);
-}
-
-static void
-destroy_editor (gchar *key,
- gpointer value,
- gpointer nada)
-{
- EditorUidClosure *closure = value;
-
- g_object_weak_unref (G_OBJECT (closure->editor),
- editor_weak_notify, closure);
-
- gtk_widget_destroy (GTK_WIDGET (closure->editor));
-}
-
-static void
-addressbook_view_dispose (GObject *object)
-{
- AddressbookView *view = ADDRESSBOOK_VIEW (object);
- AddressbookViewPrivate *priv = view->priv;
-
- if (view->priv) {
- if (priv->book)
- g_object_unref (priv->book);
-
- g_free(priv->passwd);
-
- if (priv->source_list)
- g_object_unref (priv->source_list);
-
- if (priv->uid_to_view)
- g_hash_table_destroy (priv->uid_to_view);
-
- if (priv->uid_to_editor) {
- g_hash_table_foreach (priv->uid_to_editor, (GHFunc)destroy_editor, NULL);
- g_hash_table_destroy (priv->uid_to_editor);
- }
-
- if (priv->creatable_items_handler)
- g_object_unref (priv->creatable_items_handler);
-
- if (priv->menu)
- g_object_unref (priv->menu);
-
- g_free (view->priv);
- view->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-typedef struct {
- EABView *view;
- ESource *source;
-} BookOpenData;
-
-static void
-book_open_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- BookOpenData *data = closure;
- EABView *view = data->view;
- ESource *source = data->source;
-
- g_free (data);
-
- /* we always set the "source" property on the EABView, since
- we use it to reload a previously failed book. */
- g_object_set(view,
- "source", source,
- NULL);
-
- if (status == E_BOOK_ERROR_OK) {
- g_object_set(view,
- "book", book,
- NULL);
-
- if (view->model)
- eab_model_force_folder_bar_message (view->model);
- }
- else if (status != E_BOOK_ERROR_CANCELLED) {
- eab_load_error_dialog (NULL /* XXX */, source, status);
- }
-
- g_object_unref (source);
-}
-
-static void
-activate_source (AddressbookView *view,
- ESource *source)
-{
- AddressbookViewPrivate *priv = view->priv;
- const gchar *uid;
- GtkWidget *uid_view;
- EBook *book;
- BookOpenData *data;
-
- uid = e_source_peek_uid (source);
- uid_view = g_hash_table_lookup (priv->uid_to_view, uid);
-
- if (uid_view) {
- /* there is a view for this uid. make
- sure that the view actually
- contains an EBook (if it doesn't
- contain an EBook a previous load
- failed. try to load it again */
- g_object_get (uid_view,
- "book", &book,
- NULL);
-
- if (book) {
- g_object_unref (book);
- }
- else {
- g_object_get (uid_view,
- "source", &source,
- NULL);
-
- /* source can be NULL here, if
- a previous load hasn't
- actually made it to
- book_open_cb yet. */
- if (source) {
- book = e_book_new (source, NULL);
-
- if (!book) {
- g_object_unref (source);
- }
- else {
- data = g_new (BookOpenData, 1);
- data->view = g_object_ref (uid_view);
- data->source = source; /* transfer the ref we get back from g_object_get */
-
- addressbook_load (book, book_open_cb, data);
- }
- }
- }
- }
- else {
- /* we don't have a view for this uid already
- set up. */
- GtkWidget *label = gtk_label_new (uid);
- GError *error = NULL;
-
- uid_view = eab_view_new ();
-
- gtk_widget_show (uid_view);
- gtk_widget_show (label);
-
- g_object_set (uid_view, "type", EAB_VIEW_TABLE, NULL);
-
- gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
- uid_view,
- label);
-
- g_hash_table_insert (priv->uid_to_view, g_strdup (uid), uid_view);
-
- g_signal_connect (uid_view, "status_message",
- G_CALLBACK(set_status_message), view);
-
- g_signal_connect (uid_view, "search_result",
- G_CALLBACK(search_result), view);
-
- g_signal_connect (uid_view, "folder_bar_message",
- G_CALLBACK(set_folder_bar_message), view);
-
- g_signal_connect (uid_view, "command_state_change",
- G_CALLBACK(update_command_state), view);
-
- book = e_book_new (source, &error);
-
- if (book) {
- data = g_new (BookOpenData, 1);
- data->view = g_object_ref (uid_view);
- data->source = g_object_ref (source);
-
- addressbook_load (book, book_open_cb, data);
- }
- else {
- g_warning ("error loading addressbook : %s", error->message);
- g_error_free (error);
- }
- }
-
- gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook),
- gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook),
- uid_view));
-
- if (EAB_VIEW (uid_view)->model)
- eab_model_force_folder_bar_message (EAB_VIEW (uid_view)->model);
-
- /* change menus/toolbars to reflect the new view, assuming we are already displayed */
- if (bonobo_ui_component_get_container (bonobo_control_get_ui_component (priv->folder_view_control)) != CORBA_OBJECT_NIL) {
- eab_view_setup_menus (EAB_VIEW (uid_view), bonobo_control_get_ui_component (priv->folder_view_control));
- update_command_state (EAB_VIEW (uid_view), view);
- }
-}
-
-AddressbookView *
-addressbook_view_new (void)
-{
- return g_object_new (ADDRESSBOOK_TYPE_VIEW, NULL);
-}
-
-EActivityHandler*
-addressbook_view_peek_activity_handler (AddressbookView *view)
-{
- g_return_val_if_fail (ADDRESSBOOK_IS_VIEW (view), NULL);
-
- return view->priv->activity_handler;
-}
-
-GtkWidget*
-addressbook_view_peek_info_label (AddressbookView *view)
-{
- g_return_val_if_fail (ADDRESSBOOK_IS_VIEW (view), NULL);
-
- return view->priv->info_widget;
-}
-
-GtkWidget*
-addressbook_view_peek_sidebar (AddressbookView *view)
-{
- g_return_val_if_fail (ADDRESSBOOK_IS_VIEW (view), NULL);
-
- return view->priv->sidebar_widget;
-}
-
-GtkWidget*
-addressbook_view_peek_statusbar (AddressbookView *view)
-{
- g_return_val_if_fail (ADDRESSBOOK_IS_VIEW (view), NULL);
-
- return view->priv->statusbar_widget;
-}
-
-BonoboControl*
-addressbook_view_peek_folder_view (AddressbookView *view)
-{
- g_return_val_if_fail (ADDRESSBOOK_IS_VIEW (view), NULL);
-
- return view->priv->folder_view_control;
-}
-
-void
-addressbook_view_edit_contact (AddressbookView* view,
- const gchar * source_uid,
- const gchar * contact_uid)
-{
- AddressbookViewPrivate *priv = view->priv;
-
- ESource* source = NULL;
- EContact* contact = NULL;
- EBook* book = NULL;
-
- if (!source_uid || !contact_uid)
- return;
-
- source = e_source_list_peek_source_by_uid (priv->source_list, source_uid);
- if (!source)
- return;
-
- /* FIXME: Can I unref this book? */
- book = e_book_new (source, NULL);
- if (!book)
- return;
-
- if (!e_book_open (book, TRUE, NULL)) {
- g_object_unref (book);
- return;
- }
-
- e_book_get_contact (book, contact_uid, &contact, NULL);
-
- if (!contact) {
- g_object_unref (book);
- return;
- }
- eab_show_contact_editor (book, contact, FALSE, FALSE);
- g_object_unref (contact);
- g_object_unref (book);
-}
diff --git a/addressbook/gui/component/addressbook-view.h b/addressbook/gui/component/addressbook-view.h
deleted file mode 100644
index 38554b7acf..0000000000
--- a/addressbook/gui/component/addressbook-view.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Chris Toshok <toshok@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _ADDRESSBOOK_VIEW_H_
-#define _ADDRESSBOOK_VIEW_H_
-
-#include <bonobo/bonobo-control.h>
-
-#define ADDRESSBOOK_TYPE_VIEW (addressbook_view_get_type ())
-#define ADDRESSBOOK_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ADDRESSBOOK_TYPE_VIEW, AddressbookView))
-#define ADDRESSBOOK_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ADDRESSBOOK_TYPE_VIEW, AddressbookViewClass))
-#define ADDRESSBOOK_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ADDRESSBOOK_TYPE_VIEW))
-#define ADDRESSBOOK_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), ADDRESSBOOK_TYPE_VIEW))
-
-typedef struct _AddressbookView AddressbookView;
-typedef struct _AddressbookViewPrivate AddressbookViewPrivate;
-typedef struct _AddressbookViewClass AddressbookViewClass;
-
-struct _AddressbookView {
- GObject parent;
-
- AddressbookViewPrivate *priv;
-};
-
-struct _AddressbookViewClass {
- GObjectClass parent_class;
-};
-
-GType addressbook_view_get_type (void);
-
-AddressbookView *addressbook_view_new (void);
-
-EActivityHandler *addressbook_view_peek_activity_handler (AddressbookView *view);
-GtkWidget *addressbook_view_peek_info_label (AddressbookView *view);
-GtkWidget *addressbook_view_peek_sidebar (AddressbookView *view);
-GtkWidget *addressbook_view_peek_statusbar (AddressbookView *view);
-BonoboControl *addressbook_view_peek_folder_view (AddressbookView *view);
-
-void addressbook_view_edit_contact (AddressbookView* view,
- const gchar * source_id,
- const gchar * contact_id);
-
-#endif /* _ADDRESSBOOK_VIEW_H_ */
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
deleted file mode 100644
index 7caa545059..0000000000
--- a/addressbook/gui/component/addressbook.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#include <config.h>
-
-#include <string.h>
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <libebook/e-book.h>
-#include <libedataserver/e-url.h>
-#include <libedataserverui/e-passwords.h>
-
-#include "e-util/e-error.h"
-#include "addressbook.h"
-
-#define d(x)
-
-static void addressbook_authenticate (EBook *book, gboolean previous_failure,
- ESource *source, EBookCallback cb, gpointer closure);
-static void auth_required_cb (EBook *book, gpointer data);
-
-typedef struct {
- EBookCallback cb;
- ESource *source;
- gpointer closure;
- guint cancelled : 1;
-} LoadSourceData;
-
-static void
-free_load_source_data (LoadSourceData *data)
-{
- if (data->source)
- g_object_unref (data->source);
- g_free (data);
-}
-
-/*this function removes of anything present after semicolon
-in uri*/
-
-static gchar *
-remove_parameters_from_uri (const gchar *uri)
-{
- gchar *euri_str;
- EUri *euri;
-
- euri = e_uri_new (uri);
- euri_str = e_uri_to_string (euri, FALSE);
- e_uri_free (euri);
- return euri_str;
-}
-
-static void
-load_source_auth_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- LoadSourceData *data = closure;
- gboolean was_in = g_object_get_data (G_OBJECT (book), "authenticated") != NULL;
-
- g_object_set_data (G_OBJECT (book), "authenticated", NULL);
-
- if (data->cancelled) {
- free_load_source_data (data);
- return;
- }
-
- if (status != E_BOOK_ERROR_OK) {
-
- /* the user clicked cancel in the password dialog */
- if (status == E_BOOK_ERROR_CANCELLED) {
-
- if (e_book_check_static_capability (book, "anon-access")) {
-
- GtkWidget *dialog;
-
- /* XXX "LDAP" has to be removed from the folowing message
- so that it wil valid for other servers which provide
- anonymous access*/
-
- dialog = gtk_message_dialog_new (NULL,
- 0,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_OK,
- "%s", _("Accessing LDAP Server anonymously"));
- g_signal_connect (dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL);
- gtk_widget_show (dialog);
- status = E_BOOK_ERROR_OK;
-
- goto done;
- }
- } else if (status == E_BOOK_ERROR_INVALID_SERVER_VERSION) {
- e_error_run (NULL, "addressbook:server-version", NULL);
- status = E_BOOK_ERROR_OK;
- goto done;
- } else if (status == E_BOOK_ERROR_UNSUPPORTED_AUTHENTICATION_METHOD) {
- goto done;
- } else {
- if (status == E_BOOK_ERROR_AUTHENTICATION_FAILED) {
- const gchar *uri = e_book_get_uri (book);
- gchar *stripped_uri = remove_parameters_from_uri (uri);
- const gchar *auth_domain = e_source_get_property (data->source, "auth-domain");
- const gchar *component_name;
-
- component_name = auth_domain ? auth_domain : "Addressbook";
-
- e_passwords_forget_password (component_name, stripped_uri);
-
- g_free (stripped_uri);
- } else if (was_in) {
- /* We already tried to authenticate to the server, and it failed with
- other reason than with E_BOOK_ERROR_AUTHENTICATION_FAILED, thus stop
- poking with the server and report error to the user. */
- goto done;
- }
-
- g_object_set_data (G_OBJECT (book), "authenticated", GINT_TO_POINTER (1));
- addressbook_authenticate (book, TRUE, data->source, load_source_auth_cb, closure);
- return;
- }
- }
-
-done:
- if (data->cb)
- data->cb (book, status, data->closure);
-
- free_load_source_data (data);
-}
-
-static gboolean
-get_remember_password (ESource *source)
-{
- const gchar *value;
-
- value = e_source_get_property (source, "remember_password");
- if (value && !g_ascii_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, ESource *source,
- EBookCallback cb, gpointer closure)
-{
- const gchar *password = NULL;
- gchar *pass_dup = NULL;
- const gchar *auth;
- const gchar *user;
- gchar *uri = remove_parameters_from_uri(e_book_get_uri (book));
- const gchar *auth_domain = e_source_get_property (source, "auth-domain");
- const gchar *component_name;
-
- component_name = auth_domain ? auth_domain : "Addressbook";
-
- password = e_passwords_get_password (component_name, uri);
-
- auth = e_source_get_property (source, "auth");
-
- if (auth && !strcmp ("ldap/simple-binddn", auth)) {
- user = e_source_get_property (source, "binddn");
- }
- else if (auth && !strcmp ("plain/password", auth)) {
- user = e_source_get_property (source, "user");
- if (!user) {
- user = e_source_get_property (source, "username");
- }
- }
- else {
- user = e_source_get_property (source, "email_addr");
- }
- if (!user)
- user = "";
-
- if (!password) {
- gchar *prompt;
- gchar *password_prompt;
- gboolean remember;
- const gchar *failed_auth;
- guint32 flags = E_PASSWORDS_REMEMBER_FOREVER|E_PASSWORDS_SECRET|E_PASSWORDS_ONLINE;
-
- if (previous_failure) {
- failed_auth = _("Failed to authenticate.\n");
- flags |= E_PASSWORDS_REPROMPT;
- }
- else {
- failed_auth = "";
- }
-
- password_prompt = g_strdup_printf (_("Enter password for %s (user %s)"),
- e_source_peek_name (source), user);
-
- prompt = g_strconcat (failed_auth, password_prompt, NULL);
- g_free (password_prompt);
-
- remember = get_remember_password (source);
- pass_dup = e_passwords_ask_password (
- _("Enter password"), component_name,
- uri, prompt, flags, &remember, NULL);
- if (remember != get_remember_password (source))
- set_remember_password (source, remember);
-
- g_free (prompt);
- }
-
- if (password || pass_dup) {
- e_book_async_authenticate_user (book, user, password ? password : pass_dup,
- e_source_get_property (source, "auth"),
- cb, closure);
- g_free (pass_dup);
- }
- else {
- /* they hit cancel */
- cb (book, E_BOOK_ERROR_CANCELLED, closure);
- }
-
- g_free (uri);
-}
-
-static void
-auth_required_cb (EBook *book, gpointer data)
-{
- LoadSourceData *load_source_data = g_new0(LoadSourceData, 1);
-
- load_source_data->source = g_object_ref (g_object_ref (e_book_get_source (book)));
- load_source_data->cancelled = FALSE;
- addressbook_authenticate (book, FALSE, load_source_data->source,
- load_source_auth_cb, load_source_data);
-
-}
-static void
-load_source_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- LoadSourceData *load_source_data = closure;
-
- if (load_source_data->cancelled) {
- free_load_source_data (load_source_data);
- return;
- }
-
- if (status == E_BOOK_ERROR_OK && book != NULL) {
- const gchar *auth;
-
- auth = e_source_get_property (load_source_data->source, "auth");
- if (auth && strcmp (auth, "none")) {
- g_signal_connect (book, "auth_required", G_CALLBACK(auth_required_cb), NULL);
-
- if (e_book_is_online (book)) {
- addressbook_authenticate (book, FALSE, load_source_data->source,
- load_source_auth_cb, closure);
- return;
- }
- }
- }
- load_source_data->cb (book, status, load_source_data->closure);
- free_load_source_data (load_source_data);
-}
-
-guint
-addressbook_load (EBook *book,
- EBookCallback cb, gpointer closure)
-{
- LoadSourceData *load_source_data = g_new0 (LoadSourceData, 1);
-
- load_source_data->cb = cb;
- load_source_data->closure = closure;
- load_source_data->source = g_object_ref (g_object_ref (e_book_get_source (book)));
- load_source_data->cancelled = FALSE;
-
- e_book_async_open (book, FALSE, load_source_cb, load_source_data);
-
- return GPOINTER_TO_UINT (load_source_data);
-}
-
-void
-addressbook_load_cancel (guint id)
-{
- LoadSourceData *load_source_data = GUINT_TO_POINTER (id);
-
- load_source_data->cancelled = TRUE;
-}
-
-static void
-default_book_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- LoadSourceData *load_source_data = closure;
-
- if (status == E_BOOK_ERROR_OK)
- load_source_data->source = g_object_ref (e_book_get_source (book));
-
- load_source_cb (book, status, closure);
-}
-
-void
-addressbook_load_default_book (EBookCallback cb, gpointer closure)
-{
- LoadSourceData *load_source_data = g_new (LoadSourceData, 1);
- EBook *book;
-
- load_source_data->cb = cb;
- load_source_data->source = NULL;
- load_source_data->closure = closure;
- load_source_data->cancelled = FALSE;
-
- book = e_book_new_default_addressbook (NULL);
- if (!book)
- load_source_cb (NULL, E_BOOK_ERROR_OTHER_ERROR, load_source_data); /* XXX we should just use a GError and it's error code here */
- else
- e_book_async_open (book, FALSE, default_book_cb, load_source_data);
-}
diff --git a/addressbook/gui/component/addressbook.h b/addressbook/gui/component/addressbook.h
deleted file mode 100644
index 3997c9c176..0000000000
--- a/addressbook/gui/component/addressbook.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef __ADDRESSBOOK_H__
-#define __ADDRESSBOOK_H__
-
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-object.h>
-#include <bonobo/bonobo-moniker-util.h>
-#include <libebook/e-book.h>
-
-guint addressbook_load (EBook *book, EBookCallback cb, gpointer closure);
-void addressbook_load_cancel (guint id);
-void addressbook_load_default_book (EBookCallback open_response, gpointer closure);
-
-#endif /* __ADDRESSBOOK_H__ */
diff --git a/addressbook/gui/component/apps_evolution_addressbook.schemas.in b/addressbook/gui/component/apps_evolution_addressbook.schemas.in
deleted file mode 100644
index 4a336409df..0000000000
--- a/addressbook/gui/component/apps_evolution_addressbook.schemas.in
+++ /dev/null
@@ -1,82 +0,0 @@
-<gconfschemafile>
- <schemalist>
-
- <!-- Completion uris -->
-
- <schema>
- <key>/schemas/apps/evolution/addressbook/completion/uris</key>
- <applyto>/apps/evolution/addressbook/completion/uris</applyto>
- <owner>evolution-addressbook</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>EFolderList XML for the list of completion URIs</short>
- <long>EFolderList XML for the list of completion URIs.</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/evolution/addressbook/completion/minimum_query_length</key>
- <applyto>/apps/evolution/addressbook/completion/minimum_query_length</applyto>
- <owner>evolution-addressbook</owner>
- <type>int</type>
- <default>3</default>
- <locale name="C">
- <short>Autocomplete length</short>
- <long>The number of characters that must be typed before Evolution will attempt to autocomplete.</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/evolution/addressbook/completion/show_address</key>
- <applyto>/apps/evolution/addressbook/completion/show_address</applyto>
- <owner>evolution-addressbook</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Show autocompleted name with an address</short>
- <long>Whether force showing the mail address with the name of the autocompleted contact in the entry.</long>
- </locale>
- </schema>
-
- <!-- Select names last used uri -->
-
- <schema>
- <key>/schemas/apps/evolution/addressbook/select_names/last_used_uri</key>
- <applyto>/apps/evolution/addressbook/select_names/last_used_uri</applyto>
- <owner>evolution-addressbook</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>URI for the folder last used in the select names dialog</short>
- <long>URI for the folder last used in the select names dialog.</long>
- </locale>
- </schema>
-
- <!-- View state -->
-
- <schema>
- <key>/schemas/apps/evolution/addressbook/display/vpane_position</key>
- <applyto>/apps/evolution/addressbook/display/vpane_position</applyto>
- <owner>evolution-addressbook</owner>
- <type>int</type>
- <locale name="C">
- <short>Vertical pane position</short>
- <long>Position of the vertical pane, between the card and list views and the preview pane, in pixels.</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/evolution/addressbook/display/show_preview</key>
- <applyto>/apps/evolution/addressbook/display/show_preview</applyto>
- <owner>evolution-addressbook</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Show preview pane</short>
- <long>Whether to show the preview pane.</long>
- </locale>
- </schema>
-
- </schemalist>
-</gconfschemafile>
diff --git a/addressbook/gui/component/autocompletion-config.c b/addressbook/gui/component/autocompletion-config.c
deleted file mode 100644
index 9773f5bd5b..0000000000
--- a/addressbook/gui/component/autocompletion-config.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * e-shell-config-autocompletion.h - Configuration page for addressbook autocompletion.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Chris Toshok <toshok@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include "autocompletion-config.h"
-
-#include "Evolution.h"
-
-#include <bonobo/bonobo-exception.h>
-
-#include <libedataserver/e-source-list.h>
-#include <libedataserverui/e-source-selector.h>
-#include <libedataserverui/e-name-selector-entry.h>
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-
-
-typedef struct {
- EvolutionConfigControl *config_control;
-
- GtkWidget *control_widget;
-
- ESourceList *source_list;
- GConfClient *gconf;
-} AutocompletionConfig;
-
-static void
-source_selection_changed (ESourceSelector *selector,
- AutocompletionConfig *ac)
-{
- GSList *selection;
- GSList *l;
- GSList *groups;
-
- /* first we clear all the completion flags from all sources */
- for (groups = e_source_list_peek_groups (ac->source_list); groups; groups = groups->next) {
- ESourceGroup *group = E_SOURCE_GROUP (groups->data);
- GSList *sources;
- for (sources = e_source_group_peek_sources (group); sources; sources = sources->next) {
- ESource *source = E_SOURCE (sources->data);
-
- e_source_set_property (source, "completion", NULL);
- }
- }
-
- /* then we loop over the selector's selection, setting the
- property on those sources */
- selection = e_source_selector_get_selection (selector);
- for (l = selection; l; l = l->next) {
- e_source_set_property (E_SOURCE (l->data), "completion", "true");
- }
- e_source_selector_free_selection (selection);
-
- e_source_list_sync (ac->source_list, NULL); /* XXX we should pop up a dialog if this fails */
-}
-
-static void
-config_control_destroy_notify (gpointer data,
- GObject *where_the_config_control_was)
-{
- AutocompletionConfig *ac = (AutocompletionConfig *) data;
-
- g_object_unref (ac->source_list);
- g_object_unref (ac->gconf);
-
- g_free (ac);
-}
-
-static void
-initialize_selection (AutocompletionConfig *ac)
-{
- GSList *groups;
-
- for (groups = e_source_list_peek_groups (ac->source_list); groups; groups = groups->next) {
- ESourceGroup *group = E_SOURCE_GROUP (groups->data);
- GSList *sources;
- for (sources = e_source_group_peek_sources (group); sources; sources = sources->next) {
- ESource *source = E_SOURCE (sources->data);
- const gchar *completion = e_source_get_property (source, "completion");
- if (completion && !g_ascii_strcasecmp (completion, "true"))
- e_source_selector_select_source (E_SOURCE_SELECTOR (ac->control_widget),
- source);
- }
- }
-}
-
-static GtkWidget *
-add_section (GtkWidget *vbox, const gchar *caption, gboolean expand)
-{
- GtkWidget *label, *hbox, *itembox;
- gchar *txt;
-
- g_return_val_if_fail (vbox != NULL, NULL);
- g_return_val_if_fail (caption != NULL, NULL);
-
- txt = g_strconcat ("<b>", caption, "</b>", NULL);
-
- label = gtk_label_new (NULL);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
- gtk_label_set_markup (GTK_LABEL (label), txt);
-
- g_free (txt);
-
- /* bold caption of the section */
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
- hbox = gtk_hbox_new (FALSE, 12);
-
- /* space on the left for the items in the section */
- gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (""), FALSE, FALSE, 0);
-
- /* itembox, here will all section items go */
- itembox = gtk_vbox_new (FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), itembox, TRUE, TRUE, 0);
-
- gtk_box_pack_start (GTK_BOX (vbox), hbox, expand, expand, 0);
-
- return itembox;
-}
-
-static void
-show_address_check_toggled_cb (GtkToggleButton *check, AutocompletionConfig *ac)
-{
- g_return_if_fail (check != NULL);
- g_return_if_fail (ac != NULL);
- g_return_if_fail (ac->gconf != NULL);
-
- gconf_client_set_bool (ac->gconf, FORCE_SHOW_ADDRESS, gtk_toggle_button_get_active (check), NULL);
-}
-
-EvolutionConfigControl*
-autocompletion_config_control_new (void)
-{
- AutocompletionConfig *ac;
- CORBA_Environment ev;
- GtkWidget *scrolledwin, *vbox, *itembox, *w;
-
- ac = g_new0 (AutocompletionConfig, 1);
-
- CORBA_exception_init (&ev);
-
- ac->gconf = gconf_client_get_default ();
-
- vbox = gtk_vbox_new (FALSE, 6);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
-
- itembox = add_section (vbox, _("Autocompletion"), FALSE);
-
- w = gtk_check_button_new_with_mnemonic (_("Always _show address of the autocompleted contact"));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), gconf_client_get_bool (ac->gconf, FORCE_SHOW_ADDRESS, NULL));
- g_signal_connect (w, "toggled", (GCallback)show_address_check_toggled_cb, ac);
- gtk_box_pack_start (GTK_BOX (itembox), w, FALSE, FALSE, 0);
-
- itembox = add_section (vbox, _("Look up in address books"), TRUE);
-
- ac->source_list = e_source_list_new_for_gconf_default ("/apps/evolution/addressbook/sources");
- /* XXX should we watch for the source list to change and
- update it in the control? what about our local changes? */
- /* g_signal_connect (ac->source_list, "changed", G_CALLBACK (source_list_changed), ac); */
-
- scrolledwin = gtk_scrolled_window_new (NULL, NULL);
-
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwin),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwin),
- GTK_SHADOW_IN);
-
- ac->control_widget = e_source_selector_new (ac->source_list);
-
- gtk_container_add (GTK_CONTAINER (scrolledwin), ac->control_widget);
-
- initialize_selection (ac);
-
- gtk_widget_show (ac->control_widget);
- gtk_widget_show (scrolledwin);
-
- gtk_widget_show_all (vbox);
- gtk_box_pack_start (GTK_BOX (itembox), scrolledwin, TRUE, TRUE, 0);
-
- ac->config_control = evolution_config_control_new (vbox);
-
- g_signal_connect (ac->control_widget, "selection_changed",
- G_CALLBACK (source_selection_changed), ac);
-
- g_object_weak_ref (G_OBJECT (ac->config_control), config_control_destroy_notify, ac);
-
- CORBA_exception_free (&ev);
-
- return ac->config_control;
-}
-
diff --git a/addressbook/gui/component/autocompletion-config.h b/addressbook/gui/component/autocompletion-config.h
deleted file mode 100644
index 0690604bc7..0000000000
--- a/addressbook/gui/component/autocompletion-config.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * e-shell-config-autocompletion.h - Configuration page for addressbook autocompletion.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Chris Toshok <toshok@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _AUTOCOMPLETION_CONFIG_H
-#define _AUTOCOMPLETION_CONFIG_H
-
-#include "evolution-config-control.h"
-
-EvolutionConfigControl* autocompletion_config_control_new (void);
-
-#endif /* _AUTOCOMPLETION_CONFIG_H */
diff --git a/addressbook/gui/component/component-factory.c b/addressbook/gui/component/component-factory.c
deleted file mode 100644
index eddabd7b48..0000000000
--- a/addressbook/gui/component/component-factory.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * component-factory.c - Factory for Evolution's Addressbook component.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#include <config.h>
-
-#include <string.h>
-#include "addressbook.h"
-#include "addressbook-component.h"
-#include "addressbook-config.h"
-#include "addressbook-view.h"
-#include "autocompletion-config.h"
-#include "eab-popup-control.h"
-#ifdef ENABLE_SMIME
-#include "smime/gui/certificate-manager.h"
-#endif
-#include <bonobo/bonobo-shlib-factory.h>
-
-
-#define FACTORY_ID "OAFIID:GNOME_Evolution_Addressbook_Factory:" BASE_VERSION
-
-#define COMPONENT_ID "OAFIID:GNOME_Evolution_Addressbook_Component:" BASE_VERSION
-#define ADDRESS_POPUP_ID "OAFIID:GNOME_Evolution_Addressbook_AddressPopup:" BASE_VERSION
-#define COMPLETION_CONFIG_CONTROL_ID "OAFIID:GNOME_Evolution_Addressbook_Autocompletion_ConfigControl:" BASE_VERSION
-#define CERTIFICATE_MANAGER_CONFIG_CONTROL_ID "OAFIID:GNOME_Evolution_SMime_CertificateManager_ConfigControl:" BASE_VERSION
-
-#define d(x)
-
-
-static BonoboObject *
-factory (BonoboGenericFactory *factory,
- const gchar *component_id,
- gpointer closure)
-{
- d(printf ("asked to activate component_id `%s'\n", component_id));
-
- if (strcmp (component_id, COMPONENT_ID) == 0) {
- BonoboObject *object = BONOBO_OBJECT (addressbook_component_peek ());
- bonobo_object_ref (object);
- return object;
- }
- if (strcmp (component_id, ADDRESS_POPUP_ID) == 0)
- return BONOBO_OBJECT (eab_popup_control_new ());
- if (strcmp (component_id, COMPLETION_CONFIG_CONTROL_ID) == 0)
- return BONOBO_OBJECT (autocompletion_config_control_new ());
-#ifdef ENABLE_SMIME
- if (strcmp (component_id, CERTIFICATE_MANAGER_CONFIG_CONTROL_ID) == 0)
- return BONOBO_OBJECT (certificate_manager_config_control_new ());
-#endif
-
- g_warning (FACTORY_ID ": Don't know what to do with %s", component_id);
- return NULL;
-}
-
-BONOBO_ACTIVATION_SHLIB_FACTORY (FACTORY_ID, "Evolution Addressbook component factory", factory, NULL)
diff --git a/addressbook/gui/component/ldap-config.glade b/addressbook/gui/component/ldap-config.glade
deleted file mode 100644
index f87cf84b14..0000000000
--- a/addressbook/gui/component/ldap-config.glade
+++ /dev/null
@@ -1,1454 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-
-<glade-interface>
-
-<widget class="GtkDialog" id="account-editor-window">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Address Book Properties</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
- <property name="has_separator">False</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox7">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area7">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
-
- <child>
- <widget class="GtkButton" id="account-editor-cancel-button">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="response_id">-6</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="account-editor-ok-button">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-ok</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="response_id">-5</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkNotebook" id="account-editor-notebook">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="show_tabs">True</property>
- <property name="show_border">True</property>
- <property name="tab_pos">GTK_POS_TOP</property>
- <property name="scrollable">False</property>
- <property name="enable_popup">False</property>
-
- <child>
- <widget class="GtkVBox" id="account-editor-general-vbox">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label564">
- <property name="visible">True</property>
- <property name="label">Display</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox122">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label563">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label431">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Name:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">account-editor-display-name-entry</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="account-editor-display-name-entry">
- <property name="visible">True</property>
- <property name="tooltip" 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="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="account-editor-connecting-vbox">
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label557">
- <property name="visible">True</property>
- <property name="label">Server Information</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox123">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label558">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</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="table31">
- <property name="visible">True</property>
- <property name="n_rows">3</property>
- <property name="n_columns">2</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label554">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Port:</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="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label556">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Server:</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">server-name-entry</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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="GtkHBox" id="hbox123">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label555">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Use secure connection:</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">ssl-combobox</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkComboBox" id="ssl-combobox">
- <property name="visible">True</property>
- <property name="items" translatable="yes">SSL encryption
-TLS encryption
-No encryption</property>
- <property name="add_tearoffs">False</property>
- <property name="focus_on_click">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">expand|shrink|fill</property>
- <property name="y_options">shrink|fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="server-name-entry">
- <property name="visible">True</property>
- <property name="tooltip" translatable="yes">This is the full name of your LDAP server. For example, &quot;ldap.mycompany.com&quot;.</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">*</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="GtkComboBoxEntry" id="port-comboentry">
- <property name="visible">True</property>
- <property name="items" translatable="yes">389
-636
-3268</property>
- <property name="add_tearoffs">False</property>
- <property name="has_frame">True</property>
- <property name="focus_on_click">True</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label559">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Authentication&lt;/b&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox124">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label562">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</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="table32">
- <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">6</property>
-
- <child>
- <widget class="GtkLabel" id="label560">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Login method:</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="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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="GtkLabel" id="label561">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Lo_gin:</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">auth-entry</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="auth-entry">
- <property name="visible">True</property>
- <property name="tooltip" translatable="yes">Evolution will use this email address to authenticate you with the server.</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">*</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="GtkComboBox" id="auth-combobox">
- <property name="visible">True</property>
- <property name="items" translatable="yes">Anonymously
-Using email address
-Using distinguished name (DN)</property>
- <property name="add_tearoffs">False</property>
- <property name="focus_on_click">True</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">shrink|fill</property>
- <property name="y_options">shrink|fill</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label334">
- <property name="visible">True</property>
- <property name="label" translatable="yes">General</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="account-editor-searching-vbox">
- <property name="border_width">12</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label565">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Searching&lt;/b&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox125">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label571">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</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="table33">
- <property name="visible">True</property>
- <property name="n_rows">4</property>
- <property name="n_columns">3</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label569">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label566">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Search _base:</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">rootdn-entry</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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">expand|shrink|fill</property>
- <property name="y_options">shrink|fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label567">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Search scope:</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="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <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="x_options">expand|shrink|fill</property>
- <property name="y_options">shrink|fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="rootdn-entry">
- <property name="visible">True</property>
- <property name="tooltip" translatable="yes">The search base is the distinguished name (DN) of the entry where your searches will begin. If you leave this blank, the search will begin at the root of the directory tree.</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">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">expand|shrink|fill</property>
- <property name="y_options">shrink|fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="rootdn-button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment61">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">0</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkHBox" id="hbox126">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
-
- <child>
- <widget class="GtkImage" id="image10">
- <property name="visible">True</property>
- <property name="stock">gtk-find</property>
- <property name="icon_size">4</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label568">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Find Possible Search Bases</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.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">expand|shrink|fill</property>
- <property name="y_options">shrink|fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label581">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Search _filter:</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">search-filter-entry</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">expand|shrink|fill</property>
- <property name="y_options">shrink|fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="search-filter-entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">*</property>
- <property name="activates_default">False</property>
- <accessibility>
- <atkproperty name="AtkObject::accessible_name" translatable="yes">Search Filter</atkproperty>
- <atkproperty name="AtkObject::accessible_description" translatable="yes">Search filter is the type of object to be searched for. If this is not modified, the default search will be performed on the type &quot;person&quot;.</atkproperty>
- </accessibility>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">expand|shrink|fill</property>
- <property name="y_options">shrink|fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkComboBox" id="scope-combobox">
- <property name="visible">True</property>
- <property name="items" translatable="yes">One
-Sub</property>
- <property name="add_tearoffs">False</property>
- <property name="focus_on_click">True</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">shrink|fill</property>
- <property name="y_options">shrink|fill</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label572">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Downloading&lt;/b&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox127">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label579">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</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="table34">
- <property name="visible">True</property>
- <property name="n_rows">3</property>
- <property name="n_columns">3</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkHBox" id="hbox128">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label575">
- <property name="visible">True</property>
- <property name="label" translatable="yes">1</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHScale" id="timeout-scale">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="draw_value">False</property>
- <property name="value_pos">GTK_POS_TOP</property>
- <property name="digits">1</property>
- <property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
- <property name="inverted">False</property>
- <property name="adjustment">3 1 5 0.5 1 0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label576">
- <property name="visible">True</property>
- <property name="label" translatable="yes">5</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">expand|shrink|fill</property>
- <property name="y_options">shrink|fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label574">
- <property name="visible">True</property>
- <property name="label" translatable="yes">minutes</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">shrink|fill</property>
- <property name="y_options">shrink|fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label578">
- <property name="visible">True</property>
- <property name="label" translatable="yes">cards</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">shrink|fill</property>
- <property name="y_options">shrink|fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label573">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Timeout:</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">timeout-scale</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">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">shrink|fill</property>
- <property name="y_options">shrink|fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label577">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Download limit:</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">download-limit-spinbutton</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">shrink|fill</property>
- <property name="y_options">shrink|fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkSpinButton" id="download-limit-spinbutton">
- <property name="visible">True</property>
- <property name="tooltip" translatable="yes">This is the maximum number of entries to download. Setting this number to be too large will slow down your address book.</property>
- <property name="can_focus">True</property>
- <property name="climb_rate">1</property>
- <property name="digits">0</property>
- <property name="numeric">False</property>
- <property name="update_policy">GTK_UPDATE_ALWAYS</property>
- <property name="snap_to_ticks">False</property>
- <property name="wrap">False</property>
- <property name="adjustment">0 0 1000 1 10 0</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">expand|shrink|fill</property>
- <property name="y_options">shrink|fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="canbrowsecheck">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes" comments="To translators: If enabled, addressbook will only fetch contacts from the server until either set time limit or amount of contacts limit reached">B_rowse this book until limit reached</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">3</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>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label344">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Details</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>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-<widget class="GtkDialog" id="supported-bases-dialog">
- <property name="title" translatable="yes">Supported Search Bases</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_CENTER</property>
- <property name="modal">False</property>
- <property name="default_width">320</property>
- <property name="default_height">200</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
- <property name="has_separator">False</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox8">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area8">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
-
- <child>
- <widget class="GtkButton" id="cancelbutton1">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="response_id">-6</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="okbutton1">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-ok</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="response_id">-5</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox40">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="Custom" id="supported-bases-table">
- <property name="visible">True</property>
- <property name="creation_function">supported_bases_create_table</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Fri, 12 Apr 2002 20:06:45 GMT</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-</glade-interface>
diff --git a/addressbook/gui/component/openldap-extract.h b/addressbook/gui/component/openldap-extract.h
deleted file mode 100644
index 29175fb494..0000000000
--- a/addressbook/gui/component/openldap-extract.h
+++ /dev/null
@@ -1,1426 +0,0 @@
-/* This is extracted from the OpenLDAP sources.
- *
- * Stuff that isn't used in e-book-backend-ldap.c was dropped, like
- * the LDAPSchemaExtensionItem stuff.
- *
- * This file basically has three parts:
- *
- * - some general macros from OpenLDAP that work as such on all
- * implementations.
- *
- * - ldap_str2objectclass()
- *
- * - ldap_url_parse()
- */
-
-/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
- *
- * Copyright 1998-2005 The OpenLDAP Foundation.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted only as authorized by the OpenLDAP
- * Public License.
- *
- * A copy of this license is available in file COPYING.OPENLDAP in
- * the top-level directory of the distribution or, alternatively, at
- * <http://www.OpenLDAP.org/license.html>.
- */
-
-#include <string.h>
-#include <assert.h>
-
-/* from various header files */
-
-#define LDAP_CONST const
-
-#define LDAP_PORT 389 /* ldap:/// default LDAP port */
-#define LDAPS_PORT 636 /* ldaps:/// default LDAP over TLS port */
-
-#define LDAP_ROOT_DSE ""
-
-#define LDAP_SPACE(c) ((c) == ' ' || (c) == '\t' || (c) == '\n')
-#define LDAP_DIGIT(c) ((c) >= '0' && (c) <= '9')
-
-#define LDAP_EXOP_START_TLS "1.3.6.1.4.1.1466.20037" /* RFC 2830 */
-
-#define LDAP_MALLOC(n) malloc((n))
-#define LDAP_CALLOC(n,s) calloc((n),(s))
-#define LDAP_REALLOC(p,s) realloc((p),(s))
-#define LDAP_FREE(p) free((p))
-#define LDAP_VFREE(p) vfree((gpointer *)(p))
-#define LDAP_STRDUP(s) strdup((s))
-
-#define LDAP_RANGE(n,x,y) (((x) <= (n)) && ((n) <= (y)))
-#define LDAP_NAME_ERROR(n) LDAP_RANGE((n),0x20,0x24) /* 32-34,36 */
-
-#define ldap_msgtype(lm) (lm)->lm_msgtype
-#define ldap_msgid(lm) (lm)->lm_msgid
-
-#define LDAP_SCHERR_OUTOFMEM 1
-#define LDAP_SCHERR_UNEXPTOKEN 2
-#define LDAP_SCHERR_NOLEFTPAREN 3
-#define LDAP_SCHERR_NORIGHTPAREN 4
-#define LDAP_SCHERR_NODIGIT 5
-#define LDAP_SCHERR_BADNAME 6
-#define LDAP_SCHERR_BADDESC 7
-#define LDAP_SCHERR_BADSUP 8
-#define LDAP_SCHERR_DUPOPT 9
-#define LDAP_SCHERR_EMPTY 10
-#define LDAP_SCHERR_MISSING 11
-#define LDAP_SCHERR_OUT_OF_ORDER 12
-
-#define LDAP_SCHEMA_YES 1
-
-#define LDAP_SCHEMA_ABSTRACT 0
-#define LDAP_SCHEMA_STRUCTURAL 1
-#define LDAP_SCHEMA_AUXILIARY 2
-
-#define LDAP_SCHEMA_ALLOW_NONE 0x00U /* Strict parsing */
-#define LDAP_SCHEMA_ALLOW_NO_OID 0x01U /* Allow missing oid */
-#define LDAP_SCHEMA_ALLOW_QUOTED 0x02U /* Allow bogus extra quotes */
-#define LDAP_SCHEMA_ALLOW_DESCR 0x04U /* Allow descr instead of OID */
-#define LDAP_SCHEMA_ALLOW_DESCR_PREFIX 0x08U /* Allow descr as OID prefix */
-#define LDAP_SCHEMA_ALLOW_OID_MACRO 0x10U /* Allow OID macros in slapd */
-#define LDAP_SCHEMA_ALLOW_OUT_OF_ORDER_FIELDS 0x20U /* Allow fields in most any order */
-#define LDAP_SCHEMA_ALLOW_ALL 0x3fU /* Be very liberal in parsing */
-#define LDAP_SCHEMA_SKIP 0x80U /* Don't malloc any result */
-
-typedef struct ldap_objectclass {
- gchar *oc_oid; /* REQUIRED */
- gchar **oc_names; /* OPTIONAL */
- gchar *oc_desc; /* OPTIONAL */
- gint oc_obsolete; /* 0=no, 1=yes */
- gchar **oc_sup_oids; /* OPTIONAL */
- gint oc_kind; /* 0=ABSTRACT, 1=STRUCTURAL, 2=AUXILIARY */
- gchar **oc_at_oids_must; /* OPTIONAL */
- gchar **oc_at_oids_may; /* OPTIONAL */
-} LDAPObjectClass;
-
-static void
-vfree(gpointer *vec)
-{
- gint i;
-
- for (i = 0; vec[i] != NULL; i++)
- free(vec[i]);
-}
-
-/* from schema.c */
-
-/*
- * Now come the parsers. There is one parser for each entity type:
- * objectclasses, attributetypes, etc.
- *
- * Each of them is written as a recursive-descent parser, except that
- * none of them is really recursive. But the idea is kept: there
- * is one routine per non-terminal that eithers gobbles lexical tokens
- * or calls lower-level routines, etc.
- *
- * The scanner is implemented in the routine get_token. Actually,
- * get_token is more than a scanner and will return tokens that are
- * in fact non-terminals in the grammar. So you can see the whole
- * approach as the combination of a low-level bottom-up recognizer
- * combined with a scanner and a number of top-down parsers. Or just
- * consider that the real grammars recognized by the parsers are not
- * those of the standards. As a matter of fact, our parsers are more
- * liberal than the spec when there is no ambiguity.
- *
- * The difference is pretty academic (modulo bugs or incorrect
- * interpretation of the specs).
- */
-
-#define TK_NOENDQUOTE -2
-#define TK_OUTOFMEM -1
-#define TK_EOS 0
-#define TK_UNEXPCHAR 1
-#define TK_BAREWORD 2
-#define TK_QDSTRING 3
-#define TK_LEFTPAREN 4
-#define TK_RIGHTPAREN 5
-#define TK_DOLLAR 6
-#define TK_QDESCR TK_QDSTRING
-
-struct token {
- gint type;
- gchar *sval;
-};
-
-static gint
-get_token( const gchar ** sp, gchar ** token_val )
-{
- gint kind;
- const gchar * p;
- const gchar * q;
- gchar * res;
-
- *token_val = NULL;
- switch (**sp) {
- case '\0':
- kind = TK_EOS;
- (*sp)++;
- break;
- case '(':
- kind = TK_LEFTPAREN;
- (*sp)++;
- break;
- case ')':
- kind = TK_RIGHTPAREN;
- (*sp)++;
- break;
- case '$':
- kind = TK_DOLLAR;
- (*sp)++;
- break;
- case '\'':
- kind = TK_QDSTRING;
- (*sp)++;
- p = *sp;
- while ( **sp != '\'' && **sp != '\0' )
- (*sp)++;
- if ( **sp == '\'' ) {
- q = *sp;
- res = LDAP_MALLOC(q-p+1);
- if ( !res ) {
- kind = TK_OUTOFMEM;
- } else {
- strncpy(res,p,q-p);
- res[q-p] = '\0';
- *token_val = res;
- }
- (*sp)++;
- } else {
- kind = TK_NOENDQUOTE;
- }
- break;
- default:
- kind = TK_BAREWORD;
- p = *sp;
- while ( !LDAP_SPACE(**sp) &&
- **sp != '(' &&
- **sp != ')' &&
- **sp != '$' &&
- **sp != '\'' &&
- **sp != '\0' )
- (*sp)++;
- q = *sp;
- res = LDAP_MALLOC(q-p+1);
- if ( !res ) {
- kind = TK_OUTOFMEM;
- } else {
- strncpy(res,p,q-p);
- res[q-p] = '\0';
- *token_val = res;
- }
- break;
-/* kind = TK_UNEXPCHAR; */
-/* break; */
- }
-
- return kind;
-}
-
-/* Gobble optional whitespace */
-static void
-parse_whsp(const gchar **sp)
-{
- while (LDAP_SPACE(**sp))
- (*sp)++;
-}
-
-/* Parse a sequence of dot-separated decimal strings */
-static gchar *
-ldap_int_parse_numericoid(const gchar **sp, gint *code, const gint flags)
-{
- gchar * res = NULL;
- const gchar * start = *sp;
- gint len;
- gint quoted = 0;
-
- /* Netscape puts the SYNTAX value in quotes (incorrectly) */
- if ( flags & LDAP_SCHEMA_ALLOW_QUOTED && **sp == '\'' ) {
- quoted = 1;
- (*sp)++;
- start++;
- }
- /* Each iteration of this loop gets one decimal string */
- while (**sp) {
- if ( !LDAP_DIGIT(**sp) ) {
- /*
- * Initial gchar is not a digit or gchar after dot is
- * not a digit
- */
- *code = LDAP_SCHERR_NODIGIT;
- return NULL;
- }
- (*sp)++;
- while ( LDAP_DIGIT(**sp) )
- (*sp)++;
- if ( **sp != '.' )
- break;
- /* Otherwise, gobble the dot and loop again */
- (*sp)++;
- }
- /* Now *sp points at the gchar past the numericoid. Perfect. */
- len = *sp - start;
- if ( flags & LDAP_SCHEMA_ALLOW_QUOTED && quoted ) {
- if ( **sp == '\'' ) {
- (*sp)++;
- } else {
- *code = LDAP_SCHERR_UNEXPTOKEN;
- return NULL;
- }
- }
- if (flags & LDAP_SCHEMA_SKIP) {
- res = (gchar *)start;
- } else {
- res = LDAP_MALLOC(len+1);
- if (!res) {
- *code = LDAP_SCHERR_OUTOFMEM;
- return(NULL);
- }
- strncpy(res,start,len);
- res[len] = '\0';
- }
- return(res);
-}
-
-/* Parse a qdescr or a list of them enclosed in () */
-static gchar **
-parse_qdescrs(const gchar **sp, gint *code)
-{
- gchar ** res;
- gchar ** res1;
- gint kind;
- gchar * sval;
- gint size;
- gint pos;
-
- parse_whsp(sp);
- kind = get_token(sp,&sval);
- if ( kind == TK_LEFTPAREN ) {
- /* Let's presume there will be at least 2 entries */
- size = 3;
- res = LDAP_CALLOC(3,sizeof(gchar *));
- if ( !res ) {
- *code = LDAP_SCHERR_OUTOFMEM;
- return NULL;
- }
- pos = 0;
- while (1) {
- parse_whsp(sp);
- kind = get_token(sp,&sval);
- if ( kind == TK_RIGHTPAREN )
- break;
- if ( kind == TK_QDESCR ) {
- if ( pos == size-2 ) {
- size++;
- res1 = LDAP_REALLOC(res,size*sizeof(gchar *));
- if ( !res1 ) {
- LDAP_VFREE(res);
- LDAP_FREE(sval);
- *code = LDAP_SCHERR_OUTOFMEM;
- return(NULL);
- }
- res = res1;
- }
- res[pos++] = sval;
- res[pos] = NULL;
- parse_whsp(sp);
- } else {
- LDAP_VFREE(res);
- LDAP_FREE(sval);
- *code = LDAP_SCHERR_UNEXPTOKEN;
- return(NULL);
- }
- }
- parse_whsp(sp);
- return(res);
- } else if ( kind == TK_QDESCR ) {
- res = LDAP_CALLOC(2,sizeof(gchar *));
- if ( !res ) {
- *code = LDAP_SCHERR_OUTOFMEM;
- return NULL;
- }
- res[0] = sval;
- res[1] = NULL;
- parse_whsp(sp);
- return res;
- } else {
- LDAP_FREE(sval);
- *code = LDAP_SCHERR_BADNAME;
- return NULL;
- }
-}
-
-/* Parse a woid or a $-separated list of them enclosed in () */
-static gchar **
-parse_oids(const gchar **sp, gint *code, const gint allow_quoted)
-{
- gchar ** res;
- gchar ** res1;
- gint kind;
- gchar * sval;
- gint size;
- gint pos;
-
- /*
- * Strictly speaking, doing this here accepts whsp before the
- * ( at the begining of an oidlist, but this is harmless. Also,
- * we are very liberal in what we accept as an OID. Maybe
- * refine later.
- */
- parse_whsp(sp);
- kind = get_token(sp,&sval);
- if ( kind == TK_LEFTPAREN ) {
- /* Let's presume there will be at least 2 entries */
- size = 3;
- res = LDAP_CALLOC(3,sizeof(gchar *));
- if ( !res ) {
- *code = LDAP_SCHERR_OUTOFMEM;
- return NULL;
- }
- pos = 0;
- parse_whsp(sp);
- kind = get_token(sp,&sval);
- if ( kind == TK_BAREWORD ||
- ( allow_quoted && kind == TK_QDSTRING ) ) {
- res[pos++] = sval;
- res[pos] = NULL;
- } else {
- *code = LDAP_SCHERR_UNEXPTOKEN;
- LDAP_FREE(sval);
- LDAP_VFREE(res);
- return NULL;
- }
- parse_whsp(sp);
- while (1) {
- kind = get_token(sp,&sval);
- if ( kind == TK_RIGHTPAREN )
- break;
- if ( kind == TK_DOLLAR ) {
- parse_whsp(sp);
- kind = get_token(sp,&sval);
- if ( kind == TK_BAREWORD ||
- ( allow_quoted &&
- kind == TK_QDSTRING ) ) {
- if ( pos == size-2 ) {
- size++;
- res1 = LDAP_REALLOC(res,size*sizeof(gchar *));
- if ( !res1 ) {
- LDAP_FREE(sval);
- LDAP_VFREE(res);
- *code = LDAP_SCHERR_OUTOFMEM;
- return(NULL);
- }
- res = res1;
- }
- res[pos++] = sval;
- res[pos] = NULL;
- } else {
- *code = LDAP_SCHERR_UNEXPTOKEN;
- LDAP_FREE(sval);
- LDAP_VFREE(res);
- return NULL;
- }
- parse_whsp(sp);
- } else {
- *code = LDAP_SCHERR_UNEXPTOKEN;
- LDAP_FREE(sval);
- LDAP_VFREE(res);
- return NULL;
- }
- }
- parse_whsp(sp);
- return(res);
- } else if ( kind == TK_BAREWORD ||
- ( allow_quoted && kind == TK_QDSTRING ) ) {
- res = LDAP_CALLOC(2,sizeof(gchar *));
- if ( !res ) {
- LDAP_FREE(sval);
- *code = LDAP_SCHERR_OUTOFMEM;
- return NULL;
- }
- res[0] = sval;
- res[1] = NULL;
- parse_whsp(sp);
- return res;
- } else {
- LDAP_FREE(sval);
- *code = LDAP_SCHERR_BADNAME;
- return NULL;
- }
-}
-
-static void
-ldap_objectclass_free(LDAPObjectClass * oc)
-{
- LDAP_FREE(oc->oc_oid);
- if (oc->oc_names) LDAP_VFREE(oc->oc_names);
- if (oc->oc_desc) LDAP_FREE(oc->oc_desc);
- if (oc->oc_sup_oids) LDAP_VFREE(oc->oc_sup_oids);
- if (oc->oc_at_oids_must) LDAP_VFREE(oc->oc_at_oids_must);
- if (oc->oc_at_oids_may) LDAP_VFREE(oc->oc_at_oids_may);
- LDAP_FREE(oc);
-}
-
-static LDAPObjectClass *
-ldap_str2objectclass( LDAP_CONST gchar * s,
- gint * code,
- LDAP_CONST gchar ** errp,
- LDAP_CONST unsigned flags )
-{
- gint kind;
- const gchar * ss = s;
- gchar * sval;
- gint seen_name = 0;
- gint seen_desc = 0;
- gint seen_obsolete = 0;
- gint seen_sup = 0;
- gint seen_kind = 0;
- gint seen_must = 0;
- gint seen_may = 0;
- LDAPObjectClass * oc;
- gchar ** ext_vals;
- const gchar * savepos;
-
- if ( !s ) {
- *code = LDAP_SCHERR_EMPTY;
- *errp = "";
- return NULL;
- }
-
- *errp = s;
- oc = LDAP_CALLOC(1,sizeof(LDAPObjectClass));
-
- if ( !oc ) {
- *code = LDAP_SCHERR_OUTOFMEM;
- return NULL;
- }
- oc->oc_kind = LDAP_SCHEMA_STRUCTURAL;
-
- kind = get_token(&ss,&sval);
- if ( kind != TK_LEFTPAREN ) {
- *code = LDAP_SCHERR_NOLEFTPAREN;
- LDAP_FREE(sval);
- ldap_objectclass_free(oc);
- return NULL;
- }
-
- /*
- * Definitions MUST begin with an OID in the numericoid format.
- * However, this routine is used by clients to parse the response
- * from servers and very well known servers will provide an OID
- * in the wrong format or even no OID at all. We do our best to
- * extract info from those servers.
- */
- parse_whsp(&ss);
- savepos = ss;
- oc->oc_oid = ldap_int_parse_numericoid(&ss,code,0);
- if ( !oc->oc_oid ) {
- if ( (flags & LDAP_SCHEMA_ALLOW_ALL) && (ss == savepos) ) {
- /* Backtracking */
- ss = savepos;
- kind = get_token(&ss,&sval);
- if ( kind == TK_BAREWORD ) {
- if ( !strcasecmp(sval, "NAME") ||
- !strcasecmp(sval, "DESC") ||
- !strcasecmp(sval, "OBSOLETE") ||
- !strcasecmp(sval, "SUP") ||
- !strcasecmp(sval, "ABSTRACT") ||
- !strcasecmp(sval, "STRUCTURAL") ||
- !strcasecmp(sval, "AUXILIARY") ||
- !strcasecmp(sval, "MUST") ||
- !strcasecmp(sval, "MAY") ||
- !strncasecmp(sval, "X-", 2) ) {
- /* Missing OID, backtrack */
- ss = savepos;
- } else if ( flags &
- LDAP_SCHEMA_ALLOW_OID_MACRO ) {
- /* Non-numerical OID, ignore */
- gint len = ss-savepos;
- oc->oc_oid = LDAP_MALLOC(len+1);
- strncpy(oc->oc_oid, savepos, len);
- oc->oc_oid[len] = 0;
- }
- }
- LDAP_FREE(sval);
- } else {
- *errp = ss;
- ldap_objectclass_free(oc);
- return NULL;
- }
- }
- parse_whsp(&ss);
-
- /*
- * Beyond this point we will be liberal an accept the items
- * in any order.
- */
- while (1) {
- kind = get_token(&ss,&sval);
- switch (kind) {
- case TK_EOS:
- *code = LDAP_SCHERR_NORIGHTPAREN;
- *errp = ss;
- ldap_objectclass_free(oc);
- return NULL;
- case TK_RIGHTPAREN:
- return oc;
- case TK_BAREWORD:
- if ( !strcasecmp(sval,"NAME") ) {
- LDAP_FREE(sval);
- if ( seen_name ) {
- *code = LDAP_SCHERR_DUPOPT;
- *errp = ss;
- ldap_objectclass_free(oc);
- return(NULL);
- }
- seen_name = 1;
- oc->oc_names = parse_qdescrs(&ss,code);
- if ( !oc->oc_names ) {
- if ( *code != LDAP_SCHERR_OUTOFMEM )
- *code = LDAP_SCHERR_BADNAME;
- *errp = ss;
- ldap_objectclass_free(oc);
- return NULL;
- }
- } else if ( !strcasecmp(sval,"DESC") ) {
- LDAP_FREE(sval);
- if ( seen_desc ) {
- *code = LDAP_SCHERR_DUPOPT;
- *errp = ss;
- ldap_objectclass_free(oc);
- return(NULL);
- }
- seen_desc = 1;
- parse_whsp(&ss);
- kind = get_token(&ss,&sval);
- if ( kind != TK_QDSTRING ) {
- *code = LDAP_SCHERR_UNEXPTOKEN;
- *errp = ss;
- LDAP_FREE(sval);
- ldap_objectclass_free(oc);
- return NULL;
- }
- oc->oc_desc = sval;
- parse_whsp(&ss);
- } else if ( !strcasecmp(sval,"OBSOLETE") ) {
- LDAP_FREE(sval);
- if ( seen_obsolete ) {
- *code = LDAP_SCHERR_DUPOPT;
- *errp = ss;
- ldap_objectclass_free(oc);
- return(NULL);
- }
- seen_obsolete = 1;
- oc->oc_obsolete = LDAP_SCHEMA_YES;
- parse_whsp(&ss);
- } else if ( !strcasecmp(sval,"SUP") ) {
- LDAP_FREE(sval);
- if ( seen_sup ) {
- *code = LDAP_SCHERR_DUPOPT;
- *errp = ss;
- ldap_objectclass_free(oc);
- return(NULL);
- }
- seen_sup = 1;
- oc->oc_sup_oids = parse_oids(&ss,
- code,
- flags);
- if ( !oc->oc_sup_oids ) {
- *errp = ss;
- ldap_objectclass_free(oc);
- return NULL;
- }
- } else if ( !strcasecmp(sval,"ABSTRACT") ) {
- LDAP_FREE(sval);
- if ( seen_kind ) {
- *code = LDAP_SCHERR_DUPOPT;
- *errp = ss;
- ldap_objectclass_free(oc);
- return(NULL);
- }
- seen_kind = 1;
- oc->oc_kind = LDAP_SCHEMA_ABSTRACT;
- parse_whsp(&ss);
- } else if ( !strcasecmp(sval,"STRUCTURAL") ) {
- LDAP_FREE(sval);
- if ( seen_kind ) {
- *code = LDAP_SCHERR_DUPOPT;
- *errp = ss;
- ldap_objectclass_free(oc);
- return(NULL);
- }
- seen_kind = 1;
- oc->oc_kind = LDAP_SCHEMA_STRUCTURAL;
- parse_whsp(&ss);
- } else if ( !strcasecmp(sval,"AUXILIARY") ) {
- LDAP_FREE(sval);
- if ( seen_kind ) {
- *code = LDAP_SCHERR_DUPOPT;
- *errp = ss;
- ldap_objectclass_free(oc);
- return(NULL);
- }
- seen_kind = 1;
- oc->oc_kind = LDAP_SCHEMA_AUXILIARY;
- parse_whsp(&ss);
- } else if ( !strcasecmp(sval,"MUST") ) {
- LDAP_FREE(sval);
- if ( seen_must ) {
- *code = LDAP_SCHERR_DUPOPT;
- *errp = ss;
- ldap_objectclass_free(oc);
- return(NULL);
- }
- seen_must = 1;
- oc->oc_at_oids_must = parse_oids(&ss,code,0);
- if ( !oc->oc_at_oids_must ) {
- *errp = ss;
- ldap_objectclass_free(oc);
- return NULL;
- }
- parse_whsp(&ss);
- } else if ( !strcasecmp(sval,"MAY") ) {
- LDAP_FREE(sval);
- if ( seen_may ) {
- *code = LDAP_SCHERR_DUPOPT;
- *errp = ss;
- ldap_objectclass_free(oc);
- return(NULL);
- }
- seen_may = 1;
- oc->oc_at_oids_may = parse_oids(&ss,code,0);
- if ( !oc->oc_at_oids_may ) {
- *errp = ss;
- ldap_objectclass_free(oc);
- return NULL;
- }
- parse_whsp(&ss);
- } else if ( sval[0] == 'X' && sval[1] == '-' ) {
- /* Should be parse_qdstrings */
- ext_vals = parse_qdescrs(&ss, code);
- if ( !ext_vals ) {
- *errp = ss;
- ldap_objectclass_free(oc);
- return NULL;
- }
-#if 0
- if ( add_extension(&oc->oc_extensions,
- sval, ext_vals) ) {
- *code = LDAP_SCHERR_OUTOFMEM;
- *errp = ss;
- LDAP_FREE(sval);
- ldap_objectclass_free(oc);
- return NULL;
- }
-#endif
- } else {
- *code = LDAP_SCHERR_UNEXPTOKEN;
- *errp = ss;
- LDAP_FREE(sval);
- ldap_objectclass_free(oc);
- return NULL;
- }
- break;
- default:
- *code = LDAP_SCHERR_UNEXPTOKEN;
- *errp = ss;
- LDAP_FREE(sval);
- ldap_objectclass_free(oc);
- return NULL;
- }
- }
-}
-
-/* from utf-8.c */
-
-#define LDAP_UTF8_NEXT(p) g_utf8_next_char((p))
-#define LDAP_UTF8_INCR(p) ((p)=LDAP_UTF8_NEXT((p)))
-#define ldap_x_utf8_to_ucs4(str) g_utf8_get_char(str)
-
-static gchar *ldap_utf8_strchr( const gchar *str, const gchar *chr )
-{
- for (; *str != '\0'; LDAP_UTF8_INCR(str) ) {
- if ( ldap_x_utf8_to_ucs4( str ) == ldap_x_utf8_to_ucs4( chr ) ) {
- return (gchar *) str;
- }
- }
-
- return NULL;
-}
-
-static gsize ldap_utf8_strcspn( const gchar *str, const gchar *set )
-{
- const gchar *cstr;
- const gchar *cset;
-
- for ( cstr = str; *cstr != '\0'; LDAP_UTF8_INCR(cstr) ) {
- for ( cset = set; *cset != '\0'; LDAP_UTF8_INCR(cset) ) {
- if ( ldap_x_utf8_to_ucs4( cstr ) == ldap_x_utf8_to_ucs4( cset ) ) {
- return cstr - str;
- }
- }
- }
-
- return cstr - str;
-}
-
-static gsize ldap_utf8_strspn( const gchar *str, const gchar *set )
-{
- const gchar *cstr;
- const gchar *cset;
-
- for ( cstr = str; *cstr != '\0'; LDAP_UTF8_INCR(cstr) ) {
- for ( cset = set; ; LDAP_UTF8_INCR(cset) ) {
- if ( *cset == '\0' ) {
- return cstr - str;
- }
-
- if ( ldap_x_utf8_to_ucs4( cstr ) == ldap_x_utf8_to_ucs4( cset ) ) {
- break;
- }
- }
- }
-
- return cstr - str;
-}
-
-static gchar *ldap_utf8_strtok(gchar *str, const gchar *sep, gchar **last)
-{
- gchar *begin;
- gchar *end;
-
- if ( last == NULL ) return NULL;
-
- begin = str ? str : *last;
-
- begin += ldap_utf8_strspn( begin, sep );
-
- if ( *begin == '\0' ) {
- *last = NULL;
- return NULL;
- }
-
- end = &begin[ ldap_utf8_strcspn( begin, sep ) ];
-
- if ( *end != '\0' ) {
- gchar *next = LDAP_UTF8_NEXT( end );
- *end = '\0';
- end = next;
- }
-
- *last = end;
- return begin;
-}
-
-/* from ldap.h */
-
-#define LDAP_URL_SUCCESS 0x00 /* Success */
-#define LDAP_URL_ERR_MEM 0x01 /* can't allocate memory space */
-#define LDAP_URL_ERR_PARAM 0x02 /* parameter is bad */
-
-#define LDAP_URL_ERR_BADSCHEME 0x03 /* URL doesn't begin with "ldap[si]://" */
-#define LDAP_URL_ERR_BADENCLOSURE 0x04 /* URL is missing trailing ">" */
-#define LDAP_URL_ERR_BADURL 0x05 /* URL is bad */
-#define LDAP_URL_ERR_BADHOST 0x06 /* host port is bad */
-#define LDAP_URL_ERR_BADATTRS 0x07 /* bad (or missing) attributes */
-#define LDAP_URL_ERR_BADSCOPE 0x08 /* scope string is invalid (or missing) */
-#define LDAP_URL_ERR_BADFILTER 0x09 /* bad or missing filter */
-#define LDAP_URL_ERR_BADEXTS 0x0a /* bad or missing extensions */
-
-#define LDAP_URL_PREFIX "ldap://"
-#define LDAP_URL_PREFIX_LEN (sizeof(LDAP_URL_PREFIX)-1)
-#define LDAPS_URL_PREFIX "ldaps://"
-#define LDAPS_URL_PREFIX_LEN (sizeof(LDAPS_URL_PREFIX)-1)
-#define LDAPI_URL_PREFIX "ldapi://"
-#define LDAPI_URL_PREFIX_LEN (sizeof(LDAPI_URL_PREFIX)-1)
-
-#define LDAP_URL_URLCOLON "URL:"
-#define LDAP_URL_URLCOLON_LEN (sizeof(LDAP_URL_URLCOLON)-1)
-
-typedef struct ldap_url_desc {
- struct ldap_url_desc *lud_next;
- gchar *lud_scheme;
- gchar *lud_host;
- gint lud_port;
- gchar *lud_dn;
- gchar **lud_attrs;
- gint lud_scope;
- gchar *lud_filter;
- gchar **lud_exts;
- gint lud_crit_exts;
-} LDAPURLDesc;
-
-/* from url.c */
-
-static const gchar *
-skip_url_prefix(
- const gchar *url,
- gint *enclosedp,
- const gchar **scheme )
-{
- /*
- * return non-zero if this looks like a LDAP URL; zero if not
- * if non-zero returned, *urlp will be moved past "ldap://" part of URL
- */
- const gchar *p;
-
- if ( url == NULL ) {
- return( NULL );
- }
-
- p = url;
-
- /* skip leading '<' (if any) */
- if ( *p == '<' ) {
- *enclosedp = 1;
- ++p;
- } else {
- *enclosedp = 0;
- }
-
- /* skip leading "URL:" (if any) */
- if ( strncasecmp( p, LDAP_URL_URLCOLON, LDAP_URL_URLCOLON_LEN ) == 0 ) {
- p += LDAP_URL_URLCOLON_LEN;
- }
-
- /* check for "ldap://" prefix */
- if ( strncasecmp( p, LDAP_URL_PREFIX, LDAP_URL_PREFIX_LEN ) == 0 ) {
- /* skip over "ldap://" prefix and return success */
- p += LDAP_URL_PREFIX_LEN;
- *scheme = "ldap";
- return( p );
- }
-
- /* check for "ldaps://" prefix */
- if ( strncasecmp( p, LDAPS_URL_PREFIX, LDAPS_URL_PREFIX_LEN ) == 0 ) {
- /* skip over "ldaps://" prefix and return success */
- p += LDAPS_URL_PREFIX_LEN;
- *scheme = "ldaps";
- return( p );
- }
-
- /* check for "ldapi://" prefix */
- if ( strncasecmp( p, LDAPI_URL_PREFIX, LDAPI_URL_PREFIX_LEN ) == 0 ) {
- /* skip over "ldapi://" prefix and return success */
- p += LDAPI_URL_PREFIX_LEN;
- *scheme = "ldapi";
- return( p );
- }
-
-#ifdef LDAP_CONNECTIONLESS
- /* check for "cldap://" prefix */
- if ( strncasecmp( p, LDAPC_URL_PREFIX, LDAPC_URL_PREFIX_LEN ) == 0 ) {
- /* skip over "cldap://" prefix and return success */
- p += LDAPC_URL_PREFIX_LEN;
- *scheme = "cldap";
- return( p );
- }
-#endif
-
- return( NULL );
-}
-
-static gint str2scope( const gchar *p )
-{
- if ( strcasecmp( p, "one" ) == 0 ) {
- return LDAP_SCOPE_ONELEVEL;
-
- } else if ( strcasecmp( p, "onelevel" ) == 0 ) {
- return LDAP_SCOPE_ONELEVEL;
-
- } else if ( strcasecmp( p, "base" ) == 0 ) {
- return LDAP_SCOPE_BASE;
-
- } else if ( strcasecmp( p, "sub" ) == 0 ) {
- return LDAP_SCOPE_SUBTREE;
-
- } else if ( strcasecmp( p, "subtree" ) == 0 ) {
- return LDAP_SCOPE_SUBTREE;
- }
-
- return( -1 );
-}
-
-static void
-ldap_free_urldesc( LDAPURLDesc *ludp )
-{
- if ( ludp == NULL ) {
- return;
- }
-
- if ( ludp->lud_scheme != NULL ) {
- LDAP_FREE( ludp->lud_scheme );
- }
-
- if ( ludp->lud_host != NULL ) {
- LDAP_FREE( ludp->lud_host );
- }
-
- if ( ludp->lud_dn != NULL ) {
- LDAP_FREE( ludp->lud_dn );
- }
-
- if ( ludp->lud_filter != NULL ) {
- LDAP_FREE( ludp->lud_filter);
- }
-
- if ( ludp->lud_attrs != NULL ) {
- LDAP_VFREE( ludp->lud_attrs );
- }
-
- if ( ludp->lud_exts != NULL ) {
- LDAP_VFREE( ludp->lud_exts );
- }
-
- LDAP_FREE( ludp );
-}
-
-static gint
-ldap_int_unhex( gint c )
-{
- return( c >= '0' && c <= '9' ? c - '0'
- : c >= 'A' && c <= 'F' ? c - 'A' + 10
- : c - 'a' + 10 );
-}
-
-static void
-ldap_pvt_hex_unescape( gchar *s )
-{
- /*
- * Remove URL hex escapes from s... done in place. The basic concept for
- * this routine is borrowed from the WWW library HTUnEscape() routine.
- */
- gchar *p;
-
- for ( p = s; *s != '\0'; ++s ) {
- if ( *s == '%' ) {
- if ( *++s == '\0' ) {
- break;
- }
- *p = ldap_int_unhex( *s ) << 4;
- if ( *++s == '\0' ) {
- break;
- }
- *p++ += ldap_int_unhex( *s );
- } else {
- *p++ = *s;
- }
- }
-
- *p = '\0';
-}
-
-static gchar **
-ldap_str2charray( const gchar *str_in, const gchar *brkstr )
-{
- gchar **res;
- gchar *str, *s;
- gchar *lasts;
- gint i;
-
- /* protect the input string from strtok */
- str = LDAP_STRDUP( str_in );
- if ( str == NULL ) {
- return NULL;
- }
-
- i = 1;
- for ( s = str; *s; s++ ) {
- if ( ldap_utf8_strchr( brkstr, s ) != NULL ) {
- i++;
- }
- }
-
- res = (gchar **) LDAP_MALLOC( (i + 1) * sizeof(gchar *) );
-
- if ( res == NULL ) {
- LDAP_FREE( str );
- return NULL;
- }
-
- i = 0;
-
- for ( s = ldap_utf8_strtok( str, brkstr, &lasts );
- s != NULL;
- s = ldap_utf8_strtok( NULL, brkstr, &lasts ) )
- {
- res[i] = LDAP_STRDUP( s );
-
- if (res[i] == NULL) {
- for ( --i; i >= 0; i-- ) {
- LDAP_FREE( res[i] );
- }
- LDAP_FREE( res );
- LDAP_FREE( str );
- return NULL;
- }
-
- i++;
- }
-
- res[i] = NULL;
-
- LDAP_FREE( str );
- return( res );
-}
-
-static gint
-ldap_url_parse_ext( LDAP_CONST gchar *url_in, LDAPURLDesc **ludpp )
-{
-/*
- * Pick apart the pieces of an LDAP URL.
- */
-
- LDAPURLDesc *ludp;
- gchar *p, *q, *r;
- gint i, enclosed;
- const gchar *scheme = NULL;
- const gchar *url_tmp;
- gchar *url;
-
- if ( url_in == NULL || ludpp == NULL ) {
- return LDAP_URL_ERR_PARAM;
- }
-
- *ludpp = NULL; /* pessimistic */
-
- url_tmp = skip_url_prefix( url_in, &enclosed, &scheme );
-
- if ( url_tmp == NULL ) {
- return LDAP_URL_ERR_BADSCHEME;
- }
-
- assert( scheme );
-
- /* make working copy of the remainder of the URL */
- url = LDAP_STRDUP( url_tmp );
- if ( url == NULL ) {
- return LDAP_URL_ERR_MEM;
- }
-
- if ( enclosed ) {
- p = &url[strlen(url)-1];
-
- if ( *p != '>' ) {
- LDAP_FREE( url );
- return LDAP_URL_ERR_BADENCLOSURE;
- }
-
- *p = '\0';
- }
-
- /* allocate return struct */
- ludp = (LDAPURLDesc *)LDAP_CALLOC( 1, sizeof( LDAPURLDesc ));
-
- if ( ludp == NULL ) {
- LDAP_FREE( url );
- return LDAP_URL_ERR_MEM;
- }
-
- ludp->lud_next = NULL;
- ludp->lud_host = NULL;
- ludp->lud_port = 0;
- ludp->lud_dn = NULL;
- ludp->lud_attrs = NULL;
- ludp->lud_filter = NULL;
- ludp->lud_scope = LDAP_SCOPE_DEFAULT;
- ludp->lud_filter = NULL;
- ludp->lud_exts = NULL;
-
- ludp->lud_scheme = LDAP_STRDUP( scheme );
-
- if ( ludp->lud_scheme == NULL ) {
- LDAP_FREE( url );
- ldap_free_urldesc( ludp );
- return LDAP_URL_ERR_MEM;
- }
-
- /* scan forward for '/' that marks end of hostport and begin. of dn */
- p = strchr( url, '/' );
-
- if ( p != NULL ) {
- /* terminate hostport; point to start of dn */
- *p++ = '\0';
- }
-
- /* IPv6 syntax with [ip address]:port */
- if ( *url == '[' ) {
- r = strchr( url, ']' );
- if ( r == NULL ) {
- LDAP_FREE( url );
- ldap_free_urldesc( ludp );
- return LDAP_URL_ERR_BADURL;
- }
- *r++ = '\0';
- q = strchr( r, ':' );
- } else {
- q = strchr( url, ':' );
- }
-
- if ( q != NULL ) {
- gchar *next;
-
- *q++ = '\0';
- ldap_pvt_hex_unescape( q );
-
- if ( *q == '\0' ) {
- LDAP_FREE( url );
- ldap_free_urldesc( ludp );
- return LDAP_URL_ERR_BADURL;
- }
-
- ludp->lud_port = strtol( q, &next, 10 );
- if ( next == NULL || next[0] != '\0' ) {
- LDAP_FREE( url );
- ldap_free_urldesc( ludp );
- return LDAP_URL_ERR_BADURL;
- }
- }
-
- ldap_pvt_hex_unescape( url );
-
- /* If [ip address]:port syntax, url is [ip and we skip the [ */
- ludp->lud_host = LDAP_STRDUP( url + ( *url == '[' ) );
-
- if ( ludp->lud_host == NULL ) {
- LDAP_FREE( url );
- ldap_free_urldesc( ludp );
- return LDAP_URL_ERR_MEM;
- }
-
- /*
- * Kludge. ldap://111.222.333.444:389??cn=abc,o=company
- *
- * On early Novell releases, search references/referrals were returned
- * in this format, i.e., the dn was kind of in the scope position,
- * but the required slash is missing. The whole thing is illegal syntax,
- * but we need to account for it. Fortunately it can't be confused with
- * anything real.
- */
- if ( (p == NULL) && (q != NULL) && ((q = strchr( q, '?')) != NULL)) {
- q++;
- /* ? immediately followed by question */
- if ( *q == '?') {
- q++;
- if ( *q != '\0' ) {
- /* parse dn part */
- ldap_pvt_hex_unescape( q );
- ludp->lud_dn = LDAP_STRDUP( q );
- } else {
- ludp->lud_dn = LDAP_STRDUP( "" );
- }
-
- if ( ludp->lud_dn == NULL ) {
- LDAP_FREE( url );
- ldap_free_urldesc( ludp );
- return LDAP_URL_ERR_MEM;
- }
- }
- }
-
- if ( p == NULL ) {
- LDAP_FREE( url );
- *ludpp = ludp;
- return LDAP_URL_SUCCESS;
- }
-
- /* scan forward for '?' that may marks end of dn */
- q = strchr( p, '?' );
-
- if ( q != NULL ) {
- /* terminate dn part */
- *q++ = '\0';
- }
-
- if ( *p != '\0' ) {
- /* parse dn part */
- ldap_pvt_hex_unescape( p );
- ludp->lud_dn = LDAP_STRDUP( p );
- } else {
- ludp->lud_dn = LDAP_STRDUP( "" );
- }
-
- if ( ludp->lud_dn == NULL ) {
- LDAP_FREE( url );
- ldap_free_urldesc( ludp );
- return LDAP_URL_ERR_MEM;
- }
-
- if ( q == NULL ) {
- /* no more */
- LDAP_FREE( url );
- *ludpp = ludp;
- return LDAP_URL_SUCCESS;
- }
-
- /* scan forward for '?' that may marks end of attributes */
- p = q;
- q = strchr( p, '?' );
-
- if ( q != NULL ) {
- /* terminate attributes part */
- *q++ = '\0';
- }
-
- if ( *p != '\0' ) {
- /* parse attributes */
- ldap_pvt_hex_unescape( p );
- ludp->lud_attrs = ldap_str2charray( p, "," );
-
- if ( ludp->lud_attrs == NULL ) {
- LDAP_FREE( url );
- ldap_free_urldesc( ludp );
- return LDAP_URL_ERR_BADATTRS;
- }
- }
-
- if ( q == NULL ) {
- /* no more */
- LDAP_FREE( url );
- *ludpp = ludp;
- return LDAP_URL_SUCCESS;
- }
-
- /* scan forward for '?' that may marks end of scope */
- p = q;
- q = strchr( p, '?' );
-
- if ( q != NULL ) {
- /* terminate the scope part */
- *q++ = '\0';
- }
-
- if ( *p != '\0' ) {
- /* parse the scope */
- ldap_pvt_hex_unescape( p );
- ludp->lud_scope = str2scope( p );
-
- if ( ludp->lud_scope == -1 ) {
- LDAP_FREE( url );
- ldap_free_urldesc( ludp );
- return LDAP_URL_ERR_BADSCOPE;
- }
- }
-
- if ( q == NULL ) {
- /* no more */
- LDAP_FREE( url );
- *ludpp = ludp;
- return LDAP_URL_SUCCESS;
- }
-
- /* scan forward for '?' that may marks end of filter */
- p = q;
- q = strchr( p, '?' );
-
- if ( q != NULL ) {
- /* terminate the filter part */
- *q++ = '\0';
- }
-
- if ( *p != '\0' ) {
- /* parse the filter */
- ldap_pvt_hex_unescape( p );
-
- if ( ! *p ) {
- /* missing filter */
- LDAP_FREE( url );
- ldap_free_urldesc( ludp );
- return LDAP_URL_ERR_BADFILTER;
- }
-
- LDAP_FREE( ludp->lud_filter );
- ludp->lud_filter = LDAP_STRDUP( p );
-
- if ( ludp->lud_filter == NULL ) {
- LDAP_FREE( url );
- ldap_free_urldesc( ludp );
- return LDAP_URL_ERR_MEM;
- }
- }
-
- if ( q == NULL ) {
- /* no more */
- LDAP_FREE( url );
- *ludpp = ludp;
- return LDAP_URL_SUCCESS;
- }
-
- /* scan forward for '?' that may marks end of extensions */
- p = q;
- q = strchr( p, '?' );
-
- if ( q != NULL ) {
- /* extra '?' */
- LDAP_FREE( url );
- ldap_free_urldesc( ludp );
- return LDAP_URL_ERR_BADURL;
- }
-
- /* parse the extensions */
- ludp->lud_exts = ldap_str2charray( p, "," );
-
- if ( ludp->lud_exts == NULL ) {
- LDAP_FREE( url );
- ldap_free_urldesc( ludp );
- return LDAP_URL_ERR_BADEXTS;
- }
-
- for ( i=0; ludp->lud_exts[i] != NULL; i++ ) {
- ldap_pvt_hex_unescape( ludp->lud_exts[i] );
-
- if ( *ludp->lud_exts[i] == '!' ) {
- /* count the number of critical extensions */
- ludp->lud_crit_exts++;
- }
- }
-
- if ( i == 0 ) {
- /* must have 1 or more */
- LDAP_FREE( url );
- ldap_free_urldesc( ludp );
- return LDAP_URL_ERR_BADEXTS;
- }
-
- /* no more */
- *ludpp = ludp;
- LDAP_FREE( url );
- return LDAP_URL_SUCCESS;
-}
-
-static gint
-ldap_url_parse( LDAP_CONST gchar *url_in, LDAPURLDesc **ludpp )
-{
- gint rc = ldap_url_parse_ext( url_in, ludpp );
-
- if ( rc != LDAP_URL_SUCCESS ) {
- return rc;
- }
-
- if ((*ludpp)->lud_scope == LDAP_SCOPE_DEFAULT) {
- (*ludpp)->lud_scope = LDAP_SCOPE_BASE;
- }
-
- if ((*ludpp)->lud_host != NULL && *(*ludpp)->lud_host == '\0') {
- LDAP_FREE( (*ludpp)->lud_host );
- (*ludpp)->lud_host = NULL;
- }
-
- if ((*ludpp)->lud_port == 0) {
- if ( strcmp((*ludpp)->lud_scheme, "ldap") == 0 ) {
- (*ludpp)->lud_port = LDAP_PORT;
-#ifdef LDAP_CONNECTIONLESS
- } else if ( strcmp((*ludpp)->lud_scheme, "cldap") == 0 ) {
- (*ludpp)->lud_port = LDAP_PORT;
-#endif
- } else if ( strcmp((*ludpp)->lud_scheme, "ldaps") == 0 ) {
- (*ludpp)->lud_port = LDAPS_PORT;
- }
- }
-
- return rc;
-}
-