[gthumb/ext] [gstreamer] do not change value after a button release if playing



commit c08cbe4ae3a4f43df9b12cda83e8fb5463312351
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Wed Dec 16 00:08:10 2009 +0100

    [gstreamer] do not change value after a button release if playing

 extensions/gstreamer/data/ui/mediabar.ui     |    4 ++-
 extensions/gstreamer/gth-media-viewer-page.c |   34 ++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletions(-)
---
diff --git a/extensions/gstreamer/data/ui/mediabar.ui b/extensions/gstreamer/data/ui/mediabar.ui
index 406561b..eab29ed 100644
--- a/extensions/gstreamer/data/ui/mediabar.ui
+++ b/extensions/gstreamer/data/ui/mediabar.ui
@@ -219,10 +219,12 @@
   <object class="GtkAdjustment" id="adjustment_position">
     <property name="upper">100</property>
     <property name="step_increment">1</property>
+    <property name="page_increment">1</property>
+    <property name="page_size">10</property>
   </object>
   <object class="GtkAdjustment" id="adjustment_volume">
-    <property name="value">100</property>
     <property name="upper">100</property>
+    <property name="value">100</property>
     <property name="step_increment">1</property>
   </object>
 </interface>
diff --git a/extensions/gstreamer/gth-media-viewer-page.c b/extensions/gstreamer/gth-media-viewer-page.c
index 1f19174..bd3d9de 100644
--- a/extensions/gstreamer/gth-media-viewer-page.c
+++ b/extensions/gstreamer/gth-media-viewer-page.c
@@ -61,6 +61,7 @@ struct _GthMediaViewerPagePrivate {
 	gboolean        xwin_assigned;
 	GdkPixbuf      *icon;
 	PangoLayout    *caption_layout;
+	gboolean        block_next_jump;
 };
 
 
@@ -340,6 +341,37 @@ hscale_volume_format_value_cb (GtkScale *scale,
 }
 
 
+static gboolean
+hscale_position_change_value_cb (GtkRange      *range,
+				 GtkScrollType  scroll,
+				 gdouble        value,
+				 gpointer       user_data)
+{
+	GthMediaViewerPage *self = user_data;
+
+	if (self->priv->block_next_jump && (scroll == GTK_SCROLL_JUMP)) {
+		self->priv->block_next_jump = FALSE;
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+
+static gboolean
+hscale_position_button_release_event_cb (GtkWidget      *widget,
+					 GdkEventButton *event,
+					 gpointer        user_data)
+{
+	GthMediaViewerPage *self = user_data;
+
+	if (self->priv->playing)
+		self->priv->block_next_jump = TRUE;
+
+	return FALSE;
+}
+
+
 static void
 update_player_rate (GthMediaViewerPage *self)
 {
@@ -567,6 +599,8 @@ gth_media_viewer_page_real_activate (GthViewerPage *base,
 	g_signal_connect (GET_WIDGET ("adjustment_volume"), "value-changed", G_CALLBACK (volume_value_changed_cb), self);
 	g_signal_connect (GET_WIDGET ("adjustment_position"), "value-changed", G_CALLBACK (position_value_changed_cb), self);
 	g_signal_connect (GET_WIDGET ("hscale_volume"), "format-value", G_CALLBACK (hscale_volume_format_value_cb), self);
+	g_signal_connect (GET_WIDGET ("hscale_position"), "change-value", G_CALLBACK (hscale_position_change_value_cb), self);
+	g_signal_connect (GET_WIDGET ("hscale_position"), "button-release-event", G_CALLBACK (hscale_position_button_release_event_cb), self);
 	g_signal_connect (GET_WIDGET ("button_play"), "clicked", G_CALLBACK (button_play_clicked_cb), self);
 	g_signal_connect (GET_WIDGET ("togglebutton_volume"), "toggled", G_CALLBACK (togglebutton_volume_toggled_cb), self);
 	g_signal_connect (GET_WIDGET ("button_play_slower"), "clicked", G_CALLBACK (button_play_slower_clicked_cb), self);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]