]> Dogcows Code - chaz/openbox/blobdiff - openbox/engine.c
move config option loading for the kernel into config.c/h
[chaz/openbox] / openbox / engine.c
index 0ede97ff2f900869a70f4d3d23246bcab4ce7db9..53e10debebf80701741ae03f7cba282a43e2063e 100644 (file)
@@ -1,4 +1,5 @@
 #include "engine.h"
+#include "config.h"
 
 #include <glib.h>
 #include <gmodule.h>
@@ -6,13 +7,20 @@
 #  include <stdlib.h>
 #endif
 
-char *engine_name = NULL;
-char *engine_theme = NULL;
-char *engine_layout = "NDSLIMC";
-char *engine_font = "Sans-7";
-gboolean engine_shadow = FALSE;
-int engine_shadow_offset = 1;
-int engine_shadow_tint = 25;
+EngineFrameNew *engine_frame_new;
+EngineFrameGrabClient *engine_frame_grab_client;
+EngineFrameReleaseClient *engine_frame_release_client;
+EngineFrameAdjustArea *engine_frame_adjust_area;
+EngineFrameAdjustShape *engine_frame_adjust_shape;
+EngineFrameAdjustState *engine_frame_adjust_state;
+EngineFrameAdjustFocus *engine_frame_adjust_focus;
+EngineFrameAdjustTitle *engine_frame_adjust_title;
+EngineFrameAdjustIcon *engine_frame_adjust_icon;
+EngineFrameShow *engine_frame_show;
+EngineFrameHide *engine_frame_hide;
+EngineGetContext *engine_get_context;
+EngineRenderLabel *engine_render_label;
+EngineSizeLabel *engine_size_label;
 
 static GModule *module = NULL;
 static EngineStartup *estartup = NULL;
@@ -30,19 +38,21 @@ static gboolean load(char *name)
 
     g_assert(module == NULL);
 
-    path = g_build_filename(ENGINEDIR, name, NULL);
+    path = g_build_filename(g_get_home_dir(), ".openbox", "engines", name,
+                            NULL);
     module = g_module_open(path, 0);
     g_free(path);
 
     if (module == NULL) {
-       path = g_build_filename(g_get_home_dir(), ".openbox", "engines", name,
-                               NULL);
-       module = g_module_open(path, 0);
-       g_free(path);
+        path = g_build_filename(ENGINEDIR, name, NULL);
+        module = g_module_open(path, 0);
+        g_free(path);
     }
 
-    if (module == NULL)
+    if (module == NULL) {
+        g_warning(g_module_error());
        return FALSE;
+    }
 
     /* load the engine's symbols */
     LOADSYM(startup, estartup);
@@ -59,6 +69,8 @@ static gboolean load(char *name)
     LOADSYM(frame_show, engine_frame_show);
     LOADSYM(frame_hide, engine_frame_hide);
     LOADSYM(get_context, engine_get_context);
+    LOADSYM(render_label, engine_render_label);
+    LOADSYM(size_label, engine_size_label);
 
     if (!estartup())
        return FALSE;
@@ -73,10 +85,14 @@ void engine_startup()
 
 void engine_load()
 {
-    if (load(engine_name))
+    if (load(config_engine_name))
         return;
-    g_warning("Failed to load the engine '%s'", engine_name);
+    g_warning("Failed to load the engine '%s'", config_engine_name);
     g_message("Falling back to the default: '%s'", DEFAULT_ENGINE);
+    if (module != NULL) {
+       g_module_close(module);
+        module = NULL;
+    }
     if (!load(DEFAULT_ENGINE)) {
        g_critical("Failed to load the engine '%s'. Aborting", DEFAULT_ENGINE);
        exit(1);
@@ -85,7 +101,6 @@ void engine_load()
 
 void engine_shutdown()
 {
-    g_free(engine_name);
     if (module != NULL) {
        eshutdown();
        g_module_close(module);
This page took 0.02303 seconds and 4 git commands to generate.