aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/widgets/Makefile.am7
-rw-r--r--addressbook/gui/widgets/e-addressbook-treeview-adapter.c621
-rw-r--r--addressbook/gui/widgets/e-addressbook-treeview-adapter.h44
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c125
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.h3
-rw-r--r--addressbook/gui/widgets/gal-view-factory-treeview.c84
-rw-r--r--addressbook/gui/widgets/gal-view-factory-treeview.h35
-rw-r--r--addressbook/gui/widgets/gal-view-treeview.c234
-rw-r--r--addressbook/gui/widgets/gal-view-treeview.h43
9 files changed, 0 insertions, 1196 deletions
diff --git a/addressbook/gui/widgets/Makefile.am b/addressbook/gui/widgets/Makefile.am
index a928ae5877..640f2add01 100644
--- a/addressbook/gui/widgets/Makefile.am
+++ b/addressbook/gui/widgets/Makefile.am
@@ -79,13 +79,6 @@ libeabwidgets_la_SOURCES = \
gal-view-factory-minicard.c \
gal-view-factory-minicard.h
-#TREEVIEW_SOURCES= e-addressbook-treeview-adapter.c \
-# e-addressbook-treeview-adapter.h \
-# gal-view-factory-treeview.c \
-# gal-view-factory-treeview.h \
-# gal-view-treeview.c \
-# gal-view-treeview.h
-
MARSHAL_GENERATED = eab-marshal.c eab-marshal.h
@EVO_MARSHAL_RULE@
diff --git a/addressbook/gui/widgets/e-addressbook-treeview-adapter.c b/addressbook/gui/widgets/e-addressbook-treeview-adapter.c
deleted file mode 100644
index 2d0c4b8c93..0000000000
--- a/addressbook/gui/widgets/e-addressbook-treeview-adapter.c
+++ /dev/null
@@ -1,621 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#include <config.h>
-#include "e-addressbook-model.h"
-#include "e-addressbook-treeview-adapter.h"
-#include "e-card-merging.h"
-#include "eab-gui-util.h"
-#include <gtk/gtktreednd.h>
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-
-struct _EAddressbookTreeViewAdapterPrivate {
- EAddressbookModel *model;
-
- gint stamp;
-
- ECardSimple **simples;
- int count;
-
- int create_card_id, remove_card_id, modify_card_id, model_changed_id;
-};
-
-#define PARENT_TYPE G_TYPE_OBJECT
-GObjectClass *parent_class;
-
-#define COLS (E_CARD_SIMPLE_FIELD_LAST)
-
-static void
-unlink_model(EAddressbookTreeViewAdapter *adapter)
-{
- EAddressbookTreeViewAdapterPrivate *priv = adapter->priv;
- int i;
-
- g_signal_handler_disconnect (priv->model,
- priv->create_card_id);
- g_signal_handler_disconnect (priv->model,
- priv->remove_card_id);
- g_signal_handler_disconnect (priv->model,
- priv->modify_card_id);
- g_signal_handler_disconnect (priv->model,
- priv->model_changed_id);
-
- priv->create_card_id = 0;
- priv->remove_card_id = 0;
- priv->modify_card_id = 0;
- priv->model_changed_id = 0;
-
- /* free up the existing mapping if there is one */
- if (priv->simples) {
- for (i = 0; i < priv->count; i ++)
- g_object_unref (priv->simples[i]);
- g_free (priv->simples);
- priv->simples = NULL;
- }
-
- g_object_unref (priv->model);
-
- priv->model = NULL;
-}
-
-static void
-build_simple_mapping(EAddressbookTreeViewAdapter *adapter)
-{
- EAddressbookTreeViewAdapterPrivate *priv = adapter->priv;
- int i;
-
- /* free up the existing mapping if there is one */
- if (priv->simples) {
- for (i = 0; i < priv->count; i ++)
- g_object_unref (priv->simples[i]);
- g_free (priv->simples);
- }
-
- /* build up our mapping to ECardSimple*'s */
- priv->count = e_addressbook_model_card_count (priv->model);
- priv->simples = g_new (ECardSimple*, priv->count);
- for (i = 0; i < priv->count; i ++) {
- priv->simples[i] = e_card_simple_new (e_addressbook_model_card_at (priv->model, i));
- g_object_ref (priv->simples[i]);
- }
-}
-
-static void
-addressbook_destroy(GtkObject *object)
-{
- EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER(object);
-
- unlink_model(adapter);
-
- g_free (adapter->priv);
- adapter->priv = NULL;
-
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-#if 0
-static void
-addressbook_set_value_at (ETableModel *etc, int col, int row, const void *val)
-{
- EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(etc);
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
- if (e_addressbook_model_editable (priv->model)) {
- ECard *card;
-
- if ( col >= COLS|| row >= e_addressbook_model_card_count (priv->model) )
- return;
-
- e_table_model_pre_change(etc);
-
- e_card_simple_set(priv->simples[row],
- col,
- val);
- g_object_get(priv->simples[row],
- "card", &card,
- NULL);
-
- e_card_merging_book_commit_card(e_addressbook_model_get_ebook(priv->model),
- card, card_modified_cb, NULL);
-
- /* XXX do we need this? shouldn't the commit_card generate a changed signal? */
- e_table_model_cell_changed(etc, col, row);
- }
-}
-
-/* This function returns whether a particular cell is editable. */
-static gboolean
-addressbook_is_cell_editable (ETableModel *etc, int col, int row)
-{
- EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(etc);
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
- ECard *card;
-
- if (row >= 0 && row < e_addressbook_model_card_count (priv->model))
- card = e_addressbook_model_card_at (priv->model, row);
- else
- card = NULL;
-
- if (!e_addressbook_model_editable(priv->model))
- return FALSE;
- else if (card && e_card_evolution_list (card))
- /* we only allow editing of the name and file as for
- lists */
- return col == E_CARD_SIMPLE_FIELD_FULL_NAME || col == E_CARD_SIMPLE_FIELD_FILE_AS;
- else
- return col < E_CARD_SIMPLE_FIELD_LAST_SIMPLE_STRING;
-}
-
-static void
-addressbook_append_row (ETableModel *etm, ETableModel *source, gint row)
-{
- EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(etm);
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
- ECard *card;
- ECardSimple *simple;
- int col;
-
- card = e_card_new("");
- simple = e_card_simple_new(card);
-
- for (col = 0; col < E_CARD_SIMPLE_FIELD_LAST_SIMPLE_STRING; col++) {
- const void *val = e_table_model_value_at(source, col, row);
- e_card_simple_set(simple, col, val);
- }
- e_card_simple_sync_card(simple);
- e_card_merging_book_add_card (e_addressbook_model_get_ebook (priv->model), card, NULL, NULL);
- g_object_unref (simple);
- g_object_unref (card);
-}
-#endif
-
-static void
-e_addressbook_treeview_adapter_class_init (GtkObjectClass *object_class)
-{
- parent_class = g_type_class_peek_parent (object_class);
-
- object_class->destroy = addressbook_destroy;
-}
-
-static void
-e_addressbook_treeview_adapter_init (GtkObject *object)
-{
- EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER(object);
- EAddressbookTreeViewAdapterPrivate *priv;
-
- priv = adapter->priv = g_new0 (EAddressbookTreeViewAdapterPrivate, 1);
-
- priv->create_card_id = 0;
- priv->remove_card_id = 0;
- priv->modify_card_id = 0;
- priv->model_changed_id = 0;
- priv->simples = NULL;
- priv->count = 0;
-}
-
-static void
-get_iter (EAddressbookTreeViewAdapter *adapter, gint index, GtkTreeIter *iter)
-{
- EAddressbookTreeViewAdapterPrivate *priv = adapter->priv;
-
- iter->stamp = priv->stamp;
- iter->user_data = GINT_TO_POINTER (index);
-}
-
-static void
-create_card (EAddressbookModel *model,
- gint index, gint count,
- EAddressbookTreeViewAdapter *adapter)
-{
- EAddressbookTreeViewAdapterPrivate *priv = adapter->priv;
- int i;
-
- priv->count += count;
- priv->simples = g_renew(ECardSimple *, priv->simples, priv->count);
- memmove (priv->simples + index + count, priv->simples + index, (priv->count - index - count) * sizeof (ECardSimple *));
-
- for (i = 0; i < count; i ++) {
- GtkTreeIter iter;
- GtkTreePath *path;
-
- priv->simples[index + i] = e_card_simple_new (e_addressbook_model_card_at (priv->model, index + i));
-
- get_iter (adapter, index + i, &iter);
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (adapter), &iter);
-
- gtk_tree_model_row_inserted (GTK_TREE_MODEL (adapter), path, &iter);
- gtk_tree_model_row_changed (GTK_TREE_MODEL (adapter), path, &iter);
-
- gtk_tree_path_free (path);
- }
-}
-
-static void
-remove_card (EAddressbookModel *model,
- gint index,
- EAddressbookTreeViewAdapter *adapter)
-{
- EAddressbookTreeViewAdapterPrivate *priv = adapter->priv;
- GtkTreeIter iter;
- GtkTreePath *path;
-
- g_object_unref (priv->simples[index]);
- memmove (priv->simples + index, priv->simples + index + 1, (priv->count - index - 1) * sizeof (ECardSimple *));
- priv->count --;
- get_iter (adapter, index, &iter);
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (adapter), &iter);
-
- gtk_tree_model_row_deleted (GTK_TREE_MODEL (adapter), path);
-
- gtk_tree_path_free (path);
-}
-
-static void
-modify_card (EAddressbookModel *model,
- gint index,
- EAddressbookTreeViewAdapter *adapter)
-{
- EAddressbookTreeViewAdapterPrivate *priv = adapter->priv;
- GtkTreeIter iter;
- GtkTreePath *path;
-
- g_object_unref (priv->simples[index]);
- priv->simples[index] = e_card_simple_new (e_addressbook_model_card_at (priv->model, index));
-
- get_iter (adapter, index, &iter);
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (adapter), &iter);
-
- gtk_tree_model_row_changed (GTK_TREE_MODEL (adapter), path, &iter);
-
- gtk_tree_path_free (path);
-}
-
-static void
-model_changed (EAddressbookModel *model,
- EAddressbookTreeViewAdapter *adapter)
-{
- int i;
-
- /* there has *got* to be an easier/faster way to do this... */
- for (i = 0; i < adapter->priv->count; i++) {
- remove_card (model, i, adapter);
- }
-
- build_simple_mapping (adapter);
-
- if (adapter->priv->count) {
- printf ("AIIEEEEEE\n");
- }
-
- /* XXX this isn't right either, we need to add the new cards */
-}
-
-static GtkTreeModelFlags
-adapter_get_flags (GtkTreeModel *tree_model)
-{
- g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), 0);
-
- return GTK_TREE_MODEL_LIST_ONLY;
-}
-
-static gint
-adapter_get_n_columns (GtkTreeModel *tree_model)
-{
- g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), 0);
-
- return COLS;
-}
-
-static GType
-adapter_get_column_type (GtkTreeModel *tree_model,
- gint index)
-{
- g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), G_TYPE_INVALID);
- g_return_val_if_fail (index < COLS && index >= 0, G_TYPE_INVALID);
-
- return G_TYPE_STRING;
-}
-
-static gboolean
-adapter_get_iter (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreePath *path)
-{
- EAddressbookTreeViewAdapter *adapter;
- GSList *list;
- gint i;
-
- g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), FALSE);
- g_return_val_if_fail (gtk_tree_path_get_depth (path) > 0, FALSE);
-
- adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model);
-
- i = gtk_tree_path_get_indices (path)[0];
-
- if (i >= adapter->priv->count)
- return FALSE;
-
- iter->stamp = adapter->priv->stamp;
- iter->user_data = GINT_TO_POINTER (i);
-
- return TRUE;
-}
-
-static GtkTreePath *
-adapter_get_path (GtkTreeModel *tree_model,
- GtkTreeIter *iter)
-{
- EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model);
- GtkTreePath *retval;
-
- g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), NULL);
- g_return_val_if_fail (iter->stamp == adapter->priv->stamp, NULL);
-
-
- if (GPOINTER_TO_INT (iter->user_data) >= adapter->priv->count)
- return NULL;
-
- retval = gtk_tree_path_new ();
- gtk_tree_path_append_index (retval, GPOINTER_TO_INT (iter->user_data));
- return retval;
-}
-
-static void
-adapter_get_value (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- gint column,
- GValue *value)
-{
- EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model);
- ECardSimple *simple;
- gint tmp_column = column;
- const char *v;
-
- g_return_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model));
- g_return_if_fail (column < COLS);
- g_return_if_fail (adapter->priv->stamp == iter->stamp);
-
- simple = adapter->priv->simples [ GPOINTER_TO_INT (iter->user_data) ];
-
- v = e_card_simple_get_const(simple, column);
-
- g_value_init (value, G_TYPE_STRING);
- g_value_set_string (value, (v ? v : ""));
-}
-
-static gboolean
-adapter_iter_next (GtkTreeModel *tree_model,
- GtkTreeIter *iter)
-{
- EAddressbookTreeViewAdapter *adapter;
-
- g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), FALSE);
- g_return_val_if_fail (E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model)->priv->stamp == iter->stamp, FALSE);
-
- adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model);
-
- iter->user_data = GINT_TO_POINTER (GPOINTER_TO_INT (iter->user_data) + 1);
-
- return (GPOINTER_TO_INT (iter->user_data) < adapter->priv->count);
-}
-
-static gboolean
-adapter_iter_children (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreeIter *parent)
-{
- EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model);
-
- /* this is a list, nodes have no children */
- if (parent)
- return FALSE;
-
- /* but if parent == NULL we return the list itself as children of the
- * "root"
- */
- if (adapter->priv->count) {
- iter->stamp = adapter->priv->stamp;
- iter->user_data = GINT_TO_POINTER (0);
- return TRUE;
- }
- else
- return FALSE;
-}
-
-static gboolean
-adapter_iter_has_child (GtkTreeModel *tree_model,
- GtkTreeIter *iter)
-{
- return FALSE;
-}
-
-static gint
-adapter_iter_n_children (GtkTreeModel *tree_model,
- GtkTreeIter *iter)
-{
- EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model);
-
- g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), -1);
- if (iter == NULL)
- return adapter->priv->count;
-
- g_return_val_if_fail (adapter->priv->stamp == iter->stamp, -1);
- return 0;
-}
-
-static gboolean
-adapter_iter_nth_child (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreeIter *parent,
- gint n)
-{
- EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model);
-
- g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), FALSE);
-
- if (parent)
- return FALSE;
-
- if (n < adapter->priv->count) {
- iter->stamp = adapter->priv->stamp;
- iter->user_data = GINT_TO_POINTER (n);
- return TRUE;
- }
- else
- return FALSE;
-}
-
-static gboolean
-adapter_iter_parent (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreeIter *child)
-{
- return FALSE;
-}
-
-static void
-adapter_tree_model_init (GtkTreeModelIface *iface)
-{
- iface->get_flags = adapter_get_flags;
- iface->get_n_columns = adapter_get_n_columns;
- iface->get_column_type = adapter_get_column_type;
- iface->get_iter = adapter_get_iter;
- iface->get_path = adapter_get_path;
- iface->get_value = adapter_get_value;
- iface->iter_next = adapter_iter_next;
- iface->iter_children = adapter_iter_children;
- iface->iter_has_child = adapter_iter_has_child;
- iface->iter_n_children = adapter_iter_n_children;
- iface->iter_nth_child = adapter_iter_nth_child;
- iface->iter_parent = adapter_iter_parent;
-}
-
-static gboolean
-adapter_drag_data_delete (GtkTreeDragSource *drag_source,
- GtkTreePath *path)
-{
- g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (drag_source), FALSE);
-
- return FALSE;
-}
-
-static gboolean
-adapter_drag_data_get (GtkTreeDragSource *drag_source,
- GtkTreePath *path,
- GtkSelectionData *selection_data)
-{
- g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (drag_source), FALSE);
-
- /* Note that we don't need to handle the GTK_TREE_MODEL_ROW
- * target, because the default handler does it for us, but
- * we do anyway for the convenience of someone maybe overriding the
- * default handler.
- */
-
- if (gtk_tree_set_row_drag_data (selection_data,
- GTK_TREE_MODEL (drag_source),
- path)) {
- return TRUE;
- }
- else {
- if (selection_data->target == gdk_atom_intern ("text/x-vcard", FALSE)) {
- printf ("HI THERE\n");
- }
- }
-
- return FALSE;
-}
-
-static void
-adapter_drag_source_init (GtkTreeDragSourceIface *iface)
-{
- iface->drag_data_delete = adapter_drag_data_delete;
- iface->drag_data_get = adapter_drag_data_get;
-}
-
-GType
-e_addressbook_treeview_adapter_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo adapter_info = {
- sizeof (EAddressbookTreeViewAdapterClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_addressbook_treeview_adapter_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EAddressbookTreeViewAdapter),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_addressbook_treeview_adapter_init,
- };
-
- static const GInterfaceInfo tree_model_info = {
- (GInterfaceInitFunc) adapter_tree_model_init,
- NULL,
- NULL
- };
-
- static const GInterfaceInfo drag_source_info = {
- (GInterfaceInitFunc) adapter_drag_source_init,
- NULL,
- NULL
- };
-
- type = g_type_register_static (PARENT_TYPE, "EAddressbookTreeViewAdapter", &adapter_info, 0);
-
- g_type_add_interface_static (type,
- GTK_TYPE_TREE_MODEL,
- &tree_model_info);
-
- g_type_add_interface_static (type,
- GTK_TYPE_TREE_DRAG_SOURCE,
- &drag_source_info);
- }
-
- return type;
-}
-
-void
-e_addressbook_treeview_adapter_construct (EAddressbookTreeViewAdapter *adapter,
- EAddressbookModel *model)
-{
- EAddressbookTreeViewAdapterPrivate *priv = adapter->priv;
-
- priv->model = model;
- g_object_ref (priv->model);
-
- priv->stamp = g_random_int ();
-
- priv->create_card_id = g_signal_connect(priv->model,
- "card_added",
- G_CALLBACK(create_card),
- adapter);
- priv->remove_card_id = g_signal_connect(priv->model,
- "card_removed",
- G_CALLBACK(remove_card),
- adapter);
- priv->modify_card_id = g_signal_connect(priv->model,
- "card_changed",
- G_CALLBACK(modify_card),
- adapter);
- priv->model_changed_id = g_signal_connect(priv->model,
- "model_changed",
- G_CALLBACK(model_changed),
- adapter);
-
- build_simple_mapping (adapter);
-}
-
-GtkTreeModel *
-e_addressbook_treeview_adapter_new (EAddressbookModel *model)
-{
- EAddressbookTreeViewAdapter *et;
-
- et = g_object_new(E_TYPE_ADDRESSBOOK_TREEVIEW_ADAPTER, NULL);
-
- e_addressbook_treeview_adapter_construct (et, model);
-
- return (GtkTreeModel*)et;
-}
diff --git a/addressbook/gui/widgets/e-addressbook-treeview-adapter.h b/addressbook/gui/widgets/e-addressbook-treeview-adapter.h
deleted file mode 100644
index 2c4370dee3..0000000000
--- a/addressbook/gui/widgets/e-addressbook-treeview-adapter.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#ifndef _E_ADDRESSBOOK_TREEVIEW_ADAPTER_H_
-#define _E_ADDRESSBOOK_TREEVIEW_ADAPTER_H_
-
-#include <gtk/gtktreemodel.h>
-#include "addressbook/backend/ebook/e-book.h"
-#include "addressbook/backend/ebook/e-book-view.h"
-#include "addressbook/backend/ebook/e-card-simple.h"
-
-#define E_TYPE_ADDRESSBOOK_TREEVIEW_ADAPTER (e_addressbook_treeview_adapter_get_type ())
-#define E_ADDRESSBOOK_TREEVIEW_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_ADDRESSBOOK_TREEVIEW_ADAPTER, EAddressbookTreeViewAdapter))
-#define E_ADDRESSBOOK_TREEVIEW_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_ADDRESSBOOK_TREEVIEW_ADAPTER, EAddressbookTreeViewAdapterClass))
-#define E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_ADDRESSBOOK_TREEVIEW_ADAPTER))
-#define E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_ADDRESSBOOK_TREEVIEW_ADAPTER))
-
-/* Virtual Column list:
- 0 Email
- 1 Full Name
- 2 Street
- 3 Phone
-*/
-
-typedef struct _EAddressbookTreeViewAdapter EAddressbookTreeViewAdapter;
-typedef struct _EAddressbookTreeViewAdapterPrivate EAddressbookTreeViewAdapterPrivate;
-typedef struct _EAddressbookTreeViewAdapterClass EAddressbookTreeViewAdapterClass;
-
-struct _EAddressbookTreeViewAdapter {
- GObject parent;
-
- EAddressbookTreeViewAdapterPrivate *priv;
-};
-
-
-struct _EAddressbookTreeViewAdapterClass {
- GObjectClass parent_class;
-};
-
-
-GType e_addressbook_treeview_adapter_get_type (void);
-void e_addressbook_treeview_adapter_construct (EAddressbookTreeViewAdapter *adapter,
- EAddressbookModel *model);
-GtkTreeModel *e_addressbook_treeview_adapter_new (EAddressbookModel *model);
-
-#endif /* _E_ADDRESSBOOK_TABLE_ADAPTER_H_ */
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 8aa6ef0c57..767d13c56a 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -47,11 +47,6 @@
#include "libedataserver/e-sexp.h"
#include <libedataserver/e-categories.h>
-#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW
-#include <misc/e-treeview-selection-model.h>
-#include "gal-view-factory-treeview.h"
-#include "gal-view-treeview.h"
-#endif
#include "gal-view-minicard.h"
#include "gal-view-factory-minicard.h"
@@ -61,9 +56,6 @@
#include "eab-gui-util.h"
#include "util/eab-book-util.h"
#include "e-addressbook-table-adapter.h"
-#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW
-#include "e-addressbook-treeview-adapter.h"
-#endif
#include "eab-contact-merging.h"
#include "e-util/e-error.h"
@@ -593,12 +585,6 @@ init_collection (void)
gal_view_collection_add_factory (collection, factory);
g_object_unref (factory);
-#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW
- factory = gal_view_factory_treeview_new ();
- gal_view_collection_add_factory (collection, factory);
- g_object_unref (factory);
-#endif
-
gal_view_collection_load(collection);
}
}
@@ -636,12 +622,6 @@ display_view(GalViewInstance *instance,
change_view_type (address_view, EAB_VIEW_MINICARD);
gal_view_minicard_attach (GAL_VIEW_MINICARD (view), address_view);
}
-#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW
- else if (GAL_IS_VIEW_TREEVIEW (view)) {
- change_view_type (address_view, EAB_VIEW_TREEVIEW);
- gal_view_treeview_attach (GAL_VIEW_TREEVIEW(view), GTK_TREE_VIEW (address_view->object));
- }
-#endif
address_view->current_view = view;
set_paned_position (address_view);
@@ -797,10 +777,6 @@ get_selection_model (EABView *view)
return e_table_get_selection_model (e_table_scrolled_get_table (E_TABLE_SCROLLED(view->widget)));
else if (view->view_type == EAB_VIEW_MINICARD)
return e_minicard_view_widget_get_selection_model (E_MINICARD_VIEW_WIDGET(view->object));
-#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW
- else if (view->view_type == EAB_VIEW_TREEVIEW)
- return e_treeview_get_selection_model (GTK_TREE_VIEW (view->object));
-#endif
g_return_val_if_reached (NULL);
}
@@ -1350,102 +1326,6 @@ create_table_view (EABView *view)
gtk_widget_show( GTK_WIDGET(table) );
}
-#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW
-static void
-treeview_row_activated(GtkTreeView *treeview,
- GtkTreePath *path, GtkTreeViewColumn *column,
- EABView *view)
-{
- EABModel *model = view->model;
- int row = gtk_tree_path_get_indices (path)[0];
- ECard *card = eab_model_get_card(model, row);
- EBook *book;
-
- g_object_get(model,
- "book", &book,
- NULL);
-
- g_return_if_fail (E_IS_BOOK (book));
-
- if (e_card_evolution_list (card))
- eab_show_contact_list_editor (book, card, FALSE, view->editable);
- else
- eab_show_contact_editor (book, card, FALSE, view->editable);
-
- g_object_unref (book);
- g_object_unref (card);
-}
-
-static void
-create_treeview_view (EABView *view)
-{
- GtkTreeModel *adapter;
- ECardSimple *simple;
- GtkWidget *treeview;
- GtkWidget *scrolled;
- int i;
-
- simple = e_card_simple_new(NULL);
-
- adapter = eab_treeview_adapter_new(view->model);
-
- scrolled = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow (GTK_SCROLLED_WINDOW (scrolled), GTK_SHADOW_IN);
- treeview = gtk_tree_view_new_with_model (adapter);
- g_object_unref (adapter);
-
- gtk_widget_show (treeview);
-
- gtk_container_add (GTK_CONTAINER (scrolled), treeview);
-
- for (i = 0; i < 15; i ++) {
- GtkTreeViewColumn *column =
- gtk_tree_view_column_new_with_attributes (e_card_simple_get_name (simple, i),
- gtk_cell_renderer_text_new (),
- "text", i,
- NULL);
-
- gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
- }
-
- view->object = G_OBJECT(treeview);
- view->widget = scrolled;
-
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)), GTK_SELECTION_MULTIPLE);
- gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (treeview),
- GDK_BUTTON1_MASK,
- drag_types,
- num_drag_types,
- GDK_ACTION_MOVE);
-
- g_signal_connect(treeview, "row_activated",
- G_CALLBACK (treeview_row_activated), view);
-#if 0
- g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "right_click",
- G_CALLBACK(table_right_click), view);
-
- /* drag & drop signals */
- e_table_drag_source_set (E_TABLE(E_TABLE_SCROLLED(table)->table), GDK_BUTTON1_MASK,
- drag_types, num_drag_types, GDK_ACTION_MOVE);
-
- g_signal_connect (E_TABLE_SCROLLED(table)->table,
- "table_drag_data_get",
- G_CALLBACK (table_drag_data_get),
- view);
-#endif
-
-
- g_signal_connect(e_treeview_get_selection_model (GTK_TREE_VIEW (treeview)), "selection_changed",
- G_CALLBACK(selection_changed), view);
-
- gtk_paned_add1 (GTK_PANED (view->paned), scrolled);
-
- gtk_widget_show( GTK_WIDGET(scrolled) );
-
- g_object_unref (simple);
-}
-#endif
-
static void
change_view_type (EABView *view, EABViewType view_type)
{
@@ -1465,11 +1345,6 @@ change_view_type (EABView *view, EABViewType view_type)
case EAB_VIEW_MINICARD:
create_minicard_view (view);
break;
-#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW
- case EAB_VIEW_TREEVIEW:
- create_treeview_view (view);
- break;
-#endif
default:
g_warning ("view_type not recognized.");
return;
diff --git a/addressbook/gui/widgets/e-addressbook-view.h b/addressbook/gui/widgets/e-addressbook-view.h
index 5c1be3f156..14f16c82f4 100644
--- a/addressbook/gui/widgets/e-addressbook-view.h
+++ b/addressbook/gui/widgets/e-addressbook-view.h
@@ -53,9 +53,6 @@ typedef enum {
EAB_VIEW_NONE, /* initialized to this */
EAB_VIEW_MINICARD,
EAB_VIEW_TABLE,
-#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW
- ,EAB_VIEW_TREEVIEW
-#endif
} EABViewType;
diff --git a/addressbook/gui/widgets/gal-view-factory-treeview.c b/addressbook/gui/widgets/gal-view-factory-treeview.c
deleted file mode 100644
index bdd875caa8..0000000000
--- a/addressbook/gui/widgets/gal-view-factory-treeview.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8
- -*- */
-/*
- * gal-view-factory-treeview.c: A View Factory
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * (C) 2000, 2001 Ximian, Inc.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include "gal-view-factory-treeview.h"
-#include "gal-view-treeview.h"
-
-G_DEFINE_TYPE(GalViewFactoryTreeView, gal_view_factory_treeview, GAL_VIEW_FACTORY_TYPE)
-
-static const char *
-gal_view_factory_treeview_get_title (GalViewFactory *factory)
-{
- return _("GTK Tree View");
-}
-
-static GalView *
-gal_view_factory_treeview_new_view (GalViewFactory *factory,
- const char *name)
-{
- return gal_view_treeview_new(name);
-}
-
-static const char *
-gal_view_factory_treeview_get_type_code (GalViewFactory *factory)
-{
- return "treeview";
-}
-
-static void
-gal_view_factory_treeview_class_init (GalViewFactoryTreeViewClass *treeview_class)
-{
- GalViewFactoryClass *view_factory_class = GAL_VIEW_FACTORY_CLASS(treeview_class);
-
- view_factory_class->get_title = gal_view_factory_treeview_get_title;
- view_factory_class->new_view = gal_view_factory_treeview_new_view;
- view_factory_class->get_type_code = gal_view_factory_treeview_get_type_code;
-}
-
-static void
-gal_view_factory_treeview_init (GalViewFactoryTreeView *factory)
-{
-}
-
-/**
- * gal_view_treeview_new
- *
- * A new GalViewFactory for creating TreeView views. Create one of
- * these and pass it to GalViewCollection for use.
- *
- * Returns: The new GalViewFactoryTreeView.
- */
-GalViewFactory *
-gal_view_factory_treeview_new (void)
-{
- return gal_view_factory_treeview_construct (g_object_new (GAL_TYPE_VIEW_FACTORY_TREEVIEW, NULL));
-}
-
-/**
- * gal_view_treeview_construct
- * @factory: The factory to construct
- *
- * constructs the GalViewFactoryTreeView. To be used by subclasses and
- * language bindings.
- *
- * Returns: The GalViewFactoryTreeView.
- */
-GalViewFactory *
-gal_view_factory_treeview_construct (GalViewFactoryTreeView *factory)
-{
- return GAL_VIEW_FACTORY(factory);
-}
diff --git a/addressbook/gui/widgets/gal-view-factory-treeview.h b/addressbook/gui/widgets/gal-view-factory-treeview.h
deleted file mode 100644
index f510079281..0000000000
--- a/addressbook/gui/widgets/gal-view-factory-treeview.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-factory-treeview.c: A View Factory
- *
- * Authors:
- * Chris Toshok <toshok@ximian.com>
- *
- * (C) 2000, 2001 Ximian, Inc.
- */
-#ifndef _GAL_VIEW_FACTORY_TREEVIEW_H_
-#define _GAL_VIEW_FACTORY_TREEVIEW_H_
-
-#include <gtk/gtkobject.h>
-#include <widgets/menus/gal-view-factory.h>
-
-#define GAL_TYPE_VIEW_FACTORY_TREEVIEW (gal_view_factory_treeview_get_type ())
-#define GAL_VIEW_FACTORY_TREEVIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_TYPE_VIEW_FACTORY_TREEVIEW, GalViewFactoryTreeView))
-#define GAL_VIEW_FACTORY_TREEVIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_TYPE_VIEW_FACTORY_TREEVIEW, GalViewFactoryTreeViewClass))
-#define GAL_IS_VIEW_FACTORY_TREEVIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_TYPE_VIEW_FACTORY_TREEVIEW))
-#define GAL_IS_VIEW_FACTORY_TREEVIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_TYPE_VIEW_FACTORY_TREEVIEW))
-
-typedef struct {
- GalViewFactory base;
-} GalViewFactoryTreeView;
-
-typedef struct {
- GalViewFactoryClass parent_class;
-} GalViewFactoryTreeViewClass;
-
-/* Standard functions */
-GType gal_view_factory_treeview_get_type (void);
-GalViewFactory *gal_view_factory_treeview_new (void);
-GalViewFactory *gal_view_factory_treeview_construct (GalViewFactoryTreeView *factory);
-
-#endif /* _GAL_VIEW_FACTORY_TREEVIEW_H_ */
diff --git a/addressbook/gui/widgets/gal-view-treeview.c b/addressbook/gui/widgets/gal-view-treeview.c
deleted file mode 100644
index a62ab23af3..0000000000
--- a/addressbook/gui/widgets/gal-view-treeview.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-treeview.c: An TreeView View
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * (C) 2000, 2001 Ximian, Inc.
- */
-#include <config.h>
-#include "gal-view-treeview.h"
-#include <libxml/parser.h>
-#include <e-util/e-xml-utils.h>
-
-#define PARENT_TYPE gal_view_get_type ()
-#define d(x) x
-
-static GalViewClass *gal_view_treeview_parent_class;
-
-static void
-gal_view_treeview_edit (GalView *view, GtkWindow *parent_window)
-{
- /* GalViewTreeView *treeview_view = GAL_VIEW_TREEVIEW(view); */
-}
-
-static void
-gal_view_treeview_load (GalView *view,
- const char *filename)
-{
-#if 0
- xmlDoc *doc;
- doc = xmlParseFile (filename);
- if (doc) {
- xmlNode *root = xmlDocGetRootElement(doc);
- GAL_VIEW_TREEVIEW (view)->column_width = e_xml_get_double_prop_by_name_with_default (root, "column_width", 150);
- xmlFreeDoc(doc);
- }
-#endif
-}
-
-static void
-gal_view_treeview_save (GalView *view,
- const char *filename)
-{
-#if 0
- xmlDoc *doc;
- xmlNode *root;
-
- doc = xmlNewDoc("1.0");
- root = xmlNewNode (NULL, "ETreeViewViewState");
- e_xml_set_double_prop_by_name (root, "column_width", GAL_VIEW_TREEVIEW (view)->column_width);
- xmlDocSetRootElement(doc, root);
- xmlSaveFile(filename, doc);
- xmlFreeDoc(doc);
-#endif
-}
-
-static const char *
-gal_view_treeview_get_title (GalView *view)
-{
- return GAL_VIEW_TREEVIEW(view)->title;
-}
-
-static void
-gal_view_treeview_set_title (GalView *view,
- const char *title)
-{
- g_free(GAL_VIEW_TREEVIEW(view)->title);
- GAL_VIEW_TREEVIEW(view)->title = g_strdup(title);
-}
-
-static const char *
-gal_view_treeview_get_type_code (GalView *view)
-{
- return "treeview";
-}
-
-static GalView *
-gal_view_treeview_clone (GalView *view)
-{
- GalViewTreeView *gvm, *new;
-
- gvm = GAL_VIEW_TREEVIEW(view);
-
- new = g_object_new (GAL_TYPE_VIEW_TREEVIEW, NULL);
- new->title = g_strdup (gvm->title);
-
- return GAL_VIEW(new);
-}
-
-static void
-gal_view_treeview_dispose (GObject *object)
-{
- GalViewTreeView *view = GAL_VIEW_TREEVIEW(object);
-
- if (view->title != NULL) {
- gal_view_treeview_detach (view);
- g_free(view->title);
- view->title = NULL;
- }
-
- if (G_OBJECT_CLASS (gal_view_treeview_parent_class)->dispose)
- (* G_OBJECT_CLASS (gal_view_treeview_parent_class)->dispose) (object);
-}
-
-static void
-gal_view_treeview_class_init (GObjectClass *object_class)
-{
- GalViewClass *gal_view_class = GAL_VIEW_CLASS(object_class);
- gal_view_treeview_parent_class = g_type_class_ref (PARENT_TYPE);
-
- gal_view_class->edit = gal_view_treeview_edit ;
- gal_view_class->load = gal_view_treeview_load ;
- gal_view_class->save = gal_view_treeview_save ;
- gal_view_class->get_title = gal_view_treeview_get_title ;
- gal_view_class->set_title = gal_view_treeview_set_title ;
- gal_view_class->get_type_code = gal_view_treeview_get_type_code;
- gal_view_class->clone = gal_view_treeview_clone ;
-
- object_class->dispose = gal_view_treeview_dispose ;
-}
-
-static void
-gal_view_treeview_init (GalViewTreeView *gvm)
-{
- gvm->title = NULL;
-
- gvm->tree = NULL;
-}
-
-/**
- * gal_view_treeview_new
- * @title: The name of the new view.
- *
- * Returns a new GalViewTreeView. This is primarily for use by
- * GalViewFactoryTreeView.
- *
- * Returns: The new GalViewTreeView.
- */
-GalView *
-gal_view_treeview_new (const gchar *title)
-{
- return gal_view_treeview_construct (g_object_new (GAL_TYPE_VIEW_TREEVIEW, NULL), title);
-}
-
-/**
- * gal_view_treeview_construct
- * @view: The view to construct.
- * @title: The name of the new view.
- *
- * constructs the GalViewTreeView. To be used by subclasses and
- * language bindings.
- *
- * Returns: The GalViewTreeView.
- */
-GalView *
-gal_view_treeview_construct (GalViewTreeView *view,
- const gchar *title)
-{
- view->title = g_strdup(title);
- return GAL_VIEW(view);
-}
-
-GType
-gal_view_treeview_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (GalViewTreeViewClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gal_view_treeview_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GalViewTreeView),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gal_view_treeview_init,
- };
-
- type = g_type_register_static (PARENT_TYPE, "GalViewTreeView", &info, 0);
- }
-
- return type;
-}
-
-#if 0
-static void
-column_width_changed (ETable *table, double width, GalViewMinicard *view)
-{
- d(g_print("%s: Old width = %f, New width = %f\n", G_GNUC_FUNCTION, view->column_width, width));
- if (view->column_width != width) {
- view->column_width = width;
- gal_view_changed(GAL_VIEW(view));
- }
-}
-#endif
-
-void
-gal_view_treeview_attach (GalViewTreeView *view, GtkTreeView *tree)
-{
-#if 0
- gal_view_treeview_detach (view);
-
- view->emvw = emvw;
-
- g_object_ref (view->emvw);
-
- g_object_set (view->emvw,
- "column_width", view->column_width,
- NULL);
-
- view->emvw_column_width_changed_id =
- g_signal_connect(view->emvw, "column_width_changed",
- G_CALLBACK (column_width_changed), view);
-#endif
-}
-
-void
-gal_view_treeview_detach (GalViewTreeView *view)
-{
-#if 0
- if (view->emvw == NULL)
- return;
- if (view->emvw_column_width_changed_id) {
- g_signal_handler_disconnect (view->emvw,
- view->emvw_column_width_changed_id);
- view->emvw_column_width_changed_id = 0;
- }
- g_object_unref (view->emvw);
- view->emvw = NULL;
-#endif
-}
diff --git a/addressbook/gui/widgets/gal-view-treeview.h b/addressbook/gui/widgets/gal-view-treeview.h
deleted file mode 100644
index aeea2e564f..0000000000
--- a/addressbook/gui/widgets/gal-view-treeview.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-treeview.h: An TreeView View
- *
- * Authors:
- * Chris Toshok <toshok@ximian.com>
- *
- * (C) 2000, 2001 Ximian, Inc.
- */
-#ifndef _GAL_VIEW_TREEVIEW_H_
-#define _GAL_VIEW_TREEVIEW_H_
-
-#include <widgets/menus/gal-view.h>
-#include <gtk/gtktreeview.h>
-
-#define GAL_TYPE_VIEW_TREEVIEW (gal_view_treeview_get_type ())
-#define GAL_VIEW_TREEVIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_TYPE_VIEW_TREEVIEW, GalViewTreeView))
-#define GAL_VIEW_TREEVIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_TYPE_VIEW_TREEVIEW, GalViewTreeViewClass))
-#define GAL_IS_VIEW_TREEVIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_TYPE_VIEW_TREEVIEW))
-#define GAL_IS_VIEW_TREEVIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_TYPE_VIEW_TREEVIEW))
-
-typedef struct {
- GalView base;
-
- char *title;
-
- GtkTreeView *tree;
-} GalViewTreeView;
-
-typedef struct {
- GalViewClass parent_class;
-} GalViewTreeViewClass;
-
-/* Standard functions */
-GType gal_view_treeview_get_type (void);
-GalView *gal_view_treeview_new (const gchar *title);
-GalView *gal_view_treeview_construct (GalViewTreeView *view,
- const gchar *title);
-void gal_view_treeview_attach (GalViewTreeView *view,
- GtkTreeView *tree);
-void gal_view_treeview_detach (GalViewTreeView *view);
-
-#endif /* _GAL_VIEW_TREEVIEW_H_ */