summaryrefslogtreecommitdiff
path: root/src/edje_externals/elm.c
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2010-03-25 18:10:25 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2010-03-25 18:10:25 +0000
commit475b875f38f3f44e2be1a4e1a0f4643bbb16c0fe (patch)
tree4420bc89741c7059768b85f70adcdfa9c2f7c747 /src/edje_externals/elm.c
parent49c644ca59f1769b7cf056a357a1cad940e7cb33 (diff)
Port to new Edje EXTERNAL API goodies!
Now it is possible to change labels and lots of other parameters directly through Edje's API. BIG FAT NOTE: this is a convenience that comes with a reasonable price. If you have hot paths, like loops, then avoid calling this and use the object directly. This functions add a cost to check edje, then find the part, then get the type, then get the param_set/param_get methods, then calling it, then finding the parameters using strcmp(), then checking the type and just then it will call the actual method. So whenever possible, just call the method directly. Due the reasoning of the "big fat note" I'm adding this inside edje externals only. The code would be almost the same to expose it in Elementary.h as elm_widget_property_set/get, but then I know people would misuse it... actually this kind of stuff could be easily ported to Evas smart object, but then abuse and slowness will hunt us foreveeeeer... SVN revision: 47457
Diffstat (limited to '')
-rw-r--r--src/edje_externals/elm.c56
1 files changed, 36 insertions, 20 deletions
diff --git a/src/edje_externals/elm.c b/src/edje_externals/elm.c
index df06c61a4..2aa8c814e 100644
--- a/src/edje_externals/elm.c
+++ b/src/edje_externals/elm.c
@@ -1,14 +1,22 @@
1#include <Elementary.h> 1#include "Elementary.h"
2#include "private.h" 2#include "private.h"
3 3
4void 4void
5external_signal(void *data, Evas_Object *obj, const char *signal, const char *source) 5external_signal(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *signal, const char *source)
6{ 6{
7 printf("External Signal received: '%s' '%s'\n", signal, source); 7 printf("External Signal received: '%s' '%s'\n", signal, source);
8} 8}
9 9
10const char *
11external_translate(void *data __UNUSED__, const char *orig)
12{
13 // in future, mark all params as translatable and use dgettext()
14 // with "elementary" text domain here.
15 return orig;
16}
17
10void * 18void *
11external_common_params_parse_internal(size_t params_size, void *data, Evas_Object *obj, const Eina_List *params) 19external_common_params_parse_internal(size_t params_size, void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
12{ 20{
13 Elm_Params *p; 21 Elm_Params *p;
14 const Eina_List *l; 22 const Eina_List *l;
@@ -29,27 +37,35 @@ external_common_params_parse_internal(size_t params_size, void *data, Evas_Objec
29 return p; 37 return p;
30} 38}
31 39
32void 40Evas_Object *
33external_common_icon_param_parse(Evas_Object **icon, Evas_Object *obj, const Eina_List *params) 41external_common_param_icon_get(Evas_Object *obj, const Edje_External_Param *p)
34{ 42{
35 Edje_External_Param *p; 43 Evas_Object *edje, *parent_widget, *icon;
44 const char *file;
36 45
37 p = edje_external_param_find(params, "icon"); 46 if ((!p) || (!p->s) || (p->type != EDJE_EXTERNAL_PARAM_TYPE_STRING))
38 if (p && p->s) 47 return NULL;
39 {
40 Evas_Object *parent = evas_object_smart_parent_get(obj);
41 const char *file;
42 edje_object_file_get(parent, &file, NULL);
43 *icon = elm_icon_add(parent);
44 48
45 if (elm_icon_file_set(*icon, file, p->s)) 49 edje = evas_object_smart_parent_get(obj);
46 return; 50 edje_object_file_get(edje, &file, NULL);
47 if (elm_icon_standard_set(*icon, p->s))
48 return;
49 51
50 evas_object_del(*icon); 52 parent_widget = elm_widget_parent_widget_get(obj);
51 } 53 elm_icon_add(parent_widget);
52 *icon = NULL; 54
55 if (elm_icon_file_set(icon, file, p->s))
56 return icon;
57 if (elm_icon_standard_set(icon, p->s))
58 return icon;
59
60 evas_object_del(icon);
61 return NULL;
62}
63
64void
65external_common_icon_param_parse(Evas_Object **icon, Evas_Object *obj, const Eina_List *params)
66{
67 Edje_External_Param *p = edje_external_param_find(params, "icon");
68 *icon = external_common_param_icon_get(obj, p);
53} 69}
54 70
55void 71void