From c9cba32d9ad9eb717ec135a49dc9fee4d703293a Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Wed, 15 Nov 2000 18:47:33 +0000 Subject: updates for HTMLEditor API changes 2000-11-15 Radek Doulik * updates for HTMLEditor API changes * e-msg-composer.c: added #include svn path=/trunk/; revision=6582 --- composer/ChangeLog | 4 +++ composer/e-msg-composer.c | 18 ++++++++------ composer/e-msg-composer.h | 10 ++++---- composer/listener.c | 62 +++++++++++++++++++++++------------------------ composer/listener.h | 20 +++++++-------- 5 files changed, 60 insertions(+), 54 deletions(-) diff --git a/composer/ChangeLog b/composer/ChangeLog index f2e303088c..aeeb41e1d8 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,5 +1,9 @@ 2000-11-15 Radek Doulik + * updates for HTMLEditor API changes + + * e-msg-composer.c: added #include + * e-msg-composer.h: e_msg_composer_guess_mime_type renamed and moved mime_guess_type_from_file_name from camel as it uses VFS diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 4472bae4eb..99f7c49235 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -61,6 +61,8 @@ #include "HTMLEditor.h" #include "listener.h" +#include + #define HTML_EDITOR_CONTROL_ID "OAFIID:control:html-editor:63c5499b-8b0c-475a-9948-81ec96a9662c" @@ -456,18 +458,18 @@ prepare_engine (EMsgComposer *composer) /* printf ("prepare_engine\n"); */ CORBA_exception_init (&ev); - composer->editor_engine = (HTMLEditor_Engine) bonobo_object_client_query_interface + composer->editor_engine = (GNOME_HTMLEditor_Engine) bonobo_object_client_query_interface (bonobo_widget_get_server (BONOBO_WIDGET (composer->editor)), "IDL:HTMLEditor/Engine:1.0", &ev); if (composer->editor_engine != CORBA_OBJECT_NIL) { /* printf ("trying set listener\n"); */ - composer->editor_listener = BONOBO_OBJECT (html_editor_listener_new (composer)); + composer->editor_listener = BONOBO_OBJECT (htmleditor_listener_new (composer)); if (composer->editor_listener != CORBA_OBJECT_NIL) - HTMLEditor_Engine__set_listener (composer->editor_engine, - (HTMLEditor_Listener) - bonobo_object_dup_ref - (bonobo_object_corba_objref (composer->editor_listener), &ev), - &ev); + GNOME_HTMLEditor_Engine__set_listener (composer->editor_engine, + (GNOME_HTMLEditor_Listener) + bonobo_object_dup_ref + (bonobo_object_corba_objref (composer->editor_listener), &ev), + &ev); } CORBA_exception_free (&ev); } @@ -484,7 +486,7 @@ mark_orig_text (EMsgComposer *composer) *((CORBA_boolean *) flag->_value) = CORBA_TRUE; CORBA_exception_init (&ev); - HTMLEditor_Engine_setObjectDataByType (composer->editor_engine, "ClueFlow", "orig", flag, &ev); + GNOME_HTMLEditor_Engine_setObjectDataByType (composer->editor_engine, "ClueFlow", "orig", flag, &ev); CORBA_free (flag); CORBA_exception_free (&ev); } diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index 4e8c611f66..807f23256f 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -63,11 +63,11 @@ struct _EMsgComposer { GtkWidget *address_dialog; - Bonobo_PersistFile persist_file_interface; - Bonobo_PersistStream persist_stream_interface; - HTMLEditor_Engine editor_engine; - BonoboObject *editor_listener; - GHashTable *inline_images; + Bonobo_PersistFile persist_file_interface; + Bonobo_PersistStream persist_stream_interface; + GNOME_HTMLEditor_Engine editor_engine; + BonoboObject *editor_listener; + GHashTable *inline_images; char *sig_file; diff --git a/composer/listener.c b/composer/listener.c index 0a609e6e44..f325808010 100644 --- a/composer/listener.c +++ b/composer/listener.c @@ -26,12 +26,12 @@ #include "listener.h" static BonoboObjectClass *listener_parent_class; -static POA_HTMLEditor_Listener__vepv listener_vepv; +static POA_GNOME_HTMLEditor_Listener__vepv listener_vepv; inline static HTMLEditorListener * -html_editor_listener_from_servant (PortableServer_Servant servant) +htmleditor_listener_from_servant (PortableServer_Servant servant) { - return HTML_EDITOR_LISTENER (bonobo_object_from_servant (servant)); + return HTMLEDITOR_LISTENER (bonobo_object_from_servant (servant)); } static CORBA_any * @@ -67,18 +67,18 @@ resolve_image_url (HTMLEditorListener *l, gchar *url) static void reply_indent (HTMLEditorListener *l, CORBA_Environment * ev) { - if (!HTMLEditor_Engine_isParagraphEmpty (l->composer->editor_engine, ev)) { - if (HTMLEditor_Engine_isPreviousParagraphEmpty (l->composer->editor_engine, ev)) - HTMLEditor_Engine_runCommand (l->composer->editor_engine, "cursor-backward", ev); + if (!GNOME_HTMLEditor_Engine_isParagraphEmpty (l->composer->editor_engine, ev)) { + if (GNOME_HTMLEditor_Engine_isPreviousParagraphEmpty (l->composer->editor_engine, ev)) + GNOME_HTMLEditor_Engine_runCommand (l->composer->editor_engine, "cursor-backward", ev); else { - HTMLEditor_Engine_runCommand (l->composer->editor_engine, "insert-paragraph", ev); + GNOME_HTMLEditor_Engine_runCommand (l->composer->editor_engine, "insert-paragraph", ev); return; } } - HTMLEditor_Engine_runCommand (l->composer->editor_engine, "style-normal", ev); - HTMLEditor_Engine_runCommand (l->composer->editor_engine, "indent-zero", ev); - HTMLEditor_Engine_runCommand (l->composer->editor_engine, "italic-off", ev); + GNOME_HTMLEditor_Engine_runCommand (l->composer->editor_engine, "style-normal", ev); + GNOME_HTMLEditor_Engine_runCommand (l->composer->editor_engine, "indent-zero", ev); + GNOME_HTMLEditor_Engine_runCommand (l->composer->editor_engine, "italic-off", ev); } static CORBA_any * @@ -86,7 +86,7 @@ impl_event (PortableServer_Servant _servant, const CORBA_char * name, const CORBA_any * arg, CORBA_Environment * ev) { - HTMLEditorListener *l = html_editor_listener_from_servant (_servant); + HTMLEditorListener *l = htmleditor_listener_from_servant (_servant); BonoboArg *data; CORBA_any *rv = NULL; @@ -94,12 +94,12 @@ impl_event (PortableServer_Servant _servant, if (!strcmp (name, "command")) { /* FIXME check for insert-paragraph command */ - data = HTMLEditor_Engine_getParagraphData (l->composer->editor_engine, "orig", ev); + data = GNOME_HTMLEditor_Engine_getParagraphData (l->composer->editor_engine, "orig", ev); if (ev->_major == CORBA_NO_EXCEPTION && data) { if (CORBA_TypeCode_equal (data->_type, TC_boolean, ev) && BONOBO_ARG_GET_BOOLEAN (data)) reply_indent (l, ev); BONOBO_ARG_SET_BOOLEAN (data, CORBA_FALSE); - HTMLEditor_Engine_setParagraphData (l->composer->editor_engine, "orig", data, ev); + GNOME_HTMLEditor_Engine_setParagraphData (l->composer->editor_engine, "orig", data, ev); } } else if (!strcmp (name, "image_url")) { gchar *url; @@ -115,12 +115,12 @@ impl_event (PortableServer_Servant _servant, return rv ? rv : get_any_null (); } -POA_HTMLEditor_Listener__epv * -html_editor_listener_get_epv (void) +POA_GNOME_HTMLEditor_Listener__epv * +htmleditor_listener_get_epv (void) { - POA_HTMLEditor_Listener__epv *epv; + POA_GNOME_HTMLEditor_Listener__epv *epv; - epv = g_new0 (POA_HTMLEditor_Listener__epv, 1); + epv = g_new0 (POA_GNOME_HTMLEditor_Listener__epv, 1); epv->event = impl_event; @@ -130,8 +130,8 @@ html_editor_listener_get_epv (void) static void init_listener_corba_class (void) { - listener_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - listener_vepv.HTMLEditor_Listener_epv = html_editor_listener_get_epv (); + listener_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); + listener_vepv.GNOME_HTMLEditor_Listener_epv = htmleditor_listener_get_epv (); } static void @@ -143,7 +143,7 @@ listener_class_init (HTMLEditorListenerClass *klass) } GtkType -html_editor_listener_get_type (void) +htmleditor_listener_get_type (void) { static GtkType type = 0; @@ -166,10 +166,10 @@ html_editor_listener_get_type (void) } HTMLEditorListener * -html_editor_listener_construct (HTMLEditorListener *listener, HTMLEditor_Listener corba_listener) +htmleditor_listener_construct (HTMLEditorListener *listener, GNOME_HTMLEditor_Listener corba_listener) { g_return_val_if_fail (listener != NULL, NULL); - g_return_val_if_fail (IS_HTML_EDITOR_LISTENER (listener), NULL); + g_return_val_if_fail (IS_HTMLEDITOR_LISTENER (listener), NULL); g_return_val_if_fail (corba_listener != CORBA_OBJECT_NIL, NULL); if (!bonobo_object_construct (BONOBO_OBJECT (listener), (CORBA_Object) corba_listener)) @@ -178,17 +178,17 @@ html_editor_listener_construct (HTMLEditorListener *listener, HTMLEditor_Listene return listener; } -static HTMLEditor_Listener +static GNOME_HTMLEditor_Listener create_listener (BonoboObject *listener) { - POA_HTMLEditor_Listener *servant; + POA_GNOME_HTMLEditor_Listener *servant; CORBA_Environment ev; - servant = (POA_HTMLEditor_Listener *) g_new0 (BonoboObjectServant, 1); + servant = (POA_GNOME_HTMLEditor_Listener *) g_new0 (BonoboObjectServant, 1); servant->vepv = &listener_vepv; CORBA_exception_init (&ev); - POA_HTMLEditor_Listener__init ((PortableServer_Servant) servant, &ev); + POA_GNOME_HTMLEditor_Listener__init ((PortableServer_Servant) servant, &ev); ORBIT_OBJECT_KEY(servant->_private)->object = NULL; if (ev._major != CORBA_NO_EXCEPTION){ @@ -199,16 +199,16 @@ create_listener (BonoboObject *listener) CORBA_exception_free (&ev); - return (HTMLEditor_Listener) bonobo_object_activate_servant (listener, servant); + return (GNOME_HTMLEditor_Listener) bonobo_object_activate_servant (listener, servant); } HTMLEditorListener * -html_editor_listener_new (EMsgComposer *composer) +htmleditor_listener_new (EMsgComposer *composer) { HTMLEditorListener *listener; - HTMLEditor_Listener corba_listener; + GNOME_HTMLEditor_Listener corba_listener; - listener = gtk_type_new (HTML_EDITOR_LISTENER_TYPE); + listener = gtk_type_new (HTMLEDITOR_LISTENER_TYPE); listener->composer = composer; corba_listener = create_listener (BONOBO_OBJECT (listener)); @@ -218,5 +218,5 @@ html_editor_listener_new (EMsgComposer *composer) return NULL; } - return html_editor_listener_construct (listener, corba_listener); + return htmleditor_listener_construct (listener, corba_listener); } diff --git a/composer/listener.h b/composer/listener.h index e2815a3221..284924ffc6 100644 --- a/composer/listener.h +++ b/composer/listener.h @@ -30,11 +30,11 @@ BEGIN_GNOME_DECLS -#define HTML_EDITOR_LISTENER_TYPE (html_editor_listener_get_type ()) -#define HTML_EDITOR_LISTENER(o) (GTK_CHECK_CAST ((o), HTML_EDITOR_LISTENER_TYPE, HTMLEditorListener)) -#define HTML_EDITOR_LISTENER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), HTML_EDITOR_LISTENER_TYPE, HTMLEditorListenerClass)) -#define IS_HTML_EDITOR_LISTENER(o) (GTK_CHECK_TYPE ((o), HTML_EDITOR_LISTENER_TYPE)) -#define IS_HTML_EDITOR_LISTENER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), HTML_EDITOR_LISTENER_TYPE)) +#define HTMLEDITOR_LISTENER_TYPE (htmleditor_listener_get_type ()) +#define HTMLEDITOR_LISTENER(o) (GTK_CHECK_CAST ((o), HTMLEDITOR_LISTENER_TYPE, HTMLEditorListener)) +#define HTMLEDITOR_LISTENER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), HTMLEDITOR_LISTENER_TYPE, HTMLEditorListenerClass)) +#define IS_HTMLEDITOR_LISTENER(o) (GTK_CHECK_TYPE ((o), HTMLEDITOR_LISTENER_TYPE)) +#define IS_HTMLEDITOR_LISTENER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), HTMLEDITOR_LISTENER_TYPE)) typedef struct { BonoboObject parent; @@ -45,11 +45,11 @@ typedef struct { BonoboObjectClass parent_class; } HTMLEditorListenerClass; -GtkType html_editor_listener_get_type (void); -HTMLEditorListener *html_editor_listener_construct (HTMLEditorListener *listener, - HTMLEditor_Listener corba_listener); -HTMLEditorListener *html_editor_listener_new (EMsgComposer *composer); -POA_HTMLEditor_Listener__epv *html_editor_listener_get_epv (void); +GtkType htmleditor_listener_get_type (void); +HTMLEditorListener *htmleditor_listener_construct (HTMLEditorListener *listener, + GNOME_HTMLEditor_Listener corba_listener); +HTMLEditorListener *htmleditor_listener_new (EMsgComposer *composer); +POA_GNOME_HTMLEditor_Listener__epv *htmleditor_listener_get_epv (void); END_GNOME_DECLS -- cgit