Re: my nits



On Mon, Feb 14, 2000 at 09:15:36AM -0500, Nat Friedman wrote:
>  > >     bonobo-desktop was a cute hack by Miguel to make your window
>  > > CORBA-controllable, so you could write a perl script and move the
>  > > thing around and resize it and so forth.
>  > yes, cute I guess, but it doesn't have much real-use value imho.
>     Yeah.  It would be nice to include this kind of thing in a
> BonoboApp-style toplevel object, though.

Maybe. I think I'd be higly annoyed if apps decided to start moving
around on me though.
 
[*snip* (ui-handler code)]
 
>     This is interesting.  Can you please forward this code to the
> list?  How components determine the position of their embedded
> menus/toolbars is an open question.

static void
parse_vde_uiinfo (BonoboUIHandler *uih, VDEUIInfo *uii)
{
   BonoboUIHandlerMenuItem *item, *peer;
   VDEUIInfo *curr_uii;
   gchar *path;
   int pos = -1;
   
   for (curr_uii = uii; curr_uii->parent_path != NULL; curr_uii++) {
      item = bonobo_ui_handler_menu_parse_uiinfo_one (&(curr_uii->data));
      path = g_strconcat (curr_uii->parent_path,
                          remove_ulines (curr_uii->data.label), NULL);

      if (curr_uii->override) {
         pos = bonobo_ui_handler_menu_get_pos (uih, path);
         /* don't do anything if the item already exists */
         if (pos != -1) {
            continue;
         }
      }
      pos = -1;
      if (uii->pos == VDE_MENU_BEFORE) {
         pos = 1;
      }
      g_free (path);
      if (curr_uii->relative_to_sibling) {
         path = g_strconcat (curr_uii->parent_path,
                             curr_uii->relative_to_sibling, NULL);

         pos = bonobo_ui_handler_menu_get_pos (uih, path);
         g_free (path);
         if ((pos != -1) && (uii->pos = VDE_MENU_AFTER)) {
            pos++;
         }
      }
      item->pos = pos;
      bonobo_ui_handler_menu_add_one (uih, curr_uii->parent_path, item);
   }
}

This should be improved to do better checking on stuff like the path,
and I'm also not entirely sure if it works for every case (It seemed
like _get_pos() didn't always return the correct value), but it
works ok for the menu I have.


-- 
Martijn van Beers  <martijn@earthling.net>

'Don't worry if it sounds odd. Believe me, you are talking to
someone who has seen a lot of stuff that is odd. And I don't
mean biscuits.' --- Arthur Dent



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]