summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMykyta Biliavskyi <m.biliavskyi@samsung.com>2017-12-21 12:50:55 +0200
committerMykyta Biliavskyi <m.biliavskyi@samsung.com>2017-12-21 12:50:55 +0200
commit352728b6bffef8b02b8e3ddaee4c87b1ea6a4368 (patch)
treee19d3038329d0b3ca3d809c8ebf11a2c9973a381
parentfaad95932c963f2815743ca57189fea903c0a628 (diff)
Find UI: update combobox content on log open.
Summary: Update find combobox items each time when log file opens. This needed for cases when different log files contains different events. Function _find_combobox_create was slitted into 2 functions. New one is _find_combobox_update - uses for update content of combobox list. Reviewers: Deepwarrior, i.furs Reviewed By: Deepwarrior Maniphest Tasks: T6522 Differential Revision: https://phab.enlightenment.org/D5687
-rw-r--r--src/lib/ui.c66
-rw-r--r--src/lib/ui_private.h2
2 files changed, 43 insertions, 25 deletions
diff --git a/src/lib/ui.c b/src/lib/ui.c
index 814e817..2c5afba 100644
--- a/src/lib/ui.c
+++ b/src/lib/ui.c
@@ -27,6 +27,7 @@
27#define MIN_LENGTH_BETWEEN_TIMEMARKS 140 27#define MIN_LENGTH_BETWEEN_TIMEMARKS 140
28 28
29static void timemarks_fill(Global_Data *gd); 29static void timemarks_fill(Global_Data *gd);
30static void _find_combobox_update(Find_UI *find, In_Thread_Data *thd);
30 31
31#define ZERO_LOG_EVENT {NULL, NULL, 0.0} 32#define ZERO_LOG_EVENT {NULL, NULL, 0.0}
32 33
@@ -848,6 +849,11 @@ _event_area_init_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
848 elm_object_part_content_set(info_panes, "bottom", info_layout); 849 elm_object_part_content_set(info_panes, "bottom", info_layout);
849 elm_panes_content_right_size_set(info_panes, 0.05); 850 elm_panes_content_right_size_set(info_panes, 0.05);
850 851
852 if (gd->ui->find.combobox)
853 {
854 _find_combobox_update(&gd->ui->find, gd->thd);
855 }
856
851 elm_object_part_content_set(panes, "top", info_panes); 857 elm_object_part_content_set(panes, "top", info_panes);
852 858
853 evas_object_event_callback_add(table, EVAS_CALLBACK_MOUSE_DOWN, 859 evas_object_event_callback_add(table, EVAS_CALLBACK_MOUSE_DOWN,
@@ -2556,31 +2562,21 @@ _go_toolbar_item_clicked_cb(void *data,
2556 _switch_find_ui_mode(find); 2562 _switch_find_ui_mode(find);
2557} 2563}
2558 2564
2559static Evas_Object * 2565static void
2560_find_combobox_create(Find_UI *find, In_Thread_Data *thd) 2566_find_combobox_update(Find_UI *find, In_Thread_Data *thd)
2561{ 2567{
2562 Evas_Object *combobox = NULL;
2563 Elm_Genlist_Item_Class *itc = NULL;
2564 Eina_List *names_list = NULL, *l = NULL; 2568 Eina_List *names_list = NULL, *l = NULL;
2565 char *key = NULL; 2569 char *key = NULL;
2566 2570 if (!find->combobox_itc)
2567 combobox = elm_combobox_add(find->win); 2571 {
2568 evas_object_size_hint_weight_set(combobox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 2572 find->combobox_itc = elm_genlist_item_class_new();
2569 evas_object_size_hint_align_set(combobox, EVAS_HINT_FILL, EVAS_HINT_FILL); 2573 find->combobox_itc->item_style = "default";
2570 elm_object_part_text_set(combobox, "guide", _("Enter event name")); 2574 find->combobox_itc->func.text_get = _gl_text_get_cb;
2571 evas_object_show(combobox); 2575 find->combobox_itc->func.content_get = NULL;
2572 2576 find->combobox_itc->func.state_get = NULL;
2573 evas_object_smart_callback_add(combobox, "changed,user", _event_name_find_reset_color_cb, NULL); 2577 find->combobox_itc->func.filter_get = _gl_filter_get_cb;
2574 evas_object_smart_callback_add(combobox, "changed", _gl_filter_restart_cb, NULL); 2578 find->combobox_itc->func.del = NULL;
2575 evas_object_smart_callback_add(combobox, "item,pressed", _combobox_item_pressed_cb, NULL); 2579 }
2576
2577 itc = elm_genlist_item_class_new();
2578 itc->item_style = "default";
2579 itc->func.text_get = _gl_text_get_cb;
2580 itc->func.content_get = NULL;
2581 itc->func.state_get = NULL;
2582 itc->func.filter_get = _gl_filter_get_cb;
2583 itc->func.del = NULL;
2584 2580
2585 eina_rwlock_take_read(&thd->thread_events.lock); 2581 eina_rwlock_take_read(&thd->thread_events.lock);
2586 eina_hash_foreach(thd->thread_events.hash, _name_uniq_save_cb, &names_list); 2582 eina_hash_foreach(thd->thread_events.hash, _name_uniq_save_cb, &names_list);
@@ -2591,18 +2587,36 @@ _find_combobox_create(Find_UI *find, In_Thread_Data *thd)
2591 eina_rwlock_take_read(&thd->single_events.lock); 2587 eina_rwlock_take_read(&thd->single_events.lock);
2592 eina_hash_foreach(thd->single_events.hash, _name_uniq_save_cb, &names_list); 2588 eina_hash_foreach(thd->single_events.hash, _name_uniq_save_cb, &names_list);
2593 eina_rwlock_release(&thd->single_events.lock); 2589 eina_rwlock_release(&thd->single_events.lock);
2590 elm_combobox_hover_end(find->combobox);
2591 elm_genlist_clear(find->combobox);
2594 2592
2595 EINA_LIST_FOREACH(names_list, l, key) 2593 EINA_LIST_FOREACH(names_list, l, key)
2596 { 2594 {
2597 elm_genlist_item_append(combobox, 2595 elm_genlist_item_append(find->combobox,
2598 itc, 2596 find->combobox_itc,
2599 key, 2597 key,
2600 NULL, 2598 NULL,
2601 ELM_GENLIST_ITEM_NONE, 2599 ELM_GENLIST_ITEM_NONE,
2602 NULL, 2600 NULL,
2603 key); 2601 key);
2604 } 2602 }
2603 eina_list_free(names_list);
2604}
2605
2606static Evas_Object *
2607_find_combobox_create(Find_UI *find)
2608{
2609 Evas_Object *combobox = NULL;
2610
2611 combobox = elm_combobox_add(find->win);
2612 evas_object_size_hint_weight_set(combobox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2613 evas_object_size_hint_align_set(combobox, EVAS_HINT_FILL, EVAS_HINT_FILL);
2614 elm_object_part_text_set(combobox, "guide", _("Enter event name"));
2615 evas_object_show(combobox);
2605 2616
2617 evas_object_smart_callback_add(combobox, "changed,user", _event_name_find_reset_color_cb, NULL);
2618 evas_object_smart_callback_add(combobox, "changed", _gl_filter_restart_cb, NULL);
2619 evas_object_smart_callback_add(combobox, "item,pressed", _combobox_item_pressed_cb, NULL);
2606 return combobox; 2620 return combobox;
2607} 2621}
2608 2622
@@ -2648,7 +2662,8 @@ _menu_find_dialog_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info
2648 2662
2649 find->seek_range = SEEK_ALL; 2663 find->seek_range = SEEK_ALL;
2650 find->seek_mode = SEEK_FIND; 2664 find->seek_mode = SEEK_FIND;
2651 find->combobox = _find_combobox_create(find, gd->thd); 2665 find->combobox = _find_combobox_create(find);
2666 _find_combobox_update(find, gd->thd);
2652 find->find_layout = _find_layout_create(find, gd); 2667 find->find_layout = _find_layout_create(find, gd);
2653 find->go_layout = _go_layout_create(find, gd); 2668 find->go_layout = _go_layout_create(find, gd);
2654 elm_toolbar_item_append(toolbar, NULL, _("Find"), _find_toolbar_item_clicked_cb, gd); 2669 elm_toolbar_item_append(toolbar, NULL, _("Find"), _find_toolbar_item_clicked_cb, gd);
@@ -2754,6 +2769,7 @@ ui_shutdown(Evas_Object* content)
2754 if (gd->ui->find.win) 2769 if (gd->ui->find.win)
2755 { 2770 {
2756 evas_object_del(gd->ui->find.win); 2771 evas_object_del(gd->ui->find.win);
2772 elm_genlist_item_class_free(gd->ui->find.combobox_itc);
2757 } 2773 }
2758 free(gd->ui); 2774 free(gd->ui);
2759 free(gd); 2775 free(gd);
diff --git a/src/lib/ui_private.h b/src/lib/ui_private.h
index 1004f49..c3f13bb 100644
--- a/src/lib/ui_private.h
+++ b/src/lib/ui_private.h
@@ -80,6 +80,8 @@ typedef struct _Find_UI
80 Evas_Object *find_layout; 80 Evas_Object *find_layout;
81 Evas_Object *go_layout; 81 Evas_Object *go_layout;
82 82
83 Elm_Genlist_Item_Class *combobox_itc;
84
83 Seek_Range seek_range; 85 Seek_Range seek_range;
84 Seek_Mode seek_mode; 86 Seek_Mode seek_mode;
85 87