summaryrefslogtreecommitdiff
path: root/src/modules/conf_keybindings/e_int_config_acpibindings.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2012-05-04 09:38:52 +0000
committerCedric BAIL <cedric.bail@free.fr>2012-05-04 09:38:52 +0000
commitc2a29811d59633a06de5b2468e5e41781859563a (patch)
treee712bb4ecf82d8694716944ae7ef8424c1e01a86 /src/modules/conf_keybindings/e_int_config_acpibindings.c
parent2d0970da9a693254234e4dad1c1a51bec7fa9060 (diff)
e: massiv warning cleanup !
SVN revision: 70756
Diffstat (limited to 'src/modules/conf_keybindings/e_int_config_acpibindings.c')
-rw-r--r--src/modules/conf_keybindings/e_int_config_acpibindings.c186
1 files changed, 93 insertions, 93 deletions
diff --git a/src/modules/conf_keybindings/e_int_config_acpibindings.c b/src/modules/conf_keybindings/e_int_config_acpibindings.c
index d8505f005..8bbee66e5 100644
--- a/src/modules/conf_keybindings/e_int_config_acpibindings.c
+++ b/src/modules/conf_keybindings/e_int_config_acpibindings.c
@@ -92,18 +92,18 @@ static void
92_fill_data(E_Config_Dialog_Data *cfdata) 92_fill_data(E_Config_Dialog_Data *cfdata)
93{ 93{
94 Eina_List *l; 94 Eina_List *l;
95 E_Config_Binding_Acpi *bind; 95 E_Config_Binding_Acpi *binding;
96 96
97 EINA_LIST_FOREACH(e_config->acpi_bindings, l, bind) 97 EINA_LIST_FOREACH(e_config->acpi_bindings, l, binding)
98 { 98 {
99 E_Config_Binding_Acpi *b2; 99 E_Config_Binding_Acpi *b2;
100 100
101 b2 = E_NEW(E_Config_Binding_Acpi, 1); 101 b2 = E_NEW(E_Config_Binding_Acpi, 1);
102 b2->context = bind->context; 102 b2->context = binding->context;
103 b2->type = bind->type; 103 b2->type = binding->type;
104 b2->status = bind->status; 104 b2->status = binding->status;
105 b2->action = eina_stringshare_ref(bind->action); 105 b2->action = eina_stringshare_ref(binding->action);
106 b2->params = eina_stringshare_ref(bind->params); 106 b2->params = eina_stringshare_ref(binding->params);
107 cfdata->bindings = eina_list_append(cfdata->bindings, b2); 107 cfdata->bindings = eina_list_append(cfdata->bindings, b2);
108 } 108 }
109} 109}
@@ -112,14 +112,14 @@ static void
112_free_data(E_Config_Dialog *cfd __UNUSED__, 112_free_data(E_Config_Dialog *cfd __UNUSED__,
113 E_Config_Dialog_Data *cfdata) 113 E_Config_Dialog_Data *cfdata)
114{ 114{
115 E_Config_Binding_Acpi *bind; 115 E_Config_Binding_Acpi *binding;
116 Ecore_Event_Handler *hdl; 116 Ecore_Event_Handler *hdl;
117 117
118 EINA_LIST_FREE(cfdata->bindings, bind) 118 EINA_LIST_FREE(cfdata->bindings, binding)
119 { 119 {
120 if (bind->action) eina_stringshare_del(bind->action); 120 if (binding->action) eina_stringshare_del(binding->action);
121 if (bind->params) eina_stringshare_del(bind->params); 121 if (binding->params) eina_stringshare_del(binding->params);
122 E_FREE(bind); 122 E_FREE(binding);
123 } 123 }
124 124
125 /* free the handlers */ 125 /* free the handlers */
@@ -147,26 +147,26 @@ static int
147_basic_apply(E_Config_Dialog *cfd __UNUSED__, 147_basic_apply(E_Config_Dialog *cfd __UNUSED__,
148 E_Config_Dialog_Data *cfdata) 148 E_Config_Dialog_Data *cfdata)
149{ 149{
150 E_Config_Binding_Acpi *bind, *b2; 150 E_Config_Binding_Acpi *binding, *b2;
151 Eina_List *l; 151 Eina_List *l;
152 152
153 EINA_LIST_FREE(e_config->acpi_bindings, bind) 153 EINA_LIST_FREE(e_config->acpi_bindings, binding)
154 { 154 {
155 e_bindings_acpi_del(bind->context, bind->type, bind->status, 155 e_bindings_acpi_del(binding->context, binding->type, binding->status,
156 bind->action, bind->params); 156 binding->action, binding->params);
157 if (bind->action) eina_stringshare_del(bind->action); 157 if (binding->action) eina_stringshare_del(binding->action);
158 if (bind->params) eina_stringshare_del(bind->params); 158 if (binding->params) eina_stringshare_del(binding->params);
159 E_FREE(bind); 159 E_FREE(binding);
160 } 160 }
161 161
162 EINA_LIST_FOREACH(cfdata->bindings, l, bind) 162 EINA_LIST_FOREACH(cfdata->bindings, l, binding)
163 { 163 {
164 b2 = E_NEW(E_Config_Binding_Acpi, 1); 164 b2 = E_NEW(E_Config_Binding_Acpi, 1);
165 b2->context = bind->context; 165 b2->context = binding->context;
166 b2->type = bind->type; 166 b2->type = binding->type;
167 b2->status = bind->status; 167 b2->status = binding->status;
168 b2->action = eina_stringshare_ref(bind->action); 168 b2->action = eina_stringshare_ref(binding->action);
169 b2->params = eina_stringshare_ref(bind->params); 169 b2->params = eina_stringshare_ref(binding->params);
170 e_config->acpi_bindings = 170 e_config->acpi_bindings =
171 eina_list_append(e_config->acpi_bindings, b2); 171 eina_list_append(e_config->acpi_bindings, b2);
172 172
@@ -230,7 +230,7 @@ _fill_bindings(E_Config_Dialog_Data *cfdata)
230{ 230{
231 Evas *evas; 231 Evas *evas;
232 Eina_List *l; 232 Eina_List *l;
233 E_Config_Binding_Acpi *bind; 233 E_Config_Binding_Acpi *binding;
234 int i = -1, mw; 234 int i = -1, mw;
235 235
236 evas = evas_object_evas_get(cfdata->o_bindings); 236 evas = evas_object_evas_get(cfdata->o_bindings);
@@ -239,7 +239,7 @@ _fill_bindings(E_Config_Dialog_Data *cfdata)
239 e_widget_ilist_freeze(cfdata->o_bindings); 239 e_widget_ilist_freeze(cfdata->o_bindings);
240 e_widget_ilist_clear(cfdata->o_bindings); 240 e_widget_ilist_clear(cfdata->o_bindings);
241 241
242 EINA_LIST_FOREACH(cfdata->bindings, l, bind) 242 EINA_LIST_FOREACH(cfdata->bindings, l, binding)
243 { 243 {
244 const char *lbl; 244 const char *lbl;
245 char buff[32]; 245 char buff[32];
@@ -247,7 +247,7 @@ _fill_bindings(E_Config_Dialog_Data *cfdata)
247 i++; 247 i++;
248 snprintf(buff, sizeof(buff), "%d", i); 248 snprintf(buff, sizeof(buff), "%d", i);
249 249
250 lbl = _binding_label_get(bind); 250 lbl = _binding_label_get(binding);
251 251
252 e_widget_ilist_append(cfdata->o_bindings, NULL, lbl, 252 e_widget_ilist_append(cfdata->o_bindings, NULL, lbl,
253 _cb_bindings_changed, cfdata, buff); 253 _cb_bindings_changed, cfdata, buff);
@@ -301,12 +301,12 @@ _fill_actions(E_Config_Dialog_Data *cfdata)
301static E_Config_Binding_Acpi * 301static E_Config_Binding_Acpi *
302_selected_binding_get(E_Config_Dialog_Data *cfdata) 302_selected_binding_get(E_Config_Dialog_Data *cfdata)
303{ 303{
304 E_Config_Binding_Acpi *bind; 304 E_Config_Binding_Acpi *binding;
305 305
306 if ((!cfdata) || (!cfdata->bindex)) return NULL; 306 if ((!cfdata) || (!cfdata->bindex)) return NULL;
307 if (!(bind = eina_list_nth(cfdata->bindings, atoi(cfdata->bindex)))) 307 if (!(binding = eina_list_nth(cfdata->bindings, atoi(cfdata->bindex))))
308 return NULL; 308 return NULL;
309 return bind; 309 return binding;
310} 310}
311 311
312static E_Action_Description * 312static E_Action_Description *
@@ -341,55 +341,55 @@ _selected_action_get(E_Config_Dialog_Data *cfdata)
341} 341}
342 342
343static const char * 343static const char *
344_binding_label_get(E_Config_Binding_Acpi *bind) 344_binding_label_get(E_Config_Binding_Acpi *binding)
345{ 345{
346 if (bind->type == E_ACPI_TYPE_UNKNOWN) return NULL; 346 if (binding->type == E_ACPI_TYPE_UNKNOWN) return NULL;
347 if (bind->type == E_ACPI_TYPE_AC_ADAPTER) 347 if (binding->type == E_ACPI_TYPE_AC_ADAPTER)
348 { 348 {
349 if (bind->status == 0) return _("AC Adapter Unplugged"); 349 if (binding->status == 0) return _("AC Adapter Unplugged");
350 if (bind->status == 1) return _("AC Adapter Plugged"); 350 if (binding->status == 1) return _("AC Adapter Plugged");
351 return _("Ac Adapter"); 351 return _("Ac Adapter");
352 } 352 }
353 if (bind->type == E_ACPI_TYPE_BATTERY) 353 if (binding->type == E_ACPI_TYPE_BATTERY)
354 return _("Battery"); 354 return _("Battery");
355 if (bind->type == E_ACPI_TYPE_BUTTON) 355 if (binding->type == E_ACPI_TYPE_BUTTON)
356 return _("Button"); 356 return _("Button");
357 if (bind->type == E_ACPI_TYPE_FAN) 357 if (binding->type == E_ACPI_TYPE_FAN)
358 return _("Fan"); 358 return _("Fan");
359 if (bind->type == E_ACPI_TYPE_LID) 359 if (binding->type == E_ACPI_TYPE_LID)
360 { 360 {
361 if (bind->status == E_ACPI_LID_UNKNOWN) return _("Lid Unknown"); 361 if (binding->status == E_ACPI_LID_UNKNOWN) return _("Lid Unknown");
362 if (bind->status == E_ACPI_LID_CLOSED) return _("Lid Closed"); 362 if (binding->status == E_ACPI_LID_CLOSED) return _("Lid Closed");
363 if (bind->status == E_ACPI_LID_OPEN) return _("Lid Opened"); 363 if (binding->status == E_ACPI_LID_OPEN) return _("Lid Opened");
364 return _("Lid"); 364 return _("Lid");
365 } 365 }
366 if (bind->type == E_ACPI_TYPE_POWER) 366 if (binding->type == E_ACPI_TYPE_POWER)
367 return _("Power Button"); 367 return _("Power Button");
368 if (bind->type == E_ACPI_TYPE_PROCESSOR) 368 if (binding->type == E_ACPI_TYPE_PROCESSOR)
369 return _("Processor"); 369 return _("Processor");
370 if (bind->type == E_ACPI_TYPE_SLEEP) 370 if (binding->type == E_ACPI_TYPE_SLEEP)
371 return _("Sleep Button"); 371 return _("Sleep Button");
372 if (bind->type == E_ACPI_TYPE_THERMAL) 372 if (binding->type == E_ACPI_TYPE_THERMAL)
373 return _("Thermal"); 373 return _("Thermal");
374 if (bind->type == E_ACPI_TYPE_VIDEO) 374 if (binding->type == E_ACPI_TYPE_VIDEO)
375 return _("Video"); 375 return _("Video");
376 if (bind->type == E_ACPI_TYPE_WIFI) 376 if (binding->type == E_ACPI_TYPE_WIFI)
377 return _("Wifi"); 377 return _("Wifi");
378 if (bind->type == E_ACPI_TYPE_HIBERNATE) 378 if (binding->type == E_ACPI_TYPE_HIBERNATE)
379 return _("Hibernate"); 379 return _("Hibernate");
380 if (bind->type == E_ACPI_TYPE_ZOOM_OUT) 380 if (binding->type == E_ACPI_TYPE_ZOOM_OUT)
381 return _("Zoom Out"); 381 return _("Zoom Out");
382 if (bind->type == E_ACPI_TYPE_ZOOM_IN) 382 if (binding->type == E_ACPI_TYPE_ZOOM_IN)
383 return _("Zoom In"); 383 return _("Zoom In");
384 if (bind->type == E_ACPI_TYPE_BRIGHTNESS_DOWN) 384 if (binding->type == E_ACPI_TYPE_BRIGHTNESS_DOWN)
385 return _("Brightness Down"); 385 return _("Brightness Down");
386 if (bind->type == E_ACPI_TYPE_BRIGHTNESS_UP) 386 if (binding->type == E_ACPI_TYPE_BRIGHTNESS_UP)
387 return _("Brightness Up"); 387 return _("Brightness Up");
388 if (bind->type == E_ACPI_TYPE_ASSIST) 388 if (binding->type == E_ACPI_TYPE_ASSIST)
389 return _("Assist"); 389 return _("Assist");
390 if (bind->type == E_ACPI_TYPE_S1) 390 if (binding->type == E_ACPI_TYPE_S1)
391 return _("S1"); 391 return _("S1");
392 if (bind->type == E_ACPI_TYPE_VAIO) 392 if (binding->type == E_ACPI_TYPE_VAIO)
393 return _("Vaio"); 393 return _("Vaio");
394 394
395 return _("Unknown"); 395 return _("Unknown");
@@ -399,14 +399,14 @@ static void
399_cb_bindings_changed(void *data) 399_cb_bindings_changed(void *data)
400{ 400{
401 E_Config_Dialog_Data *cfdata; 401 E_Config_Dialog_Data *cfdata;
402 E_Config_Binding_Acpi *bind; 402 E_Config_Binding_Acpi *binding;
403 Eina_List *items; 403 Eina_List *items;
404 const E_Ilist_Item *item; 404 const E_Ilist_Item *item;
405 int i = -1; 405 int i = -1;
406 406
407 if (!(cfdata = data)) return; 407 if (!(cfdata = data)) return;
408 e_widget_entry_clear(cfdata->o_params); 408 e_widget_entry_clear(cfdata->o_params);
409 if (!(bind = _selected_binding_get(cfdata))) 409 if (!(binding = _selected_binding_get(cfdata)))
410 { 410 {
411 e_widget_disabled_set(cfdata->o_params, EINA_TRUE); 411 e_widget_disabled_set(cfdata->o_params, EINA_TRUE);
412 e_widget_disabled_set(cfdata->o_del, EINA_TRUE); 412 e_widget_disabled_set(cfdata->o_del, EINA_TRUE);
@@ -422,7 +422,7 @@ _cb_bindings_changed(void *data)
422 422
423 i++; 423 i++;
424 if (!(val = e_widget_ilist_item_value_get(item))) continue; 424 if (!(val = e_widget_ilist_item_value_get(item))) continue;
425 if (strcmp(val, bind->action)) continue; 425 if (strcmp(val, binding->action)) continue;
426 e_widget_ilist_selected_set(cfdata->o_actions, i); 426 e_widget_ilist_selected_set(cfdata->o_actions, i);
427 break; 427 break;
428 } 428 }
@@ -432,12 +432,12 @@ static void
432_cb_actions_changed(void *data) 432_cb_actions_changed(void *data)
433{ 433{
434 E_Config_Dialog_Data *cfdata; 434 E_Config_Dialog_Data *cfdata;
435 E_Config_Binding_Acpi *bind; 435 E_Config_Binding_Acpi *binding;
436 E_Action_Description *dsc; 436 E_Action_Description *dsc;
437 437
438 if (!(cfdata = data)) return; 438 if (!(cfdata = data)) return;
439 e_widget_entry_clear(cfdata->o_params); 439 e_widget_entry_clear(cfdata->o_params);
440 if (!(bind = _selected_binding_get(cfdata))) 440 if (!(binding = _selected_binding_get(cfdata)))
441 { 441 {
442 e_widget_disabled_set(cfdata->o_params, EINA_TRUE); 442 e_widget_disabled_set(cfdata->o_params, EINA_TRUE);
443 e_widget_disabled_set(cfdata->o_del, EINA_TRUE); 443 e_widget_disabled_set(cfdata->o_del, EINA_TRUE);
@@ -449,13 +449,13 @@ _cb_actions_changed(void *data)
449 return; 449 return;
450 } 450 }
451 451
452 eina_stringshare_replace(&bind->action, dsc->act_cmd); 452 eina_stringshare_replace(&binding->action, dsc->act_cmd);
453 e_widget_disabled_set(cfdata->o_params, !(dsc->editable)); 453 e_widget_disabled_set(cfdata->o_params, !(dsc->editable));
454 454
455 if ((!dsc->editable) && (dsc->act_params)) 455 if ((!dsc->editable) && (dsc->act_params))
456 e_widget_entry_text_set(cfdata->o_params, dsc->act_params); 456 e_widget_entry_text_set(cfdata->o_params, dsc->act_params);
457 else if (bind->params) 457 else if (binding->params)
458 e_widget_entry_text_set(cfdata->o_params, bind->params); 458 e_widget_entry_text_set(cfdata->o_params, binding->params);
459 else 459 else
460 { 460 {
461 if ((!dsc->param_example) || (!dsc->param_example[0])) 461 if ((!dsc->param_example) || (!dsc->param_example[0]))
@@ -470,14 +470,14 @@ _cb_entry_changed(void *data,
470 void *data2 __UNUSED__) 470 void *data2 __UNUSED__)
471{ 471{
472 E_Config_Dialog_Data *cfdata; 472 E_Config_Dialog_Data *cfdata;
473 E_Config_Binding_Acpi *bind; 473 E_Config_Binding_Acpi *binding;
474 E_Action_Description *dsc; 474 E_Action_Description *dsc;
475 475
476 if (!(cfdata = data)) return; 476 if (!(cfdata = data)) return;
477 if (!(dsc = _selected_action_get(cfdata))) return; 477 if (!(dsc = _selected_action_get(cfdata))) return;
478 if (!dsc->editable) return; 478 if (!dsc->editable) return;
479 if (!(bind = _selected_binding_get(cfdata))) return; 479 if (!(binding = _selected_binding_get(cfdata))) return;
480 eina_stringshare_replace(&bind->params, 480 eina_stringshare_replace(&binding->params,
481 e_widget_entry_text_get(cfdata->o_params)); 481 e_widget_entry_text_get(cfdata->o_params));
482} 482}
483 483
@@ -528,22 +528,22 @@ _cb_del_binding(void *data,
528 void *data2 __UNUSED__) 528 void *data2 __UNUSED__)
529{ 529{
530 E_Config_Dialog_Data *cfdata; 530 E_Config_Dialog_Data *cfdata;
531 E_Config_Binding_Acpi *bind, *bind2; 531 E_Config_Binding_Acpi *binding, *bind2;
532 Eina_List *l; 532 Eina_List *l;
533 533
534 if (!(cfdata = data)) return; 534 if (!(cfdata = data)) return;
535 if (!(bind = _selected_binding_get(cfdata))) return; 535 if (!(binding = _selected_binding_get(cfdata))) return;
536 536
537 /* delete from e_config */ 537 /* delete from e_config */
538 EINA_LIST_FOREACH(e_config->acpi_bindings, l, bind2) 538 EINA_LIST_FOREACH(e_config->acpi_bindings, l, bind2)
539 { 539 {
540 if ((bind->context == bind2->context) && (bind->type == bind2->type) && 540 if ((binding->context == bind2->context) && (binding->type == bind2->type) &&
541 (((bind->action) && (bind2->action) && 541 (((binding->action) && (bind2->action) &&
542 (!strcmp(bind->action, bind2->action))) || 542 (!strcmp(binding->action, bind2->action))) ||
543 ((!bind->action) && (!bind2->action))) && 543 ((!binding->action) && (!bind2->action))) &&
544 (((bind->params) && (bind2->params) && 544 (((binding->params) && (bind2->params) &&
545 (!strcmp(bind->params, bind2->params))) || 545 (!strcmp(binding->params, bind2->params))) ||
546 ((!bind->params) && (!bind2->params)))) 546 ((!binding->params) && (!bind2->params))))
547 { 547 {
548 if (bind2->action) eina_stringshare_del(bind2->action); 548 if (bind2->action) eina_stringshare_del(bind2->action);
549 if (bind2->params) eina_stringshare_del(bind2->params); 549 if (bind2->params) eina_stringshare_del(bind2->params);
@@ -556,19 +556,19 @@ _cb_del_binding(void *data,
556 } 556 }
557 557
558 /* delete from e_bindings */ 558 /* delete from e_bindings */
559 e_bindings_acpi_del(bind->context, bind->type, bind->status, 559 e_bindings_acpi_del(binding->context, binding->type, binding->status,
560 bind->action, bind->params); 560 binding->action, binding->params);
561 561
562 /* delete from dialog list */ 562 /* delete from dialog list */
563 EINA_LIST_FOREACH(cfdata->bindings, l, bind2) 563 EINA_LIST_FOREACH(cfdata->bindings, l, bind2)
564 { 564 {
565 if ((bind->context == bind2->context) && (bind->type == bind2->type) && 565 if ((binding->context == bind2->context) && (binding->type == bind2->type) &&
566 (((bind->action) && (bind2->action) && 566 (((binding->action) && (bind2->action) &&
567 (!strcmp(bind->action, bind2->action))) || 567 (!strcmp(binding->action, bind2->action))) ||
568 ((!bind->action) && (!bind2->action))) && 568 ((!binding->action) && (!bind2->action))) &&
569 (((bind->params) && (bind2->params) && 569 (((binding->params) && (bind2->params) &&
570 (!strcmp(bind->params, bind2->params))) || 570 (!strcmp(binding->params, bind2->params))) ||
571 ((!bind->params) && (!bind2->params)))) 571 ((!binding->params) && (!bind2->params))))
572 { 572 {
573 if (bind2->action) eina_stringshare_del(bind2->action); 573 if (bind2->action) eina_stringshare_del(bind2->action);
574 if (bind2->params) eina_stringshare_del(bind2->params); 574 if (bind2->params) eina_stringshare_del(bind2->params);
@@ -625,7 +625,7 @@ _cb_acpi_event(void *data,
625{ 625{
626 E_Event_Acpi *ev; 626 E_Event_Acpi *ev;
627 E_Config_Dialog_Data *cfdata; 627 E_Config_Dialog_Data *cfdata;
628 E_Config_Binding_Acpi *bind; 628 E_Config_Binding_Acpi *binding;
629 Ecore_Event_Handler *hdl; 629 Ecore_Event_Handler *hdl;
630 630
631 ev = event; 631 ev = event;
@@ -646,12 +646,12 @@ _cb_acpi_event(void *data,
646 e_acpi_events_thaw(); 646 e_acpi_events_thaw();
647 647
648 /* NB: This may need more testing/parsing for event status */ 648 /* NB: This may need more testing/parsing for event status */
649 bind = E_NEW(E_Config_Binding_Acpi, 1); 649 binding = E_NEW(E_Config_Binding_Acpi, 1);
650 bind->context = E_BINDING_CONTEXT_NONE; 650 binding->context = E_BINDING_CONTEXT_NONE;
651 bind->type = ev->type; 651 binding->type = ev->type;
652 bind->status = ev->status; 652 binding->status = ev->status;
653 bind->action = eina_stringshare_add("dim_screen"); 653 binding->action = eina_stringshare_add("dim_screen");
654 bind->params = NULL; 654 binding->params = NULL;
655 655
656 cfdata->bindings = eina_list_append(cfdata->bindings, bind); 656 cfdata->bindings = eina_list_append(cfdata->bindings, bind);
657 _fill_bindings(cfdata); 657 _fill_bindings(cfdata);