2018-08-04 10:14:13 +00:00
|
|
|
/*
|
|
|
|
* Copyright © 2018 Benjamin Otte
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Authors: Benjamin Otte <otte@gnome.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "gtkshortcut.h"
|
|
|
|
|
|
|
|
#include "gtkbindingsprivate.h"
|
|
|
|
#include "gtkintl.h"
|
2020-03-15 13:49:50 +00:00
|
|
|
#include "gtkshortcuttrigger.h"
|
2018-08-04 10:14:13 +00:00
|
|
|
#include "gtkwidget.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:gtkshortcut
|
|
|
|
* @title: GtkShortcut
|
|
|
|
* @short_description: An object describing a keyboard shortcut
|
|
|
|
* @see_also: #GtkShortcutController, #GtkShortcutTrigger
|
|
|
|
*
|
|
|
|
* GtkShortcut is the low level object used for managing keyboard
|
|
|
|
* shortcuts.
|
|
|
|
*
|
|
|
|
* It contains a description of how to trigger the shortcut via a
|
|
|
|
* #GtkShortcutTrigger and a way to activate the shortcut on a widget
|
|
|
|
* with gtk_shortcut_activate().
|
|
|
|
*
|
|
|
|
* The actual work is usually done via #GtkShortcutController, which
|
|
|
|
* decides if and when to activate a shortcut. Using that controller
|
|
|
|
* directly however is rarely necessary as Various higher level
|
|
|
|
* convenience APIs exist on #GtkWidgets that make it easier to use
|
|
|
|
* shortcuts in GTK.
|
|
|
|
*
|
|
|
|
* #GtkShortcut does provide functionality to make it easy for users
|
|
|
|
* to work with shortcuts, either by providing informational strings
|
|
|
|
* for display purposes or by allowing shortcuts to be configured.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct _GtkShortcut
|
|
|
|
{
|
|
|
|
GObject parent_instance;
|
|
|
|
|
2020-03-15 13:49:50 +00:00
|
|
|
GtkShortcutTrigger *trigger;
|
2018-08-04 10:14:13 +00:00
|
|
|
char *signal;
|
2020-02-05 17:08:14 +00:00
|
|
|
char *action;
|
2018-08-08 17:10:27 +00:00
|
|
|
GtkShortcutFunc callback;
|
|
|
|
gpointer user_data;
|
|
|
|
GDestroyNotify destroy_notify;
|
2018-08-04 10:14:13 +00:00
|
|
|
GVariant *args;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_ARGUMENTS,
|
2018-08-08 17:10:27 +00:00
|
|
|
PROP_CALLBACK,
|
2018-08-04 10:14:13 +00:00
|
|
|
PROP_SIGNAL,
|
2020-02-05 17:08:14 +00:00
|
|
|
PROP_ACTION,
|
2020-03-15 13:49:50 +00:00
|
|
|
PROP_TRIGGER,
|
2018-08-04 10:14:13 +00:00
|
|
|
|
|
|
|
N_PROPS
|
|
|
|
};
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (GtkShortcut, gtk_shortcut, G_TYPE_OBJECT)
|
|
|
|
|
|
|
|
static GParamSpec *properties[N_PROPS] = { NULL, };
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_shortcut_dispose (GObject *object)
|
|
|
|
{
|
|
|
|
GtkShortcut *self = GTK_SHORTCUT (object);
|
|
|
|
|
2020-03-15 13:49:50 +00:00
|
|
|
g_clear_pointer (&self->trigger, gtk_shortcut_trigger_unref);
|
2018-08-04 10:14:13 +00:00
|
|
|
g_clear_pointer (&self->signal, g_free);
|
2020-02-05 17:08:14 +00:00
|
|
|
g_clear_pointer (&self->action, g_free);
|
2018-08-04 10:14:13 +00:00
|
|
|
g_clear_pointer (&self->args, g_variant_unref);
|
2018-08-08 17:10:27 +00:00
|
|
|
if (self->callback)
|
|
|
|
{
|
|
|
|
if (self->destroy_notify)
|
|
|
|
self->destroy_notify (self->user_data);
|
|
|
|
|
|
|
|
self->callback = NULL;
|
|
|
|
self->user_data = NULL;
|
|
|
|
self->destroy_notify = NULL;
|
|
|
|
}
|
2018-08-04 10:14:13 +00:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (gtk_shortcut_parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_shortcut_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GtkShortcut *self = GTK_SHORTCUT (object);
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_ARGUMENTS:
|
|
|
|
g_value_set_variant (value, self->args);
|
|
|
|
break;
|
|
|
|
|
2018-08-08 17:10:27 +00:00
|
|
|
case PROP_CALLBACK:
|
|
|
|
g_value_set_boolean (value, self->callback != NULL);
|
|
|
|
break;
|
|
|
|
|
2018-08-04 10:14:13 +00:00
|
|
|
case PROP_SIGNAL:
|
|
|
|
g_value_set_string (value, self->signal);
|
|
|
|
break;
|
|
|
|
|
2020-02-05 17:08:14 +00:00
|
|
|
case PROP_ACTION:
|
|
|
|
g_value_set_string (value, self->action);
|
|
|
|
break;
|
|
|
|
|
2020-03-15 13:49:50 +00:00
|
|
|
case PROP_TRIGGER:
|
|
|
|
g_value_set_boxed (value, self->trigger);
|
|
|
|
break;
|
|
|
|
|
2018-08-04 10:14:13 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_shortcut_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GtkShortcut *self = GTK_SHORTCUT (object);
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_ARGUMENTS:
|
|
|
|
gtk_shortcut_set_arguments (self, g_value_get_variant (value));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_SIGNAL:
|
|
|
|
gtk_shortcut_set_signal (self, g_value_get_string (value));
|
|
|
|
break;
|
|
|
|
|
2020-02-05 17:08:14 +00:00
|
|
|
case PROP_ACTION:
|
|
|
|
gtk_shortcut_set_action (self, g_value_get_string (value));
|
|
|
|
break;
|
|
|
|
|
2020-03-15 13:49:50 +00:00
|
|
|
case PROP_TRIGGER:
|
|
|
|
gtk_shortcut_set_trigger (self, g_value_dup_boxed (value));
|
|
|
|
break;
|
|
|
|
|
2018-08-04 10:14:13 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_shortcut_class_init (GtkShortcutClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
|
|
|
gobject_class->dispose = gtk_shortcut_dispose;
|
|
|
|
gobject_class->get_property = gtk_shortcut_get_property;
|
|
|
|
gobject_class->set_property = gtk_shortcut_set_property;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GtkShortcut:arguments:
|
|
|
|
*
|
|
|
|
* Arguments passed to activation.
|
|
|
|
*/
|
|
|
|
properties[PROP_ARGUMENTS] =
|
|
|
|
g_param_spec_variant ("arguments",
|
|
|
|
P_("Arguments"),
|
|
|
|
P_("Arguments passed to activation"),
|
|
|
|
G_VARIANT_TYPE_ANY,
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
2018-08-08 17:10:27 +00:00
|
|
|
/**
|
|
|
|
* GtkShortcut:callback:
|
|
|
|
*
|
|
|
|
* Whether a callback is used for shortcut activation
|
|
|
|
*/
|
|
|
|
properties[PROP_CALLBACK] =
|
|
|
|
g_param_spec_boolean ("callback",
|
|
|
|
P_("Callback"),
|
|
|
|
P_("Whether a callback is used for shortcut activation"),
|
|
|
|
FALSE,
|
|
|
|
G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
2018-08-04 10:14:13 +00:00
|
|
|
/**
|
|
|
|
* GtkShortcut:signal:
|
|
|
|
*
|
|
|
|
* The action signal to emit on the widget upon activation.
|
|
|
|
*/
|
|
|
|
properties[PROP_SIGNAL] =
|
|
|
|
g_param_spec_string ("signal",
|
|
|
|
P_("Signal"),
|
|
|
|
P_("The action signal to emit"),
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
2020-02-05 17:08:14 +00:00
|
|
|
/**
|
|
|
|
* GtkShortcut:action:
|
|
|
|
*
|
|
|
|
* The name of the action to activate on the widget upon activation.
|
|
|
|
*/
|
|
|
|
properties[PROP_ACTION] =
|
|
|
|
g_param_spec_string ("action",
|
|
|
|
P_("Action"),
|
|
|
|
P_("The action to activate"),
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
2018-08-04 10:14:13 +00:00
|
|
|
|
2020-03-15 13:49:50 +00:00
|
|
|
/**
|
|
|
|
* GtkShortcut:trigger:
|
|
|
|
*
|
|
|
|
* The trigger that triggers this shortcut.
|
|
|
|
*/
|
|
|
|
properties[PROP_TRIGGER] =
|
|
|
|
g_param_spec_boxed ("trigger",
|
|
|
|
P_("Trigger"),
|
|
|
|
P_("The trigger for this shortcut"),
|
|
|
|
GTK_TYPE_SHORTCUT_TRIGGER,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
2018-08-04 10:14:13 +00:00
|
|
|
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_shortcut_init (GtkShortcut *self)
|
|
|
|
{
|
2020-03-15 13:49:50 +00:00
|
|
|
self->trigger = gtk_shortcut_trigger_ref (gtk_never_trigger_get ());
|
2018-08-04 10:14:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_shortcut_new:
|
|
|
|
*
|
|
|
|
* Creates a new empty #GtkShortcut that never triggers and activates nothing.
|
|
|
|
*
|
|
|
|
* Returns: a new #GtkShortcut
|
|
|
|
**/
|
|
|
|
GtkShortcut *
|
|
|
|
gtk_shortcut_new (void)
|
|
|
|
{
|
|
|
|
return g_object_new (GTK_TYPE_SHORTCUT, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gtk_shortcut_trigger (GtkShortcut *self,
|
|
|
|
GdkEvent *event)
|
|
|
|
{
|
2020-03-15 13:49:50 +00:00
|
|
|
return gtk_shortcut_trigger_trigger (self->trigger, event);
|
2018-08-04 10:14:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gtk_shortcut_activate (GtkShortcut *self,
|
|
|
|
GtkWidget *widget)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_SHORTCUT (self), FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
|
|
|
|
|
2018-08-08 17:10:27 +00:00
|
|
|
if (self->callback)
|
|
|
|
{
|
|
|
|
return self->callback (widget, self->args, self->user_data);
|
|
|
|
}
|
|
|
|
else if (self->signal)
|
2018-08-04 10:14:13 +00:00
|
|
|
{
|
|
|
|
GError *error = NULL;
|
|
|
|
gboolean handled;
|
|
|
|
|
|
|
|
if (!gtk_binding_emit_signal (G_OBJECT (widget),
|
|
|
|
self->signal,
|
|
|
|
self->args,
|
|
|
|
&handled,
|
|
|
|
&error))
|
|
|
|
{
|
2020-03-15 13:49:50 +00:00
|
|
|
char *accelerator = gtk_shortcut_trigger_to_string (self->trigger);
|
2018-08-04 10:14:13 +00:00
|
|
|
g_warning ("gtk_shortcut_activate(): \":%s\": %s",
|
|
|
|
accelerator,
|
|
|
|
error->message);
|
|
|
|
g_clear_error (&error);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2020-02-05 17:08:14 +00:00
|
|
|
return handled;
|
|
|
|
}
|
|
|
|
else if (self->action)
|
|
|
|
{
|
|
|
|
GError *error = NULL;
|
|
|
|
gboolean handled;
|
|
|
|
|
|
|
|
if (!gtk_binding_activate_action (G_OBJECT (widget),
|
|
|
|
self->action,
|
|
|
|
self->args,
|
|
|
|
&handled,
|
|
|
|
&error))
|
|
|
|
{
|
|
|
|
char *accelerator = gtk_shortcut_trigger_to_string (self->trigger);
|
|
|
|
g_warning ("gtk_shortcut_activate(): \":%s\": %s",
|
|
|
|
accelerator,
|
|
|
|
error->message);
|
|
|
|
g_clear_error (&error);
|
|
|
|
g_free (accelerator);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2018-08-04 10:14:13 +00:00
|
|
|
return handled;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* shortcut is a dud */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-15 13:49:50 +00:00
|
|
|
/**
|
|
|
|
* gtk_shortcut_get_trigger:
|
|
|
|
* @self: a #GtkShortcut
|
|
|
|
*
|
|
|
|
* Gets the trigger used to trigger @self.
|
|
|
|
*
|
|
|
|
* Returns: (transfer none): the trigger used
|
|
|
|
**/
|
|
|
|
GtkShortcutTrigger *
|
|
|
|
gtk_shortcut_get_trigger (GtkShortcut *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_SHORTCUT (self), NULL);
|
|
|
|
|
|
|
|
return self->trigger;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_shortcut_set_trigger:
|
|
|
|
* @self: a #GtkShortcut
|
|
|
|
* @trigger: (transfer full) (nullable): The new trigger.
|
|
|
|
* If the @trigger is %NULL, the never trigger will be used.
|
|
|
|
*
|
|
|
|
* Sets the new trigger for @self to be @trigger.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_shortcut_set_trigger (GtkShortcut *self,
|
|
|
|
GtkShortcutTrigger *trigger)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_SHORTCUT (self));
|
|
|
|
|
|
|
|
if (trigger == NULL)
|
|
|
|
trigger = gtk_shortcut_trigger_ref (gtk_never_trigger_get ());
|
|
|
|
|
|
|
|
if (self->trigger == trigger)
|
|
|
|
{
|
|
|
|
gtk_shortcut_trigger_unref (trigger);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_shortcut_trigger_unref (self->trigger);
|
|
|
|
self->trigger = trigger;
|
|
|
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TRIGGER]);
|
|
|
|
}
|
|
|
|
|
2018-08-04 10:14:13 +00:00
|
|
|
GVariant *
|
|
|
|
gtk_shortcut_get_arguments (GtkShortcut *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_SHORTCUT (self), NULL);
|
|
|
|
|
|
|
|
return self->args;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_shortcut_set_arguments (GtkShortcut *self,
|
|
|
|
GVariant *args)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_SHORTCUT (self));
|
|
|
|
|
|
|
|
if (self->args == args)
|
|
|
|
return;
|
|
|
|
|
|
|
|
g_clear_pointer (&self->args, g_variant_unref);
|
|
|
|
if (args)
|
|
|
|
self->args = g_variant_ref_sink (args);
|
|
|
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ARGUMENTS]);
|
|
|
|
}
|
|
|
|
|
2018-08-08 17:10:27 +00:00
|
|
|
static void
|
|
|
|
gtk_shortcut_clear_activation (GtkShortcut *self)
|
|
|
|
{
|
|
|
|
if (self->signal)
|
|
|
|
{
|
|
|
|
g_clear_pointer (&self->signal, g_free);
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SIGNAL]);
|
|
|
|
}
|
|
|
|
|
2020-02-05 17:08:14 +00:00
|
|
|
if (self->action)
|
|
|
|
{
|
|
|
|
g_clear_pointer (&self->action, g_free);
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ACTION]);
|
|
|
|
}
|
|
|
|
|
2018-08-08 17:10:27 +00:00
|
|
|
if (self->callback)
|
|
|
|
{
|
|
|
|
if (self->destroy_notify)
|
|
|
|
self->destroy_notify (self->user_data);
|
|
|
|
|
|
|
|
self->callback = NULL;
|
|
|
|
self->user_data = NULL;
|
|
|
|
self->destroy_notify = NULL;
|
|
|
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CALLBACK]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-04 10:14:13 +00:00
|
|
|
const char *
|
|
|
|
gtk_shortcut_get_signal (GtkShortcut *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_SHORTCUT (self), NULL);
|
|
|
|
|
|
|
|
return self->signal;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_shortcut_set_signal (GtkShortcut *self,
|
|
|
|
const gchar *signal)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_SHORTCUT (self));
|
|
|
|
|
|
|
|
if (g_strcmp0 (self->signal, signal) == 0)
|
|
|
|
return;
|
|
|
|
|
2018-08-08 17:10:27 +00:00
|
|
|
g_object_freeze_notify (G_OBJECT (self));
|
|
|
|
|
|
|
|
gtk_shortcut_clear_activation (self);
|
2018-08-04 10:14:13 +00:00
|
|
|
self->signal = g_strdup (signal);
|
|
|
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SIGNAL]);
|
2018-08-08 17:10:27 +00:00
|
|
|
|
|
|
|
g_object_thaw_notify (G_OBJECT (self));
|
|
|
|
}
|
|
|
|
|
2020-02-05 17:08:14 +00:00
|
|
|
gboolean
|
|
|
|
gtk_shortcut_has_action (GtkShortcut *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_SHORTCUT (self), FALSE);
|
|
|
|
|
|
|
|
return self->action != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_shortcut_set_action (GtkShortcut *self,
|
|
|
|
const char *action)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_SHORTCUT (self));
|
|
|
|
|
|
|
|
if (g_strcmp0 (self->action, action) == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
g_object_freeze_notify (G_OBJECT (self));
|
|
|
|
|
|
|
|
gtk_shortcut_clear_activation (self);
|
|
|
|
self->action = g_strdup (action);
|
|
|
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ACTION]);
|
|
|
|
|
|
|
|
g_object_thaw_notify (G_OBJECT (self));
|
|
|
|
}
|
|
|
|
|
2018-08-08 17:10:27 +00:00
|
|
|
gboolean
|
|
|
|
gtk_shortcut_has_callback (GtkShortcut *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_SHORTCUT (self), FALSE);
|
|
|
|
|
|
|
|
return self->callback != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_shortcut_set_callback (GtkShortcut *self,
|
|
|
|
GtkShortcutFunc callback,
|
|
|
|
gpointer data,
|
|
|
|
GDestroyNotify destroy)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_SHORTCUT (self));
|
|
|
|
|
|
|
|
g_object_freeze_notify (G_OBJECT (self));
|
|
|
|
|
|
|
|
gtk_shortcut_clear_activation (self);
|
|
|
|
|
|
|
|
self->callback = callback;
|
|
|
|
self->user_data = data;
|
|
|
|
self->destroy_notify = destroy;
|
|
|
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CALLBACK]);
|
|
|
|
|
|
|
|
g_object_thaw_notify (G_OBJECT (self));
|
2018-08-04 10:14:13 +00:00
|
|
|
}
|
|
|
|
|