Re: gtk-perl-list Digest, Vol 57, Issue 7
() and gtk_bindings_activate_event() Indeed those two go fine, per below. But it seems they refuse to operate on plain GtkObjects, only widgets, because of wanting to spin keys through the per-display keymap thingie. So I might want gtk_bindings_set_activate() too, which would mean wrapping GtkBindingSet, however opaquely. -- next part -- A non-text attachment was scrubbed... Name: GtkObject.xs.bindings.diff Type: text/x-diff Size: 1289 bytes Desc: not available URL: http://mail.gnome.org/archives/gtk-perl-list/attachments/20090109/c95dba81/attachment.bin -- next part -- A non-text attachment was scrubbed... Name: t-entry.pl Type: text/x-perl Size: 1659 bytes Desc: not available URL: http://mail.gnome.org/archives/gtk-perl-list/attachments/20090109/c95dba81/attachment-0001.bin -- Message: 5 Date: Fri, 9 Jan 2009 07:01:28 +0100 From: Emmanuel Rodriguez emmanuel.rodrig...@gmail.com Subject: Re: Volunteers for wrapping new API? To: Torsten Schoenfeld kaffeeti...@gmx.de Cc: gtk-perl-list@gnome.org Message-ID: b85da50e0901082201x3a361045o9b59c9a87bcda...@mail.gmail.com Content-Type: text/plain; charset=UTF-8 On Thu, Jan 8, 2009 at 8:43 PM, Torsten Schoenfeld kaffeeti...@gmx.de wrote: Aloha, Ahoj, the upcoming GNOME release 2.26 will use gtk+ 2.16 which provides new API that we haven't wrapped in the bindings yet. For some reason, I seem to be unable to find the tuits to tackle this, so I'm asking you: Are there volunteers who are willing to help bind the new GTK+ API? I can give it a try as the weekend is arriving and it's cold outside ;) I don't have the most recent version of GTK nor perl Gtk2. I'm using the stock versions provided by Ubuntu 7.10, which is not even the most recent Ubuntu! I have a few questions: What's the URL for perl Gtk2 trunk? What's the best way for installing the newest Gtk2 and all it's dependencies? How to keep synchronized with the other kind souls that decided to help? Where can I submit the patches for review (mailing list or RT)? The new API is listed on http://library.gnome.org/devel/gtk/2.15/api-index-2-16.html. New signals and properties are automatically handled, so we don't need to handle those. Only new functions. For most functions, wrapping them consists of copying the C prototype into the relevant *.xs file and writing a unit test for it in the corresponding *.t file. I'd be happy to help with the corner cases not covered by this. -Torsten ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list -- Emmanuel Rodriguez -- ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list End of gtk-perl-list Digest, Vol 57, Issue 7 -- ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list
CamelBox Error - Entry Point Not Found
After installing the latest version of CamelBox and attempting to run gyroscope.pl, I get this error: Entry Point Not Found The procedure entry point g_bookmark_file_error_quark could not be located in the dynamic link library libglib-2.0-0.dll. I am running XP SP3. Prior to installing Camelbox, I had been using distribution for activstate located at http://www.lostmind.de/gtk2-perl/ . After initially receiving this error (yes, I was running perl from C:/camelbox/bin) I uninstalled that installation and then reinstalled CamelBox to see if that would correct the problem. No avail. I received a similar error when I tried to run this from my home computer, which runs Vista Home. Has anyone else experienced this or have a solution? Thanks! ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list
default signal closure via bindingset
The program below gets two errors GLib-CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL' failed at /home/gg/bug/glib-sig-ret-undef/foo.pl line 44. [gperl_value_from_sv] FIXME: unhandled type - 0 ((null) fundamental for (null)) I think the first is gperl_fundamental_wrapper_class_from_type() called when wrapper_class_by_type is NULL. Is that supposed to be at least possible? Maybe when _gperl_sv_from_value_internal() gets a signal's return value which is a new fundamental type from some C code, when neither that new type nor anything else has ever yet told to gperl_register_fundamental_full()? I think the second is because gperl_signal_class_closure_marshal() tries to gperl_value_from_sv() into a GValue which is G_TYPE_NONE. Dunno if a return_value location like that is supposed to be allowed, but gtk_binding_entry_activate() calls g_signal_emitv() that way. I guess gperl_signal_class_closure_marshal() should do the same as gperl_closure_marshal() does and don't store the sv to return_value if the latter is G_TYPE_NONE. (gperl_closure_marshal() is of course what you get if you specify a class_closure instead of the default name do_mysig.) I suppose the alternative is to look at the signal info and do nothing at all if the return_type is NONE, no matter what return_value arg the caller tried to ask for. But I'm not up with what the duties of a marshaller are supposed to be. Incidentally there's only a problem if a do_mysig() like this returns a non-undef value. But there's no requirement for handlers or class handlers to explicitly return undef if the handler is spec'ed as return_type G_TYPE_NONE, is there? package Foo; use strict; use warnings; use Gtk2 '-init'; use Glib::Object::Subclass 'Gtk2::EventBox', signals = { mysig = { param_types = [], return_type = undef, flags = ['run-last','action'], } }; Gtk2::Rc-parse_string ('HERE'); binding Foo_keys { bind x { mysig () } } class Foo binding Foo_keys HERE sub do_mysig { my ($self) = @_; print hello from do_mysig\n; return 1; } package main; use strict; use warnings; my $toplevel = Gtk2::Window-new('toplevel'); my $foo = Foo-new; $toplevel-add ($foo); my $event = Gtk2::Gdk::Event-new ('key-press'); my $keyval = Gtk2::Gdk-keyval_from_name('x'); my $display = $foo-get_display; my $keymap = Gtk2::Gdk::Keymap-get_for_display ($display); my @keys = $keymap-get_entries_for_keyval ($keyval); @keys or die; $event-group($keys[0]-{'group'}); $event-hardware_keycode($keys[0]-{'keycode'}); $foo-signal_emit ('key_press_event', $event); exit 0; Index: GType.xs === --- GType.xs (revision 1055) +++ GType.xs (working copy) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2005 by the gtk2-perl team (see the file AUTHORS for + * Copyright (C) 2003-2005, 2009 by the gtk2-perl team (see the file AUTHORS for * the full list) * * This library is free software; you can redistribute it and/or modify it @@ -254,10 +254,12 @@ GPerlValueWrapperClass * gperl_fundamental_wrapper_class_from_type (GType gtype) { - GPerlValueWrapperClass * res; + GPerlValueWrapperClass * res = NULL; G_LOCK (wrapper_class_by_type); - res = (GPerlValueWrapperClass *) - g_hash_table_lookup (wrapper_class_by_type, (gpointer) gtype); + if (wrapper_class_by_type) { + res = (GPerlValueWrapperClass *) + g_hash_table_lookup (wrapper_class_by_type, (gpointer) gtype); + } G_UNLOCK (wrapper_class_by_type); return res; } @@ -992,7 +994,12 @@ gperl_run_exception_handlers (); } else if (return_value) { - gperl_value_from_sv (return_value, POPs); + /* Same as gperl_closure_marshal() ... */ + /* we need to remove the value to from the stack, + * regardless of whether we do anything with it. */ + SV * sv = POPs; + if (G_VALUE_TYPE (return_value)) +gperl_value_from_sv (return_value, sv); PUTBACK; } SvSetSV (ERRSV, save_errsv); ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Re: Volunteers for wrapping new API?
I can give it a try as the weekend is arriving and it's cold outside ;) I don't have the most recent version of GTK nor perl Gtk2. I'm using the stock versions provided by Ubuntu 7.10, which is not even the most recent Ubuntu! I have a few questions: I hope that this is the right way for sending the patches for the next release of Gtk2. I will reply to the best of my knowledge to my own questions, please correct me if there's a better answer. I hope that this will help all new comers willing to contribute. What's the URL for perl Gtk2 trunk? svn co http://svn.gnome.org/svn/perl-Gtk2/trunk Installing the following modules from SVN might help to build the latest Gtk2: http://svn.gnome.org/svn/perl-Glib/trunk http://svn.gnome.org/svn/perl-Pango/trunk In Ubuntu/Debian I had to install the modules this way: perl Makefile.PL INSTALLDIRS=vendor make sudo make install PREFIX=/usr It's a pity because this will install the newest version over the existing one. But it should be possible to reinstall the original version of the OS with : sudo apt-get install libglib-perl libgtk2-perl --reinstall What's the best way for installing the newest Gtk2 and all it's dependencies? I tried to use jhbuild but it didn't work, so I had to install the Gtk2 libraries over the existing ones :( How to keep synchronized with the other kind souls that decided to help? Where can I submit the patches for review (mailing list or RT)? I still don't know, I hope that this mailing list is the right place! I have attached a first patch for GtkCellView. Tomorrow I will continue with the other widgets excluding the StatusIcons which found already a supporter. I took me a while to have the environment setup properly, that's why I only managed to patch one module so far. Tomorrow things should go faster. If it can help some one here's how I manage to do: Once the latest Gtk2 has been checkout and that the build dependencies have been installed the fun can finally start. The best is to build a clean version of Gtk2 (without installing it): perl Makefile.PL INSTALLDIRS=vendor make Once this has been done. Hack your favorite .xs file and it's corresponding .t file: gedit xs/GtkCellView.xs t/GtkCellView.t To compile and test it's faster to specify the files to build than to do make. Calling make without arguments will rebuild everything, at least it did so on my system. That's very long and annoying. Instead, for faster results do this: make xs/GtkCellView.c xs/GtkCellView.o blib/arch/auto/Gtk2/Gtk2.so Test the patch make test or run the test directly: perl -Iblib/lib -Iblib/arch t/GtkCellView.t Make sure that the proper lib folders are included in @INC otherwise perl will use be mixed up with existing Gtk2 and bad things will happen. Create a patch with: svn diff /tmp/GtkCellView.patch -- Emmanuel Rodriguez Index: xs/GtkCellView.xs === --- xs/GtkCellView.xs (revision 2104) +++ xs/GtkCellView.xs (working copy) @@ -35,6 +35,8 @@ GtkTreePath_own * gtk_cell_view_get_displayed_row (GtkCellView * cell_view); +GtkTreeModel_ornull * gtk_cell_view_get_model (GtkCellView * cellview); + ## gboolean gtk_cell_view_get_size_of_row (GtkCellView * cell_view, GtkTreePath * path, GtkRequisition * requisition); GtkRequisition_copy * gtk_cell_view_get_size_of_row (GtkCellView * cell_view, GtkTreePath * path) Index: t/GtkCellView.t === --- t/GtkCellView.t (revision 2104) +++ t/GtkCellView.t (working copy) @@ -12,7 +12,7 @@ use strict; use warnings; -use Gtk2::TestHelper tests = 10, +use Gtk2::TestHelper tests = 12, at_least_version = [2, 6, 0, GtkCellView is new in 2.6], ; @@ -25,6 +25,8 @@ isa_ok (my $cview = Gtk2::CellView-new, 'Gtk2::CellView', 'Gtk2::CellView-new'); +is($cview-get_model(), undef, '$cview-get_model is undef'); + ginterfaces_ok($cview); isa_ok ($cview = Gtk2::CellView-new_with_text ('text'), 'Gtk2::CellView', @@ -41,7 +43,8 @@ fill_store ($model, get_pixbufs ($win)); ok (eval { $cview-set_model ($model); 1; }, '$cview-set_model'); -# there is no get, or property??? +# there is a get (new since gtk 2.16) +is($cview-get_model(), $model, '$cview-get_model'); my $treepath = Gtk2::TreePath-new_from_string ('0'); $cview-set_displayed_row ($treepath); ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Re: CamelBox Error - Entry Point Not Found
2009/1/9 Jeff Hallock jhall...@wbanda.com: After installing the latest version of CamelBox and attempting to run gyroscope.pl, I get this error: Entry Point Not Found The procedure entry point g_bookmark_file_error_quark could not be located in the dynamic link library libglib-2.0-0.dll. I am running XP SP3. Prior to installing Camelbox, I had been using distribution for activstate located at http://www.lostmind.de/gtk2-perl/ . So you have two copies of Perl in your %PATH% environment variable, correct? If you want to use Gtk2-Perl via Camelbox, Camelbox needs to be first in your %PATH% before any other copies of Perl. It also needs to be first before any other GTK apps on Windows, such as Gimp, Pidgeon, and the like. There's a dedicated Camelbox list at http://groups.google.com/group/camelbox; I suggest you use that for any further issues, as I don't want burden the GTK developers with problems that aren't necessarily theirs. Thanks, Brian ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Re: Volunteers for wrapping new API?
Emmanuel Rodriguez emmanuel.rodrig...@gmail.com writes: In Ubuntu/Debian I had to install the modules this way: perl Makefile.PL INSTALLDIRS=vendor make sudo make install PREFIX=/usr It's a pity because this will install the newest version over the existing one. That scariest bit with that is what's left-over if you later try to uninstall :-). ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Re: default signal closure via bindingset
On Jan 9, 2009, at 4:01 PM, Kevin Ryde wrote: The program below gets two errors GLib-CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL' failed at /home/gg/bug/glib-sig-ret-undef/foo.pl line 44. [gperl_value_from_sv] FIXME: unhandled type - 0 ((null) fundamental for (null)) I think the first is gperl_fundamental_wrapper_class_from_type() called when wrapper_class_by_type is NULL. Is that supposed to be at least possible? Maybe when _gperl_sv_from_value_internal() gets a signal's return value which is a new fundamental type from some C code, when neither that new type nor anything else has ever yet told to gperl_register_fundamental_full()? That is not supposed to be possible. We're supposed to do all the type registration when loading the module, before any code using the things gets called. But you're also not supposed to pass around GValues with type G_TYPE_NONE, so far as i know. It makes me think something else is afoot. Try the fix below, first. I think the second is because gperl_signal_class_closure_marshal() tries to gperl_value_from_sv() into a GValue which is G_TYPE_NONE. Dunno if a return_value location like that is supposed to be allowed, but gtk_binding_entry_activate() calls g_signal_emitv() that way. That sounds like it could be a problem. We use the presence of a return value pointer to determine whether we're supposed to expect any return values, but here they've passed ... *brane asplode* Try this: at the top of gperl_signal_class_closure_marshal(), if (return_value) { /* Try to cover for people doing strange things */ if (G_TYPE_NONE == G_VALUE_TYPE (return_value)) return_value = NULL; } This will cause return_value to be NULL later in the function where we decide what flags to pass to call_method(). G_VOID|G_DISCARD will cause the interpreter to toss anything returned from the subroutine so that we don't have to worry about it. -- zella (crying): I want... us: What? zella (still crying): I want... something! ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Re: Volunteers for wrapping new API?
On Jan 9, 2009, at 4:09 PM, Emmanuel Rodriguez wrote: I can give it a try as the weekend is arriving and it's cold outside ;) I don't have the most recent version of GTK nor perl Gtk2. I'm using the stock versions provided by Ubuntu 7.10, which is not even the most recent Ubuntu! I have a few questions: I hope that this is the right way for sending the patches for the next release of Gtk2. I will reply to the best of my knowledge to my own questions, please correct me if there's a better answer. I hope that this will help all new comers willing to contribute. Yes, please send patches to the list for review and discussion. And do not be offended by critique. ;-) What's the URL for perl Gtk2 trunk? svn co http://svn.gnome.org/svn/perl-Gtk2/trunk Installing the following modules from SVN might help to build the latest Gtk2: http://svn.gnome.org/svn/perl-Glib/trunk http://svn.gnome.org/svn/perl-Pango/trunk In Ubuntu/Debian I had to install the modules this way: perl Makefile.PL INSTALLDIRS=vendor make sudo make install PREFIX=/usr No! (see below) It's a pity because this will install the newest version over the existing one. But it should be possible to reinstall the original version of the OS with : sudo apt-get install libglib-perl libgtk2-perl --reinstall What's the best way for installing the newest Gtk2 and all it's dependencies? I tried to use jhbuild but it didn't work, so I had to install the Gtk2 libraries over the existing ones :( NnOooo.. jhbuild is recommended. You very much want to be able to distinguish between your stable distro gtk+ and the unstable development version. Be warned, it takes a long time to bootstrap with jhbuild. The README in each gtk2-perl module's tarball or svn checkout has this to say about installing development versions in a non-standard place: To avoid installing to a system directory, since this is a beta release, you can change the installation prefix at Makefile.PL time with perl Makefile.PL PREFIX=/some/other/place This will install the module to the subdirectory lib/perl5 under the given prefix. If this is not already in perl's include path, you'll need to tell perl how to get to this library directory so you can use it; there are three ways: in your environment (the easiest): # assuming a bourne-style shell PERL5LIB=/some/other/place/lib/perl5/site_perl export PERL5LIB on the perl command line: perl -I /some/other/place/lib/perl5/site_perl yourscript in the code of your perl script: use lib '/some/other/place/lib/perl5/site_perl'; I install the perl modules to the same sandbox root i use for my jhbuild install -- $HOME/sandboxes/gnomesvn -- and when i need to work with that sandbox, i source a script that sets up my shell's environment for that sandbox. You can also use jhbuild shell. To compile and test it's faster to specify the files to build than to do make. Calling make without arguments will rebuild everything, at least it did so on my system. That's very long and annoying. Instead, for faster results do this: make xs/GtkCellView.c xs/GtkCellView.o blib/arch/auto/Gtk2/Gtk2.so Typing make with no arguments will build the default target, all, which includes the docs. If you just say make blib/arch/auto/Gtk2/Gtk2.so then make will take care of rerunning xsubpp and compiling the necessary stuff. Test the patch make test or run the test directly: perl -Iblib/lib -Iblib/arch t/GtkCellView.t This is easier with -Mblib, e.g. perl -Mblib t/GtkCellView.t Since we support all stable versions, your new support needs to be made conditional. There are a few classes of this: 1. in XS and C code, new symbols are wrapped in #if GTK_CHECK_VERSION(...) for the version of gtk+ in which the symbol was introduced. It's best to go by the @since tags in the gtk-doc for the new function over in the gtk+ source. 2. in perl and .t code, tests for new symbols go into SKIP blocks, conditional on the gtk+ version in which the symbol was added. Look around at several other files, and you'll see the convention we use. -- Well done, Android. Aperture Science reminds you that Android Hell is a real place, and you will be sent there at the first sign of defiance. -- GlaDOS ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Patch for GtkCellView 2.16
Same as the previous patch but with the proper gtk version check. Please, if something is wrong comment it to me as soon as possible as I will start to do the others modules. -- Emmanuel Rodriguez Index: xs/GtkCellView.xs === --- xs/GtkCellView.xs (revision 2104) +++ xs/GtkCellView.xs (working copy) @@ -66,3 +66,9 @@ } else XSRETURN_EMPTY; + +#if GTK_CHECK_VERSION (2, 16, 0) + +GtkTreeModel_ornull * gtk_cell_view_get_model (GtkCellView * cellview); + +#endif /* 2.16 */ Index: t/GtkCellView.t === --- t/GtkCellView.t (revision 2104) +++ t/GtkCellView.t (working copy) @@ -12,7 +12,7 @@ use strict; use warnings; -use Gtk2::TestHelper tests = 10, +use Gtk2::TestHelper tests = 12, at_least_version = [2, 6, 0, GtkCellView is new in 2.6], ; @@ -25,6 +25,11 @@ isa_ok (my $cview = Gtk2::CellView-new, 'Gtk2::CellView', 'Gtk2::CellView-new'); +SKIP: { + skip 'new 2.16 stuff', 1 unless Gtk2-CHECK_VERSION(2, 16, 0); + is($cview-get_model(), undef, '$cview-get_model is undef'); +} + ginterfaces_ok($cview); isa_ok ($cview = Gtk2::CellView-new_with_text ('text'), 'Gtk2::CellView', @@ -41,7 +46,11 @@ fill_store ($model, get_pixbufs ($win)); ok (eval { $cview-set_model ($model); 1; }, '$cview-set_model'); -# there is no get, or property??? +# there is a get (new since gtk 2.16) +SKIP: { + skip 'new 2.16 stuff', 1 unless Gtk2-CHECK_VERSION(2, 16, 0); + is($cview-get_model(), $model, '$cview-get_model'); +} my $treepath = Gtk2::TreePath-new_from_string ('0'); $cview-set_displayed_row ($treepath); ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Re: Volunteers for wrapping new API?
Emmanuel Rodriguez wrote: I can give it a try as the weekend is arriving and it's cold outside ;) I don't have the most recent version of GTK nor perl Gtk2. I'm using the stock versions provided by Ubuntu 7.10, which is not even the most recent Ubuntu! I have a few questions: I hope that this is the right way for sending the patches for the next release of Gtk2. I will reply to the best of my knowledge to my own questions, please correct me if there's a better answer. I hope that this will help all new comers willing to contribute. Thanks for tackling this, and thanks for writing down your experience! muppet already answered most of your points. I'll just add: I tried to use jhbuild but it didn't work, so I had to install the Gtk2 libraries over the existing ones :( Support in jhbuild for our modules would be nice, but doesn't exist yet. I have attached a first patch for GtkCellView. Tomorrow I will continue with the other widgets excluding the StatusIcons which found already a supporter. Please coordinate with csincock to avoid duplicate work. To compile and test it's faster to specify the files to build than to do make. Calling make without arguments will rebuild everything, at least it did so on my system. That's very long and annoying. Once everything was completely built, calling 'make' should just recompile the touched XS files, unless you also modify the Makefile or Makefile.PL. If this doesn't work for you then there's a bug somewhere. ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list