X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=main.c;fp=main.c;h=17618644e3639710519f12699300ce1259407c60;hb=9e71dc8c3f23425cdd4453402b7c2ba204a6e5e0;hp=039cf3903c215acabf63ecabd690d5d0d42ef47b;hpb=06576813e9eee9338ade91bb2486a52af9507471;p=ovirt-viewer.git diff --git a/main.c b/main.c index 039cf39..1761864 100644 --- a/main.c +++ b/main.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -102,16 +101,15 @@ static const char *title = "oVirt Viewer"; /* 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; @@ -152,13 +150,19 @@ main (int argc, char *argv[]) * 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); @@ -184,6 +188,8 @@ main (int argc, char *argv[]) start_wui_thread (); start_ui (); + DEBUG ("entering the Gtk main loop"); + gtk_main (); stop_wui_thread (); @@ -214,6 +220,8 @@ start_ui (void) GtkWidget *la_hbox; GtkWidget *notebook; + DEBUG ("creating viewer windows and menus"); + /* Parse styles. */ gtk_rc_parse_string (styles); @@ -375,7 +383,7 @@ connect_to_wui (GtkWidget *widget, gpointer data) /* 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);