[gnome-calendar] source-dialog: update calendar image color
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] source-dialog: update calendar image color
- Date: Sun, 5 Mar 2017 23:53:13 +0000 (UTC)
commit 7aa4cefa8e36f1ded3ebc59843d13ca64b2bf2bf
Author: Valentin Negoescu <valinegoescu20 gmail com>
Date: Wed Mar 1 18:08:58 2017 +0200
source-dialog: update calendar image color
After editing the color of a calendar its image is not
updated as well. Fix this by updating the image when the
edit is finished.
https://bugzilla.gnome.org/show_bug.cgi?id=773869
src/gcal-source-dialog.c | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-source-dialog.c b/src/gcal-source-dialog.c
index 987f6dc..ad90f85 100644
--- a/src/gcal-source-dialog.c
+++ b/src/gcal-source-dialog.c
@@ -562,6 +562,31 @@ is_goa_source (GcalSourceDialog *dialog,
}
static void
+source_color_changed (GObject *source,
+ GParamSpec *pspec,
+ GtkImage *icon)
+{
+ ESourceSelectable *extension;
+ GdkPixbuf *pixbuf;
+ GdkRGBA out_color;
+
+ extension = E_SOURCE_SELECTABLE (source);
+
+ if (!gdk_rgba_parse (&out_color, e_source_selectable_get_color (extension)))
+ {
+ g_warning ("Error parsing color");
+ return;
+ }
+
+ if (gdk_rgba_parse (&out_color, e_source_selectable_get_color (extension)))
+ {
+ pixbuf = get_circle_pixbuf_from_color (&out_color, 24);
+ gtk_image_set_from_pixbuf (GTK_IMAGE (icon), pixbuf);
+ g_object_unref (pixbuf);
+ }
+}
+
+static void
invalidate_calendar_listbox_sort (GObject *source,
GParamSpec *pspec,
gpointer user_data)
@@ -592,6 +617,7 @@ make_row_from_source (GcalSourceDialog *dialog,
GdkRGBA color;
gchar *parent_name;
+ ESourceSelectable *extension;
get_source_parent_name_color (dialog->manager, source, &parent_name, NULL);
builder = gtk_builder_new_from_resource ("/org/gnome/calendar/calendar-row.ui");
@@ -615,6 +641,9 @@ make_row_from_source (GcalSourceDialog *dialog,
g_signal_connect (source, "notify::display-name", G_CALLBACK (invalidate_calendar_listbox_sort),
dialog->calendars_listbox);
+ extension = E_SOURCE_SELECTABLE (e_source_get_extension (source, E_SOURCE_EXTENSION_CALENDAR));
+ g_signal_connect (extension, "notify::color", G_CALLBACK (source_color_changed), icon);
+
/* parent source name label */
bottom_label = GTK_WIDGET (gtk_builder_get_object (builder, "subtitle"));
gtk_label_set_label (GTK_LABEL (bottom_label), parent_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]