示例#1
0
RygelPlugin* rygel_plugin_construct (GType object_type, const char* name, const char* title) {
	RygelPlugin * self;
	char* _tmp1_;
	const char* _tmp0_;
	char* _tmp3_;
	const char* _tmp2_;
	GeeArrayList* _tmp6_;
	GeeArrayList* _tmp7_;
	RygelResourceInfo* resource_info;
	g_return_val_if_fail (name != NULL, NULL);
	self = g_object_newv (object_type, 0, NULL);
	_tmp1_ = NULL;
	_tmp0_ = NULL;
	self->name = (_tmp1_ = (_tmp0_ = name, (_tmp0_ == NULL) ? NULL : g_strdup (_tmp0_)), self->name = (g_free (self->name), NULL), _tmp1_);
	_tmp3_ = NULL;
	_tmp2_ = NULL;
	self->title = (_tmp3_ = (_tmp2_ = title, (_tmp2_ == NULL) ? NULL : g_strdup (_tmp2_)), self->title = (g_free (self->title), NULL), _tmp3_);
	rygel_plugin_set_available (self, TRUE);
	if (title == NULL) {
		char* _tmp5_;
		const char* _tmp4_;
		_tmp5_ = NULL;
		_tmp4_ = NULL;
		self->title = (_tmp5_ = (_tmp4_ = name, (_tmp4_ == NULL) ? NULL : g_strdup (_tmp4_)), self->title = (g_free (self->title), NULL), _tmp5_);
	}
	_tmp6_ = NULL;
	self->resource_infos = (_tmp6_ = gee_array_list_new (RYGEL_TYPE_RESOURCE_INFO, (GBoxedCopyFunc) rygel_resource_info_ref, rygel_resource_info_unref, g_direct_equal), (self->resource_infos == NULL) ? NULL : (self->resource_infos = (g_object_unref (self->resource_infos), NULL)), _tmp6_);
	_tmp7_ = NULL;
	self->icon_infos = (_tmp7_ = gee_array_list_new (RYGEL_TYPE_ICON_INFO, (GBoxedCopyFunc) rygel_icon_info_ref, rygel_icon_info_unref, g_direct_equal), (self->icon_infos == NULL) ? NULL : (self->icon_infos = (g_object_unref (self->icon_infos), NULL)), _tmp7_);
	resource_info = rygel_resource_info_new (RYGEL_CONNECTION_MANAGER_UPNP_ID, RYGEL_CONNECTION_MANAGER_UPNP_TYPE, RYGEL_CONNECTION_MANAGER_DESCRIPTION_PATH, RYGEL_TYPE_CONNECTION_MANAGER);
	rygel_plugin_add_resource (self, resource_info);
	(resource_info == NULL) ? NULL : (resource_info = (rygel_resource_info_unref (resource_info), NULL));
	return self;
}
ExternalPlugin* external_plugin_construct (GType object_type, DBusGConnection* connection, const char* service_name) {
	GError * _inner_error_;
	ExternalPlugin * self;
	char* _tmp0_;
	char* _tmp1_;
	char* root_object;
	DBusGProxy* props;
	GValue value = {0};
	GValue _tmp3_ = {0};
	GValue _tmp2_ = {0};
	const char* _tmp4_;
	char* title;
	char* _tmp6_;
	const char* _tmp5_;
	char* _tmp8_;
	const char* _tmp7_;
	RygelResourceInfo* resource_info;
	g_return_val_if_fail (connection != NULL, NULL);
	g_return_val_if_fail (service_name != NULL, NULL);
	_inner_error_ = NULL;
	_tmp0_ = NULL;
	_tmp1_ = NULL;
	root_object = (_tmp1_ = g_strconcat ("/", _tmp0_ = string_replace (service_name, ".", "/"), NULL), _tmp0_ = (g_free (_tmp0_), NULL), _tmp1_);
	props = dbus_g_proxy_new_for_name (connection, service_name, root_object, EXTERNAL_PLUGIN_PROPS_IFACE);
	_dynamic_Get4 (props, EXTERNAL_PLUGIN_OBJECT_IFACE, "DisplayName", &_tmp2_, &_inner_error_);
	value = (_tmp3_ = _tmp2_, G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL, _tmp3_);
	if (_inner_error_ != NULL) {
		root_object = (g_free (root_object), NULL);
		(props == NULL) ? NULL : (props = (g_object_unref (props), NULL));
		G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
		g_critical ("file %s: line %d: uncaught error: %s", __FILE__, __LINE__, _inner_error_->message);
		g_clear_error (&_inner_error_);
		return NULL;
	}
	_tmp4_ = NULL;
	title = (_tmp4_ = g_value_get_string (&value), (_tmp4_ == NULL) ? NULL : g_strdup (_tmp4_));
	self = (ExternalPlugin*) rygel_plugin_construct (object_type, service_name, title);
	_tmp6_ = NULL;
	_tmp5_ = NULL;
	self->service_name = (_tmp6_ = (_tmp5_ = service_name, (_tmp5_ == NULL) ? NULL : g_strdup (_tmp5_)), self->service_name = (g_free (self->service_name), NULL), _tmp6_);
	_tmp8_ = NULL;
	_tmp7_ = NULL;
	self->root_object = (_tmp8_ = (_tmp7_ = root_object, (_tmp7_ == NULL) ? NULL : g_strdup (_tmp7_)), self->root_object = (g_free (self->root_object), NULL), _tmp8_);
	resource_info = rygel_resource_info_new (RYGEL_CONTENT_DIRECTORY_UPNP_ID, RYGEL_CONTENT_DIRECTORY_UPNP_TYPE, RYGEL_CONTENT_DIRECTORY_DESCRIPTION_PATH, RYGEL_TYPE_EXTERNAL_CONTENT_DIR);
	rygel_plugin_add_resource ((RygelPlugin*) self, resource_info);
	root_object = (g_free (root_object), NULL);
	(props == NULL) ? NULL : (props = (g_object_unref (props), NULL));
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	title = (g_free (title), NULL);
	(resource_info == NULL) ? NULL : (resource_info = (rygel_resource_info_unref (resource_info), NULL));
	return self;
}
/* Path*/
TrackerPlugin* tracker_plugin_construct (GType object_type) {
	TrackerPlugin * self;
	RygelResourceInfo* resource_info;
	RygelIconInfo* icon_info;
	self = (TrackerPlugin*) rygel_plugin_construct (object_type, "Tracker", "@REALNAME@'s media");
	resource_info = rygel_resource_info_new (RYGEL_CONTENT_DIRECTORY_UPNP_ID, RYGEL_CONTENT_DIRECTORY_UPNP_TYPE, RYGEL_CONTENT_DIRECTORY_DESCRIPTION_PATH, RYGEL_TYPE_MEDIA_TRACKER);
	rygel_plugin_add_resource ((RygelPlugin*) self, resource_info);
	icon_info = rygel_icon_info_new ("image/png", (guint) 48, (guint) 48, (guint) 24, TRACKER_PLUGIN_ICON);
	rygel_plugin_add_icon ((RygelPlugin*) self, icon_info);
	(resource_info == NULL) ? NULL : (resource_info = (rygel_resource_info_unref (resource_info), NULL));
	(icon_info == NULL) ? NULL : (icon_info = (rygel_icon_info_unref (icon_info), NULL));
	return self;
}
示例#4
0
void rygel_value_take_resource_info (GValue* value, gpointer v_object) {
	RygelResourceInfo* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, RYGEL_TYPE_RESOURCE_INFO));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, RYGEL_TYPE_RESOURCE_INFO));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		rygel_resource_info_unref (old);
	}
}
示例#5
0
static void rygel_value_resource_info_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		rygel_resource_info_unref (value->data[0].v_pointer);
	}
}