[gimp] app: remove ancient utility function gimp_toggle_button_set_visible()



commit 6b246ff6c2471b02a51236ce06d9bec678e12886
Author: Michael Natterer <mitch gimp org>
Date:   Sat May 21 14:28:11 2016 +0200

    app: remove ancient utility function gimp_toggle_button_set_visible()
    
    and use g_object_bind_property() instead.

 app/widgets/gimppropwidgets.c   |   20 ++++++--------------
 app/widgets/gimpwidgets-utils.c |   11 -----------
 app/widgets/gimpwidgets-utils.h |    2 --
 3 files changed, 6 insertions(+), 27 deletions(-)
---
diff --git a/app/widgets/gimppropwidgets.c b/app/widgets/gimppropwidgets.c
index 1a7710f..2da934f 100644
--- a/app/widgets/gimppropwidgets.c
+++ b/app/widgets/gimppropwidgets.c
@@ -114,7 +114,6 @@ gimp_prop_expanding_frame_new (GObject      *config,
   GParamSpec *param_spec;
   GtkWidget  *frame;
   GtkWidget  *toggle;
-  gboolean    value;
 
   param_spec = check_param_spec_w (config, property_name,
                                    G_TYPE_PARAM_BOOLEAN, G_STRFUNC);
@@ -132,16 +131,9 @@ gimp_prop_expanding_frame_new (GObject      *config,
 
   gtk_container_add (GTK_CONTAINER (frame), child);
 
-  g_object_get (config,
-                property_name, &value,
-                NULL);
-
-  if (value)
-    gtk_widget_show (child);
-
-  g_signal_connect_object (toggle, "toggled",
-                           G_CALLBACK (gimp_toggle_button_set_visible),
-                           child, 0);
+  g_object_bind_property (G_OBJECT (config), property_name,
+                          G_OBJECT (child),  "visible",
+                          G_BINDING_SYNC_CREATE);
 
   if (button)
     *button = toggle;
@@ -150,9 +142,9 @@ gimp_prop_expanding_frame_new (GObject      *config,
 }
 
 
-/****************/
-/*  paint menu  */
-/****************/
+/*********************/
+/*  paint mode menu  */
+/*********************/
 
 static void   gimp_prop_paint_menu_callback (GtkWidget   *widget,
                                              GObject     *config);
diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c
index 725ffd8..0822799 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -995,17 +995,6 @@ gimp_window_set_transient_for (GtkWindow *window,
 #endif
 }
 
-void
-gimp_toggle_button_set_visible (GtkToggleButton *toggle,
-                                GtkWidget       *widget)
-{
-  g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle));
-  g_return_if_fail (GTK_IS_WIDGET (widget));
-
-  gtk_widget_set_visible (widget,
-                          gtk_toggle_button_get_active (toggle));
-}
-
 static gboolean
 gimp_widget_accel_find_func (GtkAccelKey *key,
                              GClosure    *closure,
diff --git a/app/widgets/gimpwidgets-utils.h b/app/widgets/gimpwidgets-utils.h
index c8d9102..da30e02 100644
--- a/app/widgets/gimpwidgets-utils.h
+++ b/app/widgets/gimpwidgets-utils.h
@@ -82,8 +82,6 @@ void              gimp_window_set_hint             (GtkWindow            *window
 guint32           gimp_window_get_native_id        (GtkWindow            *window);
 void              gimp_window_set_transient_for    (GtkWindow            *window,
                                                     guint32               parent_ID);
-void              gimp_toggle_button_set_visible   (GtkToggleButton      *toggle,
-                                                    GtkWidget            *widget);
 void              gimp_widget_set_accel_help       (GtkWidget            *widget,
                                                     GtkAction            *action);
 const gchar     * gimp_get_message_icon_name       (GimpMessageSeverity   severity);


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