From: Dana Jansens Date: Sun, 23 Mar 2003 16:19:15 +0000 (+0000) Subject: rm the themerc stuff X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=39946832001bd205f764a36fbdae17bc53d1fb35;p=chaz%2Fopenbox rm the themerc stuff --- diff --git a/openbox/openbox.c b/openbox/openbox.c index 6645f5bb..46e6a864 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -11,7 +11,6 @@ #include "config.h" #include "grab.h" #include "engine.h" -#include "themerc.h" #include "plugin.h" #include "timer.h" #include "../render/render.h" @@ -181,7 +180,6 @@ int main(int argc, char **argv) screen_shutdown(); event_shutdown(); engine_shutdown(); - themerc_shutdown(); render_shutdown(); config_shutdown(); timer_shutdown(); diff --git a/openbox/themerc.c b/openbox/themerc.c deleted file mode 100644 index bcc669e5..00000000 --- a/openbox/themerc.c +++ /dev/null @@ -1,156 +0,0 @@ -#include -#ifdef HAVE_STRING_H -# include -#endif - -char *themerc_engine; -char *themerc_theme; -char *themerc_font; -char *themerc_titlebar_layout; - -GError *error; - -static void parse(char *path, int fd) -{ - GScanner *scanner; - - scanner = g_scanner_new(NULL); - g_scanner_input_file(scanner, fd); - - while (g_scanner_get_next_token(scanner) != G_TOKEN_EOF) { - char *name, *val; - - if (scanner->token != G_TOKEN_IDENTIFIER) { - g_scanner_unexp_token(scanner, scanner->token, NULL, NULL, NULL, - NULL, TRUE); - return; - } - name = g_strdup(scanner->value.v_identifier); - - g_scanner_get_next_token(scanner); - if (scanner->token != G_TOKEN_EQUAL_SIGN) { - g_scanner_unexp_token(scanner, scanner->token, NULL, NULL, NULL, - NULL, TRUE); - g_free(name); - return; - } - - g_scanner_get_next_token(scanner); - if (scanner->token == G_TOKEN_STRING) { - val = g_strdup(scanner->value.v_identifier); - - if (!g_ascii_strcasecmp(name, "engine")) { - if (themerc_engine != NULL) { - g_warning("%s:%d: '%s' already defined", path, - scanner->line, name); - g_free(name); - g_free(val); - } else - themerc_engine = val; - } else if (!g_ascii_strcasecmp(name, "theme")) { - if (themerc_theme != NULL) { - g_warning("%s:%d: '%s' already defined", path, - scanner->line, name); - g_free(name); - g_free(val); - } else - themerc_theme = val; - } else if (!g_ascii_strcasecmp(name, "font")) { - if (themerc_font != NULL) { - g_warning("%s:%d: '%s' already defined", path, - scanner->line, name); - g_free(name); - g_free(val); - } else - themerc_font = val; - } else if (!g_ascii_strcasecmp(name, "titlebarlayout")) { - if (themerc_titlebar_layout != NULL) { - g_warning("%s:%d: '%s' already defined", path, - scanner->line, name); - g_free(name); - g_free(val); - } else { - char *lowval = g_ascii_strup(val, -1); - int i, len = strlen(lowval); - g_free(val); - for (i = 0; i < len; ++i) { - gboolean valid = FALSE; - switch(lowval[i]) { - case 'I': - case 'L': - case 'M': - case 'C': - case 'N': - case 'D': - valid = TRUE; - } - if (!valid) { - g_warning("%s:%d: invalid titlebarlayout element " - "'%c'", path, scanner->line, lowval[i]); - break; - } - } - if (i == len) - themerc_titlebar_layout = lowval; - else { - g_free(name); - g_free(val); - } - } - } else { - g_warning("%s:%d: invalid option '%s'", path, - scanner->line, name); - g_free(name); - g_free(val); - } - } else { - g_scanner_unexp_token(scanner, scanner->token, NULL, NULL, NULL, - NULL, TRUE); - g_free(name); - return; - } - } -} - -void themerc_startup() -{ - GIOChannel *chan = NULL; - char *path = NULL; - - /* defaults */ - themerc_engine = NULL; - themerc_theme = NULL; - themerc_font = NULL; - themerc_titlebar_layout = NULL; - - path = g_build_filename(g_get_home_dir(), ".openbox", "themerc", NULL); - error = NULL; - chan = g_io_channel_new_file(path, "r", &error); - - if (chan == NULL) { - g_free(path); - path = g_build_filename(THEMERCDIR, "themerc", NULL); - error = NULL; - chan = g_io_channel_new_file(path, "r", &error); - } - - if (chan != NULL) { - parse(path, g_io_channel_unix_get_fd(chan)); - g_free(path); - g_io_channel_unref(chan); /* close the channel */ - } - - /* non-NULL defaults */ - if (themerc_titlebar_layout == NULL) - themerc_titlebar_layout = g_strdup("NDLIMC"); - if (themerc_font == NULL) - themerc_font = g_strdup("sans-7"); -} - -void themerc_shutdown() -{ - if (themerc_engine != NULL) g_free(themerc_engine); - if (themerc_theme != NULL) g_free(themerc_theme); - if (themerc_font != NULL) g_free(themerc_font); - if (themerc_titlebar_layout != NULL) g_free(themerc_titlebar_layout); -} diff --git a/openbox/themerc.h b/openbox/themerc.h deleted file mode 100644 index 89e4b072..00000000 --- a/openbox/themerc.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __themerc_h -#define __themerc_h - -extern char *themerc_engine; /* NULL to use the default engine */ -extern char *themerc_theme; /* NULL to use the default theme for the engine */ -extern char *themerc_font; /* always non-NULL */ -extern char *themerc_titlebar_layout; /* always non-NULL */ - -void themerc_startup(); -void themerc_shutdown(); - -#endif