[rhythmbox] shell: Add a way to start-up with plugins disabled



commit 6035fd8ecec431373e80db5d2957e5a71b2f0099
Author: Bastien Nocera <hadess hadess net>
Date:   Sun Feb 20 20:33:20 2011 +0000

    shell: Add a way to start-up with plugins disabled
    
    For debugging purposes
    
    https://bugzilla.gnome.org/show_bug.cgi?id=642836

 shell/main.c     |    4 +++-
 shell/rb-shell.c |   29 +++++++++++++++++++++++++++--
 shell/rb-shell.h |    1 +
 3 files changed, 31 insertions(+), 3 deletions(-)
---
diff --git a/shell/main.c b/shell/main.c
index eeb4c76..97d217f 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -87,6 +87,7 @@ static gboolean quit            = FALSE;
 static gboolean no_registration = FALSE;
 static gboolean no_update	= FALSE;
 static gboolean dry_run		= FALSE;
+static gboolean disable_plugins  = FALSE;
 static char *rhythmdb_file	= NULL;
 static char *playlists_file	= NULL;
 static char **remaining_args    = NULL;
@@ -116,6 +117,7 @@ main (int argc, char **argv)
 		{ "no-update",	       0, 0, G_OPTION_ARG_NONE,         &no_update,       N_("Do not update the library with file changes"), NULL },
 		{ "no-registration", 'n', 0, G_OPTION_ARG_NONE,         &no_registration, N_("Do not register the shell"), NULL },
 		{ "dry-run",	       0, 0, G_OPTION_ARG_NONE,         &dry_run,         N_("Don't save any data permanently (implies --no-registration)"), NULL },
+		{ "disable-plugins",   0, 0, G_OPTION_ARG_NONE,         &disable_plugins, N_("Disable loading of plugins"), NULL },
 		{ "rhythmdb-file",     0, 0, G_OPTION_ARG_STRING,       &rhythmdb_file,   N_("Path for database file to use"), NULL },
 		{ "playlists-file",    0, 0, G_OPTION_ARG_STRING,       &playlists_file,   N_("Path for playlists file to use"), NULL },
 		{ "quit",	     'q', 0, G_OPTION_ARG_NONE,         &quit,            N_("Quit Rhythmbox"), NULL },
@@ -278,7 +280,7 @@ main (int argc, char **argv)
 
 		g_setenv ("PULSE_PROP_media.role", "music", TRUE);
 
-		rb_shell = rb_shell_new (no_registration, no_update, dry_run, autostarted, rhythmdb_file, playlists_file);
+		rb_shell = rb_shell_new (no_registration, no_update, dry_run, autostarted, disable_plugins, rhythmdb_file, playlists_file);
 		g_object_weak_ref (G_OBJECT (rb_shell), main_shell_weak_ref_cb, NULL);
 		if (!no_registration && session_bus != NULL) {
 			GObject *obj;
diff --git a/shell/rb-shell.c b/shell/rb-shell.c
index f67f007..a685b63 100644
--- a/shell/rb-shell.c
+++ b/shell/rb-shell.c
@@ -252,7 +252,8 @@ enum
 	PROP_SOURCE_HEADER,
 	PROP_VISIBILITY,
 	PROP_TRACK_TRANSFER_QUEUE,
-	PROP_AUTOSTARTED
+	PROP_AUTOSTARTED,
+	PROP_DISABLE_PLUGINS
 };
 
 /* prefs */
@@ -321,6 +322,7 @@ struct _RBShellPrivate
 	gboolean no_update;
 	gboolean dry_run;
 	gboolean autostarted;
+	gboolean disable_plugins;
 	char *rhythmdb_file;
 	char *playlists_file;
 
@@ -730,6 +732,19 @@ rb_shell_class_init (RBShellClass *klass)
 							       G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 
 	/**
+	 * RBShell:disable-plugins:
+	 *
+	 * If %TRUE, disable plugins
+	 */
+	g_object_class_install_property (object_class,
+					 PROP_DISABLE_PLUGINS,
+					 g_param_spec_boolean ("disable-plugins",
+							       "disable-plugins",
+							       "Whether or not to disable plugins",
+							       FALSE,
+							       G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+	/**
 	 * RBShell::visibility-changed:
 	 * @shell: the #RBShell
 	 * @visibile: new visibility
@@ -915,6 +930,9 @@ rb_shell_set_property (GObject *object,
 	case PROP_AUTOSTARTED:
 		shell->priv->autostarted = g_value_get_boolean (value);
 		break;
+	case PROP_DISABLE_PLUGINS:
+		shell->priv->disable_plugins = g_value_get_boolean (value);
+		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
@@ -1008,6 +1026,9 @@ rb_shell_get_property (GObject *object,
 	case PROP_AUTOSTARTED:
 		g_value_set_boolean (value, shell->priv->autostarted);
 		break;
+	case PROP_DISABLE_PLUGINS:
+		g_value_set_boolean (value, shell->priv->disable_plugins);
+		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
@@ -1152,6 +1173,7 @@ rb_shell_finalize (GObject *object)
  * @no_update: if %TRUE, don't update the database file
  * @dry_run: if %TRUE, don't write back file metadata changes
  * @autostarted: %TRUE if autostarted by the session manager
+ * @disable_plugins: %TRUE if the plugins should be disabled
  * @rhythmdb: path to the database file
  * @playlists: path to the playlist file
  *
@@ -1165,6 +1187,7 @@ rb_shell_new (gboolean no_registration,
 	      gboolean no_update,
 	      gboolean dry_run,
 	      gboolean autostarted,
+	      gboolean disable_plugins,
 	      char *rhythmdb,
 	      char *playlists)
 {
@@ -1174,6 +1197,7 @@ rb_shell_new (gboolean no_registration,
 			  "dry-run", dry_run, "rhythmdb-file", rhythmdb,
 			  "playlists-file", playlists,
 			  "autostarted", autostarted,
+			  "disable-plugins", disable_plugins,
 			  NULL);
 }
 
@@ -1620,7 +1644,8 @@ rb_shell_constructed (GObject *object)
 
 	rb_shell_select_page (shell, RB_DISPLAY_PAGE (shell->priv->library_source));
 
-	rb_plugins_engine_init (shell);
+	if (!shell->priv->disable_plugins)
+		rb_plugins_engine_init (shell);
 
 	/* by now we've added the built in sources and any sources from plugins,
 	 * so we can consider the fixed page groups loaded
diff --git a/shell/rb-shell.h b/shell/rb-shell.h
index 2c6debe..a9ef0b0 100644
--- a/shell/rb-shell.h
+++ b/shell/rb-shell.h
@@ -107,6 +107,7 @@ RBShell *	rb_shell_new		(gboolean no_registration,
 					 gboolean no_update,
 					 gboolean dry_run,
 					 gboolean autostarted,
+					 gboolean disable_plugins,
 					 char *rhythmdb,
 					 char *playlists);
 



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