fixed hide window on startup for gnome-shell (Closes: #676361).
[psensor.git] / src / main.c
index afcd965..5f0feee 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2011 jeanfi@gmail.com
+ * Copyright (C) 2010-2012 jeanfi@gmail.com
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -80,7 +80,7 @@ static void print_version()
                 "This is free software: you are free to change and "
                 " redistribute it.\n"
                 "There is NO WARRANTY, to the extent permitted by law.\n"),
-              "2010-2011");
+              "2010-2012");
 }
 
 static void print_help()
@@ -439,18 +439,16 @@ int main(int argc, char **argv)
        log_init();
 
        log_glib_info();
-#if !(GLIB_CHECK_VERSION(2, 32, 0))
+#if !(GLIB_CHECK_VERSION(2, 31, 0))
        /*
-        * Since GLib 2.3.32 g_thread_init call is deprecated and not
-        * needed. Documentation of this method is not clear whether
-        * it is also useless with 2.3.31.
+        * Since GLib 2.31 g_thread_init call is deprecated and not
+        * needed.
         */
        log_debug("Calling g_thread_init(NULL)");
        g_thread_init(NULL);
 #endif
 
        gdk_threads_init();
-       /* gdk_threads_enter(); */
 
        gtk_init(NULL, NULL);
 
@@ -516,16 +514,16 @@ int main(int argc, char **argv)
        ui_appindicator_init(&ui);
 #endif
 
-       /*
-        * show the window as soon as all gtk events have been processed
-        * in order to ensure that the status icon is attempted to be
-        * drawn before. If not, there is no way to detect that it is
-        * visible.
-       */
-       g_idle_add((GSourceFunc)initial_window_show, &ui);
-
        gdk_notify_startup_complete();
 
+       /*
+        * hack, did not find a cleaner solution.
+        * wait 2s to ensure that the status icon is attempted to be
+        * drawn before determining whether the main window must be
+        * show.
+        */
+       g_timeout_add(2000,(GSourceFunc)initial_window_show, &ui);
+
        /* main loop */
        gtk_main();