Add --mutter-plugins command line argument

src/core/main.c: Add --mutter-plugins argument (overrides GConf value)
src/core/prefs.c src/include/prefs.h: Add meta_prefs_override_clutter_plugins()
   to set a value for clutter_plugins that overrides the value from GConf
This commit is contained in:
Owen W. Taylor 2008-10-31 08:33:37 -04:00
parent 6683b5efff
commit 1b943f8191
3 changed files with 60 additions and 6 deletions

View File

@ -220,6 +220,7 @@ typedef struct
gchar *save_file;
gchar *display_name;
gchar *client_id;
gchar *mutter_plugins;
gboolean replace_wm;
gboolean disable_sm;
gboolean print_version;
@ -251,7 +252,7 @@ static GOptionContext *
meta_parse_options (int *argc, char ***argv,
MetaArguments *meta_args)
{
MetaArguments my_args = {NULL, NULL, NULL,
MetaArguments my_args = {NULL, NULL, NULL, NULL,
FALSE, FALSE, FALSE, FALSE, FALSE};
GOptionEntry options[] = {
{
@ -307,6 +308,14 @@ meta_parse_options (int *argc, char ***argv,
N_("Turn compositing off"),
NULL
},
#ifdef WITH_CLUTTER
{
"mutter-plugins", 0, 0, G_OPTION_ARG_STRING,
&my_args.mutter_plugins,
N_("Comma-separated list of compositor plugins"),
"PLUGINS"
},
#endif
{NULL}
};
GOptionContext *ctx;
@ -547,6 +556,25 @@ main (int argc, char **argv)
if (meta_args.composite || meta_args.no_composite)
meta_prefs_set_compositing_manager (meta_args.composite);
if (meta_args.mutter_plugins)
{
char **plugins = g_strsplit (meta_args.mutter_plugins, ",", -1);
char **plugin;
GSList *plugins_list = NULL;
for (plugin = plugins; *plugin; plugin++)
{
g_strstrip (*plugin);
plugins_list = g_slist_prepend (plugins_list, *plugin);
}
plugins_list = g_slist_reverse (plugins_list);
meta_prefs_override_clutter_plugins (plugins_list);
g_slist_free(plugins_list);
g_strfreev (plugins);
}
if (!meta_display_open ())
meta_exit (META_EXIT_ERROR);

View File

@ -113,6 +113,7 @@ static char *workspace_names[MAX_REASONABLE_WORKSPACES] = { NULL, };
#ifdef WITH_CLUTTER
static gboolean clutter_disabled = FALSE;
static gboolean clutter_plugins_overridden = FALSE;
static GSList *clutter_plugins = NULL;
#endif
@ -1044,6 +1045,7 @@ meta_prefs_init (void)
handle_preference_init_int ();
#ifdef WITH_CLUTTER
if (!clutter_plugins_overridden)
clutter_plugins = gconf_client_get_list (default_client, KEY_CLUTTER_PLUGINS,
GCONF_VALUE_STRING, &err);
@ -1233,7 +1235,7 @@ change_notify (GConfClient *client,
queue_changed (META_PREF_WORKSPACE_NAMES);
}
#ifdef WITH_CLUTTER
else if (g_str_equal (key, KEY_CLUTTER_PLUGINS))
else if (g_str_equal (key, KEY_CLUTTER_PLUGINS) && !clutter_plugins_overridden)
{
GError *err = NULL;
GSList *l;
@ -2971,6 +2973,21 @@ meta_prefs_set_clutter_plugins (GSList *list)
g_error_free (err);
}
}
void
meta_prefs_override_clutter_plugins (GSList *list)
{
GError *err = NULL;
GSList *l;
clutter_plugins_overridden = TRUE;
clutter_plugins = NULL;
for (l = list; l; l = l->next)
clutter_plugins = g_slist_prepend (clutter_plugins, g_strdup(l->data));
clutter_plugins = g_slist_reverse (clutter_plugins);
}
#endif
gboolean

View File

@ -133,11 +133,20 @@ void meta_prefs_set_clutter_disabled (gboolean whether);
GSList * meta_prefs_get_clutter_plugins (void);
/**
* Sets whether the compositor is turned on.
* Sets the list of plugins persistently in GConf
*
* \param whether TRUE to turn on, FALSE to turn off
* \param list list of plugin:option pairs
*/
void meta_prefs_set_clutter_plugins (GSList *list);
/**
* Sets the list of plugins temporarily for this process. The value
* from GConf will be ignored.
*
* \param list list of plugin:option pairs
*/
void meta_prefs_override_clutter_plugins (GSList *list);
#endif
gboolean meta_prefs_get_live_hidden_windows (void);