[gtk+] ColorChooser: Emit notification for editor changes



commit 8591f452f0004574488c22cfdced145997b27835
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed May 21 19:23:56 2014 -0400

    ColorChooser: Emit notification for editor changes
    
    When the color editor is visible, there is no way for the
    application to know about the changes that are happening.
    Fix this by emitting property notification for the "rgba"
    property.
    
    http://bugzilla.gnome.org/show_bug.cgi?id=708037

 gtk/gtkcolorchooserwidget.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcolorchooserwidget.c b/gtk/gtkcolorchooserwidget.c
index a8fb9cf..4c4cf73 100644
--- a/gtk/gtkcolorchooserwidget.c
+++ b/gtk/gtkcolorchooserwidget.c
@@ -269,6 +269,15 @@ gtk_color_chooser_widget_set_show_editor (GtkColorChooserWidget *cc,
   gtk_widget_set_visible (cc->priv->palette, !show_editor);
 }
 
+static void
+update_from_editor (GtkColorEditor        *editor,
+                    GParamSpec            *pspec,
+                    GtkColorChooserWidget *widget)
+{
+  if (gtk_widget_get_visible (editor))
+    g_object_notify (G_OBJECT (widget), "rgba");
+}
+
 /* UI construction {{{1 */
 
 static guint
@@ -565,6 +574,8 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc)
   cc->priv->editor = gtk_color_editor_new ();
   gtk_widget_set_halign (cc->priv->editor, GTK_ALIGN_CENTER);
   gtk_widget_set_hexpand (cc->priv->editor, TRUE);
+  g_signal_connect (cc->priv->editor, "notify::rgba",
+                    G_CALLBACK (update_from_editor), cc);
 
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
   gtk_container_add (GTK_CONTAINER (cc), box);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]