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
This commit is contained in:
Hans Petter Jansson
2003-11-14 00:38:47 +00:00
committed by Hans Petter
parent dbf9e56e63
commit 6cf20bbeba
5 changed files with 58 additions and 48 deletions

View File

@ -1,3 +1,21 @@
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.
2003-11-13 Ettore Perazzoli <ettore@ximian.com> 2003-11-13 Ettore Perazzoli <ettore@ximian.com>
* gui/component/addressbook-component.c * gui/component/addressbook-component.c

View File

@ -44,7 +44,7 @@ contact_list_set_value_at (ETableModel *etc, int col, int row, const void *val)
static gboolean static gboolean
contact_list_is_cell_editable (ETableModel *etc, int col, int row) contact_list_is_cell_editable (ETableModel *etc, int col, int row)
{ {
return FALSE; return TRUE;
} }
/* This function duplicates the value passed to it. */ /* This function duplicates the value passed to it. */

View File

@ -3,6 +3,7 @@
#include <config.h> #include <config.h>
#include "e-addressbook-model.h" #include "e-addressbook-model.h"
#include "e-addressbook-table-adapter.h" #include "e-addressbook-table-adapter.h"
#include "eab-contact-merging.h"
#include "eab-gui-util.h" #include "eab-gui-util.h"
#include "util/eab-destination.h" #include "util/eab-destination.h"
#include <libxml/tree.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. */ /* This function sets the value at a particular point in our ETableModel. */
#if 0
static void static void
card_modified_cb (EBook* book, EBookStatus status, contact_modified_cb (EBook* book, EBookStatus status,
gpointer user_data) gpointer user_data)
{ {
if (status != E_BOOK_ERROR_OK) if (status != E_BOOK_ERROR_OK)
eab_error_dialog (_("Error modifying card"), status); eab_error_dialog (_("Error modifying card"), status);
} }
#endif
static void static void
addressbook_set_value_at (ETableModel *etc, int col, int row, const void *val) addressbook_set_value_at (ETableModel *etc, int col, int row, const void *val)
{ {
#if 0
EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER(etc); EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER(etc);
EAddressbookTableAdapterPrivate *priv = adapter->priv; EAddressbookTableAdapterPrivate *priv = adapter->priv;
if (eab_model_editable (priv->model)) {
ECard *card;
if ( col >= COLS|| row >= eab_model_card_count (priv->model) ) if (eab_model_editable (priv->model)) {
EContact *contact;
if (col >= COLS || row >= eab_model_contact_count (priv->model))
return;
contact = eab_model_get_contact (priv->model, row);
if (!contact)
return; return;
e_table_model_pre_change(etc); e_table_model_pre_change(etc);
e_card_simple_set(priv->simples[row], e_contact_set(contact, col, (void *) val);
col, eab_merging_book_commit_contact (eab_model_get_ebook (priv->model),
val); contact, contact_modified_cb, NULL);
g_object_get(priv->simples[row],
"card", &card,
NULL);
e_card_merging_book_commit_card(eab_model_get_ebook(priv->model), g_object_unref (contact);
card, card_modified_cb, NULL);
g_object_unref (card);
/* 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); e_table_model_cell_changed(etc, col, row);
} }
#endif
} }
/* This function returns whether a particular cell is editable. */ /* This function returns whether a particular cell is editable. */
static gboolean static gboolean
addressbook_is_cell_editable (ETableModel *etc, int col, int row) addressbook_is_cell_editable (ETableModel *etc, int col, int row)
{ {
#if 0
EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER(etc); EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER(etc);
EAddressbookTableAdapterPrivate *priv = adapter->priv; EAddressbookTableAdapterPrivate *priv = adapter->priv;
ECard *card; const EContact *contact;
if (row >= 0 && row < eab_model_card_count (priv->model)) if (row >= 0 && row < eab_model_contact_count (priv->model))
card = eab_model_card_at (priv->model, row); contact = eab_model_contact_at (priv->model, row);
else else
card = NULL; contact = NULL;
if (!eab_model_editable(priv->model)) if (!eab_model_editable(priv->model))
return FALSE; 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 /* we only allow editing of the name and file as for
lists */ 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 else
return col < E_CARD_SIMPLE_FIELD_LAST_SIMPLE_STRING; return col < E_CONTACT_LAST_SIMPLE_STRING;
#else
return FALSE; return FALSE;
#endif
} }
static void static void
addressbook_append_row (ETableModel *etm, ETableModel *source, gint row) addressbook_append_row (ETableModel *etm, ETableModel *source, gint row)
{ {
#if 0
EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER(etm); EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER(etm);
EAddressbookTableAdapterPrivate *priv = adapter->priv; EAddressbookTableAdapterPrivate *priv = adapter->priv;
ECard *card; EContact *contact;
ECardSimple *simple;
int col; int col;
card = e_card_new(""); contact = e_contact_new ();
simple = e_card_simple_new(card);
for (col = 0; col < E_CARD_SIMPLE_FIELD_LAST_SIMPLE_STRING; col++) { for (col = 1; col < E_CONTACT_LAST_SIMPLE_STRING; col++) {
const void *val = e_table_model_value_at (source, col, row); const void *val = e_table_model_value_at (source, col, row);
e_card_simple_set(simple, col, val); 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); eab_merging_book_add_contact (eab_model_get_ebook (priv->model), contact, NULL, NULL);
g_object_unref (simple);
g_object_unref (card); g_object_unref (contact);
#endif
} }
/* This function duplicates the value passed to it. */ /* This function duplicates the value passed to it. */

View File

@ -229,7 +229,7 @@ e_minicard_label_set_property (GObject *object, guint prop_id, const GValue *va
break; break;
case PROP_EDITABLE: case PROP_EDITABLE:
e_minicard_label->editable = g_value_get_boolean (value); 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; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -322,7 +322,7 @@ e_minicard_label_realize (GnomeCanvasItem *item)
"clip", TRUE, "clip", TRUE,
"use_ellipsis", TRUE, "use_ellipsis", TRUE,
"fill_color", "black", "fill_color", "black",
"editable", e_minicard_label->editable, "editable", FALSE, /* e_minicard_label->editable, */
"draw_background", FALSE, "draw_background", FALSE,
"im_context", E_CANVAS (item->canvas)->im_context, "im_context", E_CANVAS (item->canvas)->im_context,
NULL ); NULL );

View File

@ -331,10 +331,11 @@ e_minicard_set_property (GObject *object, guint prop_id, const GValue *value, G
break; break;
case PROP_EDITABLE: case PROP_EDITABLE:
e_minicard->editable = g_value_get_boolean (value); 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, g_object_set (E_MINICARD_FIELD (l->data)->label,
"editable", e_minicard->editable, "editable", FALSE /* e_minicard->editable */,
NULL); NULL);
}
break; break;
case PROP_HAS_CURSOR: case PROP_HAS_CURSOR:
d(g_print("%s: PROP_HAS_CURSOR\n", G_GNUC_FUNCTION)); 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, "fieldname", name,
"field", string, "field", string,
"max_field_name_length", left_width, "max_field_name_length", left_width,
"editable", FALSE, "editable", FALSE /* e_minicard->editable */,
NULL ); NULL );
#if notyet #if notyet
g_object_set(E_MINICARD_LABEL(new_item)->field, g_object_set(E_MINICARD_LABEL(new_item)->field,