diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-07-04 07:03:45 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-07-04 07:03:45 +0800 |
commit | 6fd5b82ca0c15cb641eb0f7aa427a6989b0f1344 (patch) | |
tree | 02c04c1412131341c976409cbc093bfe4b529417 | |
parent | 43f902781ba5f22478f966a2f7687baf1a2eccdd (diff) | |
download | gsoc2013-evolution-6fd5b82ca0c15cb641eb0f7aa427a6989b0f1344.tar.gz gsoc2013-evolution-6fd5b82ca0c15cb641eb0f7aa427a6989b0f1344.tar.zst gsoc2013-evolution-6fd5b82ca0c15cb641eb0f7aa427a6989b0f1344.zip |
Removed e-card-iterator.c, e-card-iterator.h, e-card-list-iterator.c,
2000-07-03 Christopher James Lahey <clahey@helixcode.com>
* backend/ebook/Makefile.am: Removed e-card-iterator.c,
e-card-iterator.h, e-card-list-iterator.c, e-card-list-iterator.h,
e-card-list.c, e-card-list.h.
* backend/ebook/e-card-iterator.c,
backend/ebook/e-card-iterator.h,
backend/ebook/e-card-list-iterator.c,
backend/ebook/e-card-list-iterator.h, backend/ebook/e-card-list.c,
backend/ebook/e-card-list.h: Removed in favor or versions without
the -card in the e-util directory since these classes are not
specific to cards at all.
* backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h,
backend/ebook/e-card.c, backend/ebook/e-card.h,
backend/ebook/load-pine-addressbook.c, backend/ebook/test-card.c,
backend/pas/pas-backend-file.c: Changed the references to
e-card-list.c and friends to e-list.c and friends.
* contact-editor/e-contact-editor.c: Added #include
<e-contact-save-as.h> to fix a warning.
* gui/component/Makefile.am: Moved a number of classes associated
with the select-names object to the new select-names directory.
* gui/component/addressbook.c: Changed the reference to
e-select-names.h.
* gui/component/e-select-names.c, gui/component/e-select-names.h,
gui/component/select-names.glade,
gui/component/select-names.glade.h: Moved these files into
select-names/.
* gui/component/select-names/.cvsignore,
gui/component/select-names/Makefile.am,
gui/component/select-names/e-select-names-manager.c,
gui/component/select-names/e-select-names-manager.h,
gui/component/select-names/e-select-names-model.c,
gui/component/select-names/e-select-names-model.h,
gui/component/select-names/e-select-names-table-model.c,
gui/component/select-names/e-select-names-table-model.h,
gui/component/select-names/e-select-names-text-model.c,
gui/component/select-names/e-select-names-text-model.h,
gui/component/select-names/e-select-names.c,
gui/component/select-names/e-select-names.h,
gui/component/select-names/recipient.glade,
gui/component/select-names/select-names.glade,
gui/component/select-names/select-names.glade.h: New files for
select names dialog (e-select-names.c, e-select-names.h,
select-names.glade, select-names.glade.h and recipient.glade moved
from gui/component/.)
svn path=/trunk/; revision=3876
34 files changed, 1186 insertions, 866 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 962ca4b8ef..c8b7f3cdbf 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,56 @@ +2000-07-03 Christopher James Lahey <clahey@helixcode.com> + + * backend/ebook/Makefile.am: Removed e-card-iterator.c, + e-card-iterator.h, e-card-list-iterator.c, e-card-list-iterator.h, + e-card-list.c, e-card-list.h. + + * backend/ebook/e-card-iterator.c, + backend/ebook/e-card-iterator.h, + backend/ebook/e-card-list-iterator.c, + backend/ebook/e-card-list-iterator.h, backend/ebook/e-card-list.c, + backend/ebook/e-card-list.h: Removed in favor or versions without + the -card in the e-util directory since these classes are not + specific to cards at all. + + * backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h, + backend/ebook/e-card.c, backend/ebook/e-card.h, + backend/ebook/load-pine-addressbook.c, backend/ebook/test-card.c, + backend/pas/pas-backend-file.c: Changed the references to + e-card-list.c and friends to e-list.c and friends. + + * contact-editor/e-contact-editor.c: Added #include + <e-contact-save-as.h> to fix a warning. + + * gui/component/Makefile.am: Moved a number of classes associated + with the select-names object to the new select-names directory. + + * gui/component/addressbook.c: Changed the reference to + e-select-names.h. + + * gui/component/e-select-names.c, gui/component/e-select-names.h, + gui/component/select-names.glade, + gui/component/select-names.glade.h: Moved these files into + select-names/. + + * gui/component/select-names/.cvsignore, + gui/component/select-names/Makefile.am, + gui/component/select-names/e-select-names-manager.c, + gui/component/select-names/e-select-names-manager.h, + gui/component/select-names/e-select-names-model.c, + gui/component/select-names/e-select-names-model.h, + gui/component/select-names/e-select-names-table-model.c, + gui/component/select-names/e-select-names-table-model.h, + gui/component/select-names/e-select-names-text-model.c, + gui/component/select-names/e-select-names-text-model.h, + gui/component/select-names/e-select-names.c, + gui/component/select-names/e-select-names.h, + gui/component/select-names/recipient.glade, + gui/component/select-names/select-names.glade, + gui/component/select-names/select-names.glade.h: New files for + select names dialog (e-select-names.c, e-select-names.h, + select-names.glade, select-names.glade.h and recipient.glade moved + from gui/component/.) + 2000-06-29 Ettore Perazzoli <ettore@helixcode.com> * gui/component/addressbook-component.c (owner_set_cb): Get an diff --git a/addressbook/backend/ebook/Makefile.am b/addressbook/backend/ebook/Makefile.am index c0ab395564..c28b911271 100644 --- a/addressbook/backend/ebook/Makefile.am +++ b/addressbook/backend/ebook/Makefile.am @@ -33,9 +33,6 @@ libebook_la_SOURCES = \ e-book-view.c \ e-book.c \ e-card-cursor.c \ - e-card-iterator.c \ - e-card-list-iterator.c \ - e-card-list.c \ e-card-simple.c \ e-card.c @@ -48,9 +45,6 @@ libebookinclude_HEADERS = \ e-book-view.h \ e-book.h \ e-card-cursor.h \ - e-card-iterator.h \ - e-card-list-iterator.h \ - e-card-list.h \ e-card-pairs.h \ e-card-simple.h \ e-card-types.h \ diff --git a/addressbook/backend/ebook/e-card-iterator.c b/addressbook/backend/ebook/e-card-iterator.c deleted file mode 100644 index b5a023b5c1..0000000000 --- a/addressbook/backend/ebook/e-card-iterator.c +++ /dev/null @@ -1,169 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Christopher James Lahey <clahey@umich.edu> - * - * Copyright (C) 2000 Helix Code, Inc. - * Copyright (C) 1999 The Free Software Foundation - */ - -#include <config.h> -#include <gtk/gtk.h> - -#include "e-card-iterator.h" - -#define ECI_CLASS(object) (E_CARD_ITERATOR_CLASS(GTK_OBJECT((object))->klass)) - -static void e_card_iterator_init (ECardIterator *card); -static void e_card_iterator_class_init (ECardIteratorClass *klass); - -#define PARENT_TYPE (gtk_object_get_type ()) - -static GtkObjectClass *parent_class; - -enum { - INVALIDATE, - LAST_SIGNAL -}; - -static guint e_card_iterator_signals [LAST_SIGNAL] = { 0, }; - -/** - * e_card_iterator_get_type: - * @void: - * - * Registers the &ECardIterator class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &ECardIterator class. - **/ -GtkType -e_card_iterator_get_type (void) -{ - static GtkType type = 0; - - if (!type) { - GtkTypeInfo info = { - "ECardIterator", - sizeof (ECardIterator), - sizeof (ECardIteratorClass), - (GtkClassInitFunc) e_card_iterator_class_init, - (GtkObjectInitFunc) e_card_iterator_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -static void -e_card_iterator_class_init (ECardIteratorClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS(klass); - - parent_class = gtk_type_class (PARENT_TYPE); - - e_card_iterator_signals [INVALIDATE] = - gtk_signal_new ("invalidate", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ECardIteratorClass, invalidate), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, e_card_iterator_signals, LAST_SIGNAL); - - klass->invalidate = NULL; - klass->get = NULL; - klass->reset = NULL; - klass->next = NULL; - klass->prev = NULL; - klass->delete = NULL; - klass->set = NULL; - klass->is_valid = NULL; -} - -/** - * e_card_iterator_init: - */ -static void -e_card_iterator_init (ECardIterator *card) -{ -} - -/* - * Virtual functions: - */ -const void * -e_card_iterator_get (ECardIterator *iterator) -{ - if (ECI_CLASS(iterator)->get) - return ECI_CLASS(iterator)->get(iterator); - else - return NULL; -} - -void -e_card_iterator_reset (ECardIterator *iterator) -{ - if (ECI_CLASS(iterator)->reset) - ECI_CLASS(iterator)->reset(iterator); -} - -gboolean -e_card_iterator_next (ECardIterator *iterator) -{ - if (ECI_CLASS(iterator)->next) - return ECI_CLASS(iterator)->next(iterator); - else - return FALSE; -} - -gboolean -e_card_iterator_prev (ECardIterator *iterator) -{ - if (ECI_CLASS(iterator)->prev) - return ECI_CLASS(iterator)->prev(iterator); - else - return FALSE; -} - -void -e_card_iterator_delete (ECardIterator *iterator) -{ - if (ECI_CLASS(iterator)->delete) - ECI_CLASS(iterator)->delete(iterator); -} - -void -e_card_iterator_set (ECardIterator *iterator, - const void *object) -{ - if (ECI_CLASS(iterator)->set) - ECI_CLASS(iterator)->set(iterator, object); -} - -gboolean -e_card_iterator_is_valid (ECardIterator *iterator) -{ - if (ECI_CLASS(iterator)->is_valid) - return ECI_CLASS(iterator)->is_valid(iterator); - else - return FALSE; -} - -void -e_card_iterator_invalidate (ECardIterator *iterator) -{ - g_return_if_fail (iterator != NULL); - g_return_if_fail (E_IS_CARD_ITERATOR (iterator)); - - gtk_signal_emit (GTK_OBJECT (iterator), - e_card_iterator_signals [INVALIDATE]); -} diff --git a/addressbook/backend/ebook/e-card-iterator.h b/addressbook/backend/ebook/e-card-iterator.h deleted file mode 100644 index 9d657e03ef..0000000000 --- a/addressbook/backend/ebook/e-card-iterator.h +++ /dev/null @@ -1,61 +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. - * Copyright (C) 1999 The Free Software Foundation - */ - -#ifndef __E_CARD_ITERATOR_H__ -#define __E_CARD_ITERATOR_H__ - -#include <time.h> -#include <gtk/gtk.h> -#include <stdio.h> - -#define E_TYPE_CARD_ITERATOR (e_card_iterator_get_type ()) -#define E_CARD_ITERATOR(obj) (GTK_CHECK_CAST ((obj), E_TYPE_CARD_ITERATOR, ECardIterator)) -#define E_CARD_ITERATOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_CARD_ITERATOR, ECardIteratorClass)) -#define E_IS_CARD_ITERATOR(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_CARD_ITERATOR)) -#define E_IS_CARD_ITERATOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_CARD_ITERATOR)) - -typedef struct _ECardIterator ECardIterator; -typedef struct _ECardIteratorClass ECardIteratorClass; - -struct _ECardIterator { - GtkObject object; -}; - -struct _ECardIteratorClass { - GtkObjectClass parent_class; - - /* Signals */ - void (*invalidate) (ECardIterator *iterator); - - /* Virtual functions */ - const void * (*get) (ECardIterator *iterator); - void (*reset) (ECardIterator *iterator); - gboolean (*next) (ECardIterator *iterator); - gboolean (*prev) (ECardIterator *iterator); - void (*delete) (ECardIterator *iterator); - void (*set) (ECardIterator *iterator, - const void *object); - gboolean (*is_valid) (ECardIterator *iterator); -}; - -const void *e_card_iterator_get (ECardIterator *iterator); -void e_card_iterator_reset (ECardIterator *iterator); -gboolean e_card_iterator_next (ECardIterator *iterator); -gboolean e_card_iterator_prev (ECardIterator *iterator); -void e_card_iterator_delete (ECardIterator *iterator); -void e_card_iterator_set (ECardIterator *iterator, - const void *object); -gboolean e_card_iterator_is_valid (ECardIterator *iterator); - -void e_card_iterator_invalidate (ECardIterator *iterator); - -/* Standard Gtk function */ -GtkType e_card_iterator_get_type (void); - -#endif /* ! __E_CARD_ITERATOR_H__ */ diff --git a/addressbook/backend/ebook/e-card-list-iterator.c b/addressbook/backend/ebook/e-card-list-iterator.c deleted file mode 100644 index d23060fda2..0000000000 --- a/addressbook/backend/ebook/e-card-list-iterator.c +++ /dev/null @@ -1,199 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Christopher James Lahey <clahey@umich.edu> - * - * Copyright (C) 2000 Helix Code, Inc. - * Copyright (C) 1999 The Free Software Foundation - */ - -#include <config.h> -#include <gtk/gtk.h> - -#include "e-card-list-iterator.h" -#include "e-card-list.h" - -static void e_card_list_iterator_init (ECardListIterator *card); -static void e_card_list_iterator_class_init (ECardListIteratorClass *klass); - -static void e_card_list_iterator_invalidate (ECardIterator *iterator); -static gboolean e_card_list_iterator_is_valid (ECardIterator *iterator); -static void e_card_list_iterator_set (ECardIterator *iterator, - const void *object); -static void e_card_list_iterator_delete (ECardIterator *iterator); -static gboolean e_card_list_iterator_prev (ECardIterator *iterator); -static gboolean e_card_list_iterator_next (ECardIterator *iterator); -static void e_card_list_iterator_reset (ECardIterator *iterator); -static const void *e_card_list_iterator_get (ECardIterator *iterator); -static void e_card_list_iterator_destroy (GtkObject *object); - -#define PARENT_TYPE (e_card_iterator_get_type ()) - -static GtkObjectClass *parent_class; -#define PARENT_CLASS (E_CARD_LIST_ITERATOR_CLASS(parent_class)) - -/** - * e_card_list_iterator_get_type: - * @void: - * - * Registers the &ECardListIterator class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &ECardListIterator class. - **/ -GtkType -e_card_list_iterator_get_type (void) -{ - static GtkType type = 0; - - if (!type) { - GtkTypeInfo info = { - "ECardListIterator", - sizeof (ECardListIterator), - sizeof (ECardListIteratorClass), - (GtkClassInitFunc) e_card_list_iterator_class_init, - (GtkObjectInitFunc) e_card_list_iterator_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -static void -e_card_list_iterator_class_init (ECardListIteratorClass *klass) -{ - GtkObjectClass *object_class; - ECardIteratorClass *iterator_class; - - object_class = GTK_OBJECT_CLASS(klass); - iterator_class = E_CARD_ITERATOR_CLASS(klass); - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = e_card_list_iterator_destroy; - - iterator_class->invalidate = e_card_list_iterator_invalidate; - iterator_class->get = e_card_list_iterator_get; - iterator_class->reset = e_card_list_iterator_reset; - iterator_class->next = e_card_list_iterator_next; - iterator_class->prev = e_card_list_iterator_prev; - iterator_class->delete = e_card_list_iterator_delete; - iterator_class->set = e_card_list_iterator_set; - iterator_class->is_valid = e_card_list_iterator_is_valid; -} - - - -/** - * e_card_list_iterator_init: - */ -static void -e_card_list_iterator_init (ECardListIterator *card) -{ -} - -ECardIterator * -e_card_list_iterator_new (ECardList *list) -{ - ECardListIterator *iterator = gtk_type_new(e_card_list_iterator_get_type()); - - iterator->list = list; - gtk_object_ref(GTK_OBJECT(list)); - iterator->iterator = list->list; - - return E_CARD_ITERATOR(iterator); -} - -/* - * Virtual functions: - */ -static void -e_card_list_iterator_destroy (GtkObject *object) -{ - ECardListIterator *iterator = E_CARD_LIST_ITERATOR(object); - e_card_list_remove_iterator(iterator->list, E_CARD_ITERATOR(iterator)); - gtk_object_unref(GTK_OBJECT(iterator->list)); -} - -static const void * -e_card_list_iterator_get (ECardIterator *_iterator) -{ - ECardListIterator *iterator = E_CARD_LIST_ITERATOR(_iterator); - if (iterator->iterator) - return iterator->iterator->data; - else - return NULL; -} - -static void -e_card_list_iterator_reset (ECardIterator *_iterator) -{ - ECardListIterator *iterator = E_CARD_LIST_ITERATOR(_iterator); - iterator->iterator = iterator->list->list; -} - -static gboolean -e_card_list_iterator_next (ECardIterator *_iterator) -{ - ECardListIterator *iterator = E_CARD_LIST_ITERATOR(_iterator); - if (iterator->iterator) - iterator->iterator = g_list_next(iterator->iterator); - return (iterator->iterator != NULL); -} - -static gboolean -e_card_list_iterator_prev (ECardIterator *_iterator) -{ - ECardListIterator *iterator = E_CARD_LIST_ITERATOR(_iterator); - if (iterator->iterator) - iterator->iterator = g_list_previous(iterator->iterator); - return (iterator->iterator != NULL); -} - -static void -e_card_list_iterator_delete (ECardIterator *_iterator) -{ - ECardListIterator *iterator = E_CARD_LIST_ITERATOR(_iterator); - if (iterator->iterator) { - GList *temp = iterator->iterator->next; - if (iterator->list->free) - iterator->list->free(iterator->iterator->data, iterator->list->closure); - iterator->list->list = g_list_remove_link(iterator->list->list, iterator->iterator); - iterator->iterator = temp; - e_card_list_invalidate_iterators(iterator->list, E_CARD_ITERATOR(iterator)); - } -} - -static void -e_card_list_iterator_set (ECardIterator *_iterator, - const void *object) -{ - ECardListIterator *iterator = E_CARD_LIST_ITERATOR(_iterator); - if (iterator->iterator) { - if (iterator->list->free) - iterator->list->free(iterator->iterator->data, iterator->list->closure); - if (iterator->list->copy) - iterator->iterator->data = iterator->list->copy(object, iterator->list->closure); - else - iterator->iterator->data = (void *) object; - } -} - -static gboolean -e_card_list_iterator_is_valid (ECardIterator *_iterator) -{ - ECardListIterator *iterator = E_CARD_LIST_ITERATOR(_iterator); - return iterator->iterator != NULL; -} - -static void -e_card_list_iterator_invalidate (ECardIterator *_iterator) -{ - ECardListIterator *iterator = E_CARD_LIST_ITERATOR(_iterator); - iterator->iterator = NULL; -} diff --git a/addressbook/backend/ebook/e-card-list-iterator.h b/addressbook/backend/ebook/e-card-list-iterator.h deleted file mode 100644 index 38a7d77f21..0000000000 --- a/addressbook/backend/ebook/e-card-list-iterator.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. - * Copyright (C) 1999 The Free Software Foundation - */ - -#ifndef __E_CARD_LIST_ITERATOR_H__ -#define __E_CARD_LIST_ITERATOR_H__ - -#include <time.h> -#include <gtk/gtk.h> -#include <stdio.h> -#include <ebook/e-card-iterator.h> -#include <ebook/e-card-list.h> - -#define E_TYPE_CARD_LIST_ITERATOR (e_card_list_iterator_get_type ()) -#define E_CARD_LIST_ITERATOR(obj) (GTK_CHECK_CAST ((obj), E_TYPE_CARD_LIST_ITERATOR, ECardListIterator)) -#define E_CARD_LIST_ITERATOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_CARD_LIST_ITERATOR, ECardListIteratorClass)) -#define E_IS_CARD_LIST_ITERATOR(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_CARD_LIST_ITERATOR)) -#define E_IS_CARD_LIST_ITERATOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_CARD_LIST_ITERATOR)) - -typedef struct _ECardListIterator ECardListIterator; -typedef struct _ECardListIteratorClass ECardListIteratorClass; - -struct _ECardListIterator { - ECardIterator parent; - - ECardList *list; - GList *iterator; -}; - -struct _ECardListIteratorClass { - ECardIteratorClass parent_class; -}; - -ECardIterator *e_card_list_iterator_new (ECardList *list); - -/* Standard Gtk function */ -GtkType e_card_list_iterator_get_type (void); - -#endif /* ! __E_CARD_LIST_ITERATOR_H__ */ diff --git a/addressbook/backend/ebook/e-card-list.c b/addressbook/backend/ebook/e-card-list.c deleted file mode 100644 index e912de7b6e..0000000000 --- a/addressbook/backend/ebook/e-card-list.c +++ /dev/null @@ -1,140 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Christopher James Lahey <clahey@umich.edu> - * - * Copyright (C) 2000 Helix Code, Inc. - * Copyright (C) 1999 The Free Software Foundation - */ - -#include <config.h> -#include <gtk/gtk.h> - -#include "e-card-list.h" -#include "e-card-list-iterator.h" - -#define ECL_CLASS(object) (E_CARD_LIST_CLASS(GTK_OBJECT((object))->klass)) - -static void e_card_list_init (ECardList *card); -static void e_card_list_class_init (ECardListClass *klass); -static void e_card_list_destroy (GtkObject *object); - -#define PARENT_TYPE (gtk_object_get_type ()) - -static GtkObjectClass *parent_class; - -/** - * e_card_list_get_type: - * @void: - * - * Registers the &ECardList class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &ECardList class. - **/ -GtkType -e_card_list_get_type (void) -{ - static GtkType type = 0; - - if (!type) { - GtkTypeInfo info = { - "ECardList", - sizeof (ECardList), - sizeof (ECardListClass), - (GtkClassInitFunc) e_card_list_class_init, - (GtkObjectInitFunc) e_card_list_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -static void -e_card_list_class_init (ECardListClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS(klass); - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = e_card_list_destroy; -} - -/** - * e_card_list_init: - */ -static void -e_card_list_init (ECardList *list) -{ - list->list = NULL; - list->iterators = NULL; -} - -ECardList * -e_card_list_new (ECardListCopyFunc copy, ECardListFreeFunc free, void *closure) -{ - ECardList *list = gtk_type_new(e_card_list_get_type()); - list->copy = copy; - list->free = free; - list->closure = closure; - return list; -} - -ECardIterator * -e_card_list_get_iterator (ECardList *list) -{ - ECardIterator *iterator = e_card_list_iterator_new(list); - list->iterators = g_list_append(list->iterators, iterator); - return iterator; -} - -int -e_card_list_length (ECardList *list) -{ - return g_list_length(list->list); -} - -void -e_card_list_append (ECardList *list, const void *data) -{ - e_card_list_invalidate_iterators(list, NULL); - if (list->copy) - list->list = g_list_append(list->list, list->copy(data, list->closure)); - else - list->list = g_list_append(list->list, (void *) data); -} - -void -e_card_list_invalidate_iterators (ECardList *list, ECardIterator *skip) -{ - GList *iterators = list->iterators; - for (; iterators; iterators = iterators->next) { - if (iterators->data != skip) { - e_card_iterator_invalidate(E_CARD_ITERATOR(iterators->data)); - } - } -} - -void -e_card_list_remove_iterator (ECardList *list, ECardIterator *iterator) -{ - list->iterators = g_list_remove(list->iterators, iterator); -} - -/* - * Virtual functions - */ -static void -e_card_list_destroy (GtkObject *object) -{ - ECardList *list = E_CARD_LIST(object); - g_list_foreach(list->list, (GFunc) list->free, list->closure); - g_list_free(list->list); -} diff --git a/addressbook/backend/ebook/e-card-list.h b/addressbook/backend/ebook/e-card-list.h deleted file mode 100644 index af791a81a0..0000000000 --- a/addressbook/backend/ebook/e-card-list.h +++ /dev/null @@ -1,60 +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. - * Copyright (C) 1999 The Free Software Foundation - */ - -#ifndef __E_CARD_LIST_H__ -#define __E_CARD_LIST_H__ - -#include <time.h> -#include <gtk/gtk.h> -#include <stdio.h> -#include <addressbook/backend/ebook/e-card-iterator.h> - -#define E_TYPE_CARD_LIST (e_card_list_get_type ()) -#define E_CARD_LIST(obj) (GTK_CHECK_CAST ((obj), E_TYPE_CARD_LIST, ECardList)) -#define E_CARD_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_CARD_LIST, ECardListClass)) -#define E_IS_CARD_LIST(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_CARD_LIST)) -#define E_IS_CARD_LIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_CARD_LIST)) - -typedef void *(*ECardListCopyFunc) (const void *data, void *closure); -typedef void (*ECardListFreeFunc) (void *data, void *closure); - -typedef struct _ECardList ECardList; -typedef struct _ECardListClass ECardListClass; - -struct _ECardList { - GtkObject object; - GList *list; - GList *iterators; - ECardListCopyFunc copy; - ECardListFreeFunc free; - void *closure; -}; - -struct _ECardListClass { - GtkObjectClass parent_class; -}; - -ECardList *e_card_list_new (ECardListCopyFunc copy, - ECardListFreeFunc free, - void *closure); -ECardIterator *e_card_list_get_iterator (ECardList *list); -void e_card_list_append (ECardList *list, - const void *data); -int e_card_list_length (ECardList *list); - -/* For iterators to call. */ -void e_card_list_invalidate_iterators (ECardList *list, - ECardIterator *skip); -void e_card_list_remove_iterator (ECardList *list, - ECardIterator *iterator); - -/* Standard Gtk function */ -GtkType e_card_list_get_type (void); - -#endif /* ! __E_CARD_LIST_H__ */ diff --git a/addressbook/backend/ebook/e-card-simple.c b/addressbook/backend/ebook/e-card-simple.c index 8d2a0f44b4..cc3ff416ce 100644 --- a/addressbook/backend/ebook/e-card-simple.c +++ b/addressbook/backend/ebook/e-card-simple.c @@ -637,15 +637,15 @@ fill_in_info(ECardSimple *simple) { ECard *card = simple->card; if (card) { - ECardList *address_list; - ECardList *phone_list; - ECardList *email_list; + EList *address_list; + EList *phone_list; + EList *email_list; const ECardPhone *phone; const char *email; const ECardAddrLabel *address; int i; - ECardIterator *iterator; + EIterator *iterator; gtk_object_get(GTK_OBJECT(card), "address_label", &address_list, @@ -656,8 +656,8 @@ fill_in_info(ECardSimple *simple) e_card_phone_free(simple->phone[i]); simple->phone[i] = NULL; } - for (iterator = e_card_list_get_iterator(phone_list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) { - phone = e_card_iterator_get(iterator); + for (iterator = e_list_get_iterator(phone_list); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { + phone = e_iterator_get(iterator); for (i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i ++) { if (((phone->flags & phone_correspondences[i]) == phone_correspondences[i]) && (simple->phone[i] == NULL)) { simple->phone[i] = e_card_phone_copy(phone); @@ -671,8 +671,8 @@ fill_in_info(ECardSimple *simple) g_free(simple->email[i]); simple->email[i] = NULL; } - for (iterator = e_card_list_get_iterator(email_list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) { - email = e_card_iterator_get(iterator); + for (iterator = e_list_get_iterator(email_list); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { + email = e_iterator_get(iterator); for (i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i ++) { if ((simple->email[i] == NULL)) { simple->email[i] = g_strdup(email); @@ -686,8 +686,8 @@ fill_in_info(ECardSimple *simple) e_card_address_label_free(simple->address[i]); simple->address[i] = NULL; } - for (iterator = e_card_list_get_iterator(address_list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) { - address = e_card_iterator_get(iterator); + for (iterator = e_list_get_iterator(address_list); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { + address = e_iterator_get(iterator); for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i ++) { if (((address->flags & addr_correspondences[i]) == addr_correspondences[i]) && (simple->address[i] == NULL)) { simple->address[i] = e_card_address_label_copy(address); @@ -704,16 +704,16 @@ e_card_simple_sync_card(ECardSimple *simple) { ECard *card = simple->card; if (card) { - ECardList *address_list; - ECardList *phone_list; - ECardList *email_list; + EList *address_list; + EList *phone_list; + EList *email_list; const ECardPhone *phone; const ECardAddrLabel *address; const char *email; int i; int iterator_next = 1; - ECardIterator *iterator; + EIterator *iterator; gtk_object_get(GTK_OBJECT(card), "address_label", &address_list, @@ -721,18 +721,18 @@ e_card_simple_sync_card(ECardSimple *simple) "email", &email_list, NULL); - for (iterator = e_card_list_get_iterator(phone_list); e_card_iterator_is_valid(iterator); iterator_next ? e_card_iterator_next(iterator) : FALSE ) { + for (iterator = e_list_get_iterator(phone_list); e_iterator_is_valid(iterator); iterator_next ? e_iterator_next(iterator) : FALSE ) { int i; - phone = e_card_iterator_get(iterator); + phone = e_iterator_get(iterator); iterator_next = 1; for (i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i ++) { if ((phone->flags & phone_correspondences[i]) == phone_correspondences[i]) { if (simple->phone[i]) { simple->phone[i]->flags = phone_correspondences[i]; if (simple->phone[i]->number && *simple->phone[i]->number) { - e_card_iterator_set(iterator, simple->phone[i]); + e_iterator_set(iterator, simple->phone[i]); } else { - e_card_iterator_delete(iterator); + e_iterator_delete(iterator); iterator_next = 0; } e_card_phone_free(simple->phone[i]); @@ -746,22 +746,22 @@ e_card_simple_sync_card(ECardSimple *simple) for (i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i ++) { if (simple->phone[i]) { simple->phone[i]->flags = phone_correspondences[i]; - e_card_list_append(phone_list, simple->phone[i]); + e_list_append(phone_list, simple->phone[i]); e_card_phone_free(simple->phone[i]); simple->phone[i] = NULL; } } - for (iterator = e_card_list_get_iterator(email_list); e_card_iterator_is_valid(iterator); iterator_next ? e_card_iterator_next(iterator) : FALSE ) { + for (iterator = e_list_get_iterator(email_list); e_iterator_is_valid(iterator); iterator_next ? e_iterator_next(iterator) : FALSE ) { int i; - email = e_card_iterator_get(iterator); + email = e_iterator_get(iterator); iterator_next = 1; for (i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i ++) { if (simple->email[i]) { if (*simple->email[i]) { - e_card_iterator_set(iterator, simple->email[i]); + e_iterator_set(iterator, simple->email[i]); } else { - e_card_iterator_delete(iterator); + e_iterator_delete(iterator); iterator_next = 0; } g_free(simple->email[i]); @@ -773,24 +773,24 @@ e_card_simple_sync_card(ECardSimple *simple) gtk_object_unref(GTK_OBJECT(iterator)); for (i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i ++) { if (simple->email[i]) { - e_card_list_append(email_list, simple->email[i]); + e_list_append(email_list, simple->email[i]); g_free(simple->email[i]); simple->email[i] = NULL; } } - for (iterator = e_card_list_get_iterator(address_list); e_card_iterator_is_valid(iterator); iterator_next ? e_card_iterator_next(iterator) : FALSE ) { + for (iterator = e_list_get_iterator(address_list); e_iterator_is_valid(iterator); iterator_next ? e_iterator_next(iterator) : FALSE ) { int i; - address = e_card_iterator_get(iterator); + address = e_iterator_get(iterator); iterator_next = 1; for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i ++) { if ((address->flags & addr_correspondences[i]) == addr_correspondences[i]) { if (simple->address[i]) { simple->address[i]->flags = addr_correspondences[i]; if (simple->address[i]->data && *simple->address[i]->data) { - e_card_iterator_set(iterator, simple->address[i]); + e_iterator_set(iterator, simple->address[i]); } else { - e_card_iterator_delete(iterator); + e_iterator_delete(iterator); iterator_next = 0; } e_card_address_label_free(simple->address[i]); @@ -804,7 +804,7 @@ e_card_simple_sync_card(ECardSimple *simple) for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i ++) { if (simple->address[i]) { simple->address[i]->flags = addr_correspondences[i]; - e_card_list_append(address_list, simple->address[i]); + e_list_append(address_list, simple->address[i]); e_card_address_label_free(simple->address[i]); simple->address[i] = NULL; } @@ -1118,13 +1118,13 @@ void e_card_simple_arbitrary_foreach (ECardSimple gpointer closure) { if (simple->card) { - ECardList *list; - ECardIterator *iterator; + EList *list; + EIterator *iterator; gtk_object_get(GTK_OBJECT(simple->card), "arbitrary", &list, NULL); - for (iterator = e_card_list_get_iterator(list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) { - const ECardArbitrary *arbitrary = e_card_iterator_get(iterator); + for (iterator = e_list_get_iterator(list); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { + const ECardArbitrary *arbitrary = e_iterator_get(iterator); if (callback) (*callback) (arbitrary, closure); } @@ -1135,13 +1135,13 @@ const ECardArbitrary *e_card_simple_get_arbitrary (ECardSimple *sim const char *key) { if (simple->card) { - ECardList *list; - ECardIterator *iterator; + EList *list; + EIterator *iterator; gtk_object_get(GTK_OBJECT(simple->card), "arbitrary", &list, NULL); - for (iterator = e_card_list_get_iterator(list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) { - const ECardArbitrary *arbitrary = e_card_iterator_get(iterator); + for (iterator = e_list_get_iterator(list); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { + const ECardArbitrary *arbitrary = e_iterator_get(iterator); if (!strcasecmp(arbitrary->key, key)) return arbitrary; } @@ -1157,19 +1157,19 @@ void e_card_simple_set_arbitrary (ECardSimple *sim { if (simple->card) { ECardArbitrary *new_arb; - ECardList *list; - ECardIterator *iterator; + EList *list; + EIterator *iterator; gtk_object_get(GTK_OBJECT(simple->card), "arbitrary", &list, NULL); - for (iterator = e_card_list_get_iterator(list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) { - const ECardArbitrary *arbitrary = e_card_iterator_get(iterator); + for (iterator = e_list_get_iterator(list); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { + const ECardArbitrary *arbitrary = e_iterator_get(iterator); if (!strcasecmp(arbitrary->key, key)) { new_arb = e_card_arbitrary_new(); new_arb->key = g_strdup(key); new_arb->type = g_strdup(type); new_arb->value = g_strdup(value); - e_card_iterator_set(iterator, new_arb); + e_iterator_set(iterator, new_arb); e_card_arbitrary_free(new_arb); return; } @@ -1178,7 +1178,7 @@ void e_card_simple_set_arbitrary (ECardSimple *sim new_arb->key = g_strdup(key); new_arb->type = g_strdup(type); new_arb->value = g_strdup(value); - e_card_list_append(list, new_arb); + e_list_append(list, new_arb); e_card_arbitrary_free(new_arb); } } diff --git a/addressbook/backend/ebook/e-card-simple.h b/addressbook/backend/ebook/e-card-simple.h index 72351c571a..7e2be4b728 100644 --- a/addressbook/backend/ebook/e-card-simple.h +++ b/addressbook/backend/ebook/e-card-simple.h @@ -17,7 +17,7 @@ #include <stdio.h> #include <addressbook/backend/ebook/e-card.h> #include <addressbook/backend/ebook/e-card-types.h> -#include <addressbook/backend/ebook/e-card-list.h> +#include <e-util/e-list.h> #define E_TYPE_CARD_SIMPLE (e_card_simple_get_type ()) #define E_CARD_SIMPLE(obj) (GTK_CHECK_CAST ((obj), E_TYPE_CARD_SIMPLE, ECardSimple)) diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c index b07723073f..637f3a0eb9 100644 --- a/addressbook/backend/ebook/e-card.c +++ b/addressbook/backend/ebook/e-card.c @@ -266,10 +266,10 @@ char if ( card->address ) { - ECardIterator *iterator = e_card_list_get_iterator(card->address); - for ( ; e_card_iterator_is_valid(iterator) ;e_card_iterator_next(iterator) ) { + EIterator *iterator = e_list_get_iterator(card->address); + for ( ; e_iterator_is_valid(iterator) ;e_iterator_next(iterator) ) { VObject *addressprop; - ECardDeliveryAddress *address = (ECardDeliveryAddress *) e_card_iterator_get(iterator); + ECardDeliveryAddress *address = (ECardDeliveryAddress *) e_iterator_get(iterator); addressprop = addProp(vobj, VCAdrProp); set_address_flags (addressprop, address->flags); @@ -292,10 +292,10 @@ char } if ( card->address_label ) { - ECardIterator *iterator = e_card_list_get_iterator(card->address_label); - for ( ; e_card_iterator_is_valid(iterator) ;e_card_iterator_next(iterator) ) { + EIterator *iterator = e_list_get_iterator(card->address_label); + for ( ; e_iterator_is_valid(iterator) ;e_iterator_next(iterator) ) { VObject *labelprop; - ECardAddrLabel *address_label = (ECardAddrLabel *) e_card_iterator_get(iterator); + ECardAddrLabel *address_label = (ECardAddrLabel *) e_iterator_get(iterator); if (address_label->data) labelprop = addPropValue(vobj, VCDeliveryLabelProp, address_label->data); else @@ -308,10 +308,10 @@ char } if ( card->phone ) { - ECardIterator *iterator = e_card_list_get_iterator(card->phone); - for ( ; e_card_iterator_is_valid(iterator) ;e_card_iterator_next(iterator) ) { + EIterator *iterator = e_list_get_iterator(card->phone); + for ( ; e_iterator_is_valid(iterator) ;e_iterator_next(iterator) ) { VObject *phoneprop; - ECardPhone *phone = (ECardPhone *) e_card_iterator_get(iterator); + ECardPhone *phone = (ECardPhone *) e_iterator_get(iterator); phoneprop = addPropValue(vobj, VCTelephoneProp, phone->number); set_phone_flags (phoneprop, phone->flags); @@ -320,10 +320,10 @@ char } if ( card->email ) { - ECardIterator *iterator = e_card_list_get_iterator(card->email); - for ( ; e_card_iterator_is_valid(iterator) ;e_card_iterator_next(iterator) ) { + EIterator *iterator = e_list_get_iterator(card->email); + for ( ; e_iterator_is_valid(iterator) ;e_iterator_next(iterator) ) { VObject *emailprop; - emailprop = addPropValue(vobj, VCEmailAddressProp, (char *) e_card_iterator_get(iterator)); + emailprop = addPropValue(vobj, VCEmailAddressProp, (char *) e_iterator_get(iterator)); addProp (emailprop, VCInternetProp); } gtk_object_unref(GTK_OBJECT(iterator)); @@ -398,18 +398,18 @@ char addPropValue(vobj, VCNoteProp, card->note); if (card->categories) { - ECardIterator *iterator; + EIterator *iterator; int length = 0; char *string; char *stringptr; - for (iterator = e_card_list_get_iterator(card->categories); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) { - length += strlen(e_card_iterator_get(iterator)) + 1; + for (iterator = e_list_get_iterator(card->categories); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { + length += strlen(e_iterator_get(iterator)) + 1; } string = g_new(char, length + 1); stringptr = string; *stringptr = 0; - for (e_card_iterator_reset(iterator); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) { - strcpy(stringptr, e_card_iterator_get(iterator)); + for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { + strcpy(stringptr, e_iterator_get(iterator)); stringptr += strlen(stringptr); *stringptr = ','; stringptr++; @@ -424,9 +424,9 @@ char } if (card->arbitrary) { - ECardIterator *iterator; - for (iterator = e_card_list_get_iterator(card->arbitrary); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) { - const ECardArbitrary *arbitrary = e_card_iterator_get(iterator); + EIterator *iterator; + for (iterator = e_list_get_iterator(card->arbitrary); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { + const ECardArbitrary *arbitrary = e_iterator_get(iterator); VObject *arb_object; if (arbitrary->value) { arb_object = addPropValue (vobj, XEV_ARBITRARY, arbitrary->value); @@ -553,13 +553,13 @@ static void parse_email(ECard *card, VObject *vobj) { char *next_email; - ECardList *list; + EList *list; assign_string(vobj, &next_email); gtk_object_get(GTK_OBJECT(card), "email", &list, NULL); - e_card_list_append(list, next_email); + e_list_append(list, next_email); g_free (next_email); } @@ -580,7 +580,7 @@ static void parse_phone(ECard *card, VObject *vobj) { ECardPhone *next_phone = g_new(ECardPhone, 1); - ECardList *list; + EList *list; assign_string(vobj, &(next_phone->number)); next_phone->flags = get_phone_flags(vobj); @@ -588,7 +588,7 @@ parse_phone(ECard *card, VObject *vobj) gtk_object_get(GTK_OBJECT(card), "phone", &list, NULL); - e_card_list_append(list, next_phone); + e_list_append(list, next_phone); e_card_phone_free (next_phone); } @@ -596,7 +596,7 @@ static void parse_address(ECard *card, VObject *vobj) { ECardDeliveryAddress *next_addr = g_new(ECardDeliveryAddress, 1); - ECardList *list; + EList *list; next_addr->flags = get_address_flags (vobj); next_addr->po = e_v_object_get_child_value (vobj, VCPostalBoxProp); @@ -610,7 +610,7 @@ parse_address(ECard *card, VObject *vobj) gtk_object_get(GTK_OBJECT(card), "address", &list, NULL); - e_card_list_append(list, next_addr); + e_list_append(list, next_addr); e_card_delivery_address_free (next_addr); } @@ -618,7 +618,7 @@ static void parse_address_label(ECard *card, VObject *vobj) { ECardAddrLabel *next_addr = g_new(ECardAddrLabel, 1); - ECardList *list; + EList *list; next_addr->flags = get_address_flags (vobj); assign_string(vobj, &next_addr->data); @@ -626,7 +626,7 @@ parse_address_label(ECard *card, VObject *vobj) gtk_object_get(GTK_OBJECT(card), "address_label", &list, NULL); - e_card_list_append(list, next_addr); + e_list_append(list, next_addr); e_card_address_label_free (next_addr); } @@ -749,22 +749,22 @@ parse_note(ECard *card, VObject *vobj) } static void -add_list_unique(ECard *card, ECardList *list, char *string) +add_list_unique(ECard *card, EList *list, char *string) { char *temp = e_strdup_strip(string); - ECardIterator *iterator; + EIterator *iterator; if (!*temp) { g_free(temp); return; } - for ( iterator = e_card_list_get_iterator(list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) { - if (!strcmp(e_card_iterator_get(iterator), temp)) { + for ( iterator = e_list_get_iterator(list); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { + if (!strcmp(e_iterator_get(iterator), temp)) { break; } } - if (!e_card_iterator_is_valid(iterator)) { - e_card_list_append(list, temp); + if (!e_iterator_is_valid(iterator)) { + e_list_append(list, temp); } g_free(temp); gtk_object_unref(GTK_OBJECT(iterator)); @@ -776,7 +776,7 @@ do_parse_categories(ECard *card, char *str) int length = strlen(str); char *copy = g_new(char, length + 1); int i, j; - ECardList *list; + EList *list; gtk_object_get(GTK_OBJECT(card), "category_list", &list, NULL); @@ -836,7 +836,7 @@ parse_arbitrary(ECard *card, VObject *vobj) { ECardArbitrary *arbitrary = e_card_arbitrary_new(); VObjectIterator iterator; - ECardList *list; + EList *list; for ( initPropIterator (&iterator, vobj); moreIteration(&iterator); ) { VObject *temp = nextVObject(&iterator); const char *name = vObjectName(temp); @@ -854,7 +854,7 @@ parse_arbitrary(ECard *card, VObject *vobj) gtk_object_get(GTK_OBJECT(card), "arbitrary", &list, NULL); - e_card_list_append(list, arbitrary); + e_list_append(list, arbitrary); e_card_arbitrary_free(arbitrary); } @@ -1329,7 +1329,7 @@ e_card_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) case ARG_CATEGORY_LIST: if (card->categories) gtk_object_unref(GTK_OBJECT(card->categories)); - card->categories = E_CARD_LIST(GTK_VALUE_OBJECT(*arg)); + card->categories = E_LIST(GTK_VALUE_OBJECT(*arg)); if (card->categories) gtk_object_ref(GTK_OBJECT(card->categories)); break; @@ -1396,7 +1396,7 @@ e_card_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) case ARG_ARBITRARY: if (card->arbitrary) gtk_object_unref(GTK_OBJECT(card->arbitrary)); - card->arbitrary = E_CARD_LIST(GTK_VALUE_OBJECT(*arg)); + card->arbitrary = E_LIST(GTK_VALUE_OBJECT(*arg)); if (card->arbitrary) gtk_object_ref(GTK_OBJECT(card->arbitrary)); break; @@ -1429,29 +1429,29 @@ e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) break; case ARG_ADDRESS: if (!card->address) - card->address = e_card_list_new((ECardListCopyFunc) e_card_delivery_address_copy, - (ECardListFreeFunc) e_card_delivery_address_free, + card->address = e_list_new((EListCopyFunc) e_card_delivery_address_copy, + (EListFreeFunc) e_card_delivery_address_free, NULL); GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->address); break; case ARG_ADDRESS_LABEL: if (!card->address_label) - card->address_label = e_card_list_new((ECardListCopyFunc) e_card_address_label_copy, - (ECardListFreeFunc) e_card_address_label_free, + card->address_label = e_list_new((EListCopyFunc) e_card_address_label_copy, + (EListFreeFunc) e_card_address_label_free, NULL); GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->address_label); break; case ARG_PHONE: if (!card->phone) - card->phone = e_card_list_new((ECardListCopyFunc) e_card_phone_copy, - (ECardListFreeFunc) e_card_phone_free, + card->phone = e_list_new((EListCopyFunc) e_card_phone_copy, + (EListFreeFunc) e_card_phone_free, NULL); GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->phone); break; case ARG_EMAIL: if (!card->email) - card->email = e_card_list_new((ECardListCopyFunc) g_strdup, - (ECardListFreeFunc) g_free, + card->email = e_list_new((EListCopyFunc) g_strdup, + (EListFreeFunc) g_free, NULL); GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->email); break; @@ -1460,15 +1460,15 @@ e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) int i; char ** strs; int length; - ECardIterator *iterator; + EIterator *iterator; if (!card->categories) - card->categories = e_card_list_new((ECardListCopyFunc) g_strdup, - (ECardListFreeFunc) g_free, + card->categories = e_list_new((EListCopyFunc) g_strdup, + (EListFreeFunc) g_free, NULL); - length = e_card_list_length(card->categories); + length = e_list_length(card->categories); strs = g_new(char *, length + 1); - for (iterator = e_card_list_get_iterator(card->categories), i = 0; e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator), i++) { - strs[i] = (char *)e_card_iterator_get(iterator); + for (iterator = e_list_get_iterator(card->categories), i = 0; e_iterator_is_valid(iterator); e_iterator_next(iterator), i++) { + strs[i] = (char *)e_iterator_get(iterator); } strs[i] = 0; GTK_VALUE_STRING(*arg) = g_strjoinv(", ", strs); @@ -1477,8 +1477,8 @@ e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) break; case ARG_CATEGORY_LIST: if (!card->categories) - card->categories = e_card_list_new((ECardListCopyFunc) g_strdup, - (ECardListFreeFunc) g_free, + card->categories = e_list_new((EListCopyFunc) g_strdup, + (EListFreeFunc) g_free, NULL); GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->categories); break; @@ -1529,8 +1529,8 @@ e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) break; case ARG_ARBITRARY: if (!card->arbitrary) - card->arbitrary = e_card_list_new((ECardListCopyFunc) e_card_arbitrary_copy, - (ECardListFreeFunc) e_card_arbitrary_free, + card->arbitrary = e_list_new((EListCopyFunc) e_card_arbitrary_copy, + (EListFreeFunc) e_card_arbitrary_free, NULL); GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->arbitrary); diff --git a/addressbook/backend/ebook/e-card.h b/addressbook/backend/ebook/e-card.h index 3def0654cd..2f71edaab4 100644 --- a/addressbook/backend/ebook/e-card.h +++ b/addressbook/backend/ebook/e-card.h @@ -16,7 +16,7 @@ #include <gtk/gtk.h> #include <stdio.h> #include <addressbook/backend/ebook/e-card-types.h> -#include <addressbook/backend/ebook/e-card-list.h> +#include <e-util/e-list.h> #define E_TYPE_CARD (e_card_get_type ()) #define E_CARD(obj) (GTK_CHECK_CAST ((obj), E_TYPE_CARD, ECard)) @@ -34,12 +34,12 @@ struct _ECard { char *file_as; /* The File As field. */ char *fname; /* The full name. */ ECardName *name; /* The structured name. */ - ECardList *address; /* Delivery addresses (ECardDeliveryAddress *) */ - ECardList *address_label; /* Delivery address labels + EList *address; /* Delivery addresses (ECardDeliveryAddress *) */ + EList *address_label; /* Delivery address labels * (ECardAddrLabel *) */ - ECardList *phone; /* Phone numbers (ECardPhone *) */ - ECardList *email; /* Email addresses (char *) */ + EList *phone; /* Phone numbers (ECardPhone *) */ + EList *email; /* Email addresses (char *) */ char *url; /* The person's web page. */ ECardDate *bday; /* The person's birthday. */ @@ -65,9 +65,9 @@ struct _ECard { char *fburl; /* Free Busy URL */ - ECardList *categories; /* Categories. */ + EList *categories; /* Categories. */ - ECardList *arbitrary; /* Arbitrary fields. */ + EList *arbitrary; /* Arbitrary fields. */ #if 0 ECardPhoto *logo; /* This person's org's logo. */ @@ -90,7 +90,7 @@ struct _ECard { ECardRev *rev; /* The time this card was last modified. */ - ECardList xtension; + EList xtension; #endif }; diff --git a/addressbook/backend/ebook/load-pine-addressbook.c b/addressbook/backend/ebook/load-pine-addressbook.c index 8837a11a9a..1bf85cb1a6 100644 --- a/addressbook/backend/ebook/load-pine-addressbook.c +++ b/addressbook/backend/ebook/load-pine-addressbook.c @@ -61,7 +61,7 @@ book_open_cb (EBook *book, EBookStatus status, gpointer closure) char **strings; ECardName *name; ECard *card; - ECardList *list; + EList *list; if (line[length - 1] == '\n') line[--length] = 0; @@ -76,7 +76,7 @@ book_open_cb (EBook *book, EBookStatus status, gpointer closure) gtk_object_get(GTK_OBJECT(card), "email", &list, NULL); - e_card_list_append(list, strings[2]); + e_list_append(list, strings[2]); g_strfreev(strings); e_book_add_card(book, card, add_card_cb, card); } diff --git a/addressbook/backend/ebook/test-card.c b/addressbook/backend/ebook/test-card.c index c6ee6e9ff1..a727dae7a3 100644 --- a/addressbook/backend/ebook/test-card.c +++ b/addressbook/backend/ebook/test-card.c @@ -73,10 +73,10 @@ main (int argc, char **argv) char *nickname; char *fburl; ECardName *name; - ECardList *address; - ECardList *phone; - ECardList *email; - ECardIterator *iterator; + EList *address; + EList *phone; + EList *email; + EIterator *iterator; ECardDate *bday; gnome_init ("TestCard", "0.0", argc, argv); @@ -151,24 +151,24 @@ main (int argc, char **argv) printf("BDay : %4d-%02d-%02d\n", bday->year, bday->month, bday->day); } if ( email ) { - iterator = e_card_list_get_iterator(address); - for (; e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) { - printf("Email : %s\n", (char *) e_card_iterator_get(iterator)); + iterator = e_list_get_iterator(address); + for (; e_iterator_is_valid(iterator); e_iterator_next(iterator)) { + printf("Email : %s\n", (char *) e_iterator_get(iterator)); } gtk_object_unref(GTK_OBJECT(iterator)); } if ( phone ) { - iterator = e_card_list_get_iterator(address); - for (; e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) { - ECardPhone *e_card_phone = (ECardPhone *) e_card_iterator_get(iterator); + iterator = e_list_get_iterator(address); + for (; e_iterator_is_valid(iterator); e_iterator_next(iterator)) { + ECardPhone *e_card_phone = (ECardPhone *) e_iterator_get(iterator); printf("Phone ; %d : %s\n", e_card_phone->flags, e_card_phone->number); } gtk_object_unref(GTK_OBJECT(iterator)); } if ( address ) { - iterator = e_card_list_get_iterator(address); - for (; e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) { - ECardDeliveryAddress *del_address = (ECardDeliveryAddress *) e_card_iterator_get(iterator); + iterator = e_list_get_iterator(address); + for (; e_iterator_is_valid(iterator); e_iterator_next(iterator)) { + ECardDeliveryAddress *del_address = (ECardDeliveryAddress *) e_iterator_get(iterator); printf("Address ; %d:\n", del_address->flags); if ( del_address->po ) printf(" Po : %s\n", del_address->po); diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c index f76a92c38c..c9befc7bb1 100644 --- a/addressbook/backend/pas/pas-backend-file.c +++ b/addressbook/backend/pas/pas-backend-file.c @@ -159,23 +159,23 @@ static gboolean compare_email (ECard *ecard, const char *str, char *(*compare)(const char*, const char*)) { - ECardList *prop_list; - ECardIterator *iter; + EList *prop_list; + EIterator *iter; gboolean truth = FALSE; gtk_object_get(GTK_OBJECT(ecard), "email", &prop_list, NULL); - iter = e_card_list_get_iterator(prop_list); + iter = e_list_get_iterator(prop_list); - while (e_card_iterator_is_valid(iter)) { + while (e_iterator_is_valid(iter)) { - if (compare((char*)e_card_iterator_get(iter), str)) { + if (compare((char*)e_iterator_get(iter), str)) { truth = TRUE; break; } else { - e_card_iterator_next(iter); + e_iterator_next(iter); } } @@ -188,23 +188,23 @@ static gboolean compare_phone (ECard *ecard, const char *str, char *(*compare)(const char*, const char*)) { - ECardList *prop_list; - ECardIterator *iter; + EList *prop_list; + EIterator *iter; gboolean truth = FALSE; gtk_object_get(GTK_OBJECT(ecard), "phone", &prop_list, NULL); - iter = e_card_list_get_iterator(prop_list); + iter = e_list_get_iterator(prop_list); - while (e_card_iterator_is_valid(iter)) { - ECardPhone *phone = (ECardPhone*)e_card_iterator_get(iter); + while (e_iterator_is_valid(iter)) { + ECardPhone *phone = (ECardPhone*)e_iterator_get(iter); if (compare(phone->number, str)) { truth = TRUE; break; } else { - e_card_iterator_next(iter); + e_iterator_next(iter); } } diff --git a/addressbook/contact-editor/e-contact-editor.c b/addressbook/contact-editor/e-contact-editor.c index 17a6c52119..cedd798edf 100644 --- a/addressbook/contact-editor/e-contact-editor.c +++ b/addressbook/contact-editor/e-contact-editor.c @@ -28,6 +28,7 @@ #include <gdk-pixbuf/gdk-pixbuf.h> #include <gdk-pixbuf/gnome-canvas-pixbuf.h> #include <e-util/e-gui-utils.h> +#include <e-contact-save-as.h> /* Signal IDs */ enum { diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am index ade764904b..f4776e3dd1 100644 --- a/addressbook/gui/component/Makefile.am +++ b/addressbook/gui/component/Makefile.am @@ -1,3 +1,5 @@ +SUBDIRS = select-names + CPPFLAGS = \ -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" @@ -26,21 +28,20 @@ bin_PROGRAMS = \ evolution-addressbook evolution_addressbook_SOURCES = \ - e-ldap-server-dialog.c \ - e-ldap-server-dialog.h \ - e-addressbook-model.c \ - e-addressbook-model.h \ - e-cardlist-model.c \ - e-cardlist-model.h \ - e-select-names.c \ - e-select-names.h \ addressbook-component.c \ addressbook-component.h \ addressbook-factory.c \ addressbook.c \ - addressbook.h + addressbook.h \ + e-addressbook-model.c \ + e-addressbook-model.h \ + e-cardlist-model.c \ + e-cardlist-model.h \ + e-ldap-server-dialog.c \ + e-ldap-server-dialog.h evolution_addressbook_LDADD = \ + select-names/libeselectnames.la \ $(top_builddir)/shell/libeshell.a \ $(EXTRA_GNOME_LIBS) \ $(BONOBO_HTML_GNOME_LIBS) \ @@ -66,14 +67,13 @@ gnorba_DATA = addressbook.gnorba endif gladedir = $(datadir)/evolution/glade -glade_DATA = ldap-server-dialog.glade ldap-server-dialog.glade.h alphabet.glade select-names.glade +glade_DATA = ldap-server-dialog.glade ldap-server-dialog.glade.h alphabet.glade EXTRA_DIST = \ $(glade_DATA) \ addressbook.gnorba \ addressbook.oafinfo \ - alphabet.glade.h \ - select-names.glade.h + alphabet.glade.h if ENABLE_PURIFY PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index c080e35e5e..710a3b756d 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -26,7 +26,7 @@ #include <e-cell-text.h> #include <e-addressbook-model.h> -#include <e-select-names.h> +#include <select-names/e-select-names.h> #include "e-contact-editor.h" #include "e-contact-save-as.h" #include "e-ldap-server-dialog.h" diff --git a/addressbook/gui/component/select-names/.cvsignore b/addressbook/gui/component/select-names/.cvsignore new file mode 100644 index 0000000000..d6c55c7345 --- /dev/null +++ b/addressbook/gui/component/select-names/.cvsignore @@ -0,0 +1,7 @@ +.deps +.libs +.pure +Makefile +Makefile.in +*.lo +*.la diff --git a/addressbook/gui/component/select-names/Makefile.am b/addressbook/gui/component/select-names/Makefile.am new file mode 100644 index 0000000000..4a1bbc4741 --- /dev/null +++ b/addressbook/gui/component/select-names/Makefile.am @@ -0,0 +1,48 @@ +CPPFLAGS = \ + -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" + +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/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=\""$(datadir)/locale"\" \ + -DCAMEL_PROVIDERDIR=\""$(providerdir)"\" + +lib_LTLIBRARIES = libeselectnames.la + +libeselectnames_la_SOURCES = \ + e-select-names-entry.c \ + e-select-names-entry.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 + diff --git a/addressbook/gui/component/select-names/e-select-names-manager.c b/addressbook/gui/component/select-names/e-select-names-manager.c index 28981cf018..01b94057d6 100644 --- a/addressbook/gui/component/select-names/e-select-names-manager.c +++ b/addressbook/gui/component/select-names/e-select-names-manager.c @@ -13,6 +13,10 @@ #include <gtk/gtk.h> #include "e-select-names-manager.h" +#include "e-select-names-entry.h" +#include "e-select-names-model.h" +#include "e-select-names-text-model.h" +#include "widgets/e-text/e-entry.h" /* Object argument IDs */ enum { @@ -21,6 +25,12 @@ enum { }; +typedef struct { + char *id; + char *title; + ESelectNamesModel *model; +} ESelectNamesManagerSection; + static void e_select_names_manager_init (ESelectNamesManager *manager); static void e_select_names_manager_class_init (ESelectNamesManagerClass *klass); @@ -28,8 +38,6 @@ 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); -static void fill_in_info(ESelectNamesManager *manager); - /** * e_select_names_manager_get_type: * @void: @@ -98,9 +106,10 @@ static void e_select_names_manager_destroy (GtkObject *object) { ESelectNamesManager *manager; - int i; manager = E_SELECT_NAMES_MANAGER (object); + + gtk_object_unref(GTK_OBJECT(manager->sections)); } @@ -114,7 +123,6 @@ e_select_names_manager_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) switch (arg_id) { case ARG_CARD: - fill_in_info(manager); break; default: return; @@ -131,11 +139,6 @@ e_select_names_manager_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) switch (arg_id) { case ARG_CARD: - e_select_names_manager_sync_card(manager); - if (manager->card) - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(manager->card); - else - GTK_VALUE_OBJECT (*arg) = NULL; break; default: arg->type = GTK_TYPE_INVALID; @@ -143,6 +146,26 @@ e_select_names_manager_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) } } +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); + return newsec; +} + +static void +section_free(void *sec, void *data) +{ + ESelectNamesManagerSection *section = sec; + g_free(section->id); + g_free(section->title); + g_free(section); +} /** * e_select_names_manager_init: @@ -150,22 +173,51 @@ e_select_names_manager_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) static void e_select_names_manager_init (ESelectNamesManager *manager) { + manager->sections = e_list_new(section_copy, section_free, manager); } -static void -fill_in_info(ESelectNamesManager *manager) +void e_select_names_manager_add_section (ESelectNamesManager *manager, + char *id, + char *title) { - ECard *card = manager->card; - if (card) { + ESelectNamesManagerSection *section; + + section = g_new(ESelectNamesManagerSection, 1); + section->id = g_strdup(id); + section->title = g_strdup(title); + e_list_append(manager->sections, section); + section_free(section, manager); +} +GtkWidget *e_select_names_manager_create_entry (ESelectNamesManager *manager, + char *id) +{ + GtkWidget *entry; + ETextModel *model; + EIterator *iterator; + iterator = e_list_get_iterator(manager->sections); + for (; e_iterator_is_valid(iterator); e_iterator_next(iterator)) { + const ESelectNamesManagerSection *section = e_iterator_get(iterator); + if (!strcmp(section->id, id)) { + entry = GTK_WIDGET(e_entry_new()); + model = e_select_names_text_model_new(section->model); + gtk_object_set(GTK_OBJECT(entry), + "model", model, + NULL); + return entry; + } } + return NULL; } -void -e_select_names_manager_sync_card(ESelectNamesManager *manager) +void e_select_names_manager_activate_dialog (ESelectNamesManager *manager, + char *id) { - ECard *card = manager->card; - if (card) { - fill_in_info(manager); - } +} + +/* Of type ECard */ +EList *e_select_names_manager_get_cards (ESelectNamesManager *manager, + char *id) +{ + 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 index 5aba1d3295..600644f01a 100644 --- a/addressbook/gui/component/select-names/e-select-names-manager.h +++ b/addressbook/gui/component/select-names/e-select-names-manager.h @@ -12,6 +12,7 @@ #include <time.h> #include <gtk/gtk.h> #include <stdio.h> +#include <e-util/e-list.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)) @@ -24,26 +25,28 @@ typedef struct _ESelectNamesManagerClass ESelectNamesManagerClass; struct _ESelectNamesManager { GtkObject object; - + + EList *sections; }; struct _ESelectNamesManagerClass { GtkObjectClass parent_class; }; -ESelectNamesManager *e_select_names_manager_new (void); -void e_select_names_add_section (ESelectNamesManager *manager, - char *id); -GtkWidget *e_select_names_create_entry (ESelectNamesManager *manager, - char *id); -void e_select_names_activate_dialog (ESelectNamesManager *manager, - char *id); +ESelectNamesManager *e_select_names_manager_new (void); +void e_select_names_manager_add_section (ESelectNamesManager *manager, + char *id, + char *title); +GtkWidget *e_select_names_manager_create_entry (ESelectNamesManager *manager, + char *id); +void e_select_names_manager_activate_dialog (ESelectNamesManager *manager, + char *id); /* Of type ECard */ -ECardList *e_select_names_get_cards (ESelectNamesManager *manager, - char *id); +EList *e_select_names_manager_get_cards (ESelectNamesManager *manager, + char *id); /* Standard Gtk function */ -GtkType e_select_names_manager_get_type (void); +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 new file mode 100644 index 0000000000..8399136dd8 --- /dev/null +++ b/addressbook/gui/component/select-names/e-select-names-model.c @@ -0,0 +1,200 @@ +/* -*- 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" + +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; +} + +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); +} + +/* Of type ECard */ +EList *e_select_names_model_get_cards (ESelectNamesModel *model) +{ + return NULL; +} + +EList *e_select_names_model_get_data (ESelectNamesModel *model) +{ + return model->data; +} diff --git a/addressbook/gui/component/select-names/e-select-names-model.h b/addressbook/gui/component/select-names/e-select-names-model.h new file mode 100644 index 0000000000..20c90818f7 --- /dev/null +++ b/addressbook/gui/component/select-names/e-select-names-model.h @@ -0,0 +1,67 @@ +/* -*- 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, + E_SELECT_NAMES_MODEL_DATA_TYPE_SEPARATION_MATERIAL, +}; + +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); + +/* 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 new file mode 100644 index 0000000000..dc3edda5f9 --- /dev/null +++ b/addressbook/gui/component/select-names/e-select-names-table-model.c @@ -0,0 +1,157 @@ +/* -*- 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-table-model.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); + +/** + * 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 +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; +} + +/* + * 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); + + if (model->source) + gtk_object_unref(GTK_OBJECT(model->source)); +} + + +/* 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: + if (model->source) + gtk_object_unref(GTK_OBJECT(model->source)); + model->source = E_SELECT_NAMES_MODEL(GTK_VALUE_OBJECT(*arg)); + if (model->source) + gtk_object_ref(GTK_OBJECT(model->source)); + 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; +} 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 new file mode 100644 index 0000000000..94cbaff13a --- /dev/null +++ b/addressbook/gui/component/select-names/e-select-names-table-model.h @@ -0,0 +1,42 @@ +/* -*- 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 <widgets/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 _ESelectNamesTableModel ESelectNamesTableModel; +typedef struct _ESelectNamesTableModelClass ESelectNamesTableModelClass; + +struct _ESelectNamesTableModel { + ETableModel parent; + + ESelectNamesModel *source; +}; + +struct _ESelectNamesTableModelClass { + ETableModel 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 new file mode 100644 index 0000000000..98d0f153c2 --- /dev/null +++ b/addressbook/gui/component/select-names/e-select-names-text-model.c @@ -0,0 +1,263 @@ +/* -*- 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); + 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 void +e_select_names_text_model_set_text (ETextModel *model, gchar *text) +{ + e_select_names_model_clear(model); +} + +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) +{ + 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_count++; + } + + 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; + *(lengthsp++) = this_length; + } + *stringp = 0; + *lengthsp = -1; + g_free(E_TEXT_MODEL(model)->text); + E_TEXT_MODEL(model)->text = string; +} + + +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 new file mode 100644 index 0000000000..564886ffc9 --- /dev/null +++ b/addressbook/gui/component/select-names/e-select-names-text-model.h @@ -0,0 +1,44 @@ +/* -*- 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 <widgets/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 { + ETextModel 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/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c index 5cb68a7f92..a17dd410d3 100644 --- a/addressbook/gui/component/e-select-names.c +++ b/addressbook/gui/component/select-names/e-select-names.c @@ -25,8 +25,8 @@ #include <e-table-simple.h> #include <e-table.h> #include <e-cell-text.h> -#include <e-addressbook-model.h> -#include <e-cardlist-model.h> +#include <addressbook/gui/component/model/e-addressbook-model.h> +#include <addressbook/gui/component/model/e-cardlist-model.h> #include <addressbook/backend/ebook/e-book.h> static void e_select_names_init (ESelectNames *card); @@ -321,23 +321,23 @@ card_free(void *value, void *closure) gtk_object_unref(GTK_OBJECT(value)); } -ECardList * +EList * e_select_names_get_section(ESelectNames *e_select_names, char *id) { ESelectNamesChild *child; int i; int rows; - ECardList *list; + 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_card_list_new(card_copy, card_free, NULL); + 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_card_list_append(list, card); + e_list_append(list, card); gtk_object_unref(GTK_OBJECT(card)); } return list; diff --git a/addressbook/gui/component/e-select-names.h b/addressbook/gui/component/select-names/e-select-names.h index 23780e2cf5..c9d4619db2 100644 --- a/addressbook/gui/component/e-select-names.h +++ b/addressbook/gui/component/select-names/e-select-names.h @@ -23,7 +23,7 @@ #include <gnome.h> #include <glade/glade.h> -#include <addressbook/backend/ebook/e-card-list.h> +#include <e-util/e-list.h> #include <widgets/e-table/e-table.h> #ifdef __cplusplus @@ -75,7 +75,7 @@ void e_select_names_add_section (ESelectNames *e_select_names, char *name, char *id); /* Returns a ref counted list of addresses. */ -ECardList *e_select_names_get_section (ESelectNames *e_select_names, +EList *e_select_names_get_section (ESelectNames *e_select_names, char *id); #ifdef __cplusplus diff --git a/addressbook/gui/component/select-names/recipient.glade b/addressbook/gui/component/select-names/recipient.glade new file mode 100644 index 0000000000..b60972d094 --- /dev/null +++ b/addressbook/gui/component/select-names/recipient.glade @@ -0,0 +1,61 @@ +<?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.glade b/addressbook/gui/component/select-names/select-names.glade index 46da911228..46da911228 100644 --- a/addressbook/gui/component/select-names.glade +++ b/addressbook/gui/component/select-names/select-names.glade diff --git a/addressbook/gui/component/select-names.glade.h b/addressbook/gui/component/select-names/select-names.glade.h index a21ddce689..a21ddce689 100644 --- a/addressbook/gui/component/select-names.glade.h +++ b/addressbook/gui/component/select-names/select-names.glade.h diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index 17a6c52119..cedd798edf 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -28,6 +28,7 @@ #include <gdk-pixbuf/gdk-pixbuf.h> #include <gdk-pixbuf/gnome-canvas-pixbuf.h> #include <e-util/e-gui-utils.h> +#include <e-contact-save-as.h> /* Signal IDs */ enum { |