From 6fd5b82ca0c15cb641eb0f7aa427a6989b0f1344 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Mon, 3 Jul 2000 23:03:45 +0000 Subject: Removed e-card-iterator.c, e-card-iterator.h, e-card-list-iterator.c, 2000-07-03 Christopher James Lahey * 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 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 --- .../select-names/e-select-names-manager.c | 90 +++++++++++++++++----- 1 file changed, 71 insertions(+), 19 deletions(-) (limited to 'addressbook/gui/component/select-names/e-select-names-manager.c') 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 #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; } -- cgit v1.2.3