[gtk+/multitouch: 30/48] gtksettings: Set animation for press-and-hold through GtkStyleProvider
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/multitouch: 30/48] gtksettings: Set animation for press-and-hold through GtkStyleProvider
- Date: Wed, 2 Nov 2011 13:23:54 +0000 (UTC)
commit 49096f4f930d77a2b2f4178ea0e24ca699c7a4d8
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Nov 1 02:48:40 2011 +0100
gtksettings: Set animation for press-and-hold through GtkStyleProvider
The "gtk-press-and-hold-timeout" setting has also been added, to control
its duration.
gtk/gtksettings.c | 29 ++++++++++++++++++++++++++---
1 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index 4b8dd32..2eb22b8 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -33,6 +33,7 @@
#include "gtkprivate.h"
#include "gtkcssproviderprivate.h"
#include "gtksymboliccolor.h"
+#include "gtkanimationdescription.h"
#include "gtktypebuiltins.h"
#include "gtkversion.h"
@@ -90,9 +91,10 @@
*/
-#define DEFAULT_TIMEOUT_INITIAL 200
-#define DEFAULT_TIMEOUT_REPEAT 20
-#define DEFAULT_TIMEOUT_EXPAND 500
+#define DEFAULT_TIMEOUT_INITIAL 200
+#define DEFAULT_TIMEOUT_REPEAT 20
+#define DEFAULT_TIMEOUT_EXPAND 500
+#define DEFAULT_TIMEOUT_PRESS_AND_HOLD 800
typedef struct _GtkSettingsPropertyValue GtkSettingsPropertyValue;
typedef struct _GtkSettingsValuePrivate GtkSettingsValuePrivate;
@@ -1328,6 +1330,27 @@ gtk_settings_get_style (GtkStyleProvider *provider,
settings = GTK_SETTINGS (provider);
props = gtk_style_properties_new ();
+ /* Set animation for press and hold */
+ if (gtk_widget_path_iter_has_class (path, 0, GTK_STYLE_CLASS_PRESS_AND_HOLD))
+ {
+ GtkAnimationDescription *anim_desc;
+ gint duration;
+
+ g_object_get (settings,
+ "gtk-press-and-hold-timeout", &duration,
+ NULL);
+
+ anim_desc = _gtk_animation_description_new (duration,
+ GTK_TIMELINE_PROGRESS_LINEAR,
+ FALSE);
+ gtk_style_properties_set (props,
+ GTK_STATE_FLAG_ACTIVE,
+ "transition", anim_desc,
+ NULL);
+
+ _gtk_animation_description_unref (anim_desc);
+ }
+
g_object_get (settings,
"gtk-font-name", &font_name,
"gtk-color-scheme", &color_scheme,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]