[rygel] media-server: Nothing ever throws from RootContainer's constructor.
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] media-server: Nothing ever throws from RootContainer's constructor.
- Date: Tue, 22 Jan 2013 14:11:17 +0000 (UTC)
commit 29e71c4d4de836787b809a7c8996bbbfdf7e4d51
Author: Krzesimir Nowak <krnowak openismus com>
Date: Tue Jan 22 13:58:08 2013 +0100
media-server: Nothing ever throws from RootContainer's constructor.
So remove the code handling the exceptions.
.../rygel-media-export-object-factory.vala | 19 +++++--------------
.../media-export/rygel-media-export-plugin.vala | 14 ++------------
.../rygel-media-export-root-container.vala | 13 +------------
3 files changed, 8 insertions(+), 38 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-object-factory.vala b/src/plugins/media-export/rygel-media-export-object-factory.vala
index 616533f..fe8c315 100644
--- a/src/plugins/media-export/rygel-media-export-object-factory.vala
+++ b/src/plugins/media-export/rygel-media-export-object-factory.vala
@@ -38,20 +38,11 @@ internal class Rygel.MediaExport.ObjectFactory : Object {
uint child_count,
string? uri) {
if (id == "0") {
- try {
- return RootContainer.get_instance () as DBContainer;
- } catch (Error error) {
- // Must not fail - plugin is disabled if this fails
- assert_not_reached ();
- }
+ return RootContainer.get_instance () as DBContainer;
} else if (id == RootContainer.FILESYSTEM_FOLDER_ID) {
- try {
- var root_container = RootContainer.get_instance ()
- as RootContainer;
+ var root_container = RootContainer.get_instance () as RootContainer;
- return root_container.get_filesystem_container ()
- as DBContainer;
- } catch (Error error) { assert_not_reached (); }
+ return root_container.get_filesystem_container () as DBContainer;
}
if (id.has_prefix (QueryContainer.PREFIX)) {
@@ -60,7 +51,7 @@ internal class Rygel.MediaExport.ObjectFactory : Object {
}
// Return a suitable container for the top-level virtual folders.
- // This corresponds to the short-lived NullContainers that
+ // This corresponds to the short-lived NullContainers that
// we used to save these in the database.
if (id.has_prefix ("virtual-parent:")) {
return new DBContainer (id, title);
@@ -73,7 +64,7 @@ internal class Rygel.MediaExport.ObjectFactory : Object {
// Return a writable container for anything with a URI,
// such as child folders of the file system,
// to allow uploads.
- // See https://bugzilla.gnome.org/show_bug.cgi?id=676379 to
+ // See https://bugzilla.gnome.org/show_bug.cgi?id=676379 to
// give more control over this.
return new WritableDbContainer (id, title);
}
diff --git a/src/plugins/media-export/rygel-media-export-plugin.vala b/src/plugins/media-export/rygel-media-export-plugin.vala
index 5cae762..c0b6972 100644
--- a/src/plugins/media-export/rygel-media-export-plugin.vala
+++ b/src/plugins/media-export/rygel-media-export-plugin.vala
@@ -36,17 +36,7 @@ public void module_init (PluginLoader loader) {
}
// Instantiate the plugin object:
- MediaExport.Plugin plugin;
-
- try {
- plugin = new MediaExport.Plugin ();
- } catch (Error error) {
- warning ("Failed to initialize plugin '%s': %s. Ignoring..",
- MediaExport.Plugin.NAME,
- error.message);
-
- return;
- }
+ var plugin = new MediaExport.Plugin ();
// Check what other plugins are loaded,
// and check when other plugins are loaded later:
@@ -118,7 +108,7 @@ public class Rygel.MediaExport.Plugin : Rygel.MediaServerPlugin {
/**
* Instantiate the plugin.
*/
- public Plugin () throws Error {
+ public Plugin () {
// Call the base constructor,
// passing the instance of our root container.
base (RootContainer.get_instance (),
diff --git a/src/plugins/media-export/rygel-media-export-root-container.vala b/src/plugins/media-export/rygel-media-export-root-container.vala
index d981fe4..e0f542a 100644
--- a/src/plugins/media-export/rygel-media-export-root-container.vala
+++ b/src/plugins/media-export/rygel-media-export-root-container.vala
@@ -51,7 +51,6 @@ public class Rygel.MediaExport.RootContainer : TrackableDbContainer {
private ulong harvester_signal_id;
private static MediaContainer instance = null;
- private static Error creation_error = null;
internal const string FILESYSTEM_FOLDER_NAME = N_("Files & Folders");
internal const string FILESYSTEM_FOLDER_ID = "Filesystem";
@@ -64,19 +63,9 @@ public class Rygel.MediaExport.RootContainer : TrackableDbContainer {
/**
* Get the single instance of the root container.
*/
- public static MediaContainer get_instance () throws Error {
+ public static MediaContainer get_instance () {
if (RootContainer.instance == null) {
- try {
RootContainer.instance = new RootContainer ();
- } catch (Error error) {
- // Cache the error for further calls and create a Null container.
- RootContainer.instance = new NullContainer.root ();
- RootContainer.creation_error = error;
- }
- } else {
- if (creation_error != null) {
- throw creation_error;
- }
}
return RootContainer.instance;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]