diff options
Diffstat (limited to 'addressbook/gui')
130 files changed, 0 insertions, 42857 deletions
diff --git a/addressbook/gui/.cvsignore b/addressbook/gui/.cvsignore deleted file mode 100644 index 09980ae6ba..0000000000 --- a/addressbook/gui/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la diff --git a/addressbook/gui/Makefile.am b/addressbook/gui/Makefile.am deleted file mode 100644 index 6b0850da5d..0000000000 --- a/addressbook/gui/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = contact-editor contact-list-editor merging widgets search component diff --git a/addressbook/gui/component/.cvsignore b/addressbook/gui/component/.cvsignore deleted file mode 100644 index 7f76d480fb..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 384f89b40d..0000000000 --- a/addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in +++ /dev/null @@ -1,125 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_Factory" - 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="description" type="string" - _value="Factory for the controls exported by the Evolution Addressbook"/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_MiniCard_Control" - type="factory" - location="OAFIID:GNOME_Evolution_Addressbook_Factory"> - - <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 minicard viewer"/> - <oaf_attribute name="description" type="string" - _value="Control that displays an Evolution addressbook minicard."/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_Control" - type="factory" - location="OAFIID:GNOME_Evolution_Addressbook_Factory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:BonoboControl/addressbook-control:1.0"/> - <item value="IDL:GNOME/Control:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="A sample Bonobo control which displays an addressbook."/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_ShellComponent" - type="factory" - location="OAFIID:GNOME_Evolution_Addressbook_Factory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Evolution/ShellComponent:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Evolution component for handling contacts."/> - - <oaf_attribute name="evolution:shell_component_icon" type="string" - value="evolution-contacts.png"/> - <oaf_attribute name="evolution:shell_component_launch_order" type="number" - value="2"/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_AddressWidget" - type="factory" - location="OAFIID:GNOME_Evolution_Addressbook_Factory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:BonoboControl/address-widget:1.0"/> - <item value="IDL:GNOME/Control:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="A Bonobo control for displaying an address."/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_AddressPopup" - type="factory" - location="OAFIID:GNOME_Evolution_Addressbook_Factory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:BonoboControl/address-widget:1.0"/> - <item value="IDL:GNOME/Control:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="A Bonobo control for an address popup."/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_LDAPStorage_ConfigControl" - type="factory" - location="OAFIID:GNOME_Evolution_Addressbook_Factory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Evolution/ConfigControl:1.0"/> - </oaf_attribute> - - <oaf_attribute name="evolution:config_item:title" type="string" - _value="Directory Servers"/> - - <oaf_attribute name="evolution:config_item:description" type="string" - _value="Configure access to LDAP directory servers here"/> - - <oaf_attribute name="evolution:config_item:icon_name" type="string" - value="ldap-settings.png"/> - - <oaf_attribute name="evolution:config_item:type" type="stringv"> - <item value="contacts/ldap"/> - </oaf_attribute> - - <oaf_attribute name="evolution:config_item:priority" type="string" value="-6"/> - - <oaf_attribute name="description" type="string" - _value="Configuration control for the Evolution Addressbook Storages."/> - -</oaf_server> - -</oaf_info> diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am deleted file mode 100644 index 7aa28859b4..0000000000 --- a/addressbook/gui/component/Makefile.am +++ /dev/null @@ -1,121 +0,0 @@ -SUBDIRS = select-names - -INCLUDES = \ - -DG_LOG_DOMAIN=\"evolution-addressbook\" \ - -DPREFIX=\"$(prefix)\" \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DDATADIR=\"$(datadir)\" \ - -DLIBDIR=\"$(libdir)\" \ - -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/minicard \ - -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_ICONSDIR=\""$(iconsdir)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ - -DCAMEL_PROVIDERDIR=\""$(providerdir)"\" \ - -DEVOLUTION_IMAGESDIR=\""$(datadir)"/evolution/images\" \ - $(LDAP_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ - -DGTK_DISABLE_DEPRECATED \ - -DLIBGNOME_DISABLE_DEPRECATED \ - -DLIBGNOMEUI_DISABLE_DEPRECATED \ - $(EVOLUTION_ADDRESSBOOK_CFLAGS) - -componentdir = $(COMPONENT_DIR) -component_LTLIBRARIES = libevolution-addressbook.la - -libevolution_addressbook_la_SOURCES = \ - addressbook-component.c \ - addressbook-component.h \ - addressbook-config.c \ - addressbook-config.h \ - addressbook-storage.c \ - addressbook-storage.h \ - addressbook.c \ - addressbook.h \ - component-factory.c \ - e-cardlist-model.c \ - e-cardlist-model.h \ - e-address-widget.h \ - e-address-widget.c \ - e-address-popup.h \ - e-address-popup.c - -libevolution_addressbook_la_LIBADD = \ - select-names/libeselectnames.la \ - $(top_builddir)/shell/libeshell.la \ - $(top_builddir)/addressbook/gui/widgets/libeminicard.a \ - $(top_builddir)/addressbook/printing/libecontactprint.a \ - $(top_builddir)/addressbook/gui/search/libeaddressbooksearch.a \ - $(top_builddir)/filter/libfilter.la \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/camel/libcamel.la \ - $(top_builddir)/e-util/ename/libename.la \ - $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.a \ - $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.a \ - $(top_builddir)/libversit/libversit.a \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/addressbook/gui/merging/libecardmerging.a \ - $(top_builddir)/e-util/libeutil.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_DATA = apps_evolution_addressbook.schemas - -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 - -serverdir = $(libdir)/bonobo/servers -server_DATA = $(server_in_files:.server.in.in=.server) -$(server_in_files:.server.in.in=.server.in): $(server_in_files) - sed -e "s|\@COMPONENTDIR\@|$(componentdir)|" $< > $@ - -@INTLTOOL_SERVER_RULE@ - -gladedir = $(datadir)/evolution/glade -glade_DATA = ldap-config.glade - -iconsdir = $(datadir)/evolution/images - -etspecdir = $(datadir)/evolution/etspec -etspec_DATA = addressbook-config.etspec - -EXTRA_DIST = \ - $(glade_DATA) \ - $(server_DATA) \ - $(server_in_files) \ - $(etspec_DATA) - -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 1d9371fdc8..0000000000 --- a/addressbook/gui/component/addressbook-component.c +++ /dev/null @@ -1,630 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* addressbook-component.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 <libgnomevfs/gnome-vfs-types.h> -#include <libgnomevfs/gnome-vfs-uri.h> -#include <libgnomevfs/gnome-vfs-ops.h> -#include <libgnomevfs/gnome-vfs-directory.h> -#include <libgnomevfs/gnome-vfs-file-info.h> - -#include <sys/types.h> -#include <sys/stat.h> -#include <errno.h> -#include <string.h> -#include <unistd.h> - -#include <bonobo/bonobo-generic-factory.h> -#include <bonobo/bonobo-main.h> - -#include "evolution-shell-component.h" -#include "evolution-shell-component-dnd.h" -#include "evolution-storage.h" -#include "e-folder-list.h" - -#include "ebook/e-book.h" -#include "ebook/e-card.h" -#include "ebook/e-book-util.h" - -#include "addressbook-config.h" -#include "addressbook-storage.h" -#include "addressbook-component.h" -#include "addressbook.h" -#include "addressbook/gui/merging/e-card-merging.h" -#include "addressbook/gui/widgets/e-addressbook-util.h" - - - -#define GNOME_EVOLUTION_ADDRESSBOOK_COMPONENT_ID "OAFIID:GNOME_Evolution_Addressbook_ShellComponent" - -EvolutionShellClient *global_shell_client = NULL; - -EvolutionShellClient * -addressbook_component_get_shell_client (void) -{ - return global_shell_client; -} - -static char *accepted_dnd_types[] = { - "text/x-vcard", - NULL -}; - -static const EvolutionShellComponentFolderType folder_types[] = { - { "contacts", "evolution-contacts.png", N_("Contacts"), N_("Folder containing contact information"), - TRUE, accepted_dnd_types, NULL }, - { "contacts/ldap", "ldap.png", N_("LDAP Server"), N_("LDAP server containing contact information"), - FALSE, accepted_dnd_types, NULL }, - { "contacts/public", "evolution-contacts.png", N_("Public Contacts"), N_("Public folder containing contact information"), - FALSE, accepted_dnd_types, NULL }, - { NULL } -}; - -#define IS_CONTACT_TYPE(x) (g_strcasecmp((x), "contacts") == 0 || g_strcasecmp ((x), "contacts/ldap") == 0 || g_strcasecmp((x), "contacts/public") == 0) - -/* EvolutionShellComponent methods and signals. */ - -static EvolutionShellComponentResult -create_view (EvolutionShellComponent *shell_component, - const char *physical_uri, - const char *type, - const char *view_info, - BonoboControl **control_return, - void *closure) -{ - BonoboControl *control; - - if (!IS_CONTACT_TYPE (type)) - return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE; - - control = addressbook_new_control (); - bonobo_control_set_property (control, NULL, "folder_uri", TC_CORBA_string, physical_uri, NULL); - - *control_return = control; - - return EVOLUTION_SHELL_COMPONENT_OK; -} - -static void -create_folder (EvolutionShellComponent *shell_component, - const char *physical_uri, - const char *type, - const GNOME_Evolution_ShellComponentListener listener, - void *closure) -{ - CORBA_Environment ev; - GNOME_Evolution_ShellComponentListener_Result result; - - if (!IS_CONTACT_TYPE (type)) - result = GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE; - else - result = GNOME_Evolution_ShellComponentListener_OK; - - CORBA_exception_init(&ev); - GNOME_Evolution_ShellComponentListener_notifyResult(listener, result, &ev); - CORBA_exception_free(&ev); -} - -static void -remove_folder (EvolutionShellComponent *shell_component, - const char *physical_uri, - const char *type, - const GNOME_Evolution_ShellComponentListener listener, - void *closure) -{ - CORBA_Environment ev; - char *addressbook_db_path, *subdir_path; - struct stat sb; - int rv; - - CORBA_exception_init(&ev); - - if (!IS_CONTACT_TYPE (type)) { - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, - &ev); - CORBA_exception_free(&ev); - return; - } - - if (!strncmp (physical_uri, "ldap://", 7)) { - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_UNSUPPORTED_OPERATION, - &ev); - CORBA_exception_free(&ev); - return; - } - if (strncmp (physical_uri, "file://", 7)) { - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_INVALID_URI, - &ev); - CORBA_exception_free(&ev); - return; - } - - subdir_path = g_build_filename (physical_uri + 7, "subfolders", NULL); - rv = stat (subdir_path, &sb); - g_free (subdir_path); - if (rv != -1) { - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_HAS_SUBFOLDERS, - &ev); - CORBA_exception_free(&ev); - return; - } - - addressbook_db_path = g_build_filename (physical_uri + 7, "addressbook.db", NULL); - rv = unlink (addressbook_db_path); - g_free (addressbook_db_path); - if (rv == 0) { - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_OK, - &ev); - } - else { - if (errno == EACCES || errno == EPERM) - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED, - &ev); - else - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_INVALID_URI, /*XXX*/ - &ev); - } - CORBA_exception_free(&ev); -} - -/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */ - -/* This code is cut & pasted from calendar/gui/component-factory.c */ - -static GNOME_Evolution_ShellComponentListener_Result -xfer_file (GnomeVFSURI *base_src_uri, - GnomeVFSURI *base_dest_uri, - const char *file_name, - int remove_source) -{ - GnomeVFSURI *src_uri, *dest_uri; - GnomeVFSHandle *hin, *hout; - GnomeVFSResult result; - GnomeVFSFileInfo file_info; - GnomeVFSFileSize size; - char *buffer; - - src_uri = gnome_vfs_uri_append_file_name (base_src_uri, file_name); - - result = gnome_vfs_open_uri (&hin, src_uri, GNOME_VFS_OPEN_READ); - if (result == GNOME_VFS_ERROR_NOT_FOUND) { - gnome_vfs_uri_unref (src_uri); - return GNOME_Evolution_ShellComponentListener_OK; /* No need to xfer anything. */ - } - if (result != GNOME_VFS_OK) { - gnome_vfs_uri_unref (src_uri); - return GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED; - } - - result = gnome_vfs_get_file_info_uri (src_uri, &file_info, GNOME_VFS_FILE_INFO_DEFAULT); - if (result != GNOME_VFS_OK) { - gnome_vfs_uri_unref (src_uri); - return GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED; - } - - dest_uri = gnome_vfs_uri_append_file_name (base_dest_uri, file_name); - - result = gnome_vfs_create_uri (&hout, dest_uri, GNOME_VFS_OPEN_WRITE, FALSE, 0600); - if (result != GNOME_VFS_OK) { - gnome_vfs_close (hin); - gnome_vfs_uri_unref (src_uri); - gnome_vfs_uri_unref (dest_uri); - return GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED; - } - - /* write source file to destination file */ - buffer = g_malloc (file_info.size); - result = gnome_vfs_read (hin, buffer, file_info.size, &size); - if (result != GNOME_VFS_OK) { - gnome_vfs_close (hin); - gnome_vfs_close (hout); - gnome_vfs_uri_unref (src_uri); - gnome_vfs_uri_unref (dest_uri); - g_free (buffer); - return GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED; - } - - result = gnome_vfs_write (hout, buffer, file_info.size, &size); - if (result != GNOME_VFS_OK) { - gnome_vfs_close (hin); - gnome_vfs_close (hout); - gnome_vfs_uri_unref (src_uri); - gnome_vfs_uri_unref (dest_uri); - g_free (buffer); - return GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED; - } - - if (remove_source) { - char *text_uri; - - /* Sigh, we have to do this as there is no gnome_vfs_unlink_uri(). :-( */ - - text_uri = gnome_vfs_uri_to_string (src_uri, GNOME_VFS_URI_HIDE_NONE); - result = gnome_vfs_unlink (text_uri); - g_free (text_uri); - } - - gnome_vfs_close (hin); - gnome_vfs_close (hout); - gnome_vfs_uri_unref (src_uri); - gnome_vfs_uri_unref (dest_uri); - g_free (buffer); - - return GNOME_Evolution_ShellComponentListener_OK; -} - -static void -xfer_folder (EvolutionShellComponent *shell_component, - const char *source_physical_uri, - const char *destination_physical_uri, - const char *type, - gboolean remove_source, - const GNOME_Evolution_ShellComponentListener listener, - void *closure) -{ - CORBA_Environment ev; - - GnomeVFSURI *src_uri; - GnomeVFSURI *dest_uri; - GnomeVFSResult result; - - CORBA_exception_init (&ev); - - if (!IS_CONTACT_TYPE (type)) { - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, - &ev); - CORBA_exception_free(&ev); - return; - } - - if (!strncmp (source_physical_uri, "ldap://", 7) - || !strncmp (destination_physical_uri, "ldap://", 7)) { - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_UNSUPPORTED_OPERATION, - &ev); - CORBA_exception_free(&ev); - return; - } - - if (strncmp (source_physical_uri, "file://", 7) - || strncmp (destination_physical_uri, "file://", 7)) { - GNOME_Evolution_ShellComponentListener_notifyResult (listener, - GNOME_Evolution_ShellComponentListener_INVALID_URI, - &ev); - CORBA_exception_free(&ev); - return; - } - - /* check URIs */ - src_uri = gnome_vfs_uri_new (source_physical_uri); - dest_uri = gnome_vfs_uri_new (destination_physical_uri); - if (!src_uri || ! dest_uri) { - GNOME_Evolution_ShellComponentListener_notifyResult ( - listener, - GNOME_Evolution_ShellComponentListener_INVALID_URI, - &ev); - gnome_vfs_uri_unref (src_uri); - gnome_vfs_uri_unref (dest_uri); - CORBA_exception_free (&ev); - return; - } - - result = xfer_file (src_uri, dest_uri, "addressbook.db", remove_source); - - GNOME_Evolution_ShellComponentListener_notifyResult (listener, result, &ev); - - gnome_vfs_uri_unref (src_uri); - gnome_vfs_uri_unref (dest_uri); - - CORBA_exception_free (&ev); -} - -static char* -get_dnd_selection (EvolutionShellComponent *shell_component, - const char *physical_uri, - int type, - int *format_return, - const char **selection_return, - int *selection_length_return, - void *closure) -{ - /* g_print ("should get dnd selection for %s\n", physical_uri); */ - return NULL; -} - -static int owner_count = 0; - -static void -owner_set_cb (EvolutionShellComponent *shell_component, - EvolutionShellClient *shell_client, - const char *evolution_homedir, - gpointer user_data) -{ - owner_count ++; - - if (global_shell_client == NULL) - global_shell_client = shell_client; - - addressbook_storage_setup (shell_component, evolution_homedir); -} - -static gboolean -bonobo_main_quit_cb (gpointer closure) -{ - bonobo_main_quit (); - return TRUE; -} - -static void -owner_unset_cb (EvolutionShellComponent *shell_component, - GNOME_Evolution_Shell shell_interface, - gpointer user_data) -{ - owner_count --; - if (owner_count == 0) { - g_idle_add (bonobo_main_quit_cb, NULL); - } -} - -/* FIXME We should perhaps take the time to figure out if the book is editable. */ -static void -new_item_cb (EBook *book, gpointer closure) -{ - gboolean is_list = GPOINTER_TO_INT (closure); - if (book == NULL) - return; - if (is_list) - e_addressbook_show_contact_list_editor (book, e_card_new(""), TRUE, TRUE); - else - e_addressbook_show_contact_editor (book, e_card_new(""), TRUE, TRUE); -} - -static void -user_create_new_item_cb (EvolutionShellComponent *shell_component, - const char *id, - const char *parent_folder_physical_uri, - const char *parent_folder_type, - gpointer data) -{ - gboolean is_contact_list; - if (!strcmp (id, "contact")) { - is_contact_list = FALSE; - } else if (!strcmp (id, "contact_list")) { - is_contact_list = TRUE; - } else { - g_warning ("Don't know how to create item of type \"%s\"", id); - return; - } - if (IS_CONTACT_TYPE (parent_folder_type)) { - e_book_use_address_book_by_uri (parent_folder_physical_uri, - new_item_cb, GINT_TO_POINTER (is_contact_list)); - } else { - e_book_use_default_book (new_item_cb, GINT_TO_POINTER (is_contact_list)); - } -} - - -/* Destination side DnD */ - -static CORBA_boolean -destination_folder_handle_motion (EvolutionShellComponentDndDestinationFolder *folder, - const char *physical_uri, - const char *folder_type, - const GNOME_Evolution_ShellComponentDnd_DestinationFolder_Context * destination_context, - GNOME_Evolution_ShellComponentDnd_Action * suggested_action_return, - gpointer user_data) -{ - *suggested_action_return = GNOME_Evolution_ShellComponentDnd_ACTION_MOVE; - return TRUE; -} - -static void -dnd_drop_book_open_cb (EBook *book, EBookStatus status, GList *card_list) -{ - GList *l; - - for (l = card_list; l; l = l->next) { - ECard *card = l->data; - - e_card_merging_book_add_card (book, card, NULL /* XXX */, NULL); - } -} - -static CORBA_boolean -destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *folder, - const char *physical_uri, - const char *folder_type, - const GNOME_Evolution_ShellComponentDnd_DestinationFolder_Context * destination_context, - const GNOME_Evolution_ShellComponentDnd_Action action, - const GNOME_Evolution_ShellComponentDnd_Data * data, - gpointer user_data) -{ - EBook *book; - GList *card_list; - char *expanded_uri; - - if (action == GNOME_Evolution_ShellComponentDnd_ACTION_LINK) - return FALSE; /* we can't create links in our addressbook format */ - - /* g_print ("in destination_folder_handle_drop (%s)\n", physical_uri); */ - - card_list = e_card_load_cards_from_string_with_default_charset (data->bytes._buffer, "ISO-8859-1"); - - expanded_uri = e_book_expand_uri (physical_uri); - - book = e_book_new (); - addressbook_load_uri (book, expanded_uri, - (EBookCallback)dnd_drop_book_open_cb, card_list); - - g_free (expanded_uri); - - return TRUE; -} - - -/* Quitting. */ - -static gboolean -request_quit (EvolutionShellComponent *shell_component, - void *data) -{ - if (! e_contact_editor_request_close_all () - || ! e_contact_list_editor_request_close_all ()) - return FALSE; - else - return TRUE; -} - - -/* The factory function. */ - -static void -add_creatable_item (EvolutionShellComponent *shell_component, - const char *id, - const char *description, - const char *menu_description, - const char *tooltip, - char menu_shortcut, - const char *icon_name) -{ - char *icon_path; - GdkPixbuf *icon; - - if (icon_name == NULL) { - icon_path = NULL; - icon = NULL; - } else { - icon_path = g_build_filename (EVOLUTION_ICONSDIR, icon_name, NULL); - icon = gdk_pixbuf_new_from_file (icon_path, NULL); - } - - evolution_shell_component_add_user_creatable_item (shell_component, - id, - description, - menu_description, - tooltip, - "contacts", - menu_shortcut, - icon); - - - if (icon != NULL) - gdk_pixbuf_unref (icon); - g_free (icon_path); -} - -static BonoboObject * -create_component (void) -{ - EvolutionShellComponent *shell_component; - EvolutionShellComponentDndDestinationFolder *destination_interface; - - shell_component = evolution_shell_component_new (folder_types, NULL, - create_view, create_folder, - remove_folder, xfer_folder, - NULL, NULL, - get_dnd_selection, - request_quit, - NULL); - - destination_interface = evolution_shell_component_dnd_destination_folder_new (destination_folder_handle_motion, - destination_folder_handle_drop, - shell_component); - - bonobo_object_add_interface (BONOBO_OBJECT (shell_component), - BONOBO_OBJECT (destination_interface)); - - add_creatable_item (shell_component, "contact", - _("New Contact"), _("_Contact"), - _("Create a new contact"), 'c', - "evolution-contacts-mini.png"); - add_creatable_item (shell_component, "contact_list", - _("New Contact List"), _("Contact _List"), - _("Create a new contact list"), 'l', - "contact-list-16.png"); - - g_signal_connect (shell_component, "owner_set", - G_CALLBACK (owner_set_cb), NULL); - g_signal_connect (shell_component, "owner_unset", - G_CALLBACK (owner_unset_cb), NULL); - g_signal_connect (shell_component, "user_create_new_item", - G_CALLBACK (user_create_new_item_cb), NULL); - - return BONOBO_OBJECT (shell_component); -} - -static void -ensure_completion_uris_exist() -{ - /* Initialize the completion uris if they aren't set yet. The - default set is just the local Contacts folder. */ - EConfigListener *db; - char *val; - - db = e_book_get_config_database (); - - val = e_config_listener_get_string (db, "/apps/evolution/addressbook/completion/uris"); - - if (!val) { - EFolderListItem f[2]; - char *dirname, *uri; - /* in the case where the user is running for the first - time, populate the list with the local contact - folder */ - dirname = g_build_filename (g_get_home_dir (), "evolution/local/Contacts", NULL); - uri = g_strdup_printf ("file://%s", dirname); - - f[0].uri = "evolution:/local/Contacts"; - f[0].physical_uri = uri; - f[0].display_name = _("Contacts"); - - memset (&f[1], 0, sizeof (f[1])); - - val = e_folder_list_create_xml (f); - - g_free (dirname); - g_free (uri); - e_config_listener_set_string (db, "/apps/evolution/addressbook/completion/uris", val); - - g_free (val); - } -} - - -/* FIXME this is wrong. */ -BonoboObject * -addressbook_component_init (void) -{ - ensure_completion_uris_exist (); - return create_component (); -} diff --git a/addressbook/gui/component/addressbook-component.h b/addressbook/gui/component/addressbook-component.h deleted file mode 100644 index 4c6f0cdd8b..0000000000 --- a/addressbook/gui/component/addressbook-component.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* addressbook-component.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 _ADDRESSBOOK_COMPONENT_H -#define _ADDRESSBOOK_COMPONENT_H - -#include "evolution-shell-component.h" -#include "evolution-storage.h" - -BonoboObject *addressbook_component_init (void); -EvolutionShellClient *addressbook_component_get_shell_client (void); - -#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 584565fcc4..0000000000 --- a/addressbook/gui/component/addressbook-config.c +++ /dev/null @@ -1,1746 +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*/ -/*#define NEW_ADVANCED_UI*/ - -#include <config.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 "addressbook-storage.h" - -#include "evolution-config-control.h" -#include <shell/e-folder-list.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" -#define LDAP_CONFIG_CONTROL_ID "OAFIID:GNOME_Evolution_LDAPStorage_ConfigControl" - -#ifdef HAVE_LDAP -GtkWidget* addressbook_dialog_create_sources_table (char *name, char *string1, char *string2, - int num1, int num2); -GtkWidget* supported_bases_create_table (char *name, char *string1, char *string2, - int num1, int num2); - -#ifdef NEW_ADVANCED_UI -GtkWidget* objectclasses_create_server_table (char *name, char *string1, char *string2, - int num1, int num2); -GtkWidget* objectclasses_create_evolution_table (char *name, char *string1, char *string2, - int num1, int num2); -#endif - -/* default objectclasses */ -#define TOP "top" -#define PERSON "person" -#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 _AddressbookDialog AddressbookDialog; -typedef struct _AddressbookSourceDialog AddressbookSourceDialog; -typedef void (*ModifyFunc)(GtkWidget *item, AddressbookSourceDialog *dialog); - -struct _AddressbookDialog { - EvolutionConfigControl *config_control; - GtkWidget *page; - - GladeXML *gui; - GNOME_Evolution_Shell shell; - - GtkWidget *sourcesTable; - ETableModel *sourcesModel; - GtkWidget *addSource; - GtkWidget *editSource; - GtkWidget *deleteSource; - -}; - - -struct _AddressbookSourceDialog { - AddressbookDialog *addressbook_dialog; - GladeXML *gui; - - GtkWidget *window; - GtkWidget *druid; /* only used (obviously) in the druid */ - - /* 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; - -#ifdef NEW_ADVANCED_UI - /* objectclasses tab fields */ - GPtrArray *server_objectclasses; /* the objectclasses available on the server */ - GPtrArray *evolution_objectclasses; /* the objectclasses evolution will use */ - GPtrArray *default_objectclasses; /* the objectclasses we default to (actually the - intersection between defaults and server_objectclasses) */ - ModifyFunc objectclasses_modify_func; - GtkWidget *objectclasses_server_table; - ETableModel *objectclasses_server_model; - GtkWidget *objectclasses_evolution_table; - ETableModel *objectclasses_evolution_model; - GtkWidget *objectclasses_add_button; - GtkWidget *objectclasses_remove_button; - - /* refs we keep around so we can add/hide the tabs */ - GtkWidget *objectclasses_tab; - GtkWidget *objectclasses_label; - GtkWidget *mappings_tab; - GtkWidget *mappings_label; - GtkWidget *dn_customization_tab; - GtkWidget *dn_customization_label; -#endif - - /* stuff for the account editor window */ - int source_model_row; - GtkWidget *ok_button; - GtkWidget *apply_button; - GtkWidget *close_button; - GtkWidget *advanced_button_notebook; - GtkWidget *notebook; /* the toplevel notebook */ - - gboolean advanced; - -}; - - -/* ldap api foo */ -static LDAP * -addressbook_ldap_init (GtkWidget *window, AddressbookSource *source) -{ - LDAP *ldap = ldap_init (source->host, atoi(source->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); - - return NULL; - } - - /* XXX do TLS if it's configured in */ - - return ldap; -} - -static int -addressbook_ldap_auth (GtkWidget *window, AddressbookSource *source, LDAP *ldap) -{ - int 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, AddressbookSource *source, 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; -} - - -static AddressbookSource * -addressbook_dialog_get_source (AddressbookSourceDialog *dialog) -{ - AddressbookSource *source = g_new0 (AddressbookSource, 1); - - source->name = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->display_name))); - source->host = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->host))); - source->email_addr = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->email))); - source->binddn = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->binddn))); - source->port = g_strdup (gtk_entry_get_text (GTK_ENTRY (GTK_COMBO(dialog->port_combo)->entry))); - source->rootdn = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->rootdn))); - source->limit = atoi(gtk_entry_get_text (GTK_ENTRY (dialog->limit_spinbutton))); - source->scope = dialog->scope; - source->auth = dialog->auth; - source->ssl = dialog->ssl; - - addressbook_storage_init_source_uri (source); - - return source; -} - -static void -addressbook_source_dialog_set_source (AddressbookSourceDialog *dialog, AddressbookSource *source) -{ - char *string; - gtk_entry_set_text (GTK_ENTRY (dialog->display_name), source ? source->name : ""); - gtk_entry_set_text (GTK_ENTRY (dialog->host), source ? source->host : ""); - gtk_entry_set_text (GTK_ENTRY (dialog->email), source ? source->email_addr : ""); - gtk_entry_set_text (GTK_ENTRY (dialog->binddn), source ? source->binddn : ""); - gtk_entry_set_text (GTK_ENTRY (GTK_COMBO(dialog->port_combo)->entry), source ? source->port : LDAP_PORT_STRING); - gtk_entry_set_text (GTK_ENTRY (dialog->rootdn), source ? source->rootdn : ""); - - string = g_strdup_printf ("%d", source ? source->limit : 100); - gtk_entry_set_text (GTK_ENTRY (dialog->limit_spinbutton), string); - g_free (string); - - dialog->auth = source ? source->auth : ADDRESSBOOK_LDAP_AUTH_NONE; - gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->auth_optionmenu), dialog->auth); - if (dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE) { - gtk_notebook_set_current_page (GTK_NOTEBOOK(dialog->auth_label_notebook), dialog->auth - 1); - gtk_notebook_set_current_page (GTK_NOTEBOOK(dialog->auth_entry_notebook), dialog->auth - 1); - } - gtk_widget_set_sensitive (dialog->auth_label_notebook, dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE); - gtk_widget_set_sensitive (dialog->auth_entry_notebook, dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE); - - dialog->scope = source ? source->scope : ADDRESSBOOK_LDAP_SCOPE_ONELEVEL; - gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->scope_optionmenu), dialog->scope); - - dialog->ssl = source ? source->ssl : ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE; - gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->ssl_optionmenu), dialog->ssl); -} - -static void -addressbook_source_dialog_destroy (gpointer data, GObject *where_object_was) -{ - AddressbookSourceDialog *dialog = data; -#ifdef NEW_ADVANCED_UI -#define IF_UNREF(x) if (x) g_object_unref ((x)) - - int i; - - if (dialog->server_objectclasses) { - for (i = 0; i < dialog->server_objectclasses->len; i ++) - ldap_objectclass_free (g_ptr_array_index (dialog->server_objectclasses, i)); - g_ptr_array_free (dialog->server_objectclasses, TRUE); - } - - if (dialog->evolution_objectclasses) { - for (i = 0; i < dialog->evolution_objectclasses->len; i ++) - ldap_objectclass_free (g_ptr_array_index (dialog->evolution_objectclasses, i)); - g_ptr_array_free (dialog->evolution_objectclasses, TRUE); - } - - if (dialog->default_objectclasses) { - for (i = 0; i < dialog->default_objectclasses->len; i ++) - ldap_objectclass_free (g_ptr_array_index (dialog->default_objectclasses, i)); - g_ptr_array_free (dialog->default_objectclasses, TRUE); - } - - IF_UNREF (dialog->objectclasses_server_model); - IF_UNREF (dialog->objectclasses_evolution_model); - - IF_UNREF (dialog->objectclasses_tab); - IF_UNREF (dialog->objectclasses_label); - IF_UNREF (dialog->mappings_tab); - IF_UNREF (dialog->mappings_label); - IF_UNREF (dialog->dn_customization_tab); - IF_UNREF (dialog->dn_customization_label); - -#undef IF_UNREF -#endif - - gtk_widget_destroy (GTK_WIDGET (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) -{ - AddressbookSource *source = addressbook_dialog_get_source (sdialog); - AddressbookDialog *dialog = sdialog->addressbook_dialog; - - printf ("in finish (%s,%s)\n", source->name, source->host); - - e_table_memory_store_insert (E_TABLE_MEMORY_STORE (dialog->sourcesModel), - -1, source, source->name, source->host); - - evolution_config_control_changed (dialog->config_control); - - /* 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; - - 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); -} - - -/* 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, AddressbookSource *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, source, ldap)) - goto fail; - - attrs[0] = "namingContexts"; - attrs[1] = NULL; - - ldap_error = addressbook_root_dse_query (GTK_WINDOW (dialog), source, 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; - AddressbookSource *source = addressbook_dialog_get_source (sdialog); - GtkWidget *dialog; - GtkWidget *supported_bases_table; - ETableModel *model; - int id; - char **values; - - 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)); - } - - addressbook_source_free (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 */); -} - - -/* 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 -display_name_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_display_name_page_modify_cb (GtkWidget *item, AddressbookSourceDialog *dialog) -{ - dialog->display_name_changed = TRUE; - display_name_page_prepare (NULL, NULL, dialog); -} - - -#ifdef NEW_ADVANCED_UI -/* objectclasses page */ -static ETableMemoryStoreColumnInfo objectclasses_table_columns[] = { - E_TABLE_MEMORY_STORE_STRING, - E_TABLE_MEMORY_STORE_TERMINATOR -}; - -#define OBJECTCLASSES_TABLE_SPEC \ -"<ETableSpecification cursor-mode=\"line\" no-headers=\"true\"> \ - <ETableColumn model_col= \"0\" _title=\"Objectclass\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \ - <ETableState> \ - <column source=\"0\"/> \ - <grouping> <leaf column=\"0\" ascending=\"true\"/> </grouping> \ - </ETableState> \ -</ETableSpecification>" - -GtkWidget* -objectclasses_create_server_table (char *name, char *string1, char *string2, - int num1, int num2) -{ - GtkWidget *table; - ETableModel *model; - - model = e_table_memory_store_new (objectclasses_table_columns); - - table = e_table_scrolled_new (model, NULL, OBJECTCLASSES_TABLE_SPEC, NULL); - - g_object_set_data (G_OBJECT (table), "model", model); - - return table; -} - -GtkWidget* -objectclasses_create_evolution_table (char *name, char *string1, char *string2, - int num1, int num2) -{ - GtkWidget *table; - ETableModel *model; - - model = e_table_memory_store_new (objectclasses_table_columns); - - table = e_table_scrolled_new (model, NULL, OBJECTCLASSES_TABLE_SPEC, NULL); - - g_object_set_data (G_OBJECT (table), "model", model); - - return table; -} - -static void -objectclasses_add_foreach (int model_row, AddressbookSourceDialog *dialog) -{ - LDAPObjectClass *oc = e_table_memory_get_data (E_TABLE_MEMORY (dialog->objectclasses_server_model), model_row); - e_table_memory_store_remove (E_TABLE_MEMORY_STORE (dialog->objectclasses_server_model), model_row); - /* XXX remove from the server array */ - e_table_memory_store_insert (E_TABLE_MEMORY_STORE (dialog->objectclasses_evolution_model), - -1, oc, oc->oc_names[0]); - /* XXX add to the evolution array */ -} - -static void -objectclasses_add (GtkWidget *item, AddressbookSourceDialog *dialog) -{ - ESelectionModel *esm = e_table_get_selection_model (e_table_scrolled_get_table (E_TABLE_SCROLLED(dialog->objectclasses_server_table))); - - e_selection_model_foreach (esm, (EForeachFunc)objectclasses_add_foreach, dialog); - dialog->objectclasses_modify_func (item, dialog); -} - -static void -objectclasses_server_double_click (ETable *et, int row, int col, GdkEvent *event, AddressbookSourceDialog *dialog) -{ - objectclasses_add_foreach (row, dialog); - dialog->objectclasses_modify_func (GTK_WIDGET (et), dialog); -} - -static void -objectclasses_remove_foreach (int model_row, AddressbookSourceDialog *dialog) -{ - LDAPObjectClass *oc = e_table_memory_get_data (E_TABLE_MEMORY (dialog->objectclasses_evolution_model), model_row); - e_table_memory_store_remove (E_TABLE_MEMORY_STORE (dialog->objectclasses_evolution_model), model_row); - /* XXX remove from the evolution array */ - e_table_memory_store_insert (E_TABLE_MEMORY_STORE (dialog->objectclasses_server_model), - -1, oc, oc->oc_names[0]); - /* XXX add to the server array */ -} - -static void -objectclasses_remove (GtkWidget *item, AddressbookSourceDialog *dialog) -{ - ESelectionModel *esm = e_table_get_selection_model (e_table_scrolled_get_table (E_TABLE_SCROLLED(dialog->objectclasses_evolution_table))); - - e_selection_model_foreach (esm, (EForeachFunc)objectclasses_add_foreach, dialog); - - dialog->objectclasses_modify_func (item, dialog); -} - -static void -objectclasses_evolution_double_click (ETable *et, int row, int col, GdkEvent *event, AddressbookSourceDialog *dialog) -{ - objectclasses_remove_foreach (row, dialog); - dialog->objectclasses_modify_func (GTK_WIDGET (et), dialog); -} - -static void -objectclasses_restore_default (GtkWidget *item, AddressbookSourceDialog *dialog) -{ - int i; - - dialog->objectclasses_modify_func (item, dialog); - - /* clear out our evolution list */ - for (i = 0; i < dialog->evolution_objectclasses->len; i ++) { - g_ptr_array_add (dialog->server_objectclasses, g_ptr_array_index (dialog->evolution_objectclasses, i)); - } - g_ptr_array_set_size (dialog->evolution_objectclasses, 0); - - e_table_memory_store_clear (E_TABLE_MEMORY_STORE (dialog->objectclasses_evolution_model)); - - for (i = 0; i < dialog->default_objectclasses->len; i++) { - LDAPObjectClass *oc = g_ptr_array_index (dialog->default_objectclasses, i); - g_ptr_array_add (dialog->evolution_objectclasses, oc); - e_table_memory_store_insert (E_TABLE_MEMORY_STORE (dialog->objectclasses_evolution_model), - i, oc, oc->oc_names[0]); - } -} - -static void -server_selection_model_changed (ESelectionModel *selection_model, AddressbookSourceDialog *dialog) -{ - gtk_widget_set_sensitive (dialog->objectclasses_add_button, - e_selection_model_selected_count (selection_model) > 0); -} - -static void -evolution_selection_model_changed (ESelectionModel *selection_model, AddressbookSourceDialog *dialog) -{ - gtk_widget_set_sensitive (dialog->objectclasses_remove_button, - e_selection_model_selected_count (selection_model) > 0); -} - -static void -setup_objectclasses_tab (AddressbookSourceDialog *dialog, GtkSignalFunc modify_func) -{ - ETable *table; - GtkWidget *restore_default; - ESelectionModel *esm; - - dialog->server_objectclasses = g_ptr_array_new (); - dialog->evolution_objectclasses = g_ptr_array_new (); - dialog->default_objectclasses = g_ptr_array_new (); - - dialog->objectclasses_modify_func = modify_func; - - dialog->objectclasses_server_table = glade_xml_get_widget (dialog->gui, "objectclasses-server-table"); - dialog->objectclasses_server_model = g_object_get_data (G_OBJECT (dialog->objectclasses_server_table), "model"); - - dialog->objectclasses_evolution_table = glade_xml_get_widget (dialog->gui, "objectclasses-evolution-table"); - dialog->objectclasses_evolution_model = g_object_get_data (G_OBJECT (dialog->objectclasses_evolution_table), "model"); - - table = e_table_scrolled_get_table (E_TABLE_SCROLLED(dialog->objectclasses_server_table)); - g_signal_connect (table, "double_click", - G_CALLBACK (objectclasses_server_double_click), dialog); - esm = e_table_get_selection_model (table); - g_signal_connect (esm, "selection_changed", - server_selection_model_changed, dialog); - - table = e_table_scrolled_get_table (E_TABLE_SCROLLED(dialog->objectclasses_evolution_table)); - g_signal_connect (table, "double_click", - G_CALLBACK (objectclasses_evolution_double_click), dialog); - esm = e_table_get_selection_model (table); - g_signal_connect (esm, "selection_changed", - evolution_selection_model_changed, dialog); - - dialog->objectclasses_add_button = glade_xml_get_widget (dialog->gui, "objectclasses-add-button"); - g_signal_connect (dialog->objectclasses_add_button, "clicked", - G_CALLBACK(objectclasses_add), dialog); - - dialog->objectclasses_remove_button = glade_xml_get_widget (dialog->gui, "objectclasses-remove-button"); - g_signal_connect (dialog->objectclasses_remove_button, "clicked", - G_CALLBACK(objectclasses_remove), dialog); - - restore_default = glade_xml_get_widget (dialog->gui, "objectclasses-default-button"); - g_signal_connect (restore_default, "clicked", - G_CALLBACK(objectclasses_restore_default), dialog); -} -#endif - - -static AddressbookSourceDialog * -addressbook_add_server_druid (AddressbookDialog *dialog) -{ - AddressbookSourceDialog *sdialog = g_new0 (AddressbookSourceDialog, 1); - GtkWidget *page; - - sdialog->addressbook_dialog = dialog; - - 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"); - - /* 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 (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 (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 (page, "prepare", - G_CALLBACK(druid_searching_page_prepare), sdialog); - - /* display name page */ - page = glade_xml_get_widget (sdialog->gui, "add-server-druid-display-name-page"); - sdialog->display_name = glade_xml_get_widget (sdialog->gui, "druid-display-name-entry"); - g_signal_connect (sdialog->display_name, "changed", - G_CALLBACK(druid_display_name_page_modify_cb), sdialog); - g_signal_connect (page, "prepare", - G_CALLBACK(display_name_page_prepare), sdialog); - - 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 (sdialog->druid, "cancel", - G_CALLBACK(addressbook_add_server_druid_cancel), sdialog); - g_object_weak_ref (G_OBJECT (sdialog->window), - addressbook_source_dialog_destroy, sdialog); - - /* make sure we fill in the default values */ - addressbook_source_dialog_set_source (sdialog, NULL); - - 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); - if (valid) - valid = general_tab_check (dialog); -#if 0 - if (valid) - valid = connecting_tab_check (dialog); - if (valid) - valid = searching_tab_check (dialog); -#endif - - gtk_widget_set_sensitive (dialog->ok_button, valid); - gtk_widget_set_sensitive (dialog->apply_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 { - 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); - } -} - -#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) -{ - AddressbookSource *source = addressbook_dialog_get_source (sdialog); - AddressbookDialog *dialog = sdialog->addressbook_dialog; - AddressbookSource *old_source; - - /* check the display name for uniqueness */ - if (FALSE /* XXX */) { - return FALSE; - } - - /* store the new source in the addressbook dialog */ - old_source = e_table_memory_get_data (E_TABLE_MEMORY (dialog->sourcesModel), sdialog->source_model_row); - addressbook_source_free (old_source); - - e_table_memory_store_change (E_TABLE_MEMORY_STORE (dialog->sourcesModel), - sdialog->source_model_row, source, source->name, source->host); - - /* and let the config control know about the change */ - evolution_config_control_changed (dialog->config_control); - - return TRUE; -} - -static void -edit_dialog_apply_clicked (GtkWidget *item, AddressbookSourceDialog *sdialog) -{ - if (!edit_dialog_store_change (sdialog)) - return; - - /* resensitize the buttons */ - gtk_widget_set_sensitive (sdialog->ok_button, FALSE); - gtk_widget_set_sensitive (sdialog->apply_button, FALSE); -} - -static void -edit_dialog_close_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)) - edit_dialog_close_clicked (item, sdialog); -} - -static AddressbookSourceDialog* -addressbook_edit_server_dialog (AddressbookDialog *dialog, int model_row) -{ - AddressbookSource *source = e_table_memory_get_data (E_TABLE_MEMORY(dialog->sourcesModel), model_row); - AddressbookSourceDialog *sdialog = g_new0 (AddressbookSourceDialog, 1); - GtkWidget *general_tab_help; - GtkWidget *fewer_options_button, *more_options_button; - - sdialog->addressbook_dialog = dialog; - sdialog->source_model_row = model_row; - - sdialog->gui = glade_xml_new (EVOLUTION_GLADEDIR "/" GLADE_FILE_NAME, NULL, NULL); - - sdialog->window = glade_xml_get_widget (sdialog->gui, "account-editor-window"); - - /* general tab */ - general_tab_help = glade_xml_get_widget (dialog->gui, "general-tab-help"); - reparent_to_vbox (sdialog, "account-editor-general-vbox", "general-tab"); - setup_general_tab (sdialog, editor_modify_cb); - sdialog->display_name = glade_xml_get_widget (sdialog->gui, "account-editor-display-name-entry"); - g_signal_connect (sdialog->display_name, "changed", - G_CALLBACK (editor_modify_cb), sdialog); - add_focus_handler (sdialog->display_name, general_tab_help, 4); - - /* 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); - -#ifdef NEW_ADVANCED_UI - /* objectclasses tab */ - reparent_to_vbox (sdialog, "account-editor-objectclasses-vbox", "objectclasses-tab"); - setup_objectclasses_tab (sdialog, editor_modify_cb); - - /* mappings tab */ - reparent_to_vbox (sdialog, "account-editor-mappings-vbox", "mappings-tab"); - /* XXX setup_mappings_tab */ - - /* dn customization tab */ - reparent_to_vbox (sdialog, "account-editor-dn-customization-vbox", "dn-customization-tab"); - /* XXX setup_dn_customization_tab */ -#endif - - sdialog->ok_button = glade_xml_get_widget (sdialog->gui, "account-editor-ok-button"); - sdialog->apply_button = glade_xml_get_widget (sdialog->gui, "account-editor-apply-button"); - sdialog->close_button = glade_xml_get_widget (sdialog->gui, "account-editor-close-button"); - - sdialog->advanced_button_notebook = glade_xml_get_widget (sdialog->gui, "account-editor-advanced-button-notebook"); - fewer_options_button = glade_xml_get_widget (sdialog->gui, "account-editor-fewer-options-button"); - more_options_button = glade_xml_get_widget (sdialog->gui, "account-editor-more-options-button"); - - sdialog->notebook = glade_xml_get_widget (sdialog->gui, "account-editor-notebook"); -#ifdef NEW_ADVANCED_UI - sdialog->objectclasses_label = glade_xml_get_widget (sdialog->gui, "account-editor-objectclasses-label"); - g_object_ref (sdialog->objectclasses_label); - sdialog->objectclasses_tab = glade_xml_get_widget (sdialog->gui, "account-editor-objectclasses-vbox"); - g_object_ref (sdialog->objectclasses_tab); - sdialog->mappings_label = glade_xml_get_widget (sdialog->gui, "account-editor-mappings-label"); - g_object_ref (sdialog->mappings_label); - sdialog->mappings_tab = glade_xml_get_widget (sdialog->gui, "account-editor-mappings-vbox"); - g_object_ref (sdialog->mappings_tab); - sdialog->dn_customization_label = glade_xml_get_widget (sdialog->gui, "account-editor-dn-customization-label"); - g_object_ref (sdialog->dn_customization_label); - sdialog->dn_customization_tab = glade_xml_get_widget (sdialog->gui, "account-editor-dn-customization-vbox"); - g_object_ref (sdialog->dn_customization_tab); -#endif - - addressbook_source_dialog_set_source (sdialog, source); - - set_advanced_button_state (sdialog); - -#ifdef NEW_ADVANCED_UI - g_signal_connect (fewer_options_button, - "clicked", advanced_button_clicked, sdialog); - g_signal_connect (more_options_button, - "clicked", advanced_button_clicked, sdialog); - -#else - gtk_widget_hide (sdialog->advanced_button_notebook); -#endif - -#ifdef NEW_ADVANCED_UI - /* set up a signal handler to query for schema info if the user switches to the advanced tabs */ - g_signal_connect (sdialog->notebook, "switch_page", - G_CALLBACK (edit_dialog_switch_page), sdialog); -#endif - - g_signal_connect (sdialog->ok_button, - "clicked", G_CALLBACK(edit_dialog_ok_clicked), sdialog); - g_signal_connect (sdialog->apply_button, - "clicked", G_CALLBACK(edit_dialog_apply_clicked), sdialog); - g_signal_connect (sdialog->close_button, - "clicked", G_CALLBACK(edit_dialog_close_clicked), sdialog); - g_object_weak_ref (G_OBJECT (sdialog->window), - addressbook_source_dialog_destroy, sdialog); - - gtk_widget_set_sensitive (sdialog->ok_button, FALSE); - gtk_widget_set_sensitive (sdialog->apply_button, FALSE); - - gtk_window_set_modal (GTK_WINDOW (sdialog->window), TRUE); - - gtk_widget_show (sdialog->window); - - return sdialog; -} - -static void -add_source_clicked (GtkWidget *widget, AddressbookDialog *dialog) -{ - addressbook_add_server_druid (dialog); -} - -static void -edit_source_clicked (GtkWidget *widget, AddressbookDialog *dialog) -{ - int i; - ESelectionModel *selection_model; - int row_count; - - selection_model = e_table_get_selection_model (e_table_scrolled_get_table (E_TABLE_SCROLLED(dialog->sourcesTable))); - row_count = e_selection_model_row_count (selection_model); - - for (i = 0; i < row_count; i ++) { - if (e_selection_model_is_row_selected (selection_model, i)) { - addressbook_edit_server_dialog (dialog, i); - break; /* single select so we're done now */ - } - } - -#if 0 - AddressbookSource *source; - AddressbookSourceDialog *sdialog; - - source = gtk_clist_get_row_data (GTK_CLIST (dialog->clistSources), dialog->source_row); - - sdialog = addressbook_config_source_with_gui (dialog->gui, source, dialog->page); - if (sdialog->id == 0) { - /* Ok was clicked */ - source = addressbook_source_copy(sdialog->source); - - gtk_clist_set_text (GTK_CLIST (dialog->clistSources), dialog->source_row, 0, source->name); - gtk_clist_set_text (GTK_CLIST (dialog->clistSources), dialog->source_row, 1, source->host); - gtk_clist_set_row_data (GTK_CLIST (dialog->clistSources), dialog->source_row, source); - - evolution_config_control_changed (dialog->config_control); - - update_sensitivity (dialog); - } -#endif -} - -static void -delete_source_clicked (GtkWidget *widget, AddressbookDialog *dialog) -{ - int i; - ESelectionModel *selection_model; - int row_count; - - selection_model = e_table_get_selection_model (e_table_scrolled_get_table (E_TABLE_SCROLLED(dialog->sourcesTable))); - row_count = e_selection_model_row_count (selection_model); - - for (i = 0; i < row_count; i ++) { - if (e_selection_model_is_row_selected (selection_model, i)) { - AddressbookSource *source = e_table_memory_get_data (E_TABLE_MEMORY(dialog->sourcesModel), i); - e_table_memory_store_remove (E_TABLE_MEMORY_STORE (dialog->sourcesModel), i); - addressbook_source_free (source); - - break; /* single select so we're done now */ - } - } - - evolution_config_control_changed (dialog->config_control); -} - -static void -ldap_config_control_destroy_callback (gpointer data, - GObject *where_object_was) -{ - AddressbookDialog *dialog; - - dialog = (AddressbookDialog *) data; - - g_object_unref (dialog->gui); - - /* XXX free more stuff here */ - - g_free (dialog); -} - -static void -ldap_config_control_apply_callback (EvolutionConfigControl *config_control, - void *data) -{ - AddressbookDialog *dialog; - int i; - int count; - - dialog = (AddressbookDialog *) data; - - addressbook_storage_clear_sources(); - - count = e_table_model_row_count (E_TABLE_MODEL (dialog->sourcesModel)); - - for (i = 0; i < count; i ++) { - AddressbookSource *source = e_table_memory_get_data (E_TABLE_MEMORY (dialog->sourcesModel), i); - addressbook_storage_add_source (addressbook_source_copy (source)); - } - - addressbook_storage_write_sources(); -} - -static void -sources_selection_changed (ESelectionModel *esm, AddressbookDialog *dialog) -{ - gboolean sensitive = e_selection_model_selected_count (esm) == 1; - - gtk_widget_set_sensitive (dialog->editSource, sensitive); - gtk_widget_set_sensitive (dialog->deleteSource, sensitive); -} - -static void -sources_table_double_click (ETable *et, int row, int col, GdkEvent *event, AddressbookDialog *dialog) -{ - addressbook_edit_server_dialog (dialog, row); -} - - -static AddressbookDialog * -ldap_dialog_new (GNOME_Evolution_Shell shell) -{ - AddressbookDialog *dialog; - GList *l; - ESelectionModel *esm; - ETable *et; - - dialog = g_new0 (AddressbookDialog, 1); - - dialog->gui = glade_xml_new (EVOLUTION_GLADEDIR "/" GLADE_FILE_NAME, NULL, NULL); - dialog->shell = shell; - - dialog->sourcesTable = glade_xml_get_widget (dialog->gui, "sourcesTable"); - et = e_table_scrolled_get_table (E_TABLE_SCROLLED(dialog->sourcesTable)); - g_signal_connect (et, "double_click", - G_CALLBACK (sources_table_double_click), dialog); - - dialog->sourcesModel = g_object_get_data (G_OBJECT (dialog->sourcesTable), "model"); - - dialog->addSource = glade_xml_get_widget (dialog->gui, "addSource"); - g_signal_connect (dialog->addSource, "clicked", - G_CALLBACK (add_source_clicked), - dialog); - - dialog->editSource = glade_xml_get_widget (dialog->gui, "editSource"); - g_signal_connect (dialog->editSource, "clicked", - G_CALLBACK (edit_source_clicked), - dialog); - - dialog->deleteSource = glade_xml_get_widget (dialog->gui, "deleteSource"); - g_signal_connect (dialog->deleteSource, "clicked", - G_CALLBACK (delete_source_clicked), - dialog); - - l = addressbook_storage_get_sources (); - for (; l != NULL; l = l->next) { - AddressbookSource *source; - - source = addressbook_source_copy ((AddressbookSource*)l->data); - - e_table_memory_store_insert (E_TABLE_MEMORY_STORE (dialog->sourcesModel), - -1, source, source->name, source->host); - } - - esm = e_table_get_selection_model (et); - g_signal_connect (esm, "selection_changed", - G_CALLBACK (sources_selection_changed), dialog); - - sources_selection_changed (esm, dialog); - - dialog->page = glade_xml_get_widget (dialog->gui, "addressbook-sources"); - - gtk_widget_show_all (dialog->page); - - return dialog; -} - -static ETableMemoryStoreColumnInfo sources_table_columns[] = { - E_TABLE_MEMORY_STORE_STRING, - E_TABLE_MEMORY_STORE_STRING, - E_TABLE_MEMORY_STORE_TERMINATOR -}; - -GtkWidget* -addressbook_dialog_create_sources_table (char *name, char *string1, char *string2, int num1, int num2) -{ - GtkWidget *table; - ETableModel *model; - - model = e_table_memory_store_new (sources_table_columns); - - table = e_table_scrolled_new_from_spec_file (model, - NULL, - EVOLUTION_ETSPECDIR "/addressbook-config.etspec", - NULL); - - g_object_set_data (G_OBJECT (table), "model", model); - - return table; -} -#endif /* HAVE_LDAP */ - -static EvolutionConfigControl * -ldap_config_control_new (GNOME_Evolution_Shell shell) -{ - GtkWidget *control_widget; - EvolutionConfigControl *control; - -#ifdef HAVE_LDAP - AddressbookDialog *dialog; - - dialog = ldap_dialog_new (shell); - - control_widget = dialog->page; - - gtk_widget_ref (control_widget); - - gtk_container_remove (GTK_CONTAINER (control_widget->parent), control_widget); -#else - control_widget = gtk_label_new (_("LDAP was not enabled in this build of Evolution")); - gtk_widget_set_sensitive (control_widget, FALSE); - gtk_widget_show (control_widget); -#endif - - control = evolution_config_control_new (control_widget); - -#ifdef HAVE_LDAP - dialog->config_control = control; - g_signal_connect (dialog->config_control, "apply", - G_CALLBACK (ldap_config_control_apply_callback), dialog); - g_object_weak_ref (G_OBJECT (dialog->config_control), - ldap_config_control_destroy_callback, dialog); - - gtk_widget_unref (dialog->page); -#endif - - return control; -} - - -EvolutionConfigControl * -addressbook_config_control_new (void) -{ - GNOME_Evolution_Shell shell; - - shell = evolution_shell_client_corba_objref (addressbook_component_get_shell_client ()); - if (! shell) - return NULL; - - return BONOBO_OBJECT (ldap_config_control_new (shell)); -} - -void -addressbook_config_create_new_source (const char *new_source, GtkWidget *parent) -{ -#ifdef HAVE_LDAP -#if 0 - AddressbookSourceDialog *dialog; - GladeXML *gui; - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/" GLADE_FILE_NAME, NULL, NULL); - - dialog = addressbook_source_dialog (gui, NULL, parent); - - gtk_entry_set_text (GTK_ENTRY (dialog->name), new_source); - - dialog->id = gtk_dialog_run (GTK_DIALOG (dialog->dialog)); - - gtk_widget_hide (dialog->dialog); - - g_object_unref (dialog->gui); - - if (dialog->id == GTK_RESPONSE_OK) { - /* Ok was clicked */ - addressbook_storage_add_source (addressbook_source_copy(dialog->source)); - addressbook_storage_write_sources(); - } -#endif -#endif /* HAVE_LDAP */ -} - -#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_gnome_init (); - - bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); - textdomain (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 diff --git a/addressbook/gui/component/addressbook-config.etspec b/addressbook/gui/component/addressbook-config.etspec deleted file mode 100644 index e30d11f1f8..0000000000 --- a/addressbook/gui/component/addressbook-config.etspec +++ /dev/null @@ -1,9 +0,0 @@ -<ETableSpecification cursor-mode="line"> - <ETableColumn model_col= "0" _title="Account Name" expansion="1.0" minimum_width="20" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col= "1" _title="Server Name" expansion="1.0" minimum_width="20" resizable="true" cell="string" compare="string"/> - <ETableState> - <column source="0"/> - <column source="1"/> - <grouping></grouping> - </ETableState> -</ETableSpecification> diff --git a/addressbook/gui/component/addressbook-config.h b/addressbook/gui/component/addressbook-config.h deleted file mode 100644 index c1f88e3425..0000000000 --- a/addressbook/gui/component/addressbook-config.h +++ /dev/null @@ -1,36 +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 "addressbook-storage.h" -#include "evolution-config-control.h" - -EvolutionConfigControl *addressbook_config_control_new (void); - -void addressbook_config_create_new_source (const char *new_source, - GtkWidget *parent); - -#endif /* __ADDRESSBOOK_CONFIG_H__ */ diff --git a/addressbook/gui/component/addressbook-storage.c b/addressbook/gui/component/addressbook-storage.c deleted file mode 100644 index 9b73b93b54..0000000000 --- a/addressbook/gui/component/addressbook-storage.c +++ /dev/null @@ -1,722 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-ldap-storage.c - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Chris Toshok - */ - -/* The addressbook-sources.xml file goes like this: - - <?xml version="1.0"?> - <addressbooks> - <contactserver> - <name>LDAP Server</name> - <host>ldap.server.com</host> - <port>389</port> - <rootdn></rootdn> - <authmethod>simple</authmethod> - <emailaddr>toshok@blubag.com</emailaddr> - <limit>100</limit> - <rememberpass/> - </contactserver> - </addressbooks> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "addressbook-storage.h" - -#include <sys/types.h> -#include <fcntl.h> -#include <sys/stat.h> -#include <errno.h> -#include <string.h> -#include <ctype.h> -#include <unistd.h> - -#include <glib.h> -#include <gtk/gtk.h> -#include <libxml/parser.h> -#include <libxml/xmlmemory.h> - -#include <libgnome/gnome-i18n.h> -#include <libgnome/gnome-util.h> -#include <bonobo/bonobo-object.h> - -#include <gal/util/e-util.h> -#include <gal/util/e-xml-utils.h> -#include <libgnome/gnome-i18n.h> - -#include "evolution-shell-component.h" - -#include "addressbook-config.h" - -#define ADDRESSBOOK_SOURCES_XML "addressbook-sources.xml" - -#ifdef HAVE_LDAP -static gboolean load_source_data (const char *file_path); -#endif - -static gboolean save_source_data (const char *file_path); -static void deregister_storage (void); - -static GList *sources; -static EvolutionStorage *storage; -static char *storage_path; -static GNOME_Evolution_Shell corba_shell; - -void -addressbook_storage_setup (EvolutionShellComponent *shell_component, - const char *evolution_homedir) -{ - EvolutionShellClient *shell_client; - - shell_client = evolution_shell_component_get_owner (shell_component); - if (shell_client == CORBA_OBJECT_NIL) { - g_warning ("We have no shell!?"); - return; - } - - corba_shell = evolution_shell_client_corba_objref (shell_client); - - sources = NULL; - - if (storage_path) - g_free (storage_path); - storage_path = g_build_filename (evolution_homedir, ADDRESSBOOK_SOURCES_XML, NULL); -#ifdef HAVE_LDAP - if (!load_source_data (storage_path)) - deregister_storage (); -#endif -} - -#ifdef HAVE_LDAP -static void -notify_listener (const Bonobo_Listener listener, - GNOME_Evolution_Storage_Result corba_result) -{ - CORBA_any any; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - any._type = TC_GNOME_Evolution_Storage_Result; - any._value = &corba_result; - - Bonobo_Listener_event (listener, "result", &any, &ev); - - CORBA_exception_free (&ev); -} - -static void -remove_ldap_folder (EvolutionStorage *storage, const Bonobo_Listener listener, - const CORBA_char *path, const CORBA_char *physical_uri, - gpointer data) -{ - - addressbook_storage_remove_source (path + 1); - addressbook_storage_write_sources(); - - notify_listener (listener, GNOME_Evolution_Storage_OK); -} - -static void -create_ldap_folder (EvolutionStorage *storage, const Bonobo_Listener listener, - const CORBA_char *path, const CORBA_char *type, - const CORBA_char *description, const CORBA_char *parent_physical_uri, - gpointer data) -{ - if (strcmp (type, "contacts")) { - notify_listener (listener, GNOME_Evolution_Storage_UNSUPPORTED_TYPE); - return; - } - - if (strcmp (parent_physical_uri, "")) {/* ldap servers can't have subfolders */ - notify_listener (listener, GNOME_Evolution_Storage_INVALID_URI); - return; - } - addressbook_config_create_new_source (path + 1, NULL); - - notify_listener (listener, GNOME_Evolution_Storage_OK); -} -#endif - - -EvolutionStorage * -addressbook_get_other_contact_storage (void) -{ -#ifdef HAVE_LDAP - EvolutionStorageResult result; - - if (storage == NULL) { - storage = evolution_storage_new (_("Other Contacts"), FALSE); - g_signal_connect (storage, - "remove_folder", - G_CALLBACK (remove_ldap_folder), NULL); - g_signal_connect (storage, - "create_folder", - G_CALLBACK (create_ldap_folder), NULL); - result = evolution_storage_register_on_shell (storage, corba_shell); - switch (result) { - case EVOLUTION_STORAGE_OK: - break; - case EVOLUTION_STORAGE_ERROR_GENERIC : - g_warning("register_storage: generic error"); - break; - case EVOLUTION_STORAGE_ERROR_CORBA : - g_warning("register_storage: corba error"); - break; - case EVOLUTION_STORAGE_ERROR_ALREADYREGISTERED : - g_warning("register_storage: already registered error"); - break; - case EVOLUTION_STORAGE_ERROR_EXISTS : - g_warning("register_storage: already exists error"); - break; - default: - g_warning("register_storage: other error"); - break; - } - } -#endif - - return storage; -} - -static void -deregister_storage (void) -{ - if (evolution_storage_deregister_on_shell (storage, corba_shell) != - EVOLUTION_STORAGE_OK) { - g_warning("couldn't deregister storage"); - } - - storage = NULL; -} - -#ifdef HAVE_LDAP -static char * -get_string_value (xmlNode *node, - const char *name) -{ - xmlNode *p; - xmlChar *xml_string; - char *retval; - - p = e_xml_get_child_by_name (node, (xmlChar *) name); - if (p == NULL) - return NULL; - - p = e_xml_get_child_by_name (p, (xmlChar *) "text"); - if (p == NULL) /* there's no text between the tags, return the empty string */ - return g_strdup(""); - - xml_string = xmlNodeListGetString (node->doc, p, 1); - retval = g_strdup ((char *) xml_string); - xmlFree (xml_string); - - return retval; -} - -static int -get_integer_value (xmlNode *node, - const char *name, - int defval) -{ - xmlNode *p; - xmlChar *xml_string; - int retval; - - p = e_xml_get_child_by_name (node, (xmlChar *) name); - if (p == NULL) - return defval; - - p = e_xml_get_child_by_name (p, (xmlChar *) "text"); - if (p == NULL) /* there's no text between the tags, return the default */ - return defval; - - xml_string = xmlNodeListGetString (node->doc, p, 1); - retval = atoi (xml_string); - xmlFree (xml_string); - - return retval; -} -#endif - -static char * -ldap_unparse_auth (AddressbookLDAPAuthType auth_type) -{ - switch (auth_type) { - case ADDRESSBOOK_LDAP_AUTH_NONE: - return "none"; - case ADDRESSBOOK_LDAP_AUTH_SIMPLE_EMAIL: - return "ldap/simple-email"; - case ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN: - return "ldap/simple-binddn"; - default: - g_assert(0); - return "none"; - } -} - -#ifdef HAVE_LDAP -static AddressbookLDAPAuthType -ldap_parse_auth (const char *auth) -{ - if (!auth) - return ADDRESSBOOK_LDAP_AUTH_NONE; - - if (!strcmp (auth, "ldap/simple-email") || !strcmp (auth, "simple")) - return ADDRESSBOOK_LDAP_AUTH_SIMPLE_EMAIL; - else if (!strcmp (auth, "ldap/simple-binddn")) - return ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN; - else - return ADDRESSBOOK_LDAP_AUTH_NONE; -} -#endif - -static char * -ldap_unparse_scope (AddressbookLDAPScopeType scope_type) -{ - switch (scope_type) { - case ADDRESSBOOK_LDAP_SCOPE_BASE: - return "base"; - case ADDRESSBOOK_LDAP_SCOPE_ONELEVEL: - return "one"; - case ADDRESSBOOK_LDAP_SCOPE_SUBTREE: - return "sub"; - default: - g_assert(0); - return ""; - } -} - -#ifdef HAVE_LDAP -static AddressbookLDAPScopeType -ldap_parse_scope (const char *scope) -{ - if (!scope) - return ADDRESSBOOK_LDAP_SCOPE_SUBTREE; /* XXX good default? */ - - if (!strcmp (scope, "base")) - return ADDRESSBOOK_LDAP_SCOPE_BASE; - else if (!strcmp (scope, "one")) - return ADDRESSBOOK_LDAP_SCOPE_ONELEVEL; - else - return ADDRESSBOOK_LDAP_SCOPE_SUBTREE; -} -#endif - -static char * -ldap_unparse_ssl (AddressbookLDAPSSLType ssl_type) -{ - switch (ssl_type) { - case ADDRESSBOOK_LDAP_SSL_NEVER: - return "never"; - case ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE: - return "whenever_possible"; - case ADDRESSBOOK_LDAP_SSL_ALWAYS: - return "always"; - default: - g_assert(0); - return ""; - } -} - -#ifdef HAVE_LDAP -static AddressbookLDAPSSLType -ldap_parse_ssl (const char *ssl) -{ - if (!ssl) - return ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE; /* XXX good default? */ - - if (!strcmp (ssl, "always")) - return ADDRESSBOOK_LDAP_SSL_ALWAYS; - else if (!strcmp (ssl, "never")) - return ADDRESSBOOK_LDAP_SSL_NEVER; - else - return ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE; -} -#endif - -const char* -addressbook_storage_auth_type_to_string (AddressbookLDAPAuthType auth_type) -{ - return ldap_unparse_auth (auth_type); -} - -void -addressbook_storage_init_source_uri (AddressbookSource *source) -{ - GString *str; - - if (source->uri) - g_free (source->uri); - - str = g_string_new ("ldap://"); - - g_string_append_printf (str, "%s:%s/%s?"/*trigraph prevention*/"?%s", - source->host, - source->port, - source->rootdn, - ldap_unparse_scope (source->scope)); - - g_string_append_printf (str, ";limit=%d", source->limit); - - g_string_append_printf (str, ";ssl=%s", ldap_unparse_ssl (source->ssl)); - -#if 0 - g_string_append_printf (str, ";timeout=%d", source->timeout); -#endif - - source->uri = str->str; - - g_string_free (str, FALSE); -} - -#ifdef HAVE_LDAP -static gboolean -load_source_data (const char *file_path) -{ - xmlDoc *doc; - xmlNode *root; - xmlNode *child; - - addressbook_get_other_contact_storage(); - - tryagain: - doc = xmlParseFile (file_path); - if (doc == NULL) { - /* Check to see if a addressbook-sources.xml.new file - exists. If it does, rename it and try loading it */ - char *new_path = g_strdup_printf ("%s.new", file_path); - struct stat sb; - - if (stat (new_path, &sb) == 0) { - int rv; - - rv = rename (new_path, file_path); - g_free (new_path); - - if (rv < 0) { - g_error ("Failed to rename %s: %s\n", - file_path, - strerror(errno)); - return FALSE; - } else - goto tryagain; - } - - g_free (new_path); - return FALSE; - } - - root = xmlDocGetRootElement (doc); - if (root == NULL || strcmp (root->name, "addressbooks") != 0) { - xmlFreeDoc (doc); - return FALSE; - } - - for (child = root->children; child; child = child->next) { - char *path; - AddressbookSource *source; - - source = g_new0 (AddressbookSource, 1); - - if (!strcmp (child->name, "contactserver")) { - source->port = get_string_value (child, "port"); - source->host = get_string_value (child, "host"); - source->rootdn = get_string_value (child, "rootdn"); - source->scope = ldap_parse_scope (get_string_value (child, "scope")); - source->auth = ldap_parse_auth (get_string_value (child, "authmethod")); - source->ssl = ldap_parse_ssl (get_string_value (child, "ssl")); - source->email_addr = get_string_value (child, "emailaddr"); - source->binddn = get_string_value (child, "binddn"); - source->limit = get_integer_value (child, "limit", 100); - } - else if (!strcmp (child->name, "text")) { - if (child->content) { - int i; - for (i = 0; i < strlen (child->content); i++) { - if (!isspace (child->content[i])) { - g_warning ("illegal text in contactserver list."); - break; - } - } - } - g_free (source); - continue; - } - else { - g_warning ("unknown node '%s' in %s", child->name, file_path); - g_free (source); - continue; - } - - addressbook_storage_init_source_uri (source); - - source->name = get_string_value (child, "name"); - source->description = get_string_value (child, "description"); - - path = g_strdup_printf ("/%s", source->name); - evolution_storage_new_folder (storage, path, source->name, - "contacts/ldap", source->uri, - source->description, NULL, 0, FALSE, 0); - - sources = g_list_append (sources, source); - - g_free (path); - } - - if (g_list_length (sources) == 0) - deregister_storage(); - - xmlFreeDoc (doc); - return TRUE; -} -#endif - -static void -ldap_source_foreach(AddressbookSource *source, xmlNode *root) -{ - xmlNode *source_root = xmlNewNode (NULL, - (xmlChar *) "contactserver"); - - xmlAddChild (root, source_root); - - xmlNewChild (source_root, NULL, (xmlChar *) "name", - (xmlChar *) source->name); - xmlNewChild (source_root, NULL, (xmlChar *) "description", - (xmlChar *) source->description); - - xmlNewChild (source_root, NULL, (xmlChar *) "port", - (xmlChar *) source->port); - xmlNewChild (source_root, NULL, (xmlChar *) "host", - (xmlChar *) source->host); - xmlNewChild (source_root, NULL, (xmlChar *) "rootdn", - (xmlChar *) source->rootdn); - xmlNewChild (source_root, NULL, (xmlChar *) "scope", - (xmlChar *) ldap_unparse_scope(source->scope)); - xmlNewChild (source_root, NULL, (xmlChar *) "authmethod", - (xmlChar *) ldap_unparse_auth(source->auth)); - xmlNewChild (source_root, NULL, (xmlChar *) "ssl", - (xmlChar *) ldap_unparse_ssl(source->ssl)); - - if (source->limit != 100) { - char *string; - string = g_strdup_printf ("%d", source->limit); - xmlNewChild (source_root, NULL, (xmlChar *) "limit", - (xmlChar *) string); - g_free (string); - } - - if (source->auth != ADDRESSBOOK_LDAP_AUTH_NONE) { - if (source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN) - xmlNewChild (source_root, NULL, (xmlChar *) "binddn", - (xmlChar *) source->binddn); - else - xmlNewChild (source_root, NULL, (xmlChar *) "emailaddr", - (xmlChar *) source->email_addr); - - if (source->remember_passwd) - xmlNewChild (source_root, NULL, (xmlChar *) "rememberpass", - NULL); - } -} - -static gboolean -save_source_data (const char *file_path) -{ - xmlDoc *doc; - xmlNode *root; - int fd, rv; - xmlChar *buf; - int buf_size; - char *new_path = g_strdup_printf ("%s.new", file_path); - - doc = xmlNewDoc ((xmlChar *) "1.0"); - root = xmlNewDocNode (doc, NULL, (xmlChar *) "addressbooks", NULL); - xmlDocSetRootElement (doc, root); - - g_list_foreach (sources, (GFunc)ldap_source_foreach, root); - - fd = open (new_path, O_CREAT | O_TRUNC | O_WRONLY, 0600); - fchmod (fd, 0600); - - xmlDocDumpMemory (doc, &buf, &buf_size); - - if (buf == NULL) { - g_error ("Failed to write %s: xmlBufferCreate() == NULL", file_path); - return FALSE; - } - - rv = write (fd, buf, buf_size); - xmlFree (buf); - close (fd); - - if (0 > rv) { - g_error ("Failed to write new %s: %s\n", file_path, strerror(errno)); - unlink (new_path); - return FALSE; - } - else { - if (0 > rename (new_path, file_path)) { - g_error ("Failed to rename %s: %s\n", file_path, strerror(errno)); - unlink (new_path); - return FALSE; - } - return TRUE; - } -} - -void -addressbook_storage_add_source (AddressbookSource *source) -{ - char *path; - - sources = g_list_append (sources, source); - - /* And then to the ui */ - addressbook_get_other_contact_storage(); - path = g_strdup_printf ("/%s", source->name); - evolution_storage_new_folder (storage, path, source->name, "contacts/ldap", - source->uri, source->description, NULL, 0, FALSE, 0); - - g_free (path); -} - -void -addressbook_storage_remove_source (const char *name) -{ - char *path; - AddressbookSource *source = NULL; - GList *l; - - /* remove it from our hashtable */ - for (l = sources; l; l = l->next) { - AddressbookSource *s = l->data; - if (!strcmp (s->name, name)) { - source = s; - break; - } - } - - if (!source) - return; - - sources = g_list_remove_link (sources, l); - g_list_free_1 (l); - - addressbook_source_free (source); - - /* and then from the ui */ - path = g_strdup_printf ("/%s", name); - evolution_storage_removed_folder (storage, path); - - if (g_list_length (sources) == 0) - deregister_storage (); - - g_free (path); -} - -GList * -addressbook_storage_get_sources () -{ - return sources; -} - -AddressbookSource * -addressbook_storage_get_source_by_uri (const char *uri) -{ - GList *l; - - for (l = sources; l ; l = l->next) { - AddressbookSource *source = l->data; - if (!strcmp (uri, source->uri)) - return source; - } - - return NULL; -} - -void -addressbook_source_free (AddressbookSource *source) -{ - g_free (source->name); - g_free (source->description); - g_free (source->uri); - g_free (source->host); - g_free (source->port); - g_free (source->rootdn); - g_free (source->email_addr); - g_free (source->binddn); - - g_free (source); -} - -static void -addressbook_source_foreach (AddressbookSource *source, gpointer data) -{ - char *path = g_strdup_printf ("/%s", source->name); - - evolution_storage_removed_folder (storage, path); - - g_free (path); - - addressbook_source_free (source); -} - -void -addressbook_storage_clear_sources (void) -{ - g_list_foreach (sources, (GFunc)addressbook_source_foreach, NULL); - g_list_free (sources); - deregister_storage (); - sources = NULL; -} - -void -addressbook_storage_write_sources (void) -{ - save_source_data (storage_path); -} - -AddressbookSource * -addressbook_source_copy (const AddressbookSource *source) -{ - AddressbookSource *copy; - - copy = g_new0 (AddressbookSource, 1); - copy->name = g_strdup (source->name); - copy->description = g_strdup (source->description); - copy->uri = g_strdup (source->uri); - - copy->host = g_strdup (source->host); - copy->port = g_strdup (source->port); - copy->rootdn = g_strdup (source->rootdn); - copy->scope = source->scope; - copy->auth = source->auth; - copy->ssl = source->ssl; - copy->email_addr = g_strdup (source->email_addr); - copy->binddn = g_strdup (source->binddn); - copy->remember_passwd = source->remember_passwd; - copy->limit = source->limit; - - return copy; -} diff --git a/addressbook/gui/component/addressbook-storage.h b/addressbook/gui/component/addressbook-storage.h deleted file mode 100644 index 1d0fc24b73..0000000000 --- a/addressbook/gui/component/addressbook-storage.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* addressbook-storage.h - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Chris Toshok - */ - -#ifndef __ADDRESSBOOK_STORAGE_H__ -#define __ADDRESSBOOK_STORAGE_H__ - -#include "evolution-shell-component.h" -#include "evolution-storage.h" - -typedef enum { - ADDRESSBOOK_LDAP_AUTH_NONE, - ADDRESSBOOK_LDAP_AUTH_SIMPLE_EMAIL, - ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN, -} AddressbookLDAPAuthType; - -typedef enum { - ADDRESSBOOK_LDAP_SCOPE_ONELEVEL, - ADDRESSBOOK_LDAP_SCOPE_SUBTREE, - ADDRESSBOOK_LDAP_SCOPE_BASE, - ADDRESSBOOK_LDAP_SCOPE_LAST -} AddressbookLDAPScopeType; - -typedef enum { - ADDRESSBOOK_LDAP_SSL_ALWAYS, - ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE, - ADDRESSBOOK_LDAP_SSL_NEVER -} AddressbookLDAPSSLType; - -typedef struct { - char *name; - char *description; - char *host; - char *port; - char *rootdn; - AddressbookLDAPScopeType scope; - AddressbookLDAPAuthType auth; - AddressbookLDAPSSLType ssl; - char *email_addr; /* used in AUTH_SIMPLE_EMAIL */ - char *binddn; /* used in AUTH_SIMPLE_BINDDN */ - gboolean remember_passwd; - int limit; - - char *uri; /* filled in from the above */ -} AddressbookSource; - -void addressbook_storage_setup (EvolutionShellComponent *shell_component, - const char *evolution_homedir); - -EvolutionStorage *addressbook_get_other_contact_storage (void); -GList *addressbook_storage_get_sources (void); -AddressbookSource *addressbook_storage_get_source_by_uri (const char *uri); -void addressbook_storage_clear_sources (void); -void addressbook_storage_write_sources (void); -AddressbookSource *addressbook_source_copy (const AddressbookSource *source); -void addressbook_source_free (AddressbookSource *source); -void addressbook_storage_init_source_uri (AddressbookSource *source); - -void addressbook_storage_add_source (AddressbookSource *source); -void addressbook_storage_remove_source (const char *name); -const char* addressbook_storage_auth_type_to_string (AddressbookLDAPAuthType auth_type); - -#endif /* __ADDRESSBOOK_STORAGE_H__ */ diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c deleted file mode 100644 index 1fb5520454..0000000000 --- a/addressbook/gui/component/addressbook.c +++ /dev/null @@ -1,1181 +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/gtkframe.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 "select-names/e-select-names.h" -#include "select-names/e-select-names-manager.h" - -#include "evolution-shell-component-utils.h" -#include "evolution-activity-client.h" -#include "e-contact-editor.h" -#include "e-contact-save-as.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/e-addressbook-util.h" -#include "addressbook/printing/e-contact-print.h" - -#include <ebook/e-book.h> -#include <ebook/e-book-util.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[2] = { NULL, NULL }; - -#define d(x) - -#define PROPERTY_FOLDER_URI "folder_uri" - -#define PROPERTY_FOLDER_URI_IDX 1 - -typedef struct { - gint refs; - EAddressbookView *view; - ESearchBar *search; - gint ecml_changed_id; - GtkWidget *vbox; - EvolutionActivityClient *activity; - BonoboControl *control; - BonoboPropertyBag *properties; - char *uri; - char *passwd; - gboolean ignore_search_changes; -} AddressbookView; - -static void addressbook_view_ref (AddressbookView *); -static void addressbook_view_unref (AddressbookView *); - -static void addressbook_authenticate (EBook *book, gboolean previous_failure, - AddressbookSource *source, EBookCallback cb, gpointer closure); - -static void -save_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - if (view->view) - e_addressbook_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) - e_addressbook_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(e_addressbook_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) { - if (e_contact_editor_confirm_delete (GTK_WINDOW (view->view))) - e_addressbook_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) - e_addressbook_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) - e_addressbook_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) - e_addressbook_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) - e_addressbook_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) - e_addressbook_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) - e_addressbook_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) - e_addressbook_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) - e_addressbook_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) - e_addressbook_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) - e_addressbook_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) - e_addressbook_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 (EAddressbookView *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", - e_addressbook_view_can_save_as (view->view) ? "1" : "0", NULL); - bonobo_ui_component_set_prop (uic, - "/commands/ContactsView", - "sensitive", - e_addressbook_view_can_view (view->view) ? "1" : "0", NULL); - - /* Print Contact */ - bonobo_ui_component_set_prop (uic, - "/commands/ContactsPrint", - "sensitive", - e_addressbook_view_can_print (view->view) ? "1" : "0", NULL); - - /* Print Contact */ - bonobo_ui_component_set_prop (uic, - "/commands/ContactsPrintPreview", - "sensitive", - e_addressbook_view_can_print (view->view) ? "1" : "0", NULL); - - /* Delete Contact */ - bonobo_ui_component_set_prop (uic, - "/commands/ContactDelete", - "sensitive", - e_addressbook_view_can_delete (view->view) ? "1" : "0", NULL); - - bonobo_ui_component_set_prop (uic, - "/commands/ContactsCut", - "sensitive", - e_addressbook_view_can_cut (view->view) ? "1" : "0", NULL); - bonobo_ui_component_set_prop (uic, - "/commands/ContactsCopy", - "sensitive", - e_addressbook_view_can_copy (view->view) ? "1" : "0", NULL); - bonobo_ui_component_set_prop (uic, - "/commands/ContactsPaste", - "sensitive", - e_addressbook_view_can_paste (view->view) ? "1" : "0", NULL); - bonobo_ui_component_set_prop (uic, - "/commands/ContactsSelectAll", - "sensitive", - e_addressbook_view_can_select_all (view->view) ? "1" : "0", NULL); - - bonobo_ui_component_set_prop (uic, - "/commands/ContactsSendContactToOther", - "sensitive", - e_addressbook_view_can_send (view->view) ? "1" : "0", NULL); - - bonobo_ui_component_set_prop (uic, - "/commands/ContactsSendMessageToContact", - "sensitive", - e_addressbook_view_can_send_to (view->view) ? "1" : "0", NULL); - - bonobo_ui_component_set_prop (uic, - "/commands/ContactsMoveToFolder", - "sensitive", - e_addressbook_view_can_move_to_folder (view->view) ? "1" : "0", NULL); - bonobo_ui_component_set_prop (uic, - "/commands/ContactsCopyToFolder", - "sensitive", - e_addressbook_view_can_copy_to_folder (view->view) ? "1" : "0", NULL); - - /* Stop */ - bonobo_ui_component_set_prop (uic, - "/commands/ContactStop", - "sensitive", - e_addressbook_view_can_stop (view->view) ? "1" : "0", NULL); - } - - addressbook_view_unref (view); -} - -static void -change_view_type (AddressbookView *view, EAddressbookViewType 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, EVOLUTION_DATADIR, - "evolution-addressbook.xml", - "evolution-addressbook", NULL); - - e_addressbook_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) - e_addressbook_model_force_folder_bar_message (view->view->model); - - } else { - bonobo_ui_component_unset_container (uic, NULL); - e_addressbook_view_discard_menus (view->view); - } -} - -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) { - g_free (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) -{ - EBook *book; - - if (view->uri && view->view) { - g_object_get(view->view, - "book", &book, - NULL); - g_object_unref (book); - } - - if (view->properties) { - bonobo_object_unref (BONOBO_OBJECT(view->properties)); - view->properties = NULL; - } - - if (view->view) { - gtk_widget_destroy (GTK_WIDGET (view->view)); - view->view = NULL; - } - - g_free(view->passwd); - view->passwd = NULL; - - g_free(view->uri); - view->uri = NULL; - - if (view->refs == 0) - g_free(view); - - if (view->ecml_changed_id != 0) { - g_signal_handler_disconnect (get_master_list(), - view->ecml_changed_id); - view->ecml_changed_id = 0; - } -} - -static void -book_open_cb (EBook *book, EBookStatus status, gpointer closure) -{ - AddressbookView *view = closure; - - if (status == E_BOOK_STATUS_SUCCESS) { - g_object_set(view->view, - "book", book, - NULL); - } - else { - char *label_string; - GtkWidget *warning_dialog; - GtkWidget *href = NULL; - AddressbookSource *source = NULL; - - if (!strncmp (view->uri, "file:", 5)) { - label_string = - _("We were unable to open this addressbook. Please check that the\n" - "path exists and that you have permission to access it."); - } - else { - source = addressbook_storage_get_source_by_uri (view->uri); - - if (source) { - /* special case for ldap: contact folders so we can tell the user about openldap */ -#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_swapped (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); - } -} - -static void -destroy_callback(gpointer data, GObject *where_object_was) -{ - AddressbookView *view = data; - if (view->view && view->view->model && view->view->model->book_view) - e_book_view_stop (view->view->model->book_view); - addressbook_view_clear (view); - 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_FOLDER_URI_IDX: - if (view && view->uri) - BONOBO_ARG_SET_STRING (arg, view->uri); - else - BONOBO_ARG_SET_STRING (arg, ""); - break; - - default: - g_warning ("Unhandled arg %d\n", arg_id); - } -} - -typedef struct { - EBookCallback cb; - char *clean_uri; - AddressbookSource *source; - gpointer closure; -} LoadUriData; - -static void -load_uri_auth_cb (EBook *book, EBookStatus status, gpointer closure) -{ - LoadUriData *data = closure; - - if (status != E_BOOK_STATUS_SUCCESS) { - if (status == E_BOOK_STATUS_CANCELLED) { - /* the user clicked cancel in the password dialog */ - gnome_warning_dialog (_("Accessing LDAP Server anonymously")); - data->cb (book, E_BOOK_STATUS_SUCCESS, data->closure); - g_free (data->clean_uri); - g_free (data); - return; - } - else { - e_passwords_forget_password ("Addressbook", data->clean_uri); - addressbook_authenticate (book, TRUE, data->source, load_uri_auth_cb, closure); - return; - } - } - - data->cb (book, status, data->closure); - - g_free (data->clean_uri); - g_free (data); -} - -static void -addressbook_authenticate (EBook *book, gboolean previous_failure, AddressbookSource *source, - EBookCallback cb, gpointer closure) -{ - LoadUriData *load_uri_data = closure; - const char *password = NULL; - char *pass_dup = NULL; - char *semicolon; - - load_uri_data->clean_uri = g_strdup (e_book_get_uri (book)); - - semicolon = strchr (load_uri_data->clean_uri, ';'); - - if (semicolon) - *semicolon = '\0'; - - password = e_passwords_get_password ("Addressbook", load_uri_data->clean_uri); - - if (!password) { - char *prompt; - gboolean remember; - char *failed_auth; - - if (previous_failure) { - failed_auth = _("Failed to authenticate.\n"); - } - else { - failed_auth = ""; - } - - - if (source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN) - prompt = g_strdup_printf (_("%sEnter password for %s (user %s)"), - failed_auth, source->name, source->binddn); - else - prompt = g_strdup_printf (_("%sEnter password for %s (user %s)"), - failed_auth, source->name, source->email_addr); - remember = source->remember_passwd; - pass_dup = e_passwords_ask_password (prompt, "Addressbook", load_uri_data->clean_uri, prompt, TRUE, - E_PASSWORDS_REMEMBER_FOREVER, &remember, - NULL); - if (remember != source->remember_passwd) { - source->remember_passwd = remember; - addressbook_storage_write_sources (); - } - g_free (prompt); - } - - if (password || pass_dup) { - char *user; - - if (source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN) - user = source->binddn; - else - user = source->email_addr; - if (!user) - user = ""; - e_book_authenticate_user (book, user, password ? password : pass_dup, - addressbook_storage_auth_type_to_string (source->auth), - cb, closure); - g_free (pass_dup); - return; - } - else { - /* they hit cancel */ - cb (book, E_BOOK_STATUS_CANCELLED, closure); - } -} - -static void -load_uri_cb (EBook *book, EBookStatus status, gpointer closure) -{ - LoadUriData *load_uri_data = closure; - - if (status == E_BOOK_STATUS_SUCCESS && book != NULL) { - - /* check if the addressbook needs authentication */ - - load_uri_data->source = addressbook_storage_get_source_by_uri (e_book_get_uri (book)); - - if (load_uri_data->source && - load_uri_data->source->auth != ADDRESSBOOK_LDAP_AUTH_NONE) { - - addressbook_authenticate (book, FALSE, load_uri_data->source, - load_uri_auth_cb, closure); - - return; - } - } - - load_uri_data->cb (book, status, load_uri_data->closure); - g_free (load_uri_data); -} - -gboolean -addressbook_load_uri (EBook *book, const char *uri, - EBookCallback cb, gpointer closure) -{ - LoadUriData *load_uri_data = g_new0 (LoadUriData, 1); - gboolean rv; - - load_uri_data->cb = cb; - load_uri_data->closure = closure; - - rv = e_book_load_uri (book, uri, load_uri_cb, load_uri_data); - - if (!rv) - g_free (load_uri_data); - - return rv; -} - -gboolean -addressbook_load_default_book (EBook *book, EBookCallback cb, gpointer closure) -{ - LoadUriData *load_uri_data = g_new (LoadUriData, 1); - gboolean rv; - - load_uri_data->cb = cb; - load_uri_data->closure = closure; - - rv = e_book_load_default_book (book, load_uri_cb, load_uri_data); - - if (!rv) - g_free (load_uri_data); - - return rv; -} - -static void -set_prop (BonoboPropertyBag *bag, - const BonoboArg *arg, - guint arg_id, - CORBA_Environment *ev, - gpointer user_data) -{ - AddressbookView *view = user_data; - - char *uri_data; - EBook *book; - - switch (arg_id) { - - case PROPERTY_FOLDER_URI_IDX: - g_object_get(view->view, - "book", &book, - NULL); - if (view->uri) { - /* we've already had a uri set on this view, so unload it */ - e_book_unload_uri (book); - g_free (view->uri); - } else { - book = e_book_new (); - } - - view->uri = g_strdup(BONOBO_ARG_GET_STRING (arg)); - - uri_data = e_book_expand_uri (view->uri); - - if (! addressbook_load_uri (book, uri_data, book_open_cb, view)) - printf ("error calling load_uri!\n"); - - g_free(uri_data); - - 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 -alphabet_state_changed (EAddressbookView *eav, gunichar letter, AddressbookView *view) -{ - view->ignore_search_changes = TRUE; - if (letter == 0) { - e_search_bar_set_item_id (view->search, ESB_FULL_NAME); - e_search_bar_set_text (view->search, ""); - } else { - e_search_bar_set_item_id (view->search, ESB_FULL_NAME); - } - view->ignore_search_changes = FALSE; -} - -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(e_addressbook_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(e_addressbook_search_dialog_new(view->view)); - } -} - -static GNOME_Evolution_ShellView -retrieve_shell_view_interface_from_control (BonoboControl *control) -{ - Bonobo_ControlFrame control_frame; - GNOME_Evolution_ShellView shell_view_interface; - CORBA_Environment ev; - - shell_view_interface = g_object_get_data (G_OBJECT (control), - "shell_view_interface"); - - if (shell_view_interface) - return shell_view_interface; - - control_frame = bonobo_control_get_control_frame (control, NULL); - - if (control_frame == NULL) - return CORBA_OBJECT_NIL; - - CORBA_exception_init (&ev); - shell_view_interface = Bonobo_Unknown_queryInterface (control_frame, - "IDL:GNOME/Evolution/ShellView:1.0", - &ev); - CORBA_exception_free (&ev); - - if (shell_view_interface != CORBA_OBJECT_NIL) - g_object_set_data (G_OBJECT (control), - "shell_view_interface", - shell_view_interface); - else - g_warning ("Control frame doesn't have Evolution/ShellView."); - - return shell_view_interface; -} - -static void -set_status_message (EAddressbookView *eav, const char *message, AddressbookView *view) -{ - - if (!message || !*message) { - if (view->activity) { - g_object_unref (view->activity); - view->activity = NULL; - } - } - else if (!view->activity) { - int display; - char *clientid = g_strdup_printf ("%p", view); - - if (progress_icon[0] == NULL) - progress_icon[0] = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" EVOLUTION_CONTACTS_PROGRESS_IMAGE, NULL); - - view->activity = evolution_activity_client_new (addressbook_component_get_shell_client(), clientid, - progress_icon, message, TRUE, &display); - - g_free (clientid); - } - else { - evolution_activity_client_update (view->activity, message, -1.0); - } - -} - -static void -search_result (EAddressbookView *eav, EBookViewStatus status, AddressbookView *view) -{ - char *str = NULL; - - switch (status) { - case E_BOOK_VIEW_STATUS_SUCCESS: - 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_STATUS_INVALID_QUERY: - str = _("The backend for this addressbook was unable to parse this query."); - break; - case E_BOOK_VIEW_STATUS_QUERY_REFUSED: - str = _("The backend for this addressbook refused to perform this query."); - break; - case E_BOOK_VIEW_STATUS_OTHER_ERROR: - case E_BOOK_VIEW_STATUS_UNKNOWN: - str = _("This query did not complete successfully."); - break; - } - - if (str) - gnome_warning_dialog (str); -} - -static void -set_folder_bar_label (EAddressbookView *eav, const char *message, AddressbookView *view) -{ - CORBA_Environment ev; - GNOME_Evolution_ShellView shell_view_interface; - - CORBA_exception_init (&ev); - - shell_view_interface = retrieve_shell_view_interface_from_control (view->control); - if (!shell_view_interface) { - CORBA_exception_free (&ev); - return; - } - - d(g_message("Updating via ShellView")); - - if (message == NULL || message[0] == 0) { - GNOME_Evolution_ShellView_setFolderBarLabel (shell_view_interface, - "", - &ev); - } - else { - GNOME_Evolution_ShellView_setFolderBarLabel (shell_view_interface, - message, - &ev); - } - - if (BONOBO_EX (&ev)) - g_warning ("Exception in label update: %s", - bonobo_exception_get_text (&ev)); - - CORBA_exception_free (&ev); -} - -/* Our global singleton config database */ -static Bonobo_ConfigDatabase config_db = NULL; - -Bonobo_ConfigDatabase -addressbook_config_database (CORBA_Environment *ev) -{ - if (config_db == NULL) - config_db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", ev); - - return config_db; -} - -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; - 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); -} - -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; - GtkWidget *frame; - - frame = gtk_frame_new (NULL); - gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); - - 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 = E_ADDRESSBOOK_VIEW(e_addressbook_view_new()); - gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET (view->view)); - gtk_box_pack_start (GTK_BOX (view->vbox), frame, - TRUE, TRUE, 0); - - /* create the initial view */ - change_view_type (view, E_ADDRESSBOOK_VIEW_MINICARD); - - gtk_widget_show (frame); - 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_FOLDER_URI, PROPERTY_FOLDER_URI_IDX, - BONOBO_ARG_STRING, NULL, _("The URI that the Folder Browser 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, - "folder_bar_message", - G_CALLBACK(set_folder_bar_label), - view); - - g_signal_connect (view->view, - "command_state_change", - G_CALLBACK(update_command_state), - view); - - g_signal_connect (view->view, - "alphabet_state_change", - G_CALLBACK(alphabet_state_changed), - view); - - view->uri = 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 3524f24b0c..0000000000 --- a/addressbook/gui/component/addressbook.h +++ /dev/null @@ -1,17 +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 <ebook/e-book.h> - -/* use this instead of e_book_load_uri everywhere where you want the - authentication to be handled for you. */ -gboolean addressbook_load_uri (EBook *book, const char *uri, EBookCallback cb, gpointer closure); -gboolean addressbook_load_default_book (EBook *book, EBookCallback open_response, gpointer closure); - -BonoboControl *addressbook_new_control (void); - -#endif /* __ADDRESSBOOK_H__ */ diff --git a/addressbook/gui/component/apps_evolution_addressbook.schemas b/addressbook/gui/component/apps_evolution_addressbook.schemas deleted file mode 100644 index 82af9d0843..0000000000 --- a/addressbook/gui/component/apps_evolution_addressbook.schemas +++ /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/component-factory.c b/addressbook/gui/component/component-factory.c deleted file mode 100644 index eed681c844..0000000000 --- a/addressbook/gui/component/component-factory.c +++ /dev/null @@ -1,67 +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 "addressbook.h" -#include "addressbook-component.h" -#include "addressbook-config.h" -#include "e-address-popup.h" -#include "e-address-widget.h" -#include "e-minicard-control.h" - -#include <bonobo/bonobo-shlib-factory.h> - - -#define FACTORY_ID "OAFIID:GNOME_Evolution_Addressbook_Factory" - -#define MINICARD_CONTROL_ID "OAFIID:GNOME_Evolution_Addressbook_MiniCard_Control" -#define ADDRESSBOOK_CONTROL_ID "OAFIID:GNOME_Evolution_Addressbook_Control" -#define SHELL_COMPONENT_ID "OAFIID:GNOME_Evolution_Addressbook_ShellComponent" -#define ADDRESS_WIDGET_ID "OAFIID:GNOME_Evolution_Addressbook_AddressWidget" -#define ADDRESS_POPUP_ID "OAFIID:GNOME_Evolution_Addressbook_AddressPopup" -#define LDAP_STORAGE_CONFIG_CONTROL_ID "OAFIID:GNOME_Evolution_LDAPStorage_ConfigControl" - - -static BonoboObject * -factory (BonoboGenericFactory *factory, - const char *component_id, - void *closure) -{ - if (strcmp (component_id, MINICARD_CONTROL_ID) == 0) - return BONOBO_OBJECT (e_minicard_control_new ()); - if (strcmp (component_id, ADDRESSBOOK_CONTROL_ID) == 0) - return BONOBO_OBJECT (addressbook_new_control ()); - if (strcmp (component_id, SHELL_COMPONENT_ID) == 0) - return addressbook_component_init (); - if (strcmp (component_id, ADDRESS_WIDGET_ID) == 0) - return BONOBO_OBJECT (e_address_widget_new_control ()); - if (strcmp (component_id, ADDRESS_POPUP_ID) == 0) - return BONOBO_OBJECT (e_address_popup_new_control ()); - if (strcmp (component_id, LDAP_STORAGE_CONFIG_CONTROL_ID) == 0) - return BONOBO_OBJECT (addressbook_config_control_new ()); - - 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/e-address-popup.c b/addressbook/gui/component/e-address-popup.c deleted file mode 100644 index 13baf28eec..0000000000 --- a/addressbook/gui/component/e-address-popup.c +++ /dev/null @@ -1,1280 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * e-address-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. - */ - -/* - * This file is too big and this widget is too complicated. Forgive me. - */ - -#include <config.h> -#include <string.h> -#include "addressbook.h" -#include "e-address-popup.h" -#include <bonobo/bonobo-control.h> -#include <bonobo/bonobo-property-bag.h> -#include <bonobo/bonobo-generic-factory.h> -#include <gal/widgets/e-popup-menu.h> -#include <addressbook/backend/ebook/e-book.h> -#include <addressbook/backend/ebook/e-book-util.h> -#include <addressbook/gui/contact-editor/e-contact-editor.h> -#include <addressbook/gui/contact-editor/e-contact-quick-add.h> -#include <addressbook/gui/widgets/e-minicard-widget.h> -#include <addressbook/gui/widgets/e-addressbook-util.h> - -/* - * Some general scaffolding for our widgets. Think of this as a really, really - * lame implementation of a wizard (...which is still somewhat more general that - * we really need it to be). - */ - -typedef struct _MiniWizard MiniWizard; -struct _MiniWizard { - GtkWidget *body; - - GtkWidget *vbox; - GtkWidget *ok_button; - GtkWidget *cancel_button; - - void (*ok_cb) (MiniWizard *, gpointer); - void (*cleanup_cb) (gpointer); - gpointer closure; - - void (*destroy_cb) (MiniWizard *, gpointer); - gpointer destroy_closure; -}; - -static void -mini_wizard_container_add (MiniWizard *wiz, GtkWidget *w) -{ - GList *iter = gtk_container_get_children (GTK_CONTAINER (wiz->vbox)); - while (iter != NULL) { - GtkWidget *oldw = (GtkWidget *) iter->data; - iter = g_list_next (iter); - gtk_container_remove (GTK_CONTAINER (wiz->vbox), oldw); - gtk_widget_destroy (oldw); - } - gtk_container_add (GTK_CONTAINER (wiz->vbox), w); -} - -static void -mini_wizard_destroy (MiniWizard *wiz) -{ - if (wiz->cleanup_cb) - wiz->cleanup_cb (wiz->closure); - wiz->cleanup_cb = NULL; - - if (wiz->destroy_cb) - wiz->destroy_cb (wiz, wiz->destroy_closure); -} - -static void -mini_wizard_ok_cb (GtkWidget *b, gpointer closure) -{ - MiniWizard *wiz = (MiniWizard *) closure; - - gpointer old_closure = wiz->closure; - void (*old_cleanup) (gpointer) = wiz->cleanup_cb; - - wiz->cleanup_cb = NULL; - - if (wiz->ok_cb) - wiz->ok_cb (wiz, wiz->closure); - - if (old_cleanup) - old_cleanup (old_closure); - -} - -static void -mini_wizard_cancel_cb (GtkWidget *b, gpointer closure) -{ - mini_wizard_destroy ((MiniWizard *) closure); -} - -static void -mini_wizard_destroy_cb (gpointer closure, GObject *where_object_was) -{ - MiniWizard *wiz = (MiniWizard *) closure; - if (wiz->cleanup_cb) - wiz->cleanup_cb (wiz->closure); - g_free (wiz); -} - -static MiniWizard * -mini_wizard_new (void) -{ - MiniWizard *wiz = g_new (MiniWizard, 1); - GtkWidget *hbox; - - wiz->body = gtk_vbox_new (FALSE, 2); - wiz->vbox = gtk_vbox_new (FALSE, 2); - wiz->ok_button = gtk_button_new_from_stock (GTK_STOCK_OK); - wiz->cancel_button = gtk_button_new_from_stock (GTK_STOCK_CANCEL); - - wiz->ok_cb = NULL; - wiz->cleanup_cb = NULL; - wiz->closure = NULL; - - wiz->destroy_cb = NULL; - wiz->destroy_closure = NULL; - - hbox = gtk_hbox_new (FALSE, 2); - gtk_box_pack_start (GTK_BOX (hbox), wiz->ok_button, TRUE, FALSE, 2); - gtk_box_pack_start (GTK_BOX (hbox), wiz->cancel_button, TRUE, FALSE, 2); - - gtk_box_pack_start (GTK_BOX (wiz->body), wiz->vbox, TRUE, TRUE, 2); - gtk_box_pack_start (GTK_BOX (wiz->body), gtk_hseparator_new (), FALSE, TRUE, 2); - gtk_box_pack_start (GTK_BOX (wiz->body), hbox, FALSE, TRUE, 2); - - gtk_widget_show_all (wiz->body); - - g_signal_connect (wiz->ok_button, - "clicked", - G_CALLBACK (mini_wizard_ok_cb), - wiz); - g_signal_connect (wiz->cancel_button, - "clicked", - G_CALLBACK (mini_wizard_cancel_cb), - wiz); - - g_object_weak_ref (G_OBJECT (wiz->body), - mini_wizard_destroy_cb, - wiz); - - return wiz; - -} - - - -/* - * This is the code for the UI thingie that lets you manipulate the e-mail - * addresses (and *only* the e-mail addresses) associated with an existing - * card. - */ - -#define EMPTY_ENTRY N_("(none)") - -typedef struct _EMailMenu EMailMenu; -struct _EMailMenu { - GtkWidget *option_menu; - GList *options; - gchar *current_selection; -}; - -static void -email_menu_free (EMailMenu *menu) -{ - if (menu == NULL) - return; - - g_list_foreach (menu->options, (GFunc) g_free, NULL); - g_list_free (menu->options); - g_free (menu); -} - -static EMailMenu * -email_menu_new (void) -{ - EMailMenu *menu = g_new (EMailMenu, 1); - - menu->option_menu = gtk_option_menu_new (); - menu->options = NULL; - menu->current_selection = NULL; - - gtk_option_menu_set_menu (GTK_OPTION_MENU (menu->option_menu), gtk_menu_new ()); - - return menu; -} - -static void -menu_activate_cb (GtkWidget *w, gpointer closure) -{ - EMailMenu *menu = (EMailMenu *) closure; - gchar *addr = (gchar *) g_object_get_data (G_OBJECT (w), "addr"); - - menu->current_selection = addr; -} - -static void -email_menu_add_option (EMailMenu *menu, const gchar *addr) -{ - GtkWidget *menu_item; - gchar *addr_cpy; - - g_return_if_fail (menu != NULL); - if (addr == NULL) - return; - - addr_cpy = g_strdup (addr); - menu->options = g_list_append (menu->options, addr_cpy); - - menu_item = gtk_menu_item_new_with_label (addr); - g_object_set_data (G_OBJECT (menu_item), "addr", addr_cpy); - gtk_widget_show_all (menu_item); - gtk_menu_append (GTK_MENU (gtk_option_menu_get_menu (GTK_OPTION_MENU (menu->option_menu))), menu_item); - - g_signal_connect (menu_item, - "activate", - G_CALLBACK (menu_activate_cb), - menu); -} - -static void -email_menu_add_options_from_card (EMailMenu *menu, ECard *card, const gchar *extra_addr) -{ - ECardSimple *simple; - - g_return_if_fail (card && E_IS_CARD (card)); - - simple = e_card_simple_new (card); - - /* If any of these three e-mail fields are NULL, email_menu_add_option will just - return without doing anything. */ - email_menu_add_option (menu, e_card_simple_get_email (simple, E_CARD_SIMPLE_EMAIL_ID_EMAIL)); - email_menu_add_option (menu, e_card_simple_get_email (simple, E_CARD_SIMPLE_EMAIL_ID_EMAIL_2)); - email_menu_add_option (menu, e_card_simple_get_email (simple, E_CARD_SIMPLE_EMAIL_ID_EMAIL_3)); - email_menu_add_option (menu, extra_addr); - email_menu_add_option (menu, EMPTY_ENTRY); - - g_object_unref (simple); -} - -static void -email_menu_set_option (EMailMenu *menu, const gchar *addr) -{ - guint count = 0; - GList *iter; - - g_return_if_fail (menu != NULL); - - if (addr == NULL) { - email_menu_set_option (menu, EMPTY_ENTRY); - return; - } - - iter = menu->options; - while (iter && strcmp (addr, (gchar *) iter->data)) { - ++count; - iter = g_list_next (iter); - } - - if (iter) { - gtk_option_menu_set_history (GTK_OPTION_MENU (menu->option_menu), count); - menu->current_selection = (gchar *) iter->data; - } -} - -#ifdef UNDEFINED_FUNCTIONS_SHOULD_PLEASE_BE_INCLUDED -static void -email_menu_unset_option (EMailMenu *menu, const gchar *addr) -{ - GList *iter; - - g_return_if_fail (menu != NULL); - g_return_if_fail (addr != NULL); - - if (menu->current_selection == NULL || strcmp (addr, menu->current_selection)) - return; - - iter = menu->options; - while (iter && strcmp (addr, (gchar *) iter->data)) { - iter = g_list_next (iter); - } - if (iter) { - iter = g_list_next (iter); - if (iter) { - email_menu_set_option (menu, (gchar *) iter->data); - } else { - email_menu_set_option (menu, EMPTY_ENTRY); - } - } -} -#endif - - - -typedef struct _EMailTable EMailTable; -struct _EMailTable { - GtkWidget *table; - ECard *card; - EMailMenu *primary; - EMailMenu *email2; - EMailMenu *email3; -}; - -static void -email_table_cleanup_cb (gpointer closure) -{ - EMailTable *et = (EMailTable *) closure; - - if (et == NULL) - return; - - g_object_unref (et->card); - email_menu_free (et->primary); - email_menu_free (et->email2); - email_menu_free (et->email3); - - g_free (et); -} - -static void -email_table_from_card (EMailTable *et) -{ - ECardSimple *simple; - - g_return_if_fail (et != NULL); - - simple = e_card_simple_new (et->card); - email_menu_set_option (et->primary, e_card_simple_get_email (simple, E_CARD_SIMPLE_EMAIL_ID_EMAIL)); - email_menu_set_option (et->email2, e_card_simple_get_email (simple, E_CARD_SIMPLE_EMAIL_ID_EMAIL_2)); - email_menu_set_option (et->email3, e_card_simple_get_email (simple, E_CARD_SIMPLE_EMAIL_ID_EMAIL_3)); - g_object_unref (simple); -} - -static void -email_table_to_card (EMailTable *et) -{ - ECardSimple *simple; - gchar *curr; - - g_return_if_fail (et != NULL); - - simple = e_card_simple_new (et->card); - - curr = et->primary->current_selection; - if (curr && !strcmp (curr, _(EMPTY_ENTRY))) - curr = NULL; - e_card_simple_set_email (simple, E_CARD_SIMPLE_EMAIL_ID_EMAIL, curr); - - curr = et->email2->current_selection; - if (curr && !strcmp (curr, _(EMPTY_ENTRY))) - curr = NULL; - e_card_simple_set_email (simple, E_CARD_SIMPLE_EMAIL_ID_EMAIL_2, curr); - - curr = et->email3->current_selection; - if (curr && !strcmp (curr, _(EMPTY_ENTRY))) - curr = NULL; - e_card_simple_set_email (simple, E_CARD_SIMPLE_EMAIL_ID_EMAIL_3, curr); - - e_card_simple_sync_card (simple); - g_object_unref (simple); -} - -static void -email_table_save_card_cb (EBook *book, EBookStatus status, gpointer closure) -{ - ECard *card = E_CARD (closure); - - if (book) { - e_book_commit_card (book, card, NULL, NULL); - g_object_unref (book); - } - g_object_unref (card); -} - -/* - * We have to do this in an idle function because of what might be a - * re-entrancy problems with EBook. - */ -static gint -add_card_idle_cb (gpointer closure) -{ - EBook *book; - - book = e_book_new (); - if (!addressbook_load_default_book (book, email_table_save_card_cb, closure)) { - g_object_unref (book); - email_table_save_card_cb (NULL, E_BOOK_STATUS_OTHER_ERROR, closure); - } - - return 0; -} - -static void -email_table_ok_cb (MiniWizard *wiz, gpointer closure) -{ - EMailTable *et = (EMailTable *) closure; - - email_table_to_card (et); - - g_object_ref (et->card); - gtk_idle_add (add_card_idle_cb, et->card); - - mini_wizard_destroy (wiz); -} - -static void -email_table_init (MiniWizard *wiz, ECard *card, const gchar *extra_address) -{ - EMailTable *et; - - gchar *name_str; - gint xpad, ypad; - GtkAttachOptions label_x_opts, label_y_opts; - GtkAttachOptions menu_x_opts, menu_y_opts; - - g_return_if_fail (card && E_IS_CARD (card)); - - et = g_new (EMailTable, 1); - - et->card = card; - g_object_ref (et->card); - - et->table = gtk_table_new (4, 2, FALSE); - - et->primary = email_menu_new (); - et->email2 = email_menu_new (); - et->email3 = email_menu_new (); - - email_menu_add_options_from_card (et->primary, et->card, extra_address); - email_menu_add_options_from_card (et->email2, et->card, extra_address); - email_menu_add_options_from_card (et->email3, et->card, extra_address); - - email_table_from_card (et); - - label_x_opts = GTK_FILL; - label_y_opts = GTK_FILL; - menu_x_opts = GTK_EXPAND | GTK_FILL; - menu_y_opts = GTK_EXPAND | GTK_FILL; - xpad = 3; - ypad = 3; - - name_str = e_card_name_to_string (et->card->name); - gtk_table_attach (GTK_TABLE (et->table), - gtk_label_new (name_str), - 0, 2, 0, 1, - label_x_opts, label_y_opts, xpad, ypad); - g_free (name_str); - - gtk_table_attach (GTK_TABLE (et->table), - gtk_label_new (_("Primary Email")), - 0, 1, 1, 2, - label_x_opts, label_y_opts, xpad, ypad); - - gtk_table_attach (GTK_TABLE (et->table), - et->primary->option_menu, - 1, 2, 1, 2, - menu_x_opts, menu_y_opts, xpad, ypad); - - gtk_table_attach (GTK_TABLE (et->table), - gtk_label_new (_("Email 2")), - 0, 1, 2, 3, - label_x_opts, label_y_opts, xpad, ypad); - - gtk_table_attach (GTK_TABLE (et->table), - et->email2->option_menu, - 1, 2, 2, 3, - menu_x_opts, menu_y_opts, xpad, ypad); - - gtk_table_attach (GTK_TABLE (et->table), - gtk_label_new (_("Email 3")), - 0, 1, 3, 4, - label_x_opts, label_y_opts, xpad, ypad); - - gtk_table_attach (GTK_TABLE (et->table), - et->email3->option_menu, - 1, 2, 3, 4, - menu_x_opts, menu_y_opts, xpad, ypad); - - gtk_widget_show_all (et->primary->option_menu); - gtk_widget_show_all (et->email2->option_menu); - gtk_widget_show_all (et->email3->option_menu); - - gtk_widget_show_all (et->table); - mini_wizard_container_add (wiz, et->table); - wiz->ok_cb = email_table_ok_cb; - wiz->cleanup_cb = email_table_cleanup_cb; - wiz->closure = et; -} - -/* - * This code is for the little UI thing that lets you pick from a set of cards - * and decide which one you want to add the e-mail address to. - */ - -typedef struct _CardPicker CardPicker; -struct _CardPicker { - GtkWidget *body; - GtkWidget *list; - GtkListStore *model; - GList *cards; - gchar *new_name; - gchar *new_email; - - ECard *current_card; -}; - -enum { - COLUMN_ACTION, - COLUMN_CARD -}; - -static gboolean -card_picker_row_select_cb (GtkTreeSelection *selection, - GtkTreeModel *model, - GtkTreePath *path, - gboolean path_currently_selected, - gpointer closure) -{ - MiniWizard *wiz = (MiniWizard *) closure; - CardPicker *pick = (CardPicker *) wiz->closure; - GtkTreeIter iter; - - if (path_currently_selected) { - gtk_tree_model_get_iter (model, &iter, path); - gtk_tree_model_get (model, &iter, - COLUMN_CARD, &pick->current_card, - NULL); - - gtk_widget_set_sensitive (wiz->ok_button, TRUE); - } - else { - pick->current_card = NULL; - gtk_widget_set_sensitive (wiz->ok_button, FALSE); - } - - return TRUE; -} - -static void -card_picker_ok_cb (MiniWizard *wiz, gpointer closure) -{ - CardPicker *pick = (CardPicker *) closure; - - if (pick->current_card == NULL) { - e_contact_quick_add (pick->new_name, pick->new_email, NULL, NULL); - mini_wizard_destroy (wiz); - } else { - email_table_init (wiz, pick->current_card, pick->new_email); - } -} - -static void -card_picker_cleanup_cb (gpointer closure) -{ - CardPicker *pick = (CardPicker *) closure; - - g_list_foreach (pick->cards, (GFunc) g_object_unref, NULL); - g_list_free (pick->cards); - - g_free (pick->new_name); - g_free (pick->new_email); -} - -static void -card_picker_init (MiniWizard *wiz, const GList *cards, const gchar *new_name, const gchar *new_email) -{ - CardPicker *pick; - gchar *str; - GtkWidget *w, *swin; - GtkTreeIter iter; - - pick = g_new (CardPicker, 1); - - pick->body = gtk_vbox_new (FALSE, 2); - - pick->model = gtk_list_store_new (2, - G_TYPE_STRING, G_TYPE_POINTER, - NULL); - - pick->list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (pick->model)); - - gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (pick->list), TRUE); - - gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (pick->list), - COLUMN_ACTION, - _("Select an Action"), - gtk_cell_renderer_text_new (), - NULL); - - gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (pick->list)), - GTK_SELECTION_SINGLE); - - str = g_strdup_printf (_("Create a new contact \"%s\""), new_name); - gtk_list_store_append (pick->model, &iter); - gtk_list_store_set (pick->model, &iter, - str, NULL, - NULL); - g_free (str); - - pick->cards = NULL; - while (cards) { - ECard *card = (ECard *) cards->data; - gchar *name_str = e_card_name_to_string (card->name); - - pick->cards = g_list_append (pick->cards, card); - g_object_ref (card); - - str = g_strdup_printf (_("Add address to existing contact \"%s\""), name_str); - gtk_list_store_append (pick->model, &iter); - gtk_list_store_set (pick->model, &iter, - COLUMN_ACTION, str, - COLUMN_CARD, card, - NULL); - g_free (name_str); - g_free (str); - - cards = g_list_next (cards); - } - - pick->new_name = g_strdup (new_name); - pick->new_email = g_strdup (new_email); - - pick->current_card = NULL; - gtk_widget_set_sensitive (wiz->ok_button, FALSE); - - /* Connect some signals & callbacks */ - - wiz->ok_cb = card_picker_ok_cb; - wiz->cleanup_cb = card_picker_cleanup_cb; - - gtk_tree_selection_set_select_func (gtk_tree_view_get_selection (GTK_TREE_VIEW (pick->list)), - card_picker_row_select_cb, - wiz, NULL); - - /* Build our widget */ - - w = gtk_label_new (new_email); - gtk_box_pack_start (GTK_BOX (pick->body), w, FALSE, TRUE, 3); - - swin = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - - gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (swin), pick->list); - - gtk_box_pack_start (GTK_BOX (pick->body), swin, TRUE, TRUE, 2); - gtk_widget_show_all (pick->body); - - - /* Put it in our mini-wizard */ - - wiz->closure = pick; - mini_wizard_container_add (wiz, pick->body); -} - -/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */ - -/* - * The code for the actual EAddressPopup widget begins here. - */ - -/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */ - - -static GtkObjectClass *parent_class; - -static void e_address_popup_dispose (GObject *); -static void e_address_popup_query (EAddressPopup *); - - -static void -e_address_popup_class_init (EAddressPopupClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); - - object_class->dispose = e_address_popup_dispose; -} - -static void -e_address_popup_init (EAddressPopup *pop) -{ - pop->transitory = TRUE; -} - -static void -e_address_popup_cleanup (EAddressPopup *pop) -{ - if (pop->card) { - g_object_unref (pop->card); - pop->card = NULL; - } - - if (pop->scheduled_refresh) { - gtk_timeout_remove (pop->scheduled_refresh); - pop->scheduled_refresh = 0; - } - - if (pop->query_tag) { - e_book_simple_query_cancel (pop->book, pop->query_tag); - pop->query_tag = 0; - } - - if (pop->book) { - g_object_unref (pop->book); - pop->book = NULL; - } - - g_free (pop->name); - pop->name = NULL; - - g_free (pop->email); - pop->email = NULL; -} - -static void -e_address_popup_dispose (GObject *obj) -{ - EAddressPopup *pop = E_ADDRESS_POPUP (obj); - - e_address_popup_cleanup (pop); - - if (G_OBJECT_CLASS (parent_class)->dispose) - G_OBJECT_CLASS (parent_class)->dispose (obj); -} - -GType -e_address_popup_get_type (void) -{ - static GType pop_type = 0; - - if (!pop_type) { - static const GTypeInfo pop_info = { - sizeof (EAddressPopupClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_address_popup_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EAddressPopup), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_address_popup_init, - }; - - pop_type = g_type_register_static (gtk_event_box_get_type (), "EAddressPopup", &pop_info, 0); - } - - return pop_type; -} - -static void -e_address_popup_refresh_names (EAddressPopup *pop) -{ - if (pop->name_widget) { - if (pop->name && *pop->name) { - gtk_label_set_text (GTK_LABEL (pop->name_widget), pop->name); - gtk_widget_show (pop->name_widget); - } else { - gtk_widget_hide (pop->name_widget); - } - } - - if (pop->email_widget) { - if (pop->email && *pop->email) { - gtk_label_set_text (GTK_LABEL (pop->email_widget), pop->email); - gtk_widget_show (pop->email_widget); - } else { - gtk_widget_hide (pop->email_widget); - } - } - - e_address_popup_query (pop); -} - -static gint -refresh_timeout_cb (gpointer ptr) -{ - EAddressPopup *pop = E_ADDRESS_POPUP (ptr); - e_address_popup_refresh_names (pop); - pop->scheduled_refresh = 0; - return 0; -} - -static void -e_address_popup_schedule_refresh (EAddressPopup *pop) -{ - if (pop->scheduled_refresh == 0) - pop->scheduled_refresh = gtk_timeout_add (20, refresh_timeout_cb, pop); -} - -/* If we are handed something of the form "Foo <bar@bar.com>", - do the right thing. */ -static gboolean -e_address_popup_set_free_form (EAddressPopup *pop, const gchar *txt) -{ - gchar *lt, *gt = NULL; - - g_return_val_if_fail (pop && E_IS_ADDRESS_POPUP (pop), FALSE); - - if (txt == NULL) - return FALSE; - - lt = strchr (txt, '<'); - if (lt) - gt = strchr (txt, '>'); - - if (lt && gt && lt+1 < gt) { - gchar *name = g_strndup (txt, lt-txt); - gchar *email = g_strndup (lt+1, gt-lt-1); - e_address_popup_set_name (pop, name); - e_address_popup_set_email (pop, email); - - return TRUE; - } - - return FALSE; -} - -void -e_address_popup_set_name (EAddressPopup *pop, const gchar *name) -{ - g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop)); - - /* We only allow the name to be set once. */ - if (pop->name) - return; - - if (!e_address_popup_set_free_form (pop, name)) { - pop->name = g_strdup (name); - if (pop->name) - g_strstrip (pop->name); - } - - e_address_popup_schedule_refresh (pop); -} - -void -e_address_popup_set_email (EAddressPopup *pop, const gchar *email) -{ - g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop)); - - /* We only allow the e-mail to be set once. */ - if (pop->email) - return; - - if (!e_address_popup_set_free_form (pop, email)) { - pop->email = g_strdup (email); - if (pop->email) - g_strstrip (pop->email); - } - - e_address_popup_schedule_refresh (pop); -} - -void -e_address_popup_construct (EAddressPopup *pop) -{ - GtkWidget *vbox, *name_holder; - GdkColor color = { 0x0, 0xffff, 0xffff, 0xffff }; - - g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop)); - - pop->main_vbox = gtk_vbox_new (FALSE, 0); - - /* Build Generic View */ - - name_holder = gtk_event_box_new (); - vbox = gtk_vbox_new (FALSE, 2); - pop->name_widget = gtk_label_new (""); - pop->email_widget = gtk_label_new (""); - - gtk_box_pack_start (GTK_BOX (vbox), pop->name_widget, TRUE, TRUE, 2); - gtk_box_pack_start (GTK_BOX (vbox), pop->email_widget, TRUE, TRUE, 2); - gtk_container_add (GTK_CONTAINER (name_holder), GTK_WIDGET (vbox)); - - if (gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (name_holder)), &color, FALSE, TRUE)) { - GtkStyle *style = gtk_style_copy (gtk_widget_get_style (GTK_WIDGET (name_holder))); - style->bg[0] = color; - gtk_widget_set_style (GTK_WIDGET (name_holder), style); - gtk_style_unref (style); - } - - pop->generic_view = gtk_frame_new (NULL); - gtk_container_add (GTK_CONTAINER (pop->generic_view), name_holder); - gtk_box_pack_start (GTK_BOX (pop->main_vbox), pop->generic_view, TRUE, TRUE, 0); - gtk_widget_show_all (pop->generic_view); - - pop->query_msg = gtk_label_new (_("Querying Addressbook...")); - gtk_box_pack_start (GTK_BOX (pop->main_vbox), pop->query_msg, TRUE, TRUE, 0); - gtk_widget_show (pop->query_msg); - - /* Build Minicard View */ - pop->minicard_view = e_minicard_widget_new (); - gtk_box_pack_start (GTK_BOX (pop->main_vbox), pop->minicard_view, TRUE, TRUE, 0); - - - /* Final assembly */ - - gtk_container_add (GTK_CONTAINER (pop), pop->main_vbox); - gtk_widget_show (pop->main_vbox); - - gtk_container_set_border_width (GTK_CONTAINER (vbox), 3); - gtk_container_set_border_width (GTK_CONTAINER (pop), 2); -} - -GtkWidget * -e_address_popup_new (void) -{ - EAddressPopup *pop = g_object_new (E_TYPE_ADDRESS_POPUP, NULL); - e_address_popup_construct (pop); - return GTK_WIDGET (pop); -} - -static void -emit_event (EAddressPopup *pop, const char *event) -{ - if (pop->es) { - BonoboArg *arg; - - arg = bonobo_arg_new (BONOBO_ARG_BOOLEAN); - BONOBO_ARG_SET_BOOLEAN (arg, TRUE); - bonobo_event_source_notify_listeners_full (pop->es, - "GNOME/Evolution/Addressbook/AddressPopup", - "Event", - event, - arg, NULL); - bonobo_arg_release (arg); - } -} - -static void -contact_editor_cb (EBook *book, EBookStatus status, gpointer closure) -{ - EAddressPopup *pop = E_ADDRESS_POPUP (closure); - EContactEditor *ce = e_addressbook_show_contact_editor (book, pop->card, FALSE, TRUE); - e_address_popup_cleanup (pop); - emit_event (pop, "Destroy"); - e_contact_editor_raise (ce); -} - -static void -edit_contact_info_cb (EAddressPopup *pop) -{ - EBook *book; - emit_event (pop, "Hide"); - - book = e_book_new (); - if (!addressbook_load_default_book (book, contact_editor_cb, pop)) { - g_object_unref (book); - contact_editor_cb (NULL, E_BOOK_STATUS_OTHER_ERROR, pop); - } -} - -static void -e_address_popup_cardify (EAddressPopup *pop, ECard *card) -{ - GtkWidget *b; - - g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop)); - g_return_if_fail (card && E_IS_CARD (card)); - g_return_if_fail (pop->card == NULL); - - pop->card = card; - g_object_ref (pop->card); - - e_minicard_widget_set_card (E_MINICARD_WIDGET (pop->minicard_view), card); - gtk_widget_show (pop->minicard_view); - gtk_widget_hide (pop->generic_view); - - b = gtk_button_new_with_label (_("Edit Contact Info")); - gtk_box_pack_start (GTK_BOX (pop->main_vbox), b, TRUE, TRUE, 0); - g_signal_connect (b, - "clicked", - G_CALLBACK (edit_contact_info_cb), - pop); - gtk_widget_show (b); -} - -static void -add_contacts_cb (EAddressPopup *pop) -{ - if (pop->email && *pop->email) { - if (pop->name && *pop->name) - e_contact_quick_add (pop->name, pop->email, NULL, NULL); - else - e_contact_quick_add_free_form (pop->email, NULL, NULL); - - } - e_address_popup_cleanup (pop); - emit_event (pop, "Destroy"); -} - -static void -e_address_popup_no_matches (EAddressPopup *pop) -{ - GtkWidget *b; - - g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop)); - - b = gtk_button_new_with_label (_("Add to Contacts")); - gtk_box_pack_start (GTK_BOX (pop->main_vbox), b, TRUE, TRUE, 0); - g_signal_connect (b, - "clicked", - G_CALLBACK (add_contacts_cb), - pop); - gtk_widget_show (b); -} - -static void -wizard_destroy_cb (MiniWizard *wiz, gpointer closure) -{ - gtk_widget_destroy (GTK_WIDGET (closure)); -} - -static void -popup_size_allocate_cb (GtkWidget *widget, GtkAllocation *alloc, gpointer user_data) -{ - gint x, y, w, h, xmax, ymax; - - xmax = gdk_screen_width (); - ymax = gdk_screen_height (); - - if (g_object_get_data (G_OBJECT (widget), "size_allocate") == NULL) { - gdk_window_get_pointer (NULL, &x, &y, NULL); - w = alloc->width; - h = alloc->height; - x = CLAMP (x - w/2, 0, xmax - w); - y = CLAMP (y - h/2, 0, ymax - h); - gtk_widget_set_uposition (widget, x, y); - g_object_set_data (G_OBJECT (widget), "size_allocate", widget); - } -} - -static void -e_address_popup_ambiguous_email_add (EAddressPopup *pop, const GList *cards) -{ - MiniWizard *wiz = mini_wizard_new (); - GtkWidget *win = gtk_window_new (GTK_WINDOW_TOPLEVEL); - - wiz->destroy_cb = wizard_destroy_cb; - wiz->destroy_closure = win; - - gtk_window_set_title (GTK_WINDOW (win), _("Merge E-Mail Address")); - g_signal_connect (win, - "size_allocate", - G_CALLBACK (popup_size_allocate_cb), - NULL); - - /* FIXME: This hard-wired size is evil. */ - gtk_widget_set_usize (win, 275, 170); - - card_picker_init (wiz, cards, pop->name, pop->email); - - e_address_popup_cleanup (pop); - emit_event (pop, "Destroy"); - - gtk_container_add (GTK_CONTAINER (win), wiz->body); - gtk_widget_show_all (win); -} - -static void -e_address_popup_multiple_matches (EAddressPopup *pop, const GList *cards) -{ - pop->multiple_matches = TRUE; - - e_address_popup_ambiguous_email_add (pop, cards); -} - -/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/ - -/* - * Addressbook Query Fun - */ - -static void -name_only_query_cb (EBook *book, EBookSimpleQueryStatus status, const GList *cards, gpointer closure) -{ - EAddressPopup *pop; - - if (status != E_BOOK_SIMPLE_QUERY_STATUS_SUCCESS) - return; - - pop = E_ADDRESS_POPUP (closure); - - pop->query_tag = 0; - - if (cards == NULL) { - e_address_popup_no_matches (pop); - } else { - e_address_popup_ambiguous_email_add (pop, cards); - } -} - -static void -query_cb (EBook *book, EBookSimpleQueryStatus status, const GList *cards, gpointer closure) -{ - EAddressPopup *pop; - - if (status != E_BOOK_SIMPLE_QUERY_STATUS_SUCCESS) - return; - - pop = E_ADDRESS_POPUP (closure); - - pop->query_tag = 0; - gtk_widget_hide (pop->query_msg); - - if (cards == NULL) { - - /* Do a name-only query if: - (1) The name is non-empty. - (2) The e-mail is also non-empty (so that the query we just did wasn't actually a name-only query. - */ - if (pop->name && *pop->name && pop->email && *pop->email) { - pop->query_tag = e_book_name_and_email_query (book, pop->name, NULL, name_only_query_cb, pop); - } else { - e_address_popup_no_matches (pop); - } - - } else { - if (g_list_length ((GList *) cards) == 1) - e_address_popup_cardify (pop, E_CARD (cards->data)); - else - e_address_popup_multiple_matches (pop, cards); - } -} - -static void -start_query (EBook *book, EBookStatus status, gpointer closure) -{ - EAddressPopup *pop = E_ADDRESS_POPUP (closure); - - if (status != E_BOOK_STATUS_SUCCESS) { - e_address_popup_no_matches (pop); - return; - } - - if (pop->query_tag) - e_book_simple_query_cancel (book, pop->query_tag); - - if (pop->book != book) { - g_object_ref (book); - if (pop->book) - g_object_unref (pop->book); - pop->book = book; - } - - pop->query_tag = e_book_name_and_email_query (book, pop->name, pop->email, query_cb, pop); - - g_object_unref (pop); -} - -static void -e_address_popup_query (EAddressPopup *pop) -{ - EBook *book; - - g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop)); - - book = e_book_new (); - g_object_ref (pop); - - if (!addressbook_load_default_book (book, start_query, pop)) { - g_object_unref (book); - start_query (NULL, E_BOOK_STATUS_OTHER_ERROR, pop); - } -} - -/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/ - -enum { - PROPERTY_NAME, - PROPERTY_EMAIL, - PROPERTY_TRANSITORY -}; - -static void -set_prop (BonoboPropertyBag *bag, const BonoboArg *arg, guint arg_id, CORBA_Environment *ev, gpointer user_data) -{ - EAddressPopup *pop = E_ADDRESS_POPUP (user_data); - - switch (arg_id) { - - case PROPERTY_NAME: - e_address_popup_set_name (pop, BONOBO_ARG_GET_STRING (arg)); - break; - - case PROPERTY_EMAIL: - e_address_popup_set_email (pop, BONOBO_ARG_GET_STRING (arg)); - break; - - default: - g_assert_not_reached (); - } -} - -static void -get_prop (BonoboPropertyBag *bag, BonoboArg *arg, guint arg_id, CORBA_Environment *ev, gpointer user_data) -{ - EAddressPopup *pop = E_ADDRESS_POPUP (user_data); - - switch (arg_id) { - - case PROPERTY_NAME: - BONOBO_ARG_SET_STRING (arg, pop->name); - break; - - case PROPERTY_EMAIL: - BONOBO_ARG_SET_STRING (arg, pop->email); - break; - - case PROPERTY_TRANSITORY: - BONOBO_ARG_SET_BOOLEAN (arg, pop->transitory); - break; - - default: - g_assert_not_reached (); - } -} - -BonoboControl * -e_address_popup_new_control (void) -{ - BonoboControl *control; - BonoboPropertyBag *bag; - EAddressPopup *addy; - GtkWidget *w; - - w = e_address_popup_new (); - addy = E_ADDRESS_POPUP (w); - - control = bonobo_control_new (w); - gtk_widget_show (w); - - bag = bonobo_property_bag_new (get_prop, set_prop, w); - bonobo_property_bag_add (bag, "name", PROPERTY_NAME, - BONOBO_ARG_STRING, NULL, NULL, - BONOBO_PROPERTY_WRITEABLE | BONOBO_PROPERTY_READABLE); - - bonobo_property_bag_add (bag, "email", PROPERTY_EMAIL, - BONOBO_ARG_STRING, NULL, NULL, - BONOBO_PROPERTY_WRITEABLE | BONOBO_PROPERTY_READABLE); - - bonobo_property_bag_add (bag, "transitory", PROPERTY_TRANSITORY, - BONOBO_ARG_BOOLEAN, NULL, NULL, - BONOBO_PROPERTY_READABLE); - - bonobo_control_set_properties (control, bonobo_object_corba_objref (BONOBO_OBJECT (bag)), NULL); - bonobo_object_unref (BONOBO_OBJECT (bag)); - - addy->es = bonobo_event_source_new (); - bonobo_object_add_interface (BONOBO_OBJECT (control), - BONOBO_OBJECT (addy->es)); - - return control; -} diff --git a/addressbook/gui/component/e-address-popup.h b/addressbook/gui/component/e-address-popup.h deleted file mode 100644 index b2519b0ee6..0000000000 --- a/addressbook/gui/component/e-address-popup.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * e-address-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_ADDRESS_POPUP_H__ -#define __E_ADDRESS_POPUP_H__ - -#include <gtk/gtk.h> -#include <addressbook/backend/ebook/e-book.h> -#include <addressbook/backend/ebook/e-card.h> -#include <bonobo/bonobo-event-source.h> - -G_BEGIN_DECLS - -#define E_TYPE_ADDRESS_POPUP (e_address_popup_get_type ()) -#define E_ADDRESS_POPUP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_ADDRESS_POPUP, EAddressPopup)) -#define E_ADDRESS_POPUP_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), E_TYPE_ADDRESS_POPUP, EAddressPopupClass)) -#define E_IS_ADDRESS_POPUP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_ADDRESS_POPUP)) -#define E_IS_ADDRESS_POPUP_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_ADDRESS_POPUP)) - -typedef struct _EAddressPopup EAddressPopup; -typedef struct _EAddressPopupClass EAddressPopupClass; - -struct _EAddressPopup { - GtkEventBox parent; - - gchar *name; - gchar *email; - - GtkWidget *name_widget; - GtkWidget *email_widget; - GtkWidget *query_msg; - - GtkWidget *main_vbox; - GtkWidget *generic_view; - GtkWidget *minicard_view; - - gboolean transitory; - - guint scheduled_refresh; - EBook *book; - guint query_tag; - gboolean multiple_matches; - ECard *card; - - BonoboEventSource *es; -}; - -struct _EAddressPopupClass { - GtkEventBoxClass parent_class; -}; - -GType e_address_popup_get_type (void); - -void e_address_popup_set_name (EAddressPopup *, const gchar *name); -void e_address_popup_set_email (EAddressPopup *, const gchar *email); - -void e_address_popup_construct (EAddressPopup *); -GtkWidget *e_address_popup_new (void); - -BonoboControl *e_address_popup_new_control (void); - -G_END_DECLS - -#endif /* __E_ADDRESS_POPUP_H__ */ - diff --git a/addressbook/gui/component/e-address-widget.c b/addressbook/gui/component/e-address-widget.c deleted file mode 100644 index c601278807..0000000000 --- a/addressbook/gui/component/e-address-widget.c +++ /dev/null @@ -1,558 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * e-address-widget.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 <ctype.h> -#include <gtk/gtklabel.h> -#include <libgnomeui/gnome-popup-menu.h> -#include <bonobo/bonobo-control.h> -#include <bonobo/bonobo-property-bag.h> -#include <bonobo/bonobo-generic-factory.h> -#include <addressbook/gui/contact-editor/e-contact-quick-add.h> -#include "e-address-widget.h" - -static void e_address_widget_class_init (EAddressWidgetClass *klass); -static void e_address_widget_init (EAddressWidget *obj); -static void e_address_widget_destroy (GtkObject *obj); - -static gint e_address_widget_button_press_handler (GtkWidget *w, GdkEventButton *ev); -static void e_address_widget_popup (EAddressWidget *, GdkEventButton *ev); -static void e_address_widget_schedule_query (EAddressWidget *); - -static GtkObjectClass *parent_class; - -static EBook *common_book = NULL; /* sort of lame */ - -static gboolean doing_queries = FALSE; - -static void -e_address_widget_class_init (EAddressWidgetClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); - - object_class->destroy = e_address_widget_destroy; - - widget_class->button_press_event = e_address_widget_button_press_handler; -} - -static void -e_address_widget_init (EAddressWidget *addr) -{ - -} - -static void -e_address_widget_destroy (GtkObject *obj) -{ - EAddressWidget *addr = E_ADDRESS_WIDGET (obj); - - g_free (addr->name); - g_free (addr->email); - - if (addr->query_tag) - e_book_simple_query_cancel (common_book, addr->query_tag); - - if (addr->query_idle_tag) - gtk_idle_remove (addr->query_idle_tag); -} - -static gint -e_address_widget_button_press_handler (GtkWidget *w, GdkEventButton *ev) -{ - EAddressWidget *addr = E_ADDRESS_WIDGET (w); - if (ev->button == 3 && ev->state == 0) { - e_address_widget_popup (addr, ev); - return TRUE; - } - - return FALSE; -} - -GType -e_address_widget_get_type (void) -{ - static GType aw_type = 0; - - if (!aw_type) { - static const GTypeInfo aw_info = { - sizeof (EAddressWidgetClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_address_widget_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EAddressWidget), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_address_widget_init, - }; - - aw_type = g_type_register_static (gtk_event_box_get_type (), "EAddressWidget", &aw_info, 0); - } - - return aw_type; -} - -static void -gtk_widget_visible (GtkWidget *w, gboolean x) -{ - if (x) - gtk_widget_show (w); - else - gtk_widget_hide (w); -} - -static void -e_address_widget_refresh (EAddressWidget *addr) -{ - gchar *str; - gboolean have_name, have_email; - - g_return_if_fail (addr && E_IS_ADDRESS_WIDGET (addr)); - - have_name = addr->name && *addr->name; - have_email = addr->email && *addr->email && (addr->card == NULL || !addr->known_email); - - gtk_label_set_text (GTK_LABEL (addr->name_widget), have_name ? addr->name : ""); - gtk_widget_visible (addr->name_widget, have_name); - if (addr->card) { - gint i, N = strlen (addr->name); - gchar *pattern = g_malloc (N+1); - for (i=0; i<N; ++i) - pattern[i] = '_'; - pattern[i] = '\0'; - gtk_label_set_pattern (GTK_LABEL (addr->name_widget), pattern); - g_free (pattern); - } else { - gtk_label_set_pattern (GTK_LABEL (addr->name_widget), ""); - } - - if (have_email) { - str = g_strdup_printf (have_name ? "<%s>" : "%s", addr->email); - gtk_label_set_text (GTK_LABEL (addr->email_widget), str); - g_free (str); - } else { - gtk_label_set_text (GTK_LABEL (addr->email_widget), ""); - } - gtk_widget_visible (addr->email_widget, have_email); - - gtk_widget_visible (addr->spacer, have_name && have_email); - - /* Launch a query to find the appropriate card, if necessary. */ - if (addr->card == NULL) - e_address_widget_schedule_query (addr); -} - -void -e_address_widget_set_name (EAddressWidget *addr, const gchar *name) -{ - g_return_if_fail (addr && E_IS_ADDRESS_WIDGET (addr)); - - g_free (addr->name); - addr->name = g_strdup (name); - - e_address_widget_refresh (addr); -} - -void -e_address_widget_set_email (EAddressWidget *addr, const gchar *email) -{ - g_return_if_fail (addr && E_IS_ADDRESS_WIDGET (addr)); - - g_free (addr->email); - addr->email = g_strdup (email); - - e_address_widget_refresh (addr); -} - - -void -e_address_widget_set_text (EAddressWidget *addr, const gchar *text) -{ - g_return_if_fail (addr && E_IS_ADDRESS_WIDGET (addr)); - - e_address_widget_set_email (addr, text); /* CRAP */ -} - -void -e_address_widget_construct (EAddressWidget *addr) -{ - GtkWidget *box; - - g_return_if_fail (addr && E_IS_ADDRESS_WIDGET (addr)); - - box = gtk_hbox_new (FALSE, 2); - - addr->name_widget = gtk_label_new (""); - addr->spacer = gtk_label_new (" "); - addr->email_widget = gtk_label_new (""); - - gtk_box_pack_start (GTK_BOX (box), addr->name_widget, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (box), addr->spacer, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (box), addr->email_widget, FALSE, FALSE, 0); - - gtk_container_add (GTK_CONTAINER (addr), box); - - gtk_widget_show (box); - gtk_widget_show (addr->name_widget); - gtk_widget_show (addr->email_widget); -} - -GtkWidget * -e_address_widget_new (void) -{ - EAddressWidget *addr = g_object_new (E_TYPE_ADDRESS_WIDGET, NULL); - e_address_widget_construct (addr); - return GTK_WIDGET (addr); -} - -/* - * - * Cardification - * - */ - -static void -e_address_widget_cardify (EAddressWidget *addr, ECard *card, gboolean known_email) -{ - if (addr->card != card || addr->known_email != known_email) { - - if (addr->card != card) { - if (addr->card) - g_object_unref (addr->card); - addr->card = card; - g_object_ref (addr->card); - } - - addr->known_email = known_email; - - if (!(addr->name && *addr->name)) { - gchar *s = e_card_name_to_string (card->name); - e_address_widget_set_name (addr, s); - g_free (s); - } - - e_address_widget_refresh (addr); - } -} - -static void -query_results_cb (EBook *book, EBookSimpleQueryStatus status, const GList *cards, gpointer user_data) -{ - EAddressWidget *addr = user_data; - - if (g_list_length ((GList *) cards) == 1) { - ECard *card = E_CARD (cards->data); - e_address_widget_cardify (addr, card, TRUE); - } - - addr->query_tag = 0; -} - -static void -e_address_widget_do_query (EAddressWidget *addr) -{ - e_book_name_and_email_query (common_book, addr->name, addr->email, query_results_cb, addr); -} - -static void -book_ready_cb (EBook *book, EBookStatus status, gpointer user_data) -{ - EAddressWidget *addr = E_ADDRESS_WIDGET (user_data); - - if (common_book == NULL) { - common_book = book; - g_object_ref (common_book); - } else - g_object_unref (book); - - e_address_widget_do_query (addr); -} - -static gint -query_idle_fn (gpointer ptr) -{ - EAddressWidget *addr = E_ADDRESS_WIDGET (ptr); - - if (common_book) { - e_address_widget_do_query (addr); - } else { - e_book_load_default_book (e_book_new (), book_ready_cb, addr); - } - - addr->query_idle_tag = 0; - return FALSE; -} - -static void -e_address_widget_schedule_query (EAddressWidget *addr) -{ - if (addr->query_idle_tag || !doing_queries) - return; - addr->query_idle_tag = gtk_idle_add (query_idle_fn, addr); -} - -/* - * - * Popup Menu - * - */ - -#define ARBITRARY_UIINFO_LIMIT 64 - -static gint -popup_add_name_and_address (EAddressWidget *addr, GnomeUIInfo *uiinfo, gint i) -{ - gboolean flag = FALSE; - - if (addr->name && *addr->name) { - uiinfo[i].type = GNOME_APP_UI_ITEM; - uiinfo[i].label = addr->name; - ++i; - flag = TRUE; - } - - if (addr->email && *addr->email) { - uiinfo[i].type = GNOME_APP_UI_ITEM; - uiinfo[i].label = addr->email; - ++i; - flag = TRUE; - } - - if (flag) { - uiinfo[i].type = GNOME_APP_UI_SEPARATOR; - ++i; - } - - return i; -} - -static void -flip_queries_flag_cb (GtkWidget *w, gpointer user_data) -{ - doing_queries = !doing_queries; -} - -static gint -popup_add_query_change (EAddressWidget *addr, GnomeUIInfo *uiinfo, gint i) -{ - uiinfo[i].type = GNOME_APP_UI_SEPARATOR; - ++i; - - uiinfo[i].type = GNOME_APP_UI_ITEM; - uiinfo[i].label = doing_queries ? _("Disable Queries") : _("Enable Queries (Dangerous!)"); - uiinfo[i].moreinfo = flip_queries_flag_cb; - ++i; - - return i; -} - - -static GtkWidget * -popup_menu_card (EAddressWidget *addr) -{ - GnomeUIInfo uiinfo[ARBITRARY_UIINFO_LIMIT]; - GtkWidget *pop; - gint i=0; - ECard *card = E_CARD (addr->card); - - g_return_val_if_fail (card != NULL, NULL); - - memset (uiinfo, 0, sizeof (uiinfo)); - - i = popup_add_name_and_address (addr, uiinfo, i); - - uiinfo[i].type = GNOME_APP_UI_ITEM; - uiinfo[i].label = _("Edit Contact Info"); - ++i; - - i = popup_add_query_change (addr, uiinfo, i); - - uiinfo[i].type = GNOME_APP_UI_ENDOFINFO; - pop = gnome_popup_menu_new (uiinfo); - return pop; -} - -static void -post_quick_add_cb (ECard *card, gpointer user_data) -{ - e_address_widget_cardify (E_ADDRESS_WIDGET (user_data), card, TRUE); -} - -static void -add_contacts_cb (GtkWidget *w, gpointer user_data) -{ - EAddressWidget *addr = E_ADDRESS_WIDGET (user_data); - - e_contact_quick_add (addr->name, addr->email, post_quick_add_cb, addr); -} - -static GtkWidget * -popup_menu_nocard (EAddressWidget *addr) -{ - GnomeUIInfo uiinfo[ARBITRARY_UIINFO_LIMIT]; - GtkWidget *pop; - gint i=0; - - memset (uiinfo, 0, sizeof (uiinfo)); - - i = popup_add_name_and_address (addr, uiinfo, i); - - uiinfo[i].type = GNOME_APP_UI_ITEM; - uiinfo[i].label = _("Add to Contacts"); - uiinfo[i].moreinfo = add_contacts_cb; - ++i; - - i = popup_add_query_change (addr, uiinfo, i); - - uiinfo[i].type = GNOME_APP_UI_ENDOFINFO; - pop = gnome_popup_menu_new (uiinfo); - return pop; -} - -static void -e_address_widget_popup (EAddressWidget *addr, GdkEventButton *ev) -{ - GtkWidget *pop; - - g_return_if_fail (addr && E_IS_ADDRESS_WIDGET (addr)); - - pop = addr->card ? popup_menu_card (addr) : popup_menu_nocard (addr); - - if (pop) - gnome_popup_menu_do_popup (pop, NULL, NULL, ev, addr, GTK_WIDGET (addr)); -} - -/* - * - * Bonobo Control Magic - * - */ - -enum { - ADDRESS_PROPERTY_NAME, - ADDRESS_PROPERTY_EMAIL, - ADDRESS_PROPERTY_TEXT, - ADDRESS_PROPERTY_BACKGROUND_RGB -}; - - -static void -get_prop (BonoboPropertyBag *bag, BonoboArg *arg, guint arg_id, CORBA_Environment *ev, gpointer user_data) -{ - EAddressWidget *addr = E_ADDRESS_WIDGET (user_data); - - switch (arg_id) { - - case ADDRESS_PROPERTY_NAME: - BONOBO_ARG_SET_STRING (arg, addr->name ? addr->name :""); - break; - - case ADDRESS_PROPERTY_EMAIL: - BONOBO_ARG_SET_STRING (arg, addr->email ? addr->email : ""); - break; - - case ADDRESS_PROPERTY_TEXT: - BONOBO_ARG_SET_STRING (arg, "?"); - break; - } -} - -static void -set_prop (BonoboPropertyBag *bag, const BonoboArg *arg, guint arg_id, CORBA_Environment *ev, gpointer user_data) -{ - EAddressWidget *addr = E_ADDRESS_WIDGET (user_data); - - switch (arg_id) { - case ADDRESS_PROPERTY_NAME: - e_address_widget_set_name (addr, BONOBO_ARG_GET_STRING (arg)); - break; - - case ADDRESS_PROPERTY_EMAIL: - e_address_widget_set_email (addr, BONOBO_ARG_GET_STRING (arg)); - break; - - case ADDRESS_PROPERTY_TEXT: - e_address_widget_set_text (addr, BONOBO_ARG_GET_STRING (arg)); - break; - - - case ADDRESS_PROPERTY_BACKGROUND_RGB: - { - gint bg = BONOBO_ARG_GET_INT (arg); - GdkColor color; - - color.red = (bg & 0xff0000) >> 8; - color.green = (bg & 0x00ff00); - color.blue = (bg & 0x0000ff) << 8; - - if (gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (addr)), &color, FALSE, TRUE)) { - GtkStyle *style = gtk_style_copy (gtk_widget_get_style (GTK_WIDGET (addr))); - style->bg[0] = color; - gtk_widget_set_style (GTK_WIDGET (addr), style); - } - } - - break; - } -} - -BonoboControl * -e_address_widget_factory_new_control (void) -{ - BonoboControl *control; - BonoboPropertyBag *bag; - GtkWidget *w; - - w = e_address_widget_new (); - gtk_widget_show (w); - - control = bonobo_control_new (w); - - bag = bonobo_property_bag_new (get_prop, set_prop, w); - bonobo_property_bag_add (bag, "name", ADDRESS_PROPERTY_NAME, - BONOBO_ARG_STRING, NULL, NULL, - BONOBO_PROPERTY_READABLE | BONOBO_PROPERTY_WRITEABLE); - - bonobo_property_bag_add (bag, "email", ADDRESS_PROPERTY_EMAIL, - BONOBO_ARG_STRING, NULL, NULL, - BONOBO_PROPERTY_READABLE | BONOBO_PROPERTY_WRITEABLE); - - bonobo_property_bag_add (bag, "text", ADDRESS_PROPERTY_TEXT, - BONOBO_ARG_STRING, NULL, NULL, - BONOBO_PROPERTY_READABLE | BONOBO_PROPERTY_WRITEABLE); - - bonobo_property_bag_add (bag, "background_rgb", ADDRESS_PROPERTY_BACKGROUND_RGB, - BONOBO_ARG_INT, NULL, NULL, - BONOBO_PROPERTY_WRITEABLE); - - bonobo_control_set_properties (control, bonobo_object_corba_objref (BONOBO_OBJECT (bag)), NULL); - bonobo_object_unref (BONOBO_OBJECT (bag)); - - return control; -} diff --git a/addressbook/gui/component/e-address-widget.h b/addressbook/gui/component/e-address-widget.h deleted file mode 100644 index 13e4a417d0..0000000000 --- a/addressbook/gui/component/e-address-widget.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * e-address-widget.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_ADDRESS_WIDGET_H__ -#define __E_ADDRESS_WIDGET_H__ - -#include <gtk/gtkeventbox.h> -#include <gtk/gtkhbox.h> -#include <gtk/gtkobject.h> -#include <gtk/gtkwidget.h> -#include <addressbook/backend/ebook/e-book-util.h> -#include <addressbook/backend/ebook/e-card.h> - -G_BEGIN_DECLS - -#define E_TYPE_ADDRESS_WIDGET (e_address_widget_get_type ()) -#define E_ADDRESS_WIDGET(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_ADDRESS_WIDGET, EAddressWidget)) -#define E_ADDRESS_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), E_TYPE_ADDRESS_WIDGET, EAddressWidgetClass)) -#define E_IS_ADDRESS_WIDGET(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_ADDRESS_WIDGET)) -#define E_IS_ADDRESS_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_ADDRESS_WIDGET)) - -typedef struct _EAddressWidget EAddressWidget; -typedef struct _EAddressWidgetClass EAddressWidgetClass; - -struct _EAddressWidget { - GtkEventBox parent; - - gchar *name; - gchar *email; - - GtkWidget *name_widget; - GtkWidget *email_widget; - GtkWidget *spacer; - - guint query_idle_tag; - guint query_tag; - - ECard *card; - gboolean known_email; -}; - -struct _EAddressWidgetClass { - GtkEventBoxClass parent_class; -}; - -GType e_address_widget_get_type (void); - -void e_address_widget_set_name (EAddressWidget *, const gchar *name); -void e_address_widget_set_email (EAddressWidget *, const gchar *email); -void e_address_widget_set_text (EAddressWidget *, const gchar *text); - -void e_address_widget_construct (EAddressWidget *); -GtkWidget *e_address_widget_new (void); - -BonoboControl *e_address_widget_new_control (void); - -G_END_DECLS - -#endif /* __E_ADDRESS_WIDGET_H__ */ diff --git a/addressbook/gui/component/e-cardlist-model.c b/addressbook/gui/component/e-cardlist-model.c deleted file mode 100644 index 5635d25f86..0000000000 --- a/addressbook/gui/component/e-cardlist-model.c +++ /dev/null @@ -1,233 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * - * Author: - * Christopher James Lahey <clahey@ximian.com> - * - * (C) 1999 Ximian, Inc. - */ - -#include <config.h> -#include <libxml/tree.h> -#include <libxml/parser.h> -#include <libxml/xmlmemory.h> - -#include <string.h> - -#include "e-cardlist-model.h" - -#define PARENT_TYPE e_table_model_get_type() - -static void -e_cardlist_model_dispose(GObject *object) -{ - ECardlistModel *model = E_CARDLIST_MODEL(object); - int i; - - for ( i = 0; i < model->data_count; i++ ) { - g_object_unref(model->data[i]); - } - g_free(model->data); -} - -/* This function returns the number of columns in our ETableModel. */ -static int -e_cardlist_model_col_count (ETableModel *etc) -{ - return E_CARD_SIMPLE_FIELD_LAST; -} - -/* This function returns the number of rows in our ETableModel. */ -static int -e_cardlist_model_row_count (ETableModel *etc) -{ - ECardlistModel *e_cardlist_model = E_CARDLIST_MODEL(etc); - return e_cardlist_model->data_count; -} - -/* This function returns the value at a particular point in our ETableModel. */ -static void * -e_cardlist_model_value_at (ETableModel *etc, int col, int row) -{ - ECardlistModel *e_cardlist_model = E_CARDLIST_MODEL(etc); - const char *value; - if ( col >= E_CARD_SIMPLE_FIELD_LAST - 1|| row >= e_cardlist_model->data_count ) - return NULL; - value = e_card_simple_get_const(e_cardlist_model->data[row], - col + 1); - return (void *)(value ? value : ""); -} - -/* This function sets the value at a particular point in our ETableModel. */ -static void -e_cardlist_model_set_value_at (ETableModel *etc, int col, int row, const void *val) -{ - ECardlistModel *e_cardlist_model = E_CARDLIST_MODEL(etc); - ECard *card; - if ( col >= E_CARD_SIMPLE_FIELD_LAST - 1|| row >= e_cardlist_model->data_count ) - return; - e_table_model_pre_change(etc); - e_card_simple_set(e_cardlist_model->data[row], - col + 1, - val); - g_object_get(e_cardlist_model->data[row], - "card", &card, - NULL); - - e_table_model_cell_changed(etc, col, row); -} - -/* This function returns whether a particular cell is editable. */ -static gboolean -e_cardlist_model_is_cell_editable (ETableModel *etc, int col, int row) -{ - return TRUE; -} - -/* This function duplicates the value passed to it. */ -static void * -e_cardlist_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_cardlist_model_free_value (ETableModel *etc, int col, void *value) -{ - g_free(value); -} - -static void * -e_cardlist_model_initialize_value (ETableModel *etc, int col) -{ - return g_strdup(""); -} - -static gboolean -e_cardlist_model_value_is_empty (ETableModel *etc, int col, const void *value) -{ - return !(value && *(char *)value); -} - -static char * -e_cardlist_model_value_to_string (ETableModel *etc, int col, const void *value) -{ - return g_strdup(value); -} - -void -e_cardlist_model_add(ECardlistModel *model, - ECard **cards, - int count) -{ - int i; - model->data = g_realloc(model->data, model->data_count + count * sizeof(ECard *)); - for (i = 0; i < count; i++) { - gboolean found = FALSE; - const gchar *id = e_card_get_id(cards[i]); - for ( i = 0; i < model->data_count; i++) { - if ( !strcmp(e_card_simple_get_id(model->data[i]), id) ) { - found = TRUE; - break; - } - } - if (!found) { - e_table_model_pre_change(E_TABLE_MODEL(model)); - g_object_ref(cards[i]); - model->data[model->data_count++] = e_card_simple_new (cards[i]); - e_table_model_row_inserted(E_TABLE_MODEL(model), model->data_count - 1); - } - } -} - -void -e_cardlist_model_remove(ECardlistModel *model, - const char *id) -{ - int i; - for ( i = 0; i < model->data_count; i++) { - if ( !strcmp(e_card_simple_get_id(model->data[i]), id) ) { - e_table_model_pre_change(E_TABLE_MODEL(model)); - g_object_unref(model->data[i]); - memmove(model->data + i, model->data + i + 1, (model->data_count - i - 1) * sizeof (ECard *)); - e_table_model_row_deleted(E_TABLE_MODEL(model), i); - } - } -} - -static void -e_cardlist_model_class_init (GObjectClass *object_class) -{ - ETableModelClass *model_class = (ETableModelClass *) object_class; - - object_class->dispose = e_cardlist_model_dispose; - - model_class->column_count = e_cardlist_model_col_count; - model_class->row_count = e_cardlist_model_row_count; - model_class->value_at = e_cardlist_model_value_at; - model_class->set_value_at = e_cardlist_model_set_value_at; - model_class->is_cell_editable = e_cardlist_model_is_cell_editable; - model_class->duplicate_value = e_cardlist_model_duplicate_value; - model_class->free_value = e_cardlist_model_free_value; - model_class->initialize_value = e_cardlist_model_initialize_value; - model_class->value_is_empty = e_cardlist_model_value_is_empty; - model_class->value_to_string = e_cardlist_model_value_to_string; -} - -static void -e_cardlist_model_init (GObject *object) -{ - ECardlistModel *model = E_CARDLIST_MODEL(object); - model->data = NULL; - model->data_count = 0; -} - -ECard * -e_cardlist_model_get(ECardlistModel *model, - int row) -{ - if (model->data && row < model->data_count) { - ECard *card; - g_object_get(model->data[row], - "card", &card, - NULL); - g_object_ref(card); - return card; - } - return NULL; -} - -GType -e_cardlist_model_get_type (void) -{ - static GType aw_type = 0; - - if (!aw_type) { - static const GTypeInfo aw_info = { - sizeof (ECardlistModelClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_cardlist_model_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (ECardlistModel), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_cardlist_model_init, - }; - - aw_type = g_type_register_static (PARENT_TYPE, "ECardlistModel", &aw_info, 0); - } - - return aw_type; -} - -ETableModel * -e_cardlist_model_new (void) -{ - ECardlistModel *et; - - et = g_object_new (E_TYPE_CARDLIST_MODEL, NULL); - - return E_TABLE_MODEL(et); -} diff --git a/addressbook/gui/component/e-cardlist-model.h b/addressbook/gui/component/e-cardlist-model.h deleted file mode 100644 index 0968e936fc..0000000000 --- a/addressbook/gui/component/e-cardlist-model.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_CARDLIST_MODEL_H_ -#define _E_CARDLIST_MODEL_H_ - -#include <gal/e-table/e-table-model.h> -#include <ebook/e-book.h> -#include <ebook/e-book-view.h> -#include <ebook/e-card-simple.h> - -#define E_TYPE_CARDLIST_MODEL (e_cardlist_model_get_type ()) -#define E_CARDLIST_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_CARDLIST_MODEL, ECardlistModel)) -#define E_CARDLIST_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_CARDLIST_MODEL, ECardlistModelClass)) -#define E_IS_CARDLIST_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_CARDLIST_MODEL)) -#define E_IS_CARDLIST_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_CARDLIST_MODEL)) - -typedef struct { - ETableModel parent; - - /* item specific fields */ - ECardSimple **data; - int data_count; -} ECardlistModel; - - -typedef struct { - ETableModelClass parent_class; -} ECardlistModelClass; - - -GType e_cardlist_model_get_type (void); -ETableModel *e_cardlist_model_new (void); - -/* Returns object with an extra ref count. */ -ECard *e_cardlist_model_get (ECardlistModel *model, - int row); -void e_cardlist_model_add (ECardlistModel *model, - ECard **card, - int count); -void e_cardlist_model_remove (ECardlistModel *model, - const char *id); - -#endif /* _E_CARDLIST_MODEL_H_ */ diff --git a/addressbook/gui/component/ldap-config.glade b/addressbook/gui/component/ldap-config.glade deleted file mode 100644 index 4a5d00ba07..0000000000 --- a/addressbook/gui/component/ldap-config.glade +++ /dev/null @@ -1,6299 +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="Add/Edit Attribute Mappings--Simple Version"> - <property name="visible">no</property> - <property name="title" translatable="yes">Add (or Edit) Attribute Mappings</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="modal">no</property> - <property name="allow_shrink">yes</property> - <property name="allow_grow">yes</property> - <property name="window-position">GTK_WIN_POS_NONE</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="dialog-vbox4"> - <property name="homogeneous">no</property> - <property name="spacing">8</property> - <property name="visible">yes</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="dialog-action_area4"> - <property name="layout_style">GTK_BUTTONBOX_END</property> - <property name="spacing">8</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button37"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="visible">yes</property> - <property name="label">gtk-ok</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button39"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="visible">yes</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">yes</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox30"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox66"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap35"> - <property name="pixbuf">ldap.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label283"> - <property name="label" translatable="yes">Please select an Evolution attribute and an -LDAP attribute to associate with it.</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator8"> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table18"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="row_spacing">3</property> - <property name="column_spacing">3</property> - <property name="n-rows">2</property> - <property name="n-columns">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label284"> - <property name="label" translatable="yes">_Evolution attribute:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">combo-entry2</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label285"> - <property name="label" translatable="yes">_LDAP attribute:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">combo-entry3</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkCombo" id="combo4"> - <property name="value_in_list">no</property> - <property name="case_sensitive">no</property> - <property name="enable_arrow_keys">yes</property> - <property name="enable_arrows_always">no</property> - <property name="allow_empty">yes</property> - <property name="visible">yes</property> - - <child internal-child="entry"> - <widget class="GtkEntry" id="combo-entry2"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - </child> - - <child internal-child="list"> - <widget class="GtkList" id="convertwidget1"> - <property name="visible">yes</property> - - <child> - <widget class="GtkListItem" id="convertwidget2"> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="convertwidget3"> - <property name="label" translatable="yes"></property> - <property name="xalign">0.0</property> - <property name="visible">yes</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">0</property> - <property name="bottom_attach">1</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkCombo" id="combo5"> - <property name="value_in_list">no</property> - <property name="case_sensitive">no</property> - <property name="enable_arrow_keys">yes</property> - <property name="enable_arrows_always">no</property> - <property name="allow_empty">yes</property> - <property name="visible">yes</property> - - <child internal-child="entry"> - <widget class="GtkEntry" id="combo-entry3"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - </child> - - <child internal-child="list"> - <widget class="GtkList" id="convertwidget4"> - <property name="visible">yes</property> - - <child> - <widget class="GtkListItem" id="convertwidget5"> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="convertwidget6"> - <property name="label" translatable="yes"></property> - <property name="xalign">0.0</property> - <property name="visible">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">4</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <widget class="GtkDialog" id="Add/Edit Attribute Mappings-- Multiple Selection Version"> - <property name="visible">no</property> - <property name="title" translatable="yes">Add (or Edit) Attribute Mappings</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="modal">no</property> - <property name="default_width">393</property> - <property name="default_height">324</property> - <property name="allow_shrink">no</property> - <property name="allow_grow">yes</property> - <property name="window-position">GTK_WIN_POS_NONE</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="vbox31"> - <property name="homogeneous">no</property> - <property name="spacing">8</property> - <property name="visible">yes</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="hbuttonbox9"> - <property name="layout_style">GTK_BUTTONBOX_END</property> - <property name="spacing">8</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button40"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="visible">yes</property> - <property name="label">gtk-ok</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button41"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="visible">yes</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">yes</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox32"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox67"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap36"> - <property name="pixbuf">ldap.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label286"> - <property name="label" translatable="yes">Please select an Evolution attribute and an -LDAP attribute to associate with it.</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator9"> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table19"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="row_spacing">3</property> - <property name="column_spacing">3</property> - <property name="n-rows">2</property> - <property name="n-columns">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label287"> - <property name="label" translatable="yes">_Evolution attribute:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">entry32</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkCombo" id="combo6"> - <property name="value_in_list">no</property> - <property name="case_sensitive">no</property> - <property name="enable_arrow_keys">yes</property> - <property name="enable_arrows_always">no</property> - <property name="allow_empty">yes</property> - <property name="visible">yes</property> - - <child internal-child="entry"> - <widget class="GtkEntry" id="entry32"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - </child> - - <child internal-child="list"> - <widget class="GtkList" id="convertwidget7"> - <property name="visible">yes</property> - - <child> - <widget class="GtkListItem" id="convertwidget8"> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="convertwidget9"> - <property name="label" translatable="yes"></property> - <property name="xalign">0.0</property> - <property name="visible">yes</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">0</property> - <property name="bottom_attach">1</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label288"> - <property name="label" translatable="yes">_LDAP attributes:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">7.45058e-09</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">expand|fill</property> - </packing> - </child> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow6"> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkTreeView" id="clist4"> - <property name="can_focus">yes</property> - <property name="headers-visible">yes</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label289"> - <property name="child_name">CList:title</property> - <property name="label" translatable="yes">Attribute</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label290"> - <property name="child_name">CList:title</property> - <property name="label" translatable="yes">Select</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - </child> - - <child internal-child="hscrollbar"> - <widget class="GtkHScrollbar" id="convertwidget10"> - <property name="update_policy">GTK_UPDATE_CONTINUOUS</property> - <property name="visible">yes</property> - </widget> - </child> - - <child internal-child="vscrollbar"> - <widget class="GtkVScrollbar" id="convertwidget11"> - <property name="update_policy">GTK_UPDATE_CONTINUOUS</property> - <property name="visible">yes</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="x_padding">0</property> - <property name="y_padding">0</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">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">4</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <widget class="GtkWindow" id="account-editor-window"> - <property name="visible">no</property> - <property name="title" translatable="yes">account-editor</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="GtkVBox" id="vbox37"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkNotebook" id="account-editor-notebook"> - <property name="can_focus">yes</property> - <property name="show_tabs">yes</property> - <property name="show_border">yes</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">no</property> - <property name="tab_hborder">2</property> - <property name="tab_vborder">2</property> - <property name="enable-popup">no</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkVBox" id="account-editor-general-vbox"> - <property name="border_width">6</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox100"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">4</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label431"> - <property name="label" translatable="yes">_Display name:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment45"> - <property name="xalign">1</property> - <property name="yalign">0.5</property> - <property name="xscale">0.9</property> - <property name="yscale">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkEntry" id="account-editor-display-name-entry"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator12"> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label331"> - <property name="label" translatable="yes">General</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="account-editor-connecting-vbox"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label334"> - <property name="label" translatable="yes">Connecting</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="account-editor-searching-vbox"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label344"> - <property name="label" translatable="yes">Searching</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="account-editor-objectclasses-vbox"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="account-editor-objectclasses-label"> - <property name="label" translatable="yes">Objectclasses</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="account-editor-mappings-vbox"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="account-editor-mappings-label"> - <property name="label" translatable="yes">Mappings</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="account-editor-dn-customization-vbox"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="account-editor-dn-customization-label"> - <property name="label" translatable="yes">DN Customization</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator10"> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox120"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkNotebook" id="account-editor-advanced-button-notebook"> - <property name="show_tabs">no</property> - <property name="show_border">no</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">no</property> - <property name="tab_hborder">2</property> - <property name="tab_vborder">2</property> - <property name="enable-popup">no</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHButtonBox" id="hbuttonbox21"> - <property name="layout_style">GTK_BUTTONBOX_START</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="account-editor-fewer-options-button"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="label" translatable="yes"><< Fewer Options</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label554"> - <property name="label" translatable="yes">label554</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHButtonBox" id="hbuttonbox28"> - <property name="layout_style">GTK_BUTTONBOX_START</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="account-editor-more-options-button"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">_More Options >></property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label555"> - <property name="label" translatable="yes">label555</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkHButtonBox" id="hbuttonbox20"> - <property name="layout_style">GTK_BUTTONBOX_END</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="account-editor-ok-button"> - <property name="sensitive">no</property> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="label">gtk-ok</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="account-editor-apply-button"> - <property name="sensitive">no</property> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="label">gtk-apply</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="account-editor-close-button"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="label">gtk-close</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - </widget> - <widget class="GtkWindow" id="account-druid-window"> - <property name="visible">no</property> - <property name="title" translatable="yes">account-druid</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="GnomeDruid" id="account-druid"> - <property name="visible">yes</property> - - <child> - <widget class="GnomeDruidPageEdge" id="druidpagestart1"> - <property name="title" translatable="yes">LDAP Configuration Assistant</property> - <property name="text" translatable="yes">This assistant will help you to access online directory services -using LDAP (Lightweight Directory Access Protocol) servers. - -Adding a new LDAP server requires some specialized information -about the server. Please contact your system administrator if you -need help finding this information.</property> - <property name="logo_image">ldap.png</property> - <property name="watermark_image">xstdruidbg-3.png</property> - <property name="position">GNOME_EDGE_START</property> - <property name="visible">yes</property> - <property name="title_color">#ffffff</property> - <property name="text_color">#000000</property> - <property name="background_color">#000000</property> - <property name="logo_background_color">#000000</property> - <property name="textbox_color">#ffffff</property> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageStandard" id="add-server-druid-info-page"> - <property name="title" translatable="yes">Step 1: Server Information</property> - <property name="visible">yes</property> - <property name="title_foreground">#ffffff</property> - <property name="background">#000000</property> - <property name="logo_background">#000000</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="druid-vbox1"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkVBox" id="account-druid-general-vbox"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label158"> - <property name="label" translatable="yes">The first step in configuring an LDAP server is to provide its name, and your log in -information. Please ask your system administrator if you are unsure of this information.</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">3</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator2"> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageStandard" id="add-server-druid-connecting-page"> - <property name="title" translatable="yes">Step 2: Connecting to Server</property> - <property name="visible">yes</property> - <property name="title_foreground">#ffffff</property> - <property name="background">#000000</property> - <property name="logo_background">#000000</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="druid-vbox2"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkVBox" id="account-druid-connecting-vbox"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label174"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">3</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator3"> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageStandard" id="add-server-druid-searching-page"> - <property name="title" translatable="yes">Step 3: Searching the Directory</property> - <property name="visible">yes</property> - <property name="title_foreground">#ffffff</property> - <property name="background">#000000</property> - <property name="logo_background">#000000</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="vbox23"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkVBox" id="account-druid-searching-vbox"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label254"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator7"> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageStandard" id="add-server-druid-display-name-page"> - <property name="title" translatable="yes">Step 4: Display Name</property> - <property name="visible">yes</property> - <property name="title_foreground">#ffffff</property> - <property name="background">#000000</property> - <property name="logo_background">#000000</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="druid-vbox5"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkVBox" id="vbox21"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label198"> - <property name="label" translatable="yes">Specifying a display name is the last required step in configuring an LDAP server.</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">3</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator5"> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table15"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="row_spacing">3</property> - <property name="column_spacing">3</property> - <property name="n-rows">1</property> - <property name="n-columns">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkEntry" id="druid-display-name-entry"> - <property name="can_focus">yes</property> - <property name="has_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label199"> - <property name="label" translatable="yes">_Display name:</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</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> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkNotebook" id="notebook15"> - <property name="show_tabs">no</property> - <property name="show_border">no</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">no</property> - <property name="tab_hborder">2</property> - <property name="tab_vborder">2</property> - <property name="enable-popup">no</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox41"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap21"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label207"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label208"> - <property name="label" translatable="yes">label163</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox42"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap22"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label215"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label210"> - <property name="label" translatable="yes">label164</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GnomeDruidPageEdge" id="add-server-druid-finish-page"> - <property name="title" translatable="yes">Finished</property> - <property name="text" translatable="yes">Congratulations, you are finished setting up this LDAP server. You -are now ready to access this directory. - -Please click the "Finish" button to save the settings you have entered here.</property> - <property name="watermark_image">xstdruidbg-3.png</property> - <property name="position">GNOME_EDGE_FINISH</property> - <property name="visible">yes</property> - <property name="title_color">#ffffff</property> - <property name="text_color">#000000</property> - <property name="background_color">#000000</property> - <property name="logo_background_color">#000000</property> - <property name="textbox_color">#ffffff</property> - </widget> - </child> - </widget> - </child> - </widget> - <widget class="GtkWindow" id="edit_server_window_simple"> - <property name="visible">no</property> - <property name="title" translatable="yes">edit_server_window_simple</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="GtkVBox" id="vbox67"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkNotebook" id="notebook25"> - <property name="can_focus">yes</property> - <property name="show_tabs">yes</property> - <property name="show_border">yes</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">no</property> - <property name="tab_hborder">2</property> - <property name="tab_vborder">2</property> - <property name="enable-popup">no</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkVBox" id="vbox68"> - <property name="border_width">6</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox121"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">4</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label484"> - <property name="label" translatable="yes">_Display name:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment52"> - <property name="xalign">1</property> - <property name="yalign">0.5</property> - <property name="xscale">0.9</property> - <property name="yscale">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkEntry" id="entry54"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator13"> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table32"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="row_spacing">3</property> - <property name="column_spacing">3</property> - <property name="n-rows">3</property> - <property name="n-columns">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label485"> - <property name="label" translatable="yes">_Server name:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">entry55</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label486"> - <property name="label" translatable="yes">_Log in method:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label487"> - <property name="label" translatable="yes">Distinguished _name:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">entry56</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry55"> - <property name="can_focus">yes</property> - <property name="has_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment53"> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkOptionMenu" id="optionmenu18"> - <property name="can_focus">yes</property> - <property name="history">2</property> - <property name="visible">yes</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget12"> - <property name="visible">yes</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget13"> - <property name="label" translatable="yes">Anonymously</property> - <property name="visible">yes</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget14"> - <property name="label" translatable="yes">Using email address</property> - <property name="visible">yes</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget15"> - <property name="label" translatable="yes">Using distinguished name (DN)</property> - <property name="visible">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry56"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </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="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkNotebook" id="notebook26"> - <property name="show_tabs">no</property> - <property name="show_border">no</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">no</property> - <property name="tab_hborder">2</property> - <property name="tab_vborder">2</property> - <property name="enable-popup">no</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox122"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap66"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label488"> - <property name="label" translatable="yes">This is the full name of your ldap server. For example, "ldap.mycompany.com".</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label489"> - <property name="label" translatable="yes">label163</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox123"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap67"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label490"> - <property name="label" translatable="yes">label168</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label491"> - <property name="label" translatable="yes">label164</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox124"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap68"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label492"> - <property name="label" translatable="yes">label169</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label493"> - <property name="label" translatable="yes">label165</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <placeholder /> - </child> - - <child> - <widget class="GtkLabel" id="label494"> - <property name="label" translatable="yes">label214</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox125"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap69"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label495"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label496"> - <property name="label" translatable="yes">label452</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label497"> - <property name="label" translatable="yes">General</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox69"> - <property name="border_width">6</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkTable" id="table33"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="row_spacing">3</property> - <property name="column_spacing">3</property> - <property name="n-rows">2</property> - <property name="n-columns">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label498"> - <property name="label" translatable="yes">_Port number:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment54"> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkVBox" id="vbox70"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkRadioButton" id="radiobutton9"> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">_Always</property> - <property name="active">no</property> - <property name="draw_indicator">yes</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="radiobutton10"> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">_If necessary </property> - <property name="active">no</property> - <property name="draw_indicator">yes</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="radiobutton11"> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">_Don't use SSL/TLS</property> - <property name="active">no</property> - <property name="draw_indicator">yes</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment55"> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap70"> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </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="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment56"> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkCombo" id="combo8"> - <property name="value_in_list">no</property> - <property name="case_sensitive">no</property> - <property name="enable_arrow_keys">yes</property> - <property name="enable_arrows_always">no</property> - <property name="allow_empty">yes</property> - <property name="visible">yes</property> - - <child internal-child="entry"> - <widget class="GtkEntry" id="entry57"> - <property name="can_focus">yes</property> - <property name="has_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes">380</property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - </child> - - <child internal-child="list"> - <widget class="GtkList" id="convertwidget16"> - <property name="visible">yes</property> - - <child> - <widget class="GtkListItem" id="convertwidget17"> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="convertwidget18"> - <property name="label" translatable="yes">380</property> - <property name="xalign">0.0</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkListItem" id="convertwidget19"> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="convertwidget20"> - <property name="label" translatable="yes">666</property> - <property name="xalign">0.0</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkListItem" id="convertwidget21"> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="convertwidget22"> - <property name="label" translatable="yes">1234</property> - <property name="xalign">0.0</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkListItem" id="convertwidget23"> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="convertwidget24"> - <property name="label" translatable="yes"></property> - <property name="xalign">0.0</property> - <property name="visible">yes</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="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label499"> - <property name="label" translatable="yes">U_se SSL/TLS:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">7.45058e-09</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">expand|fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkNotebook" id="notebook27"> - <property name="show_tabs">no</property> - <property name="show_border">no</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">no</property> - <property name="tab_hborder">2</property> - <property name="tab_vborder">2</property> - <property name="enable-popup">no</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox126"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap71"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label500"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label501"> - <property name="label" translatable="yes">label163</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox127"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap72"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label502"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label503"> - <property name="label" translatable="yes">label398</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox128"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap73"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label504"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label505"> - <property name="label" translatable="yes">label396</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox129"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap74"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label506"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label507"> - <property name="label" translatable="yes">label397</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label508"> - <property name="label" translatable="yes">Connecting</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox71"> - <property name="border_width">6</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkTable" id="table34"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="row_spacing">3</property> - <property name="column_spacing">3</property> - <property name="n-rows">4</property> - <property name="n-columns">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label509"> - <property name="label" translatable="yes">_Search base:</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label510"> - <property name="label" translatable="yes">S_earch scope: </property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment57"> - <property name="xalign">7.45058e-09</property> - <property name="yalign">7.45058e-09</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkOptionMenu" id="optionmenu19"> - <property name="can_focus">yes</property> - <property name="history">0</property> - <property name="visible">yes</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget25"> - <property name="visible">yes</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget26"> - <property name="label" translatable="yes">Sub</property> - <property name="visible">yes</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget27"> - <property name="label" translatable="yes">One</property> - <property name="visible">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox130"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkEntry" id="entry58"> - <property name="can_focus">yes</property> - <property name="has_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="button90"> - <property name="can_focus">yes</property> - <property name="label" translatable="yes"> S_how Supported Bases </property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label511"> - <property name="label" translatable="yes">_Timeout (minutes):</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">1</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment58"> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox131"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label512"> - <property name="label" translatable="yes">1:00</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkHScale" id="hscale5"> - <property name="can_focus">yes</property> - <property name="draw_value">no</property> - <property name="value_pos">GTK_POS_LEFT</property> - <property name="digits">0</property> - <property name="visible">yes</property> - <property name="adjustment">3 1 5 0.5 1 0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label513"> - <property name="label" translatable="yes">5:00</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">3</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label514"> - <property name="label" translatable="yes">Selected:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">1</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label515"> - <property name="label" translatable="yes">2:30</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</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="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label516"> - <property name="label" translatable="yes">_Download limit:</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment59"> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox132"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkSpinButton" id="spinbutton5"> - <property name="can_focus">yes</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">no</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="wrap">no</property> - <property name="snap_to_ticks">no</property> - <property name="visible">yes</property> - <property name="adjustment">100 0 10000 1 10 10</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label517"> - <property name="label" translatable="yes">cards</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</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_padding">0</property> - <property name="y_padding">0</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">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkNotebook" id="notebook28"> - <property name="show_tabs">no</property> - <property name="show_border">no</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">no</property> - <property name="tab_hborder">2</property> - <property name="tab_vborder">2</property> - <property name="enable-popup">no</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox133"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap75"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label518"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label519"> - <property name="label" translatable="yes">label163</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox134"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap76"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label520"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label521"> - <property name="label" translatable="yes">label164</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox135"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap77"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label522"> - <property name="label" translatable="yes">This option controls how long a search will be run.</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label523"> - <property name="label" translatable="yes">label165</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox136"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap78"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label524"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label525"> - <property name="label" translatable="yes">label166</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label526"> - <property name="label" translatable="yes">Searching</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator14"> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox142"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHButtonBox" id="hbuttonbox25"> - <property name="layout_style">GTK_BUTTONBOX_START</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button100"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">_More Options >></property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkHButtonBox" id="hbuttonbox26"> - <property name="layout_style">GTK_BUTTONBOX_END</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button101"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="label">gtk-ok</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button102"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="label">gtk-apply</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button103"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="label">gtk-close</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - </widget> - <widget class="GtkDialog" id="addressbook-sources-window"> - <property name="visible">no</property> - <property name="title" translatable="yes">Addressbook Sources</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="modal">no</property> - <property name="default_width">355</property> - <property name="default_height">285</property> - <property name="allow_shrink">yes</property> - <property name="allow_grow">yes</property> - <property name="window-position">GTK_WIN_POS_NONE</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="addressbook-sources-vbox"> - <property name="homogeneous">no</property> - <property name="spacing">8</property> - <property name="visible">yes</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="hbuttonbox27"> - <property name="layout_style">GTK_BUTTONBOX_END</property> - <property name="spacing">8</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button104"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="visible">yes</property> - <property name="label">gtk-ok</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button105"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="visible">yes</property> - <property name="label">gtk-apply</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button106"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="visible">yes</property> - <property name="label">gtk-close</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">yes</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="addressbook-sources"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="Custom" id="sourcesTable"> - <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> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox73"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label529"> - <property name="label" translatable="yes"> -</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkVButtonBox" id="vbuttonbox18"> - <property name="layout_style">GTK_BUTTONBOX_START</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="addSource"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">_Add</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="editSource"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">_Edit</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="deleteSource"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">De_lete</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">4</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <widget class="GtkWindow" id="general-tab-window"> - <property name="visible">no</property> - <property name="title" translatable="yes">general-tab</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="GtkVBox" id="general-tab"> - <property name="border_width">6</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkTable" id="table36"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="row_spacing">3</property> - <property name="column_spacing">3</property> - <property name="n-rows">3</property> - <property name="n-columns">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label534"> - <property name="label" translatable="yes">_Server name:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">server-name-entry</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label535"> - <property name="label" translatable="yes">_Log in method:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="server-name-entry"> - <property name="can_focus">yes</property> - <property name="has_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment63"> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkOptionMenu" id="auth-optionmenu"> - <property name="can_focus">yes</property> - <property name="history">0</property> - <property name="visible">yes</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget28"> - <property name="visible">yes</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget29"> - <property name="label" translatable="yes">Anonymously</property> - <property name="visible">yes</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget30"> - <property name="label" translatable="yes">Using email address</property> - <property name="visible">yes</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget31"> - <property name="label" translatable="yes">Using distinguished name (DN)</property> - <property name="visible">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkNotebook" id="auth-label-notebook"> - <property name="sensitive">no</property> - <property name="show_tabs">no</property> - <property name="show_border">no</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">no</property> - <property name="tab_hborder">2</property> - <property name="tab_vborder">2</property> - <property name="enable-popup">no</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label553"> - <property name="label" translatable="yes">Email Address:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label546"> - <property name="label" translatable="yes">label546</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label536"> - <property name="label" translatable="yes">Distinguished _name:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label547"> - <property name="label" translatable="yes">label547</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</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">2</property> - <property name="bottom_attach">3</property> - <property name="x_padding">0</property> - <property name="y_padding">0</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="sensitive">no</property> - <property name="show_tabs">no</property> - <property name="show_border">no</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">no</property> - <property name="tab_hborder">2</property> - <property name="tab_vborder">2</property> - <property name="enable-popup">no</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkEntry" id="email-entry"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label549"> - <property name="label" translatable="yes">label549</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="dn-entry"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label550"> - <property name="label" translatable="yes">label550</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</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">2</property> - <property name="bottom_attach">3</property> - <property name="x_padding">0</property> - <property name="y_padding">0</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">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkNotebook" id="general-tab-help"> - <property name="show_tabs">no</property> - <property name="show_border">no</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">no</property> - <property name="tab_hborder">2</property> - <property name="tab_vborder">2</property> - <property name="enable-popup">no</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox145"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap79"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label537"> - <property name="label" translatable="yes">This is the full name of your ldap server. For example, "ldap.mycompany.com".</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label538"> - <property name="label" translatable="yes">label163</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox146"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap80"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label539"> - <property name="label" translatable="yes">Evolution will use this email address to authenticate you with the server</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label540"> - <property name="label" translatable="yes">label164</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox147"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap81"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label541"> - <property name="label" translatable="yes">Evolution will use this DN to authenticate you with the server</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label542"> - <property name="label" translatable="yes">label165</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label552"> - <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="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">yes</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label551"> - <property name="label" translatable="yes">label551</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox148"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap82"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label544"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label545"> - <property name="label" translatable="yes">label452</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - </widget> - </child> - </widget> - <widget class="GtkWindow" id="connecting-tab-window"> - <property name="visible">no</property> - <property name="title" translatable="yes">connecting-tab</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="GtkVBox" id="connecting-tab"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkTable" id="table14"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="row_spacing">3</property> - <property name="column_spacing">3</property> - <property name="n-rows">2</property> - <property name="n-columns">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label175"> - <property name="label" translatable="yes">_Port number:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment23"> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap11"> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </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="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment21"> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkCombo" id="port-combo"> - <property name="value_in_list">no</property> - <property name="case_sensitive">no</property> - <property name="enable_arrow_keys">yes</property> - <property name="enable_arrows_always">no</property> - <property name="allow_empty">yes</property> - <property name="visible">yes</property> - - <child internal-child="entry"> - <widget class="GtkEntry" id="entry27"> - <property name="can_focus">yes</property> - <property name="has_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes">389</property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - </child> - - <child internal-child="list"> - <widget class="GtkList" id="convertwidget32"> - <property name="visible">yes</property> - - <child> - <widget class="GtkListItem" id="convertwidget33"> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="convertwidget34"> - <property name="label" translatable="yes">389</property> - <property name="xalign">0.0</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkListItem" id="convertwidget35"> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="convertwidget36"> - <property name="label" translatable="yes">636</property> - <property name="xalign">0.0</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkListItem" id="convertwidget37"> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="convertwidget38"> - <property name="label" translatable="yes">3268</property> - <property name="xalign">0.0</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkListItem" id="convertwidget39"> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="convertwidget40"> - <property name="label" translatable="yes"></property> - <property name="xalign">0.0</property> - <property name="visible">yes</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="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label176"> - <property name="label" translatable="yes">U_se SSL/TLS:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">expand|fill</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment60"> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkOptionMenu" id="ssl-optionmenu"> - <property name="can_focus">yes</property> - <property name="history">1</property> - <property name="visible">yes</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget41"> - <property name="visible">yes</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget42"> - <property name="label" translatable="yes">Always</property> - <property name="visible">yes</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget43"> - <property name="label" translatable="yes">Whenever Possible</property> - <property name="visible">yes</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget44"> - <property name="label" translatable="yes">Never</property> - <property name="visible">yes</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_padding">0</property> - <property name="y_padding">0</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">no</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkNotebook" id="connecting-tab-help"> - <property name="show_tabs">no</property> - <property name="show_border">no</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">no</property> - <property name="tab_hborder">2</property> - <property name="tab_vborder">2</property> - <property name="enable-popup">no</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox30"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap7"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label178"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label179"> - <property name="label" translatable="yes">label163</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox31"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap8"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label395"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label398"> - <property name="label" translatable="yes">label398</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox91"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap43"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label399"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label396"> - <property name="label" translatable="yes">label396</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox92"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap44"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label400"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label397"> - <property name="label" translatable="yes">label397</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - </child> - </widget> - <widget class="GtkWindow" id="searching-tab-window"> - <property name="visible">no</property> - <property name="title" translatable="yes">searching-tab</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="GtkVBox" id="searching-tab"> - <property name="border_width">6</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkTable" id="table30"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="row_spacing">3</property> - <property name="column_spacing">3</property> - <property name="n-rows">4</property> - <property name="n-columns">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label455"> - <property name="label" translatable="yes">_Search base:</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label456"> - <property name="label" translatable="yes">S_earch scope: </property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment49"> - <property name="xalign">7.45058e-09</property> - <property name="yalign">7.45058e-09</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkOptionMenu" id="scope-optionmenu"> - <property name="can_focus">yes</property> - <property name="history">0</property> - <property name="visible">yes</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget45"> - <property name="visible">yes</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget46"> - <property name="label" translatable="yes">One</property> - <property name="visible">yes</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget47"> - <property name="label" translatable="yes">Sub</property> - <property name="visible">yes</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_padding">0</property> - <property name="y_padding">0</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="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkEntry" id="rootdn-entry"> - <property name="can_focus">yes</property> - <property name="has_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="rootdn-button"> - <property name="can_focus">yes</property> - <property name="label" translatable="yes"> S_how Supported Bases </property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label457"> - <property name="label" translatable="yes">_Timeout (minutes):</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">1</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment50"> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox110"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label458"> - <property name="label" translatable="yes">1:00</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkHScale" id="timeout-scale"> - <property name="can_focus">yes</property> - <property name="draw_value">no</property> - <property name="value_pos">GTK_POS_LEFT</property> - <property name="digits">0</property> - <property name="visible">yes</property> - <property name="adjustment">3 1 5 0.5 1 0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label459"> - <property name="label" translatable="yes">5:00</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">3</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label460"> - <property name="label" translatable="yes">Selected:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">1</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label461"> - <property name="label" translatable="yes">2:30</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</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="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label462"> - <property name="label" translatable="yes">_Download limit:</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment51"> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox111"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkSpinButton" id="download-limit-spinbutton"> - <property name="can_focus">yes</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">no</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="wrap">no</property> - <property name="snap_to_ticks">no</property> - <property name="visible">yes</property> - <property name="adjustment">100 0 10000 1 10 10</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label463"> - <property name="label" translatable="yes">cards</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</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_padding">0</property> - <property name="y_padding">0</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">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkNotebook" id="searching-tab-help"> - <property name="show_tabs">no</property> - <property name="show_border">no</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">no</property> - <property name="tab_hborder">2</property> - <property name="tab_vborder">2</property> - <property name="enable-popup">no</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox112"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap60"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label464"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label465"> - <property name="label" translatable="yes">label163</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox113"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap61"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label466"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label467"> - <property name="label" translatable="yes">label164</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox114"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap62"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label468"> - <property name="label" translatable="yes">This option controls how long a search will be run.</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label469"> - <property name="label" translatable="yes">label165</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox115"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap63"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label470"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label471"> - <property name="label" translatable="yes">label166</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - </widget> - </child> - </widget> - <widget class="GtkWindow" id="objectclasses-tab-window"> - <property name="visible">no</property> - <property name="title" translatable="yes">objectclasses-tab</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="GtkVBox" id="objectclasses-tab"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox93"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkVBox" id="vbox51"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label405"> - <property name="label" translatable="yes">Objectclasses Used on Server:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="Custom" id="objectclasses-server-table"> - <property name="creation_function">objectclasses_create_server_table</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Tue, 16 Apr 2002 17:09:21 GMT</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox52"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label407"> - <property name="label" translatable="yes"> -</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkVButtonBox" id="vbuttonbox15"> - <property name="layout_style">GTK_BUTTONBOX_START</property> - <property name="spacing">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="objectclasses-add-button"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">_Add -></property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="objectclasses-remove-button"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="label" translatable="yes"><- _Remove</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox53"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label408"> - <property name="label" translatable="yes">Objectclasses Used in Evolution:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="Custom" id="objectclasses-evolution-table"> - <property name="creation_function">objectclasses_create_evolution_table</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Tue, 16 Apr 2002 17:09:43 GMT</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkHButtonBox" id="hbuttonbox16"> - <property name="border_width">6</property> - <property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="objectclasses-default-button"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">R_estore Defaults</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - </widget> - </child> - </widget> - <widget class="GtkWindow" id="mappings-tab-window"> - <property name="visible">no</property> - <property name="title" translatable="yes">mappings-tab</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="GtkVBox" id="mappings-tab"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox94"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkVBox" id="vbox55"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow21"> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkTreeView" id="clist18"> - <property name="can_focus">yes</property> - <property name="headers-visible">yes</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label411"> - <property name="child_name">CList:title</property> - <property name="label" translatable="yes">Evolution Attribute</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label412"> - <property name="child_name">CList:title</property> - <property name="label" translatable="yes">Associated LDAP Attribute</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - </child> - - <child internal-child="hscrollbar"> - <widget class="GtkHScrollbar" id="convertwidget48"> - <property name="update_policy">GTK_UPDATE_CONTINUOUS</property> - <property name="visible">yes</property> - </widget> - </child> - - <child internal-child="vscrollbar"> - <widget class="GtkVScrollbar" id="convertwidget49"> - <property name="update_policy">GTK_UPDATE_CONTINUOUS</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox56"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label413"> - <property name="label" translatable="yes"> -</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkVButtonBox" id="vbuttonbox16"> - <property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button71"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">_Add Mapping</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button72"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">_Edit Mapping</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button73"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">_Delete Mapping</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkHButtonBox" id="hbuttonbox17"> - <property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property> - <property name="spacing">30</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button74"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">Re_store Defaults</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - </widget> - </child> - </widget> - <widget class="GtkWindow" id="dn-customization-tab-window"> - <property name="visible">no</property> - <property name="title" translatable="yes">dn-customization-tab</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="GtkVBox" id="dn-customization-tab"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkNotebook" id="notebook24"> - <property name="show_tabs">no</property> - <property name="show_border">no</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">no</property> - <property name="tab_hborder">2</property> - <property name="tab_vborder">2</property> - <property name="enable-popup">no</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox116"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap64"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label473"> - <property name="label" translatable="yes">To add an attribute to the DN, select it from the list and click the "Add Attribute" button. -Any values that you add to the DN will become required values for any new contacts -that you add to the directory on the LDAP server. </property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label474"> - <property name="label" translatable="yes">label163</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox117"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkImage" id="pixmap65"> - <property name="pixbuf">gnome-hint.png</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label475"> - <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="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label476"> - <property name="label" translatable="yes">label164</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table31"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="row_spacing">3</property> - <property name="column_spacing">3</property> - <property name="n-rows">2</property> - <property name="n-columns">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkVBox" id="vbox64"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label477"> - <property name="label" translatable="yes"></property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkVButtonBox" id="vbuttonbox17"> - <property name="layout_style">GTK_BUTTONBOX_START</property> - <property name="spacing">10</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button78"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">_Add to DN</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options"></property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow22"> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkTreeView" id="clist19"> - <property name="can_focus">yes</property> - <property name="headers-visible">yes</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label478"> - <property name="child_name">CList:title</property> - <property name="label" translatable="yes">LDAP Attribute</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label479"> - <property name="child_name">CList:title</property> - <property name="label" translatable="yes">Corresponding Evolution Attribute</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - </child> - - <child internal-child="hscrollbar"> - <widget class="GtkHScrollbar" id="convertwidget50"> - <property name="update_policy">GTK_UPDATE_CONTINUOUS</property> - <property name="visible">yes</property> - </widget> - </child> - - <child internal-child="vscrollbar"> - <widget class="GtkVScrollbar" id="convertwidget51"> - <property name="update_policy">GTK_UPDATE_CONTINUOUS</property> - <property name="visible">yes</property> - </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> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options">expand|fill</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox118"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label480"> - <property name="label" translatable="yes">_Distinguished Name (DN):</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">entry53</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry53"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</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="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkHButtonBox" id="hbuttonbox18"> - <property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button79"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">_Restore Defaults</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </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="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options"></property> - <property name="y_options">fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - </child> - </widget> - <widget class="GtkDialog" id="supported-bases-dialog"> - <property name="visible">no</property> - <property name="title" translatable="yes">Supported Search Bases</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="modal">no</property> - <property name="default_width">300</property> - <property name="default_height">200</property> - <property name="allow_shrink">yes</property> - <property name="allow_grow">yes</property> - <property name="window-position">GTK_WIN_POS_NONE</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="dialog-vbox5"> - <property name="homogeneous">no</property> - <property name="spacing">8</property> - <property name="visible">yes</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="dialog-action_area5"> - <property name="layout_style">GTK_BUTTONBOX_END</property> - <property name="spacing">8</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button107"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="visible">yes</property> - <property name="label">gtk-ok</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button109"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="visible">yes</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">yes</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="Custom" id="supported-bases-table"> - <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> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">4</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </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 d9b150c040..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 f25279bb38..0000000000 --- a/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl +++ /dev/null @@ -1,113 +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 SimpleCard : Bonobo::Unknown { - struct Arbitrary { - string key; - string type; - string value; - }; - - enum Field { - FileAs, - FullName, - Email, - PhonePrimary, - PhoneAssistant, - PhoneBusiness, - PhoneCallback, - PhoneCompany, - PhoneHome, - Org, - AddressBusiness, - AddressHome, - PhoneMobile, - PhoneCar, - PhoneBusinessFax, - PhoneHomeFax, - PhoneBusiness2, - PhoneHome2, - PhoneIsdn, - PhoneOther, - PhoneOtherFax, - PhonePager, - PhoneRadio, - PhoneTelex, - PhoneTtytdd, - AddressOther, - Email2, - Email3, - Url, - OrgUnit, - Office, - Title, - Role, - Manager, - Assistant, - Nickname, - Spouse, - Note, - Caluri, - Fburl, - Anniversary, - BirthDate, - Mailer, - NameOrOrg, - Categories, - FamilyName, - GivenName, - AdditionalName, - NameSuffix, - WantsHtml, - IsList, - Last - }; - - Arbitrary getArbitrary (in string key); - void setArbitrary (in string key, in string type, in string value); - - string get (in Field field); - void set (in Field field, in string value); - }; - - typedef sequence<SimpleCard> SimpleCardList; - - 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 2697741fc7..0000000000 --- a/addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.server.in.in +++ /dev/null @@ -1,29 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_SelectNamesFactory" - type="exe" - location="@LIBEXECDIR@/evolution-addressbook"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/ObjectFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Factory for the Addressbook's name selection interface"/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_SelectNames" - type="factory" - location="OAFIID:GNOME_Evolution_Addressbook_SelectNamesFactory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Evolution/Addressbook/SelectNames"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Evolution's addressbook name selection interface."/> - -</oaf_server> - -</oaf_info>
\ No newline at end of file diff --git a/addressbook/gui/component/select-names/Makefile.am b/addressbook/gui/component/select-names/Makefile.am deleted file mode 100644 index ad3bb4f8f0..0000000000 --- a/addressbook/gui/component/select-names/Makefile.am +++ /dev/null @@ -1,109 +0,0 @@ -# CORBA stuff - -idl_DATA = \ - Evolution-Addressbook-SelectNames.idl - -IDL_GENERATED = \ - Evolution-Addressbook-SelectNames.h \ - Evolution-Addressbook-SelectNames-common.c \ - Evolution-Addressbook-SelectNames-skels.c \ - Evolution-Addressbook-SelectNames-stubs.c - -Evolution-Addressbook-SelectNames-impl.o: Evolution-Addressbook-SelectNames.h - -$(IDL_GENERATED): $(idl_DATA) - $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) \ - $(srcdir)/Evolution-Addressbook-SelectNames.idl - -server_in_files = GNOME_Evolution_Addressbook_SelectNames.server.in.in - -serverdir = $(libdir)/bonobo/servers -server_DATA = $(server_in_files:.server.in.in=.server) -$(server_in_files:.server.in.in=.server.in): $(server_in_files) - sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@ - -@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_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \ - -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ - -DCAMEL_PROVIDERDIR=\""$(providerdir)"\" \ - -DG_DISABLE_DEPRECATED \ - -DGTK_DISABLE_DEPRECATED \ - -DLIBGNOME_DISABLE_DEPRECATED \ - -DLIBGNOMEUI_DISABLE_DEPRECATED \ - $(EVOLUTION_ADDRESSBOOK_CFLAGS) - -lib_LTLIBRARIES = libeselectnames.la - -libeselectnames_la_SOURCES = \ - $(IDL_GENERATED) \ - e-select-names-bonobo.c \ - e-select-names-bonobo.h \ - e-select-names-completion.c \ - e-select-names-completion.h \ - e-select-names-factory.c \ - e-select-names-factory.h \ - e-select-names-manager.c \ - e-select-names-manager.h \ - e-select-names-marshal.c \ - 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 \ - e-simple-card-bonobo.c \ - e-simple-card-bonobo.h - -# GLib marshalling cruft - -e-select-names-marshal.h: e-select-names-marshal.list - ( @GLIB_GENMARSHAL@ --prefix=e_select_names_marshal e-select-names-marshal.list --header > e-select-names-marshal.tmp \ - && mv e-select-names-marshal.tmp e-select-names-marshal.h ) \ - || ( rm -f e-select-names-marshal.tmp && exit 1 ) - -e-select-names-marshal.c: e-select-names-marshal.h - ( @GLIB_GENMARSHAL@ --prefix=e_select_names_marshal e-select-names-marshal.list --body > e-select-names-marshal.tmp \ - && mv e-select-names-marshal.tmp e-select-names-marshal.c ) \ - || ( rm -f e-select-names-marshal.tmp && exit 1 ) - -MARSHAL_GENERATED = e-select-names-marshal.c e-select-names-marshal.h - -gladedir = $(datadir)/evolution/glade -glade_DATA = select-names.glade - -etspecdir = $(datadir)/evolution/etspec -etspec_DATA = e-select-names.etspec - -EXTRA_DIST = \ - $(glade_DATA) \ - $(server_in_files) \ - $(server_DATA) \ - $(idl_DATA) \ - $(etspec_DATA) \ - e-select-names-marshal.list - -BUILT_SOURCES = $(IDL_GENERATED) $(MARSHAL_GENERATED) -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 a8284a0f83..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-bonobo.c +++ /dev/null @@ -1,466 +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 "e-simple-card-bonobo.h" - -#include <bonobo/bonobo-property-bag.h> -#include <bonobo/bonobo-control.h> -#include <bonobo/bonobo-event-source.h> - -#include <gal/util/e-util.h> -#include <gal/e-text/e-entry.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" - - - -#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_SIMPLE_CARD_LIST, - 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_SIMPLE_CARD_LIST: - { - ESelectNamesModel *model; - int count; - int i; - GNOME_Evolution_Addressbook_SimpleCardList *card_list; - - model = E_SELECT_NAMES_MODEL (g_object_get_data (G_OBJECT (w), "select_names_model")); - g_assert (model != NULL); - - count = e_select_names_model_count (model); - - card_list = GNOME_Evolution_Addressbook_SimpleCardList__alloc (); - card_list->_buffer = CORBA_sequence_GNOME_Evolution_Addressbook_SimpleCard_allocbuf (count); - card_list->_maximum = count; - card_list->_length = count; - - for (i = 0; i < count; i++) { - const EDestination *destination = e_select_names_model_get_destination (model, i); - const ECard *card = e_destination_get_card (destination); - ECardSimple *simple = e_card_simple_new ((ECard *) card); - ESimpleCardBonobo *simple_card = e_simple_card_bonobo_new (simple); - g_object_unref (simple); - - card_list->_buffer[i] = bonobo_object_corba_objref (BONOBO_OBJECT (simple_card)); - } - - CORBA_free (*(GNOME_Evolution_Addressbook_SimpleCardList **)arg->_value); - BONOBO_ARG_SET_GENERAL (arg, card_list, TC_GNOME_Evolution_Addressbook_SimpleCardList, GNOME_Evolution_Addressbook_SimpleCardList *, 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); - - 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_cardify_all (model, NULL, 0); - 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_cardify_all (model, NULL, 0); - 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 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, "simple_card_list", ENTRY_PROPERTY_ID_SIMPLE_CARD_LIST, - TC_GNOME_Evolution_Addressbook_SimpleCardList, NULL, NULL, - BONOBO_PROPERTY_READABLE); - 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); - - 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); - - 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 32d0be9268..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-completion.c +++ /dev/null @@ -1,1340 +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 <addressbook/backend/ebook/e-book-util.h> -#include <addressbook/backend/ebook/e-destination.h> -#include <addressbook/backend/ebook/e-card-simple.h> -#include <addressbook/backend/ebook/e-card-compare.h> - -typedef struct { - EBook *book; - guint book_view_tag; - EBookView *book_view; - ESelectNamesCompletion *comp; - guint card_added_tag; - guint seq_complete_tag; - gboolean sequence_complete_received; -} 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; - - gchar *cached_query_text; - GList *cached_cards; - gboolean cache_complete; - - gboolean match_contact_lists; - gboolean primary_only; - - gboolean can_fail_due_to_too_many_hits; /* like LDAP, for example... */ - - 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_card_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 *, EDestination *); - -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 (EDestination *dest, const gchar *menu_form, double score) -{ - ECompletionMatch *match; - ECard *card = e_destination_get_card (dest); - - match = e_completion_match_new (e_destination_get_name (dest), menu_form, score); - - e_completion_match_set_text (match, e_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; - } - - /* Since we sort low to high, we negate so that larger use scores will come first */ - match->sort_major = card ? -floor (e_card_get_use_score (card)) : 0; - - match->sort_minor = e_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, EDestination *dest) -{ - ECompletionMatch *match = NULL; - gint len; - ECard *card = e_destination_get_card (dest); - double score; - - if (card->nickname == NULL) - return NULL; - - len = g_utf8_strlen (comp->priv->query_text, -1); - if (card->nickname && !utf8_casefold_collate_len (comp->priv->query_text, card->nickname, len)) { - const gchar *name; - gchar *str; - - score = len * 2; /* nickname gives 2 points per matching character */ - - if (len == g_utf8_strlen (card->nickname, -1)) /* boost score on an exact match */ - score *= 10; - - name = e_destination_get_name (dest); - if (name && *name) - str = g_strdup_printf ("'%s' %s <%s>", card->nickname, name, e_destination_get_email (dest)); - else - str = g_strdup_printf ("'%s' <%s>", card->nickname, e_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, EDestination *dest) -{ - ECompletionMatch *match; - gint len = strlen (comp->priv->query_text); - const gchar *name = e_destination_get_name (dest); - const gchar *email = e_destination_get_email (dest); - double score; - - if (email - && !utf8_casefold_collate_len (comp->priv->query_text, email, len) - && !e_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, EDestination *dest) -{ - ECompletionMatch *final_match = NULL; - gchar *menu_text = NULL; - ECard *card; - const gchar *email; - gint match_len = 0; - ECardMatchType match; - ECardMatchPart first_match; - double score = 0; - gboolean have_given, have_additional, have_family; - - card = e_destination_get_card (dest); - - if (card->name == NULL) - return NULL; - - email = e_destination_get_email (dest); - - match = e_card_compare_name_to_string_full (card, comp->priv->query_text, TRUE /* yes, allow partial matches */, - NULL, &first_match, &match_len); - - if (match <= E_CARD_MATCH_NONE) - return NULL; - - score = match_len * 3; /* three points per match character */ - -#if 0 - if (card->nickname) { - /* We massively boost the score if the nickname exists and is the same as one of the "real" names. This keeps the - nickname from matching ahead of the real name for this card. */ - len = strlen (card->nickname); - if ((card->name->given && !utf8_casefold_collate_len (card->name->given, card->nickname, MIN (strlen (card->name->given), len))) - || (card->name->family && !utf8_casefold_collate_len (card->name->family, card->nickname, MIN (strlen (card->name->family), len))) - || (card->name->additional && !utf8_casefold_collate_len (card->name->additional, card->nickname, MIN (strlen (card->name->additional), len)))) - score *= 100; - } -#endif - - have_given = card->name->given && *card->name->given; - have_additional = card->name->additional && *card->name->additional; - have_family = card->name->family && *card->name->family; - - if (e_card_evolution_list (card)) { - - menu_text = e_card_name_to_string (card->name); - - } else if (first_match == E_CARD_MATCH_PART_GIVEN_NAME) { - - if (have_family) - menu_text = g_strdup_printf ("%s %s <%s>", card->name->given, card->name->family, email); - else - menu_text = g_strdup_printf ("%s <%s>", card->name->given, email); - - } else if (first_match == E_CARD_MATCH_PART_ADDITIONAL_NAME) { - - if (have_given) { - - menu_text = g_strdup_printf ("%s%s%s, %s <%s>", - card->name->additional, - have_family ? " " : "", - have_family ? card->name->family : "", - card->name->given, - email); - } else { - - menu_text = g_strdup_printf ("%s%s%s <%s>", - card->name->additional, - have_family ? " " : "", - have_family ? card->name->family : "", - email); - } - - } else if (first_match == E_CARD_MATCH_PART_FAMILY_NAME) { - - if (have_given) - menu_text = g_strdup_printf ("%s, %s%s%s <%s>", - card->name->family, - card->name->given, - have_additional ? " " : "", - have_additional ? card->name->additional : "", - email); - else - menu_text = g_strdup_printf ("%s <%s>", card->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); - } - - 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, EDestination *dest) -{ - const gchar *name; - const gchar *email; - gchar *cpy, **strv, *menu_text; - gint i, len; - double score = 0.00001; - ECompletionMatch *match; - - name = e_destination_get_name (dest); - email = e_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; -} - -/* - * Initials Query - */ - -static gchar * -sexp_initials (ESelectNamesCompletion *comp) -{ - return NULL; -} - -static ECompletionMatch * -match_initials (ESelectNamesCompletion *comp, EDestination *dest) -{ - return NULL; -} - - -typedef struct _BookQuery BookQuery; -struct _BookQuery { - gboolean primary; - BookQuerySExp builder; - BookQueryMatchTester tester; -}; - -static BookQuery book_queries[] = { - { TRUE, sexp_nickname, match_nickname}, - { TRUE, sexp_email, match_email }, - { TRUE, sexp_name, match_name }, - { TRUE, sexp_file_as, match_file_as }, - { FALSE, sexp_initials, match_initials } -}; -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, count = 0; - 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; - - if (comp->priv->primary_only) { - for (i=0; i<book_query_count; ++i) - if (book_queries[i].primary) - ++count; - } else { - count = book_query_count; - } - - queryv = g_new0 (gchar *, count+1); - for (i=0, j=0; i<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<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, EDestination *dest) -{ - ECompletionMatch *best_match = NULL; - gint i; - - g_return_val_if_fail (E_IS_SELECT_NAMES_COMPLETION (comp), NULL); - g_return_val_if_fail (E_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].primary || !comp->priv->primary_only) { - if (book_queries[i].tester && e_destination_get_card (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 *cards) -{ - while (cards) { - ECard *card = E_CARD (cards->data); - - if (e_card_evolution_list (card)) { - - if (comp->priv->match_contact_lists) { - - EDestination *dest = e_destination_new (); - ECompletionMatch *match; - e_destination_set_card (dest, card, 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 if (card->email) { - gint i; - for (i=0; i<e_list_length (card->email); ++i) { - EDestination *dest = e_destination_new (); - const gchar *email; - ECompletionMatch *match; - - e_destination_set_card (dest, card, i); - email = e_destination_get_email (dest); - - if (email && *email) { - - 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); - } - } - - cards = g_list_next (cards); - } -} - -#if 0 -static gchar * -initials_query_match_cb (QueryInfo *qi, ECard *card, double *score) -{ - gint len; - gchar f='\0', m='\0', l='\0'; /* initials */ - gchar cf, cm, cl; - - len = strlen (qi->comp->priv->query_text); - - if (len == 2) { - - f = qi->comp->priv->query_text[0]; - m = '\0'; - l = qi->comp->priv->query_text[1]; - - } else if (len == 3) { - - f = qi->comp->priv->query_text[0]; - m = qi->comp->priv->query_text[1]; - l = qi->comp->priv->query_text[2]; - - } else { - return NULL; - } - - cf = card->name->given ? *card->name->given : '\0'; - cm = card->name->additional ? *card->name->additional : '\0'; - cl = card->name->family ? *card->name->family : '\0'; - - if (f && isupper ((gint) f)) - f = tolower ((gint) f); - if (m && isupper ((gint) m)) - m = tolower ((gint) m); - if (l && isupper ((gint) l)) - l = tolower ((gint) l); - - if (cf && isupper ((gint) cf)) - cf = tolower ((gint) cf); - if (cm && isupper ((gint) cm)) - cm = tolower ((gint) cm); - if (cl && isupper ((gint) cl)) - cl = tolower ((gint) cl); - - if ((f == '\0' || (f == cf)) && (m == '\0' || (m == cm)) && (l == '\0' || (l == cl))) { - if (score) - *score = 3; - if (m) - return g_strdup_printf ("%s %s %s", card->name->given, card->name->additional, card->name->family); - else - return g_strdup_printf ("%s %s", card->name->given, card->name->family); - } - - return NULL; -} - -static gboolean -start_initials_query (ESelectNamesCompletion *comp) -{ - gint len; - gchar *query; - - if (comp && comp->priv->query_text && *(comp->priv->query_text)) { - - len = strlen (comp->priv->query_text); - if (len < 2 || len > 3) - return FALSE; - - query = g_strdup_printf ("(contains \"x-evolution-any-field\" \"%c\")", *(comp->priv->query_text)); - query_info_start (comp, comp->priv->query_text, query, initials_query_match_cb); - g_free (query); - return TRUE; - } - - return FALSE; -} -#endif - - -/* - * - * 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->card_added_tag) { - g_signal_handler_disconnect (book_data->book_view, book_data->card_added_tag); - book_data->card_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); - } - 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->cached_query_text); - g_list_foreach (comp->priv->cached_cards, (GFunc)g_object_unref, NULL); - g_list_free (comp->priv->cached_cards); - - 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 (ESelectNamesCompletion *comp) -{ - g_free (comp->priv->cached_query_text); - comp->priv->cached_query_text = NULL; - - g_list_foreach (comp->priv->cached_cards, (GFunc)g_object_unref, NULL); - g_list_free (comp->priv->cached_cards); - comp->priv->cached_cards = NULL; -} - -static void -e_select_names_completion_got_book_view_cb (EBook *book, EBookStatus status, EBookView *view, gpointer user_data) -{ - ESelectNamesCompletion *comp; - ESelectNamesCompletionBookData *book_data; - - if (status != E_BOOK_STATUS_SUCCESS) - return; - - book_data = (ESelectNamesCompletionBookData*)user_data; - comp = book_data->comp; - - book_data->book_view_tag = 0; - - if (book_data->card_added_tag) { - g_signal_handler_disconnect (book_data->book_view, book_data->card_added_tag); - book_data->card_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->card_added_tag = - g_signal_connect (view, - "card_added", - G_CALLBACK (e_select_names_completion_card_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); - book_data->sequence_complete_received = FALSE; - comp->priv->pending_completion_seq++; -} - -static void -e_select_names_completion_card_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) { - comp->priv->cached_cards = g_list_prepend (comp->priv->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 = E_SELECT_NAMES_COMPLETION(book_data->comp); - - /* - * 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))) { - e_select_names_completion_clear_cache (comp); - return; - } - - if (!book_data->sequence_complete_received) { - book_data->sequence_complete_received = TRUE; - comp->priv->pending_completion_seq --; - if (comp->priv->pending_completion_seq > 0) - return; - } - - if (comp->priv->cached_query_text - && !comp->priv->cache_complete - && !strcmp (comp->priv->cached_query_text, comp->priv->query_text)) - comp->priv->cache_complete = TRUE; - - g_free (comp->priv->query_text); - comp->priv->query_text = NULL; - - if (out) - fprintf (out, "ending search\n"); - - 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_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 (out) - fprintf (out, "cancelled book view creation\n"); - e_book_cancel (book_data->book, book_data->book_view_tag); - book_data->book_view_tag = 0; - } - if (book_data->book_view) { - if (out) - fprintf (out, "disconnecting book view signals\n"); - - if (book_data->card_added_tag) { - g_signal_handler_disconnect (book_data->book_view, book_data->card_added_tag); - book_data->card_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, "unrefed book view\n"); - - e_book_view_stop (book_data->book_view); - g_object_unref (book_data->book_view); - book_data->book_view = NULL; - } - } - - /* Clear the cache, which may contain partial results. */ - e_select_names_completion_clear_cache (comp); - -} - -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) - return; - - g_free (comp->priv->query_text); - comp->priv->query_text = g_strdup (query_text); - - g_free (comp->priv->cached_query_text); - comp->priv->cached_query_text = g_strdup (query_text); - comp->priv->cache_complete = FALSE; - - 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; - book_data->book_view_tag = e_book_get_completion_view (book_data->book, - sexp, - e_select_names_completion_got_book_view_cb, book_data); - if (! book_data->book_view_tag) - g_warning ("Exception calling e_book_get_completion_view"); - } - - } 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; - gboolean query_is_still_running, can_reuse_cached_cards; - GList *l; - - 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; - } - - query_is_still_running = FALSE; - for (l = comp->priv->book_data; l; l = l->next) { - ESelectNamesCompletionBookData *book_data = l->data; - query_is_still_running = book_data->book_view_tag; - if (query_is_still_running) - break; - } - - if (out) { - fprintf (out, "do_query: %s => %s\n", query_text, clean); - if (query_is_still_running) - fprintf (out, "a query is still running!\n"); - } - if (comp->priv->cached_query_text && out) - fprintf (out, "cached: %s\n", comp->priv->cached_query_text); - - can_reuse_cached_cards = (comp->priv->cached_query_text - && comp->priv->cache_complete - && (!comp->priv->can_fail_due_to_too_many_hits || comp->priv->cached_cards != NULL) - && (strlen (comp->priv->cached_query_text) <= strlen (clean)) - && !utf8_casefold_collate_len (comp->priv->cached_query_text, clean, strlen (comp->priv->cached_query_text))); - - - if (can_reuse_cached_cards) { - - if (out) - fprintf (out, "can reuse cached card!\n"); - - if (query_is_still_running) { - g_free (comp->priv->waiting_query); - comp->priv->waiting_query = clean; - comp->priv->waiting_pos = pos; - comp->priv->waiting_limit = limit; - if (out) - fprintf (out, "waiting for running query to complete: %s\n", comp->priv->waiting_query); - return; - } - - g_free (comp->priv->query_text); - comp->priv->query_text = clean; - if (out) - fprintf (out, "using existing query info: %s (vs %s)\n", comp->priv->query_text, comp->priv->cached_query_text); - book_query_process_card_list (comp, comp->priv->cached_cards); - e_completion_end_search (E_COMPLETION (comp)); - return; - } - - 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"); -} - -static void -check_capabilities (ESelectNamesCompletion *comp, EBook *book) -{ - gchar *cap = e_book_get_static_capabilities (book); - comp->priv->can_fail_due_to_too_many_hits = !strcmp (cap, "net"); - if (comp->priv->can_fail_due_to_too_many_hits) { - g_message ("using LDAP source for completion!"); - } - g_free (cap); -} - -#if 0 -static void -e_select_names_completion_book_ready (EBook *book, EBookStatus status, ESelectNamesCompletion *comp) -{ - comp->priv->books_not_ready--; - - g_return_if_fail (E_IS_BOOK (book)); - g_return_if_fail (E_IS_SELECT_NAMES_COMPLETION (comp)); - - check_capabilities (comp, book); - - /* If waiting_query is non-NULL, someone tried to start a query before the book was ready. - Now that it is, get started. */ - if (comp->priv->books_not_ready == 0 && comp->priv->waiting_query) { - e_select_names_completion_start_query (comp, comp->priv->waiting_query); - g_free (comp->priv->waiting_query); - comp->priv->waiting_query = NULL; - } - - g_object_unref (comp); /* post-async unref */ -} -#endif - - -/* - * - * 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; - check_capabilities (comp, book); - g_object_ref (book_data->book); - comp->priv->book_data = g_list_append (comp->priv->book_data, book_data); - - /* 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 6565208378..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 <addressbook/backend/ebook/e-book.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-factory.c b/addressbook/gui/component/select-names/e-select-names-factory.c deleted file mode 100644 index 2416e42750..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" - -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 7d9ce8ab81..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-manager.c +++ /dev/null @@ -1,775 +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-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 "e-folder-list.h" -#include <addressbook/backend/ebook/e-book-util.h> -#include <addressbook/backend/ebook/e-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 -popup_cb (EEntry *eentry, GdkEventButton *ev, gint pos, 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_popup (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_cardify_all (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_cardify_all (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_cardify_all (entry->model, entry->manager->completion_book, 0); -#endif -} - -static void -completion_handler (EEntry *entry, ECompletionMatch *match) -{ - ESelectNamesManagerEntry *mgr_entry; - ESelectNamesTextModel *text_model; - EDestination *dest; - gint i, pos, start_pos, len; - - if (match == NULL || match->user_data == NULL) - return; - - mgr_entry = get_entry_info (entry); - dest = E_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, - "popup", - G_CALLBACK (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) - gtk_timeout_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, ESelectNamesManager *manager) -{ - if (status == E_BOOK_STATUS_SUCCESS) { - 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_uri call below) */ -} - -static void -load_completion_books (ESelectNamesManager *manager) -{ - EFolderListItem *folders = e_folder_list_parse_xml (manager->cached_folder_list); - EFolderListItem *f; - - for (f = folders; f && f->physical_uri; f++) { - char *uri; - EBook *book = e_book_new (); - g_object_ref (manager); /* ref ourself before our async call */ - - uri = e_book_expand_uri (f->physical_uri); - - addressbook_load_uri (book, uri, (EBookCallback)open_book_cb, manager); - - g_free (uri); - } - e_folder_list_free_items (folders); -} - -static void -read_completion_settings_from_db (ESelectNamesManager *manager, EConfigListener *db) -{ - char *val; - long ival; - - val = e_config_listener_get_string (db, "/apps/evolution/addressbook/completion/uris"); - - if (val) { - g_free (manager->cached_folder_list); - manager->cached_folder_list = val; - load_completion_books(manager); - } - - ival = e_config_listener_get_long (db, "/apps/evolution/addressbook/completion/minimum_query_length"); - if (ival <= 0) ival = DEFAULT_MINIMUM_QUERY_LENGTH; - - manager->minimum_query_length = ival; -} - -static void -db_listener (EConfigListener *db, const char *key, - ESelectNamesManager *manager) -{ - GList *l; - - if (!strcmp (key, "/apps/evolution/addressbook/completion/uris")) { - char *val = e_config_listener_get_string (db, key); - - if (!val) - return; - - if (!manager->cached_folder_list || strcmp (val, manager->cached_folder_list)) { - 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; - - g_free (manager->cached_folder_list); - manager->cached_folder_list = val; - load_completion_books (manager); - } - } - else if (!strcmp (key, "/apps/evolution/addressbook/completion/minimum_query_length")) { - long ival = e_config_listener_get_long (db, key); - - if (ival <= 0) - ival = DEFAULT_MINIMUM_QUERY_LENGTH; - - manager->minimum_query_length = ival; - - 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: - * @VCard: a string in vCard format - * - * Returns: a new #ESelectNamesManager that wraps the @VCard. - */ -ESelectNamesManager * -e_select_names_manager_new (void) -{ - ESelectNamesManager *manager = g_object_new (E_TYPE_SELECT_NAMES_MANAGER, NULL); - EConfigListener *db; - - db = e_book_get_config_database(); - - manager->listener_id = g_signal_connect (db, - "key_changed", - G_CALLBACK (db_listener), manager); - - read_completion_settings_from_db (manager, db); - - 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) -{ - manager->sections = NULL; - manager->entries = NULL; - manager->completion_books = NULL; - manager->cached_folder_list = NULL; -} - -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->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->listener_id) { - g_signal_handler_disconnect (e_book_get_config_database(), manager->listener_id); - manager->listener_id = 0; - } - - if (manager->cached_folder_list) { - g_free (manager->cached_folder_list); - manager->cached_folder_list = 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 f5fb4aa451..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-manager.h +++ /dev/null @@ -1,69 +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; - - GList *completion_books; - - int minimum_query_length; - - gulong listener_id; - - char *cached_folder_list; -}; - -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 65ae293174..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-model.c +++ /dev/null @@ -1,839 +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 "e-select-names-model.h" -#include "e-select-names-marshal.h" -#include "addressbook/backend/ebook/e-card-simple.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_CARD, -}; - -enum { - NAME_DATA_BLANK, - NAME_DATA_CARD, - NAME_DATA_STRING -}; - -enum { - NAME_FORMAT_GIVEN_FIRST, - NAME_FORMAT_FAMILY_FIRST -}; - -struct _ESelectNamesModelPrivate { - gchar *id; - gchar *title; - - GList *data; /* of EDestination */ - - 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 (EDestination *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)) { - EDestination *dup = e_destination_copy (E_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) { - EDestination *dest = E_DESTINATION (iter->data); - strv[i] = (gchar *) e_destination_get_textrep (dest); - ++i; - iter = g_list_next (iter); - } - - text = g_strjoinv (separator, strv); - - if (strlen(text) > MAX_LENGTH) { - text[MAX_LENGTH] = '\0'; - text = g_realloc (text, MAX_LENGTH + 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) { - EDestination *dest = E_DESTINATION (iter->data); - strv[i] = (gchar *) e_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 EDestination * -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 E_DESTINATION (g_list_nth_data (model->priv->data, index)); -} - -gchar * -e_select_names_model_export_destinationv (ESelectNamesModel *model) -{ - EDestination **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 (EDestination *, len+1); - - for (i=0, j = model->priv->data; j != NULL; j = g_list_next (j)) { - EDestination *dest = E_DESTINATION (j->data); - - if (dest) - destv[i++] = dest; - } - - str = e_destination_exportv (destv); - g_free (destv); - - return str; -} - -static -void send_changed (EDestination *dest, ECard *card, gpointer closure) -{ - ESelectNamesModel *model = closure; - e_select_names_model_changed (model); -} - -void -e_select_names_model_import_destinationv (ESelectNamesModel *model, - gchar *destinationv) -{ - EDestination **destv; - gint i; - - g_return_if_fail (model && E_IS_SELECT_NAMES_MODEL (model)); - - destv = e_destination_importv (destinationv); - - e_select_names_model_delete_all (model); - - if (destv == NULL) - return; - - for (i = 0; destv[i]; i++) { - e_destination_use_card (destv[i], send_changed, model); - e_select_names_model_append (model, destv[i]); - } - g_free (destv); -} - -ECard * -e_select_names_model_get_card (ESelectNamesModel *model, gint index) -{ - const EDestination *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 ? e_destination_get_card (dest) : NULL; - -} - -const gchar * -e_select_names_model_get_string (ESelectNamesModel *model, gint index) -{ - const EDestination *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 ? e_destination_get_textrep (dest) : ""; -} - -static void -connect_destination (ESelectNamesModel *model, EDestination *dest) -{ - g_signal_connect (dest, - "changed", - G_CALLBACK (destination_changed_proxy), - model); -} - -static void -disconnect_destination (ESelectNamesModel *model, EDestination *dest) -{ - g_signal_handlers_disconnect_by_func (dest, destination_changed_proxy, model); -} - -gboolean -e_select_names_model_contains (ESelectNamesModel *model, const EDestination *dest) -{ - GList *iter; - - g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), FALSE); - g_return_val_if_fail (E_IS_DESTINATION (dest), FALSE); - - for (iter = model->priv->data; iter != NULL; iter = g_list_next (iter)) { - if (iter->data != NULL && e_destination_equal (dest, E_DESTINATION (iter->data))) - return TRUE; - } - - return FALSE; -} - -void -e_select_names_model_insert (ESelectNamesModel *model, gint index, EDestination *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 && E_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, EDestination *dest) -{ - g_return_if_fail (model && E_IS_SELECT_NAMES_MODEL (model)); - g_return_if_fail (dest && E_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, EDestination *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 && E_IS_DESTINATION (dest)); - - new_str = e_destination_get_textrep (dest); - 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, E_DESTINATION (node->data)); - connect_destination (model, dest); - - old_str = e_destination_get_textrep (E_DESTINATION (node->data)); - 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; - EDestination *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 = E_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) { - EDestination *dest; - - next = g_list_next (iter); - - if (next == NULL && !clean_last_entry) - break; - - dest = iter->data ? E_DESTINATION (iter->data) : NULL; - - if (dest == NULL || e_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), E_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 EDestination *d = e_select_names_model_get_destination (src, i); - if (d) - e_select_names_model_append (dest, e_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 EDestination *d = e_select_names_model_get_destination (src, i); - if (d && !e_select_names_model_contains (dest, d)) - e_select_names_model_append (dest, e_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 = e_destination_get_textrep (E_DESTINATION (iter->data)); - len = str ? strlen (str) : 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 = e_destination_get_textrep (E_DESTINATION (iter->data)); - len = str ? strlen (str) : 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_cardify (ESelectNamesModel *model, EBook *book, gint index, gint delay) -{ - EDestination *dest; - - g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model)); - g_return_if_fail (book == NULL || E_IS_BOOK (book)); - g_return_if_fail (0 <= index && index < g_list_length (model->priv->data)); - - dest = E_DESTINATION (g_list_nth_data (model->priv->data, index)); - - if (!e_destination_is_empty (dest)) { - - if (delay > 0) - e_destination_cardify_delayed (dest, book, delay); - else - e_destination_cardify (dest, book); - } -} - -gboolean -e_select_names_model_uncardify (ESelectNamesModel *model, gint index) -{ - EDestination *dest; - gboolean rv = FALSE; - - g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), FALSE); - g_return_val_if_fail (0 <= index && index < g_list_length (model->priv->data), FALSE); - - dest = E_DESTINATION (g_list_nth_data (model->priv->data, index)); - - if (!e_destination_is_empty (dest)) { - EDestination *cpy_dest = e_destination_copy (dest); - - rv = e_destination_uncardify (cpy_dest); - - if (rv) { - e_select_names_model_replace (model, index, cpy_dest); - } - - } - - return rv; -} - -void -e_select_names_model_cancel_cardify (ESelectNamesModel *model, gint index) -{ - EDestination *dest; - - g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model)); - g_return_if_fail (0 <= index && index < g_list_length (model->priv->data)); - - dest = E_DESTINATION (g_list_nth_data (model->priv->data, index)); - - e_destination_cancel_cardify (dest); -} - -void -e_select_names_model_cardify_all (ESelectNamesModel *model, EBook *book, gint delay) -{ - 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)) { - EDestination *dest = E_DESTINATION (iter->data); - if (!e_destination_is_empty (dest)) { - - if (delay > 0) - e_destination_cardify_delayed (dest, book, delay); - else - e_destination_cardify (dest, book); - } - } -} - -void -e_select_names_model_cancel_cardify_all (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)) { - EDestination *dest = E_DESTINATION (iter->data); - e_destination_cancel_cardify (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 8a3c5381b7..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-model.h +++ /dev/null @@ -1,91 +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 <addressbook/backend/ebook/e-card.h> -#include <addressbook/backend/ebook/e-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 EDestination *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); -ECard *e_select_names_model_get_card (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 EDestination *dest); - -void e_select_names_model_insert (ESelectNamesModel *model, gint index, EDestination *dest); -void e_select_names_model_append (ESelectNamesModel *model, EDestination *dest); -void e_select_names_model_replace (ESelectNamesModel *model, gint index, EDestination *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_cardify (ESelectNamesModel *model, EBook *book, gint index, gint delay); -gboolean e_select_names_model_uncardify (ESelectNamesModel *model, gint index); -void e_select_names_model_cancel_cardify (ESelectNamesModel *model, gint index); -void e_select_names_model_cardify_all (ESelectNamesModel *model, EBook *book, gint delay); -void e_select_names_model_cancel_cardify_all (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 33afa13b2e..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-popup.c +++ /dev/null @@ -1,560 +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/gtkcheckmenuitem.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-app.h> -#include <libgnomeui/gnome-app-helper.h> -#include <libgnomeui/gnome-popup-menu.h> - -#include <addressbook/backend/ebook/e-book-util.h> -#include <addressbook/gui/contact-editor/e-contact-editor.h> -#include <addressbook/gui/contact-editor/e-contact-quick-add.h> -#include "e-addressbook-util.h" -#include "e-select-names-popup.h" - -typedef struct _PopupInfo PopupInfo; -struct _PopupInfo { - ESelectNamesTextModel *text_model; - EDestination *dest; - gint pos; - gint index; -}; - -static PopupInfo * -popup_info_new (ESelectNamesTextModel *text_model, EDestination *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... */ - -static void -make_contact_editor_cb (EBook *book, gpointer user_data) -{ - if (book) { - EDestination *dest = E_DESTINATION (user_data); - ECard *card; - - card = (ECard *) e_destination_get_card (dest); - if (e_card_evolution_list (card)) { - EContactListEditor *ce; - ce = e_addressbook_show_contact_list_editor (book, card, FALSE, TRUE); - e_contact_list_editor_raise (ce); - } - else { - EContactEditor *ce; - ce = e_addressbook_show_contact_editor (book, card, 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); -} - -static void -change_email_num_cb (GtkWidget *w, gpointer user_data) -{ - PopupInfo *info = (PopupInfo *) user_data; - gint n; - EDestination *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 != e_destination_get_email_num (info->dest)) { - dest = e_destination_new (); - e_destination_set_card (dest, e_destination_get_card (info->dest), n); - e_select_names_model_replace (info->text_model->source, info->index, dest); - - } -} - -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 -add_remove_recipient (GnomeUIInfo *uiinfo, PopupInfo *info) -{ - uiinfo->type = GNOME_APP_UI_ITEM; - uiinfo->label = _("Remove"); - uiinfo->moreinfo = remove_recipient_cb; -} - -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 -add_remove_all_recipients (GnomeUIInfo *uiinfo, PopupInfo *info) -{ - uiinfo->type = GNOME_APP_UI_ITEM; - uiinfo->label = _("Remove All"); - uiinfo->moreinfo = remove_all_recipients_cb; -} - -static void -toggle_html_mail_cb (GtkWidget *w, gpointer user_data) -{ - PopupInfo *info = (PopupInfo *) user_data; - GtkCheckMenuItem *item = GTK_CHECK_MENU_ITEM (w); - const EDestination *dest; - - if (info == NULL) - return; - - dest = info->dest; - - item = GTK_CHECK_MENU_ITEM (item); - e_destination_set_html_mail_pref ((EDestination *) dest, item->active); -} - -static void -add_html_mail (GnomeUIInfo *uiinfo, PopupInfo *info) -{ - uiinfo->type = GNOME_APP_UI_TOGGLEITEM; - uiinfo->label = _("Send HTML Mail?"); - uiinfo->moreinfo = toggle_html_mail_cb; -} - -static void -init_html_mail (GnomeUIInfo *uiinfo, PopupInfo *info) -{ - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (uiinfo->widget), - e_destination_get_html_mail_pref (info->dest)); - gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (uiinfo->widget), TRUE); - -} - -static void -set_uiinfo_label (GnomeUIInfo *uiinfo, const gchar *str) -{ - GtkWidget *label; - GList *item_children; - - item_children = gtk_container_get_children (GTK_CONTAINER (uiinfo->widget)); - label = item_children->data; - g_list_free (item_children); - gtk_label_set_text (GTK_LABEL (label), str); -} - -#define ARBITRARY_UIINFO_LIMIT 64 -static GtkWidget * -popup_menu_card (PopupInfo *info) -{ - GnomeUIInfo uiinfo[ARBITRARY_UIINFO_LIMIT]; - GnomeUIInfo radioinfo[ARBITRARY_UIINFO_LIMIT]; - gboolean using_radio = FALSE; - ECard *card; - gint i=0; - GtkWidget *pop; - EIterator *iterator; - gint html_toggle; - gint mail_label = -1; - const gchar *mail_label_str = NULL; - - /* - * Build up our GnomeUIInfo array. - */ - - memset (uiinfo, 0, sizeof (uiinfo)); - memset (radioinfo, 0, sizeof (radioinfo)); - - card = e_destination_get_card (info->dest); - - /* Use an empty label for now, we'll fill it later. - If we set uiinfo label to contact name here, gnome_popup_menu_new - could screw it up trying make a "translation". */ - uiinfo[i].type = GNOME_APP_UI_ITEM; - uiinfo[i].label = ""; - ++i; - - uiinfo[i].type = GNOME_APP_UI_SEPARATOR; - ++i; - - if (card->email) { - - if (e_list_length (card->email) > 1) { - gint j = 0; - - using_radio = TRUE; - - iterator = e_list_get_iterator (card->email); - for (e_iterator_reset (iterator); e_iterator_is_valid (iterator); e_iterator_next (iterator)) { - gchar *label = (gchar *)e_iterator_get (iterator); - if (label && *label) { - radioinfo[j].label = ""; - radioinfo[j].type = GNOME_APP_UI_ITEM; - radioinfo[j].moreinfo = change_email_num_cb; - ++j; - } - } - g_object_unref (iterator); - - radioinfo[j].type = GNOME_APP_UI_ENDOFINFO; - - uiinfo[i].type = GNOME_APP_UI_RADIOITEMS; - uiinfo[i].moreinfo = radioinfo; - ++i; - - } else { - uiinfo[i].type = GNOME_APP_UI_ITEM; - uiinfo[i].label = ""; - mail_label_str = e_destination_get_email (info->dest); - mail_label = i; - ++i; - } - - uiinfo[i].type = GNOME_APP_UI_SEPARATOR; - ++i; - } - - add_html_mail (&(uiinfo[i]), info); - html_toggle = i; - ++i; - - uiinfo[i].type = GNOME_APP_UI_ITEM; - uiinfo[i].label = N_("Edit Contact Info"); - uiinfo[i].moreinfo = edit_contact_info_cb; - ++i; - - add_remove_recipient (&(uiinfo[i]), info); - ++i; - - add_remove_all_recipients (&(uiinfo[i]), info); - ++i; - - uiinfo[i].type = GNOME_APP_UI_ENDOFINFO; - - /* - * Now do something with it... - */ - - pop = gnome_popup_menu_new (uiinfo); - - init_html_mail (&(uiinfo[html_toggle]), info); - - /* Properly handle the names & e-mail addresses so that they don't get leaked and so that - underscores are interpreted as key accelerators. This sucks. */ - - set_uiinfo_label (&(uiinfo[0]), e_destination_get_name (info->dest)); - - if (mail_label >= 0) { - set_uiinfo_label (&(uiinfo[mail_label]), e_destination_get_email (info->dest)); - } - - if (using_radio) { - gint n = e_destination_get_email_num (info->dest); - gint j = 0; - iterator = e_list_get_iterator (card->email); - for (e_iterator_reset (iterator); e_iterator_is_valid (iterator); e_iterator_next (iterator)) { - gchar *label = (gchar *)e_iterator_get (iterator); - if (label && *label) { - set_uiinfo_label (&(radioinfo[j]), label); - - g_object_set_data (G_OBJECT (radioinfo[j].widget), "number", GINT_TO_POINTER (j)); - - if (j == n) - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (radioinfo[n].widget), TRUE); - - ++j; - } - } - g_object_unref (iterator); - } - - return pop; -} - -static GtkWidget * -popup_menu_list (PopupInfo *info) -{ - GnomeUIInfo uiinfo[ARBITRARY_UIINFO_LIMIT]; - GtkWidget *pop; - const gchar *str; - gchar *gs; - gint i = 0, subcount = 0, max_subcount = 10; - ECard *card; - EIterator *iterator; - - memset (uiinfo, 0, sizeof (uiinfo)); - - uiinfo[i].type = GNOME_APP_UI_ITEM; - uiinfo[i].label = ""; - ++i; - - uiinfo[i].type = GNOME_APP_UI_SEPARATOR; - ++i; - - card = e_destination_get_card (info->dest); - - if (card->email) { - - iterator = e_list_get_iterator (card->email); - for (e_iterator_reset (iterator); e_iterator_is_valid (iterator) && subcount < max_subcount; e_iterator_next (iterator)) { - gchar *label = (gchar *) e_iterator_get (iterator); - if (label && *label) { - uiinfo[i].type = GNOME_APP_UI_ITEM; - uiinfo[i].label = ""; - ++i; - ++subcount; - } - } - if (e_iterator_is_valid (iterator)) { - uiinfo[i].type = GNOME_APP_UI_ITEM; - uiinfo[i].label = ""; - ++i; - } - - uiinfo[i].type = GNOME_APP_UI_SEPARATOR; - ++i; - - g_object_unref (iterator); - } - - uiinfo[i].type = GNOME_APP_UI_ITEM; - uiinfo[i].label = N_("Edit Contact List"); - uiinfo[i].moreinfo = edit_contact_info_cb; - ++i; - - add_remove_recipient (&(uiinfo[i]), info); - ++i; - - add_remove_all_recipients (&(uiinfo[i]), info); - ++i; - - uiinfo[i].type = GNOME_APP_UI_ENDOFINFO; - - pop = gnome_popup_menu_new (uiinfo); - - /* Now set labels properly. */ - - str = e_destination_get_name (info->dest); - if (!(str && *str)) - str = _("Unnamed Contact List"); - set_uiinfo_label (&(uiinfo[0]), str); - - if (card->email) { - - iterator = e_list_get_iterator (card->email); - i = 2; - for (e_iterator_reset (iterator); e_iterator_is_valid (iterator) && subcount < max_subcount; e_iterator_next (iterator)) { - gchar *label = (gchar *) e_iterator_get (iterator); - if (label && *label) { - EDestination *subdest = e_destination_import (label); - set_uiinfo_label (&(uiinfo[i]), e_destination_get_address (subdest)); - ++i; - g_object_unref (subdest); - } - } - if (e_iterator_is_valid (iterator)) { - gs = g_strdup_printf (N_("(%d not shown)"), e_list_length (card->email) - max_subcount); - set_uiinfo_label (&(uiinfo[i]), gs); - g_free (gs); - } - - g_object_unref (iterator); - } - - - return pop; -} - -static void -quick_add_cb (GtkWidget *w, gpointer user_data) -{ - PopupInfo *info = (PopupInfo *) user_data; - e_contact_quick_add_free_form (e_destination_get_address (info->dest), NULL, NULL); -} - -static GtkWidget * -popup_menu_nocard (PopupInfo *info) -{ - GnomeUIInfo uiinfo[ARBITRARY_UIINFO_LIMIT]; - gint i=0; - GtkWidget *pop; - const gchar *str; - gint html_toggle; - - memset (uiinfo, 0, sizeof (uiinfo)); - - /* Use an empty label for now, we'll fill it later. - If we set uiinfo label to contact name here, gnome_popup_menu_new - could screw it up trying make a "translation". */ - uiinfo[i].type = GNOME_APP_UI_ITEM; - uiinfo[i].label = ""; - ++i; - - uiinfo[i].type = GNOME_APP_UI_SEPARATOR; - ++i; - - add_html_mail (&(uiinfo[i]), info); - html_toggle = i; - ++i; - - uiinfo[i].type = GNOME_APP_UI_ITEM; - uiinfo[i].label = _("Add to Contacts"); - uiinfo[i].moreinfo = quick_add_cb; - ++i; - - add_remove_recipient (&(uiinfo[i]), info); - ++i; - - add_remove_all_recipients (&(uiinfo[i]), info); - ++i; - - uiinfo[i].type = GNOME_APP_UI_ENDOFINFO; - - pop = gnome_popup_menu_new (uiinfo); - - init_html_mail (&(uiinfo[html_toggle]), info); - - /* Now set label of the first item to contact name */ - str = e_destination_get_name (info->dest); - if (! (str && *str)) - str = e_destination_get_email (info->dest); - if (! (str && *str)) - str = _("Unnamed Contact"); - - set_uiinfo_label (&(uiinfo[0]), str); - - return pop; -} - -void -e_select_names_popup (ESelectNamesTextModel *text_model, GdkEventButton *ev, gint pos, GtkWidget *for_widget) -{ - ESelectNamesModel *model; - GtkWidget *popup; - PopupInfo *info; - EDestination *dest; - ECard *card; - gint index; - - 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 = (EDestination *)e_select_names_model_get_destination (model, index); - if (e_destination_is_empty (dest)) - return; - - card = e_destination_get_card (dest); - - info = popup_info_new (text_model, dest, pos, index); - - if (e_destination_contains_card (dest)) { - if (e_destination_is_evolution_list (dest)) - popup = popup_menu_list (info); - else - popup = popup_menu_card (info); - } else { - popup = popup_menu_nocard (info); - } - - if (popup) { - /* Clean up our info item after we've made our selection. */ - g_signal_connect (popup, - "selection-done", - G_CALLBACK (popup_info_cleanup), - info); - - gnome_popup_menu_do_popup (popup, NULL, NULL, ev, info, for_widget); - - } else { - - popup_info_free (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 b88a480397..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-popup.h +++ /dev/null @@ -1,35 +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_popup (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-table-model.c b/addressbook/gui/component/select-names/e-select-names-table-model.c deleted file mode 100644 index 04c6a80f88..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-table-model.c +++ /dev/null @@ -1,364 +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 "e-select-names-table-model.h" -#include "addressbook/backend/ebook/e-card-simple.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 EDestination *dest = e_select_names_model_get_destination (model->source, i); - ECard *card = dest ? e_destination_get_card (dest) : NULL; - - if (card) { - ECardSimple *simple = e_card_simple_new(card); - model->data[i].name = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_NAME_OR_ORG); - if (model->data[i].name == 0) - model->data[i].name = g_strdup(""); - model->data[i].email = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_EMAIL); - if (model->data[i].email == 0) - model->data[i].email = g_strdup(""); - g_object_unref(simple); - } else { - const gchar *name = e_destination_get_name (dest); - const gchar *email = e_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 2; -} - -/* 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; - } - 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 1fbc0aa7fd..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-text-model.c +++ /dev/null @@ -1,801 +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 "e-addressbook-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_card (model, i) ? "<card>" : ""); - 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 = strlen (sep); -} - -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, strlen (text)); -} - -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; - - gint i; - - if (out) { - gchar *tmp = g_strndup (text, length); - fprintf (out, ">> insert \"%s\" (len=%d) at %d\n", tmp, length, pos); - g_free (tmp); - } - - pos = CLAMP (pos, 0, strlen (e_select_names_model_get_textification (source, text_model->sep))); - - /* 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 (i = 0; i < length && text[i]; ++i) { - gint index, start_pos, text_len; - gboolean inside_quote = FALSE; - - text_model->last_magic_comma_pos = -1; - - if (out) - fprintf (out, "processing [%c]\n", text[i]); - - 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); - - if (text[i] == *text_model->sep && index >= 0) { /* Is this a quoted or an unquoted separator we are dealing with? */ - const EDestination *dest = e_select_names_model_get_destination (source, index); - if (dest) { - const gchar *str = e_destination_get_textrep (dest); - gint j; - if (out) - fprintf (out, "str=%s pos=%d\n", str, pos); - for (j=0; j<pos-start_pos && str[j]; ++j) - if (str[j] == '"') { - 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 (text[i] == *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, e_destination_new ()); - e_select_names_model_insert (source, 0, e_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, e_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); - EDestination *d1 = e_destination_new (), *d2 = e_destination_new (); - - e_destination_set_raw (d1, str1); - e_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; - gchar *new_str = NULL; - gint this_length = 1; - gboolean whitespace = isspace ((gint) text[i]); - - 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 */ - new_str = g_strdup_printf("%c%s%s", text[i], pos < start_pos ? " " : "", str); - if (pos < start_pos) - ++this_length; - } - } else { - new_str = g_strdup_printf ("%.*s%c%s", offset, str, text[i], str + offset); - } - } else { - if (whitespace) { - /* swallow leading whitespace */ - this_length = 0; - } else { - new_str = g_strdup_printf ("%c", text[i]); - } - } - - if (new_str) { - - EDestination *dest; - dest = index >= 0 ? e_destination_copy (e_select_names_model_get_destination (source, index)) : e_destination_new (); - e_destination_set_raw (dest, new_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_free (new_str); - } - } - } - - 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; - EDestination *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 = e_destination_new (); - e_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); - new_str = str ? g_strdup_printf ("%.*s%s", offset, str, str + offset + length) : NULL; - - if (new_str) { - EReposDeleteShift repos; - EDestination *dest; - - dest = index >= 0 ? e_destination_copy (e_select_names_model_get_destination (source, index)) : e_destination_new (); - e_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 EDestination *dest; - --i; - dest = e_select_names_model_get_destination (source, i); - if (e_destination_get_card (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 EDestination *dest = e_select_names_model_get_destination (source, i); - if (e_destination_get_card (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 text_model->text + pos; -} - -static void -e_select_names_text_model_activate_obj (ETextModel *model, gint n) -{ - ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL (model)->source; - ECard *card; - gint i; - - i = nth_obj_index (source, n); - g_return_if_fail (i >= 0); - - card = e_select_names_model_get_card (source, i); - g_return_if_fail (card != NULL); - - /* present read-only contact editor when someone double clicks from here */ - if (e_card_evolution_list (card)) { - EContactListEditor *ce; - ce = e_addressbook_show_contact_list_editor (e_card_get_book(card), card, FALSE, FALSE); - e_contact_list_editor_raise (ce); - } - else { - EContactEditor *ce; - ce = e_addressbook_show_contact_editor (e_card_get_book(card), card, FALSE, FALSE); - e_contact_editor_raise (ce); - } -} - - - 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 8b0531093b..0000000000 --- a/addressbook/gui/component/select-names/e-select-names.c +++ /dev/null @@ -1,884 +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 <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-font.h> -#include <gal/widgets/e-popup-menu.h> - -#include <addressbook/gui/widgets/e-addressbook-model.h> -#include <addressbook/gui/widgets/e-addressbook-table-adapter.h> -#include <addressbook/gui/component/e-cardlist-model.h> -#include <addressbook/backend/ebook/e-book.h> -#include <addressbook/backend/ebook/e-book-util.h> -#include <addressbook/gui/component/addressbook-component.h> -#include <addressbook/gui/component/addressbook-storage.h> -#include <addressbook/gui/component/addressbook.h> -#include <shell/evolution-shell-client.h> -#include <shell/evolution-folder-selector-button.h> - -#include "e-select-names.h" -#include <addressbook/backend/ebook/e-card-simple.h> -#include "e-select-names-text-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> - -static void e_select_names_init (ESelectNames *card); -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); - -extern EvolutionShellClient *global_shell_client; - -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; - ESelectNamesTextModel *text_model; - ESelectNames *names; - GtkWidget *label; - GtkWidget *button; -} 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); -GtkWidget *e_addressbook_create_folder_selector(char *name, char *string1, char *string2, int num1, int num2); - -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 void -addressbook_model_set_uri(ESelectNames *e_select_names, EAddressbookModel *model, const char *uri) -{ - EBook *book; - char *book_uri; - - book_uri = e_book_expand_uri (uri); - - /* If uri == the current uri, then we don't have to do anything */ - book = e_addressbook_model_get_ebook (model); - if (book) { - const gchar *current_uri = e_book_get_uri (book); - if (current_uri && !strcmp (book_uri, current_uri)) { - g_free (book_uri); - return; - } - } - - book = e_book_new(); - - g_object_ref(e_select_names); - g_object_ref(model); - addressbook_load_uri(book, book_uri, (EBookCallback) set_book, e_select_names); - - g_free (book_uri); -} - -static void * -card_key (ECard *card) -{ - EBook *book; - const gchar *book_uri; - - if (card == NULL) - return NULL; - - g_assert (E_IS_CARD (card)); - - book = e_card_get_book (card); - book_uri = book ? e_book_get_uri (book) : "NoBook"; - return g_strdup_printf ("%s|%s", book_uri ? book_uri : "NoURI", e_card_get_id (card)); -} - -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; - ECard *card; - void *key; - - count = e_select_names_model_count (model); - for (i = 0; i < count; ++i) { - card = e_select_names_model_get_card (model, i); - if (card) { - key = card_key (card); - 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; - ECard *card; - EDestination *dest = e_destination_new (); - gint mapped_row; - - mapped_row = e_table_subset_view_to_model_row (E_TABLE_SUBSET (names->without), model_row); - - card = e_addressbook_model_get_card (E_ADDRESSBOOK_MODEL(names->model), mapped_row); - - if (card != NULL) { - e_destination_set_card (dest, card, 0); - - e_select_names_model_append (child->source, dest); - e_select_names_model_clean (child->source, FALSE); - - g_object_unref(card); - } -} - -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) -{ - EAddressbookModel *model = E_ADDRESSBOOK_MODEL (closure); - ECard *card = e_addressbook_model_get_card (model, row); - void *key = card_key (card); - g_object_unref (card); - 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; - EAddressbookModel *model; - GtkWidget *table; - - model = e_addressbook_model_new (); - adapter = E_TABLE_MODEL (e_addressbook_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; -} - -GtkWidget * -e_addressbook_create_folder_selector(char *name, char *string1, char *string2, int num1, int num2) -{ - return g_object_new (EVOLUTION_TYPE_FOLDER_SELECTOR_BUTTON, NULL); -} - -static void -folder_selected (EvolutionFolderSelectorButton *button, GNOME_Evolution_Folder *folder, - ESelectNames *e_select_names) -{ - addressbook_model_set_uri(e_select_names, e_select_names->model, folder->physicalUri); - - e_config_listener_set_string (e_book_get_config_database(), - "/apps/evolution/addressbook/select_names/last_used_uri", folder->physicalUri); -} - -static void -update_query (GtkWidget *widget, ESelectNames *e_select_names) -{ - char *category = ""; - const char *search = ""; - char *query; - char *q_array[4]; - int i; - 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)); - } - 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\"))", - search, search, search, search); - 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); -} - -static void -status_message (EAddressbookModel *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_CARD_SIMPLE_FIELD_NAME_OR_ORG, - model_row), - -1); - if (strcmp (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; - const char *selector_types[] = { "contacts/*", NULL }; - char *filename; - char *contacts_uri; - EConfigListener *db; - - db = e_book_get_config_database(); - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/select-names.glade", NULL, NULL); - e_select_names->gui = gui; - - 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_widget_unparent(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_OK, GTK_RESPONSE_OK, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - NULL); - - gtk_dialog_set_default_response (GTK_DIALOG (e_select_names), - GTK_RESPONSE_OK); - - gtk_window_set_title(GTK_WINDOW(e_select_names), _("Select Contacts from Addressbook")); - gtk_window_set_policy(GTK_WINDOW(e_select_names), FALSE, TRUE, FALSE); - - 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) { - 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->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); - - contacts_uri = e_config_listener_get_string_with_default (db, "/apps/evolution/addressbook/select_names/last_used_uri", NULL, NULL); - if (!contacts_uri) { - contacts_uri = e_config_listener_get_string_with_default (db, "/apps/evolution/shell/default_folders/contacts_uri", - NULL, NULL); - } - if (!contacts_uri || !contacts_uri[0]) { - if (contacts_uri) - g_free (contacts_uri); - filename = g_build_filename (g_get_home_dir(), "evolution/local/Contacts", NULL); - contacts_uri = g_strdup_printf("file://%s", filename); - g_free (filename); - } - - button = glade_xml_get_widget (gui, "folder-selector"); - evolution_folder_selector_button_construct (EVOLUTION_FOLDER_SELECTOR_BUTTON (button), - global_shell_client, - _("Find contact in"), - contacts_uri, - selector_types); - if (button && EVOLUTION_IS_FOLDER_SELECTOR_BUTTON (button)) - g_signal_connect(button, "selected", - G_CALLBACK(folder_selected), e_select_names); - gtk_widget_show (button); - - 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); - - addressbook_model_set_uri(e_select_names, e_select_names->model, contacts_uri); - - g_free (contacts_uri); -} - -static void e_select_names_child_free(char *key, ESelectNamesChild *child, ESelectNames *e_select_names) -{ - g_signal_handlers_disconnect_matched (child->source, - (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), - 0, 0, NULL, - G_CALLBACK (sync_table_and_models), e_select_names); - g_free(child->title); - g_object_unref(child->text_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->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) -{ - GtkWidget *widget = g_object_new (E_TYPE_SELECT_NAMES, NULL); - return widget; -} - -static void -button_clicked(GtkWidget *button, ESelectNamesChild *child) -{ - real_add_address(child->names, child); -} - -#if 0 -static void -remove_address(ETable *table, int row, int col, GdkEvent *event, ESelectNamesChild *child) -{ - e_select_names_model_delete (child->source, row); -} -#endif - -struct _RightClickData { - ESelectNamesChild *child; - int index; -}; -typedef struct _RightClickData RightClickData; - -#if 0 -static GSList *selected_rows = NULL; - -static void -etable_selection_foreach_cb (int row, void *data) -{ - /* Build a list of rows in reverse order, then remove them, - necessary because otherwise it'll start trying to delete - rows out of index in ETableModel */ - selected_rows = g_slist_prepend (selected_rows, GINT_TO_POINTER (row)); -} - -static void -selected_rows_foreach_cb (void *row, void *data) -{ - ESelectNamesChild *child = data; - - remove_address (NULL, GPOINTER_TO_INT (row), 0, NULL, child); -} -#endif - -static void -remove_cb (GtkWidget *widget, void *data) -{ - RightClickData *rcdata = (RightClickData *)data; - - e_select_names_model_delete (rcdata->child->source, rcdata->index); - - /* Free everything we've created */ - g_free (rcdata); -} - -static void -section_right_click_cb (EText *text, GdkEventButton *ev, gint pos, ESelectNamesChild *child) -{ - EPopupMenu right_click_menu[] = { - E_POPUP_ITEM (N_("Remove"), G_CALLBACK (remove_cb), 0), - E_POPUP_TERMINATOR - }; - gint index; - - e_select_names_model_text_pos (child->source, child->text_model->seplen, pos, &index, NULL, NULL); - - if (index != -1) { - RightClickData *rcdata = g_new0 (RightClickData, 1); - rcdata->index = index; - 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, char *name, char *id, ESelectNamesModel *source) -{ - ESelectNamesChild *child; - GtkWidget *button; - GtkWidget *label; - GtkWidget *alignment; - GtkTable *table; - char *label_text; - ETable *etable; - - GtkWidget *sw; - GtkWidget *recipient_table; - - 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->text_model = (ESelectNamesTextModel *) e_select_names_text_model_new (source); - e_select_names_text_model_set_separator (child->text_model, "\n"); - - 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); - - sw = gtk_scrolled_window_new (NULL, NULL); - recipient_table = e_entry_new (); - g_object_set (recipient_table, - "model", child->text_model, - "allow_newlines", TRUE, - NULL); - - g_signal_connect (recipient_table, - "popup", - G_CALLBACK (section_right_click_cb), - child); - - gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), recipient_table); - -#if 0 - g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(etable)), "right_click", - G_CALLBACK(section_right_click_cb), child); - g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(etable)), "double_click", - G_CALLBACK(remove_address), child); -#endif - - - 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); -} - -static void * -card_copy(const void *value, void *closure) -{ - g_object_ref((gpointer)value); - return (void *)value; -} - -static void -card_free(void *value, void *closure) -{ - g_object_unref((gpointer)value); -} - -EList * -e_select_names_get_section(ESelectNames *e_select_names, char *id) -{ - ESelectNamesChild *child; - int i; - int rows; - EList *list; - - child = g_hash_table_lookup(e_select_names->children, id); - if (!child) - return NULL; - rows = e_select_names_model_count (child->source); - - list = e_list_new(card_copy, card_free, NULL); - for (i = 0; i < rows; i++) { - ECard *card = e_select_names_model_get_card (child->source, i); - e_list_append(list, card); - g_object_unref(card); - } - return list; -} - -ESelectNamesModel * -e_select_names_get_source(ESelectNames *e_select_names, - char *id) -{ - ESelectNamesChild *child = g_hash_table_lookup(e_select_names->children, id); - if (child) { - if (child->source) - g_object_ref(child->source); - return child->source; - } else - return NULL; -} - -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 7ed09d2b12..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= "43" _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 bbed1d77ee..0000000000 --- a/addressbook/gui/component/select-names/e-select-names.h +++ /dev/null @@ -1,104 +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 <addressbook/gui/widgets/e-addressbook-model.h> - -#include "e-select-names-model.h" -#include "e-util/e-list.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* 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; - - /* item specific fields */ - GladeXML *gui; - - GHashTable *children; /* Of type char * to ESelectNamesChild */ - int child_count; - ETableScrolled *table; - ETableModel *adapter; - ETableModel *without; - EAddressbookModel *model; - GtkWidget *categories; - GtkWidget *select_entry; - GtkWidget *status_message; - char *def; - ESelectNamesFolder *current_folder; -}; - -struct _ESelectNamesClass -{ - GtkDialogClass parent_class; -}; - - -GtkWidget *e_select_names_new (void); -GType e_select_names_get_type (void); - -void e_select_names_add_section (ESelectNames *e_select_names, - char *name, - char *id, - ESelectNamesModel *source); -ESelectNamesModel *e_select_names_get_source (ESelectNames *e_select_names, - char *id); -void e_select_names_set_default (ESelectNames *e_select_names, - const char *id); -/* Returns a ref counted list of addresses. */ -EList *e_select_names_get_section (ESelectNames *e_select_names, - char *id); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_SELECT_NAMES_H__ */ diff --git a/addressbook/gui/component/select-names/e-simple-card-bonobo.c b/addressbook/gui/component/select-names/e-simple-card-bonobo.c deleted file mode 100644 index 0577daa648..0000000000 --- a/addressbook/gui/component/select-names/e-simple-card-bonobo.c +++ /dev/null @@ -1,216 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-simple-card-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. - * - * Authors: - * Ettore Perazzoli <ettore@ximian.com> - * Chris Lahey <clahey@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-simple-card-bonobo.h" - -#include <gal/util/e-util.h> - -#include "Evolution-Addressbook-SelectNames.h" - - -#define PARENT_TYPE BONOBO_TYPE_OBJECT -static BonoboObjectClass *parent_class = NULL; - -struct _ESimpleCardBonoboPrivate { - ECardSimple *card_simple; -}; - - - -static GNOME_Evolution_Addressbook_SimpleCard_Arbitrary * -impl_SimpleCard_get_arbitrary (PortableServer_Servant servant, - const CORBA_char *key, - CORBA_Environment *ev) -{ - ESimpleCardBonobo *simple_card; - ESimpleCardBonoboPrivate *priv; - GNOME_Evolution_Addressbook_SimpleCard_Arbitrary *ret_val = GNOME_Evolution_Addressbook_SimpleCard_Arbitrary__alloc (); - - simple_card = E_SIMPLE_CARD_BONOBO (bonobo_object (servant)); - priv = simple_card->priv; - - if (priv->card_simple) { - const ECardArbitrary *arbitrary = e_card_simple_get_arbitrary (priv->card_simple, key); - ret_val->key = CORBA_string_dup (arbitrary->key); - ret_val->value = CORBA_string_dup (arbitrary->value); - ret_val->type = CORBA_string_dup (arbitrary->type); - } else { - ret_val->key = CORBA_string_dup (""); - ret_val->value = CORBA_string_dup (""); - ret_val->type = CORBA_string_dup (""); - } - - return ret_val; -} - -static void -impl_SimpleCard_set_arbitrary (PortableServer_Servant servant, - const CORBA_char *key, - const CORBA_char *type, - const CORBA_char *value, - CORBA_Environment *ev) -{ - ESimpleCardBonobo *simple_card; - ESimpleCardBonoboPrivate *priv; - - simple_card = E_SIMPLE_CARD_BONOBO (bonobo_object (servant)); - priv = simple_card->priv; - - if (priv->card_simple) { - e_card_simple_set_arbitrary (priv->card_simple, key, type, value); - } -} - -static CORBA_char * -impl_SimpleCard_get (PortableServer_Servant servant, - GNOME_Evolution_Addressbook_SimpleCard_Field field, - CORBA_Environment *ev) -{ - ESimpleCardBonobo *simple_card; - ESimpleCardBonoboPrivate *priv; - - simple_card = E_SIMPLE_CARD_BONOBO (bonobo_object (servant)); - priv = simple_card->priv; - - if (priv->card_simple) { - char *value = e_card_simple_get (priv->card_simple, - field); - char *ret_val = CORBA_string_dup (value); - g_free (value); - return ret_val; - } else { - return CORBA_string_dup (""); - } -} - -static void -impl_SimpleCard_set (PortableServer_Servant servant, - GNOME_Evolution_Addressbook_SimpleCard_Field field, - const CORBA_char *value, - CORBA_Environment *ev) -{ - - ESimpleCardBonobo *simple_card; - ESimpleCardBonoboPrivate *priv; - - simple_card = E_SIMPLE_CARD_BONOBO (bonobo_object (servant)); - priv = simple_card->priv; - - if (priv->card_simple) { - e_card_simple_set (priv->card_simple, - field, - value); - } -} - - -/* GtkObject methods. */ - -static void -impl_dispose (GObject *object) -{ - ESimpleCardBonobo *simple_card; - ESimpleCardBonoboPrivate *priv; - - simple_card = E_SIMPLE_CARD_BONOBO (object); - priv = simple_card->priv; - - if (priv) { - if (priv->card_simple) { - g_object_unref (priv->card_simple); - } - - g_free (priv); - simple_card->priv = NULL; - } - - if (G_OBJECT_CLASS(parent_class)->dispose) - G_OBJECT_CLASS(parent_class)->dispose(object); -} - - -static void -e_simple_card_bonobo_class_init (ESimpleCardBonoboClass *klass) -{ - GObjectClass *object_class; - POA_GNOME_Evolution_Addressbook_SimpleCard__epv *epv; - - object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_ref (BONOBO_TYPE_OBJECT); - - object_class->dispose = impl_dispose; - - epv = &klass->epv; - epv->getArbitrary = impl_SimpleCard_get_arbitrary; - epv->setArbitrary = impl_SimpleCard_set_arbitrary; - epv->get = impl_SimpleCard_get; - epv->set = impl_SimpleCard_set; -} - -static void -e_simple_card_bonobo_init (ESimpleCardBonobo *simple_card) -{ - ESimpleCardBonoboPrivate *priv; - - priv = g_new (ESimpleCardBonoboPrivate, 1); - - priv->card_simple = NULL; - - simple_card->priv = priv; -} - - -void -e_simple_card_bonobo_construct (ESimpleCardBonobo *simple_card, - ECardSimple *card_simple) -{ - g_return_if_fail (simple_card != NULL); - g_return_if_fail (E_IS_SIMPLE_CARD_BONOBO (simple_card)); - - simple_card->priv->card_simple = card_simple; - g_object_ref (card_simple); -} - -ESimpleCardBonobo * -e_simple_card_bonobo_new (ECardSimple *card_simple) -{ - ESimpleCardBonobo *simple_card; - - simple_card = g_object_new (E_TYPE_SIMPLE_CARD_BONOBO, NULL); - - e_simple_card_bonobo_construct (simple_card, card_simple); - - return simple_card; -} - - -BONOBO_TYPE_FUNC_FULL ( - ESimpleCardBonobo, - GNOME_Evolution_Addressbook_SimpleCard, - PARENT_TYPE, - e_simple_card_bonobo); diff --git a/addressbook/gui/component/select-names/e-simple-card-bonobo.h b/addressbook/gui/component/select-names/e-simple-card-bonobo.h deleted file mode 100644 index 93429f02f8..0000000000 --- a/addressbook/gui/component/select-names/e-simple-card-bonobo.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-simple-card-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. - * - * Authors: - * Ettore Perazzoli <ettore@ximian.com> - * Chris Lahey <clahey@ximian.com> - */ - -#ifndef __E_SIMPLE_CARD_BONOBO_H__ -#define __E_SIMPLE_CARD_BONOBO_H__ - -#include <bonobo/bonobo-object.h> - -#include "Evolution-Addressbook-SelectNames.h" -#include <addressbook/backend/ebook/e-card-simple.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_SIMPLE_CARD_BONOBO (e_simple_card_bonobo_get_type ()) -#define E_SIMPLE_CARD_BONOBO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SIMPLE_CARD_BONOBO, ESimpleCardBonobo)) -#define E_SIMPLE_CARD_BONOBO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SIMPLE_CARD_BONOBO, ESimpleCardBonoboClass)) -#define E_IS_SIMPLE_CARD_BONOBO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SIMPLE_CARD_BONOBO)) -#define E_IS_SIMPLE_CARD_BONOBO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_SIMPLE_CARD_BONOBO)) - - -typedef struct _ESimpleCardBonobo ESimpleCardBonobo; -typedef struct _ESimpleCardBonoboPrivate ESimpleCardBonoboPrivate; -typedef struct _ESimpleCardBonoboClass ESimpleCardBonoboClass; - -struct _ESimpleCardBonobo { - BonoboObject parent; - - ESimpleCardBonoboPrivate *priv; -}; - -struct _ESimpleCardBonoboClass { - BonoboObjectClass parent_class; - - POA_GNOME_Evolution_Addressbook_SimpleCard__epv epv; -}; - - -GType e_simple_card_bonobo_get_type (void); -ESimpleCardBonobo *e_simple_card_bonobo_new (ECardSimple *card_simple); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __E_SIMPLE_CARD_BONOBO_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 9a6b38f461..0000000000 --- a/addressbook/gui/component/select-names/select-names.glade +++ /dev/null @@ -1,451 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkDialog" id="dialog-top"> - <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">3</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">3</property> - <property name="column_spacing">3</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="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="table5"> - <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">3</property> - <property name="column_spacing">3</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> - - <child> - <widget class="Custom" id="folder-selector"> - <property name="visible">True</property> - <property name="creation_function">e_addressbook_create_folder_selector</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Mon, 15 Jul 2002 02:21:32 GMT</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">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> - - <child> - <widget class="GtkVBox" id="vbox5"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</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">3</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">3</property> - <property name="column_spacing">3</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">3</property> - - <child> - <widget class="GtkHBox" id="hbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">3</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> - </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/contact-editor/.cvsignore b/addressbook/gui/contact-editor/.cvsignore deleted file mode 100644 index fc6d30bcb8..0000000000 --- a/addressbook/gui/contact-editor/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -*.lo -*.la -contact-editor-test -e-contact-editor-marshal.c -e-contact-editor-marshal.h diff --git a/addressbook/gui/contact-editor/Makefile.am b/addressbook/gui/contact-editor/Makefile.am deleted file mode 100644 index 62583207a3..0000000000 --- a/addressbook/gui/contact-editor/Makefile.am +++ /dev/null @@ -1,69 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/addressbook/ \ - -I$(top_srcdir)/addressbook/backend \ - -I$(top_builddir)/addressbook/backend \ - -I$(top_srcdir)/addressbook/gui/merging \ - -I$(top_srcdir)/widgets/e-table \ - -I$(top_builddir)/shell \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DDATADIR=\""$(datadir)"\" \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ - -DEVOLUTIONDIR=\""$(evolutiondir)"\" \ - -DG_LOG_DOMAIN=\"contact-editor\" \ - -DG_DISABLE_DEPRECATED \ - -DGTK_DISABLE_DEPRECATED \ - -DLIBGNOME_DISABLE_DEPRECATED \ - -DLIBGNOMEUI_DISABLE_DEPRECATED \ - $(EVOLUTION_ADDRESSBOOK_CFLAGS) - -noinst_LIBRARIES = \ - libecontacteditor.a - -libecontacteditor_a_SOURCES = \ - e-contact-editor-address.c \ - e-contact-editor-address.h \ - e-contact-editor-fullname.c \ - e-contact-editor-fullname.h \ - e-contact-editor-marshal.c \ - e-contact-editor.c \ - e-contact-editor.h \ - e-contact-save-as.c \ - e-contact-save-as.h \ - e-contact-quick-add.c \ - e-contact-quick-add.h - -# GLib marshalling cruft - -e-contact-editor-marshal.h: e-contact-editor-marshal.list - ( @GLIB_GENMARSHAL@ --prefix=ece_marshal e-contact-editor-marshal.list --header > e-contact-editor-marshal.tmp \ - && mv e-contact-editor-marshal.tmp e-contact-editor-marshal.h ) \ - || ( rm -f e-contact-editor-marshal.tmp && exit 1 ) - -e-contact-editor-marshal.c: e-contact-editor-marshal.h - ( @GLIB_GENMARSHAL@ --prefix=ece_marshal e-contact-editor-marshal.list --body > e-contact-editor-marshal.tmp \ - && mv e-contact-editor-marshal.tmp e-contact-editor-marshal.c ) \ - || ( rm -f e-contact-editor-marshal.tmp && exit 1 ) - -MARSHAL_GENERATED = e-contact-editor-marshal.c e-contact-editor-marshal.h - -evolutiondir = $(datadir)/evolution - -evolution_DATA = arrow.png - -iconsdir = $(datadir)/evolution/images - -gladedir = $(datadir)/evolution/glade - -glade_DATA = \ - contact-editor.glade \ - fulladdr.glade \ - fullname.glade - -BUILT_SOURCES = $(MARSHAL_GENERATED) -CLEANFILES = $(BUILT_SOURCES) - -EXTRA_DIST= $(evolution_DATA) \ - $(glade_DATA) \ - e-contact-editor-marshal.list diff --git a/addressbook/gui/contact-editor/arrow.png b/addressbook/gui/contact-editor/arrow.png Binary files differdeleted file mode 100644 index b102356c78..0000000000 --- a/addressbook/gui/contact-editor/arrow.png +++ /dev/null diff --git a/addressbook/gui/contact-editor/contact-editor.glade b/addressbook/gui/contact-editor/contact-editor.glade deleted file mode 100644 index 13616d09d9..0000000000 --- a/addressbook/gui/contact-editor/contact-editor.glade +++ /dev/null @@ -1,2389 +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" /> - <requires lib="bonobo" /> - - <widget class="GtkDialog" id="dialog2"> - <property name="border_width">2</property> - <property name="visible">no</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="modal">no</property> - <property name="allow_shrink">no</property> - <property name="allow_grow">no</property> - <property name="window-position">GTK_WIN_POS_NONE</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="dialog-vbox2"> - <property name="homogeneous">no</property> - <property name="spacing">4</property> - <property name="visible">yes</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="dialog-action_area2"> - <property name="layout_style">GTK_BUTTONBOX_END</property> - <property name="spacing">8</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button28"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="visible">yes</property> - <property name="label">gtk-ok</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button29"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="visible">yes</property> - <property name="label">gtk-apply</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button30"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="visible">yes</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">yes</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table2"> - <property name="homogeneous">no</property> - <property name="row_spacing">0</property> - <property name="column_spacing">2</property> - <property name="n-rows">2</property> - <property name="n-columns">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkEntry" id="entry2"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox1"> - <property name="homogeneous">no</property> - <property name="spacing">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button31"> - <property name="border_width">2</property> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">_Add</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="button32"> - <property name="border_width">2</property> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">_Delete</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">expand|fill</property> - </packing> - </child> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow1"> - <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property> - <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property> - <property name="shadow_type">GTK_SHADOW_NONE</property> - <property name="height-request">200</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkTreeView" id="clist1"> - <property name="can_focus">yes</property> - <property name="headers-visible">yes</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label20"> - <property name="child_name">CList:title</property> - <property name="label" translatable="yes">Phone Types</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - </child> - - <child internal-child="hscrollbar"> - <widget class="GtkHScrollbar" id="convertwidget1"> - <property name="update_policy">GTK_UPDATE_CONTINUOUS</property> - <property name="visible">yes</property> - </widget> - </child> - - <child internal-child="vscrollbar"> - <widget class="GtkVScrollbar" id="convertwidget2"> - <property name="update_policy">GTK_UPDATE_CONTINUOUS</property> - <property name="visible">yes</property> - </widget> - </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="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options">expand|fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">4</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <widget class="GtkDialog" id="dialog-add-phone"> - <property name="visible">no</property> - <property name="title" translatable="yes">New phone type</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="modal">no</property> - <property name="allow_shrink">no</property> - <property name="allow_grow">no</property> - <property name="window-position">GTK_WIN_POS_NONE</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="vbox2"> - <property name="homogeneous">no</property> - <property name="spacing">8</property> - <property name="visible">yes</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="hbuttonbox1"> - <property name="layout_style">GTK_BUTTONBOX_END</property> - <property name="spacing">8</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button43"> - <property name="can_default">yes</property> - <property name="has_default">yes</property> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">_Add</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button44"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="visible">yes</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">yes</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkFrame" id="frame-add-phone"> - <property name="border_width">4</property> - <property name="label" translatable="yes">New phone type</property> - <property name="label_xalign">0</property> - <property name="shadow">GTK_SHADOW_ETCHED_IN</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkAlignment" id="alignment9"> - <property name="border_width">9</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkEntry" id="entry-add-phone"> - <property name="can_focus">yes</property> - <property name="has_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">4</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <widget class="GnomeApp" id="contact editor"> - <property name="visible">no</property> - <property name="title" translatable="yes">Contact Editor</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="enable_layout_config">yes</property> - <property name="window-position">GTK_WIN_POS_NONE</property> - - <child internal-child="dock"> - <widget class="BonoboDock" id="dock1"> - <property name="allow_floating">yes</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkNotebook" id="notebook-contact-editor"> - <property name="can_focus">yes</property> - <property name="show_tabs">yes</property> - <property name="show_border">yes</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">no</property> - <property name="tab_hborder">2</property> - <property name="tab_vborder">2</property> - <property name="enable-popup">no</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkTable" id="table-contact-editor-general"> - <property name="border_width">7</property> - <property name="homogeneous">no</property> - <property name="row_spacing">4</property> - <property name="column_spacing">4</property> - <property name="n-rows">14</property> - <property name="n-columns">8</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkEntry" id="entry-phone1"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">7</property> - <property name="right_attach">8</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-phone2"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">7</property> - <property name="right_attach">8</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-phone3"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">7</property> - <property name="right_attach">8</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-phone4"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">7</property> - <property name="right_attach">8</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkTextView" id="text-address"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="wrap_mode">GTK_WRAP_WORD</property> - <property name="width-request">1</property> - <property name="height-request">1</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">7</property> - <property name="right_attach">8</property> - <property name="top_attach">5</property> - <property name="bottom_attach">9</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="button-fullname"> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">Full _Name...</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">3</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment3"> - <property name="xalign">1</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button-email1"> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment5"> - <property name="xalign">1</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button-phone4"> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">6</property> - <property name="right_attach">7</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment7"> - <property name="xalign">1</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button-phone2"> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">6</property> - <property name="right_attach">7</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment8"> - <property name="xalign">1</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button-phone1"> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">6</property> - <property name="right_attach">7</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator4"> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">4</property> - <property name="right_attach">8</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="x_padding">0</property> - <property name="y_padding">2</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment6"> - <property name="xalign">1</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button-phone3"> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">6</property> - <property name="right_attach">7</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-fullname"> - <property name="can_default">yes</property> - <property name="has_default">yes</property> - <property name="can_focus">yes</property> - <property name="has_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-jobtitle"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-company"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-email1"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-web"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">8</property> - <property name="bottom_attach">9</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator5"> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">4</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="x_padding">0</property> - <property name="y_padding">2</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkCombo" id="combo-file-as"> - <property name="value_in_list">no</property> - <property name="case_sensitive">yes</property> - <property name="enable_arrow_keys">yes</property> - <property name="enable_arrows_always">no</property> - <property name="allow_empty">yes</property> - <property name="visible">yes</property> - - <child internal-child="entry"> - <widget class="GtkEntry" id="entry-file-as"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - </child> - - <child internal-child="list"> - <widget class="GtkList" id="convertwidget3"> - <property name="visible">yes</property> - - <child> - <widget class="GtkListItem" id="convertwidget4"> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="convertwidget5"> - <property name="label" translatable="yes"></property> - <property name="xalign">0.0</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator6"> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">4</property> - <property name="top_attach">7</property> - <property name="bottom_attach">8</property> - <property name="x_padding">0</property> - <property name="y_padding">2</property> - <property name="x_options">expand|fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment-htmlmail"> - <property name="xalign">0.5</property> - <property name="yalign">0</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkCheckButton" id="checkbutton-htmlmail"> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">Wants to receive _HTML mail</property> - <property name="active">no</property> - <property name="draw_indicator">yes</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|shrink|fill</property> - <property name="y_options">shrink|fill</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment4"> - <property name="xalign">1</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button-address"> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - - <child> - <placeholder /> - </child> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">6</property> - <property name="right_attach">7</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkEventBox" id="eventbox1"> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label-phone1"> - <property name="label" translatable="yes">Business</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">entry-phone1</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">5</property> - <property name="right_attach">6</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkEventBox" id="eventbox2"> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label-phone2"> - <property name="label" translatable="yes">Home</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">entry-phone2</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">5</property> - <property name="right_attach">6</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkEventBox" id="eventbox3"> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label-phone3"> - <property name="label" translatable="yes">Business Fax</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">entry-phone3</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">5</property> - <property name="right_attach">6</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkEventBox" id="eventbox4"> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label-phone4"> - <property name="label" translatable="yes">Mobile</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</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">entry-phone4</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">5</property> - <property name="right_attach">6</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkEventBox" id="eventbox5"> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label-email1"> - <property name="label" translatable="yes">Primary Email</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">entry-email1</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkEventBox" id="eventbox-business"> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label-address"> - <property name="label" translatable="yes">Business</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">text-address</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">5</property> - <property name="right_attach">6</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment2"> - <property name="xalign">0</property> - <property name="yalign">0</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkCheckButton" id="checkbutton-mailingaddress"> - <property name="label" translatable="yes">This is the _mailing address</property> - <property name="active">no</property> - <property name="draw_indicator">yes</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">7</property> - <property name="right_attach">8</property> - <property name="top_attach">9</property> - <property name="bottom_attach">10</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator9"> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">4</property> - <property name="top_attach">11</property> - <property name="bottom_attach">12</property> - <property name="x_padding">0</property> - <property name="y_padding">2</property> - <property name="x_options">expand|fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator10"> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">4</property> - <property name="right_attach">8</property> - <property name="top_attach">11</property> - <property name="bottom_attach">12</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment-contacts"> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button-contacts"> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">C_ontacts...</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">3</property> - <property name="top_attach">12</property> - <property name="bottom_attach">13</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment15"> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkEntry" id="entry-categories"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">7</property> - <property name="right_attach">8</property> - <property name="top_attach">12</property> - <property name="bottom_attach">13</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment16"> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button-categories"> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">Ca_tegories...</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">5</property> - <property name="right_attach">7</property> - <property name="top_attach">12</property> - <property name="bottom_attach">13</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkEventBox" id="eventbox7"> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label-jobtitle"> - <property name="label" translatable="yes">_Job title:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">entry-jobtitle</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">3</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="Custom" id="custom1"> - <property name="creation_function">e_create_image_widget</property> - <property name="string1">malehead.png</property> - <property name="string2"></property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Thu, 18 May 2000 12:19:47 GMT</property> - <property name="visible">yes</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">4</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="Custom" id="custom2"> - <property name="creation_function">e_create_image_widget</property> - <property name="string1">cellphone.png</property> - <property name="string2"></property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Thu, 18 May 2000 12:20:02 GMT</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">4</property> - <property name="right_attach">5</property> - <property name="top_attach">0</property> - <property name="bottom_attach">4</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="Custom" id="custom3"> - <property name="creation_function">e_create_image_widget</property> - <property name="string1">envelope.png</property> - <property name="string2"></property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Thu, 18 May 2000 12:19:51 GMT</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">5</property> - <property name="bottom_attach">7</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="Custom" id="custom4"> - <property name="creation_function">e_create_image_widget</property> - <property name="string1">house.png</property> - <property name="string2"></property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Thu, 18 May 2000 12:20:06 GMT</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">4</property> - <property name="right_attach">5</property> - <property name="top_attach">5</property> - <property name="bottom_attach">10</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="Custom" id="custom5"> - <property name="creation_function">e_create_image_widget</property> - <property name="string1">evolution-contacts-plain.png</property> - <property name="string2"></property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Thu, 18 May 2000 12:19:59 GMT</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">12</property> - <property name="bottom_attach">14</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="Custom" id="custom6"> - <property name="creation_function">e_create_image_widget</property> - <property name="string1">briefcase.png</property> - <property name="string2"></property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Thu, 18 May 2000 12:20:09 GMT</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">4</property> - <property name="right_attach">5</property> - <property name="top_attach">12</property> - <property name="bottom_attach">14</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="Custom" id="custom10"> - <property name="creation_function">e_create_image_widget</property> - <property name="string1">globe.png</property> - <property name="string2"></property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Thu, 18 May 2000 12:19:56 GMT</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">8</property> - <property name="bottom_attach">10</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-company"> - <property name="label" translatable="yes">Organi_zation:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">entry-company</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">3</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="button-fulladdr"> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">Add_ress...</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="left_attach">5</property> - <property name="right_attach">7</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment17"> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkTable" id="table-contacts"> - <property name="homogeneous">no</property> - <property name="row_spacing">0</property> - <property name="column_spacing">0</property> - <property name="n-rows">1</property> - <property name="n-columns">1</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">12</property> - <property name="bottom_attach">13</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="accellabel-fileas"> - <property name="label" translatable="yes">File A_s:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">entry-file-as</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">3</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="accellabel-web"> - <property name="label" translatable="yes">_Web page address:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">entry-web</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">3</property> - <property name="top_attach">8</property> - <property name="bottom_attach">9</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label15"> - <property name="label" translatable="yes">General</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table-contact-editor-details"> - <property name="border_width">7</property> - <property name="homogeneous">no</property> - <property name="row_spacing">4</property> - <property name="column_spacing">4</property> - <property name="n-rows">9</property> - <property name="n-columns">6</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label-department"> - <property name="label" translatable="yes">D_epartment:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">entry-department</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-office"> - <property name="label" translatable="yes">_Office:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">entry-office</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-profession"> - <property name="label" translatable="yes">P_rofession:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">entry-profession</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </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="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-nickname"> - <property name="label" translatable="yes">_Nickname:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">entry-nickname</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-spouse"> - <property name="label" translatable="yes">S_pouse:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">entry-spouse</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-birthday"> - <property name="label" translatable="yes">Birthda_y:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">dateedit-birthday</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-assistant"> - <property name="label" translatable="yes">A_ssistant's name:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">entry-assistant</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-manager"> - <property name="label" translatable="yes">_Manager's Name:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">entry-manager</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-anniversary"> - <property name="label" translatable="yes">Anni_versary:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">dateedit-anniversary</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-spouse"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-department"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-office"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-profession"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-nickname"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-assistant"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">4</property> - <property name="right_attach">6</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-manager"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">4</property> - <property name="right_attach">6</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator7"> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">6</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_padding">0</property> - <property name="y_padding">2</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-comments"> - <property name="label" translatable="yes">No_tes:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">text-comments</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">7</property> - <property name="bottom_attach">8</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkHSeparator" id="hseparator8"> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">6</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="Custom" id="custom7"> - <property name="creation_function">e_create_image_widget</property> - <property name="string1">briefcase.png</property> - <property name="string2"></property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Thu, 18 May 2000 12:20:13 GMT</property> - <property name="visible">yes</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">2</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="Custom" id="custom8"> - <property name="creation_function">e_create_image_widget</property> - <property name="string1">malehead.png</property> - <property name="string2"></property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Thu, 18 May 2000 12:20:16 GMT</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">4</property> - <property name="bottom_attach">6</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow2"> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkTextView" id="text-comments"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="wrap_mode">GTK_WRAP_WORD</property> - <property name="visible">yes</property> - </widget> - </child> - - <child internal-child="hscrollbar"> - <widget class="GtkHScrollbar" id="convertwidget6"> - <property name="update_policy">GTK_UPDATE_CONTINUOUS</property> - <property name="visible">yes</property> - </widget> - </child> - - <child internal-child="vscrollbar"> - <widget class="GtkVScrollbar" id="convertwidget7"> - <property name="update_policy">GTK_UPDATE_CONTINUOUS</property> - <property name="visible">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">6</property> - <property name="top_attach">8</property> - <property name="bottom_attach">9</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options">expand|fill</property> - </packing> - </child> - - <child> - <widget class="Custom" id="custom9"> - <property name="creation_function">e_create_image_widget</property> - <property name="string1">globe.png</property> - <property name="string2"></property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Thu, 18 May 2000 12:20:19 GMT</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">7</property> - <property name="bottom_attach">9</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="Custom" id="dateedit-birthday"> - <property name="can_focus">yes</property> - <property name="creation_function">e_contact_editor_create_date</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Tue, 05 Jun 2001 02:36:27 GMT</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">4</property> - <property name="right_attach">6</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="Custom" id="dateedit-anniversary"> - <property name="can_focus">yes</property> - <property name="creation_function">e_contact_editor_create_date</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Tue, 05 Jun 2001 02:36:32 GMT</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">4</property> - <property name="right_attach">6</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options">fill</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label16"> - <property name="label" translatable="yes">Details</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox3"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox1"> - <property name="border_width">7</property> - <property name="homogeneous">no</property> - <property name="spacing">4</property> - <property name="visible">yes</property> - - <child> - <widget class="Custom" id="custom12"> - <property name="creation_function">e_create_image_widget</property> - <property name="string1">globe.png</property> - <property name="string2"></property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Thu, 18 May 2000 12:20:13 GMT</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label24"> - <property name="label" translatable="yes">If this person publishes free/busy or other calendar information on the Internet, enter the address -of that information here.</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment18"> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0.75</property> - <property name="yscale">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkTable" id="table-contact-editor-collaboration"> - <property name="border_width">7</property> - <property name="homogeneous">no</property> - <property name="row_spacing">4</property> - <property name="column_spacing">4</property> - <property name="n-rows">2</property> - <property name="n-columns">2</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label-caluri"> - <property name="label" translatable="yes">_Public Calendar URL:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">entry-caluri</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-fburl"> - <property name="label" translatable="yes">F_ree/Busy URL:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</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">entry-fburl</property> - <property name="visible">yes</property> - <property name="use_underline">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-caluri"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</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_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-fburl"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label21"> - <property name="label" translatable="yes">Collaboration</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child internal-child="appbar"> - <widget class="GnomeAppBar" id="appbar1"> - <property name="has_progress">yes</property> - <property name="has_status">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> -</glade-interface> diff --git a/addressbook/gui/contact-editor/e-contact-editor-address.c b/addressbook/gui/contact-editor/e-contact-editor-address.c deleted file mode 100644 index 8bb5a075f8..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor-address.c +++ /dev/null @@ -1,603 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-editor-address.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 <e-contact-editor-address.h> - -#include <glib.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-window-icon.h> -#include <libgnome/gnome-util.h> -#include <gal/widgets/e-gui-utils.h> -#include <gtk/gtkcombo.h> -#include <gtk/gtkentry.h> -#include <gtk/gtkstock.h> -#include <gtk/gtklabel.h> -#include <string.h> -#include <stdlib.h> -#include <locale.h> - -static void e_contact_editor_address_init (EContactEditorAddress *card); -static void e_contact_editor_address_class_init (EContactEditorAddressClass *klass); -static void e_contact_editor_address_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void e_contact_editor_address_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void e_contact_editor_address_dispose (GObject *object); - -static void fill_in_info(EContactEditorAddress *editor); -static void extract_info(EContactEditorAddress *editor); - -static GtkDialogClass *parent_class = NULL; - -/* The arguments we take */ -enum { - PROP_0, - PROP_ADDRESS, - PROP_EDITABLE -}; - -GType -e_contact_editor_address_get_type (void) -{ - static GType contact_editor_address_type = 0; - - if (!contact_editor_address_type) { - static const GTypeInfo contact_editor_address_info = { - sizeof (EContactEditorAddressClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_contact_editor_address_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EContactEditorAddress), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_contact_editor_address_init, - }; - - contact_editor_address_type = g_type_register_static (GTK_TYPE_DIALOG, "EContactEditorAddress", &contact_editor_address_info, 0); - } - - return contact_editor_address_type; -} - -static void -e_contact_editor_address_class_init (EContactEditorAddressClass *klass) -{ - GObjectClass *object_class; - - object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_ref (GTK_TYPE_DIALOG); - - object_class->set_property = e_contact_editor_address_set_property; - object_class->get_property = e_contact_editor_address_get_property; - object_class->dispose = e_contact_editor_address_dispose; - - g_object_class_install_property (object_class, PROP_ADDRESS, - g_param_spec_pointer ("address", - _("Address"), - /*_( */"XXX blurb" /*)*/, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EDITABLE, - g_param_spec_boolean ("editable", - _("Editable"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); -} - -static GList * -add_to_tab_order(GList *list, GladeXML *gui, char *name) -{ - GtkWidget *widget = glade_xml_get_widget(gui, name); - return g_list_prepend(list, widget); -} - -static void -setup_tab_order(GladeXML *gui) -{ - GtkWidget *container; - GList *list = NULL; - - container = glade_xml_get_widget(gui, "table-checkaddress"); - - if (container) { - list = add_to_tab_order(list, gui, "entry-city"); - list = add_to_tab_order(list, gui, "entry-region"); - list = add_to_tab_order(list, gui, "entry-code"); - list = add_to_tab_order(list, gui, "combo-country"); - list = g_list_reverse(list); - e_container_change_tab_order(GTK_CONTAINER(container), list); - g_list_free(list); - } -} - -static char * countries [] = { - N_("United States"), - N_("Afghanistan"), - N_("Albania"), - N_("Algeria"), - N_("American Samoa"), - N_("Andorra"), - N_("Angola"), - N_("Anguilla"), - N_("Antarctica"), - N_("Antigua And Barbuda"), - N_("Argentina"), - N_("Armenia"), - N_("Aruba"), - N_("Australia"), - N_("Austria"), - N_("Azerbaijan"), - N_("Bahamas"), - N_("Bahrain"), - N_("Bangladesh"), - N_("Barbados"), - N_("Belarus"), - N_("Belgium"), - N_("Belize"), - N_("Benin"), - N_("Bermuda"), - N_("Bhutan"), - N_("Bolivia"), - N_("Bosnia And Herzegowina"), - N_("Botswana"), - N_("Bouvet Island"), - N_("Brazil"), - N_("British Indian Ocean Territory"), - N_("Brunei Darussalam"), - N_("Bulgaria"), - N_("Burkina Faso"), - N_("Burundi"), - N_("Cambodia"), - N_("Cameroon"), - N_("Canada"), - N_("Cape Verde"), - N_("Cayman Islands"), - N_("Central African Republic"), - N_("Chad"), - N_("Chile"), - N_("China"), - N_("Christmas Island"), - N_("Cocos (Keeling) Islands"), - N_("Colombia"), - N_("Comoros"), - N_("Congo"), - N_("Congo"), - N_("Cook Islands"), - N_("Costa Rica"), - N_("Cote d'Ivoire"), - N_("Croatia"), - N_("Cuba"), - N_("Cyprus"), - N_("Czech Republic"), - N_("Denmark"), - N_("Djibouti"), - N_("Dominica"), - N_("Dominican Republic"), - N_("East Timor"), - N_("Ecuador"), - N_("Egypt"), - N_("El Salvador"), - N_("Equatorial Guinea"), - N_("Eritrea"), - N_("Estonia"), - N_("Ethiopia"), - N_("Falkland Islands"), - N_("Faroe Islands"), - N_("Fiji"), - N_("Finland"), - N_("France"), - N_("French Guiana"), - N_("French Polynesia"), - N_("French Southern Territories"), - N_("Gabon"), - N_("Gambia"), - N_("Georgia"), - N_("Germany"), - N_("Ghana"), - N_("Gibraltar"), - N_("Greece"), - N_("Greenland"), - N_("Grenada"), - N_("Guadeloupe"), - N_("Guam"), - N_("Guatemala"), - N_("Guinea"), - N_("Guinea-bissau"), - N_("Guyana"), - N_("Haiti"), - N_("Heard And McDonald Islands"), - N_("Holy See"), - N_("Honduras"), - N_("Hong Kong"), - N_("Hungary"), - N_("Iceland"), - N_("India"), - N_("Indonesia"), - N_("Ireland"), - N_("Israel"), - N_("Italy"), - N_("Jamaica"), - N_("Japan"), - N_("Jordan"), - N_("Kazakhstan"), - N_("Kenya"), - N_("Kiribati"), - N_("Korea, Republic Of"), - N_("Kuwait"), - N_("Kyrgyzstan"), - N_("Laos"), - N_("Latvia"), - N_("Lebanon"), - N_("Lesotho"), - N_("Liberia"), - N_("Liechtenstein"), - N_("Lithuania"), - N_("Luxembourg"), - N_("Macau"), - N_("Macedonia"), - N_("Madagascar"), - N_("Malawi"), - N_("Malaysia"), - N_("Maldives"), - N_("Mali"), - N_("Malta"), - N_("Marshall Islands"), - N_("Martinique"), - N_("Mauritania"), - N_("Mauritius"), - N_("Mayotte"), - N_("Mexico"), - N_("Micronesia"), - N_("Moldova, Republic Of"), - N_("Monaco"), - N_("Mongolia"), - N_("Montserrat"), - N_("Morocco"), - N_("Mozambique"), - N_("Myanmar"), - N_("Namibia"), - N_("Nauru"), - N_("Nepal"), - N_("Netherlands"), - N_("Netherlands Antilles"), - N_("New Caledonia"), - N_("New Zealand"), - N_("Nicaragua"), - N_("Niger"), - N_("Nigeria"), - N_("Niue"), - N_("Norfolk Island"), - N_("Northern Mariana Islands"), - N_("Norway"), - N_("Oman"), - N_("Pakistan"), - N_("Palau"), - N_("Palestinian Territory"), - N_("Panama"), - N_("Papua New Guinea"), - N_("Paraguay"), - N_("Peru"), - N_("Philippines"), - N_("Pitcairn"), - N_("Poland"), - N_("Portugal"), - N_("Puerto Rico"), - N_("Qatar"), - N_("Reunion"), - N_("Romania"), - N_("Russian Federation"), - N_("Rwanda"), - N_("Saint Kitts And Nevis"), - N_("Saint Lucia"), - N_("Saint Vincent And The Grena-dines"), - N_("Samoa"), - N_("San Marino"), - N_("Sao Tome And Principe"), - N_("Saudi Arabia"), - N_("Senegal"), - N_("Seychelles"), - N_("Sierra Leone"), - N_("Singapore"), - N_("Slovakia"), - N_("Slovenia"), - N_("Solomon Islands"), - N_("Somalia"), - N_("South Africa"), - N_("South Georgia And The South Sandwich Islands"), - N_("Spain"), - N_("Sri Lanka"), - N_("St. Helena"), - N_("St. Pierre And Miquelon"), - N_("Sudan"), - N_("Suriname"), - N_("Svalbard And Jan Mayen Islands"), - N_("Swaziland"), - N_("Sweden"), - N_("Switzerland"), - N_("Taiwan"), - N_("Tajikistan"), - N_("Tanzania, United Republic Of"), - N_("Thailand"), - N_("Togo"), - N_("Tokelau"), - N_("Tonga"), - N_("Trinidad And Tobago"), - N_("Tunisia"), - N_("Turkey"), - N_("Turkmenistan"), - N_("Turks And Caicos Islands"), - N_("Tuvalu"), - N_("Uganda"), - N_("Ukraine"), - N_("United Arab Emirates"), - N_("United Kingdom"), - N_("United States Minor Outlying Islands"), - N_("Uruguay"), - N_("Uzbekistan"), - N_("Vanuatu"), - N_("Venezuela"), - N_("Viet Nam"), - N_("Virgin Islands, British"), - N_("Virgin Islands, U.S."), - N_("Wallis And Futuna Islands"), - N_("Western Sahara"), - N_("Yemen"), - N_("Yugoslavia"), - N_("Zambia"), - N_("Zimbabwe"), - NULL -}; - -static int -compare_func (const void *voida, const void *voidb) -{ - char * const *stringa = voida, * const *stringb = voidb; - - return strcoll (*stringa, *stringb); -} - -static void -fill_in_countries (GladeXML *gui) -{ - GtkCombo *combo; - combo = (GtkCombo *) glade_xml_get_widget(gui, "combo-country"); - if (combo && GTK_IS_COMBO (combo)) { - static gboolean sorted = FALSE; - static GList *country_list; - if (!sorted) { - int i; - char *locale; - - for (i = 0; countries[i]; i++) { - countries[i] = _(countries[i]); - } - - locale = setlocale (LC_COLLATE, NULL); - qsort (countries + 1, i - 1, sizeof (countries[0]), compare_func); - country_list = NULL; - for (i = 0; countries[i]; i++) { - country_list = g_list_prepend (country_list, countries[i]); - } - country_list = g_list_reverse (country_list); - sorted = TRUE; - } - gtk_combo_set_popdown_strings (combo, country_list); - } -} - -static void -e_contact_editor_address_init (EContactEditorAddress *e_contact_editor_address) -{ - GladeXML *gui; - GtkWidget *widget; - char *icon_path; - - gtk_dialog_add_buttons (GTK_DIALOG (e_contact_editor_address), - GTK_STOCK_OK, GTK_RESPONSE_OK, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - NULL); - - gtk_window_set_policy(GTK_WINDOW(e_contact_editor_address), FALSE, TRUE, FALSE); - - e_contact_editor_address->address = NULL; - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/fulladdr.glade", NULL, NULL); - e_contact_editor_address->gui = gui; - - setup_tab_order (gui); - fill_in_countries (gui); - - widget = glade_xml_get_widget(gui, "dialog-checkaddress"); - gtk_window_set_title (GTK_WINDOW (e_contact_editor_address), - GTK_WINDOW (widget)->title); - - widget = glade_xml_get_widget(gui, "table-checkaddress"); - g_object_ref(widget); - gtk_container_remove(GTK_CONTAINER(widget->parent), widget); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (e_contact_editor_address)->vbox), widget, TRUE, TRUE, 0); - g_object_unref(widget); - - icon_path = g_concat_dir_and_file (EVOLUTION_ICONSDIR, "evolution-contacts-mini.png"); - gnome_window_icon_set_from_file (GTK_WINDOW (e_contact_editor_address), icon_path); - g_free (icon_path); -} - -void -e_contact_editor_address_dispose (GObject *object) -{ - EContactEditorAddress *e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS(object); - - if (e_contact_editor_address->gui) { - g_object_unref(e_contact_editor_address->gui); - e_contact_editor_address->gui = NULL; - } - - if (e_contact_editor_address->address) { - e_card_delivery_address_unref(e_contact_editor_address->address); - e_contact_editor_address->address = NULL; - } -} - -GtkWidget* -e_contact_editor_address_new (const ECardDeliveryAddress *address) -{ - GtkWidget *widget = g_object_new (E_TYPE_CONTACT_EDITOR_ADDRESS, NULL); - g_object_set (widget, - "address", address, - NULL); - return widget; -} - -static void -e_contact_editor_address_set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) -{ - EContactEditorAddress *e_contact_editor_address; - - e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS (object); - - switch (prop_id){ - case PROP_ADDRESS: - e_card_delivery_address_unref(e_contact_editor_address->address); - e_contact_editor_address->address = e_card_delivery_address_copy(g_value_get_pointer (value)); - fill_in_info(e_contact_editor_address); - break; - case PROP_EDITABLE: { - int i; - char *widget_names[] = { - "entry-street", - "entry-city", - "entry-ext", - "entry-po", - "entry-region", - "combo-country", - "entry-code", - "label-street", - "label-city", - "label-ext", - "label-po", - "label-region", - "label-country", - "label-code", - NULL - }; - e_contact_editor_address->editable = g_value_get_boolean (value) ? TRUE : FALSE; - for (i = 0; widget_names[i] != NULL; i ++) { - GtkWidget *w = glade_xml_get_widget(e_contact_editor_address->gui, widget_names[i]); - if (GTK_IS_ENTRY (w)) { - gtk_entry_set_editable (GTK_ENTRY (w), - e_contact_editor_address->editable); - } - else if (GTK_IS_COMBO (w)) { - gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (w)->entry), - e_contact_editor_address->editable); - gtk_widget_set_sensitive (GTK_COMBO (w)->button, e_contact_editor_address->editable); - } - else if (GTK_IS_LABEL (w)) { - gtk_widget_set_sensitive (w, e_contact_editor_address->editable); - } - } - break; - } - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_contact_editor_address_get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) -{ - EContactEditorAddress *e_contact_editor_address; - - e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS (object); - - switch (prop_id) { - case PROP_ADDRESS: - extract_info(e_contact_editor_address); - g_value_set_pointer (value, e_card_delivery_address_ref(e_contact_editor_address->address)); - break; - case PROP_EDITABLE: - g_value_set_boolean (value, e_contact_editor_address->editable ? TRUE : FALSE); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -fill_in_field(EContactEditorAddress *editor, char *field, char *string) -{ - GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, field)); - if (entry) { - if (string) - gtk_entry_set_text(entry, string); - else - gtk_entry_set_text(entry, ""); - } -} - -static void -fill_in_info(EContactEditorAddress *editor) -{ - ECardDeliveryAddress *address = editor->address; - if (address) { - fill_in_field(editor, "entry-street" , address->street ); - fill_in_field(editor, "entry-po" , address->po ); - fill_in_field(editor, "entry-ext" , address->ext ); - fill_in_field(editor, "entry-city" , address->city ); - fill_in_field(editor, "entry-region" , address->region ); - fill_in_field(editor, "entry-code" , address->code ); - fill_in_field(editor, "entry-country", address->country); - } -} - -static char * -extract_field(EContactEditorAddress *editor, char *field) -{ - GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, field)); - if (entry) - return g_strdup (gtk_entry_get_text(entry)); - else - return NULL; -} - -static void -extract_info(EContactEditorAddress *editor) -{ - ECardDeliveryAddress *address = editor->address; - if (!address) { - address = e_card_delivery_address_new(); - editor->address = address; - } - address->street = extract_field(editor, "entry-street" ); - address->po = extract_field(editor, "entry-po" ); - address->ext = extract_field(editor, "entry-ext" ); - address->city = extract_field(editor, "entry-city" ); - address->region = extract_field(editor, "entry-region" ); - address->code = extract_field(editor, "entry-code" ); - address->country = extract_field(editor, "entry-country"); -} diff --git a/addressbook/gui/contact-editor/e-contact-editor-address.h b/addressbook/gui/contact-editor/e-contact-editor-address.h deleted file mode 100644 index 7faab47a4f..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor-address.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-editor-address.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_CONTACT_EDITOR_ADDRESS_H__ -#define __E_CONTACT_EDITOR_ADDRESS_H__ - -#include <gtk/gtkdialog.h> -#include <glade/glade.h> -#include <ebook/e-card.h> - -G_BEGIN_DECLS - -/* EContactEditorAddress - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * name ECardName * RW The card currently being edited. Returns a copy. - */ - -#define E_TYPE_CONTACT_EDITOR_ADDRESS (e_contact_editor_address_get_type ()) -#define E_CONTACT_EDITOR_ADDRESS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CONTACT_EDITOR_ADDRESS, EContactEditorAddress)) -#define E_CONTACT_EDITOR_ADDRESS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CONTACT_EDITOR_ADDRESS, EContactEditorAddressClass)) -#define E_IS_CONTACT_EDITOR_ADDRESS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CONTACT_EDITOR_ADDRESS)) -#define E_IS_CONTACT_EDITOR_ADDRESS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_CONTACT_EDITOR_ADDRESS)) - - -typedef struct _EContactEditorAddress EContactEditorAddress; -typedef struct _EContactEditorAddressClass EContactEditorAddressClass; - -struct _EContactEditorAddress -{ - GtkDialog parent; - - /* item specific fields */ - ECardDeliveryAddress *address; - - guint editable : 1; - - GladeXML *gui; -}; - -struct _EContactEditorAddressClass -{ - GtkDialogClass parent_class; -}; - - -GtkWidget *e_contact_editor_address_new(const ECardDeliveryAddress *name); -GType e_contact_editor_address_get_type (void); - -G_END_DECLS - -#endif /* __E_CONTACT_EDITOR_ADDRESS_H__ */ diff --git a/addressbook/gui/contact-editor/e-contact-editor-fullname.c b/addressbook/gui/contact-editor/e-contact-editor-fullname.c deleted file mode 100644 index aa06e66eae..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor-fullname.c +++ /dev/null @@ -1,284 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-editor-fullname.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 "e-contact-editor-fullname.h" -#include <libgnomeui/gnome-window-icon.h> -#include <libgnome/gnome-util.h> -#include <libgnome/gnome-i18n.h> -#include <gtk/gtkcombo.h> -#include <gtk/gtkstock.h> -#include <gtk/gtkentry.h> -#include <gtk/gtklabel.h> - -static void e_contact_editor_fullname_init (EContactEditorFullname *card); -static void e_contact_editor_fullname_class_init (EContactEditorFullnameClass *klass); -static void e_contact_editor_fullname_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void e_contact_editor_fullname_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void e_contact_editor_fullname_dispose (GObject *object); - -static void fill_in_info(EContactEditorFullname *editor); -static void extract_info(EContactEditorFullname *editor); - -static GtkDialogClass *parent_class = NULL; - -/* The arguments we take */ -enum { - PROP_0, - PROP_NAME, - PROP_EDITABLE -}; - -GType -e_contact_editor_fullname_get_type (void) -{ - static GType contact_editor_fullname_type = 0; - - if (!contact_editor_fullname_type) { - static const GTypeInfo contact_editor_fullname_info = { - sizeof (EContactEditorFullnameClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_contact_editor_fullname_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EContactEditorFullname), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_contact_editor_fullname_init, - }; - - contact_editor_fullname_type = g_type_register_static (GTK_TYPE_DIALOG, "EContactEditorFullname", &contact_editor_fullname_info, 0); - } - - return contact_editor_fullname_type; -} - -static void -e_contact_editor_fullname_class_init (EContactEditorFullnameClass *klass) -{ - GObjectClass *object_class; - - object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_ref (GTK_TYPE_DIALOG); - - object_class->set_property = e_contact_editor_fullname_set_property; - object_class->get_property = e_contact_editor_fullname_get_property; - object_class->dispose = e_contact_editor_fullname_dispose; - - g_object_class_install_property (object_class, PROP_NAME, - g_param_spec_pointer ("name", - _("Name"), - /*_( */"XXX blurb" /*)*/, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EDITABLE, - g_param_spec_boolean ("editable", - _("Editable"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); -} - -static void -e_contact_editor_fullname_init (EContactEditorFullname *e_contact_editor_fullname) -{ - GladeXML *gui; - GtkWidget *widget; - char *icon_path; - - gtk_dialog_add_buttons (GTK_DIALOG (e_contact_editor_fullname), - GTK_STOCK_OK, GTK_RESPONSE_OK, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - NULL); - - gtk_window_set_policy(GTK_WINDOW(e_contact_editor_fullname), TRUE, TRUE, FALSE); - - e_contact_editor_fullname->name = NULL; - gui = glade_xml_new (EVOLUTION_GLADEDIR "/fullname.glade", NULL, NULL); - e_contact_editor_fullname->gui = gui; - - widget = glade_xml_get_widget(gui, "dialog-checkfullname"); - gtk_window_set_title (GTK_WINDOW (e_contact_editor_fullname), - GTK_WINDOW (widget)->title); - - widget = glade_xml_get_widget(gui, "table-checkfullname"); - g_object_ref(widget); - gtk_container_remove(GTK_CONTAINER(widget->parent), widget); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (e_contact_editor_fullname)->vbox), widget, TRUE, TRUE, 0); - g_object_unref(widget); - - icon_path = g_concat_dir_and_file (EVOLUTION_ICONSDIR, "evolution-contacts-mini.png"); - gnome_window_icon_set_from_file (GTK_WINDOW (e_contact_editor_fullname), icon_path); - g_free (icon_path); -} - -void -e_contact_editor_fullname_dispose (GObject *object) -{ - EContactEditorFullname *e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME(object); - - if (e_contact_editor_fullname->gui) { - g_object_unref(e_contact_editor_fullname->gui); - e_contact_editor_fullname->gui = NULL; - } - - if (e_contact_editor_fullname->name) { - e_card_name_unref(e_contact_editor_fullname->name); - e_contact_editor_fullname->name = NULL; - } -} - -GtkWidget* -e_contact_editor_fullname_new (const ECardName *name) -{ - GtkWidget *widget = g_object_new (E_TYPE_CONTACT_EDITOR_FULLNAME, NULL); - g_object_set (widget, - "name", name, - NULL); - return widget; -} - -static void -e_contact_editor_fullname_set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) -{ - EContactEditorFullname *e_contact_editor_fullname; - - e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME (object); - - switch (prop_id){ - case PROP_NAME: - e_card_name_unref(e_contact_editor_fullname->name); - e_contact_editor_fullname->name = e_card_name_copy(g_value_get_pointer (value)); - fill_in_info(e_contact_editor_fullname); - break; - case PROP_EDITABLE: { - int i; - char *widget_names[] = { - "combo-title", - "combo-suffix", - "entry-first", - "entry-middle", - "entry-last", - "label-title", - "label-suffix", - "label-first", - "label-middle", - "label-last", - NULL - }; - e_contact_editor_fullname->editable = g_value_get_boolean (value) ? TRUE : FALSE; - for (i = 0; widget_names[i] != NULL; i ++) { - GtkWidget *w = glade_xml_get_widget(e_contact_editor_fullname->gui, widget_names[i]); - if (GTK_IS_ENTRY (w)) { - gtk_entry_set_editable (GTK_ENTRY (w), - e_contact_editor_fullname->editable); - } - else if (GTK_IS_COMBO (w)) { - gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (w)->entry), - e_contact_editor_fullname->editable); - gtk_widget_set_sensitive (GTK_COMBO (w)->button, e_contact_editor_fullname->editable); - } - else if (GTK_IS_LABEL (w)) { - gtk_widget_set_sensitive (w, e_contact_editor_fullname->editable); - } - } - break; - } - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_contact_editor_fullname_get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) -{ - EContactEditorFullname *e_contact_editor_fullname; - - e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME (object); - - switch (prop_id) { - case PROP_NAME: - extract_info(e_contact_editor_fullname); - g_value_set_pointer (value, e_card_name_ref(e_contact_editor_fullname->name)); - break; - case PROP_EDITABLE: - g_value_set_boolean (value, e_contact_editor_fullname->editable ? TRUE : FALSE); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -fill_in_field(EContactEditorFullname *editor, char *field, char *string) -{ - GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, field)); - if (entry) { - if (string) - gtk_entry_set_text(entry, string); - else - gtk_entry_set_text(entry, ""); - } -} - -static void -fill_in_info(EContactEditorFullname *editor) -{ - ECardName *name = editor->name; - if (name) { - fill_in_field(editor, "entry-title", name->prefix); - fill_in_field(editor, "entry-first", name->given); - fill_in_field(editor, "entry-middle", name->additional); - fill_in_field(editor, "entry-last", name->family); - fill_in_field(editor, "entry-suffix", name->suffix); - } -} - -static char * -extract_field(EContactEditorFullname *editor, char *field) -{ - GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, field)); - if (entry) - return g_strdup (gtk_entry_get_text(entry)); - else - return NULL; -} - -static void -extract_info(EContactEditorFullname *editor) -{ - ECardName *name = editor->name; - if (!name) { - name = e_card_name_new(); - editor->name = name; - } - - name->prefix = extract_field(editor, "entry-title" ); - name->given = extract_field(editor, "entry-first" ); - name->additional = extract_field(editor, "entry-middle"); - name->family = extract_field(editor, "entry-last" ); - name->suffix = extract_field(editor, "entry-suffix"); -} diff --git a/addressbook/gui/contact-editor/e-contact-editor-fullname.h b/addressbook/gui/contact-editor/e-contact-editor-fullname.h deleted file mode 100644 index 3c8e055a96..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor-fullname.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-editor-fullname.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_CONTACT_EDITOR_FULLNAME_H__ -#define __E_CONTACT_EDITOR_FULLNAME_H__ - -#include <gtk/gtkdialog.h> -#include <glade/glade.h> -#include <ebook/e-card.h> - -G_BEGIN_DECLS - -/* EContactEditorFullname - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * name ECardName * RW The card currently being edited. Returns a copy. - */ - -#define E_TYPE_CONTACT_EDITOR_FULLNAME (e_contact_editor_fullname_get_type ()) -#define E_CONTACT_EDITOR_FULLNAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CONTACT_EDITOR_FULLNAME, EContactEditorFullname)) -#define E_CONTACT_EDITOR_FULLNAME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CONTACT_EDITOR_FULLNAME, EContactEditorFullnameClass)) -#define E_IS_CONTACT_EDITOR_FULLNAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CONTACT_EDITOR_FULLNAME)) -#define E_IS_CONTACT_EDITOR_FULLNAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_CONTACT_EDITOR_FULLNAME)) - - -typedef struct _EContactEditorFullname EContactEditorFullname; -typedef struct _EContactEditorFullnameClass EContactEditorFullnameClass; - -struct _EContactEditorFullname -{ - GtkDialog parent; - - /* item specific fields */ - ECardName *name; - GladeXML *gui; - - /* Whether the dialog will accept modifications */ - guint editable : 1; -}; - -struct _EContactEditorFullnameClass -{ - GtkDialogClass parent_class; -}; - - -GtkWidget *e_contact_editor_fullname_new(const ECardName *name); -GType e_contact_editor_fullname_get_type (void); - -G_END_DECLS - -#endif /* __E_CONTACT_EDITOR_FULLNAME_H__ */ diff --git a/addressbook/gui/contact-editor/e-contact-editor-marshal.list b/addressbook/gui/contact-editor/e-contact-editor-marshal.list deleted file mode 100644 index 58b2640de5..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor-marshal.list +++ /dev/null @@ -1,2 +0,0 @@ -NONE:INT,OBJECT -NONE:NONE diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c deleted file mode 100644 index 0837fe6bd9..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ /dev/null @@ -1,2825 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-editor.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 "e-contact-editor.h" - -#include <time.h> -#include <gtk/gtkcheckbutton.h> -#include <gtk/gtkcheckmenuitem.h> -#include <gtk/gtkcombo.h> -#include <gtk/gtktextview.h> -#include <gtk/gtkmessagedialog.h> -#include <gtk/gtkstock.h> -#include <gtk/gtkentry.h> -#include <gtk/gtklabel.h> -#include <libgnomeui/gnome-popup-menu.h> -#include <libgnomeui/gnome-window-icon.h> -#include <libgnome/gnome-i18n.h> - -#include <bonobo/bonobo-ui-container.h> -#include <bonobo/bonobo-ui-util.h> -#include <bonobo/bonobo-window.h> -#include <gdk-pixbuf/gdk-pixbuf.h> -#include <gal/widgets/e-categories.h> -#include <gal/widgets/e-gui-utils.h> -#include <gal/e-text/e-entry.h> - -#include <e-util/e-categories-master-list-wombat.h> - -#include "addressbook/printing/e-contact-print.h" -#include "addressbook/printing/e-contact-print-envelope.h" -#include "addressbook/gui/widgets/e-addressbook-util.h" -#include "e-util/e-gui-utils.h" -#include "widgets/misc/e-dateedit.h" -#include "shell/evolution-shell-component-utils.h" - -#include "e-card-merging.h" - -#include "e-contact-editor-address.h" -#include "e-contact-editor-fullname.h" -#include "e-contact-editor-marshal.h" -#include "e-contact-save-as.h" - -/* Signal IDs */ -enum { - CARD_ADDED, - CARD_MODIFIED, - CARD_DELETED, - EDITOR_CLOSED, - LAST_SIGNAL -}; - -static void e_contact_editor_init (EContactEditor *card); -static void e_contact_editor_class_init (EContactEditorClass *klass); -static void e_contact_editor_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void e_contact_editor_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void e_contact_editor_dispose (GObject *object); - -#if 0 -static GtkWidget *e_contact_editor_build_dialog(EContactEditor *editor, gchar *entry_id, gchar *label_id, gchar *title, GList **list, GnomeUIInfo **info); -#endif -static void _email_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor); -static void _phone_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor); -static void _address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor); -static void find_address_mailing (EContactEditor *editor); -static void enable_writable_fields(EContactEditor *editor); -static void set_editable(EContactEditor *editor); -static void fill_in_info(EContactEditor *editor); -static void extract_info(EContactEditor *editor); -static void set_fields(EContactEditor *editor); -static void set_address_field(EContactEditor *editor, int result); -static void add_field_callback(GtkWidget *widget, EContactEditor *editor); -static void command_state_changed (EContactEditor *ce); -static void widget_changed (GtkWidget *widget, EContactEditor *editor); -static void close_dialog (EContactEditor *ce); -static void enable_widget (GtkWidget *widget, gboolean enabled); - -static GtkObjectClass *parent_class = NULL; - -static guint contact_editor_signals[LAST_SIGNAL]; - -/* The arguments we take */ -enum { - PROP_0, - PROP_BOOK, - PROP_CARD, - PROP_IS_NEW_CARD, - PROP_EDITABLE, - PROP_CHANGED, - PROP_WRITABLE_FIELDS -}; - -enum { - DYNAMIC_LIST_EMAIL, - DYNAMIC_LIST_PHONE, - DYNAMIC_LIST_ADDRESS -}; - -static GSList *all_contact_editors = NULL; - -GType -e_contact_editor_get_type (void) -{ - static GType contact_editor_type = 0; - - if (!contact_editor_type) { - static const GTypeInfo contact_editor_info = { - sizeof (EContactEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_contact_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EContactEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_contact_editor_init, - }; - - contact_editor_type = g_type_register_static (GTK_TYPE_OBJECT, "EContactEditor", &contact_editor_info, 0); - } - - return contact_editor_type; -} - -static void -e_contact_editor_class_init (EContactEditorClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_ref (GTK_TYPE_OBJECT); - - object_class->set_property = e_contact_editor_set_property; - object_class->get_property = e_contact_editor_get_property; - object_class->dispose = e_contact_editor_dispose; - - g_object_class_install_property (object_class, PROP_BOOK, - g_param_spec_object ("book", - _("Book"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_BOOK, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_CARD, - g_param_spec_object ("card", - _("Card"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_CARD, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_IS_NEW_CARD, - g_param_spec_boolean ("is_new_card", - _("Is New Card"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_WRITABLE_FIELDS, - g_param_spec_object ("writable_fields", - _("Writable Fields"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_LIST, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EDITABLE, - g_param_spec_boolean ("editable", - _("Editable"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_CHANGED, - g_param_spec_boolean ("changed", - _("Changed"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); - - contact_editor_signals[CARD_ADDED] = - g_signal_new ("card_added", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EContactEditorClass, card_added), - NULL, NULL, - ece_marshal_NONE__INT_OBJECT, - G_TYPE_NONE, 2, - G_TYPE_INT, G_TYPE_OBJECT); - - contact_editor_signals[CARD_MODIFIED] = - g_signal_new ("card_modified", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EContactEditorClass, card_modified), - NULL, NULL, - ece_marshal_NONE__INT_OBJECT, - G_TYPE_NONE, 2, - G_TYPE_INT, G_TYPE_OBJECT); - - contact_editor_signals[CARD_DELETED] = - g_signal_new ("card_deleted", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EContactEditorClass, card_deleted), - NULL, NULL, - ece_marshal_NONE__INT_OBJECT, - G_TYPE_NONE, 2, - G_TYPE_INT, G_TYPE_OBJECT); - - contact_editor_signals[EDITOR_CLOSED] = - g_signal_new ("editor_closed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EContactEditorClass, editor_closed), - NULL, NULL, - ece_marshal_NONE__NONE, - G_TYPE_NONE, 0); -} - -static void -_replace_button(EContactEditor *editor, gchar *button_xml, gchar *image, GCallback func) -{ - GladeXML *gui = editor->gui; - GtkWidget *button = glade_xml_get_widget(gui, button_xml); - GtkWidget *pixmap; - gchar *image_temp; - if (button && GTK_IS_BUTTON(button)) { - image_temp = g_strdup_printf("%s/%s", EVOLUTIONDIR, image); - pixmap = e_create_image_widget(NULL, image_temp, NULL, 0, 0); - gtk_container_add(GTK_CONTAINER(button), - pixmap); - g_free(image_temp); - gtk_widget_show(pixmap); - g_signal_connect(button, "button_press_event", func, editor); - } -} - -static void -_replace_buttons(EContactEditor *editor) -{ - _replace_button(editor, "button-phone1", "arrow.png", G_CALLBACK (_phone_arrow_pressed)); - _replace_button(editor, "button-phone2", "arrow.png", G_CALLBACK (_phone_arrow_pressed)); - _replace_button(editor, "button-phone3", "arrow.png", G_CALLBACK (_phone_arrow_pressed)); - _replace_button(editor, "button-phone4", "arrow.png", G_CALLBACK (_phone_arrow_pressed)); - _replace_button(editor, "button-address", "arrow.png", G_CALLBACK (_address_arrow_pressed)); - _replace_button(editor, "button-email1", "arrow.png", G_CALLBACK (_email_arrow_pressed)); -} - -static void -wants_html_changed (GtkWidget *widget, EContactEditor *editor) -{ - gboolean wants_html; - g_object_get (widget, - "active", &wants_html, - NULL); - g_object_set (editor->card, - "wants_html", wants_html, - NULL); - - widget_changed (widget, editor); -} - -static void -phone_entry_changed (GtkWidget *widget, EContactEditor *editor) -{ - int which; - GtkEntry *entry = GTK_ENTRY(widget); - ECardPhone *phone; - - if ( widget == glade_xml_get_widget(editor->gui, "entry-phone1") ) { - which = 1; - } else if ( widget == glade_xml_get_widget(editor->gui, "entry-phone2") ) { - which = 2; - } else if ( widget == glade_xml_get_widget(editor->gui, "entry-phone3") ) { - which = 3; - } else if ( widget == glade_xml_get_widget(editor->gui, "entry-phone4") ) { - which = 4; - } else - return; - phone = e_card_phone_new(); - phone->number = g_strdup (gtk_entry_get_text(entry)); - e_card_simple_set_phone(editor->simple, editor->phone_choice[which - 1], phone); - e_card_phone_unref(phone); - set_fields(editor); - - widget_changed (widget, editor); -} - -static void -email_entry_changed (GtkWidget *widget, EContactEditor *editor) -{ - const gchar *string; - GtkEntry *entry = GTK_ENTRY(widget); - - string = gtk_entry_get_text(entry); - - e_card_simple_set_email(editor->simple, editor->email_choice, string); - - widget_changed (widget, editor); -} - -static void -address_text_changed (GtkTextBuffer *buffer, EContactEditor *editor) -{ - ECardAddrLabel *address; - GtkTextIter start_iter, end_iter; - - if (editor->address_choice == -1) - return; - - address = e_card_address_label_new(); - - if (editor->address_mailing == editor->address_choice || editor->address_mailing == -1) { - GtkWidget *check; - - address->flags |= E_CARD_ADDR_DEFAULT; - - check = glade_xml_get_widget(editor->gui, "checkbutton-mailingaddress"); - if (check && GTK_IS_CHECK_BUTTON (check)) { - g_signal_handlers_block_matched (check, - G_SIGNAL_MATCH_DATA, - 0, 0, - NULL, NULL, editor); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE); - g_signal_handlers_unblock_matched (check, - G_SIGNAL_MATCH_DATA, - 0, 0, - NULL, NULL, editor); - } - } - - gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (buffer), &start_iter); - gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (buffer), &end_iter); - - address->data = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (buffer), &start_iter, &end_iter, FALSE); - - e_card_simple_set_address(editor->simple, editor->address_choice, address); - e_card_address_label_unref(address); - - widget_changed (NULL, editor); -} - - -static void -address_mailing_changed (GtkWidget *widget, EContactEditor *editor) -{ - ECardAddrLabel *address; - GtkWidget *text; - gboolean mailing_address; - - if (editor->address_choice == -1) - return; - - mailing_address = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); - - /* Mark the current address as the mailing address */ - text = glade_xml_get_widget(editor->gui, "text-address"); - if (text && GTK_IS_TEXT_VIEW(text)) { - GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text)); - GtkTextIter start_iter, end_iter; - - address = e_card_address_label_new(); - - if (mailing_address) - address->flags |= E_CARD_ADDR_DEFAULT; - else - address->flags &= ~E_CARD_ADDR_DEFAULT; - - gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (buffer), &start_iter); - gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (buffer), &end_iter); - - address->data = gtk_text_buffer_get_text (buffer, &start_iter, &end_iter, FALSE); - - e_card_simple_set_address(editor->simple, editor->address_choice, address); - e_card_address_label_unref(address); - } - - /* Unset the previous mailing address flag */ - if (mailing_address && editor->address_mailing != -1) { - const ECardAddrLabel *curr; - - curr = e_card_simple_get_address(editor->simple, - editor->address_mailing); - address = e_card_address_label_copy (curr); - address->flags &= ~E_CARD_ADDR_DEFAULT; - e_card_simple_set_address(editor->simple, - editor->address_mailing, - address); - } - - /* Remember the new mailing address */ - if (mailing_address) - editor->address_mailing = editor->address_choice; - else - editor->address_mailing = -1; - - widget_changed (widget, editor); -} - - -/* This function tells you whether name_to_style will make sense. */ -static gboolean -style_makes_sense(const ECardName *name, char *company, int style) -{ - switch (style) { - case 0: /* Fall Through */ - case 1: - return TRUE; - case 2: - if (company && *company) - return TRUE; - else - return FALSE; - case 3: /* Fall Through */ - case 4: - if (company && *company && name && ((name->given && *name->given) || (name->family && *name->family))) - return TRUE; - else - return FALSE; - default: - return FALSE; - } -} - -static char * -name_to_style(const ECardName *name, char *company, int style) -{ - char *string; - char *strings[4], **stringptr; - char *substring; - switch (style) { - case 0: - stringptr = strings; - if (name) { - if (name->family && *name->family) - *(stringptr++) = name->family; - if (name->given && *name->given) - *(stringptr++) = name->given; - } - *stringptr = NULL; - string = g_strjoinv(", ", strings); - break; - case 1: - stringptr = strings; - if (name) { - if (name->given && *name->given) - *(stringptr++) = name->given; - if (name->family && *name->family) - *(stringptr++) = name->family; - } - *stringptr = NULL; - string = g_strjoinv(" ", strings); - break; - case 2: - string = g_strdup(company); - break; - case 3: /* Fall Through */ - case 4: - stringptr = strings; - if (name) { - if (name->family && *name->family) - *(stringptr++) = name->family; - if (name->given && *name->given) - *(stringptr++) = name->given; - } - *stringptr = NULL; - substring = g_strjoinv(", ", strings); - if (!(company && *company)) - company = ""; - if (style == 3) - string = g_strdup_printf("%s (%s)", substring, company); - else - string = g_strdup_printf("%s (%s)", company, substring); - g_free(substring); - break; - default: - string = g_strdup(""); - } - return string; -} - -static int -file_as_get_style (EContactEditor *editor) -{ - GtkEntry *file_as = GTK_ENTRY(glade_xml_get_widget(editor->gui, "entry-file-as")); - char *filestring; - char *trystring; - ECardName *name = editor->name; - int i; - int style; - - if (!(file_as && GTK_IS_ENTRY(file_as))) - return -1; - - filestring = g_strdup (gtk_entry_get_text(file_as)); - - style = -1; - for (i = 0; i < 5; i++) { - trystring = name_to_style(name, editor->company, i); - if (!strcmp(trystring, filestring)) { - g_free(trystring); - g_free(filestring); - return i; - } - g_free(trystring); - } - g_free (filestring); - return -1; -} - -static void -file_as_set_style(EContactEditor *editor, int style) -{ - char *string; - int i; - GList *strings = NULL; - GtkEntry *file_as = GTK_ENTRY(glade_xml_get_widget(editor->gui, "entry-file-as")); - GtkWidget *widget; - - - if (!(file_as && GTK_IS_ENTRY(file_as))) - return; - - if (style == -1) { - string = g_strdup (gtk_entry_get_text(file_as)); - strings = g_list_append(strings, string); - } - - widget = glade_xml_get_widget(editor->gui, "combo-file-as"); - - for (i = 0; i < 5; i++) { - if (style_makes_sense(editor->name, editor->company, i)) { - char *u; - u = name_to_style(editor->name, editor->company, i); - if (u) strings = g_list_append(strings, u); - } - } - - if (widget && GTK_IS_COMBO(widget)) { - GtkCombo *combo = GTK_COMBO(widget); - gtk_combo_set_popdown_strings(combo, strings); - g_list_foreach(strings, (GFunc) g_free, NULL); - g_list_free(strings); - } - - if (style != -1) { - string = name_to_style(editor->name, editor->company, style); - gtk_entry_set_text(file_as, string); - g_free(string); - } -} - -static void -name_entry_changed (GtkWidget *widget, EContactEditor *editor) -{ - int style = 0; - const char *string; - - style = file_as_get_style(editor); - - e_card_name_unref(editor->name); - - string = gtk_entry_get_text (GTK_ENTRY(widget)); - editor->name = e_card_name_from_string(string); - - file_as_set_style(editor, style); - - widget_changed (widget, editor); -} - -static void -company_entry_changed (GtkWidget *widget, EContactEditor *editor) -{ - int style = 0; - - style = file_as_get_style(editor); - - g_free(editor->company); - - editor->company = g_strdup (gtk_entry_get_text(GTK_ENTRY(widget))); - - file_as_set_style(editor, style); - - widget_changed (widget, editor); -} - -static void -field_changed (GtkWidget *widget, EContactEditor *editor) -{ - if (!editor->changed) { - editor->changed = TRUE; - command_state_changed (editor); - } -} - -static void -set_entry_changed_signal_phone(EContactEditor *editor, char *id) -{ - GtkWidget *widget = glade_xml_get_widget(editor->gui, id); - if (widget && GTK_IS_ENTRY(widget)) - g_signal_connect(widget, "changed", - G_CALLBACK (phone_entry_changed), editor); -} - -static void -widget_changed (GtkWidget *widget, EContactEditor *editor) -{ - if (!editor->editable) { - g_warning ("non-editable contact editor has an editable field in it."); - return; - } - - if (!editor->changed) { - editor->changed = TRUE; - command_state_changed (editor); - } -} - -static void -set_entry_changed_signal_field(EContactEditor *editor, char *id) -{ - GtkWidget *widget = glade_xml_get_widget(editor->gui, id); - if (widget && GTK_IS_ENTRY(widget)) - g_signal_connect(widget, "changed", - G_CALLBACK (field_changed), editor); -} - -static void -set_entry_changed_signals(EContactEditor *editor) -{ - GtkWidget *widget; - set_entry_changed_signal_phone(editor, "entry-phone1"); - set_entry_changed_signal_phone(editor, "entry-phone2"); - set_entry_changed_signal_phone(editor, "entry-phone3"); - set_entry_changed_signal_phone(editor, "entry-phone4"); - widget = glade_xml_get_widget(editor->gui, "entry-email1"); - if (widget && GTK_IS_ENTRY(widget)) { - g_signal_connect(widget, "changed", - G_CALLBACK (email_entry_changed), editor); - } - widget = glade_xml_get_widget(editor->gui, "text-address"); - if (widget && GTK_IS_TEXT_VIEW(widget)) { - GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); - g_signal_connect(buffer, "changed", - G_CALLBACK (address_text_changed), editor); - } - widget = glade_xml_get_widget(editor->gui, "entry-fullname"); - if (widget && GTK_IS_ENTRY(widget)) { - g_signal_connect(widget, "changed", - G_CALLBACK (name_entry_changed), editor); - } - widget = glade_xml_get_widget(editor->gui, "entry-company"); - if (widget && GTK_IS_ENTRY(widget)) { - g_signal_connect(widget, "changed", - G_CALLBACK (company_entry_changed), editor); - } - widget = glade_xml_get_widget(editor->gui, "entry-web"); - if (widget && GTK_IS_ENTRY(widget)) { - g_signal_connect(widget, "changed", - G_CALLBACK (widget_changed), editor); - } - widget = glade_xml_get_widget(editor->gui, "entry-categories"); - if (widget && GTK_IS_ENTRY(widget)) { - g_signal_connect(widget, "changed", - G_CALLBACK (widget_changed), editor); - } - widget = glade_xml_get_widget(editor->gui, "entry-jobtitle"); - if (widget && GTK_IS_ENTRY(widget)) { - g_signal_connect(widget, "changed", - G_CALLBACK (widget_changed), editor); - } - widget = glade_xml_get_widget(editor->gui, "entry-file-as"); - if (widget && GTK_IS_ENTRY(widget)) { - g_signal_connect(widget, "changed", - G_CALLBACK (widget_changed), editor); - } - widget = glade_xml_get_widget(editor->gui, "entry-manager"); - if (widget && GTK_IS_ENTRY(widget)) { - g_signal_connect (widget, "changed", - G_CALLBACK (widget_changed), editor); - } - widget = glade_xml_get_widget(editor->gui, "entry-assistant"); - if (widget && GTK_IS_ENTRY(widget)) { - g_signal_connect (widget, "changed", - G_CALLBACK (widget_changed), editor); - } - widget = glade_xml_get_widget(editor->gui, "entry-office"); - if (widget && GTK_IS_ENTRY(widget)) { - g_signal_connect (widget, "changed", - G_CALLBACK (widget_changed), editor); - } - widget = glade_xml_get_widget(editor->gui, "entry-department"); - if (widget && GTK_IS_ENTRY(widget)) { - g_signal_connect (widget, "changed", - G_CALLBACK (widget_changed), editor); - } - widget = glade_xml_get_widget(editor->gui, "entry-profession"); - if (widget && GTK_IS_ENTRY(widget)) { - g_signal_connect (widget, "changed", - G_CALLBACK (widget_changed), editor); - } - widget = glade_xml_get_widget(editor->gui, "entry-nickname"); - if (widget && GTK_IS_ENTRY(widget)) { - g_signal_connect (widget, "changed", - G_CALLBACK (widget_changed), editor); - } - widget = glade_xml_get_widget(editor->gui, "entry-spouse"); - if (widget && GTK_IS_ENTRY(widget)) { - g_signal_connect (widget, "changed", - G_CALLBACK (widget_changed), editor); - } - widget = glade_xml_get_widget(editor->gui, "text-comments"); - if (widget && GTK_IS_TEXT_VIEW(widget)) { - GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); - g_signal_connect (buffer, "changed", - G_CALLBACK (widget_changed), editor); - } - widget = glade_xml_get_widget(editor->gui, "dateedit-birthday"); - if (widget && E_IS_DATE_EDIT(widget)) { - g_signal_connect (widget, "changed", - G_CALLBACK (widget_changed), editor); - } - widget = glade_xml_get_widget(editor->gui, "dateedit-anniversary"); - if (widget && E_IS_DATE_EDIT(widget)) { - g_signal_connect (widget, "changed", - G_CALLBACK (widget_changed), editor); - } - widget = glade_xml_get_widget(editor->gui, "entry-web"); - if (widget && GTK_IS_ENTRY(widget)) { - g_signal_connect (widget, "changed", - G_CALLBACK (widget_changed), editor); - } - -} - -static void -full_name_clicked(GtkWidget *button, EContactEditor *editor) -{ - GtkDialog *dialog = GTK_DIALOG(e_contact_editor_fullname_new(editor->name)); - int result; - - g_object_set (dialog, - "editable", editor->fullname_editable, - NULL); - gtk_widget_show(GTK_WIDGET(dialog)); - result = gtk_dialog_run (dialog); - gtk_widget_hide (GTK_WIDGET (dialog)); - - if (editor->fullname_editable && result == GTK_RESPONSE_OK) { - ECardName *name; - GtkWidget *fname_widget; - int style = 0; - - g_object_get (dialog, - "name", &name, - NULL); - - style = file_as_get_style(editor); - - fname_widget = glade_xml_get_widget(editor->gui, "entry-fullname"); - if (fname_widget && GTK_IS_ENTRY(fname_widget)) { - char *full_name = e_card_name_to_string(name); - gtk_entry_set_text(GTK_ENTRY(fname_widget), full_name); - g_free(full_name); - } - - e_card_name_unref(editor->name); - editor->name = e_card_name_ref(name); - - file_as_set_style(editor, style); - } - gtk_widget_destroy (GTK_WIDGET (dialog)); -} - -static void -full_addr_clicked(GtkWidget *button, EContactEditor *editor) -{ - GtkDialog *dialog; - int result; - const ECardDeliveryAddress *address; - - address = e_card_simple_get_delivery_address(editor->simple, editor->address_choice); - - dialog = GTK_DIALOG(e_contact_editor_address_new(address)); - g_object_set (dialog, - "editable", editor->address_editable[editor->address_choice], - NULL); - gtk_widget_show(GTK_WIDGET(dialog)); - - result = gtk_dialog_run (dialog); - - gtk_widget_hide (GTK_WIDGET (dialog)); - - if (editor->address_editable[editor->address_choice] && result == GTK_RESPONSE_OK) { - ECardDeliveryAddress *new_address; - GtkWidget *address_widget; - - g_object_get (dialog, - "address", &new_address, - NULL); - - address_widget = glade_xml_get_widget(editor->gui, "text-address"); - if (address_widget && GTK_IS_TEXT_VIEW(address_widget)) { - GtkTextBuffer *buffer; - GtkTextIter start_iter, end_iter; - char *string = e_card_delivery_address_to_string(new_address); - - buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (address_widget)); - - gtk_text_buffer_get_start_iter (buffer, &start_iter); - gtk_text_buffer_get_end_iter (buffer, &end_iter); - - gtk_text_buffer_delete (buffer, &start_iter, &end_iter); - - gtk_text_buffer_insert (buffer, &start_iter, string, strlen (string)); - - g_free(string); - } else { - ECardAddrLabel *address = e_card_delivery_address_to_label(new_address); - e_card_simple_set_address(editor->simple, editor->address_choice, address); - e_card_address_label_unref(address); - } - - e_card_simple_set_delivery_address(editor->simple, editor->address_choice, new_address); - - e_card_delivery_address_unref(new_address); - } - gtk_widget_destroy (GTK_WIDGET (dialog)); -} - -static void -categories_clicked(GtkWidget *button, EContactEditor *editor) -{ - char *categories = NULL; - GtkDialog *dialog; - int result; - GtkWidget *entry = glade_xml_get_widget(editor->gui, "entry-categories"); - ECategoriesMasterList *ecml; - if (entry && GTK_IS_ENTRY(entry)) - categories = g_strdup (gtk_entry_get_text(GTK_ENTRY(entry))); - else if (editor->card) - g_object_get (editor->card, - "categories", &categories, - NULL); - dialog = GTK_DIALOG(e_categories_new(categories)); - - if (dialog == NULL) { - GtkWidget *uh_oh = gtk_message_dialog_new (NULL, - 0, GTK_MESSAGE_ERROR, - GTK_RESPONSE_OK, - _("Category editor not available."), - NULL); - g_free (categories); - gtk_widget_show (uh_oh); - return; - } - - ecml = e_categories_master_list_wombat_new (); - g_object_set (dialog, - "header", _("This contact belongs to these categories:"), - "ecml", ecml, - NULL); - g_object_unref (ecml); - gtk_widget_show(GTK_WIDGET(dialog)); - result = gtk_dialog_run (dialog); - g_free (categories); - if (result == GTK_RESPONSE_OK) { - g_object_get (dialog, - "categories", &categories, - NULL); - if (entry && GTK_IS_ENTRY(entry)) - gtk_entry_set_text(GTK_ENTRY(entry), categories); - else - g_object_set (editor->card, - "categories", categories, - NULL); - g_free(categories); - } - gtk_widget_destroy(GTK_WIDGET(dialog)); -} - -static void -ensure_select_names_contact (EContactEditor *editor) -{ - if (editor->select_names_contacts == NULL) { - editor->select_names_contacts = e_select_names_manager_new (); - e_select_names_manager_add_section (editor->select_names_contacts, - "contacts", - "Related Contacts"); - } - - set_entry_changed_signal_field(editor, "entry-caluri"); - set_entry_changed_signal_field(editor, "entry-fburl"); -} - -static void -contacts_clicked (GtkWidget *button, EContactEditor *editor) -{ - ensure_select_names_contact (editor); - e_select_names_manager_activate_dialog (editor->select_names_contacts, - "contacts"); -} - -static void -add_lists (EContactEditor *editor) -{ - GtkWidget *table = glade_xml_get_widget (editor->gui, "table-contacts"); - if (table && GTK_IS_TABLE (table)) { - GtkWidget *entry; - - ensure_select_names_contact (editor); - entry = e_select_names_manager_create_entry (editor->select_names_contacts, - "contacts"); - g_signal_connect (entry, "changed", - G_CALLBACK (widget_changed), editor); - gtk_table_attach_defaults (GTK_TABLE (table), entry, 0, 1, 0, 1); - gtk_widget_show (entry); - } -} - - -typedef struct { - EContactEditor *ce; - gboolean should_close; -} EditorCloseStruct; - -static void -card_added_cb (EBook *book, EBookStatus status, const char *id, EditorCloseStruct *ecs) -{ - EContactEditor *ce = ecs->ce; - gboolean should_close = ecs->should_close; - - gtk_widget_set_sensitive (ce->app, TRUE); - ce->in_async_call = FALSE; - - e_card_set_id (ce->card, id); - - g_signal_emit (ce, contact_editor_signals[CARD_ADDED], 0, - status, ce->card); - - if (status == E_BOOK_STATUS_SUCCESS) { - ce->is_new_card = FALSE; - - if (should_close) { - close_dialog (ce); - } - else { - ce->changed = FALSE; - command_state_changed (ce); - } - } - - g_object_unref (ce); - g_free (ecs); -} - -static void -card_modified_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs) -{ - EContactEditor *ce = ecs->ce; - gboolean should_close = ecs->should_close; - - gtk_widget_set_sensitive (ce->app, TRUE); - ce->in_async_call = FALSE; - - g_signal_emit (ce, contact_editor_signals[CARD_MODIFIED], 0, - status, ce->card); - - if (status == E_BOOK_STATUS_SUCCESS) { - if (should_close) { - close_dialog (ce); - } - else { - ce->changed = FALSE; - command_state_changed (ce); - } - } - - g_object_unref (ce); - g_free (ecs); -} - -/* Emits the signal to request saving a card */ -static void -save_card (EContactEditor *ce, gboolean should_close) -{ - extract_info (ce); - e_card_simple_sync_card (ce->simple); - - if (ce->book) { - EditorCloseStruct *ecs = g_new(EditorCloseStruct, 1); - - ecs->ce = ce; - g_object_ref (ecs->ce); - - ecs->should_close = should_close; - - gtk_widget_set_sensitive (ce->app, FALSE); - ce->in_async_call = TRUE; - - if (ce->is_new_card) - e_card_merging_book_add_card (ce->book, ce->card, (EBookIdCallback)card_added_cb, ecs); - else - e_card_merging_book_commit_card (ce->book, ce->card, (EBookCallback)card_modified_cb, ecs); - } -} - -/* Closes the dialog box and emits the appropriate signals */ -static void -close_dialog (EContactEditor *ce) -{ - if (ce->app != NULL) { - gtk_widget_destroy (ce->app); - ce->app = NULL; - g_signal_emit (ce, contact_editor_signals[EDITOR_CLOSED], 0); - } -} - -static gboolean -prompt_to_save_changes (EContactEditor *editor) -{ - if (!editor->changed) - return TRUE; - - switch (e_addressbook_prompt_save_dialog (GTK_WINDOW(editor->app))) { - case GTK_RESPONSE_YES: - save_card (editor, FALSE); - return TRUE; - case GTK_RESPONSE_NO: - return TRUE; - case GTK_RESPONSE_CANCEL: - default: - return FALSE; - } -} - -/* Menu callbacks */ - -/* File/Save callback */ -static void -file_save_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - save_card (ce, FALSE); -} - -/* File/Close callback */ -static void -file_close_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - if (!prompt_to_save_changes (ce)) - return; - - close_dialog (ce); -} - -static void -file_save_as_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - ECard *card; - - ce = E_CONTACT_EDITOR (data); - - extract_info (ce); - e_card_simple_sync_card (ce->simple); - - card = ce->card; - e_contact_save_as(_("Save Contact as VCard"), card, GTK_WINDOW (ce->app)); -} - -static void -file_send_as_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - ECard *card; - - ce = E_CONTACT_EDITOR (data); - - extract_info (ce); - e_card_simple_sync_card (ce->simple); - - card = ce->card; - e_card_send(card, E_CARD_DISPOSITION_AS_ATTACHMENT); -} - -static void -file_send_to_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - ECard *card; - - ce = E_CONTACT_EDITOR (data); - - extract_info (ce); - e_card_simple_sync_card (ce->simple); - - card = ce->card; - e_card_send(card, E_CARD_DISPOSITION_AS_TO); -} - -gboolean -e_contact_editor_confirm_delete (GtkWindow *parent) -{ - GtkWidget *dialog; - gint result; - - dialog = gtk_message_dialog_new (parent, - 0, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_NONE, -#if notyet - /* XXX we really need to handle the plural case here.. */ - (plural - ? _("Are you sure you want\n" - "to delete these contacts?")) -#endif - _("Are you sure you want\n" - "to delete this contact?")); - - gtk_dialog_add_buttons (GTK_DIALOG (dialog), - _("Delete"), GTK_RESPONSE_ACCEPT, - GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, - NULL); - - result = gtk_dialog_run(GTK_DIALOG (dialog)); - - gtk_widget_destroy (dialog); - - return (result == GTK_RESPONSE_ACCEPT); -} - -static void -card_deleted_cb (EBook *book, EBookStatus status, EContactEditor *ce) -{ - gtk_widget_set_sensitive (ce->app, TRUE); - ce->in_async_call = FALSE; - - g_signal_emit (ce, contact_editor_signals[CARD_DELETED], 0, - status, ce->card); - - /* always close the dialog after we successfully delete a card */ - if (status == E_BOOK_STATUS_SUCCESS) - close_dialog (ce); -} - -static void -delete_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce = E_CONTACT_EDITOR (data); - ECard *card = ce->card; - ECardSimple *simple = ce->simple; - - g_object_ref(card); - g_object_ref(simple); - - if (e_contact_editor_confirm_delete(GTK_WINDOW(ce->app))) { - - extract_info (ce); - e_card_simple_sync_card (simple); - - if (!ce->is_new_card && ce->book) { - gtk_widget_set_sensitive (ce->app, FALSE); - ce->in_async_call = TRUE; - - e_book_remove_card (ce->book, card, (EBookCallback)card_deleted_cb, ce); - } - } - - g_object_unref(card); - g_object_unref(simple); -} - -/* Emits the signal to request printing a card */ -static void -print_cb (BonoboUIComponent *uih, void *data, const char *path) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - - extract_info (ce); - e_card_simple_sync_card (ce->simple); - - gtk_widget_show(e_contact_print_card_dialog_new(ce->card)); -} - -#if 0 /* Envelope printing is disabled for Evolution 1.0. */ -/* Emits the signal to request printing a card */ -static void -print_envelope_cb (BonoboUIComponent *uih, void *data, const char *path) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - - extract_info (ce); - e_card_simple_sync_card (ce->simple); - - gtk_widget_show(e_contact_print_envelope_dialog_new(ce->card)); -} -#endif - -/* Toolbar/Save and Close callback */ -static void -tb_save_and_close_cb (BonoboUIComponent *uih, void *data, const char *path) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - save_card (ce, TRUE); -} - -static -BonoboUIVerb verbs [] = { - BONOBO_UI_UNSAFE_VERB ("ContactEditorSave", file_save_cb), - BONOBO_UI_UNSAFE_VERB ("ContactEditorSaveAs", file_save_as_cb), - BONOBO_UI_UNSAFE_VERB ("ContactEditorSaveClose", tb_save_and_close_cb), - BONOBO_UI_UNSAFE_VERB ("ContactEditorSendAs", file_send_as_cb), - BONOBO_UI_UNSAFE_VERB ("ContactEditorSendTo", file_send_to_cb), - BONOBO_UI_UNSAFE_VERB ("ContactEditorDelete", delete_cb), - BONOBO_UI_UNSAFE_VERB ("ContactEditorPrint", print_cb), -#if 0 /* Envelope printing is disabled for Evolution 1.0. */ - BONOBO_UI_UNSAFE_VERB ("ContactEditorPrintEnvelope", print_envelope_cb), -#endif - /* BONOBO_UI_UNSAFE_VERB ("ContactEditorPageSetup", file_page_setup_menu), */ - BONOBO_UI_UNSAFE_VERB ("ContactEditorClose", file_close_cb), - - BONOBO_UI_VERB_END -}; - -EPixmap pixmaps[] = { - E_PIXMAP ("/commands/ContactEditorSave", "save-16.png"), - E_PIXMAP ("/commands/ContactEditorSaveClose", "save-16.png"), - E_PIXMAP ("/commands/ContactEditorSaveAs", "save-as-16.png"), - E_PIXMAP ("/commands/ContactEditorDelete", "evolution-trash-mini.png"), - E_PIXMAP ("/commands/ContactEditorPrint", "print.xpm"), -#if 0 /* Envelope printing is disabled for Evolution 1.0. */ - E_PIXMAP ("/commands/ContactEditorPrintEnvelope", "print.xpm"), -#endif - E_PIXMAP ("/Toolbar/ContactEditorSaveClose", "buttons/save-24.png"), - E_PIXMAP ("/Toolbar/ContactEditorDelete", "buttons/delete-message.png"), - E_PIXMAP ("/Toolbar/ContactEditorPrint", "buttons/print.png"), - - E_PIXMAP_END -}; - -static void -create_ui (EContactEditor *ce) -{ - bonobo_ui_component_add_verb_list_with_data (ce->uic, verbs, ce); - - bonobo_ui_util_set_ui (ce->uic, EVOLUTION_DATADIR, - "evolution-contact-editor.xml", - "evolution-contact-editor", NULL); - - e_pixmaps_update (ce->uic, pixmaps); -} - -/* Callback used when the dialog box is destroyed */ -static gint -app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - - /* if we're saving, don't allow the dialog to close */ - if (ce->in_async_call) - return TRUE; - - if (!prompt_to_save_changes (ce)) - return TRUE; - - close_dialog (ce); - return TRUE; -} - -static GList * -add_to_tab_order(GList *list, GladeXML *gui, char *name) -{ - GtkWidget *widget = glade_xml_get_widget(gui, name); - return g_list_prepend(list, widget); -} - -static void -setup_tab_order(GladeXML *gui) -{ - GtkWidget *container; - GList *list = NULL; - - container = glade_xml_get_widget(gui, "table-contact-editor-general"); - - if (container) { - list = add_to_tab_order(list, gui, "entry-fullname"); - list = add_to_tab_order(list, gui, "entry-jobtitle"); - list = add_to_tab_order(list, gui, "entry-company"); - list = add_to_tab_order(list, gui, "combo-file-as"); - list = add_to_tab_order(list, gui, "entry-phone1"); - list = add_to_tab_order(list, gui, "entry-phone2"); - list = add_to_tab_order(list, gui, "entry-phone3"); - list = add_to_tab_order(list, gui, "entry-phone4"); - - list = add_to_tab_order(list, gui, "entry-email1"); - list = add_to_tab_order(list, gui, "alignment-htmlmail"); - list = add_to_tab_order(list, gui, "entry-web"); - list = add_to_tab_order(list, gui, "button-fulladdr"); - list = add_to_tab_order(list, gui, "text-address"); - list = add_to_tab_order(list, gui, "alignment-contacts"); - list = g_list_reverse(list); - e_container_change_tab_order(GTK_CONTAINER(container), list); - g_list_free(list); - } -} - -static void -e_contact_editor_init (EContactEditor *e_contact_editor) -{ - GladeXML *gui; - GtkWidget *widget; - GtkWidget *bonobo_win; - GtkWidget *wants_html; - BonoboUIContainer *container; - char *icon_path; - - e_contact_editor->email_info = NULL; - e_contact_editor->phone_info = NULL; - e_contact_editor->address_info = NULL; - e_contact_editor->email_popup = NULL; - e_contact_editor->phone_popup = NULL; - e_contact_editor->address_popup = NULL; - e_contact_editor->email_list = NULL; - e_contact_editor->phone_list = NULL; - e_contact_editor->address_list = NULL; - e_contact_editor->name = e_card_name_new(); - e_contact_editor->company = g_strdup(""); - - e_contact_editor->email_choice = 0; - e_contact_editor->phone_choice[0] = E_CARD_SIMPLE_PHONE_ID_BUSINESS; - e_contact_editor->phone_choice[1] = E_CARD_SIMPLE_PHONE_ID_HOME; - e_contact_editor->phone_choice[2] = E_CARD_SIMPLE_PHONE_ID_BUSINESS_FAX; - e_contact_editor->phone_choice[3] = E_CARD_SIMPLE_PHONE_ID_MOBILE; - e_contact_editor->address_choice = 0; - e_contact_editor->address_mailing = -1; - - e_contact_editor->arbitrary_fields = NULL; - - e_contact_editor->simple = e_card_simple_new(NULL); - - e_contact_editor->card = NULL; - e_contact_editor->changed = FALSE; - e_contact_editor->in_async_call = FALSE; - e_contact_editor->editable = TRUE; - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/contact-editor.glade", NULL, NULL); - e_contact_editor->gui = gui; - - setup_tab_order(gui); - - e_contact_editor->app = glade_xml_get_widget (gui, "contact editor"); - - e_container_foreach_leaf (GTK_CONTAINER (e_contact_editor->app), - (GtkCallback) add_field_callback, - e_contact_editor); - - _replace_buttons(e_contact_editor); - add_lists (e_contact_editor); - set_entry_changed_signals(e_contact_editor); - - wants_html = glade_xml_get_widget(e_contact_editor->gui, "checkbutton-htmlmail"); - if (wants_html && GTK_IS_TOGGLE_BUTTON(wants_html)) - g_signal_connect (wants_html, "toggled", - G_CALLBACK (wants_html_changed), e_contact_editor); - - widget = glade_xml_get_widget(e_contact_editor->gui, "checkbutton-mailingaddress"); - if (widget && GTK_IS_TOGGLE_BUTTON(widget)) - g_signal_connect (widget, "toggled", - G_CALLBACK (address_mailing_changed), e_contact_editor); - - widget = glade_xml_get_widget(e_contact_editor->gui, "button-fullname"); - if (widget && GTK_IS_BUTTON(widget)) - g_signal_connect (widget, "clicked", - G_CALLBACK (full_name_clicked), e_contact_editor); - - widget = glade_xml_get_widget(e_contact_editor->gui, "button-fulladdr"); - if (widget && GTK_IS_BUTTON(widget)) - g_signal_connect (widget, "clicked", - G_CALLBACK (full_addr_clicked), e_contact_editor); - - widget = glade_xml_get_widget(e_contact_editor->gui, "button-categories"); - if (widget && GTK_IS_BUTTON(widget)) - g_signal_connect (widget, "clicked", - G_CALLBACK (categories_clicked), e_contact_editor); - - widget = glade_xml_get_widget(e_contact_editor->gui, "button-contacts"); - if (widget && GTK_IS_BUTTON(widget)) - g_signal_connect (widget, "clicked", - G_CALLBACK (contacts_clicked), e_contact_editor); - - - /* Construct the app */ - bonobo_win = bonobo_window_new ("contact-editor-dialog", _("Contact Editor")); - - /* FIXME: The sucking bit */ - { - GtkWidget *contents; - - contents = bonobo_dock_get_client_area (gnome_app_get_dock (GNOME_APP(e_contact_editor->app))); - - if (!contents) { - g_message ("contact_editor_construct(): Could not get contents"); - return; - } - g_object_ref (contents); - gtk_container_remove (GTK_CONTAINER (contents->parent), contents); - bonobo_window_set_contents (BONOBO_WINDOW (bonobo_win), contents); - gtk_widget_destroy (e_contact_editor->app); - e_contact_editor->app = bonobo_win; - } - - /* Build the menu and toolbar */ - container = bonobo_window_get_ui_container (BONOBO_WINDOW (e_contact_editor->app)); - - e_contact_editor->uic = bonobo_ui_component_new_default (); - if (!e_contact_editor->uic) { - g_message ("e_contact_editor_init(): eeeeek, could not create the UI handler!"); - return; - } - bonobo_ui_component_set_container (e_contact_editor->uic, - bonobo_object_corba_objref (BONOBO_OBJECT (container)), - NULL); - - create_ui (e_contact_editor); - - widget = glade_xml_get_widget(e_contact_editor->gui, "entry-fullname"); - if (widget) - gtk_widget_grab_focus (widget); - - /* Connect to the deletion of the dialog */ - - g_signal_connect (e_contact_editor->app, "delete_event", - GTK_SIGNAL_FUNC (app_delete_event_cb), e_contact_editor); - - /* set the icon */ - icon_path = g_build_filename (EVOLUTION_ICONSDIR, "evolution-contacts-mini.png", NULL); - gnome_window_icon_set_from_file (GTK_WINDOW (e_contact_editor->app), icon_path); - g_free (icon_path); -} - -void -e_contact_editor_dispose (GObject *object) { - EContactEditor *e_contact_editor = E_CONTACT_EDITOR(object); - - if (e_contact_editor->writable_fields) { - g_object_unref(e_contact_editor->writable_fields); - e_contact_editor->writable_fields = NULL; - } - if (e_contact_editor->email_list) { - g_list_foreach(e_contact_editor->email_list, (GFunc) g_free, NULL); - g_list_free(e_contact_editor->email_list); - e_contact_editor->email_list = NULL; - } - if (e_contact_editor->email_info) { - g_free(e_contact_editor->email_info); - e_contact_editor->email_info = NULL; - } - if (e_contact_editor->email_popup) { - g_object_unref(e_contact_editor->email_popup); - e_contact_editor->email_popup = NULL; - } - - if (e_contact_editor->phone_list) { - g_list_foreach(e_contact_editor->phone_list, (GFunc) g_free, NULL); - g_list_free(e_contact_editor->phone_list); - e_contact_editor->phone_list = NULL; - } - if (e_contact_editor->phone_info) { - g_free(e_contact_editor->phone_info); - e_contact_editor->phone_info = NULL; - } - if (e_contact_editor->phone_popup) { - g_object_unref(e_contact_editor->phone_popup); - e_contact_editor->phone_popup = NULL; - } - - if (e_contact_editor->address_list) { - g_list_foreach(e_contact_editor->address_list, (GFunc) g_free, NULL); - g_list_free(e_contact_editor->address_list); - e_contact_editor->address_list = NULL; - } - if (e_contact_editor->address_info) { - g_free(e_contact_editor->address_info); - e_contact_editor->address_info = NULL; - } - if (e_contact_editor->address_popup) { - g_object_unref(e_contact_editor->address_popup); - e_contact_editor->address_popup = NULL; - } - - if (e_contact_editor->simple) { - g_object_unref(e_contact_editor->simple); - e_contact_editor->simple = NULL; - } - - if (e_contact_editor->book) { - g_object_unref(e_contact_editor->book); - e_contact_editor->book = NULL; - } - - if (e_contact_editor->select_names_contacts) { - g_object_unref(e_contact_editor->select_names_contacts); - e_contact_editor->select_names_contacts = NULL; - } - - if (e_contact_editor->name) { - e_card_name_unref(e_contact_editor->name); - e_contact_editor->name = NULL; - } - - if (e_contact_editor->company) { - g_free (e_contact_editor->company); - e_contact_editor->company = NULL; - } - - if (e_contact_editor->gui) { - g_object_unref(e_contact_editor->gui); - e_contact_editor->gui = NULL; - } -} - -static void -command_state_changed (EContactEditor *ce) -{ - bonobo_ui_component_set_prop (ce->uic, - "/commands/ContactEditorSaveClose", - "sensitive", - ce->changed ? "1" : "0", NULL); - bonobo_ui_component_set_prop (ce->uic, - "/commands/ContactEditorSave", - "sensitive", - ce->changed ? "1" : "0", NULL); - bonobo_ui_component_set_prop (ce->uic, - "/commands/ContactEditorDelete", - "sensitive", - (ce->editable && !ce->is_new_card) ? "1" : "0", NULL); -} - -static void -supported_fields_cb (EBook *book, EBookStatus status, - EList *fields, EContactEditor *ce) -{ - if (!g_slist_find (all_contact_editors, ce)) { - g_warning ("supported_fields_cb called for book that's still around, but contact editor that's been destroyed."); - return; - } - - g_object_set (ce, - "writable_fields", fields, - NULL); - - e_contact_editor_show (ce); - - command_state_changed (ce); -} - -static void -contact_editor_destroy_notify (void *data, - GObject *where_the_object_was) -{ - EContactEditor *ce = E_CONTACT_EDITOR (data); - - all_contact_editors = g_slist_remove (all_contact_editors, ce); -} - -EContactEditor * -e_contact_editor_new (EBook *book, - ECard *card, - gboolean is_new_card, - gboolean editable) -{ - EContactEditor *ce; - - g_return_val_if_fail (E_IS_BOOK (book), NULL); - g_return_val_if_fail (E_IS_CARD (card), NULL); - - ce = g_object_new (E_TYPE_CONTACT_EDITOR, NULL); - - all_contact_editors = g_slist_prepend (all_contact_editors, ce); - g_object_weak_ref (G_OBJECT (ce), contact_editor_destroy_notify, ce); - - gtk_object_ref (GTK_OBJECT (ce)); - gtk_object_sink (GTK_OBJECT (ce)); - - g_object_set (ce, - "book", book, - "card", card, - "is_new_card", is_new_card, - "editable", editable, - NULL); - - if (book) - e_book_get_supported_fields (book, (EBookFieldsCallback)supported_fields_cb, ce); - - return ce; -} - -static void -e_contact_editor_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - EContactEditor *editor; - - editor = E_CONTACT_EDITOR (object); - - switch (prop_id){ - case PROP_BOOK: - if (editor->book) - g_object_unref(editor->book); - editor->book = E_BOOK(g_value_get_object (value)); - g_object_ref (editor->book); - /* XXX more here about editable/etc. */ - break; - case PROP_CARD: - if (editor->card) - g_object_unref(editor->card); - editor->card = e_card_duplicate(E_CARD(g_value_get_object (value))); - g_object_set(editor->simple, - "card", editor->card, - NULL); - fill_in_info(editor); - editor->changed = FALSE; - break; - - case PROP_IS_NEW_CARD: - editor->is_new_card = g_value_get_boolean (value) ? TRUE : FALSE; - break; - - case PROP_EDITABLE: { - gboolean new_value = g_value_get_boolean (value) ? TRUE : FALSE; - gboolean changed = (editor->editable != new_value); - - editor->editable = new_value; - - if (changed) { - set_editable (editor); - command_state_changed (editor); - } - break; - } - - case PROP_CHANGED: { - gboolean new_value = g_value_get_boolean (value) ? TRUE : FALSE; - gboolean changed = (editor->changed != new_value); - - editor->changed = new_value; - - if (changed) - command_state_changed (editor); - break; - } - case PROP_WRITABLE_FIELDS: - if (editor->writable_fields) - g_object_unref(editor->writable_fields); - editor->writable_fields = g_value_get_object (value); - if (editor->writable_fields) - g_object_ref (editor->writable_fields); - else - editor->writable_fields = e_list_new(NULL, NULL, NULL); - enable_writable_fields (editor); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_contact_editor_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - EContactEditor *e_contact_editor; - - e_contact_editor = E_CONTACT_EDITOR (object); - - switch (prop_id) { - case PROP_BOOK: - g_value_set_object (value, e_contact_editor->book); - break; - - case PROP_CARD: - e_card_simple_sync_card(e_contact_editor->simple); - extract_info(e_contact_editor); - g_value_set_object (value, e_contact_editor->card); - break; - - case PROP_IS_NEW_CARD: - g_value_set_boolean (value, e_contact_editor->is_new_card ? TRUE : FALSE); - break; - - case PROP_EDITABLE: - g_value_set_boolean (value, e_contact_editor->editable ? TRUE : FALSE); - break; - - case PROP_CHANGED: - g_value_set_boolean (value, e_contact_editor->changed ? TRUE : FALSE); - break; - - case PROP_WRITABLE_FIELDS: - if (e_contact_editor->writable_fields) - g_value_set_object (value, e_list_duplicate (e_contact_editor->writable_fields)); - else - g_value_set_object (value, NULL); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -_popup_position(GtkMenu *menu, - gint *x, - gint *y, - gboolean *push_in, - gpointer data) -{ - GtkWidget *button = GTK_WIDGET(data); - GtkRequisition request; - int mh, mw; - gdk_window_get_origin (button->window, x, y); - *x += button->allocation.x; - *y += button->allocation.y; - - gtk_widget_size_request(GTK_WIDGET(menu), &request); - - mh = request.height; - mw = request.width; - - *x -= mw; - if (*x < 0) - *x = 0; - - if (*y < 0) - *y = 0; - - if ((*x + mw) > gdk_screen_width ()) - *x = gdk_screen_width () - mw; - - if ((*y + mh) > gdk_screen_height ()) - *y = gdk_screen_height () - mh; - - *push_in = FALSE; -} - -static gint -_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor, GtkWidget *popup, GList **list, GnomeUIInfo **info, gchar *label, gchar *entry, gchar *dialog_title) -{ - gint menu_item; - - g_signal_stop_emission_by_name (widget, "button_press_event"); - - gtk_widget_realize(popup); - menu_item = gnome_popup_menu_do_popup_modal(popup, _popup_position, widget, button, editor, widget); - if ( menu_item != -1 ) { -#if 0 - if (menu_item == g_list_length (*list)) { - e_contact_editor_build_dialog(editor, entry, label, dialog_title, list, info); - } else { -#endif - GtkWidget *label_widget = glade_xml_get_widget(editor->gui, label); - if (label_widget && GTK_IS_LABEL(label_widget)) { - g_object_set (label_widget, - "label", _(g_list_nth_data(*list, menu_item)), - NULL); - } -#if 0 - } -#endif - } - return menu_item; -} - -static void -e_contact_editor_build_ui_info(GList *list, GnomeUIInfo **infop) -{ - GnomeUIInfo *info; - GnomeUIInfo singleton = { GNOME_APP_UI_TOGGLEITEM, NULL, NULL, NULL, NULL, NULL, GNOME_APP_PIXMAP_NONE, 0, 0, 0, NULL }; - GnomeUIInfo end = GNOMEUIINFO_END; - int length; - int i; - - info = *infop; - - if ( info ) - g_free(info); - length = g_list_length( list ); - info = g_new(GnomeUIInfo, length + 2); - for (i = 0; i < length; i++) { - info[i] = singleton; - info[i].label = _(list->data); - list = list->next; - } - info[i] = end; - - *infop = info; -} - -static void -e_contact_editor_build_phone_ui (EContactEditor *editor) -{ - int i; - - if (editor->phone_list == NULL) { - static char *info[] = { - N_("Assistant"), - N_("Business"), - N_("Business 2"), - N_("Business Fax"), - N_("Callback"), - N_("Car"), - N_("Company"), - N_("Home"), - N_("Home 2"), - N_("Home Fax"), - N_("ISDN"), - N_("Mobile"), - N_("Other"), - N_("Other Fax"), - N_("Pager"), - N_("Primary"), - N_("Radio"), - N_("Telex"), - N_("TTY/TDD") - }; - - for (i = 0; i < sizeof(info) / sizeof(info[0]); i++) { - editor->phone_list = g_list_append(editor->phone_list, g_strdup(info[i])); - } - } - if (editor->phone_info == NULL) { - e_contact_editor_build_ui_info(editor->phone_list, &editor->phone_info); - - if ( editor->phone_popup ) - g_object_unref(editor->phone_popup); - - editor->phone_popup = gnome_popup_menu_new(editor->phone_info); - g_object_ref (editor->phone_popup); - gtk_object_sink (GTK_OBJECT (editor->phone_popup)); - } -} - -static void -e_contact_editor_build_email_ui (EContactEditor *editor) -{ - int i; - - if (editor->email_list == NULL) { - static char *info[] = { - N_("Primary Email"), - N_("Email 2"), - N_("Email 3") - }; - - for (i = 0; i < sizeof(info) / sizeof(info[0]); i++) { - editor->email_list = g_list_append(editor->email_list, g_strdup(info[i])); - } - } - if (editor->email_info == NULL) { - e_contact_editor_build_ui_info(editor->email_list, &editor->email_info); - - if ( editor->email_popup ) - g_object_unref(editor->email_popup); - - editor->email_popup = gnome_popup_menu_new(editor->email_info); - g_object_ref (editor->email_popup); - gtk_object_sink (GTK_OBJECT (editor->email_popup)); - } -} - -static void -e_contact_editor_build_address_ui (EContactEditor *editor) -{ - int i; - - if (editor->address_list == NULL) { - static char *info[] = { - N_("Business"), - N_("Home"), - N_("Other") - }; - - for (i = 0; i < sizeof(info) / sizeof(info[0]); i++) { - editor->address_list = g_list_append(editor->address_list, g_strdup(info[i])); - } - } - if (editor->address_info == NULL) { - e_contact_editor_build_ui_info(editor->address_list, &editor->address_info); - - if ( editor->address_popup ) - g_object_unref(editor->address_popup); - - editor->address_popup = gnome_popup_menu_new(editor->address_info); - g_object_ref (editor->address_popup); - gtk_object_sink (GTK_OBJECT (editor->address_popup)); - } -} - -static void -_phone_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor) -{ - int which; - int i; - gchar *label; - gchar *entry; - int result; - if ( widget == glade_xml_get_widget(editor->gui, "button-phone1") ) { - which = 1; - } else if ( widget == glade_xml_get_widget(editor->gui, "button-phone2") ) { - which = 2; - } else if ( widget == glade_xml_get_widget(editor->gui, "button-phone3") ) { - which = 3; - } else if ( widget == glade_xml_get_widget(editor->gui, "button-phone4") ) { - which = 4; - } else - return; - - label = g_strdup_printf("label-phone%d", which); - entry = g_strdup_printf("entry-phone%d", which); - - e_contact_editor_build_phone_ui (editor); - - for(i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i++) { - const ECardPhone *phone = e_card_simple_get_phone(editor->simple, i); - gboolean checked; - checked = phone && phone->number && *phone->number; - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(editor->phone_info[i].widget), - checked); - gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(editor->phone_info[i].widget), - TRUE); - } - - result = _arrow_pressed (widget, button, editor, editor->phone_popup, &editor->phone_list, &editor->phone_info, label, entry, "Add new phone number type"); - - if (result != -1) { - editor->phone_choice[which - 1] = result; - set_fields(editor); - enable_widget (glade_xml_get_widget (editor->gui, label), TRUE); - enable_widget (glade_xml_get_widget (editor->gui, entry), editor->editable); - } - - g_free(label); - g_free(entry); -} - -static void -_email_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor) -{ - int i; - int result; - - e_contact_editor_build_email_ui (editor); - - for(i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i++) { - const char *string = e_card_simple_get_email(editor->simple, i); - gboolean checked; - checked = string && *string; - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(editor->email_info[i].widget), - checked); - gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(editor->email_info[i].widget), - TRUE); - } - - result = _arrow_pressed (widget, button, editor, editor->email_popup, &editor->email_list, &editor->email_info, "label-email1", "entry-email1", "Add new Email type"); - - if (result != -1) { - editor->email_choice = result; - set_fields(editor); - - /* make sure the buttons/entry is/are sensitive */ - enable_widget (glade_xml_get_widget (editor->gui, "label-email1"), TRUE); - enable_widget (glade_xml_get_widget (editor->gui, "entry-email1"), editor->editable); - enable_widget (glade_xml_get_widget (editor->gui, "checkbutton-htmlmail"), editor->editable); - } -} - -static void -_address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor) -{ - int i; - int result; - - e_contact_editor_build_address_ui (editor); - - for(i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) { - const ECardAddrLabel *address = e_card_simple_get_address(editor->simple, i); - gboolean checked; - checked = address && address->data && *address->data; - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(editor->address_info[i].widget), - checked); - gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(editor->address_info[i].widget), - TRUE); - } - - result = _arrow_pressed (widget, button, editor, editor->address_popup, &editor->address_list, &editor->address_info, "label-address", "text-address", "Add new Address type"); - - if (result != -1) { - set_address_field(editor, result); - - /* make sure the buttons/entry is/are sensitive */ - enable_widget (glade_xml_get_widget (editor->gui, "label-address"), TRUE); - enable_widget (glade_xml_get_widget (editor->gui, "text-address"), editor->address_editable[result]); - enable_widget (glade_xml_get_widget (editor->gui, "checkbutton-mailingaddress"), editor->address_editable[result]); - } -} - -static void -find_address_mailing (EContactEditor *editor) -{ - const ECardAddrLabel *address; - int i; - - editor->address_mailing = -1; - for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) { - address = e_card_simple_get_address(editor->simple, i); - if (address && (address->flags & E_CARD_ADDR_DEFAULT)) { - if (editor->address_mailing == -1) { - editor->address_mailing = i; - } else { - ECardAddrLabel *new; - - new = e_card_address_label_copy (address); - new->flags &= ~E_CARD_ADDR_DEFAULT; - e_card_simple_set_address(editor->simple, i, new); - e_card_address_label_unref (new); - } - } - } -} - -static void -set_field(GtkEntry *entry, const char *string) -{ - const char *oldstring = gtk_entry_get_text(entry); - if (!string) - string = ""; - if (strcmp(string, oldstring)) - gtk_entry_set_text(entry, string); -} - -static void -set_phone_field(GtkWidget *entry, const ECardPhone *phone) -{ - set_field(GTK_ENTRY(entry), phone ? phone->number : ""); -} - -static void -set_fields(EContactEditor *editor) -{ - GtkWidget *entry; - GtkWidget *label_widget; - int i; - - entry = glade_xml_get_widget(editor->gui, "entry-phone1"); - if (entry && GTK_IS_ENTRY(entry)) - set_phone_field(entry, e_card_simple_get_phone(editor->simple, editor->phone_choice[0])); - - entry = glade_xml_get_widget(editor->gui, "entry-phone2"); - if (entry && GTK_IS_ENTRY(entry)) - set_phone_field(entry, e_card_simple_get_phone(editor->simple, editor->phone_choice[1])); - - entry = glade_xml_get_widget(editor->gui, "entry-phone3"); - if (entry && GTK_IS_ENTRY(entry)) - set_phone_field(entry, e_card_simple_get_phone(editor->simple, editor->phone_choice[2])); - - entry = glade_xml_get_widget(editor->gui, "entry-phone4"); - if (entry && GTK_IS_ENTRY(entry)) - set_phone_field(entry, e_card_simple_get_phone(editor->simple, editor->phone_choice[3])); - - entry = glade_xml_get_widget(editor->gui, "entry-email1"); - if (entry && GTK_IS_ENTRY(entry)) - set_field(GTK_ENTRY(entry), e_card_simple_get_email(editor->simple, editor->email_choice)); - - - - e_contact_editor_build_address_ui (editor); - - for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) { - const ECardAddrLabel *address = e_card_simple_get_address(editor->simple, i); - - if (address && address->data && *address->data) - break; - } - if (i == E_CARD_SIMPLE_ADDRESS_ID_LAST) - i = 0; - - label_widget = glade_xml_get_widget(editor->gui, "label-address"); - if (label_widget && GTK_IS_LABEL(label_widget)) { - g_object_set (label_widget, - "label", _(g_list_nth_data(editor->address_list, i)), - NULL); - } - - set_address_field(editor, i); -} - -static void -set_address_field(EContactEditor *editor, int result) -{ - GtkWidget *text, *check; - - text = glade_xml_get_widget(editor->gui, "text-address"); - - if (text && GTK_IS_TEXT_VIEW(text)) { - GtkTextView *text_view = GTK_TEXT_VIEW (text); - GtkTextBuffer *buffer; - GtkTextIter start_iter, end_iter; - const ECardAddrLabel *address; - - if (result == -1) - result = editor->address_choice; - editor->address_choice = -1; - - buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text)); - - gtk_text_buffer_get_start_iter (buffer, &start_iter); - gtk_text_buffer_get_end_iter (buffer, &end_iter); - - gtk_text_buffer_delete (buffer, &start_iter, &end_iter); - - address = e_card_simple_get_address(editor->simple, result); - if (address && address->data) - gtk_text_buffer_insert (buffer, &start_iter, address->data, strlen (address->data)); - - check = glade_xml_get_widget(editor->gui, "checkbutton-mailingaddress"); - if (check && GTK_IS_CHECK_BUTTON (check)) { - if (address && address->data) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), - address->flags & E_CARD_ADDR_DEFAULT); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), FALSE); - } - - editor->address_choice = result; - } -} - -static void -add_field_callback(GtkWidget *widget, EContactEditor *editor) -{ - const char *name; - int i; - static const char *builtins[] = { - "entry-fullname", - "entry-web", - "entry-company", - "entry-department", - "entry-office", - "entry-jobtitle", - "entry-profession", - "entry-manager", - "entry-assistant", - "entry-nickname", - "entry-spouse", - "text-comments", - "entry-categories", - "entry-contacts", - "entry-file-as", - "dateedit-anniversary", - "dateedit-birthday", - "entry-phone1", - "entry-phone2", - "entry-phone3", - "entry-phone4", - "entry-email1", - "text-address", - "checkbutton-mailingaddress", - "checkbutton-htmlmail", - "entry-caluri", - "entry-fburl", - NULL - }; - name = glade_get_widget_name(widget); - if (name) { - for (i = 0; builtins[i]; i++) { - if (!strcmp(name, builtins[i])) - return; - } - if (GTK_IS_ENTRY(widget) || GTK_IS_TEXT_VIEW(widget)) { - editor->arbitrary_fields = g_list_prepend(editor->arbitrary_fields, g_strdup(name)); - } - } -} - -static struct { - char *id; - char *key; -} field_mapping [] = { - { "entry-fullname", "full_name" }, - { "entry-web", "url" }, - { "entry-company", "org" }, - { "entry-department", "org_unit" }, - { "entry-office", "office" }, - { "entry-jobtitle", "title" }, - { "entry-profession", "role" }, - { "entry-manager", "manager" }, - { "entry-assistant", "assistant" }, - { "entry-nickname", "nickname" }, - { "entry-spouse", "spouse" }, - { "text-comments", "note" }, - { "entry-categories", "categories" }, - { "entry-caluri", "caluri" }, - { "entry-fburl", "fburl" }, -}; - -static void -fill_in_field(EContactEditor *editor, char *id, char *value) -{ - GtkWidget *widget = glade_xml_get_widget(editor->gui, id); - if (widget && GTK_IS_EDITABLE(widget)) { - int position = 0; - GtkEditable *editable = GTK_EDITABLE(widget); - gtk_editable_delete_text(editable, 0, -1); - if (value) - gtk_editable_insert_text(editable, value, strlen(value), &position); - } -} - -static void -fill_in_card_field(EContactEditor *editor, ECard *card, char *id, char *key) -{ - char *string; - g_object_get (card, - key, &string, - NULL); - fill_in_field(editor, id, string); -} - -static void -fill_in_single_field(EContactEditor *editor, char *name) -{ - ECardSimple *simple = editor->simple; - GtkWidget *widget = glade_xml_get_widget(editor->gui, name); - if (widget && GTK_IS_EDITABLE(widget)) { - int position = 0; - GtkEditable *editable = GTK_EDITABLE(widget); - const ECardArbitrary *arbitrary; - - gtk_editable_delete_text(editable, 0, -1); - arbitrary = e_card_simple_get_arbitrary(simple, - name); - if (arbitrary && arbitrary->value) - gtk_editable_insert_text(editable, arbitrary->value, strlen(arbitrary->value), &position); - } -} - -static void -disable_widget_foreach (char *key, GtkWidget *widget, gpointer closure) -{ - enable_widget (widget, FALSE); -} - -static struct { - char *widget_name; - ECardSimpleField field_id; - gboolean desensitize_for_read_only; -} widget_field_mappings[] = { - { "entry-web", E_CARD_SIMPLE_FIELD_URL, TRUE }, - { "accellabel-web", E_CARD_SIMPLE_FIELD_URL }, - - { "entry-jobtitle", E_CARD_SIMPLE_FIELD_TITLE, TRUE }, - { "label-jobtitle", E_CARD_SIMPLE_FIELD_TITLE }, - - { "entry-company", E_CARD_SIMPLE_FIELD_ORG, TRUE }, - { "label-company", E_CARD_SIMPLE_FIELD_ORG }, - - { "combo-file-as", E_CARD_SIMPLE_FIELD_FILE_AS, TRUE }, - { "entry-file-as", E_CARD_SIMPLE_FIELD_FILE_AS, TRUE }, - { "accellabel-fileas", E_CARD_SIMPLE_FIELD_FILE_AS }, - - { "label-department", E_CARD_SIMPLE_FIELD_ORG_UNIT }, - { "entry-department", E_CARD_SIMPLE_FIELD_ORG_UNIT, TRUE }, - - { "label-office", E_CARD_SIMPLE_FIELD_OFFICE }, - { "entry-office", E_CARD_SIMPLE_FIELD_OFFICE, TRUE }, - - { "label-profession", E_CARD_SIMPLE_FIELD_ROLE }, - { "entry-profession", E_CARD_SIMPLE_FIELD_ROLE, TRUE }, - - { "label-manager", E_CARD_SIMPLE_FIELD_MANAGER }, - { "entry-manager", E_CARD_SIMPLE_FIELD_MANAGER, TRUE }, - - { "label-assistant", E_CARD_SIMPLE_FIELD_ASSISTANT }, - { "entry-assistant", E_CARD_SIMPLE_FIELD_ASSISTANT, TRUE }, - - { "label-nickname", E_CARD_SIMPLE_FIELD_NICKNAME }, - { "entry-nickname", E_CARD_SIMPLE_FIELD_NICKNAME, TRUE }, - - { "label-spouse", E_CARD_SIMPLE_FIELD_SPOUSE }, - { "entry-spouse", E_CARD_SIMPLE_FIELD_SPOUSE, TRUE }, - - { "label-birthday", E_CARD_SIMPLE_FIELD_BIRTH_DATE }, - { "dateedit-birthday", E_CARD_SIMPLE_FIELD_BIRTH_DATE, TRUE }, - - { "label-anniversary", E_CARD_SIMPLE_FIELD_ANNIVERSARY }, - { "dateedit-anniversary", E_CARD_SIMPLE_FIELD_ANNIVERSARY, TRUE }, - - { "label-comments", E_CARD_SIMPLE_FIELD_NOTE }, - { "text-comments", E_CARD_SIMPLE_FIELD_NOTE, TRUE }, - - { "entry-fullname", E_CARD_SIMPLE_FIELD_FULL_NAME, TRUE }, - - { "button-categories", E_CARD_SIMPLE_FIELD_CATEGORIES, TRUE }, - { "entry-categories", E_CARD_SIMPLE_FIELD_CATEGORIES, TRUE }, - - { "label-caluri", E_CARD_SIMPLE_FIELD_CALURI }, - { "entry-caluri", E_CARD_SIMPLE_FIELD_CALURI, TRUE }, - - { "label-fburl", E_CARD_SIMPLE_FIELD_FBURL }, - { "entry-fburl", E_CARD_SIMPLE_FIELD_FBURL, TRUE } -}; -static int num_widget_field_mappings = sizeof(widget_field_mappings) / sizeof (widget_field_mappings[0]); - -static void -enable_writable_fields(EContactEditor *editor) -{ - EList *fields = editor->writable_fields; - EIterator *iter; - GHashTable *dropdown_hash, *supported_hash; - int i; - ECardSimple *simple; - ECard *card; - char *widget_name; - - if (!fields) - return; - - card = e_card_new (""); - simple = e_card_simple_new (card); - - dropdown_hash = g_hash_table_new (g_str_hash, g_str_equal); - supported_hash = g_hash_table_new (g_str_hash, g_str_equal); - - /* build our hashtable of the drop down menu items */ - e_contact_editor_build_phone_ui (editor); - for (i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i ++) - g_hash_table_insert (dropdown_hash, - (char*)e_card_simple_get_ecard_field(simple, e_card_simple_map_phone_to_field (i)), - editor->phone_info[i].widget); - e_contact_editor_build_email_ui (editor); - for (i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i ++) - g_hash_table_insert (dropdown_hash, - (char*)e_card_simple_get_ecard_field(simple, e_card_simple_map_email_to_field (i)), - editor->email_info[i].widget); - e_contact_editor_build_address_ui (editor); - for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i ++) - g_hash_table_insert (dropdown_hash, - (char*)e_card_simple_get_ecard_field(simple, e_card_simple_map_address_to_field (i)), - editor->address_info[i].widget); - - /* then disable them all */ - g_hash_table_foreach (dropdown_hash, (GHFunc)disable_widget_foreach, NULL); - - /* disable the label widgets for the dropdowns (4 phone, 1 - email and the toggle button, and 1 address and one for - the full address button */ - for (i = 0; i < 4; i ++) { - widget_name = g_strdup_printf ("label-phone%d", i+1); - enable_widget (glade_xml_get_widget (editor->gui, widget_name), FALSE); - g_free (widget_name); - widget_name = g_strdup_printf ("entry-phone%d", i+1); - enable_widget (glade_xml_get_widget (editor->gui, widget_name), FALSE); - g_free (widget_name); - } - enable_widget (glade_xml_get_widget (editor->gui, "label-email1"), FALSE); - enable_widget (glade_xml_get_widget (editor->gui, "entry-email1"), FALSE); - enable_widget (glade_xml_get_widget (editor->gui, "checkbutton-htmlmail"), FALSE); - enable_widget (glade_xml_get_widget (editor->gui, "checkbutton-mailingaddress"), FALSE); - enable_widget (glade_xml_get_widget (editor->gui, "label-address"), FALSE); - enable_widget (glade_xml_get_widget (editor->gui, "text-address"), FALSE); - - editor->fullname_editable = FALSE; - - /* enable widgets that map directly from a field to a widget (the drop down items) */ - iter = e_list_get_iterator (fields); - for (; e_iterator_is_valid (iter); e_iterator_next (iter)) { - char *field = (char*)e_iterator_get (iter); - GtkWidget *widget = g_hash_table_lookup (dropdown_hash, field); - int i; - - if (widget) { - enable_widget (widget, TRUE); - } - else { - /* if it's not a field that's handled by the - dropdown items, add it to the has to be - used in the second step */ - g_hash_table_insert (supported_hash, field, field); - } - - for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i ++) { - if (!strcmp (field, e_card_simple_get_ecard_field (simple, e_card_simple_map_address_to_field(i)))) { - editor->address_editable [i] = TRUE; - } - } - - /* ugh - this is needed to make sure we don't have a - disabled label next to a drop down when the item in - the menu (the one reflected in the label) is - enabled. */ - if (!strcmp (field, e_card_simple_get_ecard_field (simple, e_card_simple_map_email_to_field(editor->email_choice)))) { - enable_widget (glade_xml_get_widget (editor->gui, "label-email1"), TRUE); - enable_widget (glade_xml_get_widget (editor->gui, "entry-email1"), editor->editable); - enable_widget (glade_xml_get_widget (editor->gui, "checkbutton-htmlmail"), editor->editable); - } - else if (!strcmp (field, e_card_simple_get_ecard_field (simple, e_card_simple_map_address_to_field(editor->address_choice)))) { - enable_widget (glade_xml_get_widget (editor->gui, "label-address"), TRUE); - enable_widget (glade_xml_get_widget (editor->gui, "checkbutton-mailingaddress"), editor->editable); - enable_widget (glade_xml_get_widget (editor->gui, "text-address"), editor->editable); - } - else for (i = 0; i < 4; i ++) { - if (!strcmp (field, e_card_simple_get_ecard_field (simple, e_card_simple_map_phone_to_field(editor->phone_choice[i])))) { - widget_name = g_strdup_printf ("label-phone%d", i+1); - enable_widget (glade_xml_get_widget (editor->gui, widget_name), TRUE); - g_free (widget_name); - widget_name = g_strdup_printf ("entry-phone%d", i+1); - enable_widget (glade_xml_get_widget (editor->gui, widget_name), editor->editable); - g_free (widget_name); - } - } - } - - /* handle the label next to the dropdown widgets */ - - for (i = 0; i < num_widget_field_mappings; i ++) { - gboolean enabled; - GtkWidget *w; - const char *field; - - w = glade_xml_get_widget(editor->gui, widget_field_mappings[i].widget_name); - if (!w) { - g_warning (_("Could not find widget for a field: `%s'"), - widget_field_mappings[i].widget_name); - continue; - } - field = e_card_simple_get_ecard_field (simple, - widget_field_mappings[i].field_id); - - enabled = (g_hash_table_lookup (supported_hash, field) != NULL); - - if (widget_field_mappings[i].desensitize_for_read_only && !editor->editable) { - enabled = FALSE; - } - - enable_widget (w, enabled); - } - - editor->fullname_editable = (g_hash_table_lookup (supported_hash, "full_name") != NULL); - - g_hash_table_destroy (dropdown_hash); - g_hash_table_destroy (supported_hash); - g_object_unref (simple); - g_object_unref (card); -} - -static void -set_editable (EContactEditor *editor) -{ - int i; - char *entry; - /* set the sensitivity of all the non-dropdown entry/texts/dateedits */ - for (i = 0; i < num_widget_field_mappings; i ++) { - if (widget_field_mappings[i].desensitize_for_read_only) { - GtkWidget *widget = glade_xml_get_widget(editor->gui, widget_field_mappings[i].widget_name); - enable_widget (widget, editor->editable); - } - } - - /* handle the phone dropdown entries */ - for (i = 0; i < 4; i ++) { - entry = g_strdup_printf ("entry-phone%d", i+1); - - enable_widget (glade_xml_get_widget(editor->gui, entry), - editor->editable); - - g_free (entry); - } - - /* handle the email dropdown entry */ - entry = "entry-email1"; - enable_widget (glade_xml_get_widget(editor->gui, entry), - editor->editable); - enable_widget (glade_xml_get_widget(editor->gui, "checkbutton-htmlmail"), - editor->editable); - - /* handle the address dropdown entry */ - entry = "text-address"; - enable_widget (glade_xml_get_widget(editor->gui, entry), - editor->editable); -} - -static void -fill_in_info(EContactEditor *editor) -{ - ECard *card = editor->card; - if (card) { - char *file_as; - char *related_contacts; - ECardName *name; - const ECardDate *anniversary; - const ECardDate *bday; - int i; - GtkWidget *widget; - GList *list; - gboolean wants_html, wants_html_set; - - g_object_get (card, - "file_as", &file_as, - "related_contacts", &related_contacts, - "name", &name, - "anniversary", &anniversary, - "birth_date", &bday, - "wants_html_set", &wants_html_set, - "wants_html", &wants_html, - NULL); - - for (i = 0; i < sizeof(field_mapping) / sizeof(field_mapping[0]); i++) { - fill_in_card_field(editor, card, field_mapping[i].id, field_mapping[i].key); - } - - for (list = editor->arbitrary_fields; list; list = list->next) { - fill_in_single_field(editor, list->data); - } - - find_address_mailing (editor); - - if (wants_html_set) { - GtkWidget *widget = glade_xml_get_widget(editor->gui, "checkbutton-htmlmail"); - if (widget && GTK_IS_CHECK_BUTTON(widget)) { - g_object_set (widget, - "active", wants_html, - NULL); - } - } - - /* File as has to come after company and name or else it'll get messed up when setting them. */ - fill_in_field(editor, "entry-file-as", file_as); - - e_card_name_unref(editor->name); - editor->name = e_card_name_ref(name); - - widget = glade_xml_get_widget(editor->gui, "dateedit-anniversary"); - if (widget && E_IS_DATE_EDIT(widget)) { - EDateEdit *dateedit; - dateedit = E_DATE_EDIT(widget); - if (anniversary) - e_date_edit_set_date (dateedit, - anniversary->year, - anniversary->month, - anniversary->day); - else - e_date_edit_set_time (dateedit, -1); - } - - widget = glade_xml_get_widget(editor->gui, "dateedit-birthday"); - if (widget && E_IS_DATE_EDIT(widget)) { - EDateEdit *dateedit; - dateedit = E_DATE_EDIT(widget); - if (bday) - e_date_edit_set_date (dateedit, - bday->year, - bday->month, - bday->day); - else - e_date_edit_set_time (dateedit, -1); - } - - if (editor->select_names_contacts && related_contacts && *related_contacts) { - ESelectNamesModel *model = e_select_names_manager_get_source (editor->select_names_contacts, - "contacts"); - e_select_names_model_import_destinationv (model, related_contacts); - } - - set_fields(editor); - } -} - -static void -extract_field(EContactEditor *editor, ECard *card, char *editable_id, char *key) -{ - GtkWidget *widget = glade_xml_get_widget(editor->gui, editable_id); - - if (widget && GTK_IS_EDITABLE (widget)) { - GtkEditable *editable = GTK_EDITABLE(widget); - char *string = gtk_editable_get_chars(editable, 0, -1); - - if (string && *string) - g_object_set (card, - key, string, - NULL); - else - g_object_set (card, - key, NULL, - NULL); - - if (string) g_free(string); - } -} - -static void -extract_single_field(EContactEditor *editor, char *name) -{ - GtkWidget *widget = glade_xml_get_widget(editor->gui, name); - ECardSimple *simple = editor->simple; - if (widget && GTK_IS_EDITABLE(widget)) { - GtkEditable *editable = GTK_EDITABLE(widget); - char *string = gtk_editable_get_chars(editable, 0, -1); - - if (string && *string) - e_card_simple_set_arbitrary(simple, - name, - NULL, - string); - else - e_card_simple_set_arbitrary(simple, - name, - NULL, - NULL); - if (string) g_free(string); - } -} - -static void -extract_info(EContactEditor *editor) -{ - ECard *card = editor->card; - if (card) { - ECardDate anniversary; - ECardDate bday; - int i; - GtkWidget *widget; - GList *list; - - widget = glade_xml_get_widget(editor->gui, "entry-file-as"); - if (widget && GTK_IS_EDITABLE(widget)) { - GtkEditable *editable = GTK_EDITABLE(widget); - char *string = gtk_editable_get_chars(editable, 0, -1); - - if (string && *string) - g_object_set (card, - "file_as", string, - NULL); - - if (string) g_free(string); - } - - for (i = 0; i < sizeof(field_mapping) / sizeof(field_mapping[0]); i++) { - extract_field(editor, card, field_mapping[i].id, field_mapping[i].key); - } - - for (list = editor->arbitrary_fields; list; list = list->next) { - extract_single_field(editor, list->data); - } - - if (editor->select_names_contacts) { - ESelectNamesModel *model = e_select_names_manager_get_source (editor->select_names_contacts, - "contacts"); - char *string = e_select_names_model_export_destinationv (model); - if (string && *string) - g_object_set (card, - "related_contacts", string, - NULL); - else - g_object_set (card, - "related_contacts", NULL, - NULL); - g_free (string); - } - - if (editor->name) - g_object_set (card, - "name", editor->name, - NULL); - - widget = glade_xml_get_widget(editor->gui, "dateedit-anniversary"); - if (widget && E_IS_DATE_EDIT(widget)) { - if (e_date_edit_get_date (E_DATE_EDIT (widget), - &anniversary.year, - &anniversary.month, - &anniversary.day)) { - /* g_print ("%d %d %d\n", anniversary.year, anniversary.month, anniversary.day); */ - g_object_set (card, - "anniversary", &anniversary, - NULL); - } else - g_object_set (card, - "anniversary", NULL, - NULL); - } - - widget = glade_xml_get_widget(editor->gui, "dateedit-birthday"); - if (widget && E_IS_DATE_EDIT(widget)) { - if (e_date_edit_get_date (E_DATE_EDIT (widget), - &bday.year, - &bday.month, - &bday.day)) { - /* g_print ("%d %d %d\n", bday.year, bday.month, bday.day); */ - g_object_set (card, - "birth_date", &bday, - NULL); - } else - g_object_set (card, - "birth_date", NULL, - NULL); - } - } -} - -/** - * e_contact_editor_raise: - * @config: The %EContactEditor object. - * - * Raises the dialog associated with this %EContactEditor object. - */ -void -e_contact_editor_raise (EContactEditor *editor) -{ - /* FIXME: perhaps we should raise at realize time */ - if (GTK_WIDGET (editor->app)->window) - gdk_window_raise (GTK_WIDGET (editor->app)->window); -} - -/** - * e_contact_editor_show: - * @ce: The %EContactEditor object. - * - * Shows the dialog associated with this %EContactEditor object. - */ -void -e_contact_editor_show (EContactEditor *ce) -{ - gtk_widget_show (ce->app); -} - -GtkWidget * -e_contact_editor_create_date(gchar *name, - gchar *string1, gchar *string2, - gint int1, gint int2); - -GtkWidget * -e_contact_editor_create_date(gchar *name, - gchar *string1, gchar *string2, - gint int1, gint int2) -{ - GtkWidget *widget = e_date_edit_new (); - e_date_edit_set_allow_no_date_set (E_DATE_EDIT (widget), - TRUE); - e_date_edit_set_show_time (E_DATE_EDIT (widget), FALSE); - e_date_edit_set_time (E_DATE_EDIT (widget), -1); - return widget; -} - -static void -enable_widget (GtkWidget *widget, gboolean enabled) -{ - if (GTK_IS_ENTRY (widget)) { - gtk_entry_set_editable (GTK_ENTRY (widget), enabled); - } - else if (GTK_IS_TEXT_VIEW (widget)) { - gtk_text_view_set_editable (GTK_TEXT_VIEW (widget), enabled); - } - else if (GTK_IS_COMBO (widget)) { - gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (widget)->entry), - enabled); - gtk_widget_set_sensitive (GTK_COMBO (widget)->button, enabled); - } - else if (E_IS_DATE_EDIT (widget)) { - e_date_edit_set_editable (E_DATE_EDIT (widget), enabled); - } - else - gtk_widget_set_sensitive (widget, enabled); -} - - -gboolean -e_contact_editor_request_close_all (void) -{ - GSList *p; - GSList *pnext; - gboolean retval; - - retval = TRUE; - for (p = all_contact_editors; p != NULL; p = pnext) { - pnext = p->next; - - e_contact_editor_raise (E_CONTACT_EDITOR (p->data)); - if (! prompt_to_save_changes (E_CONTACT_EDITOR (p->data))) { - retval = FALSE; - break; - } - - close_dialog (E_CONTACT_EDITOR (p->data)); - } - - return retval; -} diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h deleted file mode 100644 index f4b8051fed..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor.h +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-editor.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_CONTACT_EDITOR_H__ -#define __E_CONTACT_EDITOR_H__ - -#include <libgnomeui/gnome-app.h> -#include <libgnomeui/gnome-app-helper.h> -#include <bonobo/bonobo-ui-component.h> -#include <glade/glade.h> - -#include "addressbook/gui/component/select-names/e-select-names-manager.h" -#include "addressbook/backend/ebook/e-book.h" -#include "addressbook/backend/ebook/e-card.h" -#include "addressbook/backend/ebook/e-card-simple.h" - -G_BEGIN_DECLS - -/* EContactEditor - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * card ECard * RW The card currently being edited - */ - -#define E_TYPE_CONTACT_EDITOR (e_contact_editor_get_type ()) -#define E_CONTACT_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CONTACT_EDITOR, EContactEditor)) -#define E_CONTACT_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CONTACT_EDITOR, EContactEditorClass)) -#define E_IS_CONTACT_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CONTACT_EDITOR)) -#define E_IS_CONTACT_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_CONTACT_EDITOR)) - - -typedef struct _EContactEditor EContactEditor; -typedef struct _EContactEditorClass EContactEditorClass; - -struct _EContactEditor -{ - GtkObject object; - - /* item specific fields */ - EBook *book; - ECard *card; - ECardSimple *simple; - - /* UI handler */ - BonoboUIComponent *uic; - - GladeXML *gui; - GtkWidget *app; - GnomeUIInfo *email_info; - GnomeUIInfo *phone_info; - GnomeUIInfo *address_info; - GtkWidget *email_popup; - GtkWidget *phone_popup; - GtkWidget *address_popup; - GList *email_list; - GList *phone_list; - GList *address_list; - - ESelectNamesManager *select_names_contacts; - - ECardName *name; - char *company; - - ECardSimpleEmailId email_choice; - ECardSimplePhoneId phone_choice[4]; - ECardSimpleAddressId address_choice; - ECardSimpleAddressId address_mailing; - - GList *arbitrary_fields; - - /* Whether we are editing a new card or an existing one */ - guint is_new_card : 1; - - /* Whether the card has been changed since bringing up the contact editor */ - guint changed : 1; - - /* Whether the contact editor will accept modifications */ - guint editable : 1; - - /* Whether the fullname will accept modifications */ - guint fullname_editable : 1; - - /* Whether each of the addresses are editable */ - gboolean address_editable[E_CARD_SIMPLE_ADDRESS_ID_LAST]; - - /* Whether an async wombat call is in progress */ - guint in_async_call : 1; - - EList *writable_fields; -}; - -struct _EContactEditorClass -{ - GtkObjectClass parent_class; - - /* Notification signals */ - - void (* card_added) (EContactEditor *ce, EBookStatus status, ECard *card); - void (* card_modified) (EContactEditor *ce, EBookStatus status, ECard *card); - void (* card_deleted) (EContactEditor *ce, EBookStatus status, ECard *card); - void (* editor_closed) (EContactEditor *ce); -}; - -EContactEditor *e_contact_editor_new (EBook *book, - ECard *card, - gboolean is_new_card, - gboolean editable); -GType e_contact_editor_get_type (void); - -void e_contact_editor_show (EContactEditor *editor); -void e_contact_editor_close (EContactEditor *editor); -void e_contact_editor_raise (EContactEditor *editor); - -gboolean e_contact_editor_confirm_delete (GtkWindow *parent); - -gboolean e_contact_editor_request_close_all (void); - -G_END_DECLS - -#endif /* __E_CONTACT_EDITOR_H__ */ diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c deleted file mode 100644 index 69af7802b2..0000000000 --- a/addressbook/gui/contact-editor/e-contact-quick-add.c +++ /dev/null @@ -1,463 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * e-contact-quick-add.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 <ctype.h> -#include <glib.h> -#include <gtk/gtkentry.h> -#include <gtk/gtklabel.h> -#include <gtk/gtktable.h> -#include <gtk/gtkdialog.h> -#include <gtk/gtkstock.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-app.h> -#include <addressbook/gui/component/addressbook.h> -#include <addressbook/backend/ebook/e-book.h> -#include <addressbook/backend/ebook/e-book-util.h> -#include <addressbook/backend/ebook/e-card.h> -#include "e-contact-editor.h" -#include "e-contact-quick-add.h" -#include "e-card-merging.h" - -typedef struct _QuickAdd QuickAdd; -struct _QuickAdd { - gchar *name; - gchar *email; - ECard *card; - - EContactQuickAddCallback cb; - gpointer closure; - - GtkWidget *name_entry; - GtkWidget *email_entry; - - gint refs; - -}; - -static QuickAdd * -quick_add_new (void) -{ - QuickAdd *qa = g_new0 (QuickAdd, 1); - qa->card = e_card_new (""); - qa->refs = 1; - return qa; -} - -static void -quick_add_ref (QuickAdd *qa) -{ - if (qa) { - ++qa->refs; - } -} - -static void -quick_add_unref (QuickAdd *qa) -{ - if (qa) { - --qa->refs; - if (qa->refs == 0) { - g_free (qa->name); - g_free (qa->email); - g_object_unref (qa->card); - g_free (qa); - } - } -} - -static void -quick_add_set_name (QuickAdd *qa, const gchar *name) -{ - ECardName *card_name; - - if (name == qa->name) - return; - - g_free (qa->name); - - card_name = e_card_name_from_string (name); - qa->name = e_card_name_to_string (card_name); - - g_object_set (qa->card, - "full_name", qa->name, - NULL); - - e_card_name_unref (card_name); -} - -static void -quick_add_set_email (QuickAdd *qa, const gchar *email) -{ - ECardSimple *simple; - - if (email == qa->email) - return; - - g_free (qa->email); - qa->email = g_strdup (email); - - simple = e_card_simple_new (qa->card); - e_card_simple_set (simple, E_CARD_SIMPLE_FIELD_EMAIL, email); - e_card_simple_sync_card (simple); - g_object_unref (simple); -} - -static void -merge_cb (EBook *book, EBookStatus status, gpointer closure) -{ - QuickAdd *qa = (QuickAdd *) closure; - - if (book != NULL) { - e_card_merging_book_add_card (book, qa->card, NULL, NULL); - if (qa->cb) - qa->cb (qa->card, qa->closure); - g_object_unref (book); - } else { - /* Something went wrong. */ - if (qa->cb) - qa->cb (NULL, qa->closure); - } - - quick_add_unref (qa); -} - -static void -quick_add_merge_card (QuickAdd *qa) -{ - EBook *book; - - quick_add_ref (qa); - - book = e_book_new (); - if (!addressbook_load_default_book (book, merge_cb, qa)) { - g_object_unref (book); - merge_cb (book, E_BOOK_STATUS_OTHER_ERROR, qa); - } -} - - -/* - * Raise a contact editor with all fields editable, and hook up all signals accordingly. - */ - -static void -card_added_cb (EContactEditor *ce, EBookStatus status, ECard *card, gpointer closure) -{ - QuickAdd *qa = (QuickAdd *) g_object_get_data (G_OBJECT (ce), "quick_add"); - - if (qa) { - - if (qa->cb) - qa->cb (qa->card, qa->closure); - - /* We don't need to unref qa because we set_data_full below */ - g_object_set_data (G_OBJECT (ce), "quick_add", NULL); - } -} - -static void -editor_closed_cb (GtkWidget *w, gpointer closure) -{ - QuickAdd *qa = (QuickAdd *) g_object_get_data (G_OBJECT (w), "quick_add"); - - if (qa) - /* We don't need to unref qa because we set_data_full below */ - g_object_set_data (G_OBJECT (w), "quick_add", NULL); - - g_object_unref (w); -} - -static void -ce_have_book (EBook *book, EBookStatus status, gpointer closure) -{ - QuickAdd *qa = (QuickAdd *) closure; - - if (book == NULL) { - g_warning ("Couldn't open local address book."); - quick_add_unref (qa); - } else { - EContactEditor *contact_editor = e_contact_editor_new (book, qa->card, TRUE, TRUE /* XXX */); - - /* mark it as changed so the Save buttons are enabled when we bring up the dialog. */ - g_object_set (contact_editor, - "changed", TRUE, - NULL); - - /* We pass this via object data, so that we don't get a dangling pointer referenced if both - the "card_added" and "editor_closed" get emitted. (Which, based on a backtrace in bugzilla, - I think can happen and cause a crash. */ - g_object_set_data_full (G_OBJECT (contact_editor), "quick_add", qa, - (GDestroyNotify) quick_add_unref); - - g_signal_connect (contact_editor, - "card_added", - G_CALLBACK (card_added_cb), - NULL); - g_signal_connect (contact_editor, - "editor_closed", - G_CALLBACK (editor_closed_cb), - NULL); - - g_object_unref (book); - } -} - -static void -edit_card (QuickAdd *qa) -{ - EBook *book; - book = e_book_new (); - if (!addressbook_load_default_book (book, ce_have_book, qa)) { - g_object_unref (book); - ce_have_book (book, E_BOOK_STATUS_OTHER_ERROR, qa); - } -} - -#define QUICK_ADD_RESPONSE_EDIT_FULL 2 - -static void -clicked_cb (GtkWidget *w, gint button, gpointer closure) -{ - QuickAdd *qa = (QuickAdd *) closure; - - /* Get data out of entries. */ - if (button == GTK_RESPONSE_OK || button == QUICK_ADD_RESPONSE_EDIT_FULL) { - gchar *name = NULL; - gchar *email = NULL; - - if (qa->name_entry) { - gchar *tmp; - tmp = gtk_editable_get_chars (GTK_EDITABLE (qa->name_entry), 0, -1); - name = tmp; - } - - if (qa->email_entry) { - gchar *tmp; - tmp = gtk_editable_get_chars (GTK_EDITABLE (qa->email_entry), 0, -1); - email = tmp; - } - - quick_add_set_name (qa, name); - quick_add_set_email (qa, email); - - g_free (name); - g_free (email); - } - - gtk_widget_destroy (w); - - if (button == GTK_RESPONSE_OK) { - - /* OK */ - quick_add_merge_card (qa); - - } else if (button == QUICK_ADD_RESPONSE_EDIT_FULL) { - - /* EDIT FULL */ - edit_card (qa); - - } else { - /* CANCEL */ - quick_add_unref (qa); - } - -} - -static GtkWidget * -build_quick_add_dialog (QuickAdd *qa) -{ - GtkWidget *dialog; - GtkTable *table; - const gint xpad=1, ypad=1; - - g_return_val_if_fail (qa != NULL, NULL); - - dialog = gtk_dialog_new_with_buttons (_("Contact Quick-Add"), - NULL, /* XXX */ - (GtkDialogFlags) 0, - GTK_STOCK_OK, GTK_RESPONSE_OK, - _("Edit Full"), QUICK_ADD_RESPONSE_EDIT_FULL, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - NULL); - - g_signal_connect (dialog, "reponse", - G_CALLBACK (clicked_cb), qa); - - qa->name_entry = gtk_entry_new (); - if (qa->name) - gtk_entry_set_text (GTK_ENTRY (qa->name_entry), qa->name); - - - qa->email_entry = gtk_entry_new (); - if (qa->email) - gtk_entry_set_text (GTK_ENTRY (qa->email_entry), qa->email); - - table = GTK_TABLE (gtk_table_new (2, 2, FALSE)); - - gtk_table_attach (table, gtk_label_new (_("Full Name")), - 0, 1, 0, 1, - 0, 0, xpad, ypad); - gtk_table_attach (table, qa->name_entry, - 1, 2, 0, 1, - GTK_EXPAND | GTK_FILL, GTK_EXPAND, xpad, ypad); - gtk_table_attach (table, gtk_label_new (_("E-mail")), - 0, 1, 1, 2, - 0, 0, xpad, ypad); - gtk_table_attach (table, qa->email_entry, - 1, 2, 1, 2, - GTK_EXPAND | GTK_FILL, GTK_EXPAND, xpad, ypad); - - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), - GTK_WIDGET (table), - TRUE, TRUE, 0); - gtk_widget_show_all (GTK_WIDGET (table)); - - - return dialog; -} - -void -e_contact_quick_add (const gchar *in_name, const gchar *email, - EContactQuickAddCallback cb, gpointer closure) -{ - QuickAdd *qa; - GtkWidget *dialog; - gchar *name = NULL; - gint len; - - /* We need to have *something* to work with. */ - if (in_name == NULL && email == NULL) { - if (cb) - cb (NULL, closure); - return; - } - - if (in_name) { - name = g_strdup (in_name); - - /* Remove extra whitespace and the quotes some mailers put around names. */ - g_strstrip (name); - len = strlen (name); - if ((name[0] == '\'' && name[len-1] == '\'') || (name[0] == '"' && name[len-1] == '"')) { - name[0] = ' '; - name[len-1] = ' '; - } - g_strstrip (name); - } - - qa = quick_add_new (); - qa->cb = cb; - qa->closure = closure; - if (name) - quick_add_set_name (qa, name); - if (email) - quick_add_set_email (qa, email); - - dialog = build_quick_add_dialog (qa); - gtk_widget_show_all (dialog); - - g_free (name); -} - -void -e_contact_quick_add_free_form (const gchar *text, EContactQuickAddCallback cb, gpointer closure) -{ - gchar *name=NULL, *email=NULL; - const gchar *last_at, *s; - gboolean in_quote; - - if (text == NULL) { - e_contact_quick_add (NULL, NULL, cb, closure); - return; - } - - /* Look for things that look like e-mail addresses embedded in text */ - in_quote = FALSE; - last_at = NULL; - for (s = text; *s; ++s) { - if (*s == '@' && !in_quote) - last_at = s; - else if (*s == '"') - in_quote = !in_quote; - } - - - if (last_at == NULL) { - /* No at sign, so we treat it all as the name */ - name = g_strdup (text); - } else { - gboolean bad_char = FALSE; - - /* walk backwards to whitespace or a < or a quote... */ - while (last_at >= text && !bad_char - && !(isspace ((gint) *last_at) || *last_at == '<' || *last_at == '"')) { - /* Check for some stuff that can't appear in a legal e-mail address. */ - if (*last_at == '[' - || *last_at == ']' - || *last_at == '(' - || *last_at == ')') - bad_char = TRUE; - --last_at; - } - if (last_at < text) - last_at = text; - - /* ...and then split the text there */ - if (!bad_char) { - if (text < last_at) - name = g_strndup (text, last_at-text); - email = g_strdup (last_at); - } - } - - /* If all else has failed, make it the name. */ - if (name == NULL && email == NULL) - name = g_strdup (text); - - - - /* Clean up email, remove bracketing <>s */ - if (email && *email) { - gboolean changed = FALSE; - g_strstrip (email); - if (*email == '<') { - *email = ' '; - changed = TRUE; - } - if (email[strlen (email)-1] == '>') { - email[strlen (email)-1] = ' '; - changed = TRUE; - } - if (changed) - g_strstrip (email); - } - - - e_contact_quick_add (name, email, cb, closure); - g_free (name); - g_free (email); -} diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.h b/addressbook/gui/contact-editor/e-contact-quick-add.h deleted file mode 100644 index 1bf69ee114..0000000000 --- a/addressbook/gui/contact-editor/e-contact-quick-add.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * e-contact-quick-add.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_CONTACT_QUICK_ADD_H__ -#define __E_CONTACT_QUICK_ADD_H__ - -#include <addressbook/backend/ebook/e-card.h> - -typedef void (*EContactQuickAddCallback) (ECard *new_card, gpointer closure); - -void e_contact_quick_add (const gchar *name, const gchar *email, - EContactQuickAddCallback cb, gpointer closure); - -void e_contact_quick_add_free_form (const gchar *text, EContactQuickAddCallback cb, gpointer closure); - -#endif /* __E_CONTACT_QUICK_ADD_H__ */ - diff --git a/addressbook/gui/contact-editor/e-contact-save-as.c b/addressbook/gui/contact-editor/e-contact-save-as.c deleted file mode 100644 index f281b1925f..0000000000 --- a/addressbook/gui/contact-editor/e-contact-save-as.c +++ /dev/null @@ -1,221 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-editor.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. - */ - -#include <config.h> - -#include "e-contact-save-as.h" - -#include <unistd.h> -#include <fcntl.h> -#include <gtk/gtkfilesel.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkmessagedialog.h> -#include <gal/util/e-util.h> -#include <libgnome/gnome-i18n.h> -#include <errno.h> -#include <string.h> -#include <libgnomeui/gnome-messagebox.h> - -static gint file_exists(GtkFileSelection *filesel, const char *filename); - -typedef struct { - GtkFileSelection *filesel; - char *vcard; -} SaveAsInfo; - -static void -save_it(GtkWidget *widget, SaveAsInfo *info) -{ - gint error = 0; - gint response = 0; - - const char *filename = gtk_file_selection_get_filename (info->filesel); - - error = e_write_file (filename, info->vcard, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC); - - if (error == EEXIST) { - response = file_exists(info->filesel, filename); - switch (response) { - case GTK_RESPONSE_ACCEPT : /* Overwrite */ - e_write_file(filename, info->vcard, O_WRONLY | O_CREAT | O_TRUNC); - break; - case GTK_RESPONSE_REJECT : /* cancel */ - return; - } - } else if (error != 0) { - GtkWidget *dialog; - char *str; - - str = g_strdup_printf (_("Error saving %s: %s"), filename, strerror(errno)); - dialog = gtk_message_dialog_new (GTK_WINDOW (info->filesel), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - str); - g_free (str); - - gtk_widget_show (dialog); - - return; - } - - g_free (info->vcard); - gtk_widget_destroy(GTK_WIDGET(info->filesel)); - g_free(info); -} - -static void -close_it(GtkWidget *widget, SaveAsInfo *info) -{ - g_free (info->vcard); - gtk_widget_destroy (GTK_WIDGET (info->filesel)); - g_free (info); -} - -static void -delete_it(GtkWidget *widget, SaveAsInfo *info) -{ - g_free (info->vcard); - g_free (info); -} - -static char * -make_safe_filename (const char *prefix, char *name) -{ - char *safe, *p; - - if (!name) { - /* This is a filename. Translators take note. */ - name = _("card.vcf"); - } - - p = strrchr (name, '/'); - if (p) - safe = g_strdup_printf ("%s%s%s", prefix, p, ".vcf"); - else - safe = g_strdup_printf ("%s/%s%s", prefix, name, ".vcf"); - - p = strrchr (safe, '/') + 1; - if (p) - e_filename_make_safe (p); - - return safe; -} - -void -e_contact_save_as(char *title, ECard *card, GtkWindow *parent_window) -{ - GtkFileSelection *filesel; - char *file; - char *name; - SaveAsInfo *info = g_new(SaveAsInfo, 1); - - filesel = GTK_FILE_SELECTION(gtk_file_selection_new(title)); - - g_object_get (card, - "file_as", &name, - NULL); - file = make_safe_filename (g_get_home_dir(), name); - gtk_file_selection_set_filename (filesel, file); - g_free (file); - - info->filesel = filesel; - info->vcard = e_card_get_vcard(card); - - g_signal_connect(filesel->ok_button, "clicked", - G_CALLBACK (save_it), info); - g_signal_connect(filesel->cancel_button, "clicked", - G_CALLBACK (close_it), info); - g_signal_connect(filesel, "delete_event", - G_CALLBACK (delete_it), info); - - if (parent_window) { - gtk_window_set_transient_for (GTK_WINDOW (filesel), - parent_window); - gtk_window_set_modal (GTK_WINDOW (filesel), TRUE); - } - - gtk_widget_show(GTK_WIDGET(filesel)); -} - -void -e_contact_list_save_as(char *title, GList *list, GtkWindow *parent_window) -{ - GtkFileSelection *filesel; - SaveAsInfo *info = g_new(SaveAsInfo, 1); - - filesel = GTK_FILE_SELECTION(gtk_file_selection_new(title)); - - /* This is a filename. Translators take note. */ - if (list && list->data && list->next == NULL) { - char *name, *file; - g_object_get (list->data, - "file_as", &name, - NULL); - file = make_safe_filename (g_get_home_dir(), name); - gtk_file_selection_set_filename (filesel, file); - g_free (file); - } else { - char *file; - file = make_safe_filename (g_get_home_dir(), _("list")); - gtk_file_selection_set_filename (filesel, file); - g_free (file); - } - - info->filesel = filesel; - info->vcard = e_card_list_get_vcard (list); - - g_signal_connect(filesel->ok_button, "clicked", - G_CALLBACK (save_it), info); - g_signal_connect(filesel->cancel_button, "clicked", - G_CALLBACK (close_it), info); - g_signal_connect(filesel, "delete_event", - G_CALLBACK (delete_it), info); - - if (parent_window) { - gtk_window_set_transient_for (GTK_WINDOW (filesel), - parent_window); - gtk_window_set_modal (GTK_WINDOW (filesel), TRUE); - } - - gtk_widget_show(GTK_WIDGET(filesel)); -} - -static gint -file_exists(GtkFileSelection *filesel, const char *filename) -{ - GtkWidget *dialog; - gint response; - - dialog = gtk_message_dialog_new (GTK_WINDOW (filesel), - 0, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_NONE, - _("%s already exists\nDo you want to overwrite it?"), filename); - - gtk_dialog_add_buttons (GTK_DIALOG (dialog), - _("Overwrite"), GTK_RESPONSE_ACCEPT, - GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, - NULL); - - response = gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - return response; -} diff --git a/addressbook/gui/contact-editor/e-contact-save-as.h b/addressbook/gui/contact-editor/e-contact-save-as.h deleted file mode 100644 index 2b01ad8435..0000000000 --- a/addressbook/gui/contact-editor/e-contact-save-as.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-save-as.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_CONTACT_SAVE_AS_H__ -#define __E_CONTACT_SAVE_AS_H__ - -#include <gtk/gtkwindow.h> -#include <glade/glade.h> -#include "addressbook/backend/ebook/e-card.h" -#include "addressbook/backend/ebook/e-card-simple.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -void e_contact_save_as (gchar *title, ECard *card, GtkWindow *parent_window); -void e_contact_list_save_as (gchar *title, GList *list, GtkWindow *parent_window); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_CONTACT_EDITOR_H__ */ diff --git a/addressbook/gui/contact-editor/fulladdr.glade b/addressbook/gui/contact-editor/fulladdr.glade deleted file mode 100644 index 023c0b57be..0000000000 --- a/addressbook/gui/contact-editor/fulladdr.glade +++ /dev/null @@ -1,446 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkDialog" id="dialog-checkaddress"> - <property name="title" translatable="yes">Check Address</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">True</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="vbox-container"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">8</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="hbuttonbox1"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - - <child> - <widget class="GtkButton" id="button1"> - <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="button2"> - <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">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-checkaddress"> - <property name="border_width">8</property> - <property name="visible">True</property> - <property name="n_rows">4</property> - <property name="n_columns">4</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkLabel" id="label-street"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Address:</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> - <property name="mnemonic_widget">entry-street</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">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-city"> - <property name="visible">True</property> - <property name="label" translatable="yes">_City:</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">entry-city</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">fill</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-city"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-ext"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-po"> - <property name="visible">True</property> - <property name="label" translatable="yes">_PO Box:</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">entry-po</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-ext"> - <property name="visible">True</property> - <property name="label" translatable="yes">Address _2:</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">entry-ext</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">fill</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-po"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</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> - - <child> - <widget class="GtkEntry" id="entry-street"> - <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">4</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="label-region"> - <property name="visible">True</property> - <property name="label" translatable="yes">_State/Province:</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">entry-region</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">fill</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-region"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkCombo" id="combo-country"> - <property name="visible">True</property> - <property name="can_focus">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="entry-country"> - <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> - - <child internal-child="list"> - <widget class="GtkList" id="convertwidget1"> - <property name="visible">True</property> - <property name="selection_mode">GTK_SELECTION_BROWSE</property> - - <child> - <widget class="GtkListItem" id="convertwidget2"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget3"> - <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> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</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="GtkEntry" id="entry-code"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-code"> - <property name="visible">True</property> - <property name="label" translatable="yes">_ZIP Code:</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">entry-code</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-country"> - <property name="visible">True</property> - <property name="label" translatable="yes">Countr_y:</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">entry-country</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - </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/contact-editor/fullname.glade b/addressbook/gui/contact-editor/fullname.glade deleted file mode 100644 index f890d2cb88..0000000000 --- a/addressbook/gui/contact-editor/fullname.glade +++ /dev/null @@ -1,674 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkDialog" id="dialog-checkfullname"> - <property name="title" translatable="yes">Check Full Name</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">True</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="vbox-container"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">8</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="hbuttonbox1"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - - <child> - <widget class="GtkButton" id="button1"> - <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="button2"> - <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">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-checkfullname"> - <property name="border_width">8</property> - <property name="visible">True</property> - <property name="n_rows">5</property> - <property name="n_columns">3</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">21</property> - - <child> - <widget class="GtkCombo" id="combo-title"> - <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="entry-title"> - <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> - - <child internal-child="list"> - <widget class="GtkList" id="convertwidget1"> - <property name="visible">True</property> - <property name="selection_mode">GTK_SELECTION_BROWSE</property> - - <child> - <widget class="GtkListItem" id="convertwidget2"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget3"> - <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> - - <child> - <widget class="GtkListItem" id="convertwidget4"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget5"> - <property name="visible">True</property> - <property name="label" translatable="yes">Mr.</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="convertwidget6"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget7"> - <property name="visible">True</property> - <property name="label" translatable="yes">Mrs.</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="convertwidget8"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget9"> - <property name="visible">True</property> - <property name="label" translatable="yes">Ms.</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="convertwidget10"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget11"> - <property name="visible">True</property> - <property name="label" translatable="yes">Miss</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="convertwidget12"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget13"> - <property name="visible">True</property> - <property name="label" translatable="yes">Dr.</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="convertwidget14"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget15"> - <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> - <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="GtkCombo" id="combo-suffix"> - <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="entry-suffix"> - <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> - - <child internal-child="list"> - <widget class="GtkList" id="convertwidget16"> - <property name="visible">True</property> - <property name="selection_mode">GTK_SELECTION_BROWSE</property> - - <child> - <widget class="GtkListItem" id="convertwidget17"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget18"> - <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> - - <child> - <widget class="GtkListItem" id="convertwidget19"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget20"> - <property name="visible">True</property> - <property name="label" translatable="yes">Sr.</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="convertwidget21"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget22"> - <property name="visible">True</property> - <property name="label" translatable="yes">Jr.</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="convertwidget23"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget24"> - <property name="visible">True</property> - <property name="label" translatable="yes">I</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="convertwidget25"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget26"> - <property name="visible">True</property> - <property name="label" translatable="yes">II</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="convertwidget27"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget28"> - <property name="visible">True</property> - <property name="label" translatable="yes">III</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="convertwidget29"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget30"> - <property name="visible">True</property> - <property name="label" translatable="yes">Esq.</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="convertwidget31"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget32"> - <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> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-first"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">3</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-middle"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">3</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry-last"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">3</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-first"> - <property name="visible">True</property> - <property name="label" translatable="yes">_First:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">entry-first</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">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-title"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Title:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">entry-title</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">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-middle"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Middle:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">entry-middle</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">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-last"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Last:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">entry-last</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">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-suffix"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Suffix:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">entry-suffix</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/addressbook/gui/contact-editor/test-editor.c b/addressbook/gui/contact-editor/test-editor.c deleted file mode 100644 index eb7e3d3f68..0000000000 --- a/addressbook/gui/contact-editor/test-editor.c +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * test-editor.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 <stdlib.h> -#include <gtk/gtkmain.h> -#include <libgnomeui/gnome-app.h> -#include <libgnomeui/gnome-ui-init.h> -#include <glade/glade.h> -#include "e-contact-editor.h" -#include "ebook/e-card.h" - -#define TEST_VCARD \ -"BEGIN:VCARD -" \ -"FN:Nat -" \ -"N:Friedman;Nat;D;Mr. -" \ -"BDAY:1977-08-06 -" \ -"TEL;WORK:617 679 1984 -" \ -"TEL;CELL:123 456 7890 -" \ -"EMAIL;INTERNET:nat@nat.org -" \ -"EMAIL;INTERNET:nat@ximian.com -" \ -"ADR;WORK;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234; -" \ -"ADR;HOME;POSTAL;INTL:P.O. Box 202;;;Any Town 2;MI;12344-4321;USA -" \ -"END:VCARD -" \ -" -" - -static char * -read_file (char *name) -{ - int len; - char buff[65536]; - char line[1024]; - FILE *f; - - f = fopen (name, "r"); - if (f == NULL) - g_error ("Unable to open %s!\n", name); - - len = 0; - while (fgets (line, sizeof (line), f) != NULL) { - strcpy (buff + len, line); - len += strlen (line); - } - - fclose (f); - - return g_strdup (buff); -} - -/* Callback used when a contact editor is closed */ -static void -editor_closed_cb (EContactEditor *ce, gpointer data) -{ - static int count = 2; - - count--; - g_object_unref (ce); - - if (count == 0) - exit (0); -} - -#if 0 -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey <clahey@umich.edu>", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Contact Editor Test" ), VERSION, - _( "Copyright (C) 2000, Ximian, Inc." ), - authors, - _( "This should test the contact editor canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -int main( int argc, char *argv[] ) -{ - char *cardstr; - EContactEditor *ce; - - gnome_program_init("Contact Editor Test", VERSION, LIBGNOMEUI_MODULE, argc, argv, NULL); - - glade_gnome_init (); - - cardstr = NULL; - if (argc == 2) - cardstr = read_file (argv [1]); - - if (cardstr == NULL) - cardstr = TEST_VCARD; - - ce = e_contact_editor_new (NULL, e_card_new_with_default_charset (cardstr, "ISO-8859-1"), TRUE, FALSE); - g_signal_connect (ce, "editor_closed", - G_CALLBACK (editor_closed_cb), NULL); - - ce = e_contact_editor_new (NULL, e_card_new_with_default_charset (cardstr, "ISO-8859-1"), TRUE, FALSE); - g_signal_connect (ce, "editor_closed", - G_CALLBACK (editor_closed_cb), NULL); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/gui/contact-list-editor/.cvsignore b/addressbook/gui/contact-list-editor/.cvsignore deleted file mode 100644 index f151930645..0000000000 --- a/addressbook/gui/contact-list-editor/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile.in -Makefile -.deps -.pure -e-contact-list-editor-marshal.c -e-contact-list-editor-marshal.h diff --git a/addressbook/gui/contact-list-editor/Makefile.am b/addressbook/gui/contact-list-editor/Makefile.am deleted file mode 100644 index 7f13c401c7..0000000000 --- a/addressbook/gui/contact-list-editor/Makefile.am +++ /dev/null @@ -1,62 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/addressbook/ \ - -I$(top_srcdir)/addressbook/backend \ - -I$(top_builddir)/addressbook/backend \ - -I$(top_srcdir)/addressbook/gui/merging \ - -I$(top_srcdir)/addressbook/gui/contact-editor \ - -I$(top_builddir)/shell \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\"\ - -DDATADIR=\""$(datadir)"\" \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ - -DEVOLUTIONDIR=\""$(evolutiondir)"\" \ - -DG_LOG_DOMAIN=\"contact-list-editor\" \ - -DG_DISABLE_DEPRECATED \ - -DGTK_DISABLE_DEPRECATED \ - -DLIBGNOME_DISABLE_DEPRECATED \ - -DLIBGNOMEUI_DISABLE_DEPRECATED \ - $(EVOLUTION_ADDRESSBOOK_CFLAGS) - -noinst_LIBRARIES = \ - libecontactlisteditor.a - -libecontactlisteditor_a_SOURCES = \ - e-contact-list-editor.c \ - e-contact-list-editor.h \ - e-contact-list-editor-marshal.c \ - e-contact-list-model.c \ - e-contact-list-model.h - -# GLib marshalling cruft - -e-contact-list-editor-marshal.h: e-contact-list-editor-marshal.list - ( @GLIB_GENMARSHAL@ --prefix=ecle_marshal e-contact-list-editor-marshal.list --header > e-contact-list-editor-marshal.tmp \ - && mv e-contact-list-editor-marshal.tmp e-contact-list-editor-marshal.h ) \ - || ( rm -f e-contact-list-editor-marshal.tmp && exit 1 ) - -e-contact-list-editor-marshal.c: e-contact-list-editor-marshal.h - ( @GLIB_GENMARSHAL@ --prefix=ecle_marshal e-contact-list-editor-marshal.list --body > e-contact-list-editor-marshal.tmp \ - && mv e-contact-list-editor-marshal.tmp e-contact-list-editor-marshal.c ) \ - || ( rm -f e-contact-list-editor-marshal.tmp && exit 1 ) - -MARSHAL_GENERATED = e-contact-list-editor-marshal.c e-contact-list-editor-marshal.h - - -iconsdir = $(datadir)/evolution/images - -gladedir = $(datadir)/evolution/glade - -glade_DATA = \ - contact-list-editor.glade - -etspecdir = $(datadir)/evolution/etspec -etspec_DATA = e-contact-list-editor.etspec - -BUILT_SOURCES = $(MARSHAL_GENERATED) -CLEANFILES = $(BUILT_SOURCES) - -EXTRA_DIST = $(glade_DATA) \ - $(etspec_DATA) \ - e-contact-list-editor-marshal.list diff --git a/addressbook/gui/contact-list-editor/contact-list-editor.glade b/addressbook/gui/contact-list-editor/contact-list-editor.glade deleted file mode 100644 index 6ba85be352..0000000000 --- a/addressbook/gui/contact-list-editor/contact-list-editor.glade +++ /dev/null @@ -1,278 +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" /> - <requires lib="bonobo" /> - - <widget class="GnomeApp" id="contact list editor"> - <property name="title" translatable="yes">contact-list-editor</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="modal">no</property> - <property name="default_width">426</property> - <property name="default_height">304</property> - <property name="allow_shrink">yes</property> - <property name="allow_grow">yes</property> - <property name="enable_layout_config">yes</property> - <property name="visible">yes</property> - <property name="window-position">GTK_WIN_POS_NONE</property> - - <child internal-child="dock"> - <widget class="BonoboDock" id="dock1"> - <property name="allow_floating">yes</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkVBox" id="vbox8"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox6"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label10"> - <property name="label" translatable="yes">List _name:</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">no</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">list-name-entry</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="list-name-entry"> - <property name="can_focus">yes</property> - <property name="has_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="Custom" id="custom7"> - <property name="creation_function">e_create_image_widget</property> - <property name="string1">evolution-contacts-plain.png</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Sat, 23 Jun 2001 05:59:21 GMT</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkFrame" id="frame3"> - <property name="border_width">3</property> - <property name="label" translatable="yes">Members</property> - <property name="label_xalign">0</property> - <property name="shadow">GTK_SHADOW_ETCHED_IN</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkHBox" id="hbox7"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkVBox" id="vbox9"> - <property name="border_width">3</property> - <property name="homogeneous">no</property> - <property name="spacing">3</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label11"> - <property name="label" translatable="yes">Type an email address or drag a contact into the list below:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="email-entry"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="Custom" id="contact-list-table"> - <property name="creation_function">e_contact_list_editor_create_table</property> - <property name="string1"></property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Sat, 23 Jun 2001 06:00:16 GMT</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="visible-addrs-checkbutton"> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">_Hide addresses when sending mail to this list</property> - <property name="active">no</property> - <property name="draw_indicator">yes</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox10"> - <property name="homogeneous">no</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkLabel" id="label12"> - <property name="label" translatable="yes"> -</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - - <child> - <widget class="GtkVButtonBox" id="vbuttonbox4"> - <property name="layout_style">GTK_BUTTONBOX_START</property> - <property name="spacing">0</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="add-email-button"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">_Add</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="remove-button"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">_Remove</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">no</property> - </packing> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> -</glade-interface> diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor-marshal.list b/addressbook/gui/contact-list-editor/e-contact-list-editor-marshal.list deleted file mode 100644 index 8d94a0bf3b..0000000000 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor-marshal.list +++ /dev/null @@ -1,4 +0,0 @@ -INT:OBJECT -NONE:INT,OBJECT -NONE:INT,OBJECT -NONE:NONE diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c deleted file mode 100644 index 36ccfe13d1..0000000000 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c +++ /dev/null @@ -1,1034 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-list-editor.c - * Copyright (C) 2001 Ximian, Inc. - * Author: Chris Toshok <toshok@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 "e-contact-list-editor.h" - -#include <glib.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-window-icon.h> -#include <bonobo/bonobo-ui-container.h> -#include <bonobo/bonobo-ui-util.h> -#include <bonobo/bonobo-window.h> -#include <gal/e-table/e-table-scrolled.h> -#include "shell/evolution-shell-component-utils.h" - -#include "addressbook/gui/widgets/e-addressbook-util.h" - -#include "e-contact-editor.h" -#include "e-contact-save-as.h" -#include "e-contact-list-model.h" -#include "e-contact-list-editor-marshal.h" - -/* Signal IDs */ -enum { - LIST_ADDED, - LIST_MODIFIED, - LIST_DELETED, - EDITOR_CLOSED, - LAST_SIGNAL -}; - -static void e_contact_list_editor_init (EContactListEditor *editor); -static void e_contact_list_editor_class_init (EContactListEditorClass *klass); -static void e_contact_list_editor_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void e_contact_list_editor_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void e_contact_list_editor_dispose (GObject *object); - -static void create_ui (EContactListEditor *ce); -static void set_editable (EContactListEditor *editor); -static void command_state_changed (EContactListEditor *editor); -static void close_dialog (EContactListEditor *cle); -static void extract_info(EContactListEditor *editor); -static void fill_in_info(EContactListEditor *editor); - -static void add_email_cb (GtkWidget *w, EContactListEditor *editor); -static void remove_entry_cb (GtkWidget *w, EContactListEditor *editor); -static void list_name_changed_cb (GtkWidget *w, EContactListEditor *editor); -static void visible_addrs_toggled_cb (GtkWidget *w, EContactListEditor *editor); - -static gint app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data); -static gboolean table_drag_drop_cb (ETable *table, int row, int col, GdkDragContext *context, - gint x, gint y, guint time, EContactListEditor *editor); -static gboolean table_drag_motion_cb (ETable *table, int row, int col, GdkDragContext *context, - gint x, gint y, guint time, EContactListEditor *editor); -static void table_drag_data_received_cb (ETable *table, int row, int col, - GdkDragContext *context, - gint x, gint y, - GtkSelectionData *selection_data, guint info, guint time, - EContactListEditor *editor); - -static GtkObjectClass *parent_class = NULL; - -static guint contact_list_editor_signals[LAST_SIGNAL]; - -enum DndTargetType { - DND_TARGET_TYPE_VCARD, -}; -#define VCARD_TYPE "text/x-vcard" -static GtkTargetEntry drag_types[] = { - { VCARD_TYPE, 0, DND_TARGET_TYPE_VCARD }, -}; -static const int num_drag_types = sizeof (drag_types) / sizeof (drag_types[0]); - -/* The arguments we take */ -enum { - PROP_0, - PROP_BOOK, - PROP_CARD, - PROP_IS_NEW_LIST, - PROP_EDITABLE -}; - -static GSList *all_contact_list_editors = NULL; - -GType -e_contact_list_editor_get_type (void) -{ - static GType cle_type = 0; - - if (!cle_type) { - static const GTypeInfo cle_info = { - sizeof (EContactListEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_contact_list_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EContactListEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_contact_list_editor_init, - }; - - cle_type = g_type_register_static (GTK_TYPE_OBJECT, "EContactListEditor", &cle_info, 0); - } - - return cle_type; -} - - -static void -e_contact_list_editor_class_init (EContactListEditorClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_ref (GTK_TYPE_OBJECT); - - object_class->set_property = e_contact_list_editor_set_property; - object_class->get_property = e_contact_list_editor_get_property; - object_class->dispose = e_contact_list_editor_dispose; - - g_object_class_install_property (object_class, PROP_BOOK, - g_param_spec_object ("book", - _("Book"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_BOOK, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_CARD, - g_param_spec_object ("card", - _("Card"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_CARD, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_IS_NEW_LIST, - g_param_spec_boolean ("is_new_list", - _("Is New List"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EDITABLE, - g_param_spec_boolean ("editable", - _("Editable"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); - - contact_list_editor_signals[LIST_ADDED] = - g_signal_new ("list_added", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EContactListEditorClass, list_added), - NULL, NULL, - ecle_marshal_NONE__INT_OBJECT, - G_TYPE_NONE, 2, - G_TYPE_INT, G_TYPE_OBJECT); - - contact_list_editor_signals[LIST_MODIFIED] = - g_signal_new ("list_modified", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EContactListEditorClass, list_modified), - NULL, NULL, - ecle_marshal_NONE__INT_OBJECT, - G_TYPE_NONE, 2, - G_TYPE_INT, G_TYPE_OBJECT); - - contact_list_editor_signals[LIST_DELETED] = - g_signal_new ("list_deleted", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EContactListEditorClass, list_deleted), - NULL, NULL, - ecle_marshal_NONE__INT_OBJECT, - G_TYPE_NONE, 2, - G_TYPE_INT, G_TYPE_OBJECT); - - contact_list_editor_signals[EDITOR_CLOSED] = - g_signal_new ("editor_closed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EContactListEditorClass, editor_closed), - NULL, NULL, - ecle_marshal_NONE__NONE, - G_TYPE_NONE, 0); -} - -static void -e_contact_list_editor_init (EContactListEditor *editor) -{ - GladeXML *gui; - GtkWidget *bonobo_win; - BonoboUIContainer *container; - char *icon_path; - - editor->card = NULL; - editor->changed = FALSE; - editor->editable = TRUE; - editor->in_async_call = FALSE; - editor->is_new_list = FALSE; - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/contact-list-editor.glade", NULL, NULL); - editor->gui = gui; - - editor->app = glade_xml_get_widget (gui, "contact list editor"); - - editor->table = glade_xml_get_widget (gui, "contact-list-table"); - editor->model = g_object_get_data (G_OBJECT(editor->table), "model"); - - /* XXX need this for libglade-2 it seems */ - gtk_widget_show (editor->table); - - editor->add_button = glade_xml_get_widget (editor->gui, "add-email-button"); - editor->remove_button = glade_xml_get_widget (editor->gui, "remove-button"); - - editor->email_entry = glade_xml_get_widget (gui, "email-entry"); - editor->list_name_entry = glade_xml_get_widget (gui, "list-name-entry"); - - editor->visible_addrs_checkbutton = glade_xml_get_widget (gui, "visible-addrs-checkbutton"); - - /* Construct the app */ - bonobo_win = bonobo_window_new ("contact-list-editor", _("Contact List Editor")); - - /* FIXME: The sucking bit */ - { - GtkWidget *contents; - - contents = bonobo_dock_get_client_area (gnome_app_get_dock (GNOME_APP (editor->app))); - - if (!contents) { - g_message ("contact_list_editor_construct(): Could not get contents"); - return; - } - gtk_widget_ref (contents); - gtk_container_remove (GTK_CONTAINER (contents->parent), contents); - bonobo_window_set_contents (BONOBO_WINDOW (bonobo_win), contents); - gtk_widget_destroy (editor->app); - editor->app = bonobo_win; - } - - /* Build the menu and toolbar */ - - container = bonobo_window_get_ui_container (BONOBO_WINDOW (editor->app)); - - editor->uic = bonobo_ui_component_new_default (); - if (!editor->uic) { - g_message ("e_contact_list_editor_init(): eeeeek, could not create the UI handler!"); - return; - } - bonobo_ui_component_set_container (editor->uic, - bonobo_object_corba_objref ( - BONOBO_OBJECT (container)), NULL); - - create_ui (editor); - - /* connect signals */ - g_signal_connect (editor->add_button, - "clicked", G_CALLBACK(add_email_cb), editor); - g_signal_connect (editor->email_entry, - "activate", G_CALLBACK(add_email_cb), editor); - g_signal_connect (editor->remove_button, - "clicked", G_CALLBACK(remove_entry_cb), editor); - g_signal_connect (editor->list_name_entry, - "changed", G_CALLBACK(list_name_changed_cb), editor); - g_signal_connect (editor->visible_addrs_checkbutton, - "toggled", G_CALLBACK(visible_addrs_toggled_cb), editor); - - e_table_drag_dest_set (e_table_scrolled_get_table (E_TABLE_SCROLLED (editor->table)), - 0, drag_types, num_drag_types, GDK_ACTION_LINK); - - g_signal_connect (e_table_scrolled_get_table (E_TABLE_SCROLLED (editor->table)), - "table_drag_motion", G_CALLBACK(table_drag_motion_cb), editor); - g_signal_connect (e_table_scrolled_get_table (E_TABLE_SCROLLED (editor->table)), - "table_drag_drop", G_CALLBACK (table_drag_drop_cb), editor); - g_signal_connect (e_table_scrolled_get_table (E_TABLE_SCROLLED (editor->table)), - "table_drag_data_received", G_CALLBACK(table_drag_data_received_cb), editor); - - command_state_changed (editor); - - /* Connect to the deletion of the dialog */ - - g_signal_connect (editor->app, "delete_event", - G_CALLBACK (app_delete_event_cb), editor); - - /* set the icon */ - icon_path = g_build_filename (EVOLUTION_ICONSDIR, "contact-list-16.png"); - gnome_window_icon_set_from_file (GTK_WINDOW (editor->app), icon_path); - g_free (icon_path); -} - -static void -e_contact_list_editor_dispose (GObject *object) -{ - /* XXX need to call parent dispose */ -} - -typedef struct { - EContactListEditor *cle; - gboolean should_close; -} EditorCloseStruct; - -static void -list_added_cb (EBook *book, EBookStatus status, const char *id, EditorCloseStruct *ecs) -{ - EContactListEditor *cle = ecs->cle; - gboolean should_close = ecs->should_close; - - if (cle->app) - gtk_widget_set_sensitive (cle->app, TRUE); - cle->in_async_call = FALSE; - - e_card_set_id (cle->card, id); - - g_signal_emit (cle, contact_list_editor_signals[LIST_ADDED], 0, - status, cle->card); - - if (status == E_BOOK_STATUS_SUCCESS) { - cle->is_new_list = FALSE; - - if (should_close) - close_dialog (cle); - else - command_state_changed (cle); - } - - g_object_unref (cle); - g_free (ecs); -} - -static void -list_modified_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs) -{ - EContactListEditor *cle = ecs->cle; - gboolean should_close = ecs->should_close; - - if (cle->app) - gtk_widget_set_sensitive (cle->app, TRUE); - cle->in_async_call = FALSE; - - g_signal_emit (cle, contact_list_editor_signals[LIST_MODIFIED], 0, - status, cle->card); - - if (status == E_BOOK_STATUS_SUCCESS) { - if (should_close) - close_dialog (cle); - } - - g_object_unref (cle); /* release ref held for ebook callback */ - g_free (ecs); -} - -static void -save_card (EContactListEditor *cle, gboolean should_close) -{ - extract_info (cle); - - if (cle->book) { - EditorCloseStruct *ecs = g_new(EditorCloseStruct, 1); - - ecs->cle = cle; - g_object_ref (cle); - ecs->should_close = should_close; - - if (cle->app) - gtk_widget_set_sensitive (cle->app, FALSE); - cle->in_async_call = TRUE; - - if (cle->is_new_list) - e_book_add_card (cle->book, cle->card, (EBookIdCallback)list_added_cb, ecs); - else - e_book_commit_card (cle->book, cle->card, (EBookCallback)list_modified_cb, ecs); - - cle->changed = FALSE; - } -} - -static gboolean -is_named (EContactListEditor *editor) -{ - char *string = gtk_editable_get_chars(GTK_EDITABLE (editor->list_name_entry), 0, -1); - gboolean named = FALSE; - - if (string && *string) { - named = TRUE; - } - - g_free (string); - - return named; -} - -static gboolean -prompt_to_save_changes (EContactListEditor *editor) -{ - if (!editor->changed || !is_named (editor)) - return TRUE; - - switch (e_addressbook_prompt_save_dialog (GTK_WINDOW(editor->app))) { - case GTK_RESPONSE_YES: - save_card (editor, FALSE); - return TRUE; - case GTK_RESPONSE_NO: - return TRUE; - case GTK_RESPONSE_CANCEL: - default: - return FALSE; - } -} - -static void -file_close_cb (GtkWidget *widget, gpointer data) -{ - EContactListEditor *cle = E_CONTACT_LIST_EDITOR (data); - - if (!prompt_to_save_changes (cle)) - return; - - close_dialog (cle); -} - -static void -file_save_cb (GtkWidget *widget, gpointer data) -{ - EContactListEditor *cle = E_CONTACT_LIST_EDITOR (data); - - save_card (cle, FALSE); -} - -static void -file_save_as_cb (GtkWidget *widget, gpointer data) -{ - EContactListEditor *cle = E_CONTACT_LIST_EDITOR (data); - - extract_info (cle); - - e_contact_save_as(_("Save List as VCard"), cle->card, GTK_WINDOW (cle->app)); -} - -static void -file_send_as_cb (GtkWidget *widget, gpointer data) -{ - EContactListEditor *cle = E_CONTACT_LIST_EDITOR (data); - - extract_info (cle); - - e_card_send(cle->card, E_CARD_DISPOSITION_AS_ATTACHMENT); -} - -static void -file_send_to_cb (GtkWidget *widget, gpointer data) -{ - EContactListEditor *cle = E_CONTACT_LIST_EDITOR (data); - - extract_info (cle); - - e_card_send(cle->card, E_CARD_DISPOSITION_AS_TO); -} - -static void -tb_save_and_close_cb (GtkWidget *widget, gpointer data) -{ - EContactListEditor *cle = E_CONTACT_LIST_EDITOR (data); - save_card (cle, TRUE); -} - -static void -list_deleted_cb (EBook *book, EBookStatus status, EContactListEditor *cle) -{ - if (cle->app) - gtk_widget_set_sensitive (cle->app, TRUE); - cle->in_async_call = FALSE; - - g_signal_emit (cle, contact_list_editor_signals[LIST_DELETED], 0, - status, cle->card); - - /* always close the dialog after we successfully delete a list */ - if (status == E_BOOK_STATUS_SUCCESS) - close_dialog (cle); - - g_object_unref (cle); /* release reference held for callback */ -} - -static void -delete_cb (GtkWidget *widget, gpointer data) -{ - EContactListEditor *cle = E_CONTACT_LIST_EDITOR (data); - ECard *card = cle->card; - - g_object_ref (card); - - if (e_contact_editor_confirm_delete(GTK_WINDOW(cle->app))) { - - extract_info (cle); - - if (!cle->is_new_list) { - gtk_widget_set_sensitive (cle->app, FALSE); - cle->in_async_call = TRUE; - - g_object_ref (cle); /* hold reference for callback */ - e_book_remove_card (cle->book, card, (EBookCallback)list_deleted_cb, cle); - } - } - - g_object_unref (card); -} - -static -BonoboUIVerb verbs [] = { - BONOBO_UI_UNSAFE_VERB ("ContactListEditorSave", file_save_cb), - BONOBO_UI_UNSAFE_VERB ("ContactListEditorSaveClose", tb_save_and_close_cb), - BONOBO_UI_UNSAFE_VERB ("ContactListEditorDelete", delete_cb), - BONOBO_UI_UNSAFE_VERB ("ContactListEditorSaveAs", file_save_as_cb), - BONOBO_UI_UNSAFE_VERB ("ContactListEditorSendAs", file_send_as_cb), - BONOBO_UI_UNSAFE_VERB ("ContactListEditorSendTo", file_send_to_cb), - BONOBO_UI_UNSAFE_VERB ("ContactListEditorClose", file_close_cb), - BONOBO_UI_VERB_END -}; - -static EPixmap pixmaps[] = { - E_PIXMAP ("/commands/ContactListEditorSave", "save-16.png"), - E_PIXMAP ("/commands/ContactListEditorSaveClose", "save-16.png"), - E_PIXMAP ("/commands/ContactListEditorSaveAs", "save-as-16.png"), - - E_PIXMAP ("/commands/ContactListEditorDelete", "evolution-trash-mini.png"), -#if 0 /* Envelope printing is disabled for Evolution 1.0. */ - E_PIXMAP ("/commands/ContactListEditorPrint", "print.xpm"), - E_PIXMAP ("/commands/ContactListEditorPrintEnvelope", "print.xpm"), -#endif - E_PIXMAP ("/Toolbar/ContactListEditorSaveClose", "buttons/save-24.png"), - E_PIXMAP ("/Toolbar/ContactListEditorDelete", "buttons/delete-message.png"), - E_PIXMAP ("/Toolbar/ContactListEditorPrint", "buttons/print.png"), - - E_PIXMAP_END -}; - -static void -create_ui (EContactListEditor *ce) -{ - bonobo_ui_component_add_verb_list_with_data ( - ce->uic, verbs, ce); - - bonobo_ui_util_set_ui (ce->uic, EVOLUTION_DATADIR, - "evolution-contact-list-editor.xml", - "evolution-contact-list-editor", NULL); - - e_pixmaps_update (ce->uic, pixmaps); -} - -static void -contact_list_editor_destroy_notify (gpointer data, - GObject *where_the_object_was) -{ - EContactListEditor *ce = E_CONTACT_LIST_EDITOR (data); - - all_contact_list_editors = g_slist_remove (all_contact_list_editors, ce); -} - -EContactListEditor * -e_contact_list_editor_new (EBook *book, - ECard *list_card, - gboolean is_new_list, - gboolean editable) -{ - EContactListEditor *ce = g_object_new (E_TYPE_CONTACT_LIST_EDITOR, NULL); - - all_contact_list_editors = g_slist_prepend (all_contact_list_editors, ce); - g_object_weak_ref (G_OBJECT (ce), contact_list_editor_destroy_notify, ce); - - gtk_object_ref (GTK_OBJECT (ce)); - gtk_object_sink (GTK_OBJECT (ce)); - - g_object_set (ce, - "book", book, - "card", list_card, - "is_new_list", is_new_list, - "editable", editable, - NULL); - - return ce; -} - -static void -e_contact_list_editor_set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) -{ - EContactListEditor *editor; - - editor = E_CONTACT_LIST_EDITOR (object); - - switch (prop_id){ - case PROP_BOOK: - if (editor->book) - g_object_unref (editor->book); - editor->book = E_BOOK(g_value_get_object (value)); - g_object_ref (editor->book); - /* XXX more here about editable/etc. */ - break; - case PROP_CARD: - if (editor->card) - g_object_unref (editor->card); - editor->card = e_card_duplicate(E_CARD(g_value_get_object (value))); - fill_in_info(editor); - editor->changed = FALSE; - command_state_changed (editor); - break; - case PROP_IS_NEW_LIST: { - gboolean new_value = g_value_get_boolean (value); - gboolean changed = (editor->is_new_list != new_value); - - editor->is_new_list = new_value; - - if (changed) - command_state_changed (editor); - break; - } - case PROP_EDITABLE: { - gboolean new_value = g_value_get_boolean (value); - gboolean changed = (editor->editable != new_value); - - editor->editable = new_value; - - if (changed) { - set_editable (editor); - command_state_changed (editor); - } - break; - } - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_contact_list_editor_get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) -{ - EContactListEditor *editor; - - editor = E_CONTACT_LIST_EDITOR (object); - - switch (prop_id) { - case PROP_BOOK: - g_value_set_object (value, editor->book); - break; - - case PROP_CARD: - extract_info(editor); - g_value_set_object (value, editor->card); - break; - - case PROP_IS_NEW_LIST: - g_value_set_boolean (value, editor->is_new_list); - break; - - case PROP_EDITABLE: - g_value_set_boolean (value, editor->editable); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -void -e_contact_list_editor_show (EContactListEditor *editor) -{ - gtk_widget_show (editor->app); -} - -void -e_contact_list_editor_raise (EContactListEditor *editor) -{ - gdk_window_raise (GTK_WIDGET (editor->app)->window); -} - -GtkWidget * -e_contact_list_editor_create_table(gchar *name, - gchar *string1, gchar *string2, - gint int1, gint int2); - -GtkWidget * -e_contact_list_editor_create_table(gchar *name, - gchar *string1, gchar *string2, - gint int1, gint int2) -{ - - ETableModel *model; - GtkWidget *table; - - model = e_contact_list_model_new (); - - table = e_table_scrolled_new_from_spec_file (model, - NULL, - EVOLUTION_ETSPECDIR "/e-contact-list-editor.etspec", - NULL); - - g_object_set_data(G_OBJECT(table), "model", model); - - return table; -} - -static void -add_email_cb (GtkWidget *w, EContactListEditor *editor) -{ - GtkAdjustment *adj = e_scroll_frame_get_vadjustment (E_SCROLL_FRAME (editor->table)); - const char *text = gtk_entry_get_text (GTK_ENTRY(editor->email_entry)); - - if (text && *text) { - e_contact_list_model_add_email (E_CONTACT_LIST_MODEL(editor->model), text); - - /* Skip to the end of the list */ - if (adj->upper - adj->lower > adj->page_size) - gtk_adjustment_set_value (adj, adj->upper); - } - - gtk_entry_set_text (GTK_ENTRY(editor->email_entry), ""); - - editor->changed = TRUE; - - command_state_changed (editor); -} - -static void -remove_row (int model_row, EContactListEditor *editor) -{ - e_contact_list_model_remove_row (E_CONTACT_LIST_MODEL (editor->model), model_row); -} - -static void -remove_entry_cb (GtkWidget *w, EContactListEditor *editor) -{ - e_table_selected_row_foreach (e_table_scrolled_get_table(E_TABLE_SCROLLED(editor->table)), - (EForeachFunc)remove_row, editor); - editor->changed = TRUE; - command_state_changed (editor); -} - -static void -list_name_changed_cb (GtkWidget *w, EContactListEditor *editor) -{ - editor->changed = TRUE; - command_state_changed (editor); -} - -static void -visible_addrs_toggled_cb (GtkWidget *w, EContactListEditor *editor) -{ - editor->changed = TRUE; - command_state_changed (editor); -} - -static void -set_editable (EContactListEditor *editor) -{ - gtk_widget_set_sensitive (editor->email_entry, editor->editable); - gtk_widget_set_sensitive (editor->list_name_entry, editor->editable); - gtk_widget_set_sensitive (editor->add_button, editor->editable); - gtk_widget_set_sensitive (editor->remove_button, editor->editable); - gtk_widget_set_sensitive (editor->table, editor->editable); -} - -/* Closes the dialog box and emits the appropriate signals */ -static void -close_dialog (EContactListEditor *cle) -{ - g_assert (cle->app != NULL); - - gtk_widget_destroy (cle->app); - cle->app = NULL; - - g_signal_emit (cle, contact_list_editor_signals[EDITOR_CLOSED], 0); -} - -/* Callback used when the editor is destroyed */ -static gint -app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) -{ - EContactListEditor *ce; - - ce = E_CONTACT_LIST_EDITOR (data); - - /* if we're in an async call, don't allow the dialog to close */ - if (ce->in_async_call) - return TRUE; - - if (!prompt_to_save_changes (ce)) - return TRUE; - - close_dialog (ce); - return TRUE; -} - -static gboolean -table_drag_motion_cb (ETable *table, int row, int col, - GdkDragContext *context, - gint x, gint y, guint time, EContactListEditor *editor) -{ - GList *p; - - for (p = context->targets; p != NULL; p = p->next) { - char *possible_type; - - possible_type = gdk_atom_name ((GdkAtom) p->data); - if (!strcmp (possible_type, VCARD_TYPE)) { - g_free (possible_type); - gdk_drag_status (context, GDK_ACTION_LINK, time); - return TRUE; - } - - g_free (possible_type); - } - - return FALSE; -} - -static gboolean -table_drag_drop_cb (ETable *table, int row, int col, - GdkDragContext *context, - gint x, gint y, guint time, EContactListEditor *editor) -{ - if (context->targets != NULL) { - gtk_drag_get_data (GTK_WIDGET (table), context, - GDK_POINTER_TO_ATOM (context->targets->data), - time); - return TRUE; - } - - return FALSE; -} - -static void -table_drag_data_received_cb (ETable *table, int row, int col, - GdkDragContext *context, - gint x, gint y, - GtkSelectionData *selection_data, - guint info, guint time, EContactListEditor *editor) -{ - GtkAdjustment *adj = e_scroll_frame_get_vadjustment (E_SCROLL_FRAME (editor->table)); - char *target_type; - gboolean changed = FALSE; - - target_type = gdk_atom_name (selection_data->target); - - if (!strcmp (target_type, VCARD_TYPE)) { - - GList *card_list = e_card_load_cards_from_string_with_default_charset (selection_data->data, "ISO-8859-1"); - GList *c; - - for (c = card_list; c; c = c->next) { - ECard *ecard = c->data; - - if (!e_card_evolution_list (ecard)) { - ECardSimple *simple = e_card_simple_new (ecard); - - e_contact_list_model_add_card (E_CONTACT_LIST_MODEL (editor->model), - simple); - - g_object_unref (simple); - - changed = TRUE; - } - } - g_list_foreach (card_list, (GFunc)g_object_unref, NULL); - g_list_free (card_list); - - /* Skip to the end of the list */ - if (adj->upper - adj->lower > adj->page_size) - gtk_adjustment_set_value (adj, adj->upper); - } - - if (changed) { - editor->changed = TRUE; - command_state_changed (editor); - } -} - -static void -command_state_changed (EContactListEditor *editor) -{ - gboolean named = is_named (editor); - - bonobo_ui_component_set_prop (editor->uic, - "/commands/ContactListEditorSaveClose", - "sensitive", - editor->changed && named && editor->editable ? "1" : "0", NULL); - - bonobo_ui_component_set_prop (editor->uic, - "/commands/ContactListEditorSave", - "sensitive", - editor->changed && named && editor->editable ? "1" : "0", NULL); - - bonobo_ui_component_set_prop (editor->uic, - "/commands/ContactListEditorDelete", - "sensitive", - editor->editable && !editor->is_new_list ? "1" : "0", NULL); -} - -static void -extract_info(EContactListEditor *editor) -{ - ECard *card = editor->card; - if (card) { - int i; - EList *email_list; - EIterator *email_iter; - char *string = gtk_editable_get_chars(GTK_EDITABLE (editor->list_name_entry), 0, -1); - - if (string && *string) - g_object_set (card, - "file_as", string, - "full_name", string, - NULL); - - g_free (string); - - - g_object_set (card, - "list", GINT_TO_POINTER (TRUE), - "list_show_addresses", - GINT_TO_POINTER (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(editor->visible_addrs_checkbutton))), - NULL); - - g_object_get (card, - "email", &email_list, - NULL); - - /* clear the email list */ - email_iter = e_list_get_iterator (email_list); - e_iterator_last (email_iter); - while (e_iterator_is_valid (E_ITERATOR (email_iter))) { - e_iterator_delete (E_ITERATOR (email_iter)); - } - g_object_unref (email_iter); - - /* then refill it from the contact list model */ - for (i = 0; i < e_table_model_row_count (editor->model); i ++) { - const EDestination *dest = e_contact_list_model_get_destination (E_CONTACT_LIST_MODEL (editor->model), i); - gchar *dest_xml = e_destination_export (dest); - if (dest_xml) { - e_list_append (email_list, dest_xml); - } - g_free (dest_xml); - } - } -} - -static void -fill_in_info(EContactListEditor *editor) -{ - if (editor->card) { - char *file_as; - gboolean show_addresses = FALSE; - gboolean is_evolution_list = FALSE; - EList *email_list; - EIterator *email_iter; - - g_object_get (editor->card, - "file_as", &file_as, - "email", &email_list, - "list", &is_evolution_list, - "list_show_addresses", &show_addresses, - NULL); - - gtk_editable_delete_text (GTK_EDITABLE (editor->list_name_entry), 0, -1); - if (file_as) { - int position = 0; - gtk_editable_insert_text (GTK_EDITABLE (editor->list_name_entry), file_as, strlen (file_as), &position); - } - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(editor->visible_addrs_checkbutton), !show_addresses); - - e_contact_list_model_remove_all (E_CONTACT_LIST_MODEL (editor->model)); - - email_iter = e_list_get_iterator (email_list); - - while (e_iterator_is_valid (email_iter)) { - const char *dest_xml = e_iterator_get (email_iter); - EDestination *dest; - - /* g_message ("incoming xml: [%s]", dest_xml); */ - dest = e_destination_import (dest_xml); - - if (dest != NULL) { - e_contact_list_model_add_destination (E_CONTACT_LIST_MODEL (editor->model), dest); - } - - e_iterator_next (email_iter); - } - } -} - - -gboolean -e_contact_list_editor_request_close_all (void) -{ - GSList *p; - GSList *pnext; - gboolean retval; - - retval = TRUE; - for (p = all_contact_list_editors; p != NULL; p = pnext) { - pnext = p->next; - - e_contact_list_editor_raise (E_CONTACT_LIST_EDITOR (p->data)); - if (! prompt_to_save_changes (E_CONTACT_LIST_EDITOR (p->data))) { - retval = FALSE; - break; - } - - close_dialog (E_CONTACT_LIST_EDITOR (p->data)); - } - - return retval; -} diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.etspec b/addressbook/gui/contact-list-editor/e-contact-list-editor.etspec deleted file mode 100644 index 6d5f4f2514..0000000000 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor.etspec +++ /dev/null @@ -1,7 +0,0 @@ -<ETableSpecification no-headers="true" cursor-mode="line" selection-mode="single"> -<ETableColumn model_col= "0" _title="Contact" expansion="1.0" minimum_width="20" resizable="true" cell="string" compare="string" /> - <ETableState> - <column source="0"/> - <grouping> </grouping> - </ETableState> -</ETableSpecification> diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.h b/addressbook/gui/contact-list-editor/e-contact-list-editor.h deleted file mode 100644 index 184145a0f7..0000000000 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor.h +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-list-editor.h - * Copyright (C) 2001 Ximian, Inc. - * Author: Chris Toshok <toshok@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_CONTACT_LIST_EDITOR_H__ -#define __E_CONTACT_LIST_EDITOR_H__ - -#include <libgnomeui/gnome-app.h> -#include <libgnomeui/gnome-app-helper.h> -#include <bonobo/bonobo-ui-component.h> -#include <glade/glade.h> -#include <gal/e-table/e-table-model.h> - -#include "addressbook/backend/ebook/e-book.h" -#include "addressbook/backend/ebook/e-card.h" -#include "addressbook/backend/ebook/e-card-simple.h" - -G_BEGIN_DECLS - -#define E_TYPE_CONTACT_LIST_EDITOR (e_contact_list_editor_get_type ()) -#define E_CONTACT_LIST_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CONTACT_LIST_EDITOR, EContactListEditor)) -#define E_CONTACT_LIST_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CONTACT_LIST_EDITOR, EContactListEditorClass)) -#define E_IS_CONTACT_LIST_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CONTACT_LIST_EDITOR)) -#define E_IS_CONTACT_LIST_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_CONTACT_LIST_EDITOR)) - - -typedef struct _EContactListEditor EContactListEditor; -typedef struct _EContactListEditorClass EContactListEditorClass; - -struct _EContactListEditor -{ - GtkObject object; - - /* item specific fields */ - EBook *book; - ECard *card; - - /* UI handler */ - BonoboUIComponent *uic; - - GladeXML *gui; - GtkWidget *app; - - GtkWidget *table; - ETableModel *model; - GtkWidget *email_entry; - GtkWidget *list_name_entry; - GtkWidget *add_button; - GtkWidget *remove_button; - GtkWidget *visible_addrs_checkbutton; - - /* Whether we are editing a new card or an existing one */ - guint is_new_list : 1; - - /* Whether the card has been changed since bringing up the contact editor */ - guint changed : 1; - - /* Whether the contact editor will accept modifications */ - guint editable : 1; - - /* Whether an async wombat call is in progress */ - guint in_async_call : 1; -}; - -struct _EContactListEditorClass -{ - GtkObjectClass parent_class; - - /* Notification signals */ - - void (* list_added) (EContactListEditor *cle, EBookStatus status, ECard *card); - void (* list_modified) (EContactListEditor *cle, EBookStatus status, ECard *card); - void (* list_deleted) (EContactListEditor *cle, EBookStatus status, ECard *card); - void (* editor_closed) (EContactListEditor *cle); -}; - -EContactListEditor *e_contact_list_editor_new (EBook *book, - ECard *list_card, - gboolean is_new_list, - gboolean editable); -GType e_contact_list_editor_get_type (void); -void e_contact_list_editor_show (EContactListEditor *editor); -void e_contact_list_editor_raise (EContactListEditor *editor); - -gboolean e_contact_list_editor_confirm_delete (GtkWindow *parent); - -gboolean e_contact_list_editor_request_close_all (void); - -G_END_DECLS - - -#endif /* __E_CONTACT_LIST_EDITOR_H__ */ diff --git a/addressbook/gui/contact-list-editor/e-contact-list-model.c b/addressbook/gui/contact-list-editor/e-contact-list-model.c deleted file mode 100644 index 3e4264fa85..0000000000 --- a/addressbook/gui/contact-list-editor/e-contact-list-model.c +++ /dev/null @@ -1,259 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -#include <config.h> -#include "e-contact-list-model.h" - -#define PARENT_TYPE e_table_model_get_type() -static ETableModelClass *parent_class; - -#define COLS 1 - -/* This function returns the number of columns in our ETableModel. */ -static int -contact_list_col_count (ETableModel *etc) -{ - return COLS; -} - -/* This function returns the number of rows in our ETableModel. */ -static int -contact_list_row_count (ETableModel *etc) -{ - EContactListModel *model = E_CONTACT_LIST_MODEL (etc); - return model->data_count; -} - -/* This function returns the value at a particular point in our ETableModel. */ -static void * -contact_list_value_at (ETableModel *etc, int col, int row) -{ - EContactListModel *model = E_CONTACT_LIST_MODEL (etc); - - return (void *) e_destination_get_address (model->data[row]); -} - -/* This function sets the value at a particular point in our ETableModel. */ -static void -contact_list_set_value_at (ETableModel *etc, int col, int row, const void *val) -{ - /* nothing */ -} - -/* This function returns whether a particular cell is editable. */ -static gboolean -contact_list_is_cell_editable (ETableModel *etc, int col, int row) -{ - return FALSE; -} - -/* This function duplicates the value passed to it. */ -static void * -contact_list_duplicate_value (ETableModel *etc, int col, const void *value) -{ - return g_strdup(value); -} - -/* This function frees the value passed to it. */ -static void -contact_list_free_value (ETableModel *etc, int col, void *value) -{ - g_free(value); -} - -static void * -contact_list_initialize_value (ETableModel *etc, int col) -{ - return g_strdup(""); -} - -static gboolean -contact_list_value_is_empty (ETableModel *etc, int col, const void *value) -{ - return !(value && *(char *)value); -} - -static char * -contact_list_value_to_string (ETableModel *etc, int col, const void *value) -{ - return g_strdup(value); -} - -static void -contact_list_model_destroy (GtkObject *o) -{ - EContactListModel *model = E_CONTACT_LIST_MODEL (o); - int i; - - for (i = 0; i < model->data_count; i ++) { - g_object_unref (model->data[i]); - } - g_free (model->data); - - model->data_count = 0; - model->data_alloc = 0; -} - -static void -e_contact_list_model_class_init (GtkObjectClass *object_class) -{ - ETableModelClass *model_class = (ETableModelClass *) object_class; - - parent_class = g_type_class_ref (PARENT_TYPE); - - object_class->destroy = contact_list_model_destroy; - - model_class->column_count = contact_list_col_count; - model_class->row_count = contact_list_row_count; - model_class->value_at = contact_list_value_at; - model_class->set_value_at = contact_list_set_value_at; - model_class->is_cell_editable = contact_list_is_cell_editable; - model_class->duplicate_value = contact_list_duplicate_value; - model_class->free_value = contact_list_free_value; - model_class->initialize_value = contact_list_initialize_value; - model_class->value_is_empty = contact_list_value_is_empty; - model_class->value_to_string = contact_list_value_to_string; -} - -static void -e_contact_list_model_init (GtkObject *object) -{ - EContactListModel *model = E_CONTACT_LIST_MODEL(object); - - model->data_alloc = 10; - model->data_count = 0; - model->data = g_new (EDestination*, model->data_alloc); -} - -GType -e_contact_list_model_get_type (void) -{ - static GType cle_type = 0; - - if (!cle_type) { - static const GTypeInfo cle_info = { - sizeof (EContactListModelClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_contact_list_model_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EContactListModel), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_contact_list_model_init, - }; - - cle_type = g_type_register_static (E_TABLE_MODEL_TYPE, "EContactListModel", &cle_info, 0); - } - - return cle_type; -} - -void -e_contact_list_model_construct (EContactListModel *model) -{ -} - -ETableModel * -e_contact_list_model_new () -{ - EContactListModel *model; - - model = g_object_new (E_TYPE_CONTACT_LIST_MODEL, NULL); - - e_contact_list_model_construct (model); - - return E_TABLE_MODEL(model); -} - -void -e_contact_list_model_add_destination (EContactListModel *model, EDestination *dest) -{ - g_return_if_fail (E_IS_CONTACT_LIST_MODEL (model)); - g_return_if_fail (E_IS_DESTINATION (dest)); - - e_table_model_pre_change (E_TABLE_MODEL (model)); - - if (model->data_count + 1 >= model->data_alloc) { - model->data_alloc *= 2; - model->data = g_renew (EDestination*, model->data, model->data_alloc); - } - - model->data[model->data_count ++] = dest; - g_object_ref (dest); - - e_table_model_changed (E_TABLE_MODEL (model)); -} - -void -e_contact_list_model_add_email (EContactListModel *model, - const char *email) -{ - EDestination *new_dest; - - g_return_if_fail (E_IS_CONTACT_LIST_MODEL (model)); - g_return_if_fail (email != NULL); - - new_dest = e_destination_new (); - e_destination_set_email (new_dest, email); - - e_contact_list_model_add_destination (model, new_dest); -} - -void -e_contact_list_model_add_card (EContactListModel *model, - ECardSimple *simple) -{ - EDestination *new_dest; - - g_return_if_fail (E_IS_CONTACT_LIST_MODEL (model)); - g_return_if_fail (E_IS_CARD_SIMPLE (simple)); - - new_dest = e_destination_new (); - e_destination_set_card (new_dest, simple->card, 0); /* Hard-wired for default e-mail */ - - e_contact_list_model_add_destination (model, new_dest); -} - -void -e_contact_list_model_remove_row (EContactListModel *model, int row) -{ - g_return_if_fail (E_IS_CONTACT_LIST_MODEL (model)); - g_return_if_fail (0 <= row && row < model->data_count); - - e_table_model_pre_change (E_TABLE_MODEL (model)); - - g_object_unref (model->data[row]); - memmove (model->data + row, model->data + row + 1, sizeof (EDestination*) * (model->data_count - row - 1)); - model->data_count --; - - e_table_model_changed (E_TABLE_MODEL (model)); -} - -void -e_contact_list_model_remove_all (EContactListModel *model) -{ - int i; - - g_return_if_fail (E_IS_CONTACT_LIST_MODEL (model)); - - e_table_model_pre_change (E_TABLE_MODEL (model)); - - for (i = 0; i < model->data_count; i ++) { - g_object_unref (model->data[i]); - model->data[i] = NULL; - } - - model->data_count = 0; - - e_table_model_changed (E_TABLE_MODEL (model)); -} - - -const EDestination * -e_contact_list_model_get_destination (EContactListModel *model, int row) -{ - g_return_val_if_fail (E_IS_CONTACT_LIST_MODEL (model), NULL); - g_return_val_if_fail (0 <= row && row < model->data_count, NULL); - - return model->data[row]; -} diff --git a/addressbook/gui/contact-list-editor/e-contact-list-model.h b/addressbook/gui/contact-list-editor/e-contact-list-model.h deleted file mode 100644 index bb07d83544..0000000000 --- a/addressbook/gui/contact-list-editor/e-contact-list-model.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_CONTACT_LIST_MODEL_H_ -#define _E_CONTACT_LIST_MODEL_H_ - -#include <gtk/gtk.h> -#include <gal/e-table/e-table-model.h> -#include "addressbook/backend/ebook/e-book.h" -#include "addressbook/backend/ebook/e-book-view.h" -#include "addressbook/backend/ebook/e-card-simple.h" -#include "addressbook/backend/ebook/e-destination.h" - -G_BEGIN_DECLS - -#define E_TYPE_CONTACT_LIST_MODEL (e_contact_list_model_get_type ()) -#define E_CONTACT_LIST_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_CONTACT_LIST_MODEL, EContactListModel)) -#define E_CONTACT_LIST_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_CONTACT_LIST_MODEL, EContactListModelClass)) -#define E_IS_CONTACT_LIST_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_CONTACT_LIST_MODEL)) -#define E_IS_CONTACT_LIST_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_CONTACT_LIST_MODEL)) - -typedef struct _EContactListModel EContactListModel; -typedef struct _EContactListModelClass EContactListModelClass; - -struct _EContactListModel { - ETableModel parent; - - EDestination **data; - int data_count; - int data_alloc; -}; - - -struct _EContactListModelClass { - ETableModelClass parent_class; -}; - - -GType e_contact_list_model_get_type (void); -void e_contact_list_model_construct (EContactListModel *model); -ETableModel *e_contact_list_model_new (void); - -void e_contact_list_model_add_destination (EContactListModel *model, EDestination *dest); -void e_contact_list_model_add_email (EContactListModel *model, const char *email); -void e_contact_list_model_add_card (EContactListModel *model, ECardSimple *simple); - -void e_contact_list_model_remove_row (EContactListModel *model, int row); -void e_contact_list_model_remove_all (EContactListModel *model); - -const EDestination *e_contact_list_model_get_destination (EContactListModel *model, int row); - -G_END_DECLS - -#endif /* _E_CONTACT_LIST_MODEL_H_ */ diff --git a/addressbook/gui/merging/.cvsignore b/addressbook/gui/merging/.cvsignore deleted file mode 100644 index d6c55c7345..0000000000 --- a/addressbook/gui/merging/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -*.lo -*.la diff --git a/addressbook/gui/merging/Makefile.am b/addressbook/gui/merging/Makefile.am deleted file mode 100644 index 27d3b202e9..0000000000 --- a/addressbook/gui/merging/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -INCLUDES = \ - -DG_LOG_DOMAIN=\"e-card-gui\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -I$(top_srcdir) \ - -I$(top_srcdir)/addressbook/backend \ - -I$(top_builddir)/addressbook/backend \ - -DG_DISABLE_DEPRECATED \ - -DGTK_DISABLE_DEPRECATED \ - -DLIBGNOME_DISABLE_DEPRECATED \ - -DLIBGNOMEUI_DISABLE_DEPRECATED \ - $(EVOLUTION_ADDRESSBOOK_CFLAGS) - -noinst_LIBRARIES = \ - libecardmerging.a - -libecardmerging_a_SOURCES = \ - e-card-merging.c \ - e-card-merging.h - - -gladedir = $(datadir)/evolution/glade -glade_DATA = e-card-duplicate-detected.glade \ - e-card-merging-book-commit-duplicate-detected.glade - -EXTRA_DIST = \ - $(glade_DATA) diff --git a/addressbook/gui/merging/e-card-duplicate-detected.glade b/addressbook/gui/merging/e-card-duplicate-detected.glade deleted file mode 100644 index 67536bf7cf..0000000000 --- a/addressbook/gui/merging/e-card-duplicate-detected.glade +++ /dev/null @@ -1,210 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkDialog" id="dialog-duplicate-contact"> - <property name="visible">True</property> - <property name="title" translatable="yes">Duplicate Contact Detected</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="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">8</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="button3"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Add Anyway</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="response_id">0</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button4"> - <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">1</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="table1"> - <property name="visible">True</property> - <property name="n_rows">5</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="Custom" id="custom-old-card"> - <property name="visible">True</property> - <property name="creation_function">e_card_merging_create_old_card</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Fri, 08 Jun 2001 01:33:22 GMT</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="label" translatable="yes">The name or email address of this contact already exists -in this folder. Would you like to add it anyway?</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">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="label3"> - <property name="visible">True</property> - <property name="label" translatable="yes">Original Contact:</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">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">3</property> - <property name="bottom_attach">4</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label4"> - <property name="visible">True</property> - <property name="label" translatable="yes">New Contact:</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">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">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="Custom" id="custom-new-card"> - <property name="visible">True</property> - <property name="creation_function">e_card_merging_create_old_card</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Fri, 08 Jun 2001 01:33:22 GMT</property> - </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> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment1"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0</property> - <property name="xscale">1</property> - <property name="yscale">0</property> - - <child> - <widget class="Custom" id="custom2"> - <property name="visible">True</property> - <property name="creation_function">e_create_image_widget</property> - <property name="string1">malehead.png</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Fri, 08 Jun 2001 00:18:39 GMT</property> - </widget> - </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">5</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/addressbook/gui/merging/e-card-merging-book-commit-duplicate-detected.glade b/addressbook/gui/merging/e-card-merging-book-commit-duplicate-detected.glade deleted file mode 100644 index 89599a3f7c..0000000000 --- a/addressbook/gui/merging/e-card-merging-book-commit-duplicate-detected.glade +++ /dev/null @@ -1,210 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkDialog" id="dialog-duplicate-contact"> - <property name="visible">True</property> - <property name="title" translatable="yes">Duplicate Contact Detected</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="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">8</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="button3"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Change Anyway</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="response_id">0</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button4"> - <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">1</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="table1"> - <property name="visible">True</property> - <property name="n_rows">5</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="Custom" id="custom-old-card"> - <property name="visible">True</property> - <property name="creation_function">e_card_merging_create_old_card</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Fri, 08 Jun 2001 01:33:22 GMT</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="label" translatable="yes">The changed email or name of this contact already -exists in this folder. Would you like to add it anyway?</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">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="label3"> - <property name="visible">True</property> - <property name="label" translatable="yes">Conflicting Contact:</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">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">3</property> - <property name="bottom_attach">4</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label4"> - <property name="visible">True</property> - <property name="label" translatable="yes">Changed Contact:</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">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">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="Custom" id="custom-new-card"> - <property name="visible">True</property> - <property name="creation_function">e_card_merging_create_old_card</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Fri, 08 Jun 2001 01:33:22 GMT</property> - </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> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment1"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0</property> - <property name="xscale">1</property> - <property name="yscale">0</property> - - <child> - <widget class="Custom" id="custom2"> - <property name="visible">True</property> - <property name="creation_function">e_create_image_widget</property> - <property name="string1">malehead.png</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Fri, 08 Jun 2001 00:18:39 GMT</property> - </widget> - </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">5</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/addressbook/gui/merging/e-card-merging.c b/addressbook/gui/merging/e-card-merging.c deleted file mode 100644 index 1b3da3e063..0000000000 --- a/addressbook/gui/merging/e-card-merging.c +++ /dev/null @@ -1,170 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Code for checking for duplicates when doing ECard work. - * - * Author: - * Christopher James Lahey <clahey@ximian.com> - * - * Copyright 2001, Ximian, Inc. - */ - -#include <config.h> - -#include "e-card-merging.h" -#include <ebook/e-card-compare.h> -#include <glade/glade.h> -#include <gtk/gtksignal.h> -#include "addressbook/gui/widgets/e-minicard-widget.h" - -typedef enum { - E_CARD_MERGING_ADD, - E_CARD_MERGING_COMMIT -} ECardMergingOpType; - -typedef struct { - ECardMergingOpType op; - EBook *book; - ECard *card; - EBookIdCallback id_cb; - EBookCallback cb; - gpointer closure; -} ECardMergingLookup; - -static void -doit (ECardMergingLookup *lookup) -{ - if (lookup->op == E_CARD_MERGING_ADD) - e_book_add_card (lookup->book, lookup->card, lookup->id_cb, lookup->closure); - else if (lookup->op == E_CARD_MERGING_COMMIT) - e_book_commit_card (lookup->book, lookup->card, lookup->cb, lookup->closure); -} - -static void -cancelit (ECardMergingLookup *lookup) -{ - if (lookup->op == E_CARD_MERGING_ADD) { - if (lookup->id_cb) - lookup->id_cb (lookup->book, E_BOOK_STATUS_CANCELLED, NULL, lookup->closure); - } else if (lookup->op == E_CARD_MERGING_COMMIT) { - if (lookup->cb) - lookup->cb (lookup->book, E_BOOK_STATUS_CANCELLED, lookup->closure); - } -} - -static void -response (GtkWidget *dialog, int response, ECardMergingLookup *lookup) -{ - gtk_widget_destroy (dialog); - - switch (response) { - case 0: - doit (lookup); - break; - case 1: - cancelit (lookup); - break; - } - g_free (lookup); -} - -static void -match_query_callback (ECard *card, ECard *match, ECardMatchType type, gpointer closure) -{ - ECardMergingLookup *lookup = closure; - - if ((gint) type <= (gint) E_CARD_MATCH_VAGUE) { - doit (lookup); - g_free (lookup); - } else { - GladeXML *ui; - - GtkWidget *widget; - - if (lookup->op == E_CARD_MERGING_ADD) - ui = glade_xml_new (EVOLUTION_GLADEDIR "/e-card-duplicate-detected.glade", NULL, NULL); - else if (lookup->op == E_CARD_MERGING_COMMIT) - ui = glade_xml_new (EVOLUTION_GLADEDIR "/e-card-merging-book-commit-duplicate-detected.glade", NULL, NULL); - else { - doit (lookup); - g_free (lookup); - return; - } - - widget = glade_xml_get_widget (ui, "custom-old-card"); - g_object_set (widget, - "card", match, - NULL); - - widget = glade_xml_get_widget (ui, "custom-new-card"); - g_object_set (widget, - "card", card, - NULL); - - widget = glade_xml_get_widget (ui, "dialog-duplicate-contact"); - - g_signal_connect (widget, "response", - G_CALLBACK (response), lookup); - - gtk_widget_show_all (widget); - } -} - -gboolean -e_card_merging_book_add_card (EBook *book, - ECard *card, - EBookIdCallback cb, - gpointer closure) -{ - ECardMergingLookup *lookup; - - lookup = g_new (ECardMergingLookup, 1); - - lookup->op = E_CARD_MERGING_ADD; - lookup->book = book; - lookup->card = card; - lookup->id_cb = cb; - lookup->closure = closure; - - e_card_locate_match_full (book, card, NULL, match_query_callback, lookup); - - return TRUE; -} - -gboolean -e_card_merging_book_commit_card (EBook *book, - ECard *card, - EBookCallback cb, - gpointer closure) -{ - ECardMergingLookup *lookup; - GList *avoid; - - lookup = g_new (ECardMergingLookup, 1); - - lookup->op = E_CARD_MERGING_COMMIT; - lookup->book = book; - lookup->card = card; - lookup->cb = cb; - lookup->closure = closure; - - avoid = g_list_append (NULL, card); - - e_card_locate_match_full (book, card, avoid, match_query_callback, lookup); - - g_list_free (avoid); - - return TRUE; -} - -GtkWidget * -e_card_merging_create_old_card(gchar *name, - gchar *string1, gchar *string2, - gint int1, gint int2); - -GtkWidget * -e_card_merging_create_old_card(gchar *name, - gchar *string1, gchar *string2, - gint int1, gint int2) -{ - return e_minicard_widget_new (); -} diff --git a/addressbook/gui/merging/e-card-merging.h b/addressbook/gui/merging/e-card-merging.h deleted file mode 100644 index 8ea1f9f018..0000000000 --- a/addressbook/gui/merging/e-card-merging.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * The Evolution addressbook client object. - * - * Author: - * Christopher James Lahey <clahey@ximian.com> - * - * Copyright 2001, Ximian, Inc. - */ - -#ifndef __E_CARD_MERGING_H__ -#define __E_CARD_MERGING_H__ - -#include <addressbook/backend/ebook/e-book.h> - -G_BEGIN_DECLS - -gboolean e_card_merging_book_add_card (EBook *book, - ECard *card, - EBookIdCallback cb, - gpointer closure); -gboolean e_card_merging_book_commit_card (EBook *book, - ECard *card, - EBookCallback cb, - gpointer closure); - -G_END_DECLS - -#endif /* ! __E_CARD_MERGING_H__ */ diff --git a/addressbook/gui/search/.cvsignore b/addressbook/gui/search/.cvsignore deleted file mode 100644 index d6c55c7345..0000000000 --- a/addressbook/gui/search/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -*.lo -*.la diff --git a/addressbook/gui/search/Makefile.am b/addressbook/gui/search/Makefile.am deleted file mode 100644 index 35ed1a6e49..0000000000 --- a/addressbook/gui/search/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -ruledir = $(datadir)/evolution -rule_DATA = addresstypes.xml - -EXTRA_DIST = addresstypes.xml - -INCLUDES = \ - -DG_LOG_DOMAIN=\"e-addressbook-search\" \ - -I$(top_srcdir) \ - -I$(top_srcdir)/addressbook/backend \ - -I$(top_builddir)/addressbook/backend \ - -I$(top_srcdir)/addressbook/contact-editor \ - -I$(top_srcdir)/widgets/e-text \ - -I$(top_srcdir)/widgets/misc \ - -I$(top_builddir)/shell \ - -DSEARCH_RULE_DIR=\"$(ruledir)\" \ - -DG_DISABLE_DEPRECATED \ - -DGTK_DISABLE_DEPRECATED \ - -DLIBGNOME_DISABLE_DEPRECATED \ - -DLIBGNOMEUI_DISABLE_DEPRECATED \ - $(EVOLUTION_ADDRESSBOOK_CFLAGS) - -noinst_LIBRARIES = \ - libeaddressbooksearch.a - -libeaddressbooksearch_a_SOURCES = \ - e-addressbook-search-dialog.c \ - e-addressbook-search-dialog.h diff --git a/addressbook/gui/search/addresstypes.xml b/addressbook/gui/search/addresstypes.xml deleted file mode 100644 index 4ee23af613..0000000000 --- a/addressbook/gui/search/addresstypes.xml +++ /dev/null @@ -1,83 +0,0 @@ -<?xml version="1.0"?> -<filterdescription> -<partset> - <part name="name"> - <title>Name</title> - <input type="optionlist" name="name-type"> - <option value="contains"> - <title>contains</title> - <code>(contains "full_name" ${name})</code> - </option> - <option value="not contains"> - <title>does not contain</title> - <code>(not (contains "full_name" ${name}))</code> - </option> - <option value="is"> - <title>is</title> - <code>(is "full_name" ${name})))</code> - </option> - <option value="is not"> - <title>is not</title> - <code>(not (is "full_name" ${name}))</code> - </option> - <option value="begin"> - <title>begins with</title> - <code>(beginswith "full_name" ${name})</code> - </option> - <option value="end"> - <title>ends in</title> - <code>(endswith "full_name" ${name})</code> - </option> - </input> - <input type="string" name="name"/> - </part> - <part name="email"> - <title>Email</title> - <input type="optionlist" name="email-type"> - <option value="contains"> - <title>contains</title> - <code>(contains "email" ${email})</code> - </option> - <option value="not contains"> - <title>does not contain</title> - <code>(not (contains "email" ${email}))</code> - </option> - <option value="is"> - <title>is</title> - <code>(is "email" ${email})</code> - </option> - <option value="is not"> - <title>is not</title> - <code>(not (is "email" ${email}))</code> - </option> - </input> - <input type="address" name="email"/> - </part> - <part name="category"> - <title>Category</title> - <input type="optionlist" name="category-type"> - <option value="contains"> - <title>contains</title> - <code>(contains "category" ${category})</code> - </option> - <option value="not contains"> - <title>does not contain</title> - <code>(not (contains "category" ${category}))</code> - </option> - <option value="is"> - <title>is</title> - <code>(is "category" ${category})</code> - </option> - <option value="is not"> - <title>is not</title> - <code>(not (is "category" ${category}))</code> - </option> - </input> - <input type="string" name="category"/> - </part> - <part name="sexp"> - <title>Expression</title> - <input type="code" name="code"/> - </part> -</partset> -</filterdescription> diff --git a/addressbook/gui/search/e-addressbook-search-dialog.c b/addressbook/gui/search/e-addressbook-search-dialog.c deleted file mode 100644 index 157d22cbad..0000000000 --- a/addressbook/gui/search/e-addressbook-search-dialog.c +++ /dev/null @@ -1,159 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-addressbook-search-dialog.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 <gtk/gtkbox.h> -#include <gtk/gtkentry.h> -#include <gtk/gtkstock.h> -#include <libgnome/gnome-i18n.h> -#include "gal/util/e-util.h" - -#include "e-addressbook-search-dialog.h" - - -static void e_addressbook_search_dialog_init (EAddressbookSearchDialog *widget); -static void e_addressbook_search_dialog_class_init (EAddressbookSearchDialogClass *klass); -static void e_addressbook_search_dialog_dispose (GObject *object); - -static GtkDialog *parent_class = NULL; - -#define PARENT_TYPE GTK_TYPE_DIALOG - -E_MAKE_TYPE (e_addressbook_search_dialog, - "EAddressbookSearchDialog", - EAddressbookSearchDialog, - e_addressbook_search_dialog_class_init, - e_addressbook_search_dialog_init, - PARENT_TYPE) - -static void -e_addressbook_search_dialog_class_init (EAddressbookSearchDialogClass *klass) -{ - GObjectClass *object_class; - - object_class = (GObjectClass*) klass; - - parent_class = g_type_class_ref (PARENT_TYPE); - - object_class->dispose = e_addressbook_search_dialog_dispose; -} - -static GtkWidget * -get_widget (EAddressbookSearchDialog *view) -{ - FilterPart *part; - - view->context = rule_context_new(); - /* FIXME: hide this in a class */ - rule_context_add_part_set(view->context, "partset", filter_part_get_type(), - rule_context_add_part, rule_context_next_part); - rule_context_load(view->context, SEARCH_RULE_DIR "/addresstypes.xml", ""); - view->rule = filter_rule_new(); - part = rule_context_next_part(view->context, NULL); - if (part == NULL) { - g_warning("Problem loading search for addressbook no parts to load"); - return gtk_entry_new(); - } else { - filter_rule_add_part(view->rule, filter_part_clone(part)); - return filter_rule_get_widget(view->rule, view->context); - } -} - -static char * -get_query (EAddressbookSearchDialog *view) -{ - GString *out = g_string_new(""); - char *ret; - - filter_rule_build_code(view->rule, out); - ret = out->str; - printf("Searching using %s\n", ret); - g_string_free(out, FALSE); - return ret; -} - -static void -dialog_response (GtkWidget *widget, int response_id, EAddressbookSearchDialog *dialog) -{ - char *query; - - if (response_id == GTK_RESPONSE_OK) { - query = get_query(dialog); - g_object_set(dialog->view, - "query", query, - NULL); - g_free(query); - } - - gtk_widget_destroy(GTK_WIDGET (dialog)); -} - -static void -e_addressbook_search_dialog_init (EAddressbookSearchDialog *view) -{ - GtkDialog *dialog = GTK_DIALOG (view); - - gtk_window_set_policy(GTK_WINDOW(view), FALSE, TRUE, FALSE); - gtk_window_set_default_size (GTK_WINDOW (view), 550, 400); - gtk_window_set_title(GTK_WINDOW(view), _("Advanced Search")); - view->search = get_widget(view); - gtk_box_pack_start(GTK_BOX(dialog->vbox), view->search, TRUE, TRUE, 0); - gtk_widget_show(view->search); - - gtk_dialog_add_buttons (dialog, - GTK_STOCK_OK, GTK_RESPONSE_OK, - /*GTK_STOCK_SAVE, GTK_RESPONSE_APPLY,*/ - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - NULL); - - gtk_dialog_set_default_response (dialog, GTK_RESPONSE_OK); - - g_signal_connect(dialog, "response", - G_CALLBACK(dialog_response), view); -} - -GtkWidget * -e_addressbook_search_dialog_new (EAddressbookView *addr_view) -{ - EAddressbookSearchDialog *view = g_object_new (E_ADDRESSBOOK_SEARCH_DIALOG_TYPE, NULL); - view->view = addr_view; - return GTK_WIDGET(view); -} - -static void -e_addressbook_search_dialog_dispose (GObject *object) -{ - EAddressbookSearchDialog *view; - - view = E_ADDRESSBOOK_SEARCH_DIALOG (object); - - if (view->context) { - g_object_unref(view->context); - view->context = NULL; - } - if (view->rule) { - g_object_unref(view->rule); - view->rule = NULL; - } - - G_OBJECT_CLASS(parent_class)->dispose (object); -} diff --git a/addressbook/gui/search/e-addressbook-search-dialog.h b/addressbook/gui/search/e-addressbook-search-dialog.h deleted file mode 100644 index 4be0050ca0..0000000000 --- a/addressbook/gui/search/e-addressbook-search-dialog.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard-view-widget.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_ADDRESSBOOK_SEARCH_DIALOG_H__ -#define __E_ADDRESSBOOK_SEARCH_DIALOG_H__ - -#include <ebook/e-book.h> - -#include "addressbook/gui/widgets/e-addressbook-view.h" -#include "filter/rule-context.h" -#include "filter/filter-rule.h" -#include <gtk/gtkdialog.h> - -G_BEGIN_DECLS - -#define E_ADDRESSBOOK_SEARCH_DIALOG_TYPE (e_addressbook_search_dialog_get_type ()) -#define E_ADDRESSBOOK_SEARCH_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_ADDRESSBOOK_SEARCH_DIALOG_TYPE, EAddressbookSearchDialog)) -#define E_ADDRESSBOOK_SEARCH_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_ADDRESSBOOK_SEARCH_DIALOG_TYPE, EAddressbookSearchDialogClass)) -#define E_IS_ADDRESSBOOK_SEARCH_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_ADDRESSBOOK_SEARCH_DIALOG_TYPE)) -#define E_IS_ADDRESSBOOK_SEARCH_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_ADDRESSBOOK_SEARCH_DIALOG_TYPE)) - - -typedef struct _EAddressbookSearchDialog EAddressbookSearchDialog; -typedef struct _EAddressbookSearchDialogClass EAddressbookSearchDialogClass; - -struct _EAddressbookSearchDialog -{ - GtkDialog parent; - - GtkWidget *search; - - EAddressbookView *view; - - RuleContext *context; - FilterRule *rule; -}; - -struct _EAddressbookSearchDialogClass -{ - GtkDialogClass parent_class; -}; - -GType e_addressbook_search_dialog_get_type (void); - -GtkWidget *e_addressbook_search_dialog_new (EAddressbookView *view); - -G_END_DECLS - -#endif /* __E_ADDRESSBOOK_SEARCH_DIALOG_H__ */ diff --git a/addressbook/gui/widgets/.cvsignore b/addressbook/gui/widgets/.cvsignore deleted file mode 100644 index 8f18401976..0000000000 --- a/addressbook/gui/widgets/.cvsignore +++ /dev/null @@ -1,14 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -*.lo -*.la -minicard-label-test -minicard-test -minicard-view-test -minicard-widget-test -reflow-test -e-addressbook-marshal.c -e-addressbook-marshal.h diff --git a/addressbook/gui/widgets/Makefile.am b/addressbook/gui/widgets/Makefile.am deleted file mode 100644 index 01a139b8ba..0000000000 --- a/addressbook/gui/widgets/Makefile.am +++ /dev/null @@ -1,165 +0,0 @@ -INCLUDES = \ - -DG_LOG_DOMAIN=\"e-minicard\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DEVOLUTION_IMAGESDIR=\""$(datadir)"/evolution/images\" \ - -I$(top_srcdir) \ - -I$(top_srcdir)/addressbook/backend \ - -I$(top_builddir)/addressbook/backend \ - -I$(top_srcdir)/addressbook/gui/contact-editor \ - -I$(top_srcdir)/addressbook/gui/merging \ - -I$(top_srcdir)/addressbook/gui/component \ - -I$(top_srcdir)/widgets/misc \ - -I$(top_builddir)/shell \ - -DG_DISABLE_DEPRECATED \ - -DGTK_DISABLE_DEPRECATED \ - -DLIBGNOME_DISABLE_DEPRECATED \ - -DLIBGNOMEUI_DISABLE_DEPRECATED \ - $(EVOLUTION_ADDRESSBOOK_CFLAGS) - -noinst_LIBRARIES = \ - libeminicard.a - -libeminicard_a_SOURCES = \ - e-addressbook-marshal.c \ - e-addressbook-reflow-adapter.c \ - e-addressbook-reflow-adapter.h \ - e-addressbook-table-adapter.c \ - e-addressbook-table-adapter.h \ - e-addressbook-model.c \ - e-addressbook-model.h \ - e-addressbook-util.c \ - e-addressbook-util.h \ - e-addressbook-view.c \ - e-addressbook-view.h \ - e-minicard-control.c \ - e-minicard-control.h \ - e-minicard-label.c \ - e-minicard-label.h \ - e-minicard-view-widget.c \ - e-minicard-view-widget.h \ - e-minicard-view.c \ - e-minicard-view.h \ - e-minicard-widget.c \ - e-minicard-widget.h \ - e-minicard.c \ - e-minicard.h \ - gal-view-factory-minicard.c \ - gal-view-factory-minicard.h \ - gal-view-minicard.c \ - gal-view-minicard.h - -#TREEVIEW_SOURCES= e-addressbook-treeview-adapter.c \ -# e-addressbook-treeview-adapter.h \ -# gal-view-factory-treeview.c \ -# gal-view-factory-treeview.h \ -# gal-view-treeview.c \ -# gal-view-treeview.h - -# GLib marshalling cruft - -e-addressbook-marshal.h: e-addressbook-marshal.list - ( @GLIB_GENMARSHAL@ --prefix=e_addressbook_marshal e-addressbook-marshal.list --header > e-addressbook-marshal.tmp \ - && mv e-addressbook-marshal.tmp e-addressbook-marshal.h ) \ - || ( rm -f e-addressbook-marshal.tmp && exit 1 ) - -e-addressbook-marshal.c: e-addressbook-marshal.h - ( @GLIB_GENMARSHAL@ --prefix=e_addressbook_marshal e-addressbook-marshal.list --body > e-addressbook-marshal.tmp \ - && mv e-addressbook-marshal.tmp e-addressbook-marshal.c ) \ - || ( rm -f e-addressbook-marshal.tmp && exit 1 ) - -MARSHAL_GENERATED = e-addressbook-marshal.c e-addressbook-marshal.h - -#noinst_PROGRAMS = \ -# minicard-widget-test \ -# minicard-label-test \ -# minicard-test -## reflow-test -## minicard-view-test -# -#minicard_label_test_SOURCES = \ -# test-minicard-label.c -# -#minicard_label_test_LDADD = \ -# libeminicard.a \ -# $(EVOLUTION_ADDRESSBOOK_LIBS) \ -# $(top_builddir)/e-util/libeutil.la -# -#minicard_test_SOURCES = \ -# test-minicard.c -# -#minicard_test_LDADD = \ -# libeminicard.a \ -# $(top_builddir)/addressbook/backend/ebook/libebook.la \ -# $(top_builddir)/e-util/libeutil.la \ -# $(top_builddir)/libversit/libversit.la \ -# $(top_builddir)/e-util/ename/libename.la \ -# $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.a \ -# $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.a \ -# $(top_builddir)/addressbook/printing/libecontactprint.a \ -# $(top_builddir)/addressbook/gui/merging/libecardmerging.a \ -# $(top_builddir)/widgets/misc/libemiscwidgets.a \ -# $(top_builddir)/addressbook/gui/component/select-names/libeselectnames.la \ -# $(top_builddir)/e-util/libeutil.la \ -# $(EVOLUTION_ADDRESSBOOK_LIBS) \ -# libeminicard.a -# -#reflow_test_SOURCES = \ -# test-reflow.c -# -#reflow_test_LDADD = \ -# libeminicard.a \ -# $(top_builddir)/addressbook/backend/ebook/libebook.la \ -# $(top_builddir)/e-util/libeutil.la \ -# $(top_builddir)/libversit/libversit.la \ -# $(top_builddir)/e-util/ename/libename.la \ -# $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \ -# $(top_builddir)/addressbook/printing/libecontactprint.a \ -# $(top_builddir)/widgets/misc/libemiscwidgets.a \ -# $(top_builddir)/e-util/libeutil.la \ -# $(EVOLUTION_ADDRESSBOOK_LIBS) - -#minicard_view_test_SOURCES = \ -# test-minicard-view.c - -#minicard_view_test_LDADD = \ -# $(EVOLUTION_ADDRESSBOOK_LIBS) -# libeminicard.a \ -# $(top_builddir)/addressbook/backend/ebook/libebook.la \ -# $(top_builddir)/e-util/libeutil.la \ -# $(top_builddir)/libversit/libversit.la \ -# $(top_builddir)/addressbook/ename/libename.la \ -# $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \ -# $(top_builddir)/addressbook/printing/libecontactprint.a \ -# $(top_builddir)/widgets/misc/libemiscwidgets.a \ -# $(top_builddir)/e-util/libeutil.la -# -#minicard_widget_test_SOURCES = \ -# e-minicard-widget-test.c -# -#minicard_widget_test_LDADD = \ -# libeminicard.a \ -# $(top_builddir)/addressbook/backend/ebook/libebook.la \ -# $(top_builddir)/e-util/libeutil.la \ -# $(top_builddir)/libversit/libversit.la \ -# $(top_builddir)/e-util/ename/libename.la \ -# $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.a \ -# $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.a \ -# $(top_builddir)/addressbook/gui/component/select-names/libeselectnames.la \ -# $(top_builddir)/addressbook/printing/libecontactprint.a \ -# $(top_builddir)/widgets/misc/libemiscwidgets.a \ -# $(top_builddir)/e-util/libeutil.la \ -# $(top_builddir)/addressbook/gui/merging/libecardmerging.a \ -# $(EVOLUTION_ADDRESSBOOK_LIBS) - -gladedir = $(datadir)/evolution/glade -glade_DATA = - -etspecdir = $(datadir)/evolution/etspec -etspec_DATA= e-addressbook-view.etspec - -EXTRA_DIST = \ - $(glade_DATA) \ - $(etspec_DATA) \ - e-addressbook-marshal.list diff --git a/addressbook/gui/widgets/e-addressbook-marshal.list b/addressbook/gui/widgets/e-addressbook-marshal.list deleted file mode 100644 index 8f97e48e86..0000000000 --- a/addressbook/gui/widgets/e-addressbook-marshal.list +++ /dev/null @@ -1,10 +0,0 @@ -INT:POINTER -NONE:NONE -NONE:BOOL -NONE:POINTER -NONE:ENUM -NONE:INT,INT -NONE:INT -NONE:UINT -NONE:DOUBLE -INT:POINTER diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c deleted file mode 100644 index 1d5b228bac..0000000000 --- a/addressbook/gui/widgets/e-addressbook-model.c +++ /dev/null @@ -1,682 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * - * Author: - * Christopher James Lahey <clahey@ximian.com> - * - * (C) 1999 Ximian, Inc. - */ - -#include <config.h> -#include "e-addressbook-marshal.h" -#include "e-addressbook-model.h" -#include <libxml/tree.h> -#include <libxml/parser.h> -#include <libxml/xmlmemory.h> -#include <gnome.h> -#include <gal/widgets/e-gui-utils.h> -#include "e-addressbook-util.h" -#include "e-addressbook-marshal.h" - -#define PARENT_TYPE G_TYPE_OBJECT -GObjectClass *parent_class; - -/* - * EAddressbookModel callbacks - * These are the callbacks that define the behavior of our custom model. - */ -static void e_addressbook_model_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void e_addressbook_model_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); - - -enum { - PROP_0, - PROP_BOOK, - PROP_QUERY, - PROP_EDITABLE, -}; - -enum { - WRITABLE_STATUS, - STATUS_MESSAGE, - SEARCH_RESULT, - FOLDER_BAR_MESSAGE, - CARD_ADDED, - CARD_REMOVED, - CARD_CHANGED, - MODEL_CHANGED, - STOP_STATE_CHANGED, - BACKEND_DIED, - LAST_SIGNAL -}; - -#define COLS (E_CARD_SIMPLE_FIELD_LAST) - -static guint e_addressbook_model_signals [LAST_SIGNAL] = {0, }; - -static void -free_data (EAddressbookModel *model) -{ - if (model->data) { - int i; - - for ( i = 0; i < model->data_count; i++ ) { - g_object_unref (model->data[i]); - } - - g_free(model->data); - model->data = NULL; - model->data_count = 0; - model->allocated_count = 0; - } -} - -static void -remove_book_view(EAddressbookModel *model) -{ - if (model->book_view && model->create_card_id) - g_signal_handler_disconnect (model->book_view, - model->create_card_id); - if (model->book_view && model->remove_card_id) - g_signal_handler_disconnect (model->book_view, - model->remove_card_id); - if (model->book_view && model->modify_card_id) - g_signal_handler_disconnect (model->book_view, - model->modify_card_id); - if (model->book_view && model->status_message_id) - g_signal_handler_disconnect (model->book_view, - model->status_message_id); - if (model->book_view && model->sequence_complete_id) - g_signal_handler_disconnect (model->book_view, - model->sequence_complete_id); - - model->create_card_id = 0; - model->remove_card_id = 0; - model->modify_card_id = 0; - model->status_message_id = 0; - model->sequence_complete_id = 0; - - model->search_in_progress = FALSE; - - if (model->book_view) { - e_book_view_stop (model->book_view); - g_object_unref (model->book_view); - model->book_view = NULL; - } -} - -static void -addressbook_dispose(GObject *object) -{ - EAddressbookModel *model = E_ADDRESSBOOK_MODEL(object); - - if (model->get_view_idle) { - g_source_remove(model->get_view_idle); - model->get_view_idle = 0; - } - - remove_book_view(model); - free_data (model); - - if (model->book) { - if (model->writable_status_id) - g_signal_handler_disconnect (model->book, - model->writable_status_id); - model->writable_status_id = 0; - - if (model->backend_died_id) - g_signal_handler_disconnect (model->book, - model->backend_died_id); - model->backend_died_id = 0; - - g_object_unref (model->book); - model->book = NULL; - } - - if (model->query) { - g_free (model->query); - model->query = NULL; - } - - if (G_OBJECT_CLASS(parent_class)->dispose) - G_OBJECT_CLASS(parent_class)->dispose(object); -} - -static void -update_folder_bar_message (EAddressbookModel *model) -{ - int count; - char *message; - - count = model->data_count; - - switch (count) { - case 0: - message = g_strdup (_("No cards")); - break; - case 1: - message = g_strdup (_("1 card")); - break; - default: - message = g_strdup_printf (_("%d cards"), count); - break; - } - - g_signal_emit (model, - e_addressbook_model_signals [FOLDER_BAR_MESSAGE], 0, - message); - - g_free (message); -} - -static void -create_card(EBookView *book_view, - const GList *cards, - EAddressbookModel *model) -{ - int old_count = model->data_count; - int length = g_list_length ((GList *)cards); - - if (model->data_count + length > model->allocated_count) { - while (model->data_count + length > model->allocated_count) - model->allocated_count = model->allocated_count * 2 + 1; - model->data = g_renew(ECard *, model->data, model->allocated_count); - } - - for ( ; cards; cards = cards->next) { - model->data[model->data_count++] = cards->data; - g_object_ref (cards->data); - } - - g_signal_emit (model, - e_addressbook_model_signals [CARD_ADDED], 0, - old_count, model->data_count - old_count); - - update_folder_bar_message (model); -} - -static void -remove_card(EBookView *book_view, - const char *id, - EAddressbookModel *model) -{ - int i; - - for ( i = 0; i < model->data_count; i++) { - if ( !strcmp(e_card_get_id(model->data[i]), id) ) { - g_object_unref (model->data[i]); - memmove(model->data + i, model->data + i + 1, (model->data_count - i - 1) * sizeof (ECard *)); - model->data_count--; - - g_signal_emit (model, - e_addressbook_model_signals [CARD_REMOVED], 0, - i); - update_folder_bar_message (model); - break; - } - } -} - -static void -modify_card(EBookView *book_view, - const GList *cards, - EAddressbookModel *model) -{ - for ( ; cards; cards = cards->next) { - int i; - for ( i = 0; i < model->data_count; i++) { - if ( !strcmp(e_card_get_id(model->data[i]), e_card_get_id(E_CARD(cards->data))) ) { - g_object_unref (model->data[i]); - model->data[i] = e_card_duplicate(E_CARD(cards->data)); - g_signal_emit (model, - e_addressbook_model_signals [CARD_CHANGED], 0, - i); - break; - } - } - } -} - -static void -status_message (EBookView *book_view, - char* status, - EAddressbookModel *model) -{ - g_signal_emit (model, - e_addressbook_model_signals [STATUS_MESSAGE], 0, - status); -} - -static void -sequence_complete (EBookView *book_view, - EBookViewStatus status, - EAddressbookModel *model) -{ - model->search_in_progress = FALSE; - status_message (book_view, NULL, model); - g_signal_emit (model, - e_addressbook_model_signals [SEARCH_RESULT], 0, - status); - g_signal_emit (model, - e_addressbook_model_signals [STOP_STATE_CHANGED], 0); -} - -static void -writable_status (EBook *book, - gboolean writable, - EAddressbookModel *model) -{ - if (!model->editable_set) { - model->editable = writable; - - g_signal_emit (model, - e_addressbook_model_signals [WRITABLE_STATUS], 0, - writable); - } -} - -static void -backend_died (EBook *book, - EAddressbookModel *model) -{ - g_signal_emit (model, - e_addressbook_model_signals [BACKEND_DIED], 0); -} - -static void -e_addressbook_model_class_init (GObjectClass *object_class) -{ - parent_class = g_type_class_ref (PARENT_TYPE); - - object_class->dispose = addressbook_dispose; - object_class->set_property = e_addressbook_model_set_property; - object_class->get_property = e_addressbook_model_get_property; - - g_object_class_install_property (object_class, PROP_BOOK, - g_param_spec_object ("book", - _("Book"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_BOOK, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_QUERY, - g_param_spec_string ("query", - _("Query"), - /*_( */"XXX blurb" /*)*/, - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EDITABLE, - g_param_spec_boolean ("editable", - _("Editable"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); - - e_addressbook_model_signals [WRITABLE_STATUS] = - g_signal_new ("writable_status", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, writable_status), - NULL, NULL, - e_addressbook_marshal_NONE__BOOL, - G_TYPE_NONE, - 1, G_TYPE_BOOLEAN); - - e_addressbook_model_signals [STATUS_MESSAGE] = - g_signal_new ("status_message", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, status_message), - NULL, NULL, - e_addressbook_marshal_NONE__POINTER, - G_TYPE_NONE, - 1, G_TYPE_POINTER); - - e_addressbook_model_signals [SEARCH_RESULT] = - g_signal_new ("search_result", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, search_result), - NULL, NULL, - e_addressbook_marshal_NONE__INT, - G_TYPE_NONE, 1, G_TYPE_INT); - - e_addressbook_model_signals [FOLDER_BAR_MESSAGE] = - g_signal_new ("folder_bar_message", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, folder_bar_message), - NULL, NULL, - e_addressbook_marshal_NONE__POINTER, - G_TYPE_NONE, 1, G_TYPE_POINTER); - - e_addressbook_model_signals [CARD_ADDED] = - g_signal_new ("card_added", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, card_added), - NULL, NULL, - e_addressbook_marshal_NONE__INT_INT, - G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); - - e_addressbook_model_signals [CARD_REMOVED] = - g_signal_new ("card_removed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, card_removed), - NULL, NULL, - e_addressbook_marshal_NONE__INT, - G_TYPE_NONE, 1, G_TYPE_INT); - - e_addressbook_model_signals [CARD_CHANGED] = - g_signal_new ("card_changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, card_changed), - NULL, NULL, - e_addressbook_marshal_NONE__INT, - G_TYPE_NONE, 1, G_TYPE_INT); - - e_addressbook_model_signals [MODEL_CHANGED] = - g_signal_new ("model_changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, model_changed), - NULL, NULL, - e_addressbook_marshal_NONE__NONE, - G_TYPE_NONE, 0); - - e_addressbook_model_signals [STOP_STATE_CHANGED] = - g_signal_new ("stop_state_changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, stop_state_changed), - NULL, NULL, - e_addressbook_marshal_NONE__NONE, - G_TYPE_NONE, 0); - - e_addressbook_model_signals [BACKEND_DIED] = - g_signal_new ("backend_died", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, backend_died), - NULL, NULL, - e_addressbook_marshal_NONE__NONE, - G_TYPE_NONE, 0); -} - -static void -e_addressbook_model_init (GObject *object) -{ - EAddressbookModel *model = E_ADDRESSBOOK_MODEL(object); - model->book = NULL; - model->query = g_strdup("(contains \"x-evolution-any-field\" \"\")"); - model->book_view = NULL; - model->get_view_idle = 0; - model->create_card_id = 0; - model->remove_card_id = 0; - model->modify_card_id = 0; - model->status_message_id = 0; - model->writable_status_id = 0; - model->backend_died_id = 0; - model->sequence_complete_id = 0; - model->data = NULL; - model->data_count = 0; - model->allocated_count = 0; - model->search_in_progress = FALSE; - model->editable = FALSE; - model->editable_set = FALSE; - model->first_get_view = TRUE; -} - -static void -book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointer closure) -{ - EAddressbookModel *model = closure; - - remove_book_view(model); - - if (status != E_BOOK_STATUS_SUCCESS) { - e_addressbook_error_dialog (_("Error getting book view"), status); - return; - } - - model->book_view = book_view; - if (model->book_view) - g_object_ref (model->book_view); - model->create_card_id = g_signal_connect(model->book_view, - "card_added", - G_CALLBACK (create_card), - model); - model->remove_card_id = g_signal_connect(model->book_view, - "card_removed", - G_CALLBACK (remove_card), - model); - model->modify_card_id = g_signal_connect(model->book_view, - "card_changed", - G_CALLBACK(modify_card), - model); - model->status_message_id = g_signal_connect(model->book_view, - "status_message", - G_CALLBACK(status_message), - model); - model->sequence_complete_id = g_signal_connect(model->book_view, - "sequence_complete", - G_CALLBACK(sequence_complete), - model); - - free_data (model); - - model->search_in_progress = TRUE; - g_signal_emit (model, - e_addressbook_model_signals [MODEL_CHANGED], 0); - g_signal_emit (model, - e_addressbook_model_signals [STOP_STATE_CHANGED], 0); -} - -static gboolean -get_view (EAddressbookModel *model) -{ - if (model->book && model->query) { - if (model->first_get_view) { - char *capabilities; - capabilities = e_book_get_static_capabilities (model->book); - if (capabilities && strstr (capabilities, "do-initial-query")) { - e_book_get_book_view (model->book, model->query, book_view_loaded, model); - } else { - remove_book_view(model); - free_data (model); - g_signal_emit (model, - e_addressbook_model_signals [MODEL_CHANGED], 0); - g_signal_emit (model, - e_addressbook_model_signals [STOP_STATE_CHANGED], 0); - } - model->first_get_view = FALSE; - g_free (capabilities); - } - else - e_book_get_book_view (model->book, model->query, book_view_loaded, model); - } - - model->get_view_idle = 0; - return FALSE; -} - -ECard * -e_addressbook_model_get_card(EAddressbookModel *model, - int row) -{ - if (model->data && 0 <= row && row < model->data_count) { - ECard *card; - card = e_card_duplicate (model->data[row]); - return card; - } - return NULL; -} - -const ECard * -e_addressbook_model_peek_card(EAddressbookModel *model, - int row) -{ - if (model->data && 0 <= row && row < model->data_count) { - return model->data[row]; - } - return NULL; -} - -static void -e_addressbook_model_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - EAddressbookModel *model; - - model = E_ADDRESSBOOK_MODEL (object); - - switch (prop_id){ - case PROP_BOOK: - if (model->book) { - if (model->writable_status_id) - g_signal_handler_disconnect (model->book, - model->writable_status_id); - model->writable_status_id = 0; - - if (model->backend_died_id) - g_signal_handler_disconnect (model->book, - model->backend_died_id); - model->backend_died_id = 0; - - g_object_unref (model->book); - } - model->book = E_BOOK(g_value_get_object (value)); - if (model->book) { - model->first_get_view = TRUE; - g_object_ref (model->book); - if (model->get_view_idle == 0) - model->get_view_idle = g_idle_add((GSourceFunc)get_view, model); - g_signal_connect (model->book, - "writable_status", - G_CALLBACK (writable_status), model); - g_signal_connect (model->book, - "backend_died", - G_CALLBACK (backend_died), model); - } - break; - case PROP_QUERY: - if (model->query) - g_free(model->query); - model->query = g_strdup(g_value_get_string (value)); - if (model->get_view_idle == 0) - model->get_view_idle = g_idle_add((GSourceFunc)get_view, model); - break; - case PROP_EDITABLE: - model->editable = g_value_get_boolean (value); - model->editable_set = TRUE; - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_addressbook_model_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - EAddressbookModel *e_addressbook_model; - - e_addressbook_model = E_ADDRESSBOOK_MODEL (object); - - switch (prop_id) { - case PROP_BOOK: - g_value_set_object (value, e_addressbook_model->book); - break; - case PROP_QUERY: - g_value_set_string (value, g_strdup(e_addressbook_model->query)); - break; - case PROP_EDITABLE: - g_value_set_boolean (value, e_addressbook_model->editable); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -GType -e_addressbook_model_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (EAddressbookModelClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_addressbook_model_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EAddressbookModel), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_addressbook_model_init, - }; - - type = g_type_register_static (PARENT_TYPE, "EAddressbookModel", &info, 0); - } - - return type; -} - -EAddressbookModel* -e_addressbook_model_new (void) -{ - EAddressbookModel *et; - - et = g_object_new (E_TYPE_ADDRESSBOOK_MODEL, NULL); - - return et; -} - -void e_addressbook_model_stop (EAddressbookModel *model) -{ - remove_book_view(model); - g_signal_emit (model, - e_addressbook_model_signals [STOP_STATE_CHANGED], 0); - g_signal_emit (model, - e_addressbook_model_signals [STATUS_MESSAGE], 0, - "Search Interrupted."); -} - -gboolean -e_addressbook_model_can_stop (EAddressbookModel *model) -{ - return model->search_in_progress; -} - -void -e_addressbook_model_force_folder_bar_message (EAddressbookModel *model) -{ - update_folder_bar_message (model); -} - -int -e_addressbook_model_card_count (EAddressbookModel *model) -{ - return model->data_count; -} - -ECard * -e_addressbook_model_card_at (EAddressbookModel *model, int index) -{ - return model->data[index]; -} - -gboolean -e_addressbook_model_editable (EAddressbookModel *model) -{ - return model->editable; -} - -EBook * -e_addressbook_model_get_ebook (EAddressbookModel *model) -{ - return model->book; -} diff --git a/addressbook/gui/widgets/e-addressbook-model.h b/addressbook/gui/widgets/e-addressbook-model.h deleted file mode 100644 index 4863c62e07..0000000000 --- a/addressbook/gui/widgets/e-addressbook-model.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_ADDRESSBOOK_MODEL_H_ -#define _E_ADDRESSBOOK_MODEL_H_ - -#include <glib.h> -#include <glib-object.h> -#include "addressbook/backend/ebook/e-book.h" -#include "addressbook/backend/ebook/e-book-view.h" -#include "addressbook/backend/ebook/e-card-simple.h" - -#define E_TYPE_ADDRESSBOOK_MODEL (e_addressbook_model_get_type ()) -#define E_ADDRESSBOOK_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_ADDRESSBOOK_MODEL, EAddressbookModel)) -#define E_ADDRESSBOOK_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_ADDRESSBOOK_MODEL, EAddressbookModelClass)) -#define E_IS_ADDRESSBOOK_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_ADDRESSBOOK_MODEL)) -#define E_IS_ADDRESSBOOK_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_ADDRESSBOOK_MODEL)) - -typedef struct _EAddressbookModel EAddressbookModel; -typedef struct _EAddressbookModelClass EAddressbookModelClass; - -struct _EAddressbookModel { - GObject parent; - - /* item specific fields */ - EBook *book; - char *query; - EBookView *book_view; - - int get_view_idle; - - ECard **data; - int data_count; - int allocated_count; - - int create_card_id, remove_card_id, modify_card_id, status_message_id, writable_status_id, sequence_complete_id, backend_died_id; - - guint search_in_progress : 1; - guint editable : 1; - guint editable_set : 1; - guint first_get_view : 1; -}; - - -struct _EAddressbookModelClass { - GObjectClass parent_class; - - /* - * Signals - */ - void (*writable_status) (EAddressbookModel *model, gboolean writable); - void (*search_result) (EAddressbookModel *model, EBookViewStatus status); - void (*status_message) (EAddressbookModel *model, const gchar *message); - void (*folder_bar_message) (EAddressbookModel *model, const gchar *message); - void (*card_added) (EAddressbookModel *model, gint index, gint count); - void (*card_removed) (EAddressbookModel *model, gint index); - void (*card_changed) (EAddressbookModel *model, gint index); - void (*model_changed) (EAddressbookModel *model); - void (*stop_state_changed) (EAddressbookModel *model); - void (*backend_died) (EAddressbookModel *model); -}; - - -GType e_addressbook_model_get_type (void); -EAddressbookModel *e_addressbook_model_new (void); - -/* Returns object with ref count of 1. */ -ECard *e_addressbook_model_get_card (EAddressbookModel *model, - int row); -const ECard *e_addressbook_model_peek_card (EAddressbookModel *model, - int row); -EBook *e_addressbook_model_get_ebook (EAddressbookModel *model); - -void e_addressbook_model_stop (EAddressbookModel *model); -gboolean e_addressbook_model_can_stop (EAddressbookModel *model); - -void e_addressbook_model_force_folder_bar_message (EAddressbookModel *model); - -int e_addressbook_model_card_count (EAddressbookModel *model); -ECard *e_addressbook_model_card_at (EAddressbookModel *model, - int index); -gboolean e_addressbook_model_editable (EAddressbookModel *model); - -#endif /* _E_ADDRESSBOOK_MODEL_H_ */ diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c deleted file mode 100644 index 8b70de2734..0000000000 --- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c +++ /dev/null @@ -1,476 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - - -#include <config.h> - -#include <libgnome/gnome-i18n.h> -#include "e-addressbook-marshal.h" -#include "e-addressbook-reflow-adapter.h" -#include "e-addressbook-model.h" -#include "e-addressbook-view.h" -#include "e-addressbook-util.h" - -#include "e-minicard.h" -#include <gal/widgets/e-popup-menu.h> -#include <gal/widgets/e-gui-utils.h> -#include "e-contact-save-as.h" -#include "addressbook/printing/e-contact-print.h" -#include "addressbook/printing/e-contact-print-envelope.h" - - -struct _EAddressbookReflowAdapterPrivate { - EAddressbookModel *model; - - int create_card_id, remove_card_id, modify_card_id, model_changed_id; -}; - -#define PARENT_TYPE e_reflow_model_get_type() -EReflowModel *parent_class; - -#define d(x) - -enum { - PROP_0, - PROP_BOOK, - PROP_QUERY, - PROP_EDITABLE, - PROP_MODEL, -}; - -enum { - DRAG_BEGIN, - LAST_SIGNAL -}; - -static guint e_addressbook_reflow_adapter_signals [LAST_SIGNAL] = {0, }; - -static void -unlink_model(EAddressbookReflowAdapter *adapter) -{ - EAddressbookReflowAdapterPrivate *priv = adapter->priv; - - if (priv->model && priv->create_card_id) - g_signal_handler_disconnect (priv->model, - priv->create_card_id); - if (priv->model && priv->remove_card_id) - g_signal_handler_disconnect (priv->model, - priv->remove_card_id); - if (priv->model && priv->modify_card_id) - g_signal_handler_disconnect (priv->model, - priv->modify_card_id); - - if (priv->model && priv->model_changed_id) - g_signal_handler_disconnect (priv->model, - priv->model_changed_id); - - priv->create_card_id = 0; - priv->remove_card_id = 0; - priv->modify_card_id = 0; - priv->model_changed_id = 0; - - if (priv->model) - g_object_unref (priv->model); - - priv->model = NULL; -} - - -static int -text_height (PangoLayout *layout, const gchar *text) -{ - int height; - - pango_layout_set_text (layout, text, -1); - - pango_layout_get_pixel_size (layout, NULL, &height); - - return height; -} - -static void -addressbook_dispose(GObject *object) -{ - EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(object); - - unlink_model (adapter); -} - -static void -addressbook_set_width (EReflowModel *erm, int width) -{ -} - -/* This function returns the number of items in our EReflowModel. */ -static int -addressbook_count (EReflowModel *erm) -{ - EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(erm); - EAddressbookReflowAdapterPrivate *priv = adapter->priv; - - return e_addressbook_model_card_count (priv->model); -} - -/* This function returns the height of the minicard in question */ -static int -addressbook_height (EReflowModel *erm, int i, GnomeCanvasGroup *parent) -{ - /* XXX ugh, an extra pango layout step for every minicard - whether it's displayed or not? */ - EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(erm); - EAddressbookReflowAdapterPrivate *priv = adapter->priv; - /* FIXME */ - ECardSimpleField field; - int count = 0; - int height; - char *string; - ECardSimple *simple = e_card_simple_new (e_addressbook_model_card_at (priv->model, i)); - PangoLayout *layout = gtk_widget_create_pango_layout (GTK_WIDGET (GNOME_CANVAS_ITEM (parent)->canvas), ""); - - string = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_FILE_AS); - height = text_height (layout, string ? string : "") + 10.0; - g_free(string); - - for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST_SIMPLE_STRING && count < 5; field++) { - - if (field == E_CARD_SIMPLE_FIELD_FAMILY_NAME) - continue; - - string = e_card_simple_get(simple, field); - if (string && *string) { - int this_height; - int field_text_height; - - this_height = text_height (layout, e_card_simple_get_name(simple, field)); - - field_text_height = text_height (layout, string); - if (this_height < field_text_height) - this_height = field_text_height; - - this_height += 3; - - height += this_height; - count ++; - } - g_free (string); - } - height += 2; - - g_object_unref (simple); - g_object_unref (layout); - - return height; -} - -static int -addressbook_compare (EReflowModel *erm, int n1, int n2) -{ - EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(erm); - EAddressbookReflowAdapterPrivate *priv = adapter->priv; - ECard *card1, *card2; - - card1 = e_addressbook_model_card_at (priv->model, n1); - card2 = e_addressbook_model_card_at (priv->model, n2); - - if (card1 && card2) { - char *file_as1, *file_as2; - file_as1 = card1->file_as; - file_as2 = card2->file_as; - if (file_as1 && file_as2) - return g_utf8_collate(file_as1, file_as2); - if (file_as1) - return -1; - if (file_as2) - return 1; - return strcmp(e_card_get_id(card1), e_card_get_id(card2)); - } - if (card1) - return -1; - if (card2) - return 1; - return 0; -} - -static int -adapter_drag_begin (EMinicard *card, GdkEvent *event, EAddressbookReflowAdapter *adapter) -{ - gint ret_val = 0; - - g_signal_emit (adapter, - e_addressbook_reflow_adapter_signals[DRAG_BEGIN], 0, - event, &ret_val); - - return ret_val; -} - -static GnomeCanvasItem * -addressbook_incarnate (EReflowModel *erm, int i, GnomeCanvasGroup *parent) -{ - EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(erm); - EAddressbookReflowAdapterPrivate *priv = adapter->priv; - GnomeCanvasItem *item; - - item = gnome_canvas_item_new(parent, - e_minicard_get_type(), - "card", e_addressbook_model_card_at (priv->model, i), - "editable", e_addressbook_model_editable (priv->model), - NULL); - -#if 0 - g_signal_connect (item, "selected", - G_CALLBACK(card_selected), 0, emvm); -#endif - - g_signal_connect (item, "drag_begin", - G_CALLBACK(adapter_drag_begin), adapter); - - return item; -} - -static void -addressbook_reincarnate (EReflowModel *erm, int i, GnomeCanvasItem *item) -{ - EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(erm); - EAddressbookReflowAdapterPrivate *priv = adapter->priv; - - gnome_canvas_item_set(item, - "card", e_addressbook_model_card_at (priv->model, i), - NULL); -} - - - -static void -create_card(EAddressbookModel *model, - gint index, gint count, - EAddressbookReflowAdapter *adapter) -{ - e_reflow_model_items_inserted (E_REFLOW_MODEL (adapter), - index, - count); -} - -static void -remove_card(EAddressbookModel *model, - gint index, - EAddressbookReflowAdapter *adapter) -{ - e_reflow_model_changed (E_REFLOW_MODEL (adapter)); -} - -static void -modify_card(EAddressbookModel *model, - gint index, - EAddressbookReflowAdapter *adapter) -{ - e_reflow_model_item_changed (E_REFLOW_MODEL (adapter), index); -} - -static void -model_changed(EAddressbookModel *model, - EAddressbookReflowAdapter *adapter) -{ - e_reflow_model_changed (E_REFLOW_MODEL (adapter)); -} - -static void -addressbook_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(object); - EAddressbookReflowAdapterPrivate *priv = adapter->priv; - - switch (prop_id) { - case PROP_BOOK: - g_object_set (priv->model, - "book", g_value_get_object (value), - NULL); - break; - case PROP_QUERY: - g_object_set (priv->model, - "query", g_value_get_string (value), - NULL); - break; - case PROP_EDITABLE: - g_object_set (priv->model, - "editable", g_value_get_boolean (value), - NULL); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -addressbook_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(object); - EAddressbookReflowAdapterPrivate *priv = adapter->priv; - - switch (prop_id) { - case PROP_BOOK: { - g_object_get_property (G_OBJECT (priv->model), - "book", value); - break; - } - case PROP_QUERY: { - char *query; - g_object_get_property (G_OBJECT (priv->model), - "query", value); - break; - } - case PROP_EDITABLE: { - g_object_get_property (G_OBJECT (priv->model), - "editable", value); - break; - } - case PROP_MODEL: - g_value_set_object (value, priv->model); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_addressbook_reflow_adapter_class_init (GObjectClass *object_class) -{ - EReflowModelClass *model_class = (EReflowModelClass *) object_class; - - parent_class = g_type_class_peek_parent (object_class); - - object_class->set_property = addressbook_set_property; - object_class->get_property = addressbook_get_property; - object_class->dispose = addressbook_dispose; - - g_object_class_install_property (object_class, PROP_BOOK, - g_param_spec_object ("book", - _("Book"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_BOOK, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_QUERY, - g_param_spec_string ("query", - _("Query"), - /*_( */"XXX blurb" /*)*/, - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EDITABLE, - g_param_spec_boolean ("editable", - _("Editable"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_MODEL, - g_param_spec_object ("model", - _("Model"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_ADDRESSBOOK_MODEL, - G_PARAM_READABLE)); - - e_addressbook_reflow_adapter_signals [DRAG_BEGIN] = - g_signal_new ("drag_begin", - G_OBJECT_CLASS_TYPE(object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookReflowAdapterClass, drag_begin), - NULL, NULL, - e_addressbook_marshal_INT__POINTER, - G_TYPE_INT, 1, G_TYPE_POINTER); - - model_class->set_width = addressbook_set_width; - model_class->count = addressbook_count; - model_class->height = addressbook_height; - model_class->compare = addressbook_compare; - model_class->incarnate = addressbook_incarnate; - model_class->reincarnate = addressbook_reincarnate; -} - -static void -e_addressbook_reflow_adapter_init (GtkObject *object) -{ - EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(object); - EAddressbookReflowAdapterPrivate *priv; - - priv = adapter->priv = g_new0 (EAddressbookReflowAdapterPrivate, 1); - - priv->create_card_id = 0; - priv->remove_card_id = 0; - priv->modify_card_id = 0; - priv->model_changed_id = 0; -} - -GType -e_addressbook_reflow_adapter_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (EAddressbookReflowAdapterClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_addressbook_reflow_adapter_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EAddressbookReflowAdapter), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_addressbook_reflow_adapter_init, - }; - - type = g_type_register_static (PARENT_TYPE, "EAddressbookReflowAdapter", &info, 0); - } - - return type; -} - -void -e_addressbook_reflow_adapter_construct (EAddressbookReflowAdapter *adapter, - EAddressbookModel *model) -{ - EAddressbookReflowAdapterPrivate *priv = adapter->priv; - - priv->model = model; - g_object_ref (priv->model); - - priv->create_card_id = g_signal_connect(priv->model, - "card_added", - G_CALLBACK(create_card), - adapter); - priv->remove_card_id = g_signal_connect(priv->model, - "card_removed", - G_CALLBACK(remove_card), - adapter); - priv->modify_card_id = g_signal_connect(priv->model, - "card_changed", - G_CALLBACK(modify_card), - adapter); - priv->model_changed_id = g_signal_connect(priv->model, - "model_changed", - G_CALLBACK(model_changed), - adapter); -} - -EReflowModel * -e_addressbook_reflow_adapter_new (EAddressbookModel *model) -{ - EAddressbookReflowAdapter *et; - - et = g_object_new (E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER, NULL); - - e_addressbook_reflow_adapter_construct (et, model); - - return E_REFLOW_MODEL(et); -} - - -ECard * -e_addressbook_reflow_adapter_get_card (EAddressbookReflowAdapter *adapter, - int index) -{ - EAddressbookReflowAdapterPrivate *priv = adapter->priv; - - return e_addressbook_model_get_card (priv->model, index); -} diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.h b/addressbook/gui/widgets/e-addressbook-reflow-adapter.h deleted file mode 100644 index 4bf131bc5c..0000000000 --- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_ADDRESSBOOK_REFLOW_ADAPTER_H_ -#define _E_ADDRESSBOOK_REFLOW_ADAPTER_H_ - -#include <gal/widgets/e-reflow-model.h> -#include <gal/widgets/e-selection-model.h> -#include "e-addressbook-model.h" -#include "addressbook/backend/ebook/e-book.h" -#include "addressbook/backend/ebook/e-book-view.h" -#include "addressbook/backend/ebook/e-card.h" - -#define E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER (e_addressbook_reflow_adapter_get_type ()) -#define E_ADDRESSBOOK_REFLOW_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER, EAddressbookReflowAdapter)) -#define E_ADDRESSBOOK_REFLOW_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER, EAddressbookReflowAdapterClass)) -#define E_IS_ADDRESSBOOK_REFLOW_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER)) -#define E_IS_ADDRESSBOOK_REFLOW_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER)) - -typedef struct _EAddressbookReflowAdapter EAddressbookReflowAdapter; -typedef struct _EAddressbookReflowAdapterPrivate EAddressbookReflowAdapterPrivate; -typedef struct _EAddressbookReflowAdapterClass EAddressbookReflowAdapterClass; - -struct _EAddressbookReflowAdapter { - EReflowModel parent; - - EAddressbookReflowAdapterPrivate *priv; -}; - - -struct _EAddressbookReflowAdapterClass { - EReflowModelClass parent_class; - - /* - * Signals - */ - gint (* drag_begin) (EAddressbookReflowAdapter *adapter, GdkEvent *event); -}; - - -GType e_addressbook_reflow_adapter_get_type (void); -void e_addressbook_reflow_adapter_construct (EAddressbookReflowAdapter *adapter, - EAddressbookModel *model); -EReflowModel *e_addressbook_reflow_adapter_new (EAddressbookModel *model); - -/* Returns object with ref count of 1. */ -ECard *e_addressbook_reflow_adapter_get_card (EAddressbookReflowAdapter *adapter, - int index); -#endif /* _E_ADDRESSBOOK_REFLOW_ADAPTER_H_ */ diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.c b/addressbook/gui/widgets/e-addressbook-table-adapter.c deleted file mode 100644 index 6146aa75f3..0000000000 --- a/addressbook/gui/widgets/e-addressbook-table-adapter.c +++ /dev/null @@ -1,409 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -#include <config.h> -#include "e-addressbook-model.h" -#include "e-addressbook-table-adapter.h" -#include "e-card-merging.h" -#include "e-addressbook-util.h" -#include <libxml/tree.h> -#include <libxml/parser.h> -#include <libxml/xmlmemory.h> -#include <gnome.h> - -struct _EAddressbookTableAdapterPrivate { - EAddressbookModel *model; - - ECardSimple **simples; - int count; - - int create_card_id, remove_card_id, modify_card_id, model_changed_id; -}; - -#define PARENT_TYPE e_table_model_get_type() -ETableModelClass *parent_class; - -#define COLS (E_CARD_SIMPLE_FIELD_LAST) - -static void -unlink_model(EAddressbookTableAdapter *adapter) -{ - EAddressbookTableAdapterPrivate *priv = adapter->priv; - int i; - - g_signal_handler_disconnect (priv->model, - priv->create_card_id); - g_signal_handler_disconnect (priv->model, - priv->remove_card_id); - g_signal_handler_disconnect (priv->model, - priv->modify_card_id); - g_signal_handler_disconnect (priv->model, - priv->model_changed_id); - - priv->create_card_id = 0; - priv->remove_card_id = 0; - priv->modify_card_id = 0; - priv->model_changed_id = 0; - - /* free up the existing mapping if there is one */ - if (priv->simples) { - for (i = 0; i < priv->count; i ++) - g_object_unref (priv->simples[i]); - g_free (priv->simples); - priv->simples = NULL; - } - - g_object_unref (priv->model); - - priv->model = NULL; -} - -static void -build_simple_mapping(EAddressbookTableAdapter *adapter) -{ - EAddressbookTableAdapterPrivate *priv = adapter->priv; - int i; - - /* free up the existing mapping if there is one */ - if (priv->simples) { - for (i = 0; i < priv->count; i ++) - g_object_unref (priv->simples[i]); - g_free (priv->simples); - } - - /* build up our mapping to ECardSimple*'s */ - priv->count = e_addressbook_model_card_count (priv->model); - priv->simples = g_new (ECardSimple*, priv->count); - for (i = 0; i < priv->count; i ++) { - priv->simples[i] = e_card_simple_new (e_addressbook_model_card_at (priv->model, i)); - g_object_ref (priv->simples[i]); - } -} - -static void -addressbook_destroy(GtkObject *object) -{ - EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(object); - - unlink_model(adapter); - - g_free (adapter->priv); -} - -/* This function returns the number of columns in our ETableModel. */ -static int -addressbook_col_count (ETableModel *etc) -{ - return COLS; -} - -/* This function returns the number of rows in our ETableModel. */ -static int -addressbook_row_count (ETableModel *etc) -{ - EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(etc); - EAddressbookTableAdapterPrivate *priv = adapter->priv; - - return e_addressbook_model_card_count (priv->model); -} - -/* This function returns the value at a particular point in our ETableModel. */ -static void * -addressbook_value_at (ETableModel *etc, int col, int row) -{ - EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(etc); - EAddressbookTableAdapterPrivate *priv = adapter->priv; - const char *value; - - if ( col >= COLS || row >= e_addressbook_model_card_count (priv->model) ) - return NULL; - - value = e_card_simple_get_const(priv->simples[row], col); - - if (value && !strncmp (value, "<?xml", 5)) { - EDestination *dest = e_destination_import (value); - if (dest) { - /* XXX blech, we leak this */ - value = g_strdup (e_destination_get_address (dest)); - g_object_unref (dest); - } - } - - - return (void *)(value ? value : ""); -} - -/* This function sets the value at a particular point in our ETableModel. */ -static void -card_modified_cb (EBook* book, EBookStatus status, - gpointer user_data) -{ - /* g_print ("%s: %s(): a card was modified\n", __FILE__, __FUNCTION__); */ - if (status != E_BOOK_STATUS_SUCCESS) - e_addressbook_error_dialog (_("Error modifying card"), status); -} -static void -addressbook_set_value_at (ETableModel *etc, int col, int row, const void *val) -{ - EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(etc); - EAddressbookTableAdapterPrivate *priv = adapter->priv; - if (e_addressbook_model_editable (priv->model)) { - ECard *card; - - if ( col >= COLS|| row >= e_addressbook_model_card_count (priv->model) ) - return; - - e_table_model_pre_change(etc); - - e_card_simple_set(priv->simples[row], - col, - val); - g_object_get(priv->simples[row], - "card", &card, - NULL); - - e_card_merging_book_commit_card(e_addressbook_model_get_ebook(priv->model), - card, card_modified_cb, NULL); - - /* XXX do we need this? shouldn't the commit_card generate a changed signal? */ - e_table_model_cell_changed(etc, col, row); - } -} - -/* This function returns whether a particular cell is editable. */ -static gboolean -addressbook_is_cell_editable (ETableModel *etc, int col, int row) -{ - EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(etc); - EAddressbookTableAdapterPrivate *priv = adapter->priv; - ECard *card; - - if (row >= 0 && row < e_addressbook_model_card_count (priv->model)) - card = e_addressbook_model_card_at (priv->model, row); - else - card = NULL; - - if (!e_addressbook_model_editable(priv->model)) - return FALSE; - else if (card && e_card_evolution_list (card)) - /* we only allow editing of the name and file as for - lists */ - return col == E_CARD_SIMPLE_FIELD_FULL_NAME || col == E_CARD_SIMPLE_FIELD_FILE_AS; - else - return col < E_CARD_SIMPLE_FIELD_LAST_SIMPLE_STRING; -} - -static void -addressbook_append_row (ETableModel *etm, ETableModel *source, gint row) -{ - EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(etm); - EAddressbookTableAdapterPrivate *priv = adapter->priv; - ECard *card; - ECardSimple *simple; - int col; - - card = e_card_new(""); - simple = e_card_simple_new(card); - - for (col = 0; col < E_CARD_SIMPLE_FIELD_LAST_SIMPLE_STRING; col++) { - const void *val = e_table_model_value_at(source, col, row); - e_card_simple_set(simple, col, val); - } - e_card_simple_sync_card(simple); - e_card_merging_book_add_card (e_addressbook_model_get_ebook (priv->model), card, NULL, NULL); - g_object_unref (simple); - g_object_unref (card); -} - -/* This function duplicates the value passed to it. */ -static void * -addressbook_duplicate_value (ETableModel *etc, int col, const void *value) -{ - return g_strdup(value); -} - -/* This function frees the value passed to it. */ -static void -addressbook_free_value (ETableModel *etc, int col, void *value) -{ - g_free(value); -} - -static void * -addressbook_initialize_value (ETableModel *etc, int col) -{ - return g_strdup(""); -} - -static gboolean -addressbook_value_is_empty (ETableModel *etc, int col, const void *value) -{ - return !(value && *(char *)value); -} - -static char * -addressbook_value_to_string (ETableModel *etc, int col, const void *value) -{ - return g_strdup(value); -} - -static void -e_addressbook_table_adapter_class_init (GtkObjectClass *object_class) -{ - ETableModelClass *model_class = (ETableModelClass *) object_class; - - parent_class = g_type_class_peek_parent (object_class); - - object_class->destroy = addressbook_destroy; - - model_class->column_count = addressbook_col_count; - model_class->row_count = addressbook_row_count; - model_class->value_at = addressbook_value_at; - model_class->set_value_at = addressbook_set_value_at; - model_class->is_cell_editable = addressbook_is_cell_editable; - model_class->append_row = addressbook_append_row; - model_class->duplicate_value = addressbook_duplicate_value; - model_class->free_value = addressbook_free_value; - model_class->initialize_value = addressbook_initialize_value; - model_class->value_is_empty = addressbook_value_is_empty; - model_class->value_to_string = addressbook_value_to_string; -} - -static void -e_addressbook_table_adapter_init (GtkObject *object) -{ - EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(object); - EAddressbookTableAdapterPrivate *priv; - - priv = adapter->priv = g_new0 (EAddressbookTableAdapterPrivate, 1); - - priv->create_card_id = 0; - priv->remove_card_id = 0; - priv->modify_card_id = 0; - priv->model_changed_id = 0; - priv->simples = NULL; - priv->count = 0; -} - - -static void -create_card (EAddressbookModel *model, - gint index, gint count, - EAddressbookTableAdapter *adapter) -{ - EAddressbookTableAdapterPrivate *priv = adapter->priv; - int i; - - priv->count += count; - priv->simples = g_renew(ECardSimple *, priv->simples, priv->count); - memmove (priv->simples + index + count, priv->simples + index, (priv->count - index - count) * sizeof (ECardSimple *)); - - e_table_model_pre_change (E_TABLE_MODEL (adapter)); - for (i = 0; i < count; i ++) { - priv->simples[index + i] = e_card_simple_new (e_addressbook_model_card_at (priv->model, index + i)); - } - e_table_model_rows_inserted (E_TABLE_MODEL (adapter), index, count); -} - -static void -remove_card (EAddressbookModel *model, - gint index, - EAddressbookTableAdapter *adapter) -{ - EAddressbookTableAdapterPrivate *priv = adapter->priv; - - e_table_model_pre_change (E_TABLE_MODEL (adapter)); - - g_object_unref (priv->simples[index]); - memmove (priv->simples + index, priv->simples + index + 1, (priv->count - index - 1) * sizeof (ECardSimple *)); - priv->count --; - e_table_model_rows_deleted (E_TABLE_MODEL (adapter), index, 1); -} - -static void -modify_card (EAddressbookModel *model, - gint index, - EAddressbookTableAdapter *adapter) -{ - EAddressbookTableAdapterPrivate *priv = adapter->priv; - - e_table_model_pre_change (E_TABLE_MODEL (adapter)); - - g_object_unref (priv->simples[index]); - priv->simples[index] = e_card_simple_new (e_addressbook_model_card_at (priv->model, index)); - g_object_ref (priv->simples[index]); - e_table_model_row_changed (E_TABLE_MODEL (adapter), index); -} - -static void -model_changed (EAddressbookModel *model, - EAddressbookTableAdapter *adapter) -{ - e_table_model_pre_change (E_TABLE_MODEL (adapter)); - build_simple_mapping (adapter); - e_table_model_changed (E_TABLE_MODEL (adapter)); -} - -GType -e_addressbook_table_adapter_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (EAddressbookTableAdapterClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_addressbook_table_adapter_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EAddressbookTableAdapter), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_addressbook_table_adapter_init, - }; - - type = g_type_register_static (PARENT_TYPE, "EAddressbookTableAdapter", &info, 0); - } - - return type; -} - -void -e_addressbook_table_adapter_construct (EAddressbookTableAdapter *adapter, - EAddressbookModel *model) -{ - EAddressbookTableAdapterPrivate *priv = adapter->priv; - - priv->model = model; - g_object_ref (priv->model); - - priv->create_card_id = g_signal_connect(priv->model, - "card_added", - G_CALLBACK(create_card), - adapter); - priv->remove_card_id = g_signal_connect(priv->model, - "card_removed", - G_CALLBACK(remove_card), - adapter); - priv->modify_card_id = g_signal_connect(priv->model, - "card_changed", - G_CALLBACK(modify_card), - adapter); - priv->model_changed_id = g_signal_connect(priv->model, - "model_changed", - G_CALLBACK(model_changed), - adapter); - - build_simple_mapping (adapter); -} - -ETableModel * -e_addressbook_table_adapter_new (EAddressbookModel *model) -{ - EAddressbookTableAdapter *et; - - et = g_object_new(E_TYPE_ADDRESSBOOK_TABLE_ADAPTER, NULL); - - e_addressbook_table_adapter_construct (et, model); - - return E_TABLE_MODEL(et); -} diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.h b/addressbook/gui/widgets/e-addressbook-table-adapter.h deleted file mode 100644 index df66e1dce9..0000000000 --- a/addressbook/gui/widgets/e-addressbook-table-adapter.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_ADDRESSBOOK_TABLE_ADAPTER_H_ -#define _E_ADDRESSBOOK_TABLE_ADAPTER_H_ - -#include <gal/e-table/e-table-model.h> -#include "addressbook/backend/ebook/e-book.h" -#include "addressbook/backend/ebook/e-book-view.h" -#include "addressbook/backend/ebook/e-card-simple.h" - -#define E_TYPE_ADDRESSBOOK_TABLE_ADAPTER (e_addressbook_table_adapter_get_type ()) -#define E_ADDRESSBOOK_TABLE_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_ADDRESSBOOK_TABLE_ADAPTER, EAddressbookTableAdapter)) -#define E_ADDRESSBOOK_TABLE_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_ADDRESSBOOK_TABLE_ADAPTER, EAddressbookTableAdapterClass)) -#define E_IS_ADDRESSBOOK_TABLE_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_ADDRESSBOOK_TABLE_ADAPTER)) -#define E_IS_ADDRESSBOOK_TABLE_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_ADDRESSBOOK_TABLE_ADAPTER)) - -/* Virtual Column list: - 0 Email - 1 Full Name - 2 Street - 3 Phone -*/ - -typedef struct _EAddressbookTableAdapter EAddressbookTableAdapter; -typedef struct _EAddressbookTableAdapterPrivate EAddressbookTableAdapterPrivate; -typedef struct _EAddressbookTableAdapterClass EAddressbookTableAdapterClass; - -struct _EAddressbookTableAdapter { - ETableModel parent; - - EAddressbookTableAdapterPrivate *priv; -}; - - -struct _EAddressbookTableAdapterClass { - ETableModelClass parent_class; -}; - - -GType e_addressbook_table_adapter_get_type (void); -void e_addressbook_table_adapter_construct (EAddressbookTableAdapter *adapter, - EAddressbookModel *model); -ETableModel *e_addressbook_table_adapter_new (EAddressbookModel *model); - -#endif /* _E_ADDRESSBOOK_TABLE_ADAPTER_H_ */ diff --git a/addressbook/gui/widgets/e-addressbook-treeview-adapter.c b/addressbook/gui/widgets/e-addressbook-treeview-adapter.c deleted file mode 100644 index d6401133ec..0000000000 --- a/addressbook/gui/widgets/e-addressbook-treeview-adapter.c +++ /dev/null @@ -1,627 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -#include <config.h> -#include "e-addressbook-model.h" -#include "e-addressbook-treeview-adapter.h" -#include "e-card-merging.h" -#include "e-addressbook-util.h" -#include <gtk/gtktreednd.h> -#include <libxml/tree.h> -#include <libxml/parser.h> -#include <libxml/xmlmemory.h> - -struct _EAddressbookTreeViewAdapterPrivate { - EAddressbookModel *model; - - gint stamp; - - ECardSimple **simples; - int count; - - int create_card_id, remove_card_id, modify_card_id, model_changed_id; -}; - -#define PARENT_TYPE G_TYPE_OBJECT -GObjectClass *parent_class; - -#define COLS (E_CARD_SIMPLE_FIELD_LAST) - -static void -unlink_model(EAddressbookTreeViewAdapter *adapter) -{ - EAddressbookTreeViewAdapterPrivate *priv = adapter->priv; - int i; - - g_signal_handler_disconnect (priv->model, - priv->create_card_id); - g_signal_handler_disconnect (priv->model, - priv->remove_card_id); - g_signal_handler_disconnect (priv->model, - priv->modify_card_id); - g_signal_handler_disconnect (priv->model, - priv->model_changed_id); - - priv->create_card_id = 0; - priv->remove_card_id = 0; - priv->modify_card_id = 0; - priv->model_changed_id = 0; - - /* free up the existing mapping if there is one */ - if (priv->simples) { - for (i = 0; i < priv->count; i ++) - g_object_unref (priv->simples[i]); - g_free (priv->simples); - priv->simples = NULL; - } - - g_object_unref (priv->model); - - priv->model = NULL; -} - -static void -build_simple_mapping(EAddressbookTreeViewAdapter *adapter) -{ - EAddressbookTreeViewAdapterPrivate *priv = adapter->priv; - int i; - - /* free up the existing mapping if there is one */ - if (priv->simples) { - for (i = 0; i < priv->count; i ++) - g_object_unref (priv->simples[i]); - g_free (priv->simples); - } - - /* build up our mapping to ECardSimple*'s */ - priv->count = e_addressbook_model_card_count (priv->model); - priv->simples = g_new (ECardSimple*, priv->count); - for (i = 0; i < priv->count; i ++) { - priv->simples[i] = e_card_simple_new (e_addressbook_model_card_at (priv->model, i)); - g_object_ref (priv->simples[i]); - } -} - -static void -addressbook_destroy(GtkObject *object) -{ - EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER(object); - - unlink_model(adapter); - - g_free (adapter->priv); -} - -#if 0 -static void -addressbook_set_value_at (ETableModel *etc, int col, int row, const void *val) -{ - EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(etc); - EAddressbookTableAdapterPrivate *priv = adapter->priv; - if (e_addressbook_model_editable (priv->model)) { - ECard *card; - - if ( col >= COLS|| row >= e_addressbook_model_card_count (priv->model) ) - return; - - e_table_model_pre_change(etc); - - e_card_simple_set(priv->simples[row], - col, - val); - g_object_get(priv->simples[row], - "card", &card, - NULL); - - e_card_merging_book_commit_card(e_addressbook_model_get_ebook(priv->model), - card, card_modified_cb, NULL); - - /* XXX do we need this? shouldn't the commit_card generate a changed signal? */ - e_table_model_cell_changed(etc, col, row); - } -} - -/* This function returns whether a particular cell is editable. */ -static gboolean -addressbook_is_cell_editable (ETableModel *etc, int col, int row) -{ - EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(etc); - EAddressbookTableAdapterPrivate *priv = adapter->priv; - ECard *card; - - if (row >= 0 && row < e_addressbook_model_card_count (priv->model)) - card = e_addressbook_model_card_at (priv->model, row); - else - card = NULL; - - if (!e_addressbook_model_editable(priv->model)) - return FALSE; - else if (card && e_card_evolution_list (card)) - /* we only allow editing of the name and file as for - lists */ - return col == E_CARD_SIMPLE_FIELD_FULL_NAME || col == E_CARD_SIMPLE_FIELD_FILE_AS; - else - return col < E_CARD_SIMPLE_FIELD_LAST_SIMPLE_STRING; -} - -static void -addressbook_append_row (ETableModel *etm, ETableModel *source, gint row) -{ - EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(etm); - EAddressbookTableAdapterPrivate *priv = adapter->priv; - ECard *card; - ECardSimple *simple; - int col; - - card = e_card_new(""); - simple = e_card_simple_new(card); - - for (col = 0; col < E_CARD_SIMPLE_FIELD_LAST_SIMPLE_STRING; col++) { - const void *val = e_table_model_value_at(source, col, row); - e_card_simple_set(simple, col, val); - } - e_card_simple_sync_card(simple); - e_card_merging_book_add_card (e_addressbook_model_get_ebook (priv->model), card, NULL, NULL); - g_object_unref (simple); - g_object_unref (card); -} -#endif - -static void -e_addressbook_treeview_adapter_class_init (GtkObjectClass *object_class) -{ - parent_class = g_type_class_peek_parent (object_class); - - object_class->destroy = addressbook_destroy; -} - -static void -e_addressbook_treeview_adapter_init (GtkObject *object) -{ - EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER(object); - EAddressbookTreeViewAdapterPrivate *priv; - - priv = adapter->priv = g_new0 (EAddressbookTreeViewAdapterPrivate, 1); - - priv->create_card_id = 0; - priv->remove_card_id = 0; - priv->modify_card_id = 0; - priv->model_changed_id = 0; - priv->simples = NULL; - priv->count = 0; -} - -static void -get_iter (EAddressbookTreeViewAdapter *adapter, gint index, GtkTreeIter *iter) -{ - EAddressbookTreeViewAdapterPrivate *priv = adapter->priv; - - iter->stamp = priv->stamp; - iter->user_data = GINT_TO_POINTER (index); -} - -static void -create_card (EAddressbookModel *model, - gint index, gint count, - EAddressbookTreeViewAdapter *adapter) -{ - EAddressbookTreeViewAdapterPrivate *priv = adapter->priv; - int i; - - priv->count += count; - priv->simples = g_renew(ECardSimple *, priv->simples, priv->count); - memmove (priv->simples + index + count, priv->simples + index, (priv->count - index - count) * sizeof (ECardSimple *)); - - for (i = 0; i < count; i ++) { - GtkTreeIter iter; - GtkTreePath *path; - - priv->simples[index + i] = e_card_simple_new (e_addressbook_model_card_at (priv->model, index + i)); - - get_iter (adapter, index + i, &iter); - path = gtk_tree_model_get_path (GTK_TREE_MODEL (adapter), &iter); - - gtk_tree_model_row_inserted (GTK_TREE_MODEL (adapter), path, &iter); - gtk_tree_model_row_changed (GTK_TREE_MODEL (adapter), path, &iter); - - gtk_tree_path_free (path); - } -} - -static void -remove_card (EAddressbookModel *model, - gint index, - EAddressbookTreeViewAdapter *adapter) -{ - EAddressbookTreeViewAdapterPrivate *priv = adapter->priv; - GtkTreeIter iter; - GtkTreePath *path; - - g_object_unref (priv->simples[index]); - memmove (priv->simples + index, priv->simples + index + 1, (priv->count - index - 1) * sizeof (ECardSimple *)); - priv->count --; - get_iter (adapter, index, &iter); - path = gtk_tree_model_get_path (GTK_TREE_MODEL (adapter), &iter); - - gtk_tree_model_row_deleted (GTK_TREE_MODEL (adapter), path); - - gtk_tree_path_free (path); -} - -static void -modify_card (EAddressbookModel *model, - gint index, - EAddressbookTreeViewAdapter *adapter) -{ - EAddressbookTreeViewAdapterPrivate *priv = adapter->priv; - GtkTreeIter iter; - GtkTreePath *path; - - g_object_unref (priv->simples[index]); - priv->simples[index] = e_card_simple_new (e_addressbook_model_card_at (priv->model, index)); - - get_iter (adapter, index, &iter); - path = gtk_tree_model_get_path (GTK_TREE_MODEL (adapter), &iter); - - gtk_tree_model_row_changed (GTK_TREE_MODEL (adapter), path, &iter); - - gtk_tree_path_free (path); -} - -static void -model_changed (EAddressbookModel *model, - EAddressbookTreeViewAdapter *adapter) -{ - int i; - - /* there has *got* to be an easier/faster way to do this... */ - for (i = 0; i < adapter->priv->count; i++) { - remove_card (model, i, adapter); - } - - build_simple_mapping (adapter); - - if (adapter->priv->count) { - printf ("AIIEEEEEE\n"); - } - - /* XXX this isn't right either, we need to add the new cards */ -} - -static GtkTreeModelFlags -adapter_get_flags (GtkTreeModel *tree_model) -{ - g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), 0); - - return GTK_TREE_MODEL_LIST_ONLY; -} - -static gint -adapter_get_n_columns (GtkTreeModel *tree_model) -{ - g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), 0); - - return COLS; -} - -static GType -adapter_get_column_type (GtkTreeModel *tree_model, - gint index) -{ - g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), G_TYPE_INVALID); - g_return_val_if_fail (index < COLS && index >= 0, G_TYPE_INVALID); - - return G_TYPE_STRING; -} - -static gboolean -adapter_get_iter (GtkTreeModel *tree_model, - GtkTreeIter *iter, - GtkTreePath *path) -{ - EAddressbookTreeViewAdapter *adapter; - GSList *list; - gint i; - - g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), FALSE); - g_return_val_if_fail (gtk_tree_path_get_depth (path) > 0, FALSE); - - adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model); - - i = gtk_tree_path_get_indices (path)[0]; - - if (i >= adapter->priv->count) - return FALSE; - - iter->stamp = adapter->priv->stamp; - iter->user_data = GINT_TO_POINTER (i); - - return TRUE; -} - -static GtkTreePath * -adapter_get_path (GtkTreeModel *tree_model, - GtkTreeIter *iter) -{ - EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model); - GtkTreePath *retval; - - g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), NULL); - g_return_val_if_fail (iter->stamp == adapter->priv->stamp, NULL); - - - if (GPOINTER_TO_INT (iter->user_data) >= adapter->priv->count) - return NULL; - - retval = gtk_tree_path_new (); - gtk_tree_path_append_index (retval, GPOINTER_TO_INT (iter->user_data)); - return retval; -} - -static void -adapter_get_value (GtkTreeModel *tree_model, - GtkTreeIter *iter, - gint column, - GValue *value) -{ - EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model); - ECardSimple *simple; - gint tmp_column = column; - const char *v; - - g_return_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model)); - g_return_if_fail (column < COLS); - g_return_if_fail (adapter->priv->stamp == iter->stamp); - - simple = adapter->priv->simples [ GPOINTER_TO_INT (iter->user_data) ]; - - v = e_card_simple_get_const(simple, column); - - if (v && !strncmp (v, "<?xml", 5)) { - EDestination *dest = e_destination_import (v); - if (dest) { - /* XXX blech, we leak this */ - v = g_strdup (e_destination_get_address (dest)); - g_object_unref (dest); - } - } - - g_value_init (value, G_TYPE_STRING); - g_value_set_string (value, (v ? v : "")); -} - -static gboolean -adapter_iter_next (GtkTreeModel *tree_model, - GtkTreeIter *iter) -{ - EAddressbookTreeViewAdapter *adapter; - - g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), FALSE); - g_return_val_if_fail (E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model)->priv->stamp == iter->stamp, FALSE); - - adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model); - - iter->user_data = GINT_TO_POINTER (GPOINTER_TO_INT (iter->user_data) + 1); - - return (GPOINTER_TO_INT (iter->user_data) < adapter->priv->count); -} - -static gboolean -adapter_iter_children (GtkTreeModel *tree_model, - GtkTreeIter *iter, - GtkTreeIter *parent) -{ - EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model); - - /* this is a list, nodes have no children */ - if (parent) - return FALSE; - - /* but if parent == NULL we return the list itself as children of the - * "root" - */ - if (adapter->priv->count) { - iter->stamp = adapter->priv->stamp; - iter->user_data = GINT_TO_POINTER (0); - return TRUE; - } - else - return FALSE; -} - -static gboolean -adapter_iter_has_child (GtkTreeModel *tree_model, - GtkTreeIter *iter) -{ - return FALSE; -} - -static gint -adapter_iter_n_children (GtkTreeModel *tree_model, - GtkTreeIter *iter) -{ - EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model); - - g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), -1); - if (iter == NULL) - return adapter->priv->count; - - g_return_val_if_fail (adapter->priv->stamp == iter->stamp, -1); - return 0; -} - -static gboolean -adapter_iter_nth_child (GtkTreeModel *tree_model, - GtkTreeIter *iter, - GtkTreeIter *parent, - gint n) -{ - EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model); - - g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), FALSE); - - if (parent) - return FALSE; - - if (n < adapter->priv->count) { - iter->stamp = adapter->priv->stamp; - iter->user_data = GINT_TO_POINTER (n); - return TRUE; - } - else - return FALSE; -} - -static gboolean -adapter_iter_parent (GtkTreeModel *tree_model, - GtkTreeIter *iter, - GtkTreeIter *child) -{ - return FALSE; -} - -static void -adapter_tree_model_init (GtkTreeModelIface *iface) -{ - iface->get_flags = adapter_get_flags; - iface->get_n_columns = adapter_get_n_columns; - iface->get_column_type = adapter_get_column_type; - iface->get_iter = adapter_get_iter; - iface->get_path = adapter_get_path; - iface->get_value = adapter_get_value; - iface->iter_next = adapter_iter_next; - iface->iter_children = adapter_iter_children; - iface->iter_has_child = adapter_iter_has_child; - iface->iter_n_children = adapter_iter_n_children; - iface->iter_nth_child = adapter_iter_nth_child; - iface->iter_parent = adapter_iter_parent; -} - -static gboolean -adapter_drag_data_delete (GtkTreeDragSource *drag_source, - GtkTreePath *path) -{ - g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (drag_source), FALSE); - - return FALSE; -} - -static gboolean -adapter_drag_data_get (GtkTreeDragSource *drag_source, - GtkTreePath *path, - GtkSelectionData *selection_data) -{ - g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (drag_source), FALSE); - - /* Note that we don't need to handle the GTK_TREE_MODEL_ROW - * target, because the default handler does it for us, but - * we do anyway for the convenience of someone maybe overriding the - * default handler. - */ - - if (gtk_tree_set_row_drag_data (selection_data, - GTK_TREE_MODEL (drag_source), - path)) { - return TRUE; - } - else { - if (selection_data->target == gdk_atom_intern ("text/x-vcard", FALSE)) { - printf ("HI THERE\n"); - } - } - - return FALSE; -} - -static void -adapter_drag_source_init (GtkTreeDragSourceIface *iface) -{ - iface->drag_data_delete = adapter_drag_data_delete; - iface->drag_data_get = adapter_drag_data_get; -} - -GType -e_addressbook_treeview_adapter_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo adapter_info = { - sizeof (EAddressbookTreeViewAdapterClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_addressbook_treeview_adapter_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EAddressbookTreeViewAdapter), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_addressbook_treeview_adapter_init, - }; - - static const GInterfaceInfo tree_model_info = { - (GInterfaceInitFunc) adapter_tree_model_init, - NULL, - NULL - }; - - static const GInterfaceInfo drag_source_info = { - (GInterfaceInitFunc) adapter_drag_source_init, - NULL, - NULL - }; - - type = g_type_register_static (PARENT_TYPE, "EAddressbookTreeViewAdapter", &adapter_info, 0); - - g_type_add_interface_static (type, - GTK_TYPE_TREE_MODEL, - &tree_model_info); - - g_type_add_interface_static (type, - GTK_TYPE_TREE_DRAG_SOURCE, - &drag_source_info); - } - - return type; -} - -void -e_addressbook_treeview_adapter_construct (EAddressbookTreeViewAdapter *adapter, - EAddressbookModel *model) -{ - EAddressbookTreeViewAdapterPrivate *priv = adapter->priv; - - priv->model = model; - g_object_ref (priv->model); - - priv->stamp = g_random_int (); - - priv->create_card_id = g_signal_connect(priv->model, - "card_added", - G_CALLBACK(create_card), - adapter); - priv->remove_card_id = g_signal_connect(priv->model, - "card_removed", - G_CALLBACK(remove_card), - adapter); - priv->modify_card_id = g_signal_connect(priv->model, - "card_changed", - G_CALLBACK(modify_card), - adapter); - priv->model_changed_id = g_signal_connect(priv->model, - "model_changed", - G_CALLBACK(model_changed), - adapter); - - build_simple_mapping (adapter); -} - -GtkTreeModel * -e_addressbook_treeview_adapter_new (EAddressbookModel *model) -{ - EAddressbookTreeViewAdapter *et; - - et = g_object_new(E_TYPE_ADDRESSBOOK_TREEVIEW_ADAPTER, NULL); - - e_addressbook_treeview_adapter_construct (et, model); - - return (GtkTreeModel*)et; -} diff --git a/addressbook/gui/widgets/e-addressbook-treeview-adapter.h b/addressbook/gui/widgets/e-addressbook-treeview-adapter.h deleted file mode 100644 index 2c4370dee3..0000000000 --- a/addressbook/gui/widgets/e-addressbook-treeview-adapter.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_ADDRESSBOOK_TREEVIEW_ADAPTER_H_ -#define _E_ADDRESSBOOK_TREEVIEW_ADAPTER_H_ - -#include <gtk/gtktreemodel.h> -#include "addressbook/backend/ebook/e-book.h" -#include "addressbook/backend/ebook/e-book-view.h" -#include "addressbook/backend/ebook/e-card-simple.h" - -#define E_TYPE_ADDRESSBOOK_TREEVIEW_ADAPTER (e_addressbook_treeview_adapter_get_type ()) -#define E_ADDRESSBOOK_TREEVIEW_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_ADDRESSBOOK_TREEVIEW_ADAPTER, EAddressbookTreeViewAdapter)) -#define E_ADDRESSBOOK_TREEVIEW_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_ADDRESSBOOK_TREEVIEW_ADAPTER, EAddressbookTreeViewAdapterClass)) -#define E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_ADDRESSBOOK_TREEVIEW_ADAPTER)) -#define E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_ADDRESSBOOK_TREEVIEW_ADAPTER)) - -/* Virtual Column list: - 0 Email - 1 Full Name - 2 Street - 3 Phone -*/ - -typedef struct _EAddressbookTreeViewAdapter EAddressbookTreeViewAdapter; -typedef struct _EAddressbookTreeViewAdapterPrivate EAddressbookTreeViewAdapterPrivate; -typedef struct _EAddressbookTreeViewAdapterClass EAddressbookTreeViewAdapterClass; - -struct _EAddressbookTreeViewAdapter { - GObject parent; - - EAddressbookTreeViewAdapterPrivate *priv; -}; - - -struct _EAddressbookTreeViewAdapterClass { - GObjectClass parent_class; -}; - - -GType e_addressbook_treeview_adapter_get_type (void); -void e_addressbook_treeview_adapter_construct (EAddressbookTreeViewAdapter *adapter, - EAddressbookModel *model); -GtkTreeModel *e_addressbook_treeview_adapter_new (EAddressbookModel *model); - -#endif /* _E_ADDRESSBOOK_TABLE_ADAPTER_H_ */ diff --git a/addressbook/gui/widgets/e-addressbook-util.c b/addressbook/gui/widgets/e-addressbook-util.c deleted file mode 100644 index 3d5ad8dc37..0000000000 --- a/addressbook/gui/widgets/e-addressbook-util.c +++ /dev/null @@ -1,364 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-table-field-chooser.c - * Copyright (C) 2001 Ximian, Inc. - * Author: Chris Toshok <toshok@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 "e-addressbook-util.h" - -#include <gnome.h> - -#include "e-card-merging.h" -#include <shell/evolution-shell-client.h> -#include <addressbook/backend/ebook/e-book-util.h> - -void -e_addressbook_error_dialog (const gchar *msg, EBookStatus status) -{ - static char *status_to_string[] = { - N_("Success"), - N_("Unknown error"), - N_("Repository offline"), - N_("Permission denied"), - N_("Card not found"), - N_("Card ID already exists"), - N_("Protocol not supported"), - N_("Cancelled"), - N_("Authentication Failed"), - N_("Authentication Required"), - N_("TLS not Available"), - N_("Addressbook does not exist"), - N_("Other error") - }; - char *error_msg; - GtkWidget *dialog; - - error_msg = g_strdup_printf ("%s: %s", msg, _(status_to_string [status])); - - dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - error_msg); - - g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL); - - gtk_widget_show (dialog); - - g_free (error_msg); -} - -gint -e_addressbook_prompt_save_dialog (GtkWindow *parent) -{ - GtkWidget *dialog; - gint response; - - dialog = gtk_message_dialog_new (parent, - (GtkDialogFlags)0, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_NONE, - _("Do you want to save changes?")); - gtk_dialog_add_buttons (GTK_DIALOG (dialog), - GTK_STOCK_YES, GTK_RESPONSE_YES, - GTK_STOCK_NO, GTK_RESPONSE_NO, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - NULL); - - gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES); - - response = gtk_dialog_run (GTK_DIALOG (dialog)); - - gtk_widget_destroy (dialog); - - return response; -} - -static void -added_cb (EBook* book, EBookStatus status, const char *id, - gboolean is_list) -{ - if (status != E_BOOK_STATUS_SUCCESS) { - e_addressbook_error_dialog (is_list ? _("Error adding list") : _("Error adding card"), status); - } -} - -static void -modified_cb (EBook* book, EBookStatus status, - gboolean is_list) -{ - if (status != E_BOOK_STATUS_SUCCESS) { - e_addressbook_error_dialog (is_list ? _("Error modifying list") : _("Error modifying card"), - status); - } -} - -static void -deleted_cb (EBook* book, EBookStatus status, - gboolean is_list) -{ - if (status != E_BOOK_STATUS_SUCCESS) { - e_addressbook_error_dialog (is_list ? _("Error removing list") : _("Error removing card"), - status); - } -} - -static void -editor_closed_cb (GtkObject *editor, gpointer data) -{ - g_object_unref (editor); -} - -EContactEditor * -e_addressbook_show_contact_editor (EBook *book, ECard *card, - gboolean is_new_card, - gboolean editable) -{ - EContactEditor *ce; - - ce = e_contact_editor_new (book, card, is_new_card, editable); - - g_signal_connect (ce, "card_added", - G_CALLBACK (added_cb), GINT_TO_POINTER (FALSE)); - g_signal_connect (ce, "card_modified", - G_CALLBACK (modified_cb), GINT_TO_POINTER (FALSE)); - g_signal_connect (ce, "card_deleted", - G_CALLBACK (deleted_cb), GINT_TO_POINTER (FALSE)); - g_signal_connect (ce, "editor_closed", - G_CALLBACK (editor_closed_cb), NULL); - - return ce; -} - -EContactListEditor * -e_addressbook_show_contact_list_editor (EBook *book, ECard *card, - gboolean is_new_card, - gboolean editable) -{ - EContactListEditor *ce; - - ce = e_contact_list_editor_new (book, card, is_new_card, editable); - - g_signal_connect (ce, "list_added", - G_CALLBACK (added_cb), GINT_TO_POINTER (TRUE)); - g_signal_connect (ce, "list_modified", - G_CALLBACK (modified_cb), GINT_TO_POINTER (TRUE)); - g_signal_connect (ce, "list_deleted", - G_CALLBACK (deleted_cb), GINT_TO_POINTER (TRUE)); - g_signal_connect (ce, "editor_closed", - G_CALLBACK (editor_closed_cb), GINT_TO_POINTER (TRUE)); - - e_contact_list_editor_show (ce); - - return ce; -} - -static void -view_cards (EBook *book, GList *list, gboolean editable) -{ - for (; list; list = list->next) { - ECard *card = list->data; - if (e_card_evolution_list (card)) - e_addressbook_show_contact_list_editor (book, card, FALSE, editable); - else - e_addressbook_show_contact_editor (book, card, FALSE, editable); - } -} - -void -e_addressbook_show_multiple_cards (EBook *book, - GList *list, - gboolean editable) -{ - if (list) { - int length = g_list_length (list); - if (length > 5) { - GtkWidget *dialog; - gint response; - - dialog = gtk_message_dialog_new (NULL, - 0, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_YES_NO, - _("Opening %d cards will open %d new windows as well.\n" - "Do you really want to display all of these cards?"), - length, - length); - - response = gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - if (response == GTK_RESPONSE_YES) - view_cards (book, list, editable); - } else { - view_cards (book, list, editable); - } - } -} - - - -typedef struct CardCopyProcess_ CardCopyProcess; - -typedef void (*CardCopyDone) (CardCopyProcess *process); - -struct CardCopyProcess_ { - int count; - GList *cards; - EBook *source; - EBook *destination; - CardCopyDone done_cb; -}; - -static void -card_deleted_cb (EBook* book, EBookStatus status, gpointer user_data) -{ - if (status != E_BOOK_STATUS_SUCCESS) { - e_addressbook_error_dialog (_("Error removing card"), status); - } -} - -static void -do_delete (gpointer data, gpointer user_data) -{ - EBook *book = user_data; - ECard *card = data; - - e_book_remove_card(book, card, card_deleted_cb, NULL); -} - -static void -delete_cards (CardCopyProcess *process) -{ - g_list_foreach (process->cards, - do_delete, - process->source); -} - -static void -process_unref (CardCopyProcess *process) -{ - process->count --; - if (process->count == 0) { - if (process->done_cb) { - process->done_cb (process); - } - e_free_object_list(process->cards); - g_object_unref (process->source); - g_object_unref (process->destination); - g_free (process); - } -} - -static void -card_added_cb (EBook* book, EBookStatus status, const char *id, gpointer user_data) -{ - CardCopyProcess *process = user_data; - - if (status != E_BOOK_STATUS_SUCCESS) { - e_addressbook_error_dialog (_("Error adding card"), status); - } else { - process_unref (process); - } -} - -static void -do_copy (gpointer data, gpointer user_data) -{ - EBook *book; - ECard *card; - CardCopyProcess *process; - - process = user_data; - card = data; - - book = process->destination; - - process->count ++; - e_book_add_card(book, card, card_added_cb, process); -} - -static void -got_book_cb (EBook *book, gpointer closure) -{ - CardCopyProcess *process; - process = closure; - if (book) { - process->destination = book; - g_object_ref (book); - g_list_foreach (process->cards, - do_copy, - process); - } - process_unref (process); -} - -extern EvolutionShellClient *global_shell_client; - -void -e_addressbook_transfer_cards (EBook *source, GList *cards /* adopted */, gboolean delete_from_source, GtkWindow *parent_window) -{ - const char *allowed_types[] = { "contacts/*", NULL }; - GNOME_Evolution_Folder *folder; - static char *last_uri = NULL; - CardCopyProcess *process; - char *desc; - - if (cards == NULL) - return; - - if (last_uri == NULL) - last_uri = g_strdup (""); - - if (cards->next == NULL) { - if (delete_from_source) - desc = _("Move card to"); - else - desc = _("Copy card to"); - } else { - if (delete_from_source) - desc = _("Move cards to"); - else - desc = _("Copy cards to"); - } - - evolution_shell_client_user_select_folder (global_shell_client, - parent_window, - desc, last_uri, allowed_types, - &folder); - if (!folder) - return; - - if (strcmp (last_uri, folder->evolutionUri) != 0) { - g_free (last_uri); - last_uri = g_strdup (folder->evolutionUri); - } - - process = g_new (CardCopyProcess, 1); - process->count = 1; - process->source = source; - g_object_ref (source); - process->cards = cards; - process->destination = NULL; - - if (delete_from_source) - process->done_cb = delete_cards; - else - process->done_cb = NULL; - - e_book_use_address_book_by_uri (folder->physicalUri, got_book_cb, process); - - CORBA_free (folder); -} diff --git a/addressbook/gui/widgets/e-addressbook-util.h b/addressbook/gui/widgets/e-addressbook-util.h deleted file mode 100644 index f0681cea4d..0000000000 --- a/addressbook/gui/widgets/e-addressbook-util.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-addressbook-util.h - * Copyright (C) 2001 Ximian, Inc. - * Author: Chris Toshok <toshok@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_ADDRESSBOOK_UTIL_H__ -#define __E_ADDRESSBOOK_UTIL_H__ - -#include "addressbook/backend/ebook/e-book.h" -#include "addressbook/gui/contact-editor/e-contact-editor.h" -#include "addressbook/gui/contact-list-editor/e-contact-list-editor.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -void e_addressbook_error_dialog (const gchar *msg, - EBookStatus status); -gint e_addressbook_prompt_save_dialog (GtkWindow *parent); -EContactEditor *e_addressbook_show_contact_editor (EBook *book, - ECard *card, - gboolean is_new_card, - gboolean editable); -EContactListEditor *e_addressbook_show_contact_list_editor (EBook *book, - ECard *card, - gboolean is_new_card, - gboolean editable); -void e_addressbook_show_multiple_cards (EBook *book, - GList *list, - gboolean editable); -void e_addressbook_transfer_cards (EBook *source, - GList *cards, /* adopted */ - gboolean delete_from_source, - GtkWindow *parent_window); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __E_ADDRESSBOOK_UTIL_H__ */ diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c deleted file mode 100644 index f4ef08af98..0000000000 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ /dev/null @@ -1,2069 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-table-field-chooser.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 <gtk/gtk.h> - -#include <libgnome/gnome-i18n.h> -#include <libgnome/gnome-util.h> -#include <gal/e-table/e-table-scrolled.h> -#include <gal/e-table/e-table-model.h> -#include <gal/widgets/e-scroll-frame.h> -#include <gal/widgets/e-popup-menu.h> -#include <gal/widgets/e-gui-utils.h> -#include <gal/menus/gal-view-factory-etable.h> -#include <gal/menus/gal-view-etable.h> -#include <gal/util/e-xml-utils.h> -#include <libgnomeui/gnome-dialog-util.h> - -#include <libgnomeprint/gnome-print.h> -#include <libgnomeprint/gnome-print-master.h> -#include <libgnomeprintui/gnome-print-dialog.h> -#include <libgnomeprintui/gnome-print-master-preview.h> - -#include "addressbook/printing/e-contact-print.h" -#include "addressbook/printing/e-contact-print-envelope.h" - -#include "gal-view-factory-minicard.h" -#include "gal-view-minicard.h" -#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW -#include <gal/widgets/e-treeview-selection-model.h> -#include "gal-view-factory-treeview.h" -#include "gal-view-treeview.h" -#endif - -#include "e-addressbook-marshal.h" -#include "e-addressbook-view.h" -#include "e-addressbook-model.h" -#include "e-addressbook-util.h" -#include "e-addressbook-table-adapter.h" -#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW -#include "e-addressbook-treeview-adapter.h" -#endif -#include "e-addressbook-reflow-adapter.h" -#include "e-minicard-view-widget.h" -#include "e-contact-save-as.h" -#include "e-card-merging.h" - -#include "e-contact-editor.h" -#include <gdk/gdkkeysyms.h> -#include <ctype.h> - -#include <libxml/tree.h> -#include <libxml/parser.h> - -#define SHOW_ALL_SEARCH "(contains \"x-evolution-any-field\" \"\")" - -#define d(x) - -static void e_addressbook_view_init (EAddressbookView *card); -static void e_addressbook_view_class_init (EAddressbookViewClass *klass); - -static void e_addressbook_view_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void e_addressbook_view_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); - -static void e_addressbook_view_dispose (GObject *object); -static void change_view_type (EAddressbookView *view, EAddressbookViewType view_type); - -static void status_message (GtkObject *object, const gchar *status, EAddressbookView *eav); -static void search_result (GtkObject *object, EBookViewStatus status, EAddressbookView *eav); -static void folder_bar_message (GtkObject *object, const gchar *status, EAddressbookView *eav); -static void stop_state_changed (GtkObject *object, EAddressbookView *eav); -static void writable_status (GtkObject *object, gboolean writable, EAddressbookView *eav); -static void backend_died (GtkObject *object, EAddressbookView *eav); -static void command_state_change (EAddressbookView *eav); -static void alphabet_state_change (EAddressbookView *eav, gunichar letter); - -static void selection_clear_event (GtkWidget *invisible, GdkEventSelection *event, - EAddressbookView *view); -static void selection_received (GtkWidget *invisible, GtkSelectionData *selection_data, - guint time, EAddressbookView *view); -static void selection_get (GtkWidget *invisible, GtkSelectionData *selection_data, - guint info, guint time_stamp, EAddressbookView *view); -static void invisible_destroyed (gpointer data, GObject *where_object_was); - -static GtkTableClass *parent_class = NULL; - -/* The arguments we take */ -enum { - PROP_0, - PROP_BOOK, - PROP_QUERY, - PROP_TYPE, -}; - -enum { - STATUS_MESSAGE, - SEARCH_RESULT, - FOLDER_BAR_MESSAGE, - COMMAND_STATE_CHANGE, - ALPHABET_STATE_CHANGE, - LAST_SIGNAL -}; - -enum DndTargetType { - DND_TARGET_TYPE_VCARD, -}; -#define VCARD_TYPE "text/x-vcard" -static GtkTargetEntry drag_types[] = { - { VCARD_TYPE, 0, DND_TARGET_TYPE_VCARD }, -}; -static const int num_drag_types = sizeof (drag_types) / sizeof (drag_types[0]); - -static guint e_addressbook_view_signals [LAST_SIGNAL] = {0, }; - -static GdkAtom clipboard_atom = GDK_NONE; - -static GalViewCollection *collection = NULL; - -GType -e_addressbook_view_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (EAddressbookViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_addressbook_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EAddressbookView), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_addressbook_view_init, - }; - - type = g_type_register_static (GTK_TYPE_TABLE, "EAddressbookView", &info, 0); - } - - return type; -} - -static void -e_addressbook_view_class_init (EAddressbookViewClass *klass) -{ - GObjectClass *object_class; - GtkWidgetClass *widget_class; - - object_class = G_OBJECT_CLASS(klass); - widget_class = GTK_WIDGET_CLASS(klass); - - parent_class = gtk_type_class (gtk_table_get_type ()); - - object_class->set_property = e_addressbook_view_set_property; - object_class->get_property = e_addressbook_view_get_property; - object_class->dispose = e_addressbook_view_dispose; - - g_object_class_install_property (object_class, PROP_BOOK, - g_param_spec_object ("book", - _("Book"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_BOOK, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_QUERY, - g_param_spec_string ("query", - _("Query"), - /*_( */"XXX blurb" /*)*/, - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_TYPE, - g_param_spec_int ("type", - _("Type"), - /*_( */"XXX blurb" /*)*/, - E_ADDRESSBOOK_VIEW_NONE, -#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW - E_ADDRESSBOOK_VIEW_TREEVIEW, -#else - E_ADDRESSBOOK_VIEW_MINICARD, -#endif - E_ADDRESSBOOK_VIEW_NONE, - G_PARAM_READWRITE)); - - e_addressbook_view_signals [STATUS_MESSAGE] = - g_signal_new ("status_message", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookViewClass, status_message), - NULL, NULL, - e_addressbook_marshal_NONE__POINTER, - G_TYPE_NONE, 1, G_TYPE_POINTER); - - e_addressbook_view_signals [SEARCH_RESULT] = - g_signal_new ("search_result", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookViewClass, search_result), - NULL, NULL, - e_addressbook_marshal_NONE__INT, - G_TYPE_NONE, 1, G_TYPE_INT); - - e_addressbook_view_signals [FOLDER_BAR_MESSAGE] = - g_signal_new ("folder_bar_message", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookViewClass, folder_bar_message), - NULL, NULL, - e_addressbook_marshal_NONE__POINTER, - G_TYPE_NONE, 1, G_TYPE_POINTER); - - e_addressbook_view_signals [COMMAND_STATE_CHANGE] = - g_signal_new ("command_state_change", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookViewClass, command_state_change), - NULL, NULL, - e_addressbook_marshal_NONE__NONE, - G_TYPE_NONE, 0); - - e_addressbook_view_signals [ALPHABET_STATE_CHANGE] = - g_signal_new ("alphabet_state_change", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookViewClass, alphabet_state_change), - NULL, NULL, - e_addressbook_marshal_NONE__UINT, - G_TYPE_NONE, 1, G_TYPE_UINT); - - - if (!clipboard_atom) - clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE); -} - -static void -e_addressbook_view_init (EAddressbookView *eav) -{ - eav->view_type = E_ADDRESSBOOK_VIEW_NONE; - - eav->model = e_addressbook_model_new (); - - g_signal_connect (eav->model, - "status_message", - G_CALLBACK (status_message), - eav); - - g_signal_connect (eav->model, - "search_result", - G_CALLBACK (search_result), - eav); - - g_signal_connect (eav->model, - "folder_bar_message", - G_CALLBACK (folder_bar_message), - eav); - - g_signal_connect (eav->model, - "stop_state_changed", - G_CALLBACK (stop_state_changed), - eav); - - g_signal_connect (eav->model, - "writable_status", - G_CALLBACK (writable_status), - eav); - - g_signal_connect (eav->model, - "backend_died", - G_CALLBACK (backend_died), - eav); - - eav->editable = FALSE; - eav->book = NULL; - eav->query = g_strdup (SHOW_ALL_SEARCH); - - eav->object = NULL; - eav->widget = NULL; - - eav->view_instance = NULL; - eav->view_menus = NULL; - eav->uic = NULL; - eav->current_alphabet_widget = NULL; - - eav->invisible = gtk_invisible_new (); - - gtk_selection_add_target (eav->invisible, - clipboard_atom, - GDK_SELECTION_TYPE_STRING, - 0); - - g_signal_connect (eav->invisible, "selection_get", - G_CALLBACK (selection_get), - eav); - g_signal_connect (eav->invisible, "selection_clear_event", - G_CALLBACK (selection_clear_event), - eav); - g_signal_connect (eav->invisible, "selection_received", - G_CALLBACK (selection_received), - eav); - g_object_weak_ref (G_OBJECT (eav->invisible), invisible_destroyed, eav); -} - -static void -e_addressbook_view_dispose (GObject *object) -{ - EAddressbookView *eav = E_ADDRESSBOOK_VIEW(object); - - if (eav->model) { - g_object_unref (eav->model); - eav->model = NULL; - } - - if (eav->book) { - g_object_unref (eav->book); - eav->book = NULL; - } - - if (eav->query) { - g_free(eav->query); - eav->query = NULL; - } - - eav->uic = NULL; - - if (eav->view_instance) { - g_object_unref (eav->view_instance); - eav->view_instance = NULL; - } - - if (eav->view_menus) { - g_object_unref (eav->view_menus); - eav->view_menus = NULL; - } - - if (eav->clipboard_cards) { - g_list_foreach (eav->clipboard_cards, (GFunc)g_object_unref, NULL); - g_list_free (eav->clipboard_cards); - eav->clipboard_cards = NULL; - } - - if (eav->invisible) { - gtk_widget_destroy (eav->invisible); - eav->invisible = NULL; - } - - if (G_OBJECT_CLASS(parent_class)->dispose) - G_OBJECT_CLASS(parent_class)->dispose(object); -} - -GtkWidget* -e_addressbook_view_new (void) -{ - GtkWidget *widget = GTK_WIDGET (g_object_new (E_TYPE_ADDRESSBOOK_VIEW, NULL)); - return widget; -} - -static void -writable_status (GtkObject *object, gboolean writable, EAddressbookView *eav) -{ - eav->editable = writable; - command_state_change (eav); -} - -static void -init_collection (void) -{ - GalViewFactory *factory; - ETableSpecification *spec; - char *galview; - - if (collection == NULL) { - collection = gal_view_collection_new(); - - gal_view_collection_set_title (collection, _("Addressbook")); - - galview = gnome_util_prepend_user_home("/evolution/views/addressbook/"); - gal_view_collection_set_storage_directories - (collection, - EVOLUTION_DATADIR "/evolution/views/addressbook/", - galview); - g_free(galview); - - spec = e_table_specification_new(); - e_table_specification_load_from_file (spec, EVOLUTION_ETSPECDIR "/e-addressbook-view.etspec"); - - factory = gal_view_factory_etable_new (spec); - g_object_unref (spec); - gal_view_collection_add_factory (collection, factory); - g_object_unref (factory); - - factory = gal_view_factory_minicard_new (); - gal_view_collection_add_factory (collection, factory); - g_object_unref (factory); - -#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW - factory = gal_view_factory_treeview_new (); - gal_view_collection_add_factory (collection, factory); - g_object_unref (factory); -#endif - - gal_view_collection_load(collection); - } -} - -static void -display_view(GalViewInstance *instance, - GalView *view, - gpointer data) -{ - EAddressbookView *address_view = data; - if (GAL_IS_VIEW_ETABLE(view)) { - change_view_type (address_view, E_ADDRESSBOOK_VIEW_TABLE); - gal_view_etable_attach_table (GAL_VIEW_ETABLE(view), e_table_scrolled_get_table(E_TABLE_SCROLLED(address_view->widget))); - } else if (GAL_IS_VIEW_MINICARD(view)) { - change_view_type (address_view, E_ADDRESSBOOK_VIEW_MINICARD); - gal_view_minicard_attach (GAL_VIEW_MINICARD(view), E_MINICARD_VIEW_WIDGET (address_view->object)); - } -#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW - else if (GAL_IS_VIEW_TREEVIEW (view)) { - change_view_type (address_view, E_ADDRESSBOOK_VIEW_TREEVIEW); - gal_view_treeview_attach (GAL_VIEW_TREEVIEW(view), GTK_TREE_VIEW (address_view->object)); - } -#endif - address_view->current_view = view; -} - -static void -setup_menus (EAddressbookView *view) -{ - if (view->book && view->view_instance == NULL) { - init_collection (); - view->view_instance = gal_view_instance_new (collection, e_book_get_uri (view->book)); - } - - if (view->view_instance && view->uic) { - view->view_menus = gal_view_menus_new(view->view_instance); - gal_view_menus_apply(view->view_menus, view->uic, NULL); - - display_view (view->view_instance, gal_view_instance_get_current_view (view->view_instance), view); - - g_signal_connect(view->view_instance, "display_view", - G_CALLBACK (display_view), view); - } -} - -static void -e_addressbook_view_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - EAddressbookView *eav = E_ADDRESSBOOK_VIEW(object); - - switch (prop_id){ - case PROP_BOOK: - if (eav->book) { - g_object_unref (eav->book); - } - if (g_value_get_object (value)) { - eav->book = E_BOOK(g_value_get_object (value)); - g_object_ref (eav->book); - } - else - eav->book = NULL; - - if (eav->view_instance) { - g_object_unref (eav->view_instance); - eav->view_instance = NULL; - } - - g_object_set(eav->model, - "book", eav->book, - NULL); - - setup_menus (eav); - - break; - case PROP_QUERY: -#if 0 /* This code will mess up ldap a bit. We need to think about the ramifications of this more. */ - if ((g_value_get_string (value) == NULL && !strcmp (eav->query, SHOW_ALL_SEARCH)) || - (g_value_get_string (value) != NULL && !strcmp (eav->query, g_value_get_string (value)))) - break; -#endif - g_free(eav->query); - eav->query = g_strdup(g_value_get_string (value)); - if (!eav->query) - eav->query = g_strdup (SHOW_ALL_SEARCH); - g_object_set(eav->model, - "query", eav->query, - NULL); - if (eav->current_alphabet_widget != NULL) { - GtkWidget *current = eav->current_alphabet_widget; - - eav->current_alphabet_widget = NULL; - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (current), FALSE); - } - break; - case PROP_TYPE: - change_view_type(eav, g_value_get_int (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_addressbook_view_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - EAddressbookView *eav = E_ADDRESSBOOK_VIEW(object); - - switch (prop_id) { - case PROP_BOOK: - if (eav->book) - g_value_set_object (value, eav->book); - else - g_value_set_object (value, NULL); - break; - case PROP_QUERY: - g_value_set_string (value, eav->query); - break; - case PROP_TYPE: - g_value_set_int (value, eav->view_type); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static ESelectionModel* -get_selection_model (EAddressbookView *view) -{ - if (view->view_type == E_ADDRESSBOOK_VIEW_MINICARD) - return e_minicard_view_widget_get_selection_model (E_MINICARD_VIEW_WIDGET(view->object)); - else if (view->view_type == E_ADDRESSBOOK_VIEW_TABLE) - return e_table_get_selection_model (e_table_scrolled_get_table (E_TABLE_SCROLLED(view->widget))); -#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW - else if (view->view_type == E_ADDRESSBOOK_VIEW_TREEVIEW) { - return e_treeview_get_selection_model (GTK_TREE_VIEW (view->object)); - } -#endif -} - -/* Popup menu stuff */ -typedef struct { - EAddressbookView *view; - EPopupMenu *submenu; - gpointer closure; -} CardAndBook; - -static ESelectionModel* -card_and_book_get_selection_model (CardAndBook *card_and_book) -{ - return get_selection_model (card_and_book->view); -} - -static void -card_and_book_free (CardAndBook *card_and_book) -{ - EAddressbookView *view = card_and_book->view; - ESelectionModel *selection; - - if (card_and_book->submenu) - gal_view_instance_free_popup_menu (view->view_instance, - card_and_book->submenu); - - selection = card_and_book_get_selection_model (card_and_book); - if (selection) - e_selection_model_right_click_up(selection); - - g_object_unref (view); -} - -static void -get_card_list_1(gint model_row, - gpointer closure) -{ - CardAndBook *card_and_book; - GList **list; - EAddressbookView *view; - ECard *card; - - card_and_book = closure; - list = card_and_book->closure; - view = card_and_book->view; - - card = e_addressbook_model_get_card(view->model, model_row); - *list = g_list_prepend(*list, card); -} - -static GList * -get_card_list (CardAndBook *card_and_book) -{ - GList *list = NULL; - ESelectionModel *selection; - - selection = card_and_book_get_selection_model (card_and_book); - - if (selection) { - card_and_book->closure = &list; - e_selection_model_foreach (selection, get_card_list_1, card_and_book); - } - - return list; -} - -static void -has_email_address_1(gint model_row, - gpointer closure) -{ - CardAndBook *card_and_book; - gboolean *has_email; - EAddressbookView *view; - const ECard *card; - EList *email; - - card_and_book = closure; - has_email = card_and_book->closure; - view = card_and_book->view; - - if (*has_email) - return; - - card = e_addressbook_model_peek_card(view->model, model_row); - - g_object_get (G_OBJECT (card), - "email", &email, - NULL); - - if (e_list_length (email) > 0) - *has_email = TRUE; -} - -static gboolean -get_has_email_address (CardAndBook *card_and_book) -{ - ESelectionModel *selection; - gboolean has_email = FALSE; - - selection = card_and_book_get_selection_model (card_and_book); - - if (selection) { - card_and_book->closure = &has_email; - e_selection_model_foreach (selection, has_email_address_1, card_and_book); - } - - return has_email; -} - -static void -save_as (GtkWidget *widget, CardAndBook *card_and_book) -{ - GList *cards = get_card_list (card_and_book); - if (cards) { - e_contact_list_save_as(_("Save as VCard"), cards, NULL); - e_free_object_list(cards); - } -} - -static void -send_as (GtkWidget *widget, CardAndBook *card_and_book) -{ - GList *cards = get_card_list (card_and_book); - if (cards) { - e_card_list_send(cards, E_CARD_DISPOSITION_AS_ATTACHMENT); - e_free_object_list(cards); - } -} - -static void -send_to (GtkWidget *widget, CardAndBook *card_and_book) - -{ - GList *cards = get_card_list (card_and_book); - - if (cards) { - e_card_list_send(cards, E_CARD_DISPOSITION_AS_TO); - e_free_object_list(cards); - } -} - -static void -print (GtkWidget *widget, CardAndBook *card_and_book) -{ - GList *cards = get_card_list (card_and_book); - if (cards) { - if (cards->next) - gtk_widget_show(e_contact_print_card_list_dialog_new(cards)); - else - gtk_widget_show(e_contact_print_card_dialog_new(cards->data)); - e_free_object_list(cards); - } -} - -#if 0 /* Envelope printing is disabled for Evolution 1.0. */ -static void -print_envelope (GtkWidget *widget, CardAndBook *card_and_book) -{ - GList *cards = get_card_list (card_and_book); - if (cards) { - gtk_widget_show(e_contact_list_print_envelope_dialog_new(card_and_book->card)); - e_free_object_list(cards); - } -} -#endif - -static void -copy (GtkWidget *widget, CardAndBook *card_and_book) -{ - e_addressbook_view_copy (card_and_book->view); -} - -static void -paste (GtkWidget *widget, CardAndBook *card_and_book) -{ - e_addressbook_view_paste (card_and_book->view); -} - -static void -cut (GtkWidget *widget, CardAndBook *card_and_book) -{ - e_addressbook_view_cut (card_and_book->view); -} - -static void -delete (GtkWidget *widget, CardAndBook *card_and_book) -{ - if (e_contact_editor_confirm_delete(GTK_WINDOW(gtk_widget_get_toplevel(card_and_book->view->widget)))) { - EBook *book; - - GList *list = get_card_list(card_and_book); - GList *iterator; - - g_object_get(card_and_book->view->model, - "book", &book, - NULL); - - for (iterator = list; iterator; iterator = iterator->next) { - ECard *card = iterator->data; - /* Remove the card. */ - e_book_remove_card (book, - card, - NULL, - NULL); - } - e_free_object_list(list); - } -} - -static void -copy_to_folder (GtkWidget *widget, CardAndBook *card_and_book) -{ - e_addressbook_view_copy_to_folder (card_and_book->view); -} - -static void -move_to_folder (GtkWidget *widget, CardAndBook *card_and_book) -{ - e_addressbook_view_move_to_folder (card_and_book->view); -} - -static void -free_popup_info (GtkWidget *w, CardAndBook *card_and_book) -{ - card_and_book_free (card_and_book); -} - -static void -new_card (GtkWidget *widget, CardAndBook *card_and_book) -{ - EBook *book; - - g_object_get(card_and_book->view->model, - "book", &book, - NULL); - e_addressbook_show_contact_editor (book, e_card_new(""), TRUE, TRUE); -} - -static void -new_list (GtkWidget *widget, CardAndBook *card_and_book) -{ - EBook *book; - - g_object_get(card_and_book->view->model, - "book", &book, - NULL); - e_addressbook_show_contact_list_editor (book, e_card_new(""), TRUE, TRUE); -} - -#if 0 -static void -sources (GtkWidget *widget, CardAndBook *card_and_book) -{ - BonoboControl *control; - GNOME_Evolution_ShellView shell_view; - CORBA_Environment ev; - - control = g_object_get_data (G_OBJECT (gcal), "control"); - if (control == NULL) - return; - - shell_view = get_shell_view_interface (control); - if (shell_view == CORBA_OBJECT_NIL) - return; - - CORBA_exception_init (&ev); - - GNOME_Evolution_ShellView_showSettings (shell_view, &ev); - - if (BONOBO_EX (&ev)) - g_message ("control_util_show_settings(): Could not show settings"); - - CORBA_exception_free (&ev); -} -#endif - -#define POPUP_READONLY_MASK 0x1 -#define POPUP_NOSELECTION_MASK 0x2 -#define POPUP_NOEMAIL_MASK 0x4 - -static void -do_popup_menu(EAddressbookView *view, GdkEvent *event) -{ - CardAndBook *card_and_book; - GtkMenu *popup; - EPopupMenu *submenu = NULL; - ESelectionModel *selection_model; - gboolean selection = FALSE; - - EPopupMenu menu[] = { - E_POPUP_ITEM (N_("New Contact..."), G_CALLBACK(new_card), POPUP_READONLY_MASK), - E_POPUP_ITEM (N_("New Contact List..."), G_CALLBACK(new_list), POPUP_READONLY_MASK), - E_POPUP_SEPARATOR, -#if 0 - E_POPUP_ITEM (N_("Go to Folder..."), G_CALLBACK (goto_folder), 0), - E_POPUP_ITEM (N_("Import..."), G_CALLBACK (import), POPUP_READONLY_MASK), - E_POPUP_SEPARATOR, - E_POPUP_ITEM (N_("Search for Contacts..."), G_CALLBACK (search), 0), - E_POPUP_ITEM (N_("Addressbook Sources..."), G_CALLBACK (sources), 0), - E_POPUP_SEPARATOR, - E_POPUP_ITEM (N_("Pilot Settings..."), G_CALLBACK (pilot_settings), 0), -#endif - E_POPUP_SEPARATOR, - E_POPUP_ITEM (N_("Save as VCard"), G_CALLBACK(save_as), POPUP_NOSELECTION_MASK), - E_POPUP_ITEM (N_("Forward Contact"), G_CALLBACK(send_as), POPUP_NOSELECTION_MASK), - E_POPUP_ITEM (N_("Send Message to Contact"), G_CALLBACK(send_to), POPUP_NOSELECTION_MASK | POPUP_NOEMAIL_MASK), - E_POPUP_ITEM (N_("Print"), G_CALLBACK(print), POPUP_NOSELECTION_MASK), -#if 0 /* Envelope printing is disabled for Evolution 1.0. */ - E_POPUP_ITEM (N_("Print Envelope"), G_CALLBACK(print_envelope), POPUP_NOSELECTION_MASK), -#endif - E_POPUP_SEPARATOR, - - E_POPUP_ITEM (N_("Copy to folder..."), G_CALLBACK(copy_to_folder), POPUP_NOSELECTION_MASK), - E_POPUP_ITEM (N_("Move to folder..."), G_CALLBACK(move_to_folder), POPUP_READONLY_MASK | POPUP_NOSELECTION_MASK), - E_POPUP_SEPARATOR, - - E_POPUP_ITEM (N_("Cut"), G_CALLBACK (cut), POPUP_READONLY_MASK | POPUP_NOSELECTION_MASK), - E_POPUP_ITEM (N_("Copy"), G_CALLBACK (copy), POPUP_NOSELECTION_MASK), - E_POPUP_ITEM (N_("Paste"), G_CALLBACK (paste), POPUP_READONLY_MASK), - E_POPUP_ITEM (N_("Delete"), G_CALLBACK(delete), POPUP_READONLY_MASK | POPUP_NOSELECTION_MASK), - E_POPUP_SEPARATOR, - -#if 0 - E_POPUP_SUBMENU (N_("Current View"), submenu = gal_view_instance_get_popup_menu (view->view_instance), 0), -#endif - E_POPUP_TERMINATOR - }; - - card_and_book = g_new(CardAndBook, 1); - card_and_book->view = view; - card_and_book->submenu = submenu; - - g_object_ref (card_and_book->view); - - selection_model = card_and_book_get_selection_model (card_and_book); - if (selection_model) - selection = e_selection_model_selected_count (selection_model) > 0; - - popup = e_popup_menu_create (menu, - 0, - (e_addressbook_model_editable (view->model) ? 0 : POPUP_READONLY_MASK) + - (selection ? 0 : POPUP_NOSELECTION_MASK) + - (get_has_email_address (card_and_book) ? 0 : POPUP_NOEMAIL_MASK), - card_and_book); - - g_signal_connect (popup, "selection-done", - G_CALLBACK (free_popup_info), card_and_book); - e_popup_menu (popup, event); - -} - - -/* Minicard view stuff */ - -/* Translators: put here a list of labels you want to see on buttons in - addressbook. You may use any character to separate labels but it must - also be placed at the begining ot the string */ -const char *button_labels = N_(",123,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z"); -/* Translators: put here a list of characters that correspond to buttons - in addressbook. You may use any character to separate labels but it - must also be placed at the begining ot the string. - Use lower case letters if possible. */ -const char *button_letters = N_(",0,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z"); - -typedef struct { - EAddressbookView *view; - GtkWidget *button; - GtkWidget *vbox; - gchar *letters; -} LetterClosure; - -static char ** -e_utf8_split (const char *utf8_str, gunichar delim) -{ - GSList *str_list = NULL, *sl; - int n = 0; - const char *str, *s; - char **str_array; - - g_return_val_if_fail (utf8_str != NULL, NULL); - - str = utf8_str; - while (*str != '\0') { - int len; - char *new_str; - - for (s = str; *s != '\0' && g_utf8_get_char (s) != delim; s = g_utf8_next_char (s)) - ; - len = s - str; - new_str = g_new (char, len + 1); - if (len > 0) { - memcpy (new_str, str, len); - } - new_str[len] = '\0'; - str_list = g_slist_prepend (str_list, new_str); - n++; - if (*s != '\0') { - str = g_utf8_next_char (s); - } else { - str = s; - } - } - - str_array = g_new (char *, n + 1); - str_array[n--] = NULL; - for (sl = str_list; sl != NULL; sl = sl->next) { - str_array[n--] = sl->data; - } - g_slist_free (str_list); - - return str_array; -} - -static void -jump_to_letters (EAddressbookView *view, gchar* l) -{ - char *query; - char *s; - char buf[6 + 1]; - - if (g_unichar_isdigit (g_utf8_get_char(l))) { - const char *letters = _(button_letters); - char **letter_v; - GString *gstr; - char **p; - - letter_v = e_utf8_split (g_utf8_next_char (letters), - g_utf8_get_char (letters)); - g_assert (letter_v != NULL && letter_v[0] != NULL); - gstr = g_string_new ("(not (or "); - for (p = letter_v + 1; *p != NULL; p++) { - for (s = *p; *s != '\0'; s = g_utf8_next_char (s)) { - buf [g_unichar_to_utf8 (g_utf8_get_char(s), buf)] = '\0'; - g_string_append_printf (gstr, "(beginswith \"file_as\" \"%s\")", buf); - } - } - g_string_append (gstr, "))"); - query = gstr->str; - g_strfreev (letter_v); - g_string_free (gstr, FALSE); - } else { - GString *gstr; - - gstr = g_string_new ("(or "); - - for (s = l; *s != '\0'; s = g_utf8_next_char (s)) { - buf [g_unichar_to_utf8 (g_utf8_get_char(s), buf)] = '\0'; - g_string_append_printf (gstr, "(beginswith \"file_as\" \"%s\")", buf); - } - - g_string_append (gstr, ")"); - query = gstr->str; - g_string_free (gstr, FALSE); - } - g_object_set (view, - "query", query, - NULL); - g_free (query); -} - -static void -button_toggled(GtkWidget *button, LetterClosure *closure) -{ - EAddressbookView *view = closure->view; - - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) { - GtkWidget *current = view->current_alphabet_widget; - - view->current_alphabet_widget = NULL; - if (current && current != button) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (current), FALSE); - jump_to_letters (view, closure->letters); - view->current_alphabet_widget = button; - alphabet_state_change (view, g_utf8_get_char(closure->letters)); - } else { - if (view->current_alphabet_widget != NULL && - view->current_alphabet_widget == button) { - view->current_alphabet_widget = NULL; - g_object_set (view, - "query", NULL, - NULL); - alphabet_state_change (view, 0); - } - } -} - -static void -free_closure(gpointer data, GObject *where_object_was) -{ - GtkWidget *button = GTK_WIDGET (where_object_was); - LetterClosure *closure = data; - if (button != NULL && - button == closure->view->current_alphabet_widget) { - closure->view->current_alphabet_widget = NULL; - } - g_free (closure->letters); - g_free (closure); -} - -static GtkWidget * -create_alphabet (EAddressbookView *view) -{ - GtkWidget *widget, *viewport, *vbox; - const char *labels, *letters; - char **label_v, **letter_v; - char **pl, **pc; - gunichar sep; - - widget = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (widget), - GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - - viewport = gtk_viewport_new (NULL, NULL); - gtk_container_add (GTK_CONTAINER (widget), viewport); - gtk_container_set_border_width (GTK_CONTAINER (viewport), 4); - gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_NONE); - - vbox = gtk_vbox_new (FALSE, 4); - gtk_container_add (GTK_CONTAINER (viewport), vbox); - gtk_widget_set_usize (vbox, 27, 0); - - labels = _(button_labels); - sep = g_utf8_get_char (labels); - label_v = e_utf8_split (g_utf8_next_char (labels), sep); - letters = _(button_letters); - sep = g_utf8_get_char (letters); - letter_v = e_utf8_split (g_utf8_next_char (letters), sep); - g_assert (label_v != NULL && letter_v != NULL); - for (pl = label_v, pc = letter_v; *pl != NULL && *pc != NULL; pl++, pc++) { - GtkWidget *button; - LetterClosure *closure; - char *label; - - label = *pl; - button = gtk_toggle_button_new_with_label (label); - gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); - - closure = g_new (LetterClosure, 1); - closure->view = view; - closure->letters = g_strdup (*pc); - closure->button = button; - closure->vbox = vbox; - g_signal_connect(button, "toggled", - G_CALLBACK (button_toggled), closure); - g_object_weak_ref (G_OBJECT (button), free_closure, closure); - - } - g_strfreev (label_v); - g_strfreev (letter_v); - - gtk_widget_show_all (widget); - - return widget; -} - -static void -selection_changed (GObject *o, EAddressbookView *view) -{ - command_state_change (view); -} - -static void -minicard_right_click (EMinicardView *minicard_view_item, GdkEvent *event, EAddressbookView *view) -{ - do_popup_menu(view, event); -} - -static void -create_minicard_view (EAddressbookView *view) -{ - GtkWidget *scrollframe; - GtkWidget *alphabet; - GtkWidget *minicard_view; - GtkWidget *minicard_hbox; - EAddressbookReflowAdapter *adapter; - - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - - minicard_hbox = gtk_hbox_new(FALSE, 0); - - adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(e_addressbook_reflow_adapter_new (view->model)); - minicard_view = e_minicard_view_widget_new(adapter); - - /* A hack */ - g_object_set_data (G_OBJECT (adapter), "view", view); - - g_signal_connect(minicard_view, "selection_change", - G_CALLBACK(selection_changed), view); - - g_signal_connect(minicard_view, "right_click", - G_CALLBACK(minicard_right_click), view); - - - view->object = G_OBJECT(minicard_view); - view->widget = minicard_hbox; - - scrollframe = e_scroll_frame_new (NULL, NULL); - e_scroll_frame_set_policy (E_SCROLL_FRAME (scrollframe), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - - gtk_container_add (GTK_CONTAINER (scrollframe), minicard_view); - - - gtk_box_pack_start(GTK_BOX(minicard_hbox), scrollframe, TRUE, TRUE, 0); - - alphabet = create_alphabet(view); - if (alphabet) { - g_object_ref (alphabet); - gtk_widget_unparent(alphabet); - gtk_box_pack_start(GTK_BOX(minicard_hbox), alphabet, FALSE, FALSE, 0); - g_object_unref (alphabet); - } - - gtk_table_attach(GTK_TABLE(view), minicard_hbox, - 0, 1, - 0, 1, - GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, - 0, 0); - - gtk_widget_show_all( GTK_WIDGET(minicard_hbox) ); - - gtk_widget_pop_colormap (); - - e_reflow_model_changed (E_REFLOW_MODEL (adapter)); - - g_object_unref (adapter); -} - -static void -table_double_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EAddressbookView *view) -{ - if (E_IS_ADDRESSBOOK_TABLE_ADAPTER(view->object)) { - EAddressbookModel *model = view->model; - ECard *card = e_addressbook_model_get_card(model, row); - EBook *book; - - g_object_get(model, - "book", &book, - NULL); - - g_assert (E_IS_BOOK (book)); - - if (e_card_evolution_list (card)) - e_addressbook_show_contact_list_editor (book, card, FALSE, view->editable); - else - e_addressbook_show_contact_editor (book, card, FALSE, view->editable); - } -} - -static gint -table_right_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EAddressbookView *view) -{ - do_popup_menu(view, event); - return TRUE; -} - -static gint -table_white_space_event(ETableScrolled *table, GdkEvent *event, EAddressbookView *view) -{ - if (event->type == GDK_BUTTON_PRESS && ((GdkEventButton *)event)->button == 3) { - do_popup_menu(view, event); - return TRUE; - } else { - return FALSE; - } -} - -static void -table_drag_data_get (ETable *table, - int row, - int col, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint info, - guint time, - gpointer user_data) -{ - EAddressbookView *view = user_data; - - if (!E_IS_ADDRESSBOOK_TABLE_ADAPTER(view->object)) - return; - - switch (info) { - case DND_TARGET_TYPE_VCARD: { - char *value; - - row = e_table_view_to_model_row (table, row); - value = e_card_get_vcard(view->model->data[row]); - - gtk_selection_data_set (selection_data, - selection_data->target, - 8, - value, strlen (value)); - break; - } - } -} - -static void -emit_status_message (EAddressbookView *eav, const gchar *status) -{ - g_signal_emit (eav, - e_addressbook_view_signals [STATUS_MESSAGE], 0, - status); -} - -static void -emit_search_result (EAddressbookView *eav, EBookViewStatus status) -{ - g_signal_emit (eav, - e_addressbook_view_signals [SEARCH_RESULT], 0, - status); -} - -static void -emit_folder_bar_message (EAddressbookView *eav, const gchar *message) -{ - g_signal_emit (eav, - e_addressbook_view_signals [FOLDER_BAR_MESSAGE], 0, - message); -} - -static void -status_message (GtkObject *object, const gchar *status, EAddressbookView *eav) -{ - emit_status_message (eav, status); -} - -static void -search_result (GtkObject *object, EBookViewStatus status, EAddressbookView *eav) -{ - emit_search_result (eav, status); -} - -static void -folder_bar_message (GtkObject *object, const gchar *status, EAddressbookView *eav) -{ - emit_folder_bar_message (eav, status); -} - -static void -stop_state_changed (GtkObject *object, EAddressbookView *eav) -{ - command_state_change (eav); -} - -static void -command_state_change (EAddressbookView *eav) -{ - /* Reffing during emission is unnecessary. Gtk automatically refs during an emission. */ - g_signal_emit (eav, e_addressbook_view_signals [COMMAND_STATE_CHANGE], 0); -} - -static void -alphabet_state_change (EAddressbookView *eav, gunichar letter) -{ - g_signal_emit (eav, e_addressbook_view_signals [ALPHABET_STATE_CHANGE], 0, letter); -} - -static void -backend_died (GtkObject *object, EAddressbookView *eav) -{ - char *message = g_strdup_printf (_("The addressbook backend for\n%s\nhas crashed. " - "You will have to restart Evolution in order " - "to use it again"), - e_book_get_uri (eav->book)); - gnome_error_dialog_parented (message, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (eav)))); - g_free (message); -} - -static void -create_table_view (EAddressbookView *view) -{ - ETableModel *adapter; - GtkWidget *table; - - adapter = e_addressbook_table_adapter_new(view->model); - - /* Here we create the table. We give it the three pieces of - the table we've created, the header, the model, and the - initial layout. It does the rest. */ - table = e_table_scrolled_new_from_spec_file (adapter, NULL, EVOLUTION_ETSPECDIR "/e-addressbook-view.etspec", NULL); - - view->object = G_OBJECT(adapter); - view->widget = table; - - g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "double_click", - G_CALLBACK(table_double_click), view); - g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "right_click", - G_CALLBACK(table_right_click), view); - g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "white_space_event", - G_CALLBACK(table_white_space_event), view); - g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "selection_change", - G_CALLBACK(selection_changed), view); - - /* drag & drop signals */ - e_table_drag_source_set (E_TABLE(E_TABLE_SCROLLED(table)->table), GDK_BUTTON1_MASK, - drag_types, num_drag_types, GDK_ACTION_MOVE); - - g_signal_connect (E_TABLE_SCROLLED(table)->table, - "table_drag_data_get", - G_CALLBACK (table_drag_data_get), - view); - - gtk_table_attach(GTK_TABLE(view), table, - 0, 1, - 0, 1, - GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, - 0, 0); - - gtk_widget_show( GTK_WIDGET(table) ); -} - -#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW -static void -treeview_row_activated(GtkTreeView *treeview, - GtkTreePath *path, GtkTreeViewColumn *column, - EAddressbookView *view) -{ - EAddressbookModel *model = view->model; - int row = gtk_tree_path_get_indices (path)[0]; - ECard *card = e_addressbook_model_get_card(model, row); - EBook *book; - - g_object_get(model, - "book", &book, - NULL); - - g_assert (E_IS_BOOK (book)); - - if (e_card_evolution_list (card)) - e_addressbook_show_contact_list_editor (book, card, FALSE, view->editable); - else - e_addressbook_show_contact_editor (book, card, FALSE, view->editable); -} - -static void -create_treeview_view (EAddressbookView *view) -{ - GtkTreeModel *adapter; - ECardSimple *simple; - GtkWidget *treeview; - GtkWidget *scrolled; - int i; - - simple = e_card_simple_new(NULL); - - adapter = e_addressbook_treeview_adapter_new(view->model); - - scrolled = gtk_scrolled_window_new (NULL, NULL); - treeview = gtk_tree_view_new_with_model (adapter); - - gtk_widget_show (treeview); - - gtk_container_add (GTK_CONTAINER (scrolled), treeview); - - for (i = 0; i < 15; i ++) { - GtkTreeViewColumn *column = - gtk_tree_view_column_new_with_attributes (e_card_simple_get_name (simple, i), - gtk_cell_renderer_text_new (), - "text", i, - NULL); - - gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column); - } - - view->object = G_OBJECT(treeview); - view->widget = scrolled; - - gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)), GTK_SELECTION_MULTIPLE); - gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (treeview), - GDK_BUTTON1_MASK, - drag_types, - num_drag_types, - GDK_ACTION_MOVE); - - g_signal_connect(treeview, "row_activated", - G_CALLBACK (treeview_row_activated), view); -#if 0 - g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "right_click", - G_CALLBACK(table_right_click), view); - - /* drag & drop signals */ - e_table_drag_source_set (E_TABLE(E_TABLE_SCROLLED(table)->table), GDK_BUTTON1_MASK, - drag_types, num_drag_types, GDK_ACTION_MOVE); - - g_signal_connect (E_TABLE_SCROLLED(table)->table, - "table_drag_data_get", - G_CALLBACK (table_drag_data_get), - view); -#endif - - - g_signal_connect(e_treeview_get_selection_model (GTK_TREE_VIEW (treeview)), "selection_changed", - G_CALLBACK(selection_changed), view); - - gtk_table_attach(GTK_TABLE(view), scrolled, - 0, 1, - 0, 1, - GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, - 0, 0); - - gtk_widget_show( GTK_WIDGET(scrolled) ); - - g_object_unref (simple); -} -#endif - -static void -change_view_type (EAddressbookView *view, EAddressbookViewType view_type) -{ - if (view_type == view->view_type) - return; - - if (view->widget) { - gtk_widget_destroy (view->widget); - view->widget = NULL; - } - view->object = NULL; - - switch (view_type) { - case E_ADDRESSBOOK_VIEW_MINICARD: - create_minicard_view (view); - break; - case E_ADDRESSBOOK_VIEW_TABLE: - create_table_view (view); - break; -#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW - case E_ADDRESSBOOK_VIEW_TREEVIEW: - create_treeview_view (view); - break; -#endif - default: - g_warning ("view_type not recognized."); - return; - } - - view->view_type = view_type; - - command_state_change (view); -} - -typedef struct { - GtkWidget *table; - GObject *printable; -} EContactPrintDialogWeakData; - -static void -e_contact_print_destroy(gpointer data, GObject *where_object_was) -{ - EContactPrintDialogWeakData *weak_data = data; - g_object_unref (weak_data->printable); - g_object_unref (weak_data->table); - g_free (weak_data); -} - -static void -e_contact_print_button(GtkDialog *dialog, gint button, gpointer data) -{ - GnomePrintMaster *master; - GnomePrintContext *pc; - EPrintable *printable = g_object_get_data(G_OBJECT(dialog), "printable"); - GtkWidget *preview; - switch( button ) { - case GNOME_PRINT_DIALOG_RESPONSE_PRINT: - master = gnome_print_master_new_from_config (gnome_print_dialog_get_config ( GNOME_PRINT_DIALOG(dialog) )); - pc = gnome_print_master_get_context( master ); - e_printable_reset(printable); - while (e_printable_data_left(printable)) { - if (gnome_print_gsave(pc) == -1) - /* FIXME */; - if (gnome_print_translate(pc, 72, 72) == -1) - /* FIXME */; - e_printable_print_page(printable, - pc, - 6.5 * 72, - 5 * 72, - TRUE); - if (gnome_print_grestore(pc) == -1) - /* FIXME */; - if (gnome_print_showpage(pc) == -1) - /* FIXME */; - } - gnome_print_master_close(master); - gnome_print_master_print(master); - g_object_unref (master); - gtk_widget_destroy((GtkWidget *)dialog); - break; - case GNOME_PRINT_DIALOG_RESPONSE_PREVIEW: - master = gnome_print_master_new_from_config (gnome_print_dialog_get_config ( GNOME_PRINT_DIALOG(dialog) )); - pc = gnome_print_master_get_context( master ); - e_printable_reset(printable); - while (e_printable_data_left(printable)) { - if (gnome_print_gsave(pc) == -1) - /* FIXME */; - if (gnome_print_translate(pc, 72, 72) == -1) - /* FIXME */; - e_printable_print_page(printable, - pc, - 6.5 * 72, - 9 * 72, - TRUE); - if (gnome_print_grestore(pc) == -1) - /* FIXME */; - if (gnome_print_showpage(pc) == -1) - /* FIXME */; - } - gnome_print_master_close(master); - preview = GTK_WIDGET(gnome_print_master_preview_new(master, "Print Preview")); - gtk_widget_show_all(preview); - g_object_unref (master); - break; - case GNOME_PRINT_DIALOG_RESPONSE_CANCEL: - default: - gtk_widget_destroy((GtkWidget *)dialog); - break; - } -} - -void -e_addressbook_view_setup_menus (EAddressbookView *view, - BonoboUIComponent *uic) -{ - - g_return_if_fail (view != NULL); - g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view)); - g_return_if_fail (uic != NULL); - g_return_if_fail (BONOBO_IS_UI_COMPONENT (uic)); - - init_collection (); - - view->uic = uic; - - setup_menus (view); -} - -/** - * e_addressbook_view_discard_menus: - * @view: An addressbook view. - * - * Makes an addressbook view discard its GAL view menus and its views instance - * objects. This should be called when the corresponding Bonobo component is - * deactivated. - **/ -void -e_addressbook_view_discard_menus (EAddressbookView *view) -{ - g_return_if_fail (view != NULL); - g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view)); - g_return_if_fail (view->view_instance); - - if (view->view_menus) { - gal_view_menus_unmerge (view->view_menus, NULL); - - g_object_unref (view->view_menus); - view->view_menus = NULL; - } - - if (view->view_instance) { - g_object_unref (view->view_instance); - view->view_instance = NULL; - } - - view->uic = NULL; -} - -void -e_addressbook_view_print(EAddressbookView *view) -{ - if (view->view_type == E_ADDRESSBOOK_VIEW_MINICARD) { - char *query; - EBook *book; - GtkWidget *print; - - g_object_get (view->model, - "query", &query, - "book", &book, - NULL); - print = e_contact_print_dialog_new(book, query); - g_free(query); - gtk_widget_show_all(print); - } - else if (view->view_type == E_ADDRESSBOOK_VIEW_TABLE) { - GtkWidget *dialog; - EPrintable *printable; - ETable *etable; - EContactPrintDialogWeakData *weak_data; - - dialog = gnome_print_dialog_new("Print cards", GNOME_PRINT_DIALOG_RANGE | GNOME_PRINT_DIALOG_COPIES); - gnome_print_dialog_construct_range_any(GNOME_PRINT_DIALOG(dialog), GNOME_PRINT_RANGE_ALL | GNOME_PRINT_RANGE_SELECTION, - NULL, NULL, NULL); - - g_object_get(view->widget, "table", &etable, NULL); - printable = e_table_get_printable(etable); - - g_object_ref (view->widget); - - g_object_set_data (G_OBJECT (dialog), "table", view->widget); - g_object_set_data (G_OBJECT (dialog), "printable", printable); - - g_signal_connect(dialog, - "clicked", G_CALLBACK(e_contact_print_button), NULL); - - weak_data = g_new (EContactPrintDialogWeakData, 1); - - weak_data->table = view->widget; - weak_data->printable = G_OBJECT (printable); - - g_object_weak_ref (G_OBJECT (dialog), e_contact_print_destroy, weak_data); - - gtk_widget_show(dialog); - } -#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW - else if (view->view_type == E_ADDRESSBOOK_VIEW_TREEVIEW) { - /* XXX */ - } -#endif -} - -void -e_addressbook_view_print_preview(EAddressbookView *view) -{ - if (view->view_type == E_ADDRESSBOOK_VIEW_MINICARD) { - char *query; - EBook *book; - - g_object_get (view->model, - "query", &query, - "book", &book, - NULL); - e_contact_print_preview(book, query); - g_free(query); - } - else if (view->view_type == E_ADDRESSBOOK_VIEW_TABLE) { - EPrintable *printable; - ETable *etable; - GnomePrintMaster *master; - GnomePrintContext *pc; - GnomePrintConfig *config; - GtkWidget *preview; - - g_object_get(view->widget, "table", &etable, NULL); - printable = e_table_get_printable(etable); - - master = gnome_print_master_new(); - config = gnome_print_master_get_config (master); - gnome_print_config_set_int (config, GNOME_PRINT_KEY_NUM_COPIES, 1); - pc = gnome_print_master_get_context( master ); - e_printable_reset(printable); - while (e_printable_data_left(printable)) { - if (gnome_print_gsave(pc) == -1) - /* FIXME */; - if (gnome_print_translate(pc, 72, 72) == -1) - /* FIXME */; - e_printable_print_page(printable, - pc, - 6.5 * 72, - 9 * 72, - TRUE); - if (gnome_print_grestore(pc) == -1) - /* FIXME */; - if (gnome_print_showpage(pc) == -1) - /* FIXME */; - } - gnome_print_master_close(master); - preview = GTK_WIDGET(gnome_print_master_preview_new(master, "Print Preview")); - gtk_widget_show_all(preview); - g_object_unref (master); - g_object_unref (printable); - } -#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW - else if (view->view_type == E_ADDRESSBOOK_VIEW_TREEVIEW) { - /* XXX */ - } -#endif -} - -static void -card_deleted_cb (EBook* book, EBookStatus status, gpointer user_data) -{ - if (status != E_BOOK_STATUS_SUCCESS) { - e_addressbook_error_dialog (_("Error removing card"), status); - } -} - -static void -do_remove (int i, gpointer user_data) -{ - EBook *book; - ECard *card; - EAddressbookView *view = user_data; - - g_object_get (view->model, - "book", &book, - NULL); - - card = e_addressbook_model_get_card (view->model, i); - - e_book_remove_card(book, card, card_deleted_cb, view); - - g_object_unref (card); -} - -void -e_addressbook_view_delete_selection(EAddressbookView *view) -{ - ESelectionModel *model = get_selection_model (view); - - g_return_if_fail (model); - - e_selection_model_foreach (model, - do_remove, - view); -} - -static void -invisible_destroyed (gpointer data, GObject *where_object_was) -{ - EAddressbookView *view = data; - view->invisible = NULL; -} - -static void -selection_get (GtkWidget *invisible, - GtkSelectionData *selection_data, - guint info, - guint time_stamp, - EAddressbookView *view) -{ - char *value; - - value = e_card_list_get_vcard(view->clipboard_cards); - - gtk_selection_data_set (selection_data, GDK_SELECTION_TYPE_STRING, - 8, value, strlen (value)); - -} - -static void -selection_clear_event (GtkWidget *invisible, - GdkEventSelection *event, - EAddressbookView *view) -{ - if (view->clipboard_cards) { - g_list_foreach (view->clipboard_cards, (GFunc)g_object_unref, NULL); - g_list_free (view->clipboard_cards); - view->clipboard_cards = NULL; - } -} - -static void -selection_received (GtkWidget *invisible, - GtkSelectionData *selection_data, - guint time, - EAddressbookView *view) -{ - if (selection_data->length < 0 || selection_data->type != GDK_SELECTION_TYPE_STRING) { - return; - } - else { - /* XXX make sure selection_data->data = \0 terminated */ - GList *card_list = e_card_load_cards_from_string_with_default_charset (selection_data->data, "ISO-8859-1"); - GList *l; - - if (!card_list /* it wasn't a vcard list */) - return; - - for (l = card_list; l; l = l->next) { - ECard *card = l->data; - - e_card_merging_book_add_card (view->book, card, NULL /* XXX */, NULL); - } - - g_list_foreach (card_list, (GFunc)g_object_unref, NULL); - g_list_free (card_list); - } -} - -static void -add_to_list (int model_row, gpointer closure) -{ - GList **list = closure; - *list = g_list_prepend (*list, GINT_TO_POINTER (model_row)); -} - -static GList * -get_selected_cards (EAddressbookView *view) -{ - GList *list; - GList *iterator; - ESelectionModel *selection = get_selection_model (view); - - list = NULL; - e_selection_model_foreach (selection, add_to_list, &list); - - for (iterator = list; iterator; iterator = iterator->next) { - iterator->data = e_addressbook_model_card_at (view->model, GPOINTER_TO_INT (iterator->data)); - if (iterator->data) - g_object_ref (iterator->data); - } - list = g_list_reverse (list); - return list; -} - -void -e_addressbook_view_save_as (EAddressbookView *view) -{ - GList *list = get_selected_cards (view); - if (list) - e_contact_list_save_as (_("Save as VCard"), list, NULL); - e_free_object_list(list); -} - -void -e_addressbook_view_view (EAddressbookView *view) -{ - GList *list = get_selected_cards (view); - e_addressbook_show_multiple_cards (view->book, list, view->editable); - e_free_object_list(list); -} - -void -e_addressbook_view_send (EAddressbookView *view) -{ - GList *list = get_selected_cards (view); - if (list) - e_card_list_send (list, E_CARD_DISPOSITION_AS_ATTACHMENT); - e_free_object_list(list); -} - -void -e_addressbook_view_send_to (EAddressbookView *view) -{ - GList *list = get_selected_cards (view); - if (list) - e_card_list_send (list, E_CARD_DISPOSITION_AS_TO); - e_free_object_list(list); -} - -void -e_addressbook_view_cut (EAddressbookView *view) -{ - e_addressbook_view_copy (view); - e_addressbook_view_delete_selection (view); -} - -void -e_addressbook_view_copy (EAddressbookView *view) -{ - view->clipboard_cards = get_selected_cards (view); - - gtk_selection_owner_set (view->invisible, clipboard_atom, GDK_CURRENT_TIME); -} - -void -e_addressbook_view_paste (EAddressbookView *view) -{ - gtk_selection_convert (view->invisible, clipboard_atom, - GDK_SELECTION_TYPE_STRING, - GDK_CURRENT_TIME); -} - -void -e_addressbook_view_select_all (EAddressbookView *view) -{ - ESelectionModel *model = get_selection_model (view); - - g_return_if_fail (model); - - e_selection_model_select_all (model); -} - -void -e_addressbook_view_show_all(EAddressbookView *view) -{ - g_object_set(view, - "query", NULL, - NULL); -} - -void -e_addressbook_view_stop(EAddressbookView *view) -{ - if (view) - e_addressbook_model_stop (view->model); -} - -static void -view_transfer_cards (EAddressbookView *view, gboolean delete_from_source) -{ - EBook *book; - GList *cards; - GtkWindow *parent_window; - - g_object_get(view->model, - "book", &book, - NULL); - cards = get_selected_cards (view); - parent_window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view))); - - e_addressbook_transfer_cards (book, cards, delete_from_source, parent_window); -} - -void -e_addressbook_view_copy_to_folder (EAddressbookView *view) -{ - view_transfer_cards (view, FALSE); -} - -void -e_addressbook_view_move_to_folder (EAddressbookView *view) -{ - view_transfer_cards (view, TRUE); -} - - -static gboolean -e_addressbook_view_selection_nonempty (EAddressbookView *view) -{ - ESelectionModel *selection_model; - - selection_model = get_selection_model (view); - if (selection_model == NULL) - return FALSE; - - return e_selection_model_selected_count (selection_model) != 0; -} - -gboolean -e_addressbook_view_can_create (EAddressbookView *view) -{ - return view ? e_addressbook_model_editable (view->model) : FALSE; -} - -gboolean -e_addressbook_view_can_print (EAddressbookView *view) -{ - return view && view->model ? e_addressbook_model_card_count (view->model) : FALSE; -} - -gboolean -e_addressbook_view_can_save_as (EAddressbookView *view) -{ - return view ? e_addressbook_view_selection_nonempty (view) : FALSE; -} - -gboolean -e_addressbook_view_can_view (EAddressbookView *view) -{ - return view ? e_addressbook_view_selection_nonempty (view) : FALSE; -} - -gboolean -e_addressbook_view_can_send (EAddressbookView *view) -{ - return view ? e_addressbook_view_selection_nonempty (view) : FALSE; -} - -gboolean -e_addressbook_view_can_send_to (EAddressbookView *view) -{ - return view ? e_addressbook_view_selection_nonempty (view) : FALSE; -} - -gboolean -e_addressbook_view_can_delete (EAddressbookView *view) -{ - return view ? e_addressbook_view_selection_nonempty (view) && e_addressbook_model_editable (view->model) : FALSE; -} - -gboolean -e_addressbook_view_can_cut (EAddressbookView *view) -{ - return view ? e_addressbook_view_selection_nonempty (view) && e_addressbook_model_editable (view->model) : FALSE; -} - -gboolean -e_addressbook_view_can_copy (EAddressbookView *view) -{ - return view ? e_addressbook_view_selection_nonempty (view) : FALSE; -} - -gboolean -e_addressbook_view_can_paste (EAddressbookView *view) -{ - return view ? e_addressbook_model_editable (view->model) : FALSE; -} - -gboolean -e_addressbook_view_can_select_all (EAddressbookView *view) -{ - return view ? e_addressbook_model_card_count (view->model) != 0 : FALSE; -} - -gboolean -e_addressbook_view_can_stop (EAddressbookView *view) -{ - return view ? e_addressbook_model_can_stop (view->model) : FALSE; -} - -gboolean -e_addressbook_view_can_copy_to_folder (EAddressbookView *view) -{ - return view ? e_addressbook_view_selection_nonempty (view) : FALSE; -} - -gboolean -e_addressbook_view_can_move_to_folder (EAddressbookView *view) -{ - return view ? e_addressbook_view_selection_nonempty (view) && e_addressbook_model_editable (view->model) : FALSE; -} diff --git a/addressbook/gui/widgets/e-addressbook-view.etspec b/addressbook/gui/widgets/e-addressbook-view.etspec deleted file mode 100644 index a0a0015d75..0000000000 --- a/addressbook/gui/widgets/e-addressbook-view.etspec +++ /dev/null @@ -1,51 +0,0 @@ -<ETableSpecification click-to-add="true" draw-grid="true" _click-to-add-message="* Click here to add a contact *"> - <ETableColumn model_col= "0" _title="File As" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col= "1" _title="Full Name" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col= "2" _title="Email" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col= "3" _title="Primary Phone" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col= "4" _title="Assistant Phone" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col= "5" _title="Business Phone" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col= "6" _title="Callback Phone" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col= "7" _title="Company Phone" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col= "8" _title="Home Phone" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col= "9" _title="Organization" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="10" _title="Business Address" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="11" _title="Home Address" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="12" _title="Mobile Phone" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="13" _title="Car Phone" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="14" _title="Business Fax" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="15" _title="Home Fax" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="16" _title="Business Phone 2" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="17" _title="Home Phone 2" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="18" _title="ISDN" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="19" _title="Other Phone" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="20" _title="Other Fax" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="21" _title="Pager" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="22" _title="Radio" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="23" _title="Telex" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="24" _title="TTY" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="25" _title="Other Address" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="26" _title="Email 2" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="27" _title="Email 3" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="28" _title="Web Site" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="29" _title="Department" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="30" _title="Office" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="31" _title="Title" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="32" _title="Profession" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="33" _title="Manager" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="34" _title="Assistant" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="35" _title="Nickname" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="36" _title="Spouse" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="37" _title="Note" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col="38" _title="Free-busy URL" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/> - <ETableState> - <column source="0"/> - <column source="1"/> - <column source="5"/> - <column source="2"/> - <column source="3"/> - <grouping> - <leaf column="0" ascending="true"/> - </grouping> - </ETableState> -</ETableSpecification> diff --git a/addressbook/gui/widgets/e-addressbook-view.h b/addressbook/gui/widgets/e-addressbook-view.h deleted file mode 100644 index dbf32811d8..0000000000 --- a/addressbook/gui/widgets/e-addressbook-view.h +++ /dev/null @@ -1,149 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-addressbook-view.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_ADDRESSBOOK_VIEW_H__ -#define __E_ADDRESSBOOK_VIEW_H__ - -#include <gtk/gtktable.h> -#include <bonobo/bonobo-ui-component.h> -#include <gal/menus/gal-view-instance.h> -#include "e-addressbook-model.h" -#include "widgets/menus/gal-view-menus.h" -#include "addressbook/backend/ebook/e-book.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EAddressbookView - A card displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - */ - -#define E_TYPE_ADDRESSBOOK_VIEW (e_addressbook_view_get_type ()) -#define E_ADDRESSBOOK_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_ADDRESSBOOK_VIEW, EAddressbookView)) -#define E_ADDRESSBOOK_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_ADDRESSBOOK_VIEW, EAddressbookViewClass)) -#define E_IS_ADDRESSBOOK_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_ADDRESSBOOK_VIEW)) -#define E_IS_ADDRESSBOOK_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_ADDRESSBOOK_VIEW)) - -typedef enum { - E_ADDRESSBOOK_VIEW_NONE, /* initialized to this */ - E_ADDRESSBOOK_VIEW_TABLE, - E_ADDRESSBOOK_VIEW_MINICARD -#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW - ,E_ADDRESSBOOK_VIEW_TREEVIEW -#endif -} EAddressbookViewType; - - -typedef struct _EAddressbookView EAddressbookView; -typedef struct _EAddressbookViewClass EAddressbookViewClass; - -struct _EAddressbookView -{ - GtkTable parent; - - /* item specific fields */ - EAddressbookViewType view_type; - - EAddressbookModel *model; - - GtkWidget *invisible; - GList *clipboard_cards; - - EBook *book; - char *query; - guint editable : 1; - - GObject *object; - GtkWidget *widget; - GtkWidget *current_alphabet_widget; - - GtkWidget *vbox; - - /* Menus handler and the view instance */ - GalViewInstance *view_instance; - GalViewMenus *view_menus; - GalView *current_view; - BonoboUIComponent *uic; -}; - -struct _EAddressbookViewClass -{ - GtkTableClass parent_class; - - /* - * Signals - */ - void (*status_message) (EAddressbookView *view, const gchar *message); - void (*search_result) (EAddressbookView *view, EBookViewStatus status); - void (*folder_bar_message) (EAddressbookView *view, const gchar *message); - void (*command_state_change) (EAddressbookView *view); - void (*alphabet_state_change) (EAddressbookView *view, gunichar letter); -}; - -GtkWidget *e_addressbook_view_new (void); -GType e_addressbook_view_get_type (void); - -void e_addressbook_view_setup_menus (EAddressbookView *view, - BonoboUIComponent *uic); - -void e_addressbook_view_discard_menus (EAddressbookView *view); - -void e_addressbook_view_save_as (EAddressbookView *view); -void e_addressbook_view_view (EAddressbookView *view); -void e_addressbook_view_send (EAddressbookView *view); -void e_addressbook_view_send_to (EAddressbookView *view); -void e_addressbook_view_print (EAddressbookView *view); -void e_addressbook_view_print_preview (EAddressbookView *view); -void e_addressbook_view_delete_selection (EAddressbookView *view); -void e_addressbook_view_cut (EAddressbookView *view); -void e_addressbook_view_copy (EAddressbookView *view); -void e_addressbook_view_paste (EAddressbookView *view); -void e_addressbook_view_select_all (EAddressbookView *view); -void e_addressbook_view_show_all (EAddressbookView *view); -void e_addressbook_view_stop (EAddressbookView *view); -void e_addressbook_view_copy_to_folder (EAddressbookView *view); -void e_addressbook_view_move_to_folder (EAddressbookView *view); - -gboolean e_addressbook_view_can_create (EAddressbookView *view); -gboolean e_addressbook_view_can_print (EAddressbookView *view); -gboolean e_addressbook_view_can_save_as (EAddressbookView *view); -gboolean e_addressbook_view_can_view (EAddressbookView *view); -gboolean e_addressbook_view_can_send (EAddressbookView *view); -gboolean e_addressbook_view_can_send_to (EAddressbookView *view); -gboolean e_addressbook_view_can_delete (EAddressbookView *view); -gboolean e_addressbook_view_can_cut (EAddressbookView *view); -gboolean e_addressbook_view_can_copy (EAddressbookView *view); -gboolean e_addressbook_view_can_paste (EAddressbookView *view); -gboolean e_addressbook_view_can_select_all (EAddressbookView *view); -gboolean e_addressbook_view_can_stop (EAddressbookView *view); -gboolean e_addressbook_view_can_copy_to_folder (EAddressbookView *view); -gboolean e_addressbook_view_can_move_to_folder (EAddressbookView *view); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_ADDRESSBOOK_VIEW_H__ */ diff --git a/addressbook/gui/widgets/e-minicard-control.c b/addressbook/gui/widgets/e-minicard-control.c deleted file mode 100644 index 6618ab5579..0000000000 --- a/addressbook/gui/widgets/e-minicard-control.c +++ /dev/null @@ -1,358 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard-control.c - * - * Copyright (C) 1999, 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. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - */ - -#include <config.h> - -#include <gtk/gtk.h> -#include <bonobo/bonobo-generic-factory.h> -#include <bonobo/bonobo-persist.h> -#include <bonobo/bonobo-persist-stream.h> -#include <bonobo/bonobo-stream-client.h> -#include <gal/util/e-util.h> - -#include <addressbook/gui/component/addressbook.h> -#include <addressbook/backend/ebook/e-book.h> -#include <addressbook/backend/ebook/e-book-util.h> -#include <addressbook/backend/ebook/e-card.h> - -#include "e-minicard-control.h" -#include "e-minicard-widget.h" -#include "e-card-merging.h" - -typedef struct { - EMinicardWidget *minicard; - GList *card_list; - GtkWidget *label; -} EMinicardControl; - -#define MINICARD_CONTROL_ID "OAFIID:GNOME_Evolution_Addressbook_MiniCard_Control" - - -#if 0 -enum { - PROP_RUNNING -} MyArgs; - -#define RUNNING_KEY "Clock::Running" - -static void -get_prop (BonoboPropertyBag *bag, - BonoboArg *arg, - guint arg_id, - CORBA_Environment *ev, - gpointer user_data) -{ - GObject *clock = user_data; - - switch (arg_id) { - - case PROP_RUNNING: - { - gboolean b = GPOINTER_TO_UINT (g_object_get_data (clock, RUNNING_KEY)); - BONOBO_ARG_SET_BOOLEAN (arg, b); - break; - } - - default: - g_warning ("Unhandled arg %d", arg_id); - break; - } -} - -static void -set_prop (BonoboPropertyBag *bag, - const BonoboArg *arg, - guint arg_id, - CORBA_Environment *ev, - gpointer user_data) -{ - GtkClock *clock = user_data; - - switch (arg_id) { - - case PROP_RUNNING: - { - guint i; - - i = BONOBO_ARG_GET_BOOLEAN (arg); - - if (i) - gtk_clock_start (clock); - else - gtk_clock_stop (clock); - - g_object_set_data (clock, RUNNING_KEY, - GUINT_TO_POINTER (i)); - break; - } - - default: - g_warning ("Unhandled arg %d", arg_id); - break; - } -} -#endif - -/* - * Bonobo::PersistStream - * - * These two functions implement the Bonobo::PersistStream load and - * save methods which allow data to be loaded into and out of the - * BonoboObject. - */ -static char * -stream_read (Bonobo_Stream stream) -{ - Bonobo_Stream_iobuf *buffer; - CORBA_Environment ev; - char *data = NULL; - gint length = 0; - - CORBA_exception_init (&ev); - do { -#define READ_CHUNK_SIZE 65536 - Bonobo_Stream_read (stream, READ_CHUNK_SIZE, - &buffer, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - return NULL; - } - - if (buffer->_length <= 0) - break; - - data = g_realloc (data, length + buffer->_length + 1); - - memcpy (data + length, buffer->_buffer, buffer->_length); - - length += buffer->_length; - - CORBA_free (buffer); - } while (1); - - CORBA_free (buffer); - CORBA_exception_free (&ev); - - if (data) - data[length] = '\0'; - else - data = g_strdup(""); - - return data; -} /* stream_read */ - -/* - * This function implements the Bonobo::PersistStream:load method. - */ -static void -pstream_load (BonoboPersistStream *ps, const Bonobo_Stream stream, - Bonobo_Persist_ContentType type, void *data, - CORBA_Environment *ev) -{ - GList *list; - char *vcard; - EMinicardControl *minicard_control = data; - - if (type && g_strcasecmp (type, "text/vCard") != 0 && - g_strcasecmp (type, "text/x-vCard") != 0) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Bonobo_Persist_WrongDataType, NULL); - return; - } - - if ((vcard = stream_read (stream)) == NULL) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Bonobo_Persist_FileNotFound, NULL); - return; - } - - e_free_object_list (minicard_control->card_list); - list = e_card_load_cards_from_string_with_default_charset(vcard, "ISO-8859-1"); - g_free(vcard); - minicard_control->card_list = list; - if (list) - g_object_set(minicard_control->minicard, - "card", list->data, - NULL); - if (list && list->next) { - char *message; - int length = g_list_length (list) - 1; - if (length > 1) { - message = g_strdup_printf (_("and %d other cards."), length); - } else { - message = g_strdup_printf (_("and one other card.")); - } - gtk_label_set_text (GTK_LABEL (minicard_control->label), message); - g_free (message); - gtk_widget_show (minicard_control->label); - } else { - gtk_widget_hide (minicard_control->label); - } -} /* pstream_load */ - -/* - * This function implements the Bonobo::PersistStream:save method. - */ -static void -pstream_save (BonoboPersistStream *ps, const Bonobo_Stream stream, - Bonobo_Persist_ContentType type, void *data, - CORBA_Environment *ev) -{ - EMinicardControl *minicard_control = data; - char *vcard; - int length; - - if (type && g_strcasecmp (type, "text/vCard") != 0 && - g_strcasecmp (type, "text/x-vCard") != 0) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Bonobo_Persist_WrongDataType, NULL); - return; - } - - vcard = e_card_list_get_vcard(minicard_control->card_list); - length = strlen (vcard); - bonobo_stream_client_write (stream, vcard, length, ev); - g_free (vcard); -} /* pstream_save */ - -static Bonobo_Persist_ContentTypeList * -pstream_get_content_types (BonoboPersistStream *ps, void *closure, - CORBA_Environment *ev) -{ - return bonobo_persist_generate_content_types (2, "text/vCard", "text/x-vCard"); -} - -static void -book_open_cb (EBook *book, EBookStatus status, gpointer closure) -{ - GList *list = closure; - if (book) { - GList *p; - for (p = list; p; p = p->next) { - e_card_merging_book_add_card(book, p->data, NULL, NULL); - } - g_object_unref (book); - } - e_free_object_list (list); -} - -static void -save_in_addressbook(GtkWidget *button, gpointer data) -{ - EMinicardControl *minicard_control = data; - GList *list, *p; - EBook *book; - - book = e_book_new (); - - list = g_list_copy (minicard_control->card_list); - - for (p = list; p; p = p->next) - g_object_ref (p->data); - - if (!addressbook_load_default_book (book, book_open_cb, list)) { - g_object_unref (book); - book_open_cb (NULL, E_BOOK_STATUS_OTHER_ERROR, list); - } -} - -static void -free_struct (gpointer data, GObject *where_object_was) -{ - EMinicardControl *minicard_control = data; - e_free_object_list (minicard_control->card_list); - g_free (minicard_control); -} - -BonoboControl * -e_minicard_control_new (void) -{ -#if 0 - BonoboPropertyBag *pb; -#endif - BonoboControl *control; - BonoboPersistStream *stream; - GtkWidget *minicard; - GtkWidget *button; - GtkWidget *label; - GtkWidget *vbox; - - EMinicardControl *minicard_control = g_new (EMinicardControl, 1); - - - minicard_control->card_list = NULL; - minicard_control->minicard = NULL; - minicard_control->label = NULL; - - /* Create the control. */ - - minicard = e_minicard_widget_new (); - gtk_widget_show (minicard); - minicard_control->minicard = E_MINICARD_WIDGET (minicard); - - /* This is intentionally not shown. */ - label = gtk_label_new (""); - minicard_control->label = label; - - button = gtk_button_new_with_label(_("Save in addressbook")); - g_signal_connect (button, "clicked", - G_CALLBACK (save_in_addressbook), minicard_control); - gtk_widget_show (button); - - vbox = gtk_vbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), minicard, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); - gtk_widget_show (vbox); - - control = bonobo_control_new (vbox); - - g_object_weak_ref (G_OBJECT (control), free_struct, minicard_control); - - stream = bonobo_persist_stream_new (pstream_load, pstream_save, - pstream_get_content_types, - MINICARD_CONTROL_ID, - minicard_control); - -#if 0 - /* Create the properties. */ - pb = bonobo_property_bag_new (get_prop, set_prop, clock); - bonobo_control_set_properties (control, pb); - - bonobo_property_bag_add (pb, "running", PROP_RUNNING, - BONOBO_ARG_BOOLEAN, NULL, - "Whether or not the clock is running", 0); -#endif - - if (stream == NULL) { - bonobo_object_unref (BONOBO_OBJECT (control)); - return NULL; - } - - bonobo_object_add_interface (BONOBO_OBJECT (control), - BONOBO_OBJECT (stream)); - - return control; -} diff --git a/addressbook/gui/widgets/e-minicard-control.h b/addressbook/gui/widgets/e-minicard-control.h deleted file mode 100644 index bc0d934384..0000000000 --- a/addressbook/gui/widgets/e-minicard-control.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __E_MINICARD_CONTROL_H__ -#define __E_MINICARD_CONTROL_H__ - -#include <bonobo/bonobo-control.h> - -BonoboControl *e_minicard_control_new (void); - -#endif /* __E_MINICARD_CONTROL_H__ */ diff --git a/addressbook/gui/widgets/e-minicard-label.c b/addressbook/gui/widgets/e-minicard-label.c deleted file mode 100644 index 21ace85c60..0000000000 --- a/addressbook/gui/widgets/e-minicard-label.c +++ /dev/null @@ -1,505 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard-label.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 "e-minicard-label.h" - -#include <gtk/gtksignal.h> -#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> -#include <libgnome/gnome-i18n.h> -#include <gal/util/e-util.h> -#include <gal/e-text/e-text.h> -#include <gal/widgets/e-canvas.h> -#include <gal/widgets/e-canvas-utils.h> -#include <gdk/gdkkeysyms.h> - -static void e_minicard_label_init (EMinicardLabel *card); -static void e_minicard_label_class_init (EMinicardLabelClass *klass); -static void e_minicard_label_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void e_minicard_label_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static gboolean e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event); -static void e_minicard_label_realize (GnomeCanvasItem *item); -static void e_minicard_label_unrealize (GnomeCanvasItem *item); -static void e_minicard_label_reflow(GnomeCanvasItem *item, int flags); - -static void e_minicard_label_resize_children( EMinicardLabel *e_minicard_label ); - -static GnomeCanvasGroupClass *parent_class = NULL; - -/* The arguments we take */ -enum { - PROP_0, - PROP_WIDTH, - PROP_HEIGHT, - PROP_HAS_FOCUS, - PROP_FIELD, - PROP_FIELDNAME, - PROP_TEXT_MODEL, - PROP_MAX_FIELD_NAME_WIDTH, - PROP_EDITABLE -}; - -GType -e_minicard_label_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (EMinicardLabelClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_minicard_label_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EMinicardLabel), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_minicard_label_init, - }; - - type = g_type_register_static (gnome_canvas_group_get_type (), "EMinicardLabel", &info, 0); - } - - return type; -} - -static void -e_minicard_label_class_init (EMinicardLabelClass *klass) -{ - GObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = G_OBJECT_CLASS (klass); - item_class = (GnomeCanvasItemClass *) klass; - - parent_class = g_type_class_peek_parent (klass); - - object_class->set_property = e_minicard_label_set_property; - object_class->get_property = e_minicard_label_get_property; - /* object_class->destroy = e_minicard_label_destroy; */ - - g_object_class_install_property (object_class, PROP_WIDTH, - g_param_spec_double ("width", - _("Width"), - /*_( */"XXX blurb" /*)*/, - 0.0, G_MAXDOUBLE, 10.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_HEIGHT, - g_param_spec_double ("height", - _("Height"), - /*_( */"XXX blurb" /*)*/, - 0.0, G_MAXDOUBLE, 10.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_HAS_FOCUS, - g_param_spec_boolean ("has_focus", - _("Has Focus"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_FIELD, - g_param_spec_string ("field", - _("Field"), - /*_( */"XXX blurb" /*)*/, - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_FIELDNAME, - g_param_spec_string ("fieldname", - _("Field Name"), - /*_( */"XXX blurb" /*)*/, - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_TEXT_MODEL, - g_param_spec_object ("text_model", - _("Text Model"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_TEXT_MODEL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_MAX_FIELD_NAME_WIDTH, - g_param_spec_double ("max_field_name_length", - _("Max field name length"), - /*_( */"XXX blurb" /*)*/, - -1.0, G_MAXDOUBLE, -1.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EDITABLE, - g_param_spec_boolean ("editable", - _("Editable"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); - - /* GnomeCanvasItem method overrides */ - item_class->realize = e_minicard_label_realize; - item_class->unrealize = e_minicard_label_unrealize; - item_class->event = e_minicard_label_event; -} - -static void -e_minicard_label_init (EMinicardLabel *minicard_label) -{ - minicard_label->width = 10; - minicard_label->height = 10; - minicard_label->rect = NULL; - minicard_label->fieldname = NULL; - minicard_label->field = NULL; - - minicard_label->max_field_name_length = -1; - - e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(minicard_label), e_minicard_label_reflow); -} - -static void -e_minicard_label_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - EMinicardLabel *e_minicard_label; - GnomeCanvasItem *item; - - e_minicard_label = E_MINICARD_LABEL (object); - item = GNOME_CANVAS_ITEM (object); - - switch (prop_id){ - case PROP_WIDTH: - e_minicard_label->width = g_value_get_double (value); - e_minicard_label_resize_children(e_minicard_label); - e_canvas_item_request_reflow (item); - break; - case PROP_HAS_FOCUS: - if (e_minicard_label->field && (g_value_get_boolean (value) != E_FOCUS_NONE)) - e_canvas_item_grab_focus(e_minicard_label->field, FALSE); - break; - case PROP_FIELD: - gnome_canvas_item_set( e_minicard_label->field, "text", g_value_get_string (value), NULL ); - break; - case PROP_FIELDNAME: - gnome_canvas_item_set( e_minicard_label->fieldname, "text", g_value_get_string (value), NULL ); - break; - case PROP_TEXT_MODEL: - gnome_canvas_item_set( e_minicard_label->field, "model", g_value_get_object (value), NULL); - break; - case PROP_MAX_FIELD_NAME_WIDTH: - e_minicard_label->max_field_name_length = g_value_get_double (value); - break; - case PROP_EDITABLE: - e_minicard_label->editable = g_value_get_boolean (value); - g_object_set (e_minicard_label->field, "editable", e_minicard_label->editable, NULL); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_minicard_label_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - EMinicardLabel *e_minicard_label; - - e_minicard_label = E_MINICARD_LABEL (object); - - switch (prop_id) { - case PROP_WIDTH: - g_value_set_double (value, e_minicard_label->width); - break; - case PROP_HEIGHT: - g_value_set_double (value, e_minicard_label->height); - break; - case PROP_HAS_FOCUS: - g_value_set_boolean (value, e_minicard_label->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE); - break; - case PROP_FIELD: - g_object_get_property (G_OBJECT (e_minicard_label->field), - "text", value); - break; - case PROP_FIELDNAME: - g_object_get_property (G_OBJECT (e_minicard_label->fieldname), - "text", value); - break; - case PROP_TEXT_MODEL: - g_object_get_property (G_OBJECT (e_minicard_label->field), - "model", value); - break; - case PROP_MAX_FIELD_NAME_WIDTH: - g_value_set_double (value, e_minicard_label->max_field_name_length); - break; - case PROP_EDITABLE: - g_value_set_boolean (value, e_minicard_label->editable); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_minicard_label_realize (GnomeCanvasItem *item) -{ - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) - (* GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) (item); - - e_canvas_item_request_reflow(item); - - if (!item->canvas->aa) - { - } -} - -void -e_minicard_label_construct (GnomeCanvasItem *item) -{ - EMinicardLabel *e_minicard_label; - GnomeCanvasGroup *group; - - e_minicard_label = E_MINICARD_LABEL (item); - group = GNOME_CANVAS_GROUP( item ); - - e_minicard_label->rect = - gnome_canvas_item_new( group, - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) e_minicard_label->width - 1, - "y2", (double) e_minicard_label->height - 1, - "outline_color", NULL, - NULL ); - e_minicard_label->fieldname = - gnome_canvas_item_new( group, - e_text_get_type(), - "anchor", GTK_ANCHOR_NW, - "clip_width", (double) ( e_minicard_label->width / 2 - 4 ), - "clip", TRUE, - "use_ellipsis", TRUE, - "fill_color", "black", - "draw_background", FALSE, - NULL ); - e_canvas_item_move_absolute(e_minicard_label->fieldname, 2, 1); - - e_minicard_label->field = - gnome_canvas_item_new( group, - e_text_get_type(), - "anchor", GTK_ANCHOR_NW, - "clip_width", (double) ( ( e_minicard_label->width + 1 ) / 2 - 4 ), - "clip", TRUE, - "use_ellipsis", TRUE, - "fill_color", "black", - "editable", e_minicard_label->editable, - "draw_background", FALSE, - NULL ); - e_canvas_item_move_absolute(e_minicard_label->field, ( e_minicard_label->width / 2 + 2), 1); - - e_canvas_item_request_reflow(item); -} - -static void -e_minicard_label_unrealize (GnomeCanvasItem *item) -{ - EMinicardLabel *e_minicard_label; - - e_minicard_label = E_MINICARD_LABEL (item); - - if (!item->canvas->aa) - { - } - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->unrealize) - (* GNOME_CANVAS_ITEM_CLASS( parent_class )->unrealize) (item); -} - -static gboolean -e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EMinicardLabel *e_minicard_label; - - e_minicard_label = E_MINICARD_LABEL (item); - - switch( event->type ) - { - case GDK_KEY_PRESS: - if (event->key.keyval == GDK_Escape) { - GnomeCanvasItem *parent; - - e_text_cancel_editing (E_TEXT (e_minicard_label->field)); - - parent = GNOME_CANVAS_ITEM (e_minicard_label)->parent; - if (parent) - e_canvas_item_grab_focus(parent, FALSE); - } - break; - case GDK_FOCUS_CHANGE: - { - GdkEventFocus *focus_event = (GdkEventFocus *) event; - if ( focus_event->in ) - { - gnome_canvas_item_set( e_minicard_label->rect, - "outline_color", "grey50", - "fill_color", "grey90", - NULL ); - e_minicard_label->has_focus = TRUE; - } - else - { - gnome_canvas_item_set( e_minicard_label->rect, - "outline_color", NULL, - "fill_color", NULL, - NULL ); - e_minicard_label->has_focus = FALSE; - } - } - break; - case GDK_BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - case GDK_MOTION_NOTIFY: - case GDK_ENTER_NOTIFY: - case GDK_LEAVE_NOTIFY: { - gboolean return_val; -#if 0 - GnomeCanvasItem *field; - ArtPoint p; - double inv[6], affine[6]; - - field = e_minicard_label->field; - art_affine_identity (affine); - - if (field->xform != NULL) { - if (field->object.flags & GNOME_CANVAS_ITEM_AFFINE_FULL) { - art_affine_multiply (affine, affine, field->xform); - } else { - affine[4] += field->xform[0]; - affine[5] += field->xform[1]; - } - } - - art_affine_invert (inv, affine); - switch(event->type) { - case GDK_MOTION_NOTIFY: - p.x = event->motion.x; - p.y = event->motion.y; - art_affine_point (&p, &p, inv); - event->motion.x = p.x; - event->motion.y = p.y; - break; - case GDK_BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - p.x = event->button.x; - p.y = event->button.y; - art_affine_point (&p, &p, inv); - event->button.x = p.x; - event->button.y = p.y; - break; - case GDK_ENTER_NOTIFY: - case GDK_LEAVE_NOTIFY: - p.x = event->crossing.x; - p.y = event->crossing.y; - art_affine_point (&p, &p, inv); - event->crossing.x = p.x; - event->crossing.y = p.y; - break; - default: - break; - } -#endif - g_signal_emit_by_name(e_minicard_label->field, "event", event, &return_val); - return return_val; - break; - } - default: - break; - } - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event) - return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event); - else - return 0; -} - -static void -e_minicard_label_resize_children(EMinicardLabel *e_minicard_label) -{ - double left_width; - if (e_minicard_label->max_field_name_length != -1 && ((e_minicard_label->width / 2) - 4 > e_minicard_label->max_field_name_length)) - left_width = e_minicard_label->max_field_name_length; - else - left_width = e_minicard_label->width / 2 - 4; - - gnome_canvas_item_set( e_minicard_label->fieldname, - "clip_width", (double) MAX ( left_width, 0 ), - NULL ); - gnome_canvas_item_set( e_minicard_label->field, - "clip_width", (double) MAX ( e_minicard_label->width - 8 - left_width, 0 ), - NULL ); -} - -static void -e_minicard_label_reflow(GnomeCanvasItem *item, int flags) -{ - EMinicardLabel *e_minicard_label = E_MINICARD_LABEL(item); - - gint old_height; - gdouble text_height; - gdouble left_width; - - old_height = e_minicard_label->height; - - g_object_get(e_minicard_label->fieldname, - "text_height", &text_height, - NULL); - - e_minicard_label->height = text_height; - - - g_object_get(e_minicard_label->field, - "text_height", &text_height, - NULL); - - if (e_minicard_label->height < text_height) - e_minicard_label->height = text_height; - e_minicard_label->height += 3; - - gnome_canvas_item_set( e_minicard_label->rect, - "x2", (double) e_minicard_label->width - 1, - "y2", (double) e_minicard_label->height - 1, - NULL ); - - if (e_minicard_label->max_field_name_length != -1 && ((e_minicard_label->width / 2) - 4 > e_minicard_label->max_field_name_length)) - left_width = e_minicard_label->max_field_name_length; - else - left_width = e_minicard_label->width / 2 - 4; - - e_canvas_item_move_absolute(e_minicard_label->field, left_width + 6, 1); - - if (old_height != e_minicard_label->height) - e_canvas_item_request_parent_reflow(item); -} - -GnomeCanvasItem * -e_minicard_label_new(GnomeCanvasGroup *parent) -{ - GnomeCanvasItem *item = gnome_canvas_item_new(parent, e_minicard_label_get_type(), NULL); - e_minicard_label_construct(item); - return item; -} - diff --git a/addressbook/gui/widgets/e-minicard-label.h b/addressbook/gui/widgets/e-minicard-label.h deleted file mode 100644 index 0fdc48a451..0000000000 --- a/addressbook/gui/widgets/e-minicard-label.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard-label.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_MINICARD_LABEL_H__ -#define __E_MINICARD_LABEL_H__ - -#include <glib.h> -#include <libgnomecanvas/gnome-canvas.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EMinicardLabel - A label doing focus with non-marching ants. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * width double RW width of the label - * height double R height of the label - * field string RW text in the field label - * fieldname string RW text in the fieldname label - */ - -#define E_TYPE_MINICARD_LABEL (e_minicard_label_get_type ()) -#define E_MINICARD_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_MINICARD_LABEL, EMinicardLabel)) -#define E_MINICARD_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_MINICARD_LABEL, EMiniCardLabelClass)) -#define E_IS_MINICARD_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_MINICARD_LABEL)) -#define E_IS_MINICARD_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_MINICARD_LABEL)) - - -typedef struct _EMinicardLabel EMinicardLabel; -typedef struct _EMinicardLabelClass EMinicardLabelClass; - -struct _EMinicardLabel -{ - GnomeCanvasGroup parent; - - /* item specific fields */ - double width; - double height; - double max_field_name_length; - guint editable : 1; - GnomeCanvasItem *fieldname; - GnomeCanvasItem *field; - GnomeCanvasItem *rect; - - gboolean has_focus; -}; - -struct _EMinicardLabelClass -{ - GnomeCanvasGroupClass parent_class; -}; - - -GType e_minicard_label_get_type (void); -GnomeCanvasItem *e_minicard_label_new(GnomeCanvasGroup *parent); -void e_minicard_label_construct (GnomeCanvasItem *item); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_MINICARD_LABEL_H__ */ diff --git a/addressbook/gui/widgets/e-minicard-view-widget.c b/addressbook/gui/widgets/e-minicard-view-widget.c deleted file mode 100644 index 7a12860a3e..0000000000 --- a/addressbook/gui/widgets/e-minicard-view-widget.c +++ /dev/null @@ -1,407 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard-view-widget.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 <gtk/gtksignal.h> -#include <gal/widgets/e-canvas-background.h> -#include <gal/widgets/e-canvas.h> -#include <libgnome/gnome-i18n.h> - -#include "e-addressbook-marshal.h" -#include "e-minicard-view-widget.h" - -static void e_minicard_view_widget_init (EMinicardViewWidget *widget); -static void e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass); -static void e_minicard_view_widget_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void e_minicard_view_widget_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void e_minicard_view_widget_dispose (GObject *object); -static void e_minicard_view_widget_reflow (ECanvas *canvas); -static void e_minicard_view_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static void e_minicard_view_widget_realize (GtkWidget *widget); - -static ECanvasClass *parent_class = NULL; - -/* The arguments we take */ -enum { - PROP_0, - PROP_BOOK, - PROP_QUERY, - PROP_EDITABLE, - PROP_COLUMN_WIDTH -}; - -enum { - SELECTION_CHANGE, - COLUMN_WIDTH_CHANGED, - RIGHT_CLICK, - LAST_SIGNAL -}; - -static guint signals [LAST_SIGNAL] = {0, }; - -GType -e_minicard_view_widget_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (EMinicardViewWidgetClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_minicard_view_widget_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EMinicardViewWidget), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_minicard_view_widget_init, - }; - - type = g_type_register_static (e_canvas_get_type (), "EMinicardViewWidget", &info, 0); - } - - return type; -} - -static void -e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass) -{ - GObjectClass *object_class; - GtkWidgetClass *widget_class; - ECanvasClass *canvas_class; - - object_class = (GObjectClass*) klass; - widget_class = GTK_WIDGET_CLASS (klass); - canvas_class = E_CANVAS_CLASS (klass); - - parent_class = gtk_type_class (e_canvas_get_type ()); - - object_class->set_property = e_minicard_view_widget_set_property; - object_class->get_property = e_minicard_view_widget_get_property; - object_class->dispose = e_minicard_view_widget_dispose; - - g_object_class_install_property (object_class, PROP_BOOK, - g_param_spec_object ("book", - _("Book"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_BOOK, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_QUERY, - g_param_spec_string ("query", - _("Query"), - /*_( */"XXX blurb" /*)*/, - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EDITABLE, - g_param_spec_boolean ("editable", - _("Editable"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_COLUMN_WIDTH, - g_param_spec_double ("column_width", - _("Column Width"), - /*_( */"XXX blurb" /*)*/, - 0.0, G_MAXDOUBLE, 150.0, - G_PARAM_READWRITE)); - - signals [SELECTION_CHANGE] = - g_signal_new ("selection_change", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMinicardViewWidgetClass, selection_change), - NULL, NULL, - e_addressbook_marshal_NONE__NONE, - G_TYPE_NONE, 0); - - signals [COLUMN_WIDTH_CHANGED] = - g_signal_new ("column_width_changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMinicardViewWidgetClass, column_width_changed), - NULL, NULL, - e_addressbook_marshal_NONE__DOUBLE, - G_TYPE_NONE, 1, G_TYPE_DOUBLE); - - signals [RIGHT_CLICK] = - g_signal_new ("right_click", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMinicardViewWidgetClass, right_click), - NULL, NULL, - e_addressbook_marshal_INT__POINTER, - G_TYPE_INT, 1, G_TYPE_POINTER); - - widget_class->realize = e_minicard_view_widget_realize; - widget_class->size_allocate = e_minicard_view_widget_size_allocate; - - canvas_class->reflow = e_minicard_view_widget_reflow; - - klass->selection_change = NULL; - klass->column_width_changed = NULL; - klass->right_click = NULL; -} - -static void -e_minicard_view_widget_init (EMinicardViewWidget *view) -{ - view->emv = NULL; - - view->book = NULL; - view->query = NULL; - view->editable = FALSE; - view->column_width = 150; -} - -GtkWidget * -e_minicard_view_widget_new (EAddressbookReflowAdapter *adapter) -{ - EMinicardViewWidget *widget = E_MINICARD_VIEW_WIDGET (gtk_type_new (e_minicard_view_widget_get_type ())); - - widget->adapter = adapter; - g_object_ref (widget->adapter); - - return GTK_WIDGET (widget); -} - -static void -e_minicard_view_widget_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EMinicardViewWidget *emvw; - - emvw = E_MINICARD_VIEW_WIDGET (object); - - switch (prop_id){ - case PROP_BOOK: - if (emvw->book) - g_object_unref (emvw->book); - if (g_value_get_object (value)) { - emvw->book = E_BOOK(g_value_get_object (value)); - if (emvw->book) - g_object_ref(emvw->book); - } else - emvw->book = NULL; - if (emvw->emv) - g_object_set(emvw->emv, - "book", emvw->book, - NULL); - break; - case PROP_QUERY: - emvw->query = g_strdup(g_value_get_string (value)); - if (emvw->emv) - g_object_set(emvw->emv, - "query", emvw->query, - NULL); - break; - case PROP_EDITABLE: - emvw->editable = g_value_get_boolean (value); - if (emvw->emv) - g_object_set (emvw->emv, - "editable", emvw->editable, - NULL); - break; - case PROP_COLUMN_WIDTH: - emvw->column_width = g_value_get_double (value); - if (emvw->emv) { - g_object_set (emvw->emv, - "column_width", emvw->column_width, - NULL); - } - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_minicard_view_widget_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EMinicardViewWidget *emvw; - - emvw = E_MINICARD_VIEW_WIDGET (object); - - switch (prop_id) { - case PROP_BOOK: - g_value_set_object (value, emvw->book); - break; - case PROP_QUERY: - g_value_set_string (value, emvw->query); - break; - case PROP_EDITABLE: - g_value_set_boolean (value, emvw->editable); - break; - case PROP_COLUMN_WIDTH: - g_value_set_double (value, emvw->column_width); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_minicard_view_widget_dispose (GObject *object) -{ - EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(object); - - if (view->book) { - g_object_unref (view->book); - view->book = NULL; - } - if (view->query) { - g_free(view->query); - view->query = NULL; - } - - if (view->adapter) { - g_object_unref (view->adapter); - view->adapter = NULL; - } - - if (G_OBJECT_CLASS(parent_class)->dispose) - G_OBJECT_CLASS(parent_class)->dispose (object); -} - -static void -selection_change (ESelectionModel *esm, EMinicardViewWidget *widget) -{ - g_signal_emit (widget, - signals [SELECTION_CHANGE], 0); -} - -static void -column_width_changed (ESelectionModel *esm, double width, EMinicardViewWidget *widget) -{ - g_signal_emit (widget, - signals [COLUMN_WIDTH_CHANGED], 0, width); -} - -static guint -right_click (EMinicardView *view, GdkEvent *event, EMinicardViewWidget *widget) -{ - guint ret_val; - g_signal_emit (widget, - signals [RIGHT_CLICK], 0, - event, &ret_val); - return ret_val; -} - -static void -e_minicard_view_widget_realize (GtkWidget *widget) -{ - EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(widget); - - gnome_canvas_item_new(gnome_canvas_root( GNOME_CANVAS(view) ), - e_canvas_background_get_type(), - "fill_color", "white", - NULL ); - - view->emv = gnome_canvas_item_new( - gnome_canvas_root( GNOME_CANVAS(view) ), - e_minicard_view_get_type(), - "height", (double) 100, - "minimum_width", (double) 100, - "adapter", view->adapter, - "column_width", view->column_width, - NULL ); - - g_signal_connect (E_REFLOW(view->emv)->selection, - "selection_changed", - G_CALLBACK (selection_change), view); - g_signal_connect (view->emv, - "column_width_changed", - G_CALLBACK (column_width_changed), view); - g_signal_connect (view->emv, - "right_click", - G_CALLBACK (right_click), view); - - if (GTK_WIDGET_CLASS(parent_class)->realize) - GTK_WIDGET_CLASS(parent_class)->realize (widget); -} - -static void -e_minicard_view_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation) -{ - if (GTK_WIDGET_CLASS(parent_class)->size_allocate) - GTK_WIDGET_CLASS(parent_class)->size_allocate (widget, allocation); - - if (GTK_WIDGET_REALIZED(widget)) { - double width; - EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(widget); - - gnome_canvas_item_set( view->emv, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( view->emv, - "minimum_width", (double) allocation->width, - NULL ); - g_object_get(view->emv, - "width", &width, - NULL); - width = MAX(width, allocation->width); - gnome_canvas_set_scroll_region (GNOME_CANVAS (view), 0, 0, width - 1, allocation->height - 1); - } -} - -static void -e_minicard_view_widget_reflow(ECanvas *canvas) -{ - double width; - EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(canvas); - - if (E_CANVAS_CLASS(parent_class)->reflow) - E_CANVAS_CLASS(parent_class)->reflow (canvas); - - g_object_get(view->emv, - "width", &width, - NULL); - width = MAX(width, GTK_WIDGET(canvas)->allocation.width); - gnome_canvas_set_scroll_region(GNOME_CANVAS(canvas), 0, 0, width - 1, GTK_WIDGET(canvas)->allocation.height - 1); -} - -ESelectionModel * -e_minicard_view_widget_get_selection_model (EMinicardViewWidget *view) -{ - if (view->emv) - return E_SELECTION_MODEL (E_REFLOW (view->emv)->selection); - else - return NULL; -} - -EMinicardView * -e_minicard_view_widget_get_view (EMinicardViewWidget *view) -{ - if (view->emv) - return E_MINICARD_VIEW (view->emv); - else - return NULL; -} diff --git a/addressbook/gui/widgets/e-minicard-view-widget.h b/addressbook/gui/widgets/e-minicard-view-widget.h deleted file mode 100644 index abb6b9c745..0000000000 --- a/addressbook/gui/widgets/e-minicard-view-widget.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard-view-widget.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_MINICARD_VIEW_WIDGET_H__ -#define __E_MINICARD_VIEW_WIDGET_H__ - -#include <gal/widgets/e-canvas.h> -#include "addressbook/backend/ebook/e-book.h" -#include "e-minicard-view.h" - -G_BEGIN_DECLS - -#define E_TYPE_MINICARD_VIEW_WIDGET (e_minicard_view_widget_get_type ()) -#define E_MINICARD_VIEW_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_MINICARD_VIEW_WIDGET, EMinicardViewWidget)) -#define E_MINICARD_VIEW_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_MINICARD_VIEW_WIDGET, EMinicardViewWidgetClass)) -#define E_IS_MINICARD_VIEW_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_MINICARD_VIEW_WIDGET)) -#define E_IS_MINICARD_VIEW_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_MINICARD_VIEW_WIDGET)) - - -typedef struct _EMinicardViewWidget EMinicardViewWidget; -typedef struct _EMinicardViewWidgetClass EMinicardViewWidgetClass; - -struct _EMinicardViewWidget -{ - ECanvas parent; - - GnomeCanvasItem *emv; - - EAddressbookReflowAdapter *adapter; - - EBook *book; - char *query; - guint editable : 1; - - double column_width; -}; - -struct _EMinicardViewWidgetClass -{ - ECanvasClass parent_class; - void (*selection_change) (EMinicardViewWidget *emvw); - void (*column_width_changed) (EMinicardViewWidget *emvw, double width); - guint (*right_click) (EMinicardViewWidget *emvw); -}; - - -GType e_minicard_view_widget_get_type (void); -GtkWidget *e_minicard_view_widget_new (EAddressbookReflowAdapter *adapter); - -/* Get parts of the view widget. */ -ESelectionModel *e_minicard_view_widget_get_selection_model (EMinicardViewWidget *view); -EMinicardView *e_minicard_view_widget_get_view (EMinicardViewWidget *view); - -G_END_DECLS - -#endif /* __E_MINICARD_VIEW_WIDGET_H__ */ diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c deleted file mode 100644 index 25d43fdd84..0000000000 --- a/addressbook/gui/widgets/e-minicard-view.c +++ /dev/null @@ -1,579 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard-view.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 "e-minicard-view.h" - -#include "e-addressbook-util.h" - -#include "e-addressbook-marshal.h" -#include <gtk/gtkselection.h> -#include <gtk/gtkdnd.h> -#include <gal/widgets/e-canvas.h> -#include <libgnome/gnome-i18n.h> - -static void e_minicard_view_drag_data_get(GtkWidget *widget, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint info, - guint time, - EMinicardView *view); - -static EReflowClass *parent_class = NULL; -#define PARENT_TYPE (E_REFLOW_TYPE) - -/* The arguments we take */ -enum { - PROP_0, - PROP_ADAPTER, - PROP_BOOK, - PROP_QUERY, - PROP_EDITABLE -}; - - -enum { - RIGHT_CLICK, - LAST_SIGNAL -}; - -static guint signals [LAST_SIGNAL] = {0, }; - -enum DndTargetType { - DND_TARGET_TYPE_VCARD_LIST, -}; -#define VCARD_LIST_TYPE "text/x-vcard" -static GtkTargetEntry drag_types[] = { - { VCARD_LIST_TYPE, 0, DND_TARGET_TYPE_VCARD_LIST } -}; -static gint num_drag_types = sizeof(drag_types) / sizeof(drag_types[0]); - -static void -e_minicard_view_drag_data_get(GtkWidget *widget, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint info, - guint time, - EMinicardView *view) -{ - if (!E_IS_MINICARD_VIEW(view)) - return; - - switch (info) { - case DND_TARGET_TYPE_VCARD_LIST: { - char *value; - - value = e_card_list_get_vcard(view->drag_list); - - gtk_selection_data_set (selection_data, - selection_data->target, - 8, - value, strlen (value)); - break; - } - } - - g_list_foreach (view->drag_list, (GFunc)g_object_unref, NULL); - g_list_free (view->drag_list); - view->drag_list = NULL; -} - -static int -e_minicard_view_drag_begin (EAddressbookReflowAdapter *adapter, GdkEvent *event, EMinicardView *view) -{ - GdkDragContext *context; - GtkTargetList *target_list; - GdkDragAction actions = GDK_ACTION_MOVE | GDK_ACTION_COPY; - - view->drag_list = e_minicard_view_get_card_list (view); - - g_print ("dragging %d card(s)\n", g_list_length (view->drag_list)); - - target_list = gtk_target_list_new (drag_types, num_drag_types); - - context = gtk_drag_begin (GTK_WIDGET (GNOME_CANVAS_ITEM (view)->canvas), - target_list, actions, 1/*XXX*/, event); - - if (!view->canvas_drag_data_get_id) - view->canvas_drag_data_get_id = g_signal_connect (GNOME_CANVAS_ITEM (view)->canvas, - "drag_data_get", - G_CALLBACK (e_minicard_view_drag_data_get), - view); - - gtk_drag_set_icon_default (context); - - return TRUE; -} - -static void -set_empty_message (EMinicardView *view) -{ - char *empty_message; - gboolean editable = FALSE; - - if (view->adapter) { - g_object_get (view->adapter, - "editable", &editable, - NULL); - } - - if (editable) - empty_message = _("\n\nThere are no items to show in this view.\n\n" - "Double-click here to create a new Contact."); - else - empty_message = _("\n\nThere are no items to show in this view."); - - g_object_set (view, - "empty_message", empty_message, - NULL); -} - -static void -writable_status_change (EAddressbookModel *model, gboolean writable, EMinicardView *view) -{ - set_empty_message (view); -} - -static void -adapter_changed (EMinicardView *view) -{ - set_empty_message (view); - - g_signal_connect (view->adapter, "drag_begin", - G_CALLBACK (e_minicard_view_drag_begin), view); -} - -static void -e_minicard_view_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EMinicardView *view; - - view = E_MINICARD_VIEW (object); - - switch (prop_id){ - case PROP_ADAPTER: - if (view->adapter) { - if (view->writable_status_id) { - EAddressbookModel *model; - g_object_get (view->adapter, - "model", &model, - NULL); - if (model) { - g_signal_handler_disconnect (model, view->writable_status_id); - } - } - - g_object_unref (view->adapter); - } - view->writable_status_id = 0; - view->adapter = g_value_get_object (value); - g_object_ref (view->adapter); - adapter_changed (view); - g_object_set (view, - "model", view->adapter, - NULL); - if (view->adapter) { - EAddressbookModel *model; - g_object_get (view->adapter, - "model", &model, - NULL); - if (model) { - view->writable_status_id = - g_signal_connect (model, "writable_status", - G_CALLBACK (writable_status_change), view); - } - - } - break; - case PROP_BOOK: - g_object_set (view->adapter, - "book", g_value_get_object (value), - NULL); - set_empty_message (view); - break; - case PROP_QUERY: - g_object_set (view->adapter, - "query", g_value_get_string (value), - NULL); - break; - case PROP_EDITABLE: - g_object_set (view->adapter, - "editable", g_value_get_boolean (value), - NULL); - set_empty_message (view); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_minicard_view_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EMinicardView *view; - - view = E_MINICARD_VIEW (object); - - switch (prop_id) { - case PROP_ADAPTER: - g_value_set_object (value, view->adapter); - break; - case PROP_BOOK: - g_object_get_property (G_OBJECT (view->adapter), - "book", value); - break; - case PROP_QUERY: - g_object_get_property (G_OBJECT (view->adapter), - "query", value); - break; - case PROP_EDITABLE: - g_object_get_property (G_OBJECT (view->adapter), - "editable", value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_minicard_view_dispose (GObject *object) -{ - EMinicardView *view = E_MINICARD_VIEW(object); - - if (view->canvas_drag_data_get_id) { - g_signal_handler_disconnect (GNOME_CANVAS_ITEM (view)->canvas, - view->canvas_drag_data_get_id); - view->canvas_drag_data_get_id = 0; - } - - if (view->adapter) { - if (view->writable_status_id) { - EAddressbookModel *model; - g_object_get (view->adapter, - "model", &model, - NULL); - if (model) { - g_signal_handler_disconnect (model, view->writable_status_id); - } - } - - g_object_unref (view->adapter); - } - view->writable_status_id = 0; - view->adapter = NULL; - - if (G_OBJECT_CLASS(parent_class)->dispose) - G_OBJECT_CLASS(parent_class)->dispose (object); -} - -static guint -e_minicard_view_right_click (EMinicardView *view, GdkEvent *event) -{ - guint ret_val = 0; - g_signal_emit (view, signals[RIGHT_CLICK], 0, - event, &ret_val); - return ret_val; -} - -static gboolean -e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EMinicardView *view; - - view = E_MINICARD_VIEW (item); - - switch( event->type ) { - case GDK_2BUTTON_PRESS: - if (((GdkEventButton *)event)->button == 1) { - gboolean editable; - - g_object_get(view->adapter, "editable", &editable, NULL); - - if (editable) { - EBook *book; - g_object_get(view, "book", &book, NULL); - - if (book && E_IS_BOOK (book)) - e_addressbook_show_contact_editor (book, e_card_new(""), TRUE, editable); - } - return TRUE; - } - case GDK_BUTTON_PRESS: - if (event->button.button == 3) { - e_minicard_view_right_click (view, event); - } - break; - default: - break; - } - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event) - return GNOME_CANVAS_ITEM_CLASS(parent_class)->event(item, event); - else - return FALSE; -} - -static gint -e_minicard_view_selection_event (EReflow *reflow, GnomeCanvasItem *item, GdkEvent *event) -{ - EMinicardView *view; - int return_val = FALSE; - - view = E_MINICARD_VIEW (reflow); - if (parent_class->selection_event) { - return_val = parent_class->selection_event (reflow, item, event); - } - - switch (event->type) { - case GDK_FOCUS_CHANGE: - if (event->focus_change.in) { - int i; - for (i = 0; i < reflow->count; i++) { - if (reflow->items[i] == item) { - e_selection_model_maybe_do_something(reflow->selection, i, 0, 0); - break; - } - } - } - break; - case GDK_BUTTON_PRESS: - if (event->button.button == 3) { - return_val = e_minicard_view_right_click (view, event); - if (!return_val) - e_selection_model_right_click_up(reflow->selection); - } - break; - default: - break; - } - return return_val; -} - -typedef struct { - EMinicardView *view; - EBookCallback cb; - gpointer closure; -} ViewCbClosure; - -static void -do_remove (int i, gpointer user_data) -{ - EBook *book; - ECard *card; - ViewCbClosure *viewcbclosure = user_data; - EMinicardView *view = viewcbclosure->view; - EBookCallback cb = viewcbclosure->cb; - gpointer closure = viewcbclosure->closure; - - g_object_get (view->adapter, - "book", &book, - NULL); - - card = e_addressbook_reflow_adapter_get_card (view->adapter, i); - - e_book_remove_card(book, card, cb, closure); - - g_object_unref (card); -} - -#if 0 -static int -compare_to_utf_str (EMinicard *card, const char *utf_str) -{ - g_return_val_if_fail(card != NULL, 0); - g_return_val_if_fail(E_IS_MINICARD(card), 0); - - if (g_unichar_isdigit (g_utf8_get_char (utf_str))) { - return 1; - } - - if (card->card) { - char *file_as; - g_object_get(card->card, - "file_as", &file_as, - NULL); - if (file_as) - return g_utf8_strcasecmp (file_as, utf_str); - else - return 0; - } else { - return 0; - } -} -#endif - -static void -e_minicard_view_class_init (EMinicardViewClass *klass) -{ - GObjectClass *object_class; - GnomeCanvasItemClass *item_class; - EReflowClass *reflow_class; - - object_class = G_OBJECT_CLASS (klass); - item_class = (GnomeCanvasItemClass *) klass; - reflow_class = (EReflowClass *) klass; - - parent_class = g_type_class_peek_parent (klass); - - object_class->set_property = e_minicard_view_set_property; - object_class->get_property = e_minicard_view_get_property; - object_class->dispose = e_minicard_view_dispose; - - g_object_class_install_property (object_class, PROP_ADAPTER, - g_param_spec_object ("adapter", - _("Adapter"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_BOOK, - g_param_spec_object ("book", - _("Book"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_BOOK, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_QUERY, - g_param_spec_string ("query", - _("Query"), - /*_( */"XXX blurb" /*)*/, - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EDITABLE, - g_param_spec_boolean ("editable", - _("Editable"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); - - signals [RIGHT_CLICK] = - g_signal_new ("right_click", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMinicardViewClass, right_click), - NULL, NULL, - e_addressbook_marshal_INT__POINTER, - G_TYPE_INT, 1, G_TYPE_POINTER); - - item_class->event = e_minicard_view_event; - - reflow_class->selection_event = e_minicard_view_selection_event; - /* GnomeCanvasItem method overrides */ -} - -static void -e_minicard_view_init (EMinicardView *view) -{ - view->adapter = NULL; - view->canvas_drag_data_get_id = 0; - view->writable_status_id = 0; - - set_empty_message (view); -} - -GType -e_minicard_view_get_type (void) -{ - static GType reflow_type = 0; - - if (!reflow_type) { - static const GTypeInfo reflow_info = { - sizeof (EMinicardViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_minicard_view_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EMinicardView), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_minicard_view_init, - }; - - reflow_type = g_type_register_static (PARENT_TYPE, "EMinicardView", &reflow_info, 0); - } - - return reflow_type; -} - -void -e_minicard_view_remove_selection(EMinicardView *view, - EBookCallback cb, - gpointer closure) -{ - ViewCbClosure viewcbclosure; - viewcbclosure.view = view; - viewcbclosure.cb = cb; - viewcbclosure.closure = closure; - - e_selection_model_foreach (E_REFLOW (view)->selection, - do_remove, - &viewcbclosure); -} - -void -e_minicard_view_jump_to_letter (EMinicardView *view, - gunichar letter) -{ -#if 0 - char uft_str[6 + 1]; - - utf_str [g_unichar_to_utf8 (letter, utf_str)] = '\0'; - e_reflow_sorted_jump (E_REFLOW_SORTED (view), - (GCompareFunc) compare_to_utf_str, - utf_str); -#endif -} - -typedef struct { - GList *list; - EAddressbookReflowAdapter *adapter; -} ModelAndList; - -static void -add_to_list (int index, gpointer closure) -{ - ModelAndList *mal = closure; - mal->list = g_list_prepend (mal->list, e_addressbook_reflow_adapter_get_card (mal->adapter, index)); -} - -GList * -e_minicard_view_get_card_list (EMinicardView *view) -{ - ModelAndList mal; - - mal.adapter = view->adapter; - mal.list = NULL; - - e_selection_model_foreach (E_REFLOW (view)->selection, add_to_list, &mal); - - mal.list = g_list_reverse (mal.list); - return mal.list; -} diff --git a/addressbook/gui/widgets/e-minicard-view.h b/addressbook/gui/widgets/e-minicard-view.h deleted file mode 100644 index afd432fd8e..0000000000 --- a/addressbook/gui/widgets/e-minicard-view.h +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard-view.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_MINICARD_VIEW_H__ -#define __E_MINICARD_VIEW_H__ - -#include "e-minicard.h" - -#include <gal/widgets/e-reflow.h> -#include <gal/widgets/e-selection-model-simple.h> -#include "addressbook/backend/ebook/e-book.h" -#include "e-addressbook-reflow-adapter.h" - -G_BEGIN_DECLS - -/* EMinicardView - A canvas item container. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * book EBook RW book to query - * query string RW query string - * - * From EReflowSorted: (you should really know what you're doing if you set these.) - * compare_func GCompareFunc RW compare function - * string_func EReflowStringFunc RW string function - * - * From EReflow: - * minimum_width double RW minimum width of the reflow. width >= minimum_width - * width double R width of the reflow - * height double RW height of the reflow - */ - -#define E_TYPE_MINICARD_VIEW (e_minicard_view_get_type ()) -#define E_MINICARD_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_MINICARD_VIEW, EMinicardView)) -#define E_MINICARD_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_MINICARD_VIEW, EMinicardViewClass)) -#define E_IS_MINICARD_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_MINICARD_VIEW)) -#define E_IS_MINICARD_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_MINICARD_VIEW)) - - -typedef struct _EMinicardView EMinicardView; -typedef struct _EMinicardViewClass EMinicardViewClass; - -struct _EMinicardView -{ - EReflow parent; - - EAddressbookReflowAdapter *adapter; - - /* item specific fields */ - - GList *drag_list; - - guint canvas_drag_data_get_id; - - guint writable_status_id; -}; - -struct _EMinicardViewClass -{ - EReflowClass parent_class; - - void (*right_click) (EMinicardView *view, GdkEvent *event); -}; - -GType e_minicard_view_get_type (void); -void e_minicard_view_remove_selection (EMinicardView *view, - EBookCallback cb, - gpointer closure); -void e_minicard_view_jump_to_letter (EMinicardView *view, - gunichar letter); -GList *e_minicard_view_get_card_list (EMinicardView *view); - - -G_END_DECLS - -#endif /* __E_MINICARD_VIEW_H__ */ diff --git a/addressbook/gui/widgets/e-minicard-widget-test.c b/addressbook/gui/widgets/e-minicard-widget-test.c deleted file mode 100644 index 9a8d27d21c..0000000000 --- a/addressbook/gui/widgets/e-minicard-widget-test.c +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-minicard.c - * - * Copyright (C) 2000 Ximian, Inc. - * Author: Chris Lahey <clahey@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. - * - */ - -#define TEST_VCARD \ -"BEGIN:VCARD -" \ -"FN:Nat -" \ -"N:Friedman;Nat;D;Mr. -" \ -"ORG:Ximian, Inc. -" \ -"TITLE:Head Geek -" \ -"ROLE:Programmer/Executive -" \ -"BDAY:1977-08-06 -" \ -"TEL;WORK:617 679 1984 -" \ -"TEL;CELL:123 456 7890 -" \ -"EMAIL;INTERNET:nat@nat.org -" \ -"EMAIL;INTERNET:nat@ximian.com -" \ -"ADR;WORK;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234; -" \ -"ADR;HOME;POSTAL;INTL:P.O. Box 202;;;Any Town 2;MI;12344-4321;USA -" \ -"END:VCARD -" \ -" -" - -#include "config.h" -#include <gtk/gtkmain.h> -#include <libgnomeui/gnome-app.h> -#include <libgnomeui/gnome-init.h> -#include "e-minicard-widget.h" - -/* This is a horrible thing to do, but it is just a test. */ - -static void destroy_callback(gpointer data, GObject *where_object_was) -{ - exit(0); -} - -#if 0 -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey <clahey@umich.edu>", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Minicard Widget Test" ), VERSION, - _( "Copyright (C) 2000, Ximian, Inc." ), - authors, - _( "This should test the minicard widget" ), - NULL); - gtk_widget_show (about); -} -#endif - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *minicard; - ECard *card; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Minicard Widget Test", VERSION, argc, argv); - app = gnome_app_new("Minicard Widget Test", NULL); - - minicard = e_minicard_widget_new(); - card = e_card_new(TEST_VCARD); - g_object_set(minicard, - "card", card, - NULL); - - gnome_app_set_contents( GNOME_APP( app ), minicard ); - - /* Connect the signals */ - g_object_weak_ref (app, destroy_callback, app); - - gtk_widget_show_all( app ); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/gui/widgets/e-minicard-widget.c b/addressbook/gui/widgets/e-minicard-widget.c deleted file mode 100644 index e8f33673c3..0000000000 --- a/addressbook/gui/widgets/e-minicard-widget.c +++ /dev/null @@ -1,264 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-table-field-chooser.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 <libgnome/gnome-i18n.h> -#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> -#include "e-minicard-widget.h" -#include "e-minicard.h" - -static void e_minicard_widget_init (EMinicardWidget *card); -static void e_minicard_widget_class_init (EMinicardWidgetClass *klass); -static void e_minicard_widget_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void e_minicard_widget_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void e_minicard_widget_dispose (GObject *object); -static void e_minicard_widget_size_request (GtkWidget *widget, GtkRequisition *requisition); -static void e_minicard_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static void e_minicard_widget_reflow (ECanvas *canvas); - -static ECanvasClass *parent_class = NULL; - -/* The arguments we take */ -enum { - PROP_0, - PROP_CARD, -}; - -GType -e_minicard_widget_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (EMinicardWidgetClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_minicard_widget_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EMinicardWidget), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_minicard_widget_init, - }; - - type = g_type_register_static (e_canvas_get_type (), "EMinicardWidget", &info, 0); - } - - return type; -} - -static void -e_minicard_widget_class_init (EMinicardWidgetClass *klass) -{ - GObjectClass *object_class; - GtkWidgetClass *widget_class; - ECanvasClass *ecanvas_class; - - object_class = G_OBJECT_CLASS(klass); - widget_class = GTK_WIDGET_CLASS(klass); - ecanvas_class = E_CANVAS_CLASS(klass); - - parent_class = g_type_class_peek_parent (klass); - - object_class->set_property = e_minicard_widget_set_property; - object_class->get_property = e_minicard_widget_get_property; - object_class->dispose = e_minicard_widget_dispose; - - widget_class->size_request = e_minicard_widget_size_request; - widget_class->size_allocate = e_minicard_widget_size_allocate; - - ecanvas_class->reflow = e_minicard_widget_reflow; - - g_object_class_install_property (object_class, PROP_CARD, - g_param_spec_object ("card", - _("Card"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_CARD, - G_PARAM_READWRITE)); -} - -static void -e_minicard_widget_size_request(GtkWidget *widget, GtkRequisition *requisition) -{ - double height; - EMinicardWidget *emw = E_MINICARD_WIDGET(widget); - g_object_get(emw->item, - "height", &height, - NULL); - if (height <= 0) - height = 1; - widget->requisition.height = height; - widget->requisition.width = 200; - requisition->height = height; - requisition->width = 200; -} - -static void -e_minicard_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation) -{ - double height; - EMinicardWidget *emw = E_MINICARD_WIDGET(widget); - gnome_canvas_item_set( emw->item, - "width", (double) allocation->width, - NULL ); - g_object_get(emw->item, - "height", &height, - NULL); - height = MAX(height, allocation->height); - gnome_canvas_set_scroll_region(GNOME_CANVAS( emw ), 0, 0, allocation->width - 1, height - 1); - gnome_canvas_item_set( emw->rect, - "x2", (double) allocation->width, - "y2", (double) height, - NULL ); - if (GTK_WIDGET_CLASS(parent_class)->size_allocate) - GTK_WIDGET_CLASS(parent_class)->size_allocate(widget, allocation); -} - -static void e_minicard_widget_reflow(ECanvas *canvas) -{ - double height; - EMinicardWidget *emw = E_MINICARD_WIDGET(canvas); - g_object_get(emw->item, - "height", &height, - NULL); - - height = MAX(height, GTK_WIDGET(emw)->allocation.height); - - gnome_canvas_set_scroll_region (GNOME_CANVAS(emw), 0, 0, GTK_WIDGET(emw)->allocation.width - 1, height - 1); - gnome_canvas_item_set( emw->rect, - "x2", (double) GTK_WIDGET(emw)->allocation.width, - "y2", (double) height, - NULL ); - - gtk_widget_queue_resize(GTK_WIDGET(canvas)); -} - -static void -e_minicard_widget_init (EMinicardWidget *emw) -{ - emw->rect = gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(emw)), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - - emw->item = gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(emw)), - e_minicard_get_type(), - "width", (double) 100, - NULL ); - -#if PENDING_PORT_WORK - /* XXX this crashes since the canvas has no h/v adjustments. */ - gnome_canvas_set_scroll_region ( GNOME_CANVAS( emw ), - 0, 0, - 100, 100 ); -#endif - emw->card = NULL; -} - -static void -e_minicard_widget_dispose (GObject *object) -{ - EMinicardWidget *emw = E_MINICARD_WIDGET(object); - - if (emw->card) { - g_object_unref (emw->card); - emw->card = NULL; - } - - if (G_OBJECT_CLASS(parent_class)->dispose) - G_OBJECT_CLASS(parent_class)->dispose(object); -} - -GtkWidget* -e_minicard_widget_new (void) -{ - GtkWidget *widget = GTK_WIDGET (g_object_new (E_TYPE_MINICARD_WIDGET, NULL)); - return widget; -} - -static void -e_minicard_widget_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EMinicardWidget *emw = E_MINICARD_WIDGET(object); - gpointer ptr; - - switch (prop_id){ - case PROP_CARD: - ptr = g_value_get_object (value); - e_minicard_widget_set_card (emw, ptr ? E_CARD (ptr) : NULL); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_minicard_widget_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EMinicardWidget *emw = E_MINICARD_WIDGET(object); - - switch (prop_id) { - case PROP_CARD: - if (emw->card) - g_value_set_object (value, emw->card); - else - g_value_set_object (value, NULL); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -void -e_minicard_widget_set_card (EMinicardWidget *emw, ECard *card) -{ - g_return_if_fail (emw && E_IS_MINICARD_WIDGET (emw)); - g_return_if_fail (card == NULL || E_IS_CARD (card)); - - if (card != emw->card) { - - if (emw->card) - g_object_unref (emw->card); - - emw->card = card; - - if (emw->card) - g_object_ref (emw->card); - - if (emw->item) - g_object_set (emw->item, - "card", emw->card, - NULL); - } -} diff --git a/addressbook/gui/widgets/e-minicard-widget.h b/addressbook/gui/widgets/e-minicard-widget.h deleted file mode 100644 index 829ad8f77d..0000000000 --- a/addressbook/gui/widgets/e-minicard-widget.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard-widget.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_MINICARD_WIDGET_H__ -#define __E_MINICARD_WIDGET_H__ - -#include <gal/widgets/e-canvas.h> -#include "addressbook/backend/ebook/e-card.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EMinicardWidget - A card displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - */ - -#define E_TYPE_MINICARD_WIDGET (e_minicard_widget_get_type ()) -#define E_MINICARD_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_MINICARD_WIDGET, EMinicardWidget)) -#define E_MINICARD_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_MINICARD_WIDGET, EMinicardWidgetClass)) -#define E_IS_MINICARD_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_MINICARD_WIDGET)) -#define E_IS_MINICARD_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_MINICARD_WIDGET)) - - -typedef struct _EMinicardWidget EMinicardWidget; -typedef struct _EMinicardWidgetClass EMinicardWidgetClass; - -struct _EMinicardWidget -{ - ECanvas parent; - - /* item specific fields */ - GnomeCanvasItem *item; - - GnomeCanvasItem *rect; - ECard *card; -}; - -struct _EMinicardWidgetClass -{ - ECanvasClass parent_class; -}; - - -GtkWidget *e_minicard_widget_new(void); -GType e_minicard_widget_get_type (void); - -void e_minicard_widget_set_card (EMinicardWidget *, ECard *); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_MINICARD_WIDGET_H__ */ diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c deleted file mode 100644 index a63f7604b5..0000000000 --- a/addressbook/gui/widgets/e-minicard.c +++ /dev/null @@ -1,1037 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard.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 <glib.h> -#include <gtk/gtkdnd.h> -#include <gdk/gdkkeysyms.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> -#include <gal/e-text/e-text.h> -#include <gal/util/e-util.h> -#include <gal/widgets/e-canvas-utils.h> -#include <gal/widgets/e-canvas.h> -#include "addressbook/backend/ebook/e-book.h" -#include "e-addressbook-marshal.h" -#include "e-addressbook-util.h" -#include "e-minicard.h" -#include "e-minicard-label.h" -#include "e-minicard-view.h" -#include "e-contact-editor.h" -#include "e-card-merging.h" - -static void e_minicard_init (EMinicard *card); -static void e_minicard_class_init (EMinicardClass *klass); -static void e_minicard_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void e_minicard_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void e_minicard_dispose (GObject *object); -static void e_minicard_finalize (GObject *object); -static gboolean e_minicard_event (GnomeCanvasItem *item, GdkEvent *event); -static void e_minicard_realize (GnomeCanvasItem *item); -static void e_minicard_unrealize (GnomeCanvasItem *item); -static void e_minicard_reflow ( GnomeCanvasItem *item, int flags ); - -static void e_minicard_resize_children( EMinicard *e_minicard ); -static void remodel( EMinicard *e_minicard ); - -static gint e_minicard_drag_begin (EMinicard *minicard, GdkEvent *event); - -static GnomeCanvasGroupClass *parent_class = NULL; - -typedef struct _EMinicardField EMinicardField; - -struct _EMinicardField { - ECardSimpleField field; - GnomeCanvasItem *label; -}; - -#define d(x) - -#define LIST_ICON_FILENAME "contact-list-16.png" - -#define E_MINICARD_FIELD(field) ((EMinicardField *)(field)) - -static void -e_minicard_field_destroy(EMinicardField *field) -{ - gtk_object_destroy(GTK_OBJECT(field->label)); - g_free(field); -} - -/* The arguments we take */ -enum { - PROP_0, - PROP_WIDTH, - PROP_HEIGHT, - PROP_HAS_FOCUS, - PROP_SELECTED, - PROP_HAS_CURSOR, - PROP_EDITABLE, - PROP_CARD -}; - -enum { - SELECTED, - DRAG_BEGIN, - LAST_SIGNAL -}; - -static guint e_minicard_signals [LAST_SIGNAL] = {0, }; - -GType -e_minicard_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (EMinicardClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_minicard_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EMinicard), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_minicard_init, - }; - - type = g_type_register_static (gnome_canvas_group_get_type (), "EMinicard", &info, 0); - } - - return type; -} - -static void -e_minicard_class_init (EMinicardClass *klass) -{ - GObjectClass *object_class = (GObjectClass*) klass; - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) klass; - - object_class->set_property = e_minicard_set_property; - object_class->get_property = e_minicard_get_property; - object_class->dispose = e_minicard_dispose; - object_class->finalize = e_minicard_finalize; - - parent_class = gtk_type_class (gnome_canvas_group_get_type ()); - - g_object_class_install_property (object_class, PROP_WIDTH, - g_param_spec_double ("width", - _("Width"), - /*_( */"XXX blurb" /*)*/, - 0.0, G_MAXDOUBLE, 10.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_HEIGHT, - g_param_spec_double ("height", - _("Height"), - /*_( */"XXX blurb" /*)*/, - 0.0, G_MAXDOUBLE, 10.0, - G_PARAM_READABLE)); - - g_object_class_install_property (object_class, PROP_HAS_FOCUS, - /* XXX should be _enum */ - g_param_spec_int ("has_focus", - _("Has Focus"), - /*_( */"XXX blurb" /*)*/, - E_MINICARD_FOCUS_TYPE_START, E_MINICARD_FOCUS_TYPE_END, - E_MINICARD_FOCUS_TYPE_START, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_SELECTED, - g_param_spec_boolean ("selected", - _("Selected"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_HAS_CURSOR, - g_param_spec_boolean ("has_cursor", - _("Has Cursor"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EDITABLE, - g_param_spec_boolean ("editable", - _("Editable"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_CARD, - g_param_spec_object ("card", - _("Card"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_CARD, - G_PARAM_READWRITE)); - - e_minicard_signals [SELECTED] = - g_signal_new ("selected", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMinicardClass, selected), - NULL, NULL, - e_addressbook_marshal_INT__POINTER, - G_TYPE_INT, 1, G_TYPE_POINTER); - - e_minicard_signals [DRAG_BEGIN] = - g_signal_new ("drag_begin", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMinicardClass, drag_begin), - NULL, NULL, - e_addressbook_marshal_INT__POINTER, - G_TYPE_INT, 1, G_TYPE_POINTER); - - /* GnomeCanvasItem method overrides */ - item_class->realize = e_minicard_realize; - item_class->unrealize = e_minicard_unrealize; - item_class->event = e_minicard_event; - - klass->selected = NULL; -} - -static void -e_minicard_init (EMinicard *minicard) -{ - /* minicard->card = NULL;*/ - minicard->rect = NULL; - minicard->fields = NULL; - minicard->width = 10; - minicard->height = 10; - minicard->has_focus = FALSE; - minicard->selected = FALSE; - minicard->editable = FALSE; - minicard->has_cursor = FALSE; - - minicard->card = NULL; - minicard->simple = e_card_simple_new(NULL); - - minicard->list_icon_pixbuf = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" LIST_ICON_FILENAME, NULL); - minicard->list_icon_size = gdk_pixbuf_get_height (minicard->list_icon_pixbuf); - - minicard->editor = NULL; - - minicard->changed = FALSE; - - e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(minicard), e_minicard_reflow); -} - -static void -set_selected (EMinicard *minicard, gboolean selected) -{ - GtkWidget *canvas = GTK_WIDGET(GNOME_CANVAS_ITEM(minicard)->canvas); - if (selected) { - gnome_canvas_item_set (minicard->rect, - "outline_color_gdk", &canvas->style->bg[GTK_STATE_NORMAL], - NULL); - gnome_canvas_item_set (minicard->header_rect, - "fill_color_gdk", &canvas->style->bg[GTK_STATE_SELECTED], - NULL); - gnome_canvas_item_set (minicard->header_text, - "fill_color_gdk", &canvas->style->text[GTK_STATE_SELECTED], - NULL); - } else { - gnome_canvas_item_set (minicard->rect, - "outline_color", NULL, - NULL); - gnome_canvas_item_set (minicard->header_rect, - "fill_color_gdk", &canvas->style->bg[GTK_STATE_NORMAL], - NULL); - gnome_canvas_item_set (minicard->header_text, - "fill_color_gdk", &canvas->style->fg[GTK_STATE_NORMAL], - NULL); - } - minicard->selected = selected; -} - -static void -set_has_cursor (EMinicard *minicard, gboolean has_cursor) -{ - if (!minicard->has_focus && has_cursor) - e_canvas_item_grab_focus(GNOME_CANVAS_ITEM (minicard), FALSE); - minicard->has_cursor = has_cursor; -} - - -static void -e_minicard_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - GnomeCanvasItem *item; - EMinicard *e_minicard; - GList *l; - - item = GNOME_CANVAS_ITEM (object); - e_minicard = E_MINICARD (object); - - switch (prop_id){ - case PROP_WIDTH: - if (e_minicard->width != g_value_get_double (value)) { - e_minicard->width = g_value_get_double (value); - e_minicard_resize_children(e_minicard); - if ( GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED ) - e_canvas_item_request_reflow(item); - } - break; - case PROP_HAS_FOCUS: - if (e_minicard->fields) { - if ( g_value_get_int(value) == E_FOCUS_START || - g_value_get_int(value) == E_FOCUS_CURRENT) { - gnome_canvas_item_set(E_MINICARD_FIELD(e_minicard->fields->data)->label, - "has_focus", g_value_get_int (value), - NULL); - } else if ( g_value_get_int (value) == E_FOCUS_END ) { - gnome_canvas_item_set(E_MINICARD_FIELD(g_list_last(e_minicard->fields)->data)->label, - "has_focus", g_value_get_int (value), - NULL); - } - } - else { - if (!e_minicard->has_focus) - e_canvas_item_grab_focus(item, FALSE); - } - break; - case PROP_SELECTED: - if (e_minicard->selected != g_value_get_boolean (value)) - set_selected (e_minicard, g_value_get_boolean (value)); - break; - case PROP_EDITABLE: - e_minicard->editable = g_value_get_boolean (value); - for (l = e_minicard->fields; l; l = l->next) - g_object_set (E_MINICARD_FIELD (l->data)->label, - "editable", e_minicard->editable, - NULL); - break; - case PROP_HAS_CURSOR: - d(g_print("%s: PROP_HAS_CURSOR\n", __FUNCTION__)); - if (e_minicard->has_cursor != g_value_get_boolean (value)) - set_has_cursor (e_minicard, g_value_get_boolean (value)); - break; - case PROP_CARD: - if (e_minicard->card) - g_object_unref (e_minicard->card); - e_minicard->card = E_CARD(g_value_get_object (value)); - if (e_minicard->card) - g_object_ref (e_minicard->card); - g_object_set(e_minicard->simple, - "card", e_minicard->card, - NULL); - remodel(e_minicard); - e_canvas_item_request_reflow(item); - e_minicard->changed = FALSE; - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_minicard_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - EMinicard *e_minicard; - - e_minicard = E_MINICARD (object); - - switch (prop_id) { - case PROP_WIDTH: - g_value_set_double (value, e_minicard->width); - break; - case PROP_HEIGHT: - g_value_set_double (value, e_minicard->height); - break; - case PROP_HAS_FOCUS: - g_value_set_int (value, e_minicard->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE); - break; - case PROP_SELECTED: - g_value_set_boolean (value, e_minicard->selected); - break; - case PROP_HAS_CURSOR: - g_value_set_boolean (value, e_minicard->has_cursor); - break; - case PROP_EDITABLE: - g_value_set_boolean (value, e_minicard->editable); - break; - case PROP_CARD: - e_card_simple_sync_card(e_minicard->simple); - g_value_set_object (value, e_minicard->card); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_minicard_dispose (GObject *object) -{ - EMinicard *e_minicard; - - g_return_if_fail (object != NULL); - g_return_if_fail (E_IS_MINICARD (object)); - - e_minicard = E_MINICARD (object); - - if (e_minicard->fields) { - g_list_foreach(e_minicard->fields, (GFunc) e_minicard_field_destroy, NULL); - g_list_free(e_minicard->fields); - e_minicard->fields = NULL; - } - - if (e_minicard->list_icon_pixbuf) { - gdk_pixbuf_unref (e_minicard->list_icon_pixbuf); - e_minicard->list_icon_pixbuf = NULL; - } - - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); -} - - - -static void -e_minicard_finalize (GObject *object) -{ - EMinicard *e_minicard; - - g_return_if_fail (object != NULL); - g_return_if_fail (E_IS_MINICARD (object)); - - e_minicard = E_MINICARD (object); - - if (e_minicard->card) - g_object_unref (e_minicard->card); - if (e_minicard->simple) - g_object_unref (e_minicard->simple); - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - -static void -e_minicard_realize (GnomeCanvasItem *item) -{ - EMinicard *e_minicard; - GnomeCanvasGroup *group; - GtkWidget *canvas; - - e_minicard = E_MINICARD (item); - group = GNOME_CANVAS_GROUP( item ); - canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (item)->canvas); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item); - - e_minicard->rect = - gnome_canvas_item_new( group, - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) MAX (e_minicard->width - 1, 0), - "y2", (double) MAX (e_minicard->height - 1, 0), - "outline_color", NULL, - NULL ); - - e_minicard->header_rect = - gnome_canvas_item_new( group, - gnome_canvas_rect_get_type(), - "x1", (double) 2, - "y1", (double) 2, - "x2", (double) MAX (e_minicard->width - 3, 0), - "y2", (double) MAX (e_minicard->height - 3, 0), - "fill_color_gdk", &canvas->style->bg[GTK_STATE_NORMAL], - NULL ); - - e_minicard->header_text = - gnome_canvas_item_new( group, - e_text_get_type(), - "anchor", GTK_ANCHOR_NW, - "width", (double) MAX( e_minicard->width - 12, 0 ), - "clip", TRUE, - "use_ellipsis", TRUE, - "fill_color_gdk", &canvas->style->fg[GTK_STATE_NORMAL], - "text", "", - "draw_background", FALSE, - NULL ); - - e_canvas_item_move_absolute(e_minicard->header_text, 6, 6); - - e_minicard->list_icon = - gnome_canvas_item_new ( group, - gnome_canvas_pixbuf_get_type(), - "pixbuf", e_minicard->list_icon_pixbuf, - NULL); - - remodel(e_minicard); - e_canvas_item_request_reflow(item); - - if (!item->canvas->aa) { - } -} - -static void -e_minicard_unrealize (GnomeCanvasItem *item) -{ - EMinicard *e_minicard; - - e_minicard = E_MINICARD (item); - - if (!item->canvas->aa) - { - } - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item); -} - -static void -card_modified_cb (EBook* book, EBookStatus status, gpointer user_data) -{ - d(g_print ("%s: %s(): a card was modified\n", __FILE__, __FUNCTION__)); - if (status != E_BOOK_STATUS_SUCCESS) - e_addressbook_error_dialog (_("Error modifying card"), status); -} - -/* Callback used when the contact editor is closed */ -static void -editor_closed_cb (GtkObject *editor, gpointer data) -{ - EMinicard *minicard = data; - g_object_unref (editor); - minicard->editor = NULL; -} - -static gboolean -e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EMinicard *e_minicard; - GtkWidget *canvas; - - e_minicard = E_MINICARD (item); - canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (item)->canvas); - - switch( event->type ) { - case GDK_FOCUS_CHANGE: - { - GdkEventFocus *focus_event = (GdkEventFocus *) event; - d(g_print("%s: GDK_FOCUS_CHANGE: %s\n", __FUNCTION__, focus_event->in?"in":"out")); - if (focus_event->in) { - /* Chris: When EMinicard gets the cursor, if it doesn't have the focus, it should take it. */ - e_minicard->has_focus = TRUE; - if (!e_minicard->selected) { - e_minicard_selected(e_minicard, event); - } - } else { - EBook *book = NULL; - - if (e_minicard->changed) { - - e_card_simple_sync_card(e_minicard->simple); - - if (E_IS_MINICARD_VIEW(GNOME_CANVAS_ITEM(e_minicard)->parent)) { - - g_object_get(GNOME_CANVAS_ITEM(e_minicard)->parent, - "book", &book, - NULL); - - } - - if (book) { - - /* Add the card in the contact editor to our ebook */ - e_card_merging_book_commit_card (book, - e_minicard->card, - card_modified_cb, - NULL); - } else { - remodel(e_minicard); - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(e_minicard)); - } - e_minicard->changed = FALSE; - } - e_minicard->has_focus = FALSE; - } - } - break; - case GDK_BUTTON_PRESS: { - if (1 <= event->button.button && event->button.button <= 2) { - int ret_val = e_minicard_selected(e_minicard, event); - GdkEventMask mask = ((1 << (4 + event->button.button)) | - GDK_POINTER_MOTION_MASK | - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK); - - e_canvas_item_grab_focus(item, TRUE); - - if (gnome_canvas_item_grab (GNOME_CANVAS_ITEM (e_minicard), - mask, NULL, event->button.time)) { - return FALSE; - } - gtk_grab_add (GTK_WIDGET (GNOME_CANVAS_ITEM (e_minicard)->canvas)); - e_minicard->button_x = event->button.x; - e_minicard->button_y = event->button.y; - e_minicard->drag_button = event->button.button; - e_minicard->drag_button_down = TRUE; - return ret_val; - } else if (event->button.button == 3) { - int ret_val = e_minicard_selected(e_minicard, event); - if (ret_val != 0) - return ret_val; - } - break; - } - case GDK_BUTTON_RELEASE: - e_minicard_selected(e_minicard, event); - if (e_minicard->drag_button == event->button.button) { - e_minicard->drag_button = 0; - e_minicard->drag_button_down = FALSE; - e_minicard->button_x = -1; - e_minicard->button_y = -1; - - if (GTK_WIDGET_HAS_GRAB (GNOME_CANVAS_ITEM (e_minicard)->canvas)) { - gtk_grab_remove (GTK_WIDGET (GNOME_CANVAS_ITEM (e_minicard)->canvas)); - gnome_canvas_item_ungrab (GNOME_CANVAS_ITEM (e_minicard), event->button.time); - } - } - break; - case GDK_MOTION_NOTIFY: - if (e_minicard->drag_button_down && event->motion.state & GDK_BUTTON1_MASK) { - if (MAX (abs (e_minicard->button_x - event->motion.x), - abs (e_minicard->button_y - event->motion.y)) > 3) { - gint ret_val; - - ret_val = e_minicard_drag_begin(e_minicard, event); - - e_minicard->drag_button_down = FALSE; - - return ret_val; - } - } - break; - case GDK_2BUTTON_PRESS: - if (event->button.button == 1 && E_IS_MINICARD_VIEW(item->parent)) { - if (e_minicard->editor) { - if (e_card_evolution_list (e_minicard->card)) - e_contact_list_editor_raise (E_CONTACT_LIST_EDITOR(e_minicard->editor)); - else - e_contact_editor_raise(E_CONTACT_EDITOR(e_minicard->editor)); - } else { - EBook *book = NULL; - if (E_IS_MINICARD_VIEW(item->parent)) { - g_object_get(item->parent, - "book", &book, - NULL); - } - - if (book != NULL) { - if (e_card_evolution_list (e_minicard->card)) { - EContactListEditor *editor = e_addressbook_show_contact_list_editor (book, e_minicard->card, - FALSE, e_minicard->editable); - e_minicard->editor = G_OBJECT (editor); - } - else { - EContactEditor *editor = e_addressbook_show_contact_editor (book, e_minicard->card, - FALSE, e_minicard->editable); - e_minicard->editor = G_OBJECT (editor); - } - g_object_ref (e_minicard->editor); - - g_signal_connect (e_minicard->editor, "editor_closed", - G_CALLBACK (editor_closed_cb), e_minicard); - - } - } - return TRUE; - } - break; - case GDK_KEY_PRESS: - if (event->key.keyval == GDK_Tab || - event->key.keyval == GDK_KP_Tab || - event->key.keyval == GDK_ISO_Left_Tab) { - GList *list; - for (list = e_minicard->fields; list; list = list->next) { - EMinicardField *field = E_MINICARD_FIELD(list->data); - GnomeCanvasItem *item = field->label; - EFocus has_focus; - g_object_get(item, - "has_focus", &has_focus, - NULL); - if (has_focus != E_FOCUS_NONE) { - if (event->key.state & GDK_SHIFT_MASK) - list = list->prev; - else - list = list->next; - if (list) { - EMinicardField *field = E_MINICARD_FIELD(list->data); - GnomeCanvasItem *item = field->label; - gnome_canvas_item_set(item, - "has_focus", (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START, - NULL); - return 1; - } else { - return 0; - } - } - } - } - default: - break; - } - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event) - return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event); - else - return 0; -} - -static void -e_minicard_resize_children( EMinicard *e_minicard ) -{ - GList *list; - - if (e_minicard->header_text) { - gnome_canvas_item_set( e_minicard->header_text, - "width", ((double) e_minicard->width - 12 - - (e_card_evolution_list (e_minicard->card) ? e_minicard->list_icon_size : 0.0)), - NULL ); - } - if (e_minicard->list_icon) { - e_canvas_item_move_absolute(e_minicard->list_icon, - e_minicard->width - e_minicard->list_icon_size - 3, - 3); - } - for ( list = e_minicard->fields; list; list = g_list_next( list ) ) { - gnome_canvas_item_set( E_MINICARD_FIELD( list->data )->label, - "width", (double) e_minicard->width - 4.0, - NULL ); - } -} - -static void -field_changed (EText *text, EMinicard *e_minicard) -{ - ECardSimpleType type; - char *string; - - type = GPOINTER_TO_INT - (g_object_get_data(G_OBJECT(text), - "EMinicard:field")); - g_object_get(text, - "text", &string, - NULL); - e_card_simple_set(e_minicard->simple, - type, - string); - g_free(string); - e_minicard->changed = TRUE; -} - -static void -field_activated (EText *text, EMinicard *e_minicard) -{ - e_text_stop_editing (text); - e_canvas_item_grab_focus (GNOME_CANVAS_ITEM (e_minicard), FALSE); -} - -static void -add_field (EMinicard *e_minicard, ECardSimpleField field, gdouble left_width) -{ - GnomeCanvasItem *new_item; - GnomeCanvasGroup *group; - ECardSimpleType type; - EMinicardField *minicard_field; - char *name; - char *string; - - group = GNOME_CANVAS_GROUP( e_minicard ); - - type = e_card_simple_type(e_minicard->simple, field); - name = g_strdup_printf("%s:", e_card_simple_get_name(e_minicard->simple, field)); - string = e_card_simple_get(e_minicard->simple, field); - - /* Magically convert embedded XML into an address. */ - if (!strncmp (string, "<?xml", 5)) { - EDestination *dest = e_destination_import (string); - if (dest != NULL) { - gchar *new_string = g_strdup (e_destination_get_address (dest)); - g_free (string); - string = new_string; - g_object_unref (dest); - } - } - - new_item = e_minicard_label_new(group); - gnome_canvas_item_set( new_item, - "width", e_minicard->width - 4.0, - "fieldname", name, - "field", string, - "max_field_name_length", left_width, - "editable", e_minicard->editable, - NULL ); - g_signal_connect(E_MINICARD_LABEL(new_item)->field, - "changed", G_CALLBACK (field_changed), e_minicard); - g_signal_connect(E_MINICARD_LABEL(new_item)->field, - "activate", G_CALLBACK (field_activated), e_minicard); - g_object_set(E_MINICARD_LABEL(new_item)->field, - "allow_newlines", e_card_simple_get_allow_newlines (e_minicard->simple, field), - NULL); - g_object_set_data(G_OBJECT (E_MINICARD_LABEL(new_item)->field), - "EMinicard:field", - GINT_TO_POINTER(field)); - - minicard_field = g_new(EMinicardField, 1); - minicard_field->field = field; - minicard_field->label = new_item; - - e_minicard->fields = g_list_append( e_minicard->fields, minicard_field); - e_canvas_item_move_absolute(new_item, 2, e_minicard->height); - g_free(name); - g_free(string); -} - -static int -get_left_width(EMinicard *e_minicard) -{ - gchar *name; - ECardSimpleField field; - int width = -1; - GdkFont *font; - PangoLayout *layout; - - layout = gtk_widget_create_pango_layout (GTK_WIDGET (GNOME_CANVAS_ITEM (e_minicard)->canvas), ""); - for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST; field++) { - int this_width; - name = g_strdup_printf("%s:", e_card_simple_get_name(e_minicard->simple, field)); - pango_layout_set_text (layout, name, -1); - pango_layout_get_pixel_size (layout, &this_width, NULL); - if (width < this_width) - width = this_width; - g_free(name); - } - g_object_unref (layout); - return width; -} - -static void -remodel( EMinicard *e_minicard ) -{ - int count = 0; - if ( !(GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED) ) - return; - if (e_minicard->simple) { - ECardSimpleField field; - GList *list; - char *file_as; - int left_width = -1; - - if (e_minicard->header_text) { - file_as = e_card_simple_get(e_minicard->simple, E_CARD_SIMPLE_FIELD_FILE_AS); - gnome_canvas_item_set( e_minicard->header_text, - "text", file_as ? file_as : "", - NULL ); - g_free(file_as); - } - - if (e_minicard->card && e_card_evolution_list (e_minicard->card) ) { - gnome_canvas_item_show (e_minicard->list_icon); - } - else { - gnome_canvas_item_hide (e_minicard->list_icon); - } - - list = e_minicard->fields; - e_minicard->fields = NULL; - - for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST_SIMPLE_STRING && count < 5; field++) { - EMinicardField *minicard_field = NULL; - - if (list) - minicard_field = list->data; - if (minicard_field && minicard_field->field == field) { - GList *this_list = list; - char *string; - - string = e_card_simple_get(e_minicard->simple, field); - if (string && *string) { - /* Magically convert embedded XML into an address. */ - if (!strncmp (string, "<?xml", 4)) { - EDestination *dest = e_destination_import (string); - if (dest != NULL) { - gchar *new_string = g_strdup (e_destination_get_address (dest)); - g_free (string); - string = new_string; - g_object_unref (dest); - } - } - - e_minicard->fields = g_list_append(e_minicard->fields, minicard_field); - g_object_set(minicard_field->label, - "field", string, - NULL); - count ++; - } else { - e_minicard_field_destroy(minicard_field); - } - list = g_list_remove_link(list, this_list); - g_list_free_1(this_list); - g_free(string); - } else { - char *string; - if (left_width == -1) { - left_width = get_left_width(e_minicard); - } - - string = e_card_simple_get(e_minicard->simple, field); - if (string && *string) { - add_field(e_minicard, field, left_width); - count++; - } - g_free(string); - } - } - - g_list_foreach(list, (GFunc) e_minicard_field_destroy, NULL); - g_list_free(list); - } -} - -static void -e_minicard_reflow( GnomeCanvasItem *item, int flags ) -{ - EMinicard *e_minicard = E_MINICARD(item); - if ( GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED ) { - GList *list; - gdouble text_height; - gint old_height; - - old_height = e_minicard->height; - - g_object_get( e_minicard->header_text, - "text_height", &text_height, - NULL ); - - e_minicard->height = text_height + 10.0; - - gnome_canvas_item_set( e_minicard->header_rect, - "y2", text_height + 9.0, - NULL ); - - for(list = e_minicard->fields; list; list = g_list_next(list)) { - EMinicardField *field = E_MINICARD_FIELD(list->data); - GnomeCanvasItem *item = field->label; - g_object_get (item, - "height", &text_height, - NULL); - e_canvas_item_move_absolute(item, 2, e_minicard->height); - e_minicard->height += text_height; - } - e_minicard->height += 2; - - gnome_canvas_item_set( e_minicard->rect, - "x2", (double) e_minicard->width - 1.0, - "y2", (double) e_minicard->height - 1.0, - NULL ); - gnome_canvas_item_set( e_minicard->header_rect, - "x2", (double) e_minicard->width - 3.0, - NULL ); - - if (old_height != e_minicard->height) - e_canvas_item_request_parent_reflow(item); - } -} - -const char * -e_minicard_get_card_id (EMinicard *minicard) -{ - g_return_val_if_fail(minicard != NULL, NULL); - g_return_val_if_fail(E_IS_MINICARD(minicard), NULL); - - if (minicard->card) { - return e_card_get_id(minicard->card); - } else { - return ""; - } -} - -int -e_minicard_compare (EMinicard *minicard1, EMinicard *minicard2) -{ - g_return_val_if_fail(minicard1 != NULL, 0); - g_return_val_if_fail(E_IS_MINICARD(minicard1), 0); - g_return_val_if_fail(minicard2 != NULL, 0); - g_return_val_if_fail(E_IS_MINICARD(minicard2), 0); - - if (minicard1->card && minicard2->card) { - char *file_as1, *file_as2; - g_object_get(minicard1->card, - "file_as", &file_as1, - NULL); - g_object_get(minicard2->card, - "file_as", &file_as2, - NULL); - if (file_as1 && file_as2) - return g_utf8_collate(file_as1, file_as2); - if (file_as1) - return -1; - if (file_as2) - return 1; - return strcmp(e_minicard_get_card_id(minicard1), e_minicard_get_card_id(minicard2)); - } else { - return 0; - } -} - -int -e_minicard_selected (EMinicard *minicard, GdkEvent *event) -{ - gint ret_val = 0; - GnomeCanvasItem *item = GNOME_CANVAS_ITEM (minicard); - if (item->parent) { - guint signal_id = g_signal_lookup ("selection_event", G_OBJECT_TYPE (item->parent)); - /* We should probably check the signature here, but I - * don't think it's worth the time required to code - * it. - */ - if (signal_id != 0) { - g_signal_emit(item->parent, - signal_id, 0, - item, event, &ret_val); - } - } - return ret_val; -} - -static gint -e_minicard_drag_begin (EMinicard *minicard, GdkEvent *event) -{ - gint ret_val = 0; - GnomeCanvasItem *parent; - g_signal_emit (minicard, - e_minicard_signals[DRAG_BEGIN], 0, - event, &ret_val); - - parent = GNOME_CANVAS_ITEM (minicard)->parent; - if (parent && E_IS_REFLOW (parent)) { - E_REFLOW (parent)->maybe_in_drag = FALSE; - } - return ret_val; -} diff --git a/addressbook/gui/widgets/e-minicard.h b/addressbook/gui/widgets/e-minicard.h deleted file mode 100644 index d0270e7013..0000000000 --- a/addressbook/gui/widgets/e-minicard.h +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard.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_MINICARD_H__ -#define __E_MINICARD_H__ - -#include <gdk-pixbuf/gdk-pixbuf.h> -#include "addressbook/gui/contact-editor/e-contact-editor.h" -#include "addressbook/backend/ebook/e-card.h" -#include "addressbook/backend/ebook/e-card-simple.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EMinicard - A small card displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * width double RW width of the card - * height double R height of the card - * card ECard* RW Pointer to the ECard - */ - -#define E_TYPE_MINICARD (e_minicard_get_type ()) -#define E_MINICARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_MINICARD, EMinicard)) -#define E_MINICARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_MINICARD, EMinicardClass)) -#define E_IS_MINICARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_MINICARD)) -#define E_IS_MINICARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_MINICARD)) - - -typedef struct _EMinicard EMinicard; -typedef struct _EMinicardClass EMinicardClass; -typedef enum _EMinicardFocusType EMinicardFocusType; - -enum _EMinicardFocusType { - E_MINICARD_FOCUS_TYPE_START, - E_MINICARD_FOCUS_TYPE_END -}; - -struct _EMinicard -{ - GnomeCanvasGroup parent; - - /* item specific fields */ - ECard *card; - ECardSimple *simple; - - GnomeCanvasItem *rect; - GnomeCanvasItem *header_rect; - GnomeCanvasItem *header_text; - GnomeCanvasItem *list_icon; - - GdkPixbuf *list_icon_pixbuf; - double list_icon_size; - - GObject *editor; - - GList *fields; /* Of type EMinicardField */ - guint needs_remodeling : 1; - - guint changed : 1; - - guint selected : 1; - guint has_cursor : 1; - - guint has_focus : 1; - - guint editable : 1; - - guint drag_button_down : 1; - gint drag_button; - - gint button_x; - gint button_y; - - double width; - double height; -}; - -struct _EMinicardClass -{ - GnomeCanvasGroupClass parent_class; - - gint (* selected) (EMinicard *minicard, GdkEvent *event); - gint (* drag_begin) (EMinicard *minicard, GdkEvent *event); -}; - - -GType e_minicard_get_type (void); -const char *e_minicard_get_card_id (EMinicard *minicard); -int e_minicard_compare (EMinicard *minicard1, - EMinicard *minicard2); - -int e_minicard_selected (EMinicard *minicard, - GdkEvent *event); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_MINICARD_H__ */ diff --git a/addressbook/gui/widgets/gal-view-factory-minicard.c b/addressbook/gui/widgets/gal-view-factory-minicard.c deleted file mode 100644 index 9fbff1f774..0000000000 --- a/addressbook/gui/widgets/gal-view-factory-minicard.c +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-factory-minicard.c: A View Factory - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * (C) 2000, 2001 Ximian, Inc. - */ -#include <config.h> -#include <glib.h> -#include <libgnome/gnome-i18n.h> -#include "gal-view-factory-minicard.h" -#include "gal-view-minicard.h" - -#define PARENT_TYPE GAL_VIEW_FACTORY_TYPE - -static GalViewFactoryClass *gal_view_factory_minicard_parent_class; - -static const char * -gal_view_factory_minicard_get_title (GalViewFactory *factory) -{ - return _("Card View"); -} - -static GalView * -gal_view_factory_minicard_new_view (GalViewFactory *factory, - const char *name) -{ - return gal_view_minicard_new(name); -} - -static const char * -gal_view_factory_minicard_get_type_code (GalViewFactory *factory) -{ - return "minicard"; -} - -static void -gal_view_factory_minicard_class_init (GObjectClass *object_class) -{ - GalViewFactoryClass *view_factory_class = GAL_VIEW_FACTORY_CLASS(object_class); - gal_view_factory_minicard_parent_class = g_type_class_ref (PARENT_TYPE); - - view_factory_class->get_title = gal_view_factory_minicard_get_title; - view_factory_class->new_view = gal_view_factory_minicard_new_view; - view_factory_class->get_type_code = gal_view_factory_minicard_get_type_code; -} - -static void -gal_view_factory_minicard_init (GalViewFactoryMinicard *factory) -{ -} - -/** - * gal_view_minicard_new - * - * A new GalViewFactory for creating Minicard views. Create one of - * these and pass it to GalViewCollection for use. - * - * Returns: The new GalViewFactoryMinicard. - */ -GalViewFactory * -gal_view_factory_minicard_new (void) -{ - return gal_view_factory_minicard_construct (g_object_new (GAL_TYPE_VIEW_FACTORY_MINICARD, NULL)); -} - -/** - * gal_view_minicard_construct - * @factory: The factory to construct - * - * constructs the GalViewFactoryMinicard. To be used by subclasses and - * language bindings. - * - * Returns: The GalViewFactoryMinicard. - */ -GalViewFactory * -gal_view_factory_minicard_construct (GalViewFactoryMinicard *factory) -{ - return GAL_VIEW_FACTORY(factory); -} - -E_MAKE_TYPE(gal_view_factory_minicard, "GalViewFactoryMinicard", GalViewFactoryMinicard, gal_view_factory_minicard_class_init, gal_view_factory_minicard_init, PARENT_TYPE) diff --git a/addressbook/gui/widgets/gal-view-factory-minicard.h b/addressbook/gui/widgets/gal-view-factory-minicard.h deleted file mode 100644 index 02eea99e47..0000000000 --- a/addressbook/gui/widgets/gal-view-factory-minicard.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-factory-minicard.c: A View Factory - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * (C) 2000, 2001 Ximian, Inc. - */ -#ifndef _GAL_VIEW_FACTORY_MINICARD_H_ -#define _GAL_VIEW_FACTORY_MINICARD_H_ - -#include <gtk/gtkobject.h> -#include <gal/menus/gal-view-factory.h> - -#define GAL_TYPE_VIEW_FACTORY_MINICARD (gal_view_factory_minicard_get_type ()) -#define GAL_VIEW_FACTORY_MINICARD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_TYPE_VIEW_FACTORY_MINICARD, GalViewFactoryMinicard)) -#define GAL_VIEW_FACTORY_MINICARD_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_TYPE_VIEW_FACTORY_MINICARD, GalViewFactoryMinicardClass)) -#define GAL_IS_VIEW_FACTORY_MINICARD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_TYPE_VIEW_FACTORY_MINICARD)) -#define GAL_IS_VIEW_FACTORY_MINICARD_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_TYPE_VIEW_FACTORY_MINICARD)) - -typedef struct { - GalViewFactory base; -} GalViewFactoryMinicard; - -typedef struct { - GalViewFactoryClass parent_class; -} GalViewFactoryMinicardClass; - -/* Standard functions */ -GType gal_view_factory_minicard_get_type (void); -GalViewFactory *gal_view_factory_minicard_new (void); -GalViewFactory *gal_view_factory_minicard_construct (GalViewFactoryMinicard *factory); - -#endif /* _GAL_VIEW_FACTORY_MINICARD_H_ */ diff --git a/addressbook/gui/widgets/gal-view-factory-treeview.c b/addressbook/gui/widgets/gal-view-factory-treeview.c deleted file mode 100644 index b14c8dec59..0000000000 --- a/addressbook/gui/widgets/gal-view-factory-treeview.c +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 - -*- */ -/* - * gal-view-factory-treeview.c: A View Factory - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * (C) 2000, 2001 Ximian, Inc. - */ -#include <config.h> -#include <glib.h> -#include <libgnome/gnome-i18n.h> -#include <gal/util/e-util.h> -#include "gal-view-factory-treeview.h" -#include "gal-view-treeview.h" - -#define PARENT_TYPE GAL_VIEW_FACTORY_TYPE - -static GalViewFactoryClass *gal_view_factory_treeview_parent_class; - -static const char * -gal_view_factory_treeview_get_title (GalViewFactory *factory) -{ - return _("GTK Tree View"); -} - -static GalView * -gal_view_factory_treeview_new_view (GalViewFactory *factory, - const char *name) -{ - return gal_view_treeview_new(name); -} - -static const char * -gal_view_factory_treeview_get_type_code (GalViewFactory *factory) -{ - return "treeview"; -} - -static void -gal_view_factory_treeview_class_init (GObjectClass *object_class) -{ - GalViewFactoryClass *view_factory_class = GAL_VIEW_FACTORY_CLASS(object_class); - gal_view_factory_treeview_parent_class = g_type_class_ref (PARENT_TYPE); - - view_factory_class->get_title = gal_view_factory_treeview_get_title; - view_factory_class->new_view = gal_view_factory_treeview_new_view; - view_factory_class->get_type_code = gal_view_factory_treeview_get_type_code; -} - -static void -gal_view_factory_treeview_init (GalViewFactoryTreeView *factory) -{ -} - -/** - * gal_view_treeview_new - * - * A new GalViewFactory for creating TreeView views. Create one of - * these and pass it to GalViewCollection for use. - * - * Returns: The new GalViewFactoryTreeView. - */ -GalViewFactory * -gal_view_factory_treeview_new (void) -{ - return gal_view_factory_treeview_construct (g_object_new (GAL_TYPE_VIEW_FACTORY_TREEVIEW, NULL)); -} - -/** - * gal_view_treeview_construct - * @factory: The factory to construct - * - * constructs the GalViewFactoryTreeView. To be used by subclasses and - * language bindings. - * - * Returns: The GalViewFactoryTreeView. - */ -GalViewFactory * -gal_view_factory_treeview_construct (GalViewFactoryTreeView *factory) -{ - return GAL_VIEW_FACTORY(factory); -} - -E_MAKE_TYPE(gal_view_factory_treeview, "GalViewFactoryTreeView", GalViewFactoryTreeView, gal_view_factory_treeview_class_init, gal_view_factory_treeview_init, PARENT_TYPE) diff --git a/addressbook/gui/widgets/gal-view-factory-treeview.h b/addressbook/gui/widgets/gal-view-factory-treeview.h deleted file mode 100644 index 4795c6d3aa..0000000000 --- a/addressbook/gui/widgets/gal-view-factory-treeview.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-factory-treeview.c: A View Factory - * - * Authors: - * Chris Toshok <toshok@ximian.com> - * - * (C) 2000, 2001 Ximian, Inc. - */ -#ifndef _GAL_VIEW_FACTORY_TREEVIEW_H_ -#define _GAL_VIEW_FACTORY_TREEVIEW_H_ - -#include <gtk/gtkobject.h> -#include <gal/menus/gal-view-factory.h> - -#define GAL_TYPE_VIEW_FACTORY_TREEVIEW (gal_view_factory_treeview_get_type ()) -#define GAL_VIEW_FACTORY_TREEVIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_TYPE_VIEW_FACTORY_TREEVIEW, GalViewFactoryTreeView)) -#define GAL_VIEW_FACTORY_TREEVIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_TYPE_VIEW_FACTORY_TREEVIEW, GalViewFactoryTreeViewClass)) -#define GAL_IS_VIEW_FACTORY_TREEVIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_TYPE_VIEW_FACTORY_TREEVIEW)) -#define GAL_IS_VIEW_FACTORY_TREEVIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_TYPE_VIEW_FACTORY_TREEVIEW)) - -typedef struct { - GalViewFactory base; -} GalViewFactoryTreeView; - -typedef struct { - GalViewFactoryClass parent_class; -} GalViewFactoryTreeViewClass; - -/* Standard functions */ -GType gal_view_factory_treeview_get_type (void); -GalViewFactory *gal_view_factory_treeview_new (void); -GalViewFactory *gal_view_factory_treeview_construct (GalViewFactoryTreeView *factory); - -#endif /* _GAL_VIEW_FACTORY_TREEVIEW_H_ */ diff --git a/addressbook/gui/widgets/gal-view-minicard.c b/addressbook/gui/widgets/gal-view-minicard.c deleted file mode 100644 index 0d8e01c36b..0000000000 --- a/addressbook/gui/widgets/gal-view-minicard.c +++ /dev/null @@ -1,220 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-minicard.c: An Minicard View - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * (C) 2000, 2001 Ximian, Inc. - */ -#include <config.h> -#include "gal-view-minicard.h" -#include <libxml/parser.h> -#include <gal/util/e-xml-utils.h> - -#define PARENT_TYPE gal_view_get_type () -#define d(x) x - -static GalViewClass *gal_view_minicard_parent_class; - -static void -gal_view_minicard_edit (GalView *view, GtkWindow *parent_window) -{ - /* GalViewMinicard *minicard_view = GAL_VIEW_MINICARD(view); */ -} - -static void -gal_view_minicard_load (GalView *view, - const char *filename) -{ - xmlDoc *doc; - doc = xmlParseFile (filename); - if (doc) { - xmlNode *root = xmlDocGetRootElement(doc); - GAL_VIEW_MINICARD (view)->column_width = e_xml_get_double_prop_by_name_with_default (root, "column_width", 150); - xmlFreeDoc(doc); - } -} - -static void -gal_view_minicard_save (GalView *view, - const char *filename) -{ - xmlDoc *doc; - xmlNode *root; - - doc = xmlNewDoc("1.0"); - root = xmlNewNode (NULL, "EMinicardViewState"); - e_xml_set_double_prop_by_name (root, "column_width", GAL_VIEW_MINICARD (view)->column_width); - xmlDocSetRootElement(doc, root); - xmlSaveFile(filename, doc); - xmlFreeDoc(doc); -} - -static const char * -gal_view_minicard_get_title (GalView *view) -{ - return GAL_VIEW_MINICARD(view)->title; -} - -static void -gal_view_minicard_set_title (GalView *view, - const char *title) -{ - g_free(GAL_VIEW_MINICARD(view)->title); - GAL_VIEW_MINICARD(view)->title = g_strdup(title); -} - -static const char * -gal_view_minicard_get_type_code (GalView *view) -{ - return "minicard"; -} - -static GalView * -gal_view_minicard_clone (GalView *view) -{ - GalViewMinicard *gvm, *new; - - gvm = GAL_VIEW_MINICARD(view); - - new = g_object_new (GAL_TYPE_VIEW_MINICARD, NULL); - new->title = g_strdup (gvm->title); - new->column_width = gvm->column_width; - - return GAL_VIEW(new); -} - -static void -gal_view_minicard_dispose (GObject *object) -{ - GalViewMinicard *view = GAL_VIEW_MINICARD(object); - gal_view_minicard_detach (view); - g_free(view->title); -} - -static void -gal_view_minicard_class_init (GObjectClass *object_class) -{ - GalViewClass *gal_view_class = GAL_VIEW_CLASS(object_class); - gal_view_minicard_parent_class = g_type_class_ref (PARENT_TYPE); - - gal_view_class->edit = gal_view_minicard_edit ; - gal_view_class->load = gal_view_minicard_load ; - gal_view_class->save = gal_view_minicard_save ; - gal_view_class->get_title = gal_view_minicard_get_title ; - gal_view_class->set_title = gal_view_minicard_set_title ; - gal_view_class->get_type_code = gal_view_minicard_get_type_code; - gal_view_class->clone = gal_view_minicard_clone ; - - object_class->dispose = gal_view_minicard_dispose ; -} - -static void -gal_view_minicard_init (GalViewMinicard *gvm) -{ - gvm->title = NULL; - gvm->column_width = 150.0; - - gvm->emvw = NULL; - gvm->emvw_column_width_changed_id = 0; -} - -/** - * gal_view_minicard_new - * @title: The name of the new view. - * - * Returns a new GalViewMinicard. This is primarily for use by - * GalViewFactoryMinicard. - * - * Returns: The new GalViewMinicard. - */ -GalView * -gal_view_minicard_new (const gchar *title) -{ - return gal_view_minicard_construct (g_object_new (GAL_TYPE_VIEW_MINICARD, NULL), title); -} - -/** - * gal_view_minicard_construct - * @view: The view to construct. - * @title: The name of the new view. - * - * constructs the GalViewMinicard. To be used by subclasses and - * language bindings. - * - * Returns: The GalViewMinicard. - */ -GalView * -gal_view_minicard_construct (GalViewMinicard *view, - const gchar *title) -{ - view->title = g_strdup(title); - return GAL_VIEW(view); -} - -GType -gal_view_minicard_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (GalViewMinicardClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gal_view_minicard_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GalViewMinicard), - 0, /* n_preallocs */ - (GInstanceInitFunc) gal_view_minicard_init, - }; - - type = g_type_register_static (PARENT_TYPE, "GalViewMinicard", &info, 0); - } - - return type; -} - -static void -column_width_changed (ETable *table, double width, GalViewMinicard *view) -{ - d(g_print("%s: Old width = %f, New width = %f\n", __FUNCTION__, view->column_width, width)); - if (view->column_width != width) { - view->column_width = width; - gal_view_changed(GAL_VIEW(view)); - } -} - -void -gal_view_minicard_attach (GalViewMinicard *view, EMinicardViewWidget *emvw) -{ - gal_view_minicard_detach (view); - - view->emvw = emvw; - - g_object_ref (view->emvw); - - g_object_set (view->emvw, - "column_width", view->column_width, - NULL); - - view->emvw_column_width_changed_id = - g_signal_connect(view->emvw, "column_width_changed", - G_CALLBACK (column_width_changed), view); -} - -void -gal_view_minicard_detach (GalViewMinicard *view) -{ - if (view->emvw == NULL) - return; - if (view->emvw_column_width_changed_id) { - g_signal_handler_disconnect (view->emvw, - view->emvw_column_width_changed_id); - view->emvw_column_width_changed_id = 0; - } - g_object_unref (view->emvw); - view->emvw = NULL; -} diff --git a/addressbook/gui/widgets/gal-view-minicard.h b/addressbook/gui/widgets/gal-view-minicard.h deleted file mode 100644 index e586012f73..0000000000 --- a/addressbook/gui/widgets/gal-view-minicard.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-minicard.h: An Minicard View - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * (C) 2000, 2001 Ximian, Inc. - */ -#ifndef _GAL_VIEW_MINICARD_H_ -#define _GAL_VIEW_MINICARD_H_ - -#include <gal/menus/gal-view.h> -#include <e-minicard-view-widget.h> - -#define GAL_TYPE_VIEW_MINICARD (gal_view_minicard_get_type ()) -#define GAL_VIEW_MINICARD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_TYPE_VIEW_MINICARD, GalViewMinicard)) -#define GAL_VIEW_MINICARD_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_TYPE_VIEW_MINICARD, GalViewMinicardClass)) -#define GAL_IS_VIEW_MINICARD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_TYPE_VIEW_MINICARD)) -#define GAL_IS_VIEW_MINICARD_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_TYPE_VIEW_MINICARD)) - -typedef struct { - GalView base; - - char *title; - double column_width; - - EMinicardViewWidget *emvw; - guint emvw_column_width_changed_id; -} GalViewMinicard; - -typedef struct { - GalViewClass parent_class; -} GalViewMinicardClass; - -/* Standard functions */ -GType gal_view_minicard_get_type (void); -GalView *gal_view_minicard_new (const gchar *title); -GalView *gal_view_minicard_construct (GalViewMinicard *view, - const gchar *title); -void gal_view_minicard_attach (GalViewMinicard *view, - EMinicardViewWidget *emvw); -void gal_view_minicard_detach (GalViewMinicard *view); - -#endif /* _GAL_VIEW_MINICARD_H_ */ diff --git a/addressbook/gui/widgets/gal-view-treeview.c b/addressbook/gui/widgets/gal-view-treeview.c deleted file mode 100644 index 8d13d4aa26..0000000000 --- a/addressbook/gui/widgets/gal-view-treeview.c +++ /dev/null @@ -1,227 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-treeview.c: An TreeView View - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * (C) 2000, 2001 Ximian, Inc. - */ -#include <config.h> -#include "gal-view-treeview.h" -#include <libxml/parser.h> -#include <gal/util/e-xml-utils.h> - -#define PARENT_TYPE gal_view_get_type () -#define d(x) x - -static GalViewClass *gal_view_treeview_parent_class; - -static void -gal_view_treeview_edit (GalView *view, GtkWindow *parent_window) -{ - /* GalViewTreeView *treeview_view = GAL_VIEW_TREEVIEW(view); */ -} - -static void -gal_view_treeview_load (GalView *view, - const char *filename) -{ -#if 0 - xmlDoc *doc; - doc = xmlParseFile (filename); - if (doc) { - xmlNode *root = xmlDocGetRootElement(doc); - GAL_VIEW_TREEVIEW (view)->column_width = e_xml_get_double_prop_by_name_with_default (root, "column_width", 150); - xmlFreeDoc(doc); - } -#endif -} - -static void -gal_view_treeview_save (GalView *view, - const char *filename) -{ -#if 0 - xmlDoc *doc; - xmlNode *root; - - doc = xmlNewDoc("1.0"); - root = xmlNewNode (NULL, "ETreeViewViewState"); - e_xml_set_double_prop_by_name (root, "column_width", GAL_VIEW_TREEVIEW (view)->column_width); - xmlDocSetRootElement(doc, root); - xmlSaveFile(filename, doc); - xmlFreeDoc(doc); -#endif -} - -static const char * -gal_view_treeview_get_title (GalView *view) -{ - return GAL_VIEW_TREEVIEW(view)->title; -} - -static void -gal_view_treeview_set_title (GalView *view, - const char *title) -{ - g_free(GAL_VIEW_TREEVIEW(view)->title); - GAL_VIEW_TREEVIEW(view)->title = g_strdup(title); -} - -static const char * -gal_view_treeview_get_type_code (GalView *view) -{ - return "treeview"; -} - -static GalView * -gal_view_treeview_clone (GalView *view) -{ - GalViewTreeView *gvm, *new; - - gvm = GAL_VIEW_TREEVIEW(view); - - new = g_object_new (GAL_TYPE_VIEW_TREEVIEW, NULL); - new->title = g_strdup (gvm->title); - - return GAL_VIEW(new); -} - -static void -gal_view_treeview_dispose (GObject *object) -{ - GalViewTreeView *view = GAL_VIEW_TREEVIEW(object); - gal_view_treeview_detach (view); - g_free(view->title); -} - -static void -gal_view_treeview_class_init (GObjectClass *object_class) -{ - GalViewClass *gal_view_class = GAL_VIEW_CLASS(object_class); - gal_view_treeview_parent_class = g_type_class_ref (PARENT_TYPE); - - gal_view_class->edit = gal_view_treeview_edit ; - gal_view_class->load = gal_view_treeview_load ; - gal_view_class->save = gal_view_treeview_save ; - gal_view_class->get_title = gal_view_treeview_get_title ; - gal_view_class->set_title = gal_view_treeview_set_title ; - gal_view_class->get_type_code = gal_view_treeview_get_type_code; - gal_view_class->clone = gal_view_treeview_clone ; - - object_class->dispose = gal_view_treeview_dispose ; -} - -static void -gal_view_treeview_init (GalViewTreeView *gvm) -{ - gvm->title = NULL; - - gvm->tree = NULL; -} - -/** - * gal_view_treeview_new - * @title: The name of the new view. - * - * Returns a new GalViewTreeView. This is primarily for use by - * GalViewFactoryTreeView. - * - * Returns: The new GalViewTreeView. - */ -GalView * -gal_view_treeview_new (const gchar *title) -{ - return gal_view_treeview_construct (g_object_new (GAL_TYPE_VIEW_TREEVIEW, NULL), title); -} - -/** - * gal_view_treeview_construct - * @view: The view to construct. - * @title: The name of the new view. - * - * constructs the GalViewTreeView. To be used by subclasses and - * language bindings. - * - * Returns: The GalViewTreeView. - */ -GalView * -gal_view_treeview_construct (GalViewTreeView *view, - const gchar *title) -{ - view->title = g_strdup(title); - return GAL_VIEW(view); -} - -GType -gal_view_treeview_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (GalViewTreeViewClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gal_view_treeview_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GalViewTreeView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gal_view_treeview_init, - }; - - type = g_type_register_static (PARENT_TYPE, "GalViewTreeView", &info, 0); - } - - return type; -} - -#if 0 -static void -column_width_changed (ETable *table, double width, GalViewMinicard *view) -{ - d(g_print("%s: Old width = %f, New width = %f\n", __FUNCTION__, view->column_width, width)); - if (view->column_width != width) { - view->column_width = width; - gal_view_changed(GAL_VIEW(view)); - } -} -#endif - -void -gal_view_treeview_attach (GalViewTreeView *view, GtkTreeView *tree) -{ -#if 0 - gal_view_treeview_detach (view); - - view->emvw = emvw; - - g_object_ref (view->emvw); - - g_object_set (view->emvw, - "column_width", view->column_width, - NULL); - - view->emvw_column_width_changed_id = - g_signal_connect(view->emvw, "column_width_changed", - G_CALLBACK (column_width_changed), view); -#endif -} - -void -gal_view_treeview_detach (GalViewTreeView *view) -{ -#if 0 - if (view->emvw == NULL) - return; - if (view->emvw_column_width_changed_id) { - g_signal_handler_disconnect (view->emvw, - view->emvw_column_width_changed_id); - view->emvw_column_width_changed_id = 0; - } - g_object_unref (view->emvw); - view->emvw = NULL; -#endif -} diff --git a/addressbook/gui/widgets/gal-view-treeview.h b/addressbook/gui/widgets/gal-view-treeview.h deleted file mode 100644 index a0313856a6..0000000000 --- a/addressbook/gui/widgets/gal-view-treeview.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-treeview.h: An TreeView View - * - * Authors: - * Chris Toshok <toshok@ximian.com> - * - * (C) 2000, 2001 Ximian, Inc. - */ -#ifndef _GAL_VIEW_TREEVIEW_H_ -#define _GAL_VIEW_TREEVIEW_H_ - -#include <gal/menus/gal-view.h> -#include <gtk/gtktreeview.h> - -#define GAL_TYPE_VIEW_TREEVIEW (gal_view_treeview_get_type ()) -#define GAL_VIEW_TREEVIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_TYPE_VIEW_TREEVIEW, GalViewTreeView)) -#define GAL_VIEW_TREEVIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_TYPE_VIEW_TREEVIEW, GalViewTreeViewClass)) -#define GAL_IS_VIEW_TREEVIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_TYPE_VIEW_TREEVIEW)) -#define GAL_IS_VIEW_TREEVIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_TYPE_VIEW_TREEVIEW)) - -typedef struct { - GalView base; - - char *title; - - GtkTreeView *tree; -} GalViewTreeView; - -typedef struct { - GalViewClass parent_class; -} GalViewTreeViewClass; - -/* Standard functions */ -GType gal_view_treeview_get_type (void); -GalView *gal_view_treeview_new (const gchar *title); -GalView *gal_view_treeview_construct (GalViewTreeView *view, - const gchar *title); -void gal_view_treeview_attach (GalViewTreeView *view, - GtkTreeView *tree); -void gal_view_treeview_detach (GalViewTreeView *view); - -#endif /* _GAL_VIEW_TREEVIEW_H_ */ diff --git a/addressbook/gui/widgets/test-minicard-label.c b/addressbook/gui/widgets/test-minicard-label.c deleted file mode 100644 index c109497628..0000000000 --- a/addressbook/gui/widgets/test-minicard-label.c +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-minicard-label.c - * - * Copyright (C) 2000 Ximian, Inc. - * Author: Chris Lahey <clahey@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 <gtk/gtkmain.h> -#include <libgnomeui/gnome-app.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> -#include <libgnomeui/gnome-init.h> -#include <gal/widgets/e-canvas.h> -#include "e-minicard-label.h" - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *label; -GnomeCanvasItem *rect; - -static void destroy_callback(gpointer data, GObject *where_object_was) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, allocation->height ); - gnome_canvas_item_set( label, - "width", (double) allocation->width, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( rect, - "x2", (double) allocation->width, - "y2", (double) allocation->height, - NULL ); -} - -#if 0 -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey <clahey@umich.edu>", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Minicard Label Test" ), VERSION, - _( "Copyright (C) 2000, Ximian, Inc." ), - authors, - _( "This should test the minicard label canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -static void button_press_callback( GtkWidget *widget, gpointer data ) -{ - gnome_canvas_item_grab_focus( label ); -} - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *canvas; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Minicard Label Test", VERSION, argc, argv); - app = gnome_app_new("Minicard Label Test", NULL); - - canvas = e_canvas_new(); - rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - label = e_minicard_label_new(gnome_canvas_root( GNOME_CANVAS( canvas ) )); - gnome_canvas_item_set( label, - "width", (double) 100, - "height", (double) 100, - "fieldname", "Full Name:", - "field", "Christopher James Lahey", - NULL ); - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - gnome_app_set_contents( GNOME_APP( app ), canvas ); - - - /* Connect the signals */ - g_object_weak_ref (app, destroy_callback, app); - - g_signal_connect( canvas , "size_allocate", - G_CALLBACK ( allocate_callback ), - ( gpointer ) app ); - - g_signal_connect( canvas , "button_press_event", - G_CALLBACK ( button_press_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/gui/widgets/test-minicard-view.c b/addressbook/gui/widgets/test-minicard-view.c deleted file mode 100644 index 7abe611711..0000000000 --- a/addressbook/gui/widgets/test-minicard-view.c +++ /dev/null @@ -1,206 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-reflow.c - * - * Copyright (C) 2000 Ximian, Inc. - * Author: Chris Lahey <clahey@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 <libgnorba/gnorba.h> -#include <e-util/e-canvas.h> -#include "e-minicard-view.h" - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *reflow; -GnomeCanvasItem *rect; -GtkAllocation last_alloc; - -CORBA_Environment ev; -CORBA_ORB orb; - -static void -init_bonobo (int argc, char **argv) -{ - - gnome_CORBA_init_with_popt_table ( - "Reflow Test", VERSION, - &argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); - - orb = gnome_CORBA_ORB (); - - if (bonobo_init (orb, NULL, NULL) == FALSE) - g_error (_("Could not initialize Bonobo")); - -} - -static void destroy_callback(gpointer data, GObject *where_object_was) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - double width; - last_alloc = *allocation; - gnome_canvas_item_set( reflow, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( reflow, - "minimum_width", (double) allocation->width, - NULL ); - g_object_get(reflow, - "width", &width, - NULL); - width = MAX(width, allocation->width); - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, width, allocation->height ); - gnome_canvas_item_set( rect, - "x2", (double) width, - "y2", (double) allocation->height, - NULL ); -} - -static void resize(GnomeCanvas *canvas, gpointer data) -{ - double width; - g_object_get(reflow, - "width", &width, - NULL); - width = MAX(width, last_alloc.width); - gnome_canvas_set_scroll_region(canvas , 0, 0, width, last_alloc.height ); - gnome_canvas_item_set( rect, - "x2", (double) width, - "y2", (double) last_alloc.height, - NULL ); -} - -#if 0 -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey <clahey@umich.edu>", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Reflow Test" ), VERSION, - _( "Copyright (C) 2000, Ximian, Inc." ), - authors, - _( "This should test the reflow canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -static void -book_open_cb (EBook *book, EBookStatus status, gpointer closure) -{ - if (status == E_BOOK_STATUS_SUCCESS) - gnome_canvas_item_set(reflow, - "book", book, - NULL); -} - -static gboolean -ebook_create (gpointer data) -{ - EBook *book; - - book = e_book_new (); - - if (!book) { - printf ("%s: %s(): Couldn't create EBook, bailing.\n", - __FILE__, - __FUNCTION__); - return FALSE; - } - - - if (! e_book_load_uri (book, "file:/tmp/test.db", book_open_cb, NULL)) { - printf ("error calling load_uri!\n"); - } - - - return FALSE; -} - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *canvas; - GtkWidget *vbox; - GtkWidget *scrollbar; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - CORBA_exception_init (&ev); - init_bonobo (argc, argv); - - app = gnome_app_new("Reflow Test", NULL); - - vbox = gtk_vbox_new(FALSE, 0); - - canvas = e_canvas_new(); - rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - reflow = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - e_minicard_view_get_type(), - "height", (double) 100, - "minimum_width", (double) 100, - NULL ); - g_signal_connect( canvas, "reflow", - G_CALLBACK ( resize ), - ( gpointer ) app); - - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - gtk_box_pack_start(GTK_BOX(vbox), canvas, TRUE, TRUE, 0); - - scrollbar = gtk_hscrollbar_new(gtk_layout_get_hadjustment(GTK_LAYOUT(canvas))); - - gtk_box_pack_start(GTK_BOX(vbox), scrollbar, FALSE, FALSE, 0); - - gnome_app_set_contents( GNOME_APP( app ), vbox ); - - /* Connect the signals */ - g_object_weak_ref (app, destroy_callback, app); - - g_signal_connect( canvas, "size_allocate", - G_CALLBACK ( allocate_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - gdk_window_set_back_pixmap( GTK_LAYOUT(canvas)->bin_window, NULL, FALSE); - - g_idle_add (ebook_create, NULL); - - bonobo_main (); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/gui/widgets/test-minicard.c b/addressbook/gui/widgets/test-minicard.c deleted file mode 100644 index 822362d972..0000000000 --- a/addressbook/gui/widgets/test-minicard.c +++ /dev/null @@ -1,120 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-minicard.c - * - * Copyright (C) 2000 Ximian, Inc. - * Author: Chris Lahey <clahey@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 <gtk/gtkmain.h> -#include <libgnomeui/gnome-app.h> -#include <libgnomeui/gnome-init.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> - -#include "e-minicard.h" - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *card; -GnomeCanvasItem *rect; - -static void destroy_callback(gpointer data, GObject *where_object_was) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, allocation->height ); - gnome_canvas_item_set( card, - "width", (double) allocation->width, - NULL ); - gnome_canvas_item_set( rect, - "x2", (double) allocation->width, - "y2", (double) allocation->height, - NULL ); -} - -#if 0 -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey <clahey@umich.edu>", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Minicard Test" ), VERSION, - _( "Copyright (C) 2000, Ximian, Inc." ), - authors, - _( "This should test the minicard canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *canvas; - int i; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Minicard Test", VERSION, argc, argv); - app = gnome_app_new("Minicard Test", NULL); - - canvas = gnome_canvas_new(); - rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - for ( i = 0; i < 1; i++ ) - { - card = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - e_minicard_get_type(), - "width", (double) 100, - NULL ); - } - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - gnome_app_set_contents( GNOME_APP( app ), canvas ); - - /* Connect the signals */ - g_object_weak_ref (app, destroy_callback, app); - - g_signal_connect( canvas, "size_allocate", - G_CALLBACK( allocate_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/gui/widgets/test-reflow.c b/addressbook/gui/widgets/test-reflow.c deleted file mode 100644 index 66f003fe2c..0000000000 --- a/addressbook/gui/widgets/test-reflow.c +++ /dev/null @@ -1,199 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-reflow.c - * - * Copyright (C) 2000 Ximian, Inc. - * Author: Chris Lahey <clahey@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. - */ - -#define TEST_VCARD \ -"BEGIN:VCARD -" \ -"FN:Nat -" \ -"N:Friedman;Nat;D;Mr. -" \ -"TITLE:Head Geek -" \ -"BDAY:1977-08-06 -" \ -"TEL;WORK:617 679 1984 -" \ -"TEL;CELL:123 456 7890 -" \ -"EMAIL;INTERNET:nat@nat.org -" \ -"EMAIL;INTERNET:nat@ximian.com -" \ -"ADR;WORK;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234; -" \ -"ADR;HOME;POSTAL;INTL:P.O. Box 202;;;Any Town 2;MI;12344-4321;USA -" \ -"END:VCARD -" \ -" -" - - -#include "config.h" - -#include <gtk/gtkmain.h> -#include <gtk/gtkvbox.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> -#include <libgnomeui/gnome-init.h> -#include <gal/widgets/e-canvas.h> -#include <gal/widgets/e-reflow.h> -#include <gal/widgets/e-scroll-frame.h> - -#include "e-minicard.h" - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *reflow; -GnomeCanvasItem *rect; -GtkAllocation last_alloc; - -static void destroy_callback(gpointer data, GObject *where_object_was) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - double width; - last_alloc = *allocation; - gnome_canvas_item_set( reflow, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( reflow, - "minimum_width", (double) allocation->width, - NULL ); - g_object_get(reflow, - "width", &width, - NULL); - width = MAX(width, allocation->width); - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, width - 1, allocation->height - 1); - gnome_canvas_item_set( rect, - "x2", (double) width, - "y2", (double) allocation->height, - NULL ); -} - -static void resize(GnomeCanvas *canvas, gpointer data) -{ - double width; - g_object_get(reflow, - "width", &width, - NULL); - width = MAX(width, last_alloc.width); - gnome_canvas_set_scroll_region(canvas , 0, 0, width - 1, last_alloc.height - 1); - gnome_canvas_item_set( rect, - "x2", (double) width, - "y2", (double) last_alloc.height, - NULL ); -} - -#if 0 -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey <clahey@umich.edu>", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Reflow Test" ), VERSION, - _( "Copyright (C) 2000, Ximian, Inc." ), - authors, - _( "This should test the reflow canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *canvas; - GtkWidget *vbox; - GtkWidget *scrollframe; - int i; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Reflow Test", VERSION, argc, argv); - app = gnome_app_new("Reflow Test", NULL); - - vbox = gtk_vbox_new(FALSE, 0); - - canvas = e_canvas_new(); - rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - reflow = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - e_reflow_get_type(), - "height", (double) 100, - "minimum_width", (double) 100, - NULL ); - g_signal_connect( canvas, "reflow", - G_CALLBACK ( resize ), - ( gpointer ) app); - for ( i = 0; i < 200; i++ ) - { - GnomeCanvasItem *item; - ECard *card = e_card_new (TEST_VCARD); - item = gnome_canvas_item_new( GNOME_CANVAS_GROUP(reflow), - e_minicard_get_type(), - "card", card, - NULL); - e_reflow_add_item(E_REFLOW(reflow), item, NULL); - } - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - scrollframe = e_scroll_frame_new (gtk_layout_get_hadjustment(GTK_LAYOUT(canvas)), - gtk_layout_get_vadjustment(GTK_LAYOUT(canvas))); - e_scroll_frame_set_policy (E_SCROLL_FRAME (scrollframe), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_NEVER); - - gtk_container_add (GTK_CONTAINER (scrollframe), canvas); - - gnome_app_set_contents( GNOME_APP( app ), scrollframe ); - - /* Connect the signals */ - g_object_weak_ref (app, destroy_callback, app); - - g_signal_connect( canvas, "size_allocate", - G_CALLBACK ( allocate_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - gdk_window_set_back_pixmap( GTK_LAYOUT(canvas)->bin_window, NULL, FALSE); - - gtk_main(); - - /* Not reached. */ - return 0; -} |