X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fconfig.c;h=6282bf85d8f6001a909b8032f33f385c26f5746a;hb=51bc793e046c036fdeea3a9cad834c13fda2832f;hp=109b2150565019374ef40354e716e9364d55abe8;hpb=163950b23bf796a39870044417ca54d667b6b470;p=chaz%2Fopenbox diff --git a/openbox/config.c b/openbox/config.c index 109b2150..6282bf85 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -22,6 +22,7 @@ #include "mouse.h" #include "actions.h" #include "translate.h" +#include "hooks.h" #include "client.h" #include "screen.h" #include "openbox.h" @@ -43,6 +44,7 @@ StrutPartial config_margins; gchar *config_theme; gboolean config_theme_keepborder; +guint config_theme_window_list_icon_size; gchar *config_title_layout; @@ -342,6 +344,47 @@ static void parse_per_app_settings(xmlNodePtr node, gpointer d) } } +static void parse_hook(xmlNodePtr node, gpointer d) +{ + gchar *name; + ObHook hook; + xmlNodePtr n; + + + if (!obt_parse_attr_string(node, "name", &name)) { + g_message(_("Hook in config file is missing a name")); + return; + } + + hook = hooks_hook_from_name(name); + if (!hook) + g_message(_("Unknown hook \"%s\" in config file"), name); + else { + if ((n = obt_parse_find_node(node->children, "action"))) + while (n) { + ObActionsAct *action; + + action = actions_parse(n); + if (action) + hooks_add(hook, action); + n = obt_parse_find_node(n->next, "action"); + } + } + + g_free(name); +} + +static void parse_hooks(xmlNodePtr node, gpointer d) +{ + xmlNodePtr n; + + if ((n = obt_parse_find_node(node->children, "hook"))) + while (n) { + parse_hook(n, NULL); + n = obt_parse_find_node(n->next, "hook"); + } +} + /* @@ -560,6 +603,13 @@ static void parse_theme(xmlNodePtr node, gpointer d) config_theme_keepborder = obt_parse_node_bool(n); if ((n = obt_parse_find_node(node, "animateIconify"))) config_animate_iconify = obt_parse_node_bool(n); + if ((n = obt_parse_find_node(node, "windowListIconSize"))) { + config_theme_window_list_icon_size = obt_parse_node_int(n); + if (config_theme_window_list_icon_size < 16) + config_theme_window_list_icon_size = 16; + else if (config_theme_window_list_icon_size > 96) + config_theme_window_list_icon_size = 96; + } n = obt_parse_find_node(node, "font"); while (n) { @@ -920,6 +970,7 @@ void config_startup(ObtParseInst *i) config_animate_iconify = TRUE; config_title_layout = g_strdup("NLIMC"); config_theme_keepborder = TRUE; + config_theme_window_list_icon_size = 36; config_font_activewindow = NULL; config_font_inactivewindow = NULL; @@ -987,6 +1038,8 @@ void config_startup(ObtParseInst *i) obt_parse_register(i, "menu", parse_menu, NULL); + obt_parse_register(i, "hooks", parse_hooks, NULL); + config_per_app_settings = NULL; obt_parse_register(i, "applications", parse_per_app_settings, NULL);