[gimp/gimp-2-10] libgimpwidgets: add GimpChainButton::active property



commit b869f1bf5ae8c8ee28f0eb29da1631b9fbe8374b
Author: Ell <ell_se yahoo com>
Date:   Mon Feb 4 12:52:49 2019 -0500

    libgimpwidgets: add GimpChainButton::active property
    
    ... which corresponds to the button's toggle state.
    
    (cherry picked from commit 9c3f150e25e8150862b1e63e82209ebaf73bb439)

 libgimpwidgets/gimpchainbutton.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)
---
diff --git a/libgimpwidgets/gimpchainbutton.c b/libgimpwidgets/gimpchainbutton.c
index 773b51484d..5d42b63a61 100644
--- a/libgimpwidgets/gimpchainbutton.c
+++ b/libgimpwidgets/gimpchainbutton.c
@@ -55,7 +55,8 @@ enum
 {
   PROP_0,
   PROP_POSITION,
-  PROP_ICON_SIZE
+  PROP_ICON_SIZE,
+  PROP_ACTIVE
 };
 
 enum
@@ -148,6 +149,21 @@ gimp_chain_button_class_init (GimpChainButtonClass *klass)
                                                       GTK_ICON_SIZE_BUTTON,
                                                       G_PARAM_CONSTRUCT |
                                                       GIMP_PARAM_READWRITE));
+
+  /**
+   * GimpChainButton:active:
+   *
+   * The toggled state of the chain button.
+   *
+   * Since: 2.10.10
+   */
+  g_object_class_install_property (object_class, PROP_ACTIVE,
+                                   g_param_spec_boolean ("active",
+                                                         "Active",
+                                                         "The chain's toggled state",
+                                                         FALSE,
+                                                         G_PARAM_CONSTRUCT |
+                                                         GIMP_PARAM_READWRITE));
 }
 
 static void
@@ -223,6 +239,10 @@ gimp_chain_button_set_property (GObject      *object,
       g_object_set_property (G_OBJECT (button->image), "icon-size", value);
       break;
 
+    case PROP_ACTIVE:
+      gimp_chain_button_set_active (button, g_value_get_boolean (value));
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -247,6 +267,10 @@ gimp_chain_button_get_property (GObject    *object,
       g_object_get_property (G_OBJECT (button->image), "icon-size", value);
       break;
 
+    case PROP_ACTIVE:
+      g_value_set_boolean (value, gimp_chain_button_get_active (button));
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -342,6 +366,8 @@ gimp_chain_button_set_active (GimpChainButton  *button,
       button->active = active ? TRUE : FALSE;
 
       gimp_chain_button_update_image (button);
+
+      g_object_notify (G_OBJECT (button), "active");
     }
 }
 


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