eog r5014 - in trunk: . src



Author: friemann
Date: Thu Feb 19 12:45:53 2009
New Revision: 5014
URL: http://svn.gnome.org/viewvc/eog?rev=5014&view=rev

Log:
2009-02-19  Felix Riemann  <friemann svn gnome org>

	* src/eog-thumb-view.c: (eog_thumb_view_init):
	* src/eog-window.c: (eog_window_drag_data_received),
	(eog_window_set_drag_dest):
	Simplify drag targets handling. Use functions from latest gtk+
	if available. Fixes bug #558086 (Christian Persch).


Modified:
   trunk/ChangeLog
   trunk/src/eog-thumb-view.c
   trunk/src/eog-window.c

Modified: trunk/src/eog-thumb-view.c
==============================================================================
--- trunk/src/eog-thumb-view.c	(original)
+++ trunk/src/eog-thumb-view.c	Thu Feb 19 12:45:53 2009
@@ -60,11 +60,6 @@
 
 /* Drag 'n Drop */
 
-static GtkTargetEntry target_table[] = {
-	{ "text/uri-list", 0, 0},
-};
-
-
 static void
 eog_thumb_view_finalize (GObject *object)
 {
@@ -503,6 +498,12 @@
 static void
 eog_thumb_view_init (EogThumbView *thumbview)
 {
+#if !GTK_CHECK_VERSION (2, 15, 0)
+	const GtkTargetEntry target_table[] = {
+		{"text/uri-list", 0, 0 }
+	};
+#endif
+
 	thumbview->priv = EOG_THUMB_VIEW_GET_PRIVATE (thumbview);
 
 	thumbview->priv->pixbuf_cell = eog_pixbuf_cell_renderer_new ();
@@ -547,9 +548,16 @@
 	g_signal_connect (G_OBJECT (thumbview), "parent-set",
 			  G_CALLBACK (thumbview_on_parent_set_cb), NULL);
 
+#if GTK_CHECK_VERSION (2, 15, 0)
+	gtk_icon_view_enable_model_drag_source (GTK_ICON_VIEW (thumbview), 0,
+						NULL, 0,
+						GDK_ACTION_COPY);
+	gtk_drag_source_add_uri_targets (GTK_WIDGET (thumbview));
+#else
 	gtk_icon_view_enable_model_drag_source (GTK_ICON_VIEW (thumbview), 0,
 						target_table, G_N_ELEMENTS (target_table),
 						GDK_ACTION_COPY);
+#endif /* GTK >= 2.15.0 */
 
 	g_signal_connect (G_OBJECT (thumbview), "drag-data-get",
 			  G_CALLBACK (thumbview_on_drag_data_get_cb), NULL);

Modified: trunk/src/eog-window.c
==============================================================================
--- trunk/src/eog-window.c	(original)
+++ trunk/src/eog-window.c	Thu Feb 19 12:45:53 2009
@@ -114,11 +114,6 @@
 
 static gint signals[SIGNAL_LAST];
 
-/* Drag target types */
-enum {
-	EOG_WINDOW_TARGET_URI_LIST
-};
-
 /* GConfNotifications */
 enum {
 	EOG_WINDOW_NOTIFY_INTERPOLATE,
@@ -3787,7 +3782,7 @@
         GSList *file_list;
         EogWindow *window;
 
-        if (info != EOG_WINDOW_TARGET_URI_LIST)
+        if (!gtk_targets_include_uri (&selection_data->target, 1))
                 return;
 
         if (context->suggested_action == GDK_ACTION_COPY) {
@@ -3802,15 +3797,11 @@
 static void
 eog_window_set_drag_dest (EogWindow *window)
 {
-        static const GtkTargetEntry drag_types[] = {
-                {"text/uri-list", 0, EOG_WINDOW_TARGET_URI_LIST}
-        };
-
         gtk_drag_dest_set (GTK_WIDGET (window),
                            GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
-                           drag_types,
-                           sizeof (drag_types) / sizeof (drag_types[0]),
+                           NULL, 0,
                            GDK_ACTION_COPY | GDK_ACTION_ASK);
+	gtk_drag_dest_add_uri_targets (GTK_WIDGET (window));
 }
 
 static void



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