reorganize config struct
This commit is contained in:
parent
58de591e58
commit
d4c2c23394
|
@ -7,7 +7,7 @@
|
||||||
#include "col.h"
|
#include "col.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#define CONF_VER 3
|
#define CONF_VER 4
|
||||||
|
|
||||||
#define LIM(v, min, max) {if (v >= max) v = max; else if (v <= min) v = min;}
|
#define LIM(v, min, max) {if (v >= max) v = max; else if (v <= min) v = min;}
|
||||||
|
|
||||||
|
@ -158,6 +158,8 @@ config_init(void)
|
||||||
(edd_base, Config, "bell_rings", bell_rings, EET_T_UCHAR);
|
(edd_base, Config, "bell_rings", bell_rings, EET_T_UCHAR);
|
||||||
EET_DATA_DESCRIPTOR_ADD_LIST
|
EET_DATA_DESCRIPTOR_ADD_LIST
|
||||||
(edd_base, Config, "keys", keys, edd_keys);
|
(edd_base, Config, "keys", keys, edd_keys);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC
|
||||||
|
(edd_base, Config, "gravatar", gravatar, EET_T_UCHAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -255,6 +257,8 @@ config_sync(const Config *config_src, Config *config)
|
||||||
config->colors_use = config_src->colors_use;
|
config->colors_use = config_src->colors_use;
|
||||||
memcpy(config->colors, config_src->colors, sizeof(config->colors));
|
memcpy(config->colors, config_src->colors, sizeof(config->colors));
|
||||||
config->mouse_over_focus = config_src->mouse_over_focus;
|
config->mouse_over_focus = config_src->mouse_over_focus;
|
||||||
|
/* TODO: config->keys */
|
||||||
|
config->gravatar = config_src->gravatar;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -451,13 +455,16 @@ config_load(const char *key)
|
||||||
/* upgrade to v3 */
|
/* upgrade to v3 */
|
||||||
config->active_links = EINA_TRUE;
|
config->active_links = EINA_TRUE;
|
||||||
config->bell_rings = EINA_TRUE;
|
config->bell_rings = EINA_TRUE;
|
||||||
config->version = 3;
|
|
||||||
/*pass through*/
|
/*pass through*/
|
||||||
case CONF_VER: /* 3 */
|
case 3:
|
||||||
if (eina_list_count(config->keys) == 0)
|
if (eina_list_count(config->keys) == 0)
|
||||||
{
|
{
|
||||||
_add_default_keys(config);
|
_add_default_keys(config);
|
||||||
}
|
}
|
||||||
|
/*pass through*/
|
||||||
|
case CONF_VER: /* 4 */
|
||||||
|
config->version = CONF_VER;
|
||||||
|
config->gravatar = EINA_TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (config->version < CONF_VER)
|
if (config->version < CONF_VER)
|
||||||
|
@ -491,11 +498,13 @@ config_load(const char *key)
|
||||||
config->helper.local.image = eina_stringshare_add("xdg-open");
|
config->helper.local.image = eina_stringshare_add("xdg-open");
|
||||||
config->helper.inline_please = EINA_TRUE;
|
config->helper.inline_please = EINA_TRUE;
|
||||||
config->scrollback = 2000;
|
config->scrollback = 2000;
|
||||||
config->tab_zoom = 0.5;
|
|
||||||
config->theme = eina_stringshare_add("default.edj");
|
config->theme = eina_stringshare_add("default.edj");
|
||||||
config->background = NULL;
|
config->background = NULL;
|
||||||
config->translucent = EINA_FALSE;
|
config->tab_zoom = 0.5;
|
||||||
|
config->vidmod = 0;
|
||||||
config->opacity = 50;
|
config->opacity = 50;
|
||||||
|
config->cg_width = 80;
|
||||||
|
config->cg_height = 24;
|
||||||
config->jump_on_change = EINA_TRUE;
|
config->jump_on_change = EINA_TRUE;
|
||||||
config->jump_on_keypress = EINA_TRUE;
|
config->jump_on_keypress = EINA_TRUE;
|
||||||
config->flicker_on_key = EINA_FALSE;
|
config->flicker_on_key = EINA_FALSE;
|
||||||
|
@ -503,7 +512,7 @@ config_load(const char *key)
|
||||||
config->disable_visual_bell = EINA_FALSE;
|
config->disable_visual_bell = EINA_FALSE;
|
||||||
config->bell_rings = EINA_TRUE;
|
config->bell_rings = EINA_TRUE;
|
||||||
config->active_links = EINA_TRUE;
|
config->active_links = EINA_TRUE;
|
||||||
config->vidmod = 0;
|
config->translucent = EINA_FALSE;
|
||||||
config->mute = EINA_FALSE;
|
config->mute = EINA_FALSE;
|
||||||
config->visualize = EINA_TRUE;
|
config->visualize = EINA_TRUE;
|
||||||
config->urg_bell = EINA_TRUE;
|
config->urg_bell = EINA_TRUE;
|
||||||
|
@ -513,10 +522,11 @@ config_load(const char *key)
|
||||||
config->xterm_256color = EINA_FALSE;
|
config->xterm_256color = EINA_FALSE;
|
||||||
config->erase_is_del = EINA_FALSE;
|
config->erase_is_del = EINA_FALSE;
|
||||||
config->custom_geometry = EINA_FALSE;
|
config->custom_geometry = EINA_FALSE;
|
||||||
|
config->drag_links = EINA_FALSE;
|
||||||
config->login_shell = EINA_FALSE;
|
config->login_shell = EINA_FALSE;
|
||||||
config->cg_width = 80;
|
config->mouse_over_focus = EINA_TRUE;
|
||||||
config->cg_height = 24;
|
|
||||||
config->colors_use = EINA_FALSE;
|
config->colors_use = EINA_FALSE;
|
||||||
|
config->gravatar = EINA_TRUE;
|
||||||
for (j = 0; j < 4; j++)
|
for (j = 0; j < 4; j++)
|
||||||
{
|
{
|
||||||
for (i = 0; i < 12; i++)
|
for (i = 0; i < 12; i++)
|
||||||
|
@ -530,7 +540,6 @@ config_load(const char *key)
|
||||||
config->colors[(j * 12) + i].a = aa;
|
config->colors[(j * 12) + i].a = aa;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
config->mouse_over_focus = EINA_TRUE;
|
|
||||||
_add_default_keys(config);
|
_add_default_keys(config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -606,6 +615,7 @@ config_fork(Config *config)
|
||||||
CPY(temporary);
|
CPY(temporary);
|
||||||
SCPY(config_key);
|
SCPY(config_key);
|
||||||
CPY(font_set);
|
CPY(font_set);
|
||||||
|
CPY(gravatar);
|
||||||
|
|
||||||
EINA_LIST_FOREACH(config->keys, l, key)
|
EINA_LIST_FOREACH(config->keys, l, key)
|
||||||
{
|
{
|
||||||
|
@ -620,6 +630,9 @@ config_fork(Config *config)
|
||||||
eina_stringshare_ref(key->cb);
|
eina_stringshare_ref(key->cb);
|
||||||
config2->keys = eina_list_append(config2->keys, key2);
|
config2->keys = eina_list_append(config2->keys, key2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CPY(gravatar);
|
||||||
|
|
||||||
return config2;
|
return config2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,9 @@ struct _Config
|
||||||
const char *background;
|
const char *background;
|
||||||
double tab_zoom;
|
double tab_zoom;
|
||||||
int vidmod;
|
int vidmod;
|
||||||
|
int opacity;
|
||||||
|
int cg_width;
|
||||||
|
int cg_height;
|
||||||
Eina_Bool jump_on_keypress;
|
Eina_Bool jump_on_keypress;
|
||||||
Eina_Bool jump_on_change;
|
Eina_Bool jump_on_change;
|
||||||
Eina_Bool flicker_on_key;
|
Eina_Bool flicker_on_key;
|
||||||
|
@ -56,7 +59,6 @@ struct _Config
|
||||||
Eina_Bool bell_rings;
|
Eina_Bool bell_rings;
|
||||||
Eina_Bool active_links;
|
Eina_Bool active_links;
|
||||||
Eina_Bool translucent;
|
Eina_Bool translucent;
|
||||||
int opacity;
|
|
||||||
Eina_Bool mute;
|
Eina_Bool mute;
|
||||||
Eina_Bool visualize;
|
Eina_Bool visualize;
|
||||||
Eina_Bool urg_bell;
|
Eina_Bool urg_bell;
|
||||||
|
@ -69,11 +71,9 @@ struct _Config
|
||||||
Eina_Bool drag_links;
|
Eina_Bool drag_links;
|
||||||
Eina_Bool login_shell;
|
Eina_Bool login_shell;
|
||||||
Eina_Bool mouse_over_focus;
|
Eina_Bool mouse_over_focus;
|
||||||
int cg_width;
|
|
||||||
int cg_height;
|
|
||||||
Eina_Bool colors_use;
|
Eina_Bool colors_use;
|
||||||
|
Eina_Bool gravatar;
|
||||||
Config_Color colors[(4 * 12)];
|
Config_Color colors[(4 * 12)];
|
||||||
Eina_Bool miniview;
|
|
||||||
Eina_List *keys;
|
Eina_List *keys;
|
||||||
|
|
||||||
Eina_Bool temporary; /* not in EET */
|
Eina_Bool temporary; /* not in EET */
|
||||||
|
|
|
@ -66,6 +66,9 @@ gravatar_tooltip(Evas_Object *obj, Config *config, char *email)
|
||||||
const char *url;
|
const char *url;
|
||||||
Gravatar *g;
|
Gravatar *g;
|
||||||
|
|
||||||
|
if (!config->gravatar)
|
||||||
|
return;
|
||||||
|
|
||||||
g = calloc(sizeof(Gravatar), 1);
|
g = calloc(sizeof(Gravatar), 1);
|
||||||
if (!g) return;
|
if (!g) return;
|
||||||
g->config = config;
|
g->config = config;
|
||||||
|
|
|
@ -289,6 +289,15 @@ _cb_op_behavior_mouse_over_focus_chg(void *data, Evas_Object *obj, void *event E
|
||||||
config_save(config, NULL);
|
config_save(config, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_op_behavior_gravatar_chg(void *data, Evas_Object *obj, void *event EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Evas_Object *term = data;
|
||||||
|
Config *config = termio_config_get(term);
|
||||||
|
config->gravatar = elm_check_state_get(obj);
|
||||||
|
config_save(config, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
options_behavior(Evas_Object *opbox, Evas_Object *term)
|
options_behavior(Evas_Object *opbox, Evas_Object *term)
|
||||||
{
|
{
|
||||||
|
@ -474,6 +483,16 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
|
||||||
evas_object_smart_callback_add(o, "changed",
|
evas_object_smart_callback_add(o, "changed",
|
||||||
_cb_op_behavior_mouse_over_focus_chg, term);
|
_cb_op_behavior_mouse_over_focus_chg, term);
|
||||||
|
|
||||||
|
o = elm_check_add(bx);
|
||||||
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
||||||
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
|
||||||
|
elm_object_text_set(o, _("Gravatar integration"));
|
||||||
|
elm_check_state_set(o, config->gravatar);
|
||||||
|
elm_box_pack_end(bx, o);
|
||||||
|
evas_object_show(o);
|
||||||
|
evas_object_smart_callback_add(o, "changed",
|
||||||
|
_cb_op_behavior_gravatar_chg, term);
|
||||||
|
|
||||||
o = elm_check_add(bx);
|
o = elm_check_add(bx);
|
||||||
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
|
||||||
|
|
Loading…
Reference in New Issue