g_object_ref (gtk_mnemonic_action_get ()));
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (priv->mnemonic_controller), shortcut);
gtk_widget_add_controller (GTK_WIDGET (label), priv->mnemonic_controller);
- g_object_unref (shortcut);
}
else
{
if (GTK_IS_POPOVER (gtk_widget_get_native (GTK_WIDGET (self))))
{
- GtkShortcut *shortcut;
GtkShortcutTrigger *trigger;
GtkShortcutAction *action;
{
while (g_list_model_get_n_items (G_LIST_MODEL (self->controller)) > 0)
{
- shortcut = g_list_model_get_item (G_LIST_MODEL (self->controller), 0);
+ GtkShortcut *shortcut = g_list_model_get_item (G_LIST_MODEL (self->controller), 0);
gtk_shortcut_controller_remove_shortcut (GTK_SHORTCUT_CONTROLLER (self->controller),
shortcut);
g_object_unref (shortcut);
trigger = gtk_keyval_trigger_new (key, mods);
action = gtk_signal_action_new ("clicked");
- shortcut = gtk_shortcut_new (trigger, action);
- gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (self->controller), shortcut);
- g_object_unref (shortcut);
+ gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (self->controller),
+ gtk_shortcut_new (trigger, action));
}
}
else
/**
* gtk_shortcut_controller_add_shortcut:
* @self: the controller
- * @shortcut: a #GtkShortcut
+ * @shortcut: (transfer-full): a #GtkShortcut
*
* Adds @shortcut to the list of shortcuts handled by @self.
*
g_return_if_fail (GTK_IS_SHORTCUT (shortcut));
if (!self->custom_shortcuts)
- return;
+ {
+ g_object_unref (shortcut);
+ return;
+ }
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (self));
if (widget)
update_accel (shortcut, widget, TRUE);
g_list_store_append (G_LIST_STORE (self->shortcuts), shortcut);
+ g_object_unref (shortcut);
}
/**