Re: Tutorial for porting from Gtk-Perl to Gtk2-Perl



Guillaume Cottenceau <gc mandrakesoft com> writes:

Guillaume has a document that can help in the CVS:

It'd be interesting that all the people who port programs do add
things to this document, when they miss. Sending to this list
would be ok too.

i ported most mandrake config tools[1] as well as mandrake control center
to Gtk+2.

i put trivial changes into a script so that basic conversion would be
automatic and that i've basically "only" to convert CTree, CList and
Text widgets and the like.

here it's (publically availlable in mandrakesoft cvs, in gi/docs
module) :

Attachment: porting-ugtk
Description: Text document


it lacks some emacs macros i used to convert to pixel & guillaume oo
style (thais "method object" become "object->method"), and the like.
in fact, it's just the immediate required change i had to do; most
complex were not so trivial and it would have been dangerous to
automate them.

part of this script will be useless for most people since we writed a
layer on top of gtk (ugtk) to simplify gtk+ code and be able to do
"functionnal" programming when we build a gui, which is much more
powerful and simpler.

eg, here's the extracted code from harddrake that create its gui
(well, there's of course more complicated code to detect hardware and
fill the hw tree) :

Attachment: harddrake2-gui
Description: Text document


that is 30 lines of code whereas glade-2 generate 673 lines just to
create a similar gui ...


for what's left, CTree/CList conversion is quite trivial with
 ->append_set helper. basically, you just have to create the model
before, freeze the model rather than the tree, and the like.

TextView conversion is not that much complex, though it's usually
simpler to just add all text in one pass rather than multiples times
with such a wrapper (extracted from ugtk) :

Attachment: gtktext_insert
Description: Text document


that also prevent you from freezing and de-freezing the widget which i
don't know how to do.

[1] that is drakxtools, not other softs such as rpmdrake which was
    converted by guillaume


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