aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/widgets/e-addressbook-model.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-07-08 13:21:06 +0800
committerChris Lahey <clahey@src.gnome.org>2000-07-08 13:21:06 +0800
commit04c9a5189dac46e93a3b35134dbc499df3e28c21 (patch)
tree80eb111e562f39c0b2b75b5e9a974689c1a50427 /addressbook/gui/widgets/e-addressbook-model.c
parentd1550ea22f88670875c2cb77d2bb46d8a97d6de0 (diff)
downloadgsoc2013-evolution-04c9a5189dac46e93a3b35134dbc499df3e28c21.tar
gsoc2013-evolution-04c9a5189dac46e93a3b35134dbc499df3e28c21.tar.gz
gsoc2013-evolution-04c9a5189dac46e93a3b35134dbc499df3e28c21.tar.bz2
gsoc2013-evolution-04c9a5189dac46e93a3b35134dbc499df3e28c21.tar.lz
gsoc2013-evolution-04c9a5189dac46e93a3b35134dbc499df3e28c21.tar.xz
gsoc2013-evolution-04c9a5189dac46e93a3b35134dbc499df3e28c21.tar.zst
gsoc2013-evolution-04c9a5189dac46e93a3b35134dbc499df3e28c21.zip
Added an "editable" argument.
2000-07-08 Christopher James Lahey <clahey@helixcode.com> * gui/component/e-addressbook-model.c, gui/component/e-addressbook-model.h: Added an "editable" argument. * gui/component/select-names/e-select-names.c: Set our EAddressModel to not be editable. svn path=/trunk/; revision=3969
Diffstat (limited to 'addressbook/gui/widgets/e-addressbook-model.c')
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index 7deda52c98..2401677807 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -29,6 +29,7 @@ enum {
ARG_0,
ARG_BOOK,
ARG_QUERY,
+ ARG_EDITABLE,
};
static void
@@ -93,24 +94,26 @@ addressbook_set_value_at (ETableModel *etc, int col, int row, const void *val)
{
EAddressbookModel *addressbook = E_ADDRESSBOOK_MODEL(etc);
ECard *card;
- if ( col >= E_CARD_SIMPLE_FIELD_LAST - 1|| row >= addressbook->data_count )
- return;
- e_card_simple_set(addressbook->data[row],
- col + 1,
- val);
- gtk_object_get(GTK_OBJECT(addressbook->data[row]),
- "card", &card,
- NULL);
- e_book_commit_card(addressbook->book, card, NULL, NULL);
-
- e_table_model_cell_changed(etc, col, row);
+ if (addressbook->editable) {
+ if ( col >= E_CARD_SIMPLE_FIELD_LAST - 1|| row >= addressbook->data_count )
+ return;
+ e_card_simple_set(addressbook->data[row],
+ col + 1,
+ val);
+ gtk_object_get(GTK_OBJECT(addressbook->data[row]),
+ "card", &card,
+ NULL);
+ e_book_commit_card(addressbook->book, card, NULL, NULL);
+
+ 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)
{
- return TRUE;
+ return E_ADDRESSBOOK_MODEL(etc)->editable;
}
static gint
@@ -219,6 +222,8 @@ e_addressbook_model_class_init (GtkObjectClass *object_class)
GTK_ARG_READWRITE, ARG_BOOK);
gtk_object_add_arg_type ("EAddressbookModel::query", GTK_TYPE_STRING,
GTK_ARG_READWRITE, ARG_QUERY);
+ gtk_object_add_arg_type ("EAddressbookModel::editable", GTK_TYPE_BOOL,
+ GTK_ARG_READWRITE, ARG_EDITABLE);
model_class->column_count = addressbook_col_count;
model_class->row_count = addressbook_row_count;
@@ -246,6 +251,7 @@ e_addressbook_model_init (GtkObject *object)
model->modify_card_id = 0;
model->data = NULL;
model->data_count = 0;
+ model->editable = TRUE;
}
static void
@@ -339,6 +345,9 @@ e_addressbook_model_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
if (model->get_view_idle == 0)
model->get_view_idle = g_idle_add((GSourceFunc)get_view, model);
break;
+ case ARG_EDITABLE:
+ model->editable = GTK_VALUE_BOOL (*arg);
+ break;
}
}
@@ -356,6 +365,9 @@ e_addressbook_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
case ARG_QUERY:
GTK_VALUE_STRING (*arg) = g_strdup(e_addressbook_model->query);
break;
+ case ARG_EDITABLE:
+ GTK_VALUE_BOOL (*arg) = e_addressbook_model->editable;
+ break;
default:
arg->type = GTK_TYPE_INVALID;
break;