[gtk/ebassi/activate-signal] Move activate_signal to the widget private class data
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/ebassi/activate-signal] Move activate_signal to the widget private class data
- Date: Sun, 6 Dec 2020 15:15:08 +0000 (UTC)
commit c352fe9ab02c0bb8caa40069fcd3a1c02887bc1f
Author: Emmanuele Bassi <ebassi gnome org>
Date: Sun Dec 6 15:06:18 2020 +0000
Move activate_signal to the widget private class data
Instead of having it as a field in the class structure.
gtk/gtkwidget.c | 12 ++++++------
gtk/gtkwidget.h | 5 -----
gtk/gtkwidgetprivate.h | 1 +
3 files changed, 7 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index a9a46c3a1e..61f1fabe3e 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -885,7 +885,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
gobject_class->set_property = gtk_widget_set_property;
gobject_class->get_property = gtk_widget_get_property;
- klass->activate_signal = 0;
klass->show = gtk_widget_real_show;
klass->hide = gtk_widget_real_hide;
klass->map = gtk_widget_real_map;
@@ -4310,7 +4309,7 @@ gtk_widget_can_activate (GtkWidget *self)
GtkWidgetClass *widget_class = GTK_WIDGET_GET_CLASS (self);
- if (widget_class->activate_signal != 0)
+ if (widget_class->priv->activate_signal != 0)
return TRUE;
return FALSE;
@@ -4597,7 +4596,7 @@ gtk_widget_class_get_activate_signal (GtkWidgetClass *widget_class)
{
g_return_val_if_fail (GTK_IS_WIDGET_CLASS (widget_class), 0);
- return widget_class->activate_signal;
+ return widget_class->priv->activate_signal;
}
/**
@@ -4619,7 +4618,7 @@ gtk_widget_class_set_activate_signal (GtkWidgetClass *widget_class,
g_return_if_fail (GTK_IS_WIDGET_CLASS (widget_class));
g_return_if_fail (signal_id != 0);
- widget_class->activate_signal = signal_id;
+ widget_class->priv->activate_signal = signal_id;
}
/**
@@ -4652,7 +4651,7 @@ gtk_widget_class_set_activate_signal_from_name (GtkWidgetClass *widget_class,
return;
}
- widget_class->activate_signal = signal_id;
+ widget_class->priv->activate_signal = signal_id;
}
/**
@@ -4673,8 +4672,9 @@ gtk_widget_activate (GtkWidget *widget)
if (gtk_widget_can_activate (widget))
{
+ GtkWidgetClass *widget_class = GTK_WIDGET_GET_CLASS (widget);
/* FIXME: we should eventually check the signals signature here */
- g_signal_emit (widget, GTK_WIDGET_GET_CLASS (widget)->activate_signal, 0);
+ g_signal_emit (widget, widget_class->priv->activate_signal, 0);
return TRUE;
}
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 63ffca12b8..765cb207c3 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -120,9 +120,6 @@ struct _GtkWidget
* element in the widget class structure in order for the class mechanism
* to work correctly. This allows a GtkWidgetClass pointer to be cast to
* a GObjectClass pointer.
- * @activate_signal: The signal to emit when a widget of this class is
- * activated, gtk_widget_activate() handles the emission.
- * Implementation of this signal is optional.
* @show: Signal emitted when widget is shown
* @hide: Signal emitted when widget is hidden.
* @map: Signal emitted when widget is going to be mapped, that is
@@ -194,8 +191,6 @@ struct _GtkWidgetClass
/*< public >*/
- guint activate_signal;
-
/* basics */
void (* show) (GtkWidget *widget);
void (* hide) (GtkWidget *widget);
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index 00424ff446..c024c6adf1 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -215,6 +215,7 @@ struct _GtkWidgetClassPrivate
GType layout_manager_type;
GtkWidgetAction *actions;
GtkAccessibleRole accessible_role;
+ guint activate_signal;
};
void gtk_widget_root (GtkWidget *widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]