rhythmbox r6162 - in trunk: . widgets
- From: jmatthew svn gnome org
- To: svn-commits-list gnome org
- Subject: rhythmbox r6162 - in trunk: . widgets
- Date: Tue, 24 Feb 2009 12:45:20 +0000 (UTC)
Author: jmatthew
Date: Tue Feb 24 12:45:20 2009
New Revision: 6162
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=6162&view=rev
Log:
2009-02-24 Jonathan Matthew <jonathan d14n org>
patch by: Neil Loknath <neil loknath gmail com>
* widgets/rb-header.c: (rb_header_init), (slider_scroll_callback):
Handle scroll events on the slider to make the seek direction
consistent with totem. Fixes #164351.
Modified:
trunk/ChangeLog
trunk/widgets/rb-header.c
Modified: trunk/widgets/rb-header.c
==============================================================================
--- trunk/widgets/rb-header.c (original)
+++ trunk/widgets/rb-header.c Tue Feb 24 12:45:20 2009
@@ -79,6 +79,7 @@
static gboolean slider_moved_callback (GtkWidget *widget, GdkEventMotion *event, RBHeader *header);
static gboolean slider_release_callback (GtkWidget *widget, GdkEventButton *event, RBHeader *header);
static void slider_changed_callback (GtkWidget *widget, RBHeader *header);
+static gboolean slider_scroll_callback (GtkWidget *widget, GdkEventScroll *event, RBHeader *header);
static void rb_header_elapsed_changed_cb (RBShellPlayer *player, guint elapsed, RBHeader *header);
@@ -124,6 +125,9 @@
#define ARTIST_MARKUP(xARTIST) g_markup_printf_escaped (" %s <i>%s</i>", _("by"), xARTIST)
#define STREAM_MARKUP(xSTREAM) g_markup_printf_escaped (" (%s)", xSTREAM)
+#define SCROLL_UP_SEEK_OFFSET 5
+#define SCROLL_DOWN_SEEK_OFFSET -5
+
G_DEFINE_TYPE (RBHeader, rb_header, GTK_TYPE_HBOX)
static void
@@ -271,6 +275,10 @@
"value_changed",
G_CALLBACK (slider_changed_callback),
header, 0);
+ g_signal_connect_object (G_OBJECT (header->priv->scale),
+ "scroll_event",
+ G_CALLBACK (slider_scroll_callback),
+ header, 0);
gtk_scale_set_draw_value (GTK_SCALE (header->priv->scale), FALSE);
gtk_widget_set_size_request (header->priv->scale, 150, -1);
gtk_box_pack_start (GTK_BOX (header->priv->scaleline), header->priv->scale, TRUE, TRUE, 0);
@@ -730,6 +738,31 @@
}
}
+static gboolean
+slider_scroll_callback (GtkWidget *widget, GdkEventScroll *event, RBHeader *header)
+{
+ gboolean retval = TRUE;
+ gdouble adj = gtk_adjustment_get_value (header->priv->adjustment);
+
+ switch (event->direction) {
+ case GDK_SCROLL_UP:
+ rb_debug ("slider scrolling up");
+ gtk_adjustment_set_value (header->priv->adjustment, adj + SCROLL_UP_SEEK_OFFSET);
+ break;
+
+ case GDK_SCROLL_DOWN:
+ rb_debug ("slider scrolling down");
+ gtk_adjustment_set_value (header->priv->adjustment, adj + SCROLL_DOWN_SEEK_OFFSET);
+ break;
+
+ default:
+ retval = FALSE;
+ break;
+ }
+
+ return retval;
+}
+
static void
rb_header_update_elapsed (RBHeader *header)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]