[gimp] libgimpwidgets: deprecate gimp_toggle_button_sensitive_update()



commit 05cd8670c37466ec71deef8d508d2cc087ed054f
Author: Michael Natterer <mitch gimp org>
Date:   Wed May 11 22:12:26 2011 +0200

    libgimpwidgets: deprecate gimp_toggle_button_sensitive_update()
    
    Use g_object_bind_property() instead.

 .../libgimpwidgets/libgimpwidgets-sections.txt     |    2 +-
 libgimpwidgets/gimpoldwidgets.c                    |    2 +
 libgimpwidgets/gimpoldwidgets.h                    |    6 +++-
 libgimpwidgets/gimpwidgets.c                       |   29 +++++++++++++-------
 libgimpwidgets/gimpwidgets.h                       |    2 -
 5 files changed, 26 insertions(+), 15 deletions(-)
---
diff --git a/devel-docs/libgimpwidgets/libgimpwidgets-sections.txt b/devel-docs/libgimpwidgets/libgimpwidgets-sections.txt
index 41bca23..b04c0e0 100644
--- a/devel-docs/libgimpwidgets/libgimpwidgets-sections.txt
+++ b/devel-docs/libgimpwidgets/libgimpwidgets-sections.txt
@@ -968,7 +968,6 @@ GIMP_RANDOM_SEED_TOGGLE
 gimp_random_seed_new
 GIMP_COORDINATES_CHAINBUTTON
 gimp_coordinates_new
-gimp_toggle_button_sensitive_update
 gimp_toggle_button_update
 gimp_radio_button_update
 gimp_int_adjustment_update
@@ -1259,6 +1258,7 @@ gimp_option_menu_set_history
 GimpOptionMenuSensitivityCallback
 gimp_option_menu_set_sensitive
 gimp_menu_item_update
+gimp_toggle_button_sensitive_update
 gimp_pixmap_button_new
 gimp_unit_menu_update
 </SECTION>
diff --git a/libgimpwidgets/gimpoldwidgets.c b/libgimpwidgets/gimpoldwidgets.c
index e30d477..849706f 100644
--- a/libgimpwidgets/gimpoldwidgets.c
+++ b/libgimpwidgets/gimpoldwidgets.c
@@ -621,6 +621,8 @@ gimp_pixmap_button_new (gchar       **xpm_data,
  *
  * See gimp_toggle_button_sensitive_update() for a description of how
  * to set up the list.
+ *
+ * Deprecated: use #GimpUnitComboBox instead.
  **/
 void
 gimp_unit_menu_update (GtkWidget *widget,
diff --git a/libgimpwidgets/gimpoldwidgets.h b/libgimpwidgets/gimpoldwidgets.h
index 24baa27..bee6df3 100644
--- a/libgimpwidgets/gimpoldwidgets.h
+++ b/libgimpwidgets/gimpoldwidgets.h
@@ -109,8 +109,10 @@ GtkWidget * gimp_pixmap_button_new   (gchar           **xpm_data,
  *  Standard Callbacks
  */
 
-void   gimp_unit_menu_update         (GtkWidget        *widget,
-                                      gpointer          data);
+void   gimp_toggle_button_sensitive_update (GtkToggleButton *toggle_button);
+
+void   gimp_unit_menu_update               (GtkWidget       *widget,
+                                            gpointer         data);
 
 
 G_END_DECLS
diff --git a/libgimpwidgets/gimpwidgets.c b/libgimpwidgets/gimpwidgets.c
index 9217a06..54ca1bf 100644
--- a/libgimpwidgets/gimpwidgets.c
+++ b/libgimpwidgets/gimpwidgets.c
@@ -32,6 +32,10 @@
 #include "libgimp/libgimp-intl.h"
 
 
+/*  hack: declare prototype here instead of #undef GIMP_DISABLE_DEPRECATED  */
+void   gimp_toggle_button_sensitive_update (GtkToggleButton *toggle_button);
+
+
 /**
  * SECTION: gimpwidgets
  * @title: GimpWidgets
@@ -548,14 +552,12 @@ gimp_random_seed_new (guint    *seed,
   g_object_set_data (G_OBJECT (hbox), "button", button);
   g_object_set_data (G_OBJECT (hbox), "toggle", toggle);
 
-  /* Set sensitivity data for the toggle, this stuff makes
-   * gimp_toggle_button_sensitive_update work
-   */
-  g_object_set_data (G_OBJECT (toggle), "inverse_sensitive", spinbutton);
-  g_object_set_data (G_OBJECT (spinbutton), "inverse_sensitive", button);
-
-  /* Initialise sensitivity */
-  gimp_toggle_button_update (toggle, random_seed);
+  g_object_bind_property (toggle,     "active",
+                          spinbutton, "sensitive",
+                          G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
+  g_object_bind_property (toggle, "active",
+                          button, "sensitive",
+                          G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
 
   return hbox;
 }
@@ -836,6 +838,9 @@ gimp_coordinates_new (GimpUnit         unit,
  * This function can also set the sensitive state according to the toggle
  * button's inverse "active" state by attaching widgets with the
  * "inverse_sensitive" key.
+ *
+ * Deprecated: use g_object_bind_property() instead of using the
+ *             "set_sensitive" and "inverse_sensitive" data pointers.
  **/
 void
 gimp_toggle_button_sensitive_update (GtkToggleButton *toggle_button)
@@ -870,7 +875,9 @@ gimp_toggle_button_sensitive_update (GtkToggleButton *toggle_button)
  * @data:   A pointer to a #gint variable which will store the value of
  *          gtk_toggle_button_get_active().
  *
- * Note that this function calls gimp_toggle_button_sensitive_update().
+ * Note that this function calls gimp_toggle_button_sensitive_update()
+ * which is a deprecated hack you shouldn't use. See that function's
+ * documentation for a proper replacement of its functionality.
  **/
 void
 gimp_toggle_button_update (GtkWidget *widget,
@@ -892,7 +899,9 @@ gimp_toggle_button_update (GtkWidget *widget,
  * @data:   A pointer to a #gint variable which will store the value of
  *          GPOINTER_TO_INT (g_object_get_data (@widget, "gimp-item-data")).
  *
- * Note that this function calls gimp_toggle_button_sensitive_update().
+ * Note that this function calls gimp_toggle_button_sensitive_update()
+ * which is a deprecated hack you shouldn't use. See that function's
+ * documentation for a proper replacement of its functionality.
  **/
 void
 gimp_radio_button_update (GtkWidget *widget,
diff --git a/libgimpwidgets/gimpwidgets.h b/libgimpwidgets/gimpwidgets.h
index bc2f892..51d5eb8 100644
--- a/libgimpwidgets/gimpwidgets.h
+++ b/libgimpwidgets/gimpwidgets.h
@@ -225,8 +225,6 @@ GtkWidget * gimp_coordinates_new   (GimpUnit            unit,
  *  Standard Callbacks
  */
 
-void gimp_toggle_button_sensitive_update (GtkToggleButton *toggle_button);
-
 void gimp_toggle_button_update           (GtkWidget       *widget,
                                           gpointer         data);
 



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