elm: bring back elm/uiclock
Summary: It turns out elm/uiclock (which was removed in89675c3219
) is actually used, at least by the datetime legacy widget. Removing this widget broke the datetime_example test. This commit reverts89675c3219
and fixes the elm/uiclock part names: - Part names are prefixed with 'elm.' - efl_ui_clock.c (which is used for both the new efl and the legacy elm widgets) now looks for part names with 'efl.' and 'elm.' prefixes, and without any prefix, for compatibility with older themes. Fixes T6928 Test Plan: the Datetime elementary_test (and all other clock-related tests) now work. Reviewers: zmike, jsuya, CHAN, devilhorns, Jaehyun_Cho Reviewed By: zmike, jsuya, CHAN Subscribers: #reviewers, Jaehyun, Hermet, cedric, #committers Tags: #efl Maniphest Tasks: T6928 Differential Revision: https://phab.enlightenment.org/D6577
This commit is contained in:
parent
a8421fc0c0
commit
26bedebc18
|
@ -149,6 +149,7 @@ elementary/themes/edc/elm/textpath.edc \
|
|||
elementary/themes/edc/elm/thumb.edc \
|
||||
elementary/themes/edc/elm/toolbar.edc \
|
||||
elementary/themes/edc/elm/tooltip.edc \
|
||||
elementary/themes/edc/elm/uiclock.edc \
|
||||
elementary/themes/edc/elm/video.edc \
|
||||
elementary/themes/edc/elm/win.edc \
|
||||
\
|
||||
|
|
|
@ -36,6 +36,7 @@ collections {
|
|||
#include "edc/elm/access.edc"
|
||||
#include "edc/elm/photo.edc"
|
||||
#include "edc/elm/focus.edc"
|
||||
#include "edc/elm/uiclock.edc"
|
||||
#include "edc/elm/player.edc"
|
||||
#include "edc/elm/thumb.edc"
|
||||
#include "edc/elm/pointer.edc"
|
||||
|
|
|
@ -0,0 +1,207 @@
|
|||
#define DATETIME_FIELD(_pos) \
|
||||
part { \
|
||||
name: "elm.field"#_pos; type: SWALLOW; \
|
||||
scale: 1; \
|
||||
clip_to: "clip"; \
|
||||
description { state: "default" 0.0; \
|
||||
visible: 0; \
|
||||
min: 0 0; \
|
||||
align: 0.0 0.5; \
|
||||
fixed: 1 1; \
|
||||
rel1.relative: 1.0 0.0; \
|
||||
rel1.to: "elm.separator"#_pos; \
|
||||
rel2.relative: 1.0 1.0; \
|
||||
rel2.to: "elm.separator"#_pos; \
|
||||
} \
|
||||
description { state: "enable" 0.0; \
|
||||
inherit: "default" 0.0; \
|
||||
visible: 1; \
|
||||
min: 8 10; \
|
||||
} \
|
||||
} \
|
||||
programs{ \
|
||||
program { name: "field_"#_pos"enabled"; \
|
||||
signal: "field"#_pos",enable"; source: "elm"; \
|
||||
action: STATE_SET "enable" 0.0; \
|
||||
target: "elm.field"#_pos; \
|
||||
} \
|
||||
program { name: "field_"#_pos"disabled"; \
|
||||
signal: "field"#_pos",disable"; source: "elm"; \
|
||||
action: STATE_SET "default" 0.0; \
|
||||
target: "elm.field"#_pos; \
|
||||
} \
|
||||
}
|
||||
#define DATETIME_SEPARATOR(_pos, _after) \
|
||||
part { \
|
||||
name: "elm.separator"#_pos; type: TEXT; \
|
||||
scale: 1; \
|
||||
effect: SHADOW BOTTOM; \
|
||||
clip_to: "disclip"; \
|
||||
description { state: "default" 0.0; \
|
||||
visible: 0; \
|
||||
min: 0 0; \
|
||||
align: 0.0 0.5; \
|
||||
fixed: 1 0; \
|
||||
rel1 { \
|
||||
relative: 1.0 0.0; \
|
||||
to: "elm.field"#_after; \
|
||||
} \
|
||||
rel2 { \
|
||||
relative: 1.0 1.0; \
|
||||
to: "elm.field"#_after; \
|
||||
} \
|
||||
color_class: "datetime_separator_text"; \
|
||||
text { \
|
||||
font: "Sans"; size: 10; \
|
||||
min: 1 0; \
|
||||
ellipsis: -1; \
|
||||
align: 0.5 0.5; \
|
||||
text_class: "datetime_separator_text"; \
|
||||
} \
|
||||
} \
|
||||
description { state: "enable" 0.0; \
|
||||
inherit: "default" 0.0; \
|
||||
visible: 1; \
|
||||
min: 8 10; \
|
||||
} \
|
||||
} \
|
||||
part { \
|
||||
name: "separator"#_pos"d"; type: TEXT; \
|
||||
scale: 1; \
|
||||
effect: SHADOW BOTTOM; \
|
||||
clip_to: "disclip2"; \
|
||||
description { state: "default" 0.0; \
|
||||
visible: 0; \
|
||||
rel1.to: "elm.separator"#_pos; \
|
||||
rel2.to: "elm.separator"#_pos; \
|
||||
color_class: "datetime_separator_text_disabled"; \
|
||||
text { \
|
||||
text_source: "elm.separator"#_pos; \
|
||||
font: "Sans"; size: 10; \
|
||||
text_class: "datetime_separator_text_disabled"; \
|
||||
} \
|
||||
} \
|
||||
description { state: "enable" 0.0; \
|
||||
inherit: "default" 0.0; \
|
||||
visible: 1; \
|
||||
} \
|
||||
} \
|
||||
programs { \
|
||||
program { \
|
||||
signal: "field"#_after",enable"; source: "elm"; \
|
||||
action: STATE_SET "enable" 0.0; \
|
||||
target: "elm.separator"#_pos; \
|
||||
target: "separator"#_pos"d"; \
|
||||
} \
|
||||
program { \
|
||||
signal: "field"#_after",disable"; source: "elm"; \
|
||||
action: STATE_SET "default" 0.0; \
|
||||
target: "elm.separator"#_pos; \
|
||||
target: "separator"#_pos"d"; \
|
||||
} \
|
||||
}
|
||||
group { name: "elm/uiclock/base/default";
|
||||
parts {
|
||||
part { name: "bg"; type: RECT;
|
||||
description { state: "default" 0.0;
|
||||
color_class: "datetime_bg";
|
||||
}
|
||||
}
|
||||
part { name: "clip"; type: RECT;
|
||||
description { state: "default" 0.0;
|
||||
rel1.to: "elm.separator0";
|
||||
rel2.to: "elm.separator7";
|
||||
}
|
||||
}
|
||||
part { name: "disclip"; type: RECT;
|
||||
clip_to: "clip";
|
||||
description { state: "default" 0.0;
|
||||
rel1.to: "elm.separator0";
|
||||
rel2.to: "elm.separator7";
|
||||
}
|
||||
description { state: "disabled" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
part { name: "disclip2"; type: RECT;
|
||||
clip_to: "clip";
|
||||
description { state: "default" 0.0;
|
||||
rel1.to: "elm.separator0";
|
||||
rel2.to: "elm.separator7";
|
||||
visible: 0;
|
||||
}
|
||||
description { state: "disabled" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
}
|
||||
}
|
||||
part { name: "elm.separator0"; type: SPACER;
|
||||
scale: 1;
|
||||
description { state: "default" 0.0;
|
||||
min: 8 10;
|
||||
align: 0.0 0.5;
|
||||
fixed: 1 0;
|
||||
rel2.relative: 0.0 1.0;
|
||||
}
|
||||
}
|
||||
DATETIME_FIELD(0)
|
||||
DATETIME_SEPARATOR(1,0)
|
||||
DATETIME_FIELD(1)
|
||||
DATETIME_SEPARATOR(2,1)
|
||||
DATETIME_FIELD(2)
|
||||
DATETIME_SEPARATOR(3,2)
|
||||
DATETIME_FIELD(3)
|
||||
DATETIME_SEPARATOR(4,3)
|
||||
DATETIME_FIELD(4)
|
||||
DATETIME_SEPARATOR(5,4)
|
||||
DATETIME_FIELD(5)
|
||||
DATETIME_SEPARATOR(6,5)
|
||||
DATETIME_FIELD(6)
|
||||
DATETIME_SEPARATOR(7,6)
|
||||
DATETIME_FIELD(7)
|
||||
DATETIME_SEPARATOR(8,7)
|
||||
part { name: "elm.separator9"; type: SPACER;
|
||||
description { state: "default" 0.0;
|
||||
rel1.to: "elm.separator7";
|
||||
rel1.relative: 1.0 0.0;
|
||||
min: 8 10;
|
||||
}
|
||||
}
|
||||
part { name: "discover"; type: RECT;
|
||||
description { state: "default" 0.0;
|
||||
rel1.to: "elm.separator0";
|
||||
rel2.to: "elm.separator7";
|
||||
visible: 0;
|
||||
color: 0 0 0 0;
|
||||
}
|
||||
description { state: "disabled" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
}
|
||||
}
|
||||
part { name: "elm.access"; type: RECT; repeat_events: 1;
|
||||
description { state: "default" 0.0;
|
||||
color: 0 0 0 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
programs {
|
||||
program {
|
||||
signal: "elm,state,disabled"; source: "elm";
|
||||
action: STATE_SET "disabled" 0.0;
|
||||
target: "disclip";
|
||||
target: "disclip2";
|
||||
target: "discover";
|
||||
}
|
||||
program {
|
||||
signal: "elm,state,enabled"; source: "elm";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "disclip";
|
||||
target: "disclip2";
|
||||
target: "discover";
|
||||
}
|
||||
}
|
||||
}
|
||||
#undef DATETIME_SEPARATOR
|
||||
#undef DATETIME_FIELD
|
|
@ -76,6 +76,21 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
|||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static void _part_name_snprintf(char *buffer, int buffer_size,
|
||||
const Evas_Object *obj, const char *template, int n)
|
||||
{
|
||||
snprintf(buffer, buffer_size, template, n);
|
||||
if (edje_object_part_exists (obj, buffer)) return;
|
||||
// Try 'elm' prefix instead of 'efl'
|
||||
buffer[0] = 'e';
|
||||
buffer[1] = 'l';
|
||||
buffer[2] = 'm';
|
||||
if (edje_object_part_exists (obj, buffer)) return;
|
||||
// Skip the namespace prefix "elm." which was not present
|
||||
// in previous versions
|
||||
snprintf(buffer, buffer_size, template + 4, n);
|
||||
}
|
||||
|
||||
static Elm_Module *
|
||||
_dt_mod_find(void)
|
||||
{
|
||||
|
@ -259,7 +274,8 @@ _field_list_arrange(Evas_Object *obj)
|
|||
for (idx = 0; idx < EFL_UI_CLOCK_TYPE_COUNT; idx++)
|
||||
{
|
||||
field = sd->field_list + idx;
|
||||
snprintf(buf, sizeof(buf), EDC_PART_FIELD_STR, field->location);
|
||||
_part_name_snprintf(buf, sizeof(buf), obj, EDC_PART_FIELD_STR,
|
||||
field->location);
|
||||
|
||||
if (field->visible && field->fmt_exist)
|
||||
{
|
||||
|
@ -396,17 +412,24 @@ _reload_format(Evas_Object *obj)
|
|||
{
|
||||
snprintf(buf, sizeof(buf), EDC_PART_FIELD_ENABLE_SIG_STR,
|
||||
field->location);
|
||||
elm_layout_signal_emit(obj, buf, "efl");
|
||||
if (elm_widget_is_legacy(obj))
|
||||
elm_layout_signal_emit(obj, buf, "elm");
|
||||
else
|
||||
elm_layout_signal_emit(obj, buf, "efl");
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buf, sizeof(buf), EDC_PART_FIELD_DISABLE_SIG_STR,
|
||||
field->location);
|
||||
elm_layout_signal_emit(obj, buf, "efl");
|
||||
if (elm_widget_is_legacy(obj))
|
||||
elm_layout_signal_emit(obj, buf, "elm");
|
||||
else
|
||||
elm_layout_signal_emit(obj, buf, "efl");
|
||||
}
|
||||
if (field->location + 1)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), EDC_PART_SEPARATOR_STR, (field->location + 1));
|
||||
_part_name_snprintf(buf, sizeof(buf), obj, EDC_PART_SEPARATOR_STR,
|
||||
field->location + 1);
|
||||
elm_layout_text_set(obj, buf, field->separator);
|
||||
}
|
||||
}
|
||||
|
@ -535,11 +558,15 @@ _efl_ui_clock_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Clock_Data *sd)
|
|||
{
|
||||
snprintf(buf, sizeof(buf), EDC_PART_FIELD_ENABLE_SIG_STR,
|
||||
field->location);
|
||||
elm_layout_signal_emit(obj, buf, "efl");
|
||||
if (elm_widget_is_legacy(obj))
|
||||
elm_layout_signal_emit(obj, buf, "elm");
|
||||
else
|
||||
elm_layout_signal_emit(obj, buf, "efl");
|
||||
|
||||
if (field->location)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), EDC_PART_SEPARATOR_STR, (field->location));
|
||||
_part_name_snprintf(buf, sizeof(buf), obj, EDC_PART_SEPARATOR_STR,
|
||||
field->location);
|
||||
elm_layout_text_set(obj, buf, field->separator);
|
||||
}
|
||||
|
||||
|
@ -549,7 +576,10 @@ _efl_ui_clock_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Clock_Data *sd)
|
|||
{
|
||||
snprintf(buf, sizeof(buf), EDC_PART_FIELD_DISABLE_SIG_STR,
|
||||
field->location);
|
||||
elm_layout_signal_emit(obj, buf, "efl");
|
||||
if (elm_widget_is_legacy(obj))
|
||||
elm_layout_signal_emit(obj, buf, "elm");
|
||||
else
|
||||
elm_layout_signal_emit(obj, buf, "efl");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -993,12 +1023,16 @@ _efl_ui_clock_field_visible_set(Eo *obj, Efl_Ui_Clock_Data *sd, Efl_Ui_Clock_Typ
|
|||
|
||||
snprintf(buf, sizeof(buf), EDC_PART_FIELD_ENABLE_SIG_STR,
|
||||
field->location);
|
||||
elm_layout_signal_emit(obj, buf, "efl");
|
||||
if (elm_widget_is_legacy(obj))
|
||||
elm_layout_signal_emit(obj, buf, "elm");
|
||||
else
|
||||
elm_layout_signal_emit(obj, buf, "efl");
|
||||
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
edje_object_message_signal_process(wd->resize_obj);
|
||||
|
||||
snprintf(buf, sizeof(buf), EDC_PART_FIELD_STR, field->location);
|
||||
_part_name_snprintf(buf, sizeof(buf), obj, EDC_PART_FIELD_STR,
|
||||
field->location);
|
||||
elm_layout_content_unset(obj, buf);
|
||||
elm_layout_content_set(obj, buf, field->item_obj);
|
||||
}
|
||||
|
@ -1010,12 +1044,16 @@ _efl_ui_clock_field_visible_set(Eo *obj, Efl_Ui_Clock_Data *sd, Efl_Ui_Clock_Typ
|
|||
|
||||
snprintf(buf, sizeof(buf), EDC_PART_FIELD_DISABLE_SIG_STR,
|
||||
field->location);
|
||||
elm_layout_signal_emit(obj, buf, "efl");
|
||||
if (elm_widget_is_legacy(obj))
|
||||
elm_layout_signal_emit(obj, buf, "elm");
|
||||
else
|
||||
elm_layout_signal_emit(obj, buf, "efl");
|
||||
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
edje_object_message_signal_process(wd->resize_obj);
|
||||
|
||||
snprintf(buf, sizeof(buf), EDC_PART_FIELD_STR, field->location);
|
||||
_part_name_snprintf(buf, sizeof(buf), obj, EDC_PART_FIELD_STR,
|
||||
field->location);
|
||||
evas_object_hide(elm_layout_content_unset(obj, buf));
|
||||
}
|
||||
sd->freeze_sizing = EINA_FALSE;
|
||||
|
|
Loading…
Reference in New Issue