summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--beryl-core/include/beryl-settings.h4
-rw-r--r--beryl-core/include/beryl.h7
-rw-r--r--beryl-core/libberylsettings/main.c137
-rw-r--r--beryl-core/src/display.c6
-rw-r--r--beryl-core/src/display_options.c22
-rw-r--r--beryl-core/src/plugin.c23
-rw-r--r--beryl-dbus/src/dbus.c1
-rw-r--r--beryl-plugins/src/3d.c1
-rw-r--r--beryl-plugins/src/Makefile.am6
-rw-r--r--beryl-plugins/src/animation.c1
-rw-r--r--beryl-plugins/src/annotate.c3
-rw-r--r--beryl-plugins/src/bench.c1
-rw-r--r--beryl-plugins/src/blurfx.h1
-rw-r--r--beryl-plugins/src/clone.c1
-rw-r--r--beryl-plugins/src/crashhandler.c1
-rw-r--r--beryl-plugins/src/cube.c1
-rw-r--r--beryl-plugins/src/decoration.c1
-rw-r--r--beryl-plugins/src/fade.c1
-rw-r--r--beryl-plugins/src/group.c1
-rw-r--r--beryl-plugins/src/inputzoom.c1
-rw-r--r--beryl-plugins/src/jpeg.c1
-rw-r--r--beryl-plugins/src/move.c1
-rw-r--r--beryl-plugins/src/neg.c1
-rw-r--r--beryl-plugins/src/opacify.c1
-rw-r--r--beryl-plugins/src/place.c1
-rw-r--r--beryl-plugins/src/plane.c1
-rw-r--r--beryl-plugins/src/png.c1
-rw-r--r--beryl-plugins/src/put.c1
-rw-r--r--beryl-plugins/src/resize.c1
-rw-r--r--beryl-plugins/src/rotate.c1
-rw-r--r--beryl-plugins/src/scale.c1
-rw-r--r--beryl-plugins/src/screenshot.c1
-rw-r--r--beryl-plugins/src/showdesktop.c1
-rw-r--r--beryl-plugins/src/snow.c1
-rw-r--r--beryl-plugins/src/splash.c1
-rw-r--r--beryl-plugins/src/state.c1
-rw-r--r--beryl-plugins/src/svg.c1
-rw-r--r--beryl-plugins/src/switcher.c1
-rw-r--r--beryl-plugins/src/trailfocus.c1
-rw-r--r--beryl-plugins/src/water.c1
-rw-r--r--beryl-plugins/src/wobbly.c1
-rw-r--r--beryl-plugins/src/zoom.c1
-rwxr-xr-xberyl-settings-2/main.py29
-rw-r--r--beryl-settings-bindings/python/berylsettings.pyx60
44 files changed, 274 insertions, 57 deletions
diff --git a/beryl-core/include/beryl-settings.h b/beryl-core/include/beryl-settings.h
index a4eefc4..fd62e0c 100644
--- a/beryl-core/include/beryl-settings.h
+++ b/beryl-core/include/beryl-settings.h
@@ -573,4 +573,8 @@ BerylSetting * beryl_settings_context_find_first_edge_owner(BerylSettingsContext
BerylSettingsPlugin * beryl_setting_get_plugin(BerylSetting * setting);
BerylSettingConflictType beryl_setting_conflict_get_type(BerylSettingConflict * c);
GSList * beryl_setting_conflict_get_settings(BerylSettingConflict * c);
+GSList * beryl_settings_context_get_active_plugins(BerylSettingsContext * c);
+gboolean beryl_settings_plugin_enable(BerylSettingsPlugin * p);
+gboolean beryl_settings_plugin_disable(BerylSettingsPlugin * p);
+gboolean beryl_settings_plugin_get_is_enabled(BerylSettingsPlugin * p);
#endif
diff --git a/beryl-core/include/beryl.h b/beryl-core/include/beryl.h
index 499ba0e..2371d38 100644
--- a/beryl-core/include/beryl.h
+++ b/beryl-core/include/beryl.h
@@ -510,7 +510,7 @@ optionTypeToString (CompOptionType type);
typedef int CompTimeoutHandle;
typedef int CompWatchFdHandle;
-#define COMP_DISPLAY_OPTION_ACTIVE_PLUGINS 0
+#define COMP_DISPLAY_OPTION_TOGGLE_WINDOW_FULLSCREEN 0
#define COMP_DISPLAY_OPTION_TEXTURE_FILTER 1
#define COMP_DISPLAY_OPTION_CLICK_TO_FOCUS 2
#define COMP_DISPLAY_OPTION_AUTORAISE 3
@@ -572,9 +572,8 @@ typedef int CompWatchFdHandle;
#define COMP_DISPLAY_OPTION_DIM_DEAD 59
#define COMP_DISPLAY_OPTION_IGNORE_HINTS_WHEN_MAXIMIZED 60
#define COMP_DISPLAY_OPTION_EDGE_TRIGGERING_DELAY 61
-#define COMP_DISPLAY_OPTION_TOGGLE_WINDOW_FULLSCREEN 62
//#define COMP_DISPLAY_OPTION_FOCUS_STEALING_LEVEL 63
-#define COMP_DISPLAY_OPTION_NUM 63
+#define COMP_DISPLAY_OPTION_NUM 62
struct _BerylSettingsContext;
@@ -2633,6 +2632,8 @@ typedef struct _CompPluginVTable {
GroupDesc * groupDescs;
int nGroupDescs;
+
+ Bool defaultEnabled;
} CompPluginVTable;
typedef CompPluginVTable *(*PluginGetInfoProc) (void);
diff --git a/beryl-core/libberylsettings/main.c b/beryl-core/libberylsettings/main.c
index 4e24f18..9dd8d7f 100644
--- a/beryl-core/libberylsettings/main.c
+++ b/beryl-core/libberylsettings/main.c
@@ -632,6 +632,28 @@ static void load_plugin(BerylSettingsContext * context, gchar * filename)
}
}
}
+ if (!beryl_settings_plugin_find_setting(plugin,"____plugin_enabled",FALSE))
+ {
+ NEW(BerylSetting,setting);
+ setting->parent=plugin;
+ setting->is_screen=FALSE;
+ setting->is_default=TRUE;
+ setting->name=g_strdup("____plugin_enabled");
+ setting->short_desc=g_strdup("enabled");
+ setting->long_desc=g_strdup("enabled");
+ setting->group=g_strdup("");
+ setting->subGroup=g_strdup("");
+ setting->type=BERYL_SETTING_TYPE_BOOL;
+ setting->advanced=TRUE;
+ setting->default_value.parent=setting;
+ setting->default_value.value.as_bool=vt->defaultEnabled;
+ copy_from_default(setting);
+ plugin->settings=g_slist_append(plugin->settings,setting);
+ }
+ else
+ {
+ g_error("Couldn't load plugin %s because it has a setting defined named ____plugin_enabled",plugin->name);
+ }
dlclose(dlhand);
collate_groups(plugin);
context->plugins=g_slist_append(context->plugins,plugin);
@@ -2299,3 +2321,118 @@ GSList * beryl_setting_conflict_get_settings(BerylSettingConflict * c)
{
return c->settings;
}
+
+GSList * beryl_settings_context_get_active_plugins(BerylSettingsContext * c)
+{
+ GSList * l;
+ GSList * ret = NULL;
+ for (l=c->plugins;l;l=l->next)
+ {
+ BerylSetting * s = beryl_settings_plugin_find_setting(l->data,"____plugin_enabled",FALSE);
+ if (s)
+ {
+ if (s->value.value.as_bool)
+ ret=g_slist_append(ret,l->data);
+ }
+ }
+ return ret;
+}
+
+gboolean beryl_settings_plugin_enable(BerylSettingsPlugin * p)
+{
+ if (!p->name)
+ return FALSE;
+ BerylSetting * s = beryl_settings_plugin_find_setting(p,"____plugin_enabled",FALSE);
+ if (!s)
+ return FALSE;
+ GSList * l, * m, * n, * o;
+ o = beryl_settings_context_get_active_plugins(p->context);
+ for(l=p->requires;l;l=l->next)
+ {
+ for (m=o;m;m=m->next)
+ {
+ for (n=((BerylSettingsPlugin *)m->data)->provides;n;n=n->next)
+ {
+ if (!strcmp((char *)n->data,(char *)l->data))
+ break;
+ }
+ if (n)
+ break;
+ }
+ if (!m)
+ {
+ puts("requires");
+ puts(l->data);
+ g_slist_free(o);
+ return FALSE;
+ }
+ }
+ for(l=p->provides;l;l=l->next)
+ {
+ for (m=o;m;m=m->next)
+ {
+ for (n=((BerylSettingsPlugin *)m->data)->provides;n;n=n->next)
+ {
+ if (!strcmp((char *)n->data,(char *)l->data))
+ break;
+ }
+ if (n)
+ break;
+ }
+ if (m)
+ {
+ puts("provides");
+ puts(l->data);
+ g_slist_free(o);
+ return FALSE;
+ }
+ }
+ g_slist_free(o);
+ gboolean b = TRUE;
+ return beryl_setting_value_set_bool(beryl_setting_get_primary_value(s),&b);
+}
+
+gboolean beryl_settings_plugin_disable(BerylSettingsPlugin * p)
+{
+ if (!p->name)
+ return FALSE;
+ BerylSetting * s = beryl_settings_plugin_find_setting(p,"____plugin_enabled",FALSE);
+ if (!s)
+ return FALSE;
+ GSList * l, * m, * n, * o;
+ o = beryl_settings_context_get_active_plugins(p->context);
+ for(l=p->provides;l;l=l->next)
+ {
+ for (m=o;m;m=m->next)
+ {
+ for (n=((BerylSettingsPlugin *)m->data)->requires;n;n=n->next)
+ {
+ if (!strcmp((char *)n->data,(char *)l->data))
+ break;
+ }
+ if (n)
+ break;
+ }
+ if (m)
+ {
+ puts(l->data);
+ g_slist_free(o);
+ return FALSE;
+ }
+ }
+ g_slist_free(o);
+ gboolean b = FALSE;
+ return beryl_setting_value_set_bool(beryl_setting_get_primary_value(s),&b);
+}
+
+gboolean beryl_settings_plugin_get_is_enabled(BerylSettingsPlugin * p)
+{
+ BerylSetting * s = beryl_settings_plugin_find_setting(p,"____plugin_enabled",FALSE);
+ if (!s)
+ return TRUE;
+ gboolean b = FALSE;
+ if (beryl_setting_value_get_bool(beryl_setting_get_primary_value(s),&b))
+ return b;
+ else
+ return TRUE;
+}
diff --git a/beryl-core/src/display.c b/beryl-core/src/display.c
index e243262..5f3de49 100644
--- a/beryl-core/src/display.c
+++ b/beryl-core/src/display.c
@@ -792,6 +792,7 @@ setDisplayOption(CompDisplay * display, char *name, CompOptionValue * value)
}
break;
#endif
+#if 0
case COMP_DISPLAY_OPTION_ACTIVE_PLUGINS:
if (compSetOptionList(o, value))
{
@@ -799,6 +800,7 @@ setDisplayOption(CompDisplay * display, char *name, CompOptionValue * value)
return TRUE;
}
break;
+#endif
case COMP_DISPLAY_OPTION_TEXTURE_FILTER:
if (compSetStringOption(o, value))
{
@@ -3096,7 +3098,11 @@ void reload_all(CompDisplay *d)
int nOption;
CompPlugin *p;
beryl_settings_context_read(d->context);
+
puts("Reloading options");
+
+ d->dirtyPluginList=True;
+
nOption=0;
option=compGetDisplayOptions(d, &nOption);
diff --git a/beryl-core/src/display_options.c b/beryl-core/src/display_options.c
index 610b022..e76dec9 100644
--- a/beryl-core/src/display_options.c
+++ b/beryl-core/src/display_options.c
@@ -146,11 +146,6 @@ void compDisplayFreeOptions(CompDisplay * display)
int i;
CompOption *o;
- o = &display->opt[COMP_DISPLAY_OPTION_ACTIVE_PLUGINS];
- for (i = 0; i < o->value.list.nValue; i++)
- free(o->value.list.value[i].s);
- free(o->value.list.value);
-
free(display->opt[COMP_DISPLAY_OPTION_COMMAND0].value.s);
free(display->opt[COMP_DISPLAY_OPTION_COMMAND1].value.s);
free(display->opt[COMP_DISPLAY_OPTION_COMMAND2].value.s);
@@ -183,23 +178,6 @@ void compDisplayInitOptions(CompDisplay * display, char **plugin, int nPlugin)
plugin = def_plugin;
}
- o = &display->opt[COMP_DISPLAY_OPTION_ACTIVE_PLUGINS];
- o->advanced = False;
- o->name = "active_plugins";
- o->group = N_("Main");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Active Plugins");
- o->longDesc = N_("List of currently active plugins");
- o->type = CompOptionTypeList;
- o->value.list.type = CompOptionTypeString;
- o->value.list.nValue = nPlugin;
- o->value.list.value = malloc(sizeof(CompOptionValue) * nPlugin);
- for (i = 0; i < nPlugin; i++)
- o->value.list.value[i].s = strdup(plugin[i]);
- o->rest.s.string = 0;
- o->rest.s.nString = 0;
-
display->dirtyPluginList = TRUE;
o = &display->opt[COMP_DISPLAY_OPTION_TEXTURE_FILTER];
diff --git a/beryl-core/src/plugin.c b/beryl-core/src/plugin.c
index 85d584d..ded34ee 100644
--- a/beryl-core/src/plugin.c
+++ b/beryl-core/src/plugin.c
@@ -808,7 +808,6 @@ void updatePlugins(CompDisplay * d)
{
old_num++;
pr_debug("%s ", p->vTable->name);
- finiPlugin(p);
p->state = BerylPluginNeedsUnload;
@@ -825,7 +824,10 @@ void updatePlugins(CompDisplay * d)
*/
- o = &d->opt[COMP_DISPLAY_OPTION_ACTIVE_PLUGINS];
+ GSList * active_plugins;
+ GSList * iter;
+ //o = &d->opt[COMP_DISPLAY_OPTION_ACTIVE_PLUGINS];
+ active_plugins=beryl_settings_context_get_active_plugins(d->context);
/*
* Now mark names still in the list as ok, and
@@ -835,18 +837,18 @@ void updatePlugins(CompDisplay * d)
* the new list first.
*/
- for (i = 0; i < o->value.list.nValue; i++)
+ for (iter=active_plugins;iter;iter=iter->next)
{
- pr_debug("Plugin %s ", o->value.list.value[i].s);
+ pr_debug("Plugin %s ", beryl_settings_plugin_get_name(iter->data));
p = plugins;
while (p)
{
- if (!strcmp(o->value.list.value[i].s, p->vTable->name))
+ if (!strcmp(beryl_settings_plugin_get_name(iter->data), p->vTable->name))
{
pr_debug("matches an existing plugin name.\n");
if (p->state == BerylPluginNeedsUnload)
{
- p->state = BerylPluginNeedsInit;
+ p->state = BerylPluginReady;
new_num++;
}
break;
@@ -868,12 +870,12 @@ void updatePlugins(CompDisplay * d)
* Now mark names still in the list as ok, and
* seek to load plugins with new names.
*/
- for (i = 0; i < o->value.list.nValue; i++)
+ for (iter = active_plugins; iter; iter=iter->next)
{
p = plugins;
while (p)
{
- if (!strcmp(o->value.list.value[i].s, p->vTable->name))
+ if (!strcmp(beryl_settings_plugin_get_name(iter->data), p->vTable->name))
{
break;
}
@@ -883,8 +885,8 @@ void updatePlugins(CompDisplay * d)
/* New plugin? */
if (!p)
{
- pr_debug("Seeking to load %s.\n", o->value.list.value[i].s);
- p = loadPlugin(o->value.list.value[i].s, d);
+ pr_debug("Seeking to load %s.\n", beryl_settings_plugin_get_name(iter->data));
+ p = loadPlugin(beryl_settings_plugin_get_name(iter->data), d);
if (p)
{
p->next = plugins;
@@ -902,6 +904,7 @@ void updatePlugins(CompDisplay * d)
if (p->state == BerylPluginNeedsUnload)
{
+ finiPlugin(p);
pr_debug("Unloading %s...", p->vTable->name);
if (p == plugins)
plugins = next;
diff --git a/beryl-dbus/src/dbus.c b/beryl-dbus/src/dbus.c
index bddcb0d..534d90a 100644
--- a/beryl-dbus/src/dbus.c
+++ b/beryl-dbus/src/dbus.c
@@ -1350,6 +1350,7 @@ CompPluginVTable dbusVTable = {
"misc",
0,
0,
+ True,
};
CompPluginVTable *
diff --git a/beryl-plugins/src/3d.c b/beryl-plugins/src/3d.c
index 716eba7..3566284 100644
--- a/beryl-plugins/src/3d.c
+++ b/beryl-plugins/src/3d.c
@@ -1083,6 +1083,7 @@ static CompPluginVTable tdVTable = {
"effects",
0,
0,
+ False,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/Makefile.am b/beryl-plugins/src/Makefile.am
index 863e6a0..40c6a11 100644
--- a/beryl-plugins/src/Makefile.am
+++ b/beryl-plugins/src/Makefile.am
@@ -41,8 +41,8 @@ libcrashhandler_la_LIBADD = @BERYL_LIBS@ @BERYLSETTINGS_LIBS@
libcrashhandler_la_SOURCES = crashhandler.c
if JPEG_PLUGIN
-libjpeg_la_LDFLAGS = $(PFLAGS)
-libjpeg_la_LIBADD = @BERYL_LIBS@ @BERYLSETTINGS_LIBS@ -ljpeg
+libjpeg_la_LDFLAGS = $(PFLAGS) -ljpeg
+libjpeg_la_LIBADD = @BERYL_LIBS@ @BERYLSETTINGS_LIBS@
libjpeg_la_SOURCES = jpeg.c
libjpeg_module = libjpeg.la
endif
@@ -193,5 +193,5 @@ module_LTLIBRARIES = \
libpng.la \
libsnow.la \
libopacify.la \
- $(libjpeg_module)
+ $(libjpeg_module) \
$(libannotate_module)
diff --git a/beryl-plugins/src/animation.c b/beryl-plugins/src/animation.c
index 04503c6..8c7fdfe 100644
--- a/beryl-plugins/src/animation.c
+++ b/beryl-plugins/src/animation.c
@@ -6544,6 +6544,7 @@ CompPluginVTable animVTable = {
"effects",
0,
0,
+ True,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/annotate.c b/beryl-plugins/src/annotate.c
index 6c95a7b..59323ea 100644
--- a/beryl-plugins/src/annotate.c
+++ b/beryl-plugins/src/annotate.c
@@ -1839,7 +1839,8 @@ static CompPluginVTable annoVTable = {
"beryl-plugins",
"misc",
0,
- 0
+ 0,
+ False,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/bench.c b/beryl-plugins/src/bench.c
index 6c35c47..ae2aa23 100644
--- a/beryl-plugins/src/bench.c
+++ b/beryl-plugins/src/bench.c
@@ -743,6 +743,7 @@ CompPluginVTable benchVTable = {
"misc",
0,
0,
+ False,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/blurfx.h b/beryl-plugins/src/blurfx.h
index d34185a..e24ad41 100644
--- a/beryl-plugins/src/blurfx.h
+++ b/beryl-plugins/src/blurfx.h
@@ -390,6 +390,7 @@ CompPluginVTable blurfxVTable = {
"effects",
0,
0,
+ False,
};
#endif
diff --git a/beryl-plugins/src/clone.c b/beryl-plugins/src/clone.c
index 8927d64..4b49ded 100644
--- a/beryl-plugins/src/clone.c
+++ b/beryl-plugins/src/clone.c
@@ -853,6 +853,7 @@ CompPluginVTable cloneVTable = {
"desktop",
0,
0,
+ False,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/crashhandler.c b/beryl-plugins/src/crashhandler.c
index 3bcbb36..3c454da 100644
--- a/beryl-plugins/src/crashhandler.c
+++ b/beryl-plugins/src/crashhandler.c
@@ -292,6 +292,7 @@ CompPluginVTable crashhandlerVTable = {
"devel",
0,
0,
+ False,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/cube.c b/beryl-plugins/src/cube.c
index 2f8a54f..bc5f1a3 100644
--- a/beryl-plugins/src/cube.c
+++ b/beryl-plugins/src/cube.c
@@ -3012,6 +3012,7 @@ CompPluginVTable cubeVTable = {
"desktop",
0,
0,
+ True,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/decoration.c b/beryl-plugins/src/decoration.c
index 4cdf1d4..3940e0f 100644
--- a/beryl-plugins/src/decoration.c
+++ b/beryl-plugins/src/decoration.c
@@ -1605,6 +1605,7 @@ static CompPluginVTable decorVTable = {
"effects",
0,
0,
+ True,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/fade.c b/beryl-plugins/src/fade.c
index 95b43e1..31dbbf9 100644
--- a/beryl-plugins/src/fade.c
+++ b/beryl-plugins/src/fade.c
@@ -455,6 +455,7 @@ static CompPluginVTable fadeVTable = {
"effects",
0,
0,
+ True,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/group.c b/beryl-plugins/src/group.c
index f33ba5c..4e9a962 100644
--- a/beryl-plugins/src/group.c
+++ b/beryl-plugins/src/group.c
@@ -2193,6 +2193,7 @@ CompPluginVTable groupVTable = {
"wm",
0,
0,
+ False,
};
/*
diff --git a/beryl-plugins/src/inputzoom.c b/beryl-plugins/src/inputzoom.c
index 2b4a5d4..066ddec 100644
--- a/beryl-plugins/src/inputzoom.c
+++ b/beryl-plugins/src/inputzoom.c
@@ -1042,6 +1042,7 @@ CompPluginVTable zoomVTable = {
"accessibility",
0,
0,
+ True,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/jpeg.c b/beryl-plugins/src/jpeg.c
index 5ff45c2..8eb39d1 100644
--- a/beryl-plugins/src/jpeg.c
+++ b/beryl-plugins/src/jpeg.c
@@ -463,6 +463,7 @@ CompPluginVTable JPEGVTable = {
"imageformat",
0,
0,
+ True,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/move.c b/beryl-plugins/src/move.c
index 7a21e25..e533583 100644
--- a/beryl-plugins/src/move.c
+++ b/beryl-plugins/src/move.c
@@ -986,6 +986,7 @@ CompPluginVTable moveVTable = {
"wm",
0,
0,
+ True,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/neg.c b/beryl-plugins/src/neg.c
index bc31c08..bcecd0c 100644
--- a/beryl-plugins/src/neg.c
+++ b/beryl-plugins/src/neg.c
@@ -838,6 +838,7 @@ CompPluginVTable NEGVTable = {
"accessibility",
0,
0,
+ True,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/opacify.c b/beryl-plugins/src/opacify.c
index dc6edb3..04dd202 100644
--- a/beryl-plugins/src/opacify.c
+++ b/beryl-plugins/src/opacify.c
@@ -711,6 +711,7 @@ CompPluginVTable opacifyVTable = {
"accessibility",
0,
0,
+ False,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/place.c b/beryl-plugins/src/place.c
index 019309d..a114d45 100644
--- a/beryl-plugins/src/place.c
+++ b/beryl-plugins/src/place.c
@@ -1321,6 +1321,7 @@ static CompPluginVTable placeVTable = {
"wm",
0,
0,
+ True,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/plane.c b/beryl-plugins/src/plane.c
index 23487cd..6e10610 100644
--- a/beryl-plugins/src/plane.c
+++ b/beryl-plugins/src/plane.c
@@ -1159,6 +1159,7 @@ CompPluginVTable planeVTable = {
"desktop",
0,
0,
+ False,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/png.c b/beryl-plugins/src/png.c
index a635e40..4ecc8a0 100644
--- a/beryl-plugins/src/png.c
+++ b/beryl-plugins/src/png.c
@@ -511,6 +511,7 @@ CompPluginVTable pngVTable = {
"imageformat",
0,
0,
+ True,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/put.c b/beryl-plugins/src/put.c
index c73e6a9..88037e2 100644
--- a/beryl-plugins/src/put.c
+++ b/beryl-plugins/src/put.c
@@ -2448,6 +2448,7 @@ CompPluginVTable putVTable = {
"wm",
0,
0,
+ False,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/resize.c b/beryl-plugins/src/resize.c
index 6abd6ec..92df567 100644
--- a/beryl-plugins/src/resize.c
+++ b/beryl-plugins/src/resize.c
@@ -1468,6 +1468,7 @@ CompPluginVTable resizeVTable = {
"wm",
0,
0,
+ True,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/rotate.c b/beryl-plugins/src/rotate.c
index a28594b..11d1ff7 100644
--- a/beryl-plugins/src/rotate.c
+++ b/beryl-plugins/src/rotate.c
@@ -2942,6 +2942,7 @@ CompPluginVTable rotateVTable = {
"desktop",
0,
0,
+ True,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/scale.c b/beryl-plugins/src/scale.c
index 785d872..c88cc9b 100644
--- a/beryl-plugins/src/scale.c
+++ b/beryl-plugins/src/scale.c
@@ -3349,6 +3349,7 @@ CompPluginVTable scaleVTable = {
"wm",
0,
0,
+ True,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/screenshot.c b/beryl-plugins/src/screenshot.c
index 4dce757..15b54ce 100644
--- a/beryl-plugins/src/screenshot.c
+++ b/beryl-plugins/src/screenshot.c
@@ -541,6 +541,7 @@ static CompPluginVTable shotVTable = {
"misc",
0,
0,
+ False,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/showdesktop.c b/beryl-plugins/src/showdesktop.c
index 60324d2..7244ba4 100644
--- a/beryl-plugins/src/showdesktop.c
+++ b/beryl-plugins/src/showdesktop.c
@@ -1198,6 +1198,7 @@ static CompPluginVTable showdesktopVTable = {
"desktop",
0,
0,
+ False,
};
/* send plugin info */
diff --git a/beryl-plugins/src/snow.c b/beryl-plugins/src/snow.c
index 7a619e9..c714b62 100644
--- a/beryl-plugins/src/snow.c
+++ b/beryl-plugins/src/snow.c
@@ -1068,6 +1068,7 @@ CompPluginVTable snowVTable = {
"misc",
0,
0,
+ False,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/splash.c b/beryl-plugins/src/splash.c
index 3d7b58c..b4860e3 100644
--- a/beryl-plugins/src/splash.c
+++ b/beryl-plugins/src/splash.c
@@ -935,6 +935,7 @@ CompPluginVTable splashVTable = {
"misc",
0,
0,
+ True,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/state.c b/beryl-plugins/src/state.c
index c51b2e0..bdf25de 100644
--- a/beryl-plugins/src/state.c
+++ b/beryl-plugins/src/state.c
@@ -1247,6 +1247,7 @@ static CompPluginVTable stateVTable = {
"wm",
0,
0,
+ False,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/svg.c b/beryl-plugins/src/svg.c
index 4bf08c9..11b0d25 100644
--- a/beryl-plugins/src/svg.c
+++ b/beryl-plugins/src/svg.c
@@ -234,6 +234,7 @@ CompPluginVTable svgVTable = {
"imageformat",
0,
0,
+ True,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/switcher.c b/beryl-plugins/src/switcher.c
index 355688c..5c0658e 100644
--- a/beryl-plugins/src/switcher.c
+++ b/beryl-plugins/src/switcher.c
@@ -2330,6 +2330,7 @@ CompPluginVTable switchVTable = {
"wm",
0,
0,
+ True,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/trailfocus.c b/beryl-plugins/src/trailfocus.c
index 5139ff2..2cca9dd 100644
--- a/beryl-plugins/src/trailfocus.c
+++ b/beryl-plugins/src/trailfocus.c
@@ -179,6 +179,7 @@ static CompPluginVTable trailFocusVTable = {
"effects",
0,
0,
+ False,
};
diff --git a/beryl-plugins/src/water.c b/beryl-plugins/src/water.c
index fb08482..819610f 100644
--- a/beryl-plugins/src/water.c
+++ b/beryl-plugins/src/water.c
@@ -2224,6 +2224,7 @@ static CompPluginVTable waterVTable = {
"misc",
0,
0,
+ True,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/wobbly.c b/beryl-plugins/src/wobbly.c
index 1c0ae8d..8437874 100644
--- a/beryl-plugins/src/wobbly.c
+++ b/beryl-plugins/src/wobbly.c
@@ -3650,6 +3650,7 @@ CompPluginVTable wobblyVTable = {
"effects",
0,
0,
+ True,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-plugins/src/zoom.c b/beryl-plugins/src/zoom.c
index 122c6a8..e66110a 100644
--- a/beryl-plugins/src/zoom.c
+++ b/beryl-plugins/src/zoom.c
@@ -1107,6 +1107,7 @@ CompPluginVTable zoomVTable = {
"accessibility",
0,
0,
+ False,
};
CompPluginVTable *getCompPluginInfo(void)
diff --git a/beryl-settings-2/main.py b/beryl-settings-2/main.py
index 15e4a2d..3d1f53f 100755
--- a/beryl-settings-2/main.py
+++ b/beryl-settings-2/main.py
@@ -17,7 +17,6 @@ CatImages = {"wm":"actions/window-new.svg",
Ctx = berylsettings.Context()
Ctx.Read()
-Aps = Ctx.Plugin("_").Setting("active_plugins")
hideshowall = None
@@ -35,7 +34,7 @@ def SetPluginsEnabled():
for Ca in AllCats:
for Pl in Ca[9]:
if (Pl[8]):
- Pl[8].props.active = Aps.Value.__contains__(Pl[4].Name)
+ Pl[8].props.active = Pl[4].Enabled
def SetWidgetsFromValues():
global AllowUpdate
@@ -87,7 +86,7 @@ def DelRow(plb,set):
SetSettingFromWidgets(set)
def addImageFilters(fil):
- for p in Aps.Value:
+ for p in Ctx.ActivePlugins:
for f in Ctx.Plugin(p).Provides:
if (f.split(':')[0]=='imageext'):
fil.add_pattern('*.'+f.split(':')[1])
@@ -156,16 +155,13 @@ def BrowseRow(plb,set):
SetSettingFromWidgets(set)
def chainDisablePlugin(plugin):
- for plg in Aps.Value:
+ for plg in Ctx.ActivePlugins:
pp = Ctx.Plugin(plg)
for pr in plugin.Provides:
if (pp.Requires.__contains__(pr)):
chainDisablePlugin(pp)
break
- if (Aps.Value.__contains__(plugin.Name)):
- ee = Aps.Value
- ee.remove(plugin.Name)
- Aps.Value = ee
+ plugin.Enabled=False
def satisfyDeps(feature):
#returns list of plugins that provide feature
@@ -178,7 +174,7 @@ def satisfyDeps(feature):
def tryEnablePlugin(plugin):
#first make sure it doesn't conflict
for s in plugin.Provides:
- for p in Aps.Value:
+ for p in Ctx.ActivePlugins:
if (Ctx.Plugin(p).Provides.__contains__(s)):
msg = "Can't enable plugin <b>%s</b> because it\nprovides feature <i>%s</i> which is also\nprovided by enabled plugin <b>%s</b>."%(plugin.ShortDesc,s,Ctx.Plugin(p).ShortDesc)
dlg = gtk.Dialog("Can't Enable Plugin",MainWindow,gtk.DIALOG_MODAL,("Disable Conflicting Plugin",gtk.RESPONSE_OK,gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL))
@@ -202,7 +198,7 @@ def tryEnablePlugin(plugin):
needs = []
for s in plugin.Requires:
noneed = False
- for p in Aps.Value:
+ for p in Ctx.ActivePlugins:
if Ctx.Plugin(p).Provides.__contains__(s):
noneed = True
break
@@ -239,11 +235,8 @@ def tryEnablePlugin(plugin):
return
if not tryEnablePlugin(dep[v]):
return False
- if not Aps.Value.__contains__(plugin.Name):
- ee = Aps.Value
- ee = ee+[plugin.Name]
- Aps.Value = ee
- return True
+ plugin.Enabled=True
+ return True
def PluginButtonClicked(plb,pld):
global hideshowall
@@ -320,7 +313,7 @@ def trySetBinding(set,typ,val):
for n in cfl[0][1]:
if (n.Plugin.Name == '_'):
continue
- if (Aps.Value.__contains__(n.Plugin.Name)):
+ if (n.Plugin.Enabled):
continue
cfl[0][1].remove(n)
for n in cfl[0][1]:
@@ -489,7 +482,7 @@ def UpdateBindingsList(ShowHidden):
if (EdgeBoxes[row][col][0]):
EdgeBoxes[row][col][0].set_active_iter(Iter)
for p in s:
- if (not (ShowHidden or Aps.Value.__contains__(p.Name) or p.Name == '_')):
+ if (not (ShowHidden or p.Enabled or p.Name == '_')):
continue
hasany = False
for q in p.Settings:
@@ -519,7 +512,7 @@ def UpdateBindingsList(ShowHidden):
s[p] = s[q]
s[q] = nn
for p in s:
- if (not (ShowHidden or Aps.Value.__contains__(p.Name) or p.Name == '_')):
+ if (not (ShowHidden or p.Enabled or p.Name == '_')):
continue
hasany = False
for m in p.Settings:
diff --git a/beryl-settings-bindings/python/berylsettings.pyx b/beryl-settings-bindings/python/berylsettings.pyx
index 9f84e01..250dc94 100644
--- a/beryl-settings-bindings/python/berylsettings.pyx
+++ b/beryl-settings-bindings/python/berylsettings.pyx
@@ -257,9 +257,15 @@ cdef extern GSList * beryl_setting_conflict_get_settings(BerylSettingConflict *
cdef extern GSList * beryl_settings_context_find_conflicts(BerylSettingsContext * context, BerylSettingConflictType type)
cdef extern GSList * beryl_settings_context_find_conflicts_for_setting(BerylSettingsContext * context, BerylSetting * setting, BerylSettingConflictType type)
cdef extern void beryl_settings_free_conflict_list(GSList * list)
+
+cdef extern GSList * beryl_settings_context_get_active_plugins(BerylSettingsContext * context)
+cdef extern gboolean beryl_settings_plugin_enable(BerylSettingsPlugin * plugin)
+cdef extern gboolean beryl_settings_plugin_disable(BerylSettingsPlugin * plugin)
+cdef extern gboolean beryl_settings_plugin_get_is_enabled(BerylSettingsPlugin * plugin)
#endif
#glib
+cdef extern void g_slist_free(GSList * l)
#X11
cdef extern char * XKeysymToString (int keysym)
@@ -320,6 +326,21 @@ def edgetolist(edge):
def send_reload():
beryl_settings_send_reload_signal()
+class PluginSetEnabledException(Exception):
+ def __init__(self,plugin,type):
+ self.plugin=str(plugin)
+ self.type=str(type)
+ def __str__(self):
+ return repr('Could not %s %s, dependencies not met.'%(self.type,self.plugin))
+
+class PluginEnableException(PluginSetEnabledException):
+ def __init__(self,plugin):
+ PluginSetEnabledException.__init__(self,plugin,"enable")
+
+class PluginDisableException(PluginSetEnabledException):
+ def __init__(self,plugin):
+ PluginSetEnabledException.__init__(self,plugin,"disable")
+
class NotFoundException(Exception):
def __init__(self,type,value,owner):
self.value=str(value)
@@ -421,6 +442,23 @@ cdef class Context:
else:
b=False
beryl_settings_context_set_de_integration_enabled(self.myContext,b)
+
+ property ActivePlugins:
+ def __get__(self):
+ cdef GSList * l
+ cdef GSList * m
+ cdef gchar * s
+ ret=[]
+ l = beryl_settings_context_get_active_plugins(self.myContext)
+ m = l
+ while(m!=NULL):
+ s=beryl_settings_plugin_get_name(<BerylSettingsPlugin *>m.data)
+ if (s==NULL):
+ s='_'
+ ret=ret+[s]
+ m=m.next
+ g_slist_free(l)
+ return ret
def EdgeOwner(self,edge):
cdef BerylSettingsPlugin * p
@@ -542,6 +580,28 @@ cdef class Plugin:
if (self.myPlugin==NULL):
raise PluginNotFoundException,(plugin,context)
+ property Enabled:
+ def __get__(self):
+ if (self.is_general):
+ return True
+ else:
+ if beryl_settings_plugin_get_is_enabled(self.myPlugin):
+ return True
+ else:
+ return False
+ def __set__(self,val):
+ if (self.is_general):
+ return
+ else:
+ if val:
+ if not beryl_settings_plugin_enable(self.myPlugin):
+ beryl_settings_plugin_disable(self.myPlugin)
+ raise PluginEnableException,(self)
+ else:
+ if not beryl_settings_plugin_disable(self.myPlugin):
+ beryl_settings_plugin_enable(self.myPlugin)
+ raise PluginDisableException,(self)
+
property Name:
def __get__(self):
if (self.is_general==0):