]> git.pld-linux.org Git - packages/vim.git/blob - vim-bonobo-20050909.patch
- updated to 1.15
[packages/vim.git] / vim-bonobo-20050909.patch
1 diff -Nur vim63/src/buffer.c vim63-bonobo/src/buffer.c
2 --- vim63/src/buffer.c  2005-09-09 20:11:09.929854000 +0200
3 +++ vim63-bonobo/src/buffer.c   2005-09-09 20:14:02.699589864 +0200
4 @@ -28,6 +28,10 @@
5  
6  #include "vim.h"
7  
8 +#if defined(FEAT_GUI_COMPONENT) && defined(FEAT_GUI_GNOME)
9 +#include "vim_bonobo_control.h"
10 +#endif
11 +
12  #if defined(FEAT_CMDL_COMPL) || defined(FEAT_LISTCMDS) || defined(FEAT_EVAL) || defined(FEAT_PERL)
13  static char_u  *buflist_match __ARGS((regprog_T *prog, buf_T *buf));
14  # define HAVE_BUFLIST_MATCH
15 @@ -137,10 +141,20 @@
16         if (curbuf->b_help)
17             fix_help_buffer();
18      }
19 -    else if (read_stdin)
20 +    else if (read_stdin
21 +#if defined(FEAT_GUI_COMPONENT) && defined(FEAT_GUI_GNOME)
22 +                || read_from_container
23 +#endif
24 +            )
25      {
26         int             save_bin = curbuf->b_p_bin;
27         linenr_T        line_count;
28 +#if defined(FEAT_GUI_COMPONENT) && defined(FEAT_GUI_GNOME)
29 +        int flags = READ_NEW + READ_EMB_STREAM;
30 +       curbuf->emb_buffer = TRUE;
31 +#else
32 +        int flags = READ_NEW + READ_STDIN;
33 +#endif
34  
35         /*
36          * First read the text in binary mode into the buffer.
37 @@ -150,7 +164,7 @@
38          */
39         curbuf->b_p_bin = TRUE;
40         retval = readfile(NULL, NULL, (linenr_T)0,
41 -                 (linenr_T)0, (linenr_T)MAXLNUM, NULL, READ_NEW + READ_STDIN);
42 +                 (linenr_T)0, (linenr_T)MAXLNUM, eap, flags);
43         curbuf->b_p_bin = save_bin;
44         if (retval == OK)
45         {
46 @@ -172,14 +186,21 @@
47             /* Put the cursor on the first line. */
48             curwin->w_cursor.lnum = 1;
49             curwin->w_cursor.col = 0;
50 +#if defined(FEAT_GUI_COMPONENT) && defined(FEAT_GUI_GNOME)
51 +            if (read_stdin) 
52 +            {
53 +#endif
54  #ifdef FEAT_AUTOCMD
55  # ifdef FEAT_EVAL
56 -           apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
57 +                apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
58                                                         curbuf, &retval);
59  # else
60 -           apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf);
61 +                apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf);
62  # endif
63  #endif
64 +#if defined(FEAT_GUI_COMPONENT) && defined(FEAT_GUI_GNOME)
65 +            }
66 +#endif
67         }
68      }
69  
70 @@ -4634,6 +4655,11 @@
71         return "[Scratch]";
72      }
73  #endif
74 +#if defined(FEAT_QUICKFIX) && defined(FEAT_GUI_COMPONENT)
75 +    if ( buf->emb_buffer ) {
76 +       return "[Embedded File]";
77 +    }
78 +#endif
79      if (buf->b_fname == NULL)
80         return _("[No File]");
81      return NULL;
82 diff -Nur vim63/src/config.h.in vim63-bonobo/src/config.h.in
83 --- vim63/src/config.h.in       2005-09-09 20:11:10.543761000 +0200
84 +++ vim63-bonobo/src/config.h.in        2005-09-09 20:14:02.700589712 +0200
85 @@ -321,6 +321,9 @@
86  /* Define if GTK+ multihead support is available (requires GTK+ >= 2.1.1). */
87  #undef HAVE_GTK_MULTIHEAD
88  
89 +/* Define if you want component (i.e. Bonobo) support. */
90 +#undef FEAT_GUI_COMPONENT
91
92  /* Define if your X has own locale library */
93  #undef X_LOCALE
94  
95 diff -Nur vim63/src/config.mk.in vim63-bonobo/src/config.mk.in
96 --- vim63/src/config.mk.in      2005-09-09 20:11:10.543761000 +0200
97 +++ vim63-bonobo/src/config.mk.in       2005-09-09 20:14:02.700589712 +0200
98 @@ -106,6 +106,9 @@
99  ### Prefix for location of man pages
100  MANDIR         = @mandir@
101  
102 +### Extra targets to be built by default
103 +EXTRA_TARGETS = @EXTRA_TARGETS@
104 +
105  ### Do we have a GUI
106  GUI_INC_LOC    = @GUI_INC_LOC@
107  GUI_LIB_LOC    = @GUI_LIB_LOC@
108 diff -Nur vim63/src/configure.in vim63-bonobo/src/configure.in
109 --- vim63/src/configure.in      2005-09-09 20:11:10.546761000 +0200
110 +++ vim63-bonobo/src/configure.in       2005-09-09 20:14:02.703589256 +0200
111 @@ -56,6 +56,7 @@
112    sh ./toolcheck 1>&AC_FD_MSG
113  fi
114  
115 +EXTRA_TARGETS="";
116  OS_EXTRA_SRC=""; OS_EXTRA_OBJ=""
117  
118  dnl Check for BeOS, which needs an extra source file
119 @@ -123,6 +124,7 @@
120  
121  AC_SUBST(OS_EXTRA_SRC)
122  AC_SUBST(OS_EXTRA_OBJ)
123 +AC_SUBST(EXTRA_TARGETS)
124  
125  dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS.
126  dnl Only when the directory exists and it wasn't there yet.
127 @@ -1831,6 +1833,23 @@
128           AC_DEFINE(FEAT_GUI_GNOME)
129           GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
130           GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
131 +          AC_MSG_CHECKING(whether or not to include bonobo support)
132 +          AC_ARG_ENABLE(bonobo,
133 +            [  --enable-bonobo         If using GNOME, enable bonobo support [default=no]],
134 +            , enable_bonobo="no")
135 +          if test "x$enable_bonobo" = "xno"; then
136 +            AC_MSG_RESULT($enable_bonobo);
137 +          else
138 +            if test "x$SKIP_BONOBO" != "xYES" -a $gtk_major_version -ge 2; then
139 +              AC_MSG_RESULT(yes);
140 +              AC_DEFINE(FEAT_GUI_COMPONENT) 
141 +              GUITYPE=BONOBO
142 +              VIMNAME="vim-component"
143 +              EXTRA_TARGETS="vim-factory Vim_Control.server"
144 +            else
145 +              AC_MSG_RESULT(no (Bonobo requires Gnome 2));
146 +            fi
147 +          fi
148         fi
149        }
150        fi
151 diff -Nur vim63/src/container.c vim63-bonobo/src/container.c
152 --- vim63/src/container.c       1970-01-01 01:00:00.000000000 +0100
153 +++ vim63-bonobo/src/container.c        2005-09-09 20:14:02.704589104 +0200
154 @@ -0,0 +1,266 @@
155 +
156 +#include <bonobo.h>
157 +#include <glib.h>
158 +
159 +BonoboControlFrame  *ctrl_frame;
160 +BonoboUIComponent   *ui_comp;
161 +
162 +/* vbox */
163 +GtkWidget           *box;
164 +GtkWidget           *ctrl_widget;
165 +
166 +char * filename;
167 +
168 +static Bonobo_Control
169 +instantiate_control()
170 +{
171 +       Bonobo_Control control;
172 +       Bonobo_PersistFile pfile;
173 +       Bonobo_PersistStream pstream;
174 +       CORBA_Environment ev;
175 +    Bonobo_Stream stream;
176 +
177 +       CORBA_exception_init (&ev);
178 +
179 +       /* get control component */
180 +       control = bonobo_get_object ("OAFIID:Vim_Control",
181 +                                    "Bonobo/Control", &ev);
182 +       if (BONOBO_EX (&ev) || (control == CORBA_OBJECT_NIL))
183 +    {
184 +               CORBA_exception_free (&ev);
185 +        return NULL;
186 +    }
187 +       
188 +#if 0
189 +       /* get PersistFile interface */
190 +    pfile = Bonobo_Unknown_queryInterface (control, "IDL:Bonobo/PersistFile:1.0", &ev);
191 +    if (BONOBO_EX (&ev) || (pfile == CORBA_OBJECT_NIL))
192 +    exit(1);
193 +       
194 +       /* load the file */
195 +    Bonobo_PersistFile_load (pfile, filename, &ev);
196 +       bonobo_object_release_unref (pfile, NULL);
197 +#endif
198 +
199 +       /* get PersistStream interface */
200 +    pstream = Bonobo_Unknown_queryInterface (control, "IDL:Bonobo/PersistStream:1.0", &ev);
201 +    if (BONOBO_EX (&ev) || (pstream == CORBA_OBJECT_NIL))
202 +    {
203 +               CORBA_exception_free (&ev);
204 +        return NULL;
205 +    }
206 +       
207 +       /* load the file */
208 +    stream = bonobo_get_object(filename, "IDL:Bonobo/Stream:1.0", &ev);
209 +       if (ev._major != CORBA_NO_EXCEPTION) {
210 +        g_warning("Error getting stream interface");
211 +               bonobo_object_unref (BONOBO_OBJECT (stream));
212 +               CORBA_exception_free (&ev);
213 +               return NULL;
214 +       }
215 +    Bonobo_PersistStream_load (pstream, stream, "text/plain", &ev);
216 +       if (ev._major != CORBA_NO_EXCEPTION) {
217 +        g_warning("Error loading stream!");
218 +               bonobo_object_unref (BONOBO_OBJECT (stream));
219 +               CORBA_exception_free (&ev);
220 +               return NULL;
221 +       }
222 +       bonobo_object_release_unref (pstream, NULL);
223 +    return control;
224 +}
225 +
226 +static void
227 +verb_FileNewWindow (BonoboUIComponent *uic, gpointer user_data, const char *cname)
228 +{
229 +    printf("Got New Window!\n");
230 +}
231 +
232 +static void
233 +verb_DoNothing (BonoboUIComponent *uic, gpointer user_data, const char *cname)
234 +{
235 +}
236 +
237 +static BonoboUIVerb app_verbs[] = {
238 +       BONOBO_UI_VERB ("FileNewWindow", verb_FileNewWindow),
239 +       BONOBO_UI_VERB ("FileOpen",      verb_DoNothing),
240 +       BONOBO_UI_VERB ("FileCloseWindow", verb_DoNothing),
241 +       BONOBO_UI_VERB ("FileExit",      verb_DoNothing),
242 +       BONOBO_UI_VERB ("Preferences",   verb_DoNothing),
243 +       BONOBO_UI_VERB ("HelpAbout",     verb_DoNothing),
244 +       BONOBO_UI_VERB ("Help",          verb_DoNothing),
245 +       BONOBO_UI_VERB ("DnDNewWindow",  verb_DoNothing),
246 +       BONOBO_UI_VERB ("DnDSameWindow", verb_DoNothing),
247 +       BONOBO_UI_VERB ("DnDCancel",     verb_DoNothing),
248 +       BONOBO_UI_VERB_END
249 +};
250 +
251 +static void 
252 +add_control_to_ui (BonoboWindow *window, Bonobo_Control control)
253 +{
254 +       CORBA_Environment ev;
255 +       Bonobo_PropertyControl prop_control;
256 +       BonoboUIContainer *ui_container;
257 +    char *curdir;
258 +
259 +       g_return_if_fail (window != NULL);
260 +       g_return_if_fail (BONOBO_IS_WINDOW (window));
261 +       
262 +       CORBA_exception_init (&ev);
263 +
264 +       ui_container = bonobo_window_get_ui_container (BONOBO_WINDOW (window));
265 +       ctrl_frame = bonobo_control_frame_new (BONOBO_OBJREF (ui_container));
266 +
267 +       /* bind and view new control widget */
268 +       bonobo_control_frame_bind_to_control (ctrl_frame, control, &ev);
269 +       bonobo_control_frame_control_activate (ctrl_frame);
270 +       if (control != CORBA_OBJECT_NIL && ctrl_widget == NULL) {
271 +               ctrl_widget = bonobo_control_frame_get_widget (ctrl_frame);
272 +               if (!ctrl_widget)
273 +                       g_assert_not_reached ();
274 +
275 +        bonobo_window_set_contents (BONOBO_WINDOW(window), GTK_WIDGET(ctrl_widget));
276 +               gtk_widget_show (ctrl_widget);
277 +       }
278 +
279 +       ui_comp = bonobo_ui_component_new ("vim-container");
280 +       bonobo_ui_component_set_container (ui_comp, BONOBO_OBJREF (ui_container), NULL);
281 +
282 +    curdir = (char *)getcwd(NULL, 0);
283 +       bonobo_ui_util_set_ui (ui_comp, curdir, "vim-container.xml", "Vim", NULL);
284 +    free( curdir );
285 +    bonobo_ui_component_add_verb_list_with_data (ui_comp, app_verbs, window);
286 +
287 +       /* update sensitivity of the properties menu item */
288 +       prop_control = Bonobo_Unknown_queryInterface (control, 
289 +                                                     "IDL:Bonobo/PropertyControl:1.0", &ev);
290 +       bonobo_ui_component_set_prop (ui_comp,
291 +                                     "/commands/Preferences",
292 +                                     "sensitive",
293 +                                     prop_control == CORBA_OBJECT_NIL ? "0" : "1",
294 +                                     &ev);
295 +       
296 +       bonobo_object_release_unref (prop_control, &ev);
297 +
298 +       /* enable view menu */
299 +       /* FIXME: We should check if the component adds anything to 
300 +        *        the menu, so that we don't view an empty menu.
301 +        */
302 +       /*bonobo_ui_component_set_prop (ui_comp, "/menu/View", "hidden", "0", &ev);*/
303 +
304 +       CORBA_exception_free (&ev);
305 +
306 +       /* retrieve control properties and install listeners */
307 +       //check_for_control_properties (window);
308 +}
309 +
310 +static void write_stream_to_file(Bonobo_Control control)
311 +{
312 +    Bonobo_Storage storage;
313 +    gchar * dirname;
314 +    gchar * basename;
315 +       CORBA_Environment ev;
316 +       Bonobo_PersistStream pstream;
317 +    Bonobo_Stream stream;
318 +
319 +    g_warning("write stream to file!");
320 +       CORBA_exception_init (&ev);
321 +
322 +    dirname = g_path_get_dirname(filename);
323 +    storage = bonobo_get_object(dirname, "IDL:Bonobo/Storage:1.0", &ev);
324 +    g_free(dirname);
325 +    if (BONOBO_EX (&ev) || (storage == CORBA_OBJECT_NIL))
326 +    {
327 +               CORBA_exception_free (&ev);
328 +        return;
329 +    }
330 +
331 +    pstream = Bonobo_Unknown_queryInterface (control, "IDL:Bonobo/PersistStream:1.0", &ev);
332 +    if (BONOBO_EX (&ev) || (pstream == CORBA_OBJECT_NIL))
333 +    {
334 +        bonobo_object_release_unref(storage, NULL);
335 +               CORBA_exception_free (&ev);
336 +        return;
337 +    }
338 +
339 +    basename = g_path_get_basename(filename);
340 +    stream = Bonobo_Storage_openStream(storage, basename, Bonobo_Storage_WRITE, &ev );
341 +    g_free(basename);
342 +    if (BONOBO_EX (&ev) || (stream == CORBA_OBJECT_NIL))
343 +    {
344 +        bonobo_object_release_unref(pstream, NULL);
345 +        bonobo_object_release_unref(storage, NULL);
346 +               CORBA_exception_free (&ev);
347 +        return;
348 +    }
349 +
350 +    Bonobo_PersistStream_save (pstream, stream, "text/plain", &ev);
351 +       if (ev._major != CORBA_NO_EXCEPTION) {
352 +        g_warning("Error saving stream!");
353 +               bonobo_object_unref (BONOBO_OBJECT (stream));
354 +        bonobo_object_release_unref(pstream, NULL);
355 +        bonobo_object_release_unref(storage, NULL);
356 +               CORBA_exception_free (&ev);
357 +               return;
358 +       }
359 +    bonobo_object_release_unref(stream, NULL);
360 +    bonobo_object_release_unref(pstream, NULL);
361 +    bonobo_object_release_unref(storage, NULL);
362 +    return;
363 +}
364 +
365 +static void
366 +window_destroyed (GtkWindow *window, char * data)
367 +{
368 +    Bonobo_Control control;
369 +
370 +    control = bonobo_control_frame_get_control(ctrl_frame);
371 +    write_stream_to_file(control);
372 +    bonobo_control_frame_control_deactivate(ctrl_frame);
373 +    bonobo_object_release_unref( control, NULL );
374 +    bonobo_main_quit();
375 +}
376 +
377 +int main(int argc, char * argv[] ) 
378 +{
379 +    BonoboWidget * bw;
380 +    BonoboWindow      *window;
381 +       BonoboUIEngine    *engine;
382 +       BonoboUIContainer *container;
383 +    Bonobo_Control    control;
384 +    gchar             *cwd;
385 +
386 +    if( argc <= 1 ) { 
387 +        fprintf(stderr, "%s: not enough args\n", argv[0] );
388 +        fprintf(stderr, "Usage: %s <text file>\n", argv[0]);
389 +        exit(1);
390 +    }
391 +    cwd = g_get_current_dir();
392 +    filename = g_build_filename( "file:", cwd, argv[1], NULL );
393 +    g_free(cwd);
394 +
395 +    bonobo_ui_init ("container", "1.0", &argc, argv);
396 +
397 +       if(gnome_vfs_init () == FALSE)
398 +               g_error (_("Could not initialize GnomeVFS!\n"));
399 +
400 +       window = BONOBO_WINDOW ( bonobo_window_new ("Window", "Vim Test Container"));
401 +
402 +    // instantiate a control
403 +    control = instantiate_control();
404 +    if( control == NULL )
405 +        return 1;
406 +    
407 +    // put it into our window
408 +    add_control_to_ui (window, control);
409 +
410 +    g_signal_connect (window, "destroy",
411 +          G_CALLBACK (window_destroyed),
412 +          &window);
413 +
414 +
415 +    gtk_widget_show_all( GTK_WIDGET( window ));
416 +
417 +    bonobo_main();
418 +
419 +    return 0;
420 +}
421 diff -Nur vim63/src/ex_cmds2.c vim63-bonobo/src/ex_cmds2.c
422 --- vim63/src/ex_cmds2.c        2005-09-09 20:11:09.884861000 +0200
423 +++ vim63-bonobo/src/ex_cmds2.c 2005-09-09 20:14:02.707588648 +0200
424 @@ -709,6 +709,12 @@
425      int                forceit;
426      int                allbuf;         /* may write all buffers */
427  {
428 +#ifdef FEAT_GUI_COMPONENT
429 +    if ( buf->emb_buffer ) {
430 +       EMSG(_("E467: Cannot close embedded file"));
431 +        return TRUE;
432 +    }
433 +#endif
434      if (       !forceit
435             && bufIsChanged(buf)
436             && (mult_win || buf->b_nwindows <= 1)
437 diff -Nur vim63/src/ex_docmd.c vim63-bonobo/src/ex_docmd.c
438 --- vim63/src/ex_docmd.c        2005-09-09 20:11:10.556759000 +0200
439 +++ vim63-bonobo/src/ex_docmd.c 2005-09-09 20:14:02.712587888 +0200
440 @@ -5729,8 +5729,13 @@
441      }
442      else
443      {
444 +#ifdef FEAT_GUI_COMPONENT
445 +        EMSG(_(e_compnoquit));
446 +        not_exiting();
447 +        return;
448 +#endif
449  #ifdef FEAT_WINDOWS
450 -       if (only_one_window())      /* quit last window */
451 +        if (only_one_window())             /* quit last window */
452  #endif
453             getout(0);
454  #ifdef FEAT_WINDOWS
455 @@ -5751,8 +5756,12 @@
456  ex_cquit(eap)
457      exarg_T    *eap;
458  {
459 +#ifdef FEAT_GUI_COMPONENT
460 +    EMSG(_(e_compnoquit));
461 +    return;
462 +#endif
463      getout(1); /* this does not always pass on the exit code to the Manx
464 -                  compiler. why? */
465 +                   compiler. why? */
466  }
467  
468  /*
469 @@ -5772,6 +5781,10 @@
470         return;
471      }
472  # endif
473 +#ifdef FEAT_GUI_COMPONENT
474 +    EMSG(_(e_compnoquit));
475 +    return;
476 +#endif
477      exiting = TRUE;
478      if (eap->forceit || !check_changed_any(FALSE))
479         getout(0);
480 @@ -5966,8 +5979,13 @@
481      }
482      else
483      {
484 +#ifdef FEAT_GUI_COMPONENT
485 +        EMSG(_(e_compnoquit));
486 +        not_exiting();
487 +        return;
488 +#endif
489  #ifdef FEAT_WINDOWS
490 -       if (only_one_window())      /* quit last window, exit Vim */
491 +        if ( only_one_window())            /* quit last window, exit Vim */
492  #endif
493             getout(0);
494  #ifdef FEAT_WINDOWS
495 diff -Nur vim63/src/fileio.c vim63-bonobo/src/fileio.c
496 --- vim63/src/fileio.c  2005-09-09 20:11:10.108827000 +0200
497 +++ vim63-bonobo/src/fileio.c   2005-09-09 20:18:45.327623872 +0200
498 @@ -41,6 +41,10 @@
499  # define CRYPT_MAGIC_LEN       12              /* must be multiple of 4! */
500  #endif
501  
502 +#if defined(FEAT_GUI_COMPONENT) && defined(FEAT_GUI_GNOME) 
503 +#include "vim_bonobo_control.h"
504 +#endif
505 +
506  /* Is there any system that doesn't have access()? */
507  #ifndef MACOS_CLASSIC /* Not available on MacOS 9 */
508  # define USE_MCH_ACCESS
509 @@ -202,6 +206,7 @@
510   * READ_BUFFER read from curbuf instead of a file (converting after reading
511   *             stdin)
512   * READ_DUMMY  read into a dummy buffer (to check if file contents changed)
513 + * READ_EMB_STREAM read from a bonobo persist stream
514   *
515   * return FAIL for failure, OK otherwise
516   */
517 @@ -221,6 +226,11 @@
518      int                filtering = (flags & READ_FILTER);
519      int                read_stdin = (flags & READ_STDIN);
520      int                read_buffer = (flags & READ_BUFFER);
521 +#if defined(FEAT_GUI_COMPONENT) && defined(FEAT_GUI_GNOME)
522 +    int                read_pstream = (flags & READ_EMB_STREAM);
523 +#else
524 +#define read_pstream 0
525 +#endif
526      linenr_T   read_buf_lnum = 1;      /* next line to read from curbuf */
527      colnr_T    read_buf_col = 0;       /* next char to read from this line */
528      char_u     c;
529 @@ -327,7 +337,7 @@
530       * The BufReadCmd and FileReadCmd events intercept the reading process by
531       * executing the associated commands instead.
532       */
533 -    if (!filtering && !read_stdin && !read_buffer)
534 +    if (!filtering && !read_stdin && !read_buffer && !read_pstream)
535      {
536         pos_T       pos;
537  
538 @@ -392,7 +402,7 @@
539       * On Unix it is possible to read a directory, so we have to
540       * check for it before the mch_open().
541       */
542 -    if (!read_stdin && !read_buffer)
543 +    if (!read_stdin && !read_buffer && !read_pstream)
544      {
545         perm = mch_getperm(fname);
546         if (perm >= 0 && !S_ISREG(perm)             /* not a regular file ... */
547 @@ -443,7 +453,7 @@
548      if (check_readonly && !readonlymode)    /* default: set file not readonly */
549         curbuf->b_p_ro = FALSE;
550  
551 -    if (newfile && !read_stdin && !read_buffer)
552 +    if (newfile && !read_stdin && !read_buffer && !read_pstream)
553      {
554         /* Remember time of file.
555          * For RISCOS, also remember the filetype.
556 @@ -509,6 +519,11 @@
557         setmode(0, O_BINARY);
558  #endif
559      }
560 +#ifdef FEAT_GUI_COMPONENT
561 +    else if (read_pstream)
562 +    {
563 +    }
564 +#endif
565      else if (!read_buffer)
566      {
567  #ifdef USE_MCH_ACCESS
568 @@ -643,7 +658,7 @@
569      /* If "Quit" selected at ATTENTION dialog, don't load the file */
570      if (swap_exists_action == SEA_QUIT)
571      {
572 -       if (!read_buffer && !read_stdin)
573 +       if (!read_buffer && !read_stdin && !read_pstream)
574             close(fd);
575         return FAIL;
576      }
577 @@ -668,7 +683,7 @@
578          * The file must be closed again, the autocommands may want to change
579          * the file before reading it.
580          */
581 -       if (!read_stdin)
582 +       if (!read_stdin && !read_pstream)
583             close(fd);          /* ignore errors */
584  
585         /*
586 @@ -705,7 +720,7 @@
587          * Don't allow the autocommands to change the current buffer.
588          * Try to re-open the file.
589          */
590 -       if (!read_stdin && (curbuf != old_curbuf
591 +       if (!read_stdin && !read_pstream && (curbuf != old_curbuf
592                 || (fd = mch_open((char *)fname, O_RDONLY | O_EXTRA, 0)) < 0))
593         {
594             --no_wait_return;
595 @@ -745,7 +760,7 @@
596             }
597  #endif
598         }
599 -       else if (!read_buffer)
600 +       else if (!read_buffer && !read_pstream)
601             filemess(curbuf, sfname, (char_u *)"", 0);
602      }
603  
604 @@ -850,7 +865,7 @@
605             read_buf_lnum = 1;
606             read_buf_col = 0;
607         }
608 -       else if (read_stdin || lseek(fd, (off_t)0L, SEEK_SET) != 0)
609 +       else if (read_stdin || read_pstream || lseek(fd, (off_t)0L, SEEK_SET) != 0)
610         {
611             /* Can't rewind the file, give up. */
612             error = TRUE;
613 @@ -996,7 +1011,7 @@
614          * Use the 'charconvert' expression when conversion is required
615          * and we can't do it internally or with iconv().
616          */
617 -       if (fio_flags == 0 && !read_stdin && !read_buffer && *p_ccv != NUL
618 +       if (fio_flags == 0 && !read_stdin && !read_buffer && !read_pstream && *p_ccv != NUL
619  #  ifdef USE_ICONV
620                                                     && iconv_fd == (iconv_t)-1
621  #  endif
622 @@ -1045,7 +1060,7 @@
623      /* Set can_retry when it's possible to rewind the file and try with
624       * another "fenc" value.  It's FALSE when no other "fenc" to try, reading
625       * stdin or "fenc" was specified with "++enc=". */
626 -    can_retry = (*fenc != NUL && !read_stdin
627 +    can_retry = (*fenc != NUL && !read_stdin && !read_pstream
628                                      && (eap == NULL || eap->force_enc == 0));
629  #endif
630  
631 @@ -1214,6 +1229,11 @@
632                         }
633                     }
634                 }
635 +#if defined(FEAT_GUI_COMPONENT) && defined(FEAT_GUI_GNOME) 
636 +                else if( read_pstream ) {
637 +                    size = vim_control_persist_stream_read(ptr, size);   
638 +                }
639 +#endif
640                 else
641                 {
642                     /*
643 @@ -1927,7 +1947,7 @@
644                             else if (ff_error != EOL_DOS)
645                             {
646                                 if (   try_unix
647 -                                   && !read_stdin
648 +                                   && !read_stdin && !read_pstream
649                                     && (read_buffer
650                                         || lseek(fd, (off_t)0L, SEEK_SET) == 0))
651                                 {
652 @@ -2016,7 +2036,7 @@
653  # endif
654  #endif
655  
656 -    if (!read_buffer && !read_stdin)
657 +    if (!read_buffer && !read_stdin && !read_pstream)
658         close(fd);                              /* errors are ignored */
659      vim_free(buffer);
660  
661 @@ -2205,7 +2225,7 @@
662  #ifdef ALWAYS_USE_GUI
663             /* Don't show the message when reading stdin, it would end up in a
664              * message box (which might be shown when exiting!) */
665 -           if (read_stdin || read_buffer)
666 +           if (read_stdin || read_buffer )
667                 p = msg_may_trunc(FALSE, IObuff);
668             else
669  #endif
670 @@ -2271,7 +2291,7 @@
671       */
672      write_no_eol_lnum = read_no_eol_lnum;
673  
674 -    if (!read_stdin && !read_buffer)
675 +    if (!read_stdin && !read_buffer && !read_pstream)
676      {
677         int m = msg_scroll;
678         int n = msg_scrolled;
679 @@ -2608,6 +2628,11 @@
680      int                    prev_got_int = got_int;
681      int                    file_readonly = FALSE;  /* overwritten file is read-only */
682      static char            *err_readonly = "is read-only (cannot override: \"W\" in 'cpoptions')";
683 +#if defined(FEAT_GUI_COMPONENT) && defined(FEAT_GUI_GNOME)
684 +    int                    write_pstream = write_to_container;
685 +#else
686 +#define write_pstream 0
687 +#endif
688  #if defined(UNIX) || defined(__EMX__XX)            /*XXX fix me sometime? */
689      int                    made_writable = FALSE;  /* 'w' bit has been set */
690  #endif
691 @@ -2984,7 +3009,7 @@
692      }
693  #endif /* !UNIX */
694  
695 -    if (!device && !newfile)
696 +    if (!device && !newfile && !write_pstream )
697      {
698         /*
699          * Check if the file is really writable (when renaming the file to
700 @@ -3043,6 +3068,10 @@
701      if (dobackup && *p_bsk != NUL && match_file_list(p_bsk, sfname, ffname))
702         dobackup = FALSE;
703  #endif
704 +#ifdef FEAT_GUI_COMPONENT
705 +    if( write_pstream )
706 +        dobackup = FALSE;
707 +#endif
708  
709      /*
710       * Save the value of got_int and reset it.  We don't want a previous
711 @@ -3695,95 +3724,97 @@
712       * (this may happen when the user reached his quotum for number of files).
713       * Appending will fail if the file does not exist and forceit is FALSE.
714       */
715 -    while ((fd = mch_open((char *)wfname, O_WRONLY | O_EXTRA | (append
716 -                       ? (forceit ? (O_APPEND | O_CREAT) : O_APPEND)
717 -                       : (O_CREAT | O_TRUNC))
718 -                       , perm < 0 ? 0666 : (perm & 0777))) < 0)
719 -    {
720 -       /*
721 -        * A forced write will try to create a new file if the old one is
722 -        * still readonly. This may also happen when the directory is
723 -        * read-only. In that case the mch_remove() will fail.
724 -        */
725 -       if (errmsg == NULL)
726 +    if (!write_pstream) {
727 +       while ((fd = mch_open((char *)wfname, O_WRONLY | O_EXTRA | (append
728 +                           ? (forceit ? (O_APPEND | O_CREAT) : O_APPEND)
729 +                           : (O_CREAT | O_TRUNC))
730 +                           , perm < 0 ? 0666 : (perm & 0777))) < 0)
731         {
732 +           /*
733 +            * A forced write will try to create a new file if the old one is
734 +            * still readonly. This may also happen when the directory is
735 +            * read-only. In that case the mch_remove() will fail.
736 +            */
737 +           if (errmsg == NULL)
738 +           {
739  #ifdef UNIX
740 -           struct stat st;
741 +               struct stat     st;
742  
743 -           /* Don't delete the file when it's a hard or symbolic link. */
744 -           if ((!newfile && st_old.st_nlink > 1)
745 -                   || (mch_lstat((char *)fname, &st) == 0
746 -                       && (st.st_dev != st_old.st_dev
747 -                           || st.st_ino != st_old.st_ino)))
748 -               errmsg = (char_u *)_("E166: Can't open linked file for writing");
749 -           else
750 +               /* Don't delete the file when it's a hard or symbolic link. */
751 +               if ((!newfile && st_old.st_nlink > 1)
752 +                       || (mch_lstat((char *)fname, &st) == 0
753 +                           && (st.st_dev != st_old.st_dev
754 +                               || st.st_ino != st_old.st_ino)))
755 +                   errmsg = (char_u *)_("E166: Can't open linked file for writing");
756 +               else
757  #endif
758 -           {
759 -               errmsg = (char_u *)_("E212: Can't open file for writing");
760 -               if (forceit && vim_strchr(p_cpo, CPO_FWRITE) == NULL
761 -                                                                && perm >= 0)
762                 {
763 +                   errmsg = (char_u *)_("E212: Can't open file for writing");
764 +                   if (forceit && vim_strchr(p_cpo, CPO_FWRITE) == NULL
765 +                                                                    && perm >= 0)
766 +                   {
767  #ifdef UNIX
768 -                   /* we write to the file, thus it should be marked
769 -                      writable after all */
770 -                   if (!(perm & 0200))
771 -                       made_writable = TRUE;
772 -                   perm |= 0200;
773 -                   if (st_old.st_uid != getuid() || st_old.st_gid != getgid())
774 -                       perm &= 0777;
775 +                       /* we write to the file, thus it should be marked
776 +                          writable after all */
777 +                       if (!(perm & 0200))
778 +                           made_writable = TRUE;
779 +                       perm |= 0200;
780 +                       if (st_old.st_uid != getuid() || st_old.st_gid != getgid())
781 +                           perm &= 0777;
782  #endif
783 -                   if (!append)            /* don't remove when appending */
784 -                       mch_remove(wfname);
785 -                   continue;
786 +                       if (!append)        /* don't remove when appending */
787 +                           mch_remove(wfname);
788 +                       continue;
789 +                   }
790                 }
791             }
792 -       }
793 -
794 -restore_backup:
795 -       {
796 -           struct stat st;
797  
798 -           /*
799 -            * If we failed to open the file, we don't need a backup. Throw it
800 -            * away.  If we moved or removed the original file try to put the
801 -            * backup in its place.
802 -            */
803 -           if (backup != NULL && wfname == fname)
804 +    restore_backup:
805             {
806 -               if (backup_copy)
807 +               struct stat st;
808 +
809 +               /*
810 +                * If we failed to open the file, we don't need a backup. Throw it
811 +                * away.  If we moved or removed the original file try to put the
812 +                * backup in its place.
813 +                */
814 +               if (backup != NULL && wfname == fname)
815                 {
816 -                   /*
817 -                    * There is a small chance that we removed the original,
818 -                    * try to move the copy in its place.
819 -                    * This may not work if the vim_rename() fails.
820 -                    * In that case we leave the copy around.
821 -                    */
822 -                   /* If file does not exist, put the copy in its place */
823 -                   if (mch_stat((char *)fname, &st) < 0)
824 +                   if (backup_copy)
825 +                   {
826 +                       /*
827 +                        * There is a small chance that we removed the original,
828 +                        * try to move the copy in its place.
829 +                        * This may not work if the vim_rename() fails.
830 +                        * In that case we leave the copy around.
831 +                        */
832 +                       /* If file does not exist, put the copy in its place */
833 +                       if (mch_stat((char *)fname, &st) < 0)
834 +                           vim_rename(backup, fname);
835 +                       /* if original file does exist throw away the copy */
836 +                       if (mch_stat((char *)fname, &st) >= 0)
837 +                           mch_remove(backup);
838 +                   }
839 +                   else
840 +                   {
841 +                       /* try to put the original file back */
842                         vim_rename(backup, fname);
843 -                   /* if original file does exist throw away the copy */
844 -                   if (mch_stat((char *)fname, &st) >= 0)
845 -                       mch_remove(backup);
846 -               }
847 -               else
848 -               {
849 -                   /* try to put the original file back */
850 -                   vim_rename(backup, fname);
851 +                   }
852                 }
853 -           }
854  
855 -           /* if original file no longer exists give an extra warning */
856 -           if (!newfile && mch_stat((char *)fname, &st) < 0)
857 -               end = 0;
858 -       }
859 +               /* if original file no longer exists give an extra warning */
860 +               if (!newfile && mch_stat((char *)fname, &st) < 0)
861 +                   end = 0;
862 +           }
863  
864  #ifdef FEAT_MBYTE
865 -       if (wfname != fname)
866 -           vim_free(wfname);
867 +           if (wfname != fname)
868 +               vim_free(wfname);
869  #endif
870 -       goto fail;
871 +           goto fail;
872 +       }
873 +       errmsg = NULL;
874      }
875 -    errmsg = NULL;
876  
877  #if defined(MACOS_CLASSIC) || defined(WIN3264)
878      /* TODO: Is it need for MACOS_X? (Dany) */
879 @@ -3999,7 +4030,7 @@
880      }
881  #endif
882  
883 -    if (close(fd) != 0)
884 +    if (!write_pstream && close(fd) != 0)
885      {
886         errmsg = (char_u *)_("E512: Close failed");
887         end = 0;
888 @@ -4415,6 +4446,10 @@
889      buf_T      *buf;
890      char_u     *fname;
891  {
892 +#ifdef FEAT_GUI_COMPONENT
893 +    if (buf->emb_buffer)
894 +        fname = (char_u *)"[Embedded File]";
895 +#endif
896      if (fname == NULL)
897         fname = (char_u *)"-stdin-";
898      home_replace(buf, fname, IObuff + 1, IOSIZE - 4, TRUE);
899 @@ -4939,7 +4974,12 @@
900      /* Repeat the write(), it may be interrupted by a signal. */
901      while (len)
902      {
903 -       wlen = vim_write(ip->bw_fd, buf, len);
904 +#if defined(FEAT_GUI_COMPONENT) && defined(FEAT_GUI_GNOME)
905 +        if( write_to_container )
906 +            wlen = vim_control_persist_stream_write(buf, len);
907 +        else
908 +#endif
909 +            wlen = vim_write(ip->bw_fd, buf, len);
910         if (wlen <= 0)              /* error! */
911             return FAIL;
912         len -= wlen;
913 @@ -6672,6 +6712,7 @@
914      {"BufWriteCmd",    EVENT_BUFWRITECMD},
915      {"CmdwinEnter",    EVENT_CMDWINENTER},
916      {"CmdwinLeave",    EVENT_CMDWINLEAVE},
917 +    {"EmbeddingOn",    EVENT_EMBEDDED_COMPONENT},
918      {"EncodingChanged",        EVENT_ENCODINGCHANGED},
919      {"FileEncoding",   EVENT_ENCODINGCHANGED},
920      {"CursorHold",     EVENT_CURSORHOLD},
921 diff -Nur vim63/src/globals.h vim63-bonobo/src/globals.h
922 --- vim63/src/globals.h 2005-09-09 20:11:10.559759000 +0200
923 +++ vim63-bonobo/src/globals.h  2005-09-09 20:14:02.721586520 +0200
924 @@ -837,6 +837,12 @@
925  EXTERN int     readonlymode INIT(= FALSE); /* Set to TRUE for "view" */
926  EXTERN int     recoverymode INIT(= FALSE); /* Set to TRUE for "-r" option */
927  
928 +#ifdef FEAT_GUI_COMPONENT
929 +EXTERN int      read_from_container INIT(= 0); /* read the buffer from the container app */
930 +EXTERN int      write_to_container INIT(= 0); /* write the buffer to the container app */
931 +EXTERN buf_T    *persistent_buffer INIT(= NULL); /* the buffer which the container is interested in */
932 +#endif
933 +
934  EXTERN struct buffheader stuffbuff     /* stuff buffer */
935  #ifdef DO_INIT
936                     = {{NULL, {NUL}}, NULL, 0, 0}
937 @@ -1363,6 +1369,9 @@
938  #ifdef FEAT_NETBEANS_INTG
939  EXTERN char_u e_guarded[]      INIT(=N_("E463: Region is guarded, cannot modify"));
940  #endif
941 +#ifdef FEAT_GUI_COMPONENT
942 +EXTERN char_u e_compnoquit[]   INIT(=N_("E464: Quit not allowed from embedded component"));
943 +#endif
944  #ifdef MACOS_X_UNIX
945  EXTERN short disallow_gui      INIT(= FALSE);
946  #endif
947 diff -Nur vim63/src/gtkhtml_editor.c vim63-bonobo/src/gtkhtml_editor.c
948 --- vim63/src/gtkhtml_editor.c  1970-01-01 01:00:00.000000000 +0100
949 +++ vim63-bonobo/src/gtkhtml_editor.c   2005-09-09 20:14:02.726585760 +0200
950 @@ -0,0 +1,385 @@
951 +#include "vim.h"
952 +
953 +#include <bonobo.h>
954 +#include "gtkhtml_editor.h"
955 +
956 +static BonoboObjectClass *engine_parent_class;
957 +
958 +inline static EditorEngine *
959 +gtkhtml_editor_engine_from_servant (PortableServer_Servant servant)
960 +{
961 +       return EDITOR_ENGINE (bonobo_object_from_servant (servant));
962 +}
963 +
964 +static CORBA_char *
965 +impl_get_paragraph_data (PortableServer_Servant servant, const CORBA_char * key, CORBA_Environment * ev)
966 +{
967 +       EditorEngine *e = gtkhtml_editor_engine_from_servant (servant);
968 +}
969 +
970 +static void
971 +impl_set_paragraph_data (PortableServer_Servant servant,
972 +                        const CORBA_char * key, const CORBA_char * value,
973 +                        CORBA_Environment * ev)
974 +{
975 +       EditorEngine *e = gtkhtml_editor_engine_from_servant (servant);
976 +}
977 +
978 +static void
979 +impl_set_object_data_by_type (PortableServer_Servant servant,
980 +                        const CORBA_char * type_name, const CORBA_char * key, const CORBA_char * value,
981 +                        CORBA_Environment * ev)
982 +{
983 +       EditorEngine *e = gtkhtml_editor_engine_from_servant (servant);
984 +}
985 +
986 +static void
987 +impl_set_listener (PortableServer_Servant servant, const GNOME_GtkHTML_Editor_Listener value, CORBA_Environment * ev)
988 +{
989 +       EditorEngine *e = gtkhtml_editor_engine_from_servant (servant);
990 +
991 +       bonobo_object_release_unref (e->listener, NULL);
992 +       e->listener        = bonobo_object_dup_ref (value, NULL);
993 +}
994 +
995 +static GNOME_GtkHTML_Editor_Listener
996 +impl_get_listener (PortableServer_Servant servant, CORBA_Environment * ev)
997 +{
998 +       return gtkhtml_editor_engine_from_servant (servant)->listener;
999 +}
1000 +
1001 +
1002 +
1003 +static CORBA_boolean
1004 +impl_run_command (PortableServer_Servant servant, const CORBA_char * command, CORBA_Environment * ev)
1005 +{
1006 +       EditorEngine *e = gtkhtml_editor_engine_from_servant (servant);
1007 +       printf ("command: %s\n", command);
1008 +    CORBA_boolean retval = CORBA_TRUE;
1009 +    int save_p_report = p_report;
1010 +
1011 +    p_report = 1000;
1012 +
1013 +    aco_save_T aco;
1014 +    aucmd_prepbuf(&aco, persistent_buffer);
1015 +
1016 +    if( strcmp( command, "cursor-position-save" ) == 0 ) {
1017 +        do_cmdline_cmd("normal mz");
1018 +    } else if( strcmp( command, "cursor-position-restore" ) == 0 ) {
1019 +        do_cmdline_cmd("normal 'z");
1020 +        update_screen(CLEAR);
1021 +        gui_update_cursor(TRUE, FALSE);
1022 +    } else if( strcmp( command, "cursor-bod" ) == 0 ) {
1023 +        do_cmdline_cmd("normal G");
1024 +    } else if( strcmp( command, "select-paragraph" ) == 0 ) {
1025 +        do_cmdline_cmd("normal V}");
1026 +    } else if( strcmp( command, "delete" ) == 0 ) {
1027 +        do_cmdline_cmd("normal d");
1028 +    } else if( strcmp( command, "is-saved" ) == 0 ) {
1029 +        retval = !persistent_buffer->b_changed;
1030 +    } else if( strcmp( command, "insert-paragraph" ) == 0 ) {
1031 +        do_cmdline_cmd("normal o");
1032 +    }
1033 +    aucmd_restbuf(&aco);
1034 +    p_report = save_p_report;
1035 +       return retval;
1036 +}
1037 +
1038 +static CORBA_boolean
1039 +impl_is_paragraph_empty (PortableServer_Servant servant, CORBA_Environment * ev)
1040 +{
1041 +       EditorEngine *e = gtkhtml_editor_engine_from_servant (servant);
1042 +       return CORBA_FALSE;
1043 +}
1044 +
1045 +static CORBA_boolean
1046 +impl_is_previous_paragraph_empty (PortableServer_Servant servant, CORBA_Environment * ev)
1047 +{
1048 +       EditorEngine *e = gtkhtml_editor_engine_from_servant (servant);
1049 +       return CORBA_FALSE;
1050 +}
1051 +
1052 +struct keyvalue {
1053 +    char * key;
1054 +    char * value;
1055 +    char mark;
1056 +};
1057 +
1058 +static GSList * keylist = NULL;
1059 +static char free_mark = 'y';
1060 +
1061 +static void set_mark_at_cursor( char * key, char * value ) 
1062 +{
1063 +    char cmd[5];
1064 +    struct keyvalue * kv = NULL;
1065 +    GSList * node = keylist;
1066 +    while( node != NULL ) {
1067 +        kv = node->data; 
1068 +        if( strcmp( kv->key, key ) == 0 && strcmp( kv->value, value ) == 0 ) {
1069 +            break;
1070 +        }
1071 +        node = node->next;
1072 +    }
1073 +    if( kv == NULL ) {
1074 +        kv = g_new0( struct keyvalue, 1 );
1075 +        kv->key = g_strdup( key );
1076 +        kv->value = g_strdup( value );
1077 +
1078 +        kv->mark = free_mark;
1079 +        free_mark -= 1;
1080 +        keylist = g_slist_prepend( keylist, kv );
1081 +    }
1082 +
1083 +    setmark(kv->mark);
1084 +}
1085 +
1086 +static void
1087 +impl_insert_html (PortableServer_Servant servant, const CORBA_char * html, CORBA_Environment * ev)
1088 +{
1089 +       EditorEngine *e = gtkhtml_editor_engine_from_servant (servant);
1090 +    const char * c;
1091 +    const char * s;
1092 +    char * d;
1093 +    int level = 0;
1094 +    gboolean in_data = 0;
1095 +    char key[50];
1096 +    char value[50];
1097 +    char cmd[50];
1098 +    gchar **lines;
1099 +    int curline;
1100 +    int begin;
1101 +    int i;
1102 +
1103 +       g_warning("insert html: \"%s\"", html ); 
1104 +    
1105 +    aco_save_T aco;
1106 +    aucmd_prepbuf(&aco, persistent_buffer);
1107 +
1108 +    // This gets a bit ugly...
1109 +    // Look for DATA tags with KEY and VALUE attributes.  We set a mark
1110 +    // in vim on the first line of the inserted HTML if one of these tags is present
1111 +    // (we assume that they occur at the beginning of the inserted paragraph).
1112 +    // we also assume that only one of these sequences will occur in the html.
1113 +    strcpy( key, "" );
1114 +    strcpy( value, "" );
1115 +    for( c = html; *c != '\0'; c++ ) {
1116 +        if( *c == '<' ) {
1117 +            level += 1;
1118 +            if( strncmp( c, "<DATA", 5 ) == 0 ) {
1119 +                in_data = TRUE;
1120 +            }
1121 +        } else if( *c == '>' ) {
1122 +            level -= 1;
1123 +            if( in_data ) {
1124 +                if( *key && *value ) {
1125 +                    g_warning( "got key=%s and value=%s", key, value );
1126 +                }
1127 +                in_data = FALSE;
1128 +            }
1129 +        } else if( in_data && strncmp( c, "key=", 4 ) == 0 ) {
1130 +            // extract the key
1131 +            d = key;
1132 +            for( s = &c[4]; *s != '\"'; s++ );
1133 +            s++;
1134 +            for( ; *s != '\"'; s++ ) {
1135 +                *d++ = *s; 
1136 +            }
1137 +            *d = '\0';
1138 +        } else if( in_data && strncmp( c, "value=", 6 ) == 0 ) {
1139 +            // extract the value
1140 +            d = value;
1141 +            for( s = &c[4]; *s != '\"'; s++ );
1142 +            s++;
1143 +            for( ; *s != '\"'; s++ ) {
1144 +                *d++ = *s; 
1145 +            }
1146 +            *d = '\0';
1147 +        }
1148 +    }
1149 +
1150 +    /* insert the html into the buffer, remembering the starting line */
1151 +    begin = curwin->w_cursor.lnum;
1152 +    curline = begin;
1153 +    lines = g_strsplit(html, "\n", 0);
1154 +    for(i = 0; lines[i]; i += 1) {
1155 +        ml_append(curline, lines[i], strlen(html) + 1, FALSE); 
1156 +        appended_lines_mark(curwin->w_cursor.lnum, 1);
1157 +        curline += 1;
1158 +    }
1159 +    g_strfreev(lines);
1160 +
1161 +    /* run a filter to obtain plain text from the html */
1162 +    vim_bonobo_call_begin();
1163 +    g_snprintf( cmd, 50, "%d,%d!html2text -nobs", begin, curline);
1164 +    do_cmdline_cmd(cmd);
1165 +    vim_bonobo_call_end();
1166 +    if( *key && *value ) {
1167 +        set_mark_at_cursor( key, value );
1168 +    }
1169 +    aucmd_restbuf(&aco);
1170 +}
1171 +
1172 +static CORBA_boolean
1173 +impl_search_by_data (PortableServer_Servant servant, const CORBA_long level, const CORBA_char * klass,
1174 +                    const CORBA_char * key, const CORBA_char * value, CORBA_Environment * ev)
1175 +{
1176 +       EditorEngine *e = gtkhtml_editor_engine_from_servant (servant);
1177 +
1178 +    GSList * node = keylist;
1179 +    struct keyvalue * kv = NULL;
1180 +    char cmd[15];
1181 +    char * data;
1182 +    aco_save_T aco;
1183 +    int retval = FALSE;
1184 +
1185 +    aucmd_prepbuf(&aco, persistent_buffer);
1186 +
1187 +       g_warning("search by data: key=\"%s\" value=\"%s\"", key, value ); 
1188 +    while( node != NULL ) {
1189 +        kv = node->data; 
1190 +        if( strcmp( kv->key, key ) == 0 && strcmp( kv->value, value ) == 0 ) {
1191 +            break;
1192 +        }
1193 +        node = node->next;
1194 +    }
1195 +    if( kv != NULL ) {
1196 +        pos_T *pos;
1197 +
1198 +        pos = getmark(kv->mark, FALSE);
1199 +        if( pos->lnum != 0 ) {
1200 +            /* jump to the mark in the text */
1201 +            g_snprintf( cmd, 15, "normal '%c", kv->mark );
1202 +            do_cmdline_cmd( cmd );
1203 +            g_warning( "Found key!" );
1204 +            retval = TRUE;
1205 +        } else {
1206 +            g_warning( "Key not found" );
1207 +            // mark not found.  Delete it from our list.
1208 +            g_free( kv->key );
1209 +            g_free( kv->value );
1210 +            g_free( kv );
1211 +            keylist = g_slist_remove( keylist, kv );
1212 +        }
1213 +    }
1214 +    aucmd_restbuf(&aco);
1215 +       return retval;
1216 +}
1217 +
1218 +static void
1219 +impl_freeze (PortableServer_Servant servant, CORBA_Environment * ev)
1220 +{
1221 +}
1222 +
1223 +static void
1224 +impl_thaw (PortableServer_Servant servant, CORBA_Environment * ev)
1225 +{
1226 +}
1227 +
1228 +static void
1229 +impl_undo_begin (PortableServer_Servant servant, const CORBA_char * undo_name, const CORBA_char * redo_name,
1230 +                CORBA_Environment * ev)
1231 +{
1232 +}
1233 +
1234 +static void
1235 +impl_undo_end (PortableServer_Servant servant, CORBA_Environment * ev)
1236 +{
1237 +}
1238 +
1239 +static void
1240 +impl_ignore_word (PortableServer_Servant servant, const CORBA_char * word, CORBA_Environment * ev)
1241 +{
1242 +       EditorEngine *e = gtkhtml_editor_engine_from_servant (servant);
1243 +}
1244 +
1245 +/* Return whether we have any undos. */
1246 +static CORBA_boolean
1247 +impl_has_undo (PortableServer_Servant servant, CORBA_Environment * ev)
1248 +{
1249 +    u_header_T *curhead;
1250 +       EditorEngine *e = gtkhtml_editor_engine_from_servant (servant);
1251 +
1252 +    if( !persistent_buffer) {
1253 +        return CORBA_FALSE;
1254 +    }
1255 +    /* this logic comes from undo.c */
1256 +    curhead = persistent_buffer->b_u_curhead;
1257 +    if (persistent_buffer->b_u_curhead == NULL) {              /* first undo */
1258 +               curhead = persistent_buffer->b_u_newhead;
1259 +    } else if (p_ul > 0) {                     /* multi level undo */ 
1260 +               curhead = persistent_buffer->b_u_curhead->uh_next;
1261 +    }
1262 +    if (curbuf->b_u_numhead == 0 || curhead == NULL) {
1263 +        return CORBA_FALSE;
1264 +    }
1265 +    return CORBA_TRUE;
1266 +}
1267 +
1268 +static void
1269 +impl_drop_undo (PortableServer_Servant servant, CORBA_Environment * ev)
1270 +{
1271 +       EditorEngine *e = gtkhtml_editor_engine_from_servant (servant);
1272 +       printf ("dropUndo\n");
1273 +}
1274 +
1275 +static void
1276 +engine_object_finalize (GObject *object)
1277 +{
1278 +       EditorEngine *e = EDITOR_ENGINE (object);
1279 +
1280 +       bonobo_object_release_unref (e->listener, NULL);
1281 +
1282 +       G_OBJECT_CLASS (engine_parent_class)->finalize (object);
1283 +}
1284 +
1285 +static void
1286 +editor_engine_init (GObject *object)
1287 +{
1288 +       EditorEngine *e = EDITOR_ENGINE (object);
1289 +
1290 +       e->listener = CORBA_OBJECT_NIL;
1291 +}
1292 +
1293 +static void
1294 +editor_engine_class_init (EditorEngineClass *klass)
1295 +{
1296 +       GObjectClass *object_class = G_OBJECT_CLASS (klass);
1297 +       POA_GNOME_GtkHTML_Editor_Engine__epv *epv = &klass->epv;
1298 +
1299 +       engine_parent_class = g_type_class_peek_parent (klass);
1300 +       object_class->finalize = engine_object_finalize;
1301 +
1302 +       epv->_set_listener            = impl_set_listener;
1303 +       epv->_get_listener            = impl_get_listener;
1304 +       epv->setParagraphData         = impl_set_paragraph_data;
1305 +       epv->getParagraphData         = impl_get_paragraph_data;
1306 +       epv->setObjectDataByType      = impl_set_object_data_by_type;
1307 +       epv->runCommand               = impl_run_command;
1308 +       epv->isParagraphEmpty         = impl_is_paragraph_empty;
1309 +       epv->isPreviousParagraphEmpty = impl_is_previous_paragraph_empty;
1310 +       epv->searchByData             = impl_search_by_data;
1311 +       epv->insertHTML               = impl_insert_html;
1312 +       epv->freeze                   = impl_freeze;
1313 +       epv->thaw                     = impl_thaw;
1314 +       epv->undoBegin                = impl_undo_begin;
1315 +       epv->undoEnd                  = impl_undo_end;
1316 +       epv->ignoreWord               = impl_ignore_word;
1317 +       epv->hasUndo                  = impl_has_undo;
1318 +       epv->dropUndo                 = impl_drop_undo;
1319 +}
1320 +
1321 +BONOBO_TYPE_FUNC_FULL (
1322 +       EditorEngine,                  /* Glib class name */
1323 +       GNOME_GtkHTML_Editor_Engine,   /* CORBA interface name */
1324 +       BONOBO_TYPE_OBJECT,            /* parent type */
1325 +       editor_engine);                /* local prefix ie. 'echo'_class_init */
1326 +
1327 +EditorEngine *
1328 +editor_engine_new (void)
1329 +{
1330 +       EditorEngine *ee;
1331 +
1332 +       ee = g_object_new (EDITOR_ENGINE_TYPE, NULL);
1333 +
1334 +       return ee;
1335 +}
1336 diff -Nur vim63/src/gtkhtml_editor_common.c vim63-bonobo/src/gtkhtml_editor_common.c
1337 --- vim63/src/gtkhtml_editor_common.c   1970-01-01 01:00:00.000000000 +0100
1338 +++ vim63-bonobo/src/gtkhtml_editor_common.c    2005-09-09 20:14:02.727585608 +0200
1339 @@ -0,0 +1,306 @@
1340 +/*
1341 + * This file was generated by orbit-idl-2 - DO NOT EDIT!
1342 + */
1343 +
1344 +#include <string.h>
1345 +#define ORBIT2_STUBS_API
1346 +#define ORBIT_IDL_C_COMMON
1347 +#define Editor_COMMON
1348 +#include "gtkhtml.h"
1349 +
1350 +static const CORBA_unsigned_long ORBit_zero_int = 0;
1351 +
1352 +#if ( (TC_IMPL_TC_GNOME_GtkHTML_Editor_Listener_0 == 'E') \
1353 +&& (TC_IMPL_TC_GNOME_GtkHTML_Editor_Listener_1 == 'd') \
1354 +&& (TC_IMPL_TC_GNOME_GtkHTML_Editor_Listener_2 == 'i') \
1355 +&& (TC_IMPL_TC_GNOME_GtkHTML_Editor_Listener_3 == 't') \
1356 +&& (TC_IMPL_TC_GNOME_GtkHTML_Editor_Listener_4 == 'o') \
1357 +&& (TC_IMPL_TC_GNOME_GtkHTML_Editor_Listener_5 == 'r') \
1358 +) && !defined(TC_DEF_TC_GNOME_GtkHTML_Editor_Listener)
1359 +#define TC_DEF_TC_GNOME_GtkHTML_Editor_Listener 1
1360 +#ifdef ORBIT_IDL_C_IMODULE_Editor
1361 +static
1362 +#endif
1363 +const struct CORBA_TypeCode_struct TC_GNOME_GtkHTML_Editor_Listener_struct = {
1364 +   {&ORBit_TypeCode_epv, ORBIT_REFCOUNT_STATIC},
1365 +   CORBA_tk_objref,
1366 +   0,
1367 +   0,
1368 +   ORBIT_ALIGNOF_CORBA_POINTER,
1369 +   0,
1370 +   0,
1371 +   NULL,
1372 +   CORBA_OBJECT_NIL,
1373 +   "Listener",
1374 +   "IDL:GNOME/GtkHTML/Editor/Listener:1.0",
1375 +   NULL,
1376 +   NULL,
1377 +   -1,
1378 +   0,
1379 +   0, 0
1380 +};
1381 +#endif
1382 +#if ( (TC_IMPL_TC_GNOME_GtkHTML_Editor_Engine_0 == 'E') \
1383 +&& (TC_IMPL_TC_GNOME_GtkHTML_Editor_Engine_1 == 'd') \
1384 +&& (TC_IMPL_TC_GNOME_GtkHTML_Editor_Engine_2 == 'i') \
1385 +&& (TC_IMPL_TC_GNOME_GtkHTML_Editor_Engine_3 == 't') \
1386 +&& (TC_IMPL_TC_GNOME_GtkHTML_Editor_Engine_4 == 'o') \
1387 +&& (TC_IMPL_TC_GNOME_GtkHTML_Editor_Engine_5 == 'r') \
1388 +) && !defined(TC_DEF_TC_GNOME_GtkHTML_Editor_Engine)
1389 +#define TC_DEF_TC_GNOME_GtkHTML_Editor_Engine 1
1390 +#ifdef ORBIT_IDL_C_IMODULE_Editor
1391 +static
1392 +#endif
1393 +const struct CORBA_TypeCode_struct TC_GNOME_GtkHTML_Editor_Engine_struct = {
1394 +   {&ORBit_TypeCode_epv, ORBIT_REFCOUNT_STATIC},
1395 +   CORBA_tk_objref,
1396 +   0,
1397 +   0,
1398 +   ORBIT_ALIGNOF_CORBA_POINTER,
1399 +   0,
1400 +   0,
1401 +   NULL,
1402 +   CORBA_OBJECT_NIL,
1403 +   "Engine",
1404 +   "IDL:GNOME/GtkHTML/Editor/Engine:1.0",
1405 +   NULL,
1406 +   NULL,
1407 +   -1,
1408 +   0,
1409 +   0, 0
1410 +};
1411 +#endif
1412 +#if ( (TC_IMPL_TC_GNOME_GtkHTML_Editor_URLRequestEvent_0 == 'E') \
1413 +&& (TC_IMPL_TC_GNOME_GtkHTML_Editor_URLRequestEvent_1 == 'd') \
1414 +&& (TC_IMPL_TC_GNOME_GtkHTML_Editor_URLRequestEvent_2 == 'i') \
1415 +&& (TC_IMPL_TC_GNOME_GtkHTML_Editor_URLRequestEvent_3 == 't') \
1416 +&& (TC_IMPL_TC_GNOME_GtkHTML_Editor_URLRequestEvent_4 == 'o') \
1417 +&& (TC_IMPL_TC_GNOME_GtkHTML_Editor_URLRequestEvent_5 == 'r') \
1418 +) && !defined(TC_DEF_TC_GNOME_GtkHTML_Editor_URLRequestEvent)
1419 +#define TC_DEF_TC_GNOME_GtkHTML_Editor_URLRequestEvent 1
1420 +static const char *anon_subnames_array6[] = { "url", "stream" };
1421 +static const CORBA_TypeCode anon_subtypes_array7[] =
1422 +   { (CORBA_TypeCode) & TC_CORBA_string_struct,
1423 +      (CORBA_TypeCode) & TC_Bonobo_Stream_struct };
1424 +
1425 +#ifdef ORBIT_IDL_C_IMODULE_Editor
1426 +static
1427 +#endif
1428 +const struct CORBA_TypeCode_struct
1429 +   TC_GNOME_GtkHTML_Editor_URLRequestEvent_struct = {
1430 +   {&ORBit_TypeCode_epv, ORBIT_REFCOUNT_STATIC},
1431 +   CORBA_tk_struct,
1432 +   0,
1433 +   0,
1434 +   ORBIT_ALIGNOF_CORBA_POINTER,
1435 +   0,
1436 +   2,
1437 +   (CORBA_TypeCode *) anon_subtypes_array7,
1438 +   CORBA_OBJECT_NIL,
1439 +   "URLRequestEvent",
1440 +   "IDL:GNOME/GtkHTML/Editor/URLRequestEvent:1.0",
1441 +   (char **) anon_subnames_array6,
1442 +   NULL,
1443 +   -1,
1444 +   0,
1445 +   0, 0
1446 +};
1447 +#endif
1448 +
1449 +#ifndef ORBIT_IDL_C_IMODULE_Editor
1450 +CORBA_unsigned_long GNOME_GtkHTML_Editor_Listener__classid = 0;
1451 +#endif
1452 +
1453 +#ifndef ORBIT_IDL_C_IMODULE_Editor
1454 +CORBA_unsigned_long GNOME_GtkHTML_Editor_Engine__classid = 0;
1455 +#endif
1456 +
1457 +/* Interface type data */
1458 +
1459 +static ORBit_IArg GNOME_GtkHTML_Editor_Listener_event__arginfo[] = {
1460 +   {TC_CORBA_string, ORBit_I_ARG_IN, "name"},
1461 +   {TC_CORBA_any, ORBit_I_ARG_IN, "arg"}
1462 +};
1463 +
1464 +#ifdef ORBIT_IDL_C_IMODULE_Editor
1465 +static
1466 +#endif
1467 +ORBit_IMethod GNOME_GtkHTML_Editor_Listener__imethods[] = {
1468 +   {
1469 +    {2, 2, GNOME_GtkHTML_Editor_Listener_event__arginfo, FALSE},
1470 +    {0, 0, NULL, FALSE},
1471 +    {0, 0, NULL, FALSE},
1472 +    TC_CORBA_any, "event", 5,
1473 +    0}
1474 +};
1475 +static CORBA_string GNOME_GtkHTML_Editor_Listener__base_itypes[] = {
1476 +   "IDL:Bonobo/Unknown:1.0",
1477 +   "IDL:omg.org/CORBA/Object:1.0"
1478 +};
1479 +
1480 +#ifdef ORBIT_IDL_C_IMODULE_Editor
1481 +static
1482 +#endif
1483 +ORBit_IInterface GNOME_GtkHTML_Editor_Listener__iinterface = {
1484 +   TC_GNOME_GtkHTML_Editor_Listener, {1, 1,
1485 +                                     GNOME_GtkHTML_Editor_Listener__imethods,
1486 +                                     FALSE},
1487 +   {2, 2, GNOME_GtkHTML_Editor_Listener__base_itypes, FALSE}
1488 +};
1489 +
1490 +static ORBit_IArg GNOME_GtkHTML_Editor_Engine__set_listener__arginfo[] = {
1491 +   {TC_GNOME_GtkHTML_Editor_Listener, ORBit_I_ARG_IN, "value"}
1492 +};
1493 +static ORBit_IArg GNOME_GtkHTML_Editor_Engine_runCommand__arginfo[] = {
1494 +   {TC_CORBA_string, ORBit_I_ARG_IN, "command"}
1495 +};
1496 +static ORBit_IArg GNOME_GtkHTML_Editor_Engine_getParagraphData__arginfo[] = {
1497 +   {TC_CORBA_string, ORBit_I_ARG_IN, "key"}
1498 +};
1499 +static ORBit_IArg GNOME_GtkHTML_Editor_Engine_setParagraphData__arginfo[] = {
1500 +   {TC_CORBA_string, ORBit_I_ARG_IN, "key"},
1501 +   {TC_CORBA_string, ORBit_I_ARG_IN, "value"}
1502 +};
1503 +static ORBit_IArg GNOME_GtkHTML_Editor_Engine_setObjectDataByType__arginfo[] = {
1504 +   {TC_CORBA_string, ORBit_I_ARG_IN, "type_name"},
1505 +   {TC_CORBA_string, ORBit_I_ARG_IN, "key"},
1506 +   {TC_CORBA_string, ORBit_I_ARG_IN, "data"}
1507 +};
1508 +static ORBit_IArg GNOME_GtkHTML_Editor_Engine_searchByData__arginfo[] = {
1509 +   {TC_CORBA_long, ORBit_I_ARG_IN | ORBit_I_COMMON_FIXED_SIZE, "level"},
1510 +   {TC_CORBA_string, ORBit_I_ARG_IN, "klass"},
1511 +   {TC_CORBA_string, ORBit_I_ARG_IN, "key"},
1512 +   {TC_CORBA_string, ORBit_I_ARG_IN, "value"}
1513 +};
1514 +static ORBit_IArg GNOME_GtkHTML_Editor_Engine_insertHTML__arginfo[] = {
1515 +   {TC_CORBA_string, ORBit_I_ARG_IN, "html"}
1516 +};
1517 +static ORBit_IArg GNOME_GtkHTML_Editor_Engine_undoBegin__arginfo[] = {
1518 +   {TC_CORBA_string, ORBit_I_ARG_IN, "undo_name"},
1519 +   {TC_CORBA_string, ORBit_I_ARG_IN, "redo_name"}
1520 +};
1521 +static ORBit_IArg GNOME_GtkHTML_Editor_Engine_ignoreWord__arginfo[] = {
1522 +   {TC_CORBA_string, ORBit_I_ARG_IN, "word"}
1523 +};
1524 +
1525 +#ifdef ORBIT_IDL_C_IMODULE_Editor
1526 +static
1527 +#endif
1528 +ORBit_IMethod GNOME_GtkHTML_Editor_Engine__imethods[] = {
1529 +   {
1530 +    {0, 0, NULL, FALSE},
1531 +    {0, 0, NULL, FALSE},
1532 +    {0, 0, NULL, FALSE},
1533 +    TC_GNOME_GtkHTML_Editor_Listener, "_get_listener", 13,
1534 +    0}
1535 +   , {
1536 +      {1, 1, GNOME_GtkHTML_Editor_Engine__set_listener__arginfo, FALSE},
1537 +      {0, 0, NULL, FALSE},
1538 +      {0, 0, NULL, FALSE},
1539 +      TC_void, "_set_listener", 13,
1540 +      0}
1541 +   , {
1542 +      {1, 1, GNOME_GtkHTML_Editor_Engine_runCommand__arginfo, FALSE},
1543 +      {0, 0, NULL, FALSE},
1544 +      {0, 0, NULL, FALSE},
1545 +      TC_CORBA_boolean, "runCommand", 10,
1546 +      0 | ORBit_I_COMMON_FIXED_SIZE}
1547 +   , {
1548 +      {1, 1, GNOME_GtkHTML_Editor_Engine_getParagraphData__arginfo, FALSE},
1549 +      {0, 0, NULL, FALSE},
1550 +      {0, 0, NULL, FALSE},
1551 +      TC_CORBA_string, "getParagraphData", 16,
1552 +      0}
1553 +   , {
1554 +      {2, 2, GNOME_GtkHTML_Editor_Engine_setParagraphData__arginfo, FALSE},
1555 +      {0, 0, NULL, FALSE},
1556 +      {0, 0, NULL, FALSE},
1557 +      TC_void, "setParagraphData", 16,
1558 +      0}
1559 +   , {
1560 +      {3, 3, GNOME_GtkHTML_Editor_Engine_setObjectDataByType__arginfo, FALSE},
1561 +      {0, 0, NULL, FALSE},
1562 +      {0, 0, NULL, FALSE},
1563 +      TC_void, "setObjectDataByType", 19,
1564 +      0}
1565 +   , {
1566 +      {4, 4, GNOME_GtkHTML_Editor_Engine_searchByData__arginfo, FALSE},
1567 +      {0, 0, NULL, FALSE},
1568 +      {0, 0, NULL, FALSE},
1569 +      TC_CORBA_boolean, "searchByData", 12,
1570 +      0 | ORBit_I_COMMON_FIXED_SIZE}
1571 +   , {
1572 +      {0, 0, NULL, FALSE},
1573 +      {0, 0, NULL, FALSE},
1574 +      {0, 0, NULL, FALSE},
1575 +      TC_CORBA_boolean, "isParagraphEmpty", 16,
1576 +      0 | ORBit_I_COMMON_FIXED_SIZE}
1577 +   , {
1578 +      {0, 0, NULL, FALSE},
1579 +      {0, 0, NULL, FALSE},
1580 +      {0, 0, NULL, FALSE},
1581 +      TC_CORBA_boolean, "isPreviousParagraphEmpty", 24,
1582 +      0 | ORBit_I_COMMON_FIXED_SIZE}
1583 +   , {
1584 +      {1, 1, GNOME_GtkHTML_Editor_Engine_insertHTML__arginfo, FALSE},
1585 +      {0, 0, NULL, FALSE},
1586 +      {0, 0, NULL, FALSE},
1587 +      TC_void, "insertHTML", 10,
1588 +      0}
1589 +   , {
1590 +      {0, 0, NULL, FALSE},
1591 +      {0, 0, NULL, FALSE},
1592 +      {0, 0, NULL, FALSE},
1593 +      TC_void, "freeze", 6,
1594 +      0}
1595 +   , {
1596 +      {0, 0, NULL, FALSE},
1597 +      {0, 0, NULL, FALSE},
1598 +      {0, 0, NULL, FALSE},
1599 +      TC_void, "thaw", 4,
1600 +      0}
1601 +   , {
1602 +      {2, 2, GNOME_GtkHTML_Editor_Engine_undoBegin__arginfo, FALSE},
1603 +      {0, 0, NULL, FALSE},
1604 +      {0, 0, NULL, FALSE},
1605 +      TC_void, "undoBegin", 9,
1606 +      0}
1607 +   , {
1608 +      {0, 0, NULL, FALSE},
1609 +      {0, 0, NULL, FALSE},
1610 +      {0, 0, NULL, FALSE},
1611 +      TC_void, "undoEnd", 7,
1612 +      0}
1613 +   , {
1614 +      {1, 1, GNOME_GtkHTML_Editor_Engine_ignoreWord__arginfo, FALSE},
1615 +      {0, 0, NULL, FALSE},
1616 +      {0, 0, NULL, FALSE},
1617 +      TC_void, "ignoreWord", 10,
1618 +      0}
1619 +   , {
1620 +      {0, 0, NULL, FALSE},
1621 +      {0, 0, NULL, FALSE},
1622 +      {0, 0, NULL, FALSE},
1623 +      TC_void, "dropUndo", 8,
1624 +      0}
1625 +   , {
1626 +      {0, 0, NULL, FALSE},
1627 +      {0, 0, NULL, FALSE},
1628 +      {0, 0, NULL, FALSE},
1629 +      TC_CORBA_boolean, "hasUndo", 7,
1630 +      0 | ORBit_I_COMMON_FIXED_SIZE}
1631 +};
1632 +static CORBA_string GNOME_GtkHTML_Editor_Engine__base_itypes[] = {
1633 +   "IDL:Bonobo/Unknown:1.0",
1634 +   "IDL:omg.org/CORBA/Object:1.0"
1635 +};
1636 +
1637 +#ifdef ORBIT_IDL_C_IMODULE_Editor
1638 +static
1639 +#endif
1640 +ORBit_IInterface GNOME_GtkHTML_Editor_Engine__iinterface = {
1641 +   TC_GNOME_GtkHTML_Editor_Engine, {17, 17,
1642 +                                   GNOME_GtkHTML_Editor_Engine__imethods,
1643 +                                   FALSE},
1644 +   {2, 2, GNOME_GtkHTML_Editor_Engine__base_itypes, FALSE}
1645 +};
1646 diff -Nur vim63/src/gtkhtml_editor.h vim63-bonobo/src/gtkhtml_editor.h
1647 --- vim63/src/gtkhtml_editor.h  1970-01-01 01:00:00.000000000 +0100
1648 +++ vim63-bonobo/src/gtkhtml_editor.h   2005-09-09 20:14:02.727585608 +0200
1649 @@ -0,0 +1,34 @@
1650 +#ifndef GTKHTML_ENGINE_H_
1651 +#define GTKHTML_ENGINE_H_
1652 +
1653 +G_BEGIN_DECLS
1654 +
1655 +typedef struct _EditorEngine EditorEngine;
1656 +
1657 +#include <gtk/gtktypeutils.h>
1658 +#include <bonobo/bonobo-object.h>
1659 +#include "gtkhtml.h"
1660 +
1661 +#define EDITOR_ENGINE_TYPE        (editor_engine_get_type ())
1662 +#define EDITOR_ENGINE(o)          (GTK_CHECK_CAST ((o), EDITOR_ENGINE_TYPE, EditorEngine))
1663 +#define EDITOR_ENGINE_CLASS(k)    (GTK_CHECK_CLASS_CAST((k), EDITOR_ENGINE_TYPE, EditorEngineClass))
1664 +#define IS_EDITOR_ENGINE(o)       (GTK_CHECK_TYPE ((o), EDITOR_ENGINE_TYPE))
1665 +#define IS_EDITOR_ENGINE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), EDITOR_ENGINE_TYPE))
1666 +
1667 +struct _EditorEngine {
1668 +       BonoboObject parent;
1669 +       GNOME_GtkHTML_Editor_Listener listener;
1670 +};
1671 +
1672 +typedef struct {
1673 +       BonoboObjectClass parent_class;
1674 +       POA_GNOME_GtkHTML_Editor_Engine__epv epv;
1675 +} EditorEngineClass;
1676 +
1677 +GtkType                               editor_engine_get_type   (void);
1678 +EditorEngine                         *editor_engine_new        (void);
1679 +POA_GNOME_GtkHTML_Editor_Engine__epv *editor_engine_get_epv    (void);
1680 +
1681 +G_END_DECLS
1682 +
1683 +#endif /* GTKHTML_ENGINE_H_ */
1684 diff -Nur vim63/src/gtkhtml_editor_skels.c vim63-bonobo/src/gtkhtml_editor_skels.c
1685 --- vim63/src/gtkhtml_editor_skels.c    1970-01-01 01:00:00.000000000 +0100
1686 +++ vim63-bonobo/src/gtkhtml_editor_skels.c     2005-09-09 20:14:02.728585456 +0200
1687 @@ -0,0 +1,658 @@
1688 +/*
1689 + * This file was generated by orbit-idl-2 - DO NOT EDIT!
1690 + */
1691 +
1692 +#include <string.h>
1693 +#define ORBIT2_STUBS_API
1694 +#include "gtkhtml.h"
1695 +
1696 +void
1697 +_ORBIT_skel_small_GNOME_GtkHTML_Editor_Listener_event
1698 +   (POA_GNOME_GtkHTML_Editor_Listener * _o_servant, gpointer _o_retval,
1699 +    gpointer * _o_args, CORBA_Context _o_ctx, CORBA_Environment * _o_ev,
1700 +    CORBA_any * (*_impl_event) (PortableServer_Servant _servant,
1701 +                               const CORBA_char * name,
1702 +                               const CORBA_any * arg,
1703 +                               CORBA_Environment * ev))
1704 +{
1705 +   *(CORBA_any * *)_o_retval =
1706 +      _impl_event(_o_servant, *(const CORBA_char * *) _o_args[0],
1707 +                 (const CORBA_any *) _o_args[1], _o_ev);
1708 +}
1709 +
1710 +void
1711 +_ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine__get_listener
1712 +   (POA_GNOME_GtkHTML_Editor_Engine * _o_servant, gpointer _o_retval,
1713 +    gpointer * _o_args, CORBA_Context _o_ctx, CORBA_Environment * _o_ev,
1714 +    GNOME_GtkHTML_Editor_Listener(*_impl__get_listener)
1715 +    (PortableServer_Servant _servant, CORBA_Environment * ev))
1716 +{
1717 +   *(GNOME_GtkHTML_Editor_Listener *) _o_retval =
1718 +      _impl__get_listener(_o_servant, _o_ev);
1719 +}
1720 +
1721 +void
1722 +_ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine__set_listener
1723 +   (POA_GNOME_GtkHTML_Editor_Engine * _o_servant, gpointer _o_retval,
1724 +    gpointer * _o_args, CORBA_Context _o_ctx, CORBA_Environment * _o_ev,
1725 +    void (*_impl__set_listener) (PortableServer_Servant _servant,
1726 +                                const GNOME_GtkHTML_Editor_Listener value,
1727 +                                CORBA_Environment * ev))
1728 +{
1729 +   _impl__set_listener(_o_servant,
1730 +                      *(const GNOME_GtkHTML_Editor_Listener *) _o_args[0],
1731 +                      _o_ev);
1732 +}
1733 +
1734 +void
1735 +_ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_runCommand
1736 +   (POA_GNOME_GtkHTML_Editor_Engine * _o_servant, gpointer _o_retval,
1737 +    gpointer * _o_args, CORBA_Context _o_ctx, CORBA_Environment * _o_ev,
1738 +    CORBA_boolean(*_impl_runCommand) (PortableServer_Servant _servant,
1739 +                                     const CORBA_char * command,
1740 +                                     CORBA_Environment * ev))
1741 +{
1742 +   *(CORBA_boolean *) _o_retval =
1743 +      _impl_runCommand(_o_servant, *(const CORBA_char * *) _o_args[0], _o_ev);
1744 +}
1745 +
1746 +void
1747 +_ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_getParagraphData
1748 +   (POA_GNOME_GtkHTML_Editor_Engine * _o_servant, gpointer _o_retval,
1749 +    gpointer * _o_args, CORBA_Context _o_ctx, CORBA_Environment * _o_ev,
1750 +    CORBA_string(*_impl_getParagraphData) (PortableServer_Servant _servant,
1751 +                                          const CORBA_char * key,
1752 +                                          CORBA_Environment * ev))
1753 +{
1754 +   *(CORBA_string *) _o_retval =
1755 +      _impl_getParagraphData(_o_servant, *(const CORBA_char * *) _o_args[0],
1756 +                            _o_ev);
1757 +}
1758 +
1759 +void
1760 +_ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_setParagraphData
1761 +   (POA_GNOME_GtkHTML_Editor_Engine * _o_servant, gpointer _o_retval,
1762 +    gpointer * _o_args, CORBA_Context _o_ctx, CORBA_Environment * _o_ev,
1763 +    void (*_impl_setParagraphData) (PortableServer_Servant _servant,
1764 +                                   const CORBA_char * key,
1765 +                                   const CORBA_char * value,
1766 +                                   CORBA_Environment * ev))
1767 +{
1768 +   _impl_setParagraphData(_o_servant, *(const CORBA_char * *) _o_args[0],
1769 +                         *(const CORBA_char * *) _o_args[1], _o_ev);
1770 +}
1771 +
1772 +void
1773 +_ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_setObjectDataByType
1774 +   (POA_GNOME_GtkHTML_Editor_Engine * _o_servant, gpointer _o_retval,
1775 +    gpointer * _o_args, CORBA_Context _o_ctx, CORBA_Environment * _o_ev,
1776 +    void (*_impl_setObjectDataByType) (PortableServer_Servant _servant,
1777 +                                      const CORBA_char * type_name,
1778 +                                      const CORBA_char * key,
1779 +                                      const CORBA_char * data,
1780 +                                      CORBA_Environment * ev))
1781 +{
1782 +   _impl_setObjectDataByType(_o_servant, *(const CORBA_char * *) _o_args[0],
1783 +                            *(const CORBA_char * *) _o_args[1],
1784 +                            *(const CORBA_char * *) _o_args[2], _o_ev);
1785 +}
1786 +
1787 +void
1788 +_ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_searchByData
1789 +   (POA_GNOME_GtkHTML_Editor_Engine * _o_servant, gpointer _o_retval,
1790 +    gpointer * _o_args, CORBA_Context _o_ctx, CORBA_Environment * _o_ev,
1791 +    CORBA_boolean(*_impl_searchByData) (PortableServer_Servant _servant,
1792 +                                       const CORBA_long level,
1793 +                                       const CORBA_char * klass,
1794 +                                       const CORBA_char * key,
1795 +                                       const CORBA_char * value,
1796 +                                       CORBA_Environment * ev))
1797 +{
1798 +   *(CORBA_boolean *) _o_retval =
1799 +      _impl_searchByData(_o_servant, *(const CORBA_long *) _o_args[0],
1800 +                        *(const CORBA_char * *) _o_args[1],
1801 +                        *(const CORBA_char * *) _o_args[2],
1802 +                        *(const CORBA_char * *) _o_args[3], _o_ev);
1803 +}
1804 +
1805 +void
1806 +_ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_isParagraphEmpty
1807 +   (POA_GNOME_GtkHTML_Editor_Engine * _o_servant, gpointer _o_retval,
1808 +    gpointer * _o_args, CORBA_Context _o_ctx, CORBA_Environment * _o_ev,
1809 +    CORBA_boolean(*_impl_isParagraphEmpty) (PortableServer_Servant _servant,
1810 +                                           CORBA_Environment * ev))
1811 +{
1812 +   *(CORBA_boolean *) _o_retval = _impl_isParagraphEmpty(_o_servant, _o_ev);
1813 +}
1814 +
1815 +void
1816 +_ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_isPreviousParagraphEmpty
1817 +   (POA_GNOME_GtkHTML_Editor_Engine * _o_servant, gpointer _o_retval,
1818 +    gpointer * _o_args, CORBA_Context _o_ctx, CORBA_Environment * _o_ev,
1819 +    CORBA_boolean(*_impl_isPreviousParagraphEmpty) (PortableServer_Servant
1820 +                                                   _servant,
1821 +                                                   CORBA_Environment * ev))
1822 +{
1823 +   *(CORBA_boolean *) _o_retval =
1824 +      _impl_isPreviousParagraphEmpty(_o_servant, _o_ev);
1825 +}
1826 +
1827 +void
1828 +_ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_insertHTML
1829 +   (POA_GNOME_GtkHTML_Editor_Engine * _o_servant, gpointer _o_retval,
1830 +    gpointer * _o_args, CORBA_Context _o_ctx, CORBA_Environment * _o_ev,
1831 +    void (*_impl_insertHTML) (PortableServer_Servant _servant,
1832 +                             const CORBA_char * html,
1833 +                             CORBA_Environment * ev))
1834 +{
1835 +   _impl_insertHTML(_o_servant, *(const CORBA_char * *) _o_args[0], _o_ev);
1836 +}
1837 +
1838 +void
1839 +_ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_freeze
1840 +   (POA_GNOME_GtkHTML_Editor_Engine * _o_servant, gpointer _o_retval,
1841 +    gpointer * _o_args, CORBA_Context _o_ctx, CORBA_Environment * _o_ev,
1842 +    void (*_impl_freeze) (PortableServer_Servant _servant,
1843 +                         CORBA_Environment * ev))
1844 +{
1845 +   _impl_freeze(_o_servant, _o_ev);
1846 +}
1847 +
1848 +void
1849 +_ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_thaw
1850 +   (POA_GNOME_GtkHTML_Editor_Engine * _o_servant, gpointer _o_retval,
1851 +    gpointer * _o_args, CORBA_Context _o_ctx, CORBA_Environment * _o_ev,
1852 +    void (*_impl_thaw) (PortableServer_Servant _servant,
1853 +                       CORBA_Environment * ev))
1854 +{
1855 +   _impl_thaw(_o_servant, _o_ev);
1856 +}
1857 +
1858 +void
1859 +_ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_undoBegin
1860 +   (POA_GNOME_GtkHTML_Editor_Engine * _o_servant, gpointer _o_retval,
1861 +    gpointer * _o_args, CORBA_Context _o_ctx, CORBA_Environment * _o_ev,
1862 +    void (*_impl_undoBegin) (PortableServer_Servant _servant,
1863 +                            const CORBA_char * undo_name,
1864 +                            const CORBA_char * redo_name,
1865 +                            CORBA_Environment * ev))
1866 +{
1867 +   _impl_undoBegin(_o_servant, *(const CORBA_char * *) _o_args[0],
1868 +                  *(const CORBA_char * *) _o_args[1], _o_ev);
1869 +}
1870 +
1871 +void
1872 +_ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_undoEnd
1873 +   (POA_GNOME_GtkHTML_Editor_Engine * _o_servant, gpointer _o_retval,
1874 +    gpointer * _o_args, CORBA_Context _o_ctx, CORBA_Environment * _o_ev,
1875 +    void (*_impl_undoEnd) (PortableServer_Servant _servant,
1876 +                          CORBA_Environment * ev))
1877 +{
1878 +   _impl_undoEnd(_o_servant, _o_ev);
1879 +}
1880 +
1881 +void
1882 +_ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_ignoreWord
1883 +   (POA_GNOME_GtkHTML_Editor_Engine * _o_servant, gpointer _o_retval,
1884 +    gpointer * _o_args, CORBA_Context _o_ctx, CORBA_Environment * _o_ev,
1885 +    void (*_impl_ignoreWord) (PortableServer_Servant _servant,
1886 +                             const CORBA_char * word,
1887 +                             CORBA_Environment * ev))
1888 +{
1889 +   _impl_ignoreWord(_o_servant, *(const CORBA_char * *) _o_args[0], _o_ev);
1890 +}
1891 +
1892 +void
1893 +_ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_dropUndo
1894 +   (POA_GNOME_GtkHTML_Editor_Engine * _o_servant, gpointer _o_retval,
1895 +    gpointer * _o_args, CORBA_Context _o_ctx, CORBA_Environment * _o_ev,
1896 +    void (*_impl_dropUndo) (PortableServer_Servant _servant,
1897 +                           CORBA_Environment * ev))
1898 +{
1899 +   _impl_dropUndo(_o_servant, _o_ev);
1900 +}
1901 +
1902 +void
1903 +_ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_hasUndo
1904 +   (POA_GNOME_GtkHTML_Editor_Engine * _o_servant, gpointer _o_retval,
1905 +    gpointer * _o_args, CORBA_Context _o_ctx, CORBA_Environment * _o_ev,
1906 +    CORBA_boolean(*_impl_hasUndo) (PortableServer_Servant _servant,
1907 +                                  CORBA_Environment * ev))
1908 +{
1909 +   *(CORBA_boolean *) _o_retval = _impl_hasUndo(_o_servant, _o_ev);
1910 +}
1911 +static ORBitSmallSkeleton
1912 +get_skel_small_GNOME_GtkHTML_Editor_Listener(POA_GNOME_GtkHTML_Editor_Listener
1913 +                                            * servant, const char *opname,
1914 +                                            gpointer * m_data,
1915 +                                            gpointer * impl)
1916 +{
1917 +   switch (opname[0]) {
1918 +     case 'e':
1919 +      if (strcmp((opname + 1), "vent"))
1920 +        break;
1921 +      *impl =
1922 +        (gpointer) servant->vepv->GNOME_GtkHTML_Editor_Listener_epv->event;
1923 +      *m_data =
1924 +        (gpointer) & GNOME_GtkHTML_Editor_Listener__iinterface.methods.
1925 +        _buffer[0];
1926 +      return (ORBitSmallSkeleton)
1927 +        _ORBIT_skel_small_GNOME_GtkHTML_Editor_Listener_event;
1928 +      break;
1929 +     case 'q':
1930 +      if (strcmp((opname + 1), "ueryInterface"))
1931 +        break;
1932 +      *impl = (gpointer) servant->vepv->Bonobo_Unknown_epv->queryInterface;
1933 +      *m_data = (gpointer) & Bonobo_Unknown__iinterface.methods._buffer[2];
1934 +      return (ORBitSmallSkeleton)
1935 +        _ORBIT_skel_small_Bonobo_Unknown_queryInterface;
1936 +      break;
1937 +     case 'r':
1938 +      if (strcmp((opname + 1), "ef"))
1939 +        break;
1940 +      *impl = (gpointer) servant->vepv->Bonobo_Unknown_epv->ref;
1941 +      *m_data = (gpointer) & Bonobo_Unknown__iinterface.methods._buffer[0];
1942 +      return (ORBitSmallSkeleton) _ORBIT_skel_small_Bonobo_Unknown_ref;
1943 +      break;
1944 +     case 'u':
1945 +      if (strcmp((opname + 1), "nref"))
1946 +        break;
1947 +      *impl = (gpointer) servant->vepv->Bonobo_Unknown_epv->unref;
1948 +      *m_data = (gpointer) & Bonobo_Unknown__iinterface.methods._buffer[1];
1949 +      return (ORBitSmallSkeleton) _ORBIT_skel_small_Bonobo_Unknown_unref;
1950 +      break;
1951 +     default:
1952 +      break;
1953 +   }
1954 +   return NULL;
1955 +}
1956 +
1957 +void
1958 +POA_GNOME_GtkHTML_Editor_Listener__init(PortableServer_Servant servant,
1959 +                                       CORBA_Environment * env)
1960 +{
1961 +   static PortableServer_ClassInfo class_info =
1962 +      { NULL,
1963 +(ORBit_small_impl_finder) & get_skel_small_GNOME_GtkHTML_Editor_Listener,
1964 +        "IDL:GNOME/GtkHTML/Editor/Listener:1.0",
1965 +        &GNOME_GtkHTML_Editor_Listener__classid, NULL,
1966 +        &GNOME_GtkHTML_Editor_Listener__iinterface };
1967 +   POA_GNOME_GtkHTML_Editor_Listener__vepv *fakevepv = NULL;
1968 +
1969 +   if (((PortableServer_ServantBase *) servant)->vepv[0]->finalize == 0) {
1970 +      ((PortableServer_ServantBase *) servant)->vepv[0]->finalize =
1971 +        POA_GNOME_GtkHTML_Editor_Listener__fini;
1972 +   }
1973 +   PortableServer_ServantBase__init(((PortableServer_ServantBase *) servant),
1974 +                                   env);
1975 +   POA_Bonobo_Unknown__init(servant, env);
1976 +   ORBit_classinfo_register(&class_info);
1977 +   ORBIT_SERVANT_SET_CLASSINFO(servant, &class_info);
1978 +
1979 +   if (!class_info.vepvmap) {
1980 +      class_info.vepvmap =
1981 +        g_new0(ORBit_VepvIdx, GNOME_GtkHTML_Editor_Listener__classid + 1);
1982 +      class_info.vepvmap[Bonobo_Unknown__classid] =
1983 +        (((char *) &(fakevepv->Bonobo_Unknown_epv)) -
1984 +         ((char *) (fakevepv))) / sizeof(GFunc);
1985 +      class_info.vepvmap[GNOME_GtkHTML_Editor_Listener__classid] =
1986 +        (((char *) &(fakevepv->GNOME_GtkHTML_Editor_Listener_epv)) -
1987 +         ((char *) (fakevepv))) / sizeof(GFunc);
1988 +   }
1989 +}
1990 +
1991 +void
1992 +POA_GNOME_GtkHTML_Editor_Listener__fini(PortableServer_Servant servant,
1993 +                                       CORBA_Environment * env)
1994 +{
1995 +   POA_Bonobo_Unknown__fini(servant, env);
1996 +   PortableServer_ServantBase__fini(servant, env);
1997 +}
1998 +
1999 +static ORBitSmallSkeleton
2000 +get_skel_small_GNOME_GtkHTML_Editor_Engine(POA_GNOME_GtkHTML_Editor_Engine *
2001 +                                          servant, const char *opname,
2002 +                                          gpointer * m_data, gpointer * impl)
2003 +{
2004 +   switch (opname[0]) {
2005 +     case '_':
2006 +      switch (opname[1]) {
2007 +       case 'g':
2008 +        if (strcmp((opname + 2), "et_listener"))
2009 +           break;
2010 +        *impl =
2011 +           (gpointer) servant->vepv->GNOME_GtkHTML_Editor_Engine_epv->
2012 +           _get_listener;
2013 +        *m_data =
2014 +           (gpointer) & GNOME_GtkHTML_Editor_Engine__iinterface.methods.
2015 +           _buffer[0];
2016 +        return (ORBitSmallSkeleton)
2017 +           _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine__get_listener;
2018 +        break;
2019 +       case 's':
2020 +        if (strcmp((opname + 2), "et_listener"))
2021 +           break;
2022 +        *impl =
2023 +           (gpointer) servant->vepv->GNOME_GtkHTML_Editor_Engine_epv->
2024 +           _set_listener;
2025 +        *m_data =
2026 +           (gpointer) & GNOME_GtkHTML_Editor_Engine__iinterface.methods.
2027 +           _buffer[1];
2028 +        return (ORBitSmallSkeleton)
2029 +           _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine__set_listener;
2030 +        break;
2031 +       default:
2032 +        break;
2033 +      }
2034 +      break;
2035 +     case 'd':
2036 +      if (strcmp((opname + 1), "ropUndo"))
2037 +        break;
2038 +      *impl =
2039 +        (gpointer) servant->vepv->GNOME_GtkHTML_Editor_Engine_epv->dropUndo;
2040 +      *m_data =
2041 +        (gpointer) & GNOME_GtkHTML_Editor_Engine__iinterface.methods.
2042 +        _buffer[15];
2043 +      return (ORBitSmallSkeleton)
2044 +        _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_dropUndo;
2045 +      break;
2046 +     case 'f':
2047 +      if (strcmp((opname + 1), "reeze"))
2048 +        break;
2049 +      *impl =
2050 +        (gpointer) servant->vepv->GNOME_GtkHTML_Editor_Engine_epv->freeze;
2051 +      *m_data =
2052 +        (gpointer) & GNOME_GtkHTML_Editor_Engine__iinterface.methods.
2053 +        _buffer[10];
2054 +      return (ORBitSmallSkeleton)
2055 +        _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_freeze;
2056 +      break;
2057 +     case 'g':
2058 +      if (strcmp((opname + 1), "etParagraphData"))
2059 +        break;
2060 +      *impl =
2061 +        (gpointer) servant->vepv->GNOME_GtkHTML_Editor_Engine_epv->
2062 +        getParagraphData;
2063 +      *m_data =
2064 +        (gpointer) & GNOME_GtkHTML_Editor_Engine__iinterface.methods.
2065 +        _buffer[3];
2066 +      return (ORBitSmallSkeleton)
2067 +        _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_getParagraphData;
2068 +      break;
2069 +     case 'h':
2070 +      if (strcmp((opname + 1), "asUndo"))
2071 +        break;
2072 +      *impl =
2073 +        (gpointer) servant->vepv->GNOME_GtkHTML_Editor_Engine_epv->hasUndo;
2074 +      *m_data =
2075 +        (gpointer) & GNOME_GtkHTML_Editor_Engine__iinterface.methods.
2076 +        _buffer[16];
2077 +      return (ORBitSmallSkeleton)
2078 +        _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_hasUndo;
2079 +      break;
2080 +     case 'i':
2081 +      switch (opname[1]) {
2082 +       case 'g':
2083 +        if (strcmp((opname + 2), "noreWord"))
2084 +           break;
2085 +        *impl =
2086 +           (gpointer) servant->vepv->GNOME_GtkHTML_Editor_Engine_epv->
2087 +           ignoreWord;
2088 +        *m_data =
2089 +           (gpointer) & GNOME_GtkHTML_Editor_Engine__iinterface.methods.
2090 +           _buffer[14];
2091 +        return (ORBitSmallSkeleton)
2092 +           _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_ignoreWord;
2093 +        break;
2094 +       case 'n':
2095 +        if (strcmp((opname + 2), "sertHTML"))
2096 +           break;
2097 +        *impl =
2098 +           (gpointer) servant->vepv->GNOME_GtkHTML_Editor_Engine_epv->
2099 +           insertHTML;
2100 +        *m_data =
2101 +           (gpointer) & GNOME_GtkHTML_Editor_Engine__iinterface.methods.
2102 +           _buffer[9];
2103 +        return (ORBitSmallSkeleton)
2104 +           _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_insertHTML;
2105 +        break;
2106 +       case 's':
2107 +        switch (opname[2]) {
2108 +          case 'P':
2109 +           switch (opname[3]) {
2110 +             case 'a':
2111 +              if (strcmp((opname + 4), "ragraphEmpty"))
2112 +                 break;
2113 +              *impl =
2114 +                 (gpointer) servant->vepv->GNOME_GtkHTML_Editor_Engine_epv->
2115 +                 isParagraphEmpty;
2116 +              *m_data =
2117 +                 (gpointer) & GNOME_GtkHTML_Editor_Engine__iinterface.
2118 +                 methods._buffer[7];
2119 +              return (ORBitSmallSkeleton)
2120 +                 _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_isParagraphEmpty;
2121 +              break;
2122 +             case 'r':
2123 +              if (strcmp((opname + 4), "eviousParagraphEmpty"))
2124 +                 break;
2125 +              *impl =
2126 +                 (gpointer) servant->vepv->GNOME_GtkHTML_Editor_Engine_epv->
2127 +                 isPreviousParagraphEmpty;
2128 +              *m_data =
2129 +                 (gpointer) & GNOME_GtkHTML_Editor_Engine__iinterface.
2130 +                 methods._buffer[8];
2131 +              return (ORBitSmallSkeleton)
2132 +                 _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_isPreviousParagraphEmpty;
2133 +              break;
2134 +             default:
2135 +              break;
2136 +           }
2137 +           break;
2138 +          default:
2139 +           break;
2140 +        }
2141 +        break;
2142 +       default:
2143 +        break;
2144 +      }
2145 +      break;
2146 +     case 'q':
2147 +      if (strcmp((opname + 1), "ueryInterface"))
2148 +        break;
2149 +      *impl = (gpointer) servant->vepv->Bonobo_Unknown_epv->queryInterface;
2150 +      *m_data = (gpointer) & Bonobo_Unknown__iinterface.methods._buffer[2];
2151 +      return (ORBitSmallSkeleton)
2152 +        _ORBIT_skel_small_Bonobo_Unknown_queryInterface;
2153 +      break;
2154 +     case 'r':
2155 +      switch (opname[1]) {
2156 +       case 'e':
2157 +        if (strcmp((opname + 2), "f"))
2158 +           break;
2159 +        *impl = (gpointer) servant->vepv->Bonobo_Unknown_epv->ref;
2160 +        *m_data = (gpointer) & Bonobo_Unknown__iinterface.methods._buffer[0];
2161 +        return (ORBitSmallSkeleton) _ORBIT_skel_small_Bonobo_Unknown_ref;
2162 +        break;
2163 +       case 'u':
2164 +        if (strcmp((opname + 2), "nCommand"))
2165 +           break;
2166 +        *impl =
2167 +           (gpointer) servant->vepv->GNOME_GtkHTML_Editor_Engine_epv->
2168 +           runCommand;
2169 +        *m_data =
2170 +           (gpointer) & GNOME_GtkHTML_Editor_Engine__iinterface.methods.
2171 +           _buffer[2];
2172 +        return (ORBitSmallSkeleton)
2173 +           _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_runCommand;
2174 +        break;
2175 +       default:
2176 +        break;
2177 +      }
2178 +      break;
2179 +     case 's':
2180 +      switch (opname[1]) {
2181 +       case 'e':
2182 +        switch (opname[2]) {
2183 +          case 'a':
2184 +           if (strcmp((opname + 3), "rchByData"))
2185 +              break;
2186 +           *impl =
2187 +              (gpointer) servant->vepv->GNOME_GtkHTML_Editor_Engine_epv->
2188 +              searchByData;
2189 +           *m_data =
2190 +              (gpointer) & GNOME_GtkHTML_Editor_Engine__iinterface.methods.
2191 +              _buffer[6];
2192 +           return (ORBitSmallSkeleton)
2193 +              _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_searchByData;
2194 +           break;
2195 +          case 't':
2196 +           switch (opname[3]) {
2197 +             case 'O':
2198 +              if (strcmp((opname + 4), "bjectDataByType"))
2199 +                 break;
2200 +              *impl =
2201 +                 (gpointer) servant->vepv->GNOME_GtkHTML_Editor_Engine_epv->
2202 +                 setObjectDataByType;
2203 +              *m_data =
2204 +                 (gpointer) & GNOME_GtkHTML_Editor_Engine__iinterface.
2205 +                 methods._buffer[5];
2206 +              return (ORBitSmallSkeleton)
2207 +                 _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_setObjectDataByType;
2208 +              break;
2209 +             case 'P':
2210 +              if (strcmp((opname + 4), "aragraphData"))
2211 +                 break;
2212 +              *impl =
2213 +                 (gpointer) servant->vepv->GNOME_GtkHTML_Editor_Engine_epv->
2214 +                 setParagraphData;
2215 +              *m_data =
2216 +                 (gpointer) & GNOME_GtkHTML_Editor_Engine__iinterface.
2217 +                 methods._buffer[4];
2218 +              return (ORBitSmallSkeleton)
2219 +                 _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_setParagraphData;
2220 +              break;
2221 +             default:
2222 +              break;
2223 +           }
2224 +           break;
2225 +          default:
2226 +           break;
2227 +        }
2228 +        break;
2229 +       default:
2230 +        break;
2231 +      }
2232 +      break;
2233 +     case 't':
2234 +      if (strcmp((opname + 1), "haw"))
2235 +        break;
2236 +      *impl = (gpointer) servant->vepv->GNOME_GtkHTML_Editor_Engine_epv->thaw;
2237 +      *m_data =
2238 +        (gpointer) & GNOME_GtkHTML_Editor_Engine__iinterface.methods.
2239 +        _buffer[11];
2240 +      return (ORBitSmallSkeleton)
2241 +        _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_thaw;
2242 +      break;
2243 +     case 'u':
2244 +      switch (opname[1]) {
2245 +       case 'n':
2246 +        switch (opname[2]) {
2247 +          case 'd':
2248 +           switch (opname[3]) {
2249 +             case 'o':
2250 +              switch (opname[4]) {
2251 +                case 'B':
2252 +                 if (strcmp((opname + 5), "egin"))
2253 +                    break;
2254 +                 *impl =
2255 +                    (gpointer) servant->vepv->
2256 +                    GNOME_GtkHTML_Editor_Engine_epv->undoBegin;
2257 +                 *m_data =
2258 +                    (gpointer) & GNOME_GtkHTML_Editor_Engine__iinterface.
2259 +                    methods._buffer[12];
2260 +                 return (ORBitSmallSkeleton)
2261 +                    _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_undoBegin;
2262 +                 break;
2263 +                case 'E':
2264 +                 if (strcmp((opname + 5), "nd"))
2265 +                    break;
2266 +                 *impl =
2267 +                    (gpointer) servant->vepv->
2268 +                    GNOME_GtkHTML_Editor_Engine_epv->undoEnd;
2269 +                 *m_data =
2270 +                    (gpointer) & GNOME_GtkHTML_Editor_Engine__iinterface.
2271 +                    methods._buffer[13];
2272 +                 return (ORBitSmallSkeleton)
2273 +                    _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_undoEnd;
2274 +                 break;
2275 +                default:
2276 +                 break;
2277 +              }
2278 +              break;
2279 +             default:
2280 +              break;
2281 +           }
2282 +           break;
2283 +          case 'r':
2284 +           if (strcmp((opname + 3), "ef"))
2285 +              break;
2286 +           *impl = (gpointer) servant->vepv->Bonobo_Unknown_epv->unref;
2287 +           *m_data =
2288 +              (gpointer) & Bonobo_Unknown__iinterface.methods._buffer[1];
2289 +           return (ORBitSmallSkeleton)
2290 +              _ORBIT_skel_small_Bonobo_Unknown_unref;
2291 +           break;
2292 +          default:
2293 +           break;
2294 +        }
2295 +        break;
2296 +       default:
2297 +        break;
2298 +      }
2299 +      break;
2300 +     default:
2301 +      break;
2302 +   }
2303 +   return NULL;
2304 +}
2305 +
2306 +void
2307 +POA_GNOME_GtkHTML_Editor_Engine__init(PortableServer_Servant servant,
2308 +                                     CORBA_Environment * env)
2309 +{
2310 +   static PortableServer_ClassInfo class_info =
2311 +      { NULL,
2312 +(ORBit_small_impl_finder) & get_skel_small_GNOME_GtkHTML_Editor_Engine, "IDL:GNOME/GtkHTML/Editor/Engine:1.0",
2313 +        &GNOME_GtkHTML_Editor_Engine__classid, NULL,
2314 +        &GNOME_GtkHTML_Editor_Engine__iinterface };
2315 +   POA_GNOME_GtkHTML_Editor_Engine__vepv *fakevepv = NULL;
2316 +
2317 +   if (((PortableServer_ServantBase *) servant)->vepv[0]->finalize == 0) {
2318 +      ((PortableServer_ServantBase *) servant)->vepv[0]->finalize =
2319 +        POA_GNOME_GtkHTML_Editor_Engine__fini;
2320 +   }
2321 +   PortableServer_ServantBase__init(((PortableServer_ServantBase *) servant),
2322 +                                   env);
2323 +   POA_Bonobo_Unknown__init(servant, env);
2324 +   ORBit_classinfo_register(&class_info);
2325 +   ORBIT_SERVANT_SET_CLASSINFO(servant, &class_info);
2326 +
2327 +   if (!class_info.vepvmap) {
2328 +      class_info.vepvmap =
2329 +        g_new0(ORBit_VepvIdx, GNOME_GtkHTML_Editor_Engine__classid + 1);
2330 +      class_info.vepvmap[Bonobo_Unknown__classid] =
2331 +        (((char *) &(fakevepv->Bonobo_Unknown_epv)) -
2332 +         ((char *) (fakevepv))) / sizeof(GFunc);
2333 +      class_info.vepvmap[GNOME_GtkHTML_Editor_Engine__classid] =
2334 +        (((char *) &(fakevepv->GNOME_GtkHTML_Editor_Engine_epv)) -
2335 +         ((char *) (fakevepv))) / sizeof(GFunc);
2336 +   }
2337 +}
2338 +
2339 +void
2340 +POA_GNOME_GtkHTML_Editor_Engine__fini(PortableServer_Servant servant,
2341 +                                     CORBA_Environment * env)
2342 +{
2343 +   POA_Bonobo_Unknown__fini(servant, env);
2344 +   PortableServer_ServantBase__fini(servant, env);
2345 +}
2346 diff -Nur vim63/src/gtkhtml_editor_stubs.c vim63-bonobo/src/gtkhtml_editor_stubs.c
2347 --- vim63/src/gtkhtml_editor_stubs.c    1970-01-01 01:00:00.000000000 +0100
2348 +++ vim63-bonobo/src/gtkhtml_editor_stubs.c     2005-09-09 20:14:02.729585304 +0200
2349 @@ -0,0 +1,496 @@
2350 +/*
2351 + * This file was generated by orbit-idl-2 - DO NOT EDIT!
2352 + */
2353 +
2354 +#include <string.h>
2355 +#define ORBIT2_STUBS_API
2356 +#include "gtkhtml.h"
2357 +
2358 +CORBA_any *
2359 +GNOME_GtkHTML_Editor_Listener_event(GNOME_GtkHTML_Editor_Listener _obj,
2360 +                                   const CORBA_char * name,
2361 +                                   const CORBA_any * arg,
2362 +                                   CORBA_Environment * ev)
2363 +{
2364 +   CORBA_any *_ORBIT_retval;
2365 +   POA_GNOME_GtkHTML_Editor_Listener__epv *_ORBIT_epv;
2366 +
2367 +   if (ORBit_small_flags & ORBIT_SMALL_FAST_LOCALS &&
2368 +       ORBIT_STUB_IsBypass(_obj, GNOME_GtkHTML_Editor_Listener__classid) &&
2369 +       (_ORBIT_epv =
2370 +       (POA_GNOME_GtkHTML_Editor_Listener__epv *) ORBIT_STUB_GetEpv(_obj,
2371 +                                                                    GNOME_GtkHTML_Editor_Listener__classid))->
2372 +       event) {
2373 +      ORBIT_STUB_PreCall(_obj);
2374 +      _ORBIT_retval =
2375 +        _ORBIT_epv->event(ORBIT_STUB_GetServant(_obj), name, arg, ev);
2376 +      ORBIT_STUB_PostCall(_obj);
2377 +   } else {                    /* remote marshal */
2378 +      gpointer _args[2];
2379 +
2380 +      _args[0] = (gpointer) & name;
2381 +      _args[1] = (gpointer) arg;
2382 +      ORBit_small_invoke_stub_n(_obj,
2383 +                               &GNOME_GtkHTML_Editor_Listener__iinterface.
2384 +                               methods, 0, &_ORBIT_retval, _args, NULL, ev);
2385 +
2386 +   }
2387 +   return _ORBIT_retval;
2388 +}
2389 +
2390 +GNOME_GtkHTML_Editor_Listener
2391 +GNOME_GtkHTML_Editor_Engine__get_listener(GNOME_GtkHTML_Editor_Engine _obj,
2392 +                                         CORBA_Environment * ev)
2393 +{
2394 +   GNOME_GtkHTML_Editor_Listener _ORBIT_retval;
2395 +   POA_GNOME_GtkHTML_Editor_Engine__epv *_ORBIT_epv;
2396 +
2397 +   if (ORBit_small_flags & ORBIT_SMALL_FAST_LOCALS &&
2398 +       ORBIT_STUB_IsBypass(_obj, GNOME_GtkHTML_Editor_Engine__classid) &&
2399 +       (_ORBIT_epv =
2400 +       (POA_GNOME_GtkHTML_Editor_Engine__epv *) ORBIT_STUB_GetEpv(_obj,
2401 +                                                                  GNOME_GtkHTML_Editor_Engine__classid))->
2402 +       _get_listener) {
2403 +      ORBIT_STUB_PreCall(_obj);
2404 +      _ORBIT_retval =
2405 +        _ORBIT_epv->_get_listener(ORBIT_STUB_GetServant(_obj), ev);
2406 +      ORBIT_STUB_PostCall(_obj);
2407 +   } else {                    /* remote marshal */
2408 +      ORBit_small_invoke_stub_n(_obj,
2409 +                               &GNOME_GtkHTML_Editor_Engine__iinterface.
2410 +                               methods, 0, &_ORBIT_retval, NULL, NULL, ev);
2411 +
2412 +   }
2413 +   return _ORBIT_retval;
2414 +}
2415 +
2416 +void
2417 +GNOME_GtkHTML_Editor_Engine__set_listener(GNOME_GtkHTML_Editor_Engine _obj,
2418 +                                         const GNOME_GtkHTML_Editor_Listener
2419 +                                         value, CORBA_Environment * ev)
2420 +{
2421 +   POA_GNOME_GtkHTML_Editor_Engine__epv *_ORBIT_epv;
2422 +
2423 +   if (ORBit_small_flags & ORBIT_SMALL_FAST_LOCALS &&
2424 +       ORBIT_STUB_IsBypass(_obj, GNOME_GtkHTML_Editor_Engine__classid) &&
2425 +       (_ORBIT_epv =
2426 +       (POA_GNOME_GtkHTML_Editor_Engine__epv *) ORBIT_STUB_GetEpv(_obj,
2427 +                                                                  GNOME_GtkHTML_Editor_Engine__classid))->
2428 +       _set_listener) {
2429 +      ORBIT_STUB_PreCall(_obj);
2430 +      _ORBIT_epv->_set_listener(ORBIT_STUB_GetServant(_obj), value, ev);
2431 +      ORBIT_STUB_PostCall(_obj);
2432 +   } else {                    /* remote marshal */
2433 +      gpointer _args[1];
2434 +
2435 +      _args[0] = (gpointer) & value;
2436 +      ORBit_small_invoke_stub_n(_obj,
2437 +                               &GNOME_GtkHTML_Editor_Engine__iinterface.
2438 +                               methods, 1, NULL, _args, NULL, ev);
2439 +
2440 +   }
2441 +}
2442 +CORBA_boolean
2443 +GNOME_GtkHTML_Editor_Engine_runCommand(GNOME_GtkHTML_Editor_Engine _obj,
2444 +                                      const CORBA_char * command,
2445 +                                      CORBA_Environment * ev)
2446 +{
2447 +   CORBA_boolean _ORBIT_retval;
2448 +   POA_GNOME_GtkHTML_Editor_Engine__epv *_ORBIT_epv;
2449 +
2450 +   if (ORBit_small_flags & ORBIT_SMALL_FAST_LOCALS &&
2451 +       ORBIT_STUB_IsBypass(_obj, GNOME_GtkHTML_Editor_Engine__classid) &&
2452 +       (_ORBIT_epv =
2453 +       (POA_GNOME_GtkHTML_Editor_Engine__epv *) ORBIT_STUB_GetEpv(_obj,
2454 +                                                                  GNOME_GtkHTML_Editor_Engine__classid))->
2455 +       runCommand) {
2456 +      ORBIT_STUB_PreCall(_obj);
2457 +      _ORBIT_retval =
2458 +        _ORBIT_epv->runCommand(ORBIT_STUB_GetServant(_obj), command, ev);
2459 +      ORBIT_STUB_PostCall(_obj);
2460 +   } else {                    /* remote marshal */
2461 +      gpointer _args[1];
2462 +
2463 +      _args[0] = (gpointer) & command;
2464 +      ORBit_small_invoke_stub_n(_obj,
2465 +                               &GNOME_GtkHTML_Editor_Engine__iinterface.
2466 +                               methods, 2, &_ORBIT_retval, _args, NULL, ev);
2467 +
2468 +   }
2469 +   return _ORBIT_retval;
2470 +}
2471 +
2472 +CORBA_string
2473 +GNOME_GtkHTML_Editor_Engine_getParagraphData(GNOME_GtkHTML_Editor_Engine _obj,
2474 +                                            const CORBA_char * key,
2475 +                                            CORBA_Environment * ev)
2476 +{
2477 +   CORBA_string _ORBIT_retval;
2478 +   POA_GNOME_GtkHTML_Editor_Engine__epv *_ORBIT_epv;
2479 +
2480 +   if (ORBit_small_flags & ORBIT_SMALL_FAST_LOCALS &&
2481 +       ORBIT_STUB_IsBypass(_obj, GNOME_GtkHTML_Editor_Engine__classid) &&
2482 +       (_ORBIT_epv =
2483 +       (POA_GNOME_GtkHTML_Editor_Engine__epv *) ORBIT_STUB_GetEpv(_obj,
2484 +                                                                  GNOME_GtkHTML_Editor_Engine__classid))->
2485 +       getParagraphData) {
2486 +      ORBIT_STUB_PreCall(_obj);
2487 +      _ORBIT_retval =
2488 +        _ORBIT_epv->getParagraphData(ORBIT_STUB_GetServant(_obj), key, ev);
2489 +      ORBIT_STUB_PostCall(_obj);
2490 +   } else {                    /* remote marshal */
2491 +      gpointer _args[1];
2492 +
2493 +      _args[0] = (gpointer) & key;
2494 +      ORBit_small_invoke_stub_n(_obj,
2495 +                               &GNOME_GtkHTML_Editor_Engine__iinterface.
2496 +                               methods, 3, &_ORBIT_retval, _args, NULL, ev);
2497 +
2498 +   }
2499 +   return _ORBIT_retval;
2500 +}
2501 +
2502 +void
2503 +GNOME_GtkHTML_Editor_Engine_setParagraphData(GNOME_GtkHTML_Editor_Engine _obj,
2504 +                                            const CORBA_char * key,
2505 +                                            const CORBA_char * value,
2506 +                                            CORBA_Environment * ev)
2507 +{
2508 +   POA_GNOME_GtkHTML_Editor_Engine__epv *_ORBIT_epv;
2509 +
2510 +   if (ORBit_small_flags & ORBIT_SMALL_FAST_LOCALS &&
2511 +       ORBIT_STUB_IsBypass(_obj, GNOME_GtkHTML_Editor_Engine__classid) &&
2512 +       (_ORBIT_epv =
2513 +       (POA_GNOME_GtkHTML_Editor_Engine__epv *) ORBIT_STUB_GetEpv(_obj,
2514 +                                                                  GNOME_GtkHTML_Editor_Engine__classid))->
2515 +       setParagraphData) {
2516 +      ORBIT_STUB_PreCall(_obj);
2517 +      _ORBIT_epv->setParagraphData(ORBIT_STUB_GetServant(_obj), key, value,
2518 +                                  ev);
2519 +      ORBIT_STUB_PostCall(_obj);
2520 +   } else {                    /* remote marshal */
2521 +      gpointer _args[2];
2522 +
2523 +      _args[0] = (gpointer) & key;
2524 +      _args[1] = (gpointer) & value;
2525 +      ORBit_small_invoke_stub_n(_obj,
2526 +                               &GNOME_GtkHTML_Editor_Engine__iinterface.
2527 +                               methods, 4, NULL, _args, NULL, ev);
2528 +
2529 +   }
2530 +}
2531 +void
2532 +GNOME_GtkHTML_Editor_Engine_setObjectDataByType(GNOME_GtkHTML_Editor_Engine
2533 +                                               _obj,
2534 +                                               const CORBA_char * type_name,
2535 +                                               const CORBA_char * key,
2536 +                                               const CORBA_char * data,
2537 +                                               CORBA_Environment * ev)
2538 +{
2539 +   POA_GNOME_GtkHTML_Editor_Engine__epv *_ORBIT_epv;
2540 +
2541 +   if (ORBit_small_flags & ORBIT_SMALL_FAST_LOCALS &&
2542 +       ORBIT_STUB_IsBypass(_obj, GNOME_GtkHTML_Editor_Engine__classid) &&
2543 +       (_ORBIT_epv =
2544 +       (POA_GNOME_GtkHTML_Editor_Engine__epv *) ORBIT_STUB_GetEpv(_obj,
2545 +                                                                  GNOME_GtkHTML_Editor_Engine__classid))->
2546 +       setObjectDataByType) {
2547 +      ORBIT_STUB_PreCall(_obj);
2548 +      _ORBIT_epv->setObjectDataByType(ORBIT_STUB_GetServant(_obj), type_name,
2549 +                                     key, data, ev);
2550 +      ORBIT_STUB_PostCall(_obj);
2551 +   } else {                    /* remote marshal */
2552 +      gpointer _args[3];
2553 +
2554 +      _args[0] = (gpointer) & type_name;
2555 +      _args[1] = (gpointer) & key;
2556 +      _args[2] = (gpointer) & data;
2557 +      ORBit_small_invoke_stub_n(_obj,
2558 +                               &GNOME_GtkHTML_Editor_Engine__iinterface.
2559 +                               methods, 5, NULL, _args, NULL, ev);
2560 +
2561 +   }
2562 +}
2563 +CORBA_boolean
2564 +GNOME_GtkHTML_Editor_Engine_searchByData(GNOME_GtkHTML_Editor_Engine _obj,
2565 +                                        const CORBA_long level,
2566 +                                        const CORBA_char * klass,
2567 +                                        const CORBA_char * key,
2568 +                                        const CORBA_char * value,
2569 +                                        CORBA_Environment * ev)
2570 +{
2571 +   CORBA_boolean _ORBIT_retval;
2572 +   POA_GNOME_GtkHTML_Editor_Engine__epv *_ORBIT_epv;
2573 +
2574 +   if (ORBit_small_flags & ORBIT_SMALL_FAST_LOCALS &&
2575 +       ORBIT_STUB_IsBypass(_obj, GNOME_GtkHTML_Editor_Engine__classid) &&
2576 +       (_ORBIT_epv =
2577 +       (POA_GNOME_GtkHTML_Editor_Engine__epv *) ORBIT_STUB_GetEpv(_obj,
2578 +                                                                  GNOME_GtkHTML_Editor_Engine__classid))->
2579 +       searchByData) {
2580 +      ORBIT_STUB_PreCall(_obj);
2581 +      _ORBIT_retval =
2582 +        _ORBIT_epv->searchByData(ORBIT_STUB_GetServant(_obj), level, klass,
2583 +                                 key, value, ev);
2584 +      ORBIT_STUB_PostCall(_obj);
2585 +   } else {                    /* remote marshal */
2586 +      gpointer _args[4];
2587 +
2588 +      _args[0] = (gpointer) & level;
2589 +      _args[1] = (gpointer) & klass;
2590 +      _args[2] = (gpointer) & key;
2591 +      _args[3] = (gpointer) & value;
2592 +      ORBit_small_invoke_stub_n(_obj,
2593 +                               &GNOME_GtkHTML_Editor_Engine__iinterface.
2594 +                               methods, 6, &_ORBIT_retval, _args, NULL, ev);
2595 +
2596 +   }
2597 +   return _ORBIT_retval;
2598 +}
2599 +
2600 +CORBA_boolean
2601 +GNOME_GtkHTML_Editor_Engine_isParagraphEmpty(GNOME_GtkHTML_Editor_Engine _obj,
2602 +                                            CORBA_Environment * ev)
2603 +{
2604 +   CORBA_boolean _ORBIT_retval;
2605 +   POA_GNOME_GtkHTML_Editor_Engine__epv *_ORBIT_epv;
2606 +
2607 +   if (ORBit_small_flags & ORBIT_SMALL_FAST_LOCALS &&
2608 +       ORBIT_STUB_IsBypass(_obj, GNOME_GtkHTML_Editor_Engine__classid) &&
2609 +       (_ORBIT_epv =
2610 +       (POA_GNOME_GtkHTML_Editor_Engine__epv *) ORBIT_STUB_GetEpv(_obj,
2611 +                                                                  GNOME_GtkHTML_Editor_Engine__classid))->
2612 +       isParagraphEmpty) {
2613 +      ORBIT_STUB_PreCall(_obj);
2614 +      _ORBIT_retval =
2615 +        _ORBIT_epv->isParagraphEmpty(ORBIT_STUB_GetServant(_obj), ev);
2616 +      ORBIT_STUB_PostCall(_obj);
2617 +   } else {                    /* remote marshal */
2618 +      ORBit_small_invoke_stub_n(_obj,
2619 +                               &GNOME_GtkHTML_Editor_Engine__iinterface.
2620 +                               methods, 7, &_ORBIT_retval, NULL, NULL, ev);
2621 +
2622 +   }
2623 +   return _ORBIT_retval;
2624 +}
2625 +
2626 +CORBA_boolean
2627 +GNOME_GtkHTML_Editor_Engine_isPreviousParagraphEmpty
2628 +   (GNOME_GtkHTML_Editor_Engine _obj, CORBA_Environment * ev)
2629 +{
2630 +   CORBA_boolean _ORBIT_retval;
2631 +   POA_GNOME_GtkHTML_Editor_Engine__epv *_ORBIT_epv;
2632 +
2633 +   if (ORBit_small_flags & ORBIT_SMALL_FAST_LOCALS &&
2634 +       ORBIT_STUB_IsBypass(_obj, GNOME_GtkHTML_Editor_Engine__classid) &&
2635 +       (_ORBIT_epv =
2636 +       (POA_GNOME_GtkHTML_Editor_Engine__epv *) ORBIT_STUB_GetEpv(_obj,
2637 +                                                                  GNOME_GtkHTML_Editor_Engine__classid))->
2638 +       isPreviousParagraphEmpty) {
2639 +      ORBIT_STUB_PreCall(_obj);
2640 +      _ORBIT_retval =
2641 +        _ORBIT_epv->isPreviousParagraphEmpty(ORBIT_STUB_GetServant(_obj),
2642 +                                             ev);
2643 +      ORBIT_STUB_PostCall(_obj);
2644 +   } else {                    /* remote marshal */
2645 +      ORBit_small_invoke_stub_n(_obj,
2646 +                               &GNOME_GtkHTML_Editor_Engine__iinterface.
2647 +                               methods, 8, &_ORBIT_retval, NULL, NULL, ev);
2648 +
2649 +   }
2650 +   return _ORBIT_retval;
2651 +}
2652 +
2653 +void
2654 +GNOME_GtkHTML_Editor_Engine_insertHTML(GNOME_GtkHTML_Editor_Engine _obj,
2655 +                                      const CORBA_char * html,
2656 +                                      CORBA_Environment * ev)
2657 +{
2658 +   POA_GNOME_GtkHTML_Editor_Engine__epv *_ORBIT_epv;
2659 +
2660 +   if (ORBit_small_flags & ORBIT_SMALL_FAST_LOCALS &&
2661 +       ORBIT_STUB_IsBypass(_obj, GNOME_GtkHTML_Editor_Engine__classid) &&
2662 +       (_ORBIT_epv =
2663 +       (POA_GNOME_GtkHTML_Editor_Engine__epv *) ORBIT_STUB_GetEpv(_obj,
2664 +                                                                  GNOME_GtkHTML_Editor_Engine__classid))->
2665 +       insertHTML) {
2666 +      ORBIT_STUB_PreCall(_obj);
2667 +      _ORBIT_epv->insertHTML(ORBIT_STUB_GetServant(_obj), html, ev);
2668 +      ORBIT_STUB_PostCall(_obj);
2669 +   } else {                    /* remote marshal */
2670 +      gpointer _args[1];
2671 +
2672 +      _args[0] = (gpointer) & html;
2673 +      ORBit_small_invoke_stub_n(_obj,
2674 +                               &GNOME_GtkHTML_Editor_Engine__iinterface.
2675 +                               methods, 9, NULL, _args, NULL, ev);
2676 +
2677 +   }
2678 +}
2679 +void
2680 +GNOME_GtkHTML_Editor_Engine_freeze(GNOME_GtkHTML_Editor_Engine _obj,
2681 +                                  CORBA_Environment * ev)
2682 +{
2683 +   POA_GNOME_GtkHTML_Editor_Engine__epv *_ORBIT_epv;
2684 +
2685 +   if (ORBit_small_flags & ORBIT_SMALL_FAST_LOCALS &&
2686 +       ORBIT_STUB_IsBypass(_obj, GNOME_GtkHTML_Editor_Engine__classid) &&
2687 +       (_ORBIT_epv =
2688 +       (POA_GNOME_GtkHTML_Editor_Engine__epv *) ORBIT_STUB_GetEpv(_obj,
2689 +                                                                  GNOME_GtkHTML_Editor_Engine__classid))->
2690 +       freeze) {
2691 +      ORBIT_STUB_PreCall(_obj);
2692 +      _ORBIT_epv->freeze(ORBIT_STUB_GetServant(_obj), ev);
2693 +      ORBIT_STUB_PostCall(_obj);
2694 +   } else {                    /* remote marshal */
2695 +      ORBit_small_invoke_stub_n(_obj,
2696 +                               &GNOME_GtkHTML_Editor_Engine__iinterface.
2697 +                               methods, 10, NULL, NULL, NULL, ev);
2698 +
2699 +   }
2700 +}
2701 +void
2702 +GNOME_GtkHTML_Editor_Engine_thaw(GNOME_GtkHTML_Editor_Engine _obj,
2703 +                                CORBA_Environment * ev)
2704 +{
2705 +   POA_GNOME_GtkHTML_Editor_Engine__epv *_ORBIT_epv;
2706 +
2707 +   if (ORBit_small_flags & ORBIT_SMALL_FAST_LOCALS &&
2708 +       ORBIT_STUB_IsBypass(_obj, GNOME_GtkHTML_Editor_Engine__classid) &&
2709 +       (_ORBIT_epv =
2710 +       (POA_GNOME_GtkHTML_Editor_Engine__epv *) ORBIT_STUB_GetEpv(_obj,
2711 +                                                                  GNOME_GtkHTML_Editor_Engine__classid))->
2712 +       thaw) {
2713 +      ORBIT_STUB_PreCall(_obj);
2714 +      _ORBIT_epv->thaw(ORBIT_STUB_GetServant(_obj), ev);
2715 +      ORBIT_STUB_PostCall(_obj);
2716 +   } else {                    /* remote marshal */
2717 +      ORBit_small_invoke_stub_n(_obj,
2718 +                               &GNOME_GtkHTML_Editor_Engine__iinterface.
2719 +                               methods, 11, NULL, NULL, NULL, ev);
2720 +
2721 +   }
2722 +}
2723 +void
2724 +GNOME_GtkHTML_Editor_Engine_undoBegin(GNOME_GtkHTML_Editor_Engine _obj,
2725 +                                     const CORBA_char * undo_name,
2726 +                                     const CORBA_char * redo_name,
2727 +                                     CORBA_Environment * ev)
2728 +{
2729 +   POA_GNOME_GtkHTML_Editor_Engine__epv *_ORBIT_epv;
2730 +
2731 +   if (ORBit_small_flags & ORBIT_SMALL_FAST_LOCALS &&
2732 +       ORBIT_STUB_IsBypass(_obj, GNOME_GtkHTML_Editor_Engine__classid) &&
2733 +       (_ORBIT_epv =
2734 +       (POA_GNOME_GtkHTML_Editor_Engine__epv *) ORBIT_STUB_GetEpv(_obj,
2735 +                                                                  GNOME_GtkHTML_Editor_Engine__classid))->
2736 +       undoBegin) {
2737 +      ORBIT_STUB_PreCall(_obj);
2738 +      _ORBIT_epv->undoBegin(ORBIT_STUB_GetServant(_obj), undo_name, redo_name,
2739 +                           ev);
2740 +      ORBIT_STUB_PostCall(_obj);
2741 +   } else {                    /* remote marshal */
2742 +      gpointer _args[2];
2743 +
2744 +      _args[0] = (gpointer) & undo_name;
2745 +      _args[1] = (gpointer) & redo_name;
2746 +      ORBit_small_invoke_stub_n(_obj,
2747 +                               &GNOME_GtkHTML_Editor_Engine__iinterface.
2748 +                               methods, 12, NULL, _args, NULL, ev);
2749 +
2750 +   }
2751 +}
2752 +void
2753 +GNOME_GtkHTML_Editor_Engine_undoEnd(GNOME_GtkHTML_Editor_Engine _obj,
2754 +                                   CORBA_Environment * ev)
2755 +{
2756 +   POA_GNOME_GtkHTML_Editor_Engine__epv *_ORBIT_epv;
2757 +
2758 +   if (ORBit_small_flags & ORBIT_SMALL_FAST_LOCALS &&
2759 +       ORBIT_STUB_IsBypass(_obj, GNOME_GtkHTML_Editor_Engine__classid) &&
2760 +       (_ORBIT_epv =
2761 +       (POA_GNOME_GtkHTML_Editor_Engine__epv *) ORBIT_STUB_GetEpv(_obj,
2762 +                                                                  GNOME_GtkHTML_Editor_Engine__classid))->
2763 +       undoEnd) {
2764 +      ORBIT_STUB_PreCall(_obj);
2765 +      _ORBIT_epv->undoEnd(ORBIT_STUB_GetServant(_obj), ev);
2766 +      ORBIT_STUB_PostCall(_obj);
2767 +   } else {                    /* remote marshal */
2768 +      ORBit_small_invoke_stub_n(_obj,
2769 +                               &GNOME_GtkHTML_Editor_Engine__iinterface.
2770 +                               methods, 13, NULL, NULL, NULL, ev);
2771 +
2772 +   }
2773 +}
2774 +void
2775 +GNOME_GtkHTML_Editor_Engine_ignoreWord(GNOME_GtkHTML_Editor_Engine _obj,
2776 +                                      const CORBA_char * word,
2777 +                                      CORBA_Environment * ev)
2778 +{
2779 +   POA_GNOME_GtkHTML_Editor_Engine__epv *_ORBIT_epv;
2780 +
2781 +   if (ORBit_small_flags & ORBIT_SMALL_FAST_LOCALS &&
2782 +       ORBIT_STUB_IsBypass(_obj, GNOME_GtkHTML_Editor_Engine__classid) &&
2783 +       (_ORBIT_epv =
2784 +       (POA_GNOME_GtkHTML_Editor_Engine__epv *) ORBIT_STUB_GetEpv(_obj,
2785 +                                                                  GNOME_GtkHTML_Editor_Engine__classid))->
2786 +       ignoreWord) {
2787 +      ORBIT_STUB_PreCall(_obj);
2788 +      _ORBIT_epv->ignoreWord(ORBIT_STUB_GetServant(_obj), word, ev);
2789 +      ORBIT_STUB_PostCall(_obj);
2790 +   } else {                    /* remote marshal */
2791 +      gpointer _args[1];
2792 +
2793 +      _args[0] = (gpointer) & word;
2794 +      ORBit_small_invoke_stub_n(_obj,
2795 +                               &GNOME_GtkHTML_Editor_Engine__iinterface.
2796 +                               methods, 14, NULL, _args, NULL, ev);
2797 +
2798 +   }
2799 +}
2800 +void
2801 +GNOME_GtkHTML_Editor_Engine_dropUndo(GNOME_GtkHTML_Editor_Engine _obj,
2802 +                                    CORBA_Environment * ev)
2803 +{
2804 +   POA_GNOME_GtkHTML_Editor_Engine__epv *_ORBIT_epv;
2805 +
2806 +   if (ORBit_small_flags & ORBIT_SMALL_FAST_LOCALS &&
2807 +       ORBIT_STUB_IsBypass(_obj, GNOME_GtkHTML_Editor_Engine__classid) &&
2808 +       (_ORBIT_epv =
2809 +       (POA_GNOME_GtkHTML_Editor_Engine__epv *) ORBIT_STUB_GetEpv(_obj,
2810 +                                                                  GNOME_GtkHTML_Editor_Engine__classid))->
2811 +       dropUndo) {
2812 +      ORBIT_STUB_PreCall(_obj);
2813 +      _ORBIT_epv->dropUndo(ORBIT_STUB_GetServant(_obj), ev);
2814 +      ORBIT_STUB_PostCall(_obj);
2815 +   } else {                    /* remote marshal */
2816 +      ORBit_small_invoke_stub_n(_obj,
2817 +                               &GNOME_GtkHTML_Editor_Engine__iinterface.
2818 +                               methods, 15, NULL, NULL, NULL, ev);
2819 +
2820 +   }
2821 +}
2822 +CORBA_boolean
2823 +GNOME_GtkHTML_Editor_Engine_hasUndo(GNOME_GtkHTML_Editor_Engine _obj,
2824 +                                   CORBA_Environment * ev)
2825 +{
2826 +   CORBA_boolean _ORBIT_retval;
2827 +   POA_GNOME_GtkHTML_Editor_Engine__epv *_ORBIT_epv;
2828 +
2829 +   if (ORBit_small_flags & ORBIT_SMALL_FAST_LOCALS &&
2830 +       ORBIT_STUB_IsBypass(_obj, GNOME_GtkHTML_Editor_Engine__classid) &&
2831 +       (_ORBIT_epv =
2832 +       (POA_GNOME_GtkHTML_Editor_Engine__epv *) ORBIT_STUB_GetEpv(_obj,
2833 +                                                                  GNOME_GtkHTML_Editor_Engine__classid))->
2834 +       hasUndo) {
2835 +      ORBIT_STUB_PreCall(_obj);
2836 +      _ORBIT_retval = _ORBIT_epv->hasUndo(ORBIT_STUB_GetServant(_obj), ev);
2837 +      ORBIT_STUB_PostCall(_obj);
2838 +   } else {                    /* remote marshal */
2839 +      ORBit_small_invoke_stub_n(_obj,
2840 +                               &GNOME_GtkHTML_Editor_Engine__iinterface.
2841 +                               methods, 16, &_ORBIT_retval, NULL, NULL, ev);
2842 +
2843 +   }
2844 +   return _ORBIT_retval;
2845 +}
2846 diff -Nur vim63/src/gtkhtml.h vim63-bonobo/src/gtkhtml.h
2847 --- vim63/src/gtkhtml.h 1970-01-01 01:00:00.000000000 +0100
2848 +++ vim63-bonobo/src/gtkhtml.h  2005-09-09 20:14:02.725585912 +0200
2849 @@ -0,0 +1,480 @@
2850 +/*
2851 + * This file was generated by orbit-idl-2 - DO NOT EDIT!
2852 + */
2853 +
2854 +#ifndef Editor_H
2855 +#define Editor_H 1
2856 +#include <glib.h>
2857 +#define ORBIT_IDL_SERIAL 19
2858 +#include <orbit/orbit-types.h>
2859 +
2860 +#ifdef __cplusplus
2861 +extern "C"
2862 +{
2863 +#endif                         /* __cplusplus */
2864 +
2865 +/** typedefs **/
2866 +#include <bonobo/Bonobo.h>
2867 +#if !defined(ORBIT_DECL_GNOME_GtkHTML_Editor_Listener) && !defined(_GNOME_GtkHTML_Editor_Listener_defined)
2868 +#define ORBIT_DECL_GNOME_GtkHTML_Editor_Listener 1
2869 +#define _GNOME_GtkHTML_Editor_Listener_defined 1
2870 +#define GNOME_GtkHTML_Editor_Listener__freekids CORBA_Object__freekids
2871 +   typedef CORBA_Object GNOME_GtkHTML_Editor_Listener;
2872 +   extern CORBA_unsigned_long GNOME_GtkHTML_Editor_Listener__classid;
2873 +#if !defined(TC_IMPL_TC_GNOME_GtkHTML_Editor_Listener_0)
2874 +#define TC_IMPL_TC_GNOME_GtkHTML_Editor_Listener_0 'E'
2875 +#define TC_IMPL_TC_GNOME_GtkHTML_Editor_Listener_1 'd'
2876 +#define TC_IMPL_TC_GNOME_GtkHTML_Editor_Listener_2 'i'
2877 +#define TC_IMPL_TC_GNOME_GtkHTML_Editor_Listener_3 't'
2878 +#define TC_IMPL_TC_GNOME_GtkHTML_Editor_Listener_4 'o'
2879 +#define TC_IMPL_TC_GNOME_GtkHTML_Editor_Listener_5 'r'
2880 +#ifdef ORBIT_IDL_C_IMODULE
2881 +   static
2882 +#else
2883 +   extern
2884 +#endif
2885 +   const struct CORBA_TypeCode_struct TC_GNOME_GtkHTML_Editor_Listener_struct;
2886 +#define TC_GNOME_GtkHTML_Editor_Listener ((CORBA_TypeCode)&TC_GNOME_GtkHTML_Editor_Listener_struct)
2887 +#endif
2888 +#endif
2889 +#if !defined(ORBIT_DECL_GNOME_GtkHTML_Editor_Engine) && !defined(_GNOME_GtkHTML_Editor_Engine_defined)
2890 +#define ORBIT_DECL_GNOME_GtkHTML_Editor_Engine 1
2891 +#define _GNOME_GtkHTML_Editor_Engine_defined 1
2892 +#define GNOME_GtkHTML_Editor_Engine__freekids CORBA_Object__freekids
2893 +   typedef CORBA_Object GNOME_GtkHTML_Editor_Engine;
2894 +   extern CORBA_unsigned_long GNOME_GtkHTML_Editor_Engine__classid;
2895 +#if !defined(TC_IMPL_TC_GNOME_GtkHTML_Editor_Engine_0)
2896 +#define TC_IMPL_TC_GNOME_GtkHTML_Editor_Engine_0 'E'
2897 +#define TC_IMPL_TC_GNOME_GtkHTML_Editor_Engine_1 'd'
2898 +#define TC_IMPL_TC_GNOME_GtkHTML_Editor_Engine_2 'i'
2899 +#define TC_IMPL_TC_GNOME_GtkHTML_Editor_Engine_3 't'
2900 +#define TC_IMPL_TC_GNOME_GtkHTML_Editor_Engine_4 'o'
2901 +#define TC_IMPL_TC_GNOME_GtkHTML_Editor_Engine_5 'r'
2902 +#ifdef ORBIT_IDL_C_IMODULE
2903 +   static
2904 +#else
2905 +   extern
2906 +#endif
2907 +   const struct CORBA_TypeCode_struct TC_GNOME_GtkHTML_Editor_Engine_struct;
2908 +#define TC_GNOME_GtkHTML_Editor_Engine ((CORBA_TypeCode)&TC_GNOME_GtkHTML_Editor_Engine_struct)
2909 +#endif
2910 +#endif
2911 +#if !defined(_GNOME_GtkHTML_Editor_URLRequestEvent_defined)
2912 +#define _GNOME_GtkHTML_Editor_URLRequestEvent_defined 1
2913 +   typedef struct GNOME_GtkHTML_Editor_URLRequestEvent_type
2914 +      GNOME_GtkHTML_Editor_URLRequestEvent;
2915 +   struct GNOME_GtkHTML_Editor_URLRequestEvent_type
2916 +   {
2917 +      CORBA_string url;
2918 +      Bonobo_Stream stream;
2919 +   };
2920 +
2921 +#if !defined(TC_IMPL_TC_GNOME_GtkHTML_Editor_URLRequestEvent_0)
2922 +#define TC_IMPL_TC_GNOME_GtkHTML_Editor_URLRequestEvent_0 'E'
2923 +#define TC_IMPL_TC_GNOME_GtkHTML_Editor_URLRequestEvent_1 'd'
2924 +#define TC_IMPL_TC_GNOME_GtkHTML_Editor_URLRequestEvent_2 'i'
2925 +#define TC_IMPL_TC_GNOME_GtkHTML_Editor_URLRequestEvent_3 't'
2926 +#define TC_IMPL_TC_GNOME_GtkHTML_Editor_URLRequestEvent_4 'o'
2927 +#define TC_IMPL_TC_GNOME_GtkHTML_Editor_URLRequestEvent_5 'r'
2928 +#ifdef ORBIT_IDL_C_IMODULE
2929 +   static
2930 +#else
2931 +   extern
2932 +#endif
2933 +   const struct CORBA_TypeCode_struct
2934 +      TC_GNOME_GtkHTML_Editor_URLRequestEvent_struct;
2935 +#define TC_GNOME_GtkHTML_Editor_URLRequestEvent ((CORBA_TypeCode)&TC_GNOME_GtkHTML_Editor_URLRequestEvent_struct)
2936 +#endif
2937 +#define GNOME_GtkHTML_Editor_URLRequestEvent__alloc() ((GNOME_GtkHTML_Editor_URLRequestEvent *)ORBit_small_alloc (TC_GNOME_GtkHTML_Editor_URLRequestEvent))
2938 +#define GNOME_GtkHTML_Editor_URLRequestEvent__freekids(m,d) ORBit_small_freekids (TC_GNOME_GtkHTML_Editor_URLRequestEvent,(m),(d))
2939 +#endif
2940 +
2941 +/** POA structures **/
2942 +#ifndef _defined_POA_GNOME_GtkHTML_Editor_Listener
2943 +#define _defined_POA_GNOME_GtkHTML_Editor_Listener 1
2944 +   typedef struct
2945 +   {
2946 +      void *_private;
2947 +      CORBA_any *(*event) (PortableServer_Servant _servant,
2948 +                          const CORBA_char * name, const CORBA_any * arg,
2949 +                          CORBA_Environment * ev);
2950 +   }
2951 +   POA_GNOME_GtkHTML_Editor_Listener__epv;
2952 +   typedef struct
2953 +   {
2954 +      PortableServer_ServantBase__epv *_base_epv;
2955 +      POA_Bonobo_Unknown__epv *Bonobo_Unknown_epv;
2956 +      POA_GNOME_GtkHTML_Editor_Listener__epv
2957 +        *GNOME_GtkHTML_Editor_Listener_epv;
2958 +   }
2959 +   POA_GNOME_GtkHTML_Editor_Listener__vepv;
2960 +   typedef struct
2961 +   {
2962 +      void *_private;
2963 +      POA_GNOME_GtkHTML_Editor_Listener__vepv *vepv;
2964 +   }
2965 +   POA_GNOME_GtkHTML_Editor_Listener;
2966 +   extern void POA_GNOME_GtkHTML_Editor_Listener__init(PortableServer_Servant
2967 +                                                      servant,
2968 +                                                      CORBA_Environment *
2969 +                                                      ev);
2970 +   extern void POA_GNOME_GtkHTML_Editor_Listener__fini(PortableServer_Servant
2971 +                                                      servant,
2972 +                                                      CORBA_Environment *
2973 +                                                      ev);
2974 +#endif                         /* _defined_POA_GNOME_GtkHTML_Editor_Listener */
2975 +#ifndef _defined_POA_GNOME_GtkHTML_Editor_Engine
2976 +#define _defined_POA_GNOME_GtkHTML_Editor_Engine 1
2977 +   typedef struct
2978 +   {
2979 +      void *_private;
2980 +       GNOME_GtkHTML_Editor_Listener(*_get_listener) (PortableServer_Servant
2981 +                                                     _servant,
2982 +                                                     CORBA_Environment * ev);
2983 +      void (*_set_listener) (PortableServer_Servant _servant,
2984 +                            const GNOME_GtkHTML_Editor_Listener value,
2985 +                            CORBA_Environment * ev);
2986 +       CORBA_boolean(*runCommand) (PortableServer_Servant _servant,
2987 +                                  const CORBA_char * command,
2988 +                                  CORBA_Environment * ev);
2989 +       CORBA_string(*getParagraphData) (PortableServer_Servant _servant,
2990 +                                       const CORBA_char * key,
2991 +                                       CORBA_Environment * ev);
2992 +      void (*setParagraphData) (PortableServer_Servant _servant,
2993 +                               const CORBA_char * key,
2994 +                               const CORBA_char * value,
2995 +                               CORBA_Environment * ev);
2996 +      void (*setObjectDataByType) (PortableServer_Servant _servant,
2997 +                                  const CORBA_char * type_name,
2998 +                                  const CORBA_char * key,
2999 +                                  const CORBA_char * data,
3000 +                                  CORBA_Environment * ev);
3001 +       CORBA_boolean(*searchByData) (PortableServer_Servant _servant,
3002 +                                    const CORBA_long level,
3003 +                                    const CORBA_char * klass,
3004 +                                    const CORBA_char * key,
3005 +                                    const CORBA_char * value,
3006 +                                    CORBA_Environment * ev);
3007 +       CORBA_boolean(*isParagraphEmpty) (PortableServer_Servant _servant,
3008 +                                        CORBA_Environment * ev);
3009 +       CORBA_boolean(*isPreviousParagraphEmpty) (PortableServer_Servant
3010 +                                                _servant,
3011 +                                                CORBA_Environment * ev);
3012 +      void (*insertHTML) (PortableServer_Servant _servant,
3013 +                         const CORBA_char * html, CORBA_Environment * ev);
3014 +      void (*freeze) (PortableServer_Servant _servant,
3015 +                     CORBA_Environment * ev);
3016 +      void (*thaw) (PortableServer_Servant _servant, CORBA_Environment * ev);
3017 +      void (*undoBegin) (PortableServer_Servant _servant,
3018 +                        const CORBA_char * undo_name,
3019 +                        const CORBA_char * redo_name,
3020 +                        CORBA_Environment * ev);
3021 +      void (*undoEnd) (PortableServer_Servant _servant,
3022 +                      CORBA_Environment * ev);
3023 +      void (*ignoreWord) (PortableServer_Servant _servant,
3024 +                         const CORBA_char * word, CORBA_Environment * ev);
3025 +      void (*dropUndo) (PortableServer_Servant _servant,
3026 +                       CORBA_Environment * ev);
3027 +       CORBA_boolean(*hasUndo) (PortableServer_Servant _servant,
3028 +                               CORBA_Environment * ev);
3029 +   }
3030 +   POA_GNOME_GtkHTML_Editor_Engine__epv;
3031 +   typedef struct
3032 +   {
3033 +      PortableServer_ServantBase__epv *_base_epv;
3034 +      POA_Bonobo_Unknown__epv *Bonobo_Unknown_epv;
3035 +      POA_GNOME_GtkHTML_Editor_Engine__epv *GNOME_GtkHTML_Editor_Engine_epv;
3036 +   }
3037 +   POA_GNOME_GtkHTML_Editor_Engine__vepv;
3038 +   typedef struct
3039 +   {
3040 +      void *_private;
3041 +      POA_GNOME_GtkHTML_Editor_Engine__vepv *vepv;
3042 +   }
3043 +   POA_GNOME_GtkHTML_Editor_Engine;
3044 +   extern void POA_GNOME_GtkHTML_Editor_Engine__init(PortableServer_Servant
3045 +                                                    servant,
3046 +                                                    CORBA_Environment * ev);
3047 +   extern void POA_GNOME_GtkHTML_Editor_Engine__fini(PortableServer_Servant
3048 +                                                    servant,
3049 +                                                    CORBA_Environment * ev);
3050 +#endif                         /* _defined_POA_GNOME_GtkHTML_Editor_Engine */
3051 +
3052 +/** skel prototypes **/
3053 +   void
3054 +      _ORBIT_skel_small_GNOME_GtkHTML_Editor_Listener_event
3055 +      (POA_GNOME_GtkHTML_Editor_Listener * _ORBIT_servant,
3056 +       gpointer _ORBIT_retval, gpointer * _ORBIT_args, CORBA_Context ctx,
3057 +       CORBA_Environment * ev,
3058 +       CORBA_any * (*_impl_event) (PortableServer_Servant _servant,
3059 +                                  const CORBA_char * name,
3060 +                                  const CORBA_any * arg,
3061 +                                  CORBA_Environment * ev));
3062 +   void
3063 +      _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine__get_listener
3064 +      (POA_GNOME_GtkHTML_Editor_Engine * _ORBIT_servant,
3065 +       gpointer _ORBIT_retval, gpointer * _ORBIT_args, CORBA_Context ctx,
3066 +       CORBA_Environment * ev,
3067 +       GNOME_GtkHTML_Editor_Listener(*_impl__get_listener)
3068 +       (PortableServer_Servant _servant, CORBA_Environment * ev));
3069 +   void
3070 +      _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine__set_listener
3071 +      (POA_GNOME_GtkHTML_Editor_Engine * _ORBIT_servant,
3072 +       gpointer _ORBIT_retval, gpointer * _ORBIT_args, CORBA_Context ctx,
3073 +       CORBA_Environment * ev,
3074 +       void (*_impl__set_listener) (PortableServer_Servant _servant,
3075 +                                   const GNOME_GtkHTML_Editor_Listener value,
3076 +                                   CORBA_Environment * ev));
3077 +   void
3078 +      _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_runCommand
3079 +      (POA_GNOME_GtkHTML_Editor_Engine * _ORBIT_servant,
3080 +       gpointer _ORBIT_retval, gpointer * _ORBIT_args, CORBA_Context ctx,
3081 +       CORBA_Environment * ev,
3082 +       CORBA_boolean(*_impl_runCommand) (PortableServer_Servant _servant,
3083 +                                        const CORBA_char * command,
3084 +                                        CORBA_Environment * ev));
3085 +   void
3086 +      _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_getParagraphData
3087 +      (POA_GNOME_GtkHTML_Editor_Engine * _ORBIT_servant,
3088 +       gpointer _ORBIT_retval, gpointer * _ORBIT_args, CORBA_Context ctx,
3089 +       CORBA_Environment * ev,
3090 +       CORBA_string(*_impl_getParagraphData) (PortableServer_Servant _servant,
3091 +                                             const CORBA_char * key,
3092 +                                             CORBA_Environment * ev));
3093 +   void
3094 +      _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_setParagraphData
3095 +      (POA_GNOME_GtkHTML_Editor_Engine * _ORBIT_servant,
3096 +       gpointer _ORBIT_retval, gpointer * _ORBIT_args, CORBA_Context ctx,
3097 +       CORBA_Environment * ev,
3098 +       void (*_impl_setParagraphData) (PortableServer_Servant _servant,
3099 +                                      const CORBA_char * key,
3100 +                                      const CORBA_char * value,
3101 +                                      CORBA_Environment * ev));
3102 +   void
3103 +      _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_setObjectDataByType
3104 +      (POA_GNOME_GtkHTML_Editor_Engine * _ORBIT_servant,
3105 +       gpointer _ORBIT_retval, gpointer * _ORBIT_args, CORBA_Context ctx,
3106 +       CORBA_Environment * ev,
3107 +       void (*_impl_setObjectDataByType) (PortableServer_Servant _servant,
3108 +                                         const CORBA_char * type_name,
3109 +                                         const CORBA_char * key,
3110 +                                         const CORBA_char * data,
3111 +                                         CORBA_Environment * ev));
3112 +   void
3113 +      _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_searchByData
3114 +      (POA_GNOME_GtkHTML_Editor_Engine * _ORBIT_servant,
3115 +       gpointer _ORBIT_retval, gpointer * _ORBIT_args, CORBA_Context ctx,
3116 +       CORBA_Environment * ev,
3117 +       CORBA_boolean(*_impl_searchByData) (PortableServer_Servant _servant,
3118 +                                          const CORBA_long level,
3119 +                                          const CORBA_char * klass,
3120 +                                          const CORBA_char * key,
3121 +                                          const CORBA_char * value,
3122 +                                          CORBA_Environment * ev));
3123 +   void
3124 +      _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_isParagraphEmpty
3125 +      (POA_GNOME_GtkHTML_Editor_Engine * _ORBIT_servant,
3126 +       gpointer _ORBIT_retval, gpointer * _ORBIT_args, CORBA_Context ctx,
3127 +       CORBA_Environment * ev,
3128 +       CORBA_boolean(*_impl_isParagraphEmpty) (PortableServer_Servant
3129 +                                              _servant,
3130 +                                              CORBA_Environment * ev));
3131 +   void
3132 +      _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_isPreviousParagraphEmpty
3133 +      (POA_GNOME_GtkHTML_Editor_Engine * _ORBIT_servant,
3134 +       gpointer _ORBIT_retval, gpointer * _ORBIT_args, CORBA_Context ctx,
3135 +       CORBA_Environment * ev,
3136 +       CORBA_boolean(*_impl_isPreviousParagraphEmpty) (PortableServer_Servant
3137 +                                                      _servant,
3138 +                                                      CORBA_Environment *
3139 +                                                      ev));
3140 +   void
3141 +      _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_insertHTML
3142 +      (POA_GNOME_GtkHTML_Editor_Engine * _ORBIT_servant,
3143 +       gpointer _ORBIT_retval, gpointer * _ORBIT_args, CORBA_Context ctx,
3144 +       CORBA_Environment * ev,
3145 +       void (*_impl_insertHTML) (PortableServer_Servant _servant,
3146 +                                const CORBA_char * html,
3147 +                                CORBA_Environment * ev));
3148 +   void
3149 +      _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_freeze
3150 +      (POA_GNOME_GtkHTML_Editor_Engine * _ORBIT_servant,
3151 +       gpointer _ORBIT_retval, gpointer * _ORBIT_args, CORBA_Context ctx,
3152 +       CORBA_Environment * ev,
3153 +       void (*_impl_freeze) (PortableServer_Servant _servant,
3154 +                            CORBA_Environment * ev));
3155 +   void
3156 +      _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_thaw
3157 +      (POA_GNOME_GtkHTML_Editor_Engine * _ORBIT_servant,
3158 +       gpointer _ORBIT_retval, gpointer * _ORBIT_args, CORBA_Context ctx,
3159 +       CORBA_Environment * ev,
3160 +       void (*_impl_thaw) (PortableServer_Servant _servant,
3161 +                          CORBA_Environment * ev));
3162 +   void
3163 +      _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_undoBegin
3164 +      (POA_GNOME_GtkHTML_Editor_Engine * _ORBIT_servant,
3165 +       gpointer _ORBIT_retval, gpointer * _ORBIT_args, CORBA_Context ctx,
3166 +       CORBA_Environment * ev,
3167 +       void (*_impl_undoBegin) (PortableServer_Servant _servant,
3168 +                               const CORBA_char * undo_name,
3169 +                               const CORBA_char * redo_name,
3170 +                               CORBA_Environment * ev));
3171 +   void
3172 +      _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_undoEnd
3173 +      (POA_GNOME_GtkHTML_Editor_Engine * _ORBIT_servant,
3174 +       gpointer _ORBIT_retval, gpointer * _ORBIT_args, CORBA_Context ctx,
3175 +       CORBA_Environment * ev,
3176 +       void (*_impl_undoEnd) (PortableServer_Servant _servant,
3177 +                             CORBA_Environment * ev));
3178 +   void
3179 +      _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_ignoreWord
3180 +      (POA_GNOME_GtkHTML_Editor_Engine * _ORBIT_servant,
3181 +       gpointer _ORBIT_retval, gpointer * _ORBIT_args, CORBA_Context ctx,
3182 +       CORBA_Environment * ev,
3183 +       void (*_impl_ignoreWord) (PortableServer_Servant _servant,
3184 +                                const CORBA_char * word,
3185 +                                CORBA_Environment * ev));
3186 +   void
3187 +      _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_dropUndo
3188 +      (POA_GNOME_GtkHTML_Editor_Engine * _ORBIT_servant,
3189 +       gpointer _ORBIT_retval, gpointer * _ORBIT_args, CORBA_Context ctx,
3190 +       CORBA_Environment * ev,
3191 +       void (*_impl_dropUndo) (PortableServer_Servant _servant,
3192 +                              CORBA_Environment * ev));
3193 +   void
3194 +      _ORBIT_skel_small_GNOME_GtkHTML_Editor_Engine_hasUndo
3195 +      (POA_GNOME_GtkHTML_Editor_Engine * _ORBIT_servant,
3196 +       gpointer _ORBIT_retval, gpointer * _ORBIT_args, CORBA_Context ctx,
3197 +       CORBA_Environment * ev,
3198 +       CORBA_boolean(*_impl_hasUndo) (PortableServer_Servant _servant,
3199 +                                     CORBA_Environment * ev));
3200 +
3201 +/** stub prototypes **/
3202 +#define GNOME_GtkHTML_Editor_Listener_ref Bonobo_Unknown_ref
3203 +#define GNOME_GtkHTML_Editor_Listener_unref Bonobo_Unknown_unref
3204 +#define GNOME_GtkHTML_Editor_Listener_queryInterface Bonobo_Unknown_queryInterface
3205 +   CORBA_any
3206 +      *GNOME_GtkHTML_Editor_Listener_event(GNOME_GtkHTML_Editor_Listener _obj,
3207 +                                          const CORBA_char * name,
3208 +                                          const CORBA_any * arg,
3209 +                                          CORBA_Environment * ev);
3210 +#define GNOME_GtkHTML_Editor_Engine_ref Bonobo_Unknown_ref
3211 +#define GNOME_GtkHTML_Editor_Engine_unref Bonobo_Unknown_unref
3212 +#define GNOME_GtkHTML_Editor_Engine_queryInterface Bonobo_Unknown_queryInterface
3213 +   GNOME_GtkHTML_Editor_Listener
3214 +      GNOME_GtkHTML_Editor_Engine__get_listener(GNOME_GtkHTML_Editor_Engine
3215 +                                               _obj, CORBA_Environment * ev);
3216 +   void GNOME_GtkHTML_Editor_Engine__set_listener(GNOME_GtkHTML_Editor_Engine
3217 +                                                 _obj,
3218 +                                                 const
3219 +                                                 GNOME_GtkHTML_Editor_Listener
3220 +                                                 value,
3221 +                                                 CORBA_Environment * ev);
3222 +   CORBA_boolean
3223 +      GNOME_GtkHTML_Editor_Engine_runCommand(GNOME_GtkHTML_Editor_Engine _obj,
3224 +                                            const CORBA_char * command,
3225 +                                            CORBA_Environment * ev);
3226 +   CORBA_string
3227 +      GNOME_GtkHTML_Editor_Engine_getParagraphData(GNOME_GtkHTML_Editor_Engine
3228 +                                                  _obj,
3229 +                                                  const CORBA_char * key,
3230 +                                                  CORBA_Environment * ev);
3231 +   void
3232 +      GNOME_GtkHTML_Editor_Engine_setParagraphData(GNOME_GtkHTML_Editor_Engine
3233 +                                                  _obj,
3234 +                                                  const CORBA_char * key,
3235 +                                                  const CORBA_char * value,
3236 +                                                  CORBA_Environment * ev);
3237 +   void
3238 +      GNOME_GtkHTML_Editor_Engine_setObjectDataByType
3239 +      (GNOME_GtkHTML_Editor_Engine _obj, const CORBA_char * type_name,
3240 +       const CORBA_char * key, const CORBA_char * data,
3241 +       CORBA_Environment * ev);
3242 +   CORBA_boolean
3243 +      GNOME_GtkHTML_Editor_Engine_searchByData(GNOME_GtkHTML_Editor_Engine
3244 +                                              _obj, const CORBA_long level,
3245 +                                              const CORBA_char * klass,
3246 +                                              const CORBA_char * key,
3247 +                                              const CORBA_char * value,
3248 +                                              CORBA_Environment * ev);
3249 +   CORBA_boolean
3250 +      GNOME_GtkHTML_Editor_Engine_isParagraphEmpty(GNOME_GtkHTML_Editor_Engine
3251 +                                                  _obj,
3252 +                                                  CORBA_Environment * ev);
3253 +   CORBA_boolean
3254 +      GNOME_GtkHTML_Editor_Engine_isPreviousParagraphEmpty
3255 +      (GNOME_GtkHTML_Editor_Engine _obj, CORBA_Environment * ev);
3256 +   void GNOME_GtkHTML_Editor_Engine_insertHTML(GNOME_GtkHTML_Editor_Engine
3257 +                                              _obj, const CORBA_char * html,
3258 +                                              CORBA_Environment * ev);
3259 +   void GNOME_GtkHTML_Editor_Engine_freeze(GNOME_GtkHTML_Editor_Engine _obj,
3260 +                                          CORBA_Environment * ev);
3261 +   void GNOME_GtkHTML_Editor_Engine_thaw(GNOME_GtkHTML_Editor_Engine _obj,
3262 +                                        CORBA_Environment * ev);
3263 +   void GNOME_GtkHTML_Editor_Engine_undoBegin(GNOME_GtkHTML_Editor_Engine
3264 +                                             _obj,
3265 +                                             const CORBA_char * undo_name,
3266 +                                             const CORBA_char * redo_name,
3267 +                                             CORBA_Environment * ev);
3268 +   void GNOME_GtkHTML_Editor_Engine_undoEnd(GNOME_GtkHTML_Editor_Engine _obj,
3269 +                                           CORBA_Environment * ev);
3270 +   void GNOME_GtkHTML_Editor_Engine_ignoreWord(GNOME_GtkHTML_Editor_Engine
3271 +                                              _obj, const CORBA_char * word,
3272 +                                              CORBA_Environment * ev);
3273 +   void GNOME_GtkHTML_Editor_Engine_dropUndo(GNOME_GtkHTML_Editor_Engine _obj,
3274 +                                            CORBA_Environment * ev);
3275 +   CORBA_boolean
3276 +      GNOME_GtkHTML_Editor_Engine_hasUndo(GNOME_GtkHTML_Editor_Engine _obj,
3277 +                                         CORBA_Environment * ev);
3278 +
3279 +/** more internals **/
3280 +#if !defined(MARSHAL_IMPL_GNOME_GtkHTML_Editor_URLRequestEvent_0)
3281 +#define MARSHAL_IMPL_GNOME_GtkHTML_Editor_URLRequestEvent_0 'E'
3282 +#define MARSHAL_IMPL_GNOME_GtkHTML_Editor_URLRequestEvent_1 'd'
3283 +#define MARSHAL_IMPL_GNOME_GtkHTML_Editor_URLRequestEvent_2 'i'
3284 +#define MARSHAL_IMPL_GNOME_GtkHTML_Editor_URLRequestEvent_3 't'
3285 +#define MARSHAL_IMPL_GNOME_GtkHTML_Editor_URLRequestEvent_4 'o'
3286 +#define MARSHAL_IMPL_GNOME_GtkHTML_Editor_URLRequestEvent_5 'r'
3287 +#endif
3288 +#include <orbit/orb-core/orbit-interface.h>
3289 +
3290 +#ifdef ORBIT_IDL_C_IMODULE
3291 +   static
3292 +#else
3293 +   extern
3294 +#endif
3295 +   ORBit_IInterface GNOME_GtkHTML_Editor_Listener__iinterface;
3296 +#define GNOME_GtkHTML_Editor_Listener_IMETHODS_LEN 1
3297 +#ifdef ORBIT_IDL_C_IMODULE
3298 +   static
3299 +#else
3300 +   extern
3301 +#endif
3302 +   ORBit_IMethod
3303 +      GNOME_GtkHTML_Editor_Listener__imethods
3304 +      [GNOME_GtkHTML_Editor_Listener_IMETHODS_LEN];
3305 +#ifdef ORBIT_IDL_C_IMODULE
3306 +   static
3307 +#else
3308 +   extern
3309 +#endif
3310 +   ORBit_IInterface GNOME_GtkHTML_Editor_Engine__iinterface;
3311 +#define GNOME_GtkHTML_Editor_Engine_IMETHODS_LEN 17
3312 +#ifdef ORBIT_IDL_C_IMODULE
3313 +   static
3314 +#else
3315 +   extern
3316 +#endif
3317 +   ORBit_IMethod
3318 +      GNOME_GtkHTML_Editor_Engine__imethods
3319 +      [GNOME_GtkHTML_Editor_Engine_IMETHODS_LEN];
3320 +#ifdef __cplusplus
3321 +}
3322 +#endif                         /* __cplusplus */
3323 +
3324 +#ifndef EXCLUDE_ORBIT_H
3325 +#include <orbit/orbit.h>
3326 +
3327 +#endif                         /* EXCLUDE_ORBIT_H */
3328 +#endif
3329 +#undef ORBIT_IDL_SERIAL
3330 diff -Nur vim63/src/gui.c vim63-bonobo/src/gui.c
3331 --- vim63/src/gui.c     2005-09-09 20:11:10.562758000 +0200
3332 +++ vim63-bonobo/src/gui.c      2005-09-09 20:14:02.733584696 +0200
3333 @@ -440,8 +440,12 @@
3334       * Create the GUI shell.
3335       */
3336      gui.in_use = TRUE;         /* Must be set after menus have been set up */
3337 +#ifdef FEAT_GUI_COMPONENT
3338 +    vim_bonobo_wait_for_instantiation();
3339 +#else
3340      if (gui_mch_init() == FAIL)
3341         goto error;
3342 +#endif
3343  
3344      /* Avoid a delay for an error message that was printed in the terminal
3345       * where Vim was started. */
3346 @@ -4193,8 +4197,8 @@
3347         add_to_input_buf(st, 8);
3348  #ifdef FEAT_GUI_GTK
3349         /* Need to wake up the main loop */
3350 -       if (gtk_main_level() > 0)
3351 -           gtk_main_quit();
3352 +       if (MAIN_LEVEL() > 0)
3353 +           MAIN_QUIT();
3354  #endif
3355      }
3356  }
3357 @@ -4407,8 +4411,12 @@
3358      int
3359  no_console_input()
3360  {
3361 -    return ((!gui.in_use || gui.starting)
3362 -# ifndef NO_CONSOLE
3363 +    return ((!gui.in_use || gui.starting || !gui.shell_created
3364 +#ifdef FEAT_GUI_COMPONENT
3365 +            || gui.processing_call
3366 +#endif
3367 +                )
3368 +# if !defined(NO_CONSOLE) && !defined(FEAT_GUI_COMPONENT)
3369             && !isatty(0) && !isatty(2)
3370  # endif
3371             );
3372 diff -Nur vim63/src/gui_gtk.c vim63-bonobo/src/gui_gtk.c
3373 --- vim63/src/gui_gtk.c 2005-09-09 20:11:09.520917000 +0200
3374 +++ vim63-bonobo/src/gui_gtk.c  2005-09-09 20:14:02.737584088 +0200
3375 @@ -39,7 +39,7 @@
3376  
3377  #include "vim.h"
3378  
3379 -#ifdef FEAT_GUI_GNOME
3380 +#if 0
3381  /* Gnome redefines _() and N_().  Grrr... */
3382  # ifdef _
3383  #  undef _
3384 @@ -554,9 +554,332 @@
3385  
3386  # endif /* !HAVE_GTK2 */
3387  
3388 +#ifdef FEAT_GUI_COMPONENT
3389 +
3390 +
3391 +static void
3392 +verb_activate( BonoboUIComponent *uic, gpointer data, const char *cname )
3393 +{
3394 +    gui_menu_cb((vimmenu_T *) data);
3395 +
3396 +    /* make sure the menu action is taken immediately */
3397 +    if (MAIN_LEVEL() > 0)
3398 +       MAIN_QUIT();
3399 +}
3400 +
3401 +/* Takes name (a label), and appends a normalized version of name to
3402 + * the destination string.  Normalization in this case means taking only 
3403 + * alphanumeric characters, and discarding all others.  */
3404 +static void g_string_append_normalized_name( GString * dest, char_u * name )
3405 +{
3406 +    gchar * cur;
3407 +
3408 +    if( name == NULL ) 
3409 +    {
3410 +        return;
3411 +    }
3412 +    cur = name;
3413 +    while( *cur != '\0' ) {
3414 +        gunichar wc;
3415 +        wc = g_utf8_get_char(cur);
3416 +        if( g_unichar_isalnum( wc ) ) {
3417 +            g_string_append_unichar( dest, wc );
3418 +        }
3419 +        cur = g_utf8_next_char(cur);
3420 +    }
3421 +}
3422 +
3423 +/* for the given menu, create the corresponding xml path.
3424 + * if to_parent is TRUE, returns the path to the parent of the given menu.
3425 + */
3426 +static
3427 +char * xml_path_for_menu( vimmenu_T * menu, int to_parent )
3428 +{
3429 +    GString * normname;
3430 +    GString * path;
3431 +    char * retpath;
3432 +    
3433 +    normname = g_string_sized_new( 64 );
3434 +    path = g_string_sized_new( 128 );
3435 +    while( 1 ) {
3436 +        if( menu_is_toolbar(menu->name) ) {
3437 +            /* "Toolbar" is a standard Bonobo UI element, but Vim uses "ToolBar", so we
3438 +             * have to check for this. */
3439 +            g_string_prepend( path, "/Toolbar");
3440 +        } else {
3441 +            g_string_assign( normname, "" );
3442 +            g_string_append_normalized_name( normname, menu->dname );
3443 +            g_string_prepend( path, normname->str );
3444 +            g_string_prepend( path, "/" );
3445 +        }
3446 +        if( menu->parent == NULL ) {
3447 +            if( menu && menu_is_menubar( menu->name ) ) {
3448 +                g_string_prepend( path, "/menu" );
3449 +            }
3450 +            break;
3451 +        }
3452 +        menu = menu->parent;
3453 +    }
3454 +    g_string_free( normname, TRUE );
3455 +    retpath = path->str;
3456 +    g_string_free( path, FALSE );
3457 +
3458 +    if( to_parent ) {
3459 +        gchar * slash;
3460 +        slash = g_strrstr(retpath, "/");
3461 +        if( slash == retpath )
3462 +            slash[1] = '\0';
3463 +        else if( slash ) 
3464 +            *slash = '\0';
3465 +    }
3466 +    return( retpath );
3467 +}
3468 +
3469 +/* Because the container which embeds Vim may not have the same toolbar icons
3470 + * installed, we need to send the icons in the XML stream.  This function
3471 + * takes the given GtkImage, encodes it as XML and returns the resulting XML
3472 + * as a string. */
3473 +static char *
3474 +gtk_image_to_xml_attrs( GtkImage * image)
3475 +{
3476 +    GString * xml = g_string_sized_new(32);
3477 +    GtkImageType type = gtk_image_get_storage_type(image);
3478 +    char * attrs;
3479 +    char * imagexml;
3480 +
3481 +    if( type == GTK_IMAGE_STOCK ) {
3482 +        GtkIconSize size;
3483 +        GtkIconSet * iconset;
3484 +        gchar * stockname;
3485 +        GdkPixbuf * pixbuf;
3486 +
3487 +        gtk_image_get_stock(image, &stockname, &size);
3488 +        pixbuf = gtk_widget_render_icon(gui.drawarea, stockname, size, NULL);
3489 +        imagexml = bonobo_ui_util_pixbuf_to_xml(pixbuf);
3490 +        g_string_append_printf(xml, " pixtype=\"pixbuf\" pixname=\"%s\"", imagexml);
3491 +        g_object_unref(pixbuf);
3492 +        g_free(imagexml);
3493 +    } else if( type == GTK_IMAGE_PIXBUF ) {
3494 +        imagexml = bonobo_ui_util_pixbuf_to_xml(gtk_image_get_pixbuf(image));
3495 +        g_string_append_printf(xml, " pixtype=\"pixbuf\" pixname=\"%s\"", imagexml);
3496 +        g_free(imagexml);
3497 +    }
3498 +    attrs = xml->str;
3499 +    g_string_free(xml, FALSE);
3500 +    return( attrs );
3501 +}
3502 +
3503 +
3504 +/* Generate XML which represents Vim's menus and toolbars.  Starts from the
3505 + * given menu entry.  XML is appended to "xml", and commands/verbs are added
3506 + * to the "commands" list.  If do_siblings is true, XML is also generated for
3507 + * the siblings of the given menu (following the menu->next pointer); otherwise
3508 + * only the menu and its descendents are processed.
3509 + */
3510 +static
3511 +void generate_gui_xml_recurse( vimmenu_T * menu, GString * xml, GSList ** commands, int do_siblings)
3512 +{
3513 +    GString * normname = g_string_sized_new(16);
3514 +    GString * verbname = g_string_sized_new(32);
3515 +    char_u * label;
3516 +    int use_mnemonic;
3517 +    BonoboUIComponent *uic;
3518 +    gchar * command;
3519 +
3520 +    uic = bonobo_control_get_ui_component (BONOBO_CONTROL (gui.control));
3521 +
3522 +    while( menu ) 
3523 +    {
3524 +        use_mnemonic = (p_wak[0] != 'n' );
3525 +        label = translate_mnemonic_tag( menu->name, use_mnemonic );
3526 +        g_string_assign( normname, "" );
3527 +        g_string_append_normalized_name( normname, menu->dname );
3528 +        if( menu->children ) {
3529 +            if( menu_is_toolbar( menu->name )) {
3530 +                g_string_append( xml, "<dockitem name=\"Toolbar\" look=\"icon\" tips=\"1\">");
3531 +                generate_gui_xml_recurse( menu->children, xml, commands, TRUE );
3532 +                g_string_append( xml, "</dockitem>");
3533 +            } else {
3534 +                g_string_append_printf( xml, "<submenu name=\"%s\" label=\"%s\">\n", normname->str, label);
3535 +
3536 +                generate_gui_xml_recurse( menu->children, xml, commands, TRUE );
3537 +                g_string_append( xml, "</submenu>\n");
3538 +            }
3539 +        } else if( menu_is_separator(menu->name)) {
3540 +            g_string_append( xml, "<separator />\n" );
3541 +        } else if( menu->parent && menu_is_toolbar(menu->parent->name)) {
3542 +            char * menupath = xml_path_for_menu(menu, FALSE);
3543 +            GtkImage *image = NULL;
3544 +            char * imagexml;
3545 +            char_u *tooltip;
3546 +
3547 +            g_string_assign(verbname, "");
3548 +            g_string_append_normalized_name(verbname, menupath);
3549 +            vim_free(menupath);
3550 +            image = GTK_IMAGE(create_menu_icon(menu, GTK_ICON_SIZE_SMALL_TOOLBAR));
3551 +            imagexml = gtk_image_to_xml_attrs(image);
3552 +            tooltip = CONVERT_TO_UTF8(menu->strings[MENU_INDEX_TIP]);
3553 +            g_string_append_printf( xml, "<toolitem name=\"%s\" label=\"%s\" verb=\"%s\" tip=\"%s\" %s />\n", normname->str, label, verbname->str, tooltip, imagexml);
3554 +            gtk_object_sink(GTK_OBJECT(image));
3555 +            g_free(imagexml);
3556 +            CONVERT_TO_UTF8_FREE(tooltip);
3557 +            
3558 +            command = g_strdup_printf( "<cmd name=\"%s\" sensitive=\"%c\" />\n", verbname->str, menu->sensitive ? '1' : '0');
3559 +            *commands = g_slist_prepend( *commands, command );
3560 +            bonobo_ui_component_add_verb(uic, verbname->str, verb_activate, menu);
3561 +        } else if( menu_is_menubar(menu->name)) {
3562 +            char * menupath = xml_path_for_menu(menu, FALSE);
3563 +
3564 +            g_string_assign(verbname, "");
3565 +            g_string_append_normalized_name(verbname, menupath);
3566 +            vim_free(menupath);
3567 +            
3568 +            g_string_append_printf( xml, "<menuitem name=\"%s\" label=\"%s\" verb=\"%s\" />\n", normname->str, label, verbname->str);
3569 +
3570 +            command = g_strdup_printf( "<cmd name=\"%s\" sensitive=\"%c\" />\n", verbname->str, menu->sensitive ? '1' : '0');
3571 +            *commands = g_slist_prepend( *commands, command );
3572 +            bonobo_ui_component_add_verb(uic, verbname->str, verb_activate, menu);
3573 +        }
3574 +        if( label ) {
3575 +            vim_free( label );
3576 +        }
3577 +        if( do_siblings ) {
3578 +            menu = menu->next;
3579 +        } else {
3580 +            menu = NULL;
3581 +        }
3582 +    }
3583 +    g_string_free( normname, TRUE );
3584 +}
3585 +
3586 +/* Create XML representing the menus and toolbars, and send them to the
3587 + * container application.  We only need to process menu entries which
3588 + * have changed (they are marked "dirty"). */
3589 +static
3590 +void set_gui_xml(vimmenu_T * menu)
3591 +{
3592 +    GSList * commands = NULL;
3593 +    GSList * command;
3594 +    BonoboUIComponent *uic;
3595 +    GString * xml = g_string_sized_new(1024);
3596 +    int path_exists;
3597 +    uic = bonobo_control_get_ui_component (BONOBO_CONTROL (gui.control));
3598 +
3599 +    if( bonobo_ui_component_get_container(uic) == CORBA_OBJECT_NIL ) {
3600 +        return;
3601 +    }
3602 +
3603 +    while( menu ) {
3604 +        if( menu->dirty ) {
3605 +            if (menu_is_popup(menu->name)) {
3606 +                /* do nothing */            
3607 +            } else if( menu_is_menubar(menu->name)) {
3608 +                char * menupath = xml_path_for_menu(menu, TRUE);
3609 +                path_exists = bonobo_ui_component_path_exists(uic, menupath, NULL);
3610 +                g_string_assign(xml, "");
3611 +                generate_gui_xml_recurse (menu, xml, &commands, FALSE);
3612 +                /*fprintf(stdout, "set %s\n", menupath);*/
3613 +                /*fprintf(stdout, "set %s\n%s", menupath, xml->str);*/
3614 +                /*fflush(stdout);*/
3615 +                bonobo_ui_component_set(uic, menupath, xml->str, NULL);
3616 +                g_free(menupath);
3617 +            } else if( menu_is_toolbar(menu->name)) {
3618 +                char * menupath = xml_path_for_menu(menu, TRUE);
3619 +                path_exists = bonobo_ui_component_path_exists(uic, menupath, NULL);
3620 +                g_string_assign(xml, "");
3621 +                generate_gui_xml_recurse (menu, xml, &commands, FALSE);
3622 +                /*fprintf(stdout, "set %s\n", menupath);*/
3623 +                /*fprintf(stdout, "set %s\n%s", menupath, xml->str);*/
3624 +                /*fflush(stdout);*/
3625 +                bonobo_ui_component_set(uic, menupath, xml->str, NULL);
3626 +                g_free(menupath);
3627 +            }
3628 +            menu->dirty = FALSE;
3629 +        }
3630 +        menu = menu->next;
3631 +    }
3632 +    /* the commands are inserted separately into a list, and set one by one,
3633 +     * otherwise it's not possible to update a subtree of the UI 
3634 +     */
3635 +    command = commands;
3636 +    while( command ) {
3637 +        /*fprintf(stdout, "set %s\n%s", "/commands", command->data);
3638 +        fflush(stdout);*/
3639 +        bonobo_ui_component_set(uic, "/commands", command->data, NULL);
3640 +        g_free(command->data);
3641 +        command = command->next;
3642 +    }
3643 +    g_slist_free( commands );
3644 +}
3645 +
3646 +
3647 +/* remember whether a timeout has been scheduled for updating the gui */
3648 +static gboolean update_gui_idle_installed = FALSE;
3649 +
3650 +/* if we have been embedded in a container, update the gui now, otherwise
3651 + * wait awhile and try again. */
3652 +static gboolean
3653 +update_gui_idle(gpointer data)
3654 +{
3655 +    BonoboUIComponent *uic;
3656 +
3657 +    uic = bonobo_control_get_ui_component (BONOBO_CONTROL (gui.control));
3658 +    if( bonobo_ui_component_get_container(uic) == CORBA_OBJECT_NIL ) {
3659 +        /* we aren't in a container yet; try again later... */
3660 +        g_timeout_add(100, &update_gui_idle, NULL);
3661 +        return FALSE;
3662 +    }
3663 +    bonobo_ui_component_freeze(uic, NULL);
3664 +    set_gui_xml( (vimmenu_T *)root_menu );
3665 +    update_gui_idle_installed = FALSE;
3666 +    bonobo_ui_component_thaw(uic, NULL);
3667 +    return FALSE; /* don't call me again */
3668 +}
3669 +
3670 +/* Mark the given menu as dirty -- we need to re-send the XML representing
3671 + * this menu to the container.  But don't do the update immediately; otherwise
3672 + * we'd be generating the complete UI XML each time a menu entry is added,
3673 + * which would be very slow.  Instead, schedule an update in which all 
3674 + * dirty menus will be processed. */
3675 +void
3676 +update_menu_later(vimmenu_T *menu)
3677 +{
3678 +    if (!update_gui_idle_installed)
3679 +    {
3680 +        update_gui_idle_installed = TRUE;
3681 +        g_idle_add_full(GDK_PRIORITY_EVENTS + 10,
3682 +                        &update_gui_idle, NULL, NULL);
3683 +    }
3684 +    while( menu->parent ) 
3685 +        menu = menu->parent;
3686 +    menu->dirty = TRUE;
3687 +}
3688 +
3689 +/* Schedule an update for the entire UI (all menus and toolbars) */
3690 +void update_ui_later()
3691 +{
3692 +    vimmenu_T *menu = root_menu;
3693 +
3694 +    if (!update_gui_idle_installed)
3695 +    {
3696 +        update_gui_idle_installed = TRUE;
3697 +        g_idle_add_full(GDK_PRIORITY_EVENTS + 10,
3698 +                        &update_gui_idle, NULL, NULL);
3699 +    }
3700 +    while( menu ) {
3701 +        menu->dirty = TRUE;
3702 +        menu = menu->next;
3703 +    }
3704 +}
3705 +#endif
3706 +
3707      void
3708  gui_mch_add_menu(vimmenu_T *menu, int idx)
3709  {
3710 +#ifdef FEAT_GUI_COMPONENT
3711 +    update_menu_later(menu);
3712 +    return;
3713 +#else
3714      vimmenu_T  *parent;
3715      GtkWidget  *parent_widget;
3716  
3717 @@ -602,6 +925,7 @@
3718      if (vim_strchr(p_go, GO_TEAROFF) != NULL)
3719         gtk_widget_show(menu->tearoff_handle);
3720      gtk_menu_prepend(GTK_MENU(menu->submenu_id), menu->tearoff_handle);
3721 +#endif
3722  }
3723  
3724  /*ARGSUSED*/
3725 @@ -618,8 +942,8 @@
3726  # endif
3727  
3728      /* make sure the menu action is taken immediately */
3729 -    if (gtk_main_level() > 0)
3730 -       gtk_main_quit();
3731 +    if (MAIN_LEVEL() > 0)
3732 +       MAIN_QUIT();
3733  }
3734  
3735  # if defined(FEAT_TOOLBAR) && !defined(HAVE_GTK2)
3736 @@ -724,6 +1048,10 @@
3737      void
3738  gui_mch_add_menu_item(vimmenu_T *menu, int idx)
3739  {
3740 +#ifdef FEAT_GUI_COMPONENT
3741 +    update_menu_later(menu);
3742 +    return;
3743 +#else
3744      vimmenu_T *parent;
3745  
3746      parent = menu->parent;
3747 @@ -833,6 +1161,7 @@
3748             gtk_signal_connect(GTK_OBJECT(menu->id), "activate",
3749                                GTK_SIGNAL_FUNC(menu_item_activate), menu);
3750      }
3751 +#endif
3752  }
3753  #endif /* FEAT_MENU */
3754  
3755 @@ -857,6 +1186,10 @@
3756      guint      accel_key;
3757  # endif
3758  
3759 +#ifdef FEAT_GUI_COMPONENT
3760 +    return;
3761 +#endif
3762 +
3763      for (menu = root_menu; menu != NULL; menu = menu->next)
3764      {
3765         if (menu->id == NULL)
3766 @@ -913,6 +1246,9 @@
3767      void
3768  gui_mch_toggle_tearoffs(int enable)
3769  {
3770 +#ifdef FEAT_GUI_COMPONENT
3771 +    return;
3772 +#endif
3773      recurse_tearoffs(root_menu, enable);
3774  }
3775  #endif /* FEAT_MENU */
3776 @@ -1019,6 +1355,9 @@
3777      void
3778  gui_mch_destroy_menu(vimmenu_T *menu)
3779  {
3780 +#ifdef FEAT_GUI_COMPONENT
3781 +    return;
3782 +#endif
3783  # ifdef FEAT_TOOLBAR
3784      if (menu->parent != NULL && menu_is_toolbar(menu->parent->name))
3785      {
3786 @@ -1160,8 +1499,8 @@
3787  
3788      gui_drag_scrollbar(sb, value, dragging);
3789  
3790 -    if (gtk_main_level() > 0)
3791 -       gtk_main_quit();
3792 +    if (MAIN_LEVEL() > 0)
3793 +       MAIN_QUIT();
3794  }
3795  
3796  /* SBAR_VERT or SBAR_HORIZ */
3797 @@ -1220,8 +1559,8 @@
3798      vw->browse_fname = (char_u *)g_strdup(gtk_file_selection_get_filename(
3799                                         GTK_FILE_SELECTION(vw->filedlg)));
3800      gtk_widget_hide(vw->filedlg);
3801 -    if (gtk_main_level() > 0)
3802 -       gtk_main_quit();
3803 +    if (MAIN_LEVEL() > 0)
3804 +       MAIN_QUIT();
3805  }
3806  
3807  /*ARGSUSED*/
3808 @@ -1236,8 +1575,8 @@
3809         vw->browse_fname = NULL;
3810      }
3811      gtk_widget_hide(vw->filedlg);
3812 -    if (gtk_main_level() > 0)
3813 -       gtk_main_quit();
3814 +    if (MAIN_LEVEL() > 0)
3815 +       MAIN_QUIT();
3816  }
3817  
3818  /*ARGSUSED*/
3819 @@ -1251,8 +1590,8 @@
3820      }
3821      gui.filedlg = NULL;
3822  
3823 -    if (gtk_main_level() > 0)
3824 -       gtk_main_quit();
3825 +    if (MAIN_LEVEL() > 0)
3826 +       MAIN_QUIT();
3827  
3828      return FALSE;
3829  }
3830 @@ -1335,7 +1674,7 @@
3831  
3832      gtk_widget_show(gui.filedlg);
3833      while (gui.filedlg && GTK_WIDGET_DRAWABLE(gui.filedlg))
3834 -       gtk_main_iteration_do(TRUE);
3835 +       MAIN_ITERATION_DO(TRUE);
3836  
3837      if (gui.browse_fname == NULL)
3838         return NULL;
3839 @@ -1560,8 +1899,8 @@
3840  dlg_destroy_cb(int *p)
3841  {
3842      *p = TRUE;         /* set dialog_destroyed to break out of the loop */
3843 -    if (gtk_main_level() > 0)
3844 -       gtk_main_quit();
3845 +    if (MAIN_LEVEL() > 0)
3846 +       MAIN_QUIT();
3847  }
3848  
3849  /* ARGSUSED */
3850 @@ -1865,7 +2204,7 @@
3851      /* loop here until the dialog goes away */
3852      while (dialog_status == -1 && !dialog_destroyed
3853                                                && GTK_WIDGET_DRAWABLE(dialog))
3854 -       gtk_main_iteration_do(TRUE);
3855 +       MAIN_ITERATION_DO(TRUE);
3856  
3857      if (dialog_status < 0)
3858         dialog_status = 0;
3859 @@ -2898,8 +3237,8 @@
3860      CONVERT_FROM_UTF8_FREE(find_text);
3861  #endif
3862  
3863 -    if (rc && gtk_main_level() > 0)
3864 -       gtk_main_quit(); /* make sure cmd will be handled immediately */
3865 +    if (rc && MAIN_LEVEL() > 0)
3866 +        MAIN_QUIT(); /* make sure cmd will be handled immediately */
3867  }
3868  
3869  /* our usual callback function */
3870 diff -Nur vim63/src/gui_gtk_x11.c vim63-bonobo/src/gui_gtk_x11.c
3871 --- vim63/src/gui_gtk_x11.c     2004-05-03 11:19:17.000000000 +0200
3872 +++ vim63-bonobo/src/gui_gtk_x11.c      2005-09-09 20:14:02.742583328 +0200
3873 @@ -24,6 +24,7 @@
3874  #include "vim.h"
3875  #ifdef FEAT_GUI_GNOME
3876  /* Gnome redefines _() and N_().  Grrr... */
3877 +#if 0
3878  # ifdef _
3879  #  undef _
3880  # endif
3881 @@ -36,6 +37,7 @@
3882  # ifdef bindtextdomain
3883  #  undef bindtextdomain
3884  # endif
3885 +#endif
3886  # if defined(FEAT_GETTEXT) && !defined(ENABLE_NLS)
3887  #  define ENABLE_NLS   /* so the texts in the dialog boxes are translated */
3888  # endif
3889 @@ -627,9 +629,10 @@
3890  expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data)
3891  {
3892      /* Skip this when the GUI isn't set up yet, will redraw later. */
3893 -    if (gui.starting)
3894 +    if (gui.starting) {
3895 +        g_warning("ignoring expose_event; gui still starting.\n");
3896         return FALSE;
3897 -
3898 +    }
3899      out_flush();               /* make sure all output has been processed */
3900      gui_redraw(event->area.x, event->area.y,
3901                event->area.width, event->area.height);
3902 @@ -670,8 +673,8 @@
3903         xev.xproperty.state = PropertyNewValue;
3904         serverEventProc(GDK_WINDOW_XDISPLAY(widget->window), &xev);
3905  
3906 -       if (gtk_main_level() > 0)
3907 -           gtk_main_quit();
3908 +       if (MAIN_LEVEL() > 0)
3909 +           MAIN_QUIT();
3910      }
3911      return FALSE;
3912  }
3913 @@ -772,6 +775,10 @@
3914      if (blink_state == BLINK_NONE)
3915         gui_mch_start_blink();
3916  
3917 +#ifdef FEAT_GUI_COMPONENT
3918 +    /*gtk_plug_grab_focus(GTK_PLUG(gui.plug));*/
3919 +    /*gtk_window_set_focus(GTK_WINDOW(gui.plug), gui.drawarea);*/
3920 +#endif
3921      /* make sure keyboard input goes there */
3922      if (gtk_socket_id == 0 || !GTK_WIDGET_HAS_FOCUS(gui.drawarea))
3923         gtk_widget_grab_focus(gui.drawarea);
3924 @@ -783,6 +790,11 @@
3925      static gint
3926  leave_notify_event(GtkWidget *widget, GdkEventCrossing *event, gpointer data)
3927  {
3928 +#ifdef FEAT_GUI_COMPONENT
3929 +    /*gtk_plug_ungrab_focus(GTK_PLUG(gui.plug));*/
3930 +    /*gdk_display_keyboard_ungrab (gtk_widget_get_display (gui.drawarea),
3931 +                                 gtk_get_current_event_time ());*/
3932 +#endif
3933      if (blink_state != BLINK_NONE)
3934         gui_mch_stop_blink();
3935  
3936 @@ -793,8 +805,16 @@
3937      static gint
3938  focus_in_event(GtkWidget *widget, GdkEventFocus *event, gpointer data)
3939  {
3940 +    GdkEventMask mask;
3941      gui_focus_change(TRUE);
3942  
3943 +#ifdef FEAT_GUI_COMPONENT
3944 +    gtk_widget_grab_focus(gui.drawarea);
3945 +    mask = gdk_window_get_events(gui.drawarea->window);
3946 +    mask |= GDK_KEY_PRESS | GDK_KEY_RELEASE;
3947 +    gdk_window_set_events(gui.drawarea->window, mask);
3948 +#endif
3949 +
3950      if (blink_state == BLINK_NONE)
3951         gui_mch_start_blink();
3952  
3953 @@ -809,6 +829,9 @@
3954      static gint
3955  focus_out_event(GtkWidget *widget, GdkEventFocus *event, gpointer data)
3956  {
3957 +#ifdef FEAT_GUI_COMPONENT
3958 +/*    gtk_plug_ungrab_focus(GTK_PLUG(gui.plug));*/
3959 +#endif
3960      gui_focus_change(FALSE);
3961  
3962      if (blink_state != BLINK_NONE)
3963 @@ -1167,8 +1190,8 @@
3964      if (p_mh)
3965         gui_mch_mousehide(TRUE);
3966  
3967 -    if (gtk_main_level() > 0)
3968 -       gtk_main_quit();
3969 +    if (MAIN_LEVEL() > 0)
3970 +        MAIN_QUIT();
3971  
3972      return TRUE;
3973  }
3974 @@ -1203,8 +1226,8 @@
3975      else
3976         clip_lose_selection(&clip_star);
3977  
3978 -    if (gtk_main_level() > 0)
3979 -       gtk_main_quit();
3980 +    if (MAIN_LEVEL() > 0)
3981 +       MAIN_QUIT();
3982  
3983      return TRUE;
3984  }
3985 @@ -1244,9 +1267,8 @@
3986         received_selection = RS_FAIL;
3987         /* clip_free_selection(cbd); ??? */
3988  
3989 -       if (gtk_main_level() > 0)
3990 -           gtk_main_quit();
3991 -
3992 +        if (MAIN_LEVEL() > 0)
3993 +            MAIN_QUIT();      /* make sure the above will be handled immediately */
3994         return;
3995      }
3996  
3997 @@ -1355,8 +1377,8 @@
3998      g_free(tmpbuf_utf8);
3999  #endif
4000  
4001 -    if (gtk_main_level() > 0)
4002 -       gtk_main_quit();
4003 +    if (MAIN_LEVEL() > 0)
4004 +        MAIN_QUIT();      /* make sure the above will be handled immediately */
4005  }
4006  
4007  /*
4008 @@ -1538,6 +1560,15 @@
4009         using_gnome = 1;
4010  #endif
4011  
4012 +
4013 +#ifdef FEAT_GUI_COMPONENT
4014 +    if( !vim_bonobo_init(&gui_argc, gui_argv))
4015 +    {
4016 +        /* in component mode, we don't care about trying to continue without 
4017 +         * a gui; if we can't create the factory, we might as well quit. */
4018 +        mch_exit(2);
4019 +    }
4020 +#else
4021      /* Don't use gtk_init() or gnome_init(), it exits on failure. */
4022      if (!gtk_init_check(&gui_argc, &gui_argv))
4023      {
4024 @@ -1545,10 +1576,29 @@
4025         EMSG(_(e_opendisp));
4026         return FAIL;
4027      }
4028 +#endif
4029  
4030      return OK;
4031  }
4032  
4033 +#if FEAT_GUI_COMPONENT
4034 +static gint
4035 +control_activate_event(BonoboControl *control, gboolean activated)
4036 +{
4037 +    if (activated) 
4038 +    {
4039 +        gui_focus_change (TRUE);
4040 +        if (blink_state == BLINK_NONE)
4041 +            gui_mch_start_blink();
4042 +    } else {
4043 +        gui_focus_change (FALSE);
4044 +        if (blink_state != BLINK_NONE)
4045 +            gui_mch_stop_blink();
4046 +    }
4047 +    return TRUE;
4048 +}
4049 +#endif
4050 +
4051  
4052  /****************************************************************************
4053   * Mouse handling callbacks
4054 @@ -1609,8 +1659,8 @@
4055      /* inform the editor engine about the occurence of this event */
4056      gui_send_mouse_event(button, x, y, FALSE, vim_modifiers);
4057  
4058 -    if (gtk_main_level() > 0)
4059 -       gtk_main_quit();
4060 +    if (MAIN_LEVEL() > 0)
4061 +       MAIN_QUIT();
4062  
4063      /*
4064       * Auto repeat timer handling.
4065 @@ -1805,8 +1855,8 @@
4066         vim_modifiers |= MOUSE_ALT;
4067  
4068      gui_send_mouse_event(button, x, y, repeated_click, vim_modifiers);
4069 -    if (gtk_main_level() > 0)
4070 -       gtk_main_quit(); /* make sure the above will be handled immediately */
4071 +    if (MAIN_LEVEL() > 0)
4072 +        MAIN_QUIT();      /* make sure the above will be handled immediately */
4073  
4074      return TRUE;
4075  }
4076 @@ -1854,8 +1904,8 @@
4077      gui_send_mouse_event(button, (int)event->x, (int)event->y,
4078                                                         FALSE, vim_modifiers);
4079  
4080 -    if (gtk_main_level() > 0)
4081 -       gtk_main_quit(); /* make sure the above will be handled immediately */
4082 +    if (MAIN_LEVEL() > 0)
4083 +       MAIN_QUIT();    /* make sure the above will be handled immediately */
4084  
4085      return TRUE;
4086  }
4087 @@ -1890,8 +1940,8 @@
4088         vim_modifiers |= MOUSE_ALT;
4089  
4090      gui_send_mouse_event(MOUSE_RELEASE, x, y, FALSE, vim_modifiers);
4091 -    if (gtk_main_level() > 0)
4092 -       gtk_main_quit();        /* make sure it will be handled immediately */
4093 +    if (MAIN_LEVEL() > 0)
4094 +        MAIN_QUIT();      /* make sure the above will be handled immediately */
4095  
4096      return TRUE;
4097  }
4098 @@ -2073,8 +2123,8 @@
4099      else
4100         add_to_input_buf(dropkey + 3, (int)(sizeof(dropkey) - 3));
4101  
4102 -    if (gtk_main_level() > 0)
4103 -       gtk_main_quit();
4104 +    if (MAIN_LEVEL() > 0)
4105 +        MAIN_QUIT();      /* make sure the above will be handled immediately */
4106  }
4107  
4108  /*
4109 @@ -2540,6 +2590,7 @@
4110      static void
4111  mainwin_realize(GtkWidget *widget, gpointer data)
4112  {
4113 +#ifndef FEAT_GUI_COMPONENT
4114  /* If you get an error message here, you still need to unpack the runtime
4115   * archive! */
4116  #ifdef magick
4117 @@ -2623,6 +2674,7 @@
4118  
4119  #endif /* !HAVE_GTK2 */
4120      }
4121 +#endif /* FEAT_GUI_COMPONENT */
4122  
4123  #if !(defined(FEAT_GUI_GNOME) && defined(FEAT_SESSION))
4124      /* Register a handler for WM_SAVE_YOURSELF with GDK's low-level X I/F */
4125 @@ -2641,7 +2693,7 @@
4126  #endif
4127         setup_save_yourself();
4128  
4129 -#ifdef FEAT_CLIENTSERVER
4130 +#if defined(FEAT_CLIENTSERVER) &&!defined(FEAT_GUI_COMPONENT)
4131      if (serverName == NULL && serverDelayedStartName != NULL)
4132      {
4133         /* This is a :gui command in a plain vim with no previous server */
4134 @@ -2689,7 +2741,7 @@
4135      return cursor;
4136  }
4137  
4138 -#ifdef HAVE_GTK_MULTIHEAD
4139 +#if defined(HAVE_GTK_MULTIHEAD) && !defined(FEAT_GUI_COMPONENT)
4140  /*ARGSUSED1*/
4141      static void
4142  mainwin_screen_changed_cb(GtkWidget  *widget,
4143 @@ -3014,7 +3066,11 @@
4144  #ifdef FEAT_GUI_GNOME
4145         if (using_gnome)
4146         {
4147 -           gui.mainwin = gnome_app_new("Vim", NULL);
4148 +# if defined(FEAT_GUI_COMPONENT)
4149 +            gui.mainwin = NULL;
4150 +# else
4151 +            gui.mainwin = gnome_app_new("vim", NULL);
4152 +# endif
4153  # ifdef USE_XSMP
4154             /* Use the GNOME save-yourself functionality now. */
4155             xsmp_close();
4156 @@ -3025,14 +3081,28 @@
4157             gui.mainwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
4158      }
4159  
4160 +#ifdef FEAT_GUI_COMPONENT
4161 +    vbox = gtk_vbox_new(FALSE, 0);
4162 +    gui.vbox = vbox;
4163 +#else
4164      gtk_widget_set_name(gui.mainwin, "vim-main-window");
4165 +#endif
4166  
4167  #ifdef HAVE_GTK2
4168      /* Create the PangoContext used for drawing all text. */
4169 +#ifdef FEAT_GUI_COMPONENT
4170 +    gui.text_context = gtk_widget_create_pango_context(GTK_WIDGET(gui.vbox));
4171 +#else
4172      gui.text_context = gtk_widget_create_pango_context(gui.mainwin);
4173 +#endif
4174      pango_context_set_base_dir(gui.text_context, PANGO_DIRECTION_LTR);
4175  #endif
4176  
4177 +#ifdef FEAT_GUI_COMPONENT
4178 +    bonobo_control_construct (BONOBO_CONTROL (gui.control), GTK_WIDGET(gui.vbox));
4179 +    gtk_widget_add_events(GTK_WIDGET(gui.drawarea), GDK_VISIBILITY_NOTIFY_MASK);
4180 +    gtk_widget_show_all(GTK_WIDGET(gui.vbox));
4181 +#else
4182  #ifndef HAVE_GTK2
4183      gtk_window_set_policy(GTK_WINDOW(gui.mainwin), TRUE, TRUE, TRUE);
4184  #endif
4185 @@ -3055,8 +3125,6 @@
4186      gui.accel_group = gtk_accel_group_get_default();
4187  #endif
4188  
4189 -    vbox = gtk_vbox_new(FALSE, 0);
4190 -
4191  #ifdef FEAT_GUI_GNOME
4192      if (using_gnome)
4193      {
4194 @@ -3072,6 +3140,9 @@
4195         gtk_container_add(GTK_CONTAINER(gui.mainwin), vbox);
4196         gtk_widget_show(vbox);
4197      }
4198 +#endif
4199 +  
4200 +#ifndef FEAT_GUI_COMPONENT
4201  
4202  #ifdef FEAT_MENU
4203      /*
4204 @@ -3177,6 +3248,7 @@
4205         gtk_box_pack_start(GTK_BOX(vbox), gui.toolbar, FALSE, FALSE, 0);
4206      }
4207  #endif /* FEAT_TOOLBAR */
4208 +#endif /* FEAT_GUI_COMPONENT */
4209  
4210      gui.formwin = gtk_form_new();
4211      gtk_container_border_width(GTK_CONTAINER(gui.formwin), 0);
4212 @@ -3204,6 +3276,11 @@
4213      gtk_widget_show(gui.formwin);
4214      gtk_box_pack_start(GTK_BOX(vbox), gui.formwin, TRUE, TRUE, 0);
4215  
4216 +#ifdef FEAT_GUI_COMPONENT
4217 +    GTK_WIDGET_SET_FLAGS (gui.drawarea, GTK_CAN_FOCUS);
4218 +    g_signal_connect(G_OBJECT(gui.drawarea), "key_press_event",
4219 +                        G_CALLBACK(key_press_event), NULL);
4220 +#else
4221      /* For GtkSockets, key-presses must go to the focus widget (drawarea)
4222       * and not the window. */
4223      gtk_signal_connect((gtk_socket_id == 0) ? GTK_OBJECT(gui.mainwin)
4224 @@ -3218,6 +3295,7 @@
4225                      "key_release_event",
4226                      G_CALLBACK(&key_release_event), NULL);
4227  #endif
4228 +#endif /* FEAT_GUI_COMPONENT */
4229      gtk_signal_connect(GTK_OBJECT(gui.drawarea), "realize",
4230                        GTK_SIGNAL_FUNC(drawarea_realize_cb), NULL);
4231      gtk_signal_connect(GTK_OBJECT(gui.drawarea), "unrealize",
4232 @@ -3252,16 +3330,27 @@
4233       */
4234      gui.border_offset = gui.border_width;
4235  
4236 +#ifdef FEAT_GUI_COMPONENT
4237 +    gtk_signal_connect(GTK_OBJECT(gui.drawarea), "visibility_notify_event",
4238 +                      GTK_SIGNAL_FUNC(visibility_event), NULL);
4239 +#else
4240      gtk_signal_connect(GTK_OBJECT(gui.mainwin), "visibility_notify_event",
4241                        GTK_SIGNAL_FUNC(visibility_event), NULL);
4242 +#endif
4243      gtk_signal_connect(GTK_OBJECT(gui.drawarea), "expose_event",
4244                        GTK_SIGNAL_FUNC(expose_event), NULL);
4245  
4246      /*
4247       * Only install these enter/leave callbacks when 'p' in 'guioptions'.
4248       * Only needed for some window managers.
4249 +     *
4250 +     * Force this on for bonobo, otherwise the toolbar gets the focus 
4251 +     * after you click a button, and you can't get the focus back to the 
4252 +     * drawarea.
4253       */
4254 +#ifndef FEAT_GUI_COMPONENT
4255      if (vim_strchr(p_go, GO_POINTER) != NULL)
4256 +#endif
4257      {
4258         gtk_signal_connect(GTK_OBJECT(gui.drawarea), "leave_notify_event",
4259                            GTK_SIGNAL_FUNC(leave_notify_event), NULL);
4260 @@ -3269,10 +3358,19 @@
4261                            GTK_SIGNAL_FUNC(enter_notify_event), NULL);
4262      }
4263  
4264 +#ifdef FEAT_GUI_COMPONENT
4265 +    g_signal_connect(G_OBJECT(gui.control), "activate",
4266 +                    G_CALLBACK (control_activate_event), NULL);
4267 +    gtk_signal_connect(GTK_OBJECT(gui.drawarea), "focus_out_event",
4268 +                          GTK_SIGNAL_FUNC(focus_out_event), NULL);
4269 +    gtk_signal_connect(GTK_OBJECT(gui.drawarea), "focus_in_event",
4270 +                          GTK_SIGNAL_FUNC(focus_in_event), NULL);
4271 +#else  
4272      gtk_signal_connect(GTK_OBJECT(gui.mainwin), "focus_out_event",
4273                            GTK_SIGNAL_FUNC(focus_out_event), NULL);
4274      gtk_signal_connect(GTK_OBJECT(gui.mainwin), "focus_in_event",
4275                            GTK_SIGNAL_FUNC(focus_in_event), NULL);
4276 +#endif
4277  
4278      gtk_signal_connect(GTK_OBJECT(gui.drawarea), "motion_notify_event",
4279                        GTK_SIGNAL_FUNC(motion_notify_event), NULL);
4280 @@ -3445,7 +3543,7 @@
4281       * otherwise the hints don't work. */
4282      width  = gui_get_base_width();
4283      height = gui_get_base_height();
4284 -# ifdef HAVE_GTK2
4285 +# if defined( HAVE_GTK2 ) && !defined(FEAT_GUI_COMPONENT)
4286      width  += get_menu_tool_width();
4287      height += get_menu_tool_height();
4288  # endif
4289 @@ -3492,8 +3590,18 @@
4290  form_configure_event(GtkWidget *widget, GdkEventConfigure *event,
4291                      gpointer data)
4292  {
4293 +    int height;
4294 +
4295      gtk_form_freeze(GTK_FORM(gui.formwin));
4296 -    gui_resize_shell(event->width, event->height);
4297 +#ifdef FEAT_GUI_COMPONENT
4298 +    /* width_inc and height_inc (see window manager hints, above) aren't
4299 +     * respected for embedded controls, so we have to make a slight adjustment
4300 +     * to make sure the bottom line doesn't get clipped. */
4301 +    height = gui.char_height * ((event->height - 2 )/ gui.char_height);
4302 +#else
4303 +    height = event->height;
4304 +#endif
4305 +    gui_resize_shell(event->width, height);
4306      gtk_form_thaw(GTK_FORM(gui.formwin));
4307  
4308      return TRUE;
4309 @@ -3625,8 +3733,10 @@
4310       * changed them). */
4311      highlight_gui_started();   /* re-init colors and fonts */
4312  
4313 +#ifndef FEAT_GUI_COMPONENT
4314      gtk_signal_connect(GTK_OBJECT(gui.mainwin), "destroy",
4315                        GTK_SIGNAL_FUNC(mainwin_destroy_cb), NULL);
4316 +#endif
4317  
4318  #ifdef FEAT_HANGULIN
4319      hangul_keyboard_set();
4320 @@ -3694,7 +3804,9 @@
4321                                                   NULL);
4322  # endif
4323  #endif
4324 -       gtk_widget_show(gui.mainwin);
4325 +#ifndef FEAT_GUI_COMPONENT
4326 +        gtk_widget_show(gui.mainwin);
4327 +#endif
4328  
4329  #if defined(FEAT_GUI_GNOME) && defined(HAVE_GTK2) && defined(FEAT_MENU)
4330         if (menu_handler != 0)
4331 @@ -3724,8 +3836,8 @@
4332      if (gui.mainwin != NULL)
4333         gtk_widget_destroy(gui.mainwin);
4334  
4335 -    if (gtk_main_level() > 0)
4336 -       gtk_main_quit();
4337 +    if (MAIN_LEVEL() > 0)
4338 +       MAIN_QUIT();    /* make sure the above will be handled immediately */
4339  }
4340  
4341  /*
4342 @@ -3778,6 +3890,7 @@
4343      static gboolean
4344  force_shell_resize_idle(gpointer data)
4345  {
4346 +    g_warning("force_shell_resize_idle called!");
4347      if (gui.mainwin != NULL
4348             && GTK_WIDGET_REALIZED(gui.mainwin)
4349             && GTK_WIDGET_VISIBLE(gui.mainwin))
4350 @@ -3827,7 +3940,7 @@
4351      /* this will cause the proper resizement to happen too */
4352      update_window_manager_hints();
4353  
4354 -#ifdef HAVE_GTK2
4355 +#if defined( HAVE_GTK2 ) && !defined(FEAT_GUI_COMPONENT)
4356      /* With GTK+ 2, changing the size of the form widget doesn't resize
4357       * the window.  So lets do it the other way around and resize the
4358       * main window instead. */
4359 @@ -3916,6 +4029,7 @@
4360  {
4361      GtkWidget *widget;
4362  
4363 +#ifndef FEAT_GUI_COMPONENT
4364  # ifdef FEAT_GUI_GNOME
4365      if (using_gnome)
4366         widget = gui.menubar_h;
4367 @@ -3932,6 +4046,7 @@
4368  
4369         update_window_manager_hints();
4370      }
4371 +#endif
4372  }
4373  #endif /* FEAT_MENU */
4374  
4375 @@ -3983,8 +4098,8 @@
4376  
4377      vw->fontname = (char_u *)gtk_font_selection_dialog_get_font_name(fs);
4378      gtk_widget_hide(vw->fontdlg);
4379 -    if (gtk_main_level() > 0)
4380 -       gtk_main_quit();
4381 +    if (MAIN_LEVEL() > 0)
4382 +        MAIN_QUIT();      /* make sure the above will be handled immediately */
4383  }
4384  
4385  /*ARGSUSED*/
4386 @@ -3994,8 +4109,8 @@
4387      gui_T *vw = (gui_T *)cbdata;
4388  
4389      gtk_widget_hide(vw->fontdlg);
4390 -    if (gtk_main_level() > 0)
4391 -       gtk_main_quit();
4392 +    if (MAIN_LEVEL() > 0)
4393 +        MAIN_QUIT();      /* make sure the above will be handled immediately */
4394  }
4395  
4396  /*ARGSUSED*/
4397 @@ -4005,8 +4120,8 @@
4398      gui_T *vw = (gui_T *)cbdata;
4399  
4400      vw->fontdlg = NULL;
4401 -    if (gtk_main_level() > 0)
4402 -       gtk_main_quit();
4403 +    if (MAIN_LEVEL() > 0)
4404 +        MAIN_QUIT();      /* make sure the above will be handled immediately */
4405  }
4406  #endif /* !HAVE_GTK2 */
4407  
4408 @@ -4173,7 +4288,7 @@
4409  
4410      /* Wait for the font dialog to be closed. */
4411      while (gui.fontdlg && GTK_WIDGET_DRAWABLE(gui.fontdlg))
4412 -       gtk_main_iteration_do(TRUE);
4413 +       MAIN_ITERATION_DO(TRUE);
4414  
4415      if (gui.fontname != NULL)
4416      {
4417 @@ -5727,8 +5842,13 @@
4418      void
4419  gui_mch_update(void)
4420  {
4421 +#ifdef FEAT_GUI_COMPONENT
4422 +    if( gui.processing_call ) {
4423 +        return;
4424 +    }
4425 +#endif
4426      while (gtk_events_pending() && !vim_is_input_buf_full())
4427 -       gtk_main_iteration_do(FALSE);
4428 +        MAIN_ITERATION_DO(TRUE);
4429  }
4430  
4431      static gint
4432 @@ -5739,8 +5859,8 @@
4433      /* Just inform the caller about the occurence of it */
4434      *timed_out = TRUE;
4435  
4436 -    if (gtk_main_level() > 0)
4437 -       gtk_main_quit();
4438 +    if (MAIN_LEVEL() > 0)
4439 +        MAIN_QUIT();      /* make sure the above will be handled immediately */
4440  
4441      return FALSE;              /* don't happen again */
4442  }
4443 @@ -5760,8 +5880,8 @@
4444  
4445      add_to_input_buf(bytes, 3);
4446  
4447 -    if (gtk_main_level() > 0)
4448 -       gtk_main_quit();
4449 +    if (MAIN_LEVEL() > 0)
4450 +       MAIN_QUIT();
4451  }
4452  #endif
4453  
4454 @@ -5828,7 +5948,7 @@
4455         /*
4456          * Loop in GTK+ processing  until a timeout or input occurs.
4457          */
4458 -       gtk_main();
4459 +       MAIN();
4460  
4461         /* Got char, return immediately */
4462         if (input_available())
4463 @@ -5903,6 +6023,7 @@
4464         gdk_window_clear(gui.drawarea->window);
4465  }
4466  
4467 +
4468  /*
4469   * Redraw any text revealed by scrolling up/down.
4470   */
4471 @@ -6017,7 +6138,7 @@
4472                               (guint32)GDK_CURRENT_TIME);
4473  
4474         while (received_selection == RS_NONE)
4475 -           gtk_main(); /* wait for selection_received_cb */
4476 +           MAIN();     /* wait for selection_received_cb */
4477  
4478         if (received_selection != RS_FAIL)
4479             return;
4480 @@ -6085,6 +6206,13 @@
4481      void
4482  gui_mch_menu_grey(vimmenu_T *menu, int grey)
4483  {
4484 +#ifdef FEAT_GUI_COMPONENT
4485 +    if( menu->sensitive != !grey ) {
4486 +        menu->sensitive = !grey;
4487 +        update_menu_later(menu);
4488 +    }
4489 +    return;
4490 +#endif
4491      if (menu->id == NULL)
4492         return;
4493  
4494 @@ -6222,6 +6350,40 @@
4495  static int last_shape = 0;
4496  #endif
4497  
4498 +#if 0
4499 +static BonoboWindow *
4500 +bonobo_create_window(void)
4501 +{
4502 +    BonoboWindow      *win;
4503 +    BonoboUIContainer *ui_container;
4504 +    BonoboUIComponent *ui_component;
4505 +                                                                                
4506 +    win = BONOBO_WINDOW (bonobo_window_new ("vim", "vim"));                                                                                
4507 +    ui_container = bonobo_window_get_ui_container (win);
4508 +    bonobo_ui_engine_config_set_path (bonobo_window_get_ui_engine (win),
4509 +                      "/gnome-vim/UIConfig/kvps");
4510 +                                                                                
4511 +    /* Create a UI component with which to communicate with the window */
4512 +    ui_component = bonobo_ui_component_new_default ();
4513 +
4514 +    gui.component = ui_component;
4515 +                                                                                
4516 +    /* Associate the BonoboUIComponent with the container */
4517 +    bonobo_ui_component_set_container (
4518 +        ui_component, BONOBO_OBJREF (ui_container), NULL);
4519 +                                                                                
4520 +    //bonobo_ui_util_set_ui (ui_component, "", 
4521 +                   //HELLO_SRCDIR HELLO_UI_XML,
4522 +                   //"bonobo-hello", NULL);
4523 +                                                                                
4524 +    /* Associate our verb -> callback mapping with the BonoboWindow */
4525 +    /* All the callback's user_data pointers will be set to 'win' */
4526 +    //bonobo_ui_component_add_verb_list_with_data (ui_component, hello_verbs, win);
4527 +                                                                                
4528 +    return win;
4529 +}
4530 +#endif
4531 +
4532  /*
4533   * Use the blank mouse pointer or not.
4534   *
4535 diff -Nur vim63/src/gui.h vim63-bonobo/src/gui.h
4536 --- vim63/src/gui.h     2005-09-09 20:11:10.563758000 +0200
4537 +++ vim63-bonobo/src/gui.h      2005-09-09 20:14:02.734584544 +0200
4538 @@ -52,6 +52,22 @@
4539  # include <gtk/gtk.h>
4540  #endif
4541  
4542 +# if defined(FEAT_GUI_GNOME) && defined(FEAT_GUI_COMPONENT)
4543 +    #include "libbonoboui.h"
4544 +    #include "vim_bonobo_main.h"
4545 +    #include "vim_bonobo_factory.h"
4546 +    #define MAIN vim_bonobo_main
4547 +    #define MAIN_LEVEL vim_bonobo_main_level
4548 +    #define MAIN_QUIT vim_bonobo_main_quit
4549 +    #define MAIN_ITERATION_DO vim_bonobo_main_iteration_do
4550 +    #define NO_CONSOLE
4551 +# else
4552 +    #define MAIN gtk_main
4553 +    #define MAIN_LEVEL gtk_main_level
4554 +    #define MAIN_QUIT gtk_main_quit
4555 +    #define MAIN_ITERATION_DO gtk_main_iteration_do
4556 +#endif
4557 +
4558  #ifdef FEAT_GUI_BEOS
4559  # include "gui_beos.h"
4560  #endif
4561 @@ -427,6 +443,14 @@
4562      GtkWidget  *toolbar;           /* toolbar */
4563  # endif
4564  # ifdef FEAT_GUI_GNOME
4565 +#  ifdef FEAT_GUI_COMPONENT
4566 +    GtkWidget     *vbox;
4567 +    BonoboPlug    *plug;
4568 +    BonoboControl *control;
4569 +    BonoboPersistStream * pstream;
4570 +    BonoboPersistFile * pfile;
4571 +    int                 processing_call;   /* gui loop is handling a call */
4572 +#  endif
4573      GtkWidget  *menubar_h;         /* menubar handle */
4574      GtkWidget  *toolbar_h;         /* toolbar handle */
4575  # endif
4576 diff -Nur vim63/src/main.c vim63-bonobo/src/main.c
4577 --- vim63/src/main.c    2005-09-09 20:11:10.571757000 +0200
4578 +++ vim63-bonobo/src/main.c     2005-09-09 20:19:37.444700872 +0200
4579 @@ -79,7 +79,7 @@
4580  # ifdef VIMDLL
4581  _export
4582  # endif
4583 -# ifdef FEAT_GUI_MSWIN
4584 +# if defined(FEAT_GUI_MSWIN)
4585  #  ifdef __BORLANDC__
4586  _cdecl
4587  #  endif
4588 @@ -244,8 +244,12 @@
4589      TIME_MSG("locale set");
4590  #endif
4591  
4592 -#ifdef FEAT_GUI
4593 +#if defined(FEAT_GUI_COMPONENT)
4594 +    gui.dofork = FALSE;                    /* don't use fork when running as component */
4595 +#else
4596 +# if defined(FEAT_GUI) && !defined(FEAT_GUI_COMPONENT)
4597      gui.dofork = TRUE;             /* default is to use fork() */
4598 +# endif
4599  #endif
4600  
4601  #if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER)
4602 @@ -444,6 +448,10 @@
4603         ++initstr;
4604      }
4605  
4606 +#ifdef FEAT_GUI_COMPONENT
4607 +    main_start_gui();
4608 +#endif
4609 +
4610      if (TOLOWER_ASC(initstr[0]) == 'g' || initstr[0] == 'k')
4611      {
4612         main_start_gui();
4613 @@ -1679,6 +1687,7 @@
4614       * Call settmode and starttermcap here, so the T_KS and T_TI may be
4615       * defined by termcapinit and redifined in .exrc.
4616       */
4617 +#ifndef FEAT_GUI_COMPONENT
4618      settmode(TMODE_RAW);
4619      TIME_MSG("setting raw mode");
4620  
4621 @@ -1687,6 +1696,7 @@
4622         wait_return(TRUE);
4623         TIME_MSG("waiting for return");
4624      }
4625 +#endif
4626  
4627      starttermcap();        /* start termcap if not done by wait_return() */
4628      TIME_MSG("start termcap");
4629 @@ -1815,6 +1825,9 @@
4630         curwin = firstwin;
4631         curbuf = curwin->w_buffer;
4632  #endif
4633 +#ifdef FEAT_GUI_COMPONENT
4634 +       persistent_buffer = curbuf;
4635 +#endif
4636      }
4637      TIME_MSG("opening buffers");
4638  
4639 diff -Nur vim63/src/Make_container.mak vim63-bonobo/src/Make_container.mak
4640 --- vim63/src/Make_container.mak        1970-01-01 01:00:00.000000000 +0100
4641 +++ vim63-bonobo/src/Make_container.mak 2005-09-09 20:14:02.692590928 +0200
4642 @@ -0,0 +1,11 @@
4643 +gnomeccFlags = `pkg-config --cflags libgnomeui-2.0 libgnome-2.0`
4644 +ccFlags = -g -c ${gnomeccFlags}
4645 +ldFlags = `pkg-config --libs libgnomeui-2.0 libgnome-2.0`
4646 +
4647 +all: container
4648 +
4649 +container: container.o
4650 +       gcc -o container ${ldFlags} container.o
4651 +
4652 +%.o: %.c
4653 +       gcc ${ccFlags} $< -o $@
4654 diff -Nur vim63/src/Makefile vim63-bonobo/src/Makefile
4655 --- vim63/src/Makefile  2005-09-09 20:11:10.529763000 +0200
4656 +++ vim63-bonobo/src/Makefile   2005-09-09 20:14:02.695590472 +0200
4657 @@ -1103,6 +1103,18 @@
4658  GTK_MAN_TARGETS = installghelplinks
4659  GTK_TESTTARGET = gui
4660  
4661 +### Bonobo GUI
4662 +BONOBO_SRC     = $(GTK_SRC)
4663 +BONOBO_OBJ     = $(GTK_OBJ)
4664 +BONOBO_DEFS    = $(GTK_DEFS) 
4665 +BONOBO_IPATH   = $(GTK_IPATH)
4666 +BONOBO_LIBS_DIR        =  $(GTK_LIBS_DIR)
4667 +BONOBO_LIBS1   = $(GTK_LIBS1)
4668 +BONOBO_LIBS2   =  $(GTK_LIBS2)
4669 +BONOBO_TARGETS =  $(GTK_TARGETS) vim-factory
4670 +BONOBO_MAN_TARGETS =  $(GTK_MAN_TARGETS)
4671 +BONOBO_TESTTARGET =  $(GTK_TESTTARGET)
4672 +
4673  ### Motif GUI
4674  MOTIF_SRC      = gui.c gui_motif.c gui_x11.c pty.c gui_beval.c
4675  MOTIF_OBJ      = objects/gui.o objects/gui_motif.o objects/gui_x11.o \
4676 @@ -1385,6 +1397,10 @@
4677         objects/fileio.o \
4678         objects/fold.o \
4679         objects/getchar.o \
4680 +        objects/gtkhtml_editor.o \
4681 +        objects/gtkhtml_editor_common.o \
4682 +        objects/gtkhtml_editor_skels.o \
4683 +        objects/gtkhtml_editor_stubs.o \
4684         $(HANGULIN_OBJ) \
4685         objects/if_cscope.o \
4686         objects/if_xcmdsrv.o \
4687 @@ -1413,6 +1429,9 @@
4688         objects/term.o \
4689         objects/ui.o \
4690         objects/undo.o \
4691 +       objects/vim_bonobo_main.o \
4692 +       objects/vim_bonobo_factory.o \
4693 +       objects/vim_bonobo_control.o \
4694         objects/window.o \
4695         $(GUI_OBJ) \
4696         $(PERL_OBJ) \
4697 @@ -1422,7 +1441,7 @@
4698         $(OS_EXTRA_OBJ) \
4699         $(WORKSHOP_OBJ) \
4700         $(NETBEANS_OBJ) \
4701 -       $(WSDEBUG_OBJ)
4702 +       $(WSDEBUG_OBJ)
4703  
4704  PRO_AUTO = \
4705         buffer.pro \
4706 @@ -1480,7 +1499,7 @@
4707         os_mswin.pro os_beos.pro os_vms.pro os_riscos.pro $(PERL_PRO)
4708  
4709  # Default target is making the executable and tools
4710 -all: $(VIMTARGET) $(TOOLS) languages
4711 +all: $(VIMTARGET) $(TOOLS) $(EXTRA_TARGETS) languages
4712  
4713  tools: $(TOOLS)
4714  
4715 @@ -1658,6 +1677,10 @@
4716  testclean:
4717         cd testdir; $(MAKE) -f Makefile clean
4718  
4719 +vim-factory: objects/vim_proxy_factory.o
4720 +       gcc -o vim-factory $(ALL_LIB_DIRS) $(LDFLAGS) objects/vim_proxy_factory.o $(ALL_LIBS)
4721 +
4722 +
4723  #
4724  # Avoid overwriting an existing executable, somebody might be running it and
4725  # overwriting it could cause it to crash.  Deleting it is OK, it won't be
4726 @@ -1684,6 +1707,23 @@
4727  # may create a link to the new executable from /usr/bin/vi
4728         -$(LINKIT)
4729  
4730 +Vim_Control.server: Vim_Control.server.in auto/config.mk
4731 +       rm -f Vim_Control.server Vim_Control.server.tmp
4732 +       sed -e 's,@DEST_BIN\@,$(DEST_BIN),g' \
4733 +           -e 's,@VIMNAME\@,$(VIMNAME),g' \
4734 +               Vim_Control.server.in >Vim_Control.server.tmp
4735 +       mv Vim_Control.server.tmp Vim_Control.server
4736 +
4737 +installbonobo: installvimbin
4738 +#      install factory to destbin
4739 +       $(INSTALL_PROG) vim-factory $(DEST_BIN)
4740 +       $(STRIP) $(DEST_BIN)/vim-factory
4741 +       
4742 +#      install server file to /usr/lib/bonobo/servers (modulo prefix)
4743 +       -$(SHELL) ./mkinstalldirs $(DESTDIR)$(prefix)/lib/bonobo/servers
4744 +       $(INSTALL_PROG) Vim_Control.server $(DESTDIR)$(prefix)/lib/bonobo/servers
4745 +
4746 +
4747  # install the help files; first adjust the contents for the location
4748  installruntime: $(HELPSOURCE)/vim.1 $(DEST_MAN) $(DEST_VIM) $(DEST_RT) \
4749                 $(DEST_HELP) $(DEST_PRINT) $(DEST_COL) $(DEST_SYN) $(DEST_IND) \
4750 @@ -2078,6 +2118,7 @@
4751         if test -d $(PODIR); then \
4752                 cd $(PODIR); $(MAKE) prefix=$(DESTDIR)$(prefix) clean; \
4753         fi
4754 +       -rm -f Vim_Control.server vim-factory vim-component
4755  
4756  # Make a shadow directory for compilation on another system or with different
4757  # features.
4758 @@ -2285,6 +2326,18 @@
4759  objects/gui_mac.o: gui_mac.c
4760         $(CCC) -o $@ gui_mac.c
4761  
4762 +objects/gtkhtml_editor.o: gtkhtml_editor.c
4763 +       $(CCC) -o $@ gtkhtml_editor.c
4764 +
4765 +objects/gtkhtml_editor_common.o: gtkhtml_editor_common.c
4766 +       $(CCC) -o $@ gtkhtml_editor_common.c
4767 +
4768 +objects/gtkhtml_editor_skels.o: gtkhtml_editor_skels.c
4769 +       $(CCC) -o $@ gtkhtml_editor_skels.c
4770 +
4771 +objects/gtkhtml_editor_stubs.o: gtkhtml_editor_stubs.c
4772 +       $(CCC) -o $@ gtkhtml_editor_stubs.c
4773 +
4774  objects/hangulin.o: hangulin.c
4775         $(CCC) -o $@ hangulin.c
4776  
4777 @@ -2408,6 +2461,18 @@
4778  objects/undo.o: undo.c
4779         $(CCC) -o $@ undo.c
4780  
4781 +objects/vim_bonobo_control.o: vim_bonobo_control.c
4782 +       $(CCC) -o $@ vim_bonobo_control.c
4783 +
4784 +objects/vim_bonobo_factory.o: vim_bonobo_factory.c
4785 +       $(CCC) -o $@ vim_bonobo_factory.c
4786 +
4787 +objects/vim_bonobo_main.o: vim_bonobo_main.c
4788 +       $(CCC) -o $@ vim_bonobo_main.c
4789 +
4790 +objects/vim_proxy_factory.o: vim_proxy_factory.c
4791 +       $(CCC) -o $@ vim_proxy_factory.c
4792 +
4793  objects/window.o: window.c
4794         $(CCC) -o $@ window.c
4795  
4796 diff -Nur vim63/src/mbyte.c vim63-bonobo/src/mbyte.c
4797 --- vim63/src/mbyte.c   2005-09-09 20:11:10.575756000 +0200
4798 +++ vim63-bonobo/src/mbyte.c    2005-09-09 20:14:02.751581960 +0200
4799 @@ -3382,8 +3382,8 @@
4800      /* This flag is used in changed() at next call. */
4801      xim_changed_while_preediting = TRUE;
4802  
4803 -    if (gtk_main_level() > 0)
4804 -       gtk_main_quit();
4805 +    if (MAIN_LEVEL() > 0)
4806 +       MAIN_QUIT();
4807  }
4808  
4809  /*
4810 @@ -4515,7 +4515,11 @@
4811             if (gui.fontset != NOFONTSET
4812                     && gui.fontset->type == GDK_FONT_FONTSET)
4813             {
4814 +#ifdef FEAT_GUI_COMPONENT
4815 +               widget = gui.drawarea;
4816 +#else
4817                 widget = gui.mainwin;
4818 +#endif
4819                 gdk_window_get_size(widget->window, &width, &height);
4820  
4821                 attrmask |= (int)GDK_IC_STATUS_AREA;
4822 @@ -5121,9 +5125,15 @@
4823         while (event_queue != NULL && processing_queued_event)
4824         {
4825             GdkEvent *ev = event_queue->data;
4826 -
4827 +            GtkWidget *output;
4828 +            
4829             gboolean *ret;
4830 -           gtk_signal_emit_by_name((GtkObject*)gui.mainwin, "key_press_event",
4831 +#ifdef FEAT_GUI_COMPONENT
4832 +            output = gui.drawarea;
4833 +#else
4834 +            output = gui.mainwin;
4835 +#endif
4836 +           gtk_signal_emit_by_name((GtkObject*)output, "key_press_event",
4837                                                                     ev, &ret);
4838             gdk_event_free(ev);
4839             event_queue = event_queue->next;
4840 @@ -5135,8 +5145,8 @@
4841             key_press_event_queue = NULL;
4842         }
4843      }
4844 -    if (gtk_main_level() > 0)
4845 -       gtk_main_quit();
4846 +    if (MAIN_LEVEL() > 0)
4847 +       MAIN_QUIT();
4848  }
4849  
4850  /*
4851 @@ -5292,7 +5302,11 @@
4852         GtkWidget       *widget = gui.drawarea;
4853  
4854         attr->style = (GdkIMStyle)xim_input_style;
4855 +#ifdef FEAT_GUI_COMPONENT
4856 +       attr->client_window = gui.drawarea->window;
4857 +#else
4858         attr->client_window = gui.mainwin->window;
4859 +#endif
4860  
4861         if ((colormap = gtk_widget_get_colormap(widget)) !=
4862             gtk_widget_get_default_colormap())
4863 @@ -5339,7 +5353,11 @@
4864             }
4865             else
4866             {
4867 +#ifdef FEAT_GUI_COMPONENT
4868 +               gdk_window_get_size(gui.drawarea->window, &width, &height);
4869 +#else
4870                 gdk_window_get_size(gui.mainwin->window, &width, &height);
4871 +#endif
4872                 attrmask |= (int)GDK_IC_STATUS_AREA_REQ;
4873                 attr->status_area.x = 0;
4874                 attr->status_area.y = height - gui.char_height - 1;
4875 diff -Nur vim63/src/misc1.c vim63-bonobo/src/misc1.c
4876 --- vim63/src/misc1.c   2005-09-09 20:11:10.581755000 +0200
4877 +++ vim63-bonobo/src/misc1.c    2005-09-09 20:14:02.756581200 +0200
4878 @@ -2371,6 +2371,11 @@
4879  #ifdef FEAT_TITLE
4880         need_maketitle = TRUE;      /* set window title later */
4881  #endif
4882 +#if defined(FEAT_GUI_COMPONENT)
4883 +        if( curbuf == persistent_buffer) {
4884 +            component_set_dirty(TRUE);
4885 +        }
4886 +#endif
4887      }
4888      ++curbuf->b_changedtick;
4889      ++global_changedtick;
4890 @@ -2710,6 +2715,11 @@
4891  #ifdef FEAT_TITLE
4892         need_maketitle = TRUE;      /* set window title later */
4893  #endif
4894 +#if defined(FEAT_GUI_COMPONENT)
4895 +        if( curbuf == persistent_buffer) {
4896 +            component_set_dirty(FALSE);
4897 +        }
4898 +#endif
4899      }
4900      ++buf->b_changedtick;
4901      ++global_changedtick;
4902 diff -Nur vim63/src/quote vim63-bonobo/src/quote
4903 --- vim63/src/quote     1970-01-01 01:00:00.000000000 +0100
4904 +++ vim63-bonobo/src/quote      2005-09-09 20:14:02.757581048 +0200
4905 @@ -0,0 +1,7 @@
4906 +function! Quote()
4907 +normal msHmt
4908 +%g/^GtkHTML_QUOTE_ON/.,/GtkHTML_QUOTE_OFF/s/^/> /
4909 +%g/^> GtkHTML_QUOTE_ON/d
4910 +%g/^> GtkHTML_QUOTE_OFF/d
4911 +normal 'tzt's
4912 +endfunction
4913 diff -Nur vim63/src/structs.h vim63-bonobo/src/structs.h
4914 --- vim63/src/structs.h 2005-09-09 20:11:10.607751000 +0200
4915 +++ vim63-bonobo/src/structs.h  2005-09-09 20:14:02.759580744 +0200
4916 @@ -1084,6 +1084,10 @@
4917      char_u     *b_p_bh;        /* 'bufhidden' */
4918      char_u     *b_p_bt;        /* 'buftype' */
4919  #endif
4920 +#if defined(FEAT_GUI_COMPONENT)
4921 +    int         emb_buffer;     /* this buffer is associated with the container application,
4922 +                                   and cannot be removed */
4923 +#endif
4924      int                b_p_bl;         /* 'buflisted' */
4925  #ifdef FEAT_CINDENT
4926      int                b_p_cin;        /* 'cindent' */
4927 @@ -1281,6 +1285,9 @@
4928      int                b_was_netbeans_file;/* TRUE if b_netbeans_file was once set */
4929  #endif
4930  
4931 +#if defined(FEAT_GUI_COMPONENT) && defined(FEAT_GUI_GNOME)
4932 +    pos_T      b_saved_cursor_pos;     /* start pos of last VIsual */
4933 +#endif
4934  };
4935  
4936  /*
4937 @@ -1773,8 +1780,11 @@
4938      GtkWidget  *tearoff_handle;
4939      GtkWidget   *label;                    /* Used by "set wak=" code. */
4940  #endif
4941 -#ifdef FEAT_GUI_MOTIF
4942 +#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_COMPONENT)
4943      int                sensitive;          /* turn button on/off */
4944 +#if defined(FEAT_GUI_COMPONENT)
4945 +    int         dirty;              /* menu item has been updated; container needs to know */
4946 +#endif
4947  #endif
4948  #if defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MOTIF)
4949      Pixmap     image;              /* Toolbar image */
4950 diff -Nur vim63/src/undo.c vim63-bonobo/src/undo.c
4951 --- vim63/src/undo.c    2004-04-05 20:23:45.000000000 +0200
4952 +++ vim63-bonobo/src/undo.c     2005-09-09 20:14:02.760580592 +0200
4953 @@ -764,6 +764,7 @@
4954  #endif
4955  }
4956  
4957 +
4958  /*
4959   * u_sync: stop adding to the current entry list
4960   */
4961 diff -Nur vim63/src/vim_bonobo_control.c vim63-bonobo/src/vim_bonobo_control.c
4962 --- vim63/src/vim_bonobo_control.c      1970-01-01 01:00:00.000000000 +0100
4963 +++ vim63-bonobo/src/vim_bonobo_control.c       2005-09-09 20:14:02.763580136 +0200
4964 @@ -0,0 +1,612 @@
4965 +/**
4966 + * vim_bonobo_control.c
4967 + *
4968 + * Author:
4969 + *   Jason Hildebrand <jason@peaceworks.ca>
4970 + *
4971 + */
4972 +#include <stdio.h>
4973 +
4974 +#include "vim.h"
4975 +#include "vim_bonobo_control.h"
4976 +#include "gtkhtml_editor.h"
4977 +
4978 +#include <gnome.h>
4979 +#include <libbonoboui.h>
4980 +#include <libbonobo.h>
4981 +/*#include <libnautilus/nautilus-view.h>*/
4982 +#include <X11/Intrinsic.h>
4983 +#include <X11/Xatom.h>
4984 +#include <gdk/gdkx.h>
4985 +
4986 +struct _VimControlPrivate {
4987 +    BonoboUIComponent *component;
4988 +};
4989 +
4990 +static GObjectClass *vim_control_parent_class;
4991 +
4992 +static gboolean
4993 +quit_vim(gpointer data)
4994 +{
4995 +    getout_preserve_modified(0);
4996 +}
4997 +
4998 +static void
4999 +vim_control_destroy (BonoboObject *control)
5000 +{
5001 +       BonoboUIComponent *uic;
5002 +
5003 +       g_return_if_fail (control != NULL);
5004 +       g_return_if_fail (VIM_IS_CONTROL (control));
5005 +
5006 +    g_message ("Destroying VimControl...");
5007 +
5008 +       uic = bonobo_control_get_ui_component (BONOBO_CONTROL (control));
5009 +    if( uic != CORBA_OBJECT_NIL )
5010 +        bonobo_ui_component_unset_container (uic, NULL);
5011 +
5012 +       BONOBO_OBJECT_CLASS (vim_control_parent_class)->destroy (control);
5013 +
5014 +    /* we only support creating one vim control per process, so when this one
5015 +     * is finished, we're done. */ 
5016 +    g_timeout_add(50, &quit_vim, NULL);
5017 +}
5018 +
5019 +static void
5020 +vim_control_finalize (GObject *object)
5021 +{
5022 +       VimControl *control;
5023 +
5024 +       g_return_if_fail (object != NULL);
5025 +       g_return_if_fail (VIM_IS_CONTROL (object));
5026 +
5027 +       control = VIM_CONTROL (object);
5028 +
5029 +       g_free (control->priv);
5030 +
5031 +       G_OBJECT_CLASS (vim_control_parent_class)->finalize (object);
5032 +}
5033 +
5034 +static void
5035 +vim_control_set_ui_container (VimControl *control,
5036 +                             Bonobo_UIContainer ui_container)
5037 +{
5038 +       BonoboUIComponent *uic;
5039 +       
5040 +       g_return_if_fail (control != NULL);
5041 +       g_return_if_fail (VIM_IS_CONTROL (control));
5042 +       g_return_if_fail (ui_container != CORBA_OBJECT_NIL);
5043 +
5044 +       uic = bonobo_control_get_ui_component (BONOBO_CONTROL (control));
5045 +       bonobo_ui_component_set_container (uic, ui_container, NULL);
5046 +
5047 +    /* schedule a UI update */
5048 +    update_ui_later();
5049 +}
5050 +
5051 +static void
5052 +vim_control_unset_ui_container (VimControl *control)
5053 +{
5054 +       BonoboUIComponent *uic;
5055 +
5056 +       g_return_if_fail (control != NULL);
5057 +       g_return_if_fail (VIM_IS_CONTROL (control));
5058 +
5059 +       uic = bonobo_control_get_ui_component (BONOBO_CONTROL (control));
5060 +       bonobo_ui_component_unset_container (uic, NULL);
5061 +}
5062 +
5063 +static grab_keys = 0;
5064 +
5065 +#if 0
5066 +static GdkFilterReturn
5067 +filter_key_events (GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data)
5068 +{
5069 + /* GdkScreen *screen = gdk_drawable_get_screen (event->any.window);
5070 +  GdkDisplay *display = gdk_screen_get_display (screen);*/
5071 +  XEvent *xevent = (XEvent *)gdk_xevent;
5072 +                                                                                
5073 +  GdkFilterReturn return_val;
5074 +                                                                                
5075 +  return_val = GDK_FILTER_CONTINUE;
5076 +                                                                                
5077 +  switch (xevent->type)
5078 +  {
5079 +      case KeyPress:
5080 +        g_warning("Key press!");
5081 +        break;
5082 +
5083 +      case KeyRelease:
5084 +        g_warning("Key release!");
5085 +        break;
5086 +
5087 +      default:
5088 +        break;
5089 +  }
5090 +  return return_val;
5091 +}
5092 +#endif
5093 +
5094 +static void
5095 +set_frame_cb (BonoboControl *object, gpointer data)
5096 +{
5097 +    Bonobo_ControlFrame frame;
5098 +       VimControl *control;
5099 +
5100 +       g_return_if_fail (object != NULL);
5101 +       g_return_if_fail (VIM_IS_CONTROL (object));
5102 +
5103 +    frame = bonobo_control_get_control_frame (object, NULL);
5104 +    if (frame == CORBA_OBJECT_NIL)
5105 +        return;
5106 +    CORBA_Object_release (frame, NULL);
5107 +
5108 +       control = VIM_CONTROL (object);
5109 +
5110 +    Bonobo_UIContainer ui_container;
5111 +
5112 +    ui_container = bonobo_control_get_remote_ui_container (BONOBO_CONTROL (control), NULL);
5113 +    if (ui_container != CORBA_OBJECT_NIL) {
5114 +        vim_control_set_ui_container (control, ui_container);
5115 +        bonobo_object_release_unref (ui_container, NULL);
5116 +    }
5117 +
5118 +}
5119 +
5120 +static void
5121 +embedded_cb (GtkPlug *plug)
5122 +{
5123 +    Atom     wm_class;
5124 +    Atom     actual_type;
5125 +    int        actual_format;
5126 +    unsigned long actual_length;
5127 +    unsigned long remaining_bytes;
5128 +    unsigned char * wm_class_value;
5129 +    Window   win;
5130 +    Window   root;
5131 +    Window   parent;
5132 +    Window * children = NULL;
5133 +    unsigned int nchildren;
5134 +    int     result;
5135 +
5136 +    wm_class = gdk_x11_get_xatom_by_name("WM_CLASS");
5137 +    win = GDK_WINDOW_XID(plug->socket_window);
5138 +
5139 +    while( TRUE ) {
5140 +        /*g_warning("checking xid %d", win);*/
5141 +        result = XGetWindowProperty (GDK_WINDOW_XDISPLAY (plug->socket_window), 
5142 +                            win, 
5143 +                            wm_class, 0, 120, False, XA_STRING, 
5144 +                            &actual_type, &actual_format,
5145 +                  &actual_length, &remaining_bytes, &wm_class_value);
5146 +        if( result == Success && actual_type != None) {
5147 +            /*g_warning("WM_CLASS is %s", wm_class_value);*/
5148 +            apply_autocmds(EVENT_EMBEDDED_COMPONENT, wm_class_value, NULL, FALSE, persistent_buffer);
5149 +            XFree(wm_class_value);         
5150 +            break;
5151 +        }
5152 +        gdk_error_trap_push ();
5153 +        result = XQueryTree(GDK_WINDOW_XDISPLAY(plug->socket_window),
5154 +                       win,
5155 +                       &root, &parent, &children, &nchildren);
5156 +        if (gdk_error_trap_pop () || !result) {
5157 +            break;
5158 +        }
5159 +        if( children ) {
5160 +            XFree(children);
5161 +            children = NULL;
5162 +        }
5163 +        if( root == parent) {
5164 +            /* we've reached the root window */
5165 +            break;
5166 +        }
5167 +        win = parent;
5168 +    }
5169 +}
5170 +
5171 +static void
5172 +vim_control_class_init (VimControl *klass)
5173 +{
5174 +       GObjectClass *gobject_class = (GObjectClass *)klass;
5175 +       BonoboObjectClass *bonobo_object_class = (BonoboObjectClass *)klass;
5176 +       BonoboControlClass *control_class = (BonoboControlClass *)klass;
5177 +
5178 +       vim_control_parent_class= g_type_class_peek_parent (klass);
5179 +
5180 +       bonobo_object_class->destroy = vim_control_destroy;
5181 +       gobject_class->finalize = vim_control_finalize;
5182 +}
5183 +
5184 +static char_u * stream_buffer = NULL;
5185 +static int stream_offset = 0;
5186 +static CORBA_long  stream_length = 0;
5187 +static Bonobo_Stream current_stream;
5188 +
5189 +/* It seems like it is an error to attempt to read more data
5190 + * than is available from a bonobo stream.  So we slurp in
5191 + * the entire file in one chunk, and then pass it back in 
5192 + * pieces to the caller. 
5193 + */
5194 +int
5195 +vim_control_persist_stream_read(char_u * buffer, int reqsize)
5196 +{
5197 +    int read_size;
5198 +
5199 +    if( stream_offset >= stream_length ) {
5200 +        return 0;
5201 +    }
5202 +    read_size = stream_length - stream_offset >= reqsize ? 
5203 +                    reqsize : stream_length - stream_offset;
5204 +    mch_memmove(buffer, &stream_buffer[stream_offset], read_size);
5205 +    stream_offset += read_size;
5206 +    return read_size;
5207 +}
5208 +
5209 +int
5210 +vim_control_persist_stream_write(char_u * buffer, int reqsize)
5211 +{
5212 +    CORBA_Environment ev;
5213 +
5214 +    CORBA_exception_init(&ev);
5215 +    bonobo_stream_client_write(current_stream, buffer, reqsize, &ev);
5216 +       if (ev._major != CORBA_NO_EXCEPTION ) {
5217 +        g_warning("Error writing to stream");
5218 +               CORBA_exception_free (&ev);
5219 +        return 0;
5220 +       }
5221 +    CORBA_exception_free (&ev);
5222 +    return reqsize;
5223 +}
5224 +
5225 +void
5226 +component_set_dirty(gboolean dirty)
5227 +{
5228 +    bonobo_persist_set_dirty(BONOBO_PERSIST(gui.pstream), dirty);
5229 +    bonobo_persist_set_dirty(BONOBO_PERSIST(gui.pfile), dirty);
5230 +}
5231 +
5232 +static void load_buffer_from_stream( const Bonobo_Stream         stream,
5233 +                      Bonobo_Persist_ContentType  type,
5234 +                      CORBA_Environment          *ev)
5235 +{
5236 +    exarg_T            ea;                     /* Ex command arguments */
5237 +
5238 +    g_warning ("load_buffer_from_stream");
5239 +
5240 +    stream_buffer = bonobo_stream_client_read( stream, -1, &stream_length, ev);
5241 +       if (ev->_major != CORBA_NO_EXCEPTION) {
5242 +        g_warning("Error reading from stream");
5243 +        return;
5244 +       }
5245 +    stream_offset = 0;
5246 +
5247 +    if( persistent_buffer ) {
5248 +        /* make it possible to delete the existing buffer, so that it 
5249 +         * can be replaced with what we are about to load */
5250 +        persistent_buffer->emb_buffer = FALSE;
5251 +    }
5252 +
5253 +    vim_memset(&ea, 0, sizeof(ea));
5254 +    ea.cmd = "e ++enc=utf-8";
5255 +    ea.force_enc = 8; /* this is the offset of "utf-8" in the cmd */
5256 +
5257 +    read_from_container = PERSIST_STREAM_IO;
5258 +    do_ecmd(0, NULL, NULL, &ea, 1, ECMD_OLDBUF|ECMD_FORCEIT);
5259 +    read_from_container = NORMAL_IO;
5260 +
5261 +    /* we've set the fileencoding to utf-8; set encoding to utf-8 as * well.*/
5262 +    do_cmdline_cmd("set encoding=utf-8");
5263 +
5264 +    /* remember this buffer */
5265 +       persistent_buffer = curbuf;
5266 +    ga_clear(&error_ga);
5267 +    g_free(stream_buffer);
5268 +
5269 +        
5270 +    /* run a filter to obtain plain text from the html */
5271 +    if( !strcmp( type, "text/html" )) {
5272 +        vim_bonobo_call_begin();
5273 +        /* Substitutions to recognize quoted text */
5274 +        do_cmdline_cmd("%s/<!--+GtkHTML[^>]*class=\"ClueFlow\"[^>]*key=\"orig\"[^>]*value=\"1\">-->/<pre>GtkHTML_QUOTE_ON<\\/pre>");
5275 +        do_cmdline_cmd("%s/<!--+GtkHTML[^>]*class=\"ClueFlow\"[^>]*clear=\"orig\"[^>]*>-->/<pre>GtkHTML_QUOTE_OFF<\\/pre>");
5276 +        do_cmdline_cmd("%s/<\\/i><\\/blockquote>/<\\/pre><\\/i><\\/blockquote>/");
5277 +        do_cmdline_cmd("%!html2text -nobs");
5278 +        do_cmdline_cmd("call EvoQuote()");
5279 +        vim_bonobo_call_end();
5280 +    }
5281 +    do_cmdline_cmd("set nomodified");
5282 +    component_set_dirty(FALSE);
5283 +}
5284 +
5285 +static void load_buffer_from_stream_cb(BonoboPersistStream *ps,
5286 +                      const Bonobo_Stream         stream,
5287 +                      Bonobo_Persist_ContentType  type,
5288 +                      void                       *closure,
5289 +                      CORBA_Environment          *ev)
5290 +{
5291 +    load_buffer_from_stream(stream, type, ev);
5292 +}
5293 +
5294 +static void 
5295 +save_buffer_to_stream( const Bonobo_Stream         stream,
5296 +                      Bonobo_Persist_ContentType  type,
5297 +                      CORBA_Environment          *ev)
5298 +{
5299 +    buf_T * buf;
5300 +    exarg_T            ea;                     /* Ex command arguments */
5301 +
5302 +    /*g_warning ("save_buffer_to_stream");*/
5303 +
5304 +    current_stream = stream;
5305 +    write_to_container = PERSIST_STREAM_IO;
5306 +
5307 +    if( !strcmp(type, "text/html")) {
5308 +        vim_control_persist_stream_write("<pre>", 5);
5309 +    }
5310 +
5311 +    vim_memset(&ea, 0, sizeof(ea));
5312 +    ea.cmd = "e ++enc=utf-8";
5313 +    ea.force_enc = 8; /* this is the offset of "utf-8" in the cmd */
5314 +
5315 +    buf = persistent_buffer;
5316 +    buf_write(buf, "dummy", "dummy", 1, buf->b_ml.ml_line_count, 
5317 +                &ea, FALSE, FALSE, TRUE, TRUE);
5318 +    if( !strcmp(type, "text/html")) {
5319 +        vim_control_persist_stream_write("</pre>", 6);
5320 +    }
5321 +    write_to_container = NORMAL_IO;
5322 +    ga_clear(&error_ga);
5323 +}
5324 +
5325 +static void 
5326 +save_buffer_to_stream_cb(BonoboPersistStream         *ps,
5327 +                      const Bonobo_Stream         stream,
5328 +                      Bonobo_Persist_ContentType  type,
5329 +                      void                       *closure,
5330 +                      CORBA_Environment          *ev)
5331 +{
5332 +    save_buffer_to_stream(stream, type, ev);
5333 +}
5334 +
5335 +static gint
5336 +load_buffer_from_file (BonoboPersistFile *pf,
5337 +                const CORBA_char  *filename,
5338 +                       CORBA_Environment *ev,
5339 +                void              *closure)
5340 +{
5341 +       Bonobo_PersistStream ps = closure;
5342 +       BonoboStream *stream;
5343 +       
5344 +    /* FIXME!! */
5345 +    stream = bonobo_get_object(filename, "IDL:Bonobo/Stream:1.0", ev);
5346 +
5347 +       if (!stream)
5348 +               return 0;
5349 +
5350 +       load_buffer_from_stream (ps, "text/plain", ev);
5351 +       return 0; /* Return 0 on success */
5352 +}
5353 +
5354 +static gint
5355 +save_to_file (BonoboPersistFile *pf,
5356 +              const CORBA_char  *filename,
5357 +              CORBA_Environment *ev,
5358 +              void              *closure)
5359 +{
5360 +       Bonobo_PersistStream ps = closure;
5361 +       BonoboStream *stream;
5362 +       
5363 +    
5364 +    /*
5365 +       stream = bonobo_stream_open (
5366 +               BONOBO_IO_DRIVER_FS,
5367 +               filename, Bonobo_STORAGE_WRITE | Bonobo_STORAGE_CREATE,
5368 +               S_IRUSR | S_IWUSR | S_IRGRP);
5369 +
5370 +       if (!stream)
5371 +               return 0;
5372 +
5373 +       save_buffer_to_stream (NULL, ps, "text/plain", ev);
5374 +    */
5375 +       return 0; /* Return 0 on success */
5376 +}
5377 +
5378 +
5379 +Bonobo_Persist_ContentTypeList * 
5380 +persist_stream_types( BonoboPersistStream * ps, void * closure, CORBA_Environment *ev )
5381 +{
5382 +    /*g_warning ("persist_stream_types");*/
5383 +    return bonobo_persist_generate_content_types(2, "text/plain", "text/html");
5384 +}
5385 +
5386 +
5387 +#if 0
5388 +static void
5389 +nv_load_location_cb (NautilusView *view, const char *location, gpointer user_data)
5390 +{
5391 +       g_return_if_fail (NAUTILUS_IS_VIEW (view));
5392 +       g_return_if_fail (location != NULL);
5393 +
5394 +       nautilus_view_report_load_underway (NAUTILUS_VIEW (view));
5395 +
5396 +    /* FIXME: load the file here (using gnome-vfs)! */
5397 +       nautilus_view_report_load_complete (NAUTILUS_VIEW (view));
5398 +}
5399 +#endif
5400 +
5401 +static enum {
5402 +    EDITOR_NEEDS_ESCAPE
5403 +} EditorControlProps;
5404 +
5405 +editor_get_prop (BonoboPropertyBag *bag,
5406 +         BonoboArg         *arg,
5407 +         guint              arg_id,
5408 +         CORBA_Environment *ev,
5409 +         gpointer           user_data)
5410 +{
5411 +    //GtkHTMLControlData *cd = user_data;
5412 +                                                                                
5413 +    switch (arg_id) {
5414 +    case EDITOR_NEEDS_ESCAPE:
5415 +        BONOBO_ARG_SET_BOOLEAN (arg, TRUE);
5416 +        break;
5417 +    default:
5418 +        bonobo_exception_set (ev, ex_Bonobo_PropertyBag_NotFound);
5419 +        break;
5420 +    }
5421 +}
5422 +
5423 +static void
5424 +editor_set_prop (BonoboPropertyBag *bag,
5425 +         const BonoboArg   *arg,
5426 +         guint              arg_id,
5427 +         CORBA_Environment *ev,
5428 +         gpointer           user_data)
5429 +{
5430 +    //GtkHTMLControlData *cd = user_data;
5431 +                                                                                
5432 +    switch (arg_id) {
5433 +    case EDITOR_NEEDS_ESCAPE:
5434 +        bonobo_exception_set (ev, ex_Bonobo_PropertyBag_ReadOnly);
5435 +        break;
5436 +    default:
5437 +        bonobo_exception_set (ev, ex_Bonobo_PropertyBag_NotFound);
5438 +        break;
5439 +    }
5440 +}
5441 +
5442 +static void
5443 +vim_control_init (VimControl *control)
5444 +{
5445 +       control->priv = g_new0 (VimControlPrivate, 1);
5446 +}
5447 +
5448 +BONOBO_TYPE_FUNC (VimControl, BONOBO_TYPE_CONTROL, vim_control);
5449 +
5450 +BonoboObject *
5451 +vim_control_add_interfaces (VimControl     *control,
5452 +                         BonoboObject *to_aggregate)
5453 +{
5454 +       BonoboPersistFile   *file;
5455 +    //NautilusView        *nv;
5456 +       BonoboPersistStream *stream;
5457 +    EditorEngine        *engine; /* GtkHTML editor engine interface */
5458 +       //BonoboItemContainer *item_container;
5459 +
5460 +       
5461 +       g_return_val_if_fail (VIM_IS_CONTROL (control), NULL);
5462 +       g_return_val_if_fail (BONOBO_IS_OBJECT (to_aggregate), NULL);
5463 +
5464 +       /* Interface Bonobo::PersistStream */
5465 +    stream = bonobo_persist_stream_new (load_buffer_from_stream_cb,
5466 +                                        save_buffer_to_stream_cb, 
5467 +                                        persist_stream_types, 
5468 +                                        VIM_OAFIID, 
5469 +                                        control);
5470 +    if (!stream) {
5471 +        bonobo_object_unref (BONOBO_OBJECT (to_aggregate));
5472 +        return NULL;
5473 +    }
5474 +       bonobo_object_add_interface (BONOBO_OBJECT (to_aggregate),
5475 +                                    BONOBO_OBJECT (stream));
5476 +    gui.pstream = stream;
5477 +
5478 +       /* Interface Bonobo::PersistFile */
5479 +       file = bonobo_persist_file_new (load_buffer_from_file, 
5480 +                                           save_buffer_to_stream, VIM_OAFIID, control);
5481 +       if (!file) {
5482 +               bonobo_object_unref (BONOBO_OBJECT (to_aggregate));
5483 +               return NULL;
5484 +       }
5485 +       bonobo_object_add_interface (BONOBO_OBJECT (to_aggregate),
5486 +                                    BONOBO_OBJECT (file));
5487 +    gui.pfile = file;
5488 +
5489 +    /*
5490 +    nv = nautilus_view_new_from_bonobo_control(BONOBO_CONTROL(control));
5491 +    if( !nv ) {
5492 +        bonobo_object_unref (BONOBO_OBJECT(to_aggregate));
5493 +        return NULL;
5494 +    }
5495 +       bonobo_object_add_interface (BONOBO_OBJECT (to_aggregate),
5496 +                                    BONOBO_OBJECT (nv));
5497 +
5498 +       g_signal_connect (G_OBJECT (nv), "load_location",
5499 +                         G_CALLBACK (nv_load_location_cb), NULL);
5500 +        */
5501 +
5502 +    engine = editor_engine_new();
5503 +    if( !engine ) {
5504 +        bonobo_object_unref (BONOBO_OBJECT(to_aggregate));
5505 +        return NULL;
5506 +    }
5507 +       bonobo_object_add_interface (BONOBO_OBJECT (to_aggregate),
5508 +                                    BONOBO_OBJECT (engine));
5509 +
5510 +       return to_aggregate;
5511 +}
5512 +
5513 +VimControl *
5514 +vim_control_construct (VimControl    *control)
5515 +{
5516 +       GtkWidget             *button;
5517 +       GtkWidget             *label;
5518 +    BonoboPlug            *plug;
5519 +    GtkAccelGroup         *group;
5520 +    GClosure              *closure;
5521 +       //VimControlPrivate     *priv;
5522 +    BonoboPropertyBag  *pb;
5523 +    BonoboArg          *def;
5524 +       
5525 +       g_return_val_if_fail (control != NULL, NULL);
5526 +       g_return_val_if_fail (VIM_IS_CONTROL (control), NULL);
5527 +
5528 +
5529 +       if (!vim_control_add_interfaces (control, BONOBO_OBJECT (control)))
5530 +               return NULL;
5531 +
5532 +    gui.control = BONOBO_CONTROL(control);
5533 +    gui.plug = (BonoboPlug *)bonobo_control_get_plug(control);
5534 +    gui.mainwin = GTK_WIDGET(gui.plug);
5535 +    gui_mch_init();
5536 +
5537 +    g_signal_connect (control, "set_frame", G_CALLBACK (set_frame_cb), NULL);
5538 +    g_signal_connect (gui.plug, "embedded", G_CALLBACK (embedded_cb), NULL);
5539 +
5540 +       /* Create the vim-view */
5541 +       //priv->image_view = vim_image_view_new (vim, FALSE);
5542 +       //if (!priv->image_view) {
5543 +               //bonobo_object_unref (BONOBO_OBJECT (control));
5544 +               //return NULL;
5545 +       //}
5546 +
5547 +    pb = bonobo_property_bag_new (editor_get_prop, editor_set_prop, NULL);
5548 +    bonobo_control_set_properties (control, BONOBO_OBJREF (pb), NULL);
5549 +                                                                                
5550 +    def = bonobo_arg_new (BONOBO_ARG_BOOLEAN);
5551 +    BONOBO_ARG_SET_BOOLEAN (def, TRUE);
5552 +                                                                                
5553 +    bonobo_property_bag_add (pb, "EditorNeedsEscape", EDITOR_NEEDS_ESCAPE,
5554 +                 BONOBO_ARG_BOOLEAN, def,
5555 +                 "Whether the editor requires Escape key events",
5556 +                 0);
5557 +                                                                                
5558 +    CORBA_free (def);
5559 +
5560 +    bonobo_object_unref (BONOBO_OBJECT (pb));
5561 +    
5562 +       return control;
5563 +}
5564 +
5565 +VimControl *
5566 +vim_control_new (void)
5567 +{
5568 +       VimControl *control;
5569 +       
5570 +    g_message ("Creating VimControl...");
5571 +
5572 +       control = g_object_new (VIM_CONTROL_TYPE, NULL);
5573 +
5574 +       return vim_control_construct (control);
5575 +}
5576 +
5577 diff -Nur vim63/src/vim_bonobo_control.h vim63-bonobo/src/vim_bonobo_control.h
5578 --- vim63/src/vim_bonobo_control.h      1970-01-01 01:00:00.000000000 +0100
5579 +++ vim63-bonobo/src/vim_bonobo_control.h       2005-09-09 20:14:02.764579984 +0200
5580 @@ -0,0 +1,50 @@
5581 +/*
5582 + * vim_bonobo_control.h
5583 + *
5584 + * Author:
5585 + *   Jason Hildebrand (jason@peaceworks.ca)
5586 + *
5587 + */
5588 +
5589 +#ifndef _VIM_CONTROL_H_
5590 +#define _VIM_CONTROL_H_
5591 +
5592 +#include <bonobo/bonobo-control.h>
5593 +#define VIM_OAFIID "OAFIID:Vim_Control"
5594 +#define NORMAL_IO 0
5595 +#define PERSIST_STREAM_IO 1
5596 +#define PERSIST_FILE_IO 2
5597 +
5598 +G_BEGIN_DECLS
5599
5600 +#define VIM_CONTROL_TYPE           (vim_control_get_type ())
5601 +#define VIM_CONTROL(o)             (G_TYPE_CHECK_INSTANCE_CAST ((o), VIM_CONTROL_TYPE, VimControl))
5602 +#define VIM_CONTROL_CLASS(k)       (G_TYPE_CHECK_CLASS_CAST((k), VIM_CONTROL_TYPE, VimControlClass))
5603 +
5604 +#define VIM_IS_CONTROL(o)          (G_TYPE_CHECK_INSTANCE_TYPE ((o), VIM_CONTROL_TYPE))
5605 +#define VIM_IS_CONTROL_CLASS(k)    (G_TYPE_CHECK_CLASS_TYPE ((k), VIM_CONTROL_TYPE))
5606 +#define VIM_CONTROL_GET_CLASS(o)   (G_TYPE_INSTANCE_GET_CLASS ((o), VIM_CONTROL_TYPE, VimControlClass))
5607 +
5608 +typedef struct _VimControl         VimControl;
5609 +typedef struct _VimControlClass    VimControlClass;
5610 +typedef struct _VimControlPrivate  VimControlPrivate;
5611 +
5612 +struct _VimControl {
5613 +       BonoboControl control;
5614 +
5615 +       VimControlPrivate *priv;
5616 +};
5617 +
5618 +struct _VimControlClass {
5619 +       BonoboControlClass parent_class;
5620 +};
5621 +
5622 +GType         vim_control_get_type                    (void);
5623 +VimControl    *vim_control_new                         (void);
5624 +VimControl    *vim_control_construct                   (VimControl    *control);
5625 +
5626 +void set_curbuf_persistent(void);
5627 +
5628 +G_END_DECLS
5629 +
5630 +#endif /* _VIM_CONTROL_H_*/
5631 diff -Nur vim63/src/vim_bonobo_factory.c vim63-bonobo/src/vim_bonobo_factory.c
5632 --- vim63/src/vim_bonobo_factory.c      1970-01-01 01:00:00.000000000 +0100
5633 +++ vim63-bonobo/src/vim_bonobo_factory.c       2005-09-09 20:14:02.764579984 +0200
5634 @@ -0,0 +1,73 @@
5635 +/*
5636 + * vim_bonobo_factory.c
5637 + *
5638 + * Author:
5639 + *   Jason Hildebrand (jason@peaceworks.ca)
5640 + *
5641 + */
5642 +
5643 +#include "vim.h"
5644 +#include "version.h"
5645 +#include <bonobo/bonobo-generic-factory.h>
5646 +#include "vim_bonobo_control.h"
5647 +
5648 +static BonoboGenericFactory *factory = NULL;
5649 +static int vim_instantiated = 0;
5650 +
5651 +static BonoboObject *
5652 +vim_bonobo_factory(BonoboGenericFactory *this,
5653 +              const char           *oaf_iid,
5654 +              void                 *data)
5655 +{
5656 +    VimControl     *vim;
5657 +    BonoboObject *retval;
5658 +
5659 +    g_return_val_if_fail (this != NULL, NULL);
5660 +    g_return_val_if_fail (oaf_iid != NULL, NULL);
5661 +
5662 +    if( vim_instantiated ) {
5663 +        /* we cannot instantiate more than one control from this process,
5664 +         * because of all of vim's global variables */
5665 +        return NULL;
5666 +    }
5667 +                                                                                
5668 +    g_message ("Trying to produce a '%s'...", oaf_iid);
5669 +                                                                                
5670 +    if (strcmp (oaf_iid, VIM_OAFIID) == 0) {
5671 +        vim = vim_control_new ();
5672 +        if (vim == NULL)
5673 +            return NULL;
5674 +        retval = BONOBO_OBJECT (vim);
5675 +    } else {
5676 +        g_warning ("Unknown IID `%s' requested", oaf_iid);
5677 +        return NULL;
5678 +    }
5679 +    vim_instantiated = 1;
5680 +                                                                                
5681 +    return retval;
5682 +}
5683 +
5684 +/* wait until this component is instantiated */
5685 +int vim_bonobo_wait_for_instantiation()
5686 +{
5687 +    while( !vim_instantiated) {
5688 +        MAIN_ITERATION_DO(TRUE);
5689 +    }
5690 +}
5691 +
5692 +
5693 +int vim_bonobo_init(int *argc, char *argv[])
5694 +{
5695 +    if (!bonobo_ui_init ("gnome-vim", VIM_VERSION_SHORT, argc, argv))
5696 +        g_error (_("Could not initialize Bonobo"));
5697 +                                                                                
5698 +    factory = bonobo_generic_factory_new (
5699 +        VIM_FACTORY_OAFIID, vim_bonobo_factory, NULL);
5700 +                                                                                
5701 +    if (factory == NULL) {
5702 +        g_error ("Couldn't create factory.\n");
5703 +        return 0;
5704 +    }
5705 +    return 1;
5706 +}
5707 +
5708 diff -Nur vim63/src/vim_bonobo_factory.h vim63-bonobo/src/vim_bonobo_factory.h
5709 --- vim63/src/vim_bonobo_factory.h      1970-01-01 01:00:00.000000000 +0100
5710 +++ vim63-bonobo/src/vim_bonobo_factory.h       2005-09-09 20:14:02.765579832 +0200
5711 @@ -0,0 +1,17 @@
5712 +/*
5713 + * vim_bonobo_factory.h
5714 + *
5715 + * Author:
5716 + *   Jason Hildebrand (jason@peaceworks.ca)
5717 + *
5718 + */
5719 +
5720 +#if !defined( _VIM_BONOBO_FACTORY_H)
5721 +#define _VIM_BONOBO_FACTORY_H
5722 +
5723 +#define VIM_FACTORY_OAFIID     "OAFIID:Vim_Control_Factory"
5724 +
5725 +void gui_component_init(int *argc, char *argv []);
5726 +int gui_component_wait_for_instantiation(void);
5727 +
5728 +#endif
5729 diff -Nur vim63/src/vim_bonobo_main.c vim63-bonobo/src/vim_bonobo_main.c
5730 --- vim63/src/vim_bonobo_main.c 1970-01-01 01:00:00.000000000 +0100
5731 +++ vim63-bonobo/src/vim_bonobo_main.c  2005-09-09 20:14:02.765579832 +0200
5732 @@ -0,0 +1,98 @@
5733 +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
5734 +#include "vim.h"
5735 +
5736 +#include <glib/gmain.h>
5737 +#include <glib-object.h>
5738 +#include <bonobo/Bonobo.h>
5739 +
5740 +static guint              bonobo_main_loop_level = 0;
5741 +static GSList *           bonobo_main_loops = NULL;
5742 +
5743 +static gboolean           in_bonobo_call = FALSE;
5744 +
5745 +
5746 +/**
5747 + * bonobo_main:
5748 + * 
5749 + * Activates the Bonobo POA Manager and enters the main event loop.
5750 + */
5751 +void
5752 +vim_bonobo_main (void)
5753 +{
5754 +       GMainLoop *loop;
5755 +
5756 +    if( in_bonobo_call ) {
5757 +        return;
5758 +    }
5759 +
5760 +       bonobo_activate ();
5761 +
5762 +       bonobo_main_loop_level++;
5763 +  
5764 +       loop = g_main_loop_new (NULL, TRUE);
5765 +       bonobo_main_loops = g_slist_prepend (bonobo_main_loops, loop);
5766 +
5767 +       if (g_main_loop_is_running (bonobo_main_loops->data))
5768 +               g_main_loop_run (loop);
5769 +
5770 +       bonobo_main_loops = g_slist_remove (bonobo_main_loops, loop);
5771 +
5772 +       g_main_loop_unref (loop);
5773 +
5774 +       bonobo_main_loop_level--;
5775 +}
5776 +
5777 +/**
5778 + * bonobo_main_quit:
5779 + * 
5780 + * Quits the main event loop.
5781 + */
5782 +void
5783 +vim_bonobo_main_quit (void)
5784 +{
5785 +       g_return_if_fail (bonobo_main_loops != NULL);
5786 +
5787 +       g_main_loop_quit (bonobo_main_loops->data);
5788 +}
5789 +
5790 +int
5791 +vim_bonobo_main_level(void)
5792 +{
5793 +    return bonobo_main_loop_level;
5794 +}
5795 +
5796 +static long save_p_report;
5797 +static int save_msg_silent;
5798 +static int save_emsg_silent;
5799 +
5800 +void
5801 +vim_bonobo_call_begin(void)
5802 +{
5803 +    in_bonobo_call = TRUE;
5804 +    gui.processing_call = TRUE;
5805 +    save_p_report = p_report;
5806 +    p_report = 100000;
5807 +    save_msg_silent = msg_silent;
5808 +    msg_silent = TRUE;
5809 +    save_emsg_silent = emsg_silent;
5810 +    emsg_silent = TRUE;
5811 +}
5812 +
5813 +void
5814 +vim_bonobo_call_end(void)
5815 +{
5816 +    in_bonobo_call = FALSE;
5817 +    gui.processing_call = FALSE;
5818 +    msg_silent = save_msg_silent;
5819 +    emsg_silent = save_emsg_silent;
5820 +    p_report = save_p_report;
5821 +}
5822 +
5823 +gboolean
5824 +vim_bonobo_main_iteration_do(may_block)
5825 +{
5826 +    if( ! in_bonobo_call ) {
5827 +        g_main_context_iteration(NULL, may_block);
5828 +    }
5829 +}
5830 +
5831 diff -Nur vim63/src/vim_bonobo_main.h vim63-bonobo/src/vim_bonobo_main.h
5832 --- vim63/src/vim_bonobo_main.h 1970-01-01 01:00:00.000000000 +0100
5833 +++ vim63-bonobo/src/vim_bonobo_main.h  2005-09-09 20:14:02.765579832 +0200
5834 @@ -0,0 +1,16 @@
5835 +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
5836 +
5837 +#ifndef __VIM_BONOBO_MAIN_H__
5838 +#define __VIM_BONOBO_MAIN_H__
5839 +
5840 +#include <glib-object.h>
5841 +#include <bonobo/Bonobo.h>
5842 +
5843 +void                       vim_bonobo_main                      (void);
5844 +void                vim_bonobo_main_quit     (void);
5845 +int                 vim_bonobo_level(void);
5846 +gboolean            vim_bonobo_main_iteration_do(int may_block);
5847 +void                vim_bonobo_call_begin(void);
5848 +void                vim_bonobo_call_end(void);
5849 +
5850 +#endif /* __VIM_BONOBO_MAIN_H__ */
5851 diff -Nur vim63/src/vim-container.xml vim63-bonobo/src/vim-container.xml
5852 --- vim63/src/vim-container.xml 1970-01-01 01:00:00.000000000 +0100
5853 +++ vim63-bonobo/src/vim-container.xml  2005-09-09 20:14:02.761580440 +0200
5854 @@ -0,0 +1,83 @@
5855 +<Root>
5856 +
5857 +<commands>
5858 +       <cmd name="FileNewWindow" _label="_New Window" _tip="Open a new window"
5859 +             pixtype="stock" pixname="gtk-new" accel="*Control*n"/>
5860 +
5861 +       <cmd name="FileOpen" _label="_Open..." _tip="Open a file"
5862 +            pixtype="stock" pixname="gtk-open" accel="*Control*o"/>
5863 +
5864 +       <cmd name="FileCloseWindow" _label="_Close" _tip="Close window"
5865 +             pixtype="stock" pixname="gtk-close" accel="*Control*w"/>
5866 +
5867 +        <cmd name="FileExit" _label="_Quit" _tip="Quit the program"
5868 +            pixtype="stock" pixname="gtk-quit" accel="*Control*q"/>
5869 +       
5870 +       <cmd name="Preferences" _label="_Preferences..." _tip="Change preferences"  sensitive="0"
5871 +            pixtype="stock" pixname="gtk-preferences"/>
5872 +
5873 +       <cmd name="HelpAbout" _label="_About" _tip="About this application"
5874 +            pixtype="stock" pixname="About"/>
5875 +       <cmd name="Help" _label="Contents" _tip="Help On this application"
5876 +            pixtype="stock" pixname="Help" accel="F1"/>
5877 +
5878 +
5879 +       <cmd name="DnDNewWindow" _label="Open in new window"/>
5880 +       <cmd name="DnDSameWindow" _label="Open in this window"/>
5881 +       <cmd name="DnDCancel" _label="Cancel"
5882 +            pixtype="stock" pixname="Cancel"/>
5883 +</commands>
5884 +
5885 +<menu>
5886 +        <submenu name="File" _label="_File">
5887 +
5888 +               <menuitem name="FileNewWindow" verb=""/>
5889 +
5890 +               <placeholder name="Open Placeholder" delimit="top">
5891 +                       <menuitem name="FileOpen" verb=""/>
5892 +               </placeholder>
5893 +
5894 +               <placeholder name="File Items Placeholder" delimit="top"/>
5895 +
5896 +               <separator/>
5897 +
5898 +               <menuitem name="FileCloseWindow" verb=""/>
5899 +
5900 +               <menuitem name="FileExit" verb=""/>
5901 +
5902 +       </submenu>
5903 +
5904 +       <submenu name="Edit" _label="_Edit">
5905 +               <menuitem name="Preferences" verb=""/>
5906 +        </submenu>
5907 +
5908 +       <submenu name="View" _label="_View" hidden="1">
5909 +               <placeholder name="View Preferences Placeholder"/>
5910 +               <placeholder name="View Items Placeholder" delimit="top"/>
5911 +       </submenu>
5912 +
5913 +       <submenu name="Help" _label="_Help">
5914 +               <menuitem name="Help" verb=""/>
5915 +               <menuitem name="HelpAbout" verb=""/>
5916 +       </submenu>
5917 +</menu>
5918 +
5919 +<dockitem name="Toolbar" relief="none" homogeneous="1" behavior="exclusive">
5920 +
5921 +        <toolitem name="TBOpen" _label="Open" pixtype="stock"
5922 +                  pixname="Open" verb="FileOpen"/>
5923 +
5924 +        <toolitem name="TBCloseWindow" _label="Close" pixtype="stock"
5925 +                  pixname="Close" verb="FileCloseWindow"/>
5926 +</dockitem>
5927 +
5928 +<popups>
5929 +        <popup name="dragndrop">
5930 +             <menuitem name="DnDNewWindow" verb=""/>
5931 +             <menuitem name="DnDSameWindow" verb=""/>
5932 +             <separator/>
5933 +             <menuitem name="DnDCancel" verb=""/>
5934 +        </popup>
5935 +</popups>
5936 +
5937 +</Root>
5938 diff -Nur vim63/src/Vim_Control.server vim63-bonobo/src/Vim_Control.server
5939 --- vim63/src/Vim_Control.server        1970-01-01 01:00:00.000000000 +0100
5940 +++ vim63-bonobo/src/Vim_Control.server 2005-09-09 20:14:02.695590472 +0200
5941 @@ -0,0 +1,42 @@
5942 +<oaf_info>
5943 +
5944 +<oaf_server iid="OAFIID:Vim_Proxy_Factory" type="exe" location="/usr/local/bin/vim-factory">
5945 +  <oaf_attribute name="repo_ids" type="stringv">
5946 +    <item value="IDL:Bonobo/GenericFactory:1.0"/>
5947 +  </oaf_attribute>
5948 +  <oaf_attribute name="name" type="string" value="Vim Control factory"/>
5949 +  <oaf_attribute name="description" type="string" value="Vim Control factory"/>
5950 +</oaf_server>
5951 +
5952 +<oaf_server iid="OAFIID:Vim_Control_Factory" type="exe" location="/usr/local/bin/vim-component">
5953 +  <oaf_attribute name="repo_ids" type="stringv">
5954 +    <item value="IDL:Bonobo/GenericFactory:1.0"/>
5955 +  </oaf_attribute>
5956 +  <oaf_attribute name="name" type="string" value="Vim Control factory"/>
5957 +  <oaf_attribute name="description" type="string" value="Vim Control factory"/>
5958 +</oaf_server>
5959 +
5960 +<oaf_server iid="OAFIID:Vim_Control" type="factory"
5961 + location="OAFIID:Vim_Proxy_Factory">
5962 +  <oaf_attribute name="repo_ids" type="stringv">
5963 +    <item value="IDL:Bonobo/Unknown:1.0"/>
5964 +    <item value="IDL:Bonobo/Control:1.0"/>
5965 +    <item value="IDL:Bonobo/ItemContainer:1.0"/>
5966 +    <item value="IDL:Bonobo/PersistStream:1.0"/>
5967 +    <item value="IDL:Bonobo/PersistFile:1.0"/>
5968 +    <item value="IDL:Bonobo/Persist:1.0"/>
5969 +    <item value="IDL:Nautilus/View:1.0"/>
5970 +  </oaf_attribute>
5971 +  <oaf_attribute name="name" type="string" value="Vim Control"/>
5972 +  <oaf_attribute name="description" type="string" value="Vim Control"/>
5973 +  <oaf_attribute name="bonobo:editable" type="boolean" value="false"/>
5974 +  <oaf_attribute name="bonobo:supported_mime_types" type="stringv">
5975 +    <item value="text/plain"/>
5976 +    <item value="text/*"/>
5977 +  </oaf_attribute>
5978 +  <oaf_attribute name="nautilus:view_as_name" type="string" value="Text"/>
5979 +  <oaf_attribute name="nautilus:view_as_label" type="string" value="View/Edit in Vim"/>
5980 +  <oaf_attribute name="nautilus:viewer_label" type="string" value="Vim"/>
5981 +</oaf_server>
5982 +
5983 +</oaf_info>
5984 diff -Nur vim63/src/Vim_Control.server.in vim63-bonobo/src/Vim_Control.server.in
5985 --- vim63/src/Vim_Control.server.in     1970-01-01 01:00:00.000000000 +0100
5986 +++ vim63-bonobo/src/Vim_Control.server.in      2005-09-09 20:14:02.696590320 +0200
5987 @@ -0,0 +1,42 @@
5988 +<oaf_info>
5989 +
5990 +<oaf_server iid="OAFIID:Vim_Proxy_Factory" type="exe" location="@DEST_BIN@/vim-factory">
5991 +  <oaf_attribute name="repo_ids" type="stringv">
5992 +    <item value="IDL:Bonobo/GenericFactory:1.0"/>
5993 +  </oaf_attribute>
5994 +  <oaf_attribute name="name" type="string" value="Vim Control factory"/>
5995 +  <oaf_attribute name="description" type="string" value="Vim Control factory"/>
5996 +</oaf_server>
5997 +
5998 +<oaf_server iid="OAFIID:Vim_Control_Factory" type="exe" location="@DEST_BIN@/@VIMNAME@">
5999 +  <oaf_attribute name="repo_ids" type="stringv">
6000 +    <item value="IDL:Bonobo/GenericFactory:1.0"/>
6001 +  </oaf_attribute>
6002 +  <oaf_attribute name="name" type="string" value="Vim Control factory"/>
6003 +  <oaf_attribute name="description" type="string" value="Vim Control factory"/>
6004 +</oaf_server>
6005 +
6006 +<oaf_server iid="OAFIID:Vim_Control" type="factory"
6007 + location="OAFIID:Vim_Proxy_Factory">
6008 +  <oaf_attribute name="repo_ids" type="stringv">
6009 +    <item value="IDL:Bonobo/Unknown:1.0"/>
6010 +    <item value="IDL:Bonobo/Control:1.0"/>
6011 +    <item value="IDL:Bonobo/ItemContainer:1.0"/>
6012 +    <item value="IDL:Bonobo/PersistStream:1.0"/>
6013 +    <item value="IDL:Bonobo/PersistFile:1.0"/>
6014 +    <item value="IDL:Bonobo/Persist:1.0"/>
6015 +    <item value="IDL:Nautilus/View:1.0"/>
6016 +  </oaf_attribute>
6017 +  <oaf_attribute name="name" type="string" value="Vim Control"/>
6018 +  <oaf_attribute name="description" type="string" value="Vim Control"/>
6019 +  <oaf_attribute name="bonobo:editable" type="boolean" value="false"/>
6020 +  <oaf_attribute name="bonobo:supported_mime_types" type="stringv">
6021 +    <item value="text/plain"/>
6022 +    <item value="text/*"/>
6023 +  </oaf_attribute>
6024 +  <oaf_attribute name="nautilus:view_as_name" type="string" value="Text"/>
6025 +  <oaf_attribute name="nautilus:view_as_label" type="string" value="View/Edit in Vim"/>
6026 +  <oaf_attribute name="nautilus:viewer_label" type="string" value="Vim"/>
6027 +</oaf_server>
6028 +
6029 +</oaf_info>
6030 diff -Nur vim63/src/vim.h vim63-bonobo/src/vim.h
6031 --- vim63/src/vim.h     2005-09-09 20:11:10.612751000 +0200
6032 +++ vim63-bonobo/src/vim.h      2005-09-09 20:14:02.762580288 +0200
6033 @@ -755,6 +755,10 @@
6034  #define READ_STDIN     0x04    /* read from stdin */
6035  #define READ_BUFFER    0x08    /* read from curbuf (converting stdin) */
6036  #define READ_DUMMY     0x10    /* reading into a dummy buffer */
6037 +#define READ_EMB_STREAM 0x20    /* read from container stream object 
6038 +                                        (i.e. Bonobo Persist Stream) */
6039 +#define READ_EMB_FILE   0x40    /* read from container file object 
6040 +                                        (i.e. Bonobo Persist File) */
6041  
6042  /* Values for change_indent() */
6043  #define INDENT_SET     1       /* set indent */
6044 @@ -1045,6 +1049,7 @@
6045      EVENT_CURSORHOLD,          /* cursor in same position for a while */
6046      EVENT_FUNCUNDEFINED,       /* if calling a function which doesn't exist */
6047      EVENT_REMOTEREPLY,         /* upon string reception from a remote vim */
6048 +    EVENT_EMBEDDED_COMPONENT,  /* upon embedding of vim as a component */
6049      NUM_EVENTS                 /* MUST be the last one */
6050  };
6051  
6052 diff -Nur vim63/src/vim_proxy_factory.c vim63-bonobo/src/vim_proxy_factory.c
6053 --- vim63/src/vim_proxy_factory.c       1970-01-01 01:00:00.000000000 +0100
6054 +++ vim63-bonobo/src/vim_proxy_factory.c        2005-09-09 20:14:02.766579680 +0200
6055 @@ -0,0 +1,66 @@
6056 +/*
6057 + * vim_proxy_factory.c
6058 + *
6059 + * Author:
6060 + *   Jason Hildebrand (jason@peaceworks.ca)
6061 + *
6062 + */
6063 +
6064 +#include "vim.h"
6065 +#include "version.h"
6066 +#include <libbonobo.h>
6067 +#include <bonobo/bonobo-foreign-object.h>
6068 +#include <bonobo/bonobo-generic-factory.h>
6069 +#include "vim_bonobo_control.h"
6070 +#include "vim_bonobo_factory.h"
6071 +
6072 +#define VIM_PROXY_OAFIID "OAFIID:Vim_Proxy_Factory"
6073 +
6074 +static BonoboGenericFactory *factory = NULL;
6075 +
6076 +static BonoboObject *
6077 +vim_proxy_factory(BonoboGenericFactory *this,
6078 +              const char           *oaf_iid,
6079 +              void                 *data)
6080 +{
6081 +    CORBA_Object realfactory;
6082 +    CORBA_Environment ev;
6083 +    BonoboObject * vim_control = NULL;
6084 +    CORBA_Object corba_control;
6085 +
6086 +    g_return_val_if_fail (this != NULL, NULL);
6087 +    g_return_val_if_fail (oaf_iid != NULL, NULL);
6088 +
6089 +    g_message ("Trying to produce a '%s'...", oaf_iid);
6090 +                                                                                
6091 +    if (strcmp (oaf_iid, VIM_OAFIID) == 0) {
6092 +        CORBA_exception_init(&ev);
6093 +
6094 +        realfactory = bonobo_activation_activate_from_id (VIM_FACTORY_OAFIID,
6095 +                                                  Bonobo_ACTIVATION_FLAG_PRIVATE,
6096 +                                                  NULL,
6097 +                                                  &ev);
6098 +        if (ev._major != CORBA_NO_EXCEPTION ) {
6099 +            CORBA_exception_free (&ev);
6100 +            return NULL;
6101 +        }
6102 +
6103 +        corba_control = Bonobo_GenericFactory_createObject(realfactory, VIM_OAFIID, &ev);
6104 +        if (ev._major != CORBA_NO_EXCEPTION ) {
6105 +            CORBA_exception_free (&ev);
6106 +            return NULL;
6107 +        }
6108 +        CORBA_exception_free (&ev);
6109 +        vim_control = bonobo_foreign_object_new(corba_control);
6110 +    } else {
6111 +        g_warning ("Unknown IID `%s' requested", oaf_iid);
6112 +        return NULL;
6113 +    }
6114 +    return vim_control;
6115 +}
6116 +
6117 +
6118 +BONOBO_ACTIVATION_FACTORY (VIM_PROXY_OAFIID,
6119 +               "Vim Proxy Factory", "1.0",
6120 +               vim_proxy_factory, NULL);
6121 +
This page took 0.632986 seconds and 3 git commands to generate.