With --popup, show nicely as it should
authorEnrico Zini <enrico@enricozini.org>
Mon, 2 Nov 2009 20:21:46 +0000 (21:21 +0100)
committerEnrico Zini <enrico@enricozini.org>
Mon, 2 Nov 2009 20:21:46 +0000 (21:21 +0100)
src/zavai-calendar.vala

index 47aa551d0c024d539ba1ffa5dd1892ac7d710e01..afc90e1d7f6e5e9758dbc7f5b4145847dfd6f331 100644 (file)
@@ -23,16 +23,16 @@ using GLib;
 //string VERSION = "0.1";
 
 static int main (string[] args) {
-       string opt_popup = null;
+       bool opt_popup = false;
        GLib.OptionEntry[] entries = new GLib.OptionEntry[] {
                OptionEntry() {
                        long_name = "popup",
                        short_name = 'p',
                        flags = 0,
-                       arg = OptionArg.STRING,
+                       arg = OptionArg.NONE,
                        arg_data = &opt_popup,
                        description = "run as a popup at the specified location on screen",
-                       arg_description = "X,Y" },
+                       arg_description = null },
                OptionEntry()
        };
         Gtk.init_with_args(ref args, "", entries, null);
@@ -59,15 +59,19 @@ static int main (string[] args) {
        // User interface
        var calendar = new zavai.widgets.Calendar();
 
-       Gtk.WindowType wtype;
-       if (opt_popup == null)
-               wtype = Gtk.WindowType.TOPLEVEL;
-       else
+       Gtk.Window win = new Gtk.Window(Gtk.WindowType.TOPLEVEL);
+       if (opt_popup)
        {
-               wtype = Gtk.WindowType.POPUP;
+               win.set_decorated(false);
+               //win.set_resizable(false);
+               win.set_border_width(5);
+               win.set_skip_taskbar_hint(true);
+               win.set_skip_pager_hint(true);
+               //    gtk_window_set_type_hint(GTK_WINDOW(win), GDK_WINDOW_TYPE_HINT_DOCK);
+               win.set_position(Gtk.WindowPosition.MOUSE);
+               win.stick();
        }
 
-       var win = new Gtk.Window(wtype);
        win.title = "Zavai calendar";
        win.destroy += Gtk.main_quit;
        win.add(calendar);