From 227fab86efce103776af0364cbfd3f1959f9d269 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Thu, 8 Jun 2000 17:12:12 +0000 Subject: Now this derives from GtkObject. It follows the same strategy as the 2000-06-08 Federico Mena Quintero * contact-editor/e-contact-editor.h (EContactEditor): Now this derives from GtkObject. It follows the same strategy as the EventEditor in the calendar. (EContactEditor): Added an is_new_card field so that we can know whether to add() or commit() the card. * contact-editor/e-contact-editor.c (e_contact_editor_get_type): Derive from GtkObject. (e_contact_editor_class_init): Likewise. (e_contact_editor_class_init): Added an "is_new_card" argument. (e_contact_editor_set_arg): Handle ARG_IS_NEW_CARD. (e_contact_editor_get_arg): Likewise. (e_contact_editor_new): Take in an is_new_arg argument and set it on the object. (e_contact_editor_init): Load the app widget into the app field of the EContactEditor structure. Create its UIHandler as well. (e_contact_editor_class_init): New "add_card", "commit_card", and "editor_closed" signals. * contact-editor/test-editor.c (main): Modified for the new API. (editor_closed_cb): Tweaked for the new API. Since this test program does not use Bonobo, it doesn't work, though. * gui/component/addressbook.c (new_contact_cb): Use the new contact editor API. (table_double_click): Ditto. * gui/minicard/e-minicard-view.c (e_minicard_view_event): Use the new contact editor API. * gui/minicard/e-minicard.c (e_minicard_event): Use the new contact editor API. svn path=/trunk/; revision=3479 --- addressbook/ChangeLog | 36 + addressbook/contact-editor/contact-editor.glade | 4010 ++++++++++---------- .../contact-editor/e-contact-editor-strings.h | 12 +- addressbook/contact-editor/e-contact-editor.c | 423 ++- addressbook/contact-editor/e-contact-editor.h | 20 +- addressbook/contact-editor/test-editor.c | 74 +- addressbook/gui/component/addressbook.c | 114 +- .../gui/contact-editor/contact-editor.glade | 4010 ++++++++++---------- .../gui/contact-editor/e-contact-editor-strings.h | 12 +- addressbook/gui/contact-editor/e-contact-editor.c | 423 ++- addressbook/gui/contact-editor/e-contact-editor.h | 20 +- addressbook/gui/contact-editor/test-editor.c | 74 +- addressbook/gui/minicard/e-minicard-view.c | 85 +- addressbook/gui/minicard/e-minicard.c | 81 +- addressbook/gui/widgets/e-minicard-view.c | 85 +- addressbook/gui/widgets/e-minicard.c | 81 +- libical/src/test/Makefile.in | 80 +- 17 files changed, 5273 insertions(+), 4367 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 0da4223475..2d35d6f056 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,39 @@ +2000-06-08 Federico Mena Quintero + + * contact-editor/e-contact-editor.h (EContactEditor): Now this + derives from GtkObject. It follows the same strategy as the + EventEditor in the calendar. + (EContactEditor): Added an is_new_card field so that we can know + whether to add() or commit() the card. + + * contact-editor/e-contact-editor.c (e_contact_editor_get_type): + Derive from GtkObject. + (e_contact_editor_class_init): Likewise. + (e_contact_editor_class_init): Added an "is_new_card" argument. + (e_contact_editor_set_arg): Handle ARG_IS_NEW_CARD. + (e_contact_editor_get_arg): Likewise. + (e_contact_editor_new): Take in an is_new_arg argument and set it + on the object. + (e_contact_editor_init): Load the app widget into the app field of + the EContactEditor structure. Create its UIHandler as well. + (e_contact_editor_class_init): New "add_card", "commit_card", and + "editor_closed" signals. + + * contact-editor/test-editor.c (main): Modified for the new API. + (editor_closed_cb): Tweaked for the new API. + Since this test program does not use Bonobo, it doesn't work, + though. + + * gui/component/addressbook.c (new_contact_cb): Use the new + contact editor API. + (table_double_click): Ditto. + + * gui/minicard/e-minicard-view.c (e_minicard_view_event): Use the + new contact editor API. + + * gui/minicard/e-minicard.c (e_minicard_event): Use the new + contact editor API. + 2000-06-08 Ettore Perazzoli * contact-editor/Makefile.am (contact_editor_test_LDADD): Remove diff --git a/addressbook/contact-editor/contact-editor.glade b/addressbook/contact-editor/contact-editor.glade index 21ad4fd265..7f11886b28 100644 --- a/addressbook/contact-editor/contact-editor.glade +++ b/addressbook/contact-editor/contact-editor.glade @@ -20,124 +20,100 @@ - GtkWindow - contact editor + GnomeDialog + dialog2 + 2 False - Contact Editor GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False False - True + False False + False + False - GtkNotebook - notebook-contact-editor - True - True - True - GTK_POS_TOP - False - 2 - 2 - False + GtkVBox + GnomeDialog:vbox + dialog-vbox2 + False + 4 + + 4 + True + True + - GtkTable - table-contact-editor-general - 7 - 14 - 8 - False - 4 - 4 + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area2 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + - GtkEntry - entry-phone1 + GtkButton + button28 + True True - True - True - 0 - - - 7 - 8 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - + GNOME_STOCK_BUTTON_OK - GtkEntry - entry-phone2 + GtkButton + button29 + True True - True - True - 0 - - - 7 - 8 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - + GNOME_STOCK_BUTTON_APPLY - GtkEntry - entry-phone3 + GtkButton + button30 + True True - True - True - 0 - - - 7 - 8 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - + GNOME_STOCK_BUTTON_CANCEL + + + + GtkTable + table2 + 2 + 2 + False + 0 + 2 + + 0 + True + True + GtkEntry - entry-phone4 + entry2 True True True 0 - 7 - 8 - 3 - 4 + 0 + 2 + 1 + 2 0 0 True @@ -150,118 +126,19 @@ - GtkText - text-address - 1 - 1 - True - True - - - 7 - 8 - 5 - 9 - 0 - 0 - True - False - False - False - True - True - - - - - GtkButton - button-fullname - True - + GtkVBox + vbox1 + False + 2 1 - 3 + 2 0 1 0 0 False - False - False - False - True - True - - - - - GtkAccelLabel - accellabel-fileas - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 3 - 3 - 4 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAccelLabel - accellabel-web - - GTK_JUSTIFY_LEFT - False - 0 - 0.5 - 0 - 0 - - 1 - 3 - 8 - 9 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAlignment - alignment3 - 1 - 0.5 - 0 - 1 - - 2 - 3 - 5 - 6 - 0 - 0 - False - False + True False False True @@ -270,30 +147,48 @@ GtkButton - button-email1 + button31 + 2 + True + + + 0 + False + False + + - - Placeholder - + + GtkButton + button32 + 2 + True + + + 0 + False + False + - GtkAlignment - alignment5 - 1 - 0.5 - 0 - 0 + GtkScrolledWindow + scrolledwindow1 + 200 + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS - 6 - 7 - 3 - 4 + 0 + 1 + 0 + 1 0 0 - False - False + True + True False False True @@ -301,2005 +196,2136 @@ - GtkButton - button-phone4 + GtkCList + clist1 + True + 1 + 80 + GTK_SELECTION_SINGLE + True + GTK_SHADOW_NONE - Placeholder + GtkLabel + CList:title + label20 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + - - GtkAlignment - alignment7 - 1 - 0.5 - 0 - 0 - - 6 - 7 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - button-phone2 - - - Placeholder - - - + + GnomeDialog + dialog-add-phone + False + New phone type + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + False + False + False + False - - GtkAlignment - alignment8 - 1 - 0.5 - 0 - 0 - - 6 - 7 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - + + GtkVBox + GnomeDialog:vbox + vbox2 + False + 8 + + 4 + True + True + - - GtkButton - button-phone1 + + GtkHButtonBox + GnomeDialog:action_area + hbuttonbox1 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + - - Placeholder - - + + GtkButton + button43 + True + True + True + + GNOME_STOCK_PIXMAP_ADD - GtkHSeparator - hseparator4 - - 4 - 8 - 4 - 5 - 0 - 2 - True - False - False - False - True - False - + GtkButton + button44 + True + True + GNOME_STOCK_BUTTON_CANCEL + + + + GtkFrame + frame-add-phone + 4 + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + True + True + GtkAlignment - alignment6 - 1 + alignment9 + 9 + 0.5 0.5 - 0 - 0 - - 6 - 7 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - + 1 + 1 - GtkButton - button-phone3 - - - Placeholder - + GtkEntry + entry-add-phone + True + True + True + True + 0 + + + + - - GtkEntry - entry-fullname - True - True - True - True - True - 0 - - - 3 - 4 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - + + GnomeApp + contact editor + Contact Editor + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + True + False + True - - GtkEntry - entry-jobtitle - True - True - True - 0 - - - 3 - 4 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - + + GnomeDock + GnomeApp:dock + dock1 + True + + 0 + True + True + - - GtkEntry - entry-company - True - True - True - 0 - - - 3 - 4 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - - + + GtkNotebook + GnomeDock:contents + notebook-contact-editor + True + True + True + GTK_POS_TOP + False + 2 + 2 + False + + + GtkTable + table-contact-editor-general + 7 + 14 + 8 + False + 4 + 4 - - GtkEntry - entry-email1 - True - True - True - 0 - - - 3 - 4 - 5 - 6 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry-web - True - True - True - 0 - - - 3 - 4 - 8 - 9 - 0 - 0 - True - False - False - False - True - False - - - - - GtkHSeparator - hseparator5 - - 0 - 4 - 4 - 5 - 0 - 2 - True - False - False - False - True - False - - - - - GtkCombo - combo-file-as - False - True - True - True - False - - - 3 - 4 - 3 - 4 - 0 - 0 - True - False - False - False - True - False - + + GtkEntry + entry-phone1 + True + True + True + 0 + + + 7 + 8 + 0 + 1 + 0 + 0 + True + False + False + False + True + False + + GtkEntry - GtkCombo:entry - entry-file-as + entry-phone2 True True True 0 + + 7 + 8 + 1 + 2 + 0 + 0 + True + False + False + False + True + False + - - - GtkHSeparator - hseparator6 - - 0 - 4 - 7 - 8 - 0 - 2 - True - False - False - False - True - True - - - - - GtkAlignment - alignment10 - 0.5 - 0 - 1 - 1 - - 3 - 4 - 6 - 7 - 0 - 0 - True - False - True - True - True - True - + + GtkEntry + entry-phone3 + True + True + True + 0 + + + 7 + 8 + 2 + 3 + 0 + 0 + True + False + False + False + True + False + + - GtkCheckButton - checkbutton-htmlmail - - False - True + GtkEntry + entry-phone4 + True + True + True + 0 + + + 7 + 8 + 3 + 4 + 0 + 0 + True + False + False + False + True + False + - - - GtkAlignment - alignment4 - 1 - 0.5 - 0 - 0 - - 6 - 7 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - + + GtkText + text-address + 1 + 1 + True + True + + + 7 + 8 + 5 + 9 + 0 + 0 + True + False + False + False + True + True + + GtkButton - button-address - - - Placeholder - + button-fullname + True + + + 1 + 3 + 0 + 1 + 0 + 0 + False + False + False + False + True + True + - - - - GtkLabel - address-label - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - text-address - - 5 - 7 - 6 - 7 - 0 - 0 - False - False - False - False - True - True - - - - - GtkEventBox - eventbox1 - - 5 - 6 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - GtkLabel - label-phone1 - + GtkAccelLabel + accellabel-fileas + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - entry-phone1 + + 1 + 3 + 3 + 4 + 0 + 0 + False + False + False + False + True + True + - - - - GtkEventBox - eventbox2 - - 5 - 6 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - GtkLabel - label-phone2 - - GTK_JUSTIFY_CENTER + GtkAccelLabel + accellabel-web + + GTK_JUSTIFY_LEFT False 0 0.5 0 0 - entry-phone2 + + 1 + 3 + 8 + 9 + 0 + 0 + False + False + False + False + True + True + - - - - GtkEventBox - eventbox3 - - 5 - 6 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - GtkLabel - label-phone3 - - GTK_JUSTIFY_CENTER - False - 0 + GtkAlignment + alignment3 + 1 0.5 - 0 - 0 - entry-phone3 + 0 + 1 + + 2 + 3 + 5 + 6 + 0 + 0 + False + False + False + False + True + True + + + + GtkButton + button-email1 + + + Placeholder + + - - - GtkEventBox - eventbox4 - - 5 - 6 - 3 - 4 - 0 - 0 - False - False - False - False - True - True - + + GtkAlignment + alignment5 + 1 + 0.5 + 0 + 0 + + 6 + 7 + 3 + 4 + 0 + 0 + False + False + False + False + True + True + + + + GtkButton + button-phone4 + + + Placeholder + + + - GtkLabel - label-phone4 - - GTK_JUSTIFY_LEFT - False - 0 + GtkAlignment + alignment7 + 1 0.5 - 0 - 0 - entry-phone4 + 0 + 0 + + 6 + 7 + 1 + 2 + 0 + 0 + False + False + False + False + True + True + + + + GtkButton + button-phone2 + + + Placeholder + + - - - - GtkEventBox - eventbox5 - - 1 - 2 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - - GtkLabel - label-email1 - - GTK_JUSTIFY_CENTER - False - 0 + GtkAlignment + alignment8 + 1 0.5 - 0 - 0 - entry-email1 - - + 0 + 0 + + 6 + 7 + 0 + 1 + 0 + 0 + False + False + False + False + True + True + - - GtkEventBox - eventbox-business - - 5 - 6 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - + + GtkButton + button-phone1 - - GtkLabel - label-address - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - text-address + + Placeholder + + - - - - GtkAlignment - alignment2 - 0 - 0 - 0 - 0 - - 7 - 8 - 9 - 10 - 0 - 0 - True - False - False - False - True - True - - GtkCheckButton - checkbutton-mailingaddress - - False - True + GtkHSeparator + hseparator4 + + 4 + 8 + 4 + 5 + 0 + 2 + True + False + False + False + True + False + - - - GtkHSeparator - hseparator9 - - 0 - 4 - 11 - 12 - 0 - 2 - True - False - False - False - True - True - - + + GtkAlignment + alignment6 + 1 + 0.5 + 0 + 0 + + 6 + 7 + 2 + 3 + 0 + 0 + False + False + False + False + True + True + - - GtkHSeparator - hseparator10 - - 4 - 8 - 11 - 12 - 0 - 0 - True - False - False - False - True - True - - + + GtkButton + button-phone3 - - GtkAlignment - alignment12 - 0.5 - 0.5 - 1 - 0 - - 1 - 3 - 12 - 13 - 0 - 0 - False - False - False - False - True - True - + + Placeholder + + + - GtkButton - button-contacts + GtkEntry + entry-fullname + True True - + True + True + True + 0 + + + 3 + 4 + 0 + 1 + 0 + 0 + True + False + False + False + True + False + - - - GtkAlignment - alignment15 - 0.5 - 0.5 - 1 - 0 - - 7 - 8 - 12 - 13 - 0 - 0 - True - False - False - False - True - True - + + GtkEntry + entry-jobtitle + True + True + True + 0 + + + 3 + 4 + 1 + 2 + 0 + 0 + True + False + False + False + True + False + + GtkEntry - entry-categories + entry-company True True True 0 + + 3 + 4 + 2 + 3 + 0 + 0 + True + False + False + False + True + False + - - - GtkAlignment - alignment14 - 0.5 - 0.5 - 1 - 0 - - 3 - 4 - 12 - 13 - 0 - 0 - True - False - False - False - True - True - + + GtkEntry + entry-email1 + True + True + True + 0 + + + 3 + 4 + 5 + 6 + 0 + 0 + True + False + False + False + True + False + + GtkEntry - entry-contacts + entry-web True True True 0 + + 3 + 4 + 8 + 9 + 0 + 0 + True + False + False + False + True + False + - - - GtkAlignment - alignment16 - 0.5 - 0.5 - 1 - 0 - - 5 - 7 - 12 - 13 - 0 - 0 - False - False - False - False - True - True - + + GtkHSeparator + hseparator5 + + 0 + 4 + 4 + 5 + 0 + 2 + True + False + False + False + True + False + + - GtkButton - button-categories - True - + GtkCombo + combo-file-as + False + True + True + True + False + + + 3 + 4 + 3 + 4 + 0 + 0 + True + False + False + False + True + False + + + + GtkEntry + GtkCombo:entry + entry-file-as + True + True + True + 0 + + - - - GtkEventBox - eventbox7 - - 1 - 3 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - + + GtkHSeparator + hseparator6 + + 0 + 4 + 7 + 8 + 0 + 2 + True + False + False + False + True + True + + - GtkLabel - label34 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - entry-jobtitle + GtkAlignment + alignment10 + 0.5 + 0 + 1 + 1 + + 3 + 4 + 6 + 7 + 0 + 0 + True + False + True + True + True + True + + + + GtkCheckButton + checkbutton-htmlmail + + False + True + - - - Custom - custom1 - e_create_image_widget - malehead.png - - 0 - 0 - Thu, 18 May 2000 12:19:47 GMT - - 0 - 1 - 0 - 4 - 0 - 0 - False - False - False - False - True - True - - - - - Custom - custom2 - e_create_image_widget - cellphone.png - - 0 - 0 - Thu, 18 May 2000 12:20:02 GMT - - 4 - 5 - 0 - 4 - 0 - 0 - False - False - False - False - True - True - - + + GtkAlignment + alignment4 + 1 + 0.5 + 0 + 0 + + 6 + 7 + 5 + 6 + 0 + 0 + False + False + False + False + True + True + - - Custom - custom3 - e_create_image_widget - envelope.png - - 0 - 0 - Thu, 18 May 2000 12:19:51 GMT - - 0 - 1 - 5 - 7 - 0 - 0 - False - False - False - False - True - True - - + + GtkButton + button-address - - Custom - custom4 - e_create_image_widget - house.png - - 0 - 0 - Thu, 18 May 2000 12:20:06 GMT - - 4 - 5 - 5 - 10 - 0 - 0 - False - False - False - False - True - True - - + + Placeholder + + + - - Custom - custom5 - e_create_image_widget - evolution-contacts.png - - 0 - 0 - Thu, 18 May 2000 12:19:59 GMT - - 0 - 1 - 12 - 14 + + GtkLabel + address-label + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - False - False - False - False - True - True - - + text-address + + 5 + 7 + 6 + 7 + 0 + 0 + False + False + False + False + True + True + + - - Custom - custom6 - e_create_image_widget - briefcase.png - - 0 - 0 - Thu, 18 May 2000 12:20:09 GMT - - 4 - 5 - 12 - 14 - 0 - 0 - False - False - False - False - True - True - - + + GtkEventBox + eventbox1 + + 5 + 6 + 0 + 1 + 0 + 0 + False + False + False + False + True + True + - - Custom - custom10 - e_create_image_widget - globe.png - - 0 - 0 - Thu, 18 May 2000 12:19:56 GMT - - 0 - 1 - 8 - 10 - 0 - 0 - False - False - False - False - True - True - - + + GtkLabel + label-phone1 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-phone1 + + - - GtkLabel - label35 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - entry-company - - 1 - 3 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - - + + GtkEventBox + eventbox2 + + 5 + 6 + 1 + 2 + 0 + 0 + False + False + False + False + True + True + - - GtkLabel - Notebook:tab - label15 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - + + GtkLabel + label-phone2 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-phone2 + + - - GtkTable - table-contact-editor-details - 7 - 9 - 6 - False - 4 - 4 + + GtkEventBox + eventbox3 + + 5 + 6 + 2 + 3 + 0 + 0 + False + False + False + False + True + True + - - GtkLabel - label21 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - entry-department - - 1 - 2 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - + + GtkLabel + label-phone3 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-phone3 + + - - GtkLabel - label22 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - entry-office - - 1 - 2 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - + + GtkEventBox + eventbox4 + + 5 + 6 + 3 + 4 + 0 + 0 + False + False + False + False + True + True + - - GtkLabel - label23 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - entry-profession - - 1 - 2 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - + + GtkLabel + label-phone4 + + GTK_JUSTIFY_LEFT + False + 0 + 0.5 + 0 + 0 + entry-phone4 + + - - GtkLabel - label24 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - entry-nickname - - 1 - 2 - 4 - 5 - 0 - 0 - False - False - False - False - True - True - - + + GtkEventBox + eventbox5 + + 1 + 2 + 5 + 6 + 0 + 0 + False + False + False + False + True + True + - - GtkLabel - label25 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - entry-spouse - - 1 - 2 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - - + + GtkLabel + label-email1 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-email1 + + - - GtkLabel - label31 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 3 - 4 - 4 - 5 - 0 - 0 - False - False - False - False - True - True - - + + GtkEventBox + eventbox-business + + 5 + 6 + 5 + 6 + 0 + 0 + False + False + False + False + True + True + - - GtkLabel - label30 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - entry-assistant - - 3 - 4 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - + + GtkLabel + label-address + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + text-address + + - - GtkLabel - label29 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - entry-manager - - 3 - 4 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - + + GtkAlignment + alignment2 + 0 + 0 + 0 + 0 + + 7 + 8 + 9 + 10 + 0 + 0 + True + False + False + False + True + True + - - GtkLabel - label32 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 3 - 4 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - - + + GtkCheckButton + checkbutton-mailingaddress + + False + True + + - - GtkEntry - entry-spouse - True - True - True - 0 - - - 2 - 3 - 5 - 6 - 0 - 0 - True - False - False - False - True - False - - + + GtkHSeparator + hseparator9 + + 0 + 4 + 11 + 12 + 0 + 2 + True + False + False + False + True + True + + + + + GtkHSeparator + hseparator10 + + 4 + 8 + 11 + 12 + 0 + 0 + True + False + False + False + True + True + + + + + GtkAlignment + alignment12 + 0.5 + 0.5 + 1 + 0 + + 1 + 3 + 12 + 13 + 0 + 0 + False + False + False + False + True + True + + + + GtkButton + button-contacts + True + + + + + + GtkAlignment + alignment15 + 0.5 + 0.5 + 1 + 0 + + 7 + 8 + 12 + 13 + 0 + 0 + True + False + False + False + True + True + + + + GtkEntry + entry-categories + True + True + True + 0 + + + + + + GtkAlignment + alignment14 + 0.5 + 0.5 + 1 + 0 + + 3 + 4 + 12 + 13 + 0 + 0 + True + False + False + False + True + True + + + + GtkEntry + entry-contacts + True + True + True + 0 + + + + + + GtkAlignment + alignment16 + 0.5 + 0.5 + 1 + 0 + + 5 + 7 + 12 + 13 + 0 + 0 + False + False + False + False + True + True + + + + GtkButton + button-categories + True + + + + + + GtkEventBox + eventbox7 + + 1 + 3 + 1 + 2 + 0 + 0 + False + False + False + False + True + True + + + + GtkLabel + label34 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-jobtitle + + + + + Custom + custom1 + e_create_image_widget + malehead.png + + 0 + 0 + Thu, 18 May 2000 12:19:47 GMT + + 0 + 1 + 0 + 4 + 0 + 0 + False + False + False + False + True + True + + + + + Custom + custom2 + e_create_image_widget + cellphone.png + + 0 + 0 + Thu, 18 May 2000 12:20:02 GMT + + 4 + 5 + 0 + 4 + 0 + 0 + False + False + False + False + True + True + + + + + Custom + custom3 + e_create_image_widget + envelope.png + + 0 + 0 + Thu, 18 May 2000 12:19:51 GMT + + 0 + 1 + 5 + 7 + 0 + 0 + False + False + False + False + True + True + + + + + Custom + custom4 + e_create_image_widget + house.png + + 0 + 0 + Thu, 18 May 2000 12:20:06 GMT + + 4 + 5 + 5 + 10 + 0 + 0 + False + False + False + False + True + True + + + + + Custom + custom5 + e_create_image_widget + evolution-contacts.png + + 0 + 0 + Thu, 18 May 2000 12:19:59 GMT + + 0 + 1 + 12 + 14 + 0 + 0 + False + False + False + False + True + True + + - - GtkEntry - entry-department - True - True - True - 0 - - - 2 - 3 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - + + Custom + custom6 + e_create_image_widget + briefcase.png + + 0 + 0 + Thu, 18 May 2000 12:20:09 GMT + + 4 + 5 + 12 + 14 + 0 + 0 + False + False + False + False + True + True + + - - GtkEntry - entry-office - True - True - True - 0 - - - 2 - 3 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - + + Custom + custom10 + e_create_image_widget + globe.png + + 0 + 0 + Thu, 18 May 2000 12:19:56 GMT + + 0 + 1 + 8 + 10 + 0 + 0 + False + False + False + False + True + True + + - - GtkEntry - entry-profession - True - True - True - 0 - - - 2 - 3 - 2 - 3 + + GtkLabel + label35 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - True - False - False - False - True - False - + entry-company + + 1 + 3 + 2 + 3 + 0 + 0 + False + False + False + False + True + True + + - GtkEntry - entry-nickname - True - True - True - 0 - - - 2 - 3 - 4 - 5 - 0 - 0 - True - False - False - False - True - False - + GtkLabel + Notebook:tab + label15 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 - GnomeDateEdit - dateedit-anniversary - False - False - False - 7 - 19 - - 4 - 6 - 5 - 6 - 0 - 0 - True - False - False - False - True - False - - + GtkTable + table-contact-editor-details + 7 + 9 + 6 + False + 4 + 4 - - GnomeDateEdit - dateedit-birthday - False - False - False - 7 - 19 - - 4 - 6 - 4 - 5 + + GtkLabel + label21 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - True - False - False - False - True - False - - + entry-department + + 1 + 2 + 0 + 1 + 0 + 0 + False + False + False + False + True + True + + - - GtkEntry - entry-assistant - True - True - True - 0 - - - 4 - 6 - 1 - 2 + + GtkLabel + label22 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - True - False - False - False - True - False - - + entry-office + + 1 + 2 + 1 + 2 + 0 + 0 + False + False + False + False + True + True + + - - GtkEntry - entry-manager - True - True - True - 0 - - - 4 - 6 - 0 - 1 + + GtkLabel + label23 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - True - False - False - False - True - False - - + entry-profession + + 1 + 2 + 2 + 3 + 0 + 0 + False + False + False + False + True + True + + - - GtkHSeparator - hseparator7 - - 0 - 6 - 3 - 4 + + GtkLabel + label24 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 - 2 - False - False - False - False - True - True - - + 0 + entry-nickname + + 1 + 2 + 4 + 5 + 0 + 0 + False + False + False + False + True + True + + - - GtkLabel - label33 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 7 - 8 + + GtkLabel + label25 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - False - False - False - False - True - True - - + entry-spouse + + 1 + 2 + 5 + 6 + 0 + 0 + False + False + False + False + True + True + + - - GtkHSeparator - hseparator8 - - 0 - 6 - 6 - 7 + + GtkLabel + label31 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - True - False - False - False - True - True - - + + 3 + 4 + 4 + 5 + 0 + 0 + False + False + False + False + True + True + + - - Custom - custom7 - e_create_image_widget - briefcase.png - - 0 - 0 - Thu, 18 May 2000 12:20:13 GMT - - 0 - 1 - 0 - 2 + + GtkLabel + label30 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - False - False - False - False - True - True - - + entry-assistant + + 3 + 4 + 1 + 2 + 0 + 0 + False + False + False + False + True + True + + - - Custom - custom8 - e_create_image_widget - malehead.png - - 0 - 0 - Thu, 18 May 2000 12:20:16 GMT - - 0 - 1 - 4 - 6 + + GtkLabel + label29 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - False - False - False - False - True - True - - + entry-manager + + 3 + 4 + 0 + 1 + 0 + 0 + False + False + False + False + True + True + + - - GtkScrolledWindow - scrolledwindow2 - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 1 - 6 - 8 - 9 + + GtkLabel + label32 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - True - True - False - False - True - True - + + 3 + 4 + 5 + 6 + 0 + 0 + False + False + False + False + True + True + + - GtkText - text-comments + GtkEntry + entry-spouse True True + True + 0 + + 2 + 3 + 5 + 6 + 0 + 0 + True + False + False + False + True + False + - - - - Custom - custom9 - e_create_image_widget - globe.png - - 0 - 0 - Thu, 18 May 2000 12:20:19 GMT - - 0 - 1 - 7 - 9 - 0 - 0 - False - False - False - False - True - True - - - - - - GtkLabel - Notebook:tab - label16 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - GnomeDialog - dialog2 - 2 - False - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - False - False - False - False - - - GtkVBox - GnomeDialog:vbox - dialog-vbox2 - False - 4 - - 4 - True - True - - - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area2 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button28 - True - True - GNOME_STOCK_BUTTON_OK - - - GtkButton - button29 - True - True - GNOME_STOCK_BUTTON_APPLY - + + GtkEntry + entry-department + True + True + True + 0 + + + 2 + 3 + 0 + 1 + 0 + 0 + True + False + False + False + True + False + + - - GtkButton - button30 - True - True - GNOME_STOCK_BUTTON_CANCEL - - + + GtkEntry + entry-office + True + True + True + 0 + + + 2 + 3 + 1 + 2 + 0 + 0 + True + False + False + False + True + False + + - - GtkTable - table2 - 2 - 2 - False - 0 - 2 - - 0 - True - True - + + GtkEntry + entry-profession + True + True + True + 0 + + + 2 + 3 + 2 + 3 + 0 + 0 + True + False + False + False + True + False + + - - GtkEntry - entry2 - True - True - True - 0 - - - 0 - 2 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - + + GtkEntry + entry-nickname + True + True + True + 0 + + + 2 + 3 + 4 + 5 + 0 + 0 + True + False + False + False + True + False + + - - GtkVBox - vbox1 - False - 2 - - 1 - 2 - 0 - 1 - 0 - 0 - False - True - False - False - True - True - + + GnomeDateEdit + dateedit-anniversary + False + False + False + 7 + 19 + + 4 + 6 + 5 + 6 + 0 + 0 + True + False + False + False + True + False + + - GtkButton - button31 - 2 + GnomeDateEdit + dateedit-birthday + False + False + False + 7 + 19 + + 4 + 6 + 4 + 5 + 0 + 0 + True + False + False + False + True + False + + + + + GtkEntry + entry-assistant True - + True + True + 0 + - 0 - False - False + 4 + 6 + 1 + 2 + 0 + 0 + True + False + False + False + True + False - GtkButton - button32 - 2 + GtkEntry + entry-manager True - + True + True + 0 + - 0 - False - False + 4 + 6 + 0 + 1 + 0 + 0 + True + False + False + False + True + False - - - GtkScrolledWindow - scrolledwindow1 - 200 - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 0 - 1 - 0 - 1 + + GtkHSeparator + hseparator7 + + 0 + 6 + 3 + 4 + 0 + 2 + False + False + False + False + True + True + + + + + GtkLabel + label33 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - True - True - False - False - True - True - + + 1 + 2 + 7 + 8 + 0 + 0 + False + False + False + False + True + True + + - GtkCList - clist1 - True - 1 - 80 - GTK_SELECTION_SINGLE - True - GTK_SHADOW_NONE - - - GtkLabel - CList:title - label20 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 + GtkHSeparator + hseparator8 + + 0 + 6 + 6 + 7 0 0 - + True + False + False + False + True + True + - - - - - - GnomeDialog - dialog-add-phone - False - New phone type - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - False - False - False - False + + Custom + custom7 + e_create_image_widget + briefcase.png + + 0 + 0 + Thu, 18 May 2000 12:20:13 GMT + + 0 + 1 + 0 + 2 + 0 + 0 + False + False + False + False + True + True + + - - GtkVBox - GnomeDialog:vbox - vbox2 - False - 8 - - 4 - True - True - + + Custom + custom8 + e_create_image_widget + malehead.png + + 0 + 0 + Thu, 18 May 2000 12:20:16 GMT + + 0 + 1 + 4 + 6 + 0 + 0 + False + False + False + False + True + True + + - - GtkHButtonBox - GnomeDialog:action_area - hbuttonbox1 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - + + GtkScrolledWindow + scrolledwindow2 + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 1 + 6 + 8 + 9 + 0 + 0 + True + True + False + False + True + True + - - GtkButton - button43 - True - True - True - - GNOME_STOCK_PIXMAP_ADD - + + GtkText + text-comments + True + True + + + - - GtkButton - button44 - True - True - GNOME_STOCK_BUTTON_CANCEL + + Custom + custom9 + e_create_image_widget + globe.png + + 0 + 0 + Thu, 18 May 2000 12:20:19 GMT + + 0 + 1 + 7 + 9 + 0 + 0 + False + False + False + False + True + True + + - - - - GtkFrame - frame-add-phone - 4 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - GtkAlignment - alignment9 - 9 + GtkLabel + Notebook:tab + label16 + + GTK_JUSTIFY_CENTER + False 0.5 0.5 - 1 - 1 - - - GtkEntry - entry-add-phone - True - True - True - True - 0 - - + 0 + 0 + + + GnomeAppBar + GnomeApp:appbar + appbar1 + True + True + + 0 + True + True + + diff --git a/addressbook/contact-editor/e-contact-editor-strings.h b/addressbook/contact-editor/e-contact-editor-strings.h index d5f1983573..d5ac9daf24 100644 --- a/addressbook/contact-editor/e-contact-editor-strings.h +++ b/addressbook/contact-editor/e-contact-editor-strings.h @@ -4,6 +4,12 @@ * DO NOT compile it as part of your application. */ +gchar *s = N_("_Add"); +gchar *s = N_("_Delete"); +gchar *s = N_("Phone Types"); +gchar *s = N_("New phone type"); +gchar *s = N_("Add"); +gchar *s = N_("New phone type"); gchar *s = N_("Contact Editor"); gchar *s = N_("_Full Name..."); gchar *s = N_("File As:"); @@ -33,9 +39,3 @@ gchar *s = N_("_Manager's Name:"); gchar *s = N_("Anni_versary:"); gchar *s = N_("No_tes:"); gchar *s = N_("Details"); -gchar *s = N_("_Add"); -gchar *s = N_("_Delete"); -gchar *s = N_("Phone Types"); -gchar *s = N_("New phone type"); -gchar *s = N_("Add"); -gchar *s = N_("New phone type"); diff --git a/addressbook/contact-editor/e-contact-editor.c b/addressbook/contact-editor/e-contact-editor.c index 5ca3fd753e..00cf952d8e 100644 --- a/addressbook/contact-editor/e-contact-editor.c +++ b/addressbook/contact-editor/e-contact-editor.c @@ -29,6 +29,14 @@ #include #include +/* Signal IDs */ +enum { + ADD_CARD, + COMMIT_CARD, + EDITOR_CLOSED, + LAST_SIGNAL +}; + static void e_contact_editor_init (EContactEditor *card); static void e_contact_editor_class_init (EContactEditorClass *klass); static void e_contact_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); @@ -47,12 +55,15 @@ static void set_fields(EContactEditor *editor); static void set_address_field(EContactEditor *editor, int result); static void add_field_callback(GtkWidget *widget, EContactEditor *editor); -static GtkVBoxClass *parent_class = NULL; +static GtkObjectClass *parent_class = NULL; + +static guint contact_editor_signals[LAST_SIGNAL]; /* The arguments we take */ enum { ARG_0, - ARG_CARD + ARG_CARD, + ARG_IS_NEW_CARD }; enum { @@ -80,7 +91,7 @@ e_contact_editor_get_type (void) (GtkClassInitFunc) NULL, }; - contact_editor_type = gtk_type_unique (gtk_vbox_get_type (), &contact_editor_info); + contact_editor_type = gtk_type_unique (GTK_TYPE_OBJECT, &contact_editor_info); } return contact_editor_type; @@ -90,15 +101,43 @@ static void e_contact_editor_class_init (EContactEditorClass *klass) { GtkObjectClass *object_class; - GtkVBoxClass *vbox_class; object_class = (GtkObjectClass*) klass; - vbox_class = (GtkVBoxClass *) klass; - parent_class = gtk_type_class (gtk_vbox_get_type ()); + parent_class = gtk_type_class (GTK_TYPE_OBJECT); gtk_object_add_arg_type ("EContactEditor::card", GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CARD); + gtk_object_add_arg_type ("EContactEditor::is_new_card", GTK_TYPE_BOOL, + GTK_ARG_READWRITE, ARG_IS_NEW_CARD); + + contact_editor_signals[ADD_CARD] = + gtk_signal_new ("add_card", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (EContactEditorClass, add_card), + gtk_marshal_NONE__OBJECT, + GTK_TYPE_NONE, 1, + GTK_TYPE_OBJECT); + + contact_editor_signals[COMMIT_CARD] = + gtk_signal_new ("commit_card", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (EContactEditorClass, commit_card), + gtk_marshal_NONE__OBJECT, + GTK_TYPE_NONE, 1, + GTK_TYPE_OBJECT); + + contact_editor_signals[EDITOR_CLOSED] = + gtk_signal_new ("editor_closed", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (EContactEditorClass, editor_closed), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + + gtk_object_class_add_signals (object_class, contact_editor_signals, LAST_SIGNAL); object_class->set_arg = e_contact_editor_set_arg; object_class->get_arg = e_contact_editor_get_arg; @@ -463,13 +502,328 @@ categories_clicked(GtkWidget *button, EContactEditor *editor) g_free(categories); } +/* Emits the signal to request saving a card */ +static void +save_card (EContactEditor *ce) +{ + if (ce->is_new_card) + gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[ADD_CARD], + ce->card); + else + gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[COMMIT_CARD], + ce->card); + + /* FIXME: should we set the ce->is_new_card here or have the client code + * set the "is_new_card" argument on the contact editor object? + */ + + ce->is_new_card = FALSE; +} + +/* Closes the dialog box and emits the appropriate signals */ +static void +close_dialog (EContactEditor *ce) +{ + g_assert (ce->app != NULL); + + gtk_widget_destroy (ce->app); + ce->app = NULL; + + gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[EDITOR_CLOSED]); +} + +/* Menu callbacks */ + +/* File/Save callback */ +static void +file_save_cb (GtkWidget *widget, gpointer data) +{ + EContactEditor *ce; + + ce = E_CONTACT_EDITOR (data); + save_card (ce); +} + +/* File/Close callback */ +static void +file_close_cb (GtkWidget *widget, gpointer data) +{ + EContactEditor *ce; + + ce = E_CONTACT_EDITOR (data); + close_dialog (ce); +} + +/* Menu bar */ + +static GnomeUIInfo file_new_menu[] = { + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Appointment"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Meeting Re_quest"), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Mail Message"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Contact"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Task"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Task _Request"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Journal Entry"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Note"), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Ch_oose Form..."), NULL, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo file_page_setup_menu[] = { + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Memo Style"), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Define Print _Styles..."), NULL, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo file_menu[] = { + GNOMEUIINFO_MENU_NEW_SUBTREE (file_new_menu), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: S_end"), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_MENU_SAVE_ITEM (file_save_cb, NULL), + GNOMEUIINFO_MENU_SAVE_AS_ITEM (NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Save Attac_hments..."), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Delete"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Move to Folder..."), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Cop_y to Folder..."), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_SUBTREE (N_("Page Set_up"), file_page_setup_menu), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Print Pre_view"), NULL, NULL), + GNOMEUIINFO_MENU_PRINT_ITEM (NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_MENU_PROPERTIES_ITEM (NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_MENU_CLOSE_ITEM (file_close_cb, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo edit_object_menu[] = { + GNOMEUIINFO_ITEM_NONE ("FIXME: what goes here?", NULL, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo edit_menu[] = { + GNOMEUIINFO_MENU_UNDO_ITEM (NULL, NULL), + GNOMEUIINFO_MENU_REDO_ITEM (NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_MENU_CUT_ITEM (NULL, NULL), + GNOMEUIINFO_MENU_COPY_ITEM (NULL, NULL), + GNOMEUIINFO_MENU_PASTE_ITEM (NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Paste _Special..."), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_MENU_CLEAR_ITEM (NULL, NULL), + GNOMEUIINFO_MENU_SELECT_ALL_ITEM (NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Mark as U_nread"), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_MENU_FIND_ITEM (NULL, NULL), + GNOMEUIINFO_MENU_FIND_AGAIN_ITEM (NULL, NULL), + GNOMEUIINFO_SUBTREE (N_("_Object"), edit_object_menu), + GNOMEUIINFO_END +}; + +static GnomeUIInfo view_previous_menu[] = { + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Item"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Unread Item"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Fi_rst Item in Folder"), NULL, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo view_next_menu[] = { + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Item"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Unread Item"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Last Item in Folder"), NULL, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo view_toolbars_menu[] = { + { GNOME_APP_UI_TOGGLEITEM, N_("FIXME: _Standard"), NULL, NULL, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, + { GNOME_APP_UI_TOGGLEITEM, N_("FIXME: __Formatting"), NULL, NULL, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Customize..."), NULL, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo view_menu[] = { + GNOMEUIINFO_SUBTREE (N_("Pre_vious"), view_previous_menu), + GNOMEUIINFO_SUBTREE (N_("Ne_xt"), view_next_menu), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_SUBTREE (N_("_Toolbars"), view_toolbars_menu), + GNOMEUIINFO_END +}; + +static GnomeUIInfo insert_menu[] = { + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _File..."), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: It_em..."), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Object..."), NULL, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo format_menu[] = { + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Font..."), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Paragraph..."), NULL, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo tools_forms_menu[] = { + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Ch_oose Form..."), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Desi_gn This Form"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: D_esign a Form..."), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Publish _Form..."), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Pu_blish Form As..."), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Script _Debugger"), NULL, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo tools_menu[] = { + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Spelling..."), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_SUBTREE (N_("_Forms"), tools_forms_menu), + GNOMEUIINFO_END +}; + +static GnomeUIInfo actions_menu[] = { + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _New Contact"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: New _Contact from Same Company"), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: New _Letter to Contact"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: New _Message to Contact"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: New Meetin_g with Contact"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Plan a Meeting..."), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: New _Task for Contact"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: New _Journal Entry for Contact"), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Flag for Follow Up..."), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Display Map of Address"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Open Web Page"), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Forward as _vCard"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: For_ward"), NULL, NULL) +}; + +static GnomeUIInfo help_menu[] = { + GNOMEUIINFO_ITEM_NONE ("FIXME: fix Bonobo so it supports help items!", NULL, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo main_menu[] = { + GNOMEUIINFO_MENU_FILE_TREE (file_menu), + GNOMEUIINFO_MENU_EDIT_TREE (edit_menu), + GNOMEUIINFO_MENU_VIEW_TREE (view_menu), + GNOMEUIINFO_SUBTREE (N_("_Insert"), insert_menu), + GNOMEUIINFO_SUBTREE (N_("F_ormat"), format_menu), + GNOMEUIINFO_SUBTREE (N_("_Tools"), tools_menu), + GNOMEUIINFO_SUBTREE (N_("Actio_ns"), actions_menu), + GNOMEUIINFO_MENU_HELP_TREE (help_menu), + GNOMEUIINFO_END +}; + +/* Creates the menu bar for the contact editor */ +static void +create_menu (EContactEditor *ce) +{ + BonoboUIHandlerMenuItem *list; + + bonobo_ui_handler_create_menubar (ce->uih); + + list = bonobo_ui_handler_menu_parse_uiinfo_list_with_data (main_menu, ce); + bonobo_ui_handler_menu_add_list (ce->uih, "/", list); +} + +/* Toolbar/Save and Close callback */ +static void +tb_save_and_close_cb (GtkWidget *widget, gpointer data) +{ + EContactEditor *ce; + + ce = E_CONTACT_EDITOR (data); + save_card (ce); + close_dialog (ce); +} + +/* Toolbar */ + +static GnomeUIInfo toolbar[] = { + GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Save and Close"), + N_("Save the appointment and close the dialog box"), + tb_save_and_close_cb, + GNOME_STOCK_PIXMAP_SAVE), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Print..."), + N_("Print this item"), NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Insert File..."), + N_("Insert a file as an attachment"), NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Recurrence..."), + N_("Configure recurrence rules"), NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Invite Attendees..."), + N_("Invite attendees to a meeting"), NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Delete"), + N_("Delete this item"), NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Previous"), + N_("Go to the previous item"), NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Next"), + N_("Go to the next item"), NULL), + GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Help"), + N_("See online help"), NULL, GNOME_STOCK_PIXMAP_HELP), + GNOMEUIINFO_END +}; + +/* Creates the toolbar for the contact editor */ +static void +create_toolbar (EContactEditor *ce) +{ + BonoboUIHandlerToolbarItem *list; + GnomeDockItem *dock_item; + GtkWidget *toolbar_child; + + bonobo_ui_handler_create_toolbar (ce->uih, "Toolbar"); + + /* Fetch the toolbar. What a pain in the ass. */ + + dock_item = gnome_app_get_dock_item_by_name (GNOME_APP (ce->app), GNOME_APP_TOOLBAR_NAME); + g_assert (dock_item != NULL); + + toolbar_child = gnome_dock_item_get_child (dock_item); + g_assert (toolbar_child != NULL && GTK_IS_TOOLBAR (toolbar_child)); + + /* Turn off labels as GtkToolbar sucks */ + gtk_toolbar_set_style (GTK_TOOLBAR (toolbar_child), GTK_TOOLBAR_ICONS); + + list = bonobo_ui_handler_toolbar_parse_uiinfo_list_with_data (toolbar, ce); + bonobo_ui_handler_toolbar_add_list (ce->uih, "/Toolbar", list); +} + +/* Callback used when the dialog box is destroyed */ +static gint +app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) +{ + EContactEditor *ce; + + ce = E_CONTACT_EDITOR (data); + + close_dialog (ce); + return TRUE; +} + static void e_contact_editor_init (EContactEditor *e_contact_editor) { GladeXML *gui; GtkWidget *widget; - e_contact_editor->email_info = NULL; e_contact_editor->phone_info = NULL; e_contact_editor->address_info = NULL; @@ -498,15 +852,11 @@ e_contact_editor_init (EContactEditor *e_contact_editor) gui = glade_xml_new (EVOLUTION_GLADEDIR "/contact-editor.glade", NULL); e_contact_editor->gui = gui; - widget = glade_xml_get_widget(gui, "notebook-contact-editor"); - if (!widget) { - return; - } - gtk_widget_reparent(widget, - GTK_WIDGET(e_contact_editor)); + e_contact_editor->app = glade_xml_get_widget (gui, "contact editor"); - if (GTK_IS_CONTAINER(widget)) - e_container_foreach_leaf(GTK_CONTAINER(widget), (GtkCallback) add_field_callback, e_contact_editor); + e_container_foreach_leaf (GTK_CONTAINER (e_contact_editor->app), + (GtkCallback) add_field_callback, + e_contact_editor); _replace_buttons(e_contact_editor); set_entry_changed_signals(e_contact_editor); @@ -520,6 +870,24 @@ e_contact_editor_init (EContactEditor *e_contact_editor) if (widget && GTK_IS_BUTTON(widget)) gtk_signal_connect(GTK_OBJECT(widget), "clicked", categories_clicked, e_contact_editor); + + /* Build the menu and toolbar */ + + e_contact_editor->uih = bonobo_ui_handler_new (); + if (!e_contact_editor->uih) { + g_message ("e_contact_editor_init(): eeeeek, could not create the UI handler!"); + return; + } + + bonobo_ui_handler_set_app (e_contact_editor->uih, GNOME_APP (e_contact_editor->app)); + + create_menu (e_contact_editor); + create_toolbar (e_contact_editor); + + /* Connect to the deletion of the dialog */ + + gtk_signal_connect (GTK_OBJECT (e_contact_editor->app), "delete_event", + GTK_SIGNAL_FUNC (app_delete_event_cb), e_contact_editor); } void @@ -567,14 +935,20 @@ e_contact_editor_destroy (GtkObject *object) { gtk_object_unref(GTK_OBJECT(e_contact_editor->gui)); } -GtkWidget* -e_contact_editor_new (ECard *card) +EContactEditor * +e_contact_editor_new (ECard *card, gboolean is_new_card) { - GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_get_type ())); - gtk_object_set (GTK_OBJECT(widget), + EContactEditor *ce; + + ce = E_CONTACT_EDITOR (gtk_type_new (E_CONTACT_EDITOR_TYPE)); + + gtk_object_set (GTK_OBJECT (ce), "card", card, + "is_new_card", is_new_card, NULL); - return widget; + + gtk_widget_show (ce->app); + return ce; } static void @@ -594,6 +968,10 @@ e_contact_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) NULL); fill_in_info(editor); break; + + case ARG_IS_NEW_CARD: + editor->is_new_card = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE; + break; } } @@ -610,6 +988,11 @@ e_contact_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) extract_info(e_contact_editor); GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_contact_editor->card); break; + + case ARG_IS_NEW_CARD: + GTK_VALUE_BOOL (*arg) = e_contact_editor->is_new_card ? TRUE : FALSE; + break; + default: arg->type = GTK_TYPE_INVALID; break; diff --git a/addressbook/contact-editor/e-contact-editor.h b/addressbook/contact-editor/e-contact-editor.h index 288cec1db0..8eae2bf1b5 100644 --- a/addressbook/contact-editor/e-contact-editor.h +++ b/addressbook/contact-editor/e-contact-editor.h @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -52,13 +53,17 @@ typedef struct _EContactEditorClass EContactEditorClass; struct _EContactEditor { - GtkVBox parent; + GtkObject object; /* item specific fields */ ECard *card; ECardSimple *simple; + + /* UI handler */ + BonoboUIHandler *uih; GladeXML *gui; + GtkWidget *app; GnomeUIInfo *email_info; GnomeUIInfo *phone_info; GnomeUIInfo *address_info; @@ -77,15 +82,24 @@ struct _EContactEditor ECardSimpleAddressId address_choice; GList *arbitrary_fields; + + /* Whether we are editing a new card or an existing one */ + guint is_new_card : 1; }; struct _EContactEditorClass { - GtkVBoxClass parent_class; + GtkObjectClass parent_class; + + /* Notification signals */ + + void (* add_card) (EContactEditor *ce, ECard *card); + void (* commit_card) (EContactEditor *ce, ECard *card); + void (* editor_closed) (EContactEditor *ce); }; -GtkWidget *e_contact_editor_new(ECard *card); +EContactEditor *e_contact_editor_new (ECard *card, gboolean is_new_card); GtkType e_contact_editor_get_type (void); #ifdef __cplusplus diff --git a/addressbook/contact-editor/test-editor.c b/addressbook/contact-editor/test-editor.c index 5b48c1a92f..80db2fe848 100644 --- a/addressbook/contact-editor/test-editor.c +++ b/addressbook/contact-editor/test-editor.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * test-editor.c * Copyright (C) 2000 Helix Code, Inc. * Author: Chris Lahey @@ -75,21 +75,23 @@ read_file (char *name) return g_strdup (buff); } -/* This is a horrible thing to do, but it is just a test. */ -GtkWidget *editor; - -static void destroy_callback(GtkWidget *app, gpointer data) +/* Callback used when a contact editor is closed */ +static void +editor_closed_cb (EContactEditor *ce, gpointer data) { static int count = 2; - count --; - if ( count <= 0 ) - exit(0); + + count--; + gtk_object_unref (GTK_OBJECT (ce)); + + if (count == 0) + exit (0); } #if 0 static void about_callback( GtkWidget *widget, gpointer data ) { - + const gchar *authors[] = { "Christopher James Lahey ", @@ -102,57 +104,39 @@ static void about_callback( GtkWidget *widget, gpointer data ) authors, _( "This should test the contact editor canvas item" ), NULL); - gtk_widget_show (about); + gtk_widget_show (about); } #endif int main( int argc, char *argv[] ) { char *cardstr; - GtkWidget *app; - + EContactEditor *ce; + /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); textdomain (PACKAGE);*/ - + gnome_init( "Contact Editor Test", VERSION, argc, argv); - + glade_gnome_init (); - - app = gnome_app_new("Contact Editor Test", NULL); - + cardstr = NULL; if (argc == 2) cardstr = read_file (argv [1]); - + if (cardstr == NULL) cardstr = TEST_VCARD; - - editor = e_contact_editor_new(e_card_new(cardstr)); - - gnome_app_set_contents( GNOME_APP( app ), editor ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - app = gnome_app_new("Contact Editor Test", NULL); - - editor = e_contact_editor_new(e_card_new(cardstr)); - - gnome_app_set_contents( GNOME_APP( app ), editor ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - gtk_main(); - + + ce = e_contact_editor_new (e_card_new (cardstr), TRUE); + gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", + GTK_SIGNAL_FUNC (editor_closed_cb), NULL); + + ce = e_contact_editor_new (e_card_new (cardstr), TRUE); + gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", + GTK_SIGNAL_FUNC (editor_closed_cb), NULL); + + gtk_main(); + /* Not reached. */ return 0; } diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index f98ec6eb51..3026aa4811 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -102,59 +102,62 @@ card_modified_cb (EBook* book, EBookStatus status, g_print ("%s: %s(): a card was modified\n", __FILE__, __FUNCTION__); } +/* Callback for the add_card signal from the contact editor */ +static void +add_card_cb (EContactEditor *ce, ECard *card, gpointer data) +{ + EBook *book; + + book = E_BOOK (data); + e_book_add_card (book, card, card_added_cb, NULL); +} + +/* Callback for the commit_card signal from the contact editor */ +static void +commit_card_cb (EContactEditor *ce, ECard *card, gpointer data) +{ + EBook *book; + + book = E_BOOK (data); + e_book_commit_card (book, card, card_modified_cb, NULL); +} + +/* Callback used when the contact editor is closed */ +static void +editor_closed_cb (EContactEditor *ce, gpointer data) +{ + gtk_object_unref (GTK_OBJECT (ce)); +} + static void new_contact_cb (BonoboUIHandler *uih, void *user_data, const char *path) { - gint result; ECard *card; - GtkWidget* contact_editor; EBook *book; + EContactEditor *ce; AddressbookView *view = (AddressbookView *) user_data; GtkObject *object; - GtkWidget* dlg = gnome_dialog_new ("Contact Editor", "Save", GNOME_STOCK_BUTTON_CANCEL, NULL); card = e_card_new(""); - contact_editor = e_contact_editor_new(card); - gtk_object_sink(GTK_OBJECT(card)); - - gtk_window_set_policy(GTK_WINDOW(dlg), FALSE, TRUE, FALSE); if (view->view) object = GTK_OBJECT(view->view); else object = GTK_OBJECT(view->model); - gtk_object_get(object, "book", &book, NULL); - + gtk_object_get(object, "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); + ce = e_contact_editor_new (card, TRUE); - gnome_dialog_close_hides (GNOME_DIALOG (dlg), TRUE); - result = gnome_dialog_run_and_close (GNOME_DIALOG (dlg)); + 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); - - /* 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_add_card ( - book, - card, - card_added_cb, - NULL); - } - + gtk_object_sink(GTK_OBJECT(card)); } static void @@ -813,15 +816,8 @@ 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", GNOME_STOCK_BUTTON_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); + EContactEditor *ce; gtk_object_get(GTK_OBJECT(view->model), "book", &book, @@ -829,34 +825,16 @@ table_double_click(ETable *table, gint row, AddressbookView *view) 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); + ce = e_contact_editor_new (card, FALSE); - gnome_dialog_close_hides (GNOME_DIALOG (dlg), TRUE); - result = gnome_dialog_run_and_close (GNOME_DIALOG (dlg)); + 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); - - /* 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)); + gtk_object_unref(GTK_OBJECT(card)); } static void diff --git a/addressbook/gui/contact-editor/contact-editor.glade b/addressbook/gui/contact-editor/contact-editor.glade index 21ad4fd265..7f11886b28 100644 --- a/addressbook/gui/contact-editor/contact-editor.glade +++ b/addressbook/gui/contact-editor/contact-editor.glade @@ -20,124 +20,100 @@ - GtkWindow - contact editor + GnomeDialog + dialog2 + 2 False - Contact Editor GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False False - True + False False + False + False - GtkNotebook - notebook-contact-editor - True - True - True - GTK_POS_TOP - False - 2 - 2 - False + GtkVBox + GnomeDialog:vbox + dialog-vbox2 + False + 4 + + 4 + True + True + - GtkTable - table-contact-editor-general - 7 - 14 - 8 - False - 4 - 4 + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area2 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + - GtkEntry - entry-phone1 + GtkButton + button28 + True True - True - True - 0 - - - 7 - 8 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - + GNOME_STOCK_BUTTON_OK - GtkEntry - entry-phone2 + GtkButton + button29 + True True - True - True - 0 - - - 7 - 8 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - + GNOME_STOCK_BUTTON_APPLY - GtkEntry - entry-phone3 + GtkButton + button30 + True True - True - True - 0 - - - 7 - 8 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - + GNOME_STOCK_BUTTON_CANCEL + + + + GtkTable + table2 + 2 + 2 + False + 0 + 2 + + 0 + True + True + GtkEntry - entry-phone4 + entry2 True True True 0 - 7 - 8 - 3 - 4 + 0 + 2 + 1 + 2 0 0 True @@ -150,118 +126,19 @@ - GtkText - text-address - 1 - 1 - True - True - - - 7 - 8 - 5 - 9 - 0 - 0 - True - False - False - False - True - True - - - - - GtkButton - button-fullname - True - + GtkVBox + vbox1 + False + 2 1 - 3 + 2 0 1 0 0 False - False - False - False - True - True - - - - - GtkAccelLabel - accellabel-fileas - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 3 - 3 - 4 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAccelLabel - accellabel-web - - GTK_JUSTIFY_LEFT - False - 0 - 0.5 - 0 - 0 - - 1 - 3 - 8 - 9 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAlignment - alignment3 - 1 - 0.5 - 0 - 1 - - 2 - 3 - 5 - 6 - 0 - 0 - False - False + True False False True @@ -270,30 +147,48 @@ GtkButton - button-email1 + button31 + 2 + True + + + 0 + False + False + + - - Placeholder - + + GtkButton + button32 + 2 + True + + + 0 + False + False + - GtkAlignment - alignment5 - 1 - 0.5 - 0 - 0 + GtkScrolledWindow + scrolledwindow1 + 200 + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS - 6 - 7 - 3 - 4 + 0 + 1 + 0 + 1 0 0 - False - False + True + True False False True @@ -301,2005 +196,2136 @@ - GtkButton - button-phone4 + GtkCList + clist1 + True + 1 + 80 + GTK_SELECTION_SINGLE + True + GTK_SHADOW_NONE - Placeholder + GtkLabel + CList:title + label20 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + - - GtkAlignment - alignment7 - 1 - 0.5 - 0 - 0 - - 6 - 7 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - button-phone2 - - - Placeholder - - - + + GnomeDialog + dialog-add-phone + False + New phone type + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + False + False + False + False - - GtkAlignment - alignment8 - 1 - 0.5 - 0 - 0 - - 6 - 7 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - + + GtkVBox + GnomeDialog:vbox + vbox2 + False + 8 + + 4 + True + True + - - GtkButton - button-phone1 + + GtkHButtonBox + GnomeDialog:action_area + hbuttonbox1 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + - - Placeholder - - + + GtkButton + button43 + True + True + True + + GNOME_STOCK_PIXMAP_ADD - GtkHSeparator - hseparator4 - - 4 - 8 - 4 - 5 - 0 - 2 - True - False - False - False - True - False - + GtkButton + button44 + True + True + GNOME_STOCK_BUTTON_CANCEL + + + + GtkFrame + frame-add-phone + 4 + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + True + True + GtkAlignment - alignment6 - 1 + alignment9 + 9 + 0.5 0.5 - 0 - 0 - - 6 - 7 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - + 1 + 1 - GtkButton - button-phone3 - - - Placeholder - + GtkEntry + entry-add-phone + True + True + True + True + 0 + + + + - - GtkEntry - entry-fullname - True - True - True - True - True - 0 - - - 3 - 4 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - + + GnomeApp + contact editor + Contact Editor + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + True + False + True - - GtkEntry - entry-jobtitle - True - True - True - 0 - - - 3 - 4 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - + + GnomeDock + GnomeApp:dock + dock1 + True + + 0 + True + True + - - GtkEntry - entry-company - True - True - True - 0 - - - 3 - 4 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - - + + GtkNotebook + GnomeDock:contents + notebook-contact-editor + True + True + True + GTK_POS_TOP + False + 2 + 2 + False + + + GtkTable + table-contact-editor-general + 7 + 14 + 8 + False + 4 + 4 - - GtkEntry - entry-email1 - True - True - True - 0 - - - 3 - 4 - 5 - 6 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry-web - True - True - True - 0 - - - 3 - 4 - 8 - 9 - 0 - 0 - True - False - False - False - True - False - - - - - GtkHSeparator - hseparator5 - - 0 - 4 - 4 - 5 - 0 - 2 - True - False - False - False - True - False - - - - - GtkCombo - combo-file-as - False - True - True - True - False - - - 3 - 4 - 3 - 4 - 0 - 0 - True - False - False - False - True - False - + + GtkEntry + entry-phone1 + True + True + True + 0 + + + 7 + 8 + 0 + 1 + 0 + 0 + True + False + False + False + True + False + + GtkEntry - GtkCombo:entry - entry-file-as + entry-phone2 True True True 0 + + 7 + 8 + 1 + 2 + 0 + 0 + True + False + False + False + True + False + - - - GtkHSeparator - hseparator6 - - 0 - 4 - 7 - 8 - 0 - 2 - True - False - False - False - True - True - - - - - GtkAlignment - alignment10 - 0.5 - 0 - 1 - 1 - - 3 - 4 - 6 - 7 - 0 - 0 - True - False - True - True - True - True - + + GtkEntry + entry-phone3 + True + True + True + 0 + + + 7 + 8 + 2 + 3 + 0 + 0 + True + False + False + False + True + False + + - GtkCheckButton - checkbutton-htmlmail - - False - True + GtkEntry + entry-phone4 + True + True + True + 0 + + + 7 + 8 + 3 + 4 + 0 + 0 + True + False + False + False + True + False + - - - GtkAlignment - alignment4 - 1 - 0.5 - 0 - 0 - - 6 - 7 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - + + GtkText + text-address + 1 + 1 + True + True + + + 7 + 8 + 5 + 9 + 0 + 0 + True + False + False + False + True + True + + GtkButton - button-address - - - Placeholder - + button-fullname + True + + + 1 + 3 + 0 + 1 + 0 + 0 + False + False + False + False + True + True + - - - - GtkLabel - address-label - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - text-address - - 5 - 7 - 6 - 7 - 0 - 0 - False - False - False - False - True - True - - - - - GtkEventBox - eventbox1 - - 5 - 6 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - GtkLabel - label-phone1 - + GtkAccelLabel + accellabel-fileas + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - entry-phone1 + + 1 + 3 + 3 + 4 + 0 + 0 + False + False + False + False + True + True + - - - - GtkEventBox - eventbox2 - - 5 - 6 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - GtkLabel - label-phone2 - - GTK_JUSTIFY_CENTER + GtkAccelLabel + accellabel-web + + GTK_JUSTIFY_LEFT False 0 0.5 0 0 - entry-phone2 + + 1 + 3 + 8 + 9 + 0 + 0 + False + False + False + False + True + True + - - - - GtkEventBox - eventbox3 - - 5 - 6 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - GtkLabel - label-phone3 - - GTK_JUSTIFY_CENTER - False - 0 + GtkAlignment + alignment3 + 1 0.5 - 0 - 0 - entry-phone3 + 0 + 1 + + 2 + 3 + 5 + 6 + 0 + 0 + False + False + False + False + True + True + + + + GtkButton + button-email1 + + + Placeholder + + - - - GtkEventBox - eventbox4 - - 5 - 6 - 3 - 4 - 0 - 0 - False - False - False - False - True - True - + + GtkAlignment + alignment5 + 1 + 0.5 + 0 + 0 + + 6 + 7 + 3 + 4 + 0 + 0 + False + False + False + False + True + True + + + + GtkButton + button-phone4 + + + Placeholder + + + - GtkLabel - label-phone4 - - GTK_JUSTIFY_LEFT - False - 0 + GtkAlignment + alignment7 + 1 0.5 - 0 - 0 - entry-phone4 + 0 + 0 + + 6 + 7 + 1 + 2 + 0 + 0 + False + False + False + False + True + True + + + + GtkButton + button-phone2 + + + Placeholder + + - - - - GtkEventBox - eventbox5 - - 1 - 2 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - - GtkLabel - label-email1 - - GTK_JUSTIFY_CENTER - False - 0 + GtkAlignment + alignment8 + 1 0.5 - 0 - 0 - entry-email1 - - + 0 + 0 + + 6 + 7 + 0 + 1 + 0 + 0 + False + False + False + False + True + True + - - GtkEventBox - eventbox-business - - 5 - 6 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - + + GtkButton + button-phone1 - - GtkLabel - label-address - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - text-address + + Placeholder + + - - - - GtkAlignment - alignment2 - 0 - 0 - 0 - 0 - - 7 - 8 - 9 - 10 - 0 - 0 - True - False - False - False - True - True - - GtkCheckButton - checkbutton-mailingaddress - - False - True + GtkHSeparator + hseparator4 + + 4 + 8 + 4 + 5 + 0 + 2 + True + False + False + False + True + False + - - - GtkHSeparator - hseparator9 - - 0 - 4 - 11 - 12 - 0 - 2 - True - False - False - False - True - True - - + + GtkAlignment + alignment6 + 1 + 0.5 + 0 + 0 + + 6 + 7 + 2 + 3 + 0 + 0 + False + False + False + False + True + True + - - GtkHSeparator - hseparator10 - - 4 - 8 - 11 - 12 - 0 - 0 - True - False - False - False - True - True - - + + GtkButton + button-phone3 - - GtkAlignment - alignment12 - 0.5 - 0.5 - 1 - 0 - - 1 - 3 - 12 - 13 - 0 - 0 - False - False - False - False - True - True - + + Placeholder + + + - GtkButton - button-contacts + GtkEntry + entry-fullname + True True - + True + True + True + 0 + + + 3 + 4 + 0 + 1 + 0 + 0 + True + False + False + False + True + False + - - - GtkAlignment - alignment15 - 0.5 - 0.5 - 1 - 0 - - 7 - 8 - 12 - 13 - 0 - 0 - True - False - False - False - True - True - + + GtkEntry + entry-jobtitle + True + True + True + 0 + + + 3 + 4 + 1 + 2 + 0 + 0 + True + False + False + False + True + False + + GtkEntry - entry-categories + entry-company True True True 0 + + 3 + 4 + 2 + 3 + 0 + 0 + True + False + False + False + True + False + - - - GtkAlignment - alignment14 - 0.5 - 0.5 - 1 - 0 - - 3 - 4 - 12 - 13 - 0 - 0 - True - False - False - False - True - True - + + GtkEntry + entry-email1 + True + True + True + 0 + + + 3 + 4 + 5 + 6 + 0 + 0 + True + False + False + False + True + False + + GtkEntry - entry-contacts + entry-web True True True 0 + + 3 + 4 + 8 + 9 + 0 + 0 + True + False + False + False + True + False + - - - GtkAlignment - alignment16 - 0.5 - 0.5 - 1 - 0 - - 5 - 7 - 12 - 13 - 0 - 0 - False - False - False - False - True - True - + + GtkHSeparator + hseparator5 + + 0 + 4 + 4 + 5 + 0 + 2 + True + False + False + False + True + False + + - GtkButton - button-categories - True - + GtkCombo + combo-file-as + False + True + True + True + False + + + 3 + 4 + 3 + 4 + 0 + 0 + True + False + False + False + True + False + + + + GtkEntry + GtkCombo:entry + entry-file-as + True + True + True + 0 + + - - - GtkEventBox - eventbox7 - - 1 - 3 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - + + GtkHSeparator + hseparator6 + + 0 + 4 + 7 + 8 + 0 + 2 + True + False + False + False + True + True + + - GtkLabel - label34 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - entry-jobtitle + GtkAlignment + alignment10 + 0.5 + 0 + 1 + 1 + + 3 + 4 + 6 + 7 + 0 + 0 + True + False + True + True + True + True + + + + GtkCheckButton + checkbutton-htmlmail + + False + True + - - - Custom - custom1 - e_create_image_widget - malehead.png - - 0 - 0 - Thu, 18 May 2000 12:19:47 GMT - - 0 - 1 - 0 - 4 - 0 - 0 - False - False - False - False - True - True - - - - - Custom - custom2 - e_create_image_widget - cellphone.png - - 0 - 0 - Thu, 18 May 2000 12:20:02 GMT - - 4 - 5 - 0 - 4 - 0 - 0 - False - False - False - False - True - True - - + + GtkAlignment + alignment4 + 1 + 0.5 + 0 + 0 + + 6 + 7 + 5 + 6 + 0 + 0 + False + False + False + False + True + True + - - Custom - custom3 - e_create_image_widget - envelope.png - - 0 - 0 - Thu, 18 May 2000 12:19:51 GMT - - 0 - 1 - 5 - 7 - 0 - 0 - False - False - False - False - True - True - - + + GtkButton + button-address - - Custom - custom4 - e_create_image_widget - house.png - - 0 - 0 - Thu, 18 May 2000 12:20:06 GMT - - 4 - 5 - 5 - 10 - 0 - 0 - False - False - False - False - True - True - - + + Placeholder + + + - - Custom - custom5 - e_create_image_widget - evolution-contacts.png - - 0 - 0 - Thu, 18 May 2000 12:19:59 GMT - - 0 - 1 - 12 - 14 + + GtkLabel + address-label + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - False - False - False - False - True - True - - + text-address + + 5 + 7 + 6 + 7 + 0 + 0 + False + False + False + False + True + True + + - - Custom - custom6 - e_create_image_widget - briefcase.png - - 0 - 0 - Thu, 18 May 2000 12:20:09 GMT - - 4 - 5 - 12 - 14 - 0 - 0 - False - False - False - False - True - True - - + + GtkEventBox + eventbox1 + + 5 + 6 + 0 + 1 + 0 + 0 + False + False + False + False + True + True + - - Custom - custom10 - e_create_image_widget - globe.png - - 0 - 0 - Thu, 18 May 2000 12:19:56 GMT - - 0 - 1 - 8 - 10 - 0 - 0 - False - False - False - False - True - True - - + + GtkLabel + label-phone1 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-phone1 + + - - GtkLabel - label35 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - entry-company - - 1 - 3 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - - + + GtkEventBox + eventbox2 + + 5 + 6 + 1 + 2 + 0 + 0 + False + False + False + False + True + True + - - GtkLabel - Notebook:tab - label15 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - + + GtkLabel + label-phone2 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-phone2 + + - - GtkTable - table-contact-editor-details - 7 - 9 - 6 - False - 4 - 4 + + GtkEventBox + eventbox3 + + 5 + 6 + 2 + 3 + 0 + 0 + False + False + False + False + True + True + - - GtkLabel - label21 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - entry-department - - 1 - 2 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - + + GtkLabel + label-phone3 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-phone3 + + - - GtkLabel - label22 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - entry-office - - 1 - 2 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - + + GtkEventBox + eventbox4 + + 5 + 6 + 3 + 4 + 0 + 0 + False + False + False + False + True + True + - - GtkLabel - label23 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - entry-profession - - 1 - 2 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - + + GtkLabel + label-phone4 + + GTK_JUSTIFY_LEFT + False + 0 + 0.5 + 0 + 0 + entry-phone4 + + - - GtkLabel - label24 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - entry-nickname - - 1 - 2 - 4 - 5 - 0 - 0 - False - False - False - False - True - True - - + + GtkEventBox + eventbox5 + + 1 + 2 + 5 + 6 + 0 + 0 + False + False + False + False + True + True + - - GtkLabel - label25 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - entry-spouse - - 1 - 2 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - - + + GtkLabel + label-email1 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-email1 + + - - GtkLabel - label31 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 3 - 4 - 4 - 5 - 0 - 0 - False - False - False - False - True - True - - + + GtkEventBox + eventbox-business + + 5 + 6 + 5 + 6 + 0 + 0 + False + False + False + False + True + True + - - GtkLabel - label30 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - entry-assistant - - 3 - 4 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - + + GtkLabel + label-address + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + text-address + + - - GtkLabel - label29 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - entry-manager - - 3 - 4 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - + + GtkAlignment + alignment2 + 0 + 0 + 0 + 0 + + 7 + 8 + 9 + 10 + 0 + 0 + True + False + False + False + True + True + - - GtkLabel - label32 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 3 - 4 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - - + + GtkCheckButton + checkbutton-mailingaddress + + False + True + + - - GtkEntry - entry-spouse - True - True - True - 0 - - - 2 - 3 - 5 - 6 - 0 - 0 - True - False - False - False - True - False - - + + GtkHSeparator + hseparator9 + + 0 + 4 + 11 + 12 + 0 + 2 + True + False + False + False + True + True + + + + + GtkHSeparator + hseparator10 + + 4 + 8 + 11 + 12 + 0 + 0 + True + False + False + False + True + True + + + + + GtkAlignment + alignment12 + 0.5 + 0.5 + 1 + 0 + + 1 + 3 + 12 + 13 + 0 + 0 + False + False + False + False + True + True + + + + GtkButton + button-contacts + True + + + + + + GtkAlignment + alignment15 + 0.5 + 0.5 + 1 + 0 + + 7 + 8 + 12 + 13 + 0 + 0 + True + False + False + False + True + True + + + + GtkEntry + entry-categories + True + True + True + 0 + + + + + + GtkAlignment + alignment14 + 0.5 + 0.5 + 1 + 0 + + 3 + 4 + 12 + 13 + 0 + 0 + True + False + False + False + True + True + + + + GtkEntry + entry-contacts + True + True + True + 0 + + + + + + GtkAlignment + alignment16 + 0.5 + 0.5 + 1 + 0 + + 5 + 7 + 12 + 13 + 0 + 0 + False + False + False + False + True + True + + + + GtkButton + button-categories + True + + + + + + GtkEventBox + eventbox7 + + 1 + 3 + 1 + 2 + 0 + 0 + False + False + False + False + True + True + + + + GtkLabel + label34 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-jobtitle + + + + + Custom + custom1 + e_create_image_widget + malehead.png + + 0 + 0 + Thu, 18 May 2000 12:19:47 GMT + + 0 + 1 + 0 + 4 + 0 + 0 + False + False + False + False + True + True + + + + + Custom + custom2 + e_create_image_widget + cellphone.png + + 0 + 0 + Thu, 18 May 2000 12:20:02 GMT + + 4 + 5 + 0 + 4 + 0 + 0 + False + False + False + False + True + True + + + + + Custom + custom3 + e_create_image_widget + envelope.png + + 0 + 0 + Thu, 18 May 2000 12:19:51 GMT + + 0 + 1 + 5 + 7 + 0 + 0 + False + False + False + False + True + True + + + + + Custom + custom4 + e_create_image_widget + house.png + + 0 + 0 + Thu, 18 May 2000 12:20:06 GMT + + 4 + 5 + 5 + 10 + 0 + 0 + False + False + False + False + True + True + + + + + Custom + custom5 + e_create_image_widget + evolution-contacts.png + + 0 + 0 + Thu, 18 May 2000 12:19:59 GMT + + 0 + 1 + 12 + 14 + 0 + 0 + False + False + False + False + True + True + + - - GtkEntry - entry-department - True - True - True - 0 - - - 2 - 3 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - + + Custom + custom6 + e_create_image_widget + briefcase.png + + 0 + 0 + Thu, 18 May 2000 12:20:09 GMT + + 4 + 5 + 12 + 14 + 0 + 0 + False + False + False + False + True + True + + - - GtkEntry - entry-office - True - True - True - 0 - - - 2 - 3 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - + + Custom + custom10 + e_create_image_widget + globe.png + + 0 + 0 + Thu, 18 May 2000 12:19:56 GMT + + 0 + 1 + 8 + 10 + 0 + 0 + False + False + False + False + True + True + + - - GtkEntry - entry-profession - True - True - True - 0 - - - 2 - 3 - 2 - 3 + + GtkLabel + label35 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - True - False - False - False - True - False - + entry-company + + 1 + 3 + 2 + 3 + 0 + 0 + False + False + False + False + True + True + + - GtkEntry - entry-nickname - True - True - True - 0 - - - 2 - 3 - 4 - 5 - 0 - 0 - True - False - False - False - True - False - + GtkLabel + Notebook:tab + label15 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 - GnomeDateEdit - dateedit-anniversary - False - False - False - 7 - 19 - - 4 - 6 - 5 - 6 - 0 - 0 - True - False - False - False - True - False - - + GtkTable + table-contact-editor-details + 7 + 9 + 6 + False + 4 + 4 - - GnomeDateEdit - dateedit-birthday - False - False - False - 7 - 19 - - 4 - 6 - 4 - 5 + + GtkLabel + label21 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - True - False - False - False - True - False - - + entry-department + + 1 + 2 + 0 + 1 + 0 + 0 + False + False + False + False + True + True + + - - GtkEntry - entry-assistant - True - True - True - 0 - - - 4 - 6 - 1 - 2 + + GtkLabel + label22 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - True - False - False - False - True - False - - + entry-office + + 1 + 2 + 1 + 2 + 0 + 0 + False + False + False + False + True + True + + - - GtkEntry - entry-manager - True - True - True - 0 - - - 4 - 6 - 0 - 1 + + GtkLabel + label23 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - True - False - False - False - True - False - - + entry-profession + + 1 + 2 + 2 + 3 + 0 + 0 + False + False + False + False + True + True + + - - GtkHSeparator - hseparator7 - - 0 - 6 - 3 - 4 + + GtkLabel + label24 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 - 2 - False - False - False - False - True - True - - + 0 + entry-nickname + + 1 + 2 + 4 + 5 + 0 + 0 + False + False + False + False + True + True + + - - GtkLabel - label33 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 7 - 8 + + GtkLabel + label25 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - False - False - False - False - True - True - - + entry-spouse + + 1 + 2 + 5 + 6 + 0 + 0 + False + False + False + False + True + True + + - - GtkHSeparator - hseparator8 - - 0 - 6 - 6 - 7 + + GtkLabel + label31 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - True - False - False - False - True - True - - + + 3 + 4 + 4 + 5 + 0 + 0 + False + False + False + False + True + True + + - - Custom - custom7 - e_create_image_widget - briefcase.png - - 0 - 0 - Thu, 18 May 2000 12:20:13 GMT - - 0 - 1 - 0 - 2 + + GtkLabel + label30 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - False - False - False - False - True - True - - + entry-assistant + + 3 + 4 + 1 + 2 + 0 + 0 + False + False + False + False + True + True + + - - Custom - custom8 - e_create_image_widget - malehead.png - - 0 - 0 - Thu, 18 May 2000 12:20:16 GMT - - 0 - 1 - 4 - 6 + + GtkLabel + label29 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - False - False - False - False - True - True - - + entry-manager + + 3 + 4 + 0 + 1 + 0 + 0 + False + False + False + False + True + True + + - - GtkScrolledWindow - scrolledwindow2 - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 1 - 6 - 8 - 9 + + GtkLabel + label32 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - True - True - False - False - True - True - + + 3 + 4 + 5 + 6 + 0 + 0 + False + False + False + False + True + True + + - GtkText - text-comments + GtkEntry + entry-spouse True True + True + 0 + + 2 + 3 + 5 + 6 + 0 + 0 + True + False + False + False + True + False + - - - - Custom - custom9 - e_create_image_widget - globe.png - - 0 - 0 - Thu, 18 May 2000 12:20:19 GMT - - 0 - 1 - 7 - 9 - 0 - 0 - False - False - False - False - True - True - - - - - - GtkLabel - Notebook:tab - label16 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - GnomeDialog - dialog2 - 2 - False - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - False - False - False - False - - - GtkVBox - GnomeDialog:vbox - dialog-vbox2 - False - 4 - - 4 - True - True - - - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area2 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button28 - True - True - GNOME_STOCK_BUTTON_OK - - - GtkButton - button29 - True - True - GNOME_STOCK_BUTTON_APPLY - + + GtkEntry + entry-department + True + True + True + 0 + + + 2 + 3 + 0 + 1 + 0 + 0 + True + False + False + False + True + False + + - - GtkButton - button30 - True - True - GNOME_STOCK_BUTTON_CANCEL - - + + GtkEntry + entry-office + True + True + True + 0 + + + 2 + 3 + 1 + 2 + 0 + 0 + True + False + False + False + True + False + + - - GtkTable - table2 - 2 - 2 - False - 0 - 2 - - 0 - True - True - + + GtkEntry + entry-profession + True + True + True + 0 + + + 2 + 3 + 2 + 3 + 0 + 0 + True + False + False + False + True + False + + - - GtkEntry - entry2 - True - True - True - 0 - - - 0 - 2 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - + + GtkEntry + entry-nickname + True + True + True + 0 + + + 2 + 3 + 4 + 5 + 0 + 0 + True + False + False + False + True + False + + - - GtkVBox - vbox1 - False - 2 - - 1 - 2 - 0 - 1 - 0 - 0 - False - True - False - False - True - True - + + GnomeDateEdit + dateedit-anniversary + False + False + False + 7 + 19 + + 4 + 6 + 5 + 6 + 0 + 0 + True + False + False + False + True + False + + - GtkButton - button31 - 2 + GnomeDateEdit + dateedit-birthday + False + False + False + 7 + 19 + + 4 + 6 + 4 + 5 + 0 + 0 + True + False + False + False + True + False + + + + + GtkEntry + entry-assistant True - + True + True + 0 + - 0 - False - False + 4 + 6 + 1 + 2 + 0 + 0 + True + False + False + False + True + False - GtkButton - button32 - 2 + GtkEntry + entry-manager True - + True + True + 0 + - 0 - False - False + 4 + 6 + 0 + 1 + 0 + 0 + True + False + False + False + True + False - - - GtkScrolledWindow - scrolledwindow1 - 200 - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 0 - 1 - 0 - 1 + + GtkHSeparator + hseparator7 + + 0 + 6 + 3 + 4 + 0 + 2 + False + False + False + False + True + True + + + + + GtkLabel + label33 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - True - True - False - False - True - True - + + 1 + 2 + 7 + 8 + 0 + 0 + False + False + False + False + True + True + + - GtkCList - clist1 - True - 1 - 80 - GTK_SELECTION_SINGLE - True - GTK_SHADOW_NONE - - - GtkLabel - CList:title - label20 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 + GtkHSeparator + hseparator8 + + 0 + 6 + 6 + 7 0 0 - + True + False + False + False + True + True + - - - - - - GnomeDialog - dialog-add-phone - False - New phone type - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - False - False - False - False + + Custom + custom7 + e_create_image_widget + briefcase.png + + 0 + 0 + Thu, 18 May 2000 12:20:13 GMT + + 0 + 1 + 0 + 2 + 0 + 0 + False + False + False + False + True + True + + - - GtkVBox - GnomeDialog:vbox - vbox2 - False - 8 - - 4 - True - True - + + Custom + custom8 + e_create_image_widget + malehead.png + + 0 + 0 + Thu, 18 May 2000 12:20:16 GMT + + 0 + 1 + 4 + 6 + 0 + 0 + False + False + False + False + True + True + + - - GtkHButtonBox - GnomeDialog:action_area - hbuttonbox1 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - + + GtkScrolledWindow + scrolledwindow2 + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 1 + 6 + 8 + 9 + 0 + 0 + True + True + False + False + True + True + - - GtkButton - button43 - True - True - True - - GNOME_STOCK_PIXMAP_ADD - + + GtkText + text-comments + True + True + + + - - GtkButton - button44 - True - True - GNOME_STOCK_BUTTON_CANCEL + + Custom + custom9 + e_create_image_widget + globe.png + + 0 + 0 + Thu, 18 May 2000 12:20:19 GMT + + 0 + 1 + 7 + 9 + 0 + 0 + False + False + False + False + True + True + + - - - - GtkFrame - frame-add-phone - 4 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - GtkAlignment - alignment9 - 9 + GtkLabel + Notebook:tab + label16 + + GTK_JUSTIFY_CENTER + False 0.5 0.5 - 1 - 1 - - - GtkEntry - entry-add-phone - True - True - True - True - 0 - - + 0 + 0 + + + GnomeAppBar + GnomeApp:appbar + appbar1 + True + True + + 0 + True + True + + diff --git a/addressbook/gui/contact-editor/e-contact-editor-strings.h b/addressbook/gui/contact-editor/e-contact-editor-strings.h index d5f1983573..d5ac9daf24 100644 --- a/addressbook/gui/contact-editor/e-contact-editor-strings.h +++ b/addressbook/gui/contact-editor/e-contact-editor-strings.h @@ -4,6 +4,12 @@ * DO NOT compile it as part of your application. */ +gchar *s = N_("_Add"); +gchar *s = N_("_Delete"); +gchar *s = N_("Phone Types"); +gchar *s = N_("New phone type"); +gchar *s = N_("Add"); +gchar *s = N_("New phone type"); gchar *s = N_("Contact Editor"); gchar *s = N_("_Full Name..."); gchar *s = N_("File As:"); @@ -33,9 +39,3 @@ gchar *s = N_("_Manager's Name:"); gchar *s = N_("Anni_versary:"); gchar *s = N_("No_tes:"); gchar *s = N_("Details"); -gchar *s = N_("_Add"); -gchar *s = N_("_Delete"); -gchar *s = N_("Phone Types"); -gchar *s = N_("New phone type"); -gchar *s = N_("Add"); -gchar *s = N_("New phone type"); diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index 5ca3fd753e..00cf952d8e 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -29,6 +29,14 @@ #include #include +/* Signal IDs */ +enum { + ADD_CARD, + COMMIT_CARD, + EDITOR_CLOSED, + LAST_SIGNAL +}; + static void e_contact_editor_init (EContactEditor *card); static void e_contact_editor_class_init (EContactEditorClass *klass); static void e_contact_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); @@ -47,12 +55,15 @@ static void set_fields(EContactEditor *editor); static void set_address_field(EContactEditor *editor, int result); static void add_field_callback(GtkWidget *widget, EContactEditor *editor); -static GtkVBoxClass *parent_class = NULL; +static GtkObjectClass *parent_class = NULL; + +static guint contact_editor_signals[LAST_SIGNAL]; /* The arguments we take */ enum { ARG_0, - ARG_CARD + ARG_CARD, + ARG_IS_NEW_CARD }; enum { @@ -80,7 +91,7 @@ e_contact_editor_get_type (void) (GtkClassInitFunc) NULL, }; - contact_editor_type = gtk_type_unique (gtk_vbox_get_type (), &contact_editor_info); + contact_editor_type = gtk_type_unique (GTK_TYPE_OBJECT, &contact_editor_info); } return contact_editor_type; @@ -90,15 +101,43 @@ static void e_contact_editor_class_init (EContactEditorClass *klass) { GtkObjectClass *object_class; - GtkVBoxClass *vbox_class; object_class = (GtkObjectClass*) klass; - vbox_class = (GtkVBoxClass *) klass; - parent_class = gtk_type_class (gtk_vbox_get_type ()); + parent_class = gtk_type_class (GTK_TYPE_OBJECT); gtk_object_add_arg_type ("EContactEditor::card", GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CARD); + gtk_object_add_arg_type ("EContactEditor::is_new_card", GTK_TYPE_BOOL, + GTK_ARG_READWRITE, ARG_IS_NEW_CARD); + + contact_editor_signals[ADD_CARD] = + gtk_signal_new ("add_card", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (EContactEditorClass, add_card), + gtk_marshal_NONE__OBJECT, + GTK_TYPE_NONE, 1, + GTK_TYPE_OBJECT); + + contact_editor_signals[COMMIT_CARD] = + gtk_signal_new ("commit_card", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (EContactEditorClass, commit_card), + gtk_marshal_NONE__OBJECT, + GTK_TYPE_NONE, 1, + GTK_TYPE_OBJECT); + + contact_editor_signals[EDITOR_CLOSED] = + gtk_signal_new ("editor_closed", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (EContactEditorClass, editor_closed), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + + gtk_object_class_add_signals (object_class, contact_editor_signals, LAST_SIGNAL); object_class->set_arg = e_contact_editor_set_arg; object_class->get_arg = e_contact_editor_get_arg; @@ -463,13 +502,328 @@ categories_clicked(GtkWidget *button, EContactEditor *editor) g_free(categories); } +/* Emits the signal to request saving a card */ +static void +save_card (EContactEditor *ce) +{ + if (ce->is_new_card) + gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[ADD_CARD], + ce->card); + else + gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[COMMIT_CARD], + ce->card); + + /* FIXME: should we set the ce->is_new_card here or have the client code + * set the "is_new_card" argument on the contact editor object? + */ + + ce->is_new_card = FALSE; +} + +/* Closes the dialog box and emits the appropriate signals */ +static void +close_dialog (EContactEditor *ce) +{ + g_assert (ce->app != NULL); + + gtk_widget_destroy (ce->app); + ce->app = NULL; + + gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[EDITOR_CLOSED]); +} + +/* Menu callbacks */ + +/* File/Save callback */ +static void +file_save_cb (GtkWidget *widget, gpointer data) +{ + EContactEditor *ce; + + ce = E_CONTACT_EDITOR (data); + save_card (ce); +} + +/* File/Close callback */ +static void +file_close_cb (GtkWidget *widget, gpointer data) +{ + EContactEditor *ce; + + ce = E_CONTACT_EDITOR (data); + close_dialog (ce); +} + +/* Menu bar */ + +static GnomeUIInfo file_new_menu[] = { + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Appointment"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Meeting Re_quest"), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Mail Message"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Contact"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Task"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Task _Request"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Journal Entry"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Note"), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Ch_oose Form..."), NULL, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo file_page_setup_menu[] = { + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Memo Style"), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Define Print _Styles..."), NULL, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo file_menu[] = { + GNOMEUIINFO_MENU_NEW_SUBTREE (file_new_menu), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: S_end"), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_MENU_SAVE_ITEM (file_save_cb, NULL), + GNOMEUIINFO_MENU_SAVE_AS_ITEM (NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Save Attac_hments..."), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Delete"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Move to Folder..."), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Cop_y to Folder..."), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_SUBTREE (N_("Page Set_up"), file_page_setup_menu), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Print Pre_view"), NULL, NULL), + GNOMEUIINFO_MENU_PRINT_ITEM (NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_MENU_PROPERTIES_ITEM (NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_MENU_CLOSE_ITEM (file_close_cb, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo edit_object_menu[] = { + GNOMEUIINFO_ITEM_NONE ("FIXME: what goes here?", NULL, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo edit_menu[] = { + GNOMEUIINFO_MENU_UNDO_ITEM (NULL, NULL), + GNOMEUIINFO_MENU_REDO_ITEM (NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_MENU_CUT_ITEM (NULL, NULL), + GNOMEUIINFO_MENU_COPY_ITEM (NULL, NULL), + GNOMEUIINFO_MENU_PASTE_ITEM (NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Paste _Special..."), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_MENU_CLEAR_ITEM (NULL, NULL), + GNOMEUIINFO_MENU_SELECT_ALL_ITEM (NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Mark as U_nread"), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_MENU_FIND_ITEM (NULL, NULL), + GNOMEUIINFO_MENU_FIND_AGAIN_ITEM (NULL, NULL), + GNOMEUIINFO_SUBTREE (N_("_Object"), edit_object_menu), + GNOMEUIINFO_END +}; + +static GnomeUIInfo view_previous_menu[] = { + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Item"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Unread Item"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Fi_rst Item in Folder"), NULL, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo view_next_menu[] = { + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Item"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Unread Item"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Last Item in Folder"), NULL, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo view_toolbars_menu[] = { + { GNOME_APP_UI_TOGGLEITEM, N_("FIXME: _Standard"), NULL, NULL, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, + { GNOME_APP_UI_TOGGLEITEM, N_("FIXME: __Formatting"), NULL, NULL, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Customize..."), NULL, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo view_menu[] = { + GNOMEUIINFO_SUBTREE (N_("Pre_vious"), view_previous_menu), + GNOMEUIINFO_SUBTREE (N_("Ne_xt"), view_next_menu), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_SUBTREE (N_("_Toolbars"), view_toolbars_menu), + GNOMEUIINFO_END +}; + +static GnomeUIInfo insert_menu[] = { + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _File..."), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: It_em..."), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Object..."), NULL, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo format_menu[] = { + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Font..."), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Paragraph..."), NULL, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo tools_forms_menu[] = { + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Ch_oose Form..."), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Desi_gn This Form"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: D_esign a Form..."), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Publish _Form..."), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Pu_blish Form As..."), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Script _Debugger"), NULL, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo tools_menu[] = { + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Spelling..."), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_SUBTREE (N_("_Forms"), tools_forms_menu), + GNOMEUIINFO_END +}; + +static GnomeUIInfo actions_menu[] = { + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _New Contact"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: New _Contact from Same Company"), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: New _Letter to Contact"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: New _Message to Contact"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: New Meetin_g with Contact"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Plan a Meeting..."), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: New _Task for Contact"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: New _Journal Entry for Contact"), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Flag for Follow Up..."), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Display Map of Address"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Open Web Page"), NULL, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Forward as _vCard"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: For_ward"), NULL, NULL) +}; + +static GnomeUIInfo help_menu[] = { + GNOMEUIINFO_ITEM_NONE ("FIXME: fix Bonobo so it supports help items!", NULL, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo main_menu[] = { + GNOMEUIINFO_MENU_FILE_TREE (file_menu), + GNOMEUIINFO_MENU_EDIT_TREE (edit_menu), + GNOMEUIINFO_MENU_VIEW_TREE (view_menu), + GNOMEUIINFO_SUBTREE (N_("_Insert"), insert_menu), + GNOMEUIINFO_SUBTREE (N_("F_ormat"), format_menu), + GNOMEUIINFO_SUBTREE (N_("_Tools"), tools_menu), + GNOMEUIINFO_SUBTREE (N_("Actio_ns"), actions_menu), + GNOMEUIINFO_MENU_HELP_TREE (help_menu), + GNOMEUIINFO_END +}; + +/* Creates the menu bar for the contact editor */ +static void +create_menu (EContactEditor *ce) +{ + BonoboUIHandlerMenuItem *list; + + bonobo_ui_handler_create_menubar (ce->uih); + + list = bonobo_ui_handler_menu_parse_uiinfo_list_with_data (main_menu, ce); + bonobo_ui_handler_menu_add_list (ce->uih, "/", list); +} + +/* Toolbar/Save and Close callback */ +static void +tb_save_and_close_cb (GtkWidget *widget, gpointer data) +{ + EContactEditor *ce; + + ce = E_CONTACT_EDITOR (data); + save_card (ce); + close_dialog (ce); +} + +/* Toolbar */ + +static GnomeUIInfo toolbar[] = { + GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Save and Close"), + N_("Save the appointment and close the dialog box"), + tb_save_and_close_cb, + GNOME_STOCK_PIXMAP_SAVE), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Print..."), + N_("Print this item"), NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Insert File..."), + N_("Insert a file as an attachment"), NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Recurrence..."), + N_("Configure recurrence rules"), NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Invite Attendees..."), + N_("Invite attendees to a meeting"), NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Delete"), + N_("Delete this item"), NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Previous"), + N_("Go to the previous item"), NULL), + GNOMEUIINFO_ITEM_NONE (N_("FIXME: Next"), + N_("Go to the next item"), NULL), + GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Help"), + N_("See online help"), NULL, GNOME_STOCK_PIXMAP_HELP), + GNOMEUIINFO_END +}; + +/* Creates the toolbar for the contact editor */ +static void +create_toolbar (EContactEditor *ce) +{ + BonoboUIHandlerToolbarItem *list; + GnomeDockItem *dock_item; + GtkWidget *toolbar_child; + + bonobo_ui_handler_create_toolbar (ce->uih, "Toolbar"); + + /* Fetch the toolbar. What a pain in the ass. */ + + dock_item = gnome_app_get_dock_item_by_name (GNOME_APP (ce->app), GNOME_APP_TOOLBAR_NAME); + g_assert (dock_item != NULL); + + toolbar_child = gnome_dock_item_get_child (dock_item); + g_assert (toolbar_child != NULL && GTK_IS_TOOLBAR (toolbar_child)); + + /* Turn off labels as GtkToolbar sucks */ + gtk_toolbar_set_style (GTK_TOOLBAR (toolbar_child), GTK_TOOLBAR_ICONS); + + list = bonobo_ui_handler_toolbar_parse_uiinfo_list_with_data (toolbar, ce); + bonobo_ui_handler_toolbar_add_list (ce->uih, "/Toolbar", list); +} + +/* Callback used when the dialog box is destroyed */ +static gint +app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) +{ + EContactEditor *ce; + + ce = E_CONTACT_EDITOR (data); + + close_dialog (ce); + return TRUE; +} + static void e_contact_editor_init (EContactEditor *e_contact_editor) { GladeXML *gui; GtkWidget *widget; - e_contact_editor->email_info = NULL; e_contact_editor->phone_info = NULL; e_contact_editor->address_info = NULL; @@ -498,15 +852,11 @@ e_contact_editor_init (EContactEditor *e_contact_editor) gui = glade_xml_new (EVOLUTION_GLADEDIR "/contact-editor.glade", NULL); e_contact_editor->gui = gui; - widget = glade_xml_get_widget(gui, "notebook-contact-editor"); - if (!widget) { - return; - } - gtk_widget_reparent(widget, - GTK_WIDGET(e_contact_editor)); + e_contact_editor->app = glade_xml_get_widget (gui, "contact editor"); - if (GTK_IS_CONTAINER(widget)) - e_container_foreach_leaf(GTK_CONTAINER(widget), (GtkCallback) add_field_callback, e_contact_editor); + e_container_foreach_leaf (GTK_CONTAINER (e_contact_editor->app), + (GtkCallback) add_field_callback, + e_contact_editor); _replace_buttons(e_contact_editor); set_entry_changed_signals(e_contact_editor); @@ -520,6 +870,24 @@ e_contact_editor_init (EContactEditor *e_contact_editor) if (widget && GTK_IS_BUTTON(widget)) gtk_signal_connect(GTK_OBJECT(widget), "clicked", categories_clicked, e_contact_editor); + + /* Build the menu and toolbar */ + + e_contact_editor->uih = bonobo_ui_handler_new (); + if (!e_contact_editor->uih) { + g_message ("e_contact_editor_init(): eeeeek, could not create the UI handler!"); + return; + } + + bonobo_ui_handler_set_app (e_contact_editor->uih, GNOME_APP (e_contact_editor->app)); + + create_menu (e_contact_editor); + create_toolbar (e_contact_editor); + + /* Connect to the deletion of the dialog */ + + gtk_signal_connect (GTK_OBJECT (e_contact_editor->app), "delete_event", + GTK_SIGNAL_FUNC (app_delete_event_cb), e_contact_editor); } void @@ -567,14 +935,20 @@ e_contact_editor_destroy (GtkObject *object) { gtk_object_unref(GTK_OBJECT(e_contact_editor->gui)); } -GtkWidget* -e_contact_editor_new (ECard *card) +EContactEditor * +e_contact_editor_new (ECard *card, gboolean is_new_card) { - GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_get_type ())); - gtk_object_set (GTK_OBJECT(widget), + EContactEditor *ce; + + ce = E_CONTACT_EDITOR (gtk_type_new (E_CONTACT_EDITOR_TYPE)); + + gtk_object_set (GTK_OBJECT (ce), "card", card, + "is_new_card", is_new_card, NULL); - return widget; + + gtk_widget_show (ce->app); + return ce; } static void @@ -594,6 +968,10 @@ e_contact_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) NULL); fill_in_info(editor); break; + + case ARG_IS_NEW_CARD: + editor->is_new_card = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE; + break; } } @@ -610,6 +988,11 @@ e_contact_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) extract_info(e_contact_editor); GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_contact_editor->card); break; + + case ARG_IS_NEW_CARD: + GTK_VALUE_BOOL (*arg) = e_contact_editor->is_new_card ? TRUE : FALSE; + break; + default: arg->type = GTK_TYPE_INVALID; break; diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h index 288cec1db0..8eae2bf1b5 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.h +++ b/addressbook/gui/contact-editor/e-contact-editor.h @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -52,13 +53,17 @@ typedef struct _EContactEditorClass EContactEditorClass; struct _EContactEditor { - GtkVBox parent; + GtkObject object; /* item specific fields */ ECard *card; ECardSimple *simple; + + /* UI handler */ + BonoboUIHandler *uih; GladeXML *gui; + GtkWidget *app; GnomeUIInfo *email_info; GnomeUIInfo *phone_info; GnomeUIInfo *address_info; @@ -77,15 +82,24 @@ struct _EContactEditor ECardSimpleAddressId address_choice; GList *arbitrary_fields; + + /* Whether we are editing a new card or an existing one */ + guint is_new_card : 1; }; struct _EContactEditorClass { - GtkVBoxClass parent_class; + GtkObjectClass parent_class; + + /* Notification signals */ + + void (* add_card) (EContactEditor *ce, ECard *card); + void (* commit_card) (EContactEditor *ce, ECard *card); + void (* editor_closed) (EContactEditor *ce); }; -GtkWidget *e_contact_editor_new(ECard *card); +EContactEditor *e_contact_editor_new (ECard *card, gboolean is_new_card); GtkType e_contact_editor_get_type (void); #ifdef __cplusplus diff --git a/addressbook/gui/contact-editor/test-editor.c b/addressbook/gui/contact-editor/test-editor.c index 5b48c1a92f..80db2fe848 100644 --- a/addressbook/gui/contact-editor/test-editor.c +++ b/addressbook/gui/contact-editor/test-editor.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * test-editor.c * Copyright (C) 2000 Helix Code, Inc. * Author: Chris Lahey @@ -75,21 +75,23 @@ read_file (char *name) return g_strdup (buff); } -/* This is a horrible thing to do, but it is just a test. */ -GtkWidget *editor; - -static void destroy_callback(GtkWidget *app, gpointer data) +/* Callback used when a contact editor is closed */ +static void +editor_closed_cb (EContactEditor *ce, gpointer data) { static int count = 2; - count --; - if ( count <= 0 ) - exit(0); + + count--; + gtk_object_unref (GTK_OBJECT (ce)); + + if (count == 0) + exit (0); } #if 0 static void about_callback( GtkWidget *widget, gpointer data ) { - + const gchar *authors[] = { "Christopher James Lahey ", @@ -102,57 +104,39 @@ static void about_callback( GtkWidget *widget, gpointer data ) authors, _( "This should test the contact editor canvas item" ), NULL); - gtk_widget_show (about); + gtk_widget_show (about); } #endif int main( int argc, char *argv[] ) { char *cardstr; - GtkWidget *app; - + EContactEditor *ce; + /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); textdomain (PACKAGE);*/ - + gnome_init( "Contact Editor Test", VERSION, argc, argv); - + glade_gnome_init (); - - app = gnome_app_new("Contact Editor Test", NULL); - + cardstr = NULL; if (argc == 2) cardstr = read_file (argv [1]); - + if (cardstr == NULL) cardstr = TEST_VCARD; - - editor = e_contact_editor_new(e_card_new(cardstr)); - - gnome_app_set_contents( GNOME_APP( app ), editor ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - app = gnome_app_new("Contact Editor Test", NULL); - - editor = e_contact_editor_new(e_card_new(cardstr)); - - gnome_app_set_contents( GNOME_APP( app ), editor ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - gtk_main(); - + + ce = e_contact_editor_new (e_card_new (cardstr), TRUE); + gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", + GTK_SIGNAL_FUNC (editor_closed_cb), NULL); + + ce = e_contact_editor_new (e_card_new (cardstr), TRUE); + gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", + GTK_SIGNAL_FUNC (editor_closed_cb), NULL); + + gtk_main(); + /* Not reached. */ return 0; } diff --git a/addressbook/gui/minicard/e-minicard-view.c b/addressbook/gui/minicard/e-minicard-view.c index 545bcc061f..28f8243dff 100644 --- a/addressbook/gui/minicard/e-minicard-view.c +++ b/addressbook/gui/minicard/e-minicard-view.c @@ -274,6 +274,39 @@ card_added_cb (EBook* book, EBookStatus status, const char *id, g_print ("%s: %s(): a card was added\n", __FILE__, __FUNCTION__); } +static void +card_changed_cb (EBook* book, EBookStatus status, gpointer user_data) +{ + g_print ("%s: %s(): a card was changed with status %d\n", __FILE__, __FUNCTION__, status); +} + +/* Callback for the add_card signal from the contact editor */ +static void +add_card_cb (EContactEditor *ce, ECard *card, gpointer data) +{ + EBook *book; + + book = E_BOOK (data); + e_book_add_card (book, card, card_added_cb, NULL); +} + +/* Callback for the commit_card signal from the contact editor */ +static void +commit_card_cb (EContactEditor *ce, ECard *card, gpointer data) +{ + EBook *book; + + book = E_BOOK (data); + e_book_commit_card (book, card, card_changed_cb, NULL); +} + +/* Callback used when the contact editor is closed */ +static void +editor_closed_cb (EContactEditor *ce, gpointer data) +{ + gtk_object_unref (GTK_OBJECT (ce)); +} + static gboolean e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event) { @@ -285,49 +318,25 @@ e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event) case GDK_2BUTTON_PRESS: if (((GdkEventButton *)event)->button == 1) { - gint result; ECard *card; - GtkWidget* contact_editor; + EContactEditor *ce; EBook *book; - GtkWidget* dlg = gnome_dialog_new ("Contact Editor", "Save", "Cancel", NULL); - + card = e_card_new(""); - contact_editor = e_contact_editor_new(card); - gtk_object_sink(GTK_OBJECT(card)); - - gtk_window_set_policy(GTK_WINDOW(dlg), FALSE, TRUE, FALSE); - + gtk_object_get(GTK_OBJECT(view), "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_add_card ( - book, - card, - card_added_cb, - NULL); - } + + 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); + + gtk_object_sink(GTK_OBJECT(card)); } return TRUE; default: diff --git a/addressbook/gui/minicard/e-minicard.c b/addressbook/gui/minicard/e-minicard.c index 3aabdab5ef..4b7942a9f4 100644 --- a/addressbook/gui/minicard/e-minicard.c +++ b/addressbook/gui/minicard/e-minicard.c @@ -310,6 +310,12 @@ e_minicard_unrealize (GnomeCanvasItem *item) (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item); } +static void +card_added_cb (EBook* book, EBookStatus status, const char *id, gpointer user_data) +{ + g_print ("%s: %s(): a card was added\n", __FILE__, __FUNCTION__); +} + static void card_changed_cb (EBook* book, EBookStatus status, gpointer user_data) { @@ -323,6 +329,33 @@ save_as (GtkWidget *widget, EMinicard *minicard) e_contact_save_as(_("Save as VCard"), minicard->card); } +/* Callback for the add_card signal from the contact editor */ +static void +add_card_cb (EContactEditor *ce, ECard *card, gpointer data) +{ + EBook *book; + + book = E_BOOK (data); + e_book_add_card (book, card, card_added_cb, NULL); +} + +/* Callback for the commit_card signal from the contact editor */ +static void +commit_card_cb (EContactEditor *ce, ECard *card, gpointer data) +{ + EBook *book; + + book = E_BOOK (data); + e_book_commit_card (book, card, card_changed_cb, NULL); +} + +/* Callback used when the contact editor is closed */ +static void +editor_closed_cb (EContactEditor *ce, gpointer data) +{ + gtk_object_unref (GTK_OBJECT (ce)); +} + static gboolean e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) { @@ -381,48 +414,26 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) 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)) { - gint result; - GtkWidget* contact_editor = - e_contact_editor_new(e_minicard->card); + EContactEditor *ce; EBook *book; - GtkWidget *dlg; + gtk_object_get(GTK_OBJECT(item->parent), "book", &book, NULL); - - dlg = gnome_dialog_new ("Contact Editor", "Save", "Cancel", NULL); - - gtk_window_set_policy(GTK_WINDOW(dlg), FALSE, TRUE, FALSE); - 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_changed_cb, - 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), "editor_closed", + GTK_SIGNAL_FUNC (editor_closed_cb), NULL); + return TRUE; } break; diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c index 545bcc061f..28f8243dff 100644 --- a/addressbook/gui/widgets/e-minicard-view.c +++ b/addressbook/gui/widgets/e-minicard-view.c @@ -274,6 +274,39 @@ card_added_cb (EBook* book, EBookStatus status, const char *id, g_print ("%s: %s(): a card was added\n", __FILE__, __FUNCTION__); } +static void +card_changed_cb (EBook* book, EBookStatus status, gpointer user_data) +{ + g_print ("%s: %s(): a card was changed with status %d\n", __FILE__, __FUNCTION__, status); +} + +/* Callback for the add_card signal from the contact editor */ +static void +add_card_cb (EContactEditor *ce, ECard *card, gpointer data) +{ + EBook *book; + + book = E_BOOK (data); + e_book_add_card (book, card, card_added_cb, NULL); +} + +/* Callback for the commit_card signal from the contact editor */ +static void +commit_card_cb (EContactEditor *ce, ECard *card, gpointer data) +{ + EBook *book; + + book = E_BOOK (data); + e_book_commit_card (book, card, card_changed_cb, NULL); +} + +/* Callback used when the contact editor is closed */ +static void +editor_closed_cb (EContactEditor *ce, gpointer data) +{ + gtk_object_unref (GTK_OBJECT (ce)); +} + static gboolean e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event) { @@ -285,49 +318,25 @@ e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event) case GDK_2BUTTON_PRESS: if (((GdkEventButton *)event)->button == 1) { - gint result; ECard *card; - GtkWidget* contact_editor; + EContactEditor *ce; EBook *book; - GtkWidget* dlg = gnome_dialog_new ("Contact Editor", "Save", "Cancel", NULL); - + card = e_card_new(""); - contact_editor = e_contact_editor_new(card); - gtk_object_sink(GTK_OBJECT(card)); - - gtk_window_set_policy(GTK_WINDOW(dlg), FALSE, TRUE, FALSE); - + gtk_object_get(GTK_OBJECT(view), "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_add_card ( - book, - card, - card_added_cb, - NULL); - } + + 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); + + gtk_object_sink(GTK_OBJECT(card)); } return TRUE; default: diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index 3aabdab5ef..4b7942a9f4 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -310,6 +310,12 @@ e_minicard_unrealize (GnomeCanvasItem *item) (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item); } +static void +card_added_cb (EBook* book, EBookStatus status, const char *id, gpointer user_data) +{ + g_print ("%s: %s(): a card was added\n", __FILE__, __FUNCTION__); +} + static void card_changed_cb (EBook* book, EBookStatus status, gpointer user_data) { @@ -323,6 +329,33 @@ save_as (GtkWidget *widget, EMinicard *minicard) e_contact_save_as(_("Save as VCard"), minicard->card); } +/* Callback for the add_card signal from the contact editor */ +static void +add_card_cb (EContactEditor *ce, ECard *card, gpointer data) +{ + EBook *book; + + book = E_BOOK (data); + e_book_add_card (book, card, card_added_cb, NULL); +} + +/* Callback for the commit_card signal from the contact editor */ +static void +commit_card_cb (EContactEditor *ce, ECard *card, gpointer data) +{ + EBook *book; + + book = E_BOOK (data); + e_book_commit_card (book, card, card_changed_cb, NULL); +} + +/* Callback used when the contact editor is closed */ +static void +editor_closed_cb (EContactEditor *ce, gpointer data) +{ + gtk_object_unref (GTK_OBJECT (ce)); +} + static gboolean e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) { @@ -381,48 +414,26 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) 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)) { - gint result; - GtkWidget* contact_editor = - e_contact_editor_new(e_minicard->card); + EContactEditor *ce; EBook *book; - GtkWidget *dlg; + gtk_object_get(GTK_OBJECT(item->parent), "book", &book, NULL); - - dlg = gnome_dialog_new ("Contact Editor", "Save", "Cancel", NULL); - - gtk_window_set_policy(GTK_WINDOW(dlg), FALSE, TRUE, FALSE); - 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_changed_cb, - 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), "editor_closed", + GTK_SIGNAL_FUNC (editor_closed_cb), NULL); + return TRUE; } break; diff --git a/libical/src/test/Makefile.in b/libical/src/test/Makefile.in index eaec52b6cd..c97dbd0026 100644 --- a/libical/src/test/Makefile.in +++ b/libical/src/test/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am +# Makefile.in generated automatically by automake 1.4 from Makefile.am # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -46,10 +46,9 @@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = transform = @program_transform_name@ NORMAL_INSTALL = : @@ -71,7 +70,8 @@ YACC = @YACC@ noinst_PROGRAMS = usecases copycluster regression parser findobj storage stow LDADD = ../libical/libical.a ../libicalss/libicalss.a -INCLUDES = -I . -I../libical -I../libicalss +INCLUDES = -I . -I $(srcdir) -I../libical -I $(srcdir)/../libical -I../libicalss -I $(srcdir)/../libicalss + findobj_SOURCES = findobj.c usecases_SOURCES = usecases.c @@ -130,6 +130,8 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = gtar GZIP_ENV = --best +DEP_FILES = .deps/copycluster.P .deps/findobj.P .deps/icaltestparser.P \ +.deps/regression.P .deps/storage.P .deps/stow.P .deps/usecases.P SOURCES = $(usecases_SOURCES) $(copycluster_SOURCES) $(regression_SOURCES) $(parser_SOURCES) $(findobj_SOURCES) $(storage_SOURCES) $(stow_SOURCES) OBJECTS = $(usecases_OBJECTS) $(copycluster_OBJECTS) $(regression_OBJECTS) $(parser_OBJECTS) $(findobj_OBJECTS) $(storage_OBJECTS) $(stow_OBJECTS) @@ -137,9 +139,9 @@ all: all-redirect .SUFFIXES: .SUFFIXES: .S .c .o .s $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/test/Makefile + cd $(top_srcdir) && $(AUTOMAKE) --gnu src/test/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status @@ -153,9 +155,6 @@ distclean-noinstPROGRAMS: maintainer-clean-noinstPROGRAMS: -.c.o: - $(COMPILE) -c $< - .s.o: $(COMPILE) -c $< @@ -234,6 +233,11 @@ distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) subdir = src/test distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/test/Makefile @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ @@ -244,6 +248,38 @@ distdir: $(DISTFILES) || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + -rm -rf .deps + +maintainer-clean-depend: + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp info-am: info: info-am dvi-am: @@ -266,7 +302,7 @@ uninstall: uninstall-am all-am: Makefile $(PROGRAMS) all-redirect: all-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: @@ -280,23 +316,24 @@ distclean-generic: maintainer-clean-generic: mostlyclean-am: mostlyclean-noinstPROGRAMS mostlyclean-compile \ - mostlyclean-tags mostlyclean-generic + mostlyclean-tags mostlyclean-depend mostlyclean-generic mostlyclean: mostlyclean-am -clean-am: clean-noinstPROGRAMS clean-compile clean-tags clean-generic \ - mostlyclean-am +clean-am: clean-noinstPROGRAMS clean-compile clean-tags clean-depend \ + clean-generic mostlyclean-am clean: clean-am distclean-am: distclean-noinstPROGRAMS distclean-compile distclean-tags \ - distclean-generic clean-am + distclean-depend distclean-generic clean-am distclean: distclean-am maintainer-clean-am: maintainer-clean-noinstPROGRAMS \ maintainer-clean-compile maintainer-clean-tags \ - maintainer-clean-generic distclean-am + maintainer-clean-depend maintainer-clean-generic \ + distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." @@ -306,12 +343,13 @@ maintainer-clean: maintainer-clean-am clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \ mostlyclean-compile distclean-compile clean-compile \ maintainer-clean-compile tags mostlyclean-tags distclean-tags \ -clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ -check-am installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +clean-tags maintainer-clean-tags distdir mostlyclean-depend \ +distclean-depend clean-depend maintainer-clean-depend info-am info \ +dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +install-exec install-data-am install-data install-am install \ +uninstall-am uninstall all-redirect all-am all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean # Tell versions [3.59,3.63) of GNU make to not export all variables. -- cgit