[nautilus/remove-emblems-splitted: 13/23] Remove code to handle emblems in DnD.



commit d58d42c261db94bf0d538698939698f2aeb63d1d
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sun Jul 25 12:04:13 2010 +0200

    Remove code to handle emblems in DnD.

 libnautilus-private/nautilus-dnd.h                 |    2 -
 libnautilus-private/nautilus-file-dnd.c            |   30 ----------
 libnautilus-private/nautilus-file-dnd.h            |    2 -
 libnautilus-private/nautilus-icon-dnd.c            |   57 +-------------------
 libnautilus-private/nautilus-tree-view-drag-dest.c |   38 -------------
 5 files changed, 1 insertions(+), 128 deletions(-)
---
diff --git a/libnautilus-private/nautilus-dnd.h b/libnautilus-private/nautilus-dnd.h
index 8060166..abb5e32 100644
--- a/libnautilus-private/nautilus-dnd.h
+++ b/libnautilus-private/nautilus-dnd.h
@@ -36,7 +36,6 @@
 #define NAUTILUS_ICON_DND_NETSCAPE_URL_TYPE	"_NETSCAPE_URL"
 #define NAUTILUS_ICON_DND_COLOR_TYPE		"application/x-color"
 #define NAUTILUS_ICON_DND_BGIMAGE_TYPE		"property/bgimage"
-#define NAUTILUS_ICON_DND_KEYWORD_TYPE		"property/keyword"
 #define NAUTILUS_ICON_DND_ROOTWINDOW_DROP_TYPE	"application/x-rootwindow-drop"
 #define NAUTILUS_ICON_DND_XDNDDIRECTSAVE_TYPE	"XdndDirectSave0" /* XDS Protocol Type */
 #define NAUTILUS_ICON_DND_RAW_TYPE	"application/octet-stream"
@@ -56,7 +55,6 @@ typedef enum {
 	NAUTILUS_ICON_DND_NETSCAPE_URL,
 	NAUTILUS_ICON_DND_COLOR,
 	NAUTILUS_ICON_DND_BGIMAGE,
-	NAUTILUS_ICON_DND_KEYWORD,
 	NAUTILUS_ICON_DND_TEXT,
 	NAUTILUS_ICON_DND_XDNDDIRECTSAVE,
 	NAUTILUS_ICON_DND_RAW,
diff --git a/libnautilus-private/nautilus-file-dnd.c b/libnautilus-private/nautilus-file-dnd.c
index 7dd5ba2..2f2ce88 100644
--- a/libnautilus-private/nautilus-file-dnd.c
+++ b/libnautilus-private/nautilus-file-dnd.c
@@ -125,9 +125,6 @@ nautilus_drag_can_accept_info (NautilusFile *drop_target_item,
 		case NAUTILUS_ICON_DND_RAW:
 			return nautilus_drag_can_accept_files (drop_target_item); /* Check if we can accept files at this location */
 
-		case NAUTILUS_ICON_DND_KEYWORD:
-			return TRUE;
-
 		case NAUTILUS_ICON_DND_ROOTWINDOW_DROP:
 			return FALSE;
 
@@ -142,30 +139,3 @@ nautilus_drag_can_accept_info (NautilusFile *drop_target_item,
 	}
 }
 
-void
-nautilus_drag_file_receive_dropped_keyword (NautilusFile *file,
-					    const char *keyword)
-{
-	GList *keywords, *word;
-
-	g_return_if_fail (NAUTILUS_IS_FILE (file));
-	g_return_if_fail (keyword != NULL);
-
-	/* special case the erase emblem */
-	if (strcmp (keyword, NAUTILUS_FILE_DND_ERASE_KEYWORD) == 0) {
-		keywords = NULL;
-	} else {
-		keywords = nautilus_file_get_keywords (file);
-		word = g_list_find_custom (keywords, keyword, (GCompareFunc) strcmp);
-		if (word == NULL) {
-			keywords = g_list_prepend (keywords, g_strdup (keyword));
-		} else {
-			keywords = g_list_remove_link (keywords, word);
-			g_free (word->data);
-			g_list_free_1 (word);
-		}
-	}
-
-	nautilus_file_set_keywords (file, keywords);
-	eel_g_list_free_deep (keywords);
-}
diff --git a/libnautilus-private/nautilus-file-dnd.h b/libnautilus-private/nautilus-file-dnd.h
index 4167927..41e2ba8 100644
--- a/libnautilus-private/nautilus-file-dnd.h
+++ b/libnautilus-private/nautilus-file-dnd.h
@@ -37,8 +37,6 @@ gboolean nautilus_drag_can_accept_items             (NautilusFile *drop_target_i
 gboolean nautilus_drag_can_accept_info              (NautilusFile *drop_target_item,
 						     NautilusIconDndTargetType drag_type,
 						     const GList *items);
-void     nautilus_drag_file_receive_dropped_keyword (NautilusFile *file,
-						     const char   *keyword);
 
 #endif /* NAUTILUS_FILE_DND_H */
 
diff --git a/libnautilus-private/nautilus-icon-dnd.c b/libnautilus-private/nautilus-icon-dnd.c
index 4a672e9..13f2b0b 100644
--- a/libnautilus-private/nautilus-icon-dnd.c
+++ b/libnautilus-private/nautilus-icon-dnd.c
@@ -72,7 +72,6 @@ static const GtkTargetEntry drop_types [] = {
 	{ NAUTILUS_ICON_DND_URI_LIST_TYPE, 0, NAUTILUS_ICON_DND_URI_LIST },
 	{ NAUTILUS_ICON_DND_COLOR_TYPE, 0, NAUTILUS_ICON_DND_COLOR },
 	{ NAUTILUS_ICON_DND_BGIMAGE_TYPE, 0, NAUTILUS_ICON_DND_BGIMAGE },
-	{ NAUTILUS_ICON_DND_KEYWORD_TYPE, 0, NAUTILUS_ICON_DND_KEYWORD },
 	{ NAUTILUS_ICON_DND_XDNDDIRECTSAVE_TYPE, 0, NAUTILUS_ICON_DND_XDNDDIRECTSAVE }, /* XDS Protocol Type */
 	{ NAUTILUS_ICON_DND_RAW_TYPE, 0, NAUTILUS_ICON_DND_RAW },
 	/* Must be last: */
@@ -671,47 +670,6 @@ receive_dropped_tile_image (NautilusIconContainer *container, GdkDragAction acti
 	}
 }
 
-/* handle dropped keywords */
-static void
-receive_dropped_keyword (NautilusIconContainer *container, const char *keyword, int x, int y)
-{
-	char *uri;
-	double world_x, world_y;
-
-	NautilusIcon *drop_target_icon;
-	NautilusFile *file;
-	
-	g_assert (keyword != NULL);
-
-	/* find the item we hit with our drop, if any */
-	canvas_widget_to_world (EEL_CANVAS (container), x, y, &world_x, &world_y);
-	drop_target_icon = nautilus_icon_container_item_at (container, world_x, world_y);
-	if (drop_target_icon == NULL) {
-		return;
-	}
-
-	/* FIXME bugzilla.gnome.org 42485: 
-	 * This does not belong in the icon code.
-	 * It has to be in the file manager.
-	 * The icon code has no right to deal with the file directly.
-	 * But luckily there's no issue of not getting a file object,
-	 * so we don't have to worry about async. issues here.
-	 */
-	uri = nautilus_icon_container_get_icon_uri (container, drop_target_icon);
-
-	nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_USER,
-			    "dropped emblem '%s' on icon container URI: %s",
-			    keyword, uri);
-
-	file = nautilus_file_get_by_uri (uri);
-	g_free (uri);
-	
-	nautilus_drag_file_receive_dropped_keyword (file, keyword);
-
-	nautilus_file_unref (file);
-	nautilus_icon_container_update_icon (container, drop_target_icon);
-}
-
 /* handle dropped url */
 static void
 receive_dropped_netscape_url (NautilusIconContainer *container, const char *encoded_url, GdkDragContext *context, int x, int y)
@@ -1315,13 +1273,6 @@ nautilus_icon_container_get_drop_action (NautilusIconContainer *container,
 		g_free (drop_target);
 		break;
 
-	/* handle emblems by setting the action if we're over an object */
-	case NAUTILUS_ICON_DND_KEYWORD:
-		if (icon != NULL) {
-			*action = gdk_drag_context_get_suggested_action (context);
-		}
-		break;
-
 	case NAUTILUS_ICON_DND_NETSCAPE_URL:
 		*action = nautilus_drag_default_drop_action_for_netscape_url (context);
 		break;
@@ -1384,7 +1335,7 @@ nautilus_icon_dnd_update_drop_target (NautilusIconContainer *container,
 	 */
 
 	/* Find if target icon accepts our drop. */
-	if (icon != NULL && (container->details->dnd_info->drag_info.data_type != NAUTILUS_ICON_DND_KEYWORD)) {
+	if (icon != NULL) {
 		    uri = nautilus_icon_container_get_icon_uri (container, icon);
 		    file = nautilus_file_get_by_uri (uri);
 		    g_free (uri);
@@ -1746,7 +1697,6 @@ drag_data_received_callback (GtkWidget *widget,
 		break;
 	case NAUTILUS_ICON_DND_COLOR:
 	case NAUTILUS_ICON_DND_BGIMAGE:	
-	case NAUTILUS_ICON_DND_KEYWORD:
 	case NAUTILUS_ICON_DND_URI_LIST:
 	case NAUTILUS_ICON_DND_TEXT:
 	case NAUTILUS_ICON_DND_XDNDDIRECTSAVE:
@@ -1795,11 +1745,6 @@ drag_data_received_callback (GtkWidget *widget,
 				 gdk_drag_context_get_selected_action (context),
 				 data);
 			break;
-		case NAUTILUS_ICON_DND_KEYWORD:
-			receive_dropped_keyword
-				(NAUTILUS_ICON_CONTAINER (widget),
-				 (char *) gtk_selection_data_get_data (data), x, y);
-			break;
 		case NAUTILUS_ICON_DND_NETSCAPE_URL:
 			receive_dropped_netscape_url
 				(NAUTILUS_ICON_CONTAINER (widget),
diff --git a/libnautilus-private/nautilus-tree-view-drag-dest.c b/libnautilus-private/nautilus-tree-view-drag-dest.c
index 70e88b6..c211067 100644
--- a/libnautilus-private/nautilus-tree-view-drag-dest.c
+++ b/libnautilus-private/nautilus-tree-view-drag-dest.c
@@ -88,7 +88,6 @@ static const GtkTargetEntry drag_types [] = {
 	/* prefer "_NETSCAPE_URL" over "text/uri-list" to satisfy web browsers. */
 	{ NAUTILUS_ICON_DND_NETSCAPE_URL_TYPE, 0, NAUTILUS_ICON_DND_NETSCAPE_URL },
 	{ NAUTILUS_ICON_DND_URI_LIST_TYPE, 0, NAUTILUS_ICON_DND_URI_LIST },
-	{ NAUTILUS_ICON_DND_KEYWORD_TYPE, 0, NAUTILUS_ICON_DND_KEYWORD },
 	{ NAUTILUS_ICON_DND_XDNDDIRECTSAVE_TYPE, 0, NAUTILUS_ICON_DND_XDNDDIRECTSAVE }, /* XDS Protocol Type */
 	{ NAUTILUS_ICON_DND_RAW_TYPE, 0, NAUTILUS_ICON_DND_RAW }
 };
@@ -437,13 +436,6 @@ get_drop_action (NautilusTreeViewDragDest *dest,
 	case NAUTILUS_ICON_DND_XDNDDIRECTSAVE:
 		return GDK_ACTION_COPY;
 
-	case NAUTILUS_ICON_DND_KEYWORD:
-
-		if (!path) {
-			return 0;
-		}
-
-		return GDK_ACTION_COPY;
 	}
 
 	return 0;
@@ -751,32 +743,6 @@ receive_dropped_netscape_url (NautilusTreeViewDragDest *dest,
 	g_free (drop_target);
 }
 
-static void
-receive_dropped_keyword (NautilusTreeViewDragDest *dest,
-			 GdkDragContext *context,
-			 int x, int y)
-{
-	char *drop_target_uri;
-	NautilusFile *drop_target_file;
-
-	if (!dest->details->drag_data) {
-		return;
-	}
-
-	drop_target_uri = get_drop_target_uri_at_pos (dest, x, y);
-	g_assert (drop_target_uri != NULL);
-
-	drop_target_file = nautilus_file_get_by_uri (drop_target_uri);
-
-	if (drop_target_file != NULL) {
-		nautilus_drag_file_receive_dropped_keyword (drop_target_file,
-							    (char *) gtk_selection_data_get_data (dest->details->drag_data));
-		nautilus_file_unref (drop_target_file);
-	}
-
-	g_free (drop_target_uri);
-}
-
 static gboolean
 receive_xds (NautilusTreeViewDragDest *dest,
 	     GtkWidget *widget,
@@ -870,10 +836,6 @@ drag_data_received_callback (GtkWidget *widget,
 			receive_dropped_raw (dest, tmp, length, context, x, y);
 			success = TRUE;
 			break;
-		case NAUTILUS_ICON_DND_KEYWORD:
-			receive_dropped_keyword (dest, context, x, y);
-			success = TRUE;
-			break;
 		case NAUTILUS_ICON_DND_XDNDDIRECTSAVE:
 			finished = receive_xds (dest, widget, time, context, x, y);
 			success = TRUE;



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