Ejemplo n.º 1
0
static void
vm_action_cb(const char *reply, void *data)
{
	xmlNode *r;
	Elm_Genlist_Item *gl;
	vmitem *item;
	zrpc_vm *vm;

	if (!reply || !(r = xml_parse_xml(reply)) || (!xml_parse_int(r)))
	{
		elm_label_label_set(win->main_vm->status, "Job add failed!");
		evas_object_show(win->main_vm->notify);
		return;
	}

	elm_label_label_set(win->main_vm->status, "Job add was successful!");
	evas_object_show(win->main_vm->notify);
	if ((win->view == win->main_vm->view) || (win->view == win->main_user->view))
	{
		gl = elm_genlist_selected_item_get(win->main_vm->list);
		if (gl)
		{
			item = (vmitem*)elm_genlist_item_data_get(gl);
			vm = item->vm;
			win->list = eina_list_remove(win->list, vm);
#ifdef DEBUG
printf("Removing %s from all lists...\n", vm->uuid);
#endif
			win->elist = eina_list_remove(win->elist, item);
			free_vmitem(item);
			elm_genlist_item_del(gl);
		}
	}
}
Ejemplo n.º 2
0
/*after logout completes*/
void cleanup(const char *reply, zrpc_con *zcon)
{
	xmlNode *r;

	if ((r = xml_parse_xml(reply)) && (xml_parse_int(r)))
		printf("Logout successful!\n");
	else printf("Logout failed!\n");

	ecore_main_loop_quit();
	exit(0);
}
Ejemplo n.º 3
0
/*the first callback, called after login response has been received*/
void post(const char *reply, zrpc_con *zcon)
{/*parameters are a zcon handle, and the handle number*/
	xmlNode *r;

	/* char* -> xmlNode */
	if (!(r = xml_parse_xml(reply)))
                printf("Error with reply!\n");
	/*xml_parse_int handles int and boolean tags and returns the value.
	 *all parse functions free the node passed to them
	 */
	if (xml_parse_int(r)) /*if login succeeded*/
		zrpc_VM_getAllFull(zcon, (void*)print_infos, zcon);
	else
	{
		printf("Login failed!\n");
		exit(0);
	}
}
Ejemplo n.º 4
0
/*second callback, parses getVMsFull*/
void print_infos(const char *reply, zrpc_con *zcon)
{
	/*seek to the xml data*/
	Eina_List *vms, *l;
	zrpc_vm *vm;
	xmlNode *r;

	/*parse the shit out of it*/
	if (!(r = xml_parse_xml(reply)))
                printf("Error with reply!\n");
	vms = xml_parse_vmsfull(r);
	/*print out some stats to prove the data was grabbed*/
	EINA_LIST_FOREACH(vms, l, vm)
		printf("\n********\n\nUUID: %s\nName: %s\nOS: %s\nUptime: %d\n", vm->uuid, vm->name, vm->os, vm->uptime);

	/*free the vm list*/
	EINA_LIST_FREE(vms, vm)
		zvm_free(vm);


	meta_getUsersFull(zcon, (void*)print_uinfos, zcon);
}