forked from enlightenment/terminology
options_links: clean up
This commit is contained in:
parent
75e7e211f2
commit
62b101efd7
|
@ -1,20 +1,30 @@
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
|
#include <assert.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "termio.h"
|
#include "termio.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "options_mouse.h"
|
#include "options_mouse.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
typedef struct _Mouse_Ctx {
|
||||||
|
Evas_Object *term;
|
||||||
|
Config *config;
|
||||||
|
} Mouse_Ctx;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_op_helper_inline_chg(void *data,
|
_cb_op_helper_inline_chg(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Mouse_Ctx *ctx = data;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = ctx->config;
|
||||||
|
Evas_Object *term = ctx->term;
|
||||||
|
|
||||||
config->helper.inline_please = elm_check_state_get(obj);
|
config->helper.inline_please = elm_check_state_get(obj);
|
||||||
|
termio_config_update(term);
|
||||||
|
windows_update();
|
||||||
config_save(config);
|
config_save(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,8 +33,9 @@ _cb_op_helper_email_chg(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Mouse_Ctx *ctx = data;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = ctx->config;
|
||||||
|
Evas_Object *term = ctx->term;
|
||||||
char *txt;
|
char *txt;
|
||||||
|
|
||||||
if (config->helper.email)
|
if (config->helper.email)
|
||||||
|
@ -38,6 +49,8 @@ _cb_op_helper_email_chg(void *data,
|
||||||
config->helper.email = eina_stringshare_add(txt);
|
config->helper.email = eina_stringshare_add(txt);
|
||||||
free(txt);
|
free(txt);
|
||||||
}
|
}
|
||||||
|
termio_config_update(term);
|
||||||
|
windows_update();
|
||||||
config_save(config);
|
config_save(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,8 +59,9 @@ _cb_op_helper_url_image_chg(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Mouse_Ctx *ctx = data;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = ctx->config;
|
||||||
|
Evas_Object *term = ctx->term;
|
||||||
char *txt;
|
char *txt;
|
||||||
|
|
||||||
if (config->helper.url.image)
|
if (config->helper.url.image)
|
||||||
|
@ -61,6 +75,8 @@ _cb_op_helper_url_image_chg(void *data,
|
||||||
config->helper.url.image = eina_stringshare_add(txt);
|
config->helper.url.image = eina_stringshare_add(txt);
|
||||||
free(txt);
|
free(txt);
|
||||||
}
|
}
|
||||||
|
termio_config_update(term);
|
||||||
|
windows_update();
|
||||||
config_save(config);
|
config_save(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,8 +85,9 @@ _cb_op_helper_url_video_chg(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Mouse_Ctx *ctx = data;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = ctx->config;
|
||||||
|
Evas_Object *term = ctx->term;
|
||||||
char *txt;
|
char *txt;
|
||||||
|
|
||||||
if (config->helper.url.video)
|
if (config->helper.url.video)
|
||||||
|
@ -84,6 +101,8 @@ _cb_op_helper_url_video_chg(void *data,
|
||||||
config->helper.url.video = eina_stringshare_add(txt);
|
config->helper.url.video = eina_stringshare_add(txt);
|
||||||
free(txt);
|
free(txt);
|
||||||
}
|
}
|
||||||
|
termio_config_update(term);
|
||||||
|
windows_update();
|
||||||
config_save(config);
|
config_save(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,8 +111,9 @@ _cb_op_helper_url_general_chg(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Mouse_Ctx *ctx = data;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = ctx->config;
|
||||||
|
Evas_Object *term = ctx->term;
|
||||||
char *txt;
|
char *txt;
|
||||||
|
|
||||||
if (config->helper.url.general)
|
if (config->helper.url.general)
|
||||||
|
@ -107,6 +127,8 @@ _cb_op_helper_url_general_chg(void *data,
|
||||||
config->helper.url.general = eina_stringshare_add(txt);
|
config->helper.url.general = eina_stringshare_add(txt);
|
||||||
free(txt);
|
free(txt);
|
||||||
}
|
}
|
||||||
|
termio_config_update(term);
|
||||||
|
windows_update();
|
||||||
config_save(config);
|
config_save(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,8 +137,9 @@ _cb_op_helper_local_image_chg(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Mouse_Ctx *ctx = data;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = ctx->config;
|
||||||
|
Evas_Object *term = ctx->term;
|
||||||
char *txt;
|
char *txt;
|
||||||
|
|
||||||
if (config->helper.local.image)
|
if (config->helper.local.image)
|
||||||
|
@ -130,6 +153,8 @@ _cb_op_helper_local_image_chg(void *data,
|
||||||
config->helper.local.image = eina_stringshare_add(txt);
|
config->helper.local.image = eina_stringshare_add(txt);
|
||||||
free(txt);
|
free(txt);
|
||||||
}
|
}
|
||||||
|
termio_config_update(term);
|
||||||
|
windows_update();
|
||||||
config_save(config);
|
config_save(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,8 +163,9 @@ _cb_op_helper_local_video_chg(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Mouse_Ctx *ctx = data;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = ctx->config;
|
||||||
|
Evas_Object *term = ctx->term;
|
||||||
char *txt;
|
char *txt;
|
||||||
|
|
||||||
if (config->helper.local.video)
|
if (config->helper.local.video)
|
||||||
|
@ -153,6 +179,8 @@ _cb_op_helper_local_video_chg(void *data,
|
||||||
config->helper.local.video = eina_stringshare_add(txt);
|
config->helper.local.video = eina_stringshare_add(txt);
|
||||||
free(txt);
|
free(txt);
|
||||||
}
|
}
|
||||||
|
termio_config_update(term);
|
||||||
|
windows_update();
|
||||||
config_save(config);
|
config_save(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,8 +189,9 @@ _cb_op_helper_local_general_chg(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
void *_event EINA_UNUSED)
|
void *_event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *term = data;
|
Mouse_Ctx *ctx = data;
|
||||||
Config *config = termio_config_get(term);
|
Config *config = ctx->config;
|
||||||
|
Evas_Object *term = ctx->term;
|
||||||
char *txt;
|
char *txt;
|
||||||
|
|
||||||
if (config->helper.local.general)
|
if (config->helper.local.general)
|
||||||
|
@ -176,9 +205,22 @@ _cb_op_helper_local_general_chg(void *data,
|
||||||
config->helper.local.general = eina_stringshare_add(txt);
|
config->helper.local.general = eina_stringshare_add(txt);
|
||||||
free(txt);
|
free(txt);
|
||||||
}
|
}
|
||||||
|
termio_config_update(term);
|
||||||
|
windows_update();
|
||||||
config_save(config);
|
config_save(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_parent_del_cb(void *data,
|
||||||
|
Evas *_e EINA_UNUSED,
|
||||||
|
Evas_Object *_obj EINA_UNUSED,
|
||||||
|
void *_event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Mouse_Ctx *ctx = data;
|
||||||
|
|
||||||
|
free(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
options_mouse(Evas_Object *opbox, Evas_Object *term)
|
options_mouse(Evas_Object *opbox, Evas_Object *term)
|
||||||
{
|
{
|
||||||
|
@ -186,6 +228,13 @@ options_mouse(Evas_Object *opbox, Evas_Object *term)
|
||||||
Evas_Object *o, *tb, *sc, *fr, *bx;
|
Evas_Object *o, *tb, *sc, *fr, *bx;
|
||||||
char *txt;
|
char *txt;
|
||||||
int row = 0;
|
int row = 0;
|
||||||
|
Mouse_Ctx *ctx;
|
||||||
|
|
||||||
|
ctx = calloc(1, sizeof(*ctx));
|
||||||
|
assert(ctx);
|
||||||
|
|
||||||
|
ctx->config = config;
|
||||||
|
ctx->term = term;
|
||||||
|
|
||||||
fr = o = elm_frame_add(opbox);
|
fr = o = elm_frame_add(opbox);
|
||||||
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
@ -194,6 +243,9 @@ options_mouse(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_box_pack_end(opbox, o);
|
elm_box_pack_end(opbox, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
|
evas_object_event_callback_add(o, EVAS_CALLBACK_DEL,
|
||||||
|
_parent_del_cb, ctx);
|
||||||
|
|
||||||
bx = o = elm_box_add(opbox);
|
bx = o = elm_box_add(opbox);
|
||||||
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
@ -208,14 +260,9 @@ options_mouse(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_box_pack_end(bx, o);
|
elm_box_pack_end(bx, o);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_smart_callback_add(o, "changed",
|
evas_object_smart_callback_add(o, "changed",
|
||||||
_cb_op_helper_inline_chg, term);
|
_cb_op_helper_inline_chg, ctx);
|
||||||
|
|
||||||
o = elm_separator_add(opbox);
|
OPTIONS_SEPARATOR;
|
||||||
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_separator_horizontal_set(o, EINA_TRUE);
|
|
||||||
elm_box_pack_end(bx, o);
|
|
||||||
evas_object_show(o);
|
|
||||||
|
|
||||||
sc = o = elm_scroller_add(opbox);
|
sc = o = elm_scroller_add(opbox);
|
||||||
elm_scroller_content_min_limit(sc, EINA_TRUE, EINA_FALSE);
|
elm_scroller_content_min_limit(sc, EINA_TRUE, EINA_FALSE);
|
||||||
|
@ -252,7 +299,7 @@ options_mouse(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_table_pack(tb, o, 1, row, 1, 1);
|
elm_table_pack(tb, o, 1, row, 1, 1);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_smart_callback_add(o, "changed",
|
evas_object_smart_callback_add(o, "changed",
|
||||||
_cb_op_helper_email_chg, term);
|
_cb_op_helper_email_chg, ctx);
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
o = elm_separator_add(opbox);
|
o = elm_separator_add(opbox);
|
||||||
|
@ -285,7 +332,7 @@ options_mouse(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_table_pack(tb, o, 1, row, 1, 1);
|
elm_table_pack(tb, o, 1, row, 1, 1);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_smart_callback_add(o, "changed",
|
evas_object_smart_callback_add(o, "changed",
|
||||||
_cb_op_helper_url_image_chg, term);
|
_cb_op_helper_url_image_chg, ctx);
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
o = elm_label_add(tb);
|
o = elm_label_add(tb);
|
||||||
|
@ -310,7 +357,7 @@ options_mouse(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_table_pack(tb, o, 1, row, 1, 1);
|
elm_table_pack(tb, o, 1, row, 1, 1);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_smart_callback_add(o, "changed",
|
evas_object_smart_callback_add(o, "changed",
|
||||||
_cb_op_helper_url_video_chg, term);
|
_cb_op_helper_url_video_chg, ctx);
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
o = elm_label_add(tb);
|
o = elm_label_add(tb);
|
||||||
|
@ -335,7 +382,7 @@ options_mouse(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_table_pack(tb, o, 1, row, 1, 1);
|
elm_table_pack(tb, o, 1, row, 1, 1);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_smart_callback_add(o, "changed",
|
evas_object_smart_callback_add(o, "changed",
|
||||||
_cb_op_helper_url_general_chg, term);
|
_cb_op_helper_url_general_chg, ctx);
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
o = elm_separator_add(opbox);
|
o = elm_separator_add(opbox);
|
||||||
|
@ -368,7 +415,7 @@ options_mouse(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_table_pack(tb, o, 1, row, 1, 1);
|
elm_table_pack(tb, o, 1, row, 1, 1);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_smart_callback_add(o, "changed",
|
evas_object_smart_callback_add(o, "changed",
|
||||||
_cb_op_helper_local_image_chg, term);
|
_cb_op_helper_local_image_chg, ctx);
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
o = elm_label_add(tb);
|
o = elm_label_add(tb);
|
||||||
|
@ -393,7 +440,7 @@ options_mouse(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_table_pack(tb, o, 1, row, 1, 1);
|
elm_table_pack(tb, o, 1, row, 1, 1);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_smart_callback_add(o, "changed",
|
evas_object_smart_callback_add(o, "changed",
|
||||||
_cb_op_helper_local_video_chg, term);
|
_cb_op_helper_local_video_chg, ctx);
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
o = elm_label_add(tb);
|
o = elm_label_add(tb);
|
||||||
|
@ -418,7 +465,7 @@ options_mouse(Evas_Object *opbox, Evas_Object *term)
|
||||||
elm_table_pack(tb, o, 1, row, 1, 1);
|
elm_table_pack(tb, o, 1, row, 1, 1);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_smart_callback_add(o, "changed",
|
evas_object_smart_callback_add(o, "changed",
|
||||||
_cb_op_helper_local_general_chg, term);
|
_cb_op_helper_local_general_chg, ctx);
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
evas_object_size_hint_weight_set(opbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(opbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
|
Loading…
Reference in New Issue