forked from enlightenment/efl
elementary: reload theme when it change on disk.
NOTE: This is not very robust yet. But that's not related to this patch. You can see the issue when switching between two different theme in elementary_config. At some point elementary_test start to loose information. SVN revision: 70895
This commit is contained in:
parent
b52e855c5a
commit
a666de6518
|
@ -35,3 +35,7 @@
|
||||||
2012-05-04 Leandro Pereira
|
2012-05-04 Leandro Pereira
|
||||||
|
|
||||||
* Fix icon not appearing in default Genlist theme.
|
* Fix icon not appearing in default Genlist theme.
|
||||||
|
|
||||||
|
2012-05-09 Cedric Bail
|
||||||
|
|
||||||
|
* Reload theme when it change on disk.
|
||||||
|
|
|
@ -6,6 +6,7 @@ Changes since Elementary 1.0.0:
|
||||||
Additions:
|
Additions:
|
||||||
|
|
||||||
* Focus can be moved in all directions by elm_widget_focus_go function.
|
* Focus can be moved in all directions by elm_widget_focus_go function.
|
||||||
|
* Reload theme when it change on disk.
|
||||||
|
|
||||||
Fixes:
|
Fixes:
|
||||||
|
|
||||||
|
|
|
@ -189,6 +189,18 @@ elm_bg_add(Evas_Object *parent)
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_elm_bg_file_reload(void *data, Evas_Object *obj,
|
||||||
|
const char *emission __UNUSED__, const char *source __UNUSED__)
|
||||||
|
{
|
||||||
|
Evas_Object *bg = data;
|
||||||
|
const char *file;
|
||||||
|
const char *group;
|
||||||
|
|
||||||
|
edje_object_file_get(obj, &file, &group);
|
||||||
|
elm_bg_file_set(bg, file, group);
|
||||||
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
elm_bg_file_set(Evas_Object *obj,
|
elm_bg_file_set(Evas_Object *obj,
|
||||||
const char *file,
|
const char *file,
|
||||||
|
@ -220,6 +232,8 @@ elm_bg_file_set(Evas_Object *obj,
|
||||||
sd->img = edje_object_add
|
sd->img = edje_object_add
|
||||||
(evas_object_evas_get(ELM_WIDGET_DATA(sd)->resize_obj));
|
(evas_object_evas_get(ELM_WIDGET_DATA(sd)->resize_obj));
|
||||||
ret = edje_object_file_set(sd->img, file, group);
|
ret = edje_object_file_set(sd->img, file, group);
|
||||||
|
edje_object_signal_callback_del(sd->img, "edje,change,file", "edje", _elm_bg_file_reload);
|
||||||
|
edje_object_signal_callback_add(sd->img, "edje,change,file", "edje", _elm_bg_file_reload, obj);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -2119,6 +2119,7 @@ _elm_config_reload(void)
|
||||||
_elm_config_font_overlay_apply();
|
_elm_config_font_overlay_apply();
|
||||||
_elm_rescale();
|
_elm_rescale();
|
||||||
_elm_recache();
|
_elm_recache();
|
||||||
|
ecore_event_add(ELM_EVENT_CONFIG_ALL_CHANGED, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -286,6 +286,18 @@ _parts_cursors_apply(Elm_Layout_Smart_Data *sd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_reload_theme(void *data, Evas_Object *obj,
|
||||||
|
const char *emission __UNUSED__, const char *source __UNUSED__)
|
||||||
|
{
|
||||||
|
Evas_Object *layout = data;
|
||||||
|
const char *file;
|
||||||
|
const char *group;
|
||||||
|
|
||||||
|
edje_object_file_get(obj, &file, &group);
|
||||||
|
elm_layout_file_set(layout, file, group);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_visuals_refresh(Evas_Object *obj,
|
_visuals_refresh(Evas_Object *obj,
|
||||||
Elm_Layout_Smart_Data *sd)
|
Elm_Layout_Smart_Data *sd)
|
||||||
|
@ -295,6 +307,13 @@ _visuals_refresh(Evas_Object *obj,
|
||||||
_parts_cursors_apply(sd);
|
_parts_cursors_apply(sd);
|
||||||
|
|
||||||
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
ELM_LAYOUT_CLASS(ELM_WIDGET_DATA(sd)->api)->sizing_eval(obj);
|
||||||
|
|
||||||
|
edje_object_signal_callback_del(ELM_WIDGET_DATA(sd)->resize_obj,
|
||||||
|
"edje,change,file", "edje",
|
||||||
|
_reload_theme);
|
||||||
|
edje_object_signal_callback_add(ELM_WIDGET_DATA(sd)->resize_obj,
|
||||||
|
"edje,change,file", "edje",
|
||||||
|
_reload_theme, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
|
|
|
@ -189,11 +189,56 @@ _elm_theme_data_find(Elm_Theme *th, const char *key)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void _elm_theme_idler_clean(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__);
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_elm_theme_reload_idler(void *data)
|
||||||
|
{
|
||||||
|
Evas_Object *elm = data;
|
||||||
|
|
||||||
|
elm_widget_theme(elm);
|
||||||
|
evas_object_data_del(elm, "elm-theme-reload-idler");
|
||||||
|
evas_object_event_callback_del(elm, EVAS_CALLBACK_DEL, _elm_theme_idler_clean);
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_elm_theme_idler_clean(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
Ecore_Idler *idler;
|
||||||
|
|
||||||
|
idler = evas_object_data_get(obj, "elm-theme-reload-idler");
|
||||||
|
if (idler) ecore_idler_del(idler);
|
||||||
|
evas_object_data_del(obj, "elm-theme-reload-idler");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_elm_theme_reload(void *data __UNUSED__, Evas_Object *obj,
|
||||||
|
const char *emission __UNUSED__, const char *source __UNUSED__)
|
||||||
|
{
|
||||||
|
Evas_Object *elm;
|
||||||
|
|
||||||
|
elm = evas_object_data_get(obj, "elm-parent");
|
||||||
|
if (elm)
|
||||||
|
{
|
||||||
|
evas_object_event_callback_add(elm, EVAS_CALLBACK_DEL, _elm_theme_idler_clean, NULL);
|
||||||
|
evas_object_data_set(elm, "elm-theme-reload-idler", ecore_idler_add(_elm_theme_reload_idler, elm));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
_elm_theme_object_set(Evas_Object *parent, Evas_Object *o, const char *clas, const char *group, const char *style)
|
_elm_theme_object_set(Evas_Object *parent, Evas_Object *o, const char *clas, const char *group, const char *style)
|
||||||
{
|
{
|
||||||
Elm_Theme *th = NULL;
|
Elm_Theme *th = NULL;
|
||||||
|
void *test;
|
||||||
|
|
||||||
if (parent) th = elm_widget_theme_get(parent);
|
if (parent) th = elm_widget_theme_get(parent);
|
||||||
|
test = evas_object_data_get(o, "edje,theme,watcher");
|
||||||
|
if (!test)
|
||||||
|
{
|
||||||
|
edje_object_signal_callback_add(o, "edje,change,file", "edje", _elm_theme_reload, NULL);
|
||||||
|
evas_object_data_set(o, "edje,theme,watcher", (void*) -1);
|
||||||
|
}
|
||||||
return _elm_theme_set(th, o, clas, group, style);
|
return _elm_theme_set(th, o, clas, group, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,6 +198,8 @@ _retry_thumb(Widget_Data *wd)
|
||||||
wd->file);
|
wd->file);
|
||||||
goto view_err;
|
goto view_err;
|
||||||
}
|
}
|
||||||
|
/* FIXME: Do we want to reload a thumbnail when the file change ? I think no at the moment as
|
||||||
|
this may increase the presure on the system a lot when using it in a file browser */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -182,6 +182,7 @@ _els_smart_icon_file_edje_set(Evas_Object *obj, const char *file, const char *pa
|
||||||
sd->edje = EINA_TRUE;
|
sd->edje = EINA_TRUE;
|
||||||
if (!edje_object_file_set(sd->obj, file, part))
|
if (!edje_object_file_set(sd->obj, file, part))
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
/* FIXME: do i want to update icon on file change ? */
|
||||||
_smart_reconfigure(sd);
|
_smart_reconfigure(sd);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,6 +301,20 @@ elm_smart_scroller_extern_pan_set(Evas_Object *obj, Evas_Object *pan,
|
||||||
evas_object_show(sd->pan_obj);
|
evas_object_show(sd->pan_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_elm_smart_scroller_custom_edje_file_reload(void *data,
|
||||||
|
Evas_Object *obj,
|
||||||
|
const char *emission __UNUSED__,
|
||||||
|
const char *source __UNUSED__)
|
||||||
|
{
|
||||||
|
Evas_Object *scroller = data;
|
||||||
|
const char *file;
|
||||||
|
const char *group;
|
||||||
|
|
||||||
|
edje_object_file_get(obj, &file, &group);
|
||||||
|
elm_smart_scroller_custom_edje_file_set(scroller, (char*) file, (char*) group);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
elm_smart_scroller_custom_edje_file_set(Evas_Object *obj, char *file, char *group)
|
elm_smart_scroller_custom_edje_file_set(Evas_Object *obj, char *file, char *group)
|
||||||
{
|
{
|
||||||
|
@ -309,6 +323,13 @@ elm_smart_scroller_custom_edje_file_set(Evas_Object *obj, char *file, char *grou
|
||||||
edje_object_file_set(sd->edje_obj, file, group);
|
edje_object_file_set(sd->edje_obj, file, group);
|
||||||
if (sd->pan_obj)
|
if (sd->pan_obj)
|
||||||
edje_object_part_swallow(sd->edje_obj, "elm.swallow.content", sd->pan_obj);
|
edje_object_part_swallow(sd->edje_obj, "elm.swallow.content", sd->pan_obj);
|
||||||
|
edje_object_signal_callback_del(sd->edje_obj,
|
||||||
|
"edje,change,file", "edje",
|
||||||
|
_elm_smart_scroller_custom_edje_file_reload);
|
||||||
|
edje_object_signal_callback_add(sd->edje_obj,
|
||||||
|
"edje,change,file", "edje",
|
||||||
|
_elm_smart_scroller_custom_edje_file_reload,
|
||||||
|
obj);
|
||||||
sd->vbar_visible = !sd->vbar_visible;
|
sd->vbar_visible = !sd->vbar_visible;
|
||||||
sd->hbar_visible = !sd->hbar_visible;
|
sd->hbar_visible = !sd->hbar_visible;
|
||||||
_smart_scrollbar_bar_visibility_adjust(sd);
|
_smart_scrollbar_bar_visibility_adjust(sd);
|
||||||
|
|
Loading…
Reference in New Issue