Tabbed notebook functionality.
[ovirt-viewer.git] / wui_thread.c
index 060c7a2..2500ccb 100644 (file)
@@ -245,9 +245,9 @@ wui_thread (gpointer _queue)
 
   /* This checks wui_gthread global which is actually set in the
    * main thread.  Of course, it might not be set if the WUI thread
-   * runs first.  Hence we yield for the main thread to run.
+   * runs first.  Hence we sleep for the main thread to run. (XXX)
    */
-  g_thread_yield ();
+  g_usleep (100000);
   ASSERT_IS_WUI_THREAD ();
 
   g_async_queue_ref (queue);
@@ -798,8 +798,8 @@ copy_vm (struct vm *vm)
 
   vm2 = g_memdup (vm, sizeof (*vm));
   vm2->description = g_strdup (vm->description);
+  vm2->uuid = g_strdup (vm->uuid);
   vm2->state = vm->state ? g_strdup (vm->state) : NULL;
-  vm2->uuid = vm->uuid ? g_strdup (vm->uuid) : NULL;
   vm2->mac_addr = vm->mac_addr ? g_strdup (vm->mac_addr) : NULL;
   return vm2;
 }
@@ -878,12 +878,15 @@ parse_vmlist_from_xml (const char *xml)
   char *error_str;
   GSList *new_vmlist = NULL;
   struct vm *vm;
+  int len;
 
   /*DEBUG ("XML =\n%s", xml);*/
   ASSERT_IS_WUI_THREAD ();
 
   /* We don't really expect that we won't be able to parse the XML ... */
-  doc = xmlParseDoc ((const xmlChar *) xml);
+  len = strlen (xml);
+  doc = xmlReadMemory (xml, len, NULL, NULL, 0);
+
   if (!doc) {
     DEBUG ("error parsing XML document, xml =\n%s", xml);
     error_str = g_strdup ("error parsing XML document from remote server");
@@ -1062,6 +1065,8 @@ parse_vm_from_xml (xmlNodePtr node)
     DEBUG ("required field \"description\" missing from <vm> structure");
   else if (vm.vnc_port == -1)
     DEBUG ("required field \"vnc-port\" missing from <vm> structure");
+  else if (vm.uuid == NULL)
+    DEBUG ("required field \"uuid\" missing from <vm> structure");
   else
     ret = g_memdup (&vm, sizeof vm);