Re: Where do I find the constants?



Thanks for your input, Christian.  Some specific comments:

On Fr, 2014-01-03 at 08:19 +0000, Christian Jaeger wrote:

That leaves me wondering whether my script stops working when
perl-Gtk3 is upgraded.

Yes, there might be more API changes in the future when I tackle a new
subset of gtk+ and add overrides for it.  But in general, these changes
will make the binding API more Perlish 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.

But it still leaves me also wondering why you try to move away from
the C api at all; perhaps it would make things more comfortable, but
it also makes understanding things more difficult.

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
<https://metacpan.org/pod/release/XAOC/Gtk2-1.249/lib/Gtk2/api.pod>.  We
need to port that to Gtk3.  Patches welcome.

my $cb= get "videodev_combobox";
my $list= new Gtk3::ListStore ("Glib::String");
my $seen_cur;
for (@videodevs) {
   $seen_cur=1 if $$config{videodev} eq $_;
   $list->append([$_]); # actually not working, I haven't figured it
out yet
}

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');

This is identical to what you'd do in C.




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