Re: [gtk-list] Porting a Motif app. to GTK



Thus spoke Brian J. Murrell
> I have a Motif app. (well it's not my app, it is a very decent GUI
> mailer called Ishmail - http://www.ishmail.com/ that has gone
> OpenSource) that I want to start converting to GTK.
> 
> So, my first question is, should I?  :-)  What I mean is what is the
> feasibility of converting an app from Motif to GTK?  Is there a porting
> guide, or any notes or tools of any kind out there to assist?

No porting guides exist.  I did this with XNotesPlus.  There are many
approaches you can take, but I found simply writing a version of each was
easiest.  I have a common set of headers, a couple of toolkit specific
headers, a small library of common code and then a directory for each
toolkit with the main bits of code.  I didn't completely separate the UI
code from the rest of the code - that's a shitload of work and very
difficult to do right.  It can be done, but whether you do it or not
depends on your own motivation and UI design skills.

It turns out that switching from one widget set to the other is not all
that difficult, especially going from Motif to Gtk (the other way is a
little tougher, in my opinion).  Things like forms, which get used all over
the place in Motif, get translated into boxes and tables in Gtk.  Once you've
done an source file or two, you'll see patterns you do over and over again
and the migration begins to move pretty quickly.

> If you were doing this, where would you start?  What (kinds) of widgets
> would you convert first?  Simple "inner" type widgets like menus and
> buttons or "outer" type widgets like container and manager widgets?  Or
> would you start somewhere else?

Start from the beginning, convert your main() and startup code and then
work your way outward.  Starting in the middle probably won't help.

> Will it be possible to convert piece by piece such that I can actually
> run this app with a mixture of widgets from both toolkits?  i.e.  If I
> convert the menus to use the GTK menu widget(s) will I be able to run
> the app at that point?  I can't see why not myself.

You can't mix toolkits, at least not Motif and Gtk.  In fact, there are
very few toolkits that you can mix, although some high level abstractions
allow this in some sense.  But basically, adding such integration would
bloat the toolkits terribly.  UI's are already code intensive, no sense
making it worse.

> Oh yes.  This app. is written in C++.  Would that make a difference in
> your opinion as to whether you used gtk+ proper or the gtk-- wrappers?

Beats me.  I've never done anything in C++.  The closest I come to object
oriented programming is the objectifed interfaces for the CGI and Gimp 
Perl modules.
-- 
Michael J. Hammel           |
The Graphics Muse           |   Chinese Proverb:
mjhammel@graphics-muse.org  |      Man who leaps from tall building, jumps to
http://www.graphics-muse.org       conclusion.



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