diff options
-rw-r--r-- | addressbook/ChangeLog | 19 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-card.c | 42 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-card.h | 3 | ||||
-rw-r--r-- | addressbook/contact-editor/Makefile.am | 1 | ||||
-rw-r--r-- | addressbook/contact-editor/contact-editor.glade | 1 | ||||
-rw-r--r-- | addressbook/contact-editor/e-contact-editor.c | 315 | ||||
-rw-r--r-- | addressbook/contact-editor/e-contact-editor.h | 2 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/Makefile.am | 1 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/contact-editor.glade | 1 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.c | 315 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.h | 2 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-view.c | 4 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-minicard.c | 2 |
13 files changed, 206 insertions, 502 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 0c9be6aa90..626b514b90 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,24 @@ 2000-09-20 Christopher James Lahey <clahey@helixcode.com> + * backend/ebook/e-card.c, backend/ebook/e-card.h: Added a + wants_html field to cards. Uses "x-mozilla-html". + + * contact-editor/Makefile.am: Added definition of + EVOLUTION_DATADIR. + + * contact-editor/contact-editor.glade: Make Wants HTML check + button visible. + + * contact-editor/e-contact-editor.c, + contact-editor/e-contact-editor.h: Make Wants HTML check button + active. Fix UI stuff to use XML. Set parent window of + confirm_delete dialog. + + * gui/widgets/e-addressbook-view.c, gui/widgets/e-minicard.c: Set + the parent window of the confirm_delete dialog. + +2000-09-20 Christopher James Lahey <clahey@helixcode.com> + * gui/widgets/e-addressbook-view.c: Fixed display of the minicards when the addressbook was first loading. (It was overwriting a string with NULL during init.) diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c index c2ab80a734..e18dc681ec 100644 --- a/addressbook/backend/ebook/e-card.c +++ b/addressbook/backend/ebook/e-card.c @@ -28,6 +28,7 @@ #define XEV_PILOT_ID "X-EVOLUTION-PILOTID" #define XEV_PILOT_STATUS "X-EVOLUTION-PILOTSTATUS" +#define XEV_WANTS_HTML "X-MOZILLA-HTML" #define XEV_ARBITRARY "X-EVOLUTION-ARBITRARY" /* Object argument IDs */ @@ -57,6 +58,8 @@ enum { ARG_NOTE, ARG_CATEGORIES, ARG_CATEGORY_LIST, + ARG_WANTS_HTML, + ARG_WANTS_HTML_SET, ARG_PILOTID, ARG_PILOTSTATUS, ARG_ARBITRARY, @@ -101,6 +104,7 @@ static void parse_mailer(ECard *card, VObject *object); static void parse_fburl(ECard *card, VObject *object); static void parse_note(ECard *card, VObject *object); static void parse_categories(ECard *card, VObject *object); +static void parse_wants_html(ECard *card, VObject *object); static void parse_pilot_id(ECard *card, VObject *object); static void parse_pilot_status(ECard *card, VObject *object); static void parse_arbitrary(ECard *card, VObject *object); @@ -140,6 +144,7 @@ struct { { "FBURL", parse_fburl }, { VCNoteProp, parse_note }, { "CATEGORIES", parse_categories }, + { XEV_WANTS_HTML, parse_wants_html }, { XEV_PILOT_ID, parse_pilot_id }, { XEV_PILOT_STATUS, parse_pilot_status }, { XEV_ARBITRARY, parse_arbitrary }, @@ -435,6 +440,10 @@ char g_free(string); } + if (card->wants_html_set) { + addPropValue (vobj, XEV_WANTS_HTML, card->wants_html ? "TRUE" : "FALSE"); + } + if (card->pilot_id) { gchar *pilotid_str; pilotid_str = g_strdup_printf ("%d", card->pilot_id); @@ -840,6 +849,23 @@ parse_categories(ECard *card, VObject *vobj) } static void +parse_wants_html(ECard *card, VObject *vobj) +{ + if ( vObjectValueType (vobj) ) { + char *str = fakeCString (vObjectUStringZValue (vobj)); + if (!strcasecmp(str, "true")) { + card->wants_html = TRUE; + card->wants_html_set = TRUE; + } + if (!strcasecmp(str, "false")) { + card->wants_html = FALSE; + card->wants_html_set = TRUE; + } + free(str); + } +} + +static void parse_pilot_id(ECard *card, VObject *vobj) { if ( vObjectValueType (vobj) ) { @@ -1012,6 +1038,10 @@ e_card_class_init (ECardClass *klass) GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_CATEGORIES); gtk_object_add_arg_type ("ECard::category_list", GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CATEGORY_LIST); + gtk_object_add_arg_type ("ECard::wants_html", + GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_WANTS_HTML); + gtk_object_add_arg_type ("ECard::wants_html_set", + GTK_TYPE_BOOL, GTK_ARG_READABLE, ARG_WANTS_HTML); gtk_object_add_arg_type ("ECard::pilot_id", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_PILOTID); gtk_object_add_arg_type ("ECard::pilot_status", @@ -1474,6 +1504,10 @@ e_card_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) g_free (card->note); card->note = g_strdup(GTK_VALUE_STRING(*arg)); break; + case ARG_WANTS_HTML: + card->wants_html = GTK_VALUE_BOOL(*arg); + card->wants_html_set = TRUE; + break; case ARG_PILOTID: card->pilot_id = GTK_VALUE_INT(*arg); break; @@ -1614,6 +1648,12 @@ e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) case ARG_NOTE: GTK_VALUE_STRING(*arg) = card->note; break; + case ARG_WANTS_HTML: + GTK_VALUE_BOOL(*arg) = card->wants_html; + break; + case ARG_WANTS_HTML_SET: + GTK_VALUE_BOOL(*arg) = card->wants_html_set; + break; case ARG_PILOTID: GTK_VALUE_INT(*arg) = card->pilot_id; break; @@ -1669,6 +1709,8 @@ e_card_init (ECard *card) card->fburl = NULL; card->note = NULL; card->categories = NULL; + card->wants_html = FALSE; + card->wants_html_set = FALSE; card->pilot_id = 0; card->pilot_status = 0; card->arbitrary = NULL; diff --git a/addressbook/backend/ebook/e-card.h b/addressbook/backend/ebook/e-card.h index 4a6935419d..42c77a0911 100644 --- a/addressbook/backend/ebook/e-card.h +++ b/addressbook/backend/ebook/e-card.h @@ -71,6 +71,9 @@ struct _ECard { EList *arbitrary; /* Arbitrary fields. */ + guint32 wants_html : 1; /* Wants html mail. */ + guint32 wants_html_set : 1; /* Wants html mail. */ + guint32 pilot_id; /* id of the corresponding pilot */ guint32 pilot_status; /* status information */ #if 0 diff --git a/addressbook/contact-editor/Makefile.am b/addressbook/contact-editor/Makefile.am index 64fc447da4..d44ba6a60a 100644 --- a/addressbook/contact-editor/Makefile.am +++ b/addressbook/contact-editor/Makefile.am @@ -1,6 +1,7 @@ CPPFLAGS = \ -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ -DDATADIR=\""$(datadir)"\" \ + -DEVOLUTION_DATADIR=\""$(datadir)"\" \ -DEVOLUTIONDIR=\""$(evolutiondir)"\" INCLUDES = \ diff --git a/addressbook/contact-editor/contact-editor.glade b/addressbook/contact-editor/contact-editor.glade index 4e2ff11d69..6db6d21c6f 100644 --- a/addressbook/contact-editor/contact-editor.glade +++ b/addressbook/contact-editor/contact-editor.glade @@ -961,7 +961,6 @@ <widget> <class>GtkCheckButton</class> <name>checkbutton-htmlmail</name> - <visible>False</visible> <label>Wants to receive _HTML mail</label> <active>False</active> <draw_indicator>True</draw_indicator> diff --git a/addressbook/contact-editor/e-contact-editor.c b/addressbook/contact-editor/e-contact-editor.c index 6dd00aa273..0207196459 100644 --- a/addressbook/contact-editor/e-contact-editor.c +++ b/addressbook/contact-editor/e-contact-editor.c @@ -189,6 +189,18 @@ _replace_buttons(EContactEditor *editor) } static void +wants_html_changed (GtkWidget *widget, EContactEditor *editor) +{ + gboolean wants_html; + gtk_object_get(GTK_OBJECT(widget), + "active", &wants_html, + NULL); + gtk_object_set(GTK_OBJECT(editor->card), + "wants_html", wants_html, + NULL); +} + +static void phone_entry_changed (GtkWidget *widget, EContactEditor *editor) { int which; @@ -648,7 +660,7 @@ file_save_as_cb (GtkWidget *widget, gpointer data) } gboolean -e_contact_editor_confirm_delete(void) +e_contact_editor_confirm_delete(GtkWindow *parent) { GnomeDialog *dialog; GladeXML *gui; @@ -657,6 +669,8 @@ e_contact_editor_confirm_delete(void) gui = glade_xml_new (EVOLUTION_GLADEDIR "/e-contact-editor-confirm-delete.glade", NULL); dialog = GNOME_DIALOG(glade_xml_get_widget(gui, "confirm-dialog")); + + gnome_dialog_set_parent(dialog, parent); result = gnome_dialog_run_and_close(dialog); @@ -668,11 +682,9 @@ e_contact_editor_confirm_delete(void) static void delete_cb (GtkWidget *widget, gpointer data) { - EContactEditor *ce; - - if (e_contact_editor_confirm_delete()) { + EContactEditor *ce = E_CONTACT_EDITOR (data); - ce = E_CONTACT_EDITOR (data); + if (e_contact_editor_confirm_delete(GTK_WINDOW(ce->app))) { extract_info (ce); e_card_simple_sync_card (ce->simple); @@ -687,7 +699,7 @@ delete_cb (GtkWidget *widget, gpointer data) /* Emits the signal to request printing a card */ static void -print_cb (GtkWidget *widget, gpointer data) +print_cb (BonoboUIHandler *uih, void *data, const char *path) { EContactEditor *ce; @@ -699,195 +711,9 @@ print_cb (GtkWidget *widget, gpointer data) gtk_widget_show(e_contact_print_card_dialog_new(ce->card)); } - -/* 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 (file_save_as_cb, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Save Attac_hments..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("_Delete"), NULL, delete_cb), - 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 (print_cb, 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) +tb_save_and_close_cb (BonoboUIHandler *uih, void *data, const char *path) { EContactEditor *ce; @@ -896,67 +722,43 @@ tb_save_and_close_cb (GtkWidget *widget, gpointer data) close_dialog (ce); } -/* Toolbar */ - -static GnomeUIInfo toolbar[] = { - GNOMEUIINFO_ITEM_STOCK (N_("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_STOCK (N_("Print..."), - N_("Print this item"), print_cb, - GNOME_STOCK_PIXMAP_PRINT), -#if 0 - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Insert File..."), - N_("Insert a file as an attachment"), NULL), -#endif - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_STOCK (N_("Delete"), - N_("Delete this item"), delete_cb, - GNOME_STOCK_PIXMAP_TRASH), - GNOMEUIINFO_SEPARATOR, -#if 0 - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Previous"), - N_("Go to the previous item"), NULL, - GNOME_STOCK_PIXMAP_BACK), - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Next"), - N_("Go to the next item"), NULL, - GNOME_STOCK_PIXMAP_FORWARD), -#endif - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Help"), - N_("See online help"), NULL, GNOME_STOCK_PIXMAP_HELP), - GNOMEUIINFO_END +static +BonoboUIVerb verbs [] = { + BONOBO_UI_VERB ("ContactEditorSave", file_save_cb), + BONOBO_UI_VERB ("ContactEditorSaveAs", file_save_as_cb), + BONOBO_UI_VERB ("ContactEditorSaveClose", tb_save_and_close_cb), + BONOBO_UI_VERB ("ContactEditorDelete", delete_cb), + BONOBO_UI_VERB ("ContactEditorPrint", print_cb), + /* BONOBO_UI_VERB ("ContactEditorPageSetup", file_page_setup_menu), */ + BONOBO_UI_VERB ("ContactEditorClose", file_close_cb), + + BONOBO_UI_VERB_END }; -/* Creates the toolbar for the contact editor */ static void -create_toolbar (EContactEditor *ce) +create_ui (EContactEditor *ce) { - BonoboUIHandlerToolbarItem *list; - GnomeDockItem *dock_item; - GtkWidget *toolbar_child; - - bonobo_ui_handler_create_toolbar (ce->uih, "Toolbar"); - -#warning When the UI is converted to xml this is possible with a single tag -#if 0 - /* 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); + char *fname; + xmlNode *ui; + BonoboUIComponent *component; + Bonobo_UIContainer *container; - toolbar_child = gnome_dock_item_get_child (dock_item); - g_assert (toolbar_child != NULL && GTK_IS_TOOLBAR (toolbar_child)); + component = bonobo_ui_compat_get_component (ce->uih); + container = bonobo_ui_compat_get_container (ce->uih); + + bonobo_ui_component_add_verb_list_with_data ( + component, verbs, ce); + + fname = bonobo_ui_util_get_ui_fname ( + EVOLUTION_DATADIR, "evolution-contact-editor.xml"); + g_warning ("Attempting ui load from '%s'", fname); - /* Turn off labels as GtkToolbar sucks */ - gtk_toolbar_set_style (GTK_TOOLBAR (toolbar_child), GTK_TOOLBAR_ICONS); -#endif + ui = bonobo_ui_util_new_ui (component, fname, "evolution-contact-editor"); - list = bonobo_ui_handler_toolbar_parse_uiinfo_list_with_data (toolbar, ce); - bonobo_ui_handler_toolbar_add_list (ce->uih, "/Toolbar", list); + bonobo_ui_component_set_tree (component, container, "/", ui, NULL); -#warning In theory the list should be freed too, but just convert to an xml file. + g_free (fname); + xmlFreeNode (ui); } /* Callback used when the dialog box is destroyed */ @@ -1016,6 +818,7 @@ e_contact_editor_init (EContactEditor *e_contact_editor) GladeXML *gui; GtkWidget *widget; GtkWidget *bonobo_win; + GtkWidget *wants_html; e_contact_editor->email_info = NULL; e_contact_editor->phone_info = NULL; @@ -1055,6 +858,11 @@ e_contact_editor_init (EContactEditor *e_contact_editor) _replace_buttons(e_contact_editor); set_entry_changed_signals(e_contact_editor); + + wants_html = glade_xml_get_widget(e_contact_editor->gui, "checkbutton-htmlmail"); + if (wants_html && GTK_IS_TOGGLE_BUTTON(wants_html)) + gtk_signal_connect(GTK_OBJECT(wants_html), "toggled", + wants_html_changed, e_contact_editor); widget = glade_xml_get_widget(e_contact_editor->gui, "button-fullname"); if (widget && GTK_IS_BUTTON(widget)) @@ -1102,8 +910,7 @@ e_contact_editor_init (EContactEditor *e_contact_editor) bonobo_ui_handler_set_app (e_contact_editor->uih, BONOBO_WIN (e_contact_editor->app)); - create_menu (e_contact_editor); - create_toolbar (e_contact_editor); + create_ui (e_contact_editor); /* Connect to the deletion of the dialog */ @@ -1754,12 +1561,15 @@ fill_in_info(EContactEditor *editor) int i; GtkWidget *widget; GList *list; + gboolean wants_html, wants_html_set; gtk_object_get(GTK_OBJECT(card), "file_as", &file_as, "name", &name, "anniversary", &anniversary, "birth_date", &bday, + "wants_html_set",&wants_html_set, + "wants_html", &wants_html, NULL); for (i = 0; i < sizeof(field_mapping) / sizeof(field_mapping[0]); i++) { @@ -1770,6 +1580,15 @@ fill_in_info(EContactEditor *editor) fill_in_single_field(editor, list->data); } + if (wants_html_set) { + GtkWidget *widget = glade_xml_get_widget(editor->gui, "checkbutton-htmlmail"); + if (widget && GTK_IS_CHECK_BUTTON(widget)) { + gtk_object_set(GTK_OBJECT(widget), + "active", wants_html, + NULL); + } + } + /* File as has to come after company and name or else it'll get messed up when setting them. */ fill_in_field(editor, "entry-file-as", file_as); diff --git a/addressbook/contact-editor/e-contact-editor.h b/addressbook/contact-editor/e-contact-editor.h index 4e47b5bd93..83ac71fd78 100644 --- a/addressbook/contact-editor/e-contact-editor.h +++ b/addressbook/contact-editor/e-contact-editor.h @@ -104,7 +104,7 @@ EContactEditor *e_contact_editor_new (ECard *card, gboolean is_new_card); GtkType e_contact_editor_get_type (void); -gboolean e_contact_editor_confirm_delete(void); +gboolean e_contact_editor_confirm_delete(GtkWindow *parent); #ifdef __cplusplus } diff --git a/addressbook/gui/contact-editor/Makefile.am b/addressbook/gui/contact-editor/Makefile.am index 64fc447da4..d44ba6a60a 100644 --- a/addressbook/gui/contact-editor/Makefile.am +++ b/addressbook/gui/contact-editor/Makefile.am @@ -1,6 +1,7 @@ CPPFLAGS = \ -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ -DDATADIR=\""$(datadir)"\" \ + -DEVOLUTION_DATADIR=\""$(datadir)"\" \ -DEVOLUTIONDIR=\""$(evolutiondir)"\" INCLUDES = \ diff --git a/addressbook/gui/contact-editor/contact-editor.glade b/addressbook/gui/contact-editor/contact-editor.glade index 4e2ff11d69..6db6d21c6f 100644 --- a/addressbook/gui/contact-editor/contact-editor.glade +++ b/addressbook/gui/contact-editor/contact-editor.glade @@ -961,7 +961,6 @@ <widget> <class>GtkCheckButton</class> <name>checkbutton-htmlmail</name> - <visible>False</visible> <label>Wants to receive _HTML mail</label> <active>False</active> <draw_indicator>True</draw_indicator> diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index 6dd00aa273..0207196459 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -189,6 +189,18 @@ _replace_buttons(EContactEditor *editor) } static void +wants_html_changed (GtkWidget *widget, EContactEditor *editor) +{ + gboolean wants_html; + gtk_object_get(GTK_OBJECT(widget), + "active", &wants_html, + NULL); + gtk_object_set(GTK_OBJECT(editor->card), + "wants_html", wants_html, + NULL); +} + +static void phone_entry_changed (GtkWidget *widget, EContactEditor *editor) { int which; @@ -648,7 +660,7 @@ file_save_as_cb (GtkWidget *widget, gpointer data) } gboolean -e_contact_editor_confirm_delete(void) +e_contact_editor_confirm_delete(GtkWindow *parent) { GnomeDialog *dialog; GladeXML *gui; @@ -657,6 +669,8 @@ e_contact_editor_confirm_delete(void) gui = glade_xml_new (EVOLUTION_GLADEDIR "/e-contact-editor-confirm-delete.glade", NULL); dialog = GNOME_DIALOG(glade_xml_get_widget(gui, "confirm-dialog")); + + gnome_dialog_set_parent(dialog, parent); result = gnome_dialog_run_and_close(dialog); @@ -668,11 +682,9 @@ e_contact_editor_confirm_delete(void) static void delete_cb (GtkWidget *widget, gpointer data) { - EContactEditor *ce; - - if (e_contact_editor_confirm_delete()) { + EContactEditor *ce = E_CONTACT_EDITOR (data); - ce = E_CONTACT_EDITOR (data); + if (e_contact_editor_confirm_delete(GTK_WINDOW(ce->app))) { extract_info (ce); e_card_simple_sync_card (ce->simple); @@ -687,7 +699,7 @@ delete_cb (GtkWidget *widget, gpointer data) /* Emits the signal to request printing a card */ static void -print_cb (GtkWidget *widget, gpointer data) +print_cb (BonoboUIHandler *uih, void *data, const char *path) { EContactEditor *ce; @@ -699,195 +711,9 @@ print_cb (GtkWidget *widget, gpointer data) gtk_widget_show(e_contact_print_card_dialog_new(ce->card)); } - -/* 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 (file_save_as_cb, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Save Attac_hments..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("_Delete"), NULL, delete_cb), - 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 (print_cb, 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) +tb_save_and_close_cb (BonoboUIHandler *uih, void *data, const char *path) { EContactEditor *ce; @@ -896,67 +722,43 @@ tb_save_and_close_cb (GtkWidget *widget, gpointer data) close_dialog (ce); } -/* Toolbar */ - -static GnomeUIInfo toolbar[] = { - GNOMEUIINFO_ITEM_STOCK (N_("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_STOCK (N_("Print..."), - N_("Print this item"), print_cb, - GNOME_STOCK_PIXMAP_PRINT), -#if 0 - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Insert File..."), - N_("Insert a file as an attachment"), NULL), -#endif - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_STOCK (N_("Delete"), - N_("Delete this item"), delete_cb, - GNOME_STOCK_PIXMAP_TRASH), - GNOMEUIINFO_SEPARATOR, -#if 0 - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Previous"), - N_("Go to the previous item"), NULL, - GNOME_STOCK_PIXMAP_BACK), - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Next"), - N_("Go to the next item"), NULL, - GNOME_STOCK_PIXMAP_FORWARD), -#endif - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Help"), - N_("See online help"), NULL, GNOME_STOCK_PIXMAP_HELP), - GNOMEUIINFO_END +static +BonoboUIVerb verbs [] = { + BONOBO_UI_VERB ("ContactEditorSave", file_save_cb), + BONOBO_UI_VERB ("ContactEditorSaveAs", file_save_as_cb), + BONOBO_UI_VERB ("ContactEditorSaveClose", tb_save_and_close_cb), + BONOBO_UI_VERB ("ContactEditorDelete", delete_cb), + BONOBO_UI_VERB ("ContactEditorPrint", print_cb), + /* BONOBO_UI_VERB ("ContactEditorPageSetup", file_page_setup_menu), */ + BONOBO_UI_VERB ("ContactEditorClose", file_close_cb), + + BONOBO_UI_VERB_END }; -/* Creates the toolbar for the contact editor */ static void -create_toolbar (EContactEditor *ce) +create_ui (EContactEditor *ce) { - BonoboUIHandlerToolbarItem *list; - GnomeDockItem *dock_item; - GtkWidget *toolbar_child; - - bonobo_ui_handler_create_toolbar (ce->uih, "Toolbar"); - -#warning When the UI is converted to xml this is possible with a single tag -#if 0 - /* 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); + char *fname; + xmlNode *ui; + BonoboUIComponent *component; + Bonobo_UIContainer *container; - toolbar_child = gnome_dock_item_get_child (dock_item); - g_assert (toolbar_child != NULL && GTK_IS_TOOLBAR (toolbar_child)); + component = bonobo_ui_compat_get_component (ce->uih); + container = bonobo_ui_compat_get_container (ce->uih); + + bonobo_ui_component_add_verb_list_with_data ( + component, verbs, ce); + + fname = bonobo_ui_util_get_ui_fname ( + EVOLUTION_DATADIR, "evolution-contact-editor.xml"); + g_warning ("Attempting ui load from '%s'", fname); - /* Turn off labels as GtkToolbar sucks */ - gtk_toolbar_set_style (GTK_TOOLBAR (toolbar_child), GTK_TOOLBAR_ICONS); -#endif + ui = bonobo_ui_util_new_ui (component, fname, "evolution-contact-editor"); - list = bonobo_ui_handler_toolbar_parse_uiinfo_list_with_data (toolbar, ce); - bonobo_ui_handler_toolbar_add_list (ce->uih, "/Toolbar", list); + bonobo_ui_component_set_tree (component, container, "/", ui, NULL); -#warning In theory the list should be freed too, but just convert to an xml file. + g_free (fname); + xmlFreeNode (ui); } /* Callback used when the dialog box is destroyed */ @@ -1016,6 +818,7 @@ e_contact_editor_init (EContactEditor *e_contact_editor) GladeXML *gui; GtkWidget *widget; GtkWidget *bonobo_win; + GtkWidget *wants_html; e_contact_editor->email_info = NULL; e_contact_editor->phone_info = NULL; @@ -1055,6 +858,11 @@ e_contact_editor_init (EContactEditor *e_contact_editor) _replace_buttons(e_contact_editor); set_entry_changed_signals(e_contact_editor); + + wants_html = glade_xml_get_widget(e_contact_editor->gui, "checkbutton-htmlmail"); + if (wants_html && GTK_IS_TOGGLE_BUTTON(wants_html)) + gtk_signal_connect(GTK_OBJECT(wants_html), "toggled", + wants_html_changed, e_contact_editor); widget = glade_xml_get_widget(e_contact_editor->gui, "button-fullname"); if (widget && GTK_IS_BUTTON(widget)) @@ -1102,8 +910,7 @@ e_contact_editor_init (EContactEditor *e_contact_editor) bonobo_ui_handler_set_app (e_contact_editor->uih, BONOBO_WIN (e_contact_editor->app)); - create_menu (e_contact_editor); - create_toolbar (e_contact_editor); + create_ui (e_contact_editor); /* Connect to the deletion of the dialog */ @@ -1754,12 +1561,15 @@ fill_in_info(EContactEditor *editor) int i; GtkWidget *widget; GList *list; + gboolean wants_html, wants_html_set; gtk_object_get(GTK_OBJECT(card), "file_as", &file_as, "name", &name, "anniversary", &anniversary, "birth_date", &bday, + "wants_html_set",&wants_html_set, + "wants_html", &wants_html, NULL); for (i = 0; i < sizeof(field_mapping) / sizeof(field_mapping[0]); i++) { @@ -1770,6 +1580,15 @@ fill_in_info(EContactEditor *editor) fill_in_single_field(editor, list->data); } + if (wants_html_set) { + GtkWidget *widget = glade_xml_get_widget(editor->gui, "checkbutton-htmlmail"); + if (widget && GTK_IS_CHECK_BUTTON(widget)) { + gtk_object_set(GTK_OBJECT(widget), + "active", wants_html, + NULL); + } + } + /* File as has to come after company and name or else it'll get messed up when setting them. */ fill_in_field(editor, "entry-file-as", file_as); diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h index 4e47b5bd93..83ac71fd78 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.h +++ b/addressbook/gui/contact-editor/e-contact-editor.h @@ -104,7 +104,7 @@ EContactEditor *e_contact_editor_new (ECard *card, gboolean is_new_card); GtkType e_contact_editor_get_type (void); -gboolean e_contact_editor_confirm_delete(void); +gboolean e_contact_editor_confirm_delete(GtkWindow *parent); #ifdef __cplusplus } diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index 9bcd4b2827..1700cfdc89 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -401,6 +401,7 @@ table_double_click(ETableScrolled *table, gint row, EAddressbookView *view) typedef struct { EBook *book; ECard *card; + GtkWidget *widget; } CardAndBook; static void @@ -427,7 +428,7 @@ print (GtkWidget *widget, CardAndBook *card_and_book) static void delete (GtkWidget *widget, CardAndBook *card_and_book) { - if (e_contact_editor_confirm_delete()) { + if (e_contact_editor_confirm_delete(GTK_WINDOW(gtk_widget_get_toplevel(card_and_book->widget)))) { /* Add the card in the contact editor to our ebook */ e_book_remove_card (card_and_book->book, card_and_book->card, @@ -453,6 +454,7 @@ table_right_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EA card_and_book = g_new(CardAndBook, 1); card_and_book->card = e_addressbook_model_get_card(model, row); + card_and_book->widget = GTK_WIDGET(table); gtk_object_get(GTK_OBJECT(model), "book", &(card_and_book->book), NULL); diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index 792962a5b3..dcf3ff924a 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -339,7 +339,7 @@ delete (GtkWidget *widget, EMinicard *minicard) { EBook *book; - if (e_contact_editor_confirm_delete()) { + if (e_contact_editor_confirm_delete(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(GNOME_CANVAS_ITEM(minicard)->canvas))))) { e_card_simple_sync_card(minicard->simple); gtk_object_get(GTK_OBJECT(GNOME_CANVAS_ITEM(minicard)->parent), |