settings: Add the :long-press-duration

A property to control the minimum time that has to elapse before a press
is recognized as a long press. This will be used by ClutterClickAction,
but it can be shared across touch-based gestures.
This commit is contained in:
Emmanuele Bassi 2011-06-09 14:33:17 +01:00
parent 2b81d90dd7
commit 93207d08f8

View File

@ -59,6 +59,8 @@ struct _ClutterSettings
gint xft_antialias;
gchar *xft_hint_style;
gchar *xft_rgba;
gint long_press_duration;
};
struct _ClutterSettingsClass
@ -85,6 +87,8 @@ enum
PROP_FONT_HINT_STYLE,
PROP_FONT_RGBA,
PROP_LONG_PRESS_DURATION,
PROP_LAST
};
@ -251,6 +255,10 @@ clutter_settings_set_property (GObject *gobject,
settings_update_font_options (self);
break;
case PROP_LONG_PRESS_DURATION:
self->long_press_duration = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
@ -303,6 +311,10 @@ clutter_settings_get_property (GObject *gobject,
g_value_set_string (value, self->xft_rgba);
break;
case PROP_LONG_PRESS_DURATION:
g_value_set_int (value, self->long_press_duration);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
@ -494,6 +506,24 @@ clutter_settings_class_init (ClutterSettingsClass *klass)
NULL,
CLUTTER_PARAM_READWRITE);
/**
* ClutterSettings:long-press-duration:
*
* Sets the minimum duration for a press to be recognized as a long press
* gesture. The duration is expressed in milliseconds.
*
* See also #ClutterClickAction:long-press-duration.
*
* Since: 1.8
*/
obj_props[PROP_LONG_PRESS_DURATION] =
g_param_spec_int ("long-press-duration",
P_("Long Press Duration"),
P_("The minimum duration for a long press gesture to be recognized"),
0, G_MAXINT,
500,
CLUTTER_PARAM_READWRITE);
gobject_class->set_property = clutter_settings_set_property;
gobject_class->get_property = clutter_settings_get_property;
gobject_class->notify = clutter_settings_notify;
@ -517,6 +547,8 @@ clutter_settings_init (ClutterSettings *self)
self->xft_hinting = -1;
self->xft_hint_style = NULL;
self->xft_rgba = NULL;
self->long_press_duration = 500;
}
/**