diff options
Diffstat (limited to 'addressbook/gui/component')
38 files changed, 0 insertions, 6874 deletions
diff --git a/addressbook/gui/component/.cvsignore b/addressbook/gui/component/.cvsignore deleted file mode 100644 index a8ecb5d170..0000000000 --- a/addressbook/gui/component/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -*.lo -*.la -evolution-addressbook -evolution-addressbook.pure -test-addressbook diff --git a/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in b/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in deleted file mode 100644 index 01474ce90a..0000000000 --- a/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in +++ /dev/null @@ -1,92 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_MiniCard_ControlFactory" - type="exe" - location="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 Minicard control"/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_MiniCard_Control" - type="factory" - location="OAFIID:GNOME_Evolution_Addressbook_MiniCard_ControlFactory"> - - <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_ControlFactory" - type="exe" - location="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 sample Addressbook control"/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_Control" - type="factory" - location="OAFIID:GNOME_Evolution_Addressbook_ControlFactory"> - - <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_ShellComponentFactory" - type="exe" - location="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 Evolution addressbook component."/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_ShellComponent" - type="factory" - location="OAFIID:GNOME_Evolution_Addressbook_ShellComponentFactory"> - - <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_server> - -</oaf_info> diff --git a/addressbook/gui/component/GNOME_Evolution_Addressbook.oafinfo b/addressbook/gui/component/GNOME_Evolution_Addressbook.oafinfo deleted file mode 100644 index 01474ce90a..0000000000 --- a/addressbook/gui/component/GNOME_Evolution_Addressbook.oafinfo +++ /dev/null @@ -1,92 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_MiniCard_ControlFactory" - type="exe" - location="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 Minicard control"/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_MiniCard_Control" - type="factory" - location="OAFIID:GNOME_Evolution_Addressbook_MiniCard_ControlFactory"> - - <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_ControlFactory" - type="exe" - location="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 sample Addressbook control"/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_Control" - type="factory" - location="OAFIID:GNOME_Evolution_Addressbook_ControlFactory"> - - <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_ShellComponentFactory" - type="exe" - location="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 Evolution addressbook component."/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_ShellComponent" - type="factory" - location="OAFIID:GNOME_Evolution_Addressbook_ShellComponentFactory"> - - <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_server> - -</oaf_info> diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am deleted file mode 100644 index b4f5bd1a09..0000000000 --- a/addressbook/gui/component/Makefile.am +++ /dev/null @@ -1,80 +0,0 @@ -SUBDIRS = select-names - -INCLUDES = \ - -DG_LOG_DOMAIN=\"evolution-addressbook\" \ - $(EXTRA_GNOME_CFLAGS) \ - $(GNOME_INCLUDEDIR) \ - -I$(top_srcdir) \ - -I$(top_builddir) \ - -I$(top_srcdir)/shell \ - -I$(top_builddir)/shell \ - -I$(top_srcdir)/widgets/misc \ - -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 \ - $(BONOBO_HTML_GNOME_CFLAGS) \ - -DEVOLUTION_VERSION=\""$(VERSION)"\" \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ - -DCAMEL_PROVIDERDIR=\""$(providerdir)"\" - -bin_PROGRAMS = \ - evolution-addressbook - -evolution_addressbook_SOURCES = \ - addressbook-component.c \ - addressbook-component.h \ - addressbook-config.c \ - addressbook-config.h \ - addressbook-factory.c \ - addressbook-storage.c \ - addressbook-storage.h \ - addressbook.c \ - addressbook.h \ - e-cardlist-model.c \ - e-cardlist-model.h - -evolution_addressbook_LDADD = \ - select-names/libeselectnames.la \ - $(top_builddir)/shell/libeshell.a \ - $(EXTRA_GNOME_LIBS) \ - $(BONOBO_HTML_GNOME_LIBS) \ - $(top_builddir)/addressbook/gui/widgets/libeminicard.a \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/e-util/ename/libename.la \ - $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/addressbook/printing/libecontactprint.a \ - $(top_builddir)/addressbook/gui/search/libeaddressbooksearch.a \ - $(top_builddir)/filter/libfilter.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/widgets/menus/libmenus.la - -evolution_addressbook_LDFLAGS = `gnome-config --libs gdk_pixbuf` -export-dynamic - -oafdir = $(datadir)/oaf -oaf_DATA = GNOME_Evolution_Addressbook.oafinfo - -gladedir = $(datadir)/evolution/glade -glade_DATA = addressbook-config.glade - -EXTRA_DIST = \ - $(glade_DATA) \ - $(oaf_DATA) \ - addressbook-config.glade - -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 129a2f2d97..0000000000 --- a/addressbook/gui/component/addressbook-component.c +++ /dev/null @@ -1,157 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* addressbook-component.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * 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.h> - -#include "evolution-shell-component.h" -#include "evolution-storage.h" - -#include "addressbook-storage.h" -#include "addressbook-component.h" -#include "addressbook.h" - - - -#define GNOME_EVOLUTION_ADDRESSBOOK_COMPONENT_FACTORY_ID "OAFIID:GNOME_Evolution_Addressbook_ShellComponentFactory" - -EvolutionShellClient *global_shell_client; - -EvolutionShellClient * -addressbook_component_get_shell_client (void) -{ - return global_shell_client; -} - -static BonoboGenericFactory *factory = NULL; - -static const EvolutionShellComponentFolderType folder_types[] = { - { "contacts", "evolution-contacts.png" }, - { NULL, NULL } -}; - - -/* EvolutionShellComponent methods and signals. */ - -static EvolutionShellComponentResult -create_view (EvolutionShellComponent *shell_component, - const char *physical_uri, - const char *type, - BonoboControl **control_return, - void *closure) -{ - BonoboControl *control; - - if (g_strcasecmp (type, "contacts") != 0) - return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE; - - control = addressbook_factory_new_control (); - bonobo_control_set_property (control, "folder_uri", 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 (g_strcasecmp (type, "contacts") != 0) - 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 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 void -owner_unset_cb (EvolutionShellComponent *shell_component, - GNOME_Evolution_Shell shell_interface, - gpointer user_data) -{ - owner_count --; - if (owner_count == 0) - gtk_main_quit(); -} - - -/* The factory function. */ - -static BonoboObject * -factory_fn (BonoboGenericFactory *factory, - void *closure) -{ - EvolutionShellComponent *shell_component; - - shell_component = evolution_shell_component_new (folder_types, create_view, create_folder, NULL, NULL, NULL, NULL); - - gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set", - GTK_SIGNAL_FUNC (owner_set_cb), NULL); - - gtk_signal_connect (GTK_OBJECT (shell_component), "owner_unset", - GTK_SIGNAL_FUNC (owner_unset_cb), NULL); - - return BONOBO_OBJECT (shell_component); -} - - -void -addressbook_component_factory_init (void) -{ - if (factory != NULL) - return; - - factory = bonobo_generic_factory_new (GNOME_EVOLUTION_ADDRESSBOOK_COMPONENT_FACTORY_ID, factory_fn, NULL); - - if (factory == NULL) - g_error ("Cannot initialize the Evolution addressbook factory."); -} - diff --git a/addressbook/gui/component/addressbook-component.h b/addressbook/gui/component/addressbook-component.h deleted file mode 100644 index ea0d8b9a46..0000000000 --- a/addressbook/gui/component/addressbook-component.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* addressbook-component.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * 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" - -void addressbook_component_factory_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 43f34a4389..0000000000 --- a/addressbook/gui/component/addressbook-config.c +++ /dev/null @@ -1,960 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -#include <config.h> - -#include <gnome.h> -#include <gtkhtml/gtkhtml.h> -#include <glade/glade.h> -#include <gal/widgets/e-unicode.h> -#include "e-util/e-html-utils.h" -#include "addressbook-config.h" -#include "addressbook-storage.h" - -/* #define INCLUDE_FILE_SOURCE */ - -typedef struct _AddressbookSourceDialog AddressbookSourceDialog; -typedef struct _AddressbookSourcePageItem AddressbookSourcePageItem; -typedef struct _LDAPAuthPageItem LDAPAuthPageItem; - -struct _AddressbookSourceDialog { - GtkWidget *html; - GtkWidget *dialog; - GtkWidget *vbox; - GtkWidget *name; - GtkWidget *description; - GtkWidget *source_option; - GtkWidget *notebook; - - GList *source_pages; - AddressbookSourcePageItem *source_page; - - gint id; /* button we closed the dialog with */ - - AddressbookSource *source; /* our result if the Ok button was clicked */ -}; - -struct _AddressbookSourcePageItem { - gint pnum; - - AddressbookSourceType source_type; - - AddressbookSourceDialog *dialog; - - GtkWidget *item; - GtkWidget *vbox; - - /* file: addressbook's */ - GtkWidget *path; - GtkWidget *creat; - - /* ldap: addressbook's */ - GtkWidget *host; - GtkWidget *port; - GtkWidget *rootdn; - GtkWidget *scope_optionmenu; - GtkWidget *auth_optionmenu; - GtkWidget *auth_notebook; - - GList *auths; - LDAPAuthPageItem *auth; -}; - -struct _LDAPAuthPageItem { - gint pnum; - - AddressbookLDAPAuthType auth_type; - - AddressbookSourceDialog *dialog; - AddressbookSourcePageItem *page; - - GtkWidget *item; - GtkWidget *vbox; - - /* simple (password) auth */ - GtkWidget *binddn; - GtkWidget *remember_passwd; -}; - -static void -html_size_req (GtkWidget *widget, GtkRequisition *requisition) -{ - requisition->height = GTK_LAYOUT (widget)->height; -} - -/* Returns a GtkHTML which is already inside a GtkScrolledWindow. If - * @white is TRUE, the GtkScrolledWindow will be inside a GtkFrame. - */ -static GtkWidget * -html_new (gboolean white) -{ - GtkWidget *html, *scrolled, *frame; - GtkStyle *style; - - html = gtk_html_new (); - GTK_LAYOUT (html)->height = 0; - gtk_signal_connect (GTK_OBJECT (html), "size_request", - GTK_SIGNAL_FUNC (html_size_req), NULL); - gtk_html_set_editable (GTK_HTML (html), FALSE); - style = gtk_rc_get_style (html); - if (style) { - gtk_html_set_default_background_color (GTK_HTML (html), - white ? &style->white : - &style->bg[0]); - } - gtk_widget_set_sensitive (html, FALSE); - scrolled = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), - GTK_POLICY_NEVER, - GTK_POLICY_NEVER); - gtk_container_add (GTK_CONTAINER (scrolled), html); - - if (white) { - frame = gtk_frame_new (NULL); - gtk_frame_set_shadow_type (GTK_FRAME (frame), - GTK_SHADOW_ETCHED_IN); - gtk_container_add (GTK_CONTAINER (frame), scrolled); - gtk_widget_show_all (frame); - } else - gtk_widget_show_all (scrolled); - - return html; -} - -static void -put_html (GtkHTML *html, char *text) -{ - GtkHTMLStream *handle; - - text = e_text_to_html (text, E_TEXT_TO_HTML_CONVERT_NL); - handle = gtk_html_begin (html); - gtk_html_write (html, handle, "<HTML><BODY>", 12); - gtk_html_write (html, handle, text, strlen (text)); - gtk_html_write (html, handle, "</BODY></HTML>", 14); - g_free (text); - gtk_html_end (html, handle, GTK_HTML_STREAM_OK); -} - -#ifdef INCLUDE_FILE_SOURCE -static const char * -addressbook_config_source_label (AddressbookSourceType type) -{ - switch (type) { - case ADDRESSBOOK_SOURCE_LDAP: - return _("LDAP Server"); - case ADDRESSBOOK_SOURCE_FILE: - return _("File"); - default: - g_assert(0); - return _("Unknown addressbook type"); - } -} -#endif - -static const char * -addressbook_config_auth_label (AddressbookLDAPAuthType type) -{ - switch (type) { - case ADDRESSBOOK_LDAP_AUTH_NONE: - return _("None (anonymous mode)"); - case ADDRESSBOOK_LDAP_AUTH_SIMPLE: - return _("Password"); - case ADDRESSBOOK_LDAP_AUTH_SASL: - return _("SASL"); - default: - g_assert(0); - return _("Unknown auth type"); - } -} - -static const char * -addressbook_config_scope_label (AddressbookLDAPScopeType scope) -{ - switch (scope) { - case ADDRESSBOOK_LDAP_SCOPE_BASE: - return _("Base"); - case ADDRESSBOOK_LDAP_SCOPE_ONELEVEL: - return _("One"); - case ADDRESSBOOK_LDAP_SCOPE_SUBTREE: - return _("Subtree"); - default: - g_assert (0); - return _("Unknown scope type"); - } -} - -static void -addressbook_source_edit_changed (GtkWidget *item, AddressbookSourceDialog *dialog) -{ - char *data; - gboolean complete = TRUE; - AddressbookSourcePageItem *source_page = dialog->source_page; - - if (source_page == NULL) - complete = FALSE; - - if (complete) { - data = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (dialog->name), 0, -1); - if (!data || !*data) - complete = FALSE; - g_free (data); - } - - if (complete) { - if (source_page->source_type == ADDRESSBOOK_SOURCE_FILE) { - if (complete) { - data = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (source_page->path), 0, -1); - if (!data || !*data) - complete = FALSE; - g_free (data); - } - } - else { - if (complete) { - data = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (source_page->host), 0, -1); - if (!data || !*data) - complete = FALSE; - g_free (data); - } - - if (complete) { - data = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (source_page->port), 0, -1); - if (!data || !*data) - complete = FALSE; - /* XXX more validation on port here */ - g_free (data); - } - - if (complete) { - LDAPAuthPageItem *auth_page = source_page->auth; - - if (auth_page->auth_type == ADDRESSBOOK_LDAP_AUTH_SIMPLE) { - data = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (auth_page->binddn), 0, -1); - if (!data || !*data) - complete = FALSE; - g_free (data); - } - else if (auth_page->auth_type == ADDRESSBOOK_LDAP_AUTH_SASL) { - } - data = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (source_page->port), 0, -1); - if (!data || !*data) - complete = FALSE; - /* XXX more validation on port here */ - g_free (data); - } - } - } - - gnome_dialog_set_sensitive (GNOME_DIALOG (dialog->dialog), 0, complete); -} - -static void -source_type_menuitem_activate (GtkWidget *item, gpointer data) -{ - AddressbookSourcePageItem *sitem = data; - - gtk_notebook_set_page (GTK_NOTEBOOK(sitem->dialog->notebook), sitem->pnum); - sitem->dialog->source_page = sitem; - - addressbook_source_edit_changed (item, sitem->dialog); -} - -typedef struct { - AddressbookSourceDialog *dialog; - char *help_text; -} FocusHelpClosure; - -static void -free_focus_help_closure (gpointer data) -{ - FocusHelpClosure *closure = data; - g_free(closure->help_text); - g_free(closure); -} - -static gint -focus_help (GtkWidget *widget, GdkEventFocus *event, FocusHelpClosure *closure) -{ - put_html (GTK_HTML(closure->dialog->html), closure->help_text); - return FALSE; -} - -static GtkWidget * -table_add_elem (AddressbookSourceDialog *dialog, GtkWidget *table, - int row, - const char *label_text, - const char *help_text) -{ - GtkWidget *label, *entry; - FocusHelpClosure *focus_closure; - - label = gtk_label_new (label_text); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, - row, row + 1, GTK_FILL, 0, 0, 0); - gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5); - - entry = gtk_entry_new (); - gtk_table_attach (GTK_TABLE (table), entry, 1, 3, row, row + 1, - GTK_EXPAND | GTK_FILL, 0, 0, 0); - - gtk_signal_connect (GTK_OBJECT (entry), "changed", - GTK_SIGNAL_FUNC (addressbook_source_edit_changed), dialog); - - focus_closure = g_new0 (FocusHelpClosure, 1); - focus_closure->dialog = dialog; - focus_closure->help_text = g_strdup(help_text); - - gtk_signal_connect_full (GTK_OBJECT (entry), - "focus_in_event" /* XXX */, - (GtkSignalFunc) focus_help, NULL, - focus_closure, - (GtkDestroyNotify) free_focus_help_closure, - FALSE, FALSE); - return entry; -} - -static void -ldap_auth_type_menuitem_activate (GtkWidget *item, gpointer data) -{ - LDAPAuthPageItem *auth_item = data; - - gtk_notebook_set_page (GTK_NOTEBOOK(auth_item->page->auth_notebook), auth_item->pnum); - - auth_item->page->auth = auth_item; - - addressbook_source_edit_changed (item, auth_item->dialog); -} - -static LDAPAuthPageItem * -addressbook_ldap_auth_item_new (AddressbookSourceDialog *dialog, - AddressbookSourcePageItem *page, - AddressbookLDAPAuthType type) -{ - LDAPAuthPageItem *item = g_new0 (LDAPAuthPageItem, 1); - GtkWidget *table = NULL; - int row = 0; - - item->pnum = type; - item->auth_type = type; - item->dialog = dialog; - item->page = page; - item->vbox = gtk_vbox_new (FALSE, 0); - - switch (type) { - case ADDRESSBOOK_LDAP_AUTH_NONE: - break; - case ADDRESSBOOK_LDAP_AUTH_SIMPLE: - table = gtk_table_new (2, 2, FALSE); - item->binddn = table_add_elem (dialog, table, row++, - _("Bind DN:"), - _("FIXME Bind DN Help text here")); - - item->remember_passwd = gtk_check_button_new_with_label (_("Remember this password")); - - gtk_table_attach (GTK_TABLE (table), item->remember_passwd, 1, 2, - row, row + 1, GTK_FILL, 0, 0, 0); - - gtk_box_pack_start (GTK_BOX (item->vbox), table, - TRUE, TRUE, 0); - break; - case ADDRESSBOOK_LDAP_AUTH_SASL: - break; - default: - g_assert (0); - return item; - } - - if (table) { - gtk_table_set_row_spacings (GTK_TABLE (table), 2); - gtk_table_set_col_spacings (GTK_TABLE (table), 10); - gtk_container_set_border_width (GTK_CONTAINER (table), 8); - } - - gtk_widget_show_all (item->vbox); - - return item; -} - -static AddressbookSourcePageItem * -addressbook_source_item_new (AddressbookSourceDialog *dialog, AddressbookSourceType type) -{ - AddressbookSourcePageItem *item = g_new0 (AddressbookSourcePageItem, 1); - GtkWidget *table = NULL; - int row = 0; - - item->pnum = type; - item->source_type = type; - item->dialog = dialog; - - item->vbox = gtk_vbox_new (FALSE, 0); - - switch (type) { - case ADDRESSBOOK_SOURCE_LDAP: { - GtkWidget *label; - GtkWidget *menu; - int i; - LDAPAuthPageItem *first_item = NULL; - int position; - - table = gtk_table_new (5, 2, FALSE); - - item->host = table_add_elem (dialog, table, row++, - _("Host:"), - _("FIXME Host help text here.")); - item->port = table_add_elem (dialog, table, row++, - _("Port:"), - _("FIXME Port help text here.")); - gtk_editable_insert_text (GTK_EDITABLE (item->port), "389", 3, &position); - - item->rootdn = table_add_elem (dialog, table, row++, - _("Root DN:"), - _("FIXME Root DN help text here.")); - - item->scope_optionmenu = gtk_option_menu_new (); - menu = gtk_menu_new (); - - for (i = 0; i < ADDRESSBOOK_LDAP_SCOPE_LAST; i ++) { - GtkWidget *scope_item = gtk_menu_item_new_with_label (addressbook_config_scope_label (i)); - - gtk_signal_connect (GTK_OBJECT (scope_item), "activate", - GTK_SIGNAL_FUNC (addressbook_source_edit_changed), - dialog); - - gtk_menu_append (GTK_MENU (menu), scope_item); - gtk_widget_show (scope_item); - } - - gtk_option_menu_set_menu (GTK_OPTION_MENU (item->scope_optionmenu), menu); - // ldap_auth_type_menuitem_activate (first_item->item, first_item); - gtk_option_menu_set_history (GTK_OPTION_MENU(item->scope_optionmenu), 0); - - label = gtk_label_new (_("Search Scope:")); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, - row, row + 1, GTK_FILL, 0, 0, 0); - gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5); - - gtk_table_attach (GTK_TABLE (table), - item->scope_optionmenu, - 1, 2, row, row + 1, - GTK_EXPAND | GTK_FILL, 0, - 0, 0); - - row++; - - gtk_box_pack_start (GTK_BOX (item->vbox), table, - TRUE, FALSE, 0); - - item->auth_optionmenu = gtk_option_menu_new (); - menu = gtk_menu_new (); - - item->auth_notebook = gtk_notebook_new(); - gtk_notebook_set_show_tabs (GTK_NOTEBOOK (item->auth_notebook), FALSE); - - for (i = 0; i < ADDRESSBOOK_LDAP_AUTH_LAST; i++) { - LDAPAuthPageItem *auth_item; - -#ifndef LDAP_SASL - /* skip the sasl stuff if we're not configured for it. */ - if (i == ADDRESSBOOK_LDAP_AUTH_SASL) - continue; -#endif - auth_item = addressbook_ldap_auth_item_new (dialog, item, i); - - item->auths = g_list_append (item->auths, auth_item); - - if (!first_item) - first_item = auth_item; - - auth_item->item = gtk_menu_item_new_with_label (addressbook_config_auth_label (i)); - - gtk_notebook_append_page (GTK_NOTEBOOK (item->auth_notebook), - auth_item->vbox, NULL); - - gtk_signal_connect (GTK_OBJECT (auth_item->item), "activate", - GTK_SIGNAL_FUNC (ldap_auth_type_menuitem_activate), - auth_item); - - gtk_menu_append (GTK_MENU (menu), auth_item->item); - gtk_widget_show (auth_item->item); - } - - gtk_option_menu_set_menu (GTK_OPTION_MENU (item->auth_optionmenu), menu); - ldap_auth_type_menuitem_activate (first_item->item, first_item); - gtk_option_menu_set_history (GTK_OPTION_MENU(item->auth_optionmenu), 0); - - label = gtk_label_new (_("Authentication:")); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, - row, row + 1, GTK_FILL, 0, 0, 0); - gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5); - - gtk_table_attach (GTK_TABLE (table), - item->auth_optionmenu, - 1, 2, row, row + 1, - GTK_EXPAND | GTK_FILL, 0, - 0, 0); - - gtk_box_pack_start (GTK_BOX (item->vbox), item->auth_notebook, - TRUE, TRUE, 0); - break; - } - case ADDRESSBOOK_SOURCE_FILE: { - table = gtk_table_new (2, 2, FALSE); - item->path = table_add_elem (dialog, table, row++, - _("Path:"), - _("FIXME Path Help text here")); - - gtk_box_pack_start (GTK_BOX (item->vbox), table, - TRUE, TRUE, 0); - - item->creat = gtk_check_button_new_with_label (_("Create path if it doesn't exist.")); - gtk_table_attach (GTK_TABLE (table), item->creat, 1, 2, - row, row + 1, GTK_FILL, 0, 0, 0); - break; - } - default: - g_assert(0); - return item; - } - - gtk_table_set_row_spacings (GTK_TABLE (table), 2); - gtk_table_set_col_spacings (GTK_TABLE (table), 10); - gtk_container_set_border_width (GTK_CONTAINER (table), 8); - - gtk_widget_show_all (item->vbox); - - return item; -} - -static void -addressbook_source_dialog_set_source (AddressbookSourceDialog *dialog, AddressbookSource *source) -{ - AddressbookSourcePageItem *source_page; - - e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->name), source->name); - e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->description), source->description); - - /* choose the correct server page */ - source_page = g_list_nth_data (dialog->source_pages, source->type); - source_type_menuitem_activate (source_page->item, source_page); - gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->source_option), source->type); - - if (source->type == ADDRESSBOOK_SOURCE_LDAP) { - LDAPAuthPageItem *auth_page; - - e_utf8_gtk_entry_set_text (GTK_ENTRY (source_page->host), source->ldap.host); - e_utf8_gtk_entry_set_text (GTK_ENTRY (source_page->port), source->ldap.port); - e_utf8_gtk_entry_set_text (GTK_ENTRY (source_page->rootdn), source->ldap.rootdn); - - gtk_option_menu_set_history (GTK_OPTION_MENU(source_page->scope_optionmenu), source->ldap.scope); - - auth_page = g_list_nth_data (source_page->auths, source->ldap.auth); - ldap_auth_type_menuitem_activate (auth_page->item, auth_page); - gtk_option_menu_set_history (GTK_OPTION_MENU(source_page->auth_optionmenu), auth_page->auth_type); - - if (auth_page->auth_type == ADDRESSBOOK_LDAP_AUTH_SIMPLE) { - e_utf8_gtk_entry_set_text (GTK_ENTRY (auth_page->binddn), source->ldap.binddn); - } - } - else { - e_utf8_gtk_entry_set_text (GTK_ENTRY (source_page->path), source->file.path); - } -} - -static AddressbookSource * -addressbook_source_dialog_get_source (AddressbookSourceDialog *dialog) -{ - AddressbookSource *source = g_new0 (AddressbookSource, 1); - AddressbookSourcePageItem *source_page; - - source_page = dialog->source_page; - - source->name = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->name)); - source->description = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->description)); - source->type = source_page->source_type; - - if (source->type == ADDRESSBOOK_SOURCE_FILE) { - source->file.path = e_utf8_gtk_entry_get_text (GTK_ENTRY (source_page->path)); - } - else { - LDAPAuthPageItem *auth_page; - - source->ldap.host = e_utf8_gtk_entry_get_text (GTK_ENTRY (source_page->host)); - source->ldap.port = e_utf8_gtk_entry_get_text (GTK_ENTRY (source_page->port)); - source->ldap.rootdn = e_utf8_gtk_entry_get_text (GTK_ENTRY (source_page->rootdn)); - - auth_page = source_page->auth; - - source->ldap.auth = auth_page->auth_type; - if (source->ldap.auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE) { - source->ldap.binddn = e_utf8_gtk_entry_get_text (GTK_ENTRY (auth_page->binddn)); - source->ldap.remember_passwd = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (auth_page->remember_passwd)); - } - - ldap_auth_type_menuitem_activate (auth_page->item, auth_page); - gtk_option_menu_set_history (GTK_OPTION_MENU(source_page->auth_optionmenu), auth_page->auth_type); - } - - addressbook_storage_init_source_uri (source); - - return source; -} - -static void -addressbook_source_dialog_ok_clicked (GtkWidget *widget, AddressbookSourceDialog *dialog) -{ - dialog->source = addressbook_source_dialog_get_source (dialog); -} - -static void -addressbook_source_dialog_destroy (AddressbookSourceDialog *dialog) -{ - GList *s; - - for (s = dialog->source_pages; s; s = s->next) { - AddressbookSourcePageItem *source_item = s->data; - - g_list_foreach (source_item->auths, (GFunc)g_free, NULL); - g_list_free (source_item->auths); - g_free (source_item); - } - - g_list_free (dialog->source_pages); - - if (dialog->source) - addressbook_source_free (dialog->source); - g_free (dialog); -} - -static AddressbookSourceDialog* -addressbook_source_dialog (AddressbookSource *source, GtkWidget *parent) -{ - GtkWidget *table; - AddressbookSourceDialog *dialog = g_new0 (AddressbookSourceDialog, 1); - GtkWidget *vbox, *dialog_vbox; -#ifdef INCLUDE_FILE_SOURCE - GtkWidget *menu; - AddressbookSourcePageItem *first_item = NULL; -#endif - GtkWidget *area; - int i; - int row = 0; - - if (source) - dialog->dialog = gnome_dialog_new (_("Edit Addressbook"), NULL); - else - dialog->dialog = gnome_dialog_new (_("Add Addressbook"), NULL); - - gtk_window_set_modal (GTK_WINDOW (dialog->dialog), TRUE); - gtk_window_set_policy (GTK_WINDOW (dialog->dialog), - FALSE, TRUE, FALSE); - gtk_window_set_default_size (GTK_WINDOW (dialog->dialog), 300, 350); - gnome_dialog_set_parent (GNOME_DIALOG (dialog->dialog), - GTK_WINDOW (parent)); - - dialog->vbox = gtk_vbox_new (FALSE, 5); - dialog_vbox = GNOME_DIALOG (dialog->dialog)->vbox; - - vbox = gtk_vbox_new (FALSE, 0); - - dialog->html = html_new (FALSE); - put_html (GTK_HTML (dialog->html), - _("Select the kind of addressbook you have, and enter " - "the relevant information about it.")); - - table = gtk_table_new (2, 2, FALSE); - - dialog->name = table_add_elem (dialog, table, row++, - _("Name:"), - _("FIXME Name help text here")); - dialog->description = table_add_elem (dialog, table, row++, - _("Description:"), - _("FIXME Description help text here")); - - gtk_table_set_row_spacings (GTK_TABLE (table), 2); - gtk_table_set_col_spacings (GTK_TABLE (table), 10); - gtk_container_set_border_width (GTK_CONTAINER (table), 8); - - dialog->notebook = gtk_notebook_new(); - gtk_notebook_set_show_tabs (GTK_NOTEBOOK (dialog->notebook), FALSE); - -#ifdef INCLUDE_FILE_SOURCE - dialog->source_option = gtk_option_menu_new (); - menu = gtk_menu_new (); -#endif - - for (i = -#ifndef INCLUDE_FILE_SOURCE - ADDRESSBOOK_SOURCE_LDAP; -#else - ADDRESSBOOK_SOURCE_FILE; -#endif - i < ADDRESSBOOK_SOURCE_LAST; - i ++) { - AddressbookSourcePageItem *item; - - item = addressbook_source_item_new (dialog, i); - - dialog->source_pages = g_list_append (dialog->source_pages, item); - -#ifdef INCLUDE_FILE_SOURCE - item->item = gtk_menu_item_new_with_label (addressbook_config_source_label (i)); - - if (!first_item) - first_item = item; -#endif - - gtk_notebook_append_page (GTK_NOTEBOOK (dialog->notebook), - item->vbox, NULL); - - gtk_signal_connect (GTK_OBJECT (item->item), "activate", - GTK_SIGNAL_FUNC (source_type_menuitem_activate), - item); - -#ifdef INCLUDE_FILE_SOURCE - gtk_menu_append (GTK_MENU (menu), item->item); -#endif - gtk_widget_show (item->item); - } - -#ifdef INCLUDE_FILE_SOURCE - gtk_option_menu_set_menu (GTK_OPTION_MENU (dialog->source_option), menu); - source_type_menuitem_activate (first_item->item, first_item); - gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->source_option), 0); -#endif - - gtk_box_pack_start (GTK_BOX (vbox), dialog->html->parent, - FALSE, TRUE, 0); - - gtk_box_pack_start (GTK_BOX (vbox), table, - FALSE, FALSE, 0); - -#ifdef INCLUDE_FILE_SOURCE - gtk_box_pack_start (GTK_BOX (vbox), dialog->source_option, - FALSE, FALSE, 0); -#endif - - gtk_box_pack_start (GTK_BOX (dialog->vbox), vbox, FALSE, TRUE, 0); - - gtk_box_pack_start (GTK_BOX (dialog->vbox), dialog->notebook, - TRUE, TRUE, 0); - - /* hook our ui into the gnome-dialog */ - gtk_box_pack_start (GTK_BOX (dialog_vbox), dialog->vbox, TRUE, TRUE, 0); - - gtk_widget_show_all (dialog->vbox); - - /* Buttons */ - area = GNOME_DIALOG (dialog->dialog)->action_area; - gtk_widget_show (area); - gtk_button_box_set_layout (GTK_BUTTON_BOX (area), GTK_BUTTONBOX_END); - gtk_button_box_set_spacing (GTK_BUTTON_BOX (area), 8); - - gnome_dialog_append_button (GNOME_DIALOG (dialog->dialog), - GNOME_STOCK_BUTTON_OK); - gnome_dialog_append_button (GNOME_DIALOG (dialog->dialog), - GNOME_STOCK_BUTTON_CANCEL); - - gnome_dialog_set_default (GNOME_DIALOG (dialog->dialog), 0); - - /* fill in source info if there is some */ - if (source) - addressbook_source_dialog_set_source (dialog, source); - - gnome_dialog_set_sensitive (GNOME_DIALOG (dialog->dialog), 0, FALSE); - - gnome_dialog_button_connect( GNOME_DIALOG (dialog->dialog), 0, - GTK_SIGNAL_FUNC (addressbook_source_dialog_ok_clicked), - dialog); - - return dialog; -} - -static AddressbookSourceDialog * -addressbook_config_source (AddressbookSource *source, GtkWidget *parent) -{ - AddressbookSourceDialog* dialog = addressbook_source_dialog (source, parent); - - dialog->id = gnome_dialog_run_and_close (GNOME_DIALOG (dialog->dialog)); - - return dialog; -} - - - -typedef struct { - GladeXML *gui; - GNOME_Evolution_Shell shell; - GtkWidget *dialog; - GtkWidget *clistSources; - GtkWidget *addSource; - GtkWidget *editSource; - GtkWidget *deleteSource; - gint source_row; -} AddressbookDialog; - -static void -update_sensitivity (AddressbookDialog *dialog) -{ - gboolean sensitive = dialog->source_row != -1; - - gtk_widget_set_sensitive (dialog->editSource, sensitive); - gtk_widget_set_sensitive (dialog->deleteSource, sensitive); -} - -static void -add_source_clicked (GtkWidget *widget, AddressbookDialog *dialog) -{ - AddressbookSourceDialog *sdialog; - - sdialog = addressbook_config_source (NULL, dialog->dialog); - if (sdialog->id == 0) { - /* Ok was clicked */ - AddressbookSource *source = addressbook_source_copy(sdialog->source); - gint row; - gchar *text[2]; - - text[0] = source->name; - text[1] = source->uri; - - row = e_utf8_gtk_clist_append (GTK_CLIST(dialog->clistSources), text); - gtk_clist_set_row_data_full (GTK_CLIST(dialog->clistSources), row, source, (GtkDestroyNotify) addressbook_source_free); - gnome_property_box_changed (GNOME_PROPERTY_BOX (dialog->dialog)); - update_sensitivity (dialog); - } - - addressbook_source_dialog_destroy (sdialog); -} - -static void -edit_source_clicked (GtkWidget *widget, AddressbookDialog *dialog) -{ - AddressbookSource *source; - AddressbookSourceDialog *sdialog; - - source = gtk_clist_get_row_data (GTK_CLIST (dialog->clistSources), dialog->source_row); - - sdialog = addressbook_config_source (source, dialog->dialog); - if (sdialog->id == 0) { - /* Ok was clicked */ - source = addressbook_source_copy(sdialog->source); - - e_utf8_gtk_clist_set_text (GTK_CLIST (dialog->clistSources), dialog->source_row, 0, source->name); - e_utf8_gtk_clist_set_text (GTK_CLIST (dialog->clistSources), dialog->source_row, 1, source->uri); - gtk_clist_set_row_data (GTK_CLIST (dialog->clistSources), dialog->source_row, source); - gnome_property_box_changed (GNOME_PROPERTY_BOX (dialog->dialog)); - update_sensitivity (dialog); - } - - addressbook_source_dialog_destroy (sdialog); -} - -static void -delete_source_clicked (GtkWidget *widget, AddressbookDialog *dialog) -{ - gtk_clist_remove (GTK_CLIST (dialog->clistSources), dialog->source_row); - dialog->source_row = -1; - gnome_property_box_changed (GNOME_PROPERTY_BOX(dialog->dialog)); - update_sensitivity (dialog); -} - -static void -sources_select_row (GtkWidget *widget, gint row, gint column, - GdkEventButton *event, AddressbookDialog *dialog) -{ - dialog->source_row = row; - - update_sensitivity (dialog); -} - -static void -addressbook_dialog_apply (GnomePropertyBox *property_box, gint page_num, AddressbookDialog *dialog) -{ - int i; - - if (page_num != -1) - return; - - addressbook_storage_clear_sources(); - - for (i = 0; i < GTK_CLIST(dialog->clistSources)->rows; i ++) { - AddressbookSource *source = (AddressbookSource*)gtk_clist_get_row_data (GTK_CLIST (dialog->clistSources), i); - addressbook_storage_add_source (addressbook_source_copy (source)); - } -} - -static void -addressbook_dialog_close (GnomePropertyBox *property_box, AddressbookDialog *dialog) -{ - gtk_object_unref (GTK_OBJECT (dialog->gui)); - g_free (dialog); -} - -void -addressbook_config (GNOME_Evolution_Shell shell) -{ - AddressbookDialog *dialog; - GladeXML *gui; - GtkWidget *clist; - GList *l; - - dialog = g_new0 (AddressbookDialog, 1); - - dialog->source_row = -1; - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/addressbook-config.glade", NULL); - dialog->gui = gui; - dialog->shell = shell; - - dialog->dialog = glade_xml_get_widget (gui, "dialog"); - - clist = glade_xml_get_widget (gui, "clistSources"); - dialog->clistSources = clist; - - gtk_clist_column_titles_passive (GTK_CLIST (clist)); - gtk_clist_set_column_width (GTK_CLIST (clist), 0, 80); - - dialog->addSource = glade_xml_get_widget (gui, "addSource"); - gtk_signal_connect (GTK_OBJECT(dialog->addSource), "clicked", - GTK_SIGNAL_FUNC (add_source_clicked), - dialog); - - dialog->editSource = glade_xml_get_widget (gui, "editSource"); - gtk_signal_connect (GTK_OBJECT(dialog->editSource), "clicked", - GTK_SIGNAL_FUNC (edit_source_clicked), - dialog); - - dialog->deleteSource = glade_xml_get_widget (gui, "deleteSource"); - gtk_signal_connect (GTK_OBJECT(dialog->deleteSource), "clicked", - GTK_SIGNAL_FUNC (delete_source_clicked), - dialog); - - update_sensitivity (dialog); - - l = addressbook_storage_get_sources (); - for (; l != NULL; l = l->next) { - AddressbookSource *source; - gint row; - gchar *text[2]; - - source = addressbook_source_copy ((AddressbookSource*)l->data); - - text[0] = source->name; - text[1] = source->uri; - - row = e_utf8_gtk_clist_append (GTK_CLIST(clist), text); - gtk_clist_set_row_data_full (GTK_CLIST(clist), row, source, (GtkDestroyNotify) addressbook_source_free); - } - - gtk_signal_connect (GTK_OBJECT (clist), "select_row", - GTK_SIGNAL_FUNC (sources_select_row), - dialog); - - gtk_signal_connect (GTK_OBJECT (dialog->dialog), "apply", - addressbook_dialog_apply, dialog); - - gtk_signal_connect (GTK_OBJECT (dialog->dialog), "destroy", - addressbook_dialog_close, dialog); - - gtk_window_set_default_size (GTK_WINDOW (dialog->dialog), 300, 350); - - gtk_widget_show (dialog->dialog); -} diff --git a/addressbook/gui/component/addressbook-config.glade b/addressbook/gui/component/addressbook-config.glade deleted file mode 100644 index 9194a27c5d..0000000000 --- a/addressbook/gui/component/addressbook-config.glade +++ /dev/null @@ -1,158 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> -</project> - -<widget> - <class>GnomePropertyBox</class> - <name>dialog</name> - <width>460</width> - <height>360</height> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>False</allow_grow> - <auto_shrink>False</auto_shrink> - - <widget> - <class>GtkNotebook</class> - <child_name>GnomePropertyBox:notebook</child_name> - <name>notebook1</name> - <can_focus>True</can_focus> - <show_tabs>True</show_tabs> - <show_border>True</show_border> - <tab_pos>GTK_POS_TOP</tab_pos> - <scrollable>False</scrollable> - <tab_hborder>2</tab_hborder> - <tab_vborder>2</tab_vborder> - <popup_enable>False</popup_enable> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHBox</class> - <name>hbox2</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow1</name> - <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> - <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> - <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> - <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkCList</class> - <name>clistSources</name> - <can_focus>True</can_focus> - <columns>2</columns> - <column_widths>80,80</column_widths> - <selection_mode>GTK_SELECTION_SINGLE</selection_mode> - <show_titles>True</show_titles> - <shadow_type>GTK_SHADOW_IN</shadow_type> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>label10</name> - <label>Name</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>label11</name> - <label>URI</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - </widget> - - <widget> - <class>GtkVButtonBox</class> - <name>vbuttonbox2</name> - <layout_style>GTK_BUTTONBOX_START</layout_style> - <spacing>10</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkButton</class> - <name>addSource</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label>Add</label> - <relief>GTK_RELIEF_NORMAL</relief> - </widget> - - <widget> - <class>GtkButton</class> - <name>editSource</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label>Edit</label> - <relief>GTK_RELIEF_NORMAL</relief> - </widget> - - <widget> - <class>GtkButton</class> - <name>deleteSource</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label>Delete</label> - <relief>GTK_RELIEF_NORMAL</relief> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>label8</name> - <label>Addressbook Sources</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/addressbook/gui/component/addressbook-config.h b/addressbook/gui/component/addressbook-config.h deleted file mode 100644 index 51fe555f00..0000000000 --- a/addressbook/gui/component/addressbook-config.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* addressbook-storage.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * 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_CONFIG_H__ -#define __ADDRESSBOOK_CONFIG_H__ - -#include "addressbook-storage.h" - -void addressbook_config (GNOME_Evolution_Shell shell); - -#endif /* __ADDRESSBOOK_CONFIG_H__ */ diff --git a/addressbook/gui/component/addressbook-factory.c b/addressbook/gui/component/addressbook-factory.c deleted file mode 100644 index ebfd0d9cfd..0000000000 --- a/addressbook/gui/component/addressbook-factory.c +++ /dev/null @@ -1,73 +0,0 @@ -/** - * sample-control-factory.c - * - * Copyright 1999, Helix Code, Inc. - * - * Author: - * Nat Friedman (nat@nat.org) - * - */ - -#include <config.h> -#include <gnome.h> -#include <bonobo.h> -#include <liboaf/liboaf.h> -#include <glade/glade.h> -#include <gal/widgets/e-cursors.h> -#include <unicode.h> - -#include "addressbook.h" -#include "addressbook-component.h" -#include "addressbook/gui/widgets/e-minicard-control.h" -#include "select-names/e-select-names-factory.h" - - -static void -init_corba (int *argc, char **argv) -{ - gnome_init_with_popt_table ("evolution-addressbook", "0.0", - *argc, argv, oaf_popt_options, 0, NULL); - - oaf_init (*argc, argv); -} - -static void -init_bonobo (int argc, char **argv) -{ - if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) - g_error (_("Could not initialize Bonobo")); - - glade_gnome_init (); -} - -int -main (int argc, char **argv) -{ - bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); - textdomain (PACKAGE); - - init_corba (&argc, argv); - - - init_bonobo (argc, argv); - - /* FIXME: Messy names here. This file should be `main.c'. `addressbook.c' should - be `addressbook-control-factory.c' and the functions should be called - `addressbook_control_factory_something()'. And `addressbook-component.c' - should be `addressbook-component-factory.c'. */ - - addressbook_factory_init (); - addressbook_component_factory_init (); - - e_select_names_factory_init (); - - e_minicard_control_factory_init (); - - e_cursors_init(); - - unicode_init(); - - bonobo_main (); - - return 0; -} diff --git a/addressbook/gui/component/addressbook-storage.c b/addressbook/gui/component/addressbook-storage.c deleted file mode 100644 index df11a38cbe..0000000000 --- a/addressbook/gui/component/addressbook-storage.c +++ /dev/null @@ -1,535 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-ldap-storage.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * 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 ldap server file goes like this: - - <?xml version="1.0"?> - <addressbooks> - <contactserver> - <name>LDAP Server</name> - <description>This is my company address book.</description> - <host>ldap.server.com</host> - <port>389</port> - <rootdn></rootdn> - <authmethod>simple</authmethod> - <binddn>cn=Chris Toshok,dc=helixcode,dc=com</binddn> - <rememberpass/> - </contactserver> - <contactfile> - <name>On Disk Contacts</name> - <description>This is one of my private contact dbs.</description> - <path>/home/toshok/contacts/work-contacts.db</path> - </contactfile> - </addressbooks> - - FIXME: Do we want to use a namespace for this? - FIXME: Do we want to have an internationalized description? - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo.h> - -#include "evolution-shell-component.h" -#include "evolution-storage.h" - -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> - -#include "addressbook-storage.h" - -#include <gal/util/e-util.h> -#include <gal/util/e-xml-utils.h> - -#include <sys/types.h> -#include <sys/fcntl.h> -#include <sys/stat.h> -#include <errno.h> - -#define ADDRESSBOOK_SOURCES_XML "addressbook-sources.xml" - -static gboolean load_source_data (EvolutionStorage *storage, const char *file_path); -static gboolean save_source_data (const char *file_path); - -GList *sources; -EvolutionStorage *storage; -static char *storage_path; - -void -addressbook_storage_setup (EvolutionShellComponent *shell_component, - const char *evolution_homedir) -{ - EvolutionShellClient *shell_client; - GNOME_Evolution_Shell corba_shell; - - shell_client = evolution_shell_component_get_owner (shell_component); - if (shell_client == CORBA_OBJECT_NIL) { - g_warning ("We have no shell!?"); - return; - } - - corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)); - - storage = evolution_storage_new (_("Other Contacts"), NULL, NULL); - if (evolution_storage_register_on_shell (storage, corba_shell) != EVOLUTION_STORAGE_OK) { - g_warning ("Cannot register storage"); - return; - } - - sources = NULL; - - gtk_object_set_data (GTK_OBJECT (shell_component), "e-storage", storage); - - if (storage_path) - g_free (storage_path); - storage_path = g_strdup_printf ("%s/" ADDRESSBOOK_SOURCES_XML, evolution_homedir); - load_source_data (storage, storage_path); -} - -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 char * -ldap_unparse_auth (AddressbookLDAPAuthType auth_type) -{ - switch (auth_type) { - case ADDRESSBOOK_LDAP_AUTH_NONE: - return "none"; - case ADDRESSBOOK_LDAP_AUTH_SIMPLE: - return "simple"; - case ADDRESSBOOK_LDAP_AUTH_SASL: - return "sasl"; - default: - g_assert(0); - return "none"; - } -} - -static AddressbookLDAPAuthType -ldap_parse_auth (const char *auth) -{ - if (!auth) - return ADDRESSBOOK_LDAP_AUTH_NONE; - - if (!strcmp (auth, "simple")) - return ADDRESSBOOK_LDAP_AUTH_SIMPLE; - else if (!strcmp (auth, "sasl")) - return ADDRESSBOOK_LDAP_AUTH_SASL; - else - return ADDRESSBOOK_LDAP_AUTH_NONE; -} - -static char * -ldap_unparse_scope (AddressbookLDAPScopeType scope_type) -{ - switch (scope_type) { - case ADDRESSBOOK_LDAP_SCOPE_BASE: - return "base"; - case ADDRESSBOOK_LDAP_SCOPE_ONELEVEL: - return "one"; - case ADDRESSBOOK_LDAP_SCOPE_SUBTREE: - return "sub"; - default: - g_assert(0); - return ""; - } -} - -static 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; -} - -void -addressbook_storage_init_source_uri (AddressbookSource *source) -{ - if (source->uri) - g_free (source->uri); - - if (source->type == ADDRESSBOOK_SOURCE_LDAP) - source->uri = g_strdup_printf ("ldap://%s:%s/%s??%s", - source->ldap.host, source->ldap.port, - source->ldap.rootdn, ldap_unparse_scope(source->ldap.scope)); - else - source->uri = g_strdup_printf ("file://%s", - source->file.path); -} - -static gboolean -load_source_data (EvolutionStorage *storage, - const char *file_path) -{ - xmlDoc *doc; - xmlNode *root; - xmlNode *child; - - tryagain: - doc = xmlParseFile (file_path); - if (doc == NULL) { - /* check to see if a ldapserver.xml.new file is - there. if it is, rename it and run with 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 (0 > rv) { - g_error ("Failed to rename %s: %s\n", - ADDRESSBOOK_SOURCES_XML, - strerror(errno)); - return FALSE; - } - else { - goto tryagain; - } - } - - g_free (new_path); - return TRUE; - } - - root = xmlDocGetRootElement (doc); - if (root == NULL || strcmp (root->name, "addressbooks") != 0) { - xmlFreeDoc (doc); - return FALSE; - } - - for (child = root->childs; child; child = child->next) { - char *path; - AddressbookSource *source; - - source = g_new0 (AddressbookSource, 1); - - if (!strcmp (child->name, "contactserver")) { - source->type = ADDRESSBOOK_SOURCE_LDAP; - source->ldap.port = get_string_value (child, "port"); - source->ldap.host = get_string_value (child, "host"); - source->ldap.rootdn = get_string_value (child, "rootdn"); - source->ldap.scope = ldap_parse_scope (get_string_value (child, "scope")); - source->ldap.auth = ldap_parse_auth (get_string_value (child, "authmethod")); - source->ldap.binddn = get_string_value (child, "binddn"); - } - else if (!strcmp (child->name, "contactfile")) { - source->type = ADDRESSBOOK_SOURCE_FILE; - source->file.path = get_string_value (child, "path"); - } - 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", source->uri, - source->description, FALSE); - - sources = g_list_append (sources, source); - - g_free (path); - } - - xmlFreeDoc (doc); - - return TRUE; -} - -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->ldap.port); - xmlNewChild (source_root, NULL, (xmlChar *) "host", - (xmlChar *) source->ldap.host); - xmlNewChild (source_root, NULL, (xmlChar *) "rootdn", - (xmlChar *) source->ldap.rootdn); - xmlNewChild (source_root, NULL, (xmlChar *) "scope", - (xmlChar *) ldap_unparse_scope(source->ldap.scope)); - xmlNewChild (source_root, NULL, (xmlChar *) "authmethod", - (xmlChar *) ldap_unparse_auth(source->ldap.auth)); - if (source->ldap.auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE) { - xmlNewChild (source_root, NULL, (xmlChar *) "binddn", - (xmlChar *) source->ldap.binddn); - if (source->ldap.remember_passwd) - xmlNewChild (source_root, NULL, (xmlChar *) "rememberpass", - NULL); - } -} - -static void -file_source_foreach (AddressbookSource *source, xmlNode *root) -{ - xmlNode *source_root = xmlNewNode (NULL, - (xmlChar *) "contactfile"); - - 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 *) "path", - (xmlChar *) source->file.path); -} - -static void -source_foreach(gpointer value, gpointer user_data) -{ - AddressbookSource *source = value; - xmlNode *root = user_data; - - if (source->type == ADDRESSBOOK_SOURCE_LDAP) - ldap_source_foreach(source, root); - else - file_source_foreach(source, root); -} - -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, 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", ADDRESSBOOK_SOURCES_XML); - return FALSE; - } - - rv = write (fd, buf, buf_size); - xmlFree (buf); - close (fd); - - if (0 > rv) { - g_error ("Failed to write new %s: %s\n", ADDRESSBOOK_SOURCES_XML, strerror(errno)); - unlink (new_path); - return FALSE; - } - else { - if (0 > rename (new_path, file_path)) { - g_error ("Failed to rename %s: %s\n", ADDRESSBOOK_SOURCES_XML, 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 */ - path = g_strdup_printf ("/%s", source->name); - evolution_storage_new_folder (storage, path, source->name, "contacts", - source->uri, source->description, FALSE); - - g_free (path); - - save_source_data (storage_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); - - g_free (path); - - save_source_data (storage_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); - if (source->type == ADDRESSBOOK_SOURCE_LDAP) { - g_free (source->ldap.host); - g_free (source->ldap.port); - g_free (source->ldap.rootdn); - } - else { - g_free (source->file.path); - } - - 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 () -{ - g_list_foreach (sources, (GFunc)addressbook_source_foreach, NULL); - g_list_free (sources); - sources = NULL; -} - -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->type = source->type; - copy->uri = g_strdup (source->uri); - - if (copy->type == ADDRESSBOOK_SOURCE_LDAP) { - copy->ldap.host = g_strdup (source->ldap.host); - copy->ldap.port = g_strdup (source->ldap.port); - copy->ldap.rootdn = g_strdup (source->ldap.rootdn); - copy->ldap.scope = source->ldap.scope; - copy->ldap.auth = source->ldap.auth; - copy->ldap.binddn = source->ldap.binddn; - copy->ldap.remember_passwd = source->ldap.remember_passwd; - } - else { - copy->file.path = g_strdup (source->file.path); - } - return copy; -} diff --git a/addressbook/gui/component/addressbook-storage.h b/addressbook/gui/component/addressbook-storage.h deleted file mode 100644 index 518977598e..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 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * 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" - -typedef enum { - ADDRESSBOOK_SOURCE_FILE, - ADDRESSBOOK_SOURCE_LDAP, - ADDRESSBOOK_SOURCE_LAST -} AddressbookSourceType; - -typedef enum { - ADDRESSBOOK_LDAP_AUTH_NONE, - ADDRESSBOOK_LDAP_AUTH_SIMPLE, - ADDRESSBOOK_LDAP_AUTH_SASL, /* XXX currently unsupported */ - ADDRESSBOOK_LDAP_AUTH_LAST -} AddressbookLDAPAuthType; - -typedef enum { - ADDRESSBOOK_LDAP_SCOPE_SUBTREE, - ADDRESSBOOK_LDAP_SCOPE_BASE, - ADDRESSBOOK_LDAP_SCOPE_ONELEVEL, - ADDRESSBOOK_LDAP_SCOPE_LAST -} AddressbookLDAPScopeType; - -typedef struct { - AddressbookSourceType type; - char *name; - char *description; - struct { - char *path; - } file; - struct { - char *host; - char *port; - char *rootdn; - AddressbookLDAPScopeType scope; - AddressbookLDAPAuthType auth; - char *binddn; /* used in AUTH_SIMPLE */ - gboolean remember_passwd; - } ldap; - char *uri; /* filled in from the above */ -} AddressbookSource; - -void addressbook_storage_setup (EvolutionShellComponent *shell_component, - const char *evolution_homedir); - -GList *addressbook_storage_get_sources (void); -AddressbookSource *addressbook_storage_get_source_by_uri (const char *uri); -void addressbook_storage_clear_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); - -#endif /* __ADDRESSBOOK_STORAGE_H__ */ diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c deleted file mode 100644 index 7ada315391..0000000000 --- a/addressbook/gui/component/addressbook.c +++ /dev/null @@ -1,778 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * addressbook.c: - * - * Author: - * Chris Lahey (clahey@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ - -#include <config.h> - -#include <gnome.h> -#include <libgnorba/gnorba.h> -#include <bonobo.h> - -#include "addressbook.h" - -#include <ebook/e-book.h> -#include <gal/util/e-util.h> -#include <gal/widgets/e-unicode.h> -#include "addressbook/gui/search/e-addressbook-search-dialog.h" - -#include "addressbook/gui/widgets/e-addressbook-view.h" -#include <widgets/misc/e-search-bar.h> - -#include <select-names/e-select-names.h> -#include <select-names/e-select-names-manager.h> - -#include "e-contact-editor.h" -#include "e-contact-save-as.h" -#include "addressbook-config.h" - -#include <addressbook/printing/e-contact-print.h> - -#define PROPERTY_FOLDER_URI "folder_uri" - -#define PROPERTY_FOLDER_URI_IDX 1 - -typedef struct { - EAddressbookView *view; - ESearchBar *search; - GtkWidget *vbox; - BonoboControl *control; - BonoboPropertyBag *properties; - char *uri; - char *passwd; -} AddressbookView; - -static void -card_added_cb (EBook* book, EBookStatus status, const char *id, - gpointer user_data) -{ - g_print ("%s: %s(): a card was added\n", __FILE__, __FUNCTION__); -} - -static void -card_modified_cb (EBook* book, EBookStatus status, - gpointer user_data) -{ - g_print ("%s: %s(): a card was modified\n", __FILE__, __FUNCTION__); -} - -/* Callback for the add_card signal from the contact editor */ -static void -add_card_cb (EContactEditor *ce, ECard *card, gpointer data) -{ - EBook *book; - - book = E_BOOK (data); - e_book_add_card (book, card, card_added_cb, NULL); -} - -/* Callback for the commit_card signal from the contact editor */ -static void -commit_card_cb (EContactEditor *ce, ECard *card, gpointer data) -{ - EBook *book; - - book = E_BOOK (data); - e_book_commit_card (book, card, card_modified_cb, NULL); -} - -/* Callback for the delete_card signal from the contact editor */ -static void -delete_card_cb (EContactEditor *ce, ECard *card, gpointer data) -{ - EBook *book; - - book = E_BOOK (data); - e_book_remove_card (book, card, card_modified_cb, NULL); -} - -/* Callback used when the contact editor is closed */ -static void -editor_closed_cb (EContactEditor *ce, gpointer data) -{ - gtk_object_unref (GTK_OBJECT (ce)); -} - -static void -new_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - ECard *card; - EBook *book; - EContactEditor *ce; - AddressbookView *view = (AddressbookView *) user_data; - - card = e_card_new(""); - - gtk_object_get(GTK_OBJECT(view->view), - "book", &book, - NULL); - - g_assert (E_IS_BOOK (book)); - - ce = e_contact_editor_new (card, TRUE); - - gtk_signal_connect (GTK_OBJECT (ce), "add_card", - GTK_SIGNAL_FUNC (add_card_cb), book); - gtk_signal_connect (GTK_OBJECT (ce), "commit_card", - GTK_SIGNAL_FUNC (commit_card_cb), book); - gtk_signal_connect (GTK_OBJECT (ce), "delete_card", - GTK_SIGNAL_FUNC (delete_card_cb), book); - gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", - GTK_SIGNAL_FUNC (editor_closed_cb), NULL); - - gtk_object_sink(GTK_OBJECT(card)); -} - -static void -config_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - addressbook_config (NULL /* XXX */); -} - -static void -search_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - EBook *book; - AddressbookView *view = (AddressbookView *) user_data; - - gtk_object_get(GTK_OBJECT(view->view), - "book", &book, - NULL); - g_assert (E_IS_BOOK (book)); - - gtk_widget_show(e_addressbook_search_dialog_new(book)); -} - -#if 0 -static void -find_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - gint result; - GtkWidget* search_entry = gtk_entry_new(); - gchar* search_text; - AddressbookView *view = (AddressbookView *) user_data; - - GtkWidget* dlg = gnome_dialog_new ("Search Contacts", "Find", - GNOME_STOCK_BUTTON_CANCEL, NULL); - - gtk_object_get (view->view, - "query", &search_text, - NULL); - e_utf8_gtk_entry_set_text(GTK_ENTRY(search_entry), search_text); - g_free (search_text); - - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox), - search_entry, TRUE, TRUE, 0); - - gtk_widget_show_all (dlg); - - gnome_dialog_close_hides (GNOME_DIALOG (dlg), TRUE); - result = gnome_dialog_run_and_close (GNOME_DIALOG (dlg)); - - /* If the user clicks "okay"...*/ - if (result == 0) { - search_text = e_utf8_gtk_entry_get_text(GTK_ENTRY(search_entry)); - gtk_object_set (view->view, - "query", query, - NULL); - g_free (search_text); - } -} -#endif - -static void -delete_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - e_addressbook_view_delete_selection(view->view); -} - -static void -print_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - e_addressbook_view_print(view->view); -} - -static void -show_all_contacts_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - e_addressbook_view_show_all(view->view); -} - -static void -stop_loading_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - e_addressbook_view_stop(view->view); -} - -static void -update_view_type (AddressbookView *view) -{ - BonoboUIComponent *uic = bonobo_control_get_ui_component (view->control); - EAddressbookViewType view_type; - - if (!uic || bonobo_ui_component_get_container (uic) == CORBA_OBJECT_NIL) - return; - - gtk_object_get (GTK_OBJECT (view->view), "type", &view_type, NULL); - - switch (view_type) { - case E_ADDRESSBOOK_VIEW_TABLE: - if (uic) - bonobo_ui_component_set_prop (uic, "/menu/View/AsTable", - "label", _("As _Minicards"), NULL); - - break; - case E_ADDRESSBOOK_VIEW_MINICARD: - if (uic) - bonobo_ui_component_set_prop (uic, "/menu/View/AsTable", - "label", _("As _Table"), NULL); - break; - default: - g_warning ("view_type must be either TABLE or MINICARD\n"); - return; - } -} - -static void -change_view_type (AddressbookView *view, EAddressbookViewType view_type) -{ - gtk_object_set (GTK_OBJECT (view->view), "type", view_type, NULL); - - update_view_type (view); -} - -static void -toggle_view_as_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = user_data; - EAddressbookViewType view_type; - - gtk_object_get (GTK_OBJECT (view->view), "type", &view_type, NULL); - - if (view_type == E_ADDRESSBOOK_VIEW_TABLE) - change_view_type (view, E_ADDRESSBOOK_VIEW_MINICARD); - else - change_view_type (view, E_ADDRESSBOOK_VIEW_TABLE); -} - -BonoboUIVerb verbs [] = { - BONOBO_UI_UNSAFE_VERB ("ContactsPrint", print_cb), - BONOBO_UI_UNSAFE_VERB ("ViewAsTable", toggle_view_as_cb), - BONOBO_UI_UNSAFE_VERB ("ViewNewContact", new_contact_cb), - BONOBO_UI_UNSAFE_VERB ("ToolSearch", search_cb), - - BONOBO_UI_UNSAFE_VERB ("AddressbookConfig", config_cb), - - BONOBO_UI_UNSAFE_VERB ("ContactNew", new_contact_cb), -/* BONOBO_UI_UNSAFE_VERB ("ContactFind", find_contact_cb),*/ - BONOBO_UI_UNSAFE_VERB ("ContactDelete", delete_contact_cb), - BONOBO_UI_UNSAFE_VERB ("ContactViewAll", show_all_contacts_cb), - BONOBO_UI_UNSAFE_VERB ("ContactStop", stop_loading_cb), - - BONOBO_UI_VERB_END -}; - -static void -set_pixmap (BonoboUIComponent *uic, - const char *xml_path, - const char *icon) -{ - char *path; - GdkPixbuf *pixbuf; - - path = g_concat_dir_and_file (EVOLUTION_DATADIR "/images/evolution", icon); - - pixbuf = gdk_pixbuf_new_from_file (path); - g_return_if_fail (pixbuf != NULL); - - bonobo_ui_util_set_pixbuf (uic, xml_path, pixbuf); - - gdk_pixbuf_unref (pixbuf); - - g_free (path); -} - -static void -update_pixmaps (BonoboUIComponent *uic) -{ - set_pixmap (uic, "/menu/File/Print/Print", "16_print.xpm"); /* FIXME it doesn't seem to work */ - set_pixmap (uic, "/menu/Settings/AddressbookConfig", "16_configure_addressbook.xpm"); - - set_pixmap (uic, "/Toolbar/View All", "24_all_contacts.xpm"); - set_pixmap (uic, "/Toolbar/Find", "24_find_contact.xpm"); -} - -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); - bonobo_ui_component_set_container (uic, remote_ui_container); - bonobo_object_release_unref (remote_ui_container, NULL); - - bonobo_ui_component_add_verb_list_with_data ( - uic, verbs, view); - - bonobo_ui_component_freeze (uic, NULL); - - bonobo_ui_util_set_ui (uic, EVOLUTION_DATADIR, - "evolution-addressbook.xml", - "evolution-addressbook"); - - e_addressbook_view_setup_menus (view->view, uic); - - update_view_type (view); - - update_pixmaps (uic); - - bonobo_ui_component_thaw (uic, NULL); -} - -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); - else - bonobo_ui_component_unset_container (uic); -} - -static void -addressbook_view_free(AddressbookView *view) -{ - if (view->properties) - bonobo_object_unref(BONOBO_OBJECT(view->properties)); - g_free(view->passwd); - g_free(view->uri); - g_free(view); -} - -static void -book_auth_cb (EBook *book, EBookStatus status, gpointer closure) -{ - AddressbookView *view = closure; - if (status == E_BOOK_STATUS_SUCCESS) { - gtk_object_set(GTK_OBJECT(view->view), - "book", book, - NULL); - } - else { - /* pop up a nice dialog, or redo the authentication - bit some number of times. */ - } -} - -static void -passwd_cb (gchar *string, gpointer data) -{ - AddressbookView *view = (AddressbookView*)data; - - view->passwd = g_strdup (string); -} - -static void -book_open_cb (EBook *book, EBookStatus status, gpointer closure) -{ - if (status == E_BOOK_STATUS_SUCCESS) { - AddressbookView *view = closure; - AddressbookSource *source; - - /* check if the addressbook needs authentication */ - - source = addressbook_storage_get_source_by_uri (view->uri); - if (source && - source->type == ADDRESSBOOK_SOURCE_LDAP && - source->ldap.auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE) { - int button; - char *msg = g_strdup_printf (_("Enter password for %s"), source->ldap.binddn); - /* give a password prompt for the binddn */ - GtkWidget *dialog = gnome_request_dialog (TRUE, msg, NULL, - 0, passwd_cb, view, NULL); - - button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); - - if (button == 0 && *(view->passwd)) { - e_book_authenticate_user (book, source->ldap.binddn, view->passwd, - book_auth_cb, closure); - memset (view->passwd, 0, strlen (view->passwd)); /* clear out the passwd */ - g_free (view->passwd); - view->passwd = NULL; - return; - } - } - - - /* if they either didn't configure the source to use - authentication, or they canceled the dialog, - proceed without authenticating */ - gtk_object_set(GTK_OBJECT(view->view), - "book", book, - NULL); - - } else { - GtkWidget *warning_dialog, *label, *href; - warning_dialog = gnome_dialog_new ( - _("Unable to open addressbook"), - GNOME_STOCK_BUTTON_CLOSE, - NULL); - - label = gtk_label_new ( - _("We were unable to open this addressbook. This either\n" - "means you have entered an incorrect URI, or have tried\n" - "to access an LDAP server and don't have LDAP support\n" - "compiled in. If you've entered a URI, check the URI for\n" - "correctness and reenter. If not, you probably have\n" - "attempted to access an LDAP server. If you wish to be\n" - "able to use LDAP, you'll need to download and install\n" - "OpenLDAP and recompile and install Evolution.\n")); - gtk_misc_set_alignment(GTK_MISC(label), - 0, .5); - gtk_label_set_justify(GTK_LABEL(label), - GTK_JUSTIFY_LEFT); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (warning_dialog)->vbox), - label, TRUE, TRUE, 0); - gtk_widget_show (label); - - href = gnome_href_new ("http://www.openldap.org/", "OpenLDAP at http://www.openldap.org/"); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (warning_dialog)->vbox), - href, FALSE, FALSE, 0); - gtk_widget_show (href); - - gnome_dialog_run (GNOME_DIALOG (warning_dialog)); - - gtk_object_destroy (GTK_OBJECT (warning_dialog)); - } -} - -static void destroy_callback(GtkWidget *widget, gpointer data) -{ - AddressbookView *view = data; - addressbook_view_free(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); - } -} - -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: - gtk_object_get(GTK_OBJECT(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)); - - if (!strncmp (view->uri, "file:", 5)) { - - if (strlen (view->uri + 7) > 3 - && !strcmp (view->uri + strlen(view->uri) - 3, ".db")) { - /* it's a .db file */ - uri_data = g_strdup (view->uri); - } - else { - char *file_name; - /* we assume it's a dir and glom addressbook.db onto the end. */ - file_name = g_concat_dir_and_file(view->uri + 7, "addressbook.db"); - uri_data = g_strdup_printf("file://%s", file_name); - g_free(file_name); - } - - } - else { - uri_data = g_strdup (view->uri); - } - - if (! e_book_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_SHOW_ALL, - ESB_ADVANCED, -}; - -static ESearchBarItem addressbook_search_menu_items[] = { - { N_("Show All"), ESB_SHOW_ALL }, - { NULL, 0 }, - { N_("Advanced..."), ESB_ADVANCED}, - { NULL, -1 } -}; - -static void -addressbook_menu_activated (ESearchBar *esb, int id, AddressbookView *view) -{ - EBook *book; - switch (id) { - case ESB_SHOW_ALL: - e_addressbook_view_show_all(view->view); - break; - case ESB_ADVANCED: - gtk_object_get(GTK_OBJECT(view->view), - "book", &book, - NULL); - g_assert (E_IS_BOOK (book)); - - gtk_widget_show(e_addressbook_search_dialog_new(book)); - break; - } -} - -enum { - ESB_ANY, - ESB_FULL_NAME, - ESB_EMAIL, -}; - -static ESearchBarItem addressbook_search_option_items[] = { - { N_("Any field contains"), ESB_ANY }, - { N_("Name contains"), ESB_FULL_NAME }, - { N_("Email contains"), ESB_EMAIL }, - { NULL, -1 } -}; - -static void -addressbook_query_changed (ESearchBar *esb, AddressbookView *view) -{ - char *search_word, *search_query; - int search_type; - - gtk_object_get(GTK_OBJECT(esb), - "text", &search_word, - "option_choice", &search_type, - NULL); - - if (search_word && strlen (search_word)) { - switch (search_type) { - case ESB_ANY: - search_query = g_strdup_printf ("(contains \"x-evolution-any-field\" \"%s\")", - search_word); - break; - case ESB_FULL_NAME: - search_query = g_strdup_printf ("(contains \"full_name\" \"%s\")", - search_word); - break; - case ESB_EMAIL: - search_query = g_strdup_printf ("(contains \"email\" \"%s\")", - search_word); - break; - default: - search_query = g_strdup ("(contains \"full_name\" \"\")"); - break; - } - } else - search_query = g_strdup ("(contains \"full_name\" \"\")"); - - gtk_object_set (GTK_OBJECT(view->view), - "query", search_query, - NULL); - - g_free (search_query); - g_free (search_word); -} - -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 = gtk_object_get_data (GTK_OBJECT (control), - "shell_view_interface"); - - if (shell_view_interface) - return shell_view_interface; - - control_frame = bonobo_control_get_control_frame (control); - - 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) - gtk_object_set_data (GTK_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) -{ - 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 (message == NULL || message[0] == 0) { - printf ("clearing message\n"); - GNOME_Evolution_ShellView_unsetMessage (shell_view_interface, &ev); - } - else { - printf ("setting message %s\n", message); - GNOME_Evolution_ShellView_setMessage (shell_view_interface, - message, 0 /* XXX */, &ev); - } - - CORBA_exception_free (&ev); -} - -BonoboControl * -addressbook_factory_new_control (void) -{ - AddressbookView *view; - - view = g_new0 (AddressbookView, 1); - - view->vbox = gtk_vbox_new(FALSE, GNOME_PAD); - - gtk_container_set_border_width(GTK_CONTAINER(view->vbox), GNOME_PAD_SMALL); - - gtk_signal_connect( GTK_OBJECT( view->vbox ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) view ); - - /* Create the control. */ - view->control = bonobo_control_new(view->vbox); - - view->search = E_SEARCH_BAR(e_search_bar_new(addressbook_search_menu_items, - addressbook_search_option_items)); - gtk_box_pack_start (GTK_BOX (view->vbox), GTK_WIDGET (view->search), - FALSE, FALSE, 0); - gtk_signal_connect (GTK_OBJECT (view->search), "query_changed", - GTK_SIGNAL_FUNC (addressbook_query_changed), view); - gtk_signal_connect (GTK_OBJECT (view->search), "menu_activated", - GTK_SIGNAL_FUNC (addressbook_menu_activated), view); - - view->view = E_ADDRESSBOOK_VIEW(e_addressbook_view_new()); - gtk_box_pack_start(GTK_BOX(view->vbox), GTK_WIDGET(view->view), - TRUE, TRUE, 0); - - /* create the initial view */ - change_view_type (view, E_ADDRESSBOOK_VIEW_MINICARD); - - 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, - view->properties); - - gtk_signal_connect (GTK_OBJECT (view->view), - "status_message", - GTK_SIGNAL_FUNC(set_status_message), - view); - - view->uri = NULL; - - gtk_signal_connect (GTK_OBJECT (view->control), "activate", - control_activate_cb, view); - - return view->control; -} - -static BonoboObject * -addressbook_factory (BonoboGenericFactory *Factory, void *closure) -{ - return BONOBO_OBJECT (addressbook_factory_new_control ()); -} - -void -addressbook_factory_init (void) -{ - static BonoboGenericFactory *addressbook_control_factory = NULL; - - if (addressbook_control_factory != NULL) - return; - - addressbook_control_factory = bonobo_generic_factory_new ( - "OAFIID:GNOME_Evolution_Addressbook_ControlFactory", - addressbook_factory, NULL); - - if (addressbook_control_factory == NULL) { - g_error ("I could not register a Addressbook factory."); - } -} diff --git a/addressbook/gui/component/addressbook.h b/addressbook/gui/component/addressbook.h deleted file mode 100644 index 66c5a7e4e6..0000000000 --- a/addressbook/gui/component/addressbook.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __ADDRESSBOOK_H__ -#define __ADDRESSBOOK_H__ - -#include <bonobo/bonobo-control.h> - -BonoboControl *addressbook_factory_new_control (void); -void addressbook_factory_init (void); - -#endif /* __ADDRESSBOOK_H__ */ diff --git a/addressbook/gui/component/e-cardlist-model.c b/addressbook/gui/component/e-cardlist-model.c deleted file mode 100644 index 23b61d58be..0000000000 --- a/addressbook/gui/component/e-cardlist-model.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * - * Author: - * Christopher James Lahey <clahey@helixcode.com> - * - * (C) 1999 Helix Code, Inc. - */ - -#include <config.h> -#include "e-cardlist-model.h" -#include <gnome-xml/tree.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> -#include <gnome.h> - -#define PARENT_TYPE e_table_model_get_type() - -static void -e_cardlist_model_destroy(GtkObject *object) -{ - ECardlistModel *model = E_CARDLIST_MODEL(object); - int i; - - for ( i = 0; i < model->data_count; i++ ) { - gtk_object_unref(GTK_OBJECT(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_card_simple_set(e_cardlist_model->data[row], - col + 1, - val); - gtk_object_get(GTK_OBJECT(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; - 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; - } - } - if (!found) { - gtk_object_ref(GTK_OBJECT(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) ) { - gtk_object_unref(GTK_OBJECT(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 (GtkObjectClass *object_class) -{ - ETableModelClass *model_class = (ETableModelClass *) object_class; - - object_class->destroy = e_cardlist_model_destroy; - - 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 (GtkObject *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; - gtk_object_get(GTK_OBJECT(model->data[row]), - "card", &card, - NULL); - gtk_object_ref(GTK_OBJECT(card)); - return card; - } - return NULL; -} - -GtkType -e_cardlist_model_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "ECardlistModel", - sizeof (ECardlistModel), - sizeof (ECardlistModelClass), - (GtkClassInitFunc) e_cardlist_model_class_init, - (GtkObjectInitFunc) e_cardlist_model_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -ETableModel * -e_cardlist_model_new (void) -{ - ECardlistModel *et; - - et = gtk_type_new (e_cardlist_model_get_type ()); - - 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 0b9a7a2265..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_CARDLIST_MODEL_TYPE (e_cardlist_model_get_type ()) -#define E_CARDLIST_MODEL(o) (GTK_CHECK_CAST ((o), E_CARDLIST_MODEL_TYPE, ECardlistModel)) -#define E_CARDLIST_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CARDLIST_MODEL_TYPE, ECardlistModelClass)) -#define E_IS_CARDLIST_MODEL(o) (GTK_CHECK_TYPE ((o), E_CARDLIST_MODEL_TYPE)) -#define E_IS_CARDLIST_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CARDLIST_MODEL_TYPE)) - -typedef struct { - ETableModel parent; - - /* item specific fields */ - ECardSimple **data; - int data_count; -} ECardlistModel; - - -typedef struct { - ETableModelClass parent_class; -} ECardlistModelClass; - - -GtkType 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/select-names/.cvsignore b/addressbook/gui/component/select-names/.cvsignore deleted file mode 100644 index 1d8db60890..0000000000 --- a/addressbook/gui/component/select-names/.cvsignore +++ /dev/null @@ -1,11 +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 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 c38d714cf4..0000000000 --- a/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * CORBA interface for the SelectNames dialog. - * - * Authors: - * Ettore Perazzoli <ettore@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#include <Bonobo.idl> - -module GNOME { -module Evolution { -module Addressbook { - - interface SelectNames : Bonobo::Unknown { - struct Section { - string id; - string title; - }; - - typedef sequence<Section> SectionList; - - exception DuplicateID {}; - exception SectionNotFound {}; - - void addSection (in string id, in string title) - raises (DuplicateID); - - 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.oaf.in b/addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.oaf.in deleted file mode 100644 index e3719967b0..0000000000 --- a/addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.oaf.in +++ /dev/null @@ -1,29 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_SelectNamesFactory" - type="exe" - location="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/GNOME_Evolution_Addressbook_SelectNames.oafinfo b/addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.oafinfo deleted file mode 100644 index e3719967b0..0000000000 --- a/addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.oafinfo +++ /dev/null @@ -1,29 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_SelectNamesFactory" - type="exe" - location="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 9b9c448873..0000000000 --- a/addressbook/gui/component/select-names/Makefile.am +++ /dev/null @@ -1,74 +0,0 @@ -# CORBA stuff - -IDLS = \ - 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): $(IDLS) - $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \ - $(srcdir)/Evolution-Addressbook-SelectNames.idl - -oafdir = $(datadir)/oaf -oaf_DATA = GNOME_Evolution_Addressbook_SelectNames.oafinfo - -# - -INCLUDES = \ - -DG_LOG_DOMAIN=\"evolution-addressbook\" \ - $(EXTRA_GNOME_CFLAGS) \ - $(GNOME_INCLUDEDIR) \ - -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 \ - $(BONOBO_HTML_GNOME_CFLAGS) \ - -DEVOLUTION_VERSION=\""$(VERSION)"\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ - -DCAMEL_PROVIDERDIR=\""$(providerdir)"\" - -lib_LTLIBRARIES = libeselectnames.la - -libeselectnames_la_SOURCES = \ - $(IDL_GENERATED) \ - e-select-names-bonobo.c \ - e-select-names-bonobo.h \ - e-select-names-factory.c \ - e-select-names-factory.h \ - e-select-names-manager.c \ - e-select-names-manager.h \ - e-select-names-model.c \ - e-select-names-model.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 - -gladedir = $(datadir)/evolution/glade -glade_DATA = select-names.glade - -EXTRA_DIST = \ - $(glade_DATA) \ - select-names.glade.h \ - $(oaf_DATA) \ - $(IDLS) - -BUILT_SOURCES = $(IDL_GENERATED) -CLEANFILES += $(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 87be63c3db..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-bonobo.c +++ /dev/null @@ -1,315 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-select-names-bonobo.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * 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 <gnome.h> - -#include <bonobo/bonobo-property-bag.h> -#include <bonobo/bonobo-control.h> - -#include "Evolution-Addressbook-SelectNames.h" - -#include <gal/util/e-util.h> -#include "e-select-names-manager.h" - -#include "e-select-names-bonobo.h" - - -#define PARENT_TYPE bonobo_object_get_type () -static BonoboObjectClass *parent_class = NULL; - -struct _ESelectNamesBonoboPrivate { - ESelectNamesManager *manager; -}; - -enum _EntryPropertyID { - ENTRY_PROPERTY_ID_TEXT, - 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 *widget; - char *text; - - widget = GTK_WIDGET (user_data); - - switch (arg_id) { - case ENTRY_PROPERTY_ID_TEXT: - gtk_object_get (GTK_OBJECT (widget), "text", &text, NULL); - BONOBO_ARG_SET_STRING (arg, text); - break; - default: - break; - } -} - -static void -entry_set_property_fn (BonoboPropertyBag *bag, - const BonoboArg *arg, - guint arg_id, - CORBA_Environment *ev, - gpointer user_data) -{ - GtkWidget *widget; - const char *text; - - widget = GTK_WIDGET (user_data); - - switch (arg_id) { - case ENTRY_PROPERTY_ID_TEXT: - text = BONOBO_ARG_GET_STRING (arg); - gtk_object_set (GTK_OBJECT (widget), "text", text, NULL); - break; - case ENTRY_PROPERTY_ID_ENTRY_CHANGED: - gtk_object_set_data (GTK_OBJECT (widget), "entry_property_id_changed", GUINT_TO_POINTER (1)); - break; - default: - break; - } -} - - -/* CORBA interface implementation. */ - -static POA_GNOME_Evolution_Addressbook_SelectNames__vepv SelectNames_vepv; - -static POA_GNOME_Evolution_Addressbook_SelectNames * -create_servant (void) -{ - POA_GNOME_Evolution_Addressbook_SelectNames *servant; - CORBA_Environment ev; - - servant = (POA_GNOME_Evolution_Addressbook_SelectNames *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &SelectNames_vepv; - - CORBA_exception_init (&ev); - - POA_GNOME_Evolution_Addressbook_SelectNames__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - return servant; -} - -static void -impl_SelectNames_add_section (PortableServer_Servant servant, - const CORBA_char *id, - const CORBA_char *title, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - ESelectNamesBonobo *select_names; - ESelectNamesBonoboPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - select_names = E_SELECT_NAMES_BONOBO (bonobo_object); - priv = select_names->priv; - - e_select_names_manager_add_section (priv->manager, id, title); -} - -static void -entry_changed (GtkWidget *widget, BonoboControl *control) -{ - gboolean changed = GPOINTER_TO_UINT (gtk_object_get_data (GTK_OBJECT (widget), "entry_property_id_changed")); - - if (!changed) - bonobo_control_set_property (control, "entry_changed", TRUE, NULL); -} - -static Bonobo_Control -impl_SelectNames_get_entry_for_section (PortableServer_Servant servant, - const CORBA_char *section_id, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - ESelectNamesBonobo *select_names; - ESelectNamesBonoboPrivate *priv; - GtkWidget *entry_widget; - BonoboControl *control; - BonoboPropertyBag *property_bag; - - bonobo_object = bonobo_object_from_servant (servant); - select_names = E_SELECT_NAMES_BONOBO (bonobo_object); - 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, "entry_changed", ENTRY_PROPERTY_ID_ENTRY_CHANGED, - BONOBO_ARG_BOOLEAN, NULL, NULL, - BONOBO_PROPERTY_WRITEABLE); - - bonobo_control_set_properties (control, property_bag); - - gtk_signal_connect (GTK_OBJECT (entry_widget), "changed", - GTK_SIGNAL_FUNC (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) -{ - BonoboObject *bonobo_object; - ESelectNamesBonobo *select_names; - ESelectNamesBonoboPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - select_names = E_SELECT_NAMES_BONOBO (bonobo_object); - priv = select_names->priv; - - e_select_names_manager_activate_dialog (priv->manager, section_id); -} - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - ESelectNamesBonobo *select_names; - ESelectNamesBonoboPrivate *priv; - - select_names = E_SELECT_NAMES_BONOBO (object); - priv = select_names->priv; - - gtk_object_unref (GTK_OBJECT (priv->manager)); - - g_free (priv); -} - - -static void -corba_class_init () -{ - POA_GNOME_Evolution_Addressbook_SelectNames__vepv *vepv; - POA_GNOME_Evolution_Addressbook_SelectNames__epv *epv; - PortableServer_ServantBase__epv *base_epv; - - base_epv = g_new0 (PortableServer_ServantBase__epv, 1); - base_epv->_private = NULL; - base_epv->finalize = NULL; - base_epv->default_POA = NULL; - - epv = g_new0 (POA_GNOME_Evolution_Addressbook_SelectNames__epv, 1); - epv->addSection = impl_SelectNames_add_section; - epv->getEntryBySection = impl_SelectNames_get_entry_for_section; - epv->activateDialog = impl_SelectNames_activate_dialog; - - vepv = &SelectNames_vepv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); - vepv->GNOME_Evolution_Addressbook_SelectNames_epv = epv; -} - -static void -class_init (ESelectNamesBonoboClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (klass); - parent_class = gtk_type_class (bonobo_object_get_type ()); - - object_class->destroy = impl_destroy; - - corba_class_init (); -} - -static void -init (ESelectNamesBonobo *select_names) -{ - ESelectNamesBonoboPrivate *priv; - - priv = g_new (ESelectNamesBonoboPrivate, 1); - - priv->manager = e_select_names_manager_new (); - - select_names->priv = priv; -} - - -void -e_select_names_bonobo_construct (ESelectNamesBonobo *select_names, - GNOME_Evolution_Addressbook_SelectNames corba_object) -{ - g_return_if_fail (select_names != NULL); - g_return_if_fail (E_IS_SELECT_NAMES_BONOBO (select_names)); - - bonobo_object_construct (BONOBO_OBJECT (select_names), corba_object); -} - -ESelectNamesBonobo * -e_select_names_bonobo_new (void) -{ - POA_GNOME_Evolution_Addressbook_SelectNames *servant; - GNOME_Evolution_Addressbook_SelectNames corba_object; - ESelectNamesBonobo *select_names; - - servant = create_servant (); - if (servant == NULL) - return NULL; - - select_names = gtk_type_new (e_select_names_bonobo_get_type ()); - - corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (select_names), servant); - e_select_names_bonobo_construct (select_names, corba_object); - - return select_names; -} - - -E_MAKE_TYPE (e_select_names_bonobo, "ESelectNamesBonobo", ESelectNamesBonobo, class_init, init, PARENT_TYPE) 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 87fbfa0fab..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-bonobo.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-select-names-bonobo.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * 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__ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#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) (GTK_CHECK_CAST ((obj), E_TYPE_SELECT_NAMES_BONOBO, ESelectNamesBonobo)) -#define E_SELECT_NAMES_BONOBO_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_BONOBO, ESelectNamesBonoboClass)) -#define E_IS_SELECT_NAMES_BONOBO(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SELECT_NAMES_BONOBO)) -#define E_IS_SELECT_NAMES_BONOBO_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), 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; -}; - - -GtkType e_select_names_bonobo_get_type (void); -void e_select_names_bonobo_construct (ESelectNamesBonobo *select_names, - GNOME_Evolution_Addressbook_SelectNames corba_object); -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-factory.c b/addressbook/gui/component/select-names/e-select-names-factory.c deleted file mode 100644 index 1b97172f9e..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-factory.c +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-select-names-factory.c - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * 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.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, - 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 f65d5aaa9e..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-factory.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-select-names-factory.h - * - * Copyright (C) 2000 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * 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 3af59611ab..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-manager.c +++ /dev/null @@ -1,363 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#include <config.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <gtk/gtk.h> - -#include "e-select-names-manager.h" -#include "e-select-names-model.h" -#include "e-select-names-text-model.h" -#include "e-select-names.h" -#include <gal/e-text/e-entry.h> - -/* Object argument IDs */ -enum { - ARG_0, - ARG_CARD, -}; - - -typedef struct { - char *id; - char *title; - ESelectNamesModel *model; -} ESelectNamesManagerSection; - -typedef struct { - char *id; - EEntry *entry; -} 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_destroy (GtkObject *object); -static void e_select_names_manager_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_select_names_manager_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - -/** - * 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. - **/ -GtkType -e_select_names_manager_get_type (void) -{ - static GtkType manager_type = 0; - - if (!manager_type) { - GtkTypeInfo manager_info = { - "ESelectNamesManager", - sizeof (ESelectNamesManager), - sizeof (ESelectNamesManagerClass), - (GtkClassInitFunc) e_select_names_manager_class_init, - (GtkObjectInitFunc) e_select_names_manager_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - manager_type = gtk_type_unique (gtk_object_get_type (), &manager_info); - } - - return manager_type; -} - -/** - * 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 = E_SELECT_NAMES_MANAGER(gtk_type_new(e_select_names_manager_get_type())); - return manager; -} - -static void -e_select_names_manager_class_init (ESelectNamesManagerClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS(klass); - - gtk_object_add_arg_type ("ESelectNamesManager::card", - GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CARD); - - object_class->destroy = e_select_names_manager_destroy; - object_class->get_arg = e_select_names_manager_get_arg; - object_class->set_arg = e_select_names_manager_set_arg; -} - -/* - * ESelectNamesManager lifecycle management and vcard loading/saving. - */ - -static void -e_select_names_manager_destroy (GtkObject *object) -{ - ESelectNamesManager *manager; - - manager = E_SELECT_NAMES_MANAGER (object); - - gtk_object_unref(GTK_OBJECT(manager->sections)); - gtk_object_unref(GTK_OBJECT(manager->entries)); -} - - -/* Set_arg handler for the manager */ -static void -e_select_names_manager_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ESelectNamesManager *manager; - - manager = E_SELECT_NAMES_MANAGER (object); - - switch (arg_id) { - case ARG_CARD: - break; - default: - return; - } -} - -/* Get_arg handler for the manager */ -static void -e_select_names_manager_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ESelectNamesManager *manager; - - manager = E_SELECT_NAMES_MANAGER (object); - - switch (arg_id) { - case ARG_CARD: - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void * -section_copy(const void *sec, void *data) -{ - const ESelectNamesManagerSection *section = sec; - ESelectNamesManagerSection *newsec; - - newsec = g_new(ESelectNamesManagerSection, 1); - newsec->id = g_strdup(section->id); - newsec->title = g_strdup(section->title); - newsec->model = section->model; - if (newsec->model) - gtk_object_ref(GTK_OBJECT(newsec->model)); - return newsec; -} - -static void -section_free(void *sec, void *data) -{ - ESelectNamesManagerSection *section = sec; - g_free(section->id); - g_free(section->title); - if (section->model) - gtk_object_unref(GTK_OBJECT(section->model)); - g_free(section); -} - -static void * -entry_copy(const void *ent, void *data) -{ - const ESelectNamesManagerEntry *entry = ent; - ESelectNamesManagerEntry *newent; - - newent = g_new(ESelectNamesManagerEntry, 1); - newent->id = g_strdup(entry->id); - newent->entry = entry->entry; - if (newent->entry) - gtk_object_ref(GTK_OBJECT(newent->entry)); - return newent; -} - -static void -entry_free(void *ent, void *data) -{ - ESelectNamesManagerEntry *entry = ent; - g_free(entry->id); - if (entry->entry) - gtk_object_unref(GTK_OBJECT(entry->entry)); - g_free(entry); -} - -/** - * e_select_names_manager_init: - */ -static void -e_select_names_manager_init (ESelectNamesManager *manager) -{ - manager->sections = e_list_new(section_copy, section_free, manager); - manager->entries = e_list_new(entry_copy, entry_free, manager); -} - -void e_select_names_manager_add_section (ESelectNamesManager *manager, - const char *id, - const char *title) -{ - ESelectNamesManagerSection *section; - - section = g_new(ESelectNamesManagerSection, 1); - section->id = g_strdup(id); - section->title = g_strdup(title); - section->model = e_select_names_model_new(); - e_list_append(manager->sections, section); - section_free(section, manager); -} - -static void -entry_destroyed(EEntry *entry, ESelectNamesManager *manager) -{ - if(!GTK_OBJECT_DESTROYED(manager)) { - EIterator *iterator = e_list_get_iterator(manager->entries); - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - const ESelectNamesManagerEntry *this_entry = e_iterator_get(iterator); - if(entry == this_entry->entry) { - e_iterator_delete(iterator); - break; - } - } - } - gtk_object_unref(GTK_OBJECT(manager)); -} - -GtkWidget *e_select_names_manager_create_entry (ESelectNamesManager *manager, - const char *id) -{ - ETextModel *model; - EIterator *iterator; - iterator = e_list_get_iterator(manager->sections); - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - const ESelectNamesManagerSection *section = e_iterator_get(iterator); - if (!strcmp(section->id, id)) { - ESelectNamesManagerEntry *entry; - EEntry *eentry; - eentry = E_ENTRY(e_entry_new()); - - entry = g_new(ESelectNamesManagerEntry, 1); - entry->entry = eentry; - entry->id = (char *)id; - model = e_select_names_text_model_new(section->model); - e_list_append(manager->entries, entry); - g_free(entry); - - gtk_object_set(GTK_OBJECT(eentry), - "model", model, - "editable", TRUE, - "use_ellipsis", TRUE, - "allow_newlines", FALSE, - NULL); - gtk_signal_connect(GTK_OBJECT(eentry), "destroy", - GTK_SIGNAL_FUNC(entry_destroyed), manager); - gtk_object_ref(GTK_OBJECT(manager)); - return GTK_WIDGET(eentry); - } - } - return NULL; -} - -static void -e_select_names_clicked(ESelectNames *dialog, gint button, ESelectNamesManager *manager) -{ - switch(button) { - case 0: { - EList *list = manager->sections; - EIterator *iterator = e_list_get_iterator(list); - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - ESelectNamesManagerSection *section = (void *) e_iterator_get(iterator); - ESelectNamesModel *source = e_select_names_get_source(dialog, section->id); - if (section->model) - gtk_object_unref(GTK_OBJECT(section->model)); - section->model = source; - /* Don't ref because get_source returns a conceptual ref_count of 1. */ - } - gtk_object_unref(GTK_OBJECT(iterator)); - - list = manager->entries; - iterator = e_list_get_iterator(list); - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - ESelectNamesManagerEntry *entry = (void *) e_iterator_get(iterator); - ESelectNamesModel *source = e_select_names_get_source(dialog, entry->id); - if (source) { - ETextModel *model = e_select_names_text_model_new(source); - if (model) { - gtk_object_set(GTK_OBJECT(entry->entry), - "model", model, - NULL); - gtk_object_unref(GTK_OBJECT(source)); - } - gtk_object_unref(GTK_OBJECT(model)); - } - } - gtk_object_unref(GTK_OBJECT(iterator)); - break; - } - } - gnome_dialog_close(GNOME_DIALOG(dialog)); -} - -void e_select_names_manager_activate_dialog (ESelectNamesManager *manager, - const char *id) -{ - EIterator *iterator; - - 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 { - manager->names = E_SELECT_NAMES (e_select_names_new ()); - - iterator = e_list_get_iterator(manager->sections); - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - const ESelectNamesManagerSection *section = e_iterator_get(iterator); - ESelectNamesModel *newmodel = e_select_names_model_duplicate(section->model); - e_select_names_add_section(manager->names, section->id, section->title, newmodel); - gtk_object_unref(GTK_OBJECT(newmodel)); - } - e_select_names_set_default(manager->names, id); - gtk_signal_connect(GTK_OBJECT(manager->names), "clicked", - GTK_SIGNAL_FUNC(e_select_names_clicked), manager); - gtk_signal_connect(GTK_OBJECT(manager->names), "destroy", - GTK_SIGNAL_FUNC(gtk_widget_destroyed), - &manager->names); - gtk_widget_show(GTK_WIDGET(manager->names)); - } -} - -/* Of type ECard */ -EList *e_select_names_manager_get_cards (ESelectNamesManager *manager, - const char *id) -{ - EIterator *iterator; - iterator = e_list_get_iterator(manager->sections); - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - const ESelectNamesManagerSection *section = e_iterator_get(iterator); - if (!strcmp(section->id, id)) { - return e_select_names_model_get_cards(section->model); - } - } - return NULL; -} 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 13cddaac7d..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-manager.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#ifndef __E_SELECT_NAMES_MANAGER_H__ -#define __E_SELECT_NAMES_MANAGER_H__ - -#include <time.h> -#include <gtk/gtk.h> -#include <stdio.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) (GTK_CHECK_CAST ((obj), E_TYPE_SELECT_NAMES_MANAGER, ESelectNamesManager)) -#define E_SELECT_NAMES_MANAGER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_MANAGER, ESelectNamesManagerClass)) -#define E_IS_SELECT_NAMES_MANAGER(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SELECT_NAMES_MANAGER)) -#define E_IS_SELECT_NAMES_MANAGER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_MANAGER)) - -typedef struct _ESelectNamesManager ESelectNamesManager; -typedef struct _ESelectNamesManagerClass ESelectNamesManagerClass; - -struct _ESelectNamesManager { - GtkObject object; - - EList *sections; - EList *entries; - - ESelectNames *names; -}; - -struct _ESelectNamesManagerClass { - GtkObjectClass parent_class; -}; - -ESelectNamesManager *e_select_names_manager_new (void); -void e_select_names_manager_add_section (ESelectNamesManager *manager, - const char *id, - const char *title); -GtkWidget *e_select_names_manager_create_entry (ESelectNamesManager *manager, - const char *id); -void e_select_names_manager_activate_dialog (ESelectNamesManager *manager, - const char *id); - -/* Of type ECard */ -EList *e_select_names_manager_get_cards (ESelectNamesManager *manager, - const char *id); - -/* Standard Gtk function */ -GtkType e_select_names_manager_get_type (void); - -#endif /* ! __E_SELECT_NAMES_MANAGER_H__ */ 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 0bbbe588a6..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-model.c +++ /dev/null @@ -1,441 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#include <config.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <gtk/gtk.h> - -#include "e-select-names-model.h" -#include <gal/util/e-util.h> -#include "addressbook/backend/ebook/e-card-simple.h" - -enum { - E_SELECT_NAMES_MODEL_CHANGED, - 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, -}; - -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_destroy (GtkObject *object); -static void e_select_names_model_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_select_names_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - -/** - * e_select_names_model_get_type: - * @void: - * - * Registers the &ESelectNamesModel class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &ESelectNamesModel class. - **/ -GtkType -e_select_names_model_get_type (void) -{ - static GtkType model_type = 0; - - if (!model_type) { - GtkTypeInfo model_info = { - "ESelectNamesModel", - sizeof (ESelectNamesModel), - sizeof (ESelectNamesModelClass), - (GtkClassInitFunc) e_select_names_model_class_init, - (GtkObjectInitFunc) e_select_names_model_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - model_type = gtk_type_unique (gtk_object_get_type (), &model_info); - } - - return model_type; -} - -/** - * e_select_names_model_new: - * @VCard: a string in vCard format - * - * Returns: a new #ESelectNamesModel that wraps the @VCard. - */ -ESelectNamesModel * -e_select_names_model_new (void) -{ - ESelectNamesModel *model = E_SELECT_NAMES_MODEL(gtk_type_new(e_select_names_model_get_type())); - return model; -} - -/** - * e_select_names_model_new: - * @VCard: a string in vCard format - * - * Returns: a new #ESelectNamesModel that wraps the @VCard. - */ -ESelectNamesModel * -e_select_names_model_duplicate (ESelectNamesModel *old) -{ - ESelectNamesModel *model = E_SELECT_NAMES_MODEL(gtk_type_new(e_select_names_model_get_type())); - model->data = e_list_duplicate(old->data); - model->id = g_strdup(old->id); - model->title = g_strdup(old->title); - return model; -} - -static void -e_select_names_model_class_init (ESelectNamesModelClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS(klass); - - e_select_names_model_signals[E_SELECT_NAMES_MODEL_CHANGED] = - gtk_signal_new ("changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ESelectNamesModelClass, changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, e_select_names_model_signals, E_SELECT_NAMES_MODEL_LAST_SIGNAL); - - gtk_object_add_arg_type ("ESelectNamesModel::card", - GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CARD); - - klass->changed = NULL; - - object_class->destroy = e_select_names_model_destroy; - object_class->get_arg = e_select_names_model_get_arg; - object_class->set_arg = e_select_names_model_set_arg; -} - -/* - * ESelectNamesModel lifecycle management and vcard loading/saving. - */ - -static void -e_select_names_model_destroy (GtkObject *object) -{ - ESelectNamesModel *model; - - model = E_SELECT_NAMES_MODEL (object); - - gtk_object_unref(GTK_OBJECT(model->data)); -} - - -/* Set_arg handler for the model */ -static void -e_select_names_model_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ESelectNamesModel *model; - - model = E_SELECT_NAMES_MODEL (object); - - switch (arg_id) { - case ARG_CARD: - break; - default: - return; - } -} - -/* Get_arg handler for the model */ -static void -e_select_names_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ESelectNamesModel *model; - - model = E_SELECT_NAMES_MODEL (object); - - switch (arg_id) { - case ARG_CARD: - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void * -data_copy(const void *sec, void *data) -{ - const ESelectNamesModelData *section = sec; - ESelectNamesModelData *newsec; - - newsec = g_new(ESelectNamesModelData, 1); - newsec->type = section->type; - newsec->card = section->card; - if (newsec->card) - gtk_object_ref(GTK_OBJECT(newsec->card)); - newsec->string = g_strdup(section->string); - return newsec; -} - -static void -data_free(void *sec, void *data) -{ - ESelectNamesModelData *section = sec; - if (section->card) - gtk_object_unref(GTK_OBJECT(section->card)); - g_free(section->string); - g_free(section); -} - -/** - * e_select_names_model_init: - */ -static void -e_select_names_model_init (ESelectNamesModel *model) -{ - model->data = e_list_new(data_copy, data_free, model); -} - -static void * -copy_func(const void *data, void *user_data) -{ - GtkObject *object = (void *) data; - if (object) - gtk_object_ref(object); - return object; -} - -static void -free_func(void *data, void *user_data) -{ - GtkObject *object = data; - if (object) - gtk_object_unref(object); -} - -/* Of type ECard */ -EList *e_select_names_model_get_cards (ESelectNamesModel *model) -{ - EList *list = e_list_new(copy_func, free_func, NULL); - EIterator *iterator = e_list_get_iterator(model->data); - EIterator *new_iterator = e_list_get_iterator(list); - - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - ESelectNamesModelData *node = (void *) e_iterator_get(iterator); - ECard *card; - ECardSimple *simple; - if (node->card) { - card = node->card; - gtk_object_ref(GTK_OBJECT(card)); - } else { - card = e_card_new(""); - } - simple = e_card_simple_new(card); - e_card_simple_set_arbitrary(simple, "text_version", "string", node->string); - e_iterator_insert(new_iterator, card, FALSE); - gtk_object_unref(GTK_OBJECT(card)); - gtk_object_unref(GTK_OBJECT(simple)); - } - return list; -} - -EList *e_select_names_model_get_data (ESelectNamesModel *model) -{ - return model->data; -} - -static void -e_select_names_model_changed (ESelectNamesModel *model) -{ - gtk_signal_emit(GTK_OBJECT(model), - e_select_names_model_signals[E_SELECT_NAMES_MODEL_CHANGED]); -} - -void -e_select_names_model_insert (ESelectNamesModel *model, - EIterator *iterator, /* Must be one of the iterators in the model, or NULL if the list is empty. */ - int index, - char *data) -{ - gchar **strings = e_strsplit(data, ",", -1); - int i; - if (iterator == NULL) { - ESelectNamesModelData new = {E_SELECT_NAMES_MODEL_DATA_TYPE_STRING_ADDRESS, NULL, ""}; - - e_list_append(model->data, &new); - iterator = e_list_get_iterator(model->data); - - index = 0; - } else { - gtk_object_ref(GTK_OBJECT(iterator)); - } - if (strings[0]) { - ESelectNamesModelData *node = (void *) e_iterator_get(iterator); - gchar *temp = g_strdup_printf("%.*s%s%s", index, node->string, strings[0], node->string + index); - g_free(node->string); - node->string = temp; - index += strlen(strings[0]); - - for (i = 1; strings[i]; i++) { - ESelectNamesModelData *node = (void *) e_iterator_get(iterator); - gchar *temp = g_strdup_printf("%.*s", index, node->string); - gchar *temp2 = g_strdup_printf("%s%s", strings[i], node->string + index); - - g_free(node->string); - node->type = E_SELECT_NAMES_MODEL_DATA_TYPE_STRING_ADDRESS; - node->string = temp; - if (node->card) - gtk_object_unref(GTK_OBJECT(node->card)); - node->card = NULL; - - node = g_new(ESelectNamesModelData, 1); - node->type = E_SELECT_NAMES_MODEL_DATA_TYPE_STRING_ADDRESS; - node->card = NULL; - node->string = temp2; - e_iterator_insert(iterator, node, 0); - index = strlen(strings[i]); - g_free(node->string); - g_free(node); - } - } - e_select_names_model_changed(model); - gtk_object_unref(GTK_OBJECT(iterator)); -} - -void -e_select_names_model_insert_length (ESelectNamesModel *model, - EIterator *iterator, /* Must be one of the iterators in the model. */ - int index, - char *data, - int length) -{ - gchar *string = g_new(char, length + 1); - strncpy(string, data, length); - string[length] = 0; - e_select_names_model_insert(model, iterator, index, string); - g_free(string); -} - -void -e_select_names_model_delete (ESelectNamesModel *model, - EIterator *iterator, /* Must be one of the iterators in the model. */ - int index, - int length) -{ - while (length > 0 && e_iterator_is_valid(iterator)) { - ESelectNamesModelData *node = (void *) e_iterator_get(iterator); - int this_length = strlen(node->string); - if (this_length <= index + length) { - gchar *temp = g_strdup_printf("%.*s", index, node->string); - g_free(node->string); - node->string = temp; - length -= this_length - index; - } else { - gchar *temp = g_strdup_printf("%.*s%s", index, node->string, node->string + index + length); - g_free(node->string); - node->string = temp; - break; - } - - if (length > 0) { - e_iterator_next(iterator); - if (e_iterator_is_valid(iterator)) { - ESelectNamesModelData *node2 = (void *) e_iterator_get(iterator); - gchar *temp = g_strdup_printf("%s%s", node->string, node2->string); - g_free(node2->string); - node2->string = temp; - e_iterator_prev(iterator); - e_iterator_delete(iterator); - length --; - } - } - } - e_select_names_model_changed(model); -} - -void -e_select_names_model_replace (ESelectNamesModel *model, - EIterator *iterator, /* Must be one of the iterators in the model. */ - int index, - int length, - char *data) -{ - if (iterator == NULL) { - ESelectNamesModelData new = {E_SELECT_NAMES_MODEL_DATA_TYPE_STRING_ADDRESS, NULL, ""}; - - e_list_append(model->data, &new); - iterator = e_list_get_iterator(model->data); - - index = 0; - } else { - gtk_object_ref(GTK_OBJECT(iterator)); - } - while (length > 0 && e_iterator_is_valid(iterator)) { - ESelectNamesModelData *node = (void *) e_iterator_get(iterator); - int this_length = strlen(node->string); - if (this_length <= index + length) { - gchar *temp = g_strdup_printf("%.*s", index, node->string); - g_free(node->string); - node->string = temp; - length -= this_length - index; - } else { - gchar *temp = g_strdup_printf("%.*s%s", index, node->string, node->string + index + length); - g_free(node->string); - node->string = temp; - length = 0; - } - - if (length > 0) { - e_iterator_next(iterator); - if (e_iterator_is_valid(iterator)) { - ESelectNamesModelData *node2 = (void *) e_iterator_get(iterator); - gchar *temp = g_strdup_printf("%s%s", node->string, node2->string); - g_free(node2->string); - node2->string = temp; - e_iterator_prev(iterator); - e_iterator_delete(iterator); - } - } - } - if (!e_iterator_is_valid(iterator)) { - ESelectNamesModelData *node; - e_iterator_last(iterator); - if (e_iterator_is_valid(iterator)) { - node = (void *) e_iterator_get(iterator); - index = strlen(node->string); - } else - index = 0; - } - e_select_names_model_insert (model, iterator, index, data); - gtk_object_unref(GTK_OBJECT(iterator)); -} - - -void -e_select_names_model_add_item (ESelectNamesModel *model, - EIterator *iterator, /* NULL for at the beginning. */ - ESelectNamesModelData *data) -{ - e_iterator_insert(iterator, data, FALSE); - e_select_names_model_changed(model); -} - -void -e_select_names_model_remove_item (ESelectNamesModel *model, - EIterator *iterator) -{ - e_iterator_delete(iterator); - 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 4ea1bdc8db..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-model.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#ifndef __E_SELECT_NAMES_MODEL_H__ -#define __E_SELECT_NAMES_MODEL_H__ - -#include <time.h> -#include <gtk/gtk.h> -#include <stdio.h> -#include <e-util/e-list.h> -#include <addressbook/backend/ebook/e-card.h> - -#define E_TYPE_SELECT_NAMES_MODEL (e_select_names_model_get_type ()) -#define E_SELECT_NAMES_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SELECT_NAMES_MODEL, ESelectNamesModel)) -#define E_SELECT_NAMES_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_MODEL, ESelectNamesModelClass)) -#define E_IS_SELECT_NAMES_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SELECT_NAMES_MODEL)) -#define E_IS_SELECT_NAMES_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_MODEL)) - -typedef enum _ESelectNamesModelDataType ESelectNamesModelDataType; -typedef struct _ESelectNamesModelData ESelectNamesModelData; -typedef struct _ESelectNamesModel ESelectNamesModel; -typedef struct _ESelectNamesModelClass ESelectNamesModelClass; - -enum _ESelectNamesModelDataType { - E_SELECT_NAMES_MODEL_DATA_TYPE_CARD, - E_SELECT_NAMES_MODEL_DATA_TYPE_STRING_ADDRESS, -}; - -struct _ESelectNamesModelData { - ESelectNamesModelDataType type; - ECard *card; - char *string; -}; - -struct _ESelectNamesModel { - GtkObject object; - - char *id; - char *title; - - EList *data; /* Of type ESelectNamesModelData. */ -}; - -struct _ESelectNamesModelClass { - GtkObjectClass parent_class; - - void (*changed) (ESelectNamesModel *model); -}; - -ESelectNamesModel *e_select_names_model_new (void); -ESelectNamesModel *e_select_names_model_duplicate (ESelectNamesModel *old); - -/* These lengths are allowed to go over objects and act just like the text model does. */ -void e_select_names_model_insert (ESelectNamesModel *model, - EIterator *iterator, /* Must be one of the iterators in the model. */ - int index, - char *data); -void e_select_names_model_insert_length (ESelectNamesModel *model, - EIterator *iterator, /* Must be one of the iterators in the model. */ - int index, - char *data, - int length); -void e_select_names_model_delete (ESelectNamesModel *model, - EIterator *iterator, /* Must be one of the iterators in the model. */ - int index, - int length); -void e_select_names_model_replace (ESelectNamesModel *model, - EIterator *iterator, /* Must be one of the iterators in the model. */ - int index, - int replacement_length, - char *data); - -void e_select_names_model_add_item (ESelectNamesModel *model, - EIterator *iterator, /* NULL for at the beginning. */ - ESelectNamesModelData *data); -void e_select_names_model_remove_item (ESelectNamesModel *model, - EIterator *iterator); - -/* Of type ECard */ -EList *e_select_names_model_get_cards (ESelectNamesModel *model); - -/* Of type ESelectNamesModelData */ -EList *e_select_names_model_get_data (ESelectNamesModel *model); - -/* Standard Gtk function */ -GtkType e_select_names_model_get_type (void); - -#endif /* ! __E_SELECT_NAMES_MODEL_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 37abcddc70..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-table-model.c +++ /dev/null @@ -1,353 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#include <config.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <gtk/gtk.h> - -#include <gal/util/e-util.h> -#include "e-select-names-table-model.h" -#include "addressbook/backend/ebook/e-card-simple.h" - -/* Object argument IDs */ -enum { - ARG_0, - ARG_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_destroy (GtkObject *object); -static void e_select_names_table_model_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_select_names_table_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - -static void e_select_names_table_model_model_changed (ESelectNamesModel *source, - ESelectNamesTableModel *model); - - -static void -e_select_names_table_model_add_source (ESelectNamesTableModel *model, - ESelectNamesModel *source) -{ - model->source = source; - if (model->source) - gtk_object_ref(GTK_OBJECT(model->source)); - model->source_changed_id = gtk_signal_connect(GTK_OBJECT(model->source), "changed", - GTK_SIGNAL_FUNC(e_select_names_table_model_model_changed), - model); -} - -static void -e_select_names_table_model_drop_source (ESelectNamesTableModel *model) -{ - if (model->source_changed_id) - gtk_signal_disconnect(GTK_OBJECT(model->source), model->source_changed_id); - if (model->source) - gtk_object_unref(GTK_OBJECT(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. - **/ -GtkType -e_select_names_table_model_get_type (void) -{ - static GtkType model_type = 0; - - if (!model_type) { - GtkTypeInfo model_info = { - "ESelectNamesTableModel", - sizeof (ESelectNamesTableModel), - sizeof (ESelectNamesTableModelClass), - (GtkClassInitFunc) e_select_names_table_model_class_init, - (GtkObjectInitFunc) e_select_names_table_model_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - model_type = gtk_type_unique (e_table_model_get_type (), &model_info); - } - - return model_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 = E_TABLE_MODEL(gtk_type_new(e_select_names_table_model_get_type())); - gtk_object_set(GTK_OBJECT(model), - "source", source, - NULL); - return model; -} - -static void -fill_in_info (ESelectNamesTableModel *model) -{ - if (model->source) { - EList *list = e_select_names_model_get_data(model->source); - EIterator *iterator = e_list_get_iterator(list); - int count = 0; - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - count ++; - } - model->count = count; - model->data = g_new(ESelectNamesTableModelData, count); - count = 0; - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - const ESelectNamesModelData *data = e_iterator_get(iterator); - switch (data->type) { - case E_SELECT_NAMES_MODEL_DATA_TYPE_CARD: { - ECardSimple *simple = e_card_simple_new(data->card); - model->data[count].name = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_FULL_NAME); - if ((model->data[count].name == 0) || *model->data[count].name == 0) { - model->data[count].name = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_ORG); - } - if (model->data[count].name == 0) - model->data[count].name = g_strdup(""); - model->data[count].email = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_EMAIL); - if (model->data[count].email == 0) - model->data[count].email = g_strdup(""); - gtk_object_unref(GTK_OBJECT(simple)); - count ++; - break; - } - case E_SELECT_NAMES_MODEL_DATA_TYPE_STRING_ADDRESS: - model->data[count].name = e_strdup_strip(data->string); - model->data[count].email = e_strdup_strip(data->string); - count ++; - break; - } - } - } else { - model->count = 0; - } -} - -static void -clear_info (ESelectNamesTableModel *model) -{ - 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_destroy (GtkObject *object) -{ - ESelectNamesTableModel *model; - - model = E_SELECT_NAMES_TABLE_MODEL (object); - - e_select_names_table_model_drop_source (model); - clear_info(model); -} - -/* 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) -{ - 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_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ESelectNamesTableModel *model; - - model = E_SELECT_NAMES_TABLE_MODEL (object); - - switch (arg_id) { - case ARG_SOURCE: - e_select_names_table_model_drop_source (model); - e_select_names_table_model_add_source (model, E_SELECT_NAMES_MODEL(GTK_VALUE_OBJECT (*arg))); - break; - default: - return; - } -} - -/* Get_arg handler for the model */ -static void -e_select_names_table_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ESelectNamesTableModel *model; - - model = E_SELECT_NAMES_TABLE_MODEL (object); - - switch (arg_id) { - case ARG_SOURCE: - GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(model->source); - break; - default: - arg->type = GTK_TYPE_INVALID; - 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) -{ - GtkObjectClass *object_class; - ETableModelClass *table_model_class; - - object_class = GTK_OBJECT_CLASS(klass); - table_model_class = E_TABLE_MODEL_CLASS(klass); - - gtk_object_add_arg_type ("ESelectNamesTableModel::source", - GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_SOURCE); - - object_class->destroy = e_select_names_table_model_destroy; - object_class->get_arg = e_select_names_table_model_get_arg; - object_class->set_arg = e_select_names_table_model_set_arg; - - 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 7a051d337c..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@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#ifndef __E_SELECT_NAMES_TABLE_MODEL_H__ -#define __E_SELECT_NAMES_TABLE_MODEL_H__ - -#include <time.h> -#include <gtk/gtk.h> -#include <stdio.h> -#include "e-select-names-model.h" -#include <gal/e-table/e-table-model.h> - -#define E_TYPE_SELECT_NAMES_TABLE_MODEL (e_select_names_table_model_get_type ()) -#define E_SELECT_NAMES_TABLE_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SELECT_NAMES_TABLE_MODEL, ESelectNamesTableModel)) -#define E_SELECT_NAMES_TABLE_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_TABLE_MODEL, ESelectNamesTableModelClass)) -#define E_IS_SELECT_NAMES_TABLE_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SELECT_NAMES_TABLE_MODEL)) -#define E_IS_SELECT_NAMES_TABLE_MODEL_CLASS(klass) (GTK_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 */ -GtkType 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 71934c46dc..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-text-model.c +++ /dev/null @@ -1,357 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#include <config.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <gtk/gtk.h> - -#include "e-select-names-text-model.h" - -/* Object argument IDs */ -enum { - ARG_0, - ARG_SOURCE, -}; - -static void e_select_names_text_model_init (ESelectNamesTextModel *model); -static void e_select_names_text_model_class_init (ESelectNamesTextModelClass *klass); - -static void e_select_names_text_model_destroy (GtkObject *object); -static void e_select_names_text_model_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_select_names_text_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - -static void e_select_names_text_model_set_text (ETextModel *model, gchar *text); -static void e_select_names_text_model_insert (ETextModel *model, gint position, gchar *text); -static void e_select_names_text_model_insert_length (ETextModel *model, gint position, gchar *text, gint length); -static void e_select_names_text_model_delete (ETextModel *model, gint position, gint length); - -static void e_select_names_text_model_model_changed (ESelectNamesModel *source, - ESelectNamesTextModel *model); - - -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 GtkType model_type = 0; - - if (!model_type) { - GtkTypeInfo model_info = { - "ESelectNamesTextModel", - sizeof (ESelectNamesTextModel), - sizeof (ESelectNamesTextModelClass), - (GtkClassInitFunc) e_select_names_text_model_class_init, - (GtkObjectInitFunc) e_select_names_text_model_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - model_type = gtk_type_unique (PARENT_TYPE, &model_info); - } - - return model_type; -} - -/** - * e_select_names_text_model_new: - * @VCard: a string in vCard format - * - * Returns: a new #ESelectNamesTextModel that wraps the @VCard. - */ -ETextModel * -e_select_names_text_model_new (ESelectNamesModel *source) -{ - ETextModel *model = E_TEXT_MODEL(gtk_type_new(e_select_names_text_model_get_type())); - gtk_object_set(GTK_OBJECT(model), - "source", source, - NULL); - e_select_names_text_model_model_changed (source, E_SELECT_NAMES_TEXT_MODEL(model)); - return model; -} - -static void -e_select_names_text_model_class_init (ESelectNamesTextModelClass *klass) -{ - GtkObjectClass *object_class; - ETextModelClass *text_model_class; - - object_class = GTK_OBJECT_CLASS(klass); - text_model_class = E_TEXT_MODEL_CLASS(klass); - - parent_class = gtk_type_class(PARENT_TYPE); - - gtk_object_add_arg_type ("ESelectNamesTextModel::source", - GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_SOURCE); - - object_class->destroy = e_select_names_text_model_destroy; - object_class->get_arg = e_select_names_text_model_get_arg; - object_class->set_arg = e_select_names_text_model_set_arg; - - 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; -} - -static int -get_length(EIterator *iterator) -{ - const ESelectNamesModelData *data = e_iterator_get(iterator); - return strlen(data->string); -} - -static void -e_select_names_text_model_set_text (ETextModel *model, gchar *text) -{ - ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL(model)->source; - EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(source)); - int length = 0; - if (model->text) { - length = strlen(model->text); - } - - e_iterator_reset(iterator); - if (!e_iterator_is_valid(iterator)) { - gtk_object_unref(GTK_OBJECT(iterator)); - iterator = NULL; - } - e_select_names_model_replace(source, - iterator, - 0, - length, - text); - if (iterator) - gtk_object_unref(GTK_OBJECT(iterator)); -} - -static void -e_select_names_text_model_insert (ETextModel *model, gint position, gchar *text) -{ - ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL(model)->source; - EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(source)); - - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - int this_length = get_length(iterator); - if (position <= this_length) { - break; - } else { - position -= this_length + 1; - } - } - if (!e_iterator_is_valid(iterator)) { - gtk_object_unref(GTK_OBJECT(iterator)); - iterator = NULL; - } - e_select_names_model_insert(source, - iterator, - position, - text); - if (iterator) - gtk_object_unref(GTK_OBJECT(iterator)); -} - -static void -e_select_names_text_model_insert_length (ETextModel *model, gint position, gchar *text, gint length) -{ - ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL(model)->source; - EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(source)); - - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - int this_length = get_length(iterator); - if (position <= this_length) { - break; - } else { - position -= this_length + 1; - } - } - if (!e_iterator_is_valid(iterator)) { - gtk_object_unref(GTK_OBJECT(iterator)); - iterator = NULL; - } - e_select_names_model_insert_length(source, - iterator, - position, - text, - length); - if (iterator) - gtk_object_unref(GTK_OBJECT(iterator)); -} - -static void -e_select_names_text_model_delete (ETextModel *model, gint position, gint length) -{ - ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL(model)->source; - EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(source)); - - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - int this_length = get_length(iterator); - if (position <= this_length) { - e_select_names_model_delete(source, - iterator, - position, - length); - break; - } else { - position -= this_length + 1; - } - } - if (iterator) - gtk_object_unref(GTK_OBJECT(iterator)); -} - -static void -e_select_names_text_model_model_changed (ESelectNamesModel *source, - ESelectNamesTextModel *model) -{ - EList *list = e_select_names_model_get_data(source); - EIterator *iterator = e_list_get_iterator(list); - int length = 0; - int length_count = 0; - int *lengthsp; - char *string; - char *stringp; - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - const ESelectNamesModelData *data = e_iterator_get(iterator); - length += strlen(data->string); - length ++; - length_count++; - } - if (length > 0) - length --; - - g_free(model->lengths); - model->lengths = g_new(int, length_count + 1); - lengthsp = model->lengths; - - string = g_new(char, length + 1); - stringp = string; - *stringp = 0; - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - const ESelectNamesModelData *data = e_iterator_get(iterator); - int this_length; - - strcpy(stringp, data->string); - this_length = strlen(stringp); - stringp += this_length; - *(stringp++) = ','; - *(lengthsp++) = this_length; - } - if (stringp != string) { - stringp --; - *stringp = 0; - } - *lengthsp = -1; - g_free(E_TEXT_MODEL(model)->text); - E_TEXT_MODEL(model)->text = string; - e_text_model_changed(E_TEXT_MODEL(model)); -} - - -static void -e_select_names_text_model_add_source (ESelectNamesTextModel *model, - ESelectNamesModel *source) -{ - model->source = source; - if (model->source) - gtk_object_ref(GTK_OBJECT(model->source)); - model->source_changed_id = gtk_signal_connect(GTK_OBJECT(model->source), "changed", - GTK_SIGNAL_FUNC(e_select_names_text_model_model_changed), - model); -} - -static void -e_select_names_text_model_drop_source (ESelectNamesTextModel *model) -{ - if (model->source_changed_id) - gtk_signal_disconnect(GTK_OBJECT(model->source), model->source_changed_id); - if (model->source) - gtk_object_unref(GTK_OBJECT(model->source)); - model->source = NULL; - model->source_changed_id = 0; -} - -/* - * ESelectNamesTextModel lifecycle management and vcard loading/saving. - */ - -static void -e_select_names_text_model_destroy (GtkObject *object) -{ - ESelectNamesTextModel *model; - - model = E_SELECT_NAMES_TEXT_MODEL (object); - - e_select_names_text_model_drop_source(model); - g_free(model->lengths); - - if (GTK_OBJECT_CLASS(parent_class)->destroy) - GTK_OBJECT_CLASS(parent_class)->destroy(object); -} - - -/* Set_arg handler for the model */ -static void -e_select_names_text_model_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ESelectNamesTextModel *model; - - model = E_SELECT_NAMES_TEXT_MODEL (object); - - switch (arg_id) { - case ARG_SOURCE: - e_select_names_text_model_drop_source(model); - e_select_names_text_model_add_source(model, E_SELECT_NAMES_MODEL(GTK_VALUE_OBJECT(*arg))); - break; - default: - return; - } -} - -/* Get_arg handler for the model */ -static void -e_select_names_text_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ESelectNamesTextModel *model; - - model = E_SELECT_NAMES_TEXT_MODEL (object); - - switch (arg_id) { - case ARG_SOURCE: - GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(model->source); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -/** - * e_select_names_text_model_init: - */ -static void -e_select_names_text_model_init (ESelectNamesTextModel *model) -{ - model->source = NULL; - model->source_changed_id = 0; - model->lengths = NULL; -} - 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 3d6bed468e..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-text-model.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#ifndef __E_SELECT_NAMES_TEXT_MODEL_H__ -#define __E_SELECT_NAMES_TEXT_MODEL_H__ - -#include <time.h> -#include <gtk/gtk.h> -#include <stdio.h> -#include "e-select-names-model.h" -#include <gal/e-text/e-text-model.h> - -#define E_TYPE_SELECT_NAMES_TEXT_MODEL (e_select_names_text_model_get_type ()) -#define E_SELECT_NAMES_TEXT_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SELECT_NAMES_TEXT_MODEL, ESelectNamesTextModel)) -#define E_SELECT_NAMES_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_TEXT_MODEL, ESelectNamesTextModelClass)) -#define E_IS_SELECT_NAMES_TEXT_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SELECT_NAMES_TEXT_MODEL)) -#define E_IS_SELECT_NAMES_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_TEXT_MODEL)) - -typedef struct _ESelectNamesTextModel ESelectNamesTextModel; -typedef struct _ESelectNamesTextModelClass ESelectNamesTextModelClass; - -struct _ESelectNamesTextModel { - ETextModel parent; - - ESelectNamesModel *source; - int source_changed_id; - int *lengths; -}; - -struct _ESelectNamesTextModelClass { - ETextModelClass parent_class; -}; - -ETextModel *e_select_names_text_model_new (ESelectNamesModel *source); - -/* Standard Gtk function */ -GtkType 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 ef9ffcabdf..0000000000 --- a/addressbook/gui/component/select-names/e-select-names.c +++ /dev/null @@ -1,661 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-select-names.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * 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 <gnome.h> -#include "e-select-names.h" -#include <gal/e-table/e-table-simple.h> -#include <addressbook/gui/widgets/e-addressbook-model.h> -#include <addressbook/gui/component/e-cardlist-model.h> -#include <addressbook/backend/ebook/e-book.h> -#include "e-select-names-table-model.h" -#include <shell/evolution-shell-client.h> -#include <addressbook/gui/component/addressbook-component.h> -#include <gal/widgets/e-font.h> - -static void e_select_names_init (ESelectNames *card); -static void e_select_names_class_init (ESelectNamesClass *klass); -static void e_select_names_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_select_names_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_select_names_destroy (GtkObject *object); - -static GnomeDialogClass *parent_class = NULL; -#define PARENT_TYPE gnome_dialog_get_type() - -/* The arguments we take */ -enum { - ARG_0, -}; - -typedef struct { - char *title; - ETableModel *model; - ESelectNamesModel *source; - ESelectNames *names; - GtkWidget *label; -} ESelectNamesChild; - -GtkType -e_select_names_get_type (void) -{ - static GtkType type = 0; - - if (!type) { - static const GtkTypeInfo info = - { - "ESelectNames", - sizeof (ESelectNames), - sizeof (ESelectNamesClass), - (GtkClassInitFunc) e_select_names_class_init, - (GtkObjectInitFunc) e_select_names_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -static void -e_select_names_class_init (ESelectNamesClass *klass) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) klass; - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->set_arg = e_select_names_set_arg; - object_class->get_arg = e_select_names_get_arg; - object_class->destroy = e_select_names_destroy; -} - -#define SPEC "<ETableSpecification no-headers=\"true\" cursor-mode=\"line\"> \ - <ETableColumn model_col= \"35\" _title=\"Name\" 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>" - -#define SPEC2 "<ETableSpecification no-headers=\"true\" cursor-mode=\"line\"> \ - <ETableColumn model_col= \"0\" _title=\"Name\" 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 *e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int num1, int num2); - -static void -set_book(EBook *book, EBookStatus status, ETableModel *model) -{ - gtk_object_set(GTK_OBJECT(model), - "book", book, - NULL); - gtk_object_unref(GTK_OBJECT(book)); -} - -static void -addressbook_model_set_uri(ETableModel *model, char *uri) -{ - EBook *book; - book = e_book_new(); - gtk_object_ref(GTK_OBJECT(model)); - gtk_object_ref(GTK_OBJECT(book)); - e_book_load_uri(book, uri, (EBookCallback) set_book, model); -} - -static void -real_add_address_cb (int model_row, - gpointer closure) -{ - ESelectNamesChild *child = closure; - ESelectNames *names = child->names; - ECard *card = e_addressbook_model_get_card(E_ADDRESSBOOK_MODEL(names->model), model_row); - ESelectNamesModelData new = {E_SELECT_NAMES_MODEL_DATA_TYPE_CARD, - card, - NULL}; - char *name, *email; - ECardSimple *simple = e_card_simple_new(card); - EIterator *iterator; - - name = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_FULL_NAME); - email = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_EMAIL); - if (name && *name && email && *email) { - new.string = g_strdup_printf("\"%s\" <%s>", name, email); - } else if (email && *email) { - new.string = g_strdup_printf("%s", email); - } else { - new.string = g_strdup(""); - } - - iterator = e_list_get_iterator(e_select_names_model_get_data(child->source)); - e_iterator_last(iterator); - e_select_names_model_add_item(child->source, iterator, &new); - - gtk_object_unref(GTK_OBJECT(simple)); - gtk_object_unref(GTK_OBJECT(card)); - g_free(email); - g_free(name); - g_free(new.string); -} - -static void -real_add_address(ESelectNames *names, ESelectNamesChild *child) -{ - e_table_selected_row_foreach(e_table_scrolled_get_table(names->table), - real_add_address_cb, child); -} - -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); - } -} - -GtkWidget * -e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int num1, int num2) -{ - ETableModel *model; - GtkWidget *table; - char *filename; - char *uri; - - model = e_addressbook_model_new(); - gtk_object_set(GTK_OBJECT(model), - "editable", FALSE, - "query", "(contains \"email\" \"\")", - NULL); - - - filename = gnome_util_prepend_user_home("evolution/local/Contacts/addressbook.db"); - uri = g_strdup_printf("file://%s", filename); - - addressbook_model_set_uri(model, uri); - - g_free(uri); - g_free(filename); - table = e_table_scrolled_new (model, NULL, SPEC, NULL); - - gtk_object_set_data(GTK_OBJECT(table), "model", model); - return table; -} - -static void -set_current_selection(ETableScrolled *table, int row, ESelectNames *names) -{ - names->currently_selected = row; -} - -typedef struct { - char *description; - char *display_name; - char *physical_uri; - -} ESelectNamesFolder; - -static void -e_select_names_folder_free(ESelectNamesFolder *e_folder) -{ - g_free(e_folder->description ); - g_free(e_folder->display_name); - g_free(e_folder->physical_uri); - g_free(e_folder); -} - -static void -e_select_names_option_activated(GtkWidget *widget, ESelectNames *e_select_names) -{ - ESelectNamesFolder *e_folder = gtk_object_get_data (GTK_OBJECT (widget), "EsnChoiceFolder"); - - addressbook_model_set_uri(e_select_names->model, e_folder->physical_uri); -} - -typedef struct { - ESelectNames *names; - GtkWidget *menu; -} NamesAndMenu; - -static void -add_menu_item (gpointer key, - gpointer value, - gpointer user_data) -{ - GtkWidget *menu; - GtkWidget *item; - ESelectNamesFolder *e_folder; - NamesAndMenu *nnm; - ESelectNames *e_select_names; - - nnm = user_data; - e_folder = value; - menu = nnm->menu; - e_select_names = nnm->names; - - item = gtk_menu_item_new_with_label (e_folder->display_name); - gtk_menu_append (GTK_MENU (menu), item); - gtk_object_set_data (GTK_OBJECT (item), "EsnChoiceFolder", e_folder); - - gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (e_select_names_option_activated), - e_select_names); -} - -static void -update_option_menu(ESelectNames *e_select_names) -{ - GtkWidget *menu; - GtkWidget *option; - - option = glade_xml_get_widget (e_select_names->gui, - "optionmenu-folder"); - if (option) { - NamesAndMenu nnm; - menu = gtk_menu_new (); - - nnm.names = e_select_names; - nnm.menu = menu; - - g_hash_table_foreach (e_select_names->folders, - add_menu_item, - &nnm); - - gtk_widget_show_all (menu); - - gtk_option_menu_set_menu (GTK_OPTION_MENU (option), - menu); - gtk_option_menu_set_history (GTK_OPTION_MENU (option), 0); - gtk_widget_set_sensitive (option, TRUE); - } -} - -static void -new_folder (EvolutionStorageListener *storage_listener, - const char *path, - const GNOME_Evolution_Folder *folder, - ESelectNames *e_select_names) -{ - if (!strcmp(folder->type, "contacts")) { - ESelectNamesFolder *e_folder = g_new(ESelectNamesFolder, 1); - e_folder->description = g_strdup(folder->description ); - e_folder->display_name = g_strdup(folder->display_name); - e_folder->physical_uri = g_strdup(folder->physical_uri); - g_hash_table_insert(e_select_names->folders, - g_strdup(path), e_folder); - update_option_menu(e_select_names); - } -} - -static void -update_folder (EvolutionStorageListener *storage_listener, - const char *path, - const char *display_name, - ESelectNames *e_select_names) -{ - ESelectNamesFolder *e_folder = g_hash_table_lookup(e_select_names->folders, path); - if (e_folder) { - g_free(e_folder->display_name); - e_folder->display_name = g_strdup(e_folder->display_name); - update_option_menu(e_select_names); - } -} - -static void -removed_folder (EvolutionStorageListener *storage_listener, - const char *path, - ESelectNames *e_select_names) -{ - ESelectNamesFolder *e_folder; - char *orig_path; - - if (g_hash_table_lookup_extended(e_select_names->folders, path, (void **) &orig_path, (void **) &e_folder)) { - g_hash_table_remove(e_select_names->folders, path); - e_select_names_folder_free(e_folder); - g_free(orig_path); - update_option_menu(e_select_names); - } -} - -static void -e_select_names_hookup_shell_listener (ESelectNames *e_select_names) -{ - GNOME_Evolution_Storage storage; - GNOME_Evolution_StorageListener listener; - CORBA_Environment ev; - - CORBA_exception_init(&ev); - - storage = (GNOME_Evolution_Storage) (evolution_shell_client_get_local_storage(addressbook_component_get_shell_client())); - e_select_names->listener = evolution_storage_listener_new(); - - listener = evolution_storage_listener_corba_objref(e_select_names->listener); - - gtk_signal_connect(GTK_OBJECT(e_select_names->listener), "new_folder", - GTK_SIGNAL_FUNC(new_folder), e_select_names); - gtk_signal_connect(GTK_OBJECT(e_select_names->listener), "update_folder", - GTK_SIGNAL_FUNC(update_folder), e_select_names); - gtk_signal_connect(GTK_OBJECT(e_select_names->listener), "removed_folder", - GTK_SIGNAL_FUNC(removed_folder), e_select_names); - - GNOME_Evolution_Storage_addListener(storage, listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_select_names_init: Exception adding listener to " - "remote GNOME_Evolution_Storage interface.\n"); - CORBA_exception_free (&ev); - return; - } - - bonobo_object_release_unref(storage, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_select_names_init: Exception unref'ing " - "remote GNOME_Evolution_Storage interface.\n"); - CORBA_exception_free (&ev); - return; - } - - CORBA_exception_free(&ev); -} - -static void -e_select_names_init (ESelectNames *e_select_names) -{ - GladeXML *gui; - GtkWidget *widget; - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/select-names.glade", 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(GNOME_DIALOG(e_select_names)->vbox), widget, TRUE, TRUE, 0); - gtk_widget_unref(widget); - - gnome_dialog_append_buttons(GNOME_DIALOG(e_select_names), - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_CANCEL, - NULL); - - 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 = gtk_object_get_data(GTK_OBJECT(e_select_names->table), "model"); - - e_select_names->currently_selected = -1; - - e_select_names->folders = g_hash_table_new(g_str_hash, g_str_equal); - - e_select_names_hookup_shell_listener (e_select_names); - - gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(e_select_names->table)), "cursor_activated", - GTK_SIGNAL_FUNC(set_current_selection), e_select_names); - - gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(e_select_names->table)), "double_click", - GTK_SIGNAL_FUNC(add_address), e_select_names); -} - -static void e_select_names_child_free(char *key, ESelectNamesChild *child, ESelectNames *e_select_names) -{ - g_free(child->title); - gtk_object_unref(GTK_OBJECT(child->model)); - gtk_object_unref(GTK_OBJECT(child->source)); - g_free(key); -} - -static void -e_select_names_destroy (GtkObject *object) { - ESelectNames *e_select_names = E_SELECT_NAMES(object); - - gtk_signal_disconnect_by_data(GTK_OBJECT(e_select_names->listener), e_select_names); - gtk_object_unref(GTK_OBJECT(e_select_names->listener)); - - gtk_object_unref(GTK_OBJECT(e_select_names->gui)); - 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); - - g_free(e_select_names->def); -} - -GtkWidget* -e_select_names_new (void) -{ - GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_select_names_get_type ())); - return widget; -} - -static void -e_select_names_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - ESelectNames *editor; - - editor = E_SELECT_NAMES (o); - - switch (arg_id){ - default: - return; - } -} - -static void -e_select_names_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ESelectNames *e_select_names; - - e_select_names = E_SELECT_NAMES (object); - - switch (arg_id) { - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -button_clicked(GtkWidget *button, ESelectNamesChild *child) -{ - real_add_address(child->names, child); -} - -static void -remove_address(ETable *table, int row, int col, GdkEvent *event, ESelectNamesChild *child) -{ - EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(child->source)); - e_iterator_reset(iterator); - for (; row > 0; row--) { - e_iterator_next(iterator); - } - e_select_names_model_remove_item(child->source, iterator); -} - -void -e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, ESelectNamesModel *source) -{ - ESelectNamesChild *child; - GtkWidget *button; - GtkWidget *alignment; - GtkWidget *label; - GtkTable *table; - char *label_text; - - ETableModel *model; - GtkWidget *etable; - - 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)); - - e_select_names->child_count++; - - alignment = gtk_alignment_new(0, 0, 1, 0); - - button = gtk_button_new (); - - label_text = g_strconcat (child->title, " ->", NULL); - label = gtk_label_new (label_text); - g_free (label_text); - gtk_container_add (GTK_CONTAINER (button), label); - child->label = label; - - gtk_container_add(GTK_CONTAINER(alignment), button); - gtk_widget_show_all(alignment); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(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); - - model = e_select_names_table_model_new(source); - etable = e_table_scrolled_new (model, NULL, SPEC2, NULL); - - gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(etable))), "double_click", - GTK_SIGNAL_FUNC(remove_address), child); - - child->model = model; - child->source = source; - gtk_object_ref(GTK_OBJECT(child->model)); - gtk_object_ref(GTK_OBJECT(child->source)); - - gtk_widget_show(etable); - - gtk_table_attach(table, etable, - 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); -} - -static void * -card_copy(const void *value, void *closure) -{ - gtk_object_ref(GTK_OBJECT(value)); - return (void *)value; -} - -static void -card_free(void *value, void *closure) -{ - gtk_object_unref(GTK_OBJECT(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_table_model_row_count(child->model); - - list = e_list_new(card_copy, card_free, NULL); - for (i = 0; i < rows; i++) { - ECard *card = e_cardlist_model_get(E_CARDLIST_MODEL(child->model), i); - e_list_append(list, card); - gtk_object_unref(GTK_OBJECT(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) - gtk_object_ref(GTK_OBJECT(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) - gtk_widget_restore_default_style(child->label); - } - - 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) { - EFont *efont; - GdkFont *gdkfont; - GtkStyle *style, *oldstyle; - - oldstyle = gtk_widget_get_style(child->label); - style = gtk_style_copy(oldstyle); - - efont = e_font_from_gdk_font(style->font); - gdkfont = e_font_to_gdk_font(efont, E_FONT_BOLD); - e_font_unref(efont); - - gdk_font_ref(gdkfont); - gdk_font_unref(style->font); - style->font = gdkfont; - - gtk_widget_set_style(child->label, style); - - gtk_style_unref(oldstyle); - } - } -} 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 9d47558117..0000000000 --- a/addressbook/gui/component/select-names/e-select-names.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-select-names.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey <clahey@helixcode.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * 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 <gnome.h> -#include <glade/glade.h> -#include <e-util/e-list.h> -#include <gal/e-table/e-table.h> -#include <gal/e-table/e-table-scrolled.h> -#include "e-select-names-model.h" - -#include <shell/evolution-storage-listener.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_SELECT_NAMES_TYPE (e_select_names_get_type ()) -#define E_SELECT_NAMES(obj) (GTK_CHECK_CAST ((obj), E_SELECT_NAMES_TYPE, ESelectNames)) -#define E_SELECT_NAMES_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_SELECT_NAMES_TYPE, ESelectNamesClass)) -#define E_IS_SELECT_NAMES(obj) (GTK_CHECK_TYPE ((obj), E_SELECT_NAMES_TYPE)) -#define E_IS_SELECT_NAMES_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_SELECT_NAMES_TYPE)) - -typedef struct _ESelectNames ESelectNames; -typedef struct _ESelectNamesClass ESelectNamesClass; - -struct _ESelectNames -{ - GnomeDialog parent; - - /* item specific fields */ - GladeXML *gui; - - GHashTable *children; /* Of type char * to ESelectNamesChild */ - int child_count; - ETableScrolled *table; - ETableModel *model; - int currently_selected; - EvolutionStorageListener *listener; - GHashTable *folders; - char *def; -}; - -struct _ESelectNamesClass -{ - GnomeDialogClass parent_class; -}; - - -GtkWidget *e_select_names_new (void); -GtkType 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/recipient.glade b/addressbook/gui/component/select-names/recipient.glade deleted file mode 100644 index b60972d094..0000000000 --- a/addressbook/gui/component/select-names/recipient.glade +++ /dev/null @@ -1,61 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>Recipient</name> - <program_name>recipient</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> - <use_widget_names>True</use_widget_names> - <output_main_file>False</output_main_file> - <output_support_files>False</output_support_files> - <output_build_files>False</output_build_files> - <gnome_help_support>True</gnome_help_support> -</project> - -<widget> - <class>GtkWindow</class> - <name>window1</name> - <visible>False</visible> - <title>window1</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - - <widget> - <class>GtkHBox</class> - <name>hbox-top</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkAlignment</class> - <name>alignment1</name> - <xalign>1.08033e-07</xalign> - <yalign>0</yalign> - <xscale>1</xscale> - <yscale>0</yscale> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkButton</class> - <name>text-button</name> - <can_focus>True</can_focus> - <label>-></label> - </widget> - </widget> - </widget> -</widget> - -</GTK-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 063d39c1fa..0000000000 --- a/addressbook/gui/component/select-names/select-names.glade +++ /dev/null @@ -1,270 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>Select-names</name> - <program_name>select-names</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> - <output_main_file>False</output_main_file> - <output_support_files>False</output_support_files> - <output_build_files>False</output_build_files> - <output_translatable_strings>True</output_translatable_strings> - <translatable_strings_file>select-names.glade.h</translatable_strings_file> -</project> - -<widget> - <class>GnomeDialog</class> - <name>dialog-top</name> - <visible>False</visible> - <title>Select Names</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - <auto_close>False</auto_close> - <hide_on_close>False</hide_on_close> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDialog:vbox</child_name> - <name>dialog-vbox1</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>dialog-action_area1</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>8</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - <pack>GTK_PACK_END</pack> - </child> - - <widget> - <class>GtkButton</class> - <name>button1</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> - </widget> - - <widget> - <class>GtkButton</class> - <name>button3</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - </widget> - </widget> - - <widget> - <class>GtkTable</class> - <name>table-top</name> - <rows>4</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>6</row_spacing> - <column_spacing>6</column_spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHBox</class> - <name>hbox1</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkEntry</class> - <name>entry-find</name> - <visible>False</visible> - <can_focus>True</can_focus> - <has_focus>True</has_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-find</name> - <visible>False</visible> - <can_focus>True</can_focus> - <label>Find...</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel1</name> - <label>Select name from:</label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>table-source</name> - <creation_function>e_addressbook_create_ebook_table</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Sat, 10 Jun 2000 22:02:57 GMT</last_modification_time> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>True</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkTable</class> - <name>table-recipients</name> - <rows>1</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel2</name> - <label>Message Recipients</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>optionmenu1</name> - <can_focus>True</can_focus> - <items></items> - <initial_choice>0</initial_choice> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/addressbook/gui/component/select-names/select-names.glade.h b/addressbook/gui/component/select-names/select-names.glade.h deleted file mode 100644 index 432ceac23d..0000000000 --- a/addressbook/gui/component/select-names/select-names.glade.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Translatable strings file generated by Glade. - * Add this file to your project's POTFILES.in. - * DO NOT compile it as part of your application. - */ - -gchar *s = N_("Select Names"); -gchar *s = N_("Find..."); -gchar *s = N_("Select name from:"); -gchar *s = N_("Message Recipients"); |