summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSungtaek Hong <sth253.hong@samsung.com>2017-11-28 20:50:53 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-12-06 17:35:21 +0900
commit7e58dd5580e0ec917453f943a5730c928921b574 (patch)
tree72911c11247ed44d7bd3d445d4df78a29cefb58d
parent63af2870c7c2a46802dc85ff9aa66eb68626f339 (diff)
elm_code_widget: change efl_add to legacy_add
Summary: elm_code_widget is legacy add, thus efl_add is not available. Signed-off-by: Sungtaek Hong <sth253.hong@samsung.com> Reviewers: jpeg, cedric, ajwillia.ms, woohyun Differential Revision: https://phab.enlightenment.org/D5548
-rw-r--r--src/bin/elementary/test_code.c32
-rw-r--r--src/lib/elementary/elm_code_widget.c3
-rw-r--r--src/tests/elementary/elm_code_test_widget.c2
3 files changed, 27 insertions, 10 deletions
diff --git a/src/bin/elementary/test_code.c b/src/bin/elementary/test_code.c
index b05240c1af..e69e6ee26f 100644
--- a/src/bin/elementary/test_code.c
+++ b/src/bin/elementary/test_code.c
@@ -59,7 +59,11 @@ _elm_code_test_welcome_setup(Evas_Object *parent)
59 Elm_Code_Widget *widget; 59 Elm_Code_Widget *widget;
60 60
61 code = elm_code_create(); 61 code = elm_code_create();
62 widget = efl_add(ELM_CODE_WIDGET_CLASS, parent, elm_obj_code_widget_code_set(efl_added, code)); 62 widget = elm_code_widget_add(parent, code);
63 evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
64 evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL);
65 evas_object_show(widget);
66
63 efl_event_callback_add(widget, &ELM_CODE_EVENT_LINE_LOAD_DONE, _elm_code_test_line_done_cb, NULL); 67 efl_event_callback_add(widget, &ELM_CODE_EVENT_LINE_LOAD_DONE, _elm_code_test_line_done_cb, NULL);
64 efl_event_callback_add(widget, ELM_OBJ_CODE_WIDGET_EVENT_LINE_CLICKED, _elm_code_test_line_clicked_cb, code); 68 efl_event_callback_add(widget, ELM_OBJ_CODE_WIDGET_EVENT_LINE_CLICKED, _elm_code_test_line_clicked_cb, code);
65 69
@@ -90,7 +94,11 @@ _elm_code_test_editor_setup(Evas_Object *parent, Eina_Bool log)
90 Elm_Code_Widget *widget; 94 Elm_Code_Widget *widget;
91 95
92 code = elm_code_create(); 96 code = elm_code_create();
93 widget = efl_add(ELM_CODE_WIDGET_CLASS, parent, elm_obj_code_widget_code_set(efl_added, code)); 97 widget = elm_code_widget_add(parent, code);
98 evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
99 evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL);
100 evas_object_show(widget);
101
94 elm_obj_code_widget_font_set(widget, NULL, 14); 102 elm_obj_code_widget_font_set(widget, NULL, 14);
95 elm_obj_code_widget_editable_set(widget, EINA_TRUE); 103 elm_obj_code_widget_editable_set(widget, EINA_TRUE);
96 elm_obj_code_widget_show_whitespace_set(widget, EINA_TRUE); 104 elm_obj_code_widget_show_whitespace_set(widget, EINA_TRUE);
@@ -118,7 +126,11 @@ _elm_code_test_syntax_setup(Evas_Object *parent)
118 Elm_Code_Widget *widget; 126 Elm_Code_Widget *widget;
119 127
120 code = elm_code_create(); 128 code = elm_code_create();
121 widget = efl_add(ELM_CODE_WIDGET_CLASS, parent, elm_obj_code_widget_code_set(efl_added, code)); 129 widget = elm_code_widget_add(parent, code);
130 evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
131 evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL);
132 evas_object_show(widget);
133
122 elm_obj_code_widget_editable_set(widget, EINA_TRUE); 134 elm_obj_code_widget_editable_set(widget, EINA_TRUE);
123 elm_obj_code_widget_syntax_enabled_set(widget, EINA_TRUE); 135 elm_obj_code_widget_syntax_enabled_set(widget, EINA_TRUE);
124 elm_obj_code_widget_code_get(widget)->file->mime = "text/x-csrc"; 136 elm_obj_code_widget_code_get(widget)->file->mime = "text/x-csrc";
@@ -144,12 +156,13 @@ _elm_code_test_mirror_setup(Elm_Code *code, char *font_name, Evas_Object *parent
144{ 156{
145 Elm_Code_Widget *widget; 157 Elm_Code_Widget *widget;
146 158
147 widget = efl_add(ELM_CODE_WIDGET_CLASS, parent, elm_obj_code_widget_code_set(efl_added, code)); 159 widget = elm_code_widget_add(parent, code);
148 elm_obj_code_widget_font_set(widget, font_name, 11);
149 elm_obj_code_widget_line_numbers_set(widget, EINA_TRUE);
150
151 evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 160 evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
152 evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL); 161 evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL);
162 evas_object_show(widget);
163
164 elm_obj_code_widget_font_set(widget, font_name, 11);
165 elm_obj_code_widget_line_numbers_set(widget, EINA_TRUE);
153 166
154 return widget; 167 return widget;
155} 168}
@@ -161,7 +174,10 @@ _elm_code_test_diff_inline_setup(Evas_Object *parent)
161 Elm_Code *code; 174 Elm_Code *code;
162 175
163 code = elm_code_create(); 176 code = elm_code_create();
164 diff = efl_add(ELM_CODE_WIDGET_CLASS, parent, elm_obj_code_widget_code_set(efl_added, code)); 177 diff = elm_code_widget_add(parent, code);
178 evas_object_size_hint_weight_set(diff, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
179 evas_object_size_hint_align_set(diff, EVAS_HINT_FILL, EVAS_HINT_FILL);
180 evas_object_show(diff);
165 181
166 elm_code_parser_standard_add(code, ELM_CODE_PARSER_STANDARD_DIFF); 182 elm_code_parser_standard_add(code, ELM_CODE_PARSER_STANDARD_DIFF);
167 elm_code_file_open(code, PACKAGE_DATA_DIR "/testdiff.diff"); 183 elm_code_file_open(code, PACKAGE_DATA_DIR "/testdiff.diff");
diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c
index c4f3e9c062..b3ae252fc9 100644
--- a/src/lib/elementary/elm_code_widget.c
+++ b/src/lib/elementary/elm_code_widget.c
@@ -2042,7 +2042,8 @@ _elm_code_widget_code_set(Eo *obj, Elm_Code_Widget_Data *pd, Elm_Code *code)
2042 2042
2043 pd->code = code; 2043 pd->code = code;
2044 2044
2045 code->widgets = eina_list_append(code->widgets, obj); 2045 if (code)
2046 code->widgets = eina_list_append(code->widgets, obj);
2046} 2047}
2047 2048
2048EOLIAN static Elm_Code * 2049EOLIAN static Elm_Code *
diff --git a/src/tests/elementary/elm_code_test_widget.c b/src/tests/elementary/elm_code_test_widget.c
index c9fd6e8740..e832449776 100644
--- a/src/tests/elementary/elm_code_test_widget.c
+++ b/src/tests/elementary/elm_code_test_widget.c
@@ -102,7 +102,7 @@ START_TEST (elm_code_widget_construct_nocode)
102 elm_init(1, NULL); 102 elm_init(1, NULL);
103 103
104 win = elm_win_add(NULL, "entry", ELM_WIN_BASIC); 104 win = elm_win_add(NULL, "entry", ELM_WIN_BASIC);
105 widget = efl_add(ELM_CODE_WIDGET_CLASS, win); 105 widget = elm_code_widget_add(win, NULL);
106 ck_assert(!widget); 106 ck_assert(!widget);
107 107
108 elm_shutdown(); 108 elm_shutdown();