diff options
author | nobody <nobody@localhost> | 2003-12-09 09:57:09 +0800 |
---|---|---|
committer | nobody <nobody@localhost> | 2003-12-09 09:57:09 +0800 |
commit | 4ef7d31cb740e45d402fa986aea2449fc1e1ed02 (patch) | |
tree | 75bb0caf9afd4b94842023406d6a7938c5d8b2b7 /addressbook/gui/component | |
parent | 0031a7166cd0f3fc0cec0b60c468ca22a8c45b0b (diff) | |
download | gsoc2013-evolution-LIBGLADE_2_4_0.tar.gz gsoc2013-evolution-LIBGLADE_2_4_0.tar.zst gsoc2013-evolution-LIBGLADE_2_4_0.zip |
This commit was manufactured by cvs2svn to create tagLIBGLADE_2_4_0
'LIBGLADE_2_4_0'.
svn path=/tags/LIBGLADE_2_4_0/; revision=23842
Diffstat (limited to 'addressbook/gui/component')
44 files changed, 0 insertions, 13704 deletions
diff --git a/addressbook/gui/component/.cvsignore b/addressbook/gui/component/.cvsignore deleted file mode 100644 index 5639d4fc22..0000000000 --- a/addressbook/gui/component/.cvsignore +++ /dev/null @@ -1,14 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -*.lo -*.la -evolution-addressbook -evolution-addressbook.pure -test-addressbook -GNOME_Evolution_Addressbook*.server -GNOME_Evolution_Addressbook*.server.in -addressbook-marshal.c -addressbook-marshal.h 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 fb55b0df58..0000000000 --- a/addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in +++ /dev/null @@ -1,143 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_Factory:@VERSION@" - type="shlib" - location="@COMPONENTDIR@/libevolution-addressbook.so"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/ObjectFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="name" type="string" - _value="Evolution Addressbook"/> - -</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 Addressbook card viewer"/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_Control:@VERSION@" - type="factory" - location="OAFIID:GNOME_Evolution_Addressbook_Factory:@VERSION@"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:BonoboControl/addressbook-control:@VERSION@"/> - <item value="IDL:GNOME/Control:1.0"/> - </oaf_attribute> - - <oaf_attribute name="name" type="string" - _value="Evolution Addressbook folder 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 Addressbook component"/> - - <oaf_attribute name="evolution:component_alias" type="string" value="contacts"/> - - <oaf_attribute name="evolution:button_label" type="string" _value="Contacts"/> - <oaf_attribute name="evolution:button_sort_order" type="string" value="-9"/> - <oaf_attribute name="evolution:button_icon" type="string" value="evolution-contacts.png"/> - -</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 Addressbook 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 Addressbook address pop-up"/> - -</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="Manager your S/Mime certificates here"/> - - <oaf_attribute name="evolution2:config_item:icon_name" type="string" - value="pgp-signature-ok.png"/> - - <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 autocomple here"/> - - <oaf_attribute name="evolution2:config_item:icon_name" type="string" - value="folder-settings.png"/> - - <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 09dcb8e537..0000000000 --- a/addressbook/gui/component/Makefile.am +++ /dev/null @@ -1,108 +0,0 @@ -SUBDIRS = select-names - -INCLUDES = \ - -DG_LOG_DOMAIN=\"evolution-addressbook\" \ - -I$(top_srcdir) \ - -I$(top_builddir) \ - -I$(top_srcdir)/shell \ - -I$(top_builddir)/shell \ - -I$(top_srcdir)/widgets/misc \ - -I$(top_srcdir)/addressbook/gui/contact-editor \ - -I$(top_srcdir)/addressbook/gui/contact-list-editor \ - -I$(top_srcdir)/addressbook/gui/widgets \ - -I$(top_srcdir)/addressbook/backend \ - -I$(top_builddir)/addressbook/backend \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \ - -DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \ - -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 \ - autocompletion-config.c \ - autocompletion-config.h \ - addressbook.c \ - addressbook.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)/addressbook/gui/component/select-names/libeselectnames.la \ - $(top_builddir)/shell/libeshell.la \ - $(top_builddir)/addressbook/gui/merging/libeabbookmerging.la \ - $(top_builddir)/addressbook/gui/widgets/libeabwidgets.la \ - $(top_builddir)/addressbook/gui/search/libeaddressbooksearch.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/misc/libemiscwidgets.la \ - $(top_builddir)/widgets/menus/libmenus.la \ - $(EVOLUTION_ADDRESSBOOK_LIBS) $(LDAP_LIBS) - - - -libevolution_addressbook_la_LDFLAGS = -module -avoid-version - -# GConf schemas - -schemadir = $(GCONF_SCHEMA_FILE_DIR) -schema_in_files = apps_evolution_addressbook.schemas.in.in -schema_DATA = $(schema_in_files:.schemas.in.in=-$(BASE_VERSION).schemas) -%-$(BASE_VERSION).schemas.in: %.schemas.in.in - cp $< $@ - -@INTLTOOL_SCHEMAS_RULE@ - -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 $(srcdir)/$$p; \ - done \ - fi - -server_in_files = GNOME_Evolution_Addressbook.server.in.in -server_DATA = $(server_in_files:.server.in.in=_$(BASE_VERSION).server) -@EVO_SERVER_RULE@ -@INTLTOOL_SERVER_RULE@ - -glade_DATA = \ - ldap-config.glade - -BUILT_SOURCES = $(server_DATA) -CLEANFILES = $(BUILT_SOURCES) - -EXTRA_DIST = \ - $(glade_DATA) \ - $(schema_DATA) \ - $(server_in_files) - -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 diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c deleted file mode 100644 index 803ed82d55..0000000000 --- a/addressbook/gui/component/addressbook-component.c +++ /dev/null @@ -1,431 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* addressbook-component.c - * - * Copyright (C) 2003 Ettore Perazzoli - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli <ettore@ximian.com> - */ - -/* EPFIXME: Add autocompletion setting. */ - - -#include <config.h> - -#include "addressbook-component.h" - -#include "addressbook.h" -#include "addressbook-config.h" - -#include "widgets/misc/e-source-selector.h" -#include "addressbook/gui/widgets/eab-gui-util.h" - -#include "e-task-bar.h" - -#include <string.h> -#include <bonobo/bonobo-i18n.h> -#include <gtk/gtkscrolledwindow.h> -#include <gtk/gtkmenu.h> -#include <gtk/gtkimage.h> -#include <gtk/gtkimagemenuitem.h> -#include <gtk/gtklabel.h> /* FIXME */ -#include <gtk/gtkmessagedialog.h> -#include <gtk/gtkstock.h> -#include <gconf/gconf-client.h> -#include <gal/util/e-util.h> - - -#define PARENT_TYPE bonobo_object_get_type () -static BonoboObjectClass *parent_class = NULL; - -struct _AddressbookComponentPrivate { - GConfClient *gconf_client; - ESourceList *source_list; - GtkWidget *source_selector; - - EActivityHandler *activity_handler; -}; - - -/* Utility functions. */ - -static void -load_uri_for_selection (ESourceSelector *selector, - BonoboControl *view_control) -{ - ESource *selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (selector)); - - if (selected_source != NULL) { - bonobo_control_set_property (view_control, NULL, "source_uid", TC_CORBA_string, - e_source_peek_uid (selected_source), NULL); - } -} - -static void -add_popup_menu_item (GtkMenu *menu, const char *label, const char *pixmap, - GCallback callback, gpointer user_data) -{ - GtkWidget *item, *image; - - if (pixmap) { - item = gtk_image_menu_item_new_with_label (label); - - /* load the image */ - image = gtk_image_new_from_file (pixmap); - if (!image) - image = gtk_image_new_from_stock (pixmap, GTK_ICON_SIZE_MENU); - - if (image) - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); - } else { - item = gtk_menu_item_new_with_label (label); - } - - if (callback) - g_signal_connect (G_OBJECT (item), "activate", callback, user_data); - - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - gtk_widget_show (item); -} - -/* Folder popup menu callbacks */ - -static void -new_addressbook_cb (GtkWidget *widget, AddressbookComponent *comp) -{ - addressbook_config_create_new_source (gtk_widget_get_toplevel (widget)); -} - -static void -edit_addressbook_cb (GtkWidget *widget, AddressbookComponent *comp) -{ - AddressbookComponentPrivate *priv; - ESource *selected_source; - - priv = comp->priv; - - selected_source = - e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->source_selector)); - if (!selected_source) - return; - - addressbook_config_edit_source (gtk_widget_get_toplevel (widget), selected_source); -} - -static void -delete_addressbook_cb (GtkWidget *widget, AddressbookComponent *comp) -{ -} - -/* Callbacks. */ - -static void -primary_source_selection_changed_callback (ESourceSelector *selector, - BonoboControl *view_control) -{ - load_uri_for_selection (selector, view_control); -} - -static void -fill_popup_menu_callback (ESourceSelector *selector, GtkMenu *menu, AddressbookComponent *comp) -{ - add_popup_menu_item (menu, _("New Addressbook"), NULL, G_CALLBACK (new_addressbook_cb), comp); - add_popup_menu_item (menu, _("Properties..."), NULL, G_CALLBACK (edit_addressbook_cb), comp); - add_popup_menu_item (menu, _("Delete"), GTK_STOCK_DELETE, G_CALLBACK (delete_addressbook_cb), comp); - add_popup_menu_item (menu, _("Rename"), NULL, NULL, NULL); -} - -/* Evolution::Component CORBA methods. */ - -static void -impl_createControls (PortableServer_Servant servant, - Bonobo_Control *corba_sidebar_control, - Bonobo_Control *corba_view_control, - Bonobo_Control *corba_statusbar_control, - CORBA_Environment *ev) -{ - AddressbookComponent *addressbook_component = ADDRESSBOOK_COMPONENT (bonobo_object_from_servant (servant)); - GtkWidget *selector; - GtkWidget *selector_scrolled_window; - GtkWidget *statusbar_widget; - BonoboControl *sidebar_control; - BonoboControl *view_control; - BonoboControl *statusbar_control; - - selector = e_source_selector_new (addressbook_component->priv->source_list); - e_source_selector_show_selection (E_SOURCE_SELECTOR (selector), FALSE); - gtk_widget_show (selector); - - addressbook_component->priv->source_selector = 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), selector); - gtk_widget_show (selector_scrolled_window); - - sidebar_control = bonobo_control_new (selector_scrolled_window); - - view_control = addressbook_new_control (); - g_signal_connect_object (selector, "primary_selection_changed", - G_CALLBACK (primary_source_selection_changed_callback), - G_OBJECT (view_control), 0); - g_signal_connect_object (selector, "fill_popup_menu", - G_CALLBACK (fill_popup_menu_callback), - G_OBJECT (addressbook_component), 0); - load_uri_for_selection (E_SOURCE_SELECTOR (selector), view_control); - - statusbar_widget = e_task_bar_new (); - gtk_widget_show (statusbar_widget); - statusbar_control = bonobo_control_new (statusbar_widget); - - e_activity_handler_attach_task_bar (addressbook_component->priv->activity_handler, - E_TASK_BAR (statusbar_widget)); - - *corba_sidebar_control = CORBA_Object_duplicate (BONOBO_OBJREF (sidebar_control), ev); - *corba_view_control = CORBA_Object_duplicate (BONOBO_OBJREF (view_control), ev); - *corba_statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (statusbar_control), ev); -} - -static GNOME_Evolution_CreatableItemTypeList * -impl__get_userCreatableItems (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - GNOME_Evolution_CreatableItemTypeList *list = GNOME_Evolution_CreatableItemTypeList__alloc (); - - list->_length = 2; - list->_maximum = list->_length; - list->_buffer = GNOME_Evolution_CreatableItemTypeList_allocbuf (list->_length); - - CORBA_sequence_set_release (list, FALSE); - - list->_buffer[0].id = "contact"; - list->_buffer[0].description = _("New Contact"); - list->_buffer[0].menuDescription = _("_Contact"); - list->_buffer[0].tooltip = _("Create a new contact"); - list->_buffer[0].menuShortcut = 'c'; - list->_buffer[0].iconName = "evolution-contacts-mini.png"; - - list->_buffer[1].id = "contact_list"; - list->_buffer[1].description = _("New Contact List"); - list->_buffer[1].menuDescription = _("Contact _List"); - list->_buffer[1].tooltip = _("Create a new contact list"); - list->_buffer[1].menuShortcut = 'l'; - list->_buffer[1].iconName = "contact-list-16.png"; - - return list; -} - -static void -impl_requestCreateItem (PortableServer_Servant servant, - const CORBA_char *item_type_name, - CORBA_Environment *ev) -{ - AddressbookComponent *addressbook_component = ADDRESSBOOK_COMPONENT (bonobo_object_from_servant (servant)); - AddressbookComponentPrivate *priv; - EBook *book; - EContact *contact = e_contact_new (); - ESource *selected_source; - gchar *uri; - - priv = addressbook_component->priv; - - selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->source_selector)); - if (!selected_source) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_Failed, NULL); - return; - } - - uri = e_source_get_uri (selected_source); - if (!uri) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_Failed, NULL); - return; - } - - book = e_book_new (); - if (!e_book_load_uri (book, uri, TRUE, NULL)) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_Failed, NULL); - g_object_unref (book); - g_free (uri); - return; - } - - contact = e_contact_new (); - - if (!item_type_name) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_UnknownType, NULL); - } else 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); - } else { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_UnknownType, NULL); - } - - g_object_unref (book); - g_object_unref (contact); - g_free (uri); -} - - -/* GObject methods. */ - -static void -impl_dispose (GObject *object) -{ - AddressbookComponentPrivate *priv = ADDRESSBOOK_COMPONENT (object)->priv; - - if (priv->source_selector != NULL) { - g_object_unref (priv->source_selector); - priv->source_selector = NULL; - } - - if (priv->source_list != NULL) { - g_object_unref (priv->source_list); - priv->source_list = NULL; - } - - if (priv->gconf_client != NULL) { - g_object_unref (priv->gconf_client); - priv->gconf_client = NULL; - } - - if (priv->activity_handler != NULL) { - g_object_unref (priv->activity_handler); - priv->activity_handler = 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); - - epv->createControls = impl_createControls; - epv->_get_userCreatableItems = impl__get_userCreatableItems; - epv->requestCreateItem = impl_requestCreateItem; - - 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; - GSList *groups; - - priv = g_new0 (AddressbookComponentPrivate, 1); - - /* EPFIXME: Should use a custom one instead? Also we should add - addressbook_component_peek_gconf_client(). */ - priv->gconf_client = gconf_client_get_default (); - - priv->source_list = e_source_list_new_for_gconf (priv->gconf_client, - "/apps/evolution/addressbook/sources"); - - priv->activity_handler = e_activity_handler_new (); - - /* Create default addressbooks if there are no groups */ - groups = e_source_list_peek_groups (priv->source_list); - if (!groups) { - ESourceGroup *group; - ESource *source; - char *base_uri, *base_uri_proto, *new_dir; - - /* create the local source group */ - base_uri = g_build_filename (g_get_home_dir (), - "/.evolution/addressbook/local/OnThisComputer/", - NULL); - - base_uri_proto = g_strconcat ("file://", base_uri, NULL); - - group = e_source_group_new (_("On This Computer"), base_uri_proto); - e_source_list_add_group (priv->source_list, group, -1); - - g_free (base_uri_proto); - - /* FIXME: Migrate addressbooks from older setup? */ - - /* Create default addressbooks */ - new_dir = g_build_filename (base_uri, "Personal/", NULL); - if (!e_mkdir_hier (new_dir, 0700)) { - source = e_source_new (_("Personal"), "Personal"); - e_source_group_add_source (group, source, -1); - } - g_free (new_dir); - - new_dir = g_build_filename (base_uri, "Work/", NULL); - if (!e_mkdir_hier (new_dir, 0700)) { - source = e_source_new (_("Work"), "Work"); - e_source_group_add_source (group, source, -1); - } - g_free (new_dir); - - g_free (base_uri); - - /* Create the LDAP source group */ - group = e_source_group_new (_("On LDAP Servers"), "ldap://"); - e_source_list_add_group (priv->source_list, group, -1); - } - - component->priv = priv; -} - - -/* 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; -} - - -EActivityHandler * -addressbook_component_peek_activity_handler (AddressbookComponent *component) -{ - g_return_val_if_fail (ADDRESSBOOK_IS_COMPONENT (component), NULL); - - return component->priv->activity_handler; -} - - -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 f08f54aaaf..0000000000 --- a/addressbook/gui/component/addressbook-component.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* addressbook-component.h - * - * Copyright (C) 2003 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli <ettore@ximian.com> - */ - -#ifndef _ADDRESSBOOK_COMPONENT_H_ -#define _ADDRESSBOOK_COMPONENT_H_ - -#include <bonobo/bonobo-object.h> - -#include "Evolution.h" -#include "e-activity-handler.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); - -EActivityHandler *addressbook_component_peek_activity_handler (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 371539562a..0000000000 --- a/addressbook/gui/component/addressbook-config.c +++ /dev/null @@ -1,1439 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Toshok <toshok@ximian.com> - * Chris Lahey <clahey@ximian.com> - **/ - -/*#define STANDALONE*/ - -#include <config.h> - -#include <string.h> -#include <stdlib.h> -#include <sys/time.h> - -#include <gtk/gtkcombo.h> -#include <gtk/gtkdialog.h> -#include <gtk/gtkentry.h> -#include <gtk/gtkmessagedialog.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-druid.h> -#include <libgnomeui/gnome-druid-page.h> - -#include <bonobo/bonobo-generic-factory.h> - -#include <glade/glade.h> - -#include "addressbook.h" -#include "addressbook-component.h" -#include "addressbook-config.h" - -#include "evolution-config-control.h" - -#include <gal/e-table/e-table-memory-store.h> -#include <gal/e-table/e-table-scrolled.h> - - -#ifdef HAVE_LDAP -#include "ldap.h" -#include "ldap_schema.h" -#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 (char *name, char *string1, char *string2, - int num1, int num2); - -/* default objectclasses */ -#define TOP "top" -#define PERSON "person" -#define ORGANIZATIONALPERSON "organizationalPerson" -#define INETORGPERSON "inetOrgPerson" -#define EVOLUTIONPERSON "evolutionPerson" -#define CALENTRY "calEntry" - - -typedef struct { - GtkWidget *notebook; - int page_num; -} FocusHelpClosure; - -static void -focus_help (GtkWidget *w, GdkEventFocus *event, FocusHelpClosure *closure) -{ - gtk_notebook_set_current_page (GTK_NOTEBOOK(closure->notebook), closure->page_num); -} - -static void -add_focus_handler (GtkWidget *widget, GtkWidget *notebook, int page_num) -{ - FocusHelpClosure *focus_closure = g_new0 (FocusHelpClosure, 1); - focus_closure->notebook = notebook; - focus_closure->page_num = page_num; - - g_signal_connect_data (G_OBJECT (widget), - "focus_in_event" /* XXX */, - G_CALLBACK (focus_help), - focus_closure, - (GClosureNotify) g_free, - (GConnectFlags)0); -} - -typedef struct _AddressbookSourceDialog AddressbookSourceDialog; -typedef void (*ModifyFunc)(GtkWidget *item, AddressbookSourceDialog *dialog); - -struct _AddressbookSourceDialog { - GladeXML *gui; - - GtkWidget *window; - GtkWidget *druid; /* only used (obviously) in the druid */ - - /* Source selection (druid only) */ - ESourceList *source_list; - GtkWidget *group_optionmenu; - - /* ESource we're currently editing (editor only) */ - ESource *source; - - /* Source group we're creating/editing a source in */ - ESourceGroup *source_group; - - /* info page fields */ - ModifyFunc general_modify_func; - GtkWidget *host; - GtkWidget *auth_optionmenu; - AddressbookLDAPAuthType auth; - GtkWidget *auth_label_notebook; - GtkWidget *auth_entry_notebook; - GtkWidget *email; - GtkWidget *binddn; - - /* connecting page fields */ - ModifyFunc connecting_modify_func; - GtkWidget *port_combo; - GtkWidget *ssl_optionmenu; - AddressbookLDAPSSLType ssl; - - /* searching page fields */ - ModifyFunc searching_modify_func; - GtkWidget *rootdn; - AddressbookLDAPScopeType scope; - GtkWidget *scope_optionmenu; - GtkWidget *timeout_scale; - GtkWidget *limit_spinbutton; - - /* display name page fields */ - GtkWidget *display_name; - gboolean display_name_changed; /* only used in the druid */ - - gboolean schema_query_successful; - - /* stuff for the account editor window */ - GtkWidget *ok_button; - GtkWidget *cancel_button; - GtkWidget *advanced_button_notebook; - GtkWidget *notebook; /* the toplevel notebook */ - - gboolean advanced; -}; - - - -#ifdef HAVE_LDAP - -static char * -ldap_unparse_auth (AddressbookLDAPAuthType auth_type) -{ - switch (auth_type) { - case ADDRESSBOOK_LDAP_AUTH_NONE: - return "none"; - case ADDRESSBOOK_LDAP_AUTH_SIMPLE_EMAIL: - return "ldap/simple-email"; - case ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN: - return "ldap/simple-binddn"; - default: - g_assert(0); - return "none"; - } -} - -static AddressbookLDAPAuthType -ldap_parse_auth (const char *auth) -{ - if (!auth) - return ADDRESSBOOK_LDAP_AUTH_NONE; - - if (!strcmp (auth, "ldap/simple-email") || !strcmp (auth, "simple")) - return ADDRESSBOOK_LDAP_AUTH_SIMPLE_EMAIL; - else if (!strcmp (auth, "ldap/simple-binddn")) - return ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN; - else - return ADDRESSBOOK_LDAP_AUTH_NONE; -} - -static char * -ldap_unparse_scope (AddressbookLDAPScopeType scope_type) -{ - switch (scope_type) { - case ADDRESSBOOK_LDAP_SCOPE_BASE: - return "base"; - case ADDRESSBOOK_LDAP_SCOPE_ONELEVEL: - return "one"; - case ADDRESSBOOK_LDAP_SCOPE_SUBTREE: - return "sub"; - default: - g_assert(0); - return ""; - } -} - -static char * -ldap_unparse_ssl (AddressbookLDAPSSLType ssl_type) -{ - switch (ssl_type) { - case ADDRESSBOOK_LDAP_SSL_NEVER: - return "never"; - case ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE: - return "whenever_possible"; - case ADDRESSBOOK_LDAP_SSL_ALWAYS: - return "always"; - default: - g_assert(0); - return ""; - } -} - -static AddressbookLDAPSSLType -ldap_parse_ssl (const char *ssl) -{ - if (!ssl) - return ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE; /* XXX good default? */ - - if (!strcmp (ssl, "always")) - return ADDRESSBOOK_LDAP_SSL_ALWAYS; - else if (!strcmp (ssl, "never")) - return ADDRESSBOOK_LDAP_SSL_NEVER; - else - return ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE; -} - -#endif - - - -static gboolean -create_source_dir (AddressbookSourceDialog *dialog, ESource *source) -{ - gchar *new_dir; - gint result; - - new_dir = g_build_filename (e_source_group_peek_base_uri (dialog->source_group), - e_source_peek_name (source), NULL); - g_print ("Making %s\n", new_dir); - result = e_mkdir_hier (new_dir + sizeof ("file://") - 1, 0700); - g_free (new_dir); - - if (result) { - e_notice (NULL /* FIXME: parent */, GTK_MESSAGE_ERROR, - _("Could not create a directory for the new addressbook.")); - return FALSE; - } - - return TRUE; -} - -static void -dialog_to_source (AddressbookSourceDialog *dialog, ESource *source, gboolean temporary) -{ - gchar *str; - - g_assert (source); - - e_source_set_name (source, gtk_entry_get_text (GTK_ENTRY (dialog->display_name))); - - if (!strcmp ("ldap://", e_source_group_peek_base_uri (dialog->source_group))) { -#ifdef HAVE_LDAP - e_source_set_property (source, "email_addr", gtk_entry_get_text (GTK_ENTRY (dialog->email))); - e_source_set_property (source, "binddn", gtk_entry_get_text (GTK_ENTRY (dialog->binddn))); - e_source_set_property (source, "limit", gtk_entry_get_text (GTK_ENTRY (dialog->limit_spinbutton))); - e_source_set_property (source, "ssl", ldap_unparse_ssl (dialog->ssl)); - e_source_set_property (source, "auth", ldap_unparse_auth (dialog->auth)); - - str = g_strdup_printf ("%s:%s/%s?" /* trigraph prevention */ "?%s", - gtk_entry_get_text (GTK_ENTRY (dialog->host)), - gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (dialog->port_combo)->entry)), - gtk_entry_get_text (GTK_ENTRY (dialog->rootdn)), - ldap_unparse_scope (dialog->scope)); - e_source_set_relative_uri (source, str); - g_free (str); -#endif - } else { - const gchar *relative_uri; - - relative_uri = e_source_peek_relative_uri (source); - if (!relative_uri || !strlen (relative_uri)) { - e_source_set_relative_uri (source, e_source_peek_name (source)); - - if (!temporary && !create_source_dir (dialog, source)) - return; - } - } - - if (!temporary && !e_source_peek_group (source)) - e_source_group_add_source (dialog->source_group, source, -1); -} - -static ESource * -dialog_to_temp_source (AddressbookSourceDialog *dialog) -{ - ESource *source; - - source = e_source_new ("", ""); - dialog_to_source (dialog, source, TRUE); - - return source; -} - -#ifdef HAVE_LDAP -static gboolean -source_to_uri_parts (ESource *source, gchar **host, gchar **rootdn, - AddressbookLDAPScopeType *scope, gint *port) -{ - gchar *uri; - LDAPURLDesc *lud; - gint ldap_error; - - g_assert (source); - - uri = e_source_get_uri (source); - ldap_error = ldap_url_parse ((gchar *) uri, &lud); - g_free (uri); - - if (ldap_error != LDAP_SUCCESS) - return FALSE; - - if (host) - *host = g_strdup (lud->lud_host ? lud->lud_host : ""); - if (rootdn) - *rootdn = g_strdup (lud->lud_dn ? lud->lud_dn : ""); - if (port) - *port = lud->lud_port ? lud->lud_port : LDAP_PORT; - if (scope) - *scope = lud->lud_scope == LDAP_SCOPE_BASE ? ADDRESSBOOK_LDAP_SCOPE_BASE : - lud->lud_scope == LDAP_SCOPE_ONELEVEL ? ADDRESSBOOK_LDAP_SCOPE_ONELEVEL : - lud->lud_scope == LDAP_SCOPE_SUBTREE ? ADDRESSBOOK_LDAP_SCOPE_SUBTREE : - ADDRESSBOOK_LDAP_SCOPE_ONELEVEL; - - ldap_free_urldesc (lud); - return TRUE; -} -#endif - -#define SOURCE_PROP_STRING(source, prop) \ - (source && e_source_get_property (source, prop) ? e_source_get_property (source, prop) : "") - -static void -source_to_dialog (AddressbookSourceDialog *dialog) -{ - ESource *source = dialog->source; - - gtk_entry_set_text (GTK_ENTRY (dialog->display_name), source ? e_source_peek_name (source) : ""); - -#ifdef HAVE_LDAP - gtk_entry_set_text (GTK_ENTRY (dialog->email), SOURCE_PROP_STRING (source, "email_addr")); - gtk_entry_set_text (GTK_ENTRY (dialog->binddn), SOURCE_PROP_STRING (source, "binddn")); - gtk_entry_set_text (GTK_ENTRY (dialog->limit_spinbutton), - source && e_source_get_property (source, "limit") ? - e_source_get_property (source, "limit") : "100"); - - dialog->auth = source && e_source_get_property (source, "auth") ? - ldap_parse_auth (e_source_get_property (source, "auth")) : ADDRESSBOOK_LDAP_AUTH_NONE; - dialog->ssl = source && e_source_get_property (source, "ssl") ? - ldap_parse_ssl (e_source_get_property (source, "ssl")) : ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE; - - if (source && !strcmp ("ldap://", e_source_group_peek_base_uri (dialog->source_group))) { - gchar *host; - gchar *rootdn; - AddressbookLDAPScopeType scope; - gint port; - - if (source_to_uri_parts (source, &host, &rootdn, &scope, &port)) { - gchar *port_str; - - gtk_entry_set_text (GTK_ENTRY (dialog->host), host); - gtk_entry_set_text (GTK_ENTRY (dialog->rootdn), rootdn); - - dialog->scope = scope; - - port_str = g_strdup_printf ("%d", port); - gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (dialog->port_combo)->entry), port_str); - g_free (port_str); - - g_free (host); - g_free (rootdn); - } - } - - gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->auth_optionmenu), dialog->auth); - if (dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE) { - gtk_notebook_set_current_page (GTK_NOTEBOOK(dialog->auth_label_notebook), dialog->auth - 1); - gtk_notebook_set_current_page (GTK_NOTEBOOK(dialog->auth_entry_notebook), dialog->auth - 1); - } - gtk_widget_set_sensitive (dialog->auth_label_notebook, dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE); - gtk_widget_set_sensitive (dialog->auth_entry_notebook, dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE); - - gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->scope_optionmenu), dialog->scope); - gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->ssl_optionmenu), dialog->ssl); -#endif -} - -#ifdef HAVE_LDAP - -/* ldap api foo */ -static LDAP * -addressbook_ldap_init (GtkWidget *window, ESource *source) -{ - LDAP *ldap; - gchar *host; - gint port; - - if (!source_to_uri_parts (source, &host, NULL, NULL, &port)) - return NULL; - - ldap = ldap_init (host, port); - if (!ldap) { - GtkWidget *dialog; - dialog = gtk_message_dialog_new (GTK_WINDOW(window), - GTK_DIALOG_MODAL, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("Failed to connect to LDAP server")); - g_signal_connect (dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); - gtk_widget_show (dialog); - } - - /* XXX do TLS if it's configured in */ - - 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) { - GtkWidget *dialog; - dialog = gtk_message_dialog_new (GTK_WINDOW (window), - GTK_DIALOG_MODAL, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("Failed to authenticate with LDAP server")); - g_signal_connect (dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); - gtk_widget_show (dialog); - } - - return ldap_error; -} - -static int -addressbook_root_dse_query (GtkWindow *window, LDAP *ldap, char **attrs, LDAPMessage **resp) -{ - int ldap_error; - struct timeval timeout; - - /* 3 second timeout */ - timeout.tv_sec = 3; - timeout.tv_usec = 0; - - ldap_error = ldap_search_ext_s (ldap, - LDAP_ROOT_DSE, LDAP_SCOPE_BASE, - "(objectclass=*)", - attrs, 0, NULL, NULL, &timeout, LDAP_NO_LIMIT, resp); - if (LDAP_SUCCESS != ldap_error) { - GtkWidget *dialog; - dialog = gtk_message_dialog_new (window, - GTK_DIALOG_MODAL, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("Could not perform query on Root DSE")); - g_signal_connect (dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); - gtk_widget_show (dialog); - } - - return ldap_error; -} - -#endif - -static void -addressbook_source_dialog_destroy (gpointer data, GObject *where_object_was) -{ - AddressbookSourceDialog *dialog = data; - - g_object_unref (dialog->gui); - g_free (dialog); -} - -static void -addressbook_add_server_druid_cancel (GtkWidget *widget, AddressbookSourceDialog *dialog) -{ - gtk_widget_destroy (dialog->window); -} - -static void -addressbook_add_server_druid_finish (GnomeDruidPage *druid_page, GtkWidget *gnome_druid, AddressbookSourceDialog *sdialog) -{ - sdialog->source = e_source_new ("", ""); - dialog_to_source (sdialog, sdialog->source, FALSE); - - /* tear down the widgets */ - gtk_widget_destroy (sdialog->window); -} - -static void -reparent_to_vbox (AddressbookSourceDialog *dialog, char *vbox_name, char *widget_name) -{ - GtkWidget *vbox, *widget; - - vbox = glade_xml_get_widget (dialog->gui, vbox_name); - widget = glade_xml_get_widget (dialog->gui, widget_name); - - gtk_widget_reparent (widget, vbox); - gtk_box_set_child_packing (GTK_BOX (vbox), widget, TRUE, TRUE, 0, GTK_PACK_START); -} - -static void -auth_optionmenu_activated (GtkWidget *item, AddressbookSourceDialog *dialog) -{ - dialog->auth = g_list_index (gtk_container_get_children (GTK_CONTAINER (item->parent)), - item); - - dialog->general_modify_func (item, dialog); - - if (dialog->auth == 0) { - gtk_widget_set_sensitive (dialog->auth_label_notebook, FALSE); - gtk_widget_set_sensitive (dialog->auth_entry_notebook, FALSE); - } - else { - gtk_widget_set_sensitive (dialog->auth_label_notebook, TRUE); - gtk_widget_set_sensitive (dialog->auth_entry_notebook, TRUE); - gtk_notebook_set_current_page (GTK_NOTEBOOK(dialog->auth_label_notebook), dialog->auth - 1); - gtk_notebook_set_current_page (GTK_NOTEBOOK(dialog->auth_entry_notebook), dialog->auth - 1); - } -} - -static void -add_auth_activate_cb (GtkWidget *item, AddressbookSourceDialog *dialog) -{ - g_signal_connect (item, "activate", - G_CALLBACK (auth_optionmenu_activated), dialog); -} - -static void -setup_general_tab (AddressbookSourceDialog *dialog, ModifyFunc modify_func) -{ - GtkWidget *general_tab_help; - GtkWidget *menu; - - general_tab_help = glade_xml_get_widget (dialog->gui, "general-tab-help"); - - dialog->general_modify_func = modify_func; - dialog->host = glade_xml_get_widget (dialog->gui, "server-name-entry"); - g_signal_connect (dialog->host, "changed", - G_CALLBACK (modify_func), dialog); - add_focus_handler (dialog->host, general_tab_help, 0); - - dialog->auth_label_notebook = glade_xml_get_widget (dialog->gui, "auth-label-notebook"); - dialog->auth_entry_notebook = glade_xml_get_widget (dialog->gui, "auth-entry-notebook"); - dialog->email = glade_xml_get_widget (dialog->gui, "email-entry"); - g_signal_connect (dialog->email, "changed", - G_CALLBACK (modify_func), dialog); - add_focus_handler (dialog->email, general_tab_help, 1); - dialog->binddn = glade_xml_get_widget (dialog->gui, "dn-entry"); - g_signal_connect (dialog->binddn, "changed", - G_CALLBACK (modify_func), dialog); - add_focus_handler (dialog->binddn, general_tab_help, 2); - - dialog->auth_optionmenu = glade_xml_get_widget (dialog->gui, "auth-optionmenu"); - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU(dialog->auth_optionmenu)); - gtk_container_foreach (GTK_CONTAINER (menu), (GtkCallback)add_auth_activate_cb, dialog); - add_focus_handler (dialog->auth_optionmenu, general_tab_help, 3); -} - -static gboolean -general_tab_check (AddressbookSourceDialog *dialog) -{ - gboolean valid = TRUE; - const char *string; - - if (strcmp ("ldap://", e_source_group_peek_base_uri (dialog->source_group))) - return TRUE; - - string = gtk_entry_get_text (GTK_ENTRY (dialog->host)); - if (!string || !string[0]) - valid = FALSE; - - if (valid) { - if (dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE) { - if (dialog->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN) - string = gtk_entry_get_text (GTK_ENTRY (dialog->binddn)); - else - string = gtk_entry_get_text (GTK_ENTRY (dialog->email)); - - if (!string || !string[0]) - valid = FALSE; - } - } - - return valid; -} - -static void -druid_info_page_modify_cb (GtkWidget *item, AddressbookSourceDialog *dialog) -{ - gnome_druid_set_buttons_sensitive (GNOME_DRUID(dialog->druid), - TRUE, /* back */ - general_tab_check (dialog), /* next */ - TRUE, /* cancel */ - FALSE /* help */); -} - -static void -druid_info_page_prepare (GnomeDruidPage *dpage, GtkWidget *gdruid, AddressbookSourceDialog *dialog) -{ - druid_info_page_modify_cb (NULL, dialog); - /* stick the focus in the hostname field */ - gtk_widget_grab_focus (dialog->host); -} - - -/* connecting page */ -static void -ssl_optionmenu_activated (GtkWidget *item, AddressbookSourceDialog *dialog) -{ - dialog->ssl = g_list_index (gtk_container_get_children (GTK_CONTAINER (item->parent)), - item); - - dialog->connecting_modify_func (item, dialog); -} - -static void -ssl_optionmenu_selected (GtkWidget *item, AddressbookSourceDialog *dialog) -{ - GtkWidget *connecting_tab_help; - int ssl_type = g_list_index (gtk_container_get_children (GTK_CONTAINER (item->parent)), - item); - - connecting_tab_help = glade_xml_get_widget (dialog->gui, "connecting-tab-help"); - - gtk_notebook_set_current_page (GTK_NOTEBOOK(connecting_tab_help), ssl_type + 1); -} - -static void -add_ssl_activate_cb (GtkWidget *item, AddressbookSourceDialog *dialog) -{ - g_signal_connect (item, "activate", - G_CALLBACK (ssl_optionmenu_activated), dialog); - g_signal_connect (item, "select", - G_CALLBACK (ssl_optionmenu_selected), dialog); -} - -static void -port_changed_func (GtkWidget *item, AddressbookSourceDialog *dialog) -{ - /* if the port value is ldaps, set the SSL/TLS option menu to - Always and desensitize it */ - const char *string = gtk_entry_get_text (GTK_ENTRY (item)); - - dialog->connecting_modify_func (item, dialog); - - if (!strcmp (string, LDAPS_PORT_STRING)) { - dialog->ssl = ADDRESSBOOK_LDAP_SSL_ALWAYS; - gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->ssl_optionmenu), - dialog->ssl); - - gtk_widget_set_sensitive (dialog->ssl_optionmenu, FALSE); - } - else { - gtk_widget_set_sensitive (dialog->ssl_optionmenu, TRUE); - } - -} - -static void -setup_connecting_tab (AddressbookSourceDialog *dialog, ModifyFunc modify_func) -{ - GtkWidget *menu; - GtkWidget *connecting_tab_help; - - dialog->connecting_modify_func = modify_func; - - connecting_tab_help = glade_xml_get_widget (dialog->gui, "connecting-tab-help"); - - dialog->port_combo = glade_xml_get_widget (dialog->gui, "port-combo"); - add_focus_handler (dialog->port_combo, connecting_tab_help, 0); - add_focus_handler (GTK_COMBO(dialog->port_combo)->entry, connecting_tab_help, 0); - g_signal_connect (GTK_COMBO(dialog->port_combo)->entry, "changed", - G_CALLBACK (modify_func), dialog); - g_signal_connect (GTK_COMBO(dialog->port_combo)->entry, "changed", - G_CALLBACK (port_changed_func), dialog); - dialog->ssl_optionmenu = glade_xml_get_widget (dialog->gui, "ssl-optionmenu"); - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU(dialog->ssl_optionmenu)); - gtk_container_foreach (GTK_CONTAINER (menu), (GtkCallback)add_ssl_activate_cb, dialog); -} - -static gboolean -connecting_tab_check (AddressbookSourceDialog *dialog) -{ - gboolean valid = TRUE; - const char *string; - - string = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO(dialog->port_combo)->entry)); - if (!string || !string[0]) - valid = FALSE; - - return valid; -} - -static void -druid_connecting_page_modify_cb (GtkWidget *item, AddressbookSourceDialog *dialog) -{ - gnome_druid_set_buttons_sensitive (GNOME_DRUID(dialog->druid), - TRUE, /* back */ - connecting_tab_check (dialog), /* next */ - TRUE, /* cancel */ - FALSE /* help */); -} - -static void -druid_connecting_page_prepare (GnomeDruidPage *dpage, GtkWidget *gdruid, AddressbookSourceDialog *dialog) -{ - druid_connecting_page_modify_cb (NULL, dialog); - /* stick the focus in the port combo */ - gtk_widget_grab_focus (GTK_COMBO(dialog->port_combo)->entry); -} - - - -#ifdef HAVE_LDAP - -/* searching page */ -static ETableMemoryStoreColumnInfo bases_table_columns[] = { - E_TABLE_MEMORY_STORE_STRING, - E_TABLE_MEMORY_STORE_TERMINATOR -}; - -#define BASES_TABLE_SPEC \ -"<ETableSpecification cursor-mode=\"line\" no-headers=\"true\"> \ - <ETableColumn model_col= \"0\" _title=\"Base\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \ - <ETableState> \ - <column source=\"0\"/> \ - <grouping></grouping> \ - </ETableState> \ -</ETableSpecification>" - -GtkWidget* -supported_bases_create_table (char *name, char *string1, char *string2, int num1, int num2) -{ - GtkWidget *table; - ETableModel *model; - - model = e_table_memory_store_new (bases_table_columns); - - table = e_table_scrolled_new (model, NULL, BASES_TABLE_SPEC, NULL); - - g_object_set_data (G_OBJECT (table), "model", model); - - return table; -} - -static gboolean -do_ldap_root_dse_query (GtkWidget *dialog, ETableModel *model, ESource *source, char ***rvalues) -{ - LDAP *ldap; - char *attrs[2]; - int ldap_error; - char **values; - LDAPMessage *resp; - int i; - - ldap = addressbook_ldap_init (dialog, source); - if (!ldap) - return FALSE; - - if (LDAP_SUCCESS != addressbook_ldap_auth (dialog, ldap)) - goto fail; - - attrs[0] = "namingContexts"; - attrs[1] = NULL; - - ldap_error = addressbook_root_dse_query (GTK_WINDOW (dialog), ldap, attrs, &resp); - - if (ldap_error != LDAP_SUCCESS) - goto fail; - - values = ldap_get_values (ldap, resp, "namingContexts"); - if (!values || values[0] == NULL) { - GtkWidget *error_dialog; - error_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog), - GTK_DIALOG_MODAL, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("The server responded with no supported search bases")); - g_signal_connect (error_dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); - gtk_widget_show (error_dialog); - goto fail; - } - - for (i = 0; values[i]; i++) - e_table_memory_store_insert (E_TABLE_MEMORY_STORE (model), - -1, GINT_TO_POINTER(i), values[i]); - - *rvalues = values; - - ldap_unbind_s (ldap); - return TRUE; - - fail: - ldap_unbind_s (ldap); - return FALSE; -} - -static void -search_base_selection_model_changed (ESelectionModel *selection_model, GtkWidget *dialog) -{ - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), - GTK_RESPONSE_OK, - e_selection_model_selected_count (selection_model) == 1); -} - -static void -query_for_supported_bases (GtkWidget *button, AddressbookSourceDialog *sdialog) -{ - ESelectionModel *selection_model; - ESource *source; - GtkWidget *dialog; - GtkWidget *supported_bases_table; - ETableModel *model; - int id; - char **values; - - source = dialog_to_temp_source (sdialog); - - dialog = glade_xml_get_widget (sdialog->gui, "supported-bases-dialog"); - - supported_bases_table = glade_xml_get_widget (sdialog->gui, "supported-bases-table"); - gtk_widget_show (supported_bases_table); - selection_model = e_table_get_selection_model (e_table_scrolled_get_table (E_TABLE_SCROLLED(supported_bases_table))); - model = g_object_get_data (G_OBJECT (supported_bases_table), "model"); - - g_signal_connect (selection_model, "selection_changed", - G_CALLBACK (search_base_selection_model_changed), dialog); - - search_base_selection_model_changed (selection_model, dialog); - - if (do_ldap_root_dse_query (dialog, model, source, &values)) { - id = gtk_dialog_run (GTK_DIALOG (dialog)); - - gtk_widget_hide (dialog); - - if (id == GTK_RESPONSE_OK) { - int i; - /* OK was clicked */ - - /* ugh. */ - for (i = 0; values[i]; i ++) { - if (e_selection_model_is_row_selected (selection_model, i)) { - gtk_entry_set_text (GTK_ENTRY (sdialog->rootdn), values[i]); - break; /* single selection, so we can quit when we've found it. */ - } - } - } - - ldap_value_free (values); - - e_table_memory_store_clear (E_TABLE_MEMORY_STORE (model)); - } - - g_object_unref (source); -} - -static void -scope_optionmenu_activated (GtkWidget *item, AddressbookSourceDialog *dialog) -{ - dialog->scope = g_list_index (gtk_container_get_children (GTK_CONTAINER (item->parent)), - item); - - if (dialog->searching_modify_func) - dialog->searching_modify_func (item, dialog); -} - -static void -add_scope_activate_cb (GtkWidget *item, AddressbookSourceDialog *dialog) -{ - g_signal_connect (item, "activate", - G_CALLBACK (scope_optionmenu_activated), dialog); -} - -static void -setup_searching_tab (AddressbookSourceDialog *dialog, ModifyFunc modify_func) -{ - GtkWidget *menu; - GtkWidget *rootdn_button; - GtkWidget *searching_tab_help; - - dialog->searching_modify_func = modify_func; - - searching_tab_help = glade_xml_get_widget (dialog->gui, "searching-tab-help"); - - dialog->rootdn = glade_xml_get_widget (dialog->gui, "rootdn-entry"); - add_focus_handler (dialog->rootdn, searching_tab_help, 0); - if (modify_func) - g_signal_connect (dialog->rootdn, "changed", - G_CALLBACK (modify_func), dialog); - - dialog->scope_optionmenu = glade_xml_get_widget (dialog->gui, "scope-optionmenu"); - add_focus_handler (dialog->scope_optionmenu, searching_tab_help, 1); - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU(dialog->scope_optionmenu)); - gtk_container_foreach (GTK_CONTAINER (menu), (GtkCallback)add_scope_activate_cb, dialog); - - dialog->timeout_scale = glade_xml_get_widget (dialog->gui, "timeout-scale"); - add_focus_handler (dialog->timeout_scale, searching_tab_help, 2); - if (modify_func) - g_signal_connect (GTK_RANGE(dialog->timeout_scale)->adjustment, - "value_changed", - G_CALLBACK (modify_func), dialog); - - dialog->limit_spinbutton = glade_xml_get_widget (dialog->gui, "download-limit-spinbutton"); - if (modify_func) - g_signal_connect (dialog->limit_spinbutton, "changed", - G_CALLBACK (modify_func), dialog); - - /* special handling for the "Show Supported Bases button" */ - rootdn_button = glade_xml_get_widget (dialog->gui, "rootdn-button"); - g_signal_connect (rootdn_button, "clicked", - G_CALLBACK(query_for_supported_bases), dialog); -} - -static void -druid_searching_page_prepare (GnomeDruidPage *dpage, GtkWidget *gdruid, AddressbookSourceDialog *dialog) -{ - gnome_druid_set_buttons_sensitive (GNOME_DRUID(dialog->druid), - TRUE, /* back */ - TRUE, /* next */ - TRUE, /* cancel */ - FALSE /* help */); -} - -#endif - - -/* display name page */ -static gboolean -display_name_check (AddressbookSourceDialog *dialog) -{ - gboolean valid = TRUE; - const char *string; - - string = gtk_entry_get_text (GTK_ENTRY (dialog->display_name)); - if (!string || !string[0]) - valid = FALSE; - - return valid; -} - -static void -folder_page_prepare (GtkWidget *page, GtkWidget *gnome_druid, AddressbookSourceDialog *dialog) -{ - if (!dialog->display_name_changed) { - const char *server_name = gtk_entry_get_text (GTK_ENTRY (dialog->host)); - gtk_entry_set_text (GTK_ENTRY (dialog->display_name), server_name); - } - - gnome_druid_set_buttons_sensitive (GNOME_DRUID(dialog->druid), - TRUE, /* back */ - display_name_check (dialog), /* next */ - TRUE, /* cancel */ - FALSE /* help */); -} - -static void -druid_folder_page_modify_cb (GtkWidget *item, AddressbookSourceDialog *dialog) -{ - dialog->display_name_changed = TRUE; - folder_page_prepare (NULL, NULL, dialog); -} - - - -static void -source_group_changed_cb (GtkWidget *widget, AddressbookSourceDialog *sdialog) -{ - sdialog->source_group = g_slist_nth (e_source_list_peek_groups (sdialog->source_list), - gtk_option_menu_get_history (GTK_OPTION_MENU (sdialog->group_optionmenu)))->data; -} - -static void -source_group_menu_add_groups (GtkMenuShell *menu_shell, ESourceList *source_list) -{ - GSList *groups, *sl; - - groups = e_source_list_peek_groups (source_list); - for (sl = groups; sl; sl = g_slist_next (sl)) { - GtkWidget *menu_item; - ESourceGroup *group = sl->data; - -#ifndef HAVE_LDAP - /* If LDAP isn't configured, skip LDAP groups */ - if (!strcmp ("ldap://", e_source_group_peek_base_uri (group))) - continue; -#endif - - menu_item = gtk_menu_item_new_with_label (e_source_group_peek_name (group)); - gtk_widget_show (menu_item); - gtk_menu_shell_append (menu_shell, menu_item); - } -} - -static gboolean -folder_page_forward (GtkWidget *page, GtkWidget *widget, AddressbookSourceDialog *sdialog) -{ - GtkWidget *finish_page = glade_xml_get_widget (sdialog->gui, "add-server-druid-finish-page"); - - if (strcmp ("ldap://", e_source_group_peek_base_uri (sdialog->source_group))) { - gnome_druid_set_page (GNOME_DRUID (sdialog->druid), GNOME_DRUID_PAGE (finish_page)); - return TRUE; - } - - return FALSE; -} - -static gboolean -finish_page_back (GtkWidget *page, GtkWidget *widget, AddressbookSourceDialog *sdialog) -{ - GtkWidget *folder_page = glade_xml_get_widget (sdialog->gui, "add-server-druid-folder-page"); - - if (strcmp ("ldap://", e_source_group_peek_base_uri (sdialog->source_group))) { - gnome_druid_set_page (GNOME_DRUID (sdialog->druid), GNOME_DRUID_PAGE (folder_page)); - return TRUE; - } - - return FALSE; -} - -static AddressbookSourceDialog * -addressbook_add_server_druid (void) -{ - AddressbookSourceDialog *sdialog = g_new0 (AddressbookSourceDialog, 1); - GtkWidget *page; - GConfClient *gconf_client; - - sdialog->gui = glade_xml_new (EVOLUTION_GLADEDIR "/" GLADE_FILE_NAME, NULL, NULL); - - sdialog->window = glade_xml_get_widget (sdialog->gui, "account-druid-window"); - sdialog->druid = glade_xml_get_widget (sdialog->gui, "account-druid"); - - /* general page */ - page = glade_xml_get_widget (sdialog->gui, "add-server-druid-folder-page"); - sdialog->display_name = glade_xml_get_widget (sdialog->gui, "druid-display-name-entry"); - g_signal_connect (sdialog->display_name, "changed", - G_CALLBACK (druid_folder_page_modify_cb), sdialog); - g_signal_connect_after (page, "prepare", - G_CALLBACK (folder_page_prepare), sdialog); - g_signal_connect_after (page, "next", - G_CALLBACK (folder_page_forward), sdialog); - - gconf_client = gconf_client_get_default (); - sdialog->source_list = e_source_list_new_for_gconf (gconf_client, "/apps/evolution/addressbook/sources"); - sdialog->group_optionmenu = glade_xml_get_widget (sdialog->gui, "druid-group-option-menu"); - if (!GTK_IS_MENU (gtk_option_menu_get_menu (GTK_OPTION_MENU (sdialog->group_optionmenu)))) { - GtkWidget *menu = gtk_menu_new (); - gtk_option_menu_set_menu (GTK_OPTION_MENU (sdialog->group_optionmenu), menu); - gtk_widget_show (menu); - } - - /* NOTE: This assumes that we have sources. If they don't exist, they're set up - * on startup of the Addressbook component. */ - source_group_menu_add_groups (GTK_MENU_SHELL (gtk_option_menu_get_menu ( - GTK_OPTION_MENU (sdialog->group_optionmenu))), sdialog->source_list); - gtk_option_menu_set_history (GTK_OPTION_MENU (sdialog->group_optionmenu), 0); - sdialog->source_group = e_source_list_peek_groups (sdialog->source_list)->data; - g_signal_connect (sdialog->group_optionmenu, "changed", - G_CALLBACK (source_group_changed_cb), sdialog); - -#ifdef HAVE_LDAP - - /* info page */ - page = glade_xml_get_widget (sdialog->gui, "add-server-druid-info-page"); - reparent_to_vbox (sdialog, "account-druid-general-vbox", "general-tab"); - setup_general_tab (sdialog, druid_info_page_modify_cb); - g_signal_connect_after (page, "prepare", - G_CALLBACK(druid_info_page_prepare), sdialog); - - /* connecting page */ - page = glade_xml_get_widget (sdialog->gui, "add-server-druid-connecting-page"); - reparent_to_vbox (sdialog, "account-druid-connecting-vbox", "connecting-tab"); - setup_connecting_tab (sdialog, druid_connecting_page_modify_cb); - g_signal_connect_after (page, "prepare", - G_CALLBACK(druid_connecting_page_prepare), sdialog); - - /* searching page */ - page = glade_xml_get_widget (sdialog->gui, "add-server-druid-searching-page"); - reparent_to_vbox (sdialog, "account-druid-searching-vbox", "searching-tab"); - setup_searching_tab (sdialog, NULL); - g_signal_connect_after (page, "prepare", - G_CALLBACK(druid_searching_page_prepare), sdialog); - -#endif - - /* finish page */ - page = glade_xml_get_widget (sdialog->gui, "add-server-druid-finish-page"); - g_signal_connect (page, "finish", - G_CALLBACK(addressbook_add_server_druid_finish), sdialog); - g_signal_connect_after (page, "back", - G_CALLBACK (finish_page_back), sdialog); - g_signal_connect (sdialog->druid, "cancel", - G_CALLBACK(addressbook_add_server_druid_cancel), sdialog); - g_object_weak_ref (G_OBJECT (sdialog->window), - addressbook_source_dialog_destroy, sdialog); - - /* make sure we fill in the default values */ - source_to_dialog (sdialog); - - gtk_window_set_type_hint (GTK_WINDOW (sdialog->window), GDK_WINDOW_TYPE_HINT_DIALOG); - gtk_window_set_modal (GTK_WINDOW (sdialog->window), TRUE); - - gtk_widget_show_all (sdialog->window); - - return sdialog; -} - -static void -editor_modify_cb (GtkWidget *item, AddressbookSourceDialog *dialog) -{ - gboolean valid = TRUE; - - valid = display_name_check (dialog); -#ifdef HAVE_LDAP - if (valid) - valid = general_tab_check (dialog); - if (valid) - valid = connecting_tab_check (dialog); -#if 0 - if (valid) - valid = searching_tab_check (dialog); -#endif -#endif - - gtk_widget_set_sensitive (dialog->ok_button, valid); -} - -static void -set_advanced_button_state (AddressbookSourceDialog *dialog) -{ - if (dialog->advanced) { - gtk_notebook_set_current_page (GTK_NOTEBOOK(dialog->advanced_button_notebook), 0); -#ifdef NEW_ADVANCED_UI - gtk_notebook_append_page (GTK_NOTEBOOK(dialog->notebook), dialog->objectclasses_tab, dialog->objectclasses_label); - gtk_notebook_append_page (GTK_NOTEBOOK(dialog->notebook), dialog->mappings_tab, dialog->mappings_label); - gtk_notebook_append_page (GTK_NOTEBOOK(dialog->notebook), dialog->dn_customization_tab, dialog->dn_customization_label); -#endif - } - else { -#ifdef NEW_ADVANCED_UI - gtk_notebook_set_current_page (GTK_NOTEBOOK(dialog->advanced_button_notebook), 1); - - /* hide the advanced tabs of the main notebook */ - gtk_notebook_remove_page (GTK_NOTEBOOK(dialog->notebook), 5); - gtk_notebook_remove_page (GTK_NOTEBOOK(dialog->notebook), 4); - gtk_notebook_remove_page (GTK_NOTEBOOK(dialog->notebook), 3); -#endif - } -} - -#ifdef NEW_ADVANCED_UI -static void -advanced_button_clicked (GtkWidget *button, AddressbookSourceDialog *dialog) -{ - dialog->advanced = !dialog->advanced; - set_advanced_button_state (dialog); -} - -static gboolean -do_schema_query (AddressbookSourceDialog *sdialog) -{ - LDAP *ldap; - int ldap_error; - char *schema_dn; - char *attrs[3]; - char **values; - int i; - AddressbookSource *source = addressbook_dialog_get_source (sdialog); - LDAPMessage *resp; - struct timeval timeout; - - ldap = addressbook_ldap_init (sdialog->window, source); - if (!ldap) - goto fail; - - if (LDAP_SUCCESS != addressbook_ldap_auth (sdialog->window, source, ldap)) - goto fail; - - attrs[0] = "subschemaSubentry"; - attrs[1] = NULL; - - ldap_error = addressbook_root_dse_query (sdialog->window, source, ldap, attrs, &resp); - - if (ldap_error != LDAP_SUCCESS) - goto fail; - - values = ldap_get_values (ldap, resp, "subschemaSubentry"); - if (!values || values[0] == NULL) { - GtkWidget *dialog; - dialog = gnome_ok_dialog_parented (_("This server does not support LDAPv3 schema information"), GTK_WINDOW (sdialog->window)); - gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); - goto fail; - } - - schema_dn = g_strdup (values[0]); - - ldap_value_free (values); - ldap_msgfree (resp); - - attrs[0] = "objectClasses"; - attrs[1] = NULL; - - /* 3 second timeout */ - timeout.tv_sec = 3; - timeout.tv_usec = 0; - - ldap_error = ldap_search_ext_s (ldap, schema_dn, LDAP_SCOPE_BASE, - "(objectClass=subschema)", attrs, 0, - NULL, NULL, &timeout, LDAP_NO_LIMIT, &resp); - if (LDAP_SUCCESS != ldap_error) { - GtkWidget *dialog; - dialog = gnome_error_dialog_parented (_("Error retrieving schema information"), GTK_WINDOW (sdialog->window)); - gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); - goto fail; - } - - values = ldap_get_values (ldap, resp, "objectClasses"); - if (!values) { - GtkWidget *dialog; - dialog = gnome_error_dialog_parented (_("Server did not respond with valid schema information"), GTK_WINDOW (sdialog->window)); - gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); - goto fail; - } - - for (i = 0; values[i]; i ++) { - int j; - int code; - const char *err; - LDAPObjectClass *oc = ldap_str2objectclass (values[i], &code, &err, 0); - - if (!oc) - continue; - - /* we fill in the default list of classes here */ - for (j = 0; oc->oc_names[j]; j ++) { - if (!g_strcasecmp (oc->oc_names[j], EVOLUTIONPERSON) || - !g_strcasecmp (oc->oc_names[j], INETORGPERSON) || - !g_strcasecmp (oc->oc_names[j], ORGANIZATIONALPERSON) || - !g_strcasecmp (oc->oc_names[j], PERSON) || - !g_strcasecmp (oc->oc_names[j], CALENTRY) || - !g_strcasecmp (oc->oc_names[j], TOP)) - g_ptr_array_add (sdialog->default_objectclasses, oc); - } - - g_ptr_array_add (sdialog->server_objectclasses, oc); - } - - addressbook_source_free (source); - ldap_unbind_s (ldap); - return TRUE; - - fail: - addressbook_source_free (source); - if (ldap) - ldap_unbind_s (ldap); - return FALSE; -} - -static void -edit_dialog_switch_page (GtkNotebook *notebook, - GtkNotebookPage *page, guint page_num, - AddressbookSourceDialog *sdialog) -{ - if (page_num >= 3 && !sdialog->schema_query_successful) { - int i; - - gtk_widget_set_sensitive (GTK_WIDGET (notebook), FALSE); - - sdialog->schema_query_successful = do_schema_query (sdialog); - - if (sdialog->schema_query_successful) { - /* fill in the objectclasses model */ - for (i = 0; i < sdialog->server_objectclasses->len; i ++) { - LDAPObjectClass *oc = g_ptr_array_index (sdialog->server_objectclasses, i); - e_table_memory_store_insert (E_TABLE_MEMORY_STORE (sdialog->objectclasses_server_model), - -1, oc, oc->oc_names[0]); - } - gtk_widget_set_sensitive (page->child, TRUE); - } - else { - gtk_widget_set_sensitive (page->child, FALSE); - } - - gtk_widget_set_sensitive (GTK_WIDGET (notebook), TRUE); - } -} -#endif - -static gboolean -edit_dialog_store_change (AddressbookSourceDialog *sdialog) -{ - dialog_to_source (sdialog, sdialog->source, FALSE); - - /* check the display name for uniqueness */ - if (FALSE /* XXX */) { - return FALSE; - } - - return TRUE; -} - -static void -edit_dialog_cancel_clicked (GtkWidget *item, AddressbookSourceDialog *sdialog) -{ - gtk_widget_destroy (sdialog->window); -} - -static void -edit_dialog_ok_clicked (GtkWidget *item, AddressbookSourceDialog *sdialog) -{ - if (edit_dialog_store_change (sdialog)) { - gtk_widget_destroy (sdialog->window); - } -} - -void -addressbook_config_edit_source (GtkWidget *parent, ESource *source) -{ - AddressbookSourceDialog *sdialog = g_new0 (AddressbookSourceDialog, 1); - GtkWidget *general_tab_help; - - sdialog->gui = glade_xml_new (EVOLUTION_GLADEDIR "/" GLADE_FILE_NAME, NULL, NULL); - sdialog->window = glade_xml_get_widget (sdialog->gui, "account-editor-window"); - - sdialog->source = source; - sdialog->source_group = e_source_peek_group (source); - - sdialog->display_name = glade_xml_get_widget (sdialog->gui, "account-editor-display-name-entry"); - g_signal_connect (sdialog->display_name, "changed", - G_CALLBACK (editor_modify_cb), sdialog); - -#ifdef HAVE_LDAP - - /* general tab */ - general_tab_help = glade_xml_get_widget (sdialog->gui, "general-tab-help"); - reparent_to_vbox (sdialog, "account-editor-general-ldap-vbox", "general-tab"); - setup_general_tab (sdialog, editor_modify_cb); - - /* connecting tab */ - reparent_to_vbox (sdialog, "account-editor-connecting-vbox", "connecting-tab"); - setup_connecting_tab (sdialog, editor_modify_cb); - - /* searching tab */ - reparent_to_vbox (sdialog, "account-editor-searching-vbox", "searching-tab"); - setup_searching_tab (sdialog, editor_modify_cb); - -#endif - - sdialog->notebook = glade_xml_get_widget (sdialog->gui, "account-editor-notebook"); - - sdialog->ok_button = glade_xml_get_widget (sdialog->gui, "account-editor-ok-button"); - sdialog->cancel_button = glade_xml_get_widget (sdialog->gui, "account-editor-cancel-button"); - -#ifdef HAVE_LDAP - if (strcmp ("ldap://", e_source_group_peek_base_uri (sdialog->source_group))) { - gtk_widget_hide (glade_xml_get_widget (sdialog->gui, "account-editor-general-ldap-vbox")); - gtk_widget_hide (glade_xml_get_widget (sdialog->gui, "account-editor-connecting-vbox")); - gtk_widget_hide (glade_xml_get_widget (sdialog->gui, "account-editor-searching-vbox")); - } else { - add_focus_handler (sdialog->display_name, general_tab_help, 4); - } -#else - gtk_widget_hide (glade_xml_get_widget (sdialog->gui, "account-editor-general-ldap-vbox")); - gtk_widget_hide (glade_xml_get_widget (sdialog->gui, "account-editor-connecting-vbox")); - gtk_widget_hide (glade_xml_get_widget (sdialog->gui, "account-editor-searching-vbox")); -#endif - - source_to_dialog (sdialog); - - set_advanced_button_state (sdialog); - - g_signal_connect (sdialog->ok_button, - "clicked", G_CALLBACK(edit_dialog_ok_clicked), sdialog); - g_signal_connect (sdialog->cancel_button, - "clicked", G_CALLBACK(edit_dialog_cancel_clicked), sdialog); - g_object_weak_ref (G_OBJECT (sdialog->window), - addressbook_source_dialog_destroy, sdialog); - - gtk_widget_set_sensitive (sdialog->ok_button, FALSE); - - gtk_window_set_type_hint (GTK_WINDOW (sdialog->window), GDK_WINDOW_TYPE_HINT_DIALOG); - gtk_window_set_modal (GTK_WINDOW (sdialog->window), TRUE); - - gtk_widget_show (sdialog->window); -} - -void -addressbook_config_create_new_source (GtkWidget *parent) -{ - AddressbookSourceDialog *dialog; - - dialog = addressbook_add_server_druid (); -} - -#if 0 -#ifdef STANDALONE -int -main(int argc, char **argv) -{ - AddressbookDialog *dialog; - - gnome_init_with_popt_table ("evolution-addressbook", "0.0", - argc, argv, oaf_popt_options, 0, NULL); - - glade_init (); - - bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR); - textdomain (GETTEXT_PACKAGE); - -#if 0 - g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING); -#endif - - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - - dialog = ldap_dialog_new (NULL); - - gtk_widget_show (glade_xml_get_widget (dialog->gui, "addressbook-sources-window")); - - gtk_main(); - - return 0; -} -#endif - -#endif diff --git a/addressbook/gui/component/addressbook-config.h b/addressbook/gui/component/addressbook-config.h deleted file mode 100644 index b5800bc123..0000000000 --- a/addressbook/gui/component/addressbook-config.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* addressbook-storage.h - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Authors: - * Chris Toshok <toshok@ximian.com> - * Chris Lahey <clahey@ximian.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; - -void addressbook_config_edit_source (GtkWidget *parent, ESource *source); -void addressbook_config_create_new_source (GtkWidget *parent); - -#endif /* __ADDRESSBOOK_CONFIG_H__ */ diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c deleted file mode 100644 index f415c903e9..0000000000 --- a/addressbook/gui/component/addressbook.c +++ /dev/null @@ -1,1087 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* addressbook.c - * - * Copyright (C) 2000, 2001, 2002 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Chris Lahey (clahey@ximian.com) - */ - -#include <config.h> - -#include <string.h> -#include <glib.h> -#include <gtk/gtkvbox.h> -#include <gtk/gtkwidget.h> -#include <gtk/gtkmessagedialog.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-app.h> -#include <libgnomeui/gnome-href.h> -#include <libgnomeui/gnome-uidefs.h> -#include <bonobo/bonobo-generic-factory.h> -#include <bonobo/bonobo-ui-util.h> -#include <bonobo/bonobo-exception.h> -#include <bonobo/bonobo-property-bag.h> -#include <gal/util/e-util.h> - -#include "e-util/e-categories-master-list-wombat.h" -#include "e-util/e-sexp.h" -#include "e-util/e-passwords.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-component.h" -#include "addressbook/gui/search/e-addressbook-search-dialog.h" -#include "addressbook/gui/widgets/e-addressbook-view.h" -#include "addressbook/gui/widgets/eab-gui-util.h" -#include "addressbook/printing/e-contact-print.h" -#include "addressbook/util/eab-book-util.h" - -#include <libebook/e-book-async.h> -#include <widgets/misc/e-search-bar.h> -#include <widgets/misc/e-filter-bar.h> - -/* This is used for the addressbook status bar */ -#define EVOLUTION_CONTACTS_PROGRESS_IMAGE "evolution-contacts-mini.png" -static GdkPixbuf *progress_icon = NULL; - -#define d(x) - -#define PROPERTY_SOURCE_UID "source_uid" - -#define PROPERTY_SOURCE_UID_IDX 1 - -typedef struct { - gint refs; - EABView *view; - ESearchBar *search; - gint ecml_changed_id; - GtkWidget *vbox; - EBook *book; - guint activity_id; - BonoboControl *control; - BonoboPropertyBag *properties; - GConfClient *gconf_client; - ESourceList *source_list; - ESource *source; - char *passwd; - gboolean ignore_search_changes; - gboolean failed_to_load; -} AddressbookView; - -static void addressbook_view_ref (AddressbookView *); -static void addressbook_view_unref (AddressbookView *); - -static void addressbook_authenticate (EBook *book, gboolean previous_failure, - ESource *source, EBookCallback cb, gpointer closure); - -static void book_open_cb (EBook *book, EBookStatus status, gpointer closure); - -static void -save_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - if (view->view) - eab_view_save_as(view->view); -} - -static void -view_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - if (view->view) - eab_view_view(view->view); -} - -static void -search_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - - if (view->view) - gtk_widget_show(eab_search_dialog_new(view->view)); -} - -static void -delete_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - if (view->view) { - eab_view_delete_selection(view->view); - } -} - -static void -print_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - if (view->view) - eab_view_print(view->view); -} - -static void -print_preview_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - if (view->view) - eab_view_print_preview(view->view); -} - -static void -stop_loading_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - if (view->view) - eab_view_stop(view->view); -} - -static void -cut_contacts_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - if (view->view) - eab_view_cut(view->view); -} - -static void -copy_contacts_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - if (view->view) - eab_view_copy(view->view); -} - -static void -paste_contacts_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - if (view->view) - eab_view_paste(view->view); -} - -static void -select_all_contacts_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - if (view->view) - eab_view_select_all (view->view); -} - -static void -send_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - if (view->view) - eab_view_send (view->view); -} - -static void -send_contact_to_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - if (view->view) - eab_view_send_to (view->view); -} - -static void -copy_contact_to_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - if (view->view) - eab_view_copy_to_folder (view->view); -} - -static void -move_contact_to_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - if (view->view) - eab_view_move_to_folder (view->view); -} - -static void -forget_passwords_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - e_passwords_forget_passwords(); -} - -static void -update_command_state (EABView *eav, AddressbookView *view) -{ - BonoboUIComponent *uic; - - if (view->view == NULL) - return; - - addressbook_view_ref (view); - - uic = bonobo_control_get_ui_component (view->control); - - if (bonobo_ui_component_get_container (uic) != CORBA_OBJECT_NIL) { - bonobo_ui_component_set_prop (uic, - "/commands/ContactsSaveAsVCard", - "sensitive", - eab_view_can_save_as (view->view) ? "1" : "0", NULL); - bonobo_ui_component_set_prop (uic, - "/commands/ContactsView", - "sensitive", - eab_view_can_view (view->view) ? "1" : "0", NULL); - - /* Print Contact */ - bonobo_ui_component_set_prop (uic, - "/commands/ContactsPrint", - "sensitive", - eab_view_can_print (view->view) ? "1" : "0", NULL); - - /* Print Contact */ - bonobo_ui_component_set_prop (uic, - "/commands/ContactsPrintPreview", - "sensitive", - eab_view_can_print (view->view) ? "1" : "0", NULL); - - /* Delete Contact */ - bonobo_ui_component_set_prop (uic, - "/commands/ContactDelete", - "sensitive", - eab_view_can_delete (view->view) ? "1" : "0", NULL); - - bonobo_ui_component_set_prop (uic, - "/commands/ContactsCut", - "sensitive", - eab_view_can_cut (view->view) ? "1" : "0", NULL); - bonobo_ui_component_set_prop (uic, - "/commands/ContactsCopy", - "sensitive", - eab_view_can_copy (view->view) ? "1" : "0", NULL); - bonobo_ui_component_set_prop (uic, - "/commands/ContactsPaste", - "sensitive", - eab_view_can_paste (view->view) ? "1" : "0", NULL); - bonobo_ui_component_set_prop (uic, - "/commands/ContactsSelectAll", - "sensitive", - eab_view_can_select_all (view->view) ? "1" : "0", NULL); - - bonobo_ui_component_set_prop (uic, - "/commands/ContactsSendContactToOther", - "sensitive", - eab_view_can_send (view->view) ? "1" : "0", NULL); - - bonobo_ui_component_set_prop (uic, - "/commands/ContactsSendMessageToContact", - "sensitive", - eab_view_can_send_to (view->view) ? "1" : "0", NULL); - - bonobo_ui_component_set_prop (uic, - "/commands/ContactsMoveToFolder", - "sensitive", - eab_view_can_move_to_folder (view->view) ? "1" : "0", NULL); - bonobo_ui_component_set_prop (uic, - "/commands/ContactsCopyToFolder", - "sensitive", - eab_view_can_copy_to_folder (view->view) ? "1" : "0", NULL); - - /* Stop */ - bonobo_ui_component_set_prop (uic, - "/commands/ContactStop", - "sensitive", - eab_view_can_stop (view->view) ? "1" : "0", NULL); - } - - addressbook_view_unref (view); -} - -static void -change_view_type (AddressbookView *view, EABViewType view_type) -{ - g_object_set (view->view, "type", view_type, NULL); -} - -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 ("ToolSearch", search_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), - - BONOBO_UI_VERB_END -}; - -static EPixmap pixmaps [] = { - E_PIXMAP ("/menu/File/FileOps/ContactsSaveAsVCard", "save-as-16.png"), - E_PIXMAP ("/menu/File/Print/ContactsPrint", "print.xpm"), - E_PIXMAP ("/menu/File/Print/ContactsPrintPreview", "print-preview.xpm"), - - E_PIXMAP ("/menu/EditPlaceholder/Edit/ContactsCut", "16_cut.png"), - E_PIXMAP ("/menu/EditPlaceholder/Edit/ContactsCopy", "16_copy.png"), - E_PIXMAP ("/menu/EditPlaceholder/Edit/ContactsPaste", "16_paste.png"), - E_PIXMAP ("/menu/EditPlaceholder/Edit/ContactDelete", "evolution-trash-mini.png"), - - E_PIXMAP ("/menu/Tools/ComponentPlaceholder/ToolSearch", "search-16.png"), - - E_PIXMAP ("/Toolbar/ContactsPrint", "buttons/print.png"), - E_PIXMAP ("/Toolbar/ContactDelete", "buttons/delete-message.png"), - - E_PIXMAP_END -}; - -static void -control_activate (BonoboControl *control, - BonoboUIComponent *uic, - AddressbookView *view) -{ - Bonobo_UIContainer remote_ui_container; - - 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); - - e_search_bar_set_ui_component (view->search, uic); - - bonobo_ui_component_add_verb_list_with_data ( - uic, verbs, view); - - bonobo_ui_component_freeze (uic, NULL); - - bonobo_ui_util_set_ui (uic, PREFIX, - EVOLUTION_UIDIR "/evolution-addressbook.xml", - "evolution-addressbook", NULL); - - eab_view_setup_menus (view->view, uic); - - e_pixmaps_update (uic, pixmaps); - - bonobo_ui_component_thaw (uic, NULL); - - update_command_state (view->view, view); -} - -static void -control_activate_cb (BonoboControl *control, - gboolean activate, - AddressbookView *view) -{ - BonoboUIComponent *uic; - - uic = bonobo_control_get_ui_component (control); - g_assert (uic != NULL); - - if (activate) { - control_activate (control, uic, view); - if (activate && view->view && view->view->model) - eab_model_force_folder_bar_message (view->view->model); - - /* if the book failed to load, we kick off another - load here */ - - if (view->failed_to_load && view->source) { - EBook *book; - - book = e_book_new (); - - addressbook_load_source (book, view->source, book_open_cb, view); - } - } else { - bonobo_ui_component_unset_container (uic, NULL); - eab_view_discard_menus (view->view); - } -} - -static ECategoriesMasterList * -get_master_list (void) -{ - static ECategoriesMasterList *category_list = NULL; - - if (category_list == NULL) - category_list = e_categories_master_list_wombat_new (); - return category_list; -} - -static void -addressbook_view_clear (AddressbookView *view) -{ - if (view->book) { - g_object_unref (view->book); - view->book = NULL; - } - - if (view->properties) { - bonobo_object_unref (BONOBO_OBJECT(view->properties)); - view->properties = NULL; - } - - g_free(view->passwd); - view->passwd = NULL; - - if (view->source_list) { - g_object_unref (view->source_list); - view->source_list = NULL; - } - - if (view->ecml_changed_id != 0) { - g_signal_handler_disconnect (get_master_list(), - view->ecml_changed_id); - view->ecml_changed_id = 0; - } -} - -static void -addressbook_view_ref (AddressbookView *view) -{ - g_assert (view->refs > 0); - ++view->refs; -} - -static void -addressbook_view_unref (AddressbookView *view) -{ - g_assert (view->refs > 0); - --view->refs; - if (view->refs == 0) { - addressbook_view_clear (view); - g_free (view); - } -} - -static void -book_open_cb (EBook *book, EBookStatus status, gpointer closure) -{ - AddressbookView *view = closure; - - if (status == E_BOOK_ERROR_OK) { - view->failed_to_load = FALSE; - g_object_set(view->view, - "book", book, - NULL); - view->book = book; - } - else { - char *label_string; - GtkWidget *warning_dialog; - GtkWidget *href = NULL; - gchar *uri; - - view->failed_to_load = TRUE; - - uri = e_source_get_uri (view->source); - - if (!strncmp (uri, "file:", 5)) { - label_string = - _("We were unable to open this addressbook. Please check that the\n" - "path exists and that you have permission to access it."); - } - else if (!strncmp (uri, "ldap:", 5)) { - /* special case for ldap: contact folders so we can tell the user about openldap */ -#if HAVE_LDAP - label_string = - _("We were unable to open this addressbook. This either\n" - "means you have entered an incorrect URI, or the LDAP server\n" - "is unreachable."); -#else - label_string = - _("This version of Evolution does not have LDAP support\n" - "compiled in to it. If you want to use LDAP in Evolution\n" - "you must compile the program from the CVS sources after\n" - "retrieving OpenLDAP from the link below.\n"); - href = gnome_href_new ("http://www.openldap.org/", "OpenLDAP at http://www.openldap.org/"); -#endif - } else { - /* other network folders */ - label_string = - _("We were unable to open this addressbook. This either\n" - "means you have entered an incorrect URI, or the server\n" - "is unreachable."); - } - - warning_dialog = gtk_message_dialog_new ( - NULL /* XXX */, - 0, - GTK_MESSAGE_WARNING, - GTK_BUTTONS_CLOSE, - label_string, - NULL); - - g_signal_connect (warning_dialog, - "response", - G_CALLBACK (gtk_widget_destroy), - warning_dialog); - - gtk_window_set_title (GTK_WINDOW (warning_dialog), _("Unable to open addressbook")); - - if (href) - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (warning_dialog)->vbox), - href, FALSE, FALSE, 0); - - gtk_widget_show_all (warning_dialog); - - g_free (uri); - } -} - -static void -destroy_callback(gpointer data, GObject *where_object_was) -{ - AddressbookView *view = data; - addressbook_view_unref (view); -} - -static void -get_prop (BonoboPropertyBag *bag, - BonoboArg *arg, - guint arg_id, - CORBA_Environment *ev, - gpointer user_data) -{ - AddressbookView *view = user_data; - - switch (arg_id) { - - case PROPERTY_SOURCE_UID_IDX: - if (view && view->source) - BONOBO_ARG_SET_STRING (arg, e_source_peek_uid (view->source)); - else - BONOBO_ARG_SET_STRING (arg, ""); - break; - - default: - g_warning ("Unhandled arg %d\n", arg_id); - } -} - -typedef struct { - EBookCallback cb; - ESource *source; - gpointer closure; -} LoadSourceData; - -static void -load_source_auth_cb (EBook *book, EBookStatus status, gpointer closure) -{ - LoadSourceData *data = closure; - - if (status != E_BOOK_ERROR_OK) { - if (status == E_BOOK_ERROR_CANCELLED) { - /* the user clicked cancel in the password dialog */ - GtkWidget *dialog; - dialog = gtk_message_dialog_new (NULL, - 0, - GTK_MESSAGE_WARNING, - GTK_BUTTONS_OK, - _("Accessing LDAP Server anonymously")); - g_signal_connect (dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); - gtk_widget_show (dialog); - data->cb (book, E_BOOK_ERROR_OK, data->closure); - g_free (data); - return; - } - else { - gchar *uri = e_source_get_uri (data->source); - - e_passwords_forget_password ("Addressbook", uri); - addressbook_authenticate (book, TRUE, data->source, load_source_auth_cb, closure); - - g_free (uri); - return; - } - } - - data->cb (book, status, data->closure); - - g_object_unref (data->source); - g_free (data); -} - -static gboolean -get_remember_password (ESource *source) -{ - const gchar *value; - - value = e_source_get_property (source, "remember_password"); - if (value && !strcasecmp (value, "true")) - return TRUE; - - return FALSE; -} - -static void -set_remember_password (ESource *source, gboolean value) -{ - e_source_set_property (source, "remember_password", - value ? "true" : "false"); -} - -static void -addressbook_authenticate (EBook *book, gboolean previous_failure, ESource *source, - EBookCallback cb, gpointer closure) -{ - const char *password = NULL; - char *pass_dup = NULL; - const gchar *auth; - const gchar *user; - gchar *uri = e_source_get_uri (source); - - password = e_passwords_get_password ("Addressbook", uri); - - auth = e_source_get_property (source, "auth"); - - if (auth && !strcmp ("ldap/simple-binddn", auth)) - user = e_source_get_property (source, "binddn"); - else - user = e_source_get_property (source, "email_addr"); - if (!user) - user = ""; - - if (!password) { - char *prompt; - gboolean remember; - char *failed_auth; - - if (previous_failure) { - failed_auth = _("Failed to authenticate.\n"); - } - else { - failed_auth = ""; - } - - prompt = g_strdup_printf (_("%sEnter password for %s (user %s)"), - failed_auth, e_source_peek_name (source), user); - - remember = get_remember_password (source); - pass_dup = e_passwords_ask_password (prompt, "Addressbook", uri, prompt, TRUE, - E_PASSWORDS_REMEMBER_FOREVER, &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 -load_source_cb (EBook *book, EBookStatus status, gpointer closure) -{ - LoadSourceData *load_source_data = closure; - - if (status == E_BOOK_ERROR_OK && book != NULL) { - const gchar *auth; - - auth = e_source_get_property (load_source_data->source, "auth"); - - /* check if the addressbook needs authentication */ - - if (auth && strcmp (auth, "none")) { - addressbook_authenticate (book, FALSE, load_source_data->source, - load_source_auth_cb, closure); - - return; - } - } - - load_source_data->cb (book, status, load_source_data->closure); - g_object_unref (load_source_data->source); - g_free (load_source_data); -} - -void -addressbook_load_source (EBook *book, ESource *source, - 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 (source); - - e_book_async_load_source (book, source, load_source_cb, load_source_data); -} - -void -addressbook_load_default_book (EBookCallback cb, gpointer closure) -{ - LoadSourceData *load_source_data = g_new (LoadSourceData, 1); - - /* FIXME: We need to get the source for the default book */ - - load_source_data->cb = cb; - load_source_data->closure = closure; - - e_book_async_get_default_addressbook (load_source_cb, load_source_data); -} - -static void -set_prop (BonoboPropertyBag *bag, - const BonoboArg *arg, - guint arg_id, - CORBA_Environment *ev, - gpointer user_data) -{ - AddressbookView *view = user_data; - const gchar *uid; - - switch (arg_id) { - - case PROPERTY_SOURCE_UID_IDX: - if (view->book) { - /* we've already had a uri set on this view, so unload it */ - e_book_async_unload_uri (view->book); - view->source = NULL; - } else { - view->book = e_book_new (); - } - - view->failed_to_load = FALSE; - - uid = BONOBO_ARG_GET_STRING (arg); - view->source = e_source_list_peek_source_by_uid (view->source_list, uid); - - if (view->source) - addressbook_load_source (view->book, view->source, book_open_cb, view); - else - g_warning ("Could not find source by UID '%s'!", uid); - - break; - - default: - g_warning ("Unhandled arg %d\n", arg_id); - break; - } -} - -enum { - ESB_FULL_NAME, - ESB_EMAIL, - ESB_CATEGORY, - ESB_ANY, - ESB_ADVANCED -}; - -static ESearchBarItem addressbook_search_option_items[] = { - { N_("Name begins with"), ESB_FULL_NAME, NULL }, - { N_("Email begins with"), ESB_EMAIL, NULL }, - { N_("Category is"), ESB_CATEGORY, NULL }, /* We attach subitems below */ - { N_("Any field contains"), ESB_ANY, NULL }, - { N_("Advanced..."), ESB_ADVANCED, NULL }, - { NULL, -1, NULL } -}; - -static void -addressbook_search_activated (ESearchBar *esb, AddressbookView *view) -{ - ECategoriesMasterList *master_list; - char *search_word, *search_query; - const char *category_name; - int search_type, subid; - - if (view->ignore_search_changes) { - return; - } - - g_object_get(esb, - "text", &search_word, - "item_id", &search_type, - NULL); - - if (search_type == ESB_ADVANCED) { - gtk_widget_show(eab_search_dialog_new(view->view)); - } - else { - if ((search_word && strlen (search_word)) || search_type == ESB_CATEGORY) { - GString *s = g_string_new (""); - e_sexp_encode_string (s, search_word); - switch (search_type) { - case ESB_ANY: - search_query = g_strdup_printf ("(contains \"x-evolution-any-field\" %s)", - s->str); - break; - case ESB_FULL_NAME: - search_query = g_strdup_printf ("(beginswith \"full_name\" %s)", - s->str); - break; - case ESB_EMAIL: - search_query = g_strdup_printf ("(beginswith \"email\" %s)", - s->str); - break; - case ESB_CATEGORY: - subid = e_search_bar_get_subitem_id (esb); - - if (subid < 0 || subid == G_MAXINT) { - /* match everything */ - search_query = g_strdup ("(contains \"x-evolution-any-field\" \"\")"); - } else { - master_list = get_master_list (); - category_name = e_categories_master_list_nth (master_list, subid); - search_query = g_strdup_printf ("(is \"category\" \"%s\")", category_name); - } - break; - default: - search_query = g_strdup ("(contains \"x-evolution-any-field\" \"\")"); - break; - } - g_string_free (s, TRUE); - } else - search_query = g_strdup ("(contains \"x-evolution-any-field\" \"\")"); - - if (search_query) - g_object_set (view->view, - "query", search_query, - NULL); - - g_free (search_query); - } - - g_free (search_word); -} - -static void -addressbook_query_changed (ESearchBar *esb, AddressbookView *view) -{ - int search_type; - - g_object_get(esb, - "item_id", &search_type, - NULL); - - if (search_type == ESB_ADVANCED) { - gtk_widget_show(eab_search_dialog_new(view->view)); - } -} - -static void -set_status_message (EABView *eav, const char *message, AddressbookView *view) -{ - EActivityHandler *activity_handler = addressbook_component_peek_activity_handler (addressbook_component_peek ()); - - if (!message || !*message) { - if (view->activity_id != 0) { - e_activity_handler_operation_finished (activity_handler, view->activity_id); - view->activity_id = 0; - } - } else if (view->activity_id == 0) { - char *clientid = g_strdup_printf ("%p", view); - - if (progress_icon == NULL) - progress_icon = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" EVOLUTION_CONTACTS_PROGRESS_IMAGE, NULL); - - view->activity_id = e_activity_handler_operation_started (activity_handler, clientid, - progress_icon, message, TRUE); - - g_free (clientid); - } else { - e_activity_handler_operation_progressing (activity_handler, view->activity_id, message, -1.0); - } - -} - -static void -search_result (EABView *eav, EBookViewStatus status, AddressbookView *view) -{ - char *str = NULL; - - switch (status) { - case E_BOOK_VIEW_STATUS_OK: - return; - case E_BOOK_VIEW_STATUS_SIZE_LIMIT_EXCEEDED: - str = _("More cards matched this query than either the server is \n" - "configured to return or Evolution is configured to display.\n" - "Please make your search more specific or raise the result limit in\n" - "the directory server preferences for this addressbook."); - break; - case E_BOOK_VIEW_STATUS_TIME_LIMIT_EXCEEDED: - str = _("The time to execute this query exceeded the server limit or the limit\n" - "you have configured for this addressbook. Please make your search\n" - "more specific or raise the time limit in the directory server\n" - "preferences for this addressbook."); - break; - case E_BOOK_VIEW_ERROR_INVALID_QUERY: - str = _("The backend for this addressbook was unable to parse this query."); - break; - case E_BOOK_VIEW_ERROR_QUERY_REFUSED: - str = _("The backend for this addressbook refused to perform this query."); - break; - case E_BOOK_VIEW_ERROR_OTHER_ERROR: - str = _("This query did not complete successfully."); - break; - } - - if (str) { - GtkWidget *dialog; - dialog = gtk_message_dialog_new (NULL, - 0, - GTK_MESSAGE_WARNING, - GTK_BUTTONS_OK, - str); - g_signal_connect (dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); - gtk_widget_show (dialog); - } -} - -static int -compare_subitems (const void *a, const void *b) -{ - const ESearchBarSubitem *subitem_a = a; - const ESearchBarSubitem *subitem_b = b; - - return strcoll (subitem_a->text, subitem_b->text); -} - -static void -make_suboptions (AddressbookView *view) -{ - ESearchBarSubitem *subitems, *s; - ECategoriesMasterList *master_list; - gint i, N; - - master_list = get_master_list (); - N = e_categories_master_list_count (master_list); - subitems = g_new (ESearchBarSubitem, N+2); - - subitems[0].id = G_MAXINT; - subitems[0].text = g_strdup (_("Any Category")); - subitems[0].translate = FALSE; - - for (i=0; i<N; ++i) { - const char *category = e_categories_master_list_nth (master_list, i); - - subitems[i+1].id = i; - subitems[i+1].text = g_strdup (category); - subitems[i+1].translate = FALSE; - } - subitems[N+1].id = -1; - subitems[N+1].text = NULL; - - qsort (subitems + 1, N, sizeof (subitems[0]), compare_subitems); - - e_search_bar_set_suboption (view->search, ESB_CATEGORY, subitems); - - for (s = subitems; s->id != -1; s++) { - if (s->text) - g_free (s->text); - } - g_free (subitems); -} - -static void -ecml_changed (ECategoriesMasterList *ecml, AddressbookView *view) -{ - make_suboptions (view); -} - -static void -connect_master_list_changed (AddressbookView *view) -{ - view->ecml_changed_id = - g_signal_connect (get_master_list(), "changed", - G_CALLBACK (ecml_changed), view); -} - -BonoboControl * -addressbook_new_control (void) -{ - AddressbookView *view; - - view = g_new0 (AddressbookView, 1); - view->refs = 1; - view->ignore_search_changes = FALSE; - - view->vbox = gtk_vbox_new (FALSE, 0); - - g_object_weak_ref (G_OBJECT (view->vbox), destroy_callback, view); - - /* Create the control. */ - view->control = bonobo_control_new (view->vbox); - - view->search = E_SEARCH_BAR (e_search_bar_new (NULL, addressbook_search_option_items)); - make_suboptions (view); - connect_master_list_changed (view); - - gtk_box_pack_start (GTK_BOX (view->vbox), GTK_WIDGET (view->search), - FALSE, FALSE, 0); - g_signal_connect (view->search, "query_changed", - G_CALLBACK (addressbook_query_changed), view); - g_signal_connect (view->search, "search_activated", - G_CALLBACK (addressbook_search_activated), view); - - view->view = EAB_VIEW(eab_view_new()); - gtk_box_pack_start (GTK_BOX (view->vbox), GTK_WIDGET (view->view), - TRUE, TRUE, 0); - - /* create the initial view */ - change_view_type (view, EAB_VIEW_TABLE); - - gtk_widget_show (view->vbox); - gtk_widget_show (GTK_WIDGET(view->view)); - gtk_widget_show (GTK_WIDGET(view->search)); - - view->properties = bonobo_property_bag_new (get_prop, set_prop, view); - - bonobo_property_bag_add (view->properties, - PROPERTY_SOURCE_UID, PROPERTY_SOURCE_UID_IDX, - BONOBO_ARG_STRING, NULL, - _("UID of the contacts source that the view will display"), 0); - - bonobo_control_set_properties (view->control, - bonobo_object_corba_objref (BONOBO_OBJECT (view->properties)), - NULL); - - g_signal_connect (view->view, "status_message", - G_CALLBACK(set_status_message), view); - - g_signal_connect (view->view, "search_result", - G_CALLBACK(search_result), view); - - g_signal_connect (view->view, "command_state_change", - G_CALLBACK(update_command_state), view); - - view->gconf_client = gconf_client_get_default (); - view->source_list = e_source_list_new_for_gconf (view->gconf_client, - "/apps/evolution/addressbook/sources"); - view->source = NULL; - - g_signal_connect (view->control, "activate", - G_CALLBACK (control_activate_cb), view); - - return view->control; -} diff --git a/addressbook/gui/component/addressbook.h b/addressbook/gui/component/addressbook.h deleted file mode 100644 index fb05287133..0000000000 --- a/addressbook/gui/component/addressbook.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __ADDRESSBOOK_H__ -#define __ADDRESSBOOK_H__ - -#include <bonobo/bonobo-control.h> -#include <e-util/e-config-listener.h> -#include <bonobo/bonobo-object.h> -#include <bonobo/bonobo-moniker-util.h> -#include <libebook/e-book-async.h> - -/* use this instead of e_book_load_uri everywhere where you want the - authentication to be handled for you. */ -#if 0 -void addressbook_load_uri (EBook *book, const char *uri, EBookCallback cb, gpointer closure); -#endif -void addressbook_load_source (EBook *book, ESource *source, EBookCallback cb, gpointer closure); -void addressbook_load_default_book (EBookCallback open_response, gpointer closure); - -BonoboControl *addressbook_new_control (void); - -#endif /* __ADDRESSBOOK_H__ */ diff --git a/addressbook/gui/component/apps_evolution_addressbook.schemas.in.in b/addressbook/gui/component/apps_evolution_addressbook.schemas.in.in deleted file mode 100644 index 82af9d0843..0000000000 --- a/addressbook/gui/component/apps_evolution_addressbook.schemas.in.in +++ /dev/null @@ -1,42 +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> - </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>The number of characters that must be typed before evolution will attempt to autocomplete</short> - </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> - </locale> - </schema> - - </schemalist> -</gconfschemafile>
\ No newline at end of file diff --git a/addressbook/gui/component/autocompletion-config.c b/addressbook/gui/component/autocompletion-config.c deleted file mode 100644 index 05898f6688..0000000000 --- a/addressbook/gui/component/autocompletion-config.c +++ /dev/null @@ -1,150 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-config-autocompletion.h - Configuration page for addressbook autocompletion. - * - * Copyright (C) 2003 Novell, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Authors: Chris Toshok <toshok@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - - -#include "autocompletion-config.h" - -#include "Evolution.h" - -#include <bonobo/bonobo-exception.h> - -#include "e-source-selector.h" -#include <libedataserver/e-source-list.h> -#include <libgnome/gnome-i18n.h> -#include <gtk/gtkwidget.h> -#include <gtk/gtksignal.h> - - -typedef struct { - EvolutionConfigControl *config_control; - - GtkWidget *control_widget; - - ESourceList *source_list; -} AutocompletionConfig; - -static void -source_selection_changed (ESourceSelector *selector, - AutocompletionConfig *ac) -{ - evolution_config_control_changed (ac->config_control); -} - -static void -config_control_destroy_notify (void *data, - GObject *where_the_config_control_was) -{ - AutocompletionConfig *ac = (AutocompletionConfig *) data; - - g_object_unref (ac->source_list); - - g_free (ac); -} - - -static void -config_control_apply_callback (EvolutionConfigControl *config_control, - 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 (E_SOURCE_SELECTOR (ac->control_widget)); - 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 -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 char *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); - } - } -} - -EvolutionConfigControl* -autocompletion_config_control_new (void) -{ - AutocompletionConfig *ac; - CORBA_Environment ev; - - ac = g_new0 (AutocompletionConfig, 1); - - CORBA_exception_init (&ev); - - 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); */ - - ac->control_widget = e_source_selector_new (ac->source_list); - - initialize_selection (ac); - - gtk_widget_show (ac->control_widget); - - ac->config_control = evolution_config_control_new (ac->control_widget); - - g_signal_connect (ac->control_widget, "selection_changed", - G_CALLBACK (source_selection_changed), ac); - g_signal_connect (ac->config_control, "apply", - G_CALLBACK (config_control_apply_callback), 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 86f056477e..0000000000 --- a/addressbook/gui/component/autocompletion-config.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-shell-config-autocompletion.h - Configuration page for addressbook autocompletion. - * - * Copyright (C) 2003 Novell, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Authors: Chris Toshok <toshok@ximian.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 08bf146691..0000000000 --- a/addressbook/gui/component/component-factory.c +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* component-factory.c - Factory for Evolution's Addressbook component. - * - * Copyright (C) 2002 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli <ettore@ximian.com> - */ - -#include <config.h> - -#include <string.h> -#include "addressbook.h" -#include "addressbook-component.h" -#include "addressbook-config.h" -#include "autocompletion-config.h" -#include "eab-popup-control.h" -#include "eab-vcard-control.h" -#include "select-names/e-select-names-bonobo.h" -#if HAVE_NSS -#include "smime/gui/certificate-manager.h" -#endif -#include <bonobo/bonobo-shlib-factory.h> - - -#define FACTORY_ID "OAFIID:GNOME_Evolution_Addressbook_Factory:" BASE_VERSION - -#define VCARD_CONTROL_ID "OAFIID:GNOME_Evolution_Addressbook_VCard_Control:" BASE_VERSION -#define ADDRESSBOOK_CONTROL_ID "OAFIID:GNOME_Evolution_Addressbook_Control:" BASE_VERSION -#define COMPONENT_ID "OAFIID:GNOME_Evolution_Addressbook_Component:" BASE_VERSION -#define ADDRESS_POPUP_ID "OAFIID:GNOME_Evolution_Addressbook_AddressPopup:" BASE_VERSION -#define SELECT_NAMES_ID "OAFIID:GNOME_Evolution_Addressbook_SelectNames:" BASE_VERSION -#define LDAP_STORAGE_CONFIG_CONTROL_ID "OAFIID:GNOME_Evolution_LDAPStorage_ConfigControl:" 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 - - -static BonoboObject * -factory (BonoboGenericFactory *factory, - const char *component_id, - void *closure) -{ - printf ("asked to activate component_id `%s'\n", component_id); - - if (strcmp (component_id, VCARD_CONTROL_ID) == 0) - return BONOBO_OBJECT (eab_vcard_control_new ()); - if (strcmp (component_id, ADDRESSBOOK_CONTROL_ID) == 0) - return BONOBO_OBJECT (addressbook_new_control ()); - 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 ()); -#if 0 - /* Config control is dead */ - if (strcmp (component_id, LDAP_STORAGE_CONFIG_CONTROL_ID) == 0) - return BONOBO_OBJECT (addressbook_config_control_new ()); -#endif - if (strcmp (component_id, SELECT_NAMES_ID) == 0) - return BONOBO_OBJECT (e_select_names_bonobo_new ()); -#if HAVE_NSS - 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 0683fe1f66..0000000000 --- a/addressbook/gui/component/ldap-config.glade +++ /dev/null @@ -1,2722 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> -<requires lib="gnome"/> - -<widget class="GtkWindow" id="account-editor-window"> - <property name="title" translatable="yes">Edit LDAP Server</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - - <child> - <widget class="GtkVBox" id="vbox37"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkNotebook" id="account-editor-notebook"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="show_tabs">True</property> - <property name="show_border">True</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">False</property> - <property name="enable_popup">False</property> - - <child> - <widget class="GtkVBox" id="account-editor-general-vbox"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkHBox" id="hbox100"> - <property name="border_width">3</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">4</property> - - <child> - <widget class="GtkLabel" id="label431"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Display name:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment45"> - <property name="visible">True</property> - <property name="xalign">1</property> - <property name="yalign">0.5</property> - <property name="xscale">0.9</property> - <property name="yscale">1</property> - - <child> - <widget class="GtkEntry" id="account-editor-display-name-entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="account-editor-general-ldap-vbox"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <placeholder/> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label331"> - <property name="visible">True</property> - <property name="label" translatable="yes">General</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="account-editor-connecting-vbox"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <placeholder/> - </child> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label334"> - <property name="visible">True</property> - <property name="label" translatable="yes">Connecting</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="account-editor-searching-vbox"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <placeholder/> - </child> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label344"> - <property name="visible">True</property> - <property name="label" translatable="yes">Searching</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator10"> - <property name="visible">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox120"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkHButtonBox" id="hbuttonbox20"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkButton" id="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> - </widget> - </child> - - <child> - <widget class="GtkButton" id="account-editor-ok-button"> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> -</widget> - -<widget class="GtkWindow" id="account-druid-window"> - <property name="title" translatable="yes">New Addressbook</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - - <child> - <widget class="GnomeDruid" id="account-druid"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="show_help">False</property> - - <child> - <widget class="GnomeDruidPageEdge" id="druidpagestart1"> - <property name="visible">True</property> - <property name="position">GNOME_EDGE_START</property> - <property name="title" translatable="yes">Addressbook Creation Assistant</property> - <property name="text" translatable="yes">This assistant will help you create a new addressbook. - -Depending on the type of addressbook you create, additional -parameters may be required. Please contact your system -administrator if you need help finding this information.</property> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageStandard" id="add-server-druid-folder-page"> - <property name="visible">True</property> - <property name="title" translatable="yes">Step 1: Folder Characteristics</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="druid-vbox6"> - <property name="border_width">16</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkVBox" id="vbox21"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label198"> - <property name="visible">True</property> - <property name="label" translatable="yes">Specifying a display name and group is the first step in setting up an addressbook.</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">3</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator5"> - <property name="visible">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table15"> - <property name="border_width">3</property> - <property name="visible">True</property> - <property name="n_rows">2</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">3</property> - - <child> - <widget class="GtkEntry" id="druid-display-name-entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="has_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label199"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Display name:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">druid-display-name-entry</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label555"> - <property name="visible">True</property> - <property name="label" translatable="yes">Group:</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkOptionMenu" id="druid-group-option-menu"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">-1</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkNotebook" id="notebook15"> - <property name="visible">True</property> - <property name="show_tabs">False</property> - <property name="show_border">False</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">False</property> - <property name="enable_popup">False</property> - - <child> - <widget class="GtkLabel" id="label207"> - <property name="visible">True</property> - <property name="label" translatable="yes">This is the name that will appear in your Evolution folder list. It is for display purposes only. </property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label208"> - <property name="visible">True</property> - <property name="label" translatable="yes">label163</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label215"> - <property name="visible">True</property> - <property name="label" translatable="yes">Selecting this option will let you change Evolution's default settings for LDAP -searches, and for creating and editing contacts. </property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label210"> - <property name="visible">True</property> - <property name="label" translatable="yes">label164</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageStandard" id="add-server-druid-info-page"> - <property name="visible">True</property> - <property name="title" translatable="yes">Step 2: Server Information</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="druid-vbox1"> - <property name="border_width">3</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">3</property> - - <child> - <widget class="GtkVBox" id="account-druid-general-vbox"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label158"> - <property name="visible">True</property> - <property name="label" translatable="yes">You have decided to configure an LDAP server. The first step in doing this is to provide its name and your -log in information. Please ask your system administrator if you are unsure of this information.</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">3</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator2"> - <property name="visible">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageStandard" id="add-server-druid-connecting-page"> - <property name="visible">True</property> - <property name="title" translatable="yes">Step 3: Connecting to Server</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="druid-vbox2"> - <property name="border_width">3</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">3</property> - - <child> - <widget class="GtkVBox" id="account-druid-connecting-vbox"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label174"> - <property name="visible">True</property> - <property name="label" translatable="yes">Now, you must specify how you want to connect to the LDAP server. The SSL (Secure Sockets Layer) -and TLS (Transport Layer Security) protocols are used by some servers to cryptographically protect -your connection. Ask your system administrator if your LDAP server uses these protocols.</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">3</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator3"> - <property name="visible">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageStandard" id="add-server-druid-searching-page"> - <property name="visible">True</property> - <property name="title" translatable="yes">Step 4: Searching the Directory</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="vbox23"> - <property name="border_width">3</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">3</property> - - <child> - <widget class="GtkVBox" id="account-druid-searching-vbox"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label254"> - <property name="visible">True</property> - <property name="label" translatable="yes">The options on this page control how many entries should be included in your -searches, and how long a search should take. Ask your system administrator if you -need to change these options.</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator7"> - <property name="visible">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageEdge" id="add-server-druid-finish-page"> - <property name="visible">True</property> - <property name="position">GNOME_EDGE_FINISH</property> - <property name="title" translatable="yes">Finished</property> - <property name="text" translatable="yes">Congratulations, you are finished setting up this addressbook. - -Please click the "Finish" button to save the settings you have entered here.</property> - </widget> - </child> - </widget> - </child> -</widget> - -<widget class="GtkDialog" id="addressbook-sources-window"> - <property name="title" translatable="yes">Addressbook Sources</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="default_width">355</property> - <property name="default_height">285</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="has_separator">True</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="addressbook-sources-vbox"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="hbuttonbox27"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - - <child> - <widget class="GtkButton" id="button104"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="response_id">0</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button105"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-apply</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="response_id">0</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button106"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-close</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="response_id">0</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="GtkHBox" id="addressbook-sources"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="Custom" id="sourcesTable"> - <property name="visible">True</property> - <property name="creation_function">addressbook_dialog_create_sources_table</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Thu, 11 Apr 2002 00:31:02 GMT</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox73"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label529"> - <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_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVButtonBox" id="vbuttonbox18"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_START</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkButton" id="addSource"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-add</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="editSource"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - - <child> - <widget class="GtkAlignment" id="alignment64"> - <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> - - <child> - <widget class="GtkHBox" id="hbox121"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - - <child> - <widget class="Custom" id="custom1"> - <property name="visible">True</property> - <property name="creation_function">e_create_image_widget</property> - <property name="string1">stock-edit-24.png</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Fri, 25 Apr 2003 20:27:48 GMT</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="label554"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Edit</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> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkButton" id="deleteSource"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-remove</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -<widget class="GtkWindow" id="general-tab-window"> - <property name="title" translatable="yes">general-tab</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - - <child> - <widget class="GtkVBox" id="general-tab"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkTable" id="table36"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="n_rows">4</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="label534"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Server 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">1</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> - </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="label535"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Log in method:</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">1</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="server-name-entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="has_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment63"> - <property name="visible">True</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - - <child> - <widget class="GtkOptionMenu" id="auth-optionmenu"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget28"> - <property name="visible">True</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget29"> - <property name="visible">True</property> - <property name="label" translatable="yes">Anonymously</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget30"> - <property name="visible">True</property> - <property name="label" translatable="yes">Using email address</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget31"> - <property name="visible">True</property> - <property name="label" translatable="yes">Using distinguished name (DN)</property> - <property name="use_underline">True</property> - </widget> - </child> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkNotebook" id="auth-label-notebook"> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="show_tabs">False</property> - <property name="show_border">False</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">False</property> - <property name="enable_popup">False</property> - - <child> - <widget class="GtkLabel" id="label553"> - <property name="visible">True</property> - <property name="label" translatable="yes">Email address:</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">1</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label546"> - <property name="visible">True</property> - <property name="label" translatable="yes">label546</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label536"> - <property name="visible">True</property> - <property name="label" translatable="yes">Distinguished _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> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label547"> - <property name="visible">True</property> - <property name="label" translatable="yes">label547</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - <packing> - <property name="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">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkNotebook" id="auth-entry-notebook"> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="show_tabs">False</property> - <property name="show_border">False</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">False</property> - <property name="enable_popup">False</property> - - <child> - <widget class="GtkEntry" id="email-entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label549"> - <property name="visible">True</property> - <property name="label" translatable="yes">label549</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="dn-entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label550"> - <property name="visible">True</property> - <property name="label" translatable="yes">label550</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator12"> - <property name="visible">True</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkNotebook" id="general-tab-help"> - <property name="visible">True</property> - <property name="show_tabs">False</property> - <property name="show_border">False</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">False</property> - <property name="enable_popup">False</property> - - <child> - <widget class="GtkLabel" id="label537"> - <property name="visible">True</property> - <property name="label" translatable="yes">This is the full name of your ldap server. For example, "ldap.mycompany.com".</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label538"> - <property name="visible">True</property> - <property name="label" translatable="yes">label163</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label539"> - <property name="visible">True</property> - <property name="label" translatable="yes">Evolution will use this email address to authenticate you with the server</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label540"> - <property name="visible">True</property> - <property name="label" translatable="yes">label164</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label541"> - <property name="visible">True</property> - <property name="label" translatable="yes">Evolution will use this DN to authenticate you with the server</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label542"> - <property name="visible">True</property> - <property name="label" translatable="yes">label165</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label552"> - <property name="visible">True</property> - <property name="label" translatable="yes">This is the method evolution will use to authenticate you. Note that setting this to "Email Address" requires anonymous access to your ldap server.</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">True</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label551"> - <property name="visible">True</property> - <property name="label" translatable="yes">label551</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label544"> - <property name="visible">True</property> - <property name="label" translatable="yes">This is the name for this server that will appear in your Evolution folder list. -It is for display purposes only. </property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label545"> - <property name="visible">True</property> - <property name="label" translatable="yes">label452</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - </widget> - </child> -</widget> - -<widget class="GtkWindow" id="connecting-tab-window"> - <property name="title" translatable="yes">connecting-tab</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - - <child> - <widget class="GtkVBox" id="connecting-tab"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkTable" id="table14"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="n_rows">2</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkLabel" id="label175"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Port number:</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">1</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment21"> - <property name="visible">True</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - - <child> - <widget class="GtkCombo" id="port-combo"> - <property name="visible">True</property> - <property name="value_in_list">False</property> - <property name="allow_empty">True</property> - <property name="case_sensitive">False</property> - <property name="enable_arrow_keys">True</property> - <property name="enable_arrows_always">False</property> - - <child internal-child="entry"> - <widget class="GtkEntry" id="entry27"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="has_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - </child> - - <child internal-child="list"> - <widget class="GtkList" id="convertwidget32"> - <property name="visible">True</property> - <property name="selection_mode">GTK_SELECTION_BROWSE</property> - - <child> - <widget class="GtkListItem" id="convertwidget33"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget34"> - <property name="visible">True</property> - <property name="label" translatable="yes">389</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkListItem" id="convertwidget35"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget36"> - <property name="visible">True</property> - <property name="label" translatable="yes">636</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkListItem" id="convertwidget37"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget38"> - <property name="visible">True</property> - <property name="label" translatable="yes">3268</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkListItem" id="convertwidget39"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget40"> - <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> - </widget> - </child> - </widget> - </child> - </widget> - </child> - </widget> - </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="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label176"> - <property name="visible">True</property> - <property name="label" translatable="yes">U_se SSL/TLS:</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">1</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment60"> - <property name="visible">True</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - - <child> - <widget class="GtkOptionMenu" id="ssl-optionmenu"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget41"> - <property name="visible">True</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget42"> - <property name="visible">True</property> - <property name="label" translatable="yes">Always</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget43"> - <property name="visible">True</property> - <property name="label" translatable="yes">Whenever Possible</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget44"> - <property name="visible">True</property> - <property name="label" translatable="yes">Never</property> - <property name="use_underline">True</property> - </widget> - </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">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkNotebook" id="connecting-tab-help"> - <property name="visible">True</property> - <property name="show_tabs">False</property> - <property name="show_border">False</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">False</property> - <property name="enable_popup">False</property> - - <child> - <widget class="GtkLabel" id="label178"> - <property name="visible">True</property> - <property name="label" translatable="yes">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.</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label179"> - <property name="visible">True</property> - <property name="label" translatable="yes">label163</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label395"> - <property name="visible">True</property> - <property name="label" translatable="yes">Selecting this option means that Evolution will only connect to your LDAP server if -your LDAP server supports SSL or TLS.</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label398"> - <property name="visible">True</property> - <property name="label" translatable="yes">label398</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label399"> - <property name="visible">True</property> - <property name="label" translatable="yes">Selecting this option means that Evolution will only try to use SSL/TLS if you are in a -insecure environment. For example, if you and your LDAP server are behind a firewall -at work, then Evolution doesn't need to use SSL/TLS because your connection is already -secure.</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label396"> - <property name="visible">True</property> - <property name="label" translatable="yes">label396</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label400"> - <property name="visible">True</property> - <property name="label" translatable="yes">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. </property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label397"> - <property name="visible">True</property> - <property name="label" translatable="yes">label397</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -<widget class="GtkWindow" id="searching-tab-window"> - <property name="title" translatable="yes">searching-tab</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - - <child> - <widget class="GtkVBox" id="searching-tab"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkTable" id="table30"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="n_rows">4</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="label455"> - <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">1</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label456"> - <property name="visible">True</property> - <property name="label" translatable="yes">S_earch 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">1</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment49"> - <property name="visible">True</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">7.45058e-09</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - - <child> - <widget class="GtkOptionMenu" id="scope-optionmenu"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget45"> - <property name="visible">True</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget46"> - <property name="visible">True</property> - <property name="label" translatable="yes">One</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget47"> - <property name="visible">True</property> - <property name="label" translatable="yes">Sub</property> - <property name="use_underline">True</property> - </widget> - </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">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox109"> - <property name="border_width">3</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">3</property> - - <child> - <widget class="GtkEntry" id="rootdn-entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="has_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="rootdn-button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes"> S_how Supported Bases </property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</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="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label457"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Timeout (minutes):</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">1</property> - <property name="yalign">1</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment50"> - <property name="visible">True</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - - <child> - <widget class="GtkHBox" id="hbox110"> - <property name="border_width">3</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">3</property> - - <child> - <widget class="GtkLabel" id="label458"> - <property name="visible">True</property> - <property name="label" translatable="yes">1:00</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="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_LEFT</property> - <property name="digits">0</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="label459"> - <property name="visible">True</property> - <property name="label" translatable="yes">5:00</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</property> - <property name="yalign">0.5</property> - <property name="xpad">3</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label460"> - <property name="visible">True</property> - <property name="label" translatable="yes">Selected:</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">1</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="label461"> - <property name="visible">True</property> - <property name="label" translatable="yes">2:30</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label462"> - <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">1</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment51"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - - <child> - <widget class="GtkHBox" id="hbox111"> - <property name="border_width">3</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">3</property> - - <child> - <widget class="GtkSpinButton" id="download-limit-spinbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">False</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">100 0 10000 1 10 10</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label463"> - <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_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkNotebook" id="searching-tab-help"> - <property name="visible">True</property> - <property name="show_tabs">False</property> - <property name="show_border">False</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">False</property> - <property name="enable_popup">False</property> - - <child> - <widget class="GtkLabel" id="label464"> - <property name="visible">True</property> - <property name="label" 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="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label465"> - <property name="visible">True</property> - <property name="label" translatable="yes">label163</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label466"> - <property name="visible">True</property> - <property name="label" translatable="yes">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. -</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label467"> - <property name="visible">True</property> - <property name="label" translatable="yes">label164</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label468"> - <property name="visible">True</property> - <property name="label" translatable="yes">This option controls how long a search will be run.</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label469"> - <property name="visible">True</property> - <property name="label" translatable="yes">label165</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label470"> - <property name="visible">True</property> - <property name="label" translatable="yes">This is the maximum number of entries to download. Setting this number to be -too large will slow down your addressbook.</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label471"> - <property name="visible">True</property> - <property name="label" translatable="yes">label166</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - </widget> - </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_NONE</property> - <property name="modal">False</property> - <property name="default_width">300</property> - <property name="default_height">200</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="has_separator">True</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="dialog-vbox5"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="dialog-action_area5"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - - <child> - <widget class="GtkButton" id="button107"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="response_id">-5</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button109"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="response_id">-6</property> - </widget> - </child> - </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="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> - </child> -</widget> - -</glade-interface> diff --git a/addressbook/gui/component/select-names/.cvsignore b/addressbook/gui/component/select-names/.cvsignore deleted file mode 100644 index 1520453f86..0000000000 --- a/addressbook/gui/component/select-names/.cvsignore +++ /dev/null @@ -1,15 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -*.lo -*.la -Evolution-Addressbook-SelectNames-stubs.c -Evolution-Addressbook-SelectNames-skels.c -Evolution-Addressbook-SelectNames-common.c -Evolution-Addressbook-SelectNames.h -GNOME_Evolution_Addressbook_SelectNames*.server -GNOME_Evolution_Addressbook_SelectNames*.server.in -e-select-names-marshal.c -e-select-names-marshal.h diff --git a/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl b/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl deleted file mode 100644 index 6feb6b54bb..0000000000 --- a/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * CORBA interface for the SelectNames dialog. - * - * Authors: - * Ettore Perazzoli <ettore@ximian.com> - * - * Copyright (C) 2000 Ximian, Inc. - */ - -#include <Bonobo.idl> - -module GNOME { -module Evolution { -module Addressbook { - - interface SelectNames : Bonobo::Unknown { - struct Section { - string id; - string title; - }; - - typedef sequence<Section> SectionList; - - exception DuplicateID {}; - exception SectionNotFound {}; - - void addSection (in string id, in string title) - raises (DuplicateID); - void addSectionWithLimit (in string id, in string title, in short limit) - raises (DuplicateID); - - Bonobo::Control getEntryBySection (in string section_id) - raises (SectionNotFound); - - void activateDialog (in string section_id); - }; - - -}; -}; -}; diff --git a/addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.server.in.in b/addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.server.in.in deleted file mode 100644 index 0a9f975463..0000000000 --- a/addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.server.in.in +++ /dev/null @@ -1,31 +0,0 @@ -<oaf_info> - -<!-- -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_SelectNamesFactory:@VERSION@" - type="shlib" - location="@COMPONENTDIR@/libevolution-addressbook.so"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/ObjectFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="name" type="string" - _value="Evolution Addressbook name selection interface"/> - -</oaf_server> ---> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_SelectNames:@VERSION@" - type="factory" - location="OAFIID:GNOME_Evolution_Addressbook_Factory:@VERSION@"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Evolution/Addressbook/SelectNames:@VERSION@"/> - </oaf_attribute> - - <oaf_attribute name="name" type="string" - _value="Evolution Addressbook name selection interface"/> - -</oaf_server> - -</oaf_info> diff --git a/addressbook/gui/component/select-names/Makefile.am b/addressbook/gui/component/select-names/Makefile.am deleted file mode 100644 index b64cf31689..0000000000 --- a/addressbook/gui/component/select-names/Makefile.am +++ /dev/null @@ -1,96 +0,0 @@ -# CORBA stuff - -idl_DATA = \ - Evolution-Addressbook-SelectNames.idl - -IDL_GENERATED_H = \ - Evolution-Addressbook-SelectNames.h -IDL_GENERATED_C = \ - Evolution-Addressbook-SelectNames-common.c \ - Evolution-Addressbook-SelectNames-skels.c \ - Evolution-Addressbook-SelectNames-stubs.c -IDL_GENERATED = $(IDL_GENERATED_C) $(IDL_GENERATED_H) - -$(IDL_GENERATED_H): $(idl_DATA) - $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) \ - $(srcdir)/Evolution-Addressbook-SelectNames.idl -$(IDL_GENERATED_C): $(IDL_GENERATED_H) - -server_in_files = GNOME_Evolution_Addressbook_SelectNames.server.in.in -server_DATA = $(server_in_files:.server.in.in=_$(BASE_VERSION).server) -@EVO_SERVER_RULE@ -@INTLTOOL_SERVER_RULE@ - -INCLUDES = \ - -DG_LOG_DOMAIN=\"evolution-addressbook\" \ - -I$(top_srcdir) \ - -I$(top_builddir) \ - -I$(top_srcdir)/shell \ - -I$(top_builddir)/shell \ - -I$(top_srcdir)/widgets/e-text \ - -I$(top_srcdir)/widgets/e-table \ - -I$(top_srcdir)/addressbook/gui/minicard \ - -I$(top_srcdir)/addressbook/gui/widgets \ - -I$(top_srcdir)/addressbook/contact-editor \ - -I$(top_srcdir)/addressbook/backend \ - -I$(top_builddir)/addressbook/backend \ - -DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \ - -DEVOLUTION_UIDIR=\""$(evolutionuidir)"\" \ - -DPREFIX=\""$(prefix)"\" \ - $(EVOLUTION_ADDRESSBOOK_CFLAGS) - -privlib_LTLIBRARIES = libeselectnames.la - -libeselectnames_la_SOURCES = \ - $(IDL_GENERATED) \ - $(MARSHAL_GENERATED) \ - e-select-names-bonobo.c \ - e-select-names-bonobo.h \ - e-select-names-completion.c \ - e-select-names-completion.h \ - e-select-names-config.c \ - e-select-names-config.h \ - e-select-names-config-keys.h \ - e-select-names-manager.c \ - e-select-names-manager.h \ - e-select-names-model.c \ - e-select-names-model.h \ - e-select-names-popup.c \ - e-select-names-popup.h \ - e-select-names-table-model.c \ - e-select-names-table-model.h \ - e-select-names-text-model.c \ - e-select-names-text-model.h \ - e-select-names.c \ - e-select-names.h - -libeselectnames_la_LIBADD = \ - $(EVOLUTION_ADDRESSBOOK_LIBS) - -# We'll need these again when we split out the select names control -# into its own shlib factory, but for now they're redundant. -# -# e-select-names-factory.c -# e-select-names-factory.h - -MARSHAL_GENERATED = e-select-names-marshal.c e-select-names-marshal.h -@EVO_MARSHAL_RULE@ - -glade_DATA = select-names.glade -etspec_DATA = e-select-names.etspec e-select-names-section.etspec - -EXTRA_DIST = \ - $(glade_DATA) \ - $(server_in_files) \ - $(idl_DATA) \ - $(etspec_DATA) \ - e-select-names-marshal.list - -BUILT_SOURCES = $(IDL_GENERATED) $(MARSHAL_GENERATED) $(server_DATA) -CLEANFILES = $(BUILT_SOURCES) - -dist-hook: - cd $(distdir); rm -f $(BUILT_SOURCES) diff --git a/addressbook/gui/component/select-names/e-select-names-bonobo.c b/addressbook/gui/component/select-names/e-select-names-bonobo.c deleted file mode 100644 index 1977abe95f..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-bonobo.c +++ /dev/null @@ -1,600 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-select-names-bonobo.c - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-select-names-bonobo.h" - -#include <bonobo-activation/bonobo-activation-activate.h> - -#include <bonobo/bonobo-property-bag.h> -#include <bonobo/bonobo-control.h> -#include <bonobo/bonobo-exception.h> -#include <bonobo/bonobo-event-source.h> -#include <bonobo/bonobo-ui-util.h> - -#include <gal/util/e-util.h> -#include <gal/e-text/e-entry.h> -#include <gal/util/e-text-event-processor.h> - -#include "Evolution-Addressbook-SelectNames.h" - -#include "e-select-names-manager.h" -#include "e-select-names-model.h" -#include "e-select-names-text-model.h" -#include "e-select-names-completion.h" - -#include <string.h> - - -#define PARENT_TYPE BONOBO_TYPE_OBJECT -static BonoboObjectClass *parent_class = NULL; - -struct _ESelectNamesBonoboPrivate { - ESelectNamesManager *manager; - BonoboEventSource *event_source; -}; - -enum _EntryPropertyID { - ENTRY_PROPERTY_ID_TEXT, - ENTRY_PROPERTY_ID_ADDRESSES, - ENTRY_PROPERTY_ID_DESTINATIONS, - ENTRY_PROPERTY_ID_ALLOW_CONTACT_LISTS, - ENTRY_PROPERTY_ID_ENTRY_CHANGED -}; -typedef enum _EntryPropertyID EntryPropertyID; - - -/* PropertyBag implementation for the entry widgets. */ - -static void -entry_get_property_fn (BonoboPropertyBag *bag, - BonoboArg *arg, - unsigned int arg_id, - CORBA_Environment *ev, - void *user_data) -{ - GtkWidget *w; - - w = GTK_WIDGET (user_data); - - switch (arg_id) { - case ENTRY_PROPERTY_ID_TEXT: - { - ETextModel *text_model; - text_model = E_TEXT_MODEL (g_object_get_data (G_OBJECT (w), "select_names_text_model")); - g_assert (text_model != NULL); - - BONOBO_ARG_SET_STRING (arg, e_text_model_get_text (text_model)); - break; - } - - case ENTRY_PROPERTY_ID_ADDRESSES: - { - ESelectNamesModel *model; - char *text; - - model = E_SELECT_NAMES_MODEL (g_object_get_data (G_OBJECT (w), "select_names_model")); - g_assert (model != NULL); - - text = e_select_names_model_get_address_text (model, ", "); - BONOBO_ARG_SET_STRING (arg, text); - g_free (text); - } - break; - - case ENTRY_PROPERTY_ID_DESTINATIONS: - { - ESelectNamesModel *model; - char *text; - - model = E_SELECT_NAMES_MODEL (g_object_get_data (G_OBJECT (w), "select_names_model")); - g_assert (model != NULL); - - text = e_select_names_model_export_destinationv (model); - BONOBO_ARG_SET_STRING (arg, text); - g_free (text); - } - break; - - case ENTRY_PROPERTY_ID_ALLOW_CONTACT_LISTS: - { - ESelectNamesCompletion *comp; - comp = E_SELECT_NAMES_COMPLETION (g_object_get_data (G_OBJECT (w), "completion_handler")); - g_assert (comp != NULL); - - BONOBO_ARG_SET_BOOLEAN (arg, e_select_names_completion_get_match_contact_lists (comp)); - break; - } - - case ENTRY_PROPERTY_ID_ENTRY_CHANGED: - /* This is a read-only property. */ - g_assert_not_reached (); - break; - - default: - break; - } -} - -static void -entry_set_property_fn (BonoboPropertyBag *bag, - const BonoboArg *arg, - guint arg_id, - CORBA_Environment *ev, - gpointer user_data) -{ - GtkWidget *w; - - w = GTK_WIDGET (user_data); - - switch (arg_id) { - - case ENTRY_PROPERTY_ID_TEXT: - case ENTRY_PROPERTY_ID_ADDRESSES: - { - ESelectNamesModel *model; - model = E_SELECT_NAMES_MODEL (g_object_get_data (G_OBJECT (w), "select_names_model")); - g_assert (model != NULL); - - e_entry_set_text (E_ENTRY (w), BONOBO_ARG_GET_STRING (arg)); - e_select_names_model_load_all_contacts (model, NULL); - break; - } - - case ENTRY_PROPERTY_ID_DESTINATIONS: - { - ESelectNamesModel *model; - model = E_SELECT_NAMES_MODEL (g_object_get_data (G_OBJECT (w), "select_names_model")); - g_assert (model != NULL); - - e_select_names_model_import_destinationv (model, BONOBO_ARG_GET_STRING (arg)); - e_select_names_model_load_all_contacts (model, NULL); - break; - } - - case ENTRY_PROPERTY_ID_ALLOW_CONTACT_LISTS: - { - ESelectNamesCompletion *comp; - comp = E_SELECT_NAMES_COMPLETION (g_object_get_data (G_OBJECT (w), "completion_handler")); - g_assert (comp != NULL); - - e_select_names_completion_set_match_contact_lists (comp, BONOBO_ARG_GET_BOOLEAN (arg)); - break; - } - - case ENTRY_PROPERTY_ID_ENTRY_CHANGED: - g_object_set_data (G_OBJECT (w), "entry_property_id_changed", GUINT_TO_POINTER (1)); - break; - - default: - break; - } -} - -static void -impl_SelectNames_add_section (PortableServer_Servant servant, - const CORBA_char *id, - const CORBA_char *title, - CORBA_Environment *ev) -{ - ESelectNamesBonobo *select_names; - ESelectNamesBonoboPrivate *priv; - - select_names = E_SELECT_NAMES_BONOBO (bonobo_object (servant)); - priv = select_names->priv; - - e_select_names_manager_add_section (priv->manager, id, title); -} - -static void -impl_SelectNames_add_section_with_limit (PortableServer_Servant servant, - const CORBA_char *id, - const CORBA_char *title, - CORBA_short limit, - CORBA_Environment *ev) -{ - ESelectNamesBonobo *select_names; - ESelectNamesBonoboPrivate *priv; - - select_names = E_SELECT_NAMES_BONOBO (bonobo_object (servant)); - priv = select_names->priv; - - e_select_names_manager_add_section_with_limit (priv->manager, id, title, limit); -} - -static void -entry_changed (GtkWidget *widget, BonoboControl *control) -{ - gboolean changed = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (widget), "entry_property_id_changed")); - - if (!changed) - bonobo_control_set_property (control, NULL, "entry_changed", TC_CORBA_boolean, TRUE, NULL); -} - -static void -manager_changed_cb (ESelectNamesManager *manager, const gchar *section_id, gint changed_working_copy, gpointer closure) -{ - ESelectNamesBonobo *select_names = E_SELECT_NAMES_BONOBO (closure); - BonoboArg *arg; - - arg = bonobo_arg_new (BONOBO_ARG_STRING); - BONOBO_ARG_SET_STRING (arg, section_id); - - bonobo_event_source_notify_listeners_full (select_names->priv->event_source, - "GNOME/Evolution", - "changed", - changed_working_copy ? "working_copy" : "model", - arg, NULL); - - bonobo_arg_release (arg); -} - -static void -manager_ok_cb (ESelectNamesManager *manager, gpointer closure) -{ - ESelectNamesBonobo *select_names = E_SELECT_NAMES_BONOBO (closure); - BonoboArg *arg; - - arg = bonobo_arg_new (BONOBO_ARG_NULL); - - bonobo_event_source_notify_listeners_full (select_names->priv->event_source, - "GNOME/Evolution", - "ok", - "dialog", - arg, - NULL); - - bonobo_arg_release (arg); -} - -static void -copy_cb (BonoboUIComponent *ui, gpointer user_data, const char *command) -{ - EEntry *entry = E_ENTRY (user_data); - - e_text_copy_clipboard (entry->item); -} - -static void -cut_cb (BonoboUIComponent *ui, gpointer user_data, const char *command) -{ - EEntry *entry = E_ENTRY (user_data); - - e_text_cut_clipboard (entry->item); -} - -static void -paste_cb (BonoboUIComponent *ui, gpointer user_data, const char *command) -{ - EEntry *entry = E_ENTRY (user_data); - - e_text_paste_clipboard (entry->item); -} - -static void -select_all_cb (BonoboUIComponent *ui, gpointer user_data, const char *command) -{ - EEntry *entry = E_ENTRY (user_data); - - e_text_select_all (entry->item); -} - -static BonoboUIVerb verbs [] = { - BONOBO_UI_VERB ("EditCut", cut_cb), - BONOBO_UI_VERB ("EditCopy", copy_cb), - BONOBO_UI_VERB ("EditPaste", paste_cb), - BONOBO_UI_VERB ("EditSelectAll", select_all_cb), - BONOBO_UI_VERB_END -}; - -typedef struct { - GtkWidget *widget; - BonoboControl *control; - Bonobo_UIContainer remote_ui_container; - char *ui_xml_path; - char *app_name; - BonoboUIVerb *verbs; - gpointer user_data; -} ControlUIClosure; - -static void -free_closure (ControlUIClosure *closure, - GtkObject *where_object_was) -{ - bonobo_object_release_unref (closure->remote_ui_container, NULL); - g_free (closure->ui_xml_path); - g_free (closure->app_name); - g_free (closure); -} - -static void -merge_menu_items (BonoboControl *control, BonoboUIComponent *uic, ControlUIClosure *closure) -{ - if (closure->remote_ui_container) { - bonobo_ui_component_set_container (uic, closure->remote_ui_container, NULL); - - bonobo_ui_component_add_verb_list_with_data (uic, closure->verbs, closure->user_data); - - bonobo_ui_component_freeze (uic, NULL); - - bonobo_ui_util_set_ui (uic, PREFIX, - closure->ui_xml_path, - closure->app_name, NULL); - - bonobo_ui_component_thaw (uic, NULL); - } -} - -static void -unmerge_menu_items (BonoboControl *control, BonoboUIComponent *uic, ControlUIClosure *closure) -{ - bonobo_ui_component_unset_container (uic, NULL); -} - -static void -control_set_frame_cb (BonoboControl *control, - ControlUIClosure *closure) -{ - Bonobo_ControlFrame frame = bonobo_control_get_control_frame (control, - NULL); - if (!frame) - return; - closure->remote_ui_container = bonobo_control_get_remote_ui_container (control, NULL); -} - -static void -control_activate_cb (BonoboControl *control, - gboolean activate, - ControlUIClosure *closure) -{ - if (activate) - gtk_widget_grab_focus (closure->widget); /* the ECanvas */ -} - -static gboolean -widget_focus_cb (GtkWidget *w, GdkEventFocus *focus, ControlUIClosure *closure) -{ - BonoboUIComponent *uic; - - uic = bonobo_control_get_ui_component (closure->control); - - if (GTK_WIDGET_HAS_FOCUS (w)) { - merge_menu_items (closure->control, uic, closure); - } else { - unmerge_menu_items (closure->control, uic, closure); - } - - return FALSE; -} - -static void -e_bonobo_control_automerge_ui (GtkWidget *w, - BonoboControl *control, - const char *ui_xml_path, - const char *app_name, - BonoboUIVerb *verbs, - gpointer data) -{ - ControlUIClosure *closure; - - g_return_if_fail (GTK_IS_WIDGET (w)); - g_return_if_fail (BONOBO_IS_CONTROL (control)); - g_return_if_fail (ui_xml_path != NULL); - g_return_if_fail (app_name != NULL); - g_return_if_fail (verbs != NULL); - - closure = g_new (ControlUIClosure, 1); - - closure->widget = w; - closure->control = control; - closure->ui_xml_path = g_strdup (ui_xml_path); - closure->app_name = g_strdup (app_name); - closure->verbs = verbs; - closure->user_data = data; - - g_signal_connect (w, "focus_in_event", - G_CALLBACK (widget_focus_cb), closure); - g_signal_connect (w, "focus_out_event", - G_CALLBACK (widget_focus_cb), closure); - g_signal_connect (control, "activate", - G_CALLBACK (control_activate_cb), closure); - g_signal_connect (control, "set_frame", - G_CALLBACK (control_set_frame_cb), closure); - - g_object_weak_ref (G_OBJECT (control), (GWeakNotify)free_closure, closure); -} - -static Bonobo_Control -impl_SelectNames_get_entry_for_section (PortableServer_Servant servant, - const CORBA_char *section_id, - CORBA_Environment *ev) -{ - ESelectNamesBonobo *select_names; - ESelectNamesBonoboPrivate *priv; - GtkWidget *entry_widget; - BonoboControl *control; - BonoboPropertyBag *property_bag; - - select_names = E_SELECT_NAMES_BONOBO (bonobo_object (servant)); - priv = select_names->priv; - - entry_widget = e_select_names_manager_create_entry (priv->manager, section_id); - gtk_widget_show (entry_widget); - - if (entry_widget == NULL) { - CORBA_exception_set (ev, - CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Addressbook_SelectNames_SectionNotFound, - NULL); - return CORBA_OBJECT_NIL; - } - - control = bonobo_control_new (entry_widget); - - property_bag = bonobo_property_bag_new (entry_get_property_fn, entry_set_property_fn, entry_widget); - bonobo_property_bag_add (property_bag, "text", ENTRY_PROPERTY_ID_TEXT, - BONOBO_ARG_STRING, NULL, NULL, - BONOBO_PROPERTY_READABLE | BONOBO_PROPERTY_WRITEABLE); - bonobo_property_bag_add (property_bag, "addresses", ENTRY_PROPERTY_ID_ADDRESSES, - BONOBO_ARG_STRING, NULL, NULL, - BONOBO_PROPERTY_READABLE | BONOBO_PROPERTY_WRITEABLE); - bonobo_property_bag_add (property_bag, "destinations", ENTRY_PROPERTY_ID_DESTINATIONS, - BONOBO_ARG_STRING, NULL, NULL, - BONOBO_PROPERTY_READABLE | BONOBO_PROPERTY_WRITEABLE); - bonobo_property_bag_add (property_bag, "allow_contact_lists", ENTRY_PROPERTY_ID_ALLOW_CONTACT_LISTS, - BONOBO_ARG_BOOLEAN, NULL, NULL, - BONOBO_PROPERTY_READABLE | BONOBO_PROPERTY_WRITEABLE); - bonobo_property_bag_add (property_bag, "entry_changed", ENTRY_PROPERTY_ID_ENTRY_CHANGED, - BONOBO_ARG_BOOLEAN, NULL, NULL, - BONOBO_PROPERTY_WRITEABLE); - - bonobo_control_set_properties (control, bonobo_object_corba_objref (BONOBO_OBJECT (property_bag)), NULL); - bonobo_object_unref (BONOBO_OBJECT (property_bag)); - - g_signal_connect (entry_widget, "changed", G_CALLBACK (entry_changed), control); - - e_bonobo_control_automerge_ui (GTK_WIDGET (E_ENTRY (entry_widget)->canvas), - control, - EVOLUTION_UIDIR "/evolution-composer-entries.xml", - "evolution-addressbook", - verbs, entry_widget); - - return CORBA_Object_duplicate (bonobo_object_corba_objref (BONOBO_OBJECT (control)), ev); -} - -static void -impl_SelectNames_activate_dialog (PortableServer_Servant servant, - const CORBA_char *section_id, - CORBA_Environment *ev) -{ - ESelectNamesBonobo *select_names; - ESelectNamesBonoboPrivate *priv; - - select_names = E_SELECT_NAMES_BONOBO (bonobo_object (servant)); - priv = select_names->priv; - - e_select_names_manager_activate_dialog (priv->manager, section_id); -} - - -/* GtkObject methods. */ - -static void -impl_dispose (GObject *object) -{ - ESelectNamesBonobo *select_names; - ESelectNamesBonoboPrivate *priv; - - select_names = E_SELECT_NAMES_BONOBO (object); - priv = select_names->priv; - - if (priv) { - if (priv->manager->names) { - gtk_widget_destroy (GTK_WIDGET (priv->manager->names)); - priv->manager->names = NULL; - } - - g_object_unref (priv->manager); - - g_free (priv); - select_names->priv = NULL; - } - - if (G_OBJECT_CLASS (parent_class)->dispose) - G_OBJECT_CLASS (parent_class)->dispose (object); -} - - -static void -e_select_names_bonobo_class_init (ESelectNamesBonoboClass *klass) -{ - GObjectClass *object_class; - POA_GNOME_Evolution_Addressbook_SelectNames__epv *epv; - - object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - - object_class->dispose = impl_dispose; - - epv = &klass->epv; - epv->addSection = impl_SelectNames_add_section; - epv->addSectionWithLimit = impl_SelectNames_add_section_with_limit; - epv->getEntryBySection = impl_SelectNames_get_entry_for_section; - epv->activateDialog = impl_SelectNames_activate_dialog; -} - -static void -e_select_names_bonobo_init (ESelectNamesBonobo *select_names) -{ - ESelectNamesBonoboPrivate *priv; - - priv = g_new (ESelectNamesBonoboPrivate, 1); - - priv->manager = e_select_names_manager_new (); - priv->event_source = NULL; - - g_signal_connect (priv->manager, - "changed", - G_CALLBACK (manager_changed_cb), - select_names); - - g_signal_connect (priv->manager, - "ok", - G_CALLBACK (manager_ok_cb), - select_names); - - select_names->priv = priv; -} - - -static void -e_select_names_bonobo_construct (ESelectNamesBonobo *select_names) -{ - g_return_if_fail (select_names != NULL); - g_return_if_fail (E_IS_SELECT_NAMES_BONOBO (select_names)); - - g_assert (select_names->priv->event_source == NULL); - select_names->priv->event_source = bonobo_event_source_new (); - bonobo_object_add_interface (BONOBO_OBJECT (select_names), BONOBO_OBJECT (select_names->priv->event_source)); -} - -ESelectNamesBonobo * -e_select_names_bonobo_new (void) -{ - ESelectNamesBonobo *select_names; - - select_names = g_object_new (E_TYPE_SELECT_NAMES_BONOBO, NULL); - - e_select_names_bonobo_construct (select_names); - - return select_names; -} - - -BONOBO_TYPE_FUNC_FULL ( - ESelectNamesBonobo, - GNOME_Evolution_Addressbook_SelectNames, - PARENT_TYPE, - e_select_names_bonobo); diff --git a/addressbook/gui/component/select-names/e-select-names-bonobo.h b/addressbook/gui/component/select-names/e-select-names-bonobo.h deleted file mode 100644 index 5b04ed5b2e..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-bonobo.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-select-names-bonobo.h - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef __E_SELECT_NAMES_BONOBO_H__ -#define __E_SELECT_NAMES_BONOBO_H__ - -#include <bonobo/bonobo-object.h> - -#include "Evolution-Addressbook-SelectNames.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_SELECT_NAMES_BONOBO (e_select_names_bonobo_get_type ()) -#define E_SELECT_NAMES_BONOBO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SELECT_NAMES_BONOBO, ESelectNamesBonobo)) -#define E_SELECT_NAMES_BONOBO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_BONOBO, ESelectNamesBonoboClass)) -#define E_IS_SELECT_NAMES_BONOBO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SELECT_NAMES_BONOBO)) -#define E_IS_SELECT_NAMES_BONOBO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_BONOBO)) - - -typedef struct _ESelectNamesBonobo ESelectNamesBonobo; -typedef struct _ESelectNamesBonoboPrivate ESelectNamesBonoboPrivate; -typedef struct _ESelectNamesBonoboClass ESelectNamesBonoboClass; - -struct _ESelectNamesBonobo { - BonoboObject parent; - - ESelectNamesBonoboPrivate *priv; -}; - -struct _ESelectNamesBonoboClass { - BonoboObjectClass parent_class; - - POA_GNOME_Evolution_Addressbook_SelectNames__epv epv; -}; - - -GType e_select_names_bonobo_get_type (void); -ESelectNamesBonobo *e_select_names_bonobo_new (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __E_SELECT_NAMES_BONOBO_H__ */ diff --git a/addressbook/gui/component/select-names/e-select-names-completion.c b/addressbook/gui/component/select-names/e-select-names-completion.c deleted file mode 100644 index 39b5f7a008..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-completion.c +++ /dev/null @@ -1,1231 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * e-select-names-completion.c - * - * Copyright (C) 2001 Ximian, Inc. - * - * Developed by Jon Trowbridge <trow@ximian.com> - */ - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - */ - -#include <config.h> -#include "e-select-names-completion.h" - -#include <ctype.h> -#include <stdio.h> -#include <string.h> -#include <math.h> - -#include <gtk/gtksignal.h> - -#include <libebook/e-contact.h> -#include <addressbook/util/eab-book-util.h> -#include <addressbook/util/eab-destination.h> -#include <addressbook/gui/merging/eab-contact-compare.h> - -typedef struct { - EBook *book; - guint book_view_tag; - EBookView *book_view; - ESelectNamesCompletion *comp; - guint contacts_added_tag; - guint seq_complete_tag; - gboolean sequence_complete_received; - - gchar *cached_query_text; - GList *cached_cards; - gboolean cache_complete; - -} ESelectNamesCompletionBookData; - -struct _ESelectNamesCompletionPrivate { - - ESelectNamesTextModel *text_model; - - GList *book_data; - gint books_not_ready; - gint pending_completion_seq; - - gchar *waiting_query; - gint waiting_pos, waiting_limit; - gchar *query_text; - - gboolean match_contact_lists; - - gint minimum_query_length; -}; - -static void e_select_names_completion_class_init (ESelectNamesCompletionClass *); -static void e_select_names_completion_init (ESelectNamesCompletion *); -static void e_select_names_completion_dispose (GObject *object); - -static void e_select_names_completion_got_book_view_cb (EBook *book, EBookStatus status, EBookView *view, gpointer user_data); -static void e_select_names_completion_contacts_added_cb (EBookView *, const GList *cards, gpointer user_data); -static void e_select_names_completion_seq_complete_cb (EBookView *, EBookViewStatus status, gpointer user_data); - -static void e_select_names_completion_do_query (ESelectNamesCompletion *, const gchar *query_text, gint pos, gint limit); - -static void e_select_names_completion_handle_request (ECompletion *, const gchar *txt, gint pos, gint limit); -static void e_select_names_completion_end (ECompletion *); - -static GObjectClass *parent_class; - -static FILE *out; - -/* - * - * Query builders - * - */ - -typedef gchar *(*BookQuerySExp) (ESelectNamesCompletion *); -typedef ECompletionMatch *(*BookQueryMatchTester) (ESelectNamesCompletion *, EABDestination *); - -static int -utf8_casefold_collate_len (const gchar *str1, const gchar *str2, int len) -{ - gchar *s1 = g_utf8_casefold(str1, len); - gchar *s2 = g_utf8_casefold(str2, len); - int rv; - - rv = g_utf8_collate (s1, s2); - - g_free (s1); - g_free (s2); - - return rv; -} - -static int -utf8_casefold_collate (const gchar *str1, const gchar *str2) -{ - return utf8_casefold_collate_len (str1, str2, -1); -} - -static void -our_match_destroy (ECompletionMatch *match) -{ - g_object_unref (match->user_data); -} - -static ECompletionMatch * -make_match (EABDestination *dest, const gchar *menu_form, double score) -{ - ECompletionMatch *match; -#if notyet - EContact *contact = eab_destination_get_contact (dest); -#endif - - match = e_completion_match_new (eab_destination_get_name (dest), menu_form, score); - - e_completion_match_set_text (match, eab_destination_get_name (dest), menu_form); - - /* Reject any match that has null text fields. */ - if (! (e_completion_match_get_match_text (match) && e_completion_match_get_menu_text (match))) { - g_object_unref (match); - return NULL; - } - -#if notyet - /* XXX toshok - EContact doesn't have the use_score stuff */ - /* Since we sort low to high, we negate so that larger use scores will come first */ - match->sort_major = contact ? -floor (e_contact_get_use_score (contact)) : 0; -#else - match->sort_major = 0; -#endif - - match->sort_minor = eab_destination_get_email_num (dest); - - match->user_data = dest; - g_object_ref (dest); - - match->destroy = our_match_destroy; - - return match; -} - -/* - * Nickname query - */ - -static gchar * -sexp_nickname (ESelectNamesCompletion *comp) -{ - gchar *query = g_strdup_printf ("(beginswith \"nickname\" \"%s\")", comp->priv->query_text); - - return query; -} - -static ECompletionMatch * -match_nickname (ESelectNamesCompletion *comp, EABDestination *dest) -{ - ECompletionMatch *match = NULL; - gint len; - EContact *contact = eab_destination_get_contact (dest); - double score; - const char *nickname; - - nickname = e_contact_get_const (contact, E_CONTACT_NICKNAME); - if (nickname == NULL) - return NULL; - - len = g_utf8_strlen (comp->priv->query_text, -1); - if (nickname && !utf8_casefold_collate_len (comp->priv->query_text, nickname, len)) { - const gchar *name; - gchar *str; - - score = len * 2; /* nickname gives 2 points per matching character */ - - if (len == g_utf8_strlen (nickname, -1)) /* boost score on an exact match */ - score *= 10; - - name = eab_destination_get_name (dest); - if (name && *name) - str = g_strdup_printf ("'%s' %s <%s>", nickname, name, eab_destination_get_email (dest)); - else - str = g_strdup_printf ("'%s' <%s>", nickname, eab_destination_get_email (dest)); - - match = make_match (dest, str, score); - g_free (str); - } - - return match; -} - -/* - * E-Mail Query - */ - -static gchar * -sexp_email (ESelectNamesCompletion *comp) -{ - return g_strdup_printf ("(beginswith \"email\" \"%s\")", comp->priv->query_text); -} - -static ECompletionMatch * -match_email (ESelectNamesCompletion *comp, EABDestination *dest) -{ - ECompletionMatch *match; - gint len = strlen (comp->priv->query_text); - const gchar *name = eab_destination_get_name (dest); - const gchar *email = eab_destination_get_email (dest); - double score; - - if (email - && !utf8_casefold_collate_len (comp->priv->query_text, email, len) - && !eab_destination_is_evolution_list (dest)) { - - gchar *str; - - score = len * 2; /* 2 points for each matching character */ - - if (name && *name) - str = g_strdup_printf ("<%s> %s", email, name); - else - str = g_strdup (email); - - match = make_match (dest, str, score); - - g_free (str); - - return match; - } - - return NULL; -} - -/* - * Name Query - */ - -static gchar * -name_style_query (ESelectNamesCompletion *comp, const gchar *field) -{ - if (comp && comp->priv->query_text && *comp->priv->query_text) { - gchar *cpy = g_strdup (comp->priv->query_text), *c; - gchar **strv; - gchar *query; - gint i, count=0; - - for (c = cpy; *c; ++c) { - if (*c == ',') - *c = ' '; - } - - strv = g_strsplit (cpy, " ", 0); - for (i=0; strv[i]; ++i) { - gchar *old; - ++count; - g_strstrip (strv[i]); - old = strv[i]; - strv[i] = g_strdup_printf ("(beginswith \"%s\" \"%s\")", field, old); - g_free (old); - } - - if (count == 1) { - query = strv[0]; - strv[0] = NULL; - } else { - gchar *joined = g_strjoinv (" ", strv); - query = g_strdup_printf ("(and %s)", joined); - g_free (joined); - } - - g_free (cpy); - g_strfreev (strv); - - return query; - } - - return NULL; -} - -static gchar * -sexp_name (ESelectNamesCompletion *comp) -{ - return name_style_query (comp, "full_name"); -} - -static ECompletionMatch * -match_name (ESelectNamesCompletion *comp, EABDestination *dest) -{ - ECompletionMatch *final_match = NULL; - gchar *menu_text = NULL; - EContact *contact; - const gchar *email; - gint match_len = 0; - EABContactMatchType match; - EABContactMatchPart first_match; - double score = 0; - gboolean have_given, have_additional, have_family; - EContactName *contact_name; - - contact = eab_destination_get_contact (dest); - - contact_name = e_contact_get (contact, E_CONTACT_NAME); - if (!contact_name) - return NULL; - - email = eab_destination_get_email (dest); - - match = eab_contact_compare_name_to_string_full (contact, comp->priv->query_text, TRUE /* yes, allow partial matches */, - NULL, &first_match, &match_len); - - if (match <= EAB_CONTACT_MATCH_NONE) { - e_contact_name_free (contact_name); - return NULL; - } - - score = match_len * 3; /* three points per match character */ - - have_given = contact_name->given && *contact_name->given; - have_additional = contact_name->additional && *contact_name->additional; - have_family = contact_name->family && *contact_name->family; - - if (e_contact_get (contact, E_CONTACT_IS_LIST)) { - - menu_text = e_contact_name_to_string (contact_name); - - } else if (first_match == EAB_CONTACT_MATCH_PART_GIVEN_NAME) { - - if (have_family) - menu_text = g_strdup_printf ("%s %s <%s>", contact_name->given, contact_name->family, email); - else - menu_text = g_strdup_printf ("%s <%s>", contact_name->given, email); - - } else if (first_match == EAB_CONTACT_MATCH_PART_ADDITIONAL_NAME) { - - if (have_given) { - - menu_text = g_strdup_printf ("%s%s%s, %s <%s>", - contact_name->additional, - have_family ? " " : "", - have_family ? contact_name->family : "", - contact_name->given, - email); - } else { - - menu_text = g_strdup_printf ("%s%s%s <%s>", - contact_name->additional, - have_family ? " " : "", - have_family ? contact_name->family : "", - email); - } - - } else if (first_match == EAB_CONTACT_MATCH_PART_FAMILY_NAME) { - - if (have_given) - menu_text = g_strdup_printf ("%s, %s%s%s <%s>", - contact_name->family, - contact_name->given, - have_additional ? " " : "", - have_additional ? contact_name->additional : "", - email); - else - menu_text = g_strdup_printf ("%s <%s>", contact_name->family, email); - - } else { /* something funny happened */ - - menu_text = g_strdup_printf ("<%s> ???", email); - - } - - if (menu_text) { - g_strstrip (menu_text); - final_match = make_match (dest, menu_text, score); - g_free (menu_text); - } - - e_contact_name_free (contact_name); - - return final_match; -} - -/* - * File As Query - */ - -static gchar * -sexp_file_as (ESelectNamesCompletion *comp) -{ - return name_style_query (comp, "file_as"); -} - -static ECompletionMatch * -match_file_as (ESelectNamesCompletion *comp, EABDestination *dest) -{ - const gchar *name; - const gchar *email; - gchar *cpy, **strv, *menu_text; - gint i, len; - double score = 0.00001; - ECompletionMatch *match; - - name = eab_destination_get_name (dest); - email = eab_destination_get_email (dest); - - if (!(name && *name)) - return NULL; - - cpy = g_strdup (comp->priv->query_text); - strv = g_strsplit (cpy, " ", 0); - - for (i=0; strv[i] && score > 0; ++i) { - len = g_utf8_strlen (strv[i], -1); - if (!utf8_casefold_collate_len (name, strv[i], len)) - score += len; /* one point per character of the match */ - else - score = 0; - } - - g_free (cpy); - g_strfreev (strv); - - if (score <= 0) - return NULL; - - menu_text = g_strdup_printf ("%s <%s>", name, email); - g_strstrip (menu_text); - match = make_match (dest, menu_text, score); - g_free (menu_text); - - return match; -} - -typedef struct _BookQuery BookQuery; -struct _BookQuery { - BookQuerySExp builder; - BookQueryMatchTester tester; -}; - -static BookQuery book_queries[] = { - { sexp_nickname, match_nickname}, - { sexp_email, match_email }, - { sexp_name, match_name }, - { sexp_file_as, match_file_as }, -}; -static gint book_query_count = sizeof (book_queries) / sizeof (BookQuery); - -/* - * Build up a big compound sexp corresponding to all of our queries. - */ -static gchar * -book_query_sexp (ESelectNamesCompletion *comp) -{ - gint i, j; - gchar **queryv, *query; - - g_return_val_if_fail (comp && E_IS_SELECT_NAMES_COMPLETION (comp), NULL); - - if (! (comp->priv->query_text && *comp->priv->query_text)) - return NULL; - - queryv = g_new0 (gchar *, book_query_count+1); - for (i=0, j=0; i<book_query_count; ++i) { - queryv[j] = book_queries[i].builder (comp); - if (queryv[j]) - ++j; - } - - if (j == 0) { - query = NULL; - } else if (j == 1) { - query = queryv[0]; - queryv[0] = NULL; - } else { - gchar *tmp = g_strjoinv (" ", queryv); - query = g_strdup_printf ("(or %s)", tmp); - g_free (tmp); - } - - for (i=0; i<book_query_count; ++i) - g_free (queryv[i]); - g_free (queryv); - - return query; -} - -/* - * Sweep across all of our query rules and find the best score/match - * string that applies to a given destination. - */ -static ECompletionMatch * -book_query_score (ESelectNamesCompletion *comp, EABDestination *dest) -{ - ECompletionMatch *best_match = NULL; - gint i; - - g_return_val_if_fail (E_IS_SELECT_NAMES_COMPLETION (comp), NULL); - g_return_val_if_fail (EAB_IS_DESTINATION (dest), NULL); - - if (! (comp->priv->query_text && *comp->priv->query_text)) - return NULL; - - for (i=0; i<book_query_count; ++i) { - - ECompletionMatch *this_match = NULL; - - if (book_queries[i].tester && eab_destination_get_contact (dest)) { - this_match = book_queries[i].tester (comp, dest); - } - - if (this_match) { - if (best_match == NULL || this_match->score > best_match->score) { - e_completion_match_unref (best_match); - best_match = this_match; - } else { - e_completion_match_unref (this_match); - } - } - } - - return best_match; -} - -static void -book_query_process_card_list (ESelectNamesCompletion *comp, const GList *contacts) -{ - while (contacts) { - EContact *contact = E_CONTACT (contacts->data); - - if (e_contact_get (contact, E_CONTACT_IS_LIST)) { - - if (comp->priv->match_contact_lists) { - - EABDestination *dest = eab_destination_new (); - ECompletionMatch *match; - eab_destination_set_contact (dest, contact, 0); - match = book_query_score (comp, dest); - if (match && match->score > 0) { - e_completion_found_match (E_COMPLETION (comp), match); - } else { - e_completion_match_unref (match); - } - g_object_unref (dest); - - } - - } - else { - GList *email = e_contact_get (contact, E_CONTACT_EMAIL); - if (email) { - GList *iter; - gint i; - for (i=0, iter = email; iter; ++i, iter = iter->next) { - EABDestination *dest = eab_destination_new (); - gchar *e; - ECompletionMatch *match; - - eab_destination_set_contact (dest, contact, i); - e = iter->data; - - if (e && *e) { - - match = book_query_score (comp, dest); - if (match && match->score > 0) { - e_completion_found_match (E_COMPLETION (comp), match); - } else { - e_completion_match_unref (match); - } - } - - g_object_unref (dest); - } - } - g_list_foreach (email, (GFunc)g_free, NULL); - g_list_free (email); - } - - contacts = contacts->next; - } -} - -/* - * - * ESelectNamesCompletion code - * - */ - - -GType -e_select_names_completion_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (ESelectNamesCompletionClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_select_names_completion_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (ESelectNamesCompletion), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_select_names_completion_init, - }; - - type = g_type_register_static (e_completion_get_type (), "ESelectNamesCompletion", &info, 0); - } - - return type; -} - -static void -e_select_names_completion_class_init (ESelectNamesCompletionClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - ECompletionClass *completion_class = E_COMPLETION_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); - - object_class->dispose = e_select_names_completion_dispose; - - completion_class->request_completion = e_select_names_completion_handle_request; - completion_class->end_completion = e_select_names_completion_end; - - if (getenv ("EVO_DEBUG_SELECT_NAMES_COMPLETION")) { - out = fopen ("/tmp/evo-debug-select-names-completion", "w"); - if (out) - setvbuf (out, NULL, _IONBF, 0); - } -} - -static void -e_select_names_completion_init (ESelectNamesCompletion *comp) -{ - comp->priv = g_new0 (struct _ESelectNamesCompletionPrivate, 1); - comp->priv->match_contact_lists = TRUE; -} - -static void -e_select_names_completion_clear_book_data (ESelectNamesCompletion *comp) -{ - GList *l; - - for (l = comp->priv->book_data; l; l = l->next) { - ESelectNamesCompletionBookData *book_data = l->data; - - if (book_data->contacts_added_tag) { - g_signal_handler_disconnect (book_data->book_view, book_data->contacts_added_tag); - book_data->contacts_added_tag = 0; - } - - if (book_data->seq_complete_tag) { - g_signal_handler_disconnect (book_data->book_view, book_data->seq_complete_tag); - book_data->seq_complete_tag = 0; - } - - g_object_unref (book_data->book); - - if (book_data->book_view) { - e_book_view_stop (book_data->book_view); - g_object_unref (book_data->book_view); - } - - g_free (book_data->cached_query_text); - g_list_foreach (book_data->cached_cards, (GFunc)g_object_unref, NULL); - g_list_free (book_data->cached_cards); - - g_free (book_data); - } - g_list_free (comp->priv->book_data); - comp->priv->book_data = NULL; -} - -static void -e_select_names_completion_dispose (GObject *object) -{ - ESelectNamesCompletion *comp = E_SELECT_NAMES_COMPLETION (object); - - if (comp->priv) { - if (comp->priv->text_model) - g_object_unref (comp->priv->text_model); - - e_select_names_completion_clear_book_data (comp); - - g_free (comp->priv->waiting_query); - g_free (comp->priv->query_text); - - g_free (comp->priv); - comp->priv = NULL; - } - - if (parent_class->dispose) - parent_class->dispose (object); -} - - -/* - * - * EBook/EBookView Callbacks & Query Stuff - * - */ - -static gchar * -clean_query_text (const gchar *s) -{ - gchar *q = g_new (gchar, strlen(s)+1), *t; - - t = q; - while (*s) { - if (*s != ',' && *s != '"') { - *t = *s; - ++t; - } - ++s; - } - *t = '\0'; - - g_strstrip (q); - - return q; -} - -static void -e_select_names_completion_clear_cache (ESelectNamesCompletionBookData *book_data) -{ - if (out) - fprintf (out, "** clearing cache on book %s\n", e_book_get_uri (book_data->book)); - - g_free (book_data->cached_query_text); - g_list_foreach (book_data->cached_cards, (GFunc)g_object_unref, NULL); - g_list_free (book_data->cached_cards); - - book_data->cached_query_text = NULL; - book_data->cached_cards = NULL; -} - -static void -e_select_names_completion_done (ESelectNamesCompletion *comp) -{ - g_free (comp->priv->query_text); - comp->priv->query_text = NULL; - - e_completion_end_search (E_COMPLETION (comp)); /* That's all folks! */ - - /* Need to launch a new completion if another one is pending. */ - if (comp->priv->waiting_query) { - gchar *s = comp->priv->waiting_query; - comp->priv->waiting_query = NULL; - e_completion_begin_search (E_COMPLETION (comp), s, comp->priv->waiting_pos, comp->priv->waiting_limit); - g_free (s); - } -} - -static void -e_select_names_completion_got_book_view_cb (EBook *book, EBookStatus status, EBookView *view, gpointer user_data) -{ - ESelectNamesCompletion *comp; - ESelectNamesCompletionBookData *book_data; - - book_data = (ESelectNamesCompletionBookData*)user_data; - comp = book_data->comp; - - if (status != E_BOOK_ERROR_OK) { - comp->priv->pending_completion_seq--; - if (!comp->priv->pending_completion_seq) - e_select_names_completion_done (comp); - return; - } - - book_data->book_view_tag = 0; - - if (book_data->contacts_added_tag) { - g_signal_handler_disconnect (book_data->book_view, book_data->contacts_added_tag); - book_data->contacts_added_tag = 0; - } - if (book_data->seq_complete_tag) { - g_signal_handler_disconnect (book_data->book_view, book_data->seq_complete_tag); - book_data->seq_complete_tag = 0; - } - - g_object_ref (view); - if (book_data->book_view) { - e_book_view_stop (book_data->book_view); - g_object_unref (book_data->book_view); - } - book_data->book_view = view; - - book_data->contacts_added_tag = - g_signal_connect (view, - "contacts_added", - G_CALLBACK (e_select_names_completion_contacts_added_cb), - book_data); - - book_data->seq_complete_tag = - g_signal_connect (view, - "sequence_complete", - G_CALLBACK (e_select_names_completion_seq_complete_cb), - book_data); - - e_book_view_start (view); - - book_data->sequence_complete_received = FALSE; -} - -static void -e_select_names_completion_contacts_added_cb (EBookView *book_view, const GList *cards, gpointer user_data) -{ - ESelectNamesCompletionBookData *book_data = user_data; - ESelectNamesCompletion *comp = book_data->comp; - - if (e_completion_searching (E_COMPLETION (comp))) { - book_query_process_card_list (comp, cards); - - /* Save the list of matching cards. */ - while (cards) { - book_data->cached_cards = g_list_prepend (book_data->cached_cards, cards->data); - g_object_ref (cards->data); - cards = g_list_next (cards); - } - } -} - -static void -e_select_names_completion_seq_complete_cb (EBookView *book_view, EBookViewStatus status, gpointer user_data) -{ - ESelectNamesCompletionBookData *book_data = user_data; - ESelectNamesCompletion *comp = book_data->comp; - - if (out) - fprintf (out, "** got sequence_complete (status = %d) on book %s\n", status, e_book_get_uri (book_data->book)); - - /* - * We aren't searching, but the addressbook has changed -- clear our card cache so that - * future completion requests will take the changes into account. - */ - if (! e_completion_searching (E_COMPLETION (comp))) { - if (out) - fprintf (out, "\t we weren't searching, clearing the cache\n"); - e_select_names_completion_clear_cache (book_data); - return; - } - - if (book_data->cached_query_text - && status == E_BOOK_ERROR_OK - && !book_data->cache_complete - && !strcmp (book_data->cached_query_text, comp->priv->query_text)) - book_data->cache_complete = TRUE; - - if (out) - fprintf (out, "\tending search, book_data->cache_complete == %d\n", book_data->cache_complete); - - if (!book_data->sequence_complete_received) { - book_data->sequence_complete_received = TRUE; - - if (book_data->contacts_added_tag) { - g_signal_handler_disconnect (book_data->book_view, book_data->contacts_added_tag); - book_data->contacts_added_tag = 0; - } - if (book_data->seq_complete_tag) { - g_signal_handler_disconnect (book_data->book_view, book_data->seq_complete_tag); - book_data->seq_complete_tag = 0; - } - - if (out) - fprintf (out, "\t %d remaining book view's\n", comp->priv->pending_completion_seq - 1); - - comp->priv->pending_completion_seq --; - if (comp->priv->pending_completion_seq > 0) - return; - } - - e_select_names_completion_done (comp); -} - -static void -e_select_names_completion_stop_query (ESelectNamesCompletion *comp) -{ - GList *l; - - g_return_if_fail (comp && E_IS_SELECT_NAMES_COMPLETION (comp)); - - if (out) - fprintf (out, "stopping query\n"); - - if (comp->priv->waiting_query) { - if (out) - fprintf (out, "stopped waiting query\n"); - g_free (comp->priv->waiting_query); - comp->priv->waiting_query = NULL; - } - - g_free (comp->priv->query_text); - comp->priv->query_text = NULL; - - for (l = comp->priv->book_data; l; l = l->next) { - ESelectNamesCompletionBookData *book_data = l->data; - if (book_data->book_view_tag) { -#if notyet - e_book_cancel (book_data->book, book_data->book_view_tag); -#endif - book_data->book_view_tag = 0; - } - if (book_data->book_view) { - if (book_data->contacts_added_tag) { - g_signal_handler_disconnect (book_data->book_view, book_data->contacts_added_tag); - book_data->contacts_added_tag = 0; - } - if (book_data->seq_complete_tag) { - g_signal_handler_disconnect (book_data->book_view, book_data->seq_complete_tag); - book_data->seq_complete_tag = 0; - } - - e_book_view_stop (book_data->book_view); - g_object_unref (book_data->book_view); - book_data->book_view = NULL; - } - } - - comp->priv->pending_completion_seq = 0; -} - -static void -e_select_names_completion_start_query (ESelectNamesCompletion *comp, const gchar *query_text) -{ - g_return_if_fail (comp && E_IS_SELECT_NAMES_COMPLETION (comp)); - g_return_if_fail (query_text); - - e_select_names_completion_stop_query (comp); /* Stop any prior queries. */ - - if (comp->priv->books_not_ready == 0) { - gchar *sexp; - - if (strlen (query_text) < comp->priv->minimum_query_length) { - e_completion_end_search (E_COMPLETION (comp)); - return; - } - - g_free (comp->priv->query_text); - comp->priv->query_text = g_strdup (query_text); - - sexp = book_query_sexp (comp); - if (sexp && *sexp) { - GList *l; - - if (out) - fprintf (out, "\n\n**** starting query: \"%s\"\n", comp->priv->query_text); - - for (l = comp->priv->book_data; l; l = l->next) { - ESelectNamesCompletionBookData *book_data = l->data; - gboolean can_reuse_cached_cards; - - if (out) { - fprintf (out, - "book == %s[\n" - "\tbook_data->cached_query_text == `%s'\n" - "\tbook_data->cache_complete == %d\n" - "\tbook_data->cached_cards == %p\n", - e_book_get_uri (book_data->book), - book_data->cached_query_text, - book_data->cache_complete, - book_data->cached_cards); - } - - /* for lack of a better place, we invalidate the cache here if we - notice that the text is different. */ - if (book_data->cached_query_text - && (strlen (book_data->cached_query_text) > strlen (query_text) - || utf8_casefold_collate_len (book_data->cached_query_text, query_text, - strlen (book_data->cached_query_text)))) - book_data->cache_complete = FALSE; - - can_reuse_cached_cards = (book_data->cached_query_text - && book_data->cache_complete - && book_data->cached_cards != NULL); - - if (can_reuse_cached_cards) { - - if (out) - fprintf (out, "\t*** can reuse cached cards (%d cards cached)!\n", g_list_length (book_data->cached_cards)); - - if (out) - fprintf (out, "\tusing existing query info: %s (vs %s)\n", query_text, book_data->cached_query_text); - book_query_process_card_list (comp, book_data->cached_cards); - } - else { - e_select_names_completion_clear_cache (book_data); - book_data->cached_query_text = g_strdup (query_text); - - book_data->book_view_tag = e_book_async_get_book_view (book_data->book, - sexp, - e_select_names_completion_got_book_view_cb, book_data); - comp->priv->pending_completion_seq++; - } - - if (out) - fprintf (out, "]\n"); - } - - /* if we looped through all the books - and were able to complete based - solely on our cached cards, signal - that the search is over. */ - if (!comp->priv->pending_completion_seq) - e_select_names_completion_done (E_SELECT_NAMES_COMPLETION (comp)); - } else { - g_free (comp->priv->query_text); - comp->priv->query_text = NULL; - } - g_free (sexp); - - } else { - - comp->priv->waiting_query = g_strdup (query_text); - - } -} - -static void -e_select_names_completion_do_query (ESelectNamesCompletion *comp, const gchar *query_text, gint pos, gint limit) -{ - gchar *clean; - - g_return_if_fail (comp != NULL); - g_return_if_fail (E_IS_SELECT_NAMES_COMPLETION (comp)); - - clean = clean_query_text (query_text); - if (! (clean && *clean)) { - g_free (clean); - e_completion_end_search (E_COMPLETION (comp)); - return; - } - - if (out) - fprintf (out, "do_query: %s => %s\n", query_text, clean); - - e_select_names_completion_start_query (comp, clean); - g_free (clean); -} - - -/* - * - * Completion Search Override - a Framework for Christian-Resurrection-Holiday Edible-Chicken-Ova - * - */ - -typedef struct _SearchOverride SearchOverride; -struct _SearchOverride { - const gchar *trigger; - const gchar *text[4]; -}; -static SearchOverride override[] = { - { "why?", { "\"I must create a system, or be enslaved by another man's.\"", - " -- Wiliam Blake, \"Jerusalem\"", - NULL } }, - { "easter-egg?", { "What were you expecting, a flight simulator?", NULL } }, - { NULL, { NULL } } }; - -static gboolean -search_override_check (SearchOverride *over, const gchar *text) -{ - /* The g_utf8_validate is needed because as of 2001-06-11, - * EText doesn't translate from locale->UTF8 when you paste - * into it. - */ - if (over == NULL || text == NULL || !g_utf8_validate (text, -1, NULL)) - return FALSE; - - return !utf8_casefold_collate (over->trigger, text); -} - - -/* - * - * Completion Callbacks - * - */ - -static void -e_select_names_completion_handle_request (ECompletion *comp, const gchar *text, gint pos, gint limit) -{ - ESelectNamesCompletion *selcomp = E_SELECT_NAMES_COMPLETION (comp); - const gchar *str; - gint index, j; - - g_return_if_fail (comp != NULL); - g_return_if_fail (E_IS_SELECT_NAMES_COMPLETION (comp)); - g_return_if_fail (text != NULL); - - if (out) { - fprintf (out, "\n\n**** requesting completion\n"); - fprintf (out, "text=\"%s\" pos=%d limit=%d\n", text, pos, limit); - } - - e_select_names_model_text_pos (selcomp->priv->text_model->source, - selcomp->priv->text_model->seplen, - pos, &index, NULL, NULL); - str = index >= 0 ? e_select_names_model_get_string (selcomp->priv->text_model->source, index) : NULL; - - if (out) - fprintf (out, "index=%d str=\"%s\"\n", index, str); - - if (str == NULL || *str == '\0') { - if (out) - fprintf (out, "aborting empty query\n"); - e_completion_end_search (comp); - return; - } - - for (j=0; override[j].trigger; ++j) { - if (search_override_check (&(override[j]), str)) { - gint k; - - for (k=0; override[j].text[k]; ++k) { - ECompletionMatch *match = g_new (ECompletionMatch, 1); - e_completion_match_construct (match); - e_completion_match_set_text (match, text, override[j].text[k]); - match->score = 1 / (double) (k + 1); - e_completion_found_match (comp, match); - } - - e_completion_end_search (comp); - return; - } - } - - e_select_names_completion_do_query (selcomp, str, pos, limit); -} - -static void -e_select_names_completion_end (ECompletion *comp) -{ - g_return_if_fail (comp != NULL); - g_return_if_fail (E_IS_COMPLETION (comp)); - - if (out) - fprintf (out, "completion ended\n"); -} - -/* - * - * Our Pseudo-Constructor - * - */ - -ECompletion * -e_select_names_completion_new (ESelectNamesTextModel *text_model) -{ - ESelectNamesCompletion *comp; - - g_return_val_if_fail (E_IS_SELECT_NAMES_TEXT_MODEL (text_model), NULL); - - comp = g_object_new (E_TYPE_SELECT_NAMES_COMPLETION, NULL); - - comp->priv->text_model = text_model; - g_object_ref (text_model); - - return E_COMPLETION (comp); -} - -void -e_select_names_completion_add_book (ESelectNamesCompletion *comp, EBook *book) -{ - ESelectNamesCompletionBookData *book_data; - - g_return_if_fail (book != NULL); - - book_data = g_new0 (ESelectNamesCompletionBookData, 1); - book_data->book = book; - book_data->comp = comp; - g_object_ref (book_data->book); - comp->priv->book_data = g_list_append (comp->priv->book_data, book_data); - - /* XXX toshok - this doesn't work properly. need to rethink this next bit. */ - /* if the user is typing as we're adding books, restart the - query after the new book has been added */ - if (comp->priv->query_text && *comp->priv->query_text) { - char *query_text = g_strdup (comp->priv->query_text); - e_select_names_completion_stop_query (comp); - e_select_names_completion_start_query (comp, query_text); - g_free (query_text); - } -} - -void -e_select_names_completion_clear_books (ESelectNamesCompletion *comp) -{ - e_select_names_completion_stop_query (comp); - e_select_names_completion_clear_book_data (comp); -} - -void -e_select_names_completion_set_minimum_query_length (ESelectNamesCompletion *comp, int query_length) -{ - g_return_if_fail (E_IS_SELECT_NAMES_COMPLETION (comp)); - comp->priv->minimum_query_length = query_length; -} - -gboolean -e_select_names_completion_get_match_contact_lists (ESelectNamesCompletion *comp) -{ - g_return_val_if_fail (E_IS_SELECT_NAMES_COMPLETION (comp), FALSE); - return comp->priv->match_contact_lists; -} - - -void -e_select_names_completion_set_match_contact_lists (ESelectNamesCompletion *comp, gboolean x) -{ - g_return_if_fail (E_IS_SELECT_NAMES_COMPLETION (comp)); - comp->priv->match_contact_lists = x; -} - diff --git a/addressbook/gui/component/select-names/e-select-names-completion.h b/addressbook/gui/component/select-names/e-select-names-completion.h deleted file mode 100644 index 4ad1f4fd52..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-completion.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * e-select-names-completion.h - * - * Copyright (C) 2001 Ximian, Inc. - * - * Developed by Jon Trowbridge <trow@ximian.com> - */ - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - */ - -#ifndef E_SELECT_NAMES_COMPLETION_H -#define E_SELECT_NAMES_COMPLETION_H - -#include <gal/e-text/e-completion.h> -#include <libebook/e-book-async.h> -#include "e-select-names-text-model.h" - -G_BEGIN_DECLS - -#define E_TYPE_SELECT_NAMES_COMPLETION (e_select_names_completion_get_type ()) -#define E_SELECT_NAMES_COMPLETION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_SELECT_NAMES_COMPLETION, ESelectNamesCompletion)) -#define E_SELECT_NAMES_COMPLETION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), E_TYPE_SELECT_NAMES_COMPLETION, ESelectNamesCompletionClass)) -#define E_IS_SELECT_NAMES_COMPLETION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_SELECT_NAMES_COMPLETION)) -#define E_IS_SELECT_NAMES_COMPLETION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_SELECT_NAMES_COMPLETION)) - -typedef struct _ESelectNamesCompletion ESelectNamesCompletion; -typedef struct _ESelectNamesCompletionClass ESelectNamesCompletionClass; -struct _ESelectNamesCompletionPrivate; - -struct _ESelectNamesCompletion { - ECompletion parent; - - struct _ESelectNamesCompletionPrivate *priv; -}; - -struct _ESelectNamesCompletionClass { - ECompletionClass parent_class; - -}; - -GType e_select_names_completion_get_type (void); - -ECompletion *e_select_names_completion_new (ESelectNamesTextModel *); -void e_select_names_completion_add_book (ESelectNamesCompletion *, EBook *); -void e_select_names_completion_clear_books (ESelectNamesCompletion *); -void e_select_names_completion_set_minimum_query_length (ESelectNamesCompletion *, int); -gboolean e_select_names_completion_get_match_contact_lists (ESelectNamesCompletion *); -void e_select_names_completion_set_match_contact_lists (ESelectNamesCompletion *, gboolean); - -G_END_DECLS - -#endif /* E_SELECT_NAMES_COMPLETION_H */ diff --git a/addressbook/gui/component/select-names/e-select-names-config-keys.h b/addressbook/gui/component/select-names/e-select-names-config-keys.h deleted file mode 100644 index e0f08c3019..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-config-keys.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors : - * JP Rosevear <jpr@ximian.com> - * - * Copyright 2003, Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#ifndef _E_SELECT_NAMES_CONFIG_KEYS_H_ -#define _E_SELECT_NAMES_CONFIG_KEYS_H_ - -#include <glib.h> - -G_BEGIN_DECLS - -#define SELECT_NAMES_CONFIG_PREFIX "/apps/evolution/addressbook/completion" - -/* Display settings */ -#define SELECT_NAMES_CONFIG_COMPLETION_BOOKS SELECT_NAMES_CONFIG_PREFIX "/books" -#define SELECT_NAMES_CONFIG_LAST_COMPLETION_BOOK SELECT_NAMES_CONFIG_PREFIX "/last_book" -#define SELECT_NAMES_CONFIG_MIN_QUERY_LENGTH SELECT_NAMES_CONFIG_PREFIX "/minimum_query_length" - -G_END_DECLS - -#endif diff --git a/addressbook/gui/component/select-names/e-select-names-config.c b/addressbook/gui/component/select-names/e-select-names-config.c deleted file mode 100644 index 8335ed7c3b..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-config.c +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Authors : - * Damon Chaplin <damon@ximian.com> - * Rodrigo Moya <rodrigo@ximian.com> - * - * Copyright 2000, Ximian, Inc. - * Copyright 2000, Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <string.h> - -#include "e-select-names-config-keys.h" -#include "e-select-names-config.h" - -static GConfClient *config = NULL; - -static void -do_cleanup (void) -{ - g_object_unref (config); - config = NULL; -} - -static void -e_select_names_config_init (void) -{ - if (config) - return; - - config = gconf_client_get_default (); - g_atexit ((GVoidFunc) do_cleanup); - - gconf_client_add_dir (config, SELECT_NAMES_CONFIG_PREFIX, GCONF_CLIENT_PRELOAD_RECURSIVE, NULL); -} - -void -e_select_names_config_remove_notification (guint id) -{ - gconf_client_notify_remove (config, id); -} - -char * -e_select_names_config_get_last_completion_book (void) -{ - e_select_names_config_init (); - - return gconf_client_get_string (config, SELECT_NAMES_CONFIG_LAST_COMPLETION_BOOK, NULL); -} - -void -e_select_names_config_set_last_completion_book (const char *last_completion_book) -{ - e_select_names_config_init (); - - gconf_client_set_string (config, SELECT_NAMES_CONFIG_LAST_COMPLETION_BOOK, last_completion_book, NULL); -} - -guint -e_select_names_config_add_notification_last_completion_book (GConfClientNotifyFunc func, gpointer data) -{ - guint id; - - e_select_names_config_init (); - - id = gconf_client_notify_add (config, SELECT_NAMES_CONFIG_LAST_COMPLETION_BOOK, func, data, NULL, NULL); - - return id; -} - -gint -e_select_names_config_get_min_query_length (void) -{ - e_select_names_config_init (); - - return gconf_client_get_int (config, SELECT_NAMES_CONFIG_MIN_QUERY_LENGTH, NULL); -} - - -void -e_select_names_config_set_min_query_length (gint day_end_hour) -{ - e_select_names_config_init (); - - gconf_client_set_int (config, SELECT_NAMES_CONFIG_MIN_QUERY_LENGTH, day_end_hour, NULL); -} - -guint -e_select_names_config_add_notification_min_query_length (GConfClientNotifyFunc func, gpointer data) -{ - guint id; - - e_select_names_config_init (); - - id = gconf_client_notify_add (config, SELECT_NAMES_CONFIG_MIN_QUERY_LENGTH, func, data, NULL, NULL); - - return id; -} diff --git a/addressbook/gui/component/select-names/e-select-names-config.h b/addressbook/gui/component/select-names/e-select-names-config.h deleted file mode 100644 index 12d2c1314d..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-config.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors : - * Damon Chaplin <damon@ximian.com> - * Rodrigo Moya <rodrigo@ximian.com> - * - * Copyright 2000, Ximian, Inc. - * Copyright 2000, Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#ifndef _E_SELECT_NAMES_CONFIG_H_ -#define _E_SELECT_NAMES_CONFIG_H_ - -#include <gconf/gconf-client.h> - -void e_select_names_config_remove_notification (guint id); - -/* The last completion book */ -char *e_select_names_config_get_last_completion_book (void); -void e_select_names_config_set_last_completion_book (const char *last_completion_book); -guint e_select_names_config_add_notification_last_completion_book (GConfClientNotifyFunc func, gpointer data); - - -/* The minimum query length */ -gint e_select_names_config_get_min_query_length (void); -void e_select_names_config_set_min_query_length (gint day_end_hour); -guint e_select_names_config_add_notification_min_query_length (GConfClientNotifyFunc func, gpointer data); - -#endif /* _E_SELECT_NAMES_CONFIG_H_ */ diff --git a/addressbook/gui/component/select-names/e-select-names-factory.c b/addressbook/gui/component/select-names/e-select-names-factory.c deleted file mode 100644 index 9e427513e0..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-factory.c +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-select-names-factory.c - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo/bonobo-generic-factory.h> - -#include "e-select-names-bonobo.h" -#include "e-select-names-factory.h" - - -#define COMPONENT_FACTORY_ID "OAFIID:GNOME_Evolution_Addressbook_SelectNamesFactory:" BASE_VERSION - -static BonoboGenericFactory *factory = NULL; - - -static BonoboObject * -factory_fn (BonoboGenericFactory *factory, - const char *component_id, - void *closure) -{ - return BONOBO_OBJECT (e_select_names_bonobo_new ()); -} - - -gboolean -e_select_names_factory_init (void) -{ - if (factory != NULL) - return TRUE; - - factory = bonobo_generic_factory_new (COMPONENT_FACTORY_ID, factory_fn, NULL); - - if (factory == NULL) - return FALSE; - - return TRUE; -} diff --git a/addressbook/gui/component/select-names/e-select-names-factory.h b/addressbook/gui/component/select-names/e-select-names-factory.h deleted file mode 100644 index 0fe85c8361..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-factory.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-select-names-factory.h - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_SECELT_NAMES_FACTORY_H -#define _E_SECELT_NAMES_FACTORY_H - -#include <glib.h> - -gboolean e_select_names_factory_init (void); - -#endif diff --git a/addressbook/gui/component/select-names/e-select-names-manager.c b/addressbook/gui/component/select-names/e-select-names-manager.c deleted file mode 100644 index 1b7cbbb38e..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-manager.c +++ /dev/null @@ -1,755 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@ximian.com> - * Jon Trowbridge <trow@ximian.com. - * - * Copyright (C) 2000, 2001 Ximian, Inc. - */ - -#include <config.h> - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include <gal/e-text/e-entry.h> - -#include <libgnome/gnome-i18n.h> -#include "e-select-names-config.h" -#include "e-select-names-manager.h" -#include "e-select-names-marshal.h" -#include "e-select-names-model.h" -#include "e-select-names-text-model.h" -#include "e-select-names.h" -#include "e-select-names-completion.h" -#include "e-select-names-popup.h" -#include <addressbook/util/eab-book-util.h> -#include <addressbook/util/eab-destination.h> -#include "addressbook/gui/component/addressbook.h" -#include <bonobo/bonobo-object.h> - -#define DEFAULT_MINIMUM_QUERY_LENGTH 3 - -enum { - CHANGED, - OK, - CANCEL, - LAST_SIGNAL -}; - -static guint e_select_names_manager_signals[LAST_SIGNAL] = { 0 }; - -static GObjectClass *parent_class = NULL; - -typedef struct { - char *id; - char *title; - ESelectNamesModel *model; - ESelectNamesModel *original_model; - ESelectNamesManager *manager; - guint changed_tag; -} ESelectNamesManagerSection; - -typedef struct { - char *id; - EEntry *entry; - ESelectNamesManager *manager; - ESelectNamesModel *model; - ECompletion *comp; - guint cleaning_tag; -} ESelectNamesManagerEntry; - -static void e_select_names_manager_init (ESelectNamesManager *manager); -static void e_select_names_manager_class_init (ESelectNamesManagerClass *klass); - -static void e_select_names_manager_dispose (GObject *object); - -/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */ - -/* ESelectNamesManagerSection routines */ - -static void -section_model_changed_cb (ESelectNamesModel *model, gpointer closure) -{ - ESelectNamesManagerSection *section = closure; - g_signal_emit (section->manager, - e_select_names_manager_signals[CHANGED], 0, - section->id, - FALSE); -} - -static ESelectNamesManagerSection * -e_select_names_manager_section_new (ESelectNamesManager *manager, - const gchar *id, - const gchar *title, - ESelectNamesModel *model) -{ - ESelectNamesManagerSection *section; - - g_return_val_if_fail (E_IS_SELECT_NAMES_MANAGER (manager), NULL); - g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), NULL); - - section = g_new0 (ESelectNamesManagerSection, 1); - - section->id = g_strdup (id); - section->title = g_strdup (title); - - section->manager = manager; - - section->model = model; - g_object_ref (section->model); - section->changed_tag = - g_signal_connect (section->model, - "changed", - G_CALLBACK (section_model_changed_cb), - section); - - return section; -} - -static void -e_select_names_manager_section_free (ESelectNamesManagerSection *section) -{ - if (section == NULL) - return; - - g_free (section->id); - g_free (section->title); - - if (section->model) { - g_signal_handler_disconnect (section->model, section->changed_tag); - g_object_unref (section->model); - } - - if (section->original_model) { - g_object_unref (section->original_model); - } - - g_free (section); -} - -/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */ - -/* ESelectNamesManagerEntry routines */ - -static ESelectNamesManagerEntry * -get_entry_info (EEntry *entry) -{ - g_return_val_if_fail (E_IS_ENTRY (entry), NULL); - return (ESelectNamesManagerEntry *) g_object_get_data (G_OBJECT (entry), "entry_info"); -} - -static void -populate_popup_cb (EEntry *eentry, GdkEventButton *ev, gint pos, GtkWidget *menu, gpointer user_data) -{ - ESelectNamesTextModel *text_model; - - g_object_get (eentry, - "model", &text_model, - NULL); - g_assert (E_IS_SELECT_NAMES_TEXT_MODEL (text_model)); - - e_select_names_populate_popup (menu, text_model, ev, pos, GTK_WIDGET (eentry)); -} - -#if 0 -static gboolean -clean_cb (gpointer ptr) -{ - ESelectNamesManagerEntry *entry = ptr; - - e_select_names_model_clean (entry->model, TRUE); - entry->cleaning_tag = 0; - return FALSE; -} -#endif - -static gint -focus_in_cb (GtkWidget *w, GdkEventFocus *ev, gpointer user_data) -{ - ESelectNamesManagerEntry *entry = user_data; - - if (entry->cleaning_tag) { - g_source_remove (entry->cleaning_tag); - entry->cleaning_tag = 0; - } - - e_select_names_model_cancel_all_contact_load (entry->model); - - return FALSE; -} - -static gint -focus_out_cb (GtkWidget *w, GdkEventFocus *ev, gpointer user_data) -{ -#if 0 - /* XXX fix me */ - ESelectNamesManagerEntry *entry = user_data; - gboolean visible = e_entry_completion_popup_is_visible (entry->entry); - - if (! visible) { - e_select_names_model_load_all_contacts (entry->model, entry->manager->completion_book, 100); - if (entry->cleaning_tag == 0) - entry->cleaning_tag = gtk_timeout_add (100, clean_cb, entry); - } -#endif - return FALSE; -} - -static void -completion_popup_cb (EEntry *w, gint visible, gpointer user_data) -{ -#if 0 - /* XXX fix me */ - ESelectNamesManagerEntry *entry = user_data; - - if (!visible && !GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (entry->entry->canvas))) - e_select_names_model_load_all_contacts (entry->model, entry->manager->completion_book, 0); -#endif -} - -static void -completion_handler (EEntry *entry, ECompletionMatch *match) -{ - ESelectNamesManagerEntry *mgr_entry; - ESelectNamesTextModel *text_model; - EABDestination *dest; - gint i, pos, start_pos, len; - - if (match == NULL || match->user_data == NULL) - return; - - mgr_entry = get_entry_info (entry); - dest = EAB_DESTINATION (match->user_data); - - /* Sometimes I really long for garbage collection. Reference - counting makes you feel 31337, but sometimes it is just a - bitch. */ - g_object_ref (dest); - - g_object_get (entry, - "model", &text_model, - NULL); - g_assert (E_IS_SELECT_NAMES_TEXT_MODEL (text_model)); - - pos = e_entry_get_position (entry); - e_select_names_model_text_pos (mgr_entry->model, text_model->seplen, pos, &i, NULL, NULL); - e_select_names_model_replace (mgr_entry->model, i, dest); - e_select_names_model_name_pos (mgr_entry->model, text_model->seplen, i, &start_pos, &len); - e_entry_set_position (entry, start_pos+len); -} - -static ESelectNamesManagerEntry * -e_select_names_manager_entry_new (ESelectNamesManager *manager, ESelectNamesModel *model, const gchar *id) -{ - ESelectNamesManagerEntry *entry; - ETextModel *text_model; - GList *l; - - g_return_val_if_fail (E_IS_SELECT_NAMES_MANAGER (manager), NULL); - g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), NULL); - - entry = g_new0 (ESelectNamesManagerEntry, 1); - - entry->id = g_strdup (id); - - entry->entry = E_ENTRY (e_entry_new ()); - text_model = e_select_names_text_model_new (model); - g_object_set(entry->entry, - "model", text_model, /* The entry takes ownership of the text model */ - "editable", TRUE, - "use_ellipsis", TRUE, - "allow_newlines", FALSE, - NULL); - - g_object_ref (entry->entry); - - entry->comp = e_select_names_completion_new (E_SELECT_NAMES_TEXT_MODEL (text_model)); - - for (l = manager->completion_books; l; l = l->next) { - EBook *book = l->data; - e_select_names_completion_add_book (E_SELECT_NAMES_COMPLETION(entry->comp), book); - } - - e_select_names_completion_set_minimum_query_length (E_SELECT_NAMES_COMPLETION(entry->comp), - manager->minimum_query_length); - - e_entry_enable_completion_full (entry->entry, entry->comp, 100, completion_handler); - - entry->manager = manager; - - entry->model = model; - g_object_ref (model); - - g_signal_connect (entry->entry, - "populate_popup", - G_CALLBACK (populate_popup_cb), - entry); - - g_signal_connect (entry->entry->canvas, - "focus_in_event", - G_CALLBACK (focus_in_cb), - entry); - - g_signal_connect (entry->entry->canvas, - "focus_out_event", - G_CALLBACK (focus_out_cb), - entry); - - g_signal_connect (entry->entry, - "completion_popup", - G_CALLBACK (completion_popup_cb), - entry); - - g_object_set_data (G_OBJECT (entry->entry), "entry_info", entry); - g_object_set_data (G_OBJECT (entry->entry), "select_names_model", model); - g_object_set_data (G_OBJECT (entry->entry), "select_names_text_model", text_model); - g_object_set_data (G_OBJECT (entry->entry), "completion_handler", entry->comp); - - return entry; -} - -static void -e_select_names_manager_entry_free (ESelectNamesManagerEntry *entry) -{ - if (entry == NULL) - return; - - g_free (entry->id); - g_object_unref (entry->model); - g_object_unref (entry->entry); - - if (entry->cleaning_tag) - g_source_remove (entry->cleaning_tag); - - g_free (entry); -} - -/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */ - -static void -e_select_names_manager_save_models (ESelectNamesManager *manager) -{ - GList *iter; - - for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) { - ESelectNamesManagerSection *section = iter->data; - - if (section->original_model == NULL && section->model != NULL) - section->original_model = e_select_names_model_duplicate (section->model); - - } -} - -static void -e_select_names_manager_revert_to_saved_models (ESelectNamesManager *manager) -{ - GList *iter; - - for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) { - ESelectNamesManagerSection *section = iter->data; - if (section->model && section->original_model) { - e_select_names_model_overwrite_copy (section->model, section->original_model); - g_object_unref (section->original_model); - section->original_model = NULL; - } - } -} - -static void -e_select_names_manager_discard_saved_models (ESelectNamesManager *manager) -{ - GList *iter; - - for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) { - ESelectNamesManagerSection *section = iter->data; - if (section->original_model) { - g_object_unref (section->original_model); - section->original_model = NULL; - } - } -} - -/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */ - -static void -open_book_cb (EBook *book, EBookStatus status, gpointer user_data) -{ - ESelectNamesManager *manager = E_SELECT_NAMES_MANAGER (user_data); - - if (status == E_BOOK_ERROR_OK) { - GList *l; - for (l = manager->entries; l; l = l->next) { - ESelectNamesManagerEntry *entry = l->data; - e_select_names_completion_add_book (E_SELECT_NAMES_COMPLETION(entry->comp), book); - } - - manager->completion_books = g_list_append (manager->completion_books, book); - g_object_ref (book); - } - - g_object_unref (manager); /* unref ourself (matches ref before the load_source call below) */ -} - -static void -update_completion_books (ESelectNamesManager *manager) -{ - GSList *groups; - - /* Add all the completion books */ - for (groups = e_source_list_peek_groups (manager->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 char *completion = e_source_get_property (source, "completion"); - if (completion && !g_ascii_strcasecmp (completion, "true")) { - EBook *book = e_book_new (); - g_object_ref (manager); - addressbook_load_source (book, source, open_book_cb, manager); - } - } - } -} - -static void -source_list_changed (ESourceList *source_list, ESelectNamesManager *manager) -{ - GList *l; - - for (l = manager->entries; l; l = l->next) { - ESelectNamesManagerEntry *entry = l->data; - e_select_names_completion_clear_books (E_SELECT_NAMES_COMPLETION (entry->comp)); - } - - g_list_foreach (manager->completion_books, (GFunc)g_object_unref, NULL); - g_list_free (manager->completion_books); - manager->completion_books = NULL; - - update_completion_books (manager); -} - -static void -config_min_query_length_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data) -{ - ESelectNamesManager *manager = data; - GList *l; - - manager->minimum_query_length = e_select_names_config_get_min_query_length (); - if (manager->minimum_query_length <= 0) - manager->minimum_query_length = DEFAULT_MINIMUM_QUERY_LENGTH; - - for (l = manager->entries; l; l = l->next) { - ESelectNamesManagerEntry *entry = l->data; - e_select_names_completion_set_minimum_query_length (E_SELECT_NAMES_COMPLETION(entry->comp), - manager->minimum_query_length); - } -} - -/** - * e_select_names_manager_new: - * - * Returns: a new #ESelectNamesManager - */ -ESelectNamesManager * -e_select_names_manager_new (void) -{ - ESelectNamesManager *manager = g_object_new (E_TYPE_SELECT_NAMES_MANAGER, NULL); - - return manager; -} - - -/* - * ESelectNamesManager lifecycle management and vcard loading/saving. - */ - - -void -e_select_names_manager_add_section (ESelectNamesManager *manager, - const char *id, - const char *title) -{ - g_return_if_fail (E_IS_SELECT_NAMES_MANAGER (manager)); - g_return_if_fail (id != NULL); - g_return_if_fail (title != NULL); - - e_select_names_manager_add_section_with_limit (manager, id, title, -1); -} - -void -e_select_names_manager_add_section_with_limit (ESelectNamesManager *manager, - const char *id, - const char *title, - gint limit) -{ - ESelectNamesManagerSection *section; - ESelectNamesModel *model; - - g_return_if_fail (E_IS_SELECT_NAMES_MANAGER (manager)); - g_return_if_fail (id != NULL); - g_return_if_fail (title != NULL); - - model = e_select_names_model_new (); - e_select_names_model_set_limit (model, limit); - - section = e_select_names_manager_section_new (manager, id, title, model); - - manager->sections = g_list_append (manager->sections, section); - - g_object_unref (model); -} - -ESelectNamesModel * -e_select_names_manager_get_source (ESelectNamesManager *manager, - const char *id) -{ - GList *iter; - - g_return_val_if_fail (E_IS_SELECT_NAMES_MANAGER (manager), NULL); - g_return_val_if_fail (id != NULL, NULL); - - for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) { - ESelectNamesManagerSection *section = iter->data; - if (!strcmp (section->id, id)) - return section->model; - } - return NULL; -} - -GtkWidget * -e_select_names_manager_create_entry (ESelectNamesManager *manager, const char *id) -{ - GList *iter; - - g_return_val_if_fail (E_IS_SELECT_NAMES_MANAGER (manager), NULL); - g_return_val_if_fail (id != NULL, NULL); - - for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) { - ESelectNamesManagerSection *section = iter->data; - if (!strcmp(section->id, id)) { - ESelectNamesManagerEntry *entry; - - entry = e_select_names_manager_entry_new (manager, section->model, section->id); - manager->entries = g_list_append (manager->entries, entry); - - return GTK_WIDGET(entry->entry); - } - } - - return NULL; -} - -static void -e_select_names_response(ESelectNames *dialog, gint response_id, ESelectNamesManager *manager) -{ - gtk_widget_destroy (GTK_WIDGET (dialog)); - - switch(response_id) { - case GTK_RESPONSE_OK: - e_select_names_manager_discard_saved_models (manager); - g_signal_emit (manager, e_select_names_manager_signals[OK], 0); - break; - - case GTK_RESPONSE_CANCEL: - e_select_names_manager_revert_to_saved_models (manager); - g_signal_emit (manager, e_select_names_manager_signals[CANCEL], 0); - break; - } -} - -static void -clear_widget (gpointer data, GObject *where_object_was) -{ - GtkWidget **widget_ref = data; - *widget_ref = NULL; -} - -void -e_select_names_manager_activate_dialog (ESelectNamesManager *manager, - const char *id) -{ - g_return_if_fail (E_IS_SELECT_NAMES_MANAGER (manager)); - g_return_if_fail (id != NULL); - - if (manager->names) { - - g_assert (GTK_WIDGET_REALIZED (GTK_WIDGET (manager->names))); - e_select_names_set_default (manager->names, id); - gdk_window_show (GTK_WIDGET (manager->names)->window); - gdk_window_raise (GTK_WIDGET (manager->names)->window); - - } else { - - GList *iter; - - manager->names = E_SELECT_NAMES (e_select_names_new ()); - - for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) { - ESelectNamesManagerSection *section = iter->data; - e_select_names_add_section (manager->names, section->id, section->title, section->model); - } - - e_select_names_set_default (manager->names, id); - - g_signal_connect(manager->names, - "response", - G_CALLBACK(e_select_names_response), - manager); - - g_object_weak_ref (G_OBJECT (manager->names), clear_widget, &manager->names); - - gtk_widget_show(GTK_WIDGET(manager->names)); - } - - e_select_names_manager_save_models (manager); -} - -/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */ - -static void -e_select_names_manager_init (ESelectNamesManager *manager) -{ - guint not; - - manager->sections = NULL; - manager->entries = NULL; - - manager->source_list = e_source_list_new_for_gconf_default ("/apps/evolution/addressbook/sources"); - g_signal_connect (manager->source_list, "changed", G_CALLBACK (source_list_changed), manager); - - manager->completion_books = NULL; - - manager->minimum_query_length = e_select_names_config_get_min_query_length (); - - update_completion_books (manager); - - not = e_select_names_config_add_notification_min_query_length (config_min_query_length_changed_cb, manager); - manager->notifications = g_list_append (manager->notifications, GUINT_TO_POINTER (not)); -} - -static void -e_select_names_manager_dispose (GObject *object) -{ - ESelectNamesManager *manager; - - manager = E_SELECT_NAMES_MANAGER (object); - - if (manager->names) { - gtk_widget_destroy (GTK_WIDGET (manager->names)); - manager->names = NULL; - } - - if (manager->sections) { - g_list_foreach (manager->sections, (GFunc) e_select_names_manager_section_free, NULL); - g_list_free (manager->sections); - manager->sections = NULL; - } - - if (manager->entries) { - g_list_foreach (manager->entries, (GFunc) e_select_names_manager_entry_free, NULL); - g_list_free (manager->entries); - manager->entries = NULL; - } - - if (manager->source_list) { - g_object_unref (manager->source_list); - manager->source_list = NULL; - } - - if (manager->completion_books) { - g_list_foreach (manager->completion_books, (GFunc) g_object_unref, NULL); - g_list_free (manager->completion_books); - manager->completion_books = NULL; - } - - if (manager->notifications) { - GList *l; - - for (l = manager->notifications; l; l = l->next) - e_select_names_config_remove_notification (GPOINTER_TO_UINT (l->data)); - g_list_free (manager->notifications); - manager->notifications = NULL; - } - - if (G_OBJECT_CLASS (parent_class)->dispose) - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -e_select_names_manager_class_init (ESelectNamesManagerClass *klass) -{ - GObjectClass *object_class; - - object_class = G_OBJECT_CLASS(klass); - parent_class = g_type_class_peek_parent (klass); - - object_class->dispose = e_select_names_manager_dispose; - - e_select_names_manager_signals[CHANGED] = - g_signal_new ("changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ESelectNamesManagerClass, changed), - NULL, NULL, - e_select_names_marshal_NONE__POINTER_INT, - G_TYPE_NONE, 2, - G_TYPE_POINTER, - G_TYPE_INT); - - e_select_names_manager_signals[OK] = - g_signal_new ("ok", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ESelectNamesManagerClass, ok), - NULL, NULL, - e_select_names_marshal_NONE__NONE, - G_TYPE_NONE, 0); - - e_select_names_manager_signals[CANCEL] = - g_signal_new ("cancel", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ESelectNamesManagerClass, cancel), - NULL, NULL, - e_select_names_marshal_NONE__NONE, - G_TYPE_NONE, 0); -} - -/** - * e_select_names_manager_get_type: - * @void: - * - * Registers the &ESelectNamesManager class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &ESelectNamesManager class. - **/ -GType -e_select_names_manager_get_type (void) -{ - static GType manager_type = 0; - - if (!manager_type) { - static const GTypeInfo manager_info = { - sizeof (ESelectNamesManagerClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_select_names_manager_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (ESelectNamesManager), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_select_names_manager_init, - }; - - manager_type = g_type_register_static (G_TYPE_OBJECT, "ESelectNamesManager", &manager_info, 0); - } - - return manager_type; -} - - - diff --git a/addressbook/gui/component/select-names/e-select-names-manager.h b/addressbook/gui/component/select-names/e-select-names-manager.h deleted file mode 100644 index 0830d299d5..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-manager.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * Copyright (C) 2000 Ximian, Inc. - */ - -#ifndef __E_SELECT_NAMES_MANAGER_H__ -#define __E_SELECT_NAMES_MANAGER_H__ - -#include <stdio.h> -#include <time.h> -#include <gtk/gtkobject.h> -#include <e-util/e-list.h> -#include "e-select-names.h" - -#define E_TYPE_SELECT_NAMES_MANAGER (e_select_names_manager_get_type ()) -#define E_SELECT_NAMES_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SELECT_NAMES_MANAGER, ESelectNamesManager)) -#define E_SELECT_NAMES_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_MANAGER, ESelectNamesManagerClass)) -#define E_IS_SELECT_NAMES_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SELECT_NAMES_MANAGER)) -#define E_IS_SELECT_NAMES_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_MANAGER)) - -typedef struct _ESelectNamesManager ESelectNamesManager; -typedef struct _ESelectNamesManagerClass ESelectNamesManagerClass; - -struct _ESelectNamesManager { - GObject object; - - GList *sections; - GList *entries; - - ESelectNames *names; - - ESourceList *source_list; - GList *completion_books; - - int minimum_query_length; - - GList *notifications; -}; - -struct _ESelectNamesManagerClass { - GObjectClass parent_class; - - void (*changed) (ESelectNamesManager *, const gchar *section_id, gint changed_working_copy); - void (*ok) (ESelectNamesManager *); - void (*cancel) (ESelectNamesManager *); -}; - -ESelectNamesManager *e_select_names_manager_new (void); -void e_select_names_manager_add_section (ESelectNamesManager *manager, - const char *id, - const char *title); -void e_select_names_manager_add_section_with_limit (ESelectNamesManager *manager, - const char *id, - const char *title, - gint limit); -ESelectNamesModel *e_select_names_manager_get_source (ESelectNamesManager *manager, - const char *id); -GtkWidget *e_select_names_manager_create_entry (ESelectNamesManager *manager, - const char *id); -void e_select_names_manager_activate_dialog (ESelectNamesManager *manager, - const char *id); -/* Standard Gtk function */ -GType e_select_names_manager_get_type (void); - -#endif /* ! __E_SELECT_NAMES_MANAGER_H__ */ diff --git a/addressbook/gui/component/select-names/e-select-names-marshal.list b/addressbook/gui/component/select-names/e-select-names-marshal.list deleted file mode 100644 index 8e751dc27d..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-marshal.list +++ /dev/null @@ -1,3 +0,0 @@ -NONE:POINTER,INT -NONE:NONE -NONE:INT,INT,INT diff --git a/addressbook/gui/component/select-names/e-select-names-model.c b/addressbook/gui/component/select-names/e-select-names-model.c deleted file mode 100644 index 74bda7a74b..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-model.c +++ /dev/null @@ -1,769 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@ximian.com> - * Jon Trowbidge <trow@ximian.com> - * - * Copyright (C) 2000, 2001 Ximian, Inc. - */ - -#include <config.h> - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <gtk/gtkmarshal.h> -#include <gtk/gtksignal.h> - -#include <gal/util/e-util.h> -#include <libebook/e-contact.h> -#include "e-select-names-model.h" -#include "e-select-names-marshal.h" - -#define MAX_LENGTH 2047 - - -enum { - E_SELECT_NAMES_MODEL_CHANGED, - E_SELECT_NAMES_MODEL_RESIZED, - E_SELECT_NAMES_MODEL_LAST_SIGNAL -}; - -static guint e_select_names_model_signals[E_SELECT_NAMES_MODEL_LAST_SIGNAL] = { 0 }; - -/* Object argument IDs */ -enum { - ARG_0, - ARG_CONTACT, -}; - -struct _ESelectNamesModelPrivate { - gchar *id; - gchar *title; - - GList *data; /* of EABDestination */ - - gint limit; - - gint freeze_count; - gboolean pending_changed; -}; - -static GObjectClass *parent_class = NULL; - -static void e_select_names_model_init (ESelectNamesModel *model); -static void e_select_names_model_class_init (ESelectNamesModelClass *klass); - -static void e_select_names_model_dispose (GObject *object); - -GType -e_select_names_model_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (ESelectNamesModelClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_select_names_model_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (ESelectNamesModel), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_select_names_model_init, - }; - - type = g_type_register_static (G_TYPE_OBJECT, "ESelectNamesModel", &info, 0); - } - - return type; -} - -static void -e_select_names_model_class_init (ESelectNamesModelClass *klass) -{ - GObjectClass *object_class; - - object_class = G_OBJECT_CLASS(klass); - parent_class = g_type_class_peek_parent (klass); - - e_select_names_model_signals[E_SELECT_NAMES_MODEL_CHANGED] = - g_signal_new ("changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ESelectNamesModelClass, changed), - NULL, NULL, - e_select_names_marshal_NONE__NONE, - G_TYPE_NONE, 0); - - e_select_names_model_signals[E_SELECT_NAMES_MODEL_RESIZED] = - g_signal_new ("resized", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ESelectNamesModelClass, resized), - NULL, NULL, - e_select_names_marshal_NONE__INT_INT_INT, - G_TYPE_NONE, 3, - G_TYPE_INT, - G_TYPE_INT, - G_TYPE_INT); - - klass->changed = NULL; - - object_class->dispose = e_select_names_model_dispose; -} - -/** - * e_select_names_model_init: - */ -static void -e_select_names_model_init (ESelectNamesModel *model) -{ - model->priv = g_new0 (struct _ESelectNamesModelPrivate, 1); - - model->priv->limit = -1; -} - -static void -e_select_names_model_dispose (GObject *object) -{ - ESelectNamesModel *model = E_SELECT_NAMES_MODEL (object); - - if (model->priv) { - g_free (model->priv->title); - g_free (model->priv->id); - - g_list_foreach (model->priv->data, (GFunc) g_object_unref, NULL); - g_list_free (model->priv->data); - - g_free (model->priv); - model->priv = NULL; - } - - if (G_OBJECT_CLASS (parent_class)->dispose) - G_OBJECT_CLASS (parent_class)->dispose (object); -} - - -static void -e_select_names_model_changed (ESelectNamesModel *model) -{ - if (model->priv->freeze_count > 0) { - model->priv->pending_changed = TRUE; - } else { - g_signal_emit (model, e_select_names_model_signals[E_SELECT_NAMES_MODEL_CHANGED], 0); - model->priv->pending_changed = FALSE; - } -} - -static void -destination_changed_proxy (EABDestination *dest, gpointer closure) -{ - e_select_names_model_changed (E_SELECT_NAMES_MODEL (closure)); -} - -/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/ - -ESelectNamesModel * -e_select_names_model_new (void) -{ - ESelectNamesModel *model; - model = g_object_new (E_TYPE_SELECT_NAMES_MODEL, NULL); - return model; -} - -ESelectNamesModel * -e_select_names_model_duplicate (ESelectNamesModel *old) -{ - ESelectNamesModel *model = e_select_names_model_new (); - GList *iter; - - model->priv->id = g_strdup (old->priv->id); - model->priv->title = g_strdup (old->priv->title); - - for (iter = old->priv->data; iter != NULL; iter = g_list_next (iter)) { - EABDestination *dup = eab_destination_copy (EAB_DESTINATION (iter->data)); - e_select_names_model_append (model, dup); - } - - model->priv->limit = old->priv->limit; - - return model; -} - -gchar * -e_select_names_model_get_textification (ESelectNamesModel *model, const char *separator) -{ - gchar *text; - - g_return_val_if_fail (model != NULL, NULL); - g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), NULL); - g_return_val_if_fail (separator && *separator, NULL); - - if (model->priv->data == NULL) { - - text = g_strdup (""); - - } else { - gchar **strv = g_new0 (gchar *, g_list_length (model->priv->data)+1); - gint i = 0; - GList *iter = model->priv->data; - - while (iter) { - EABDestination *dest = EAB_DESTINATION (iter->data); - strv[i] = (gchar *) eab_destination_get_textrep (dest, FALSE); - ++i; - iter = g_list_next (iter); - } - - text = g_strjoinv (separator, strv); - - if (g_utf8_strlen(text, -1) > MAX_LENGTH) { - char *p = g_utf8_offset_to_pointer (text, MAX_LENGTH); - *p = '\0'; - text = g_realloc (text, p - text + 1); - } - - g_free (strv); - - } - - return text; -} - -gchar * -e_select_names_model_get_address_text (ESelectNamesModel *model, const char *separator) -{ - gchar *addr_text; - - g_return_val_if_fail (model != NULL, NULL); - g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), NULL); - g_return_val_if_fail (separator && *separator, NULL); - - if (model->priv->data == NULL) { - - addr_text = g_strdup (""); - - } else { - gchar **strv = g_new0 (gchar *, g_list_length (model->priv->data)+1); - gint i = 0; - GList *iter = model->priv->data; - - while (iter) { - EABDestination *dest = EAB_DESTINATION (iter->data); - strv[i] = (gchar *) eab_destination_get_address (dest); - if (strv[i]) - ++i; - iter = g_list_next (iter); - } - - addr_text = g_strjoinv (separator, strv); - - g_free (strv); - - } - - return addr_text; -} - -gint -e_select_names_model_count (ESelectNamesModel *model) -{ - g_return_val_if_fail (model != NULL, 0); - g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), 0); - - return g_list_length (model->priv->data); -} - -gint -e_select_names_model_get_limit (ESelectNamesModel *model) -{ - g_return_val_if_fail (model != NULL, 0); - g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), 0); - - return model->priv->limit; -} - -void -e_select_names_model_set_limit (ESelectNamesModel *model, gint limit) -{ - g_return_if_fail (model != NULL); - g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model)); - - model->priv->limit = MAX (limit, -1); -} - -gboolean -e_select_names_model_at_limit (ESelectNamesModel *model) -{ - g_return_val_if_fail (model != NULL, TRUE); - g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), TRUE); - - return model->priv->limit >= 0 && g_list_length (model->priv->data) >= model->priv->limit; -} - -const EABDestination * -e_select_names_model_get_destination (ESelectNamesModel *model, gint index) -{ - g_return_val_if_fail (model && E_IS_SELECT_NAMES_MODEL (model), NULL); - g_return_val_if_fail (0 <= index, NULL); - g_return_val_if_fail (index < g_list_length (model->priv->data), NULL); - - return EAB_DESTINATION (g_list_nth_data (model->priv->data, index)); -} - -gchar * -e_select_names_model_export_destinationv (ESelectNamesModel *model) -{ - EABDestination **destv; - gchar *str; - gint i, len = 0; - GList *j; - g_return_val_if_fail (model && E_IS_SELECT_NAMES_MODEL (model), NULL); - - len = g_list_length (model->priv->data); - destv = g_new0 (EABDestination *, len+1); - - for (i=0, j = model->priv->data; j != NULL; j = g_list_next (j)) { - EABDestination *dest = EAB_DESTINATION (j->data); - - if (dest) - destv[i++] = dest; - } - - str = eab_destination_exportv (destv); - g_free (destv); - - return str; -} - -static void send_changed (EABDestination *dest, EContact *contact, gpointer closure) -{ - ESelectNamesModel *model = closure; - e_select_names_model_changed (model); -} - -void -e_select_names_model_import_destinationv (ESelectNamesModel *model, - gchar *destinationv) -{ - EABDestination **destv; - gint i; - - g_return_if_fail (model && E_IS_SELECT_NAMES_MODEL (model)); - - destv = eab_destination_importv (destinationv); - - e_select_names_model_delete_all (model); - - if (destv == NULL) - return; - - for (i = 0; destv[i]; i++) { - eab_destination_use_contact (destv[i], send_changed, model); - e_select_names_model_append (model, destv[i]); - } - g_free (destv); -} - -EContact * -e_select_names_model_get_contact (ESelectNamesModel *model, gint index) -{ - const EABDestination *dest; - - g_return_val_if_fail (model && E_IS_SELECT_NAMES_MODEL (model), NULL); - g_return_val_if_fail (0 <= index, NULL); - g_return_val_if_fail (index < g_list_length (model->priv->data), NULL); - - dest = e_select_names_model_get_destination (model, index); - return dest ? eab_destination_get_contact (dest) : NULL; - -} - -const gchar * -e_select_names_model_get_string (ESelectNamesModel *model, gint index) -{ - const EABDestination *dest; - - g_return_val_if_fail (model && E_IS_SELECT_NAMES_MODEL (model), NULL); - g_return_val_if_fail (0 <= index, NULL); - g_return_val_if_fail (index < g_list_length (model->priv->data), NULL); - - dest = e_select_names_model_get_destination (model, index); - - return dest ? eab_destination_get_textrep (dest, FALSE) : ""; -} - -static void -connect_destination (ESelectNamesModel *model, EABDestination *dest) -{ - g_signal_connect (dest, - "changed", - G_CALLBACK (destination_changed_proxy), - model); -} - -static void -disconnect_destination (ESelectNamesModel *model, EABDestination *dest) -{ - g_signal_handlers_disconnect_by_func (dest, destination_changed_proxy, model); -} - -gboolean -e_select_names_model_contains (ESelectNamesModel *model, const EABDestination *dest) -{ - GList *iter; - - g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), FALSE); - g_return_val_if_fail (EAB_IS_DESTINATION (dest), FALSE); - - for (iter = model->priv->data; iter != NULL; iter = g_list_next (iter)) { - if (iter->data != NULL && eab_destination_equal (dest, EAB_DESTINATION (iter->data))) - return TRUE; - } - - return FALSE; -} - -void -e_select_names_model_insert (ESelectNamesModel *model, gint index, EABDestination *dest) -{ - g_return_if_fail (model != NULL); - g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model)); - g_return_if_fail (0 <= index && index <= g_list_length (model->priv->data)); - g_return_if_fail (dest && EAB_IS_DESTINATION (dest)); - - if (e_select_names_model_at_limit (model)) { - /* FIXME: This is bad. */ - g_object_unref (dest); - return; - } - - connect_destination (model, dest); - - model->priv->data = g_list_insert (model->priv->data, dest, index); - - g_object_ref (dest); - - e_select_names_model_changed (model); -} - -void -e_select_names_model_append (ESelectNamesModel *model, EABDestination *dest) -{ - g_return_if_fail (model && E_IS_SELECT_NAMES_MODEL (model)); - g_return_if_fail (dest && EAB_IS_DESTINATION (dest)); - - if (e_select_names_model_at_limit (model)) { - /* FIXME: This is bad. */ - g_object_unref (dest); - return; - } - - connect_destination (model, dest); - - model->priv->data = g_list_append (model->priv->data, dest); - - g_object_ref (dest); - - e_select_names_model_changed (model); -} - -void -e_select_names_model_replace (ESelectNamesModel *model, gint index, EABDestination *dest) -{ - GList *node; - const gchar *new_str, *old_str; - gint old_strlen=0, new_strlen=0; - - g_return_if_fail (model != NULL); - g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model)); - g_return_if_fail (model->priv->data == NULL || (0 <= index && index < g_list_length (model->priv->data))); - g_return_if_fail (dest && EAB_IS_DESTINATION (dest)); - - new_str = eab_destination_get_textrep (dest, FALSE); - new_strlen = new_str ? strlen (new_str) : 0; - - if (model->priv->data == NULL) { - - connect_destination (model, dest); - - model->priv->data = g_list_append (model->priv->data, dest); - g_object_ref (dest); - - } else { - - node = g_list_nth (model->priv->data, index); - - if (node->data != dest) { - - disconnect_destination (model, EAB_DESTINATION (node->data)); - connect_destination (model, dest); - - old_str = eab_destination_get_textrep (EAB_DESTINATION (node->data), FALSE); - old_strlen = old_str ? strlen (old_str) : 0; - - g_object_unref (node->data); - - node->data = dest; - g_object_ref (dest); - } - } - - e_select_names_model_changed (model); - - g_signal_emit (model, e_select_names_model_signals[E_SELECT_NAMES_MODEL_RESIZED], 0, - index, old_strlen, new_strlen); -} - -void -e_select_names_model_delete (ESelectNamesModel *model, gint index) -{ - GList *node; - EABDestination *dest; - - g_return_if_fail (model != NULL); - g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model)); - g_return_if_fail (0 <= index && index < g_list_length (model->priv->data)); - - node = g_list_nth (model->priv->data, index); - dest = EAB_DESTINATION (node->data); - - disconnect_destination (model, dest); - g_object_unref (dest); - - model->priv->data = g_list_remove_link (model->priv->data, node); - g_list_free_1 (node); - - e_select_names_model_changed (model); -} - -void -e_select_names_model_clean (ESelectNamesModel *model, gboolean clean_last_entry) -{ - GList *iter, *next; - gboolean changed = FALSE; - - g_return_if_fail (model != NULL && E_IS_SELECT_NAMES_MODEL (model)); - - iter = model->priv->data; - - while (iter) { - EABDestination *dest; - - next = g_list_next (iter); - - if (next == NULL && !clean_last_entry) - break; - - dest = iter->data ? EAB_DESTINATION (iter->data) : NULL; - - if (dest == NULL || eab_destination_is_empty (dest)) { - if (dest) { - disconnect_destination (model, dest); - g_object_unref (dest); - } - model->priv->data = g_list_remove_link (model->priv->data, iter); - g_list_free_1 (iter); - changed = TRUE; - } - - iter = next; - } - - if (changed) - e_select_names_model_changed (model); -} - -static void -delete_all_iter (gpointer data, gpointer closure) -{ - disconnect_destination (E_SELECT_NAMES_MODEL (closure), EAB_DESTINATION (data)); - g_object_unref (data); -} - -void -e_select_names_model_delete_all (ESelectNamesModel *model) -{ - g_return_if_fail (model != NULL && E_IS_SELECT_NAMES_MODEL (model)); - - g_list_foreach (model->priv->data, delete_all_iter, model); - g_list_free (model->priv->data); - model->priv->data = NULL; - - e_select_names_model_changed (model); -} - -void -e_select_names_model_overwrite_copy (ESelectNamesModel *dest, ESelectNamesModel *src) -{ - gint i, len; - - g_return_if_fail (dest && E_IS_SELECT_NAMES_MODEL (dest)); - g_return_if_fail (src && E_IS_SELECT_NAMES_MODEL (src)); - - if (src == dest) - return; - - e_select_names_model_delete_all (dest); - len = e_select_names_model_count (src); - for (i = 0; i < len; ++i) { - const EABDestination *d = e_select_names_model_get_destination (src, i); - if (d) - e_select_names_model_append (dest, eab_destination_copy (d)); - } -} - -void -e_select_names_model_merge (ESelectNamesModel *dest, ESelectNamesModel *src) -{ - gint i, len; - - g_return_if_fail (E_IS_SELECT_NAMES_MODEL (dest)); - g_return_if_fail (E_IS_SELECT_NAMES_MODEL (src)); - - if (src == dest) - return; - - len = e_select_names_model_count (src); - for (i = 0; i < len; ++i) { - const EABDestination *d = e_select_names_model_get_destination (src, i); - if (d && !e_select_names_model_contains (dest, d)) - e_select_names_model_append (dest, eab_destination_copy (d)); - } -} - -void -e_select_names_model_name_pos (ESelectNamesModel *model, gint seplen, gint index, gint *pos, gint *length) -{ - gint rp = 0, i, len = 0; - GList *iter; - const gchar *str; - - g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model)); - g_return_if_fail (seplen > 0); - - i = 0; - iter = model->priv->data; - while (iter && i <= index) { - rp += len + (i > 0 ? seplen : 0); - str = eab_destination_get_textrep (EAB_DESTINATION (iter->data), FALSE); - len = str ? g_utf8_strlen (str, -1) : 0; - ++i; - iter = g_list_next (iter); - } - - if (i <= index) { - rp = -1; - len = 0; - } - - if (pos) - *pos = rp; - if (length) - *length = len; -} - -void -e_select_names_model_text_pos (ESelectNamesModel *model, gint seplen, gint pos, gint *index, gint *start_pos, gint *length) -{ - GList *iter; - const gchar *str; - gint len = 0, i = 0, sp = 0, adj = 0; - - g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model)); - g_return_if_fail (seplen > 0); - - iter = model->priv->data; - - while (iter != NULL) { - str = eab_destination_get_textrep (EAB_DESTINATION (iter->data), FALSE); - len = str ? g_utf8_strlen (str, -1) : 0; - - if (sp <= pos && pos <= sp + len + adj) { - break; - } - - sp += len + adj + 1; - adj = seplen-1; - ++i; - - iter = g_list_next (iter); - } - - if (i != 0) - sp += seplen-1; /* skip past "magic space" */ - - if (iter == NULL) { -#if 0 - g_print ("text_pos ended NULL\n"); -#endif - i = -1; - sp = -1; - len = 0; - } else { -#if 0 - g_print ("text_pos got index %d\n", i); -#endif - } - - if (index) - *index = i; - if (start_pos) - *start_pos = sp; - if (length) - *length = len; -} - -void -e_select_names_model_load_all_contacts (ESelectNamesModel *model, EBook *book) -{ - GList *iter; - - g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model)); - g_return_if_fail (book == NULL || E_IS_BOOK (book)); - - for (iter = model->priv->data; iter != NULL; iter = g_list_next (iter)) { - EABDestination *dest = EAB_DESTINATION (iter->data); - if (!eab_destination_is_empty (dest)) { - - eab_destination_load_contact (dest, book); - } - } -} - -void -e_select_names_model_cancel_all_contact_load (ESelectNamesModel *model) -{ - GList *iter; - - g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model)); - - for (iter = model->priv->data; iter != NULL; iter = g_list_next (iter)) { - EABDestination *dest = EAB_DESTINATION (iter->data); - if (!eab_destination_is_empty (dest)) { - - eab_destination_cancel_contact_load (dest); - } - } -} - -void -e_select_names_model_freeze (ESelectNamesModel *model) -{ - g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model)); - - ++model->priv->freeze_count; -} - -void -e_select_names_model_thaw (ESelectNamesModel *model) -{ - g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model)); - g_return_if_fail (model->priv->freeze_count > 0); - - --model->priv->freeze_count; - if (model->priv->pending_changed) - e_select_names_model_changed (model); -} diff --git a/addressbook/gui/component/select-names/e-select-names-model.h b/addressbook/gui/component/select-names/e-select-names-model.h deleted file mode 100644 index 0d21ee86b3..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-model.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Authors: - * Chris Lahey <clahey@ximian.com> - * Jon Trowbridge <trow@ximian.com> - * - * Copyright (C) 2000, 2001 Ximian, Inc. - */ - -#ifndef __E_SELECT_NAMES_MODEL_H__ -#define __E_SELECT_NAMES_MODEL_H__ - -#include <time.h> -#include <gtk/gtkobject.h> -#include <stdio.h> -#include <e-util/e-list.h> -#include <libebook/e-contact.h> -#include <addressbook/util/eab-destination.h> - -#define E_TYPE_SELECT_NAMES_MODEL (e_select_names_model_get_type ()) -#define E_SELECT_NAMES_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SELECT_NAMES_MODEL, ESelectNamesModel)) -#define E_SELECT_NAMES_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_MODEL, ESelectNamesModelClass)) -#define E_IS_SELECT_NAMES_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SELECT_NAMES_MODEL)) -#define E_IS_SELECT_NAMES_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_MODEL)) - -typedef struct _ESelectNamesModel ESelectNamesModel; -typedef struct _ESelectNamesModelClass ESelectNamesModelClass; -struct _ESelectNamesModelPrivate; - -struct _ESelectNamesModel { - GObject object; - - struct _ESelectNamesModelPrivate *priv; -}; - -struct _ESelectNamesModelClass { - GObjectClass parent_class; - - void (*changed) (ESelectNamesModel *model); - void (*resized) (ESelectNamesModel *model, gint index, gint old_len, gint new_len); -}; - -GType e_select_names_model_get_type (void); - -ESelectNamesModel *e_select_names_model_new (void); -ESelectNamesModel *e_select_names_model_duplicate (ESelectNamesModel *old); - -gchar *e_select_names_model_get_textification (ESelectNamesModel *model, const char *separator); -gchar *e_select_names_model_get_address_text (ESelectNamesModel *model, const char *separator); - -gint e_select_names_model_count (ESelectNamesModel *model); -gint e_select_names_model_get_limit (ESelectNamesModel *model); -void e_select_names_model_set_limit (ESelectNamesModel *model, gint limit); -gboolean e_select_names_model_at_limit (ESelectNamesModel *model); - -const EABDestination *e_select_names_model_get_destination (ESelectNamesModel *model, gint index); -gchar *e_select_names_model_export_destinationv (ESelectNamesModel *model); -void e_select_names_model_import_destinationv (ESelectNamesModel *model, - gchar *destinationv); -EContact *e_select_names_model_get_contact (ESelectNamesModel *model, gint index); -const gchar *e_select_names_model_get_string (ESelectNamesModel *model, gint index); - -gboolean e_select_names_model_contains (ESelectNamesModel *model, const EABDestination *dest); - -void e_select_names_model_insert (ESelectNamesModel *model, gint index, EABDestination *dest); -void e_select_names_model_append (ESelectNamesModel *model, EABDestination *dest); -void e_select_names_model_replace (ESelectNamesModel *model, gint index, EABDestination *dest); -void e_select_names_model_delete (ESelectNamesModel *model, gint index); -void e_select_names_model_delete_all (ESelectNamesModel *model); -void e_select_names_model_overwrite_copy (ESelectNamesModel *dest, ESelectNamesModel *src); -void e_select_names_model_merge (ESelectNamesModel *dest, ESelectNamesModel *src); - -void e_select_names_model_clean (ESelectNamesModel *model, gboolean clean_last_entry); - -void e_select_names_model_name_pos (ESelectNamesModel *model, gint seplen, gint index, gint *pos, gint *length); -void e_select_names_model_text_pos (ESelectNamesModel *model, gint seplen, gint pos, gint *index, gint *start_pos, gint *length); - -void e_select_names_model_load_all_contacts (ESelectNamesModel *model, EBook *book); -void e_select_names_model_cancel_all_contact_load (ESelectNamesModel *model); - -/* This is a mildly annoying freeze/thaw pair, in that it only applies to the 'changed' - signal and not to 'resized'. This could cause unexpected results in some cases. */ -void e_select_names_model_freeze (ESelectNamesModel *model); -void e_select_names_model_thaw (ESelectNamesModel *model); - - -#endif /* ! __E_SELECT_NAMES_MODEL_H__ */ diff --git a/addressbook/gui/component/select-names/e-select-names-popup.c b/addressbook/gui/component/select-names/e-select-names-popup.c deleted file mode 100644 index bb0f331516..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-popup.c +++ /dev/null @@ -1,399 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * e-select-names-popup.c - * - * Copyright (C) 2001 Ximian, Inc. - * - * Developed by Jon Trowbridge <trow@ximian.com> - */ - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - */ - -#include <config.h> - -#include <stdio.h> -#include <string.h> - -#include <glib.h> -#include <gtk/gtkimage.h> -#include <gtk/gtkmenuitem.h> -#include <gtk/gtkimagemenuitem.h> -#include <gtk/gtkcheckmenuitem.h> -#include <gtk/gtkradiomenuitem.h> -#include <gtk/gtkseparatormenuitem.h> -#include <gtk/gtklabel.h> -#include <libgnome/gnome-i18n.h> - -#include <addressbook/util/eab-book-util.h> -#include <addressbook/gui/contact-editor/e-contact-editor.h> -#include <addressbook/gui/contact-list-editor/e-contact-list-editor.h> -#include <addressbook/gui/contact-editor/e-contact-quick-add.h> -#include "eab-gui-util.h" -#include "e-select-names-popup.h" - -#define LIST_ICON_FILENAME "contact-list-16.png" -#define CONTACT_ICON_FILENAME "evolution-contacts-mini.png" - -typedef struct _PopupInfo PopupInfo; -struct _PopupInfo { - ESelectNamesTextModel *text_model; - EABDestination *dest; - gint pos; - gint index; -}; - -static PopupInfo * -popup_info_new (ESelectNamesTextModel *text_model, EABDestination *dest, gint pos, gint index) -{ - PopupInfo *info = g_new0 (PopupInfo, 1); - info->text_model = text_model; - info->dest = dest; - info->pos = pos; - info->index = index; - - if (text_model) - g_object_ref (text_model); - - if (dest) - g_object_ref (dest); - - return info; -} - -static void -popup_info_free (PopupInfo *info) -{ - if (info) { - - if (info->text_model) - g_object_unref (info->text_model); - - if (info->dest) - g_object_unref (info->dest); - - g_free (info); - } -} - -static void -popup_info_cleanup (GtkWidget *w, gpointer info) -{ - popup_info_free ((PopupInfo *) info); -} - -/* You are in a maze of twisty little callbacks, all alike... */ - -#if TOO_MANY_MENU_ITEMS -static void -make_contact_editor_cb (EBook *book, gpointer user_data) -{ - if (book) { - EABDestination *dest = EAB_DESTINATION (user_data); - EContact *contact; - - contact = (EContact *) eab_destination_get_contact (dest); - if (e_contact_get (contact, E_CONTACT_IS_LIST)) { - EContactListEditor *ce; - ce = e_addressbook_show_contact_list_editor (book, contact, FALSE, TRUE); - e_contact_list_editor_raise (ce); - } - else { - EContactEditor *ce; - ce = e_addressbook_show_contact_editor (book, contact, FALSE, TRUE); - e_contact_editor_raise (ce); - } - g_object_unref (dest); - } -} - -static void -edit_contact_info_cb (GtkWidget *w, gpointer user_data) -{ - PopupInfo *info = (PopupInfo *) user_data; - if (info == NULL) - return; - - g_object_ref (info->dest); - e_book_use_default_book (make_contact_editor_cb, (gpointer) info->dest); -} -#endif - -static void -change_email_num_cb (GtkWidget *w, gpointer user_data) -{ - PopupInfo *info = (PopupInfo *) user_data; - gint n; - EABDestination *dest; - - if (info == NULL) - return; - - if (! GTK_CHECK_MENU_ITEM (w)->active) - return; - - n = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (w), "number")); - - if (n != eab_destination_get_email_num (info->dest)) { - dest = eab_destination_new (); - eab_destination_set_contact (dest, eab_destination_get_contact (info->dest), n); - e_select_names_model_replace (info->text_model->source, info->index, dest); - } -} - -#if TOO_MANY_MENU_ITEMS -static void -remove_recipient_cb (GtkWidget *w, gpointer user_data) -{ - PopupInfo *info = (PopupInfo *) user_data; - e_select_names_model_delete (info->text_model->source, info->index); -} - -static void -remove_all_recipients_cb (GtkWidget *w, gpointer user_data) -{ - PopupInfo *info = (PopupInfo *) user_data; - e_select_names_model_delete_all (info->text_model->source); -} - -static void -toggle_html_mail_cb (GtkWidget *w, gpointer user_data) -{ - PopupInfo *info = (PopupInfo *) user_data; - GtkCheckMenuItem *item = GTK_CHECK_MENU_ITEM (w); - const EABDestination *dest; - - if (info == NULL) - return; - - dest = info->dest; - - item = GTK_CHECK_MENU_ITEM (item); - eab_destination_set_html_mail_pref ((EABDestination *) dest, item->active); -} -#endif - -static void -populate_popup_contact (GtkWidget *pop, gboolean list, PopupInfo *info) -{ - GtkWidget *image; - EContact *contact; - GtkWidget *menuitem; - GList *email_list; - - contact = eab_destination_get_contact (info->dest); - -#if TOO_MANY_MENU_ITEMS - menuitem = gtk_separator_menu_item_new(); - gtk_widget_show (menuitem); - gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem); - - menuitem = gtk_menu_item_new_with_label (_("Remove All")); - g_signal_connect (menuitem, "activate", - G_CALLBACK (remove_all_recipients_cb), - info); - gtk_widget_show (menuitem); - gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem); - - menuitem = gtk_menu_item_new_with_label (_("Remove")); - g_signal_connect (menuitem, "activate", - G_CALLBACK (remove_recipient_cb), - info); - gtk_widget_show (menuitem); - gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem); - - menuitem = gtk_menu_item_new_with_label (list ? _("View Contact List") : _("View Contact Info")); - g_signal_connect (menuitem, "activate", - G_CALLBACK (edit_contact_info_cb), - info); - gtk_widget_show (menuitem); - gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem); - - menuitem = gtk_check_menu_item_new_with_label (_("Send HTML Mail?")); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem), - eab_destination_get_html_mail_pref (info->dest)); - g_signal_connect (menuitem, "toggled", - G_CALLBACK (toggle_html_mail_cb), - info); - gtk_widget_show (menuitem); - gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem); -#endif - - email_list = e_contact_get (contact, E_CONTACT_EMAIL); - - if (email_list) { - menuitem = gtk_separator_menu_item_new(); - gtk_widget_show (menuitem); - gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem); - - if (g_list_length (email_list) > 1) { - GList *l; - GSList *radiogroup = NULL; - gint n = eab_destination_get_email_num (info->dest); - gint j = g_list_length (email_list) - 1; - - for (l = g_list_last (email_list); l; l = l->prev) { - char *email = l->data; - char *label = NULL; - - if (!strncmp (email, "<?xml", 5)) { - EABDestination *dest = eab_destination_import (email); - if (dest) { - label = g_strdup (eab_destination_get_textrep (dest, TRUE)); - g_object_unref (dest); - } - } - else { - label = g_strdup (email); - } - - if (list) { - menuitem = gtk_menu_item_new_with_label (label); - } - else { - menuitem = gtk_radio_menu_item_new_with_label (radiogroup, label); - g_signal_connect (menuitem, "toggled", - G_CALLBACK (change_email_num_cb), - info); - if (j == n) - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem), TRUE); - - g_object_set_data (G_OBJECT (menuitem), "number", GINT_TO_POINTER (j)); - radiogroup = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem)); - } - - gtk_widget_show (menuitem); - gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem); - - j--; - - g_free (label); - } - } else { - menuitem = gtk_menu_item_new_with_label (eab_destination_get_email (info->dest)); - gtk_widget_show (menuitem); - gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem); - } - - g_list_foreach (email_list, (GFunc)g_free, NULL); - g_list_free (email_list); - } - - menuitem = gtk_separator_menu_item_new (); - gtk_widget_show (menuitem); - gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem); - - image = gtk_image_new_from_file (list - ? EVOLUTION_IMAGESDIR "/" LIST_ICON_FILENAME - : EVOLUTION_IMAGESDIR "/" CONTACT_ICON_FILENAME); - gtk_widget_show (image); - menuitem = gtk_image_menu_item_new_with_label (eab_destination_get_name (info->dest)); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), - image); - gtk_widget_show (menuitem); - gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem); -} - -static void -quick_add_cb (GtkWidget *w, gpointer user_data) -{ - PopupInfo *info = (PopupInfo *) user_data; - e_contact_quick_add_free_form (eab_destination_get_address (info->dest), NULL, NULL); -} - -static void -populate_popup_nocontact (GtkWidget *pop, PopupInfo *info) -{ - const gchar *str; - GtkWidget *menuitem; - - menuitem = gtk_separator_menu_item_new (); - gtk_widget_show (menuitem); - gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem); - - menuitem = gtk_menu_item_new_with_label (_("Add to Contacts")); - gtk_widget_show (menuitem); - gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem); - g_signal_connect (menuitem, "activate", - G_CALLBACK (quick_add_cb), - info); - -#if TOO_MANY_MENU_ITEMS - menuitem = gtk_check_menu_item_new_with_label (_("Send HTML Mail?")); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem), - eab_destination_get_html_mail_pref (info->dest)); - g_signal_connect (menuitem, "toggled", - G_CALLBACK (toggle_html_mail_cb), - info); - gtk_widget_show (menuitem); - gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem); -#endif - - menuitem = gtk_separator_menu_item_new (); - gtk_widget_show (menuitem); - gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem); - - str = eab_destination_get_name (info->dest); - if (! (str && *str)) - str = eab_destination_get_email (info->dest); - if (! (str && *str)) - str = _("Unnamed Contact"); - - menuitem = gtk_menu_item_new_with_label (str); - gtk_widget_show (menuitem); - gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem); -} - -void -e_select_names_populate_popup (GtkWidget *menu, ESelectNamesTextModel *text_model, - GdkEventButton *ev, gint pos, GtkWidget *for_widget) -{ - ESelectNamesModel *model; - PopupInfo *info; - EABDestination *dest; - gint index; - - g_return_if_fail (GTK_IS_MENU_SHELL (menu)); - g_return_if_fail (E_IS_SELECT_NAMES_TEXT_MODEL (text_model)); - g_return_if_fail (ev); - g_return_if_fail (0 <= pos); - - model = text_model->source; - - e_select_names_model_text_pos (model, text_model->seplen, pos, &index, NULL, NULL); - if (index < 0 || index >= e_select_names_model_count (model)) - return; - - /* XXX yuck, why does this return a const? */ - dest = (EABDestination *)e_select_names_model_get_destination (model, index); - if (eab_destination_is_empty (dest)) - return; - - info = popup_info_new (text_model, dest, pos, index); - - if (eab_destination_get_contact (dest)) { - populate_popup_contact (menu, eab_destination_is_evolution_list (dest), info); - } else { - populate_popup_nocontact (menu, info); - } - - /* Clean up our info item after we've made our selection. */ - g_signal_connect (menu, - "selection-done", - G_CALLBACK (popup_info_cleanup), - info); -} diff --git a/addressbook/gui/component/select-names/e-select-names-popup.h b/addressbook/gui/component/select-names/e-select-names-popup.h deleted file mode 100644 index 531275190b..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-popup.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * e-select-names-popup.h - * - * Copyright (C) 2001 Ximian, Inc. - * - * Developed by Jon Trowbridge <trow@ximian.com> - */ - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - */ - -#ifndef __E_SELECT_NAMES_POPUP_H__ -#define __E_SELECT_NAMES_POPUP_H__ - -#include "e-select-names-text-model.h" - -void e_select_names_populate_popup (GtkWidget *menu, ESelectNamesTextModel *text_model, - GdkEventButton *ev, gint pos, GtkWidget *for_widget); - -#endif /* __E_SELECT_NAMES_POPUP_H__ */ - diff --git a/addressbook/gui/component/select-names/e-select-names-section.etspec b/addressbook/gui/component/select-names/e-select-names-section.etspec deleted file mode 100644 index 9d7b038892..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-section.etspec +++ /dev/null @@ -1,7 +0,0 @@ -<ETableSpecification no-headers="true" cursor-mode="line" alternating-row-colors="false"> - <ETableColumn model_col= "0" _title="Name" expansion="1.0" minimum_width="20" resizable="true" cell="string" compare="collate" search="string"/> - <ETableState> - <column source="0"/> - <grouping> <leaf column="0" ascending="true"/> </grouping> - </ETableState> -</ETableSpecification> diff --git a/addressbook/gui/component/select-names/e-select-names-table-model.c b/addressbook/gui/component/select-names/e-select-names-table-model.c deleted file mode 100644 index aaa6936c8d..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-table-model.c +++ /dev/null @@ -1,366 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * Copyright (C) 2000 Ximian, Inc. - */ - -#include <config.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include <gtk/gtksignal.h> -#include <gal/util/e-util.h> -#include <libgnome/gnome-i18n.h> -#include <libebook/e-contact.h> -#include "e-select-names-table-model.h" - -/* Object argument IDs */ -enum { - PROP_0, - PROP_SOURCE, -}; - -static void e_select_names_table_model_init (ESelectNamesTableModel *model); -static void e_select_names_table_model_class_init (ESelectNamesTableModelClass *klass); - -static void e_select_names_table_model_dispose (GObject *object); -static void e_select_names_table_model_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void e_select_names_table_model_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void e_select_names_table_model_model_changed (ESelectNamesModel *source, - ESelectNamesTableModel *model); - -static ETableModelClass *parent_class = NULL; - -static void -e_select_names_table_model_add_source (ESelectNamesTableModel *model, - ESelectNamesModel *source) -{ - model->source = source; - if (model->source) - g_object_ref(model->source); - model->source_changed_id = g_signal_connect(model->source, "changed", - G_CALLBACK(e_select_names_table_model_model_changed), - model); -} - -static void -e_select_names_table_model_drop_source (ESelectNamesTableModel *model) -{ - if (model->source_changed_id) - g_signal_handler_disconnect(model->source, model->source_changed_id); - if (model->source) - g_object_unref(model->source); - model->source = NULL; - model->source_changed_id = 0; -} - -/** - * e_select_names_table_model_get_type: - * @void: - * - * Registers the &ESelectNamesTableModel class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &ESelectNamesTableModel class. - **/ -GType -e_select_names_table_model_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (ESelectNamesTableModelClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_select_names_table_model_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (ESelectNamesTableModel), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_select_names_table_model_init, - }; - - type = g_type_register_static (e_table_model_get_type (), "ESelectNamesTableModel", &info, 0); - } - - return type; -} - -/** - * e_select_names_table_model_new: - * @VCard: a string in vCard format - * - * Returns: a new #ESelectNamesTableModel that wraps the @VCard. - */ -ETableModel * -e_select_names_table_model_new (ESelectNamesModel *source) -{ - ETableModel *model = g_object_new (E_TYPE_SELECT_NAMES_TABLE_MODEL, NULL); - g_object_set(model, - "source", source, - NULL); - return model; -} - -static void -fill_in_info (ESelectNamesTableModel *model) -{ - if (model->source) { - int count = e_select_names_model_count (model->source); - gint i; - - model->count = count; - model->data = g_new(ESelectNamesTableModelData, count); - - for (i = 0; i < count; ++i) { - const EABDestination *dest = e_select_names_model_get_destination (model->source, i); - EContact *contact = dest ? eab_destination_get_contact (dest) : NULL; - - if (contact) { - model->data[i].name = e_contact_get(contact, E_CONTACT_FULL_NAME); - if (model->data[i].name == 0) - model->data[i].name = g_strdup(""); - model->data[i].email = e_contact_get(contact, E_CONTACT_EMAIL_1); - if (model->data[i].email == 0) - model->data[i].email = g_strdup(""); - } else { - const gchar *name = eab_destination_get_name (dest); - const gchar *email = eab_destination_get_email (dest); - - model->data[i].name = g_strdup (name && *name ? name : email); - model->data[i].email = g_strdup (email); - } - } - } else { - model->count = 0; - } -} - -static void -clear_info (ESelectNamesTableModel *model) -{ - if (model->data) { - int i; - for (i = 0; i < model->count; i++) { - g_free(model->data[i].name); - g_free(model->data[i].email); - } - g_free(model->data); - model->data = NULL; - } - - model->count = -1; -} - -/* - * ESelectNamesTableModel lifecycle management and vcard loading/saving. - */ - -static void -e_select_names_table_model_dispose (GObject *object) -{ - ESelectNamesTableModel *model; - - model = E_SELECT_NAMES_TABLE_MODEL (object); - - e_select_names_table_model_drop_source (model); - clear_info(model); - - if (G_OBJECT_CLASS (parent_class)->dispose) - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -/* This function returns the number of columns in our ETableModel. */ -static int -e_select_names_table_model_col_count (ETableModel *etc) -{ - return 3; -} - -/* This function returns the number of rows in our ETableModel. */ -static int -e_select_names_table_model_row_count (ETableModel *etc) -{ - ESelectNamesTableModel *e_select_names_table_model = E_SELECT_NAMES_TABLE_MODEL(etc); - if (e_select_names_table_model->count == -1) { - if (e_select_names_table_model->source) { - fill_in_info(e_select_names_table_model); - } else { - return 0; - } - } - return e_select_names_table_model->count; -} - -/* This function returns the value at a particular point in our ETableModel. */ -static void * -e_select_names_table_model_value_at (ETableModel *etc, int col, int row) -{ - ESelectNamesTableModel *e_select_names_table_model = E_SELECT_NAMES_TABLE_MODEL(etc); - if (e_select_names_table_model->data == NULL) { - fill_in_info(e_select_names_table_model); - } - switch (col) { - case 0: - if (e_select_names_table_model->data[row].name == NULL) { - fill_in_info(e_select_names_table_model); - } - return e_select_names_table_model->data[row].name; - break; - case 1: - if (e_select_names_table_model->data[row].email == NULL) { - fill_in_info(e_select_names_table_model); - } - return e_select_names_table_model->data[row].email; - break; - case 2: - /* underline column*/ - return (void*)TRUE; - break; - } - return ""; -} - -/* This function sets the value at a particular point in our ETableModel. */ -static void -e_select_names_table_model_set_value_at (ETableModel *etc, int col, int row, const void *val) -{ -} - -/* This function returns whether a particular cell is editable. */ -static gboolean -e_select_names_table_model_is_cell_editable (ETableModel *etc, int col, int row) -{ - return FALSE; -} - -/* This function duplicates the value passed to it. */ -static void * -e_select_names_table_model_duplicate_value (ETableModel *etc, int col, const void *value) -{ - return g_strdup(value); -} - -/* This function frees the value passed to it. */ -static void -e_select_names_table_model_free_value (ETableModel *etc, int col, void *value) -{ - g_free(value); -} - -static void * -e_select_names_table_model_initialize_value (ETableModel *etc, int col) -{ - return g_strdup(""); -} - -static gboolean -e_select_names_table_model_value_is_empty (ETableModel *etc, int col, const void *value) -{ - return !(value && *(char *)value); -} - -static char * -e_select_names_table_model_value_to_string (ETableModel *etc, int col, const void *value) -{ - return g_strdup(value); -} - -static void -e_select_names_table_model_model_changed (ESelectNamesModel *source, - ESelectNamesTableModel *model) -{ - e_table_model_pre_change(E_TABLE_MODEL(model)); - clear_info(model); - e_table_model_changed(E_TABLE_MODEL(model)); -} - -/* Set_arg handler for the model */ -static void -e_select_names_table_model_set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) -{ - ESelectNamesTableModel *model; - - model = E_SELECT_NAMES_TABLE_MODEL (object); - - switch (prop_id) { - case PROP_SOURCE: - e_select_names_table_model_drop_source (model); - e_select_names_table_model_add_source (model, E_SELECT_NAMES_MODEL(g_value_get_object (value))); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -/* Get_arg handler for the model */ -static void -e_select_names_table_model_get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) -{ - ESelectNamesTableModel *model; - - model = E_SELECT_NAMES_TABLE_MODEL (object); - - switch (prop_id) { - case PROP_SOURCE: - g_value_set_object (value, model->source); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -/** - * e_select_names_table_model_init: - */ -static void -e_select_names_table_model_init (ESelectNamesTableModel *model) -{ - model->source = NULL; - model->source_changed_id = 0; - - model->count = -1; - model->data = NULL; -} - -static void -e_select_names_table_model_class_init (ESelectNamesTableModelClass *klass) -{ - GObjectClass *object_class; - ETableModelClass *table_model_class; - - object_class = G_OBJECT_CLASS(klass); - table_model_class = E_TABLE_MODEL_CLASS(klass); - - parent_class = g_type_class_peek_parent (klass); - - object_class->dispose = e_select_names_table_model_dispose; - object_class->get_property = e_select_names_table_model_get_property; - object_class->set_property = e_select_names_table_model_set_property; - - g_object_class_install_property (object_class, PROP_SOURCE, - g_param_spec_object ("source", - _("Source"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_SELECT_NAMES_MODEL, - G_PARAM_READWRITE)); - - table_model_class->column_count = e_select_names_table_model_col_count; - table_model_class->row_count = e_select_names_table_model_row_count; - table_model_class->value_at = e_select_names_table_model_value_at; - table_model_class->set_value_at = e_select_names_table_model_set_value_at; - table_model_class->is_cell_editable = e_select_names_table_model_is_cell_editable; - table_model_class->duplicate_value = e_select_names_table_model_duplicate_value; - table_model_class->free_value = e_select_names_table_model_free_value; - table_model_class->initialize_value = e_select_names_table_model_initialize_value; - table_model_class->value_is_empty = e_select_names_table_model_value_is_empty; - table_model_class->value_to_string = e_select_names_table_model_value_to_string; -} diff --git a/addressbook/gui/component/select-names/e-select-names-table-model.h b/addressbook/gui/component/select-names/e-select-names-table-model.h deleted file mode 100644 index 1fd1026f19..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-table-model.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * Copyright (C) 2000 Ximian, Inc. - */ - -#ifndef __E_SELECT_NAMES_TABLE_MODEL_H__ -#define __E_SELECT_NAMES_TABLE_MODEL_H__ - -#include <time.h> -#include <stdio.h> -#include <gtk/gtkobject.h> -#include <gal/e-table/e-table-model.h> -#include "e-select-names-model.h" - -#define E_TYPE_SELECT_NAMES_TABLE_MODEL (e_select_names_table_model_get_type ()) -#define E_SELECT_NAMES_TABLE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SELECT_NAMES_TABLE_MODEL, ESelectNamesTableModel)) -#define E_SELECT_NAMES_TABLE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_TABLE_MODEL, ESelectNamesTableModelClass)) -#define E_IS_SELECT_NAMES_TABLE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SELECT_NAMES_TABLE_MODEL)) -#define E_IS_SELECT_NAMES_TABLE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_TABLE_MODEL)) - -typedef struct { - char *name; - char *email; -} ESelectNamesTableModelData; - -typedef struct _ESelectNamesTableModel ESelectNamesTableModel; -typedef struct _ESelectNamesTableModelClass ESelectNamesTableModelClass; - -struct _ESelectNamesTableModel { - ETableModel parent; - - ESelectNamesModel *source; - int source_changed_id; - - int count; - ESelectNamesTableModelData *data; /* This is used as an array. */ -}; - -struct _ESelectNamesTableModelClass { - ETableModelClass parent_class; -}; - -ETableModel *e_select_names_table_model_new (ESelectNamesModel *source); - -/* Standard Gtk function */ -GType e_select_names_table_model_get_type (void); - -#endif /* ! __E_SELECT_NAMES_TABLE_MODEL_H__ */ diff --git a/addressbook/gui/component/select-names/e-select-names-text-model.c b/addressbook/gui/component/select-names/e-select-names-text-model.c deleted file mode 100644 index e885de5bf6..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-text-model.c +++ /dev/null @@ -1,852 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@ximian.com> - * Jon Trowbridge <trow@ximian.com> - * - * Copyright (C) 2000, 2001 Ximian, Inc. - */ - -#include <config.h> - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -#include <gal/e-text/e-text-model-repos.h> -#include <libgnome/gnome-i18n.h> - -#include <addressbook/gui/contact-editor/e-contact-editor.h> -#include "e-select-names-text-model.h" -#include "eab-gui-util.h" - -static FILE *out = NULL; /* stream for debugging spew */ - -/* Object argument IDs */ -enum { - PROP_0, - PROP_SOURCE, -}; - -static void e_select_names_text_model_class_init (ESelectNamesTextModelClass *klass); -static void e_select_names_text_model_init (ESelectNamesTextModel *model); -static void e_select_names_text_model_dispose (GObject *object); -static void e_select_names_text_model_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void e_select_names_text_model_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); - -static void e_select_names_text_model_set_source (ESelectNamesTextModel *model, ESelectNamesModel *source); - -static const gchar *e_select_names_text_model_get_text (ETextModel *model); -static void e_select_names_text_model_set_text (ETextModel *model, const gchar *text); -static void e_select_names_text_model_insert (ETextModel *model, gint position, const gchar *text); -static void e_select_names_text_model_insert_length (ETextModel *model, gint position, const gchar *text, gint length); -static void e_select_names_text_model_delete (ETextModel *model, gint position, gint length); - -static gint e_select_names_text_model_obj_count (ETextModel *model); -static const gchar *e_select_names_text_model_get_nth_obj (ETextModel *model, gint n, gint *len); -static void e_select_names_text_model_activate_obj (ETextModel *model, gint n); - - -static ETextModelClass *parent_class; -#define PARENT_TYPE e_text_model_get_type() - -/** - * e_select_names_text_model_get_type: - * @void: - * - * Registers the &ESelectNamesTextModel class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &ESelectNamesTextModel class. - **/ -GtkType -e_select_names_text_model_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (ESelectNamesTextModelClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_select_names_text_model_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (ESelectNamesTextModel), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_select_names_text_model_init, - }; - - type = g_type_register_static (PARENT_TYPE, "ESelectNamesTextModel", &info, 0); - } - - return type; -} - -static void -e_select_names_text_model_class_init (ESelectNamesTextModelClass *klass) -{ - GObjectClass *object_class; - ETextModelClass *text_model_class; - - object_class = G_OBJECT_CLASS(klass); - text_model_class = E_TEXT_MODEL_CLASS(klass); - - parent_class = g_type_class_peek_parent (klass); - - object_class->dispose = e_select_names_text_model_dispose; - object_class->get_property = e_select_names_text_model_get_property; - object_class->set_property = e_select_names_text_model_set_property; - - g_object_class_install_property (object_class, PROP_SOURCE, - g_param_spec_object ("source", - _("Source"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_SELECT_NAMES_MODEL, - G_PARAM_READWRITE)); - - text_model_class->get_text = e_select_names_text_model_get_text; - text_model_class->set_text = e_select_names_text_model_set_text; - text_model_class->insert = e_select_names_text_model_insert; - text_model_class->insert_length = e_select_names_text_model_insert_length; - text_model_class->delete = e_select_names_text_model_delete; - - text_model_class->obj_count = e_select_names_text_model_obj_count; - text_model_class->get_nth_obj = e_select_names_text_model_get_nth_obj; - text_model_class->object_activated = e_select_names_text_model_activate_obj; - - if (getenv ("EVO_DEBUG_SELECT_NAMES_TEXT_MODEL")) { - out = fopen ("/tmp/evo-debug-select-names-text-model", "w"); - if (out) - setvbuf (out, NULL, _IONBF, 0); - } -} - -static void -dump_model (ESelectNamesTextModel *text_model) -{ - ESelectNamesModel *model = text_model->source; - gint i; - - if (out == NULL) - return; - - fprintf (out, "\n*** Model State: count=%d\n", e_select_names_model_count (model)); - - for (i=0; i<e_select_names_model_count (model); ++i) - fprintf (out, "[%d] \"%s\" %s\n", i, - e_select_names_model_get_string (model, i), - e_select_names_model_get_contact (model, i) ? "<contact>" : ""); - fprintf (out, "\n"); -} - -static void -e_select_names_text_model_init (ESelectNamesTextModel *model) -{ - const gchar *default_sep; - - model->last_magic_comma_pos = -1; - - if (getenv ("EVOLUTION_DISABLE_MAGIC_COMMA")) - default_sep = ","; - else - default_sep = ", "; - - e_select_names_text_model_set_separator (model, default_sep); -} - -static void -e_select_names_text_model_dispose (GObject *object) -{ - ESelectNamesTextModel *model; - - model = E_SELECT_NAMES_TEXT_MODEL (object); - - if (model->text) { - g_free (model->text); - model->text = NULL; - } - if (model->sep) { - g_free (model->sep); - model->sep = NULL; - } - - e_select_names_text_model_set_source (model, NULL); - - if (G_OBJECT_CLASS(parent_class)->dispose) - G_OBJECT_CLASS(parent_class)->dispose(object); -} - -static void -e_select_names_text_model_set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) -{ - ESelectNamesTextModel *model; - - model = E_SELECT_NAMES_TEXT_MODEL (object); - - switch (prop_id) { - case PROP_SOURCE: - e_select_names_text_model_set_source(model, E_SELECT_NAMES_MODEL (g_value_get_object(value))); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_select_names_text_model_get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) -{ - ESelectNamesTextModel *model; - - model = E_SELECT_NAMES_TEXT_MODEL (object); - - switch (prop_id) { - case PROP_SOURCE: - g_value_set_object (value, model->source); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -resize_cb (ESelectNamesModel *source, gint index, gint old_len, gint new_len, ETextModel *model) -{ - EReposDeleteShift repos_del; - EReposInsertShift repos_ins; - gint pos; - gint seplen = E_SELECT_NAMES_TEXT_MODEL (model)->seplen; - - e_select_names_model_name_pos (source, seplen, index, &pos, NULL); - - if (new_len < old_len) { - - repos_del.model = model; - repos_del.pos = pos; - repos_del.len = old_len - new_len; - e_text_model_reposition (model, e_repos_delete_shift, &repos_del); - - } else if (old_len < new_len) { - - repos_ins.model = model; - repos_ins.pos = pos; - repos_ins.len = new_len - old_len; - e_text_model_reposition (model, e_repos_insert_shift, &repos_ins); - - } -} - -static void -changed_cb (ESelectNamesModel *source, ETextModel *model) -{ - ESelectNamesTextModel *text_model = E_SELECT_NAMES_TEXT_MODEL (model); - - g_free (text_model->text); - text_model->text = NULL; - - e_text_model_changed (model); -} - - -static void -e_select_names_text_model_set_source (ESelectNamesTextModel *model, - ESelectNamesModel *source) -{ - if (source == model->source) - return; - - if (model->source) { - g_signal_handler_disconnect (model->source, model->source_changed_id); - g_signal_handler_disconnect (model->source, model->source_resize_id); - g_object_unref (model->source); - } - - model->source = source; - - if (model->source) { - g_object_ref (model->source); - model->source_changed_id = g_signal_connect (model->source, - "changed", - G_CALLBACK (changed_cb), - model); - model->source_resize_id = g_signal_connect (model->source, - "resized", - G_CALLBACK (resize_cb), - model); - } -} - -ETextModel * -e_select_names_text_model_new (ESelectNamesModel *source) -{ - ETextModel *model = g_object_new (E_TYPE_SELECT_NAMES_TEXT_MODEL, NULL); - e_select_names_text_model_set_source (E_SELECT_NAMES_TEXT_MODEL (model), source); - return model; -} - -void -e_select_names_text_model_set_separator (ESelectNamesTextModel *model, const char *sep) -{ - g_return_if_fail (E_IS_SELECT_NAMES_TEXT_MODEL (model)); - g_return_if_fail (sep && *sep); - - g_free (model->sep); - model->sep = g_strdup (sep); - model->seplen = g_utf8_strlen (sep, -1); -} - -static const gchar * -e_select_names_text_model_get_text (ETextModel *model) -{ - ESelectNamesTextModel *snm = E_SELECT_NAMES_TEXT_MODEL(model); - - if (snm == NULL) - return ""; - else if (snm->text == NULL) - snm->text = e_select_names_model_get_textification (snm->source, snm->sep); - - return snm->text; -} - -static void -e_select_names_text_model_set_text (ETextModel *model, const gchar *text) -{ - ESelectNamesTextModel *snm = E_SELECT_NAMES_TEXT_MODEL(model); - - e_select_names_model_delete_all (snm->source); - e_select_names_text_model_insert (model, 0, text); -} - -static void -e_select_names_text_model_insert (ETextModel *model, gint position, const gchar *text) -{ - e_select_names_text_model_insert_length (model, position, text, g_utf8_strlen (text, -1)); -} - -static void -e_select_names_text_model_insert_length (ETextModel *model, gint pos, const gchar *text, gint length) -{ - ESelectNamesTextModel *text_model = E_SELECT_NAMES_TEXT_MODEL (model); - ESelectNamesModel *source = text_model->source; - const char *t; - gchar *tmp; - - if (out) { - tmp = g_strndup (text, length); - fprintf (out, ">> insert \"%s\" (len=%d) at %d\n", tmp, length, pos); - g_free (tmp); - } - - tmp = e_select_names_model_get_textification (source, text_model->sep); - pos = CLAMP (pos, 0, g_utf8_strlen (tmp, -1)); - g_free (tmp); - - /* We want to control all cursor motions ourselves, rather than taking hints - from the ESelectNamesModel. */ - g_signal_handler_block (source, text_model->source_resize_id); - - /* We handle this one character at a time. */ - - for (t = text; length >= 0; t = g_utf8_next_char (t), length--) { - gint index, start_pos, text_len; - gboolean inside_quote = FALSE; - gunichar ut = g_utf8_get_char (t); - - if (ut == 0) - break; - - text_model->last_magic_comma_pos = -1; - - if (out) - fprintf (out, "processing [%d]\n", ut); - - e_select_names_model_text_pos (source, text_model->seplen, pos, &index, &start_pos, &text_len); - - if (out) - fprintf (out, "index=%d start_pos=%d text_len=%d\n", index, start_pos, text_len); - - /* Is this a quoted or an unquoted separator we are dealing with? */ - if (ut == g_utf8_get_char(text_model->sep) && index >= 0) { - const EABDestination *dest = e_select_names_model_get_destination (source, index); - if (dest) { - const gchar *str = eab_destination_get_textrep (dest, FALSE); - int j; - const char *jp; - - if (out) - fprintf (out, "str=%s pos=%d\n", str, pos); - - for (jp = str, j = 0; j<pos-start_pos && *jp; jp = g_utf8_next_char (jp), ++j) { - if (*jp == '"') { - inside_quote = !inside_quote; - if (out) - fprintf (out, "flip to %d at %d\n", start_pos+j, inside_quote); - } - } - } - if (out) - fprintf (out, inside_quote ? "inside quote\n" : "not inside quote\n"); - } - - - if (ut == g_utf8_get_char (text_model->sep) && !inside_quote) { - - /* This is the case of hitting , first thing in an empty entry */ - if (index == -1) { - EReposAbsolute repos; - - e_select_names_model_insert (source, 0, eab_destination_new ()); - e_select_names_model_insert (source, 0, eab_destination_new ()); - - repos.model = model; - repos.pos = -1; /* At end */ - e_text_model_reposition (model, e_repos_absolute, &repos); - - - } else if (pos <= start_pos || pos == start_pos + text_len) { - EReposInsertShift repos; - gint ins_point = index; - - if (text_len != 0 && pos == start_pos + text_len) - ++ins_point; - - /* Block adjacent blank cards. */ - if (! ((ins_point < e_select_names_model_count (source) && - (e_select_names_model_get_string (source, ins_point) == NULL)) - || (ins_point > 0 && (e_select_names_model_get_string (source, ins_point-1) == NULL)))) { - - e_select_names_model_insert (source, ins_point, eab_destination_new ()); - - repos.model = model; - repos.pos = pos; - repos.len = text_model->seplen; - e_text_model_reposition (model, e_repos_insert_shift, &repos); - pos += text_model->seplen; - } - - } else { - EReposInsertShift repos; - gint offset = MAX (pos - start_pos, 0); - const gchar *str = e_select_names_model_get_string (source, index); - gchar *str1 = g_strndup (str, offset); - gchar *str2 = g_strdup (str+offset); - EABDestination *d1 = eab_destination_new (), *d2 = eab_destination_new (); - - eab_destination_set_raw (d1, str1); - eab_destination_set_raw (d2, str2); - - e_select_names_model_replace (source, index, d1); - e_select_names_model_insert (source, index+1, d2); - - g_free (str1); - g_free (str2); - - repos.model = model; - repos.pos = pos; - repos.len = text_model->seplen; - e_text_model_reposition (model, e_repos_insert_shift, &repos); - pos += text_model->seplen; - } - - if (text_model->seplen > 1) - text_model->last_magic_comma_pos = pos; - - } else { - EReposInsertShift repos; - gint offset = MAX (pos - start_pos, 0); - const gchar *str; - GString *new_str = g_string_new (NULL); - gint this_length = 1; - gboolean whitespace = g_unichar_isspace (ut); - - str = index >= 0 ? e_select_names_model_get_string (source, index) : NULL; - if (str && *str) { - if (pos <= start_pos) { - if (whitespace) { - /* swallow leading whitespace */ - this_length = 0; - } else { - /* Adjust for our "magic white space" */ - /* FIXME: This code does the wrong thing if seplen > 2 */ - g_string_append_unichar (new_str, ut); - g_string_append (new_str, pos < start_pos ? " " : ""); - g_string_append (new_str, str); - if (pos < start_pos) - ++this_length; - } - } else { - const char *u; - int n; - for (u = str, n = 0; n < offset; u = g_utf8_next_char (u), n++) - g_string_append_unichar (new_str, g_utf8_get_char (u)); - g_string_append_unichar (new_str, ut); - g_string_append (new_str, u); - } - } else { - if (whitespace) { - /* swallow leading whitespace */ - this_length = 0; - } else { - g_string_append_unichar (new_str, ut); - } - } - - if (new_str->len) { - - EABDestination *dest; - dest = index >= 0 ? eab_destination_copy (e_select_names_model_get_destination (source, index)) : eab_destination_new (); - eab_destination_set_raw (dest, new_str->str); - e_select_names_model_replace (source, index, dest); - - /* e_select_names_model_replace (source, index, dest); */ - - if (this_length > 0) { - repos.model = model; - repos.pos = pos; - repos.len = this_length; - e_text_model_reposition (model, e_repos_insert_shift, &repos); - - pos += this_length; - } - } - g_string_free (new_str, TRUE); - } - } - - dump_model (text_model); - - g_signal_handler_unblock (source, text_model->source_resize_id); -} - - -static void -e_select_names_text_model_delete (ETextModel *model, gint pos, gint length) -{ - ESelectNamesTextModel *text_model = E_SELECT_NAMES_TEXT_MODEL (model); - ESelectNamesModel *source = text_model->source; - gint index, start_pos, text_len, offset; - - if (out) { - const gchar *str = e_select_names_model_get_textification (source, text_model->sep); - gint i, len; - - fprintf (out, ">> delete %d at pos %d\n", length, pos); - - len = strlen (str); - for (i=0; i<pos && i<len; ++i) - fprintf (out, "%c", str[i]); - fprintf (out, "["); - for (i=pos; i<pos+length && i<len; ++i) - fprintf (out, "%c", str[i]); - fprintf (out, "]"); - for (i=pos+length; i<len; ++i) - fprintf (out, "%c", str[i]); - fprintf (out, "\n"); - } - - if (length < 0) - return; - - if (text_model->last_magic_comma_pos == pos+1 && length == 1) { - pos -= text_model->seplen-1; - if (pos >= 0) - length = text_model->seplen; - text_model->last_magic_comma_pos = -1; - } - - e_select_names_model_text_pos (source, text_model->seplen, pos, &index, &start_pos, &text_len); - - if (out) - fprintf (out, "index=%d, start_pos=%d, text_len=%d\n", index, start_pos, text_len); - - /* We want to control all cursor motions ourselves, rather than taking hints - from the ESelectNamesModel. */ - g_signal_handler_block (source, E_SELECT_NAMES_TEXT_MODEL (model)->source_resize_id); - - /* First, we handle a few tricky cases. */ - - if (pos < start_pos) { - EReposAbsolute repos; - - repos.model = model; - repos.pos = pos; - e_text_model_reposition (model, e_repos_absolute, &repos); - - length -= start_pos - pos; - - if (length > 0) - e_select_names_text_model_delete (model, start_pos, length); - goto finished; - } - - if (pos == start_pos + text_len) { - /* We are positioned right at the end of an entry, possibly right in front of a comma. */ - - if (index+1 < e_select_names_model_count (source)) { - EReposDeleteShift repos; - EABDestination *new_dest; - const gchar *str1 = e_select_names_model_get_string (source, index); - const gchar *str2 = e_select_names_model_get_string (source, index+1); - gchar *new_str; - - while (str1 && *str1 && isspace ((gint) *str1)) - ++str1; - while (str2 && *str2 && isspace ((gint) *str2)) - ++str2; - - if (str1 && str2) - new_str = g_strdup_printf ("%s%s%s", str1, text_model->sep+1, str2); - else if (str1) - new_str = g_strdup (str1); - else if (str2) - new_str = g_strdup (str2); - else - new_str = g_strdup (""); - - if (out) - fprintf (out, "joining \"%s\" and \"%s\" to \"%s\"\n", str1, str2, new_str); - - e_select_names_model_delete (source, index+1); - - new_dest = eab_destination_new (); - eab_destination_set_raw (new_dest, new_str); - e_select_names_model_replace (source, index, new_dest); - g_free (new_str); - - repos.model = model; - repos.pos = pos; - repos.len = text_model->seplen; - - e_text_model_reposition (model, e_repos_delete_shift, &repos); - - if (length > 1) - e_select_names_text_model_delete (model, pos, length-1); - } else { - /* If we are at the end of the last entry (which we must be if we end up in this block), - we can just do nothing. So this else-block is here just to give us a place to - put this comment. */ - } - - goto finished; - } - - if (pos + length > start_pos + text_len) { - /* Uh oh... our changes straddle two objects. */ - - if (pos == start_pos) { /* Delete the whole thing */ - EReposDeleteShift repos; - - e_select_names_model_delete (source, index); - - if (out) - fprintf (out, "deleted all of %d\n", index); - - repos.model = model; - repos.pos = pos; - repos.len = text_len + text_model->seplen; - - e_text_model_reposition (model, e_repos_delete_shift, &repos); - - length -= text_len + text_model->seplen; - if (length > 0) - e_select_names_text_model_delete (model, pos, length); - - } else { - /* Delete right up to the end, and then call e_select_names_text_model_delete again - to finish the job. */ - gint len1, len2; - - len1 = text_len - (pos - start_pos); - len2 = length - len1; - - if (out) - fprintf (out, "two-stage delete: %d, %d\n", len1, len2); - - - e_select_names_text_model_delete (model, pos, len1); - e_select_names_text_model_delete (model, pos, len2); - } - - goto finished; - } - - /* Our changes are confined to just one entry. */ - if (length > 0) { - const gchar *str; - gchar *new_str; - - offset = pos - start_pos; - - str = e_select_names_model_get_string (source, index); - - if (str) { - const char *p; - char *np; - int i; - EReposDeleteShift repos; - EABDestination *dest; - - new_str = g_new0 (char, strlen (str) * 6 + 1); /* worse case it can't be any longer than this */ - - /* copy the region before the deletion */ - for (p = str, i = 0, np = new_str; i < offset; i++) { - gunichar ch; - - ch = g_utf8_get_char (p); - g_unichar_to_utf8 (ch, np); - - np = g_utf8_next_char (np); - p = g_utf8_next_char (p); - } - - /* skip the deleted segment */ - for (i = 0; i < length; i++) - p = g_utf8_next_char (p); - - /* copy the region after the deletion */ - for (; *p; p = g_utf8_next_char (p)) { - gunichar ch; - - ch = g_utf8_get_char (p); - g_unichar_to_utf8 (ch, np); - - np = g_utf8_next_char (np); - } - - dest = index >= 0 ? eab_destination_copy (e_select_names_model_get_destination (source, index)) : eab_destination_new (); - eab_destination_set_raw (dest, new_str); - e_select_names_model_replace (source, index, dest); - - if (out) - fprintf (out, "new_str: \"%s\"\n", new_str); - - g_free (new_str); - - repos.model = model; - repos.pos = pos; - repos.len = length; - - e_text_model_reposition (model, e_repos_delete_shift, &repos); - - } else { - EReposDeleteShift repos; - - e_select_names_model_delete (source, index); - - if (out) - fprintf (out, "deleted %d\n", index); - - - repos.model = model; - repos.pos = pos; - repos.len = text_model->seplen; - - e_text_model_reposition (model, e_repos_delete_shift, &repos); - } - } - - finished: - E_SELECT_NAMES_TEXT_MODEL (model)->last_magic_comma_pos = -1; - g_signal_handler_unblock (source, E_SELECT_NAMES_TEXT_MODEL (model)->source_resize_id); - dump_model (E_SELECT_NAMES_TEXT_MODEL (model)); -} - -static gint -e_select_names_text_model_obj_count (ETextModel *model) -{ - ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL (model)->source; - gint i, count; - - count = i = e_select_names_model_count (source); - while (i > 0) { - const EABDestination *dest; - --i; - dest = e_select_names_model_get_destination (source, i); - if (eab_destination_get_contact (dest) == NULL) - --count; - } - - return count; -} - -static gint -nth_obj_index (ESelectNamesModel *source, gint n) -{ - gint i, N; - - i = 0; - N = e_select_names_model_count (source); - - do { - const EABDestination *dest = e_select_names_model_get_destination (source, i); - if (eab_destination_get_contact (dest)) - --n; - ++i; - } while (n >= 0 && i < N); - - if (i <= N) - --i; - else - i = -1; - - return i; -} - -static const gchar * -e_select_names_text_model_get_nth_obj (ETextModel *model, gint n, gint *len) -{ - ESelectNamesTextModel *text_model = E_SELECT_NAMES_TEXT_MODEL (model); - ESelectNamesModel *source = text_model->source; - gint i, pos; - - i = nth_obj_index (source, n); - if (i < 0) - return NULL; - - e_select_names_model_name_pos (source, text_model->seplen, i, &pos, len); - if (pos < 0) - return NULL; - - if (text_model->text == NULL) - text_model->text = e_select_names_model_get_textification (source, text_model->sep); - return g_utf8_offset_to_pointer (text_model->text, pos); -} - -static void -e_select_names_text_model_activate_obj (ETextModel *model, gint n) -{ -#if notyet - /* XXX the new ebook doesn't have e_contact_get_book, and we - don't really want to add it, so this can't be implemented - this simply anymore */ - ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL (model)->source; - EContact *contact; - gint i; - - i = nth_obj_index (source, n); - g_return_if_fail (i >= 0); - - contact = e_select_names_model_get_contact (source, i); - g_return_if_fail (contact != NULL); - - /* present read-only contact editor when someone double clicks from here */ - if (e_contact_get (contact, E_CONTACT_IS_LIST)) { - EContactListEditor *ce; - ce = e_addressbook_show_contact_list_editor (e_contact_get_book(contact), contact, FALSE, FALSE); - e_contact_list_editor_raise (ce); - } - else { - EABContactEditor *ce; - ce = e_addressbook_show_contact_editor (e_contact_get_book(contact), contact, FALSE, FALSE); - e_contact_editor_raise (ce); - } -#endif -} - - - diff --git a/addressbook/gui/component/select-names/e-select-names-text-model.h b/addressbook/gui/component/select-names/e-select-names-text-model.h deleted file mode 100644 index eec062aee6..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-text-model.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@ximian.com> - * Jon Trowbridge <trow@ximian.com> - * - * Copyright (C) 2000, 2001 Ximian, Inc. - */ - -#ifndef __E_SELECT_NAMES_TEXT_MODEL_H__ -#define __E_SELECT_NAMES_TEXT_MODEL_H__ - -#include <time.h> -#include <stdio.h> -#include <gtk/gtkobject.h> -#include <gal/e-text/e-text-model.h> -#include "e-select-names-model.h" - -#define E_TYPE_SELECT_NAMES_TEXT_MODEL (e_select_names_text_model_get_type ()) -#define E_SELECT_NAMES_TEXT_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SELECT_NAMES_TEXT_MODEL, ESelectNamesTextModel)) -#define E_SELECT_NAMES_TEXT_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_TEXT_MODEL, ESelectNamesTextModelClass)) -#define E_IS_SELECT_NAMES_TEXT_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SELECT_NAMES_TEXT_MODEL)) -#define E_IS_SELECT_NAMES_TEXT_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_TEXT_MODEL)) - -typedef struct _ESelectNamesTextModel ESelectNamesTextModel; -typedef struct _ESelectNamesTextModelClass ESelectNamesTextModelClass; - -struct _ESelectNamesTextModel { - ETextModel parent; - - ESelectNamesModel *source; - gint source_changed_id; - gint source_resize_id; - - gchar *text; - - gchar *sep; - gint seplen; - - gint last_magic_comma_pos; -}; - -struct _ESelectNamesTextModelClass { - ETextModelClass parent_class; -}; - -ETextModel *e_select_names_text_model_new (ESelectNamesModel *source); -void e_select_names_text_model_set_separator (ESelectNamesTextModel *model, const char *sep); - -/* Standard Gtk function */ -GType e_select_names_text_model_get_type (void); - -#endif /* ! __E_SELECT_NAMES_TEXT_MODEL_H__ */ diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c deleted file mode 100644 index 3925857447..0000000000 --- a/addressbook/gui/component/select-names/e-select-names.c +++ /dev/null @@ -1,845 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-select-names.c - * Copyright (C) 2000 Ximian, Inc. - * Author: Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include <string.h> -#include <glib.h> -#include <gtk/gtk.h> -#include <libgnome/gnome-i18n.h> - -#include <gal/e-table/e-table-simple.h> -#include <gal/e-table/e-table-without.h> -#include <gal/widgets/e-popup-menu.h> - -#include <libebook/e-book-async.h> -#include <libebook/e-contact.h> -#include <addressbook/gui/widgets/e-addressbook-model.h> -#include <addressbook/gui/widgets/e-addressbook-table-adapter.h> -#include <addressbook/util/eab-book-util.h> -#include <addressbook/gui/component/addressbook-component.h> -#include <addressbook/gui/component/addressbook.h> - -#include "e-select-names-config.h" -#include "e-select-names.h" -#include "e-select-names-table-model.h" -#include <gal/widgets/e-categories-master-list-option-menu.h> -#include <gal/e-text/e-entry.h> -#include <e-util/e-categories-master-list-wombat.h> -#include "e-util/e-sexp.h" - -static void e_select_names_init (ESelectNames *names); -static void e_select_names_class_init (ESelectNamesClass *klass); -static void e_select_names_dispose (GObject *object); -static void update_query (GtkWidget *widget, ESelectNames *e_select_names); - -static void sync_table_and_models (ESelectNamesModel *triggering_model, ESelectNames *esl); - -static GtkDialogClass *parent_class = NULL; -#define PARENT_TYPE gtk_dialog_get_type() - -/* The arguments we take */ -enum { - ARG_0, -}; - -typedef struct { - char *title; - ESelectNamesModel *source; - ESelectNamesTableModel *table_model; - ESelectNames *names; - GtkWidget *label; - GtkWidget *button; - GtkWidget *recipient_table; - gulong changed_id; -} ESelectNamesChild; - -GType -e_select_names_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (ESelectNamesClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_select_names_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (ESelectNames), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_select_names_init, - }; - - type = g_type_register_static (PARENT_TYPE, "ESelectNames", &info, 0); - } - - return type; -} - -static void -e_select_names_class_init (ESelectNamesClass *klass) -{ - GObjectClass *object_class; - - object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); - - object_class->dispose = e_select_names_dispose; -} - -GtkWidget *e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int num1, int num2); - -static void -search_result (EABModel *model, EBookViewStatus status, ESelectNames *esn) -{ - sync_table_and_models (NULL, esn); -} - -static void -set_book(EBook *book, EBookStatus status, ESelectNames *esn) -{ - g_object_set(esn->model, - "book", book, - NULL); - update_query (NULL, esn); - g_object_unref(book); - g_object_unref(esn->model); - g_object_unref(esn); -} - -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 -addressbook_model_set_source (ESelectNames *e_select_names, EABModel *model, ESource *source) -{ - EBook *book; - - book = e_book_new(); - - g_object_ref(e_select_names); - g_object_ref(model); - - addressbook_load_source (book, source, (EBookCallback) set_book, e_select_names); -} - -static void * -contact_key (const EContact *contact) -{ - EBook *book = NULL; - const gchar *book_uri; - - if (contact == NULL) - return NULL; - - g_assert (E_IS_CONTACT (contact)); - -#if notyet - /* XXX we need a way to reproduce this here somehow.. or at - least make sure we never collide between two contacts in - different books. */ - book = e_contact_get_book (contact); -#endif - book_uri = book ? e_book_get_uri (book) : "NoBook"; - return g_strdup_printf ("%s|%s", book_uri ? book_uri : "NoURI", (char*)e_contact_get_const ((EContact*)contact, E_CONTACT_UID)); -} - -static void -sync_one_model (gpointer k, gpointer val, gpointer closure) -{ - ETableWithout *etw = E_TABLE_WITHOUT (closure); - ESelectNamesChild *child = val; - ESelectNamesModel *model = child->source; - gint i, count; - EContact *contact; - void *key; - - count = e_select_names_model_count (model); - for (i = 0; i < count; ++i) { - contact = e_select_names_model_get_contact (model, i); - if (contact) { - key = contact_key (contact); - e_table_without_hide (etw, key); - g_free (key); - } - } -} - -static void -sync_table_and_models (ESelectNamesModel *triggering_model, ESelectNames *esl) -{ - e_table_without_show_all (E_TABLE_WITHOUT (esl->without)); - g_hash_table_foreach (esl->children, sync_one_model, esl->without); -} - -static void -real_add_address_cb (int model_row, gpointer closure) -{ - ESelectNamesChild *child = closure; - ESelectNames *names = child->names; - const EContact *contact; - EABDestination *dest = eab_destination_new (); - gint mapped_row; - - mapped_row = e_table_subset_view_to_model_row (E_TABLE_SUBSET (names->without), model_row); - - contact = eab_model_contact_at (EAB_MODEL(names->model), mapped_row); - - if (contact != NULL) { - eab_destination_set_contact (dest, (EContact*)contact, 0); - - e_select_names_model_append (child->source, dest); - e_select_names_model_clean (child->source, FALSE); - } -} - -static void -real_add_address(ESelectNames *names, ESelectNamesChild *child) -{ - e_select_names_model_freeze (child->source); - e_table_selected_row_foreach(e_table_scrolled_get_table(names->table), - real_add_address_cb, child); - e_select_names_model_thaw (child->source); -} - -static void -add_address(ETable *table, int row, int col, GdkEvent *event, ESelectNames *names) -{ - ESelectNamesChild *child; - - child = g_hash_table_lookup(names->children, names->def); - if (child) { - real_add_address(names, child); - } -} - -static void -sensitize_button (gpointer key, gpointer data, gpointer user_data) -{ - gboolean *sensitive = user_data; - ESelectNamesChild *child = data; - - gtk_widget_set_sensitive (child->button, *sensitive); -} - -static void -selection_change (ETable *table, ESelectNames *names) -{ - gboolean sensitive; - - sensitive = e_table_selected_count (table) > 0; - - g_hash_table_foreach (names->children, sensitize_button, &sensitive); -} - -static void * -esn_get_key_fn (ETableModel *source, int row, void *closure) -{ - EABModel *model = EAB_MODEL (closure); - const EContact *contact = eab_model_contact_at (model, row); - void *key = contact_key (contact); - return key; -} - -static void * -esn_dup_key_fn (const void *key, void *closure) -{ - void *dup = (void *) g_strdup ((const gchar *) key); - return dup; -} - -static void -esn_free_gotten_key_fn (void *key, void *closure) -{ - g_free (key); -} - -static void -esn_free_duped_key_fn (void *key, void *closure) -{ - g_free (key); -} - -GtkWidget * -e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int num1, int num2) -{ - ETableModel *adapter; - ETableModel *without; - EABModel *model; - GtkWidget *table; - - model = eab_model_new (); - adapter = E_TABLE_MODEL (eab_table_adapter_new (model)); - - g_object_set(model, - "editable", FALSE, - NULL); - - without = e_table_without_new (adapter, - g_str_hash, - g_str_equal, - esn_get_key_fn, - esn_dup_key_fn, - esn_free_gotten_key_fn, - esn_free_duped_key_fn, - model); - - table = e_table_scrolled_new_from_spec_file (without, - NULL, - EVOLUTION_ETSPECDIR "/e-select-names.etspec", - NULL); - - g_object_set_data(G_OBJECT(table), "adapter", adapter); - g_object_set_data(G_OBJECT(table), "without", without); - g_object_set_data(G_OBJECT(table), "model", model); - - return table; -} - -static void -source_selected (ESourceOptionMenu *menu, ESource *source, ESelectNames *e_select_names) -{ - addressbook_model_set_source (e_select_names, e_select_names->model, source); - e_select_names_config_set_last_completion_book (e_source_peek_uid (source)); -} - -static void -update_query (GtkWidget *widget, ESelectNames *e_select_names) -{ - char *category = ""; - const char *search = ""; - char *query; - char *q_array[4]; - int i; - GString *s = g_string_new (""); - - if (e_select_names->categories) { - category = e_categories_master_list_option_menu_get_category (E_CATEGORIES_MASTER_LIST_OPTION_MENU (e_select_names->categories)); - } - if (e_select_names->select_entry) { - search = gtk_entry_get_text (GTK_ENTRY (e_select_names->select_entry)); - } - - e_sexp_encode_string (s, search); - - i = 0; - q_array[i++] = "(contains \"email\" \"\")"; - if (category && *category) - q_array[i++] = g_strdup_printf ("(is \"category\" \"%s\")", category); - if (search && *search) - q_array[i++] = g_strdup_printf ("(or (beginswith \"email\" %s) " - " (beginswith \"full_name\" %s) " - " (beginswith \"nickname\" %s)" - " (beginswith \"file_as\" %s))", - s->str, s->str, s->str, s->str); - q_array[i++] = NULL; - if (i > 2) { - char *temp = g_strjoinv (" ", q_array); - query = g_strdup_printf ("(and %s)", temp); - g_free (temp); - } else { - query = g_strdup (q_array[0]); - } - g_object_set (e_select_names->model, - "query", query, - NULL); - for (i = 1; q_array[i]; i++) { - g_free (q_array[i]); - } - g_free (query); - g_string_free (s, TRUE); -} - -static void -status_message (EABModel *model, const gchar *message, ESelectNames *e_select_names) -{ - if (message == NULL) - gtk_label_set_text (GTK_LABEL (e_select_names->status_message), ""); - else - gtk_label_set_text (GTK_LABEL (e_select_names->status_message), message); -} - -static void -categories_changed (GtkWidget *widget, ESelectNames *e_select_names) -{ - update_query (widget, e_select_names); -} - -static void -select_entry_changed (GtkWidget *widget, ESelectNames *e_select_names) -{ - if (e_select_names->select_entry) { - const char *select_string = gtk_entry_get_text (GTK_ENTRY (e_select_names->select_entry)); - char *select_strcoll_string = g_utf8_collate_key (select_string, -1); - int count; - ETable *table; - int i; - - table = e_table_scrolled_get_table (e_select_names->table); - - count = e_table_model_row_count (e_select_names->without); - - for (i = 0; i < count; i++) { - int model_row = e_table_view_to_model_row (table, i); - char *row_strcoll_string = - g_utf8_collate_key (e_table_model_value_at (e_select_names->without, - E_CONTACT_FULL_NAME, - model_row), - -1); - if (g_utf8_collate (select_strcoll_string, row_strcoll_string) <= 0) { - g_free (row_strcoll_string); - break; - } - g_free (row_strcoll_string); - } - g_free (select_strcoll_string); - if (i == count) - i --; - - if (count > 0) { - i = e_table_view_to_model_row (table, i); - e_table_set_cursor_row (table, i); - } - } -} - -GtkWidget *e_select_names_create_categories (gchar *name, - gchar *string1, gchar *string2, - gint int1, gint int2); - -GtkWidget * -e_select_names_create_categories (gchar *name, - gchar *string1, gchar *string2, - gint int1, gint int2) -{ - ECategoriesMasterList *ecml; - GtkWidget *option_menu; - - ecml = e_categories_master_list_wombat_new (); - option_menu = e_categories_master_list_option_menu_new (ecml); - g_object_unref (ecml); - - return option_menu; -} - -static void -clear_widget (gpointer data, GObject *where_object_was) -{ - GtkWidget **widget_ref = data; - *widget_ref = NULL; -} - -static void -e_select_names_init (ESelectNames *e_select_names) -{ - GladeXML *gui; - GtkWidget *widget, *button, *table, *esom; - ESource *source = NULL; - char *uid; - - /* FIXME What to do on error/NULL ? */ - e_select_names->source_list = e_source_list_new_for_gconf_default ("/apps/evolution/addressbook/sources"); - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/select-names.glade", NULL, NULL); - e_select_names->gui = gui; - - /* Add the source menu */ - esom = e_source_option_menu_new (e_select_names->source_list); - g_signal_connect (esom, "source_selected", G_CALLBACK (source_selected), e_select_names); - gtk_widget_show (esom); - - table = glade_xml_get_widget (gui, "show_contacts_table"); - gtk_table_attach (GTK_TABLE (table), esom, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0); - - /* Set up the rest of the widgets */ - e_select_names->children = g_hash_table_new(g_str_hash, g_str_equal); - e_select_names->child_count = 0; - e_select_names->def = NULL; - - widget = glade_xml_get_widget(gui, "table-top"); - if (!widget) { - return; - } - gtk_widget_ref(widget); - gtk_container_remove(GTK_CONTAINER(widget->parent), widget); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(e_select_names)->vbox), widget, TRUE, TRUE, 0); - gtk_widget_unref(widget); - - gtk_dialog_add_buttons (GTK_DIALOG (e_select_names), - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); - - gtk_dialog_set_default_response (GTK_DIALOG (e_select_names), - GTK_RESPONSE_OK); - - gtk_container_set_border_width (GTK_CONTAINER (e_select_names), 12); - gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (e_select_names)->vbox), 6); - gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (e_select_names)->action_area), 12); - - gtk_window_set_modal (GTK_WINDOW (e_select_names), TRUE); - - gtk_window_set_title(GTK_WINDOW(e_select_names), _("Select Contacts from Addressbook")); - gtk_window_set_resizable(GTK_WINDOW(e_select_names), TRUE); - - e_select_names->table = E_TABLE_SCROLLED(glade_xml_get_widget(gui, "table-source")); - e_select_names->model = g_object_get_data(G_OBJECT(e_select_names->table), "model"); - e_select_names->adapter = g_object_get_data(G_OBJECT(e_select_names->table), "adapter"); - e_select_names->without = g_object_get_data(G_OBJECT(e_select_names->table), "without"); - gtk_widget_show (GTK_WIDGET (e_select_names->table)); - - e_select_names->status_message = glade_xml_get_widget (gui, "status-message"); - if (e_select_names->status_message && !GTK_IS_LABEL (e_select_names->status_message)) - e_select_names->status_message = NULL; - if (e_select_names->status_message) { - e_select_names->status_id = g_signal_connect (e_select_names->model, "status_message", - G_CALLBACK (status_message), e_select_names); - g_object_weak_ref (G_OBJECT (e_select_names->status_message), clear_widget, &e_select_names->status_message); - } - - e_select_names->search_id = g_signal_connect (e_select_names->model, - "search_result", G_CALLBACK (search_result), - e_select_names); - - e_select_names->categories = glade_xml_get_widget (gui, "custom-categories"); - if (e_select_names->categories && !E_IS_CATEGORIES_MASTER_LIST_OPTION_MENU (e_select_names->categories)) - e_select_names->categories = NULL; - if (e_select_names->categories) { - g_signal_connect(e_select_names->categories, "changed", - G_CALLBACK(categories_changed), e_select_names); - g_object_weak_ref (G_OBJECT (e_select_names->categories), clear_widget, &e_select_names->categories); - } - gtk_widget_show (e_select_names->categories); - - e_select_names->select_entry = glade_xml_get_widget (gui, "entry-select"); - if (e_select_names->select_entry && !GTK_IS_ENTRY (e_select_names->select_entry)) - e_select_names->select_entry = NULL; - if (e_select_names->select_entry) { - g_signal_connect(e_select_names->select_entry, "changed", - G_CALLBACK(select_entry_changed), e_select_names); - g_signal_connect(e_select_names->select_entry, "activate", - G_CALLBACK(update_query), e_select_names); - g_object_weak_ref (G_OBJECT (e_select_names->select_entry), clear_widget, &e_select_names->select_entry); - } - - button = glade_xml_get_widget (gui, "button-find"); - if (button && GTK_IS_BUTTON (button)) - g_signal_connect(button, "clicked", - G_CALLBACK(update_query), e_select_names); - - g_signal_connect (e_table_scrolled_get_table (e_select_names->table), "double_click", - G_CALLBACK (add_address), e_select_names); - g_signal_connect (e_table_scrolled_get_table (e_select_names->table), "selection_change", - G_CALLBACK (selection_change), e_select_names); - selection_change (e_table_scrolled_get_table (e_select_names->table), e_select_names); - - /* Select a source for to display initially */ - uid = e_select_names_config_get_last_completion_book (); - if (uid) { - source = e_source_list_peek_source_by_uid (e_select_names->source_list, uid); - g_free (uid); - } - - if (!source) - source = find_first_source (e_select_names->source_list); - - /* FIXME What if we still can't find a source? */ - e_source_option_menu_select (E_SOURCE_OPTION_MENU (esom), source); - -} - -static void e_select_names_child_free(char *key, ESelectNamesChild *child, ESelectNames *e_select_names) -{ - g_signal_handler_disconnect(child->source, child->changed_id); - - g_free(child->title); - g_object_unref(child->table_model); - g_object_unref(child->source); - g_free(key); - g_free(child); -} - -static void -e_select_names_dispose (GObject *object) -{ - ESelectNames *e_select_names = E_SELECT_NAMES(object); - - if (e_select_names->source_list) { - g_object_unref (e_select_names->source_list); - e_select_names->source_list = NULL; - } - - if (e_select_names->status_id) { - g_signal_handler_disconnect(e_select_names->model, e_select_names->status_id); - e_select_names->status_id = 0; - } - - if (e_select_names->search_id) { - g_signal_handler_disconnect(e_select_names->model, e_select_names->search_id); - e_select_names->search_id = 0; - } - - if (e_select_names->gui) { - g_object_unref(e_select_names->gui); - e_select_names->gui = NULL; - } - - if (e_select_names->children) { - g_hash_table_foreach(e_select_names->children, (GHFunc) e_select_names_child_free, e_select_names); - g_hash_table_destroy(e_select_names->children); - e_select_names->children = NULL; - } - - if (e_select_names->without) { - g_object_unref(e_select_names->without); - e_select_names->without = NULL; - } - if (e_select_names->adapter) { - g_object_unref(e_select_names->adapter); - e_select_names->adapter = NULL; - } - if (e_select_names->model) { - g_object_unref(e_select_names->model); - e_select_names->model = NULL; - } - - if (e_select_names->def) { - g_free(e_select_names->def); - e_select_names->def = NULL; - } - - if (G_OBJECT_CLASS(parent_class)->dispose) - G_OBJECT_CLASS(parent_class)->dispose(object); -} - -GtkWidget* -e_select_names_new (void) -{ - ESelectNames *e_select_names; - - e_select_names = g_object_new (E_TYPE_SELECT_NAMES, NULL); - - return GTK_WIDGET (e_select_names); -} - -static void -button_clicked(GtkWidget *button, ESelectNamesChild *child) -{ - real_add_address(child->names, child); -} - -static void -remove_address(ETable *table, int row, int col, GdkEvent *event, ESelectNamesChild *child) -{ - e_select_names_model_delete (child->source, row); -} - -struct _RightClickData { - ESelectNamesChild *child; - int row; -}; -typedef struct _RightClickData RightClickData; - -static void -remove_cb (GtkWidget *widget, void *data) -{ - RightClickData *rcdata = (RightClickData *)data; - - e_select_names_model_delete (rcdata->child->source, rcdata->row); - - /* Free everything we've created */ - g_free (rcdata); -} - -static void -section_right_click_cb (ETable *et, int row, int col, GdkEvent *ev, ESelectNamesChild *child) -{ - static EPopupMenu right_click_menu[] = { - E_POPUP_ITEM (N_("Remove"), G_CALLBACK (remove_cb), 0), - E_POPUP_TERMINATOR - }; - RightClickData *rcdata = g_new0 (RightClickData, 1); - - rcdata->row = row; - rcdata->child = child; - - e_popup_menu_run (right_click_menu, (GdkEvent *)ev, 0, 0, rcdata); -} - -void -e_select_names_add_section (ESelectNames *e_select_names, - const char *name, const char *id, - ESelectNamesModel *source) -{ - ESelectNamesChild *child; - GtkWidget *button; - GtkWidget *label; - GtkWidget *alignment; - GtkTable *table; - char *label_text; - ETable *etable; - ETableExtras *extras; - ECell *string_cell; - - GtkWidget *sw; - - if (g_hash_table_lookup(e_select_names->children, id)) { - return; - } - - table = GTK_TABLE(glade_xml_get_widget (e_select_names->gui, "table-recipients")); - - child = g_new(ESelectNamesChild, 1); - - child->names = e_select_names; - child->title = g_strdup (_(name)); - - child->table_model = (ESelectNamesTableModel*)e_select_names_table_model_new (source); - - child->source = source; - g_object_ref(child->source); - - e_select_names->child_count++; - - alignment = gtk_alignment_new(0, 0, 1, 0); - - label_text = g_strconcat (child->title, " ->", NULL); - - label = gtk_label_new (""); - - gtk_label_set_markup (GTK_LABEL(label), label_text); - - g_free (label_text); - - button = gtk_button_new (); - gtk_container_add (GTK_CONTAINER (button), label); - child->label = label; - child->button = button; - - gtk_container_add(GTK_CONTAINER(alignment), button); - gtk_widget_show_all(alignment); - g_signal_connect(button, "clicked", - G_CALLBACK(button_clicked), child); - gtk_table_attach(table, alignment, - 0, 1, - e_select_names->child_count, - e_select_names->child_count + 1, - GTK_FILL, GTK_FILL, - 0, 0); - - etable = e_table_scrolled_get_table (e_select_names->table); - gtk_widget_set_sensitive (button, e_table_selected_count (etable) > 0); - - extras = e_table_extras_new (); - string_cell = e_table_extras_get_cell (extras, "string"); - - g_object_set (string_cell, - "underline_column", 2, - NULL); - - sw = e_table_scrolled_new_from_spec_file (E_TABLE_MODEL (child->table_model), - extras, - EVOLUTION_ETSPECDIR "/e-select-names-section.etspec", - NULL); - g_object_unref (extras); - - child->recipient_table = GTK_WIDGET (e_table_scrolled_get_table (E_TABLE_SCROLLED (sw))); - - g_signal_connect (child->recipient_table, - "right_click", - G_CALLBACK (section_right_click_cb), - child); - - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - - g_signal_connect(child->recipient_table, "double_click", - G_CALLBACK(remove_address), child); - - child->changed_id = g_signal_connect (child->source, - "changed", - G_CALLBACK (sync_table_and_models), - e_select_names); - - gtk_widget_show_all (sw); - - gtk_table_attach(table, sw, - 1, 2, - e_select_names->child_count, - e_select_names->child_count + 1, - GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, - 0, 0); - - g_hash_table_insert(e_select_names->children, g_strdup(id), child); - - sync_table_and_models (child->source, e_select_names); -} - -void -e_select_names_set_default (ESelectNames *e_select_names, - const char *id) -{ - ESelectNamesChild *child; - - if (e_select_names->def) { - child = g_hash_table_lookup(e_select_names->children, e_select_names->def); - if (child) { - GtkWidget *label = child->label; - - /* set the previous default to non-bold */ - gtk_label_set_markup (GTK_LABEL (label), child->title); - } - } - - g_free(e_select_names->def); - e_select_names->def = g_strdup(id); - - if (e_select_names->def) { - child = g_hash_table_lookup(e_select_names->children, e_select_names->def); - if (child) { - GtkWidget *label = child->label; - char *markup = g_strconcat ("<b>", child->title, "</b>", NULL); - - /* set the new default to bold */ - gtk_label_set_markup (GTK_LABEL (label), markup); - g_free (markup); - } - } -} diff --git a/addressbook/gui/component/select-names/e-select-names.etspec b/addressbook/gui/component/select-names/e-select-names.etspec deleted file mode 100644 index 7a260887ff..0000000000 --- a/addressbook/gui/component/select-names/e-select-names.etspec +++ /dev/null @@ -1,7 +0,0 @@ -<ETableSpecification no-headers="true" cursor-mode="line"> - <ETableColumn model_col= "69" _title="Name" expansion="1.0" minimum_width="20" resizable="true" cell="string" compare="collate" search="string"/> - <ETableState> - <column source="0"/> - <grouping> <leaf column="0" ascending="true"/> </grouping> - </ETableState> -</ETableSpecification> diff --git a/addressbook/gui/component/select-names/e-select-names.h b/addressbook/gui/component/select-names/e-select-names.h deleted file mode 100644 index e927932d13..0000000000 --- a/addressbook/gui/component/select-names/e-select-names.h +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-select-names.h - * Copyright (C) 2000 Ximian, Inc. - * Author: Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_SELECT_NAMES_H__ -#define __E_SELECT_NAMES_H__ - -#include <glib.h> -#include <gtk/gtkwidget.h> -#include <gtk/gtkdialog.h> -#include <glade/glade.h> -#include <gal/e-table/e-table.h> -#include <gal/e-table/e-table-scrolled.h> -#include <libedataserver/e-source-list.h> -#include <widgets/misc/e-source-option-menu.h> - -#include "e-addressbook-model.h" - -#include "e-select-names-model.h" - -G_BEGIN_DECLS - -/* ESelectNames - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - */ - -#define E_TYPE_SELECT_NAMES (e_select_names_get_type ()) -#define E_SELECT_NAMES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SELECT_NAMES, ESelectNames)) -#define E_SELECT_NAMES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES, ESelectNamesClass)) -#define E_IS_SELECT_NAMES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SELECT_NAMES)) -#define E_IS_SELECT_NAMES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_SELECT_NAMES)) - -typedef struct _ESelectNames ESelectNames; -typedef struct _ESelectNamesClass ESelectNamesClass; -typedef struct _ESelectNamesFolder ESelectNamesFolder; - -struct _ESelectNames -{ - GtkDialog parent; - - ESourceList *source_list; - - /* item specific fields */ - GladeXML *gui; - - GHashTable *children; /* Of type char * to ESelectNamesChild */ - int child_count; - ETableScrolled *table; - ETableModel *adapter; - ETableModel *without; - EABModel *model; - GtkWidget *categories; - GtkWidget *select_entry; - GtkWidget *status_message; - char *def; - ESelectNamesFolder *current_folder; - - /* signal handlers */ - gulong status_id; - gulong search_id; -}; - -struct _ESelectNamesClass -{ - GtkDialogClass parent_class; -}; - - -GType e_select_names_get_type (void); - -GtkWidget *e_select_names_new (void); - -void e_select_names_add_section (ESelectNames *e_select_names, - const char *name, - const char *id, - ESelectNamesModel *source); -void e_select_names_set_default (ESelectNames *e_select_names, - const char *id); - -G_END_DECLS - -#endif /* __E_SELECT_NAMES_H__ */ diff --git a/addressbook/gui/component/select-names/recipient.glade b/addressbook/gui/component/select-names/recipient.glade deleted file mode 100644 index edcf6bbab0..0000000000 --- a/addressbook/gui/component/select-names/recipient.glade +++ /dev/null @@ -1,45 +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="GtkWindow" id="window1"> - <property name="visible">no</property> - <property name="title" translatable="yes">window1</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="modal">no</property> - <property name="allow_shrink">no</property> - <property name="allow_grow">yes</property> - <property name="window-position">GTK_WIN_POS_NONE</property> - - <child> - <widget class="GtkHBox" id="hbox-top"> - <property name="homogeneous">no</property> - <property name="spacing">4</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkAlignment" id="alignment1"> - <property name="xalign">1.08033e-07</property> - <property name="yalign">0</property> - <property name="xscale">1</property> - <property name="yscale">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="text-button"> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">-></property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - </child> - </widget> -</glade-interface> diff --git a/addressbook/gui/component/select-names/select-names.glade b/addressbook/gui/component/select-names/select-names.glade deleted file mode 100644 index bf63b9dfa4..0000000000 --- a/addressbook/gui/component/select-names/select-names.glade +++ /dev/null @@ -1,435 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> -<requires lib="gnome"/> - -<widget class="GtkDialog" id="dialog-top"> - <property name="border_width">12</property> - <property name="title" translatable="yes">Select Names</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="default_width">417</property> - <property name="default_height">332</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="has_separator">True</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="dialog-vbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="dialog-action_area1"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - - <child> - <widget class="GtkButton" id="button4"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="response_id">0</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button5"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="response_id">0</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table-top"> - <property name="visible">True</property> - <property name="n_rows">3</property> - <property name="n_columns">1</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkHSeparator" id="hseparator1"> - <property name="visible">True</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"></property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox5"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkTable" id="table4"> - <property name="visible">True</property> - <property name="n_rows">2</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">3</property> - - <child> - <widget class="GtkLabel" id="label32"> - <property name="visible">True</property> - <property name="label" translatable="yes">Type a name into the entry, or -select one from the list below:</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table-recipients"> - <property name="visible">True</property> - <property name="n_rows">1</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkLabel" id="label20"> - <property name="visible">True</property> - <property name="label" translatable="yes">Selected Contacts:</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">True</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment4"> - <property name="visible">True</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - - <child> - <widget class="GtkVBox" id="vbox6"> - <property name="border_width">3</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkHBox" id="hbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkEntry" id="entry-select"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="button-find"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Find</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment3"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - - <child> - <widget class="Custom" id="table-source"> - <property name="visible">True</property> - <property name="creation_function">e_addressbook_create_ebook_table</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Sat, 10 Jun 2000 22:02:57 GMT</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> - </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> - </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="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> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="status-message"> - <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">3</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">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkFrame" id="frame1"> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> - <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property> - - <child> - <widget class="GtkTable" id="show_contacts_table"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="n_rows">2</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkLabel" id="label30"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Folder:</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> - </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="label31"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Category:</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> - </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="GtkAlignment" id="alignment5"> - <property name="visible">True</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - - <child> - <widget class="Custom" id="custom-categories"> - <property name="visible">True</property> - <property name="creation_function">e_select_names_create_categories</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Tue, 19 Feb 2002 23:06:24 GMT</property> - </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="y_options">fill</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="label" translatable="yes">Show Contacts</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">label_item</property> - </packing> - </child> - </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="y_options"></property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> |