aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorHans Petter Jansson <hpj@ximian.com>2003-11-14 08:38:47 +0800
committerHans Petter <hansp@src.gnome.org>2003-11-14 08:38:47 +0800
commit6cf20bbebabbc2c930cff97c0cf28a1297a0ce3f (patch)
tree8c67e8d5494ada49bbc872bc405059f8f4bc0176 /addressbook/gui
parentdbf9e56e6398ae0520085e8a3f0f25fc2225d4a8 (diff)
downloadgsoc2013-evolution-6cf20bbebabbc2c930cff97c0cf28a1297a0ce3f.tar
gsoc2013-evolution-6cf20bbebabbc2c930cff97c0cf28a1297a0ce3f.tar.gz
gsoc2013-evolution-6cf20bbebabbc2c930cff97c0cf28a1297a0ce3f.tar.bz2
gsoc2013-evolution-6cf20bbebabbc2c930cff97c0cf28a1297a0ce3f.tar.lz
gsoc2013-evolution-6cf20bbebabbc2c930cff97c0cf28a1297a0ce3f.tar.xz
gsoc2013-evolution-6cf20bbebabbc2c930cff97c0cf28a1297a0ce3f.tar.zst
gsoc2013-evolution-6cf20bbebabbc2c930cff97c0cf28a1297a0ce3f.zip
Return TRUE for all cells, for now.
2003-11-13 Hans Petter Jansson <hpj@ximian.com> * gui/contact-list-editor/e-contact-list-model.c (contact_list_is_cell_editable): Return TRUE for all cells, for now. * gui/widgets/e-addressbook-table-adapter.c (card_modified_cb): Renamed to contact_modified_cb (). (addressbook_set_value_at): Port to use EContact instead of ECard. (addressbook_is_cell_editable): Ditto. (addressbook_append_row): Ditto. * gui/widgets/e-minicard-label.c (e_minicard_label_set_property): Make not editable, ever, and add a comment to this effect. (e_minicard_label_realize): Ditto. * gui/widgets/e-minicard.c (e_minicard_set_property): Ditto. (add_field): Ditto. svn path=/trunk/; revision=23348
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-model.c2
-rw-r--r--addressbook/gui/widgets/e-addressbook-table-adapter.c73
-rw-r--r--addressbook/gui/widgets/e-minicard-label.c4
-rw-r--r--addressbook/gui/widgets/e-minicard.c7
4 files changed, 39 insertions, 47 deletions
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-model.c b/addressbook/gui/contact-list-editor/e-contact-list-model.c
index 80bc29b7a9..c7fd626372 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-model.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-model.c
@@ -44,7 +44,7 @@ contact_list_set_value_at (ETableModel *etc, int col, int row, const void *val)
static gboolean
contact_list_is_cell_editable (ETableModel *etc, int col, int row)
{
- return FALSE;
+ return TRUE;
}
/* This function duplicates the value passed to it. */
diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.c b/addressbook/gui/widgets/e-addressbook-table-adapter.c
index eb01b9b079..9fa48084ed 100644
--- a/addressbook/gui/widgets/e-addressbook-table-adapter.c
+++ b/addressbook/gui/widgets/e-addressbook-table-adapter.c
@@ -3,6 +3,7 @@
#include <config.h>
#include "e-addressbook-model.h"
#include "e-addressbook-table-adapter.h"
+#include "eab-contact-merging.h"
#include "eab-gui-util.h"
#include "util/eab-destination.h"
#include <libxml/tree.h>
@@ -105,96 +106,86 @@ addressbook_value_at (ETableModel *etc, int col, int row)
}
/* This function sets the value at a particular point in our ETableModel. */
-#if 0
static void
-card_modified_cb (EBook* book, EBookStatus status,
- gpointer user_data)
+contact_modified_cb (EBook* book, EBookStatus status,
+ gpointer user_data)
{
if (status != E_BOOK_ERROR_OK)
eab_error_dialog (_("Error modifying card"), status);
}
-#endif
static void
addressbook_set_value_at (ETableModel *etc, int col, int row, const void *val)
{
-#if 0
EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER(etc);
EAddressbookTableAdapterPrivate *priv = adapter->priv;
+
if (eab_model_editable (priv->model)) {
- ECard *card;
+ EContact *contact;
+
+ if (col >= COLS || row >= eab_model_contact_count (priv->model))
+ return;
- if ( col >= COLS|| row >= eab_model_card_count (priv->model) )
+ contact = eab_model_get_contact (priv->model, row);
+ if (!contact)
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_contact_set(contact, col, (void *) val);
+ eab_merging_book_commit_contact (eab_model_get_ebook (priv->model),
+ contact, contact_modified_cb, NULL);
- e_card_merging_book_commit_card(eab_model_get_ebook(priv->model),
- card, card_modified_cb, NULL);
- g_object_unref (card);
+ g_object_unref (contact);
- /* XXX do we need this? shouldn't the commit_card generate a changed signal? */
+ /* XXX do we need this? shouldn't the commit_contact generate a changed signal? */
e_table_model_cell_changed(etc, col, row);
}
-#endif
}
/* This function returns whether a particular cell is editable. */
static gboolean
addressbook_is_cell_editable (ETableModel *etc, int col, int row)
{
-#if 0
EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER(etc);
EAddressbookTableAdapterPrivate *priv = adapter->priv;
- ECard *card;
+ const EContact *contact;
- if (row >= 0 && row < eab_model_card_count (priv->model))
- card = eab_model_card_at (priv->model, row);
+ if (row >= 0 && row < eab_model_contact_count (priv->model))
+ contact = eab_model_contact_at (priv->model, row);
else
- card = NULL;
+ contact = NULL;
if (!eab_model_editable(priv->model))
return FALSE;
- else if (card && e_card_evolution_list (card))
+ else if (contact && e_contact_get ((EContact *) contact, E_CONTACT_IS_LIST))
/* 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;
+ return col == E_CONTACT_FULL_NAME || col == E_CONTACT_FILE_AS;
else
- return col < E_CARD_SIMPLE_FIELD_LAST_SIMPLE_STRING;
-#else
+ return col < E_CONTACT_LAST_SIMPLE_STRING;
+
return FALSE;
-#endif
}
static void
addressbook_append_row (ETableModel *etm, ETableModel *source, gint row)
{
-#if 0
EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER(etm);
EAddressbookTableAdapterPrivate *priv = adapter->priv;
- ECard *card;
- ECardSimple *simple;
+ EContact *contact;
int col;
- card = e_card_new("");
- simple = e_card_simple_new(card);
+ contact = e_contact_new ();
- 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);
+ for (col = 1; col < E_CONTACT_LAST_SIMPLE_STRING; col++) {
+ const void *val = e_table_model_value_at (source, col, row);
+ e_contact_set (contact, col, (void *) val);
}
- e_card_simple_sync_card(simple);
- e_card_merging_book_add_card (eab_model_get_ebook (priv->model), card, NULL, NULL);
- g_object_unref (simple);
- g_object_unref (card);
-#endif
+
+ eab_merging_book_add_contact (eab_model_get_ebook (priv->model), contact, NULL, NULL);
+
+ g_object_unref (contact);
}
/* This function duplicates the value passed to it. */
diff --git a/addressbook/gui/widgets/e-minicard-label.c b/addressbook/gui/widgets/e-minicard-label.c
index 31935164d7..df1465349e 100644
--- a/addressbook/gui/widgets/e-minicard-label.c
+++ b/addressbook/gui/widgets/e-minicard-label.c
@@ -229,7 +229,7 @@ e_minicard_label_set_property (GObject *object, guint prop_id, const GValue *va
break;
case PROP_EDITABLE:
e_minicard_label->editable = g_value_get_boolean (value);
- g_object_set (e_minicard_label->field, "editable", e_minicard_label->editable, NULL);
+ g_object_set (e_minicard_label->field, "editable", FALSE /* e_minicard_label->editable */, NULL);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -322,7 +322,7 @@ e_minicard_label_realize (GnomeCanvasItem *item)
"clip", TRUE,
"use_ellipsis", TRUE,
"fill_color", "black",
- "editable", e_minicard_label->editable,
+ "editable", FALSE, /* e_minicard_label->editable, */
"draw_background", FALSE,
"im_context", E_CANVAS (item->canvas)->im_context,
NULL );
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c
index 85060ce156..259d2b12f0 100644
--- a/addressbook/gui/widgets/e-minicard.c
+++ b/addressbook/gui/widgets/e-minicard.c
@@ -331,10 +331,11 @@ e_minicard_set_property (GObject *object, guint prop_id, const GValue *value, G
break;
case PROP_EDITABLE:
e_minicard->editable = g_value_get_boolean (value);
- for (l = e_minicard->fields; l; l = l->next)
+ for (l = e_minicard->fields; l; l = l->next) {
g_object_set (E_MINICARD_FIELD (l->data)->label,
- "editable", e_minicard->editable,
+ "editable", FALSE /* e_minicard->editable */,
NULL);
+ }
break;
case PROP_HAS_CURSOR:
d(g_print("%s: PROP_HAS_CURSOR\n", G_GNUC_FUNCTION));
@@ -706,7 +707,7 @@ add_field (EMinicard *e_minicard, EContactField field, gdouble left_width)
"fieldname", name,
"field", string,
"max_field_name_length", left_width,
- "editable", FALSE,
+ "editable", FALSE /* e_minicard->editable */,
NULL );
#if notyet
g_object_set(E_MINICARD_LABEL(new_item)->field,