summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrafspiny <rafspiny@gmail.com>2020-02-18 16:12:45 +0000
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-02-19 16:33:59 +0100
commitd2e1d430a8a5c62b5ec3a0449ae496af1dbd8861 (patch)
tree10c3fb54ff6657967b4cb38ededd5c57bd9efdf6
parent090c351d388da6f19644ea83685419c9db9bb4e1 (diff)
downloadefl-d2e1d430a8a5c62b5ec3a0449ae496af1dbd8861.tar.gz
Adding "elm,calendar,ch_%d,weekend" and "elm,calendar,ch_%d,weekday" signals from "elm".
The calendar object in elementary needs to know which days are weekdays and which are weekend days in order to properly change the state of the header's labels. This code add a signal emission from e_calendar.c when setting the header. Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11375
-rw-r--r--src/lib/elementary/elm_calendar.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lib/elementary/elm_calendar.c b/src/lib/elementary/elm_calendar.c
index e6de3373c6..6edefe3c5e 100644
--- a/src/lib/elementary/elm_calendar.c
+++ b/src/lib/elementary/elm_calendar.c
@@ -22,6 +22,8 @@
#define ELM_CALENDAR_BUTTON_RIGHT "elm,calendar,button,right"
#define ELM_CALENDAR_BUTTON_YEAR_LEFT "elm,calendar,button_year,left"
#define ELM_CALENDAR_BUTTON_YEAR_RIGHT "elm,calendar,button_year,right"
+#define ELM_CALENDAR_CH_WEEKEND "elm,calendar,ch_%d,weekend"
+#define ELM_CALENDAR_CH_WEEKDAY "elm,calendar,ch_%d,weekday"
#define ELM_CALENDAR_CH_TEXT_PART_STR "elm.ch_%d.text"
#define ELM_CALENDAR_CIT_TEXT_PART_STR "elm.cit_%d.text"
@@ -674,6 +676,7 @@ static void
_set_headers(Evas_Object *obj)
{
static char part[64];
+ static char emission[64];
int i;
struct tm *t;
time_t temp = 259200; // the first sunday since epoch
@@ -710,7 +713,15 @@ _set_headers(Evas_Object *obj)
for (i = 0; i < ELM_DAY_LAST; i++)
{
_part_name_snprintf(part, sizeof(part), obj, ELM_CALENDAR_CH_TEXT_PART_STR, i);
- elm_layout_text_set(obj, part, sd->weekdays[(i + sd->first_week_day) % ELM_DAY_LAST]);
+ int weekday_index = (i + sd->first_week_day) % ELM_DAY_LAST;
+ elm_layout_text_set(obj, part, sd->weekdays[weekday_index]);
+ // Signaling the theme about which days are weekdays and which weekend
+ if (weekday_index == ELM_DAY_SATURDAY || weekday_index == ELM_DAY_SUNDAY)
+ _part_name_snprintf(emission, sizeof(emission), obj, ELM_CALENDAR_CH_WEEKEND, i);
+ else
+ _part_name_snprintf(emission, sizeof(emission), obj, ELM_CALENDAR_CH_WEEKDAY, i);
+
+ elm_layout_signal_emit(obj, emission, "elm");
}
sd->filling = EINA_FALSE;