[Xfce4-commits] [xfce/xfdesktop] 01/01: Add a move to trash menu option (Bug 10980)
noreply at xfce.org
noreply at xfce.org
Sun Jul 27 22:16:27 CEST 2014
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository xfce/xfdesktop.
commit 6b8e12f8eaa5832918a088fc2a59184ce3fa974f
Author: Eric Koegel <eric.koegel at gmail.com>
Date: Sun Jul 27 23:11:31 2014 +0300
Add a move to trash menu option (Bug 10980)
This adds a "move to trash" menu option to better match Thunar's
menu. Since there's a trash option now, the delete option always
deletes the file.
---
src/xfdesktop-file-icon-manager.c | 33 ++++++++++++++++++++++++++-------
1 file changed, 26 insertions(+), 7 deletions(-)
diff --git a/src/xfdesktop-file-icon-manager.c b/src/xfdesktop-file-icon-manager.c
index 9f50632..147c8a7 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -927,17 +927,21 @@ xfdesktop_file_icon_menu_copy(GtkWidget *widget,
}
static void
+xfdesktop_file_icon_menu_trash(GtkWidget *widget,
+ gpointer user_data)
+{
+ XfdesktopFileIconManager *fmanager = XFDESKTOP_FILE_ICON_MANAGER(user_data);
+
+ xfdesktop_file_icon_manager_delete_selected(fmanager, FALSE);
+}
+
+static void
xfdesktop_file_icon_menu_delete(GtkWidget *widget,
gpointer user_data)
{
XfdesktopFileIconManager *fmanager = XFDESKTOP_FILE_ICON_MANAGER(user_data);
- GdkModifierType state;
- gboolean force_delete = FALSE;
-
- if(gtk_get_current_event_state(&state) && state & GDK_SHIFT_MASK)
- force_delete = TRUE;
-
- xfdesktop_file_icon_manager_delete_selected(fmanager, force_delete);
+
+ xfdesktop_file_icon_manager_delete_selected(fmanager, TRUE);
}
static void
@@ -1631,6 +1635,21 @@ xfdesktop_file_icon_manager_populate_context_menu(XfceDesktop *desktop,
} else
gtk_widget_set_sensitive(mi, FALSE);
+ /* Trash */
+ mi = gtk_image_menu_item_new_with_mnemonic(_("Mo_ve to Trash"));
+ /* Add the trashcan image */
+ img = gtk_image_new_from_icon_name("user-trash", GTK_ICON_SIZE_MENU);
+ gtk_widget_show(img);
+ gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(mi), img);
+ gtk_widget_show(mi);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
+ if(multi_sel || xfdesktop_file_icon_can_delete_file(file_icon)) {
+ g_signal_connect(G_OBJECT(mi), "activate",
+ G_CALLBACK(xfdesktop_file_icon_menu_trash),
+ fmanager);
+ } else
+ gtk_widget_set_sensitive(mi, FALSE);
+
/* Delete */
mi = gtk_image_menu_item_new_from_stock(GTK_STOCK_DELETE, NULL);
gtk_widget_show(mi);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list