app: use get_color_name_from_source()
This commit is contained in:
@@ -134,7 +134,6 @@ process_sources (GcalApplication *application)
|
|||||||
ESource *source;
|
ESource *source;
|
||||||
|
|
||||||
gint arr_length, i = 0;
|
gint arr_length, i = 0;
|
||||||
ESourceSelectable *extension;
|
|
||||||
GQuark color_id;
|
GQuark color_id;
|
||||||
const gchar* color_str;
|
const gchar* color_str;
|
||||||
|
|
||||||
@@ -154,9 +153,8 @@ process_sources (GcalApplication *application)
|
|||||||
{
|
{
|
||||||
source = l->data;
|
source = l->data;
|
||||||
|
|
||||||
extension = E_SOURCE_SELECTABLE (e_source_get_extension (source, E_SOURCE_EXTENSION_CALENDAR));
|
color_str = get_color_name_from_source (source);
|
||||||
color_id = g_quark_from_string (e_source_selectable_get_color (extension));
|
color_id = g_quark_from_string (color_str);
|
||||||
color_str = e_source_selectable_get_color (extension);
|
|
||||||
|
|
||||||
bkg_color = g_strdup_printf (CSS_TEMPLATE, color_id, color_str);
|
bkg_color = g_strdup_printf (CSS_TEMPLATE, color_id, color_str);
|
||||||
slanted_edge_both_ltr =
|
slanted_edge_both_ltr =
|
||||||
|
|||||||
+3
-11
@@ -129,15 +129,13 @@ fill_sources_menu (GcalEditDialog *dialog)
|
|||||||
{
|
{
|
||||||
ESource *source;
|
ESource *source;
|
||||||
GMenuItem *item;
|
GMenuItem *item;
|
||||||
ESourceSelectable *extension;
|
|
||||||
GdkRGBA color;
|
GdkRGBA color;
|
||||||
GdkPixbuf *pix;
|
GdkPixbuf *pix;
|
||||||
|
|
||||||
source = E_SOURCE (aux->data);
|
source = E_SOURCE (aux->data);
|
||||||
|
|
||||||
/* retrieve color */
|
/* retrieve color */
|
||||||
extension = E_SOURCE_SELECTABLE (e_source_get_extension (source, E_SOURCE_EXTENSION_CALENDAR));
|
gdk_rgba_parse (&color, get_color_name_from_source (source));
|
||||||
gdk_rgba_parse (&color, e_source_selectable_get_color (E_SOURCE_SELECTABLE (extension)));
|
|
||||||
pix = gcal_get_pixbuf_from_color (&color, 16);;
|
pix = gcal_get_pixbuf_from_color (&color, 16);;
|
||||||
|
|
||||||
/* menu item */
|
/* menu item */
|
||||||
@@ -194,12 +192,10 @@ on_calendar_selected (GtkWidget *menu_item,
|
|||||||
if (g_strcmp0 (e_source_get_uid (source), uid) == 0)
|
if (g_strcmp0 (e_source_get_uid (source), uid) == 0)
|
||||||
{
|
{
|
||||||
GdkRGBA color;
|
GdkRGBA color;
|
||||||
ESourceSelectable *extension;
|
|
||||||
GdkPixbuf *pix;
|
GdkPixbuf *pix;
|
||||||
|
|
||||||
/* retrieve color */
|
/* retrieve color */
|
||||||
extension = E_SOURCE_SELECTABLE (e_source_get_extension (source, E_SOURCE_EXTENSION_CALENDAR));
|
gdk_rgba_parse (&color, get_color_name_from_source (source));
|
||||||
gdk_rgba_parse (&color, e_source_selectable_get_color (E_SOURCE_SELECTABLE (extension)));
|
|
||||||
|
|
||||||
pix = gcal_get_pixbuf_from_color (&color, 16);
|
pix = gcal_get_pixbuf_from_color (&color, 16);
|
||||||
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->source_image), pix);
|
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->source_image), pix);
|
||||||
@@ -764,7 +760,6 @@ gcal_edit_dialog_set_event_data (GcalEditDialog *dialog,
|
|||||||
|
|
||||||
GdkRGBA color;
|
GdkRGBA color;
|
||||||
GdkPixbuf *pix;
|
GdkPixbuf *pix;
|
||||||
ESourceSelectable *extension;
|
|
||||||
|
|
||||||
const gchar *const_text = NULL;
|
const gchar *const_text = NULL;
|
||||||
gboolean all_day;
|
gboolean all_day;
|
||||||
@@ -825,10 +820,7 @@ gcal_edit_dialog_set_event_data (GcalEditDialog *dialog,
|
|||||||
gtk_entry_set_text (GTK_ENTRY (priv->summary_entry), e_summary.value);
|
gtk_entry_set_text (GTK_ENTRY (priv->summary_entry), e_summary.value);
|
||||||
|
|
||||||
/* dialog titlebar's title & subtitle */
|
/* dialog titlebar's title & subtitle */
|
||||||
extension = E_SOURCE_SELECTABLE (e_source_get_extension (data->source, E_SOURCE_EXTENSION_CALENDAR));
|
gdk_rgba_parse (&color, get_color_name_from_source (data->source));
|
||||||
gdk_rgba_parse (
|
|
||||||
&color,
|
|
||||||
e_source_selectable_get_color (E_SOURCE_SELECTABLE (extension)));
|
|
||||||
|
|
||||||
pix = gcal_get_pixbuf_from_color (&color, 16);
|
pix = gcal_get_pixbuf_from_color (&color, 16);
|
||||||
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->source_image), pix);
|
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->source_image), pix);
|
||||||
|
|||||||
@@ -705,7 +705,6 @@ gcal_event_widget_new_from_data (GcalEventData *data)
|
|||||||
gchar *uuid;
|
gchar *uuid;
|
||||||
ECalComponentId *id;
|
ECalComponentId *id;
|
||||||
ECalComponentText e_summary;
|
ECalComponentText e_summary;
|
||||||
ESourceSelectable *extension;
|
|
||||||
|
|
||||||
GQuark color_id;
|
GQuark color_id;
|
||||||
GdkRGBA color;
|
GdkRGBA color;
|
||||||
@@ -744,13 +743,10 @@ gcal_event_widget_new_from_data (GcalEventData *data)
|
|||||||
gcal_event_widget_set_summary (event, (gchar*) e_summary.value);
|
gcal_event_widget_set_summary (event, (gchar*) e_summary.value);
|
||||||
|
|
||||||
/* color */
|
/* color */
|
||||||
extension = E_SOURCE_SELECTABLE (
|
gdk_rgba_parse (&color, get_color_name_from_source (priv->source));
|
||||||
e_source_get_extension (priv->source,
|
|
||||||
E_SOURCE_EXTENSION_CALENDAR));
|
|
||||||
gdk_rgba_parse (&color, e_source_selectable_get_color (extension));
|
|
||||||
gcal_event_widget_set_color (event, &color);
|
gcal_event_widget_set_color (event, &color);
|
||||||
|
|
||||||
color_id = g_quark_from_string (e_source_selectable_get_color (extension));
|
color_id = g_quark_from_string (get_color_name_from_source (priv->source));
|
||||||
custom_css_class = g_strdup_printf ("color-%d", color_id);
|
custom_css_class = g_strdup_printf ("color-%d", color_id);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), custom_css_class);
|
gtk_style_context_add_class (gtk_widget_get_style_context (widget), custom_css_class);
|
||||||
g_free (custom_css_class);
|
g_free (custom_css_class);
|
||||||
|
|||||||
@@ -316,7 +316,6 @@ make_row_for_event_data (GcalSearchView *view,
|
|||||||
GDateTime *datetime;
|
GDateTime *datetime;
|
||||||
ECalComponentDateTime comp_dt;
|
ECalComponentDateTime comp_dt;
|
||||||
ECalComponentText summary;
|
ECalComponentText summary;
|
||||||
ESourceSelectable *extension;
|
|
||||||
GdkRGBA color;
|
GdkRGBA color;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
@@ -334,9 +333,7 @@ make_row_for_event_data (GcalSearchView *view,
|
|||||||
priv = gcal_search_view_get_instance_private (view);
|
priv = gcal_search_view_get_instance_private (view);
|
||||||
|
|
||||||
/* get event color */
|
/* get event color */
|
||||||
extension = E_SOURCE_SELECTABLE (e_source_get_extension (data->source, E_SOURCE_EXTENSION_CALENDAR));
|
gdk_rgba_parse (&color, get_color_name_from_source (data->source));
|
||||||
gdk_rgba_parse (&color, e_source_selectable_get_color (E_SOURCE_SELECTABLE (extension)));
|
|
||||||
|
|
||||||
pixbuf = gcal_get_pixbuf_from_color (&color, 16);
|
pixbuf = gcal_get_pixbuf_from_color (&color, 16);
|
||||||
|
|
||||||
/* make an image of the color */
|
/* make an image of the color */
|
||||||
|
|||||||
+1
-3
@@ -727,7 +727,6 @@ add_source (GcalManager *manager,
|
|||||||
GSimpleAction *action;
|
GSimpleAction *action;
|
||||||
|
|
||||||
gchar *item_name;
|
gchar *item_name;
|
||||||
ESourceSelectable *extension;
|
|
||||||
|
|
||||||
priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
|
priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
|
||||||
|
|
||||||
@@ -738,8 +737,7 @@ add_source (GcalManager *manager,
|
|||||||
|
|
||||||
/* retrieve the source's color & build item name */
|
/* retrieve the source's color & build item name */
|
||||||
item_name = g_strdup_printf ("%s", e_source_get_uid (source));
|
item_name = g_strdup_printf ("%s", e_source_get_uid (source));
|
||||||
extension = E_SOURCE_SELECTABLE (e_source_get_extension (source, E_SOURCE_EXTENSION_CALENDAR));
|
gdk_rgba_parse (&color, get_color_name_from_source (source));
|
||||||
gdk_rgba_parse (&color, e_source_selectable_get_color (E_SOURCE_SELECTABLE (extension)));
|
|
||||||
pix = gcal_get_pixbuf_from_color (&color, 16);
|
pix = gcal_get_pixbuf_from_color (&color, 16);
|
||||||
|
|
||||||
/* create the menu item */
|
/* create the menu item */
|
||||||
|
|||||||
Reference in New Issue
Block a user