[gimp/gimp-2-10] app: add gimp_gtk_adjustment_chain()



commit a974e71702d1e68b3134ee8d2f4acff6e4034f27
Author: Ell <ell_se yahoo com>
Date:   Mon Jun 1 23:21:21 2020 +0300

    app: add gimp_gtk_adjustment_chain()
    
    ... which takes a pair of GtkAdjustments, and binds the value of
    the first to the lower-limit of the second, and the value of the
    second to the upper-limit of the first.
    
    (cherry picked from commit 45e5c2231afb48376a1bbc37bed78ab41dad8afb)

 app/widgets/gimpwidgets-utils.c | 15 +++++++++++++++
 app/widgets/gimpwidgets-utils.h |  3 +++
 2 files changed, 18 insertions(+)
---
diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c
index 6b9de67680..b6750bf6a8 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -1668,6 +1668,21 @@ gimp_gtk_container_clear (GtkContainer *container)
                          container);
 }
 
+void
+gimp_gtk_adjustment_chain (GtkAdjustment *adjustment1,
+                           GtkAdjustment *adjustment2)
+{
+  g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment1));
+  g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment2));
+
+  g_object_bind_property (adjustment1, "value",
+                          adjustment2, "lower",
+                          G_BINDING_SYNC_CREATE);
+  g_object_bind_property (adjustment2, "value",
+                          adjustment1, "upper",
+                          G_BINDING_SYNC_CREATE);
+}
+
 static gboolean
 gimp_print_event_free (gpointer data)
 {
diff --git a/app/widgets/gimpwidgets-utils.h b/app/widgets/gimpwidgets-utils.h
index dfdca55001..d1709ab362 100644
--- a/app/widgets/gimpwidgets-utils.h
+++ b/app/widgets/gimpwidgets-utils.h
@@ -117,6 +117,9 @@ void              gimp_widget_set_fully_opaque     (GtkWidget            *widget
 
 void              gimp_gtk_container_clear         (GtkContainer         *container);
 
+void              gimp_gtk_adjustment_chain        (GtkAdjustment        *adjustment1,
+                                                    GtkAdjustment        *adjustment2);
+
 const gchar     * gimp_print_event                 (const GdkEvent       *event);
 
 gboolean          gimp_color_profile_store_add_defaults


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