[goobox] fixed skipping to a specific position
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goobox] fixed skipping to a specific position
- Date: Sun, 3 Jun 2012 19:51:42 +0000 (UTC)
commit 31dbbae872b850314be6eecf16c82c81174d4c38
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Jun 3 14:03:45 2012 +0200
fixed skipping to a specific position
src/goo-player-info.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/goo-player-info.c b/src/goo-player-info.c
index 38a5055..58aff8b 100644
--- a/src/goo-player-info.c
+++ b/src/goo-player-info.c
@@ -261,6 +261,16 @@ time_scale_button_press_cb (GtkRange *range,
GdkEventButton *event,
GooPlayerInfo *info)
{
+ /* In an audio player when clicking on the progress bar the user expect
+ * to jump to the specified position directly instead of scrolling one
+ * page up or down as happens by default in Gtk+. The button 2
+ * behavior is what we want by default for button 1. */
+
+ if (event->button == 1)
+ event->button = 2;
+ else if (event->button == 2)
+ event->button = 1;
+
info->priv->dragging = TRUE;
info->priv->update_id = g_timeout_add (UPDATE_TIMEOUT,
update_time_label_cb,
@@ -274,12 +284,22 @@ time_scale_button_release_cb (GtkRange *range,
GdkEventButton *event,
GooPlayerInfo *info)
{
+ /* Swap button 1 and 2 behaviors, see time_scale_button_press_cb
+ * for an explanation. */
+
+ if (event->button == 1)
+ event->button = 2;
+ else if (event->button == 2)
+ event->button = 1;
+
if (info->priv->update_id != 0) {
g_source_remove (info->priv->update_id);
info->priv->update_id = 0;
}
info->priv->dragging = FALSE;
+ g_signal_emit_by_name (range, "value-changed");
+
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]