summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2013-08-27 18:47:56 +0200
committerBoris Faure <billiob@gmail.com>2013-08-27 18:47:56 +0200
commit4f78faf5c80714758a5ba50b29a55794cb2ffb8b (patch)
treeebb5bed6b1d1754bf88b7c9e4bda02129f84c738
parent30392f23a9b824b57adccdc7972420f45995b303 (diff)
use a macro instead of some copy/pasta
-rw-r--r--src/bin/main.c80
1 files changed, 20 insertions, 60 deletions
diff --git a/src/bin/main.c b/src/bin/main.c
index 184f9f2..974566c 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -1427,65 +1427,25 @@ _tab_go(Term *term, int tnum)
1427 _sel_go(sp, term2); 1427 _sel_go(sp, term2);
1428} 1428}
1429 1429
1430static void 1430#define CB_TAB(TAB) \
1431_cb_tab_1(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) 1431static void \
1432{ 1432_cb_tab_##TAB(void *data, Evas_Object *obj EINA_UNUSED, \
1433 _tab_go(data, 0); 1433 void *event EINA_UNUSED) \
1434} 1434{ \
1435 1435 _tab_go(data, TAB - 1); \
1436static void 1436}
1437_cb_tab_2(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) 1437
1438{ 1438CB_TAB(1)
1439 _tab_go(data, 1); 1439CB_TAB(2)
1440} 1440CB_TAB(3)
1441 1441CB_TAB(4)
1442static void 1442CB_TAB(5)
1443_cb_tab_3(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) 1443CB_TAB(6)
1444{ 1444CB_TAB(7)
1445 _tab_go(data, 2); 1445CB_TAB(8)
1446} 1446CB_TAB(9)
1447 1447CB_TAB(10)
1448static void 1448#undef CB_TAB
1449_cb_tab_4(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
1450{
1451 _tab_go(data, 3);
1452}
1453
1454static void
1455_cb_tab_5(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
1456{
1457 _tab_go(data, 4);
1458}
1459
1460static void
1461_cb_tab_6(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
1462{
1463 _tab_go(data, 5);
1464}
1465
1466static void
1467_cb_tab_7(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
1468{
1469 _tab_go(data, 6);
1470}
1471
1472static void
1473_cb_tab_8(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
1474{
1475 _tab_go(data, 7);
1476}
1477
1478static void
1479_cb_tab_9(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
1480{
1481 _tab_go(data, 8);
1482}
1483
1484static void
1485_cb_tab_0(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
1486{
1487 _tab_go(data, 9);
1488}
1489 1449
1490static Eina_Bool 1450static Eina_Bool
1491_cb_cmd_focus(void *data) 1451_cb_cmd_focus(void *data)
@@ -2166,7 +2126,7 @@ main_term_new(Win *wn, Config *config, const char *cmd,
2166 evas_object_smart_callback_add(o, "tab,7", _cb_tab_7, term); 2126 evas_object_smart_callback_add(o, "tab,7", _cb_tab_7, term);
2167 evas_object_smart_callback_add(o, "tab,8", _cb_tab_8, term); 2127 evas_object_smart_callback_add(o, "tab,8", _cb_tab_8, term);
2168 evas_object_smart_callback_add(o, "tab,9", _cb_tab_9, term); 2128 evas_object_smart_callback_add(o, "tab,9", _cb_tab_9, term);
2169 evas_object_smart_callback_add(o, "tab,0", _cb_tab_0, term); 2129 evas_object_smart_callback_add(o, "tab,0", _cb_tab_10, term);
2170 evas_object_show(o); 2130 evas_object_show(o);
2171 2131
2172 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, 2132 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,