2003-04-08 07:31:26 +00:00
|
|
|
#include "config.h"
|
2003-05-24 21:47:06 +00:00
|
|
|
#include "parser/parse.h"
|
2003-04-08 07:31:26 +00:00
|
|
|
|
|
|
|
gboolean config_focus_new;
|
|
|
|
gboolean config_focus_follow;
|
|
|
|
gboolean config_focus_last;
|
|
|
|
gboolean config_focus_last_on_desktop;
|
2003-05-09 16:57:17 +00:00
|
|
|
gboolean config_focus_popup;
|
2003-04-08 07:31:26 +00:00
|
|
|
|
2003-04-13 07:27:21 +00:00
|
|
|
char *config_theme;
|
2003-04-08 07:31:26 +00:00
|
|
|
|
2003-07-30 16:25:08 +00:00
|
|
|
gchar *config_title_layout;
|
|
|
|
|
2003-05-16 18:10:10 +00:00
|
|
|
int config_desktops_num;
|
2003-04-08 07:31:26 +00:00
|
|
|
GSList *config_desktops_names;
|
|
|
|
|
2003-08-03 17:47:10 +00:00
|
|
|
gboolean config_redraw_resize;
|
2003-05-11 23:57:56 +00:00
|
|
|
|
2003-07-10 17:03:05 +00:00
|
|
|
ObStackingLayer config_dock_layer;
|
|
|
|
gboolean config_dock_floating;
|
|
|
|
ObDirection config_dock_pos;
|
|
|
|
gint config_dock_x;
|
|
|
|
gint config_dock_y;
|
|
|
|
ObOrientation config_dock_orient;
|
|
|
|
gboolean config_dock_hide;
|
|
|
|
guint config_dock_hide_timeout;
|
2003-05-16 18:10:10 +00:00
|
|
|
|
2003-05-24 15:35:26 +00:00
|
|
|
static void parse_focus(xmlDocPtr doc, xmlNodePtr node, void *d)
|
2003-04-08 07:31:26 +00:00
|
|
|
{
|
2003-05-24 15:35:26 +00:00
|
|
|
xmlNodePtr n;
|
|
|
|
|
2003-07-23 01:45:44 +00:00
|
|
|
node = node->xmlChildrenNode;
|
|
|
|
|
2003-05-24 15:35:26 +00:00
|
|
|
if ((n = parse_find_node("focusNew", node)))
|
|
|
|
config_focus_new = parse_bool(doc, n);
|
|
|
|
if ((n = parse_find_node("followMouse", node)))
|
|
|
|
config_focus_follow = parse_bool(doc, n);
|
|
|
|
if ((n = parse_find_node("focusLast", node)))
|
|
|
|
config_focus_last = parse_bool(doc, n);
|
|
|
|
if ((n = parse_find_node("focusLastOnDesktop", node)))
|
|
|
|
config_focus_last_on_desktop = parse_bool(doc, n);
|
|
|
|
if ((n = parse_find_node("cyclingDialog", node)))
|
|
|
|
config_focus_popup = parse_bool(doc, n);
|
2003-04-08 07:31:26 +00:00
|
|
|
}
|
|
|
|
|
2003-05-24 15:35:26 +00:00
|
|
|
static void parse_theme(xmlDocPtr doc, xmlNodePtr node, void *d)
|
2003-04-08 07:31:26 +00:00
|
|
|
{
|
2003-05-24 15:35:26 +00:00
|
|
|
xmlNodePtr n;
|
|
|
|
|
2003-07-23 01:45:44 +00:00
|
|
|
node = node->xmlChildrenNode;
|
|
|
|
|
2003-05-24 15:35:26 +00:00
|
|
|
if ((n = parse_find_node("theme", node))) {
|
|
|
|
g_free(config_theme);
|
|
|
|
config_theme = parse_string(doc, n);
|
|
|
|
}
|
2003-07-30 16:25:08 +00:00
|
|
|
if ((n = parse_find_node("titlelayout", node))) {
|
|
|
|
g_free(config_title_layout);
|
|
|
|
config_title_layout = parse_string(doc, n);
|
|
|
|
}
|
2003-04-08 07:31:26 +00:00
|
|
|
}
|
|
|
|
|
2003-05-24 15:35:26 +00:00
|
|
|
static void parse_desktops(xmlDocPtr doc, xmlNodePtr node, void *d)
|
2003-04-08 07:31:26 +00:00
|
|
|
{
|
2003-05-24 15:35:26 +00:00
|
|
|
xmlNodePtr n;
|
|
|
|
|
2003-07-23 01:45:44 +00:00
|
|
|
node = node->xmlChildrenNode;
|
|
|
|
|
2003-05-24 15:35:26 +00:00
|
|
|
if ((n = parse_find_node("number", node)))
|
|
|
|
config_desktops_num = parse_int(doc, n);
|
|
|
|
if ((n = parse_find_node("names", node))) {
|
|
|
|
GSList *it;
|
|
|
|
xmlNodePtr nname;
|
|
|
|
|
|
|
|
for (it = config_desktops_names; it; it = it->next)
|
|
|
|
g_free(it->data);
|
|
|
|
g_slist_free(config_desktops_names);
|
|
|
|
config_desktops_names = NULL;
|
|
|
|
|
|
|
|
nname = parse_find_node("name", n->xmlChildrenNode);
|
|
|
|
while (nname) {
|
|
|
|
config_desktops_names = g_slist_append(config_desktops_names,
|
|
|
|
parse_string(doc, nname));
|
|
|
|
nname = parse_find_node("name", nname->next);
|
|
|
|
}
|
|
|
|
}
|
2003-04-08 07:31:26 +00:00
|
|
|
}
|
|
|
|
|
2003-08-03 17:47:10 +00:00
|
|
|
static void parse_resize(xmlDocPtr doc, xmlNodePtr node, void *d)
|
2003-05-11 23:57:56 +00:00
|
|
|
{
|
2003-05-24 15:35:26 +00:00
|
|
|
xmlNodePtr n;
|
|
|
|
|
2003-07-23 01:45:44 +00:00
|
|
|
node = node->xmlChildrenNode;
|
|
|
|
|
2003-08-03 17:47:10 +00:00
|
|
|
if ((n = parse_find_node("drawContents", node)))
|
|
|
|
config_redraw_resize = parse_bool(doc, n);
|
2003-05-11 23:57:56 +00:00
|
|
|
}
|
|
|
|
|
2003-05-24 15:35:26 +00:00
|
|
|
static void parse_dock(xmlDocPtr doc, xmlNodePtr node, void *d)
|
2003-05-16 18:10:10 +00:00
|
|
|
{
|
2003-05-24 15:35:26 +00:00
|
|
|
xmlNodePtr n;
|
|
|
|
|
2003-07-23 01:45:44 +00:00
|
|
|
node = node->xmlChildrenNode;
|
|
|
|
|
2003-05-24 15:35:26 +00:00
|
|
|
if ((n = parse_find_node("position", node))) {
|
|
|
|
if (parse_contains("TopLeft", doc, n))
|
2003-07-10 16:29:40 +00:00
|
|
|
config_dock_floating = FALSE,
|
|
|
|
config_dock_pos = OB_DIRECTION_NORTHWEST;
|
2003-05-24 15:35:26 +00:00
|
|
|
else if (parse_contains("Top", doc, n))
|
2003-07-10 16:29:40 +00:00
|
|
|
config_dock_floating = FALSE,
|
|
|
|
config_dock_pos = OB_DIRECTION_NORTH;
|
2003-05-24 15:35:26 +00:00
|
|
|
else if (parse_contains("TopRight", doc, n))
|
2003-07-10 16:29:40 +00:00
|
|
|
config_dock_floating = FALSE,
|
|
|
|
config_dock_pos = OB_DIRECTION_NORTHEAST;
|
2003-05-24 15:35:26 +00:00
|
|
|
else if (parse_contains("Right", doc, n))
|
2003-07-10 16:29:40 +00:00
|
|
|
config_dock_floating = FALSE,
|
|
|
|
config_dock_pos = OB_DIRECTION_EAST;
|
2003-05-24 15:35:26 +00:00
|
|
|
else if (parse_contains("BottomRight", doc, n))
|
2003-07-10 16:29:40 +00:00
|
|
|
config_dock_floating = FALSE,
|
|
|
|
config_dock_pos = OB_DIRECTION_SOUTHEAST;
|
2003-05-24 15:35:26 +00:00
|
|
|
else if (parse_contains("Bottom", doc, n))
|
2003-07-10 16:29:40 +00:00
|
|
|
config_dock_floating = FALSE,
|
|
|
|
config_dock_pos = OB_DIRECTION_SOUTH;
|
2003-05-24 15:35:26 +00:00
|
|
|
else if (parse_contains("BottomLeft", doc, n))
|
2003-07-10 16:29:40 +00:00
|
|
|
config_dock_floating = FALSE,
|
|
|
|
config_dock_pos = OB_DIRECTION_SOUTHWEST;
|
2003-05-24 15:35:26 +00:00
|
|
|
else if (parse_contains("Left", doc, n))
|
2003-07-10 16:29:40 +00:00
|
|
|
config_dock_floating = FALSE,
|
|
|
|
config_dock_pos = OB_DIRECTION_WEST;
|
2003-05-24 15:35:26 +00:00
|
|
|
else if (parse_contains("Floating", doc, n))
|
2003-07-10 16:29:40 +00:00
|
|
|
config_dock_floating = TRUE;
|
2003-05-24 15:35:26 +00:00
|
|
|
}
|
2003-07-10 16:29:40 +00:00
|
|
|
if (config_dock_floating) {
|
2003-05-24 15:35:26 +00:00
|
|
|
if ((n = parse_find_node("floatingX", node)))
|
|
|
|
config_dock_x = parse_int(doc, n);
|
|
|
|
if ((n = parse_find_node("floatingY", node)))
|
|
|
|
config_dock_y = parse_int(doc, n);
|
|
|
|
}
|
|
|
|
if ((n = parse_find_node("stacking", node))) {
|
|
|
|
if (parse_contains("top", doc, n))
|
2003-07-10 17:03:05 +00:00
|
|
|
config_dock_layer = OB_STACKING_LAYER_TOP;
|
2003-05-24 15:35:26 +00:00
|
|
|
else if (parse_contains("normal", doc, n))
|
2003-07-10 17:03:05 +00:00
|
|
|
config_dock_layer = OB_STACKING_LAYER_NORMAL;
|
2003-05-24 15:35:26 +00:00
|
|
|
else if (parse_contains("bottom", doc, n))
|
2003-07-10 17:03:05 +00:00
|
|
|
config_dock_layer = OB_STACKING_LAYER_BELOW;
|
2003-05-24 15:35:26 +00:00
|
|
|
}
|
|
|
|
if ((n = parse_find_node("direction", node))) {
|
|
|
|
if (parse_contains("horizontal", doc, n))
|
2003-07-10 16:38:45 +00:00
|
|
|
config_dock_orient = OB_ORIENTATION_HORZ;
|
2003-05-24 15:35:26 +00:00
|
|
|
else if (parse_contains("vertical", doc, n))
|
2003-07-10 16:38:45 +00:00
|
|
|
config_dock_orient = OB_ORIENTATION_VERT;
|
2003-05-24 15:35:26 +00:00
|
|
|
}
|
|
|
|
if ((n = parse_find_node("autoHide", node)))
|
|
|
|
config_dock_hide = parse_bool(doc, n);
|
|
|
|
if ((n = parse_find_node("hideTimeout", node)))
|
|
|
|
config_dock_hide_timeout = parse_int(doc, n);
|
2003-05-16 18:10:10 +00:00
|
|
|
}
|
|
|
|
|
2003-04-08 07:31:26 +00:00
|
|
|
void config_startup()
|
|
|
|
{
|
|
|
|
config_focus_new = TRUE;
|
|
|
|
config_focus_follow = FALSE;
|
|
|
|
config_focus_last = TRUE;
|
|
|
|
config_focus_last_on_desktop = TRUE;
|
2003-05-09 16:57:17 +00:00
|
|
|
config_focus_popup = TRUE;
|
2003-04-08 07:31:26 +00:00
|
|
|
|
2003-05-24 15:35:26 +00:00
|
|
|
parse_register("focus", parse_focus, NULL);
|
2003-04-08 07:31:26 +00:00
|
|
|
|
2003-04-13 07:27:21 +00:00
|
|
|
config_theme = NULL;
|
2003-04-08 07:31:26 +00:00
|
|
|
|
2003-07-30 16:25:08 +00:00
|
|
|
config_title_layout = g_strdup("NLIMC");
|
|
|
|
|
2003-05-24 15:35:26 +00:00
|
|
|
parse_register("theme", parse_theme, NULL);
|
2003-04-08 07:31:26 +00:00
|
|
|
|
|
|
|
config_desktops_num = 4;
|
|
|
|
config_desktops_names = NULL;
|
|
|
|
|
2003-05-24 15:35:26 +00:00
|
|
|
parse_register("desktops", parse_desktops, NULL);
|
2003-05-11 23:57:56 +00:00
|
|
|
|
2003-08-03 17:47:10 +00:00
|
|
|
config_redraw_resize = TRUE;
|
2003-05-11 23:57:56 +00:00
|
|
|
|
2003-08-03 17:47:10 +00:00
|
|
|
parse_register("resize", parse_resize, NULL);
|
2003-05-16 18:10:10 +00:00
|
|
|
|
2003-07-10 17:03:05 +00:00
|
|
|
config_dock_layer = OB_STACKING_LAYER_TOP;
|
2003-07-10 16:29:40 +00:00
|
|
|
config_dock_pos = OB_DIRECTION_NORTHEAST;
|
|
|
|
config_dock_floating = FALSE;
|
2003-05-16 18:10:10 +00:00
|
|
|
config_dock_x = 0;
|
|
|
|
config_dock_y = 0;
|
2003-07-10 16:38:45 +00:00
|
|
|
config_dock_orient = OB_ORIENTATION_VERT;
|
2003-05-16 18:10:10 +00:00
|
|
|
config_dock_hide = FALSE;
|
|
|
|
config_dock_hide_timeout = 3000;
|
|
|
|
|
2003-05-24 15:35:26 +00:00
|
|
|
parse_register("dock", parse_dock, NULL);
|
2003-04-08 07:31:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void config_shutdown()
|
|
|
|
{
|
|
|
|
GSList *it;
|
|
|
|
|
2003-04-13 07:27:21 +00:00
|
|
|
g_free(config_theme);
|
2003-04-08 07:31:26 +00:00
|
|
|
|
|
|
|
for (it = config_desktops_names; it; it = it->next)
|
|
|
|
g_free(it->data);
|
|
|
|
g_slist_free(config_desktops_names);
|
|
|
|
}
|