View Single Post
Bundyo's Avatar
Posts: 4,708 | Thanked: 4,649 times | Joined on Oct 2007 @ Bulgaria
#70
hostwin.vala (fast replacement until i post the whole source):
Code:
using GLib;
using Gtk;
using Gdk;
using Hildon;
using Osso;

public string apptitle;
public string exttext;
public string filename;

static void println (string str) {
	stdout.printf ("%s\n", str);
}

public class mainProgram : Hildon.Program {
        private Hildon.Window window;
        private Label label;
        private Pid pid;
        
	construct {
                window = new Hildon.Window ();
		window.set_icon_from_file ("/usr/share/pixmaps/"+apptitle.down()+".png");
                window.destroy += Gtk.main_quit;
                add_window (window);
                
		label = new Label(exttext);
		window.add(label);

                Environment.set_application_name (apptitle);
                window.map_event += activate;
                
                window.show_all();
	}
		
	private bool activate() {
	        string[] buf = new string[1];

		buf[0] = filename;
	        Process.spawn_async( null, buf, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out this.pid );
		ChildWatch.add (this.pid, child_exited);
				
		return false;
	}

	private void child_exited (Pid pid, int status) {
		Gtk.main_quit();
	}

        static int main (string[] args) {
                Osso.Context ctx;

                Gtk.init (ref args);
                
                apptitle = args[1];
                filename = args[2];
                exttext = args[3];
                
                ctx = new Osso.Context(apptitle, "0.2", false, null);
                if (ctx.display_state_on() != Osso.Error.OK)
                    println("Error: Osso Initialize failed.\n");
                    
                var prg = new mainProgram ();
                Gtk.main();
                
                return 0;
        }
}
__________________
Technically, there are three determinate states the cat could be in: Alive, Dead, and Bloody Furious.

Last edited by Bundyo; 2008-10-15 at 10:20.
 

The Following User Says Thank You to Bundyo For This Useful Post: