[totem/gnome-2-26] Bug 578249 – Don't restart video when drag and dropping on itself
- From: Robin Stocker <robinst src gnome org>
- To: svn-commits-list gnome org
- Subject: [totem/gnome-2-26] Bug 578249 – Don't restart video when drag and dropping on itself
- Date: Fri, 17 Jul 2009 08:17:20 +0000 (UTC)
commit b78077b7c4ef446fa632291914f58dfd4e4cc7e1
Author: Robin Stocker <robin nibor org>
Date: Thu Jul 16 17:26:25 2009 +0200
Bug 578249 â?? Don't restart video when drag and dropping on itself
2009-07-16 Robin Stocker <robin nibor org>
* src/totem-object.c (drop_video_cb, drag_video_cb):
* src/totem-private.h (TotemObject): When dragging the video and
then accidentally dropping it again on itself, ignore it instead
of restarting the video. (Closes: #578249)
ChangeLog | 7 +++++++
src/totem-object.c | 25 +++++++++++++++++++------
src/totem-private.h | 4 ++++
3 files changed, 30 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0235fc9..d3fc846 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-07-16 Robin Stocker <robin nibor org>
+
+ * src/totem-object.c (drop_video_cb, drag_video_cb):
+ * src/totem-private.h (TotemObject): When dragging the video and
+ then accidentally dropping it again on itself, ignore it instead
+ of restarting the video. (Closes: #578249)
+
2009-05-13 Bastien Nocera <hadess hadess net>
* src/totem-uri.c (totem_uri_get_cached_subtitle_for_uri):
diff --git a/src/totem-object.c b/src/totem-object.c
index 2252871..551bae8 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -2162,16 +2162,27 @@ drop_video_cb (GtkWidget *widget,
{
gboolean empty_pl;
- if (context->suggested_action == GDK_ACTION_ASK)
+ if (context->suggested_action == GDK_ACTION_ASK) {
context->action = totem_drag_ask (totem_get_playlist_length (totem) > 0);
+ }
- if (context->action != GDK_ACTION_DEFAULT) {
- empty_pl = (context->action == GDK_ACTION_MOVE);
- totem_action_drop_files (totem, data, info, empty_pl);
- gtk_drag_finish (context, TRUE, FALSE, time);
+ /* User selected cancel */
+ if (context->action == GDK_ACTION_DEFAULT) {
+ gtk_drag_finish (context, FALSE, FALSE, time);
return;
}
- gtk_drag_finish (context, FALSE, FALSE, time);
+
+ /* Drop of video on itself */
+ if (context->source_window == totem->video_drag_source_window &&
+ context->action == GDK_ACTION_MOVE) {
+ gtk_drag_finish (context, FALSE, FALSE, time);
+ return;
+ }
+
+ empty_pl = (context->action == GDK_ACTION_MOVE);
+ totem_action_drop_files (totem, data, info, empty_pl);
+ gtk_drag_finish (context, TRUE, FALSE, time);
+ return;
}
static void
@@ -2266,6 +2277,8 @@ drag_video_cb (GtkWidget *widget,
gtk_selection_data_set (selection_data, selection_data->target,
8, (guchar *) text, len);
+ totem->video_drag_source_window = context->source_window;
+
g_free (text);
}
diff --git a/src/totem-private.h b/src/totem-private.h
index 45c0f5a..38f25d8 100644
--- a/src/totem-private.h
+++ b/src/totem-private.h
@@ -160,6 +160,10 @@ struct TotemObject {
BaconMessageConnection *conn;
TotemStates state;
TotemOpenLocation *open_location;
+
+ /* Stored source_window of GdkDragContext from a video drag,
+ * used to detect when the video is dropped on itself. */
+ GdkWindow *video_drag_source_window;
};
GtkWidget *totem_volume_create (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]