diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c index 3f313c77..284569a3 100644 --- a/thunar/thunar-standard-view.c +++ b/thunar/thunar-standard-view.c @@ -2535,13 +2535,23 @@ static void thunar_standard_view_action_cut (GtkAction *action, ThunarStandardView *standard_view) { + GtkWidget *window; + GtkWidget *widget; + G_GNUC_BEGIN_IGNORE_DEPRECATIONS _thunar_return_if_fail (GTK_IS_ACTION (action)); G_GNUC_END_IGNORE_DEPRECATIONS _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view)); _thunar_return_if_fail (THUNAR_IS_CLIPBOARD_MANAGER (standard_view->clipboard)); - thunar_clipboard_manager_cut_files (standard_view->clipboard, standard_view->priv->selected_files); + window = gtk_widget_get_toplevel (GTK_WIDGET (standard_view)); + widget = gtk_window_get_focus (GTK_WINDOW (window)); + + /* check if focused widget is the location entry */ + if (GTK_IS_ENTRY (widget)) + g_signal_emit_by_name (widget, "cut-clipboard", NULL); + else + thunar_clipboard_manager_cut_files (standard_view->clipboard, standard_view->priv->selected_files); } @@ -2550,13 +2560,23 @@ static void thunar_standard_view_action_copy (GtkAction *action, ThunarStandardView *standard_view) { + GtkWidget *window; + GtkWidget *widget; + G_GNUC_BEGIN_IGNORE_DEPRECATIONS _thunar_return_if_fail (GTK_IS_ACTION (action)); G_GNUC_END_IGNORE_DEPRECATIONS _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view)); _thunar_return_if_fail (THUNAR_IS_CLIPBOARD_MANAGER (standard_view->clipboard)); - thunar_clipboard_manager_copy_files (standard_view->clipboard, standard_view->priv->selected_files); + window = gtk_widget_get_toplevel (GTK_WIDGET (standard_view)); + widget = gtk_window_get_focus (GTK_WINDOW (window)); + + /* check if focused widget is the location entry */ + if (GTK_IS_ENTRY (widget)) + g_signal_emit_by_name (widget, "copy-clipboard", NULL); + else + thunar_clipboard_manager_copy_files (standard_view->clipboard, standard_view->priv->selected_files); } @@ -2565,6 +2585,8 @@ static void thunar_standard_view_action_paste (GtkAction *action, ThunarStandardView *standard_view) { + GtkWidget *window; + GtkWidget *widget; ThunarFile *current_directory; G_GNUC_BEGIN_IGNORE_DEPRECATIONS @@ -2572,11 +2594,20 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS G_GNUC_END_IGNORE_DEPRECATIONS _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view)); - current_directory = thunar_navigator_get_current_directory (THUNAR_NAVIGATOR (standard_view)); - if (G_LIKELY (current_directory != NULL)) + window = gtk_widget_get_toplevel (GTK_WIDGET (standard_view)); + widget = gtk_window_get_focus (GTK_WINDOW (window)); + + /* check if focused widget is the location entry */ + if (GTK_IS_ENTRY (widget)) + g_signal_emit_by_name (widget, "paste-clipboard", NULL); + else { - thunar_clipboard_manager_paste_files (standard_view->clipboard, thunar_file_get_file (current_directory), - GTK_WIDGET (standard_view), thunar_standard_view_new_files_closure (standard_view, NULL)); + current_directory = thunar_navigator_get_current_directory (THUNAR_NAVIGATOR (standard_view)); + if (G_LIKELY (current_directory != NULL)) + { + thunar_clipboard_manager_paste_files (standard_view->clipboard, thunar_file_get_file (current_directory), + GTK_WIDGET (standard_view), thunar_standard_view_new_files_closure (standard_view, NULL)); + } } }