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 /addressbook/gui/component/select-names/e-select-names-model.c | |
parent | 43f902781ba5f22478f966a2f7687baf1a2eccdd (diff) | |
download | gsoc2013-evolution-6fd5b82ca0c15cb641eb0f7aa427a6989b0f1344.tar gsoc2013-evolution-6fd5b82ca0c15cb641eb0f7aa427a6989b0f1344.tar.gz gsoc2013-evolution-6fd5b82ca0c15cb641eb0f7aa427a6989b0f1344.tar.bz2 gsoc2013-evolution-6fd5b82ca0c15cb641eb0f7aa427a6989b0f1344.tar.lz gsoc2013-evolution-6fd5b82ca0c15cb641eb0f7aa427a6989b0f1344.tar.xz 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
Diffstat (limited to 'addressbook/gui/component/select-names/e-select-names-model.c')
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names-model.c | 200 |
1 files changed, 200 insertions, 0 deletions
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; +} |