[gnome-calendar/calendar-editor] source-dialog: implement color selection
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/calendar-editor] source-dialog: implement color selection
- Date: Mon, 9 Feb 2015 17:56:37 +0000 (UTC)
commit ed293a81e7f6d950563ea46c30845e6175795f05
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Feb 9 15:56:28 2015 -0200
source-dialog: implement color selection
data/ui/source-dialog.ui | 1 +
src/gcal-source-dialog.c | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/data/ui/source-dialog.ui b/data/ui/source-dialog.ui
index bea1bed..9a8a43e 100644
--- a/data/ui/source-dialog.ui
+++ b/data/ui/source-dialog.ui
@@ -111,6 +111,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <signal name="color-set" handler="color_set" object="GcalSourceDialog" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>
diff --git a/src/gcal-source-dialog.c b/src/gcal-source-dialog.c
index f9b2cbe..982eebc 100644
--- a/src/gcal-source-dialog.c
+++ b/src/gcal-source-dialog.c
@@ -52,6 +52,9 @@ struct _GcalSourceDialog
static void action_widget_activated (GtkWidget *widget,
gpointer user_data);
+static void color_set (GtkColorButton *button,
+ gpointer user_data);
+
static gboolean description_label_link_activated (GtkWidget *widget,
gchar *uri,
gpointer user_data);
@@ -91,6 +94,21 @@ action_widget_activated (GtkWidget *widget,
gtk_dialog_response (GTK_DIALOG (user_data), response);
}
+static void
+color_set (GtkColorButton *button,
+ gpointer user_data)
+{
+ GcalSourceDialogPrivate *priv = GCAL_SOURCE_DIALOG (user_data)->priv;
+ ESourceSelectable *extension;
+ GdkRGBA color;
+
+ gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (button), &color);
+
+ extension = E_SOURCE_SELECTABLE (e_source_get_extension (priv->source, E_SOURCE_EXTENSION_CALENDAR));
+
+ e_source_selectable_set_color (extension, gdk_rgba_to_string (&color));
+}
+
/**
* description_label_link_activated:
*
@@ -220,6 +238,7 @@ gcal_source_dialog_class_init (GcalSourceDialogClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, stack);
gtk_widget_class_bind_template_callback (widget_class, action_widget_activated);
+ gtk_widget_class_bind_template_callback (widget_class, color_set);
gtk_widget_class_bind_template_callback (widget_class, description_label_link_activated);
gtk_widget_class_bind_template_callback (widget_class, name_entry_text_changed);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]