summaryrefslogtreecommitdiff
path: root/src/lib/elementary/elm_photo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/elementary/elm_photo.c')
-rw-r--r--src/lib/elementary/elm_photo.c86
1 files changed, 54 insertions, 32 deletions
diff --git a/src/lib/elementary/elm_photo.c b/src/lib/elementary/elm_photo.c
index 53300f9..1af5e2b 100644
--- a/src/lib/elementary/elm_photo.c
+++ b/src/lib/elementary/elm_photo.c
@@ -8,8 +8,8 @@
8 8
9#include "elm_priv.h" 9#include "elm_priv.h"
10#include "elm_widget_photo.h" 10#include "elm_widget_photo.h"
11#include "elm_photo.eo.h" 11#include "elm_photo_eo.h"
12#include "elm_icon.eo.h" 12#include "elm_icon_eo.h"
13 13
14#define MY_CLASS ELM_PHOTO_CLASS 14#define MY_CLASS ELM_PHOTO_CLASS
15 15
@@ -49,14 +49,14 @@ _sizing_eval(Evas_Object *obj)
49 evas_object_size_hint_max_set(obj, maxw, maxh); 49 evas_object_size_hint_max_set(obj, maxw, maxh);
50} 50}
51 51
52EOLIAN static Efl_Ui_Theme_Apply_Result 52EOLIAN static Eina_Error
53_elm_photo_efl_ui_widget_theme_apply(Eo *obj, Elm_Photo_Data *sd) 53_elm_photo_efl_ui_widget_theme_apply(Eo *obj, Elm_Photo_Data *sd)
54{ 54{
55 Efl_Ui_Theme_Apply_Result int_ret = EFL_UI_THEME_APPLY_RESULT_FAIL; 55 Eina_Error int_ret = EFL_UI_THEME_APPLY_ERROR_GENERIC;
56 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); 56 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
57 57
58 int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS)); 58 int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
59 if (!int_ret) return EFL_UI_THEME_APPLY_RESULT_FAIL; 59 if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret;
60 60
61 edje_object_mirrored_set 61 edje_object_mirrored_set
62 (wd->resize_obj, efl_ui_mirrored_get(obj)); 62 (wd->resize_obj, efl_ui_mirrored_get(obj));
@@ -315,6 +315,17 @@ elm_photo_add(Evas_Object *parent)
315} 315}
316 316
317EOLIAN static Eo * 317EOLIAN static Eo *
318_elm_photo_efl_object_finalize(Eo *obj, Elm_Photo_Data *sd)
319{
320 obj = efl_finalize(efl_super(obj, MY_CLASS));
321 if (!obj) return NULL;
322 if (efl_file_get(sd->icon) || efl_file_mmap_get(sd->icon))
323 efl_file_load(sd->icon);
324
325 return obj;
326}
327
328EOLIAN static Eo *
318_elm_photo_efl_object_constructor(Eo *obj, Elm_Photo_Data *_pd EINA_UNUSED) 329_elm_photo_efl_object_constructor(Eo *obj, Elm_Photo_Data *_pd EINA_UNUSED)
319{ 330{
320 obj = efl_constructor(efl_super(obj, MY_CLASS)); 331 obj = efl_constructor(efl_super(obj, MY_CLASS));
@@ -325,50 +336,61 @@ _elm_photo_efl_object_constructor(Eo *obj, Elm_Photo_Data *_pd EINA_UNUSED)
325 return obj; 336 return obj;
326} 337}
327 338
328EOLIAN static void 339EOLIAN static Eina_Error
329_elm_photo_efl_file_file_get(const Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, const char **file, const char **key EINA_UNUSED) 340_elm_photo_efl_file_load(Eo *obj, Elm_Photo_Data *sd)
330{
331 efl_file_get(sd->icon, file, NULL);
332}
333
334EOLIAN static Eina_Bool
335_elm_photo_efl_file_file_set(Eo *obj, Elm_Photo_Data *sd, const char *file, const char *key EINA_UNUSED)
336{ 341{
342 const char *file = efl_file_get(sd->icon);
343 Eina_Error err = 0;
337 if (!file) 344 if (!file)
338 { 345 {
339 if (!elm_icon_standard_set(sd->icon, "no_photo")) return EINA_FALSE; 346 if (!elm_icon_standard_set(sd->icon, "no_photo")) return EINA_FALSE;
340 } 347 }
341 else 348 else
342 { 349 {
343 if (!elm_image_file_set(sd->icon, file, NULL)) return EINA_FALSE; 350 if (efl_file_loaded_get(obj)) return 0;
351 err = efl_file_load(sd->icon);
352 if (err) return err;
344 } 353 }
345 354
346 _sizing_eval(obj); 355 _sizing_eval(obj);
347 356
348 return EINA_TRUE; 357 return 0;
349} 358}
350 359
351EOLIAN static void 360EOLIAN static const Eina_File *
352_elm_photo_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, const Eina_File **file, const char **key EINA_UNUSED) 361_elm_photo_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Elm_Photo_Data *sd)
353{ 362{
354 efl_file_mmap_get(sd->icon, file, key); 363 return efl_file_mmap_get(sd->icon);
355} 364}
356 365
357EOLIAN static Eina_Bool 366EOLIAN static Eina_Error
358_elm_photo_efl_file_mmap_set(Eo *obj, Elm_Photo_Data *sd, const Eina_File *file, const char *key EINA_UNUSED) 367_elm_photo_efl_file_mmap_set(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, const Eina_File *file)
359{ 368{
360 if (!file) 369 return efl_file_mmap_set(sd->icon, file);
361 { 370}
362 if (!elm_icon_standard_set(sd->icon, "no_photo")) return EINA_FALSE;
363 }
364 else
365 {
366 if (!efl_file_mmap_set(sd->icon, file, NULL)) return EINA_FALSE;
367 }
368 371
369 _sizing_eval(obj); 372EOLIAN static Eina_Error
373_elm_photo_efl_file_file_set(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, const char *file)
374{
375 return efl_file_set(sd->icon, file);
376}
370 377
371 return EINA_TRUE; 378EOLIAN static const char *
379_elm_photo_efl_file_file_get(const Eo *obj EINA_UNUSED, Elm_Photo_Data *sd)
380{
381 return efl_file_get(sd->icon);
382}
383
384EOLIAN static void
385_elm_photo_efl_file_key_set(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, const char *key)
386{
387 return efl_file_key_set(sd->icon, key);
388}
389
390EOLIAN static const char *
391_elm_photo_efl_file_key_get(const Eo *obj EINA_UNUSED, Elm_Photo_Data *sd)
392{
393 return efl_file_key_get(sd->icon);
372} 394}
373 395
374static void 396static void
@@ -380,7 +402,7 @@ _elm_photo_class_constructor(Efl_Class *klass)
380EAPI Eina_Bool 402EAPI Eina_Bool
381elm_photo_file_set(Eo *obj, const char *file) 403elm_photo_file_set(Eo *obj, const char *file)
382{ 404{
383 return efl_file_set((Eo *) obj, file, NULL); 405 return efl_file_simple_load((Eo *) obj, file, NULL);
384} 406}
385 407
386/* Legacy deprecated functions */ 408/* Legacy deprecated functions */
@@ -471,4 +493,4 @@ elm_photo_thumb_set(Evas_Object *obj, const char *file, const char *group)
471#define ELM_PHOTO_EXTRA_OPS \ 493#define ELM_PHOTO_EXTRA_OPS \
472 EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_photo) 494 EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_photo)
473 495
474#include "elm_photo.eo.c" 496#include "elm_photo_eo.c"