diff options
Diffstat (limited to 'thunar/thunar-standard-view.c')
-rw-r--r-- | thunar/thunar-standard-view.c | 1011 |
1 files changed, 29 insertions, 982 deletions
diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c index c9f0e1b3..6538eed3 100644 --- a/thunar/thunar-standard-view.c +++ b/thunar/thunar-standard-view.c @@ -42,8 +42,8 @@ #include <thunar/thunar-gtk-extensions.h> #include <thunar/thunar-history.h> #include <thunar/thunar-icon-renderer.h> +#include <thunar/thunar-launcher.h> #include <thunar/thunar-marshal.h> -#include <thunar/thunar-menu-util.h> #include <thunar/thunar-pango-extensions.h> #include <thunar/thunar-private.h> #include <thunar/thunar-properties-dialog.h> @@ -51,7 +51,6 @@ #include <thunar/thunar-simple-job.h> #include <thunar/thunar-standard-view.h> #include <thunar/thunar-standard-view-ui.h> -#include <thunar/thunar-templates-action.h> #include <thunar/thunar-thumbnailer.h> #include <thunar/thunar-util.h> @@ -81,7 +80,6 @@ enum /* Signal identifiers */ enum { - DELETE_SELECTED_FILES, START_OPEN_LOCATION, LAST_SIGNAL, }; @@ -148,7 +146,6 @@ static void thunar_standard_view_scroll_to_file (Thu gboolean use_align, gfloat row_align, gfloat col_align); -static gboolean thunar_standard_view_delete_selected_files (ThunarStandardView *standard_view); static GdkDragAction thunar_standard_view_get_dest_actions (ThunarStandardView *standard_view, GdkDragContext *context, gint x, @@ -159,47 +156,17 @@ static ThunarFile *thunar_standard_view_get_drop_file (Thu gint x, gint y, GtkTreePath **path_return); -static void thunar_standard_view_merge_custom_actions (ThunarStandardView *standard_view); static void thunar_standard_view_update_statusbar_text (ThunarStandardView *standard_view); static void thunar_standard_view_current_directory_destroy (ThunarFile *current_directory, ThunarStandardView *standard_view); static void thunar_standard_view_current_directory_changed (ThunarFile *current_directory, ThunarStandardView *standard_view); -static void thunar_standard_view_action_create_empty_file (GtkAction *action, - ThunarStandardView *standard_view); -static void thunar_standard_view_action_create_folder (GtkAction *action, - ThunarStandardView *standard_view); -static void thunar_standard_view_action_create_template (GtkAction *action, - const ThunarFile *file, - ThunarStandardView *standard_view); -static void thunar_standard_view_action_properties (GtkAction *action, - ThunarStandardView *standard_view); -static void thunar_standard_view_action_cut (GtkAction *action, - ThunarStandardView *standard_view); -static void thunar_standard_view_action_copy (GtkAction *action, - ThunarStandardView *standard_view); -static void thunar_standard_view_action_paste (GtkAction *action, - ThunarStandardView *standard_view); -static void thunar_standard_view_action_move_to_trash (GtkAction *action, - ThunarStandardView *standard_view); -static void thunar_standard_view_action_delete (GtkAction *action, - ThunarStandardView *standard_view); -static void thunar_standard_view_action_paste_into_folder (GtkAction *action, - ThunarStandardView *standard_view); static void thunar_standard_view_action_select_all_files (GtkAction *action, ThunarStandardView *standard_view); static void thunar_standard_view_action_select_by_pattern (GtkAction *action, ThunarStandardView *standard_view); static void thunar_standard_view_action_selection_invert (GtkAction *action, ThunarStandardView *standard_view); -static void thunar_standard_view_action_duplicate (GtkAction *action, - ThunarStandardView *standard_view); -static void thunar_standard_view_action_make_link (GtkAction *action, - ThunarStandardView *standard_view); -static void thunar_standard_view_action_rename (GtkAction *action, - ThunarStandardView *standard_view); -static void thunar_standard_view_action_restore (GtkAction *action, - ThunarStandardView *standard_view); static GClosure *thunar_standard_view_new_files_closure (ThunarStandardView *standard_view, GtkWidget *source_view); static void thunar_standard_view_new_files (ThunarStandardView *standard_view, @@ -325,9 +292,6 @@ struct _ThunarStandardViewPrivate /* history of the current view */ ThunarHistory *history; - /* support for file manager extensions */ - ThunarxProviderFactory *provider_factory; - /* zoom-level support */ ThunarZoomLevel zoom_level; @@ -338,10 +302,6 @@ struct _ThunarStandardViewPrivate gchar *statusbar_text; guint statusbar_text_idle_id; - /* custom menu actions support */ - GtkActionGroup *custom_actions; - gint custom_merge_id; - /* right-click drag/popup support */ GList *drag_g_file_list; guint drag_scroll_timer_id; @@ -400,21 +360,21 @@ static const GtkActionEntry action_entries[] = { { "file-context-menu", NULL, N_ ("File Context Menu"), NULL, NULL, NULL, }, { "folder-context-menu", NULL, N_ ("Folder Context Menu"), NULL, NULL, NULL, }, - { "create-folder", "folder-new", N_ ("Create _Folder..."), "<control><shift>N", N_ ("Create an empty folder within the current folder"), G_CALLBACK (thunar_standard_view_action_create_folder), }, - { "properties", "document-properties", N_ ("_Properties..."), "<alt>Return", N_ ("View the properties of the selected file"), G_CALLBACK (thunar_standard_view_action_properties), }, - { "cut", "edit-cut", N_ ("Cu_t"), "<control>X", NULL, G_CALLBACK (thunar_standard_view_action_cut), }, - { "copy", "edit-copy", N_ ("_Copy"), "<control>C", NULL, G_CALLBACK (thunar_standard_view_action_copy), }, - { "paste", "edit-paste", N_ ("_Paste"), "<control>V", N_ ("Move or copy files previously selected by a Cut or Copy command"), G_CALLBACK (thunar_standard_view_action_paste), }, - { "move-to-trash", "user-trash", N_ ("Mo_ve to Trash"), NULL, NULL, G_CALLBACK (thunar_standard_view_action_move_to_trash), }, - { "delete", "edit-delete", N_ ("_Delete"), NULL, NULL, G_CALLBACK (thunar_standard_view_action_delete), }, - { "paste-into-folder", "edit-paste", N_ ("Paste Into Folder"), NULL, N_ ("Move or copy files previously selected by a Cut or Copy command into the selected folder"), G_CALLBACK (thunar_standard_view_action_paste_into_folder), }, - { "select-all-files", NULL, N_ ("Select _all Files"), NULL, N_ ("Select all files in this window"), G_CALLBACK (thunar_standard_view_action_select_all_files), }, - { "select-by-pattern", NULL, N_ ("Select _by Pattern..."), "<control>S", N_ ("Select all files that match a certain pattern"), G_CALLBACK (thunar_standard_view_action_select_by_pattern), }, - { "invert-selection", NULL, N_ ("_Invert Selection"), NULL, N_ ("Select all files but not those currently selected"), G_CALLBACK (thunar_standard_view_action_selection_invert), }, - { "duplicate", NULL, N_ ("Du_plicate"), NULL, NULL, G_CALLBACK (thunar_standard_view_action_duplicate), }, - { "make-link", NULL, N_ ("Ma_ke Link"), NULL, NULL, G_CALLBACK (thunar_standard_view_action_make_link), }, - { "rename", NULL, N_ ("_Rename..."), "F2", NULL, G_CALLBACK (thunar_standard_view_action_rename), }, - { "restore", NULL, N_ ("_Restore"), NULL, NULL, G_CALLBACK (thunar_standard_view_action_restore), }, + { "create-folder", "folder-new", N_ ("Create _Folder..."), "<control><shift>N", N_ ("Create an empty folder within the current folder"), G_CALLBACK (NULL), }, + { "properties", "document-properties", N_ ("_Properties..."), "<alt>Return", N_ ("View the properties of the selected file"), G_CALLBACK (NULL), }, + { "cut", "edit-cut", N_ ("Cu_t"), "<control>X", NULL, G_CALLBACK (NULL), }, + { "copy", "edit-copy", N_ ("_Copy"), "<control>C", NULL, G_CALLBACK (NULL), }, + { "paste", "edit-paste", N_ ("_Paste"), "<control>V", N_ ("Move or copy files previously selected by a Cut or Copy command"), G_CALLBACK (NULL), }, + { "move-to-trash", "user-trash", N_ ("Mo_ve to Trash"), NULL, NULL, G_CALLBACK (NULL), }, + { "delete", "edit-delete", N_ ("_Delete"), NULL, NULL, G_CALLBACK (NULL), }, + { "paste-into-folder", "edit-paste", N_ ("Paste Into Folder"), NULL, N_ ("Move or copy files previously selected by a Cut or Copy command into the selected folder"), G_CALLBACK (NULL), }, + { "select-all-files", NULL, N_ ("Select _all Files"), NULL, N_ ("Select all files in this window"), G_CALLBACK (NULL), }, + { "select-by-pattern", NULL, N_ ("Select _by Pattern..."), "<control>S", N_ ("Select all files that match a certain pattern"), G_CALLBACK (NULL), }, + { "invert-selection", NULL, N_ ("_Invert Selection"), NULL, N_ ("Select all files but not those currently selected"), G_CALLBACK (NULL), }, + { "duplicate", NULL, N_ ("Du_plicate"), NULL, NULL, G_CALLBACK (NULL), }, + { "make-link", NULL, N_ ("Ma_ke Link"), NULL, NULL, G_CALLBACK (NULL), }, + { "rename", NULL, N_ ("_Rename..."), "F2", NULL, G_CALLBACK (NULL), }, + { "restore", NULL, N_ ("_Restore"), NULL, NULL, G_CALLBACK (NULL), }, }; /* Target types for dragging from the view */ @@ -450,7 +410,6 @@ static void thunar_standard_view_class_init (ThunarStandardViewClass *klass) { GtkWidgetClass *gtkwidget_class; - GtkBindingSet *binding_set; GObjectClass *gobject_class; gpointer g_iface; @@ -467,7 +426,6 @@ thunar_standard_view_class_init (ThunarStandardViewClass *klass) gtkwidget_class->grab_focus = thunar_standard_view_grab_focus; gtkwidget_class->draw = thunar_standard_view_draw; - klass->delete_selected_files = thunar_standard_view_delete_selected_files; klass->connect_ui_manager = (gpointer) exo_noop; klass->disconnect_ui_manager = (gpointer) exo_noop; @@ -578,30 +536,6 @@ thunar_standard_view_class_init (ThunarStandardViewClass *klass) NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); - - /** - * ThunarStandardView::delete-selected-files: - * @standard_view : a #ThunarStandardView. - * - * Emitted whenever the user presses the Delete key. This - * is an internal signal used to bind the action to keys. - **/ - standard_view_signals[DELETE_SELECTED_FILES] = - g_signal_new (I_("delete-selected-files"), - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, - G_STRUCT_OFFSET (ThunarStandardViewClass, delete_selected_files), - g_signal_accumulator_true_handled, NULL, - _thunar_marshal_BOOLEAN__VOID, - G_TYPE_BOOLEAN, 0); - - /* setup the key bindings for the standard views */ - binding_set = gtk_binding_set_by_class (klass); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_BackSpace, GDK_CONTROL_MASK, "delete-selected-files", 0); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_Delete, 0, "delete-selected-files", 0); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_Delete, GDK_SHIFT_MASK, "delete-selected-files", 0); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Delete, 0, "delete-selected-files", 0); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Delete, GDK_SHIFT_MASK, "delete-selected-files", 0); } @@ -654,9 +588,6 @@ thunar_standard_view_init (ThunarStandardView *standard_view) /* grab a reference on the preferences */ standard_view->preferences = thunar_preferences_get (); - /* grab a reference on the provider factory */ - standard_view->priv->provider_factory = thunarx_provider_factory_get_default (); - /* create a thumbnailer */ standard_view->priv->thumbnailer = thunar_thumbnailer_get (); g_signal_connect (G_OBJECT (standard_view->priv->thumbnailer), "request-finished", G_CALLBACK (thunar_standard_view_finished_thumbnailing), standard_view); @@ -694,11 +625,11 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS G_GNUC_END_IGNORE_DEPRECATIONS /* add the "Create Document" sub menu action */ - standard_view->priv->action_create_document = thunar_templates_action_new ("create-document", _("Create _Document")); + //standard_view->priv->action_create_document = thunar_templates_action_new ("create-document", _("Create _Document")); g_signal_connect (G_OBJECT (standard_view->priv->action_create_document), "create-empty-file", - G_CALLBACK (thunar_standard_view_action_create_empty_file), standard_view); + G_CALLBACK (NULL), standard_view); g_signal_connect (G_OBJECT (standard_view->priv->action_create_document), "create-template", - G_CALLBACK (thunar_standard_view_action_create_template), standard_view); + G_CALLBACK (NULL), standard_view); G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_action_group_add_action (standard_view->action_group, standard_view->priv->action_create_document); G_GNUC_END_IGNORE_DEPRECATIONS @@ -896,7 +827,6 @@ thunar_standard_view_finalize (GObject *object) _thunar_assert (standard_view->loading_binding == NULL); _thunar_assert (standard_view->icon_factory == NULL); _thunar_assert (standard_view->ui_manager == NULL); - _thunar_assert (standard_view->clipboard == NULL); /* release the thumbnailer */ g_signal_handlers_disconnect_by_func (standard_view->priv->thumbnailer, thunar_standard_view_finished_thumbnailing, standard_view); @@ -909,9 +839,6 @@ thunar_standard_view_finalize (GObject *object) /* release the selected_files list (if any) */ thunar_g_file_list_free (standard_view->priv->selected_files); - /* release our reference on the provider factory */ - g_object_unref (G_OBJECT (standard_view->priv->provider_factory)); - /* release the drag path list (just in case the drag-end wasn't fired before) */ thunar_g_file_list_free (standard_view->priv->drag_g_file_list); @@ -1081,19 +1008,10 @@ thunar_standard_view_realize (GtkWidget *widget) { ThunarStandardView *standard_view = THUNAR_STANDARD_VIEW (widget); GtkIconTheme *icon_theme; - GdkDisplay *display; /* let the GtkWidget do its work */ GTK_WIDGET_CLASS (thunar_standard_view_parent_class)->realize (widget); - /* query the clipboard manager for the display */ - display = gtk_widget_get_display (widget); - standard_view->clipboard = thunar_clipboard_manager_get_for_display (display); - - /* we need update the selection state based on the clipboard content */ - g_signal_connect_swapped (G_OBJECT (standard_view->clipboard), "changed", - G_CALLBACK (thunar_standard_view_selection_changed), standard_view); - /* determine the icon factory for the screen on which we are realized */ icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (widget)); standard_view->icon_factory = thunar_icon_factory_get_for_icon_theme (icon_theme); @@ -1117,18 +1035,11 @@ thunar_standard_view_unrealize (GtkWidget *widget) { ThunarStandardView *standard_view = THUNAR_STANDARD_VIEW (widget); - /* disconnect the clipboard changed handler */ - g_signal_handlers_disconnect_by_func (G_OBJECT (standard_view->clipboard), thunar_standard_view_selection_changed, standard_view); - /* drop the reference on the icon factory */ g_signal_handlers_disconnect_by_func (G_OBJECT (standard_view->icon_factory), gtk_widget_queue_draw, standard_view); g_object_unref (G_OBJECT (standard_view->icon_factory)); standard_view->icon_factory = NULL; - /* drop the reference on the clipboard manager */ - g_object_unref (G_OBJECT (standard_view->clipboard)); - standard_view->clipboard = NULL; - /* let the GtkWidget do its work */ GTK_WIDGET_CLASS (thunar_standard_view_parent_class)->unrealize (widget); } @@ -1270,21 +1181,6 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS /* disconnect from the previous UI manager */ if (G_LIKELY (standard_view->ui_manager != NULL)) { - /* remove any registered custom menu actions */ - if (G_LIKELY (standard_view->priv->custom_merge_id != 0)) - { - gtk_ui_manager_remove_ui (standard_view->ui_manager, standard_view->priv->custom_merge_id); - standard_view->priv->custom_merge_id = 0; - } - - /* drop the previous custom action group */ - if (G_LIKELY (standard_view->priv->custom_actions != NULL)) - { - gtk_ui_manager_remove_action_group (standard_view->ui_manager, standard_view->priv->custom_actions); - g_object_unref (G_OBJECT (standard_view->priv->custom_actions)); - standard_view->priv->custom_actions = NULL; - } - /* drop our action group from the previous UI manager */ gtk_ui_manager_remove_action_group (standard_view->ui_manager, standard_view->action_group); @@ -1336,6 +1232,15 @@ G_GNUC_END_IGNORE_DEPRECATIONS +static void +thunar_standard_view_set_selected_files_view (ThunarView *view, + GList *selected_files) +{ + thunar_standard_view_set_selected_files_component (THUNAR_COMPONENT (view), selected_files); +} + + + static ThunarFile* thunar_standard_view_get_current_directory (ThunarNavigator *navigator) { @@ -1441,7 +1346,6 @@ thunar_standard_view_set_current_directory (ThunarNavigator *navigator, { ThunarStandardView *standard_view = THUNAR_STANDARD_VIEW (navigator); ThunarFolder *folder; - gboolean trashed; _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view)); _thunar_return_if_fail (current_directory == NULL || THUNAR_IS_FILE (current_directory)); @@ -1524,21 +1428,6 @@ thunar_standard_view_set_current_directory (ThunarNavigator *navigator, /* reconnect our model to the view */ g_object_set (G_OBJECT (gtk_bin_get_child (GTK_BIN (standard_view))), "model", standard_view->model, NULL); - /* check if the new directory is in the trash */ - trashed = thunar_file_is_trashed (current_directory); - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* update the "Create Folder"/"Create Document" actions */ - gtk_action_set_visible (standard_view->priv->action_create_folder, !trashed); - gtk_action_set_visible (standard_view->priv->action_create_document, !trashed); - - /* update the "Rename" action */ - gtk_action_set_visible (standard_view->priv->action_rename, !trashed); - - /* update the "Restore" action */ - gtk_action_set_visible (standard_view->priv->action_restore, trashed); -G_GNUC_END_IGNORE_DEPRECATIONS - /* schedule a thumbnail timeout */ /* NOTE: quickly after this we always trigger a size allocate wich will handle this */ @@ -1897,54 +1786,6 @@ thunar_standard_view_scroll_to_file (ThunarView *view, -static gboolean -thunar_standard_view_delete_selected_files (ThunarStandardView *standard_view) -{ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - GtkAction *action = GTK_ACTION (standard_view->priv->action_move_to_trash); -G_GNUC_END_IGNORE_DEPRECATIONS - const gchar *accel_path; - GtkAccelKey key; - - _thunar_return_val_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view), FALSE); - - if (thunar_g_vfs_is_uri_scheme_supported ("trash")) - { - /* Check if there is a user defined accelerator for the delete action, - * if there is, skip events from the hard-coded keys which are set in - * the class of the standard view. See bug #4173. - * - * The trick here is that if a custom accelerator is set by the user, - * this function is never called. If a hardcoded key combination is - * pressed and a custom accelerator is set, accel_key || accel_mods - * are no 0. */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - accel_path = gtk_action_get_accel_path (action); -G_GNUC_END_IGNORE_DEPRECATIONS - if (accel_path != NULL - && gtk_accel_map_lookup_entry (accel_path, &key) - && (key.accel_key != 0 || key.accel_mods != 0)) - return FALSE; - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* just emit the "activate" signal on the "move-trash" action */ - gtk_action_activate (action); -G_GNUC_END_IGNORE_DEPRECATIONS - } - else - { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* do a permanent delete */ - gtk_action_activate (GTK_ACTION (standard_view->priv->action_delete)); -G_GNUC_END_IGNORE_DEPRECATIONS - } - - /* ...and we're done */ - return TRUE; -} - - - static GdkDragAction thunar_standard_view_get_dest_actions (ThunarStandardView *standard_view, GdkDragContext *context, @@ -2058,128 +1899,6 @@ thunar_standard_view_get_drop_file (ThunarStandardView *standard_view, -static void -thunar_standard_view_merge_custom_actions (ThunarStandardView *standard_view) -{ - GtkTreeIter iter; - ThunarFile *file = NULL; - GtkWidget *window; - GList *providers; - GList *items = NULL; - GList *files = NULL; - GList *tmp; - GList *lp; - GList *selected_items; - gchar *path; - - /* we cannot add anything if we aren't connected to any UI manager */ - if (G_UNLIKELY (standard_view->ui_manager == NULL)) - return; - - /* determine the toplevel window we belong to */ - window = gtk_widget_get_toplevel (GTK_WIDGET (standard_view)); - - /* get the selected items */ - selected_items = (*THUNAR_STANDARD_VIEW_GET_CLASS (standard_view)->get_selected_items) (standard_view); - - /* load the menu providers from the provider factory */ - providers = thunarx_provider_factory_list_providers (standard_view->priv->provider_factory, THUNARX_TYPE_MENU_PROVIDER); - if (G_LIKELY (providers != NULL)) - { - /* determine the list of selected files or the current folder */ - if (G_LIKELY (selected_items != NULL)) - { - for (lp = selected_items; lp != NULL; lp = lp->next) - { - gtk_tree_model_get_iter (GTK_TREE_MODEL (standard_view->model), &iter, lp->data); - file = thunar_list_model_get_file (standard_view->model, &iter); - files = g_list_prepend (files, file); - } - files = g_list_reverse (files); - } - else - { - /* grab a reference to the current directory of the view */ - file = thunar_navigator_get_current_directory (THUNAR_NAVIGATOR (standard_view)); - } - - /* load the menu items offered by the menu providers */ - for (lp = providers; lp != NULL; lp = lp->next) - { - if (G_LIKELY (files != NULL)) - tmp = thunarx_menu_provider_get_file_menu_items (lp->data, window, files); - else if (G_LIKELY (file != NULL)) - tmp = thunarx_menu_provider_get_folder_menu_items (lp->data, window, THUNARX_FILE_INFO (file)); - else - tmp = NULL; - items = g_list_concat (items, tmp); - g_object_unref (G_OBJECT (lp->data)); - } - g_list_free (providers); - - /* cleanup the selected files list (if any) */ - if (G_LIKELY (files != NULL)) - thunar_g_file_list_free (files); - } - - /* remove the previously determined menu actions from the UI manager */ - if (G_LIKELY (standard_view->priv->custom_merge_id != 0)) - { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - gtk_ui_manager_remove_ui (standard_view->ui_manager, standard_view->priv->custom_merge_id); - gtk_ui_manager_ensure_update (standard_view->ui_manager); -G_GNUC_END_IGNORE_DEPRECATIONS - standard_view->priv->custom_merge_id = 0; - } - - /* drop any previous custom action group */ - if (G_LIKELY (standard_view->priv->custom_actions != NULL)) - { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - gtk_ui_manager_remove_action_group (standard_view->ui_manager, standard_view->priv->custom_actions); -G_GNUC_END_IGNORE_DEPRECATIONS - g_object_unref (G_OBJECT (standard_view->priv->custom_actions)); - standard_view->priv->custom_actions = NULL; - } - - /* add the actions specified by the menu providers */ - if (G_LIKELY (items != NULL)) - { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* allocate the action group and the merge id for the custom actions */ - standard_view->priv->custom_actions = gtk_action_group_new ("thunar-standard-view-custom-actions"); - standard_view->priv->custom_merge_id = gtk_ui_manager_new_merge_id (standard_view->ui_manager); - gtk_ui_manager_insert_action_group (standard_view->ui_manager, standard_view->priv->custom_actions, -1); -G_GNUC_END_IGNORE_DEPRECATIONS - - if (G_LIKELY (selected_items != NULL)) - { - /* add to the file context menu */ - path = "/file-context-menu/placeholder-custom-actions"; - } - else - { - /* add to the folder context menu */ - path = "/folder-context-menu/placeholder-custom-actions"; - } - - thunar_menu_util_add_items_to_ui_manager (standard_view->ui_manager, - standard_view->priv->custom_actions, - standard_view->priv->custom_merge_id, - path, items); - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* be sure to update the UI manager to avoid flickering */ - gtk_ui_manager_ensure_update (standard_view->ui_manager); -G_GNUC_END_IGNORE_DEPRECATIONS - - /* cleanup */ - g_list_free (items); - } -} - - - static gboolean thunar_standard_view_update_statusbar_text_idle (gpointer data) { @@ -2341,332 +2060,6 @@ thunar_standard_view_current_directory_changed (ThunarFile *current_dire static void -thunar_standard_view_action_create_empty_file (GtkAction *action, - ThunarStandardView *standard_view) -{ - ThunarApplication *application; - ThunarFile *current_directory; - GList path_list; - gchar *name; - -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)); - - /* ask the user to enter a name for the new empty file */ - name = thunar_show_create_dialog (GTK_WIDGET (standard_view), - "text/plain", - _("New Empty File"), - _("New Empty File...")); - if (G_LIKELY (name != NULL)) - { - /* determine the ThunarFile for the current directory */ - current_directory = thunar_navigator_get_current_directory (THUNAR_NAVIGATOR (standard_view)); - if (G_LIKELY (current_directory != NULL)) - { - /* fake the path list */ - path_list.data = g_file_resolve_relative_path (thunar_file_get_file (current_directory), name); - path_list.next = path_list.prev = NULL; - - /* launch the operation */ - application = thunar_application_get (); - thunar_application_creat (application, GTK_WIDGET (standard_view), &path_list, NULL, - thunar_standard_view_new_files_closure (standard_view, NULL)); - g_object_unref (application); - - /* release the path */ - g_object_unref (path_list.data); - } - - /* release the file name in the local encoding */ - g_free (name); - } -} - - - -static void -thunar_standard_view_action_create_folder (GtkAction *action, - ThunarStandardView *standard_view) -{ - ThunarApplication *application; - ThunarFile *current_directory; - GList path_list; - gchar *name; - -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)); - - /* ask the user to enter a name for the new folder */ - name = thunar_show_create_dialog (GTK_WIDGET (standard_view), - "inode/directory", - _("New Folder"), - _("Create New Folder")); - if (G_LIKELY (name != NULL)) - { - /* determine the ThunarFile for the current directory */ - current_directory = thunar_navigator_get_current_directory (THUNAR_NAVIGATOR (standard_view)); - if (G_LIKELY (current_directory != NULL)) - { - /* fake the path list */ - path_list.data = g_file_resolve_relative_path (thunar_file_get_file (current_directory), name); - path_list.next = path_list.prev = NULL; - - /* launch the operation */ - application = thunar_application_get (); - thunar_application_mkdir (application, GTK_WIDGET (standard_view), &path_list, - thunar_standard_view_new_files_closure (standard_view, NULL)); - g_object_unref (G_OBJECT (application)); - - /* release the path */ - g_object_unref (path_list.data); - } - - /* release the file name */ - g_free (name); - } -} - - - -static void -thunar_standard_view_action_create_template (GtkAction *action, - const ThunarFile *file, - ThunarStandardView *standard_view) -{ - ThunarApplication *application; - ThunarFile *current_directory; - GList target_path_list; - gchar *name; - gchar *title; - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - _thunar_return_if_fail (GTK_IS_ACTION (action)); -G_GNUC_END_IGNORE_DEPRECATIONS - _thunar_return_if_fail (THUNAR_IS_FILE (file)); - _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view)); - - /* generate a title for the create dialog */ - title = g_strdup_printf (_("Create Document from template \"%s\""), - thunar_file_get_display_name (file)); - - /* ask the user to enter a name for the new document */ - name = thunar_show_create_dialog (GTK_WIDGET (standard_view), - thunar_file_get_content_type (THUNAR_FILE (file)), - thunar_file_get_display_name (file), - title); - if (G_LIKELY (name != NULL)) - { - /* determine the ThunarFile for the current directory */ - current_directory = thunar_navigator_get_current_directory (THUNAR_NAVIGATOR (standard_view)); - if (G_LIKELY (current_directory != NULL)) - { - /* fake the target path list */ - target_path_list.data = g_file_get_child (thunar_file_get_file (current_directory), name); - target_path_list.next = NULL; - target_path_list.prev = NULL; - - /* launch the operation */ - application = thunar_application_get (); - thunar_application_creat (application, GTK_WIDGET (standard_view), &target_path_list, - thunar_file_get_file (file), - thunar_standard_view_new_files_closure (standard_view, NULL)); - g_object_unref (G_OBJECT (application)); - - /* release the target path */ - g_object_unref (target_path_list.data); - } - - /* release the file name */ - g_free (name); - } - - /* cleanup */ - g_free (title); -} - - - -static void -thunar_standard_view_action_properties (GtkAction *action, - ThunarStandardView *standard_view) -{ - ThunarFile *directory; - GtkWidget *toplevel; - GtkWidget *dialog; - -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)); - - /* popup the files dialog */ - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (standard_view)); - if (G_LIKELY (toplevel != NULL)) - { - dialog = thunar_properties_dialog_new (GTK_WINDOW (toplevel)); - - /* check if no files are currently selected */ - if (standard_view->priv->selected_files == NULL) - { - /* if we don't have any files selected, we just popup - * the properties dialog for the current folder. - */ - directory = thunar_navigator_get_current_directory (THUNAR_NAVIGATOR (standard_view)); - thunar_properties_dialog_set_file (THUNAR_PROPERTIES_DIALOG (dialog), directory); - } - else - { - /* popup the properties dialog for all file(s) */ - thunar_properties_dialog_set_files (THUNAR_PROPERTIES_DIALOG (dialog), - standard_view->priv->selected_files); - } - - gtk_widget_show (dialog); - } -} - - - -static void -thunar_standard_view_action_cut (GtkAction *action, - ThunarStandardView *standard_view) -{ -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); -} - - - -static void -thunar_standard_view_action_copy (GtkAction *action, - ThunarStandardView *standard_view) -{ -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); -} - - - -static void -thunar_standard_view_action_paste (GtkAction *action, - ThunarStandardView *standard_view) -{ - ThunarFile *current_directory; - -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)); - - 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)); - } -} - - - -static void -thunar_standard_view_unlink_selection (ThunarStandardView *standard_view, - gboolean permanently) -{ - ThunarApplication *application; - - _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view)); - - /* delete the selected files */ - application = thunar_application_get (); - thunar_application_unlink_files (application, GTK_WIDGET (standard_view), - standard_view->priv->selected_files, - permanently); - g_object_unref (G_OBJECT (application)); - - /* do not select new files */ - thunar_component_set_selected_files (THUNAR_COMPONENT (standard_view), NULL); -} - - - -static void -thunar_standard_view_action_move_to_trash (GtkAction *action, - ThunarStandardView *standard_view) -{ - gboolean permanently; - GdkModifierType state; - const gchar *accel_path; - GtkAccelKey key; - -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)); - - /* check if we should permanently delete the files (user holds shift) */ - permanently = (gtk_get_current_event_state (&state) && (state & GDK_SHIFT_MASK) != 0); - if (permanently) - { - /* look if the user has set a custom accelerator (accel_key != 0) - * that contains a shift modifier */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - accel_path = gtk_action_get_accel_path (action); -G_GNUC_END_IGNORE_DEPRECATIONS - if (accel_path != NULL - && gtk_accel_map_lookup_entry (accel_path, &key) - && key.accel_key != 0 - && (key.accel_mods & GDK_SHIFT_MASK) != 0) - permanently = FALSE; - } - - thunar_standard_view_unlink_selection (standard_view, permanently); -} - - - -static void -thunar_standard_view_action_delete (GtkAction *action, - ThunarStandardView *standard_view) -{ - thunar_standard_view_unlink_selection (standard_view, TRUE); -} - - - -static void -thunar_standard_view_action_paste_into_folder (GtkAction *action, - ThunarStandardView *standard_view) -{ - ThunarFile *file; - -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)); - - /* determine the first selected file and verify that it's a folder */ - file = g_list_nth_data (standard_view->priv->selected_files, 0); - if (G_LIKELY (file != NULL && thunar_file_is_directory (file))) - thunar_clipboard_manager_paste_files (standard_view->clipboard, thunar_file_get_file (file), GTK_WIDGET (standard_view), NULL); -} - - - -static void thunar_standard_view_action_select_all_files (GtkAction *action, ThunarStandardView *standard_view) { @@ -2802,221 +2195,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS -static void -thunar_standard_view_action_duplicate (GtkAction *action, - ThunarStandardView *standard_view) -{ - ThunarApplication *application; - ThunarFile *current_directory; - GClosure *new_files_closure; - GList *selected_files; - -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)); - - /* determine the file for the current directory */ - current_directory = thunar_navigator_get_current_directory (THUNAR_NAVIGATOR (standard_view)); - if (G_LIKELY (current_directory != NULL)) - { - /* determine the selected files for the view */ - selected_files = thunar_file_list_to_thunar_g_file_list (standard_view->priv->selected_files); - if (G_LIKELY (selected_files != NULL)) - { - /* copy the selected files into the current directory, which effectively - * creates duplicates of the files. - */ - application = thunar_application_get (); - new_files_closure = thunar_standard_view_new_files_closure (standard_view, NULL); - thunar_application_copy_into (application, GTK_WIDGET (standard_view), selected_files, - thunar_file_get_file (current_directory), new_files_closure); - g_object_unref (G_OBJECT (application)); - - /* clean up */ - thunar_g_file_list_free (selected_files); - } - } -} - - - -static void -thunar_standard_view_action_make_link (GtkAction *action, - ThunarStandardView *standard_view) -{ - ThunarApplication *application; - ThunarFile *current_directory; - GClosure *new_files_closure; - GList *selected_files; - -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)); - - /* determine the file for the current directory */ - current_directory = thunar_navigator_get_current_directory (THUNAR_NAVIGATOR (standard_view)); - if (G_LIKELY (current_directory != NULL)) - { - /* determine the selected paths for the view */ - selected_files = thunar_file_list_to_thunar_g_file_list (standard_view->priv->selected_files); - if (G_LIKELY (selected_files != NULL)) - { - /* link the selected files into the current directory, which effectively - * creates new unique links for the files. - */ - application = thunar_application_get (); - new_files_closure = thunar_standard_view_new_files_closure (standard_view, NULL); - thunar_application_link_into (application, GTK_WIDGET (standard_view), selected_files, - thunar_file_get_file (current_directory), new_files_closure); - g_object_unref (G_OBJECT (application)); - - /* clean up */ - thunar_g_file_list_free (selected_files); - } - } -} - - - -static void -thunar_standard_view_rename_error (ExoJob *job, - GError *error, - ThunarStandardView *standard_view) -{ - GArray *param_values; - ThunarFile *file; - - _thunar_return_if_fail (EXO_IS_JOB (job)); - _thunar_return_if_fail (error != NULL); - _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view)); - - param_values = thunar_simple_job_get_param_values (THUNAR_SIMPLE_JOB (job)); - file = g_value_get_object (&g_array_index (param_values, GValue, 0)); - - /* display an error message */ - thunar_dialogs_show_error (GTK_WIDGET (standard_view), error, - _("Failed to rename \"%s\""), - thunar_file_get_display_name (file)); -} - - - -static void -thunar_standard_view_rename_finished (ExoJob *job, - ThunarStandardView *standard_view) -{ - GArray *param_values; - ThunarFile *file; - - _thunar_return_if_fail (EXO_IS_JOB (job)); - _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view)); - - param_values = thunar_simple_job_get_param_values (THUNAR_SIMPLE_JOB (job)); - file = g_value_get_object (&g_array_index (param_values, GValue, 0)); - - /* make sure the file is still visible */ - thunar_view_scroll_to_file (THUNAR_VIEW (standard_view), file, TRUE, FALSE, 0.0f, 0.0f); - - /* update the selection, so we get updated actions, statusbar, - * etc. with the new file name and probably new mime type. - */ - thunar_standard_view_selection_changed (standard_view); - - /* destroy the job */ - g_signal_handlers_disconnect_matched (job, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, standard_view); - g_object_unref (job); -} - - - -static void -thunar_standard_view_action_rename (GtkAction *action, - ThunarStandardView *standard_view) -{ - ThunarFile *file; - GtkWidget *window; - ThunarJob *job; - GdkModifierType state; - gboolean force_bulk_renamer; - const gchar *accel_path; - GtkAccelKey key; - -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)); - - /* leave if no files are selected */ - if (G_UNLIKELY (standard_view->priv->selected_files == NULL)) - return; - - /* open the bulk renamer also with one file selected and shift */ - force_bulk_renamer = (gtk_get_current_event_state (&state) && (state & GDK_SHIFT_MASK) != 0); - if (G_UNLIKELY (force_bulk_renamer)) - { - /* Check if the user defined a custom accelerator that includes the - * shift button. If he or she has, we won't force the bulk renamer. */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - accel_path = gtk_action_get_accel_path (action); -G_GNUC_END_IGNORE_DEPRECATIONS - if (accel_path != NULL - && gtk_accel_map_lookup_entry (accel_path, &key) - && (key.accel_mods & GDK_SHIFT_MASK) != 0) - force_bulk_renamer = FALSE; - } - - /* start renaming if we have exactly one selected file */ - if (!force_bulk_renamer - && standard_view->priv->selected_files->next == NULL) - { - /* get the window */ - window = gtk_widget_get_toplevel (GTK_WIDGET (standard_view)); - - /* get the file */ - file = THUNAR_FILE (standard_view->priv->selected_files->data); - - /* run the rename dialog */ - job = thunar_dialogs_show_rename_file (GTK_WINDOW (window), file); - if (G_LIKELY (job != NULL)) - { - g_signal_connect (job, "error", G_CALLBACK (thunar_standard_view_rename_error), standard_view); - g_signal_connect (job, "finished", G_CALLBACK (thunar_standard_view_rename_finished), standard_view); - } - } - else - { - /* determine the current directory of the view */ - file = thunar_navigator_get_current_directory (THUNAR_NAVIGATOR (standard_view)); - - /* display the bulk rename dialog */ - thunar_show_renamer_dialog (GTK_WIDGET (standard_view), file, standard_view->priv->selected_files, FALSE, NULL); - } -} - - - -static void -thunar_standard_view_action_restore (GtkAction *action, - ThunarStandardView *standard_view) -{ - ThunarApplication *application; - -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)); - - /* restore the selected files */ - application = thunar_application_get (); - thunar_application_restore_files (application, GTK_WIDGET (standard_view), standard_view->priv->selected_files, - thunar_standard_view_new_files_closure (standard_view, NULL)); - g_object_unref (G_OBJECT (application)); -} - - - static GClosure* thunar_standard_view_new_files_closure (ThunarStandardView *standard_view, GtkWidget *source_view) @@ -4512,17 +3690,7 @@ void thunar_standard_view_selection_changed (ThunarStandardView *standard_view) { GtkTreeIter iter; - ThunarFile *current_directory; - gboolean can_paste_into_folder; - gboolean restorable; - gboolean trashable; - gboolean pastable; - gboolean writable; - gboolean trashed; - gboolean hide_trash_action; - gboolean show_delete_action; GList *lp, *selected_files; - gint n_selected_files = 0; _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view)); @@ -4539,9 +3707,7 @@ thunar_standard_view_selection_changed (ThunarStandardView *standard_view) /* determine the new list of selected files (replacing GtkTreePath's with ThunarFile's) */ selected_files = (*THUNAR_STANDARD_VIEW_GET_CLASS (standard_view)->get_selected_items) (standard_view); - restorable = (selected_files != NULL); - trashable = (selected_files != NULL); - for (lp = selected_files; lp != NULL; lp = lp->next, ++n_selected_files) + for (lp = selected_files; lp != NULL; lp = lp->next) { /* determine the iterator for the path */ gtk_tree_model_get_iter (GTK_TREE_MODEL (standard_view->model), &iter, lp->data); @@ -4551,133 +3717,14 @@ thunar_standard_view_selection_changed (ThunarStandardView *standard_view) /* ...and replace it with the file */ lp->data = thunar_list_model_get_file (standard_view->model, &iter); - - /* enable "Restore" if we have only trashed files (atleast one file) */ - if (!thunar_file_is_trashed (lp->data)) - restorable = FALSE; - - /* enable "Move to Trash" if files can be trashed */ - if (!thunar_file_can_be_trashed (lp->data)) - trashable = FALSE; } /* and setup the new selected files list */ standard_view->priv->selected_files = selected_files; - /* check whether the folder displayed by the view is writable/in the trash */ - current_directory = thunar_navigator_get_current_directory (THUNAR_NAVIGATOR (standard_view)); - writable = (current_directory != NULL && thunar_file_is_writable (current_directory)); - trashed = (current_directory != NULL && thunar_file_is_trashed (current_directory)); - - /* if moving to trash is not applicable, replace it with the delete action - * but only if the directory is writable -- keep "move to trash" otherwise */ - hide_trash_action = writable && (trashed || !trashable || !thunar_g_vfs_is_uri_scheme_supported ("trash")); - - g_object_get (G_OBJECT (standard_view->preferences), "misc-show-delete-action", &show_delete_action, NULL); - - /* check whether the clipboard contains data that can be pasted here */ - pastable = (standard_view->clipboard != NULL && thunar_clipboard_manager_get_can_paste (standard_view->clipboard)); - - /* check whether the only selected file is - * folder to which we can paste to */ - can_paste_into_folder = (n_selected_files == 1) - && thunar_file_is_directory (selected_files->data) - && thunar_file_is_writable (selected_files->data); - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* update the "Create Folder"/"Create Document" actions */ - gtk_action_set_sensitive (standard_view->priv->action_create_folder, !trashed && writable); - gtk_action_set_sensitive (standard_view->priv->action_create_document, !trashed && writable); - - /* update the "Properties" action */ - gtk_action_set_sensitive (standard_view->priv->action_properties, - current_directory != NULL || n_selected_files > 0); -G_GNUC_END_IGNORE_DEPRECATIONS - - /* update the "Cut" action */ - g_object_set (G_OBJECT (standard_view->priv->action_cut), - "sensitive", (n_selected_files > 0) && writable, - "tooltip", ngettext ("Prepare the selected file to be moved with a Paste command", - "Prepare the selected files to be moved with a Paste command", - n_selected_files), - NULL); - - /* update the "Copy" action */ - g_object_set (G_OBJECT (standard_view->priv->action_copy), - "sensitive", (n_selected_files > 0), - "tooltip", ngettext ("Prepare the selected file to be copied with a Paste command", - "Prepare the selected files to be copied with a Paste command", - n_selected_files), - NULL); - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* update the "Paste" action */ - gtk_action_set_sensitive (standard_view->priv->action_paste, writable && pastable); -G_GNUC_END_IGNORE_DEPRECATIONS - - /* update the "Move to Trash" action */ - g_object_set (G_OBJECT (standard_view->priv->action_move_to_trash), - "sensitive", (n_selected_files > 0) && writable, - "visible", !hide_trash_action, - "tooltip", ngettext ("Move the selected file to the Trash", - "Move the selected files to the Trash", - n_selected_files), - NULL); - - /* update the "Delete" action */ - g_object_set (G_OBJECT (standard_view->priv->action_delete), - "sensitive", (n_selected_files > 0) && writable, - "visible", hide_trash_action || show_delete_action, - "tooltip", ngettext ("Permanently delete the selected file", - "Permanently delete the selected files", - n_selected_files), - NULL); - - /* update the "Paste Into Folder" action */ - g_object_set (G_OBJECT (standard_view->priv->action_paste_into_folder), - "sensitive", pastable, - "visible", can_paste_into_folder, - NULL); - - /* update the "Duplicate File(s)" action */ - g_object_set (G_OBJECT (standard_view->priv->action_duplicate), - "sensitive", (n_selected_files > 0) && !restorable && writable, - "tooltip", ngettext ("Duplicate the selected file", - "Duplicate each selected file", - n_selected_files), - NULL); - - /* update the "Make Link(s)" action */ - g_object_set (G_OBJECT (standard_view->priv->action_make_link), - "label", ngettext ("Ma_ke Link", "Ma_ke Links", n_selected_files), - "sensitive", (n_selected_files > 0) && !restorable && writable, - "tooltip", ngettext ("Create a symbolic link for the selected file", - "Create a symbolic link for each selected file", - n_selected_files), - NULL); - - /* update the "Rename" action */ - g_object_set (G_OBJECT (standard_view->priv->action_rename), - "sensitive", (n_selected_files > 0 && !restorable && writable), - "tooltip", ngettext ("Rename the selected file", - "Rename the selected files", - n_selected_files), - NULL); - - /* update the "Restore" action */ - g_object_set (G_OBJECT (standard_view->priv->action_restore), - "sensitive", (n_selected_files > 0 && restorable), - "tooltip", ngettext ("Restore the selected file", - "Restore the selected files", - n_selected_files), - NULL); - /* update the statusbar text */ thunar_standard_view_update_statusbar_text (standard_view); - /* merge the custom actions */ - thunar_standard_view_merge_custom_actions (standard_view); - /* emit notification for "selected-files" */ g_object_notify_by_pspec (G_OBJECT (standard_view), standard_view_props[PROP_SELECTED_FILES]); } |