aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/widgets
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2001-03-02 19:02:33 +0800
committerChris Toshok <toshok@src.gnome.org>2001-03-02 19:02:33 +0800
commit0d345b68bf4ab7f2d21f3387f11e1c42c335e0b4 (patch)
treeb8ded202fd5216426089ddb3af49a0b73dd9a2d8 /addressbook/gui/widgets
parent3e7e23772816efd672b314bcf507609cea821dd5 (diff)
downloadgsoc2013-evolution-0d345b68bf4ab7f2d21f3387f11e1c42c335e0b4.tar
gsoc2013-evolution-0d345b68bf4ab7f2d21f3387f11e1c42c335e0b4.tar.gz
gsoc2013-evolution-0d345b68bf4ab7f2d21f3387f11e1c42c335e0b4.tar.bz2
gsoc2013-evolution-0d345b68bf4ab7f2d21f3387f11e1c42c335e0b4.tar.lz
gsoc2013-evolution-0d345b68bf4ab7f2d21f3387f11e1c42c335e0b4.tar.xz
gsoc2013-evolution-0d345b68bf4ab7f2d21f3387f11e1c42c335e0b4.tar.zst
gsoc2013-evolution-0d345b68bf4ab7f2d21f3387f11e1c42c335e0b4.zip
new function. (e_minicard_view_event): split out the creation of the
2001-03-02 Chris Toshok <toshok@ximian.com> * gui/widgets/e-minicard-view.c (supported_fields_cb): new function. (e_minicard_view_event): split out the creation of the contact editor to the supported_fields callback. * gui/widgets/e-minicard.c (supported_fields_cb): new function. (e_minicard_event): split out the creation of the contact editor to the supported_fields callback. * gui/widgets/e-addressbook-view.c (table_double_click): split function into two functions, since e_book_get_supported_fields requires a callback now. (supported_fields_cb): new function. * gui/component/addressbook.c (new_contact_cb): split this into two functions, since e_book_get_supported_fields requires a callback now. (supported_fields_cb): new function. * contact-editor/test-editor.c (main): track change to e_contact_editor_new (pass NULL for the writable_fields arg.) * contact-editor/contact-editor.glade: fix several labels so they make better sense (since we look them up in e-contact-editor.c.) * contact-editor/e-contact-editor.h (struct _EContactEditor): add writable_fields. also, add it to e_contact_editor_new. * contact-editor/e-contact-editor.c (e_contact_editor_class_init): add writable_fields arg. (e_contact_editor_destroy): unref the writable_fields list. (e_contact_editor_new): pass @fields as the writable_fields arg. (e_contact_editor_set_arg): add writable_fields support. (enable_writable_fields): new (very hairy) function, to disable everything and reenable just the fields listed in the writable_fields list. (_email_arrow_pressed): set label-email1, entry-email1, and checkbutton-htmlmail to be sensitive since the only way to get here is to activate a writable field in the menu. (_address_arrow_pressed): set label-address, button-fulladdr, and text-address to be sensitive for the same reason. (_phone_arrow_pressed): sensitize the label and entry for the same reason. svn path=/trunk/; revision=8516
Diffstat (limited to 'addressbook/gui/widgets')
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c33
-rw-r--r--addressbook/gui/widgets/e-minicard-view.c38
-rw-r--r--addressbook/gui/widgets/e-minicard.c31
3 files changed, 65 insertions, 37 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 24070181f3..bc22ff65d6 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -392,13 +392,31 @@ editor_closed_cb (EContactEditor *ce, gpointer data)
}
static void
+supported_fields_cb (EBook *book, EBookStatus status, EList *fields, ECard *card)
+{
+ EContactEditor *ce;
+
+ ce = e_contact_editor_new (card, FALSE, fields);
+
+ gtk_signal_connect (GTK_OBJECT (ce), "add_card",
+ GTK_SIGNAL_FUNC (add_card_cb), book);
+ gtk_signal_connect (GTK_OBJECT (ce), "commit_card",
+ GTK_SIGNAL_FUNC (commit_card_cb), book);
+ gtk_signal_connect (GTK_OBJECT (ce), "delete_card",
+ GTK_SIGNAL_FUNC (delete_card_cb), book);
+ gtk_signal_connect (GTK_OBJECT (ce), "editor_closed",
+ GTK_SIGNAL_FUNC (editor_closed_cb), NULL);
+
+ gtk_object_unref(GTK_OBJECT(card));
+}
+
+static void
table_double_click(ETableScrolled *table, gint row, EAddressbookView *view)
{
if (E_IS_ADDRESSBOOK_MODEL(view->object)) {
EAddressbookModel *model = E_ADDRESSBOOK_MODEL(view->object);
ECard *card = e_addressbook_model_get_card(model, row);
EBook *book;
- EContactEditor *ce;
gtk_object_get(GTK_OBJECT(model),
"book", &book,
@@ -406,18 +424,7 @@ table_double_click(ETableScrolled *table, gint row, EAddressbookView *view)
g_assert (E_IS_BOOK (book));
- ce = e_contact_editor_new (card, FALSE);
-
- gtk_signal_connect (GTK_OBJECT (ce), "add_card",
- GTK_SIGNAL_FUNC (add_card_cb), book);
- gtk_signal_connect (GTK_OBJECT (ce), "commit_card",
- GTK_SIGNAL_FUNC (commit_card_cb), book);
- gtk_signal_connect (GTK_OBJECT (ce), "delete_card",
- GTK_SIGNAL_FUNC (delete_card_cb), book);
- gtk_signal_connect (GTK_OBJECT (ce), "editor_closed",
- GTK_SIGNAL_FUNC (editor_closed_cb), NULL);
-
- gtk_object_unref(GTK_OBJECT(card));
+ e_book_get_supported_fields (book, (EBookFieldsCallback)supported_fields_cb, card);
}
}
diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c
index 3e3b1ceaf0..e503d54d1f 100644
--- a/addressbook/gui/widgets/e-minicard-view.c
+++ b/addressbook/gui/widgets/e-minicard-view.c
@@ -401,6 +401,26 @@ editor_closed_cb (EContactEditor *ce, gpointer data)
gtk_object_unref (GTK_OBJECT (ce));
}
+static void
+supported_fields_cb (EBook *book, EBookStatus status, EList *fields, EMinicard *e_minicard)
+{
+ ECard *card;
+ EContactEditor *ce;
+
+ card = e_card_new("");
+
+ ce = e_contact_editor_new (card, TRUE, fields);
+
+ gtk_signal_connect (GTK_OBJECT (ce), "add_card",
+ GTK_SIGNAL_FUNC (add_card_cb), book);
+ gtk_signal_connect (GTK_OBJECT (ce), "commit_card",
+ GTK_SIGNAL_FUNC (commit_card_cb), book);
+ gtk_signal_connect (GTK_OBJECT (ce), "editor_closed",
+ GTK_SIGNAL_FUNC (editor_closed_cb), NULL);
+
+ gtk_object_sink(GTK_OBJECT(card));
+}
+
static gboolean
e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event)
{
@@ -412,25 +432,15 @@ e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event)
case GDK_2BUTTON_PRESS:
if (((GdkEventButton *)event)->button == 1)
{
- ECard *card;
- EContactEditor *ce;
EBook *book;
- card = e_card_new("");
-
gtk_object_get(GTK_OBJECT(view), "book", &book, NULL);
- g_assert (E_IS_BOOK (book));
-
- ce = e_contact_editor_new (card, TRUE);
- gtk_signal_connect (GTK_OBJECT (ce), "add_card",
- GTK_SIGNAL_FUNC (add_card_cb), book);
- gtk_signal_connect (GTK_OBJECT (ce), "commit_card",
- GTK_SIGNAL_FUNC (commit_card_cb), book);
- gtk_signal_connect (GTK_OBJECT (ce), "editor_closed",
- GTK_SIGNAL_FUNC (editor_closed_cb), NULL);
+ g_assert (E_IS_BOOK (book));
- gtk_object_sink(GTK_OBJECT(card));
+ e_book_get_supported_fields (book,
+ (EBookFieldsCallback)supported_fields_cb,
+ NULL);
}
return TRUE;
default:
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c
index 6208f1f23f..22566ec749 100644
--- a/addressbook/gui/widgets/e-minicard.c
+++ b/addressbook/gui/widgets/e-minicard.c
@@ -557,6 +557,24 @@ editor_closed_cb (EContactEditor *ce, gpointer data)
minicard->editor = NULL;
}
+static void
+supported_fields_cb (EBook *book, EBookStatus status, EList *fields, EMinicard *e_minicard)
+{
+ e_minicard->editor = e_contact_editor_new (e_minicard->card, FALSE, fields);
+
+ if (book != NULL) {
+ gtk_signal_connect (GTK_OBJECT (e_minicard->editor), "add_card",
+ GTK_SIGNAL_FUNC (add_card_cb), book);
+ gtk_signal_connect (GTK_OBJECT (e_minicard->editor), "commit_card",
+ GTK_SIGNAL_FUNC (commit_card_cb), book);
+ gtk_signal_connect (GTK_OBJECT (e_minicard->editor), "delete_card",
+ GTK_SIGNAL_FUNC (delete_card_cb), book);
+ }
+
+ gtk_signal_connect (GTK_OBJECT (e_minicard->editor), "editor_closed",
+ GTK_SIGNAL_FUNC (editor_closed_cb), e_minicard);
+}
+
static gboolean
e_minicard_event (GnomeCanvasItem *item, GdkEvent *event)
{
@@ -641,19 +659,12 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event)
"book", &book,
NULL);
}
- e_minicard->editor = e_contact_editor_new (e_minicard->card, FALSE);
if (book != NULL) {
- gtk_signal_connect (GTK_OBJECT (e_minicard->editor), "add_card",
- GTK_SIGNAL_FUNC (add_card_cb), book);
- gtk_signal_connect (GTK_OBJECT (e_minicard->editor), "commit_card",
- GTK_SIGNAL_FUNC (commit_card_cb), book);
- gtk_signal_connect (GTK_OBJECT (e_minicard->editor), "delete_card",
- GTK_SIGNAL_FUNC (delete_card_cb), book);
+ e_book_get_supported_fields (book,
+ (EBookFieldsCallback)supported_fields_cb,
+ e_minicard);
}
-
- gtk_signal_connect (GTK_OBJECT (e_minicard->editor), "editor_closed",
- GTK_SIGNAL_FUNC (editor_closed_cb), e_minicard);
}
return TRUE;
}