diff options
author | Michael Meeks <michael@helixcode.com> | 2000-10-19 10:56:53 +0800 |
---|---|---|
committer | Michael Meeks <mmeeks@src.gnome.org> | 2000-10-19 10:56:53 +0800 |
commit | 78bdc918f67fb9597f3c1c22c166a9f3087497be (patch) | |
tree | f814d14f132cc7ba5d30be7152c60dbf7df55b3b /composer | |
parent | eef1bb9ef244e68edffd14980de2fd518a69b09c (diff) | |
download | gsoc2013-evolution-78bdc918f67fb9597f3c1c22c166a9f3087497be.tar gsoc2013-evolution-78bdc918f67fb9597f3c1c22c166a9f3087497be.tar.gz gsoc2013-evolution-78bdc918f67fb9597f3c1c22c166a9f3087497be.tar.bz2 gsoc2013-evolution-78bdc918f67fb9597f3c1c22c166a9f3087497be.tar.lz gsoc2013-evolution-78bdc918f67fb9597f3c1c22c166a9f3087497be.tar.xz gsoc2013-evolution-78bdc918f67fb9597f3c1c22c166a9f3087497be.tar.zst gsoc2013-evolution-78bdc918f67fb9597f3c1c22c166a9f3087497be.zip |
kill. (create_toolbar): die. (setup_ui): impl. (e_msg_composer_construct):
2000-10-19 Michael Meeks <michael@helixcode.com>
* e-msg-composer.c (create_menubar_file, create_menubar_edit),
(create_menubar_format, create_menubar_view, create_menubar): kill.
(create_toolbar): die.
(setup_ui): impl.
(e_msg_composer_construct): hook in.
(menu_format_html_cb): update.
(menu_view_attachments_activate_cb): ditto.
(destroy): upd.
(e_msg_composer_construct): upd.
(e_msg_composer_set_send_html): upd.
svn path=/trunk/; revision=6018
Diffstat (limited to 'composer')
-rw-r--r-- | composer/ChangeLog | 13 | ||||
-rw-r--r-- | composer/Makefile.am | 1 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 283 | ||||
-rw-r--r-- | composer/e-msg-composer.h | 2 |
4 files changed, 96 insertions, 203 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog index b8ea2b41ef..3f38d969c1 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,16 @@ +2000-10-19 Michael Meeks <michael@helixcode.com> + + * e-msg-composer.c (create_menubar_file, create_menubar_edit), + (create_menubar_format, create_menubar_view, create_menubar): kill. + (create_toolbar): die. + (setup_ui): impl. + (e_msg_composer_construct): hook in. + (menu_format_html_cb): update. + (menu_view_attachments_activate_cb): ditto. + (destroy): upd. + (e_msg_composer_construct): upd. + (e_msg_composer_set_send_html): upd. + 2000-10-16 Iain Holmes <iain@helixcode.com> * e-msg-composer-hdrs.c (init): Don't need the ID anymore. diff --git a/composer/Makefile.am b/composer/Makefile.am index ea7407b326..5d1b396bfc 100644 --- a/composer/Makefile.am +++ b/composer/Makefile.am @@ -44,6 +44,7 @@ INCLUDES = \ $(BONOBO_GNOME_CFLAGS) \ $(GTKHTML_CFLAGS) \ $(UNICODE_CFLAGS) \ + -DEVOLUTION_DATADIR=\"$(datadir)\" \ -DE_GLADEDIR=\"$(gladedir)\" \ -DG_LOG_DOMAIN=\"composer\" diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index e05dc71103..f614c6512d 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -564,7 +564,7 @@ do_exit (EMsgComposer *composer) /* Menu callbacks. */ static void -menu_file_open_cb (BonoboUIHandler *uih, +menu_file_open_cb (BonoboUIComponent *uic, void *data, const char *path) { @@ -583,7 +583,7 @@ menu_file_open_cb (BonoboUIHandler *uih, } static void -menu_file_save_cb (BonoboUIHandler *uih, +menu_file_save_cb (BonoboUIComponent *uic, void *data, const char *path) { @@ -608,7 +608,7 @@ menu_file_save_cb (BonoboUIHandler *uih, } static void -menu_file_save_as_cb (BonoboUIHandler *uih, +menu_file_save_as_cb (BonoboUIComponent *uic, void *data, const char *path) { @@ -620,7 +620,7 @@ menu_file_save_as_cb (BonoboUIHandler *uih, } static void -menu_file_send_cb (BonoboUIHandler *uih, +menu_file_send_cb (BonoboUIComponent *uic, void *data, const char *path) { @@ -628,7 +628,7 @@ menu_file_send_cb (BonoboUIHandler *uih, } static void -menu_file_send_later_cb (BonoboUIHandler *uih, +menu_file_send_later_cb (BonoboUIComponent *uic, void *data, const char *path) { @@ -636,7 +636,7 @@ menu_file_send_later_cb (BonoboUIHandler *uih, } static void -menu_file_close_cb (BonoboUIHandler *uih, +menu_file_close_cb (BonoboUIComponent *uic, void *data, const char *path) { @@ -647,7 +647,7 @@ menu_file_close_cb (BonoboUIHandler *uih, } static void -menu_file_add_attachment_cb (BonoboUIHandler *uih, +menu_file_add_attachment_cb (BonoboUIComponent *uic, void *data, const char *path) { @@ -661,14 +661,21 @@ menu_file_add_attachment_cb (BonoboUIHandler *uih, } static void -menu_view_attachments_activate_cb (BonoboUIHandler *uih, - void *data, - const char *path) +menu_view_attachments_activate_cb (BonoboUIComponent *component, + const char *path, + Bonobo_UIComponent_EventType type, + const char *state, + gpointer user_data) + { - gboolean state; + gboolean new_state; + + if (type != Bonobo_UIComponent_STATE_CHANGED) + return; + + new_state = atoi (state); - state = bonobo_ui_handler_menu_get_toggle_state (uih, path); - e_msg_composer_show_attachments (E_MSG_COMPOSER (data), state); + e_msg_composer_show_attachments (E_MSG_COMPOSER (user_data), new_state); } #if 0 @@ -811,7 +818,7 @@ static void fs_selection_get (GtkWidget *widget, GtkSelectionData *sdata, #endif static void -menu_file_insert_file_cb (BonoboUIHandler *uih, +menu_file_insert_file_cb (BonoboUIComponent *uic, void *data, const char *path) { @@ -837,205 +844,76 @@ menu_file_insert_file_cb (BonoboUIHandler *uih, } static void -menu_format_html_cb (BonoboUIHandler *uih, - void *data, - const char *path) +menu_format_html_cb (BonoboUIComponent *component, + const char *path, + Bonobo_UIComponent_EventType type, + const char *state, + gpointer user_data) + { EMsgComposer *composer; gboolean new_state; - composer = E_MSG_COMPOSER (data); + if (type != Bonobo_UIComponent_STATE_CHANGED) + return; + + composer = E_MSG_COMPOSER (user_data); - new_state = bonobo_ui_handler_menu_get_toggle_state (uih, path); - if ((new_state && composer->send_html) || (! new_state && ! composer->send_html)) + new_state = atoi (state); + + if ((new_state && composer->send_html) || + (! new_state && ! composer->send_html)) return; e_msg_composer_set_send_html (composer, new_state); } -/* Menu bar creation. */ +static BonoboUIVerb verbs [] = { -static void -create_menubar_file (EMsgComposer *composer, - BonoboUIHandler *uih) -{ - bonobo_ui_handler_menu_new_subtree (uih, "/File", - _("_File"), - NULL, -1, - BONOBO_UI_HANDLER_PIXMAP_NONE, NULL, - 0, 0); - - bonobo_ui_handler_menu_new_item (uih, "/File/Open", - _("_Open..."), - _("Load a previously saved message"), - -1, - BONOBO_UI_HANDLER_PIXMAP_STOCK, - GNOME_STOCK_MENU_OPEN, - 0, 0, - menu_file_open_cb, composer); - - bonobo_ui_handler_menu_new_item (uih, "/File/Save", - _("_Save..."), - _("Save message"), - -1, - BONOBO_UI_HANDLER_PIXMAP_STOCK, - GNOME_STOCK_MENU_SAVE, - 0, 0, - menu_file_save_cb, composer); - - bonobo_ui_handler_menu_new_item (uih, "/File/Save as", - _("Save _as..."), - _("Save message with a different name"), - -1, - BONOBO_UI_HANDLER_PIXMAP_STOCK, - GNOME_STOCK_MENU_SAVE_AS, - 0, 0, - menu_file_save_as_cb, composer); - - bonobo_ui_handler_menu_new_item (uih, "/File/Save in folder", - _("Save in _folder..."), - _("Save the message in a specified folder"), - -1, - BONOBO_UI_HANDLER_PIXMAP_NONE, NULL, - 0, 0, - NULL, composer); - - bonobo_ui_handler_menu_new_separator (uih, "/File/Separator1", -1); - - bonobo_ui_handler_menu_new_item (uih, "/File/Insert text file", - _("_Insert text file... (FIXME)"), - _("Insert a file as text into the message"), - -1, - BONOBO_UI_HANDLER_PIXMAP_NONE, NULL, - 0, 0, - menu_file_insert_file_cb, composer); - - bonobo_ui_handler_menu_new_separator (uih, "/File/Separator2", -1); - - bonobo_ui_handler_menu_new_item (uih, "/File/Send Now", - _("Send _Now"), - _("Send the message now"), - -1, - BONOBO_UI_HANDLER_PIXMAP_STOCK, - GNOME_STOCK_MENU_MAIL_SND, - 0, 0, - menu_file_send_cb, composer); - - bonobo_ui_handler_menu_new_item (uih, "/File/Send Later", - _("Send _Later"), - _("Send the message later"), - -1, - BONOBO_UI_HANDLER_PIXMAP_STOCK, - GNOME_STOCK_MENU_MAIL_SND, - 0, 0, - menu_file_send_later_cb, composer); - - bonobo_ui_handler_menu_new_separator (uih, "/File/Separator3", -1); - - bonobo_ui_handler_menu_new_item (uih, "/File/Close", - _("_Close..."), - _("Quit the message composer"), - -1, - BONOBO_UI_HANDLER_PIXMAP_STOCK, - GNOME_STOCK_MENU_CLOSE, - 0, 0, - menu_file_close_cb, composer); -} + BONOBO_UI_UNSAFE_VERB ("FileOpen", menu_file_open_cb), + BONOBO_UI_UNSAFE_VERB ("FileSave", menu_file_save_cb), + BONOBO_UI_UNSAFE_VERB ("FileSaveAs", menu_file_save_as_cb), + BONOBO_UI_UNSAFE_VERB ("FileClose", menu_file_close_cb), -static void -create_menubar_edit (EMsgComposer *composer, - BonoboUIHandler *uih) -{ - bonobo_ui_handler_menu_new_subtree (uih, "/Edit", - _("_Edit"), - NULL, -1, - BONOBO_UI_HANDLER_PIXMAP_NONE, NULL, - 0, 0); -} + BONOBO_UI_UNSAFE_VERB ("FileInsertFile", menu_file_insert_file_cb), + BONOBO_UI_UNSAFE_VERB ("FileAttach", menu_file_add_attachment_cb), -static void -create_menubar_format (EMsgComposer *composer, - BonoboUIHandler *uih) -{ - bonobo_ui_handler_menu_new_subtree (uih, "/Format", - _("F_ormat"), - NULL, -1, - BONOBO_UI_HANDLER_PIXMAP_NONE, NULL, - 0, 0); - - bonobo_ui_handler_menu_new_toggleitem (uih, "/Format/HTML", - _("HTML"), - _("Send the mail in HTML format"), - -1, - 0, 0, - menu_format_html_cb, composer); - - bonobo_ui_handler_menu_set_toggle_state (uih, "/Format/HTML", composer->send_html); -} + BONOBO_UI_UNSAFE_VERB ("FileSend", menu_file_send_cb), + BONOBO_UI_UNSAFE_VERB ("FileSendLater", menu_file_send_later_cb), -static void -create_menubar_view (EMsgComposer *composer, - BonoboUIHandler *uih) -{ - bonobo_ui_handler_menu_new_subtree (uih, "/View", - _("_View"), - NULL, -1, - BONOBO_UI_HANDLER_PIXMAP_NONE, NULL, - 0, 0); - - bonobo_ui_handler_menu_new_toggleitem (uih, "/View/Show attachments", - _("Show _attachments"), - _("Show/hide attachments"), - -1, - 0, 0, - menu_view_attachments_activate_cb, composer); -} + BONOBO_UI_VERB_END +}; static void -create_menubar (EMsgComposer *composer) +setup_ui (EMsgComposer *composer) { - BonoboUIHandler *uih; - - uih = composer->uih; - bonobo_ui_handler_create_menubar (uih); - - create_menubar_file (composer, uih); - create_menubar_edit (composer, uih); - create_menubar_format (composer, uih); - create_menubar_view (composer, uih); -} + BonoboUIContainer *container; - -/* Toolbar implementation. */ + container = bonobo_ui_container_new (); + bonobo_ui_container_set_win (container, BONOBO_WIN (composer)); -static void -create_toolbar (EMsgComposer *composer) -{ - BonoboUIHandler *uih; - - uih = composer->uih; - bonobo_ui_handler_create_toolbar (uih, "Toolbar"); - - bonobo_ui_handler_toolbar_new_item (uih, - "/Toolbar/Send", - _("Send"), - _("Send this message"), - -1, - BONOBO_UI_HANDLER_PIXMAP_STOCK, - GNOME_STOCK_PIXMAP_MAIL_SND, - 0, 0, - menu_file_send_cb, composer); - - bonobo_ui_handler_toolbar_new_item (uih, - "/Toolbar/Attach", - _("Attach"), - _("Attach a file"), - -1, - BONOBO_UI_HANDLER_PIXMAP_STOCK, - GNOME_STOCK_PIXMAP_ATTACH, - 0, 0, - menu_file_add_attachment_cb, composer); + composer->uic = bonobo_ui_component_new ("evolution-message-composer"); + bonobo_ui_component_set_container ( + composer->uic, bonobo_object_corba_objref (BONOBO_OBJECT (container))); + + bonobo_ui_component_add_verb_list_with_data ( + composer->uic, verbs, composer); + + bonobo_ui_util_set_ui (composer->uic, EVOLUTION_DATADIR, + "evolution-message-composer.xml", + "evolution-message-composer"); + + bonobo_ui_component_set_prop (composer->uic, "/commands/FormatHtml", + "state", composer->send_html ? "1" : "0", NULL); + + bonobo_ui_component_add_listener ( + composer->uic, "FormatHtml", + menu_format_html_cb, composer); + + bonobo_ui_component_add_listener ( + composer->uic, "ViewAttach", + menu_view_attachments_activate_cb, composer); } @@ -1066,7 +944,9 @@ destroy (GtkObject *object) composer = E_MSG_COMPOSER (object); - bonobo_object_unref (BONOBO_OBJECT (composer->uih)); + if (composer->uic) + bonobo_object_unref (BONOBO_OBJECT (composer->uic)); + composer->uic = NULL; /* FIXME? I assume the Bonobo widget will get destroyed normally? */ @@ -1188,7 +1068,7 @@ class_init (EMsgComposerClass *klass) static void init (EMsgComposer *composer) { - composer->uih = NULL; + composer->uic = NULL; composer->hdrs = NULL; composer->extra_hdr_names = g_ptr_array_new (); @@ -1262,8 +1142,7 @@ e_msg_composer_construct (EMsgComposer *composer) gtk_signal_connect (GTK_OBJECT (composer), "drag_data_received", GTK_SIGNAL_FUNC (drag_data_received), NULL); - composer->uih = bonobo_ui_handler_new (); - bonobo_ui_handler_set_app (composer->uih, BONOBO_WIN (composer)); + setup_ui (composer); vbox = gtk_vbox_new (FALSE, 0); @@ -1272,12 +1151,10 @@ e_msg_composer_construct (EMsgComposer *composer) gtk_widget_show (composer->hdrs); /* Editor component. */ - - create_menubar (composer); - create_toolbar (composer); composer->editor = bonobo_widget_new_control ( HTML_EDITOR_CONTROL_ID, - bonobo_ui_compat_get_container (composer->uih)); + bonobo_ui_component_get_container (composer->uic)); + if (!composer->editor) return; @@ -1767,7 +1644,9 @@ e_msg_composer_set_send_html (EMsgComposer *composer, return; composer->send_html = send_html; - bonobo_ui_handler_menu_set_toggle_state (composer->uih, "/Format/HTML", send_html); + + bonobo_ui_component_set_prop (composer->uic, "/commands/FormatHtml", + "state", composer->send_html ? "1" : "0", NULL); } /** diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index 48a933329e..68ab9bef7c 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -49,7 +49,7 @@ typedef struct _EMsgComposerClass EMsgComposerClass; struct _EMsgComposer { BonoboWin parent; - BonoboUIHandler *uih; + BonoboUIComponent *uic; GtkWidget *hdrs; GPtrArray *extra_hdr_names, *extra_hdr_values; |