Re: Embeding a Bonobo object in a Gtk Window



Probably, you simply forgot to check errors, for example, instead

ui_comp = bonobo_ui_component_new ("OAFID:Nautilus_Tree_View");

you should write

ui_comp = bonobo_ui_component_new ("OAFIID:Nautilus_Tree_View");

But there are other problems to, try to write a complete _working_ example 
like attached. For example, the activation of Nautilus_Tree_View requires 
eel_preferences_init () call. I think, this is nautilus bug.



#include <libbonoboui.h>

#ifdef NAU
#include <eel/eel.h>
#include <libgnomeui/gnome-ui-init.h>
#endif

GtkWidget *app_new () 
{
  GtkWidget *app;
  GtkWidget *component;
  
  app = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  
#ifdef NAU
  component = bonobo_widget_new_control ("OAFIID:Nautilus_Tree_View", NULL);
#else 
  component = bonobo_widget_new_control ("OAFIID:GNOME_EOG_Control", NULL);
#endif 
  
  gtk_widget_show (component);

  gtk_container_add (GTK_CONTAINER (app), component);

  return app; 
}

int 
main (int argc, char* argv[])
{
	GtkWidget *app;

	if (!bonobo_ui_init ("bonobo-app", "0.0.0", &argc, argv))
	    g_error (_("Cannot init libbonoboui code"));

#ifdef NAU
	eel_preferences_init ("/apps/nautilus");
#endif

	app = app_new ();

	gtk_widget_show_all (GTK_WIDGET (app));

	bonobo_main ();

	return 0;
}
all: a b

a: test.c
	gcc -g `pkg-config libbonoboui-2.0 --cflags --libs` -o a test.c

b: test.c
	gcc -g `pkg-config eel-2.0 --cflags --libs` -DNAU -o b test.c


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