mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-17 14:30:15 +00:00
gesture single: Convert to g_object_notify_by_pspec
This avoids pspec lookup overhead in g_object_notify.
This commit is contained in:
parent
89ca0db7c5
commit
3077a7e025
@ -58,11 +58,13 @@ struct _GtkGestureSinglePrivate
|
|||||||
enum {
|
enum {
|
||||||
PROP_TOUCH_ONLY = 1,
|
PROP_TOUCH_ONLY = 1,
|
||||||
PROP_EXCLUSIVE,
|
PROP_EXCLUSIVE,
|
||||||
PROP_BUTTON
|
PROP_BUTTON,
|
||||||
|
LAST_PROP
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkGestureSingle, gtk_gesture_single,
|
static GParamSpec *properties[LAST_PROP] = { NULL, };
|
||||||
GTK_TYPE_GESTURE)
|
|
||||||
|
G_DEFINE_TYPE_WITH_PRIVATE (GtkGestureSingle, gtk_gesture_single, GTK_TYPE_GESTURE)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_gesture_single_get_property (GObject *object,
|
gtk_gesture_single_get_property (GObject *object,
|
||||||
@ -254,14 +256,12 @@ gtk_gesture_single_class_init (GtkGestureSingleClass *klass)
|
|||||||
*
|
*
|
||||||
* Since: 3.14
|
* Since: 3.14
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (object_class,
|
properties[PROP_TOUCH_ONLY] =
|
||||||
PROP_TOUCH_ONLY,
|
g_param_spec_boolean ("touch-only",
|
||||||
g_param_spec_boolean ("touch-only",
|
P_("Handle only touch events"),
|
||||||
P_("Handle only touch events"),
|
P_("Whether the gesture handles only touch events"),
|
||||||
P_("Whether the gesture handles"
|
FALSE,
|
||||||
" only touch events"),
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||||
FALSE,
|
|
||||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkGestureSingle:exclusive:
|
* GtkGestureSingle:exclusive:
|
||||||
@ -271,13 +271,12 @@ gtk_gesture_single_class_init (GtkGestureSingleClass *klass)
|
|||||||
*
|
*
|
||||||
* Since: 3.14
|
* Since: 3.14
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (object_class,
|
properties[PROP_EXCLUSIVE] =
|
||||||
PROP_EXCLUSIVE,
|
g_param_spec_boolean ("exclusive",
|
||||||
g_param_spec_boolean ("exclusive",
|
P_("Whether the gesture is exclusive"),
|
||||||
P_("Whether the gesture is exclusive"),
|
P_("Whether the gesture is exclusive"),
|
||||||
P_("Whether the gesture is exclusive"),
|
FALSE,
|
||||||
FALSE,
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkGestureSingle:button:
|
* GtkGestureSingle:button:
|
||||||
@ -286,13 +285,15 @@ gtk_gesture_single_class_init (GtkGestureSingleClass *klass)
|
|||||||
*
|
*
|
||||||
* Since: 3.14
|
* Since: 3.14
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (object_class,
|
properties[PROP_BUTTON] =
|
||||||
PROP_BUTTON,
|
g_param_spec_uint ("button",
|
||||||
g_param_spec_uint ("button",
|
P_("Button number"),
|
||||||
P_("Button number"),
|
P_("Button number to listen to"),
|
||||||
P_("Button number to listen to"),
|
0, G_MAXUINT,
|
||||||
0, G_MAXUINT, GDK_BUTTON_PRIMARY,
|
GDK_BUTTON_PRIMARY,
|
||||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||||
|
|
||||||
|
g_object_class_install_properties (object_class, LAST_PROP, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -371,7 +372,7 @@ gtk_gesture_single_set_touch_only (GtkGestureSingle *gesture,
|
|||||||
|
|
||||||
priv->touch_only = touch_only;
|
priv->touch_only = touch_only;
|
||||||
_gtk_gesture_single_update_evmask (gesture);
|
_gtk_gesture_single_update_evmask (gesture);
|
||||||
g_object_notify (G_OBJECT (gesture), "touch-only");
|
g_object_notify_by_pspec (G_OBJECT (gesture), properties[PROP_TOUCH_ONLY]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -425,7 +426,7 @@ gtk_gesture_single_set_exclusive (GtkGestureSingle *gesture,
|
|||||||
|
|
||||||
priv->exclusive = exclusive;
|
priv->exclusive = exclusive;
|
||||||
_gtk_gesture_single_update_evmask (gesture);
|
_gtk_gesture_single_update_evmask (gesture);
|
||||||
g_object_notify (G_OBJECT (gesture), "exclusive");
|
g_object_notify_by_pspec (G_OBJECT (gesture), properties[PROP_EXCLUSIVE]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -476,7 +477,7 @@ gtk_gesture_single_set_button (GtkGestureSingle *gesture,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
priv->button = button;
|
priv->button = button;
|
||||||
g_object_notify (G_OBJECT (gesture), "button");
|
g_object_notify_by_pspec (G_OBJECT (gesture), properties[PROP_BUTTON]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user