コード例 #1
0
RygelMediaContainer* rygel_media_container_construct (GType object_type, const char* id, RygelMediaContainer* parent, const char* title, gint child_count) {
#line 301 "rygel-media-container.c"
	RygelMediaContainer * self;
	char* _tmp0_;
	char* _tmp1_;
#line 43 "rygel-media-container.vala"
	g_return_val_if_fail (id != NULL, NULL);
#line 43 "rygel-media-container.vala"
	g_return_val_if_fail (title != NULL, NULL);
#line 43 "rygel-media-container.vala"
	self = (RygelMediaContainer*) rygel_media_object_construct (object_type);
#line 47 "rygel-media-container.vala"
	((RygelMediaObject*) self)->id = (_tmp0_ = g_strdup (id), _g_free0 (((RygelMediaObject*) self)->id), _tmp0_);
#line 48 "rygel-media-container.vala"
	((RygelMediaObject*) self)->parent = parent;
#line 49 "rygel-media-container.vala"
	rygel_media_object_set_title ((RygelMediaObject*) self, title);
#line 50 "rygel-media-container.vala"
	self->child_count = child_count;
#line 51 "rygel-media-container.vala"
	self->update_id = (guint32) 0;
#line 52 "rygel-media-container.vala"
	((RygelMediaObject*) self)->upnp_class = (_tmp1_ = g_strdup ("object.container.storageFolder"), _g_free0 (((RygelMediaObject*) self)->upnp_class), _tmp1_);
#line 54 "rygel-media-container.vala"
	g_signal_connect_object (self, "container-updated", (GCallback) _rygel_media_container_on_container_updated_rygel_media_container_container_updated, self, 0);
#line 325 "rygel-media-container.c"
	return self;
}
コード例 #2
0
static gboolean rygel_mediathek_rss_container_parse_response (RygelMediathekRssContainer* self, const char* data, gsize length) {
#line 178 "rygel-mediathek-rss-container.c"
	gboolean result = FALSE;
	GError * _inner_error_;
	gboolean ret;
	xmlDoc* doc;
#line 52 "rygel-mediathek-rss-container.vala"
	g_return_val_if_fail (self != NULL, FALSE);
#line 52 "rygel-mediathek-rss-container.vala"
	g_return_val_if_fail (data != NULL, FALSE);
#line 187 "rygel-mediathek-rss-container.c"
	_inner_error_ = NULL;
#line 53 "rygel-mediathek-rss-container.vala"
	ret = FALSE;
#line 54 "rygel-mediathek-rss-container.vala"
	doc = xmlParseMemory (data, (gint) length);
#line 55 "rygel-mediathek-rss-container.vala"
	if (doc != NULL) {
#line 195 "rygel-mediathek-rss-container.c"
		xmlXPathContext* ctx;
		xmlXPathObject* xpo;
		gboolean _tmp0_ = FALSE;
#line 56 "rygel-mediathek-rss-container.vala"
		gee_abstract_collection_clear ((GeeAbstractCollection*) ((RygelSimpleContainer*) self)->children);
#line 57 "rygel-mediathek-rss-container.vala"
		((RygelMediaContainer*) self)->child_count = 0;
#line 59 "rygel-mediathek-rss-container.vala"
		ctx = xmlXPathNewContext (doc);
#line 60 "rygel-mediathek-rss-container.vala"
		xpo = xmlXPathEval ("/rss/channel/title", ctx);
#line 61 "rygel-mediathek-rss-container.vala"
		if (xpo->type == XPATH_NODESET) {
#line 62 "rygel-mediathek-rss-container.vala"
			_tmp0_ = xmlXPathNodeSetGetLength (xpo->nodesetval) > 0;
#line 211 "rygel-mediathek-rss-container.c"
		} else {
#line 61 "rygel-mediathek-rss-container.vala"
			_tmp0_ = FALSE;
#line 215 "rygel-mediathek-rss-container.c"
		}
#line 61 "rygel-mediathek-rss-container.vala"
		if (_tmp0_) {
#line 219 "rygel-mediathek-rss-container.c"
			char* _tmp1_;
#line 64 "rygel-mediathek-rss-container.vala"
			rygel_media_object_set_title ((RygelMediaObject*) self, _tmp1_ = xmlNodeGetContent (xmlXPathNodeSetItem (xpo->nodesetval, 0)));
#line 223 "rygel-mediathek-rss-container.c"
			_g_free0 (_tmp1_);
		}
#line 67 "rygel-mediathek-rss-container.vala"
		xpo = xmlXPathEval ("/rss/channel/item", ctx);
#line 68 "rygel-mediathek-rss-container.vala"
		if (xpo->type == XPATH_NODESET) {
#line 230 "rygel-mediathek-rss-container.c"
			{
				gint i;
#line 69 "rygel-mediathek-rss-container.vala"
				i = 0;
#line 235 "rygel-mediathek-rss-container.c"
				{
					gboolean _tmp2_;
#line 69 "rygel-mediathek-rss-container.vala"
					_tmp2_ = TRUE;
#line 69 "rygel-mediathek-rss-container.vala"
					while (TRUE) {
#line 242 "rygel-mediathek-rss-container.c"
						xmlNode* node;
#line 69 "rygel-mediathek-rss-container.vala"
						if (!_tmp2_) {
#line 69 "rygel-mediathek-rss-container.vala"
							i++;
#line 248 "rygel-mediathek-rss-container.c"
						}
#line 69 "rygel-mediathek-rss-container.vala"
						_tmp2_ = FALSE;
#line 69 "rygel-mediathek-rss-container.vala"
						if (!(i < xmlXPathNodeSetGetLength (xpo->nodesetval))) {
#line 69 "rygel-mediathek-rss-container.vala"
							break;
#line 256 "rygel-mediathek-rss-container.c"
						}
#line 70 "rygel-mediathek-rss-container.vala"
						node = xmlXPathNodeSetItem (xpo->nodesetval, i);
#line 260 "rygel-mediathek-rss-container.c"
						{
							RygelMediathekVideoItem* item;
#line 73 "rygel-mediathek-rss-container.vala"
							item = rygel_mediathek_video_item_create_from_xml ((RygelMediaContainer*) self, node, &_inner_error_);
#line 265 "rygel-mediathek-rss-container.c"
							if (_inner_error_ != NULL) {
								if (_inner_error_->domain == RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR) {
									goto __catch3_rygel_mediathek_video_item_error;
								}
								_xmlXPathFreeContext0 (ctx);
								g_critical ("file %s: line %d: unexpected 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 FALSE;
							}
#line 75 "rygel-mediathek-rss-container.vala"
							rygel_simple_container_add_child ((RygelSimpleContainer*) self, (RygelMediaObject*) item);
#line 76 "rygel-mediathek-rss-container.vala"
							ret = TRUE;
#line 279 "rygel-mediathek-rss-container.c"
							_g_object_unref0 (item);
						}
						goto __finally3;
						__catch3_rygel_mediathek_video_item_error:
						{
							GError * _error_;
							_error_ = _inner_error_;
							_inner_error_ = NULL;
							{
#line 79 "rygel-mediathek-rss-container.vala"
								g_warning (_ ("Error creating video item: %s"), _error_->message);
#line 291 "rygel-mediathek-rss-container.c"
								_g_error_free0 (_error_);
							}
						}
						__finally3:
						if (_inner_error_ != NULL) {
							_xmlXPathFreeContext0 (ctx);
							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 FALSE;
						}
					}
				}
			}
		} else {
#line 85 "rygel-mediathek-rss-container.vala"
			g_warning ("rygel-mediathek-rss-container.vala:85: %s", _ ("XPath query failed"));
#line 308 "rygel-mediathek-rss-container.c"
		}
#line 88 "rygel-mediathek-rss-container.vala"
		xmlFreeDoc (doc);
#line 89 "rygel-mediathek-rss-container.vala"
		rygel_media_container_updated ((RygelMediaContainer*) self);
#line 314 "rygel-mediathek-rss-container.c"
		_xmlXPathFreeContext0 (ctx);
	} else {
#line 92 "rygel-mediathek-rss-container.vala"
		g_warning ("rygel-mediathek-rss-container.vala:92: %s", _ ("Failed to parse doc"));
#line 319 "rygel-mediathek-rss-container.c"
	}
	result = ret;
#line 95 "rygel-mediathek-rss-container.vala"
	return result;
#line 324 "rygel-mediathek-rss-container.c"
}
コード例 #3
0
RygelExternalContainer* rygel_external_container_construct (GType object_type, const char* id, const char* service_name, const char* object_path, const char* host_ip, RygelExternalContainer* parent) {
#line 236 "rygel-external-container.c"
	GError * _inner_error_;
	RygelExternalContainer * self;
	char* _tmp0_;
	char* _tmp1_;
	char* _tmp2_;
	GeeArrayList* _tmp3_;
#line 42 "rygel-external-container.vala"
	g_return_val_if_fail (id != NULL, NULL);
#line 42 "rygel-external-container.vala"
	g_return_val_if_fail (service_name != NULL, NULL);
#line 42 "rygel-external-container.vala"
	g_return_val_if_fail (object_path != NULL, NULL);
#line 42 "rygel-external-container.vala"
	g_return_val_if_fail (host_ip != NULL, NULL);
#line 251 "rygel-external-container.c"
	_inner_error_ = NULL;
#line 47 "rygel-external-container.vala"
	self = (RygelExternalContainer*) rygel_media_container_construct (object_type, id, (RygelMediaContainer*) parent, "Uknown", 0);
#line 49 "rygel-external-container.vala"
	self->service_name = (_tmp0_ = g_strdup (service_name), _g_free0 (self->service_name), _tmp0_);
#line 50 "rygel-external-container.vala"
	self->priv->object_path = (_tmp1_ = g_strdup (object_path), _g_free0 (self->priv->object_path), _tmp1_);
#line 51 "rygel-external-container.vala"
	self->host_ip = (_tmp2_ = g_strdup (host_ip), _g_free0 (self->host_ip), _tmp2_);
#line 53 "rygel-external-container.vala"
	self->priv->containers = (_tmp3_ = gee_array_list_new (RYGEL_TYPE_EXTERNAL_CONTAINER, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL), _g_object_unref0 (self->priv->containers), _tmp3_);
#line 263 "rygel-external-container.c"
	{
		DBusGConnection* connection;
		RygelExternalMediaContainer* _tmp4_;
		char* _tmp5_;
#line 56 "rygel-external-container.vala"
		connection = dbus_g_bus_get (DBUS_BUS_SESSION, &_inner_error_);
#line 270 "rygel-external-container.c"
		if (_inner_error_ != NULL) {
			goto __catch0_g_error;
		}
#line 59 "rygel-external-container.vala"
		self->actual_container = (_tmp4_ = rygel_external_media_container_dbus_proxy_new (connection, service_name, object_path), _g_object_unref0 (self->actual_container), _tmp4_);
#line 63 "rygel-external-container.vala"
		rygel_media_object_set_title ((RygelMediaObject*) self, _tmp5_ = rygel_external_media_object_get_display_name ((RygelExternalMediaObject*) self->actual_container));
#line 278 "rygel-external-container.c"
		_g_free0 (_tmp5_);
#line 65 "rygel-external-container.vala"
		rygel_external_container_update_container (self, &_inner_error_);
#line 282 "rygel-external-container.c"
		if (_inner_error_ != NULL) {
			_dbus_g_connection_unref0 (connection);
			goto __catch0_g_error;
		}
#line 67 "rygel-external-container.vala"
		g_signal_connect_object (self->actual_container, "updated", (GCallback) _rygel_external_container_on_updated_rygel_external_media_container_updated, self, 0);
#line 289 "rygel-external-container.c"
		_dbus_g_connection_unref0 (connection);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError * err;
		err = _inner_error_;
		_inner_error_ = NULL;
		{
#line 69 "rygel-external-container.vala"
			g_critical ("rygel-external-container.vala:69: Failed to fetch information about co" \
"ntainer '%s': %s\n", ((RygelMediaObject*) self)->id, err->message);
#line 301 "rygel-external-container.c"
			_g_error_free0 (err);
		}
	}
	__finally0:
	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 NULL;
	}
	return self;
}