diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-05-20 02:47:39 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-05-20 02:47:39 +0800 |
commit | 26c45ab265e8dfec121a765306143de5a579ccbb (patch) | |
tree | 734c156b57bf46892423fdc0f8c2d51e3447e96c | |
parent | 46f211579d1dfd60147099942b40c9697796e7c8 (diff) | |
download | gsoc2013-evolution-26c45ab265e8dfec121a765306143de5a579ccbb.tar.gz gsoc2013-evolution-26c45ab265e8dfec121a765306143de5a579ccbb.tar.zst gsoc2013-evolution-26c45ab265e8dfec121a765306143de5a579ccbb.zip |
Added initialize_value and value_is_empty callbacks.
2000-05-19 Christopher James Lahey <clahey@helixcode.com>
* contact-editor/e-contact-editor-categories.c,
gui/component/e-addressbook-model.c: Added initialize_value and
value_is_empty callbacks.
svn path=/trunk/; revision=3139
-rw-r--r-- | addressbook/ChangeLog | 6 | ||||
-rw-r--r-- | addressbook/contact-editor/e-contact-editor-categories.c | 22 | ||||
-rw-r--r-- | addressbook/gui/component/e-addressbook-model.c | 14 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor-categories.c | 22 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-model.c | 14 |
5 files changed, 78 insertions, 0 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 21dcebd4a1..a3eb738631 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,11 @@ 2000-05-19 Christopher James Lahey <clahey@helixcode.com> + * contact-editor/e-contact-editor-categories.c, + gui/component/e-addressbook-model.c: Added initialize_value and + value_is_empty callbacks. + +2000-05-19 Christopher James Lahey <clahey@helixcode.com> + * contact-editor/e-contact-editor.c: Fixed a bug that broke address field support. diff --git a/addressbook/contact-editor/e-contact-editor-categories.c b/addressbook/contact-editor/e-contact-editor-categories.c index 3287672861..831fbce2b9 100644 --- a/addressbook/contact-editor/e-contact-editor-categories.c +++ b/addressbook/contact-editor/e-contact-editor-categories.c @@ -40,6 +40,8 @@ static void e_contact_editor_categories_set_value_at (ETableModel *etc, int col, static gboolean e_contact_editor_categories_is_cell_editable (ETableModel *etc, int col, int row, gpointer data); static void *e_contact_editor_categories_duplicate_value (ETableModel *etc, int col, const void *value, gpointer data); static void e_contact_editor_categories_free_value (ETableModel *etc, int col, void *value, gpointer data); +static void *e_contact_editor_categories_initialize_value (ETableModel *etc, int col, gpointer data); +static gboolean e_contact_editor_categories_value_is_empty (ETableModel *etc, int col, const void *value, gpointer data); static void e_contact_editor_categories_thaw (ETableModel *etc, gpointer data); static GnomeDialogClass *parent_class = NULL; @@ -271,6 +273,8 @@ e_contact_editor_categories_init (EContactEditorCategories *categories) e_contact_editor_categories_is_cell_editable, e_contact_editor_categories_duplicate_value, e_contact_editor_categories_free_value, + e_contact_editor_categories_initialize_value, + e_contact_editor_categories_value_is_empty, e_contact_editor_categories_thaw, categories); @@ -435,6 +439,24 @@ e_contact_editor_categories_free_value (ETableModel *etc, int col, void *value, g_free(value); } +static void * +e_contact_editor_categories_initialize_value (ETableModel *etc, int col, gpointer data) +{ + if (col == 0) + return NULL; + else + return g_strdup(""); +} + +static gboolean +e_contact_editor_categories_value_is_empty (ETableModel *etc, int col, const void *value, gpointer data) +{ + if (col == 0) + return value == NULL; + else + return !(value && *(char *)value); +} + /* This function is for when the model is unfrozen. This can mostly be ignored for simple models. */ static void diff --git a/addressbook/gui/component/e-addressbook-model.c b/addressbook/gui/component/e-addressbook-model.c index b2f7332c52..598f6786cf 100644 --- a/addressbook/gui/component/e-addressbook-model.c +++ b/addressbook/gui/component/e-addressbook-model.c @@ -125,6 +125,18 @@ addressbook_free_value (ETableModel *etc, int col, void *value) g_free(value); } +static void * +addressbook_initialize_value (ETableModel *etc, int col) +{ + return g_strdup(""); +} + +static gboolean +addressbook_value_is_empty (ETableModel *etc, int col, const void *value) +{ + return !(value && *(char *)value); +} + /* This function is for when the model is unfrozen. This can mostly be ignored for simple models. */ static void @@ -201,6 +213,8 @@ e_addressbook_model_class_init (GtkObjectClass *object_class) model_class->is_cell_editable = addressbook_is_cell_editable; model_class->duplicate_value = addressbook_duplicate_value; model_class->free_value = addressbook_free_value; + model_class->initialize_value = addressbook_initialize_value; + model_class->value_is_empty = addressbook_value_is_empty; model_class->thaw = addressbook_thaw; } diff --git a/addressbook/gui/contact-editor/e-contact-editor-categories.c b/addressbook/gui/contact-editor/e-contact-editor-categories.c index 3287672861..831fbce2b9 100644 --- a/addressbook/gui/contact-editor/e-contact-editor-categories.c +++ b/addressbook/gui/contact-editor/e-contact-editor-categories.c @@ -40,6 +40,8 @@ static void e_contact_editor_categories_set_value_at (ETableModel *etc, int col, static gboolean e_contact_editor_categories_is_cell_editable (ETableModel *etc, int col, int row, gpointer data); static void *e_contact_editor_categories_duplicate_value (ETableModel *etc, int col, const void *value, gpointer data); static void e_contact_editor_categories_free_value (ETableModel *etc, int col, void *value, gpointer data); +static void *e_contact_editor_categories_initialize_value (ETableModel *etc, int col, gpointer data); +static gboolean e_contact_editor_categories_value_is_empty (ETableModel *etc, int col, const void *value, gpointer data); static void e_contact_editor_categories_thaw (ETableModel *etc, gpointer data); static GnomeDialogClass *parent_class = NULL; @@ -271,6 +273,8 @@ e_contact_editor_categories_init (EContactEditorCategories *categories) e_contact_editor_categories_is_cell_editable, e_contact_editor_categories_duplicate_value, e_contact_editor_categories_free_value, + e_contact_editor_categories_initialize_value, + e_contact_editor_categories_value_is_empty, e_contact_editor_categories_thaw, categories); @@ -435,6 +439,24 @@ e_contact_editor_categories_free_value (ETableModel *etc, int col, void *value, g_free(value); } +static void * +e_contact_editor_categories_initialize_value (ETableModel *etc, int col, gpointer data) +{ + if (col == 0) + return NULL; + else + return g_strdup(""); +} + +static gboolean +e_contact_editor_categories_value_is_empty (ETableModel *etc, int col, const void *value, gpointer data) +{ + if (col == 0) + return value == NULL; + else + return !(value && *(char *)value); +} + /* This function is for when the model is unfrozen. This can mostly be ignored for simple models. */ static void diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c index b2f7332c52..598f6786cf 100644 --- a/addressbook/gui/widgets/e-addressbook-model.c +++ b/addressbook/gui/widgets/e-addressbook-model.c @@ -125,6 +125,18 @@ addressbook_free_value (ETableModel *etc, int col, void *value) g_free(value); } +static void * +addressbook_initialize_value (ETableModel *etc, int col) +{ + return g_strdup(""); +} + +static gboolean +addressbook_value_is_empty (ETableModel *etc, int col, const void *value) +{ + return !(value && *(char *)value); +} + /* This function is for when the model is unfrozen. This can mostly be ignored for simple models. */ static void @@ -201,6 +213,8 @@ e_addressbook_model_class_init (GtkObjectClass *object_class) model_class->is_cell_editable = addressbook_is_cell_editable; model_class->duplicate_value = addressbook_duplicate_value; model_class->free_value = addressbook_free_value; + model_class->initialize_value = addressbook_initialize_value; + model_class->value_is_empty = addressbook_value_is_empty; model_class->thaw = addressbook_thaw; } |