static void ease_flickr_service_real_parse_data (EasePluginImportService* base, const char* jsondata) {
#line 298 "ease-import-flickr-service.c"
	EaseFlickrService * self;
	JsonObject* obj;
	char* stat;
	JsonObject* photos;
	JsonArray* photo_array;
	GError * _inner_error_ = NULL;
	self = (EaseFlickrService*) base;
#line 91 "ease-import-flickr-service.vala"
	g_return_if_fail (jsondata != NULL);
#line 93 "ease-import-flickr-service.vala"
	if (jsondata == NULL) {
#line 93 "ease-import-flickr-service.vala"
		return;
#line 312 "ease-import-flickr-service.c"
	}
	{
#line 97 "ease-import-flickr-service.vala"
		json_parser_load_from_data (self->priv->parser, jsondata, -1, &_inner_error_);
#line 317 "ease-import-flickr-service.c"
		if (_inner_error_ != NULL) {
			goto __catch7_g_error;
		}
	}
	goto __finally7;
	__catch7_g_error:
	{
		GError * e;
		e = _inner_error_;
		_inner_error_ = NULL;
		{
#line 101 "ease-import-flickr-service.vala"
			g_error ("ease-import-flickr-service.vala:101: Couldn't parse JSON data: %s", e->message);
#line 331 "ease-import-flickr-service.c"
			_g_error_free0 (e);
		}
	}
	__finally7:
	if (_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
#line 104 "ease-import-flickr-service.vala"
	obj = _json_object_ref0 (json_node_get_object (json_parser_get_root (self->priv->parser)));
#line 106 "ease-import-flickr-service.vala"
	stat = g_strdup (json_object_get_string_member (obj, "stat"));
#line 107 "ease-import-flickr-service.vala"
	if (_vala_strcmp0 (stat, "ok") != 0) {
#line 109 "ease-import-flickr-service.vala"
		g_warning ("ease-import-flickr-service.vala:109: The request failed : \n" \
"Error code: %G\n" \
"Message: %s", (double) json_object_get_int_member (obj, "code"), json_object_get_string_member (obj, "message"));
#line 349 "ease-import-flickr-service.c"
		_g_free0 (stat);
		_json_object_unref0 (obj);
#line 112 "ease-import-flickr-service.vala"
		return;
#line 354 "ease-import-flickr-service.c"
	}
#line 115 "ease-import-flickr-service.vala"
	photos = _json_object_ref0 (json_object_get_object_member (obj, "photos"));
#line 116 "ease-import-flickr-service.vala"
	photo_array = _json_array_ref0 (json_object_get_array_member (photos, "photo"));
#line 119 "ease-import-flickr-service.vala"
	json_array_foreach_element (photo_array, __lambda70__json_array_foreach, self);
#line 362 "ease-import-flickr-service.c"
	_json_array_unref0 (photo_array);
	_json_object_unref0 (photos);
	_g_free0 (stat);
	_json_object_unref0 (obj);
}
示例#2
0
static void docker_gui_get_containers (DockerGui* self, GtkListStore* listmodel) {
	GtkTreeIter iter = {0};
	gchar* uri = NULL;
	gchar* _tmp0_ = NULL;
	SoupSession* session = NULL;
	SoupSession* _tmp1_ = NULL;
	SoupMessage* message = NULL;
	SoupMessage* _tmp2_ = NULL;
	JsonParser* parser = NULL;
	JsonParser* _tmp3_ = NULL;
	SoupMessageBody* _tmp4_ = NULL;
	SoupBuffer* _tmp5_ = NULL;
	SoupBuffer* _tmp6_ = NULL;
	guint8* _tmp7_ = NULL;
	gint _tmp7__length1 = 0;
	JsonArray* jsonContainers = NULL;
	JsonNode* _tmp8_ = NULL;
	JsonArray* _tmp9_ = NULL;
	JsonArray* _tmp10_ = NULL;
	JsonArray* _tmp11_ = NULL;
	GList* _tmp12_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (listmodel != NULL);
	_tmp0_ = g_strdup ("http://localhost:5555/containers/json");
	uri = _tmp0_;
	_tmp1_ = soup_session_new ();
	session = _tmp1_;
	_tmp2_ = soup_message_new ("GET", uri);
	message = _tmp2_;
	soup_session_send_message (session, message);
	_tmp3_ = json_parser_new ();
	parser = _tmp3_;
	_tmp4_ = message->response_body;
	_tmp5_ = soup_message_body_flatten (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = _tmp6_->data;
	_tmp7__length1 = (gint) _tmp6_->length;
	json_parser_load_from_data (parser, (const gchar*) _tmp7_, (gssize) (-1), &_inner_error_);
	__vala_SoupBuffer_free0 (_tmp6_);
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_object_unref0 (parser);
		_g_object_unref0 (message);
		_g_object_unref0 (session);
		_g_free0 (uri);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp8_ = json_parser_get_root (parser);
	_tmp9_ = json_node_get_array (_tmp8_);
	_tmp10_ = _json_array_ref0 (_tmp9_);
	jsonContainers = _tmp10_;
	_tmp11_ = jsonContainers;
	_tmp12_ = json_array_get_elements (_tmp11_);
	{
		GList* c_collection = NULL;
		GList* c_it = NULL;
		c_collection = _tmp12_;
		for (c_it = c_collection; c_it != NULL; c_it = c_it->next) {
			JsonNode* _tmp13_ = NULL;
			JsonNode* c = NULL;
			_tmp13_ = __vala_JsonNode_copy0 ((JsonNode*) c_it->data);
			c = _tmp13_;
			{
				JsonObject* o = NULL;
				JsonNode* _tmp14_ = NULL;
				JsonObject* _tmp15_ = NULL;
				JsonObject* _tmp16_ = NULL;
				gchar* Id = NULL;
				JsonObject* _tmp17_ = NULL;
				const gchar* _tmp18_ = NULL;
				gchar* _tmp19_ = NULL;
				gchar* Image = NULL;
				JsonObject* _tmp20_ = NULL;
				const gchar* _tmp21_ = NULL;
				gchar* _tmp22_ = NULL;
				FILE* _tmp23_ = NULL;
				const gchar* _tmp24_ = NULL;
				const gchar* _tmp25_ = NULL;
				GtkListStore* _tmp26_ = NULL;
				GtkTreeIter _tmp27_ = {0};
				GtkListStore* _tmp28_ = NULL;
				GtkTreeIter _tmp29_ = {0};
				const gchar* _tmp30_ = NULL;
				const gchar* _tmp31_ = NULL;
				_tmp14_ = c;
				_tmp15_ = json_node_get_object (_tmp14_);
				_tmp16_ = _json_object_ref0 (_tmp15_);
				o = _tmp16_;
				_tmp17_ = o;
				_tmp18_ = json_object_get_string_member (_tmp17_, "Id");
				_tmp19_ = g_strdup (_tmp18_);
				Id = _tmp19_;
				_tmp20_ = o;
				_tmp21_ = json_object_get_string_member (_tmp20_, "Image");
				_tmp22_ = g_strdup (_tmp21_);
				Image = _tmp22_;
				_tmp23_ = stdout;
				_tmp24_ = Id;
				_tmp25_ = Image;
				fprintf (_tmp23_, "%s - %s\n", _tmp24_, _tmp25_);
				_tmp26_ = listmodel;
				gtk_list_store_append (_tmp26_, &_tmp27_);
				iter = _tmp27_;
				_tmp28_ = listmodel;
				_tmp29_ = iter;
				_tmp30_ = Id;
				_tmp31_ = Image;
				gtk_list_store_set (_tmp28_, &_tmp29_, 0, _tmp30_, 1, _tmp31_, -1);
				_g_free0 (Image);
				_g_free0 (Id);
				_json_object_unref0 (o);
				__vala_JsonNode_free0 (c);
			}
		}
		_g_list_free0 (c_collection);
	}
	_json_array_unref0 (jsonContainers);
	_g_object_unref0 (parser);
	_g_object_unref0 (message);
	_g_object_unref0 (session);
	_g_free0 (uri);
}