diff options
Diffstat (limited to 'addressbook/gui')
-rw-r--r-- | addressbook/gui/component/addressbook.c | 6 | ||||
-rw-r--r-- | addressbook/gui/component/e-addressbook-model.c | 22 | ||||
-rw-r--r-- | addressbook/gui/component/e-cardlist-model.c | 7 | ||||
-rw-r--r-- | addressbook/gui/component/e-select-names.c | 1 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor-categories.c | 11 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-model.c | 22 |
6 files changed, 66 insertions, 3 deletions
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index 1bce1010e3..c080e35e5e 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -745,7 +745,7 @@ set_prop (BonoboPropertyBag *bag, } #define SPEC "<?xml version=\"1.0\"?> \ -<ETableSpecification> \ +<ETableSpecification click-to-add=\"1\"> \ <columns-shown> \ <column>0</column> \ <column>1</column> \ @@ -1023,6 +1023,10 @@ create_table_view (AddressbookView *view, char *initial_query) gtk_signal_connect(GTK_OBJECT(view->table), "right_click", GTK_SIGNAL_FUNC(table_right_click), view); + gtk_object_set (GTK_OBJECT(view->table), + "click_to_add_message", _("* Click here to add a contact *"), + NULL); + gtk_box_pack_start(GTK_BOX(view->vbox), view->table, TRUE, TRUE, 0); gtk_widget_show_all( GTK_WIDGET(view->table) ); diff --git a/addressbook/gui/component/e-addressbook-model.c b/addressbook/gui/component/e-addressbook-model.c index f5d2fca7cb..7deda52c98 100644 --- a/addressbook/gui/component/e-addressbook-model.c +++ b/addressbook/gui/component/e-addressbook-model.c @@ -113,6 +113,19 @@ addressbook_is_cell_editable (ETableModel *etc, int col, int row) return TRUE; } +static gint +addressbook_append_row (ETableModel *etm) +{ + ECard *card; + EAddressbookModel *model = E_ADDRESSBOOK_MODEL(etm); + model->data = g_realloc(model->data, (model->data_count + 1) * sizeof(ECard *)); + card = e_card_new(""); + model->data[model->data_count++] = e_card_simple_new (card); + gtk_object_unref(GTK_OBJECT(card)); + e_table_model_row_inserted(E_TABLE_MODEL(model), model->data_count - 1); + return model->data_count - 1; +} + /* This function duplicates the value passed to it. */ static void * addressbook_duplicate_value (ETableModel *etc, int col, const void *value) @@ -139,6 +152,12 @@ addressbook_value_is_empty (ETableModel *etc, int col, const void *value) return !(value && *(char *)value); } +static char * +addressbook_value_to_string (ETableModel *etc, int col, const void *value) +{ + return g_strdup(value); +} + static void create_card(EBookView *book_view, const GList *cards, @@ -146,7 +165,6 @@ create_card(EBookView *book_view, { model->data = g_realloc(model->data, (model->data_count + g_list_length((GList *)cards)) * sizeof(ECard *)); for ( ; cards; cards = cards->next) { - gtk_object_ref(GTK_OBJECT(cards->data)); model->data[model->data_count++] = e_card_simple_new (E_CARD(cards->data)); e_table_model_row_inserted(E_TABLE_MODEL(model), model->data_count - 1); } @@ -207,10 +225,12 @@ e_addressbook_model_class_init (GtkObjectClass *object_class) model_class->value_at = addressbook_value_at; model_class->set_value_at = addressbook_set_value_at; model_class->is_cell_editable = addressbook_is_cell_editable; + model_class->append_row = addressbook_append_row; 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->value_to_string = addressbook_value_to_string; } static void diff --git a/addressbook/gui/component/e-cardlist-model.c b/addressbook/gui/component/e-cardlist-model.c index e4a802439a..23b61d58be 100644 --- a/addressbook/gui/component/e-cardlist-model.c +++ b/addressbook/gui/component/e-cardlist-model.c @@ -107,6 +107,12 @@ e_cardlist_model_value_is_empty (ETableModel *etc, int col, const void *value) return !(value && *(char *)value); } +static char * +e_cardlist_model_value_to_string (ETableModel *etc, int col, const void *value) +{ + return g_strdup(value); +} + void e_cardlist_model_add(ECardlistModel *model, ECard **cards, @@ -160,6 +166,7 @@ e_cardlist_model_class_init (GtkObjectClass *object_class) model_class->free_value = e_cardlist_model_free_value; model_class->initialize_value = e_cardlist_model_initialize_value; model_class->value_is_empty = e_cardlist_model_value_is_empty; + model_class->value_to_string = e_cardlist_model_value_to_string; } static void diff --git a/addressbook/gui/component/e-select-names.c b/addressbook/gui/component/e-select-names.c index 517d071ede..5cb68a7f92 100644 --- a/addressbook/gui/component/e-select-names.c +++ b/addressbook/gui/component/e-select-names.c @@ -97,6 +97,7 @@ e_select_names_class_init (ESelectNamesClass *klass) #define SPEC "<ETableSpecification no-header=\"1\"> \ <columns-shown> \ <column> 0 </column> \ + <column> 2 </column> \ </columns-shown> \ <grouping> <leaf column=\"0\" ascending=\"1\"/> </grouping> \ </ETableSpecification>" diff --git a/addressbook/gui/contact-editor/e-contact-editor-categories.c b/addressbook/gui/contact-editor/e-contact-editor-categories.c index e58162a06a..03e1265795 100644 --- a/addressbook/gui/contact-editor/e-contact-editor-categories.c +++ b/addressbook/gui/contact-editor/e-contact-editor-categories.c @@ -42,6 +42,7 @@ static void *e_contact_editor_categories_duplicate_value (ETableModel *etc, int 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 char * e_contact_editor_categories_value_to_string (ETableModel *etc, int col, const void *value, gpointer data); static GnomeDialogClass *parent_class = NULL; @@ -274,6 +275,7 @@ e_contact_editor_categories_init (EContactEditorCategories *categories) e_contact_editor_categories_free_value, e_contact_editor_categories_initialize_value, e_contact_editor_categories_value_is_empty, + e_contact_editor_categories_value_to_string, categories); header = e_table_header_new(); @@ -454,3 +456,12 @@ e_contact_editor_categories_value_is_empty (ETableModel *etc, int col, const voi else return !(value && *(char *)value); } + +static char * +e_contact_editor_categories_value_to_string (ETableModel *etc, int col, const void *value, gpointer data) +{ + if (col == 0) + return g_strdup_printf("%d", (int) value); + else + return g_strdup(value); +} diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c index f5d2fca7cb..7deda52c98 100644 --- a/addressbook/gui/widgets/e-addressbook-model.c +++ b/addressbook/gui/widgets/e-addressbook-model.c @@ -113,6 +113,19 @@ addressbook_is_cell_editable (ETableModel *etc, int col, int row) return TRUE; } +static gint +addressbook_append_row (ETableModel *etm) +{ + ECard *card; + EAddressbookModel *model = E_ADDRESSBOOK_MODEL(etm); + model->data = g_realloc(model->data, (model->data_count + 1) * sizeof(ECard *)); + card = e_card_new(""); + model->data[model->data_count++] = e_card_simple_new (card); + gtk_object_unref(GTK_OBJECT(card)); + e_table_model_row_inserted(E_TABLE_MODEL(model), model->data_count - 1); + return model->data_count - 1; +} + /* This function duplicates the value passed to it. */ static void * addressbook_duplicate_value (ETableModel *etc, int col, const void *value) @@ -139,6 +152,12 @@ addressbook_value_is_empty (ETableModel *etc, int col, const void *value) return !(value && *(char *)value); } +static char * +addressbook_value_to_string (ETableModel *etc, int col, const void *value) +{ + return g_strdup(value); +} + static void create_card(EBookView *book_view, const GList *cards, @@ -146,7 +165,6 @@ create_card(EBookView *book_view, { model->data = g_realloc(model->data, (model->data_count + g_list_length((GList *)cards)) * sizeof(ECard *)); for ( ; cards; cards = cards->next) { - gtk_object_ref(GTK_OBJECT(cards->data)); model->data[model->data_count++] = e_card_simple_new (E_CARD(cards->data)); e_table_model_row_inserted(E_TABLE_MODEL(model), model->data_count - 1); } @@ -207,10 +225,12 @@ e_addressbook_model_class_init (GtkObjectClass *object_class) model_class->value_at = addressbook_value_at; model_class->set_value_at = addressbook_set_value_at; model_class->is_cell_editable = addressbook_is_cell_editable; + model_class->append_row = addressbook_append_row; 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->value_to_string = addressbook_value_to_string; } static void |