X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=internal.h;fp=internal.h;h=2fbf2c7939f6de5490190f791338a6203d8358e0;hb=dc0e64a4c244fa084eb7bfce4503404824ada6ef;hp=d838fdec7590c7b487a6fe0dc45c28c2b5adea9c;hpb=9e71dc8c3f23425cdd4453402b7c2ba204a6e5e0;p=ovirt-viewer.git diff --git a/internal.h b/internal.h index d838fde..2fbf2c7 100644 --- a/internal.h +++ b/internal.h @@ -83,16 +83,30 @@ extern void wui_thread_send_refresh_vm_list (void); /* Retrieve the list of VMs. * + * wui_thread_get_vmlist returns TRUE if there was a valid list of + * VMs (even if it is empty), or FALSE if we don't have a valid list + * of VMs to return. + * * NB: Caller must call free_vmlist once it is done with the list. * - * This can return NULL if the WUI thread doesn't have a valid - * list of VMs to return to the caller. In the case of a valid, - * empty list, you will get a non-NULL GSList pointer to an empty - * list. */ -extern GSList *wui_thread_get_vmlist (void); +extern gboolean wui_thread_get_vmlist (GSList **ret); extern void free_vmlist (GSList *vmlist); +struct vm { + char *description; + int hostid; + int id; + long mem_allocated; /* Kbytes */ + long mem_used; /* Kbytes */ + int vcpus_allocated; + int vcpus_used; + char *state; + char *uuid; /* Printable UUID. */ + int vnc_port; + char *mac_addr; /* Printable MAC addr. */ +}; + /* Returns true if the WUI thread thinks it is connected to a remote * WUI. REST is connectionless so really this means that we * successfully made an HTTP/HTTPS request "recently", and we haven't @@ -117,4 +131,36 @@ extern gboolean wui_thread_has_valid_vmlist (void); */ extern gboolean wui_thread_is_busy (void); +/* Callbacks from the WUI thread to the main thread. The WUI thread + * adds these to the Glib main loop using g_idle_add, which means they + * actually get executed in the context of the main thread. + */ + +/* The WUI thread has changed its state to connected. */ +extern gboolean main_connected (gpointer); + +/* The WUI thread has changed its state to disconnected. */ +extern gboolean main_disconnected (gpointer); + +/* The WUI thread has changed its state to logged in. */ +extern gboolean main_logged_in (gpointer); + +/* The WUI thread has changed its state to logged out. */ +extern gboolean main_logged_out (gpointer); + +/* The WUI thread has changed its state to busy. */ +extern gboolean main_busy (gpointer); + +/* The WUI thread has changed its state to idle. */ +extern gboolean main_idle (gpointer); + +/* The WUI thread had a connection problem. */ +extern gboolean main_connection_error (gpointer str); + +/* The WUI thread had a login problem. */ +extern gboolean main_login_error (gpointer str); + +/* The WUI thread reports a general status error. */ +extern gboolean main_status_error (gpointer str); + #endif /* OVIRT_VIEWER_INTERNAL_H */