summaryrefslogtreecommitdiff
path: root/openbox
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-03-22 23:26:43 +0000
committerDana Jansens <danakj@orodu.net>2003-03-22 23:26:43 +0000
commit5bf68f762b8fc87cf5583b645b948b4fe55f179f (patch)
tree9fd2db21c6fe08bc9433574dc429744f2966a79b /openbox
parent4cc0d9b72d4bb084e6736c60319fd8e2ab92ef6a (diff)
make the openbox engine use the new config shit instead of the themerc shit.
order te startup so that plugins can set up their config shit before parsing the config, then the config is parsed, engine is loaded, and finally the plugins are officially started.
Diffstat (limited to 'openbox')
-rw-r--r--openbox/config.c6
-rw-r--r--openbox/engine.c3
-rw-r--r--openbox/openbox.c19
-rw-r--r--openbox/plugin.c48
-rw-r--r--openbox/plugin.h3
5 files changed, 63 insertions, 16 deletions
diff --git a/openbox/config.c b/openbox/config.c
index b9c24ded..0f6be9a3 100644
--- a/openbox/config.c
+++ b/openbox/config.c
@@ -27,8 +27,8 @@ void config_startup()
config_def_set(config_def_new("engine", Config_String));
config_def_set(config_def_new("theme", Config_String));
config_def_set(config_def_new("font", Config_String));
+ config_def_set(config_def_new("font.shadow", Config_Integer));
config_def_set(config_def_new("font.shadow.offset", Config_Integer));
- config_def_set(config_def_new("font.shadow.tint", Config_Integer));
config_def_set(config_def_new("titlebar.layout", Config_String));
/*g_datalist_foreach(&config_def, print_config, NULL);*/
@@ -54,15 +54,15 @@ void config_parse()
load = TRUE;
}
g_free(path);
- g_free(path);
if (!load) {
/* load the system wide rc */
path = g_build_filename(RCDIR, "rc3", NULL);
if ((file = fopen(path, "r")) != NULL) {
- cparse_go(path, file);
+ /*cparse_go(path, file);*/
fclose(file);
}
+ g_free(path);
}
}
diff --git a/openbox/engine.c b/openbox/engine.c
index c4e24a39..c654d263 100644
--- a/openbox/engine.c
+++ b/openbox/engine.c
@@ -64,9 +64,8 @@ void engine_startup()
ConfigValue engine;
module = NULL;
- g_message("ENGINE STARTUP");
+
if (config_get("engine", Config_String, &engine)) {
- g_warning("GOT ENGINE %s", engine.string);
if (load(engine.string))
return;
g_warning("Failed to load the engine '%s'", engine.string);
diff --git a/openbox/openbox.c b/openbox/openbox.c
index b32977b1..6645f5bb 100644
--- a/openbox/openbox.c
+++ b/openbox/openbox.c
@@ -147,23 +147,22 @@ int main(int argc, char **argv)
config_startup();
render_startup();
font_startup();
- themerc_startup();
+ plugin_startup();
+
+ /* load the plugins specified in the pluginrc */
+ plugin_loadall();
+ /* parse/load user options */
+ config_parse();
+
engine_startup();
event_startup();
screen_startup();
focus_startup();
client_startup();
grab_startup();
- plugin_startup();
-
- /* XXX load all plugins!! */
- plugin_open("focus");
- plugin_open("keyboard");
- plugin_open("mouse");
- plugin_open("placement");
- plugin_open("resistance");
- config_parse();
+ /* call startup for all the plugins */
+ plugin_startall();
/* get all the existing windows */
client_manage_all();
diff --git a/openbox/plugin.c b/openbox/plugin.c
index a8556fc7..e0067f22 100644
--- a/openbox/plugin.c
+++ b/openbox/plugin.c
@@ -94,9 +94,9 @@ gboolean plugin_open(char *name)
g_warning("failed to load plugin '%s'", name);
return FALSE;
}
+ /* XXX p->plugin_set_config(); */
g_datalist_set_data_full(&plugins, name, p, (GDestroyNotify) plugin_free);
- p->startup();
return TRUE;
}
@@ -104,3 +104,49 @@ void plugin_close(char *name)
{
g_datalist_remove_data(&plugins, name);
}
+
+static void foreach_start(GQuark key, Plugin *p, gpointer *foo)
+{
+ p->startup();
+}
+
+void plugin_startall()
+{
+ g_datalist_foreach(&plugins, (GDataForeachFunc)foreach_start, NULL);
+}
+
+void plugin_loadall()
+{
+ GIOChannel *io;
+ GError *err;
+ char *path, *name;
+
+ path = g_build_filename(g_get_home_dir(), ".openbox", "pluginrc", NULL);
+ err = NULL;
+ io = g_io_channel_new_file(path, "r", &err);
+ g_free(path);
+
+ if (io == NULL) {
+ path = g_build_filename(RCDIR, "pluginrc", NULL);
+ err = NULL;
+ io = g_io_channel_new_file(path, "r", &err);
+ g_free(path);
+ }
+
+ if (io == NULL) {
+ /* load the default plugins */
+ plugin_open("focus");
+ plugin_open("keyboard");
+ plugin_open("mouse");
+ plugin_open("placement");
+ plugin_open("resistance");
+ } else {
+ /* load the plugins in the rc file */
+ while (g_io_channel_read_line(io, &name, NULL, NULL, &err) ==
+ G_IO_STATUS_NORMAL) {
+ plugin_open(name);
+ g_free(name);
+ }
+ g_io_channel_unref(io);
+ }
+}
diff --git a/openbox/plugin.h b/openbox/plugin.h
index d5cb2f6f..8595fbac 100644
--- a/openbox/plugin.h
+++ b/openbox/plugin.h
@@ -4,6 +4,9 @@
void plugin_startup();
void plugin_shutdown();
+void plugin_loadall();
+void plugin_startall();
+
gboolean plugin_open(char *name);
void plugin_close(char *name);