[gnome-calendar] application: use events edges styles
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] application: use events edges styles
- Date: Thu, 22 Jan 2015 18:52:24 +0000 (UTC)
commit 5071b94b142b5c27a111dbe4477a918a8eebaec4
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Thu Jan 22 13:47:25 2015 -0500
application: use events edges styles
data/theme/gtk-styles.css | 22 +---------------------
src/gcal-application.c | 41 +++++++++++++++++++++++++++++++++++++++--
2 files changed, 40 insertions(+), 23 deletions(-)
---
diff --git a/data/theme/gtk-styles.css b/data/theme/gtk-styles.css
index 052fa46..5f2554b 100644
--- a/data/theme/gtk-styles.css
+++ b/data/theme/gtk-styles.css
@@ -162,28 +162,8 @@ GtkButton.popover-sidebar {
border-radius: 0;
}
-GcalEventWidget.slanted-start:dir(ltr) {
- border-top-left-radius: 0;
- border-bottom-left-radius: 0;
-}
-
-GcalEventWidget.slanted-end:dir(ltr) {
- border-top-right-radius: 0;
- border-bottom-right-radius: 0;
-}
-
-GcalEventWidget.slanted-start:dir(rtl) {
- border-top-right-radius: 0;
- border-bottom-right-radius: 0;
-}
-
-GcalEventWidget.slanted-end:dir(rtl) {
- border-top-left-radius: 0;
- border-bottom-left-radius: 0;
-}
-
GcalEventWidget {
- border-radius: 6px;
+ border-radius: 3px;
margin-top: 2px;
margin-left: 4px;
margin-bottom: 2px;
diff --git a/src/gcal-application.c b/src/gcal-application.c
index 71ce9c2..8b3f2a9 100644
--- a/src/gcal-application.c
+++ b/src/gcal-application.c
@@ -22,6 +22,7 @@
#endif
#include "gcal-application.h"
+#include "css-code.h"
#include "gcal-window.h"
#include <glib.h>
@@ -30,7 +31,6 @@
#include <glib/gi18n.h>
#define CSS_FILE "resource:///org/gnome/calendar/gtk-styles.css"
-#define CSS_TEMPLATE "GcalEventWidget.color-%d { background-color: %s; }"
typedef struct
{
@@ -121,7 +121,10 @@ source_added_cb (GcalManager *manager,
gint i, arr_length = 0;
ESourceSelectable *extension;
GQuark color_id;
+ const gchar* color_str;
+ gchar *css_snippet, *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_data;
@@ -131,6 +134,7 @@ source_added_cb (GcalManager *manager,
extension = E_SOURCE_SELECTABLE (e_source_get_extension (source, E_SOURCE_EXTENSION_CALENDAR));
color_id = g_quark_from_string (e_source_selectable_get_color (extension));
+ color_str = e_source_selectable_get_color (extension);
if (priv->css_code_snippets != NULL)
arr_length = g_strv_length (priv->css_code_snippets);
@@ -139,7 +143,39 @@ source_added_cb (GcalManager *manager,
for (i = 0; i < arr_length; i++)
new_css_snippets[i] = priv->css_code_snippets[i];
- new_css_snippets[arr_length] = g_strdup_printf (CSS_TEMPLATE, color_id, e_source_selectable_get_color
(extension));
+
+ bkg_color = 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);
+ css_snippet = 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);
+ new_css_snippets[arr_length] = css_snippet;
+ 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);
if (priv->css_code_snippets != NULL)
g_free (priv->css_code_snippets); /* shallow free, cause I'm just moving the pointers */
@@ -486,3 +522,4 @@ gcal_application_get_settings (GcalApplication *app)
priv = gcal_application_get_instance_private (app);
return priv->settings;
}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]