Use function setter for WidgetClass.activate_signal

This commit is contained in:
Emmanuele Bassi 2020-12-04 23:12:20 +00:00
parent e5e18ddffb
commit 213024a560
8 changed files with 17 additions and 12 deletions

View File

@ -282,9 +282,10 @@ gtk_button_class_init (GtkButtonClass *klass)
NULL, NULL, NULL, NULL,
NULL, NULL,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
widget_class->activate_signal = button_signals[ACTIVATE];
activate_action = gtk_signal_action_new ("activate");
gtk_widget_class_set_activate_signal (widget_class, button_signals[ACTIVATE]);
activate_action = gtk_signal_action_new ("activate");
for (guint i = 0; i < G_N_ELEMENTS (activate_keyvals); i++) for (guint i = 0; i < G_N_ELEMENTS (activate_keyvals); i++)
{ {
GtkShortcut *activate_shortcut = gtk_shortcut_new (gtk_keyval_trigger_new (activate_keyvals[i], 0), GtkShortcut *activate_shortcut = gtk_shortcut_new (gtk_keyval_trigger_new (activate_keyvals[i], 0),

View File

@ -292,6 +292,7 @@ gtk_expander_class_init (GtkExpanderClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
guint activate_signal;
gobject_class->dispose = gtk_expander_dispose; gobject_class->dispose = gtk_expander_dispose;
gobject_class->set_property = gtk_expander_set_property; gobject_class->set_property = gtk_expander_set_property;
@ -368,7 +369,7 @@ gtk_expander_class_init (GtkExpanderClass *klass)
GTK_TYPE_WIDGET, GTK_TYPE_WIDGET,
GTK_PARAM_READWRITE)); GTK_PARAM_READWRITE));
widget_class->activate_signal = activate_signal =
g_signal_new (I_("activate"), g_signal_new (I_("activate"),
G_TYPE_FROM_CLASS (gobject_class), G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
@ -377,6 +378,7 @@ gtk_expander_class_init (GtkExpanderClass *klass)
NULL, NULL,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
gtk_widget_class_set_activate_signal (widget_class, activate_signal);
gtk_widget_class_set_css_name (widget_class, I_("expander-widget")); gtk_widget_class_set_css_name (widget_class, I_("expander-widget"));
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_BUTTON); gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_BUTTON);
} }

View File

@ -547,11 +547,11 @@ gtk_flow_box_child_class_init (GtkFlowBoxChildClass *class)
NULL, NULL, NULL, NULL,
NULL, NULL,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
widget_class->activate_signal = child_signals[CHILD_ACTIVATE];
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
gtk_widget_class_set_css_name (widget_class, I_("flowboxchild")); gtk_widget_class_set_css_name (widget_class, I_("flowboxchild"));
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_GRID_CELL); gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_GRID_CELL);
gtk_widget_class_set_activate_signal (widget_class, child_signals[CHILD_ACTIVATE]);
} }
static void static void
@ -3837,7 +3837,7 @@ gtk_flow_box_class_init (GtkFlowBoxClass *class)
NULL, NULL,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
widget_class->activate_signal = signals[ACTIVATE_CURSOR_CHILD]; gtk_widget_class_set_activate_signal (widget_class, signals[ACTIVATE_CURSOR_CHILD]);
gtk_flow_box_add_move_binding (widget_class, GDK_KEY_Home, 0, gtk_flow_box_add_move_binding (widget_class, GDK_KEY_Home, 0,
GTK_MOVEMENT_BUFFER_ENDS, -1); GTK_MOVEMENT_BUFFER_ENDS, -1);

View File

@ -637,7 +637,7 @@ gtk_list_box_class_init (GtkListBoxClass *klass)
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
_gtk_marshal_VOID__ENUM_INT_BOOLEAN_BOOLEANv); _gtk_marshal_VOID__ENUM_INT_BOOLEAN_BOOLEANv);
widget_class->activate_signal = signals[ACTIVATE_CURSOR_ROW]; gtk_widget_class_set_activate_signal (widget_class, signals[ACTIVATE_CURSOR_ROW]);
gtk_list_box_add_move_binding (widget_class, GDK_KEY_Home, 0, gtk_list_box_add_move_binding (widget_class, GDK_KEY_Home, 0,
GTK_MOVEMENT_BUFFER_ENDS, -1); GTK_MOVEMENT_BUFFER_ENDS, -1);
@ -3466,7 +3466,7 @@ gtk_list_box_row_class_init (GtkListBoxRowClass *klass)
NULL, NULL,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
widget_class->activate_signal = row_signals[ROW__ACTIVATE]; gtk_widget_class_set_activate_signal (widget_class, row_signals[ROW__ACTIVATE]);
/** /**
* GtkListBoxRow:activatable: * GtkListBoxRow:activatable:

View File

@ -263,7 +263,7 @@ gtk_list_item_widget_class_init (GtkListItemWidgetClass *klass)
NULL, NULL,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
widget_class->activate_signal = signals[ACTIVATE_SIGNAL]; gtk_widget_class_set_activate_signal (widget_class, signals[ACTIVATE_SIGNAL]);
/** /**
* GtkListItem|listitem.select: * GtkListItem|listitem.select:

View File

@ -1295,8 +1295,7 @@ gtk_model_button_class_init (GtkModelButtonClass *class)
NULL, NULL,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
widget_class->activate_signal = signals[SIGNAL_CLICKED]; gtk_widget_class_set_activate_signal (widget_class, signals[SIGNAL_CLICKED]);
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT);
gtk_widget_class_set_css_name (widget_class, I_("modelbutton")); gtk_widget_class_set_css_name (widget_class, I_("modelbutton"));
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_MENU_ITEM); gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_MENU_ITEM);

View File

@ -354,6 +354,7 @@ gtk_popover_menu_bar_item_class_init (GtkPopoverMenuBarItemClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
guint activate_signal;
object_class->dispose = gtk_popover_menu_bar_item_dispose; object_class->dispose = gtk_popover_menu_bar_item_dispose;
object_class->finalize = gtk_popover_menu_bar_item_finalize; object_class->finalize = gtk_popover_menu_bar_item_finalize;
@ -364,7 +365,7 @@ gtk_popover_menu_bar_item_class_init (GtkPopoverMenuBarItemClass *klass)
klass->activate = gtk_popover_menu_bar_item_activate; klass->activate = gtk_popover_menu_bar_item_activate;
widget_class->activate_signal = activate_signal =
g_signal_new (I_("activate"), g_signal_new (I_("activate"),
G_OBJECT_CLASS_TYPE (object_class), G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
@ -375,6 +376,7 @@ gtk_popover_menu_bar_item_class_init (GtkPopoverMenuBarItemClass *klass)
gtk_widget_class_set_css_name (widget_class, I_("item")); gtk_widget_class_set_css_name (widget_class, I_("item"));
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_MENU_ITEM); gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_MENU_ITEM);
gtk_widget_class_set_activate_signal (widget_class, activate_signal);
} }
enum enum
{ {

View File

@ -570,7 +570,8 @@ gtk_switch_class_init (GtkSwitchClass *klass)
NULL, NULL, NULL, NULL,
NULL, NULL,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
widget_class->activate_signal = signals[ACTIVATE];
gtk_widget_class_set_activate_signal (widget_class, signals[ACTIVATE]);
/** /**
* GtkSwitch::state-set: * GtkSwitch::state-set: