[rygel-gst-0-10-plugins] Do not check for Tracker



commit d1ba52f4629a07874b8c03dee6390472a3b89ebd
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Jan 17 10:02:11 2013 +0100

    Do not check for Tracker
    
    * rygel-media-export-plugin.c: Do not check for the tracker plugin,
      to disable this plugin. As this code is now mostly for use
      as an example, this is not interesting.
      This also removes a chunk of ugly generated code, making it
      a little easier to make the code readable.

 src/media-export/rygel-media-export-plugin.c |  290 +-------------------------
 1 files changed, 4 insertions(+), 286 deletions(-)
---
diff --git a/src/media-export/rygel-media-export-plugin.c b/src/media-export/rygel-media-export-plugin.c
index c00f591..f9438e8 100644
--- a/src/media-export/rygel-media-export-plugin.c
+++ b/src/media-export/rygel-media-export-plugin.c
@@ -38,29 +38,11 @@ struct _Block2Data {
 	RygelPlugin* our_plugin;
 };
 
-
-#define TRACKER_PLUGIN "Tracker"
-
 static Block1Data* block1_data_ref (Block1Data* _data1_);
 static void block1_data_unref (void * _userdata_);
 #define RYGEL_MEDIA_EXPORT_PLUGIN_NAME "MediaExport"
 RygelMediaExportPlugin* rygel_media_export_plugin_new (GError** error);
 RygelMediaExportPlugin* rygel_media_export_plugin_construct (GType object_type, GError** error);
-static gboolean __lambda7_ (Block1Data* _data1_);
-void on_plugin_available (RygelPlugin* plugin, RygelPlugin* our_plugin);
-static void __lambda9_ (Block1Data* _data1_, RygelPlugin* new_plugin);
-static void ___lambda9__rygel_plugin_loader_plugin_available (RygelPluginLoader* _sender, RygelPlugin* plugin, gpointer self);
-static gboolean ___lambda7__gsource_func (gpointer self);
-static Block2Data* block2_data_ref (Block2Data* _data2_);
-static void block2_data_unref (void * _userdata_);
-static void ____lambda8_ (Block2Data* _data2_);
-void shutdown_media_export (void);
-static void _____lambda8__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
-
-/**
- * Simple plugin which exposes the media contents of a directory via UPnP.
- *
- */
 
 static Block1Data* block1_data_ref (Block1Data* _data1_) {
 	g_atomic_int_inc (&_data1_->_ref_count_);
@@ -78,75 +60,10 @@ static void block1_data_unref (void * _userdata_) {
 	}
 }
 
-
-static void __lambda9_ (Block1Data* _data1_, RygelPlugin* new_plugin) {
-	RygelPlugin* _tmp0_;
-	RygelMediaExportPlugin* _tmp1_;
-	g_return_if_fail (new_plugin != NULL);
-	_tmp0_ = new_plugin;
-	_tmp1_ = _data1_->plugin;
-	on_plugin_available (_tmp0_, (RygelPlugin*) _tmp1_);
-}
-
-
-static void ___lambda9__rygel_plugin_loader_plugin_available (RygelPluginLoader* _sender, RygelPlugin* plugin, gpointer self) {
-	__lambda9_ (self, plugin);
-}
-
-
-static gboolean __lambda7_ (Block1Data* _data1_) {
-	gboolean result = FALSE;
-	RygelPluginLoader* _tmp11_;
-	{
-		RygelPluginLoader* _tmp0_;
-		GeeCollection* _tmp1_ = NULL;
-		GeeCollection* _tmp2_;
-		GeeIterator* _tmp3_ = NULL;
-		GeeIterator* _tmp4_;
-		GeeIterator* _loaded_plugin_it;
-		_tmp0_ = _data1_->loader;
-		_tmp1_ = rygel_plugin_loader_list_plugins (_tmp0_);
-		_tmp2_ = _tmp1_;
-		_tmp3_ = gee_iterable_iterator ((GeeIterable*) _tmp2_);
-		_tmp4_ = _tmp3_;
-		g_object_unref (_tmp2_);
-		_loaded_plugin_it = _tmp4_;
-		while (TRUE) {
-			GeeIterator* _tmp5_;
-			gboolean _tmp6_ = FALSE;
-			GeeIterator* _tmp7_;
-			gpointer _tmp8_ = NULL;
-			RygelPlugin* loaded_plugin;
-			RygelPlugin* _tmp9_;
-			RygelMediaExportPlugin* _tmp10_;
-			_tmp5_ = _loaded_plugin_it;
-			_tmp6_ = gee_iterator_next (_tmp5_);
-			if (!_tmp6_) {
-				break;
-			}
-			_tmp7_ = _loaded_plugin_it;
-			_tmp8_ = gee_iterator_get (_tmp7_);
-			loaded_plugin = (RygelPlugin*) _tmp8_;
-			_tmp9_ = loaded_plugin;
-			_tmp10_ = _data1_->plugin;
-			on_plugin_available (_tmp9_, (RygelPlugin*) _tmp10_);
-			g_object_unref (loaded_plugin);
-		}
-		g_object_unref (_loaded_plugin_it);
-	}
-	_tmp11_ = _data1_->loader;
-	g_signal_connect_data (_tmp11_, "plugin-available", (GCallback) ___lambda9__rygel_plugin_loader_plugin_available, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
-	result = FALSE;
-	return result;
-}
-
-
-static gboolean ___lambda7__gsource_func (gpointer self) {
-	gboolean result;
-	result = __lambda7_ (self);
-	return result;
-}
-
+/**
+ * Simple plugin which exposes the media contents of a directory via UPnP.
+ *
+ */
 
 void module_init (RygelPluginLoader* loader) {
 	Block1Data* _data1_;
@@ -209,207 +126,8 @@ void module_init (RygelPluginLoader* loader) {
 		g_clear_error (&_inner_error_);
 		return;
 	}
-	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda7__gsource_func, block1_data_ref (_data1_), block1_data_unref);
-	_tmp8_ = _data1_->loader;
-	_tmp9_ = _data1_->plugin;
-	rygel_plugin_loader_add_plugin (_tmp8_, (RygelPlugin*) _tmp9_);
-	block1_data_unref (_data1_);
-	_data1_ = NULL;
 }
 
-
-static Block2Data* block2_data_ref (Block2Data* _data2_) {
-	g_atomic_int_inc (&_data2_->_ref_count_);
-	return _data2_;
-}
-
-
-static void block2_data_unref (void * _userdata_) {
-	Block2Data* _data2_;
-	_data2_ = (Block2Data*) _userdata_;
-	if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
-		g_object_unref (_data2_->plugin);
-		g_object_unref (_data2_->our_plugin);
-		g_slice_free (Block2Data, _data2_);
-	}
-}
-
-
-static void ____lambda8_ (Block2Data* _data2_) {
-	RygelPlugin* _tmp0_;
-	gboolean _tmp1_;
-	gboolean _tmp2_;
-	_tmp0_ = _data2_->plugin;
-	_tmp1_ = rygel_plugin_get_active (_tmp0_);
-	_tmp2_ = _tmp1_;
-	if (_tmp2_) {
-		RygelPlugin* _tmp3_;
-		RygelPlugin* _tmp4_;
-		gboolean _tmp5_;
-		gboolean _tmp6_;
-		shutdown_media_export ();
-		_tmp3_ = _data2_->our_plugin;
-		_tmp4_ = _data2_->plugin;
-		_tmp5_ = rygel_plugin_get_active (_tmp4_);
-		_tmp6_ = _tmp5_;
-		rygel_plugin_set_active (_tmp3_, !_tmp6_);
-	}
-}
-
-
-static void _____lambda8__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
-	____lambda8_ (self);
-}
-
-
-void on_plugin_available (RygelPlugin* plugin, RygelPlugin* our_plugin) {
-	Block2Data* _data2_;
-	RygelPlugin* _tmp0_;
-	RygelPlugin* _tmp1_;
-	RygelPlugin* _tmp2_;
-	RygelPlugin* _tmp3_;
-	RygelPlugin* _tmp4_;
-	const gchar* _tmp5_;
-	const gchar* _tmp6_;
-	g_return_if_fail (plugin != NULL);
-	g_return_if_fail (our_plugin != NULL);
-	_data2_ = g_slice_new0 (Block2Data);
-	_data2_->_ref_count_ = 1;
-	_tmp0_ = plugin;
-	_tmp1_ = g_object_ref (_tmp0_);
-	g_object_unref (_data2_->plugin);
-	_data2_->plugin = _tmp1_;
-	_tmp2_ = our_plugin;
-	_tmp3_ = g_object_ref (_tmp2_);
-	g_object_unref (_data2_->our_plugin);
-	_data2_->our_plugin = _tmp3_;
-	_tmp4_ = _data2_->plugin;
-	_tmp5_ = rygel_plugin_get_name (_tmp4_);
-	_tmp6_ = _tmp5_;
-	if (g_strcmp0 (_tmp6_, TRACKER_PLUGIN) == 0) {
-		gboolean _tmp7_ = FALSE;
-		RygelPlugin* _tmp8_;
-		gboolean _tmp9_;
-		gboolean _tmp10_;
-		gboolean _tmp14_;
-		_tmp8_ = _data2_->our_plugin;
-		_tmp9_ = rygel_plugin_get_active (_tmp8_);
-		_tmp10_ = _tmp9_;
-		if (_tmp10_) {
-			RygelPlugin* _tmp11_;
-			gboolean _tmp12_;
-			gboolean _tmp13_;
-			_tmp11_ = _data2_->plugin;
-			_tmp12_ = rygel_plugin_get_active (_tmp11_);
-			_tmp13_ = _tmp12_;
-			_tmp7_ = !_tmp13_;
-		} else {
-			_tmp7_ = FALSE;
-		}
-		_tmp14_ = _tmp7_;
-		if (_tmp14_) {
-			RygelPlugin* _tmp15_;
-			_tmp15_ = _data2_->plugin;
-			g_signal_connect_data ((GObject*) _tmp15_, "notify::active", (GCallback) _____lambda8__g_object_notify, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
-		} else {
-			RygelPlugin* _tmp16_;
-			gboolean _tmp17_;
-			gboolean _tmp18_;
-			RygelPlugin* _tmp19_;
-			gboolean _tmp20_;
-			gboolean _tmp21_;
-			_tmp16_ = _data2_->our_plugin;
-			_tmp17_ = rygel_plugin_get_active (_tmp16_);
-			_tmp18_ = _tmp17_;
-			_tmp19_ = _data2_->plugin;
-			_tmp20_ = rygel_plugin_get_active (_tmp19_);
-			_tmp21_ = _tmp20_;
-			if (_tmp18_ == _tmp21_) {
-				RygelPlugin* _tmp22_;
-				gboolean _tmp23_;
-				gboolean _tmp24_;
-				RygelPlugin* _tmp25_;
-				RygelPlugin* _tmp26_;
-				gboolean _tmp27_;
-				gboolean _tmp28_;
-				_tmp22_ = _data2_->plugin;
-				_tmp23_ = rygel_plugin_get_active (_tmp22_);
-				_tmp24_ = _tmp23_;
-				if (_tmp24_) {
-					shutdown_media_export ();
-				} else {
-					g_message ("rygel-media-export-plugin.vala:79: Plugin '%s' inactivate, activating " \
-"'%s' plugin", TRACKER_PLUGIN, RYGEL_MEDIA_EXPORT_PLUGIN_NAME);
-				}
-				_tmp25_ = _data2_->our_plugin;
-				_tmp26_ = _data2_->plugin;
-				_tmp27_ = rygel_plugin_get_active (_tmp26_);
-				_tmp28_ = _tmp27_;
-				rygel_plugin_set_active (_tmp25_, !_tmp28_);
-			}
-		}
-	}
-	block2_data_unref (_data2_);
-	_data2_ = NULL;
-}
-
-
-void shutdown_media_export (void) {
-	GError * _inner_error_ = NULL;
-	g_message ("rygel-media-export-plugin.vala:89: Deactivating plugin '%s' in favor o" \
-"f plugin '%s'", RYGEL_MEDIA_EXPORT_PLUGIN_NAME, TRACKER_PLUGIN);
-	{
-		RygelMetaConfig* _tmp0_ = NULL;
-		RygelMetaConfig* config;
-		RygelMetaConfig* _tmp1_;
-		gboolean _tmp2_ = FALSE;
-		gboolean enabled;
-		gboolean _tmp3_;
-		_tmp0_ = rygel_meta_config_get_default ();
-		config = _tmp0_;
-		_tmp1_ = config;
-		_tmp2_ = rygel_configuration_get_bool ((RygelConfiguration*) _tmp1_, "MediaExport", "enabled", &_inner_error_);
-		enabled = _tmp2_;
-		if (_inner_error_ != NULL) {
-			g_object_unref (config);
-			goto __catch1_g_error;
-		}
-		_tmp3_ = enabled;
-		if (_tmp3_) {
-			RygelMediaContainer* _tmp4_ = NULL;
-			RygelMediaContainer* _tmp5_;
-			RygelMediaExportRootContainer* root;
-			RygelMediaExportRootContainer* _tmp6_;
-			_tmp4_ = rygel_media_export_root_container_get_instance (&_inner_error_);
-			_tmp5_ = _tmp4_;
-			if (_inner_error_ != NULL) {
-				g_object_unref (config);
-				goto __catch1_g_error;
-			}
-			root = G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, RYGEL_MEDIA_EXPORT_TYPE_ROOT_CONTAINER) ? ((RygelMediaExportRootContainer*) _tmp5_) : NULL;
-			_tmp6_ = root;
-			rygel_media_export_root_container_shutdown (_tmp6_);
-			g_object_unref (root);
-		}
-		g_object_unref (config);
-	}
-	goto __finally1;
-	__catch1_g_error:
-	{
-		GError* _error_ = NULL;
-		_error_ = _inner_error_;
-		_inner_error_ = NULL;
-		g_error_free (_error_);
-	}
-	__finally1:
-	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;
-	}
-}
-
-
 RygelMediaExportPlugin* rygel_media_export_plugin_construct (GType object_type, GError** error) {
 	RygelMediaExportPlugin * self = NULL;
 	RygelMediaContainer* _tmp0_ = NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]