dynamic menu creation with bonobo



the following code should produce a number of dynamically created menu
items
and insert them into existing menu structure. it does so indeed, but
their
labels are empty and therefore the resulting items have very small
height.

this is done in BonoboControl _construct();

  placeholder = bonobo_ui_node_new("placeholder");
  bonobo_ui_node_set_attr(placeholder, "name", "MediaList");
  bonobo_ui_node_set_attr(placeholder, "delimit", "top");
  papersizes = gtk_gs_defaults_get_paper_sizes();
  for(i = 0; i < n; i++) {
    item = bonobo_ui_node_new("menuitem");
    g_snprintf(name, 32, "Media%s", papersizes[i].name);
    bonobo_ui_node_set_attr(item, "name", name);
    bonobo_ui_node_set_attr(item, "_label", papersizes[i].name);
    bonobo_ui_node_set_attr(item, "type", "radio");
    bonobo_ui_node_set_attr(item, "group", "Media");
    bonobo_ui_node_add_child(placeholder, item);
  }
  ps_view->priv->media_menus = placeholder;

and this in in control activate signal handler after setting the ui
container:

  bonobo_ui_util_set_ui(ps_view->priv->uic, DATADIR,
                        "ggv-postscript-view-ui.xml",
"GgvPostscriptView");

  new_media_menus = bonobo_ui_node_copy(ps_view->priv->media_menus,
TRUE);
  if(new_media_menus)
    bonobo_ui_component_set_tree(ps_view->priv->uic, "/menu/View/Media",
                                 new_media_menus, NULL);

and the XML contains "MediaList" placeholder in /menu/View/Media menu.

what am I doing wrong?

regards,
	jaKa

-- 

email: jaka gnu org
w3:    http://pluton.ijs.si/~jaka




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