forked from enlightenment/terminology
terminology: reload theme when file change.
NOTE: use edje_watch to test the change to your own theme faster. SVN revision: 72332
This commit is contained in:
parent
b090970d16
commit
fa397e90f6
|
@ -48,6 +48,18 @@ _cb_size_hint(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_reload_theme(void *data __UNUSED__, Evas_Object *obj,
|
||||
const char *emission __UNUSED__, const char *source __UNUSED__)
|
||||
{
|
||||
const char *file;
|
||||
const char *group;
|
||||
|
||||
edje_object_file_get(obj, &file, &group);
|
||||
edje_object_file_set(obj, file, group);
|
||||
fprintf(stderr, "RELOADING THEME main.c\n");
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_options(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
||||
{
|
||||
|
@ -263,6 +275,7 @@ elm_main(int argc, char **argv)
|
|||
evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
edje_object_file_set(o, config_theme_path_get(config),
|
||||
"terminology/background");
|
||||
edje_object_signal_callback_add(o, "edje,change,file", "edje", _reload_theme, NULL);
|
||||
elm_win_resize_object_add(win, o);
|
||||
evas_object_show(o);
|
||||
|
||||
|
|
|
@ -73,6 +73,18 @@ _is_fmt(const char *f, const char **extn)
|
|||
}
|
||||
|
||||
//////////////////////// img
|
||||
static void
|
||||
_reload_theme(void *data __UNUSED__, Evas_Object *obj,
|
||||
const char *emission __UNUSED__, const char *source __UNUSED__)
|
||||
{
|
||||
const char *file;
|
||||
const char *group;
|
||||
|
||||
edje_object_file_get(obj, &file, &group);
|
||||
edje_object_file_set(obj, file, group);
|
||||
fprintf(stderr, "RELOADING THEME media.c\n");
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_img_preloaded(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
||||
{
|
||||
|
@ -274,6 +286,7 @@ _type_edje_init(Evas_Object *obj)
|
|||
{
|
||||
edje_object_signal_callback_add(o, "preload,done", "",
|
||||
_cb_edje_preloaded, obj);
|
||||
edje_object_signal_callback_add(o, "edje,change,file", "edje", _reload_theme, NULL);
|
||||
edje_object_preload(o, EINA_FALSE);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,18 @@ struct _Font
|
|||
static Eina_List *fonts = NULL;
|
||||
static Eina_Hash *fonthash = NULL;
|
||||
|
||||
static void
|
||||
_reload_theme(void *data __UNUSED__, Evas_Object *obj,
|
||||
const char *emission __UNUSED__, const char *source __UNUSED__)
|
||||
{
|
||||
const char *file;
|
||||
const char *group;
|
||||
|
||||
edje_object_file_get(obj, &file, &group);
|
||||
edje_object_file_set(obj, file, group);
|
||||
fprintf(stderr, "RELOADING THEME\n");
|
||||
}
|
||||
|
||||
static void
|
||||
_update_preview(void)
|
||||
{
|
||||
|
@ -97,6 +109,7 @@ _cb_op_font_content_get(void *data, Evas_Object *obj, const char *part)
|
|||
o = edje_object_add(evas_object_evas_get(obj));
|
||||
edje_object_file_set(o, config_theme_path_get(config),
|
||||
"terminology/fontpreview");
|
||||
edje_object_signal_callback_add(o, "edje,change,file", "edje", _reload_theme, NULL);
|
||||
|
||||
if (!f->bitmap)
|
||||
font = f->name;
|
||||
|
|
|
@ -46,6 +46,18 @@ static Evas_Smart_Class _parent_sc = EVAS_SMART_CLASS_INIT_NULL;
|
|||
|
||||
static void _smart_calculate(Evas_Object *obj);
|
||||
|
||||
static void
|
||||
_reload_theme(void *data __UNUSED__, Evas_Object *obj,
|
||||
const char *emission __UNUSED__, const char *source __UNUSED__)
|
||||
{
|
||||
const char *file;
|
||||
const char *group;
|
||||
|
||||
edje_object_file_get(obj, &file, &group);
|
||||
edje_object_file_set(obj, file, group);
|
||||
fprintf(stderr, "RELOADING THEME termio\n");
|
||||
}
|
||||
|
||||
static void
|
||||
_smart_apply(Evas_Object *obj)
|
||||
{
|
||||
|
@ -665,6 +677,7 @@ _termio_config_set(Evas_Object *obj, Config *config)
|
|||
|
||||
edje_object_file_set(sd->cur.obj,
|
||||
config_theme_path_get(config), "terminology/cursor");
|
||||
edje_object_signal_callback_add(sd->cur.obj, "edje,change,file", "edje", _reload_theme, NULL);
|
||||
evas_object_resize(sd->cur.obj, sd->font.chw, sd->font.chh);
|
||||
evas_object_show(sd->cur.obj);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue