summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2020-07-21 23:46:02 +0200
committerBoris Faure <billiob@gmail.com>2020-07-21 23:46:02 +0200
commit6b8409dfda313c1cdb9aa74238d50021973cd967 (patch)
treef27da3889b011f99dd628cb4f842eb258b07e14a
parentce788a69f6071d102e4278bd3574d23bafbbe958 (diff)
about: add twitter link
-rw-r--r--data/themes/default/about.edc2
-rw-r--r--data/themes/default/base.edc242
-rw-r--r--src/bin/about.c33
3 files changed, 273 insertions, 4 deletions
diff --git a/data/themes/default/about.edc b/data/themes/default/about.edc
index 3623fa9..aae49bc 100644
--- a/data/themes/default/about.edc
+++ b/data/themes/default/about.edc
@@ -70,7 +70,7 @@ group { name: "terminology/about";
70 aspect_preference: BOTH; 70 aspect_preference: BOTH;
71 image.normal: "ab_shell.png"; 71 image.normal: "ab_shell.png";
72 } 72 }
73 } 73 }
74 } 74 }
75 programs { 75 programs {
76 program { 76 program {
diff --git a/data/themes/default/base.edc b/data/themes/default/base.edc
index d262dfd..29c5911 100644
--- a/data/themes/default/base.edc
+++ b/data/themes/default/base.edc
@@ -1,7 +1,12 @@
1group { name: "terminology/base"; 1group { name: "terminology/base";
2 images.image: "pm_shadow.png" COMP; 2 images {
3 images.image: "bg_bevel.png" COMP; 3 image: "pm_shadow.png" COMP;
4 images.image: "bg_glint.png" COMP; 4 image: "bg_bevel.png" COMP;
5 image: "bg_glint.png" COMP;
6 image: "lk_bottom.png" COMP;
7 image: "lk_left.png" COMP;
8 image: "lk_right.png" COMP;
9 }
5 parts { 10 parts {
6 part { name: "terminology.content"; type: SWALLOW; 11 part { name: "terminology.content"; type: SWALLOW;
7 description { state: "default" 0.0; 12 description { state: "default" 0.0;
@@ -143,17 +148,248 @@ group { name: "terminology/base";
143 rel2.relative: 1.0 1.0; 148 rel2.relative: 1.0 1.0;
144 } 149 }
145 } 150 }
151 part { name: "twitter.base"; type: RECT;
152 mouse_events: 0;
153 scale: 1;
154 description { state: "default" 0.0;
155 visible: 0;
156 fixed: 1 1;
157 rel1 {
158 to_y: "terminology.about";
159 relative: 0.0 1.0;
160 }
161 rel2 {
162 relative: 0.5 1.0;
163 }
164 }
165 }
166 part { name: "twitter.txt"; type: TEXT;
167 mouse_events: 1;
168 scale: 1;
169 effect: GLOW;
170 description { state: "default" 0.0;
171 visible: 0;
172 align: 1.0 0.5;
173 fixed: 1 1;
174 rel1 {
175 to: "twitter.base";
176 relative: 0.5 0.5;
177 }
178 rel2 {
179 to: "twitter.base";
180 relative: 0.5 0.5;
181 }
182 color: 51 255 17 255;
183 color2: 136 255 136 40;
184 color3: 136 255 136 8;
185 text {
186 font: "Sans"; size: 11;
187 text: "Twitter: @_Terminology_";
188 align: 1.0 0.5;
189 min: 1 1;
190 }
191 }
192 description { state: "visible" 0.0;
193 inherit: "default" 0.0;
194 visible: 1;
195 }
196 }
197 part { name: "twitter.bottom";
198 mouse_events: 0;
199 description { state: "default" 0.0;
200 fixed: 1 1;
201 image.normal: "lk_bottom.png";
202 image.border: 9 9 0 0;
203 align: 0.5 1.0;
204 min: 20 8;
205 rel1 {
206 to: "twitter.txt";
207 offset: -6 -2;
208 relative: 0.0 1.0;
209 }
210 rel2 {
211 to: "twitter.txt";
212 offset: 5 -1;
213 }
214 color: 51 255 17 255;
215 fill.smooth: 0;
216 visible: 0;
217 }
218 description { state: "visible" 0.0;
219 inherit: "default";
220 visible: 1;
221 }
222 }
223 part { name: "twitter.l";
224 mouse_events: 0;
225 description { state: "default" 0.0;
226 fixed: 1 1;
227 image.normal: "lk_left.png";
228 align: 0.0 1.0;
229 min: 4 4;
230 rel1 {
231 to: "twitter.txt";
232 offset: 6 -2;
233 relative: 0.0 1.0;
234 }
235 rel2 {
236 to: "twitter.txt";
237 offset: 6 -2;
238 relative: 0.0 1.0;
239 }
240 color: 51 255 17 255;
241 visible: 0;
242 }
243 description { state: "visible" 0.0;
244 inherit: "default";
245 visible: 1;
246 }
247 description { state: "out" 0.0;
248 fixed: 1 1;
249 inherit: "visible" 0.0;
250 min: 16 16;
251 rel1 {
252 to: "twitter.txt";
253 offset: -10 -2;
254 }
255 rel2 {
256 to: "twitter.txt";
257 offset: -10 -2;
258 }
259 color: 51 255 17 255;
260 }
261 description { state: "out2" 0.0;
262 fixed: 1 1;
263 inherit: "visible" 0.0;
264 min: 32 32;
265 rel1 {
266 to: "twitter.txt";
267 offset: -26 -2;
268 }
269 rel2 {
270 to: "twitter.txt";
271 offset: -26 -2;
272 }
273 color: 51 255 17 0;
274 }
275 }
276 part { name: "twitter.r";
277 mouse_events: 0;
278 description { state: "default" 0.0;
279 fixed: 1 1;
280 image.normal: "lk_right.png";
281 align: 1.0 1.0;
282 min: 4 4;
283 rel1 {
284 to: "twitter.txt";
285 offset: -5 -1;
286 relative: 1.0 1.0;
287 }
288 rel2 {
289 to: "twitter.txt";
290 offset: -5 -1;
291 relative: 1.0 1.0;
292 }
293 color: 51 255 17 0;
294 visible: 0;
295 }
296 description { state: "visible" 0.0;
297 inherit: "default";
298 visible: 1;
299 }
300 description { state: "out" 0.0;
301 fixed: 1 1;
302 inherit: "visible" 0.0;
303 min: 16 16;
304 rel1 {
305 to: "twitter.txt";
306 offset: 9 -2;
307 }
308 rel2 {
309 to: "twitter.txt";
310 offset: 9 -2;
311 }
312 color: 51 255 17 255;
313 }
314 description { state: "out2" 0.0;
315 fixed: 1 1;
316 inherit: "visible" 0.0;
317 min: 32 32;
318 rel1 {
319 to: "twitter.txt";
320 offset: 25 -2;
321 }
322 rel2 {
323 to: "twitter.txt";
324 offset: 25 -2;
325 }
326 color: 51 255 17 0;
327 }
328 }
329 program { name: "twitter.show2";
330 action: STATE_SET "out2" 0.0;
331 transition: LINEAR 0.3;
332 target: "twitter.l";
333 target: "twitter.r";
334 after: "twitter.show3";
335 }
336 program { name: "twitter.show3";
337 action: STATE_SET "default" 0.0;
338 target: "twitter.l";
339 target: "twitter.r";
340 after: "twitter.show";
341 }
342 program {
343 name: "twitter.show_bottom";
344 signal: "mouse,in"; source: "twitter.txt";
345 action: STATE_SET "visible" 0.0;
346 target: "twitter.bottom";
347 }
348 program {
349 name: "twitter.show";
350 signal: "mouse,in"; source: "twitter.txt";
351 action: STATE_SET "out" 0.0;
352 transition: LINEAR 0.3;
353 target: "twitter.l";
354 target: "twitter.r";
355 after: "twitter.show2";
356 }
357 program {
358 signal: "mouse,out"; source: "twitter.txt";
359 action: STATE_SET "visible" 0.0;
360 target: "twitter.txt";
361 }
362 program {
363 signal: "mouse,out"; source: "twitter.txt";
364 action: ACTION_STOP;
365 target: "twitter.show";
366 target: "twitter.show2";
367 target: "twitter.show3";
368 }
369 program {
370 signal: "mouse,out"; source: "twitter.txt";
371 action: STATE_SET "default" 0.0;
372 target: "twitter.bottom";
373 target: "twitter.l";
374 target: "twitter.r";
375 }
376 program {
377 signal: "mouse,down,1"; source: "twitter.txt";
378 action: SIGNAL_EMIT "about,twitter" "terminology";
379 }
146 program { 380 program {
147 signal: "about,show"; source: "terminology"; 381 signal: "about,show"; source: "terminology";
148 action: STATE_SET "visible" 0.0; 382 action: STATE_SET "visible" 0.0;
149 transition: SPRING 1.2 2.0 6; 383 transition: SPRING 1.2 2.0 6;
150 target: "terminology.about"; 384 target: "terminology.about";
385 target: "twitter.txt";
151 } 386 }
152 program { 387 program {
153 signal: "about,hide"; source: "terminology"; 388 signal: "about,hide"; source: "terminology";
154 action: STATE_SET "default" 0.0; 389 action: STATE_SET "default" 0.0;
155 transition: DECELERATE 0.6; 390 transition: DECELERATE 0.6;
156 target: "terminology.about"; 391 target: "terminology.about";
392 target: "twitter.txt";
157 } 393 }
158 394
159 395
diff --git a/src/bin/about.c b/src/bin/about.c
index d876e69..4a9d937 100644
--- a/src/bin/about.c
+++ b/src/bin/about.c
@@ -15,6 +15,7 @@ typedef struct _about_ctx {
15 Evas_Object *term; 15 Evas_Object *term;
16 void (*donecb) (void *data); 16 void (*donecb) (void *data);
17 void *donedata; 17 void *donedata;
18 Config *config;
18} About_Ctx; 19} About_Ctx;
19 20
20 21
@@ -28,6 +29,32 @@ _cb_del_delay(void *data)
28} 29}
29 30
30static void 31static void
32_run_url(const About_Ctx *ctx,
33 const char *url)
34{
35 char buf[PATH_MAX];
36 const char *cmd = "xdg-open";
37
38 if (ctx->config && ctx->config->helper.url.general &&
39 ctx->config->helper.url.general[0])
40 cmd = ctx->config->helper.url.general;
41
42 snprintf(buf, sizeof(buf), "%s %s", cmd, url);
43 ecore_exe_run(buf, NULL);
44}
45
46static void
47_cb_twitter(void *data,
48 Evas_Object *_obj EINA_UNUSED,
49 const char *_sig EINA_UNUSED,
50 const char *_src EINA_UNUSED)
51{
52 About_Ctx *ctx = data;
53
54 _run_url(ctx, "https://twitter.com/_Terminology_");
55}
56
57static void
31_cb_mouse_down(void *data, 58_cb_mouse_down(void *data,
32 Evas *_e EINA_UNUSED, 59 Evas *_e EINA_UNUSED,
33 Evas_Object *_obj EINA_UNUSED, 60 Evas_Object *_obj EINA_UNUSED,
@@ -47,6 +74,8 @@ _cb_mouse_down(void *data,
47 74
48 if (ctx->donecb) 75 if (ctx->donecb)
49 ctx->donecb(ctx->donedata); 76 ctx->donecb(ctx->donedata);
77 elm_layout_signal_callback_del(ctx->base, "about,twitter", "*",
78 _cb_twitter);
50 79
51 free(ctx); 80 free(ctx);
52} 81}
@@ -68,6 +97,7 @@ about_show(Evas_Object *win, Evas_Object *base, Evas_Object *term,
68 ctx->term = term; 97 ctx->term = term;
69 ctx->donecb = donecb; 98 ctx->donecb = donecb;
70 ctx->donedata = donedata; 99 ctx->donedata = donedata;
100 ctx->config = config;
71 101
72 ctx->layout = o = elm_layout_add(win); 102 ctx->layout = o = elm_layout_add(win);
73 if (elm_layout_file_set(o, config_theme_path_get(config), 103 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,
195 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, 225 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
196 _cb_mouse_down, ctx); 226 _cb_mouse_down, ctx);
197 227
228 elm_layout_signal_callback_add(base, "about,twitter", "*",
229 _cb_twitter, ctx);
230
198 elm_layout_signal_emit(base, "about,show", "terminology"); 231 elm_layout_signal_emit(base, "about,show", "terminology");
199 elm_object_signal_emit(ctx->layout, "begin" ,"terminology"); 232 elm_object_signal_emit(ctx->layout, "begin" ,"terminology");
200 elm_object_focus_set(ctx->layout, EINA_TRUE); 233 elm_object_focus_set(ctx->layout, EINA_TRUE);