diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-05-28 12:26:30 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-05-28 12:26:30 +0800 |
commit | 350fde81677a44e5203a38c833e5175c3b649de2 (patch) | |
tree | fcf8a53c086d9a34fc0492b98a51128d54ba3753 /addressbook/gui | |
parent | f91435fc0c0186d48079dc44d8626135eba92462 (diff) | |
download | gsoc2013-evolution-350fde81677a44e5203a38c833e5175c3b649de2.tar gsoc2013-evolution-350fde81677a44e5203a38c833e5175c3b649de2.tar.gz gsoc2013-evolution-350fde81677a44e5203a38c833e5175c3b649de2.tar.bz2 gsoc2013-evolution-350fde81677a44e5203a38c833e5175c3b649de2.tar.lz gsoc2013-evolution-350fde81677a44e5203a38c833e5175c3b649de2.tar.xz gsoc2013-evolution-350fde81677a44e5203a38c833e5175c3b649de2.tar.zst gsoc2013-evolution-350fde81677a44e5203a38c833e5175c3b649de2.zip |
Added double click to open contact editor.
2000-05-25 Christopher James Lahey <clahey@helixcode.com>
* gui/component/addressbook.c,
gui/component/e-addressbook-model.c,
gui/component/e-addressbook-model.h: Added double click to open
contact editor.
svn path=/trunk/; revision=3239
Diffstat (limited to 'addressbook/gui')
-rw-r--r-- | addressbook/gui/component/addressbook.c | 60 | ||||
-rw-r--r-- | addressbook/gui/component/e-addressbook-model.c | 15 | ||||
-rw-r--r-- | addressbook/gui/component/e-addressbook-model.h | 4 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-model.c | 15 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-model.h | 4 |
5 files changed, 98 insertions, 0 deletions
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index 61a07db87c..dab940d088 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -94,6 +94,13 @@ card_added_cb (EBook* book, EBookStatus status, const char *id, } static void +card_modified_cb (EBook* book, EBookStatus status, + gpointer user_data) +{ + g_print ("%s: %s(): a card was modified\n", __FILE__, __FUNCTION__); +} + +static void new_contact_cb (BonoboUIHandler *uih, void *user_data, const char *path) { gint result; @@ -719,6 +726,56 @@ teardown_table_view (AddressbookView *view) } static void +table_double_click(ETable *table, gint row, AddressbookView *view) +{ + ECard *card = e_addressbook_model_get_card(E_ADDRESSBOOK_MODEL(view->model), row); + gint result; + GtkWidget* contact_editor; + EBook *book; + GtkWidget* dlg = gnome_dialog_new ("Contact Editor", "Save", "Cancel", NULL); + + contact_editor = e_contact_editor_new(card); + gtk_object_unref(GTK_OBJECT(card)); + + gtk_window_set_policy(GTK_WINDOW(dlg), FALSE, TRUE, FALSE); + + gtk_object_get(GTK_OBJECT(view->model), + "book", &book, + NULL); + + g_assert (E_IS_BOOK (book)); + + gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox), + contact_editor, TRUE, TRUE, 0); + + gtk_widget_show (contact_editor); + gtk_widget_show (dlg); + + gnome_dialog_close_hides (GNOME_DIALOG (dlg), TRUE); + result = gnome_dialog_run_and_close (GNOME_DIALOG (dlg)); + + + /* If the user clicks "okay"...*/ + if (result == 0) { + ECard *card; + g_assert (contact_editor); + g_assert (GTK_IS_OBJECT (contact_editor)); + gtk_object_get(GTK_OBJECT(contact_editor), + "card", &card, + NULL); + + /* Add the card in the contact editor to our ebook */ + e_book_commit_card ( + book, + card, + card_modified_cb, + NULL); + } + + gnome_dialog_close(GNOME_DIALOG (dlg)); +} + +static void create_table_view (AddressbookView *view, char *initial_query) { ECell *cell_left_just; @@ -765,6 +822,9 @@ create_table_view (AddressbookView *view, char *initial_query) initial layout. It does the rest. */ view->table = e_table_new (e_table_header, E_TABLE_MODEL(view->model), SPEC); + gtk_signal_connect(GTK_OBJECT(view->table), "double_click", + GTK_SIGNAL_FUNC(table_double_click), view); + 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 598f6786cf..5d71757b60 100644 --- a/addressbook/gui/component/e-addressbook-model.c +++ b/addressbook/gui/component/e-addressbook-model.c @@ -284,6 +284,21 @@ get_view(EAddressbookModel *model) return FALSE; } +ECard * +e_addressbook_model_get_card(EAddressbookModel *model, + int row) +{ + if (model->data && row < model->data_count) { + ECard *card; + gtk_object_get(GTK_OBJECT(model->data[row]), + "card", &card, + NULL); + gtk_object_ref(GTK_OBJECT(card)); + return card; + } + return NULL; +} + static void e_addressbook_model_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) { diff --git a/addressbook/gui/component/e-addressbook-model.h b/addressbook/gui/component/e-addressbook-model.h index a428b076a9..bff9a21d00 100644 --- a/addressbook/gui/component/e-addressbook-model.h +++ b/addressbook/gui/component/e-addressbook-model.h @@ -45,4 +45,8 @@ typedef struct { GtkType e_addressbook_model_get_type (void); ETableModel *e_addressbook_model_new (void); +/* Returns object with ref count of 1. */ +ECard *e_addressbook_model_get_card(EAddressbookModel *model, + int row); + #endif /* _E_ADDRESSBOOK_MODEL_H_ */ diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c index 598f6786cf..5d71757b60 100644 --- a/addressbook/gui/widgets/e-addressbook-model.c +++ b/addressbook/gui/widgets/e-addressbook-model.c @@ -284,6 +284,21 @@ get_view(EAddressbookModel *model) return FALSE; } +ECard * +e_addressbook_model_get_card(EAddressbookModel *model, + int row) +{ + if (model->data && row < model->data_count) { + ECard *card; + gtk_object_get(GTK_OBJECT(model->data[row]), + "card", &card, + NULL); + gtk_object_ref(GTK_OBJECT(card)); + return card; + } + return NULL; +} + static void e_addressbook_model_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) { diff --git a/addressbook/gui/widgets/e-addressbook-model.h b/addressbook/gui/widgets/e-addressbook-model.h index a428b076a9..bff9a21d00 100644 --- a/addressbook/gui/widgets/e-addressbook-model.h +++ b/addressbook/gui/widgets/e-addressbook-model.h @@ -45,4 +45,8 @@ typedef struct { GtkType e_addressbook_model_get_type (void); ETableModel *e_addressbook_model_new (void); +/* Returns object with ref count of 1. */ +ECard *e_addressbook_model_get_card(EAddressbookModel *model, + int row); + #endif /* _E_ADDRESSBOOK_MODEL_H_ */ |