[nautilus] dnd: remove "Set as Background" action on drop
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] dnd: remove "Set as Background" action on drop
- Date: Mon, 17 Feb 2014 22:52:51 +0000 (UTC)
commit dfdacd786329201fe3ea936c9ddc67cb3c87c07e
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Feb 17 14:52:08 2014 -0800
dnd: remove "Set as Background" action on drop
We already have a context menu action these days.
https://bugzilla.gnome.org/show_bug.cgi?id=698585
libnautilus-private/nautilus-canvas-dnd.c | 83 +----------------------------
libnautilus-private/nautilus-dnd.c | 5 --
libnautilus-private/nautilus-dnd.h | 7 ---
3 files changed, 1 insertions(+), 94 deletions(-)
---
diff --git a/libnautilus-private/nautilus-canvas-dnd.c b/libnautilus-private/nautilus-canvas-dnd.c
index 0670438..3fd46e7 100644
--- a/libnautilus-private/nautilus-canvas-dnd.c
+++ b/libnautilus-private/nautilus-canvas-dnd.c
@@ -51,9 +51,6 @@
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#define GNOME_DESKTOP_USE_UNSTABLE_API
-#include <libgnome-desktop/gnome-bg.h>
-#include <gdesktop-enums.h>
#include <libnautilus-private/nautilus-file-utilities.h>
#include <libnautilus-private/nautilus-file-changes-queue.h>
@@ -1011,79 +1008,16 @@ nautilus_canvas_container_find_drop_target (NautilusCanvasContainer *container,
return nautilus_canvas_container_get_icon_drop_target_uri (container, drop_target_icon);
}
-static gboolean
-selection_is_image_file (GList *selection_list)
-{
- const char *mime_type;
- NautilusDragSelectionItem *selected_item;
- gboolean result;
- GFile *location;
- GFileInfo *info;
-
- /* Make sure only one item is selected */
- if (selection_list == NULL ||
- selection_list->next != NULL) {
- return FALSE;
- }
-
- selected_item = selection_list->data;
-
- mime_type = NULL;
-
- location = g_file_new_for_uri (selected_item->uri);
- info = g_file_query_info (location,
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
- 0, NULL, NULL);
- if (info) {
- mime_type = g_file_info_get_content_type (info);
- }
-
- result = g_str_has_prefix (mime_type, "image/");
-
- if (info) {
- g_object_unref (info);
- }
- g_object_unref (location);
-
- return result;
-}
-
-static void
-receive_dropped_background_image (const gchar *image_uri)
-{
- GnomeBG *bg;
- char *filename;
-
- if (image_uri != NULL) {
- filename = g_filename_from_uri (image_uri, NULL, NULL);
- } else {
- filename = NULL;
- }
-
- bg = gnome_bg_new ();
-
- /* Currently, we only support tiled images. So we set the placement.
- */
- gnome_bg_set_placement (bg, G_DESKTOP_BACKGROUND_STYLE_WALLPAPER);
- gnome_bg_set_filename (bg, filename);
-
- gnome_bg_save_to_preferences (bg, gnome_background_preferences);
-
- g_free (filename);
- g_object_unref (bg);
-}
-
static void
nautilus_canvas_container_receive_dropped_icons (NautilusCanvasContainer *container,
GdkDragContext *context,
int x, int y)
{
- char *drop_target, *container_uri;
+ char *drop_target;
gboolean local_move_only;
double world_x, world_y;
gboolean icon_hit;
GdkDragAction action, real_action;
- NautilusDragSelectionItem *selected_item;
drop_target = NULL;
@@ -1101,26 +1035,11 @@ nautilus_canvas_container_receive_dropped_icons (NautilusCanvasContainer *contai
action = GDK_ACTION_MOVE;
} else {
action = GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK;
- container_uri = get_container_uri (container);
-
- if (eel_uri_is_desktop (container_uri) &&
- selection_is_image_file (container->details->dnd_info->drag_info.selection_list))
{
- action |= NAUTILUS_DND_ACTION_SET_AS_BACKGROUND;
- }
-
- g_free (container_uri);
}
real_action = nautilus_drag_drop_action_ask
(GTK_WIDGET (container), action);
}
- if (real_action == (GdkDragAction) NAUTILUS_DND_ACTION_SET_AS_BACKGROUND) {
- selected_item = container->details->dnd_info->drag_info.selection_list->data;
- receive_dropped_background_image (selected_item->uri);
-
- return;
- }
-
if (real_action > 0) {
eel_canvas_window_to_world (EEL_CANVAS (container),
x + gtk_adjustment_get_value (gtk_scrollable_get_hadjustment
(GTK_SCROLLABLE (container))),
diff --git a/libnautilus-private/nautilus-dnd.c b/libnautilus-private/nautilus-dnd.c
index 3ff9844..9ad7c8c 100644
--- a/libnautilus-private/nautilus-dnd.c
+++ b/libnautilus-private/nautilus-dnd.c
@@ -785,11 +785,6 @@ nautilus_drag_drop_action_ask (GtkWidget *widget,
(actions & GDK_ACTION_LINK) != 0,
&damd);
- append_drop_action_menu_item (menu, _("Set as _Background"),
- NAUTILUS_DND_ACTION_SET_AS_BACKGROUND,
- (actions & NAUTILUS_DND_ACTION_SET_AS_BACKGROUND) != 0,
- &damd);
-
eel_gtk_menu_append_separator (GTK_MENU (menu));
menu_item = gtk_menu_item_new_with_mnemonic (_("Cancel"));
diff --git a/libnautilus-private/nautilus-dnd.h b/libnautilus-private/nautilus-dnd.h
index d3e7924..0657aa1 100644
--- a/libnautilus-private/nautilus-dnd.h
+++ b/libnautilus-private/nautilus-dnd.h
@@ -58,13 +58,6 @@ typedef enum {
NAUTILUS_ICON_DND_ROOTWINDOW_DROP
} NautilusIconDndTargetType;
-typedef enum {
- NAUTILUS_DND_ACTION_FIRST = GDK_ACTION_ASK << 1,
- NAUTILUS_DND_ACTION_SET_AS_BACKGROUND = NAUTILUS_DND_ACTION_FIRST << 0,
- NAUTILUS_DND_ACTION_SET_AS_FOLDER_BACKGROUND = NAUTILUS_DND_ACTION_FIRST << 1,
- NAUTILUS_DND_ACTION_SET_AS_GLOBAL_BACKGROUND = NAUTILUS_DND_ACTION_FIRST << 2
-} NautilusDndAction;
-
/* drag&drop-related information. */
typedef struct {
GtkTargetList *target_list;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]