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)
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 @@
22#define ELM_CALENDAR_BUTTON_RIGHT "elm,calendar,button,right" 22#define ELM_CALENDAR_BUTTON_RIGHT "elm,calendar,button,right"
23#define ELM_CALENDAR_BUTTON_YEAR_LEFT "elm,calendar,button_year,left" 23#define ELM_CALENDAR_BUTTON_YEAR_LEFT "elm,calendar,button_year,left"
24#define ELM_CALENDAR_BUTTON_YEAR_RIGHT "elm,calendar,button_year,right" 24#define ELM_CALENDAR_BUTTON_YEAR_RIGHT "elm,calendar,button_year,right"
25#define ELM_CALENDAR_CH_WEEKEND "elm,calendar,ch_%d,weekend"
26#define ELM_CALENDAR_CH_WEEKDAY "elm,calendar,ch_%d,weekday"
25 27
26#define ELM_CALENDAR_CH_TEXT_PART_STR "elm.ch_%d.text" 28#define ELM_CALENDAR_CH_TEXT_PART_STR "elm.ch_%d.text"
27#define ELM_CALENDAR_CIT_TEXT_PART_STR "elm.cit_%d.text" 29#define ELM_CALENDAR_CIT_TEXT_PART_STR "elm.cit_%d.text"
@@ -674,6 +676,7 @@ static void
674_set_headers(Evas_Object *obj) 676_set_headers(Evas_Object *obj)
675{ 677{
676 static char part[64]; 678 static char part[64];
679 static char emission[64];
677 int i; 680 int i;
678 struct tm *t; 681 struct tm *t;
679 time_t temp = 259200; // the first sunday since epoch 682 time_t temp = 259200; // the first sunday since epoch
@@ -710,7 +713,15 @@ _set_headers(Evas_Object *obj)
710 for (i = 0; i < ELM_DAY_LAST; i++) 713 for (i = 0; i < ELM_DAY_LAST; i++)
711 { 714 {
712 _part_name_snprintf(part, sizeof(part), obj, ELM_CALENDAR_CH_TEXT_PART_STR, i); 715 _part_name_snprintf(part, sizeof(part), obj, ELM_CALENDAR_CH_TEXT_PART_STR, i);
713 elm_layout_text_set(obj, part, sd->weekdays[(i + sd->first_week_day) % ELM_DAY_LAST]); 716 int weekday_index = (i + sd->first_week_day) % ELM_DAY_LAST;
717 elm_layout_text_set(obj, part, sd->weekdays[weekday_index]);
718 // Signaling the theme about which days are weekdays and which weekend
719 if (weekday_index == ELM_DAY_SATURDAY || weekday_index == ELM_DAY_SUNDAY)
720 _part_name_snprintf(emission, sizeof(emission), obj, ELM_CALENDAR_CH_WEEKEND, i);
721 else
722 _part_name_snprintf(emission, sizeof(emission), obj, ELM_CALENDAR_CH_WEEKDAY, i);
723
724 elm_layout_signal_emit(obj, emission, "elm");
714 } 725 }
715 726
716 sd->filling = EINA_FALSE; 727 sd->filling = EINA_FALSE;