[Gtk-sharp-list] portability issues
Francis Brosnan Blázquez
francis@aspl.es
Fri, 22 Oct 2004 15:38:09 +0200
--=-40Mh4EVLMkEA7jsIUqH+
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hi Paulo,
I've modifed your project to make the splash stuff by using GLib timeout
system insted of Threads. I've only modified the attached file.
I hope it helps,
.-Francis
--=-40Mh4EVLMkEA7jsIUqH+
Content-Disposition: attachment; filename=wndSplash.cs
Content-Type: text/x-csharp; name=wndSplash.cs; charset=iso-8859-15
Content-Transfer-Encoding: quoted-printable
/* =09
* File: wndSplash.cs
* Description: Splash screen
*
* Developer: Paulo Pires
* Email: pjpires@gmail.com
*
* Created on: 7th September 2004
*
*/
using System;
using Gtk;
namespace TrafficMan{
public class wndSplash : Window
{
private Image logo, logo2;
private Label label1, label2, label3;
private ProgressBar pBar;
private int steps =3D 0;
=09
public wndSplash () : base (Globals.AppName)
{
// definir objectos
logo =3D new Image(); =09
logo.File =3D "trafficman.png";
=09
label1 =3D new Label("<b>TrafficMan</b>");
label2 =3D new Label("<small>Um produto <b>Sinalarte</b>, desenvolvido =
por Paulo Pires</small>");
=09
label1.UseMarkup =3D true;
label2.UseMarkup =3D true;
=09
logo2 =3D new Image();
logo2.File =3D "sinalarte.gif";
=09
pBar =3D new ProgressBar();
VBox v =3D new VBox();
v.BorderWidth =3D 12;
v.Spacing =3D 12;
this.Add(v);
HBox h =3D new HBox();
h.Spacing =3D 6;
h.PackStart(logo, true, true, 0);
h.PackStart(label1, false, false, 0);
h.PackEnd(logo2, true, true, 0);
v.Add(h);
// adicionar objectos
v.Spacing =3D 6;
v.PackStart(label2, true, true, 0);
v.PackEnd(pBar, true, true, 0);
// event handlers
this.DeleteEvent +=3D OnWindowDeleteEvent;
=09
// show
this.SetIconFromFile("trafficman.png");
this.SetPosition(WindowPosition.Center);
this.Resizable =3D false;
this.ShowAll();
=09
GLib.Timeout.Add (1000, new GLib.TimeoutHandler (Work));
}
=09
private void OnWindowDeleteEvent(object o, DeleteEventArgs args){
=09
Application.Quit();
args.RetVal =3D true;
}
=20
private void LoadConf(){
=09
// load xml
log("Loading Configuration ...");
=09
}
=09
private void LoadProject(){
=09
// load xml
log("Loading Project ...");
=09
}
=09
bool Work() {
=09
switch (steps) {
case 0:
pBar.Text =3D "A carregar configura=C3=A7=C3=A3o ...";
pBar.Fraction =3D 0.5;
break;
case 1:
pBar.Text =3D "A carregar configura=C3=A7=C3=A3o ...";
pBar.Fraction =3D 1;
break;
case 2:
new wndMain();
this.Hide ();
return false; // don't call me again GLib
default:
// do nothing
break;
}
steps++;
return true; // call me again GLib timeout system
}
=09
=09
=09
=09
void log(string str){
Console.WriteLine(str);
}
}
}
--=-40Mh4EVLMkEA7jsIUqH+--