mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-18 09:00:34 +00:00
Bug 602099 - Actions can be activatable too
Add a couple type checks in gtk_activatable_do_set_related_action() to allow both GtkWidgets and GtkActions to implement GtkActivatable. Bug 602099 describes a use case for this. Also add a GObject prerequisite to the GtkActivatable interface.
This commit is contained in:
parent
182108c68e
commit
e8ed566898
@ -276,13 +276,16 @@ gtk_activatable_get_type (void)
|
||||
{
|
||||
static GType activatable_type = 0;
|
||||
|
||||
if (!activatable_type)
|
||||
if (!activatable_type) {
|
||||
activatable_type =
|
||||
g_type_register_static_simple (G_TYPE_INTERFACE, I_("GtkActivatable"),
|
||||
sizeof (GtkActivatableIface),
|
||||
(GClassInitFunc) gtk_activatable_class_init,
|
||||
0, NULL, 0);
|
||||
|
||||
g_type_interface_add_prerequisite (activatable_type, G_TYPE_OBJECT);
|
||||
}
|
||||
|
||||
return activatable_type;
|
||||
}
|
||||
|
||||
@ -445,6 +448,8 @@ gtk_activatable_do_set_related_action (GtkActivatable *activatable,
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (prev_action, gtk_activatable_action_notify, activatable);
|
||||
|
||||
/* Check the type so that actions can be activatable too. */
|
||||
if (GTK_IS_WIDGET (activatable))
|
||||
_gtk_action_remove_from_proxy_list (prev_action, GTK_WIDGET (activatable));
|
||||
|
||||
/* Some apps are using the object data directly...
|
||||
@ -477,6 +482,7 @@ gtk_activatable_do_set_related_action (GtkActivatable *activatable,
|
||||
|
||||
g_signal_connect (G_OBJECT (action), "notify", G_CALLBACK (gtk_activatable_action_notify), activatable);
|
||||
|
||||
if (GTK_IS_WIDGET (activatable))
|
||||
_gtk_action_add_to_proxy_list (action, GTK_WIDGET (activatable));
|
||||
|
||||
g_object_set_data (G_OBJECT (activatable), "gtk-action", action);
|
||||
|
Loading…
Reference in New Issue
Block a user