summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSungtaek Hong <sth253.hong@samsung.com>2017-11-28 20:50:53 +0900
committerSungtaek Hong <sth253.hong@samsung.com>2017-12-08 16:02:22 +0900
commit3490da0fffa3aed3109e68d9d26539c446b3c28f (patch)
tree76bf1076168648d4ae782b423a57dbfd95043d8f /src
parent751cf2c0d0d2dff2dcf55f3e49a16924a57e6da7 (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
Diffstat (limited to 'src')
-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 ab7c8d346f..b6dad3ea2f 100644
--- a/src/bin/elementary/test_code.c
+++ b/src/bin/elementary/test_code.c
@@ -63,7 +63,11 @@ _elm_code_test_welcome_setup(Evas_Object *parent)
63 Elm_Code_Widget *widget; 63 Elm_Code_Widget *widget;
64 64
65 code = elm_code_create(); 65 code = elm_code_create();
66 widget = efl_add(ELM_CODE_WIDGET_CLASS, parent, elm_obj_code_widget_code_set(efl_added, code)); 66 widget = elm_code_widget_add(parent, code);
67 evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
68 evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL);
69 evas_object_show(widget);
70
67 efl_event_callback_add(widget, &ELM_CODE_EVENT_LINE_LOAD_DONE, _elm_code_test_line_done_cb, NULL); 71 efl_event_callback_add(widget, &ELM_CODE_EVENT_LINE_LOAD_DONE, _elm_code_test_line_done_cb, NULL);
68 efl_event_callback_add(widget, ELM_OBJ_CODE_WIDGET_EVENT_LINE_CLICKED, _elm_code_test_line_clicked_cb, code); 72 efl_event_callback_add(widget, ELM_OBJ_CODE_WIDGET_EVENT_LINE_CLICKED, _elm_code_test_line_clicked_cb, code);
69 73
@@ -94,7 +98,11 @@ _elm_code_test_editor_setup(Evas_Object *parent, Eina_Bool log)
94 Elm_Code_Widget *widget; 98 Elm_Code_Widget *widget;
95 99
96 code = elm_code_create(); 100 code = elm_code_create();
97 widget = efl_add(ELM_CODE_WIDGET_CLASS, parent, elm_obj_code_widget_code_set(efl_added, code)); 101 widget = elm_code_widget_add(parent, code);
102 evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
103 evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL);
104 evas_object_show(widget);
105
98 elm_obj_code_widget_font_set(widget, NULL, 14); 106 elm_obj_code_widget_font_set(widget, NULL, 14);
99 elm_obj_code_widget_editable_set(widget, EINA_TRUE); 107 elm_obj_code_widget_editable_set(widget, EINA_TRUE);
100 elm_obj_code_widget_show_whitespace_set(widget, EINA_TRUE); 108 elm_obj_code_widget_show_whitespace_set(widget, EINA_TRUE);
@@ -122,7 +130,11 @@ _elm_code_test_syntax_setup(Evas_Object *parent)
122 Elm_Code_Widget *widget; 130 Elm_Code_Widget *widget;
123 131
124 code = elm_code_create(); 132 code = elm_code_create();
125 widget = efl_add(ELM_CODE_WIDGET_CLASS, parent, elm_obj_code_widget_code_set(efl_added, code)); 133 widget = elm_code_widget_add(parent, code);
134 evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
135 evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL);
136 evas_object_show(widget);
137
126 elm_obj_code_widget_editable_set(widget, EINA_TRUE); 138 elm_obj_code_widget_editable_set(widget, EINA_TRUE);
127 elm_obj_code_widget_syntax_enabled_set(widget, EINA_TRUE); 139 elm_obj_code_widget_syntax_enabled_set(widget, EINA_TRUE);
128 elm_obj_code_widget_code_get(widget)->file->mime = "text/x-csrc"; 140 elm_obj_code_widget_code_get(widget)->file->mime = "text/x-csrc";
@@ -148,12 +160,13 @@ _elm_code_test_mirror_setup(Elm_Code *code, char *font_name, Evas_Object *parent
148{ 160{
149 Elm_Code_Widget *widget; 161 Elm_Code_Widget *widget;
150 162
151 widget = efl_add(ELM_CODE_WIDGET_CLASS, parent, elm_obj_code_widget_code_set(efl_added, code)); 163 widget = elm_code_widget_add(parent, code);
152 elm_obj_code_widget_font_set(widget, font_name, 11);
153 elm_obj_code_widget_line_numbers_set(widget, EINA_TRUE);
154
155 evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 164 evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
156 evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL); 165 evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL);
166 evas_object_show(widget);
167
168 elm_obj_code_widget_font_set(widget, font_name, 11);
169 elm_obj_code_widget_line_numbers_set(widget, EINA_TRUE);
157 170
158 return widget; 171 return widget;
159} 172}
@@ -165,7 +178,10 @@ _elm_code_test_diff_inline_setup(Evas_Object *parent)
165 Elm_Code *code; 178 Elm_Code *code;
166 179
167 code = elm_code_create(); 180 code = elm_code_create();
168 diff = efl_add(ELM_CODE_WIDGET_CLASS, parent, elm_obj_code_widget_code_set(efl_added, code)); 181 diff = elm_code_widget_add(parent, code);
182 evas_object_size_hint_weight_set(diff, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
183 evas_object_size_hint_align_set(diff, EVAS_HINT_FILL, EVAS_HINT_FILL);
184 evas_object_show(diff);
169 185
170 elm_code_parser_standard_add(code, ELM_CODE_PARSER_STANDARD_DIFF); 186 elm_code_parser_standard_add(code, ELM_CODE_PARSER_STANDARD_DIFF);
171 elm_code_file_open(code, PACKAGE_DATA_DIR "/testdiff.diff"); 187 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 ee82acc0df..592b8aa4a2 100644
--- a/src/lib/elementary/elm_code_widget.c
+++ b/src/lib/elementary/elm_code_widget.c
@@ -2044,7 +2044,8 @@ _elm_code_widget_code_set(Eo *obj, Elm_Code_Widget_Data *pd, Elm_Code *code)
2044 2044
2045 pd->code = code; 2045 pd->code = code;
2046 2046
2047 code->widgets = eina_list_append(code->widgets, obj); 2047 if (code)
2048 code->widgets = eina_list_append(code->widgets, obj);
2048} 2049}
2049 2050
2050EOLIAN static Elm_Code * 2051EOLIAN 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();