Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide console in gtk applications

Tags:

windows

gtk

vala

For example I've got simple gtk app alike:

public class Application : Gtk.Window {
    public Application () {
        this.title = "Zaebis";
        this.window_position = Gtk.WindowPosition.CENTER;
        this.destroy.connect (Gtk.main_quit);
        this.set_default_size (170, 70);
        Gtk.Button button = new Gtk.Button.with_label ("Make everything zaebis");
        this.add (button);
        button.clicked.connect (() => {
            button.label = "Everything is zaebis now";
            });
        }
    public static int main (string[] args) {
        Gtk.init (ref args); (new Application ()).show_all ();
        Gtk.main (); return 0;
        }
    }

I compile it valac --pkg gtk+-2.0 main.vala but when I run it I also see empty console. How to not show / hide this console and show only my window?

like image 443
cnd Avatar asked Sep 03 '13 12:09

cnd


1 Answers

Are you running this in Windows?

From https://wiki.gnome.org/Vala/ValaOnWindows :

In order to suppress the additional console window for GTK+ applications you have to take the following steps:

  • Download MinGW API for MS-Windows
  • Extract w32api-x.xx-mingw32-dev.tar.gz into the Vala/MinGW installation directory
  • Pass -X -mwindows to the Vala compiler:

    valac -X -mwindows --pkg gtk+-2.0 hellogtk.vala
    
like image 113
JeroldHaas Avatar answered Sep 19 '22 04:09

JeroldHaas