GtkBuilder questions

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

 



Hi,

I'm trying to use GtkBuilder in Empathy instead of Glade. My first
problem is bug #486420.

libempathy-gtk is a library with a set of widgets that any application
can embed in is UI. So I would like to have methods like
GtkWidget *empathy_foo_new ();

This function should return a new object of a class I define myself that
inherit from GtkWindow or other classes, the object need to have
refcount=1, floating=true and visible=false (like all gtk_foo_new()
methods in GTK+).

Most widgets inherit from GtkContainer and I define in my glade/ui xml
file widgets contained. If I do that naively I can construct the widget
using glade (and convert to ui) but that won't be my own defined class.
Is there a way to tell GtkBuilder that an object is of type EmpathyFoo
and GtkBuilder will magically use g_object_new (EMPATHY_TYPE_FOO,
properties) to create that object and will pack childrens in it? I was
told that's possible to create my own widgets classes for glade using
"catalogues", I didn't tested that yet, is that possible with GtkBuilder
too?

An other problem I have is using GtkBuilder if the root is not a
GtkWindow object, GtkBuilder takes ownership of the widget (using
g_object_sink_ref), that means if I create a window I can unref the
builder safely but if it's just a GtkHBox (for example) I have to first
g_object_ref(hbox); and g_object_force_floating (hbox); and then it
should be safe to unref the builder, and my hbox becomes a normal widget
I can pack where I want. Is that the normal behaviours? I think libglade
don't act like that.

And final question; I have one ui file per widget, should I create one
GtkBuilder object and add_from_file() all ui files in it? Or should I
create one GtkBuilder per widget? And if I want to create 2 instances of
one widget I have to create 2 different GtkBuilder objects or is there a
way to tell GtkBuilder to create a new instance of a given object?

Thanks for answers,
Xavier Claessens.

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux