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>
* 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
contact_list_is_cell_editable (ETableModel *etc, int col, int row)
{
return FALSE;
return TRUE;
}
/* This function duplicates the value passed to it. */

View File

@ -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;
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;
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. */

View File

@ -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 );

View File

@ -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,