about: add twitter link

This commit is contained in:
Boris Faure 2020-07-21 23:46:02 +02:00
parent ce788a69f6
commit 6b8409dfda
Signed by: borisfaure
GPG Key ID: 35C0410516166BE8
3 changed files with 273 additions and 4 deletions

View File

@ -70,7 +70,7 @@ group { name: "terminology/about";
aspect_preference: BOTH;
image.normal: "ab_shell.png";
}
}
}
}
programs {
program {

View File

@ -1,7 +1,12 @@
group { name: "terminology/base";
images.image: "pm_shadow.png" COMP;
images.image: "bg_bevel.png" COMP;
images.image: "bg_glint.png" COMP;
images {
image: "pm_shadow.png" COMP;
image: "bg_bevel.png" COMP;
image: "bg_glint.png" COMP;
image: "lk_bottom.png" COMP;
image: "lk_left.png" COMP;
image: "lk_right.png" COMP;
}
parts {
part { name: "terminology.content"; type: SWALLOW;
description { state: "default" 0.0;
@ -143,17 +148,248 @@ group { name: "terminology/base";
rel2.relative: 1.0 1.0;
}
}
part { name: "twitter.base"; type: RECT;
mouse_events: 0;
scale: 1;
description { state: "default" 0.0;
visible: 0;
fixed: 1 1;
rel1 {
to_y: "terminology.about";
relative: 0.0 1.0;
}
rel2 {
relative: 0.5 1.0;
}
}
}
part { name: "twitter.txt"; type: TEXT;
mouse_events: 1;
scale: 1;
effect: GLOW;
description { state: "default" 0.0;
visible: 0;
align: 1.0 0.5;
fixed: 1 1;
rel1 {
to: "twitter.base";
relative: 0.5 0.5;
}
rel2 {
to: "twitter.base";
relative: 0.5 0.5;
}
color: 51 255 17 255;
color2: 136 255 136 40;
color3: 136 255 136 8;
text {
font: "Sans"; size: 11;
text: "Twitter: @_Terminology_";
align: 1.0 0.5;
min: 1 1;
}
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
part { name: "twitter.bottom";
mouse_events: 0;
description { state: "default" 0.0;
fixed: 1 1;
image.normal: "lk_bottom.png";
image.border: 9 9 0 0;
align: 0.5 1.0;
min: 20 8;
rel1 {
to: "twitter.txt";
offset: -6 -2;
relative: 0.0 1.0;
}
rel2 {
to: "twitter.txt";
offset: 5 -1;
}
color: 51 255 17 255;
fill.smooth: 0;
visible: 0;
}
description { state: "visible" 0.0;
inherit: "default";
visible: 1;
}
}
part { name: "twitter.l";
mouse_events: 0;
description { state: "default" 0.0;
fixed: 1 1;
image.normal: "lk_left.png";
align: 0.0 1.0;
min: 4 4;
rel1 {
to: "twitter.txt";
offset: 6 -2;
relative: 0.0 1.0;
}
rel2 {
to: "twitter.txt";
offset: 6 -2;
relative: 0.0 1.0;
}
color: 51 255 17 255;
visible: 0;
}
description { state: "visible" 0.0;
inherit: "default";
visible: 1;
}
description { state: "out" 0.0;
fixed: 1 1;
inherit: "visible" 0.0;
min: 16 16;
rel1 {
to: "twitter.txt";
offset: -10 -2;
}
rel2 {
to: "twitter.txt";
offset: -10 -2;
}
color: 51 255 17 255;
}
description { state: "out2" 0.0;
fixed: 1 1;
inherit: "visible" 0.0;
min: 32 32;
rel1 {
to: "twitter.txt";
offset: -26 -2;
}
rel2 {
to: "twitter.txt";
offset: -26 -2;
}
color: 51 255 17 0;
}
}
part { name: "twitter.r";
mouse_events: 0;
description { state: "default" 0.0;
fixed: 1 1;
image.normal: "lk_right.png";
align: 1.0 1.0;
min: 4 4;
rel1 {
to: "twitter.txt";
offset: -5 -1;
relative: 1.0 1.0;
}
rel2 {
to: "twitter.txt";
offset: -5 -1;
relative: 1.0 1.0;
}
color: 51 255 17 0;
visible: 0;
}
description { state: "visible" 0.0;
inherit: "default";
visible: 1;
}
description { state: "out" 0.0;
fixed: 1 1;
inherit: "visible" 0.0;
min: 16 16;
rel1 {
to: "twitter.txt";
offset: 9 -2;
}
rel2 {
to: "twitter.txt";
offset: 9 -2;
}
color: 51 255 17 255;
}
description { state: "out2" 0.0;
fixed: 1 1;
inherit: "visible" 0.0;
min: 32 32;
rel1 {
to: "twitter.txt";
offset: 25 -2;
}
rel2 {
to: "twitter.txt";
offset: 25 -2;
}
color: 51 255 17 0;
}
}
program { name: "twitter.show2";
action: STATE_SET "out2" 0.0;
transition: LINEAR 0.3;
target: "twitter.l";
target: "twitter.r";
after: "twitter.show3";
}
program { name: "twitter.show3";
action: STATE_SET "default" 0.0;
target: "twitter.l";
target: "twitter.r";
after: "twitter.show";
}
program {
name: "twitter.show_bottom";
signal: "mouse,in"; source: "twitter.txt";
action: STATE_SET "visible" 0.0;
target: "twitter.bottom";
}
program {
name: "twitter.show";
signal: "mouse,in"; source: "twitter.txt";
action: STATE_SET "out" 0.0;
transition: LINEAR 0.3;
target: "twitter.l";
target: "twitter.r";
after: "twitter.show2";
}
program {
signal: "mouse,out"; source: "twitter.txt";
action: STATE_SET "visible" 0.0;
target: "twitter.txt";
}
program {
signal: "mouse,out"; source: "twitter.txt";
action: ACTION_STOP;
target: "twitter.show";
target: "twitter.show2";
target: "twitter.show3";
}
program {
signal: "mouse,out"; source: "twitter.txt";
action: STATE_SET "default" 0.0;
target: "twitter.bottom";
target: "twitter.l";
target: "twitter.r";
}
program {
signal: "mouse,down,1"; source: "twitter.txt";
action: SIGNAL_EMIT "about,twitter" "terminology";
}
program {
signal: "about,show"; source: "terminology";
action: STATE_SET "visible" 0.0;
transition: SPRING 1.2 2.0 6;
target: "terminology.about";
target: "twitter.txt";
}
program {
signal: "about,hide"; source: "terminology";
action: STATE_SET "default" 0.0;
transition: DECELERATE 0.6;
target: "terminology.about";
target: "twitter.txt";
}

View File

@ -15,6 +15,7 @@ typedef struct _about_ctx {
Evas_Object *term;
void (*donecb) (void *data);
void *donedata;
Config *config;
} About_Ctx;
@ -27,6 +28,32 @@ _cb_del_delay(void *data)
return EINA_FALSE;
}
static void
_run_url(const About_Ctx *ctx,
const char *url)
{
char buf[PATH_MAX];
const char *cmd = "xdg-open";
if (ctx->config && ctx->config->helper.url.general &&
ctx->config->helper.url.general[0])
cmd = ctx->config->helper.url.general;
snprintf(buf, sizeof(buf), "%s %s", cmd, url);
ecore_exe_run(buf, NULL);
}
static void
_cb_twitter(void *data,
Evas_Object *_obj EINA_UNUSED,
const char *_sig EINA_UNUSED,
const char *_src EINA_UNUSED)
{
About_Ctx *ctx = data;
_run_url(ctx, "https://twitter.com/_Terminology_");
}
static void
_cb_mouse_down(void *data,
Evas *_e EINA_UNUSED,
@ -47,6 +74,8 @@ _cb_mouse_down(void *data,
if (ctx->donecb)
ctx->donecb(ctx->donedata);
elm_layout_signal_callback_del(ctx->base, "about,twitter", "*",
_cb_twitter);
free(ctx);
}
@ -68,6 +97,7 @@ about_show(Evas_Object *win, Evas_Object *base, Evas_Object *term,
ctx->term = term;
ctx->donecb = donecb;
ctx->donedata = donedata;
ctx->config = config;
ctx->layout = o = elm_layout_add(win);
if (elm_layout_file_set(o, config_theme_path_get(config),
@ -195,6 +225,9 @@ about_show(Evas_Object *win, Evas_Object *base, Evas_Object *term,
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
_cb_mouse_down, ctx);
elm_layout_signal_callback_add(base, "about,twitter", "*",
_cb_twitter, ctx);
elm_layout_signal_emit(base, "about,show", "terminology");
elm_object_signal_emit(ctx->layout, "begin" ,"terminology");
elm_object_focus_set(ctx->layout, EINA_TRUE);