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