GtkBuilder in GtkAda?

View: New views
6 Messages — Rating Filter:   Alert me  

GtkBuilder in GtkAda?

by ter Vehn Robert :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Does GtkAda provide Ada API:s towards the GtkBuilder functions found in GTK+ >=2.12? I'd like to use Glade-3 (3.6) when building my next API, that's why I'm asking.

Kind Regards
Robert
_______________
Robert ter Vehn
robert.tervehn@...

_______________________________________________
gtkada mailing list
gtkada@...
http://lists.adacore.com/mailman/listinfo/gtkada

Re: GtkBuilder in GtkAda?

by Arnaud Charlet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Does GtkAda provide Ada API:s towards the GtkBuilder functions found in GTK+ >=2.12? I'd like to use Glade-3 (3.6) when building my next API, that's why I'm asking.

GtkBuilder has not been bound yet.

If people would like to contribute such bindings, that'd be very welcome!

Arno
_______________________________________________
gtkada mailing list
gtkada@...
http://lists.adacore.com/mailman/listinfo/gtkada

Re: GtkBuilder in GtkAda?

by ter Vehn Robert :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Do You think it would require lots of work creating such a binding? Do You have any advice documentation describing how to create GTK bindings?

Kind Regards
Robert


-----Original Message-----
From: Arnaud Charlet [mailto:charlet@...]
Sent: den 11 juni 2009 10:19
To: ter Vehn Robert
Cc: gtkada@...
Subject: Re: [gtkada] GtkBuilder in GtkAda?

> Does GtkAda provide Ada API:s towards the GtkBuilder functions found in GTK+ >=2.12? I'd like to use Glade-3 (3.6) when building my next API, that's why I'm asking.

GtkBuilder has not been bound yet.

If people would like to contribute such bindings, that'd be very welcome!

Arno
_______________________________________________
gtkada mailing list
gtkada@...
http://lists.adacore.com/mailman/listinfo/gtkada

Re: GtkBuilder in GtkAda?

by Arnaud Charlet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Do You think it would require lots of work creating such a binding?

I haven't looked at the GtkBuilder API, so can't really comment.
I'd guess it's not a trivial binding, but creating bindings in general is
not rocket science.

> Do You have any advice documentation describing how to create GTK bindings?

I'd suggest looking at how other APIs have been bound by looking at existing
gtk-*.ad{s,b} files.

Arno
_______________________________________________
gtkada mailing list
gtkada@...
http://lists.adacore.com/mailman/listinfo/gtkada

Re: GtkBuilder in GtkAda?

by ter Vehn Robert :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Thanks for the response. I've started experiencing some but have a question on what the "preferred GtkAda way" is.

I'm binding the C function which is declared as:
guint gtk_builder_add_from_file (GtkBuilder *builder, const gchar *filename, GError **error);

The function returns a 'guint' which is 0 on error, otherwise a positive 'guint', although having two "error flags" seems unnecessary (return value and error pointer).

How would the corresponding GtkAda procedure/function declaration look?
A straightforward translation could be (package Gtk.Builder):
function Add_From_File (Builder : Gtk_Builder; Filename : String; Error : Glib.GError.GError_Access) return Glib.Guint;

Should I use exceptions in case of an error? Another option is to return null on a successful call, i.e.:
function Add_From_File (Builder : Gtk_Builder; Filename : String) return Glib.Error.GError;

What way corresponds best with the ideas behind GtkAda?

For clarification, the Gtk_Builder type is:
type Gtk_Builder_Record is new Glib.Object.GObject_Record with private;
type Gtk_Builder is access all Gtk_Builder_Record'Class;
private:
  type Gtk_Builder_Record is new Glib.GObject.GObject_Record with null record;

Kind Regards
Robert ter Vehn

-----Original Message-----
From: Arnaud Charlet [mailto:charlet@...]
Sent: den 24 juni 2009 09:50
To: ter Vehn Robert
Cc: gtkada@...
Subject: Re: [gtkada] GtkBuilder in GtkAda?

> Do You think it would require lots of work creating such a binding?

I haven't looked at the GtkBuilder API, so can't really comment.
I'd guess it's not a trivial binding, but creating bindings in general is
not rocket science.

> Do You have any advice documentation describing how to create GTK bindings?

I'd suggest looking at how other APIs have been bound by looking at existing
gtk-*.ad{s,b} files.

Arno
_______________________________________________
gtkada mailing list
gtkada@...
http://lists.adacore.com/mailman/listinfo/gtkada

Re: GtkBuilder in GtkAda?

by Arnaud Charlet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> How would the corresponding GtkAda procedure/function declaration look?
> A straightforward translation could be (package Gtk.Builder):
> function Add_From_File (Builder : Gtk_Builder; Filename : String; Error : Glib.GError.GError_Access) return Glib.Guint;
>
> Should I use exceptions in case of an error? Another option is to return null on a successful call, i.e.:
> function Add_From_File (Builder : Gtk_Builder; Filename : String) return Glib.Error.GError;

Right, that's what we do in e.g. gtk-file_chooser.ad{s,b}, so I'd suggest doing
the same (return null on a successful call).

Arno
_______________________________________________
gtkada mailing list
gtkada@...
http://lists.adacore.com/mailman/listinfo/gtkada