[gtk/activatable-buttons: 3/4] colorbutton: Make color buttons activatable again
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/activatable-buttons: 3/4] colorbutton: Make color buttons activatable again
- Date: Mon, 5 Jul 2021 14:11:32 +0000 (UTC)
commit fc65d6393a6cee305a69a0df266484872e6dca14
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Jul 5 10:10:19 2021 -0400
colorbutton: Make color buttons activatable again
The activation is simply forwarded to the toggle button
within.
gtk/gtkcolorbutton.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
---
diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c
index 90d3225351..d34e0c3cf3 100644
--- a/gtk/gtkcolorbutton.c
+++ b/gtk/gtkcolorbutton.c
@@ -91,6 +91,7 @@ struct _GtkColorButtonClass {
GtkWidgetClass parent_class;
void (* color_set) (GtkColorButton *cp);
+ void (* activate) (GtkColorButton *self);
};
/* Properties */
@@ -108,6 +109,7 @@ enum
enum
{
COLOR_SET,
+ ACTIVATE,
LAST_SIGNAL
};
@@ -137,6 +139,12 @@ G_DEFINE_TYPE_WITH_CODE (GtkColorButton, gtk_color_button, GTK_TYPE_WIDGET,
G_IMPLEMENT_INTERFACE (GTK_TYPE_COLOR_CHOOSER,
gtk_color_button_iface_init))
+static void
+gtk_color_button_activate (GtkColorButton *self)
+{
+ gtk_widget_activate (self->button);
+}
+
static void
gtk_color_button_class_init (GtkColorButtonClass *klass)
{
@@ -155,6 +163,7 @@ gtk_color_button_class_init (GtkColorButtonClass *klass)
widget_class->root = gtk_color_button_root;
klass->color_set = NULL;
+ klass->activate = gtk_color_button_activate;
g_object_class_override_property (gobject_class, PROP_RGBA, "rgba");
g_object_class_override_property (gobject_class, PROP_USE_ALPHA, "use-alpha");
@@ -194,6 +203,28 @@ gtk_color_button_class_init (GtkColorButtonClass *klass)
NULL,
G_TYPE_NONE, 0);
+ /**
+ * GtkColorButton::activate:
+ * @widget: the object which received the signal.
+ *
+ * Emitted to when the color button is activated.
+ *
+ * The `::activate` signal on `GtkMenuButton` is an action signal and
+ * emitting it causes the button to pop up its dialog.
+ *
+ * Since: 4.4
+ */
+ color_button_signals[ACTIVATE] =
+ g_signal_new (I_ ("activate"),
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GtkColorButtonClass, activate),
+ NULL, NULL,
+ NULL,
+ G_TYPE_NONE, 0);
+
+ gtk_widget_class_set_activate_signal (widget_class, color_button_signals[ACTIVATE]);
+
/**
* GtkColorButton:show-editor:
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]