summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2016-05-08 22:34:26 +0200
committerDave Andreoli <dave@gurumeditation.it>2016-05-08 22:34:26 +0200
commit3787d33992318270b2ccf146423f88f4057cb421 (patch)
treea64e87810d9e811c241575b269d494a1503b3ac8 /src
parent4da0722a8d8abb5d2fec1879698fc2d3c04cc5c9 (diff)
Improve elm standard icons test
* use a genlist to speedup and make use of group ability * manually list the icons (otherwise old and deprecated icons show up) NOTE: as always this expose a new genlist bug: just change the size of the icons (with the radio button) and scroll the list...new realized items get a wrong size.
Diffstat (limited to 'src')
-rw-r--r--src/bin/elementary/test_icon.c331
1 files changed, 294 insertions, 37 deletions
diff --git a/src/bin/elementary/test_icon.c b/src/bin/elementary/test_icon.c
index e92f94944d..a70568dcc1 100644
--- a/src/bin/elementary/test_icon.c
+++ b/src/bin/elementary/test_icon.c
@@ -145,40 +145,298 @@ test_icon_transparent(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
145} 145}
146 146
147/* Test: Icon Standard */ 147/* Test: Icon Standard */
148static void 148static char *
149_standard_list_populate(Evas_Object *list, int size) 149_gl_group_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
150{
151 return strdup(data);
152}
153
154static char *
155_gl_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
156{
157 return strdup(data);
158}
159
160static Evas_Object *
161_gl_content_get(void *data, Evas_Object *obj, const char *part)
150{ 162{
151 Evas_Object *ic; 163 Evas_Object *ic;
152 Eina_List *l; 164 const char *name = data;
153 const char *group; 165 int size = elm_radio_value_get(evas_object_data_get(obj, "size_rdg"));
154 char name[128], *p;
155 166
156 elm_list_clear(list); 167 if (!strcmp(part, "elm.swallow.icon"))
157 l = elm_theme_group_base_list(NULL, "elm/icon/");
158 EINA_LIST_FREE(l, group)
159 { 168 {
160 // group = "/elm/icon/standard-name/style/maybe_another_style??" 169 ic = elm_icon_add(obj);
161 snprintf(name, sizeof(name), "%s", group + 9); 170 // evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
162 if ((p = strrchr(name, '/'))) 171 elm_icon_standard_set(ic, name);
163 *p = '\0'; 172 if (size)
164 // printf("Found group:%s Name:%s\n", group, name); 173 evas_object_size_hint_min_set(ic, size, size);
165 174 return ic;
166 // quick hack to show only standard-compliant icons
167 // apart from the "folder" one, all the others have "-" in the name
168 // ...also do not show deprecated arrow-* icons
169 if (((strrchr(name, '-') != NULL) || !strcmp(name, "folder")|| !strcmp(name, "starred"))
170 && (strncmp(name, "arrow-", 6)))
171 {
172 ic = elm_icon_add(list);
173 elm_icon_standard_set(ic, name);
174 if (size)
175 evas_object_size_hint_min_set(ic, size, size);
176 elm_list_item_append(list, name, ic, NULL, NULL, NULL);
177 }
178
179 eina_stringshare_del(group);
180 } 175 }
181 elm_list_go(list); 176
177 return NULL;
178}
179
180static void
181_standard_genlist_populate(Evas_Object *gl)
182{
183 Elm_Genlist_Item_Class *itc, *itc_g;
184 Elm_Object_Item *git;
185
186 itc_g = elm_genlist_item_class_new();
187 itc_g->item_style = "group_index";
188 itc_g->func.text_get = _gl_group_text_get;
189
190 itc = elm_genlist_item_class_new();
191 itc->item_style = "default";
192 itc->func.text_get = _gl_text_get;
193 itc->func.content_get = _gl_content_get;
194
195#define CONTEXT(NAME) \
196 git = elm_genlist_item_append(gl, itc_g, NAME, NULL, \
197 ELM_GENLIST_ITEM_GROUP, NULL, NULL);
198
199#define IC(NAME) \
200 elm_genlist_item_append(gl, itc, NAME, git, \
201 ELM_GENLIST_ITEM_NONE, NULL, NULL);
202
203 CONTEXT("Places")
204 IC("user-home")
205 IC("user-bookmarks")
206 IC("user-desktop")
207 IC("user-trash")
208 IC("folder")
209 IC("folder-remote")
210 IC("folder-open")
211 IC("folder-home")
212 IC("folder-download")
213 IC("folder-recent")
214 IC("folder-documents")
215 IC("folder-pictures")
216 IC("folder-music")
217 IC("folder-videos")
218 IC("network-server")
219 IC("network-workgroup")
220 IC("start-here")
221
222 CONTEXT("Emblems")
223 IC("emblem-default")
224 IC("emblem-downloads")
225 IC("emblem-favorite")
226 IC("emblem-important")
227 IC("emblem-readonly")
228 IC("emblem-shared")
229 IC("emblem-symbolic-link")
230 IC("emblem-unreadable")
231 IC("emblem-system")
232 IC("emblem-synchronized")
233 IC("emblem-synchronizing")
234
235 CONTEXT("Actions")
236 IC("application-exit")
237 IC("call-start")
238 IC("call-stop")
239 IC("document-open")
240 IC("document-page-setup")
241 IC("document-properties")
242 IC("document-save")
243 IC("document-save-as")
244 IC("document-send")
245 IC("document-close")
246 IC("document-new")
247 IC("document-print")
248 IC("document-print-preview")
249 IC("document-revert")
250 IC("document-export")
251 IC("document-import")
252 IC("edit-clear")
253 IC("edit-copy")
254 IC("edit-cut")
255 IC("edit-delete")
256 IC("edit-find")
257 IC("edit-find-replace")
258 IC("edit-paste")
259 IC("edit-redo")
260 IC("edit-undo")
261 IC("edit-select-all")
262 IC("folder-copy")
263 IC("folder-move")
264 IC("folder-new")
265 IC("format-indent-less")
266 IC("format-indent-more")
267 IC("format-justify-center")
268 IC("format-justify-fill")
269 IC("format-justify-left")
270 IC("format-justify-right")
271 IC("format-text-direction-ltr")
272 IC("format-text-direction-rtl")
273 IC("format-text-bold")
274 IC("format-text-italic")
275 IC("format-text-underline")
276 IC("format-text-strikethrough")
277 IC("go-home")
278 IC("go-bottom")
279 IC("go-down")
280 IC("go-first")
281 IC("go-jump")
282 IC("go-last")
283 IC("go-next")
284 IC("go-previous")
285 IC("go-top")
286 IC("go-up")
287 IC("insert-image")
288 IC("insert-link")
289 IC("insert-object")
290 IC("insert-text")
291 IC("list-add")
292 IC("list-remove")
293 IC("media-eject")
294 IC("media-playback-pause")
295 IC("media-playback-start")
296 IC("media-playback-stop")
297 IC("media-record")
298 IC("media-seek-backward")
299 IC("media-seek-forward")
300 IC("media-skip-backward")
301 IC("media-skip-forward")
302 IC("object-flip-horizontal")
303 IC("object-flip-vertical")
304 IC("object-rotate-left")
305 IC("object-rotate-right")
306 IC("process-stop")
307 IC("tools-check-spelling")
308 IC("view-list-compact")
309 IC("view-list-details")
310 IC("view-list-icons")
311 IC("view-fullscreen")
312 IC("view-refresh")
313 IC("view-restore")
314 IC("view-sort-ascending")
315 IC("view-sort-descending")
316 IC("view-close")
317 IC("window-close")
318 IC("window-new")
319 IC("system-run")
320 IC("system-shutdown")
321 IC("system-reboot")
322 IC("system-log-out")
323 IC("system-search")
324 IC("help-about")
325 IC("help-contents")
326 IC("zoom-fit-best")
327 IC("zoom-fit")
328 IC("zoom-in")
329 IC("zoom-original")
330 IC("zoom-out")
331
332 CONTEXT("Status")
333 IC("audio-volume-high")
334 IC("audio-volume-low")
335 IC("audio-volume-medium")
336 IC("audio-volume-muted")
337 IC("audio-volume")
338 IC("battery-caution")
339 IC("battery-empty")
340 IC("battery-low")
341 IC("battery-good")
342 IC("battery-full")
343 IC("battery-caution-charging")
344 IC("battery-empty-charging")
345 IC("battery-low-charging")
346 IC("battery-good-charging")
347 IC("battery-full-charging")
348 IC("bluetooth-active")
349 IC("bluetooth-disabled")
350 IC("changes-allow")
351 IC("changes-prevent")
352 IC("dialog-error")
353 IC("dialog-information")
354 IC("dialog-password")
355 IC("dialog-question")
356 IC("dialog-warning")
357 IC("media-playlist-repeat")
358 IC("media-playlist-shuffle")
359 IC("network-cellular-3g")
360 IC("network-cellular-4g")
361 IC("network-cellular-edge")
362 IC("network-cellular-gprs")
363 IC("network-cellular-umts")
364 IC("network-cellular-connected")
365 IC("network-cellular-signal-excellent")
366 IC("network-cellular-signal-good")
367 IC("network-cellular-signal-none")
368 IC("network-cellular-signal-ok")
369 IC("network-cellular-signal-weak")
370 IC("network-cellular-signal-acquiring")
371 IC("network-error")
372 IC("network-offline")
373 IC("network-receive")
374 IC("network-transmit-receive")
375 IC("network-transmit")
376 IC("network-idle")
377 IC("network-vpn")
378 IC("network-vpn-acquiring")
379 IC("network-wireless-acquiring")
380 IC("network-wireless-encrypted")
381 IC("network-wireless-signal-excellent")
382 IC("network-wireless-signal-good")
383 IC("network-wireless-signal-none")
384 IC("network-wireless-signal-ok")
385 IC("network-wireless-signal-weak")
386 IC("printer-error")
387 IC("printer-printing")
388 IC("printer-warning")
389 IC("security-high")
390 IC("security-medium")
391 IC("security-low")
392 IC("software-update-available")
393 IC("software-update-urgent")
394 IC("user-available")
395 IC("user-away")
396 IC("user-busy")
397 IC("user-invisible")
398 IC("user-idle")
399 IC("user-offline")
400 IC("weather-clear-night")
401 IC("weather-clear")
402 IC("weather-clouds-night")
403 IC("weather-clouds")
404 IC("weather-few-clouds-night")
405 IC("weather-few-clouds")
406 IC("weather-fog")
407 IC("weather-overcast")
408 IC("weather-severe-alert")
409 IC("weather-showers-scattered")
410 IC("weather-showers")
411 IC("weather-snow")
412 IC("weather-storm")
413 IC("mail-attachment")
414 IC("mail-unread")
415 IC("mail-read")
416 IC("starred")
417 IC("non-starred")
418
419 CONTEXT("Categories")
420 IC("applications-accessories")
421 IC("applications-development")
422 IC("applications-games")
423 IC("applications-graphics")
424 IC("applications-internet")
425 IC("applications-multimedia")
426 IC("applications-office")
427 IC("applications-other")
428 IC("applications-science")
429 IC("applications-system")
430 IC("applications-utilities")
431 IC("preferences-desktop")
432 IC("preferences-system")
433 IC("preferences-other")
434
435#undef CONTEXT
436#undef IC
437
438 elm_genlist_item_class_free(itc);
439 elm_genlist_item_class_free(itc_g);
182} 440}
183 441
184static void 442static void
@@ -186,9 +444,8 @@ _rdg_changed_cb(void *data, Evas_Object *obj EINA_UNUSED,
186 void *event_info EINA_UNUSED) 444 void *event_info EINA_UNUSED)
187{ 445{
188 Evas_Object *li = data; 446 Evas_Object *li = data;
189 Evas_Object *size_rdg = evas_object_data_get(li, "size_rdg");
190 447
191 _standard_list_populate(li, elm_radio_value_get(size_rdg)); 448 elm_genlist_realized_items_update(li);
192} 449}
193 450
194static void 451static void
@@ -257,11 +514,10 @@ test_icon_standard(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
257 elm_win_resize_object_add(win, box); 514 elm_win_resize_object_add(win, box);
258 evas_object_show(box); 515 evas_object_show(box);
259 516
260 li = elm_list_add(box); 517 li = elm_genlist_add(box);
261 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 518 evas_object_size_hint_expand_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
262 evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); 519 evas_object_size_hint_fill_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
263 evas_object_smart_callback_add(li, "selected", _list_selected_cb, NULL); 520 evas_object_smart_callback_add(li, "selected", _list_selected_cb, NULL);
264 _standard_list_populate(li, 0);
265 evas_object_show(li); 521 evas_object_show(li);
266 522
267 // lookup order 523 // lookup order
@@ -357,7 +613,8 @@ test_icon_standard(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
357 evas_object_show(rd); 613 evas_object_show(rd);
358 evas_object_smart_callback_add(rd, "changed", _rdg_changed_cb, li); 614 evas_object_smart_callback_add(rd, "changed", _rdg_changed_cb, li);
359 615
360 // pack the list 616 // populate and pack the list
617 _standard_genlist_populate(li);
361 elm_box_pack_end(box, li); 618 elm_box_pack_end(box, li);
362 619
363 // live resize 620 // live resize
@@ -398,6 +655,6 @@ test_icon_standard(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
398 evas_object_show(bt); 655 evas_object_show(bt);
399 656
400 // show the win 657 // show the win
401 evas_object_resize(win, 300, 400); 658 evas_object_resize(win, 300, 500);
402 evas_object_show(win); 659 evas_object_show(win);
403} 660}