[Gtk-sharp-list] portability issues

Miguel de Icaza miguel@ximian.com
Fri, 22 Oct 2004 12:30:10 -0400


Hello,

> 1 - A simple Glade# app, built on Glade without any signals, besides
> delete_event, attached on a bunch of code who shows a Gtk.Window.
> Well, I've compiled it on Linux and tried to run it in Windows! After
> installing the combined package of Mono+Gtk-sharp i've runned it and
> everything went well, except the GtkToolItem and GtkToolButton widgets
> that weren't recognized. I'm using glade-2.6.2.
> 
> My 1st question is: Are these widgets supported on Windows?

The issue here is that Gtk# is binding the older (and most commonly
available Gtk+).  And recent Glade versions gratuitously "upgrade" your
Gtk 2.2 project to 2.4 and there is no way that am aware of turning this
off.

Am not sure if there is a fix for this, other than "lets move to
2.4" (which we are going to do).

> All the code is running fine, since I have my own debug on each Thread
> and it's debuggin right. So I close my app, and try to run it again!
> SURPRISE! It works very well! The ProgressBar is updated and all the
> widgets works ... 

That is one way of doing threads.   The recommended way is to use
Thread.Notify.

Basically threads and GUIs do not mix, and you should only ever do Gtk#
calls from one thread.  The Enter/Leave stuff sadly will take the lock
for too long, so your best answer really is Thread.Notify.

> On Windows, I've compiled* it tried to run it and it works, but my
> Threads don't debug :(. It creates the wndSplash and then wndMain, but
> all of them without widgets and the program does not respond.

You likely have a deadlock and you are not letting Gtk process events.

Solution: dont use Gdk.Enter/Leave thread stuff.  Use ThreadNotify
instead.

> My 3rd question: Any clue about this?
> 
> 
> *compiled: mcs -pkg:gtk-sharp wndSplash.cs wndMain.cs

Dont know what that is.

Miguel