aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/widgets/e-minicard.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-07-21 04:59:36 +0800
committerChris Lahey <clahey@src.gnome.org>2000-07-21 04:59:36 +0800
commit8ab34219361284ed90033fdfb2c425ef804e1cc7 (patch)
tree2d0979fea28d9aecc7fa374cdce35bbe55b12a89 /addressbook/gui/widgets/e-minicard.c
parent782d8a198c2d18a0395cee729245e2f724ae0a90 (diff)
downloadgsoc2013-evolution-8ab34219361284ed90033fdfb2c425ef804e1cc7.tar
gsoc2013-evolution-8ab34219361284ed90033fdfb2c425ef804e1cc7.tar.gz
gsoc2013-evolution-8ab34219361284ed90033fdfb2c425ef804e1cc7.tar.bz2
gsoc2013-evolution-8ab34219361284ed90033fdfb2c425ef804e1cc7.tar.lz
gsoc2013-evolution-8ab34219361284ed90033fdfb2c425ef804e1cc7.tar.xz
gsoc2013-evolution-8ab34219361284ed90033fdfb2c425ef804e1cc7.tar.zst
gsoc2013-evolution-8ab34219361284ed90033fdfb2c425ef804e1cc7.zip
Fixed the oaf info.
2000-07-20 Christopher James Lahey <clahey@helixcode.com> * gui/component/addressbook.oafinfo: Fixed the oaf info. * gui/minicard/.cvsignore, gui/minicard/Makefile.am, gui/minicard/e-minicard-widget-test.c: Added a test for the minicard widget. * gui/minicard/e-minicard-control.c: Fixed the mime type. * gui/minicard/e-minicard.c: Fixed some crashes if your parent isn't a minicard view. * gui/minicard/e-minicard-control.oafinfo: Removed. svn path=/trunk/; revision=4249
Diffstat (limited to 'addressbook/gui/widgets/e-minicard.c')
-rw-r--r--addressbook/gui/widgets/e-minicard.c93
1 files changed, 56 insertions, 37 deletions
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c
index 68f6ccfc05..2fa1d3c080 100644
--- a/addressbook/gui/widgets/e-minicard.c
+++ b/addressbook/gui/widgets/e-minicard.c
@@ -418,20 +418,30 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event)
NULL );
e_minicard->has_focus = TRUE;
} else {
- EBook *book;
+ EBook *book = NULL;
e_card_simple_sync_card(e_minicard->simple);
+
+ if (E_IS_MINICARD_VIEW(GNOME_CANVAS_ITEM(e_minicard)->parent)) {
+
+ gtk_object_get(GTK_OBJECT(GNOME_CANVAS_ITEM(e_minicard)->parent),
+ "book", &book,
+ NULL);
+
+ }
- gtk_object_get(GTK_OBJECT(GNOME_CANVAS_ITEM(e_minicard)->parent),
- "book", &book,
- NULL);
-
+ if (book) {
+
/* Add the card in the contact editor to our ebook */
- e_book_commit_card (book,
- e_minicard->card,
- card_changed_cb,
- NULL);
-
+ e_book_commit_card (book,
+ e_minicard->card,
+ card_changed_cb,
+ NULL);
+ } else {
+ remodel(e_minicard);
+ e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(e_minicard));
+ }
+
gnome_canvas_item_set( e_minicard->rect,
"outline_color", NULL,
NULL );
@@ -449,35 +459,44 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event)
if (event->button.button == 1) {
e_canvas_item_grab_focus(item);
} else if (event->button.button == 3) {
- EPopupMenu menu[] = { {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), 0},
- {"Print", NULL, GTK_SIGNAL_FUNC(print), 0},
- {"Delete", NULL, GTK_SIGNAL_FUNC(delete), 0},
- {NULL, NULL, NULL, 0}};
- e_popup_menu_run (menu, (GdkEventButton *)event, 0, e_minicard);
+ if (E_IS_MINICARD_VIEW(item->parent)) {
+ EPopupMenu menu[] = { {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), 0},
+ {"Print", NULL, GTK_SIGNAL_FUNC(print), 0},
+ {"Delete", NULL, GTK_SIGNAL_FUNC(delete), 0},
+ {NULL, NULL, NULL, 0}};
+ e_popup_menu_run (menu, (GdkEventButton *)event, 0, e_minicard);
+ } else {
+ EPopupMenu menu[] = { {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), 0},
+ {"Print", NULL, GTK_SIGNAL_FUNC(print), 0},
+ {NULL, NULL, NULL, 0}};
+ e_popup_menu_run (menu, (GdkEventButton *)event, 0, e_minicard);
+ }
}
break;
case GDK_2BUTTON_PRESS:
if (event->button.button == 1 && E_IS_MINICARD_VIEW(item->parent)) {
EContactEditor *ce;
- EBook *book;
-
- gtk_object_get(GTK_OBJECT(item->parent),
- "book", &book,
- NULL);
- g_assert (E_IS_BOOK (book));
-
+ EBook *book = NULL;
+ if (E_IS_MINICARD_VIEW(item->parent)) {
+
+ gtk_object_get(GTK_OBJECT(item->parent),
+ "book", &book,
+ NULL);
+ }
ce = e_contact_editor_new (e_minicard->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);
+ if (book != NULL) {
+ 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);
-
return TRUE;
}
break;
@@ -524,17 +543,17 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event)
static void
e_minicard_resize_children( EMinicard *e_minicard )
{
- if ( GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED ) {
- GList *list;
-
+ GList *list;
+
+ if (e_minicard->header_text) {
gnome_canvas_item_set( e_minicard->header_text,
"width", (double) e_minicard->width - 12,
NULL );
- for ( list = e_minicard->fields; list; list = g_list_next( list ) ) {
- gnome_canvas_item_set( E_MINICARD_FIELD( list->data )->label,
- "width", (double) e_minicard->width - 4.0,
- NULL );
- }
+ }
+ for ( list = e_minicard->fields; list; list = g_list_next( list ) ) {
+ gnome_canvas_item_set( E_MINICARD_FIELD( list->data )->label,
+ "width", (double) e_minicard->width - 4.0,
+ NULL );
}
}