app: event-widget CSS code for classes rewritten

This commit is contained in:
Erick Pérez Castellanos
2015-02-13 09:12:15 -05:00
parent 16d77a6718
commit 348be33329
3 changed files with 242 additions and 162 deletions
+2
View File
@@ -1,3 +1,5 @@
@define-color event_shadow_color alpha(black, 0.2);
.views { .views {
/* background color of every view */ /* background color of every view */
background-color: @theme_base_color; background-color: @theme_base_color;
+239 -127
View File
@@ -19,133 +19,245 @@
#ifndef CSS_CODE_H #ifndef CSS_CODE_H
#define CSS_CODE_H #define CSS_CODE_H
#define CSS_TEMPLATE "GcalEventWidget.color-%d {"\ #define CSS_TEMPLATE \
" background-color: %s;"\ ".color-%1$d {"\
"}" " background-color: %2$s"\
"}"\
#define CSS_TEMPLATE_EDGE_BOTH "GcalEventWidget.color-%d.slanted:dir(ltr) {"\ ".color-%1$d.slanted {"\
" background-color: transparent;"\ " background-color: transparent;"\
" padding: 0 2em;"\ " background-image: linear-gradient(100deg, /* left edge */"\
" border-radius: 0;"\ " alpha(%2$s, 0) 5px,"\
" background-image: linear-gradient(-80deg, %s,"\ " %2$s 6px,"\
" %s 40%%,"\ " %2$s 9px,"\
" alpha(%s, 0) 45%%,"\ " alpha(%2$s, 0) 10px,"\
" alpha(%s, 0) 60%%,"\ " alpha(%2$s, 0) 16px,"\
" %s 65%%,"\ " %2$s 17px),"\
" %s 75%%,"\ " linear-gradient(280deg, /* right edge */"\
" alpha(%s, 0) 80%%),"\ " alpha(%2$s, 0) 5px,"\
" linear-gradient(100deg, %s,"\ " %2$s 6px,"\
" %s 40%%,"\ " %2$s 9px,"\
" alpha(%s, 0) 45%%,"\ " alpha(%2$s, 0) 10px,"\
" alpha(%s, 0) 60%%,"\ " alpha(%2$s, 0) 16px,"\
" %s 65%%,"\ " %2$s 17px),"\
" %s 75%%,"\ " linear-gradient(100deg, /* left edge shadow */"\
" alpha(%s, 0) 80%%),"\ " transparent 5px,"\
" linear-gradient(to top, %s);"\ " @event_shadow_color 6px,"\
" background-size: 2em, 2em, 100%% 100%%;"\ " @event_shadow_color 9px,"\
" background-repeat: no-repeat;"\ " transparent 10px,"\
" background-clip: border-box, border-box, content-box;"\ " transparent 16px,"\
" background-position: top left, top right;"\ " @event_shadow_color 17px),"\
"}" " linear-gradient(280deg, /* right edge shadow*/"\
" transparent 5px,"\
#define CSS_TEMPLATE_EDGE_BOTH_RTL "GcalEventWidget.color-%d.slanted:dir(rtl) {"\ " @event_shadow_color 6px,"\
" background-color: transparent;"\ " @event_shadow_color 9px,"\
" padding: 0 2em;"\ " transparent 10px,"\
" border-radius: 0;"\ " transparent 16px,"\
" background-image: linear-gradient(-100deg, %s,"\ " @event_shadow_color 17px);"\
" %s 40%%,"\ " border-bottom: 1px solid transparent; /* for the shadow displacement */"\
" alpha(%s, 0) 45%%,"\ " background-size: 50%% 100%%, 50%% 100%%, 50%% 100%%, 50%% 100%%;"\
" alpha(%s, 0) 60%%,"\ " background-position: left bottom, right bottom, left bottom, right bottom;"\
" %s 65%%,"\ " background-repeat: no-repeat;"\
" %s 75%%,"\ " background-origin: padding-box, padding-box, border-box, border-box;"\
" alpha(%s, 0) 80%%),"\ " background-clip: padding-box, padding-box, border-box, border-box;"\
" linear-gradient(80deg, %s,"\ " padding-left: 24px;"\
" %s 40%%,"\ " padding-right: 24px;"\
" alpha(%s, 0) 45%%,"\ " padding-top: 3px;"\
" alpha(%s, 0) 60%%,"\ " padding-bottom: 4px;"\
" %s 65%%,"\ " border-radius: 0;"\
" %s 75%%,"\ "}"\
" alpha(%s, 0) 80%%),"\ ".color-%1$d.slanted:backdrop {"\
" linear-gradient(to top, %s);"\ " background-image: linear-gradient(100deg, /* left edge */"\
" background-size: 2em, 2em, 100%% 100%%;"\ " alpha(%2$s, 0) 5px,"\
" background-repeat: no-repeat;"\ " %2$s 6px,"\
" background-clip: border-box, border-box, content-box;"\ " %2$s 9px,"\
" background-position: top left, top right;"\ " alpha(%2$s, 0) 10px,"\
"}" " alpha(%2$s, 0) 16px,"\
" %2$s 17px),"\
#define CSS_TEMPLATE_EDGE "GcalEventWidget.color-%d.slanted-end:dir(ltr) {"\ " linear-gradient(280deg, /* right edge */"\
" background-color: transparent;"\ " alpha(%2$s, 0) 5px,"\
" padding-right: 2em;"\ " %2$s 6px,"\
" border-top-right-radius: 0;"\ " %2$s 9px,"\
" border-bottom-right-radius: 0;"\ " alpha(%2$s, 0) 10px,"\
" background-image: linear-gradient(100deg, %s,"\ " alpha(%2$s, 0) 16px,"\
" %s 40%%,"\ " %2$s 17px);"\
" alpha(%s, 0) 45%%,"\ "}"\
" alpha(%s, 0) 60%%,"\ ".color-%1$d.slanted:dir(rtl) {"\
" %s 65%%,"\ " background-image: linear-gradient(80deg, /* left edge */"\
" %s 75%%,"\ " alpha(%2$s, 0) 5px,"\
" alpha(%s, 0) 80%%),"\ " %2$s 6px,"\
" linear-gradient(to top, %s);"\ " %2$s 9px,"\
" background-size: 2em, 100%% 100%%;"\ " alpha(%2$s, 0) 10px,"\
" background-repeat: no-repeat;"\ " alpha(%2$s, 0) 16px,"\
" background-position: top right, -2em;"\ " %2$s 17px),"\
"}" " linear-gradient(260deg, /* right edge */"\
" alpha(%2$s, 0) 5px,"\
#define CSS_TEMPLATE_EDGE_START "GcalEventWidget.color-%d.slanted-start:dir(ltr) {"\ " %2$s 6px,"\
" background-color: transparent;"\ " %2$s 9px,"\
" padding-left: 2em;"\ " alpha(%2$s, 0) 10px,"\
" border-top-left-radius: 0;"\ " alpha(%2$s, 0) 16px,"\
" border-bottom-left-radius: 0;"\ " %2$s 17px),"\
" background-image: linear-gradient(-80deg, %s,"\ " linear-gradient(80deg, /* left edge shadow */"\
" %s 40%%,"\ " transparent 5px,"\
" alpha(%s, 0) 45%%,"\ " @event_shadow_color 6px,"\
" alpha(%s, 0) 60%%,"\ " @event_shadow_color 9px,"\
" %s 65%%,"\ " transparent 10px,"\
" %s 75%%,"\ " transparent 16px,"\
" alpha(%s, 0) 80%%),"\ " @event_shadow_color 17px),"\
" linear-gradient(to top, %s);"\ " linear-gradient(260deg, /* right edge shadow*/"\
" background-size: 2em, 100%% 100%%;"\ " transparent 5px,"\
" background-repeat: no-repeat;"\ " @event_shadow_color 6px,"\
" background-position: top left, 2em;"\ " @event_shadow_color 9px,"\
"}" " transparent 10px,"\
" transparent 16px,"\
#define CSS_TEMPLATE_EDGE_RTL "GcalEventWidget.color-%d.slanted-end:dir(rtl) {"\ " @event_shadow_color 17px);"\
" background-color: transparent;"\ "}"\
" padding-left: 2em;"\ ".color-%1$d.slanted:dir(rtl):backdrop {"\
" border-top-left-radius: 0;"\ " background-image: linear-gradient(80deg, /* left edge */"\
" border-bottom-left-radius: 0;"\ " alpha(%2$s, 0) 5px,"\
" background-image: linear-gradient(-100deg, %s,"\ " %2$s 6px,"\
" %s 40%%,"\ " %2$s 9px,"\
" alpha(%s, 0) 45%%,"\ " alpha(%2$s, 0) 10px,"\
" alpha(%s, 0) 60%%,"\ " alpha(%2$s, 0) 16px,"\
" %s 65%%,"\ " %2$s 17px),"\
" %s 75%%,"\ " linear-gradient(260deg, /* right edge */"\
" alpha(%s, 0) 80%%),"\ " alpha(%2$s, 0) 5px,"\
" linear-gradient(to top, %s);"\ " %2$s 6px,"\
" background-size: 2em, 100%% 100%%;"\ " %2$s 9px,"\
" background-repeat: no-repeat;"\ " alpha(%2$s, 0) 10px,"\
" background-position: top left, 2em;"\ " alpha(%2$s, 0) 16px,"\
"}" " %2$s 17px);"\
"}"\
#define CSS_TEMPLATE_EDGE_START_RTL "GcalEventWidget.color-%d.slanted-start:dir(rtl) {"\ ".color-%1$d.slanted-start {"\
" background-color: transparent;"\ " background-color: transparent;"\
" padding-right: 2em;"\ " background-image: linear-gradient(100deg, /* left edge */"\
" border-top-right-radius: 0;"\ " alpha(%2$s, 0) 5px,"\
" border-bottom-right-radius: 0;"\ " %2$s 6px,"\
" background-image: linear-gradient(80deg, %s,"\ " %2$s 9px,"\
" %s 40%%,"\ " alpha(%2$s, 0) 10px,"\
" alpha(%s, 0) 45%%,"\ " alpha(%2$s, 0) 16px,"\
" alpha(%s, 0) 60%%,"\ " %2$s 17px),"\
" %s 65%%,"\ " linear-gradient(100deg, /* left edge shadow */"\
" %s 75%%,"\ " transparent 5px,"\
" alpha(%s, 0) 80%%),"\ " @event_shadow_color 6px,"\
" linear-gradient(to top, %s);"\ " @event_shadow_color 9px,"\
" background-size: 2em, 100%% 100%%;"\ " transparent 10px,"\
" background-repeat: no-repeat;"\ " transparent 16px,"\
" background-position: top right, -2em;"\ " @event_shadow_color 17px);"\
"}" " border-bottom: 1px solid transparent; /* for the shadow displacement */"\
" background-position: left bottom, left bottom;"\
" background-size: 100%% 100%%, 100%% 100%%;"\
" background-origin: padding-box, border-box;"\
" background-clip: padding-box, border-box;"\
" border-radius: 0 5px 4px 0;"\
" padding-right: 4px;"\
" padding-left: 24px;"\
" padding-top: 3px;"\
" padding-bottom: 4px;"\
"}"\
".color-%1$d.slanted-start:backdrop {"\
" background-image: linear-gradient(100deg, /* left edge */"\
" alpha(%2$s, 0) 5px,"\
" %2$s 6px,"\
" %2$s 9px,"\
" alpha(%2$s, 0) 10px,"\
" alpha(%2$s, 0) 16px,"\
" %2$s 17px);"\
"}"\
".color-%1$d.slanted-start:dir(rtl) {"\
" background-image: linear-gradient(260deg, /* right edge */"\
" alpha(%2$s, 0) 5px,"\
" %2$s 6px,"\
" %2$s 9px,"\
" alpha(%2$s, 0) 10px,"\
" alpha(%2$s, 0) 16px,"\
" %2$s 17px),"\
" linear-gradient(260deg, /* right edge shadow */"\
" transparent 5px,"\
" @event_shadow_color 6px,"\
" @event_shadow_color 9px,"\
" transparent 10px,"\
" transparent 16px,"\
" @event_shadow_color 17px);"\
" border-bottom: 1px solid transparent; /* for the shadow displacement */"\
" background-position: right bottom, right bottom;"\
" border-radius: 4px 0 0 5px;"\
" padding-right: 24px;"\
" padding-left: 4px;"\
"}"\
".color-%1$d.slanted-start:dir(rtl):backdrop {"\
" background-image: linear-gradient(260deg, /* right edge */"\
" alpha(%2$s, 0) 5px,"\
" %2$s 6px,"\
" %2$s 9px,"\
" alpha(%2$s, 0) 10px,"\
" alpha(%2$s, 0) 16px,"\
" %2$s 17px);"\
"}"\
".color-%1$d.slanted-end {"\
" background-color: transparent;"\
" background-image: linear-gradient(280deg, /* right edge */"\
" alpha(%2$s, 0) 5px,"\
" %2$s 6px,"\
" %2$s 9px,"\
" alpha(%2$s, 0) 10px,"\
" alpha(%2$s, 0) 16px,"\
" %2$s 17px),"\
" linear-gradient(280deg, /* right edge shadow */"\
" transparent 5px,"\
" @event_shadow_color 6px,"\
" @event_shadow_color 9px,"\
" transparent 10px,"\
" transparent 16px,"\
" @event_shadow_color 17px);"\
" border-bottom: 1px solid transparent; /* for the shadow displacement */"\
" background-position: right bottom, right bottom;"\
" background-size: 100%% 100%%, 100%% 100%%;"\
" background-origin: padding-box, border-box;"\
" background-clip: padding-box, border-box;"\
" border-radius: 4px 0 0 5px;"\
" padding-right: 24px;"\
" padding-left: 4px;"\
" padding-top: 3px;"\
" padding-bottom: 4px;"\
"}"\
".color-%1$d.slanted-end:backdrop {"\
" background-image: linear-gradient(280deg, /* right edge */"\
" alpha(%2$s, 0) 5px,"\
" %2$s 6px,"\
" %2$s 9px,"\
" alpha(%2$s, 0) 10px,"\
" alpha(%2$s, 0) 16px,"\
" %2$s 17px);"\
"}"\
".color-%1$d.slanted-end:dir(rtl) {"\
" background-image: linear-gradient(80deg, /* left edge */"\
" alpha(%2$s, 0) 5px,"\
" %2$s 6px,"\
" %2$s 9px,"\
" alpha(%2$s, 0) 10px,"\
" alpha(%2$s, 0) 16px,"\
" %2$s 17px),"\
" linear-gradient(80deg, /* left edge shadow */"\
" transparent 5px,"\
" @event_shadow_color 6px,"\
" @event_shadow_color 9px,"\
" transparent 10px,"\
" transparent 16px,"\
" @event_shadow_color 17px);"\
" background-position: left bottom, left bottom;"\
" border-radius: 0 4px 5px 0;"\
" padding-right: 4px;"\
" padding-left: 24px;"\
"}"\
".color-%1$d.slanted-end:dir(rtl):backdrop {"\
" background-image: linear-gradient(80deg, /* left edge */"\
" alpha(%2$s, 0) 5px,"\
" %2$s 6px,"\
" %2$s 9px,"\
" alpha(%2$s, 0) 10px,"\
" alpha(%2$s, 0) 16px,"\
" %2$s 17px);"\
"}"
#endif /* CSS_CODE_H */ #endif /* CSS_CODE_H */
+1 -35
View File
@@ -137,8 +137,6 @@ process_sources (GcalApplication *application)
GQuark color_id; GQuark color_id;
const gchar* color_str; const gchar* color_str;
gchar *bkg_color, *slanted_edge_both_ltr, *slanted_edge_both_rtl;
gchar *slanted_edge_start_ltr, *slanted_edge_start_rtl, *slanted_edge_end_ltr, *slanted_edge_end_rtl;
gchar **new_css_snippets; gchar **new_css_snippets;
gchar *new_css_data; gchar *new_css_data;
@@ -156,39 +154,7 @@ process_sources (GcalApplication *application)
color_str = get_color_name_from_source (source); color_str = get_color_name_from_source (source);
color_id = g_quark_from_string (color_str); color_id = g_quark_from_string (color_str);
bkg_color = g_strdup_printf (CSS_TEMPLATE, color_id, color_str); new_css_snippets[i] = g_strdup_printf (CSS_TEMPLATE, color_id, color_str);
slanted_edge_both_ltr =
g_strdup_printf (CSS_TEMPLATE_EDGE_BOTH, color_id,
color_str, color_str, color_str, color_str, color_str, color_str, color_str, color_str,
color_str, color_str, color_str, color_str, color_str, color_str, color_str);
slanted_edge_both_rtl =
g_strdup_printf (CSS_TEMPLATE_EDGE_BOTH_RTL, color_id,
color_str, color_str, color_str, color_str, color_str, color_str, color_str, color_str,
color_str, color_str, color_str, color_str, color_str, color_str, color_str);
slanted_edge_end_ltr =
g_strdup_printf (CSS_TEMPLATE_EDGE, color_id,
color_str, color_str, color_str, color_str, color_str, color_str, color_str, color_str);
slanted_edge_start_ltr =
g_strdup_printf (CSS_TEMPLATE_EDGE_START, color_id,
color_str, color_str, color_str, color_str, color_str, color_str, color_str, color_str);
slanted_edge_end_rtl =
g_strdup_printf (CSS_TEMPLATE_EDGE_RTL, color_id,
color_str, color_str, color_str, color_str, color_str, color_str, color_str, color_str);
slanted_edge_start_rtl =
g_strdup_printf (CSS_TEMPLATE_EDGE_START_RTL, color_id,
color_str, color_str, color_str, color_str, color_str, color_str, color_str, color_str);
new_css_snippets[i] = g_strconcat (bkg_color, slanted_edge_both_ltr, slanted_edge_both_rtl,
slanted_edge_end_ltr, slanted_edge_start_ltr,
slanted_edge_end_rtl, slanted_edge_start_rtl, NULL);
g_free (bkg_color);
g_free (slanted_edge_both_ltr);
g_free (slanted_edge_both_rtl);
g_free (slanted_edge_end_ltr);
g_free (slanted_edge_start_ltr);
g_free (slanted_edge_start_rtl);
g_free (slanted_edge_end_rtl);
} }
g_list_free (sources); g_list_free (sources);