[aisleriot] sol: prop-editor: Update from gtk



commit fd744a07f6535d25b1425df7f97d450f005d473a
Author: Christian Persch <chpe gnome org>
Date:   Fri Mar 2 18:40:51 2012 +0100

    sol: prop-editor: Update from gtk

 src/prop-editor.c |   38 +++++++++++++++++---------------------
 src/prop-editor.h |    4 +---
 2 files changed, 18 insertions(+), 24 deletions(-)
---
diff --git a/src/prop-editor.c b/src/prop-editor.c
index 71b83eb..ac7409b 100644
--- a/src/prop-editor.c
+++ b/src/prop-editor.c
@@ -12,9 +12,7 @@
  * Library General Public License for more details.
  *
  * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <string.h>
@@ -113,7 +111,7 @@ free_object_property (ObjectProperty *p)
 
 static void
 connect_controller (GObject     *controller,
-                    const gchar *signal_name,
+                    const gchar *signal,
                     GObject     *model,
                     GParamSpec  *spec,
                     GCallback    func)
@@ -124,7 +122,7 @@ connect_controller (GObject     *controller,
   p->obj = model;
   p->spec = spec;
 
-  p->modified_id = g_signal_connect_data (controller, signal_name, func, p,
+  p->modified_id = g_signal_connect_data (controller, signal, func, p,
                                           (GClosureNotify)free_object_property,
                                           0);
   g_object_set_data (controller, "object-property", p);
@@ -666,7 +664,7 @@ rgba_modified (GtkColorButton *cb, gpointer data)
   ObjectProperty *p = data;
   GdkRGBA color;
 
-  gtk_color_button_get_rgba (cb, &color);
+  gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (cb), &color);
 
   if (is_child_property (p->spec))
     {
@@ -692,12 +690,12 @@ rgba_changed (GObject *object, GParamSpec *pspec, gpointer data)
   get_property_value (object, pspec, &val);
 
   color = g_value_get_boxed (&val);
-  gtk_color_button_get_rgba (cb, &cb_color);
+  gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (cb), &cb_color);
 
   if (color != NULL && !gdk_rgba_equal (color, &cb_color))
     {
       block_controller (G_OBJECT (cb));
-      gtk_color_button_set_rgba (cb, color);
+      gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (cb), color);
       unblock_controller (G_OBJECT (cb));
     }
 
@@ -708,20 +706,23 @@ static void
 color_modified (GtkColorButton *cb, gpointer data)
 {
   ObjectProperty *p = data;
-  GdkColor color;
+  GValue val = G_VALUE_INIT;
 
-  gtk_color_button_get_color (cb, &color);
+  g_value_init (&val, GDK_TYPE_COLOR);
+  g_object_get_property (G_OBJECT (cb), "color", &val);
 
   if (is_child_property (p->spec))
     {
       GtkWidget *widget = GTK_WIDGET (p->obj);
       GtkWidget *parent = gtk_widget_get_parent (widget);
 
-      gtk_container_child_set (GTK_CONTAINER (parent),
-			       widget, p->spec->name, &color, NULL);
+      gtk_container_child_set_property (GTK_CONTAINER (parent),
+			                widget, p->spec->name, &val);
     }
   else
-    g_object_set (p->obj, p->spec->name, &color, NULL);
+    g_object_set_property (p->obj, p->spec->name, &val);
+
+  g_value_unset (&val);
 }
 
 static void
@@ -729,19 +730,14 @@ color_changed (GObject *object, GParamSpec *pspec, gpointer data)
 {
   GtkColorButton *cb = GTK_COLOR_BUTTON (data);
   GValue val = G_VALUE_INIT;
-  GdkColor *color;
-  GdkColor cb_color;
 
   g_value_init (&val, GDK_TYPE_COLOR);
   get_property_value (object, pspec, &val);
 
-  color = g_value_get_boxed (&val);
-  gtk_color_button_get_color (cb, &cb_color);
-
-  if (color != NULL && !gdk_color_equal (color, &cb_color))
+  if (g_value_get_boxed (&val))
     {
       block_controller (G_OBJECT (cb));
-      gtk_color_button_set_color (cb, color);
+      g_object_set_property (G_OBJECT (cb), "color", &val);
       unblock_controller (G_OBJECT (cb));
     }
 
@@ -1015,7 +1011,7 @@ property_widget (GObject    *object,
            G_PARAM_SPEC_VALUE_TYPE (spec) == GDK_TYPE_RGBA)
     {
       prop_edit = gtk_color_button_new ();
-      gtk_color_button_set_use_alpha (GTK_COLOR_BUTTON (prop_edit), TRUE);
+      gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (prop_edit), TRUE);
 
       g_object_connect_property (object, spec,
                                  G_CALLBACK (rgba_changed),
diff --git a/src/prop-editor.h b/src/prop-editor.h
index 9d1ced2..37ec75e 100644
--- a/src/prop-editor.h
+++ b/src/prop-editor.h
@@ -12,9 +12,7 @@
  * Library General Public License for more details.
  *
  * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <gtk/gtk.h>



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