Esempio n. 1
0
prop_t *
settings_create_bound_string(prop_t *parent, prop_t *title, prop_t *value)
{
  prop_t *p = setting_add(parent, title, "string", 0);
  prop_link(value, prop_create(p, "value"));
  return p;
}
Esempio n. 2
0
static setting_t *
setting_create_leaf(prop_t *parent, prop_t *title, const char *type,
		    const char *valuename, int flags)
{
  setting_t *s = calloc(1, sizeof(setting_t));
  s->s_root = prop_ref_inc(setting_add(parent, title, type, flags));
  s->s_val = prop_ref_inc(prop_create(s->s_root, valuename));
  return s;
}
Esempio n. 3
0
void
settings_create_info(prop_t *parent, const char *image,
		     prop_t *description)
{
  prop_t *r = setting_add(parent, NULL, "info", 0);
  prop_link(description, prop_create(r, "description"));
  if(image != NULL)
    prop_set_string(prop_create(r, "image"), image);
}
Esempio n. 4
0
void
settings_create_info(prop_t *parent, const char *image,
		     const char *description)
{
  prop_t *r = prop_create(setting_add(prop_create(parent, "model"),
				      "Info", "info"), "model");
  prop_set_string(prop_create(r, "description"), description);
  if(image != NULL)
    prop_set_string(prop_create(r, "image"), image);
}
Esempio n. 5
0
static setting_t *
setting_create_leaf(prop_t *parent, prop_t *title, const char *type,
		    const char *valuename)
{
  setting_t *s = calloc(1, sizeof(setting_t));
  s->s_root = setting_add(prop_create(parent, "model"), title, type);
  s->s_model = prop_create(s->s_root, "model");
  s->s_val = prop_ref_inc(prop_create(s->s_model, valuename));
  return s;
}
Esempio n. 6
0
prop_t *
settings_add_dir(prop_t *parent, prop_t *title, const char *subtype,
		 const char *icon, prop_t *shortdesc,
		 const char *url)
{
  prop_t *p = setting_add(parent, title, "settings", 0);
  prop_t *metadata = prop_create(p, "metadata");

  if(shortdesc != NULL)
    prop_link(shortdesc, prop_create(metadata, "shortdesc"));

  settings_add_dir_sup(p, url, icon, subtype);
  return p;
}
Esempio n. 7
0
prop_t *
settings_add_dir(prop_t *parent, const char *title, const char *subtype,
		 const char *icon)
{
  char url[100];
  prop_t *p = setting_add(parent ? prop_create(parent, "model") : NULL,
			  title, "settings");
  prop_t *model = prop_create(p, "model");
  prop_t *metadata = prop_create(model, "metadata");

  prop_set_string(prop_create(model, "subtype"), subtype);
  backend_prop_make(model, url, sizeof(url));
  prop_set_string(prop_create(p, "url"), url);
  if(icon != NULL)
    prop_set_string(prop_create(metadata, "icon"), icon);
  return p;
}
Esempio n. 8
0
prop_t *
settings_add_url(prop_t *parent, prop_t *title,
		 const char *subtype, const char *icon,
		 prop_t *shortdesc, const char *url)
{
  prop_t *p = setting_add(parent, title, "settings", 0);
  prop_t *metadata = prop_create(p, "metadata");

  if(shortdesc != NULL)
    prop_link(shortdesc, prop_create(metadata, "shortdesc"));

  prop_set_string(prop_create(p, "url"), url);
  prop_set_string(prop_create(p, "subtype"), subtype);

  if(icon != NULL)
    prop_set_string(prop_create(metadata, "icon"), icon);
  return p;
}
Esempio n. 9
0
static void
init_dev_settings(void)
{
  htsmsg_t *store;

  if((store = htsmsg_store_load("dev")) == NULL)
    store = htsmsg_create_map();

  settings_dev = settings_add_dir(prop_create_root(NULL),
				  _p("Developer settings"), NULL, NULL,
				  _p("Settings useful for developers"),
				  "settings:dev");

  prop_t *r = setting_add(settings_dev, NULL, "info", 0);
  prop_set_string(prop_create(r, "description"),
		  "Settings for developers. If you don't know what this is, don't touch it");


  prop_t *t;
  
  t = prop_create_root(NULL);
  prop_set_string(t, "Enable binrelpace");

  settings_create_bool(settings_dev, "binreplace", t, 0,
		       store, settings_generic_set_bool,
		       &gconf.enable_bin_replace, 
		       SETTINGS_INITIAL_UPDATE, NULL,
		       settings_generic_save_settings, 
		       (void *)"dev");

  t = prop_create_root(NULL);
  prop_set_string(t, "Enable omnigrade");

  settings_create_bool(settings_dev, "omnigrade", t, 0,
		       store, settings_generic_set_bool,
		       &gconf.enable_omnigrade, 
		       SETTINGS_INITIAL_UPDATE, NULL,
		       settings_generic_save_settings, 
		       (void *)"dev");


}
Esempio n. 10
0
void setting_init(Client *c)
{
    int i;
    gboolean on = TRUE, off = FALSE;

    c->config.settings = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, (GDestroyNotify)setting_free);
    setting_add(c, "user-agent", TYPE_CHAR, &"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Safari/605.1.15 " PROJECT "/" VERSION, webkit, 0, "user-agent");
    /* TODO use the real names for webkit settings */
    i = 14;
    setting_add(c, "accelerated-2d-canvas", TYPE_BOOLEAN, &off, webkit, 0, "enable-accelerated-2d-canvas");
    setting_add(c, "allow-file-access-from-file-urls", TYPE_BOOLEAN, &off, webkit, 0, "allow-file-access-from-file-urls");
    setting_add(c, "allow-universal-access-from-file-urls", TYPE_BOOLEAN, &off, webkit, 0, "allow-universal-access-from-file-urls");
    setting_add(c, "caret", TYPE_BOOLEAN, &off, webkit, 0, "enable-caret-browsing");
    setting_add(c, "cursiv-font", TYPE_CHAR, &"serif", webkit, 0, "cursive-font-family");
    setting_add(c, "default-charset", TYPE_CHAR, &"utf-8", webkit, 0, "default-charset");
    setting_add(c, "default-font", TYPE_CHAR, &"sans-serif", webkit, 0, "default-font-family");
    setting_add(c, "dns-prefetching", TYPE_BOOLEAN, &on, webkit, 0, "enable-dns-prefetching");
    i = SETTING_DEFAULT_FONT_SIZE;
    setting_add(c, "font-size", TYPE_INTEGER, &i, webkit, 0, "default-font-size");
    setting_add(c, "frame-flattening", TYPE_BOOLEAN, &off, webkit, 0, "enable-frame-flattening");
    setting_add(c, "hardware-acceleration-policy", TYPE_CHAR, &"ondemand", hardware_acceleration_policy, FLAG_NODUP, NULL);
    setting_add(c, "header", TYPE_CHAR, &"", headers, FLAG_LIST|FLAG_NODUP, "header");
    i = 1000;
    setting_add(c, "hint-timeout", TYPE_INTEGER, &i, NULL, 0, NULL);
    setting_add(c, "hint-keys", TYPE_CHAR, &"0123456789", NULL, 0, NULL);
    setting_add(c, "hint-follow-last", TYPE_BOOLEAN, &on, NULL, 0, NULL);
    setting_add(c, "hint-keys-same-length", TYPE_BOOLEAN, &off, NULL, 0, NULL);
    setting_add(c, "html5-database", TYPE_BOOLEAN, &on, webkit, 0, "enable-html5-database");
    setting_add(c, "html5-local-storage", TYPE_BOOLEAN, &on, webkit, 0, "enable-html5-local-storage");
    setting_add(c, "hyperlink-auditing", TYPE_BOOLEAN, &off, webkit, 0, "enable-hyperlink-auditing");
    setting_add(c, "images", TYPE_BOOLEAN, &on, webkit, 0, "auto-load-images");
    setting_add(c, "javascript-can-access-clipboard", TYPE_BOOLEAN, &off, webkit, 0, "javascript-can-access-clipboard");
    setting_add(c, "javascript-can-open-windows-automatically", TYPE_BOOLEAN, &off, webkit, 0, "javascript-can-open-windows-automatically");
    setting_add(c, "media-playback-allows-inline", TYPE_BOOLEAN, &on, webkit, 0, "media-playback-allows-inline");
    setting_add(c, "media-playback-requires-user-gesture", TYPE_BOOLEAN, &off, webkit, 0, "media-playback-requires-user-gesture");
    setting_add(c, "media-stream", TYPE_BOOLEAN, &off, webkit, 0, "enable-media-stream");
    setting_add(c, "mediasource", TYPE_BOOLEAN, &off, webkit, 0, "enable-mediasource");
    i = 5;
    setting_add(c, "minimum-font-size", TYPE_INTEGER, &i, webkit, 0, "minimum-font-size");
    setting_add(c, "monospace-font", TYPE_CHAR, &"monospace", webkit, 0, "monospace-font-family");
    i = SETTING_DEFAULT_MONOSPACE_FONT_SIZE;
    setting_add(c, "monospace-font-size", TYPE_INTEGER, &i, webkit, 0, "default-monospace-font-size");
    setting_add(c, "offline-cache", TYPE_BOOLEAN, &on, webkit, 0, "enable-offline-web-application-cache");
    setting_add(c, "plugins", TYPE_BOOLEAN, &on, webkit, 0, "enable-plugins");
    setting_add(c, "prevent-newwindow", TYPE_BOOLEAN, &off, internal, 0, &c->config.prevent_newwindow);
    setting_add(c, "print-backgrounds", TYPE_BOOLEAN, &on, webkit, 0, "print-backgrounds");
    setting_add(c, "private-browsing", TYPE_BOOLEAN, &off, webkit, 0, "enable-private-browsing");
    setting_add(c, "sans-serif-font", TYPE_CHAR, &"sans-serif", webkit, 0, "sans-serif-font-family");
    setting_add(c, "scripts", TYPE_BOOLEAN, &on, webkit, 0, "enable-javascript");
    setting_add(c, "serif-font", TYPE_CHAR, &"serif", webkit, 0, "serif-font-family");
    setting_add(c, "site-specific-quirks", TYPE_BOOLEAN, &off, webkit, 0, "enable-site-specific-quirks");
    setting_add(c, "smooth-scrolling", TYPE_BOOLEAN, &off, webkit, 0, "enable-smooth-scrolling");
    setting_add(c, "spacial-navigation", TYPE_BOOLEAN, &off, webkit, 0, "enable-spatial-navigation");
    setting_add(c, "tabs-to-links", TYPE_BOOLEAN, &on, webkit, 0, "enable-tabs-to-links");
    setting_add(c, "webaudio", TYPE_BOOLEAN, &off, webkit, 0, "enable-webaudio");
    setting_add(c, "webgl", TYPE_BOOLEAN, &off, webkit, 0, "enable-webgl");
    setting_add(c, "webinspector", TYPE_BOOLEAN, &on, webkit, 0, "enable-developer-extras");
    setting_add(c, "xss-auditor", TYPE_BOOLEAN, &on, webkit, 0, "enable-xss-auditor");

    /* internal variables */
    setting_add(c, "stylesheet", TYPE_BOOLEAN, &on, user_style, 0, NULL);
    setting_add(c, "user-scripts", TYPE_BOOLEAN, &on, user_scripts, 0, NULL);
    setting_add(c, "cookie-accept", TYPE_CHAR, &"always", cookie_accept, 0, NULL);
    i = 40;
    setting_add(c, "scroll-step", TYPE_INTEGER, &i, internal, 0, &c->config.scrollstep);
    setting_add(c, "home-page", TYPE_CHAR, &SETTING_HOME_PAGE, NULL, 0, NULL);
    i = 2000;
    /* TODO should be global and not overwritten by a new client */
    setting_add(c, "history-max-items", TYPE_INTEGER, &i, internal, 0, &vb.config.history_max);
    setting_add(c, "editor-command", TYPE_CHAR, &"x-terminal-emulator -e -vi '%s'", NULL, 0, NULL);
    setting_add(c, "strict-ssl", TYPE_BOOLEAN, &on, tls_policy, 0, NULL);
    setting_add(c, "status-bar", TYPE_BOOLEAN, &on, statusbar, 0, NULL);
    i = 1000;
    setting_add(c, "timeoutlen", TYPE_INTEGER, &i, internal, 0, &c->map.timeoutlen);
    setting_add(c, "input-autohide", TYPE_BOOLEAN, &off, input_autohide, 0, &c->config.input_autohide);
    setting_add(c, "fullscreen", TYPE_BOOLEAN, &off, fullscreen, 0, NULL);
    setting_add(c, "show-titlebar", TYPE_BOOLEAN, &on, window_decorate, 0, NULL);
    i = 100;
    setting_add(c, "default-zoom", TYPE_INTEGER, &i, default_zoom, 0, NULL);
    setting_add(c, "download-path", TYPE_CHAR, &"~/", NULL, 0, NULL);
    setting_add(c, "incsearch", TYPE_BOOLEAN, &off, internal, 0, &c->config.incsearch);
    i = 10;
    /* TODO should be global and not overwritten by a new client */
    setting_add(c, "closed-max-items", TYPE_INTEGER, &i, internal, 0, &vb.config.closed_max);
    setting_add(c, "x-hint-command", TYPE_CHAR, &":o <C-R>;", NULL, 0, NULL);
    setting_add(c, "spell-checking", TYPE_BOOLEAN, &off, webkit_spell_checking, 0, NULL);
    setting_add(c, "spell-checking-languages", TYPE_CHAR, &"en_US", webkit_spell_checking_language, FLAG_LIST|FLAG_NODUP, NULL);

    /* gui style settings vimb3 */
    setting_add(c, "completion-css", TYPE_CHAR, &"color:#fff;background-color:#656565;font:" SETTING_GUI_FONT_NORMAL, gui_style, 0, NULL);
    setting_add(c, "completion-hover-css", TYPE_CHAR, &"background-color:#777;", gui_style, 0, NULL);
    setting_add(c, "completion-selected-css", TYPE_CHAR, &"color:#f6f3e8;background-color:#888;", gui_style, 0, NULL);
    setting_add(c, "input-css", TYPE_CHAR, &"background-color:#fff;color:#000;font:" SETTING_GUI_FONT_NORMAL, gui_style, 0, NULL);
    setting_add(c, "input-error-css", TYPE_CHAR, &"background-color:#f77;font:" SETTING_GUI_FONT_EMPH, gui_style, 0, NULL);
    setting_add(c, "status-css", TYPE_CHAR, &"color:#fff;background-color:#000;font:" SETTING_GUI_FONT_EMPH, gui_style, 0, NULL);
    setting_add(c, "status-ssl-css", TYPE_CHAR, &"background-color:#95e454;color:#000;", gui_style, 0, NULL);
    setting_add(c, "status-ssl-invalid-css", TYPE_CHAR, &"background-color:#f77;color:#000;", gui_style, 0, NULL);

    /* initialize the shortcuts and set the default shortcuts */
    shortcut_add(c->config.shortcuts, "dl", "https://duckduckgo.com/html/?q=$0");
    shortcut_add(c->config.shortcuts, "dd", "https://duckduckgo.com/?q=$0");
    shortcut_set_default(c->config.shortcuts, "dl");
}
Esempio n. 11
0
prop_t *
settings_create_divider(prop_t *parent, prop_t *caption)
{
  return setting_add(parent, caption, "divider", 0);
}
Esempio n. 12
0
prop_t *
settings_create_divider(prop_t *parent, prop_t *caption)
{
  return setting_add(prop_create(parent, "model"), caption, "divider");
}
Esempio n. 13
0
prop_t *
settings_create_separator(prop_t *parent, prop_t *caption)
{
  return setting_add(parent, caption, "separator", 0);
}
Esempio n. 14
0
static void
init_dev_settings(void)
{
  htsmsg_t *store;

  if((store = htsmsg_store_load("dev")) == NULL)
    store = htsmsg_create_map();

  gconf.settings_dev = settings_add_dir(prop_create_root(NULL),
				  _p("Developer settings"), NULL, NULL,
				  _p("Settings useful for developers"),
				  "settings:dev");

  prop_t *r = setting_add(gconf.settings_dev, NULL, "info", 0);
  prop_set_string(prop_create(r, "description"),
		  "Settings for developers. If you don't know what this is, don't touch it");


  prop_t *t;
  
  t = prop_create_root(NULL);
  prop_set_string(t, "Experimental features (Use at own risk)");

  settings_create_bool(gconf.settings_dev, "experimental", t, 0,
		       store, settings_generic_set_bool,
		       &gconf.enable_experimental, 
		       SETTINGS_INITIAL_UPDATE, NULL,
		       settings_generic_save_settings, 
		       (void *)"dev");


  t = prop_create_root(NULL);
  prop_set_string(t, "Enable binrelpace");

  settings_create_bool(gconf.settings_dev, "binreplace", t, 0,
		       store, settings_generic_set_bool,
		       &gconf.enable_bin_replace, 
		       SETTINGS_INITIAL_UPDATE, NULL,
		       settings_generic_save_settings, 
		       (void *)"dev");

  t = prop_create_root(NULL);
  prop_set_string(t, "Enable omnigrade");

  settings_create_bool(gconf.settings_dev, "omnigrade", t, 0,
		       store, settings_generic_set_bool,
		       &gconf.enable_omnigrade, 
		       SETTINGS_INITIAL_UPDATE, NULL,
		       settings_generic_save_settings, 
		       (void *)"dev");


  t = prop_create_root(NULL);
  prop_set_string(t, "Debug all HTTP requests");

  settings_create_bool(gconf.settings_dev, "httpdebug", t, 0,
		       store, settings_generic_set_bool,
		       &gconf.enable_http_debug, 
		       SETTINGS_INITIAL_UPDATE, NULL,
		       settings_generic_save_settings, 
		       (void *)"dev");

  t = prop_create_root(NULL);
  prop_set_string(t, "Disable HTTP connection reuse");

  settings_create_bool(gconf.settings_dev, "nohttpreuse", t, 0,
		       store, settings_generic_set_bool,
		       &gconf.disable_http_reuse, 
		       SETTINGS_INITIAL_UPDATE, NULL,
		       settings_generic_save_settings, 
		       (void *)"dev");


}