Re: Where do I find the constants?

2014/1/3 Torsten Schönfeld <torsten schoenfeld gmx de>
.. and add overrides for it.  But in general, these changes
will make the binding API more Perlish

(My point was that I "probably" prefer it to be straight lowlevel access, not Perlish. Perhaps it is a kind of "Perlishness" that one really wants, or/and still fits the "mechanical mapping from C", thus it would be premature to be critical here. But I'll mention what I'm generally doing when writing foreign function interfaces in Scheme: I first write a layer which is as lowlevel as possible; i.e. what can be achieved purely automatically if a machine readable API representation is available. And then write nicer ("Schemeish") abstractions on top, in a separate module. Thus concerns are clearly separated, and the lowlevel access would still be available to users should they wish to use it. I haven't thought through how I would do this with an OO framework like Gtk, though. Perhaps the added complexity isn't worth it here / I don't know what I'm talking about.)

and more backwards-compatible
with Gtk2.  This process can be accelerated (and could even be finished
already), if more people looked at the bindings and contributed patches
for missing pieces.

Perhaps it would be useful to point at some commit/patch(es) that are representing such work (it would be interesting for me to see what kind of Perlishness you're talking about and how it's implemented, and would show what kind of stuff to look out for.)
We're actually sticking very closely to the C API, even more so than
Gtk2.  There's just a thin layer of mechanical translation necessary to
get from C to Perl.  For Gtk2, it's described in
<>.  We
need to port that to Gtk3.  Patches welcome.

Thanks, this is really what I was looking for. Sorry, I somehow didn't read that page last time you posted it.
This is not how you use a Gtk3::TreeModel (of which Gtk3::ListStore is
an implementation).  You need to first create an iterator and then use
it to put data at its position in the list.

  my $model = Gtk3::ListStore->new ([qw/Glib::String/]);
  my $iter = $model->append;
  $model->set ($iter, 0 => 'Foo');

Thanks; this is what I've tried now (I'm using "local our" instead of "my" so that I can debug it more easily; 'get' is my wrapper around Gtk3::Builder's get_object):

local our $cb= get "videodev_combobox";
local our $model= new Gtk3::ListStore (["Glib::String"]);
local our $iter= $model->append;
for (@videodevs) {
   $model->set($iter, 0=> $_);

but the combobox is still "empty" after this (more precisely: has a hand-editable entry and one entry in the popup menu, but which is blank), and I'm getting

(recordvideo:5101): Gtk-CRITICAL **: gtk_entry_set_text: assertion `text != NULL' failed

when I select the blank entry from the popup.

Here's my glade code for the combobox:

              <object class="GtkComboBox" id="videodev_combobox">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="has_entry">True</property>
                <child internal-child="entry">
                  <object class="GtkEntry" id="combobox-entry">
                    <property name="can_focus">True</property>

(I'm going to read up more about how iterators are used in Gtk,


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