#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <alloca.h>
#include <glib.h>
#include <gtk/gtk.h>
/* Gtk widget styles. Avoid installation hassles by keeping this
* inside the binary. It can still be overridden by the user (who
- * will do that?).
+ * will do that?)
*/
static const char *styles =
- "\
-style \"ovirt-viewer-yellow-box\"\n\
-{\n\
- bg[NORMAL] = shade (1.5, \"yellow\")\n\
-}\n\
-widget \"*.ovirt-viewer-connection-area\" style \"ovirt-viewer-yellow-box\"\n\
-";
+ "style \"ovirt-viewer-yellow-box\"\n"
+ "{\n"
+ " bg[NORMAL] = shade (1.5, \"yellow\")\n"
+ "}\n"
+ "widget \"*.ovirt-viewer-connection-area\" style \"ovirt-viewer-yellow-box\"\n"
+ ;
/* Command-line arguments. */
static int print_version = 0;
* The WUI thread keeps the UI updated by adding idle events which are
* processed in the main thread - see:
* http://mail.gnome.org/archives/gtk-app-devel-list/2007-March/msg00232.html
+ *
+ * Note that under Win32 you must confine all Gtk/Gdk interactions
+ * to a single thread - see:
+ * http://developer.gimp.org/api/2.0/gdk/gdk-Threads.html
*/
if (!g_thread_supported ()) {
- g_thread_init (NULL);
- gdk_threads_init ();
+ g_thread_init (NULL);
+#ifndef WIN32
+ gdk_threads_init ();
+#endif
} else {
- fprintf (stderr, "GLib threads not supported or not working.");
- exit (1);
+ fprintf (stderr, "GLib threads not supported or not working.");
+ exit (1);
}
gtk_init (&argc, &argv);
start_wui_thread ();
start_ui ();
+ DEBUG ("entering the Gtk main loop");
+
gtk_main ();
stop_wui_thread ();
GtkWidget *la_hbox;
GtkWidget *notebook;
+ DEBUG ("creating viewer windows and menus");
+
/* Parse styles. */
gtk_rc_parse_string (styles);
/* https:// + hostname + /ovirt + \0 */
len = 8 + strlen (hostname) + 6 + 1;
- uri = alloca (len);
+ uri = g_alloca (len);
snprintf (uri, len, HTTPS "://%s/ovirt", hostname);
wui_thread_send_connect (uri);