/* * File: dillocfg-gtk_token.c * * Copyright (C) 2003 Kiyo * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #include #include #include "../config.h" #include "../src/intl.h" #include "dillocfg_token.h" #include "dillocfg_option.h" static const OptionAdjustment_t font_factor_option = {0.1, 20, 0.1, 1}; static const OptionAdjustment_t geometry_option = {1, 65535, 1, 0}; static const gchar *panel_sizes[] = {"tiny", "small", "medium", "large", NULL}; static const gchar *user_agents[] = { "Dillo/%v", "Mozilla/3.0 (compatible;) Dillo/%v", "Mozilla/4.0 (compatible; MSIE 4.0;) Dillo/%v", "Mozilla/4.0 (Macintosh; U; PPC Mac OS X; ja-jp) Dillo/%v", "DoCoMo/1.0/x505i (Dillo/%v)", "J-PHONE/4.2/J-x53 (Dillo/%v)", "KDDI-x24 UP.Browser/6.0.x.x (GUI) MMP/1.1 (Dillo/%v)", NULL }; static const gchar *cookie_rules[] = { "ACCEPT_SESSION", "DENY", "ACCEPT", NULL }; /* symbol array */ static struct { const gchar *name; const gchar *label; const guint token; const guint type; const gchar *value; const gpointer option; Option *object; } symbols[] = { { "null", "null", 0, -1, NULL, (const gpointer)NULL, NULL }, { "geometry", N_("Window Size"), TOKEN_GEOMETRY, GEOMETRY_OPTION, "640x550", (const gpointer)&geometry_option, NULL }, { "http_proxy", N_("HTTP Proxy"), TOKEN_PROXY, ENTRY_OPTION, "", (const gpointer)TRUE, NULL }, { "http_proxyuser", N_("HTTP Proxy User"), TOKEN_PROXYUSER, ENTRY_OPTION, "", (const gpointer)FALSE, NULL }, { "no_proxy", N_("NO Proxy"), TOKEN_NOPROXY, ENTRY_OPTION, "", (const gpointer)TRUE, NULL }, { "user_agent", N_("User-Agent"), TOKEN_USER_AGENT, SELECT_OPTION, "Dillo/%v", (const gpointer)&user_agents, NULL }, { "send_referer", N_("Send referer header"), TOKEN_SEND_REFERER, CHECK_OPTION, "YES", NULL, NULL }, { "link_color", N_("Link color"), TOKEN_LINK_COLOR, COLOR_OPTION, "0x0000ff", NULL, NULL }, { "visited_color", N_("Visited color"), TOKEN_VISITED_COLOR, COLOR_OPTION, "0xa020f0", NULL, NULL }, { "bg_color", N_("BackGround color"), TOKEN_BG_COLOR, COLOR_OPTION, "0xffffff", NULL, NULL }, { "allow_white_bg", N_("Allow white bg"), TOKEN_ALLOW_WHITE_BG, CHECK_OPTION, "NO", NULL, NULL }, { "force_my_colors", N_("Force my colors"), TOKEN_FORCE_MY_COLORS, CHECK_OPTION, "NO", NULL, NULL }, { "contrast_visited_color", N_("Contrast visited color"), TOKEN_CONTRAST_VISITED_COLOR, CHECK_OPTION, "NO", NULL, NULL }, { "text_color", N_("Text color"), TOKEN_TEXT_COLOR, COLOR_OPTION, "0x000000", NULL, NULL }, { "use_oblique", N_("Use oblique"), TOKEN_USE_OBLIQUE, CHECK_OPTION, "NO", NULL, NULL }, { "start_page", N_("Start Page"), TOKEN_START_PAGE, ENTRY_OPTION, "about:splash", (const gpointer)TRUE, NULL }, { "home", N_("HOMEPAGE"), TOKEN_HOME, ENTRY_OPTION, "http://www.google.com/", (const gpointer)TRUE, NULL }, { "search_url", N_("Search-engine's URL"), TOKEN_SEARCH_URL, ENTRY_OPTION, "http://www.google.com/search?ie=UTF-8&oe=UTF-8&q=%s", (const gpointer)TRUE, NULL }, { "search_charset", N_("Search-engine's charset"), TOKEN_SEARCH_CHARSET, ENTRY_OPTION, "UTF-8", (const gpointer)FALSE, NULL }, { "show_tooltip", N_("Show Tooltip"), TOKEN_SHOW_TOOLTIP, CHECK_OPTION, "YES", NULL, NULL }, { "panel_size", N_("Panel Size"), TOKEN_PANEL_SIZE, SELECT_OPTION, "tiny", (const gpointer)&panel_sizes, NULL }, { "small_icons", N_("Small icons"), TOKEN_SMALL_ICONS, CHECK_OPTION, "YES", NULL, NULL }, { "limit_text_width", N_("Limit text width"), TOKEN_LIMIT_TEXT_WIDTH, CHECK_OPTION, "NO", NULL, NULL }, { "limit_font_decoration", N_("Limit font decoration"), TOKEN_LIMIT_FONT_DECORATION, CHECK_OPTION, "NO", NULL, NULL }, { "font_factor", N_("Font factor"), TOKEN_FONT_FACTOR, SPIN_OPTION, "1.0", (const gpointer)&font_factor_option, NULL }, { "font_sizes", N_("Font Sizes"), TOKEN_FONT_SIZES, ENTRY_OPTION, "10 12 14 16 18 20", (const gpointer)TRUE, NULL }, { "w3c_plus_heuristics", N_("W3C+heuristics"), TOKEN_W3C_PLUS_HEURISTICS, CHECK_OPTION, "YES", NULL, NULL }, { "use_dicache", N_("Use dicache"), TOKEN_USE_DICACHE, CHECK_OPTION, "NO", NULL, NULL }, { "show_back", N_("Show Back"), TOKEN_SHOW_BACK, CHECK_OPTION, "YES", NULL, NULL }, { "show_forw", N_("Show Forw"), TOKEN_SHOW_FORW, CHECK_OPTION, "YES", NULL, NULL }, { "show_home", N_("Show Home"), TOKEN_SHOW_HOME, CHECK_OPTION, "YES", NULL, NULL }, { "show_reload", N_("Show Reload"), TOKEN_SHOW_RELOAD, CHECK_OPTION, "YES", NULL, NULL }, { "show_save", N_("Show Save"), TOKEN_SHOW_SAVE, CHECK_OPTION, "YES", NULL, NULL }, { "show_stop", N_("Show Stop"), TOKEN_SHOW_STOP, CHECK_OPTION, "YES", NULL, NULL }, { "show_bookmarks", N_("Show Bookmarks"), TOKEN_SHOW_BOOKMARKS, CHECK_OPTION, "YES", NULL, NULL }, { "show_menubar", N_("Show Menubar"), TOKEN_SHOW_MENUBAR, CHECK_OPTION, "YES", NULL, NULL }, { "show_clear_url", N_("Show ClearURL"), TOKEN_SHOW_CLEAR_URL, CHECK_OPTION, "YES", NULL, NULL }, { "show_url", N_("Show URL box"), TOKEN_SHOW_URL, CHECK_OPTION, "YES", NULL, NULL }, { "show_search", N_("Show Web Search"), TOKEN_SHOW_SEARCH, CHECK_OPTION, "YES", NULL, NULL }, { "show_progress_box", N_("Show Progress box"), TOKEN_SHOW_PROGRESS_BOX, CHECK_OPTION, "NO", NULL, NULL }, { "show_popup_navigation", N_("Show Popup navigation"), TOKEN_SHOW_POPUP_NAVIGATION, CHECK_OPTION, "YES", NULL, NULL }, { "fullwindow_start", N_("Fullwindow start"), TOKEN_FULLWINDOW_START, CHECK_OPTION, "NO", NULL, NULL }, { "transient_dialogs", N_("Transient dialogs"), TOKEN_TRANSIENT_DIALOGS, CHECK_OPTION, "NO", NULL, NULL }, { "popup_dialogs", N_("Popup dialogs"), TOKEN_POPUP_DIALOGS, CHECK_OPTION, "NO", NULL, NULL }, { "vw_aafontname", N_("vw_aafontname"), TOKEN_VW_AAFONT, FONT_OPTION, "*", (const gpointer)TRUE, NULL }, { "fw_aafontname", N_("fw_aafontname"), TOKEN_FW_AAFONT, FONT_OPTION, "*", (const gpointer)TRUE, NULL }, { "vw_fontname", N_("vw_fontname"), TOKEN_VW_FONT, FONT_OPTION, "*-gothic", (const gpointer)TRUE, NULL }, { "fw_fontname", N_("fw_fontname"), TOKEN_FW_FONT, FONT_OPTION, "*-gothic", (const gpointer)TRUE, NULL }, { "generate_submit", N_("Generate submit"), TOKEN_GENERATE_SUBMIT, CHECK_OPTION, "YES", NULL, NULL }, { "enterpress_forces_submit", N_("Enterpress forces submit"), TOKEN_ENTERPRESS_FORCES_SUBMIT, CHECK_OPTION, "NO", NULL, NULL }, { "show_msg", N_("Show debugging messsages"), TOKEN_SHOW_MSG, CHECK_OPTION, "NO", NULL, NULL }, { "show_extra_warnings", N_("Show Extra Warnings"), TOKEN_SHOW_EXTRA_WARNINGS, CHECK_OPTION, "NO", NULL, NULL }, { "focus_location_on_new", N_("Focus location on new"), TOKEN_FOCUS_LOCATION_ON_NEW, CHECK_OPTION, "YES", NULL, NULL }, { "accept_language", N_("Accept Language"), TOKEN_ACCEPT_LANGUAGE, ENTRY_OPTION, "en-us", (const gpointer)TRUE, NULL }, { "accept_language", N_("Accept Language"), TOKEN_ACCEPT_LANGUAGE, ENTRY_OPTION, "en-us, ja", (const gpointer)TRUE, NULL }, #ifndef DISABLE_TABS { "tab_load_in_background", N_("Tab load in background"), TOKEN_TAB_LOAD_IN_BACKGROUND, CHECK_OPTION, "YES", NULL, NULL }, { "tab_close_middle_click", N_("Tab close middle click"), TOKEN_TAB_CLOSE_MIDDLE_CLICK, CHECK_OPTION, "YES", NULL, NULL }, { "tab_instead_of_window", N_("Tab instead of window"), TOKEN_TAB_INSTEAD_OF_WINDOW, CHECK_OPTION, "YES", FALSE, NULL }, { "tab_bar_show_fullscreen", N_("Tab bar show fullscreen"), TOKEN_TAB_BAR_SHOW_FULLSCREEN, CHECK_OPTION, "NO", NULL, NULL }, { "tab_bar_show_single_tab", N_("Tab bar show single tab"), TOKEN_TAB_BAR_SHOW_SINGLE_TAB, CHECK_OPTION, "NO", NULL, NULL }, { "tab_bar_scroller", N_("Tab bar scroller"), TOKEN_TAB_BAR_SCROLLER, CHECK_OPTION, "NO", NULL, NULL }, { "tab_bar_homogeneous", N_("Tab bar homogeneous"), TOKEN_TAB_BAR_HOMOGENEOUS, CHECK_OPTION, "YES", NULL, NULL }, { "tab_title_compress", N_("Tab title compress"), TOKEN_TAB_TITLE_COMPRESS, CHECK_OPTION, "NO", NULL, NULL }, { "compress_vowels", N_("Compress vowels"), TOKEN_COMPRESS_VOWELS, ENTRY_OPTION, "aeiouyAEIOUY", (const gpointer)TRUE, NULL }, { "compress_common_prefixes", N_("Compress_common_prefixes"), TOKEN_COMPRESS_COMMON_PREFIXES, ENTRY_OPTION, "index of ;re: ;fwd: ;www.;welcome to ;the ", (const gpointer)TRUE, NULL }, #endif /* !DISABLE_TABS */ { "DEFAULT", N_("Default"), TOKEN_COOKIE_DEFAULT, COOKIE, "ACCEPT_SESSION", (const gpointer)&cookie_rules, NULL }, { NULL, NULL, TOKEN_COOKIE, COOKIE, "ACCEPT_SESSION", (const gpointer)&cookie_rules, NULL }, }; static guint token2num(guint tkn) { gint i; for (i = 0; i < N_TOKENS && symbols[i].token != tkn; i++); return i; } guint name2token(const gchar *name) { gint i; for (i = 0; i < N_TOKENS; i++) if (symbols[i].name && strcmp(symbols[i].name, name) == 0) return (const guint)symbols[i].token; return 0; } const gchar *get_token_name(guint tkn) { return symbols[token2num(tkn)].name; } const gchar *get_token_label(guint tkn) { return symbols[token2num(tkn)].label; } guint get_token_type(guint tkn) { return symbols[token2num(tkn)].type; } gpointer get_token_value(guint tkn) { return (const gpointer)symbols[token2num(tkn)].value; } gpointer get_token_option(guint tkn) { return symbols[token2num(tkn)].option; } void set_token_object(guint tkn, Option *obj) { symbols[token2num(tkn)].object = obj; } Option *get_token_object(guint tkn) { return symbols[token2num(tkn)].object; } /* vim: set ts=3 sw=3 sts=3 expandtab:*/