ThunarVFS References in Thunar

… and what to do with them.

Thunar

ThunarVFS is used almost everywhere inside Thunar. All appearances in the code have to be replaced with equivalent (or improved) implementations based on GIO. In order to do that, we first have to collect information about all the ThunarVFS references in the code. Afterwards, we can determine what to do with each reference.

It's probably a good idea to look at ThunarFolder/ThunarFile at the very end because I already have an idea on how to deal with them. Deciding what to do with the other ThunarVFS references first could have interesting implications on ThunarFolder/ThunarFile.

ThunarApplication

Has a lot of references to ThunarVFS, plus it has several function for creating jobs. Most of the code related to ThunarVfsJob will have to be redesigned around GFile, using functions like g_file_copy_async().

Solution

ThunarApplication

Use GVolumeMonitor instead of ThunarVfsVolumeManager.

thunar_application_init()

Connect to the correct signals of GVolumeMonitor.

thunar_application_collect_and_launch()

Use g_file_get_parent() instead of thunar_vfs_path_is_root(). Maybe even add a new function g_file_has_parent() to thunar-glib-extensions.c.

In case of the trash we need special handling of the “trash::orig-path” attribute of GFileInfo. To make that easier we should probably use ThunarFile here and turn thunar_application_collect_and_launch() into an asynchronous operation.

thunar_application_move_into()

Use special job for moving into trash. Use g_file_get_uri_scheme() instead of thunar_vfs_path_get_scheme(). Maybe even add a separate function thunar_application_trash() in addition to thunar_application_move_into().

thunar_application_unlink_files()

Use g_file_list_prepend() instead of thunar_vfs_path_list_prepend(). Use new function thunar_application_trash() instead of thunar_application_move_into() in combination with the trash path. Use g_file_list_free() instead of thunar_vfs_path_list_free().

thunar_application_empty_trash()

Use g_file_new_for_trash() instead of thunar_vfs_path_get_for_trash() and g_object_unref() instead of thunar_vfs_path_unref().

thunar_application_restore_files()

Rewrite in an asynchronous way based on the “trash::orig-file” attribute of GFileInfo.

ThunarChooserButton

Has references to

  • ThunarVfsMimeApplication
  • ThunarVfsMimeDatabase
  • ThunarVfsMimeInfo

Solution

There's no need to have a ThunarVfsMimeDatabase member in the _ThunarChooserButton struct, so remove it.

thunar_chooser_button_activate()

Called when the button is clicked. Sets the default application for the MIME type of the current file.

Use g_app_info_set_default_for_type() to apply the new setting and maybe use g_app_info_set_default_for_extension() as a fallback if the content type cannot be determined.

thunar_chooser_button_file_changed()

Called when the file associated with the chooser button has changed. Uses ThunarVfsMimeDatabase, ThunarVfsMimeApplication and ThunarVfsMimeInfo to determine the default application for the MIME type of this file.

Determine the content type of the file here and get the default application using g_app_info_get_default_for_type(). If that is NULL or the content type cannot be determined try g_app_info_get_default_for_uri_scheme() as a fallback. Otherwise show “No application selected”.

thunar_chooser_button_pressed()

Called when the button is pressed. Pops up a menu with all applications for the content type or URI scheme listed. The default application always comes first in this menu.

Use g_app_info_get_all_for_type() to determine the application list, and maybe g_app_info_get_default_for_uri_scheme() as a fallback or to append more generic applications to the menu.

ThunarChooserDialog

Has references to

  • ThunarVfsMimeApplication
  • ThunarVfsMimeInfo
  • ThunarVfsMimeDatabase

It can probably simplified dramatically by using GAppInfo.

Solution

thunar_chooser_dialog_response()

We need special handling for custom commands because GIO doesn't support them. So we probably need to create a new desktop entry for each custom command. Afterwards create a new GAppInfo based on that desktop entry and set it as default (if custom commands are used) using g_app_info_set_as_default_for_type().

Instead of thunar_vfs_mime_handler_exec() use g_app_info_launch().

thunar_chooser_dialog_context_menu()

We need a replacement for thunar_vfs_mime_application_is_usercreated(). Maybe g_app_info_can_remove_supports_type() is useful here.

thunar_chooser_dialog_update_header()

Use g_app_info_get_icon() instead of thunar_vfs_mime_info_lookup_icon_name(). Still need to figure out how to set the window icon based on a GIcon.

Use g_content_type_get_description() instead of thunar_vfs_mime_info_get_comment().

thunar_chooser_dialog_action_remove()

Again, we need a replacement for thunar_vfs_mime_application_is_usercreated(). Maybe g_app_info_can_remove_supports_type() is useful here.

Use g_app_info_get_name() instead of thunar_vfs_mime_handler_get_name().

thunar_chooser_dialog_selection_changed()

Use g_app_info_get_executable() instead of thunar_vfs_mime_handler_get_command().

thunar_chooser_dialog_set_file()

Initialize ThunarChooserModel based on the ThunarFile or GFileInfo instead of ThunarVfsMimeInfo.

ThunarChooserModel

Has references to

  • ThunarVfsMimeApplication
  • ThunarVfsMimeInfo
  • ThunarVfsMimeDatabase

Solution

Use const gchar * instead of ThunarVfsMimeInfo everywhere. We only need the content type here. It might be a good idea to replace the timer/threading code with the async API of GDirEnumerator.

thunar_chooser_model_append()

Use g_app_info_get_name () instead of thunar_vfs_mime_handler_get_name() and g_app_info_get_icon() instead of thunar_vfs_mime_handler_lookup_icon_name().

thunar_chooser_model_import()

Use g_app_info_get_all_for_type() and maybe g_app_info_get_all_for_uri_scheme() instead of thunar_vfs_mime_database_get_applications().

Use g_app_info_equal() instead of thunar_vfs_mime_application_equal().

thunar_chooser_model_readdir()

Implement this based on GAppInfo and GDirEnumerator.

compare_application_by_name()

Use g_app_info_get_name() instead of thunar_vfs_mime_handler_get_name().

thunar_chooser_model_thread()

Use g_app_info_should_show() instead of thunar_vfS_mime_handler_get_flags()… and g_app_info_equal() instead of thunar_vfs_mime_application_equal().

thunar_chooser_model_remove()

Try to use g_app_info_remove_supports_type() instead of thunar_vfs_mime_database_remove_application().

ThunarClipboardManager

Has references to

  • ThunarVfsPath

These references are only used internally and it shouldn't be hard to replace them with code based on GFile.

Solution

ThunarClipboardPasteRequest

The member ThunarVfsPath *target_path has to be changed to GFile *target_path.

thunar_clipboard_manager_contents_received()

Add new function g_file_list_from_string() (equivalent to thunar_vfs_path_list_from_string()) to thunar-glib-extensions.c and use it here. Also add g_file_list_free() as a replacement for thunar_vfs_path_list_free().

thunar_clipboard_manager_get_callback()

Add new function g_file_list_to_string() as a replacement for thunar_vfs_path_list_to_string() to thunar-glib-extensions.c and use it here. Also use g_file_list_free() instead of thunar_vfs_path_list_free().

thunar_clipboard_manager_paste_files()

The function signature will have to be changed to something like this:

void thunar_clipboard_manager_paste_files (ThunarClipboardManager *manager,
                                           GFile                  *target_path,
                                           GtkWidget              *widget,
                                           GClosure               *new_files_closure);

Inside the function, use g_object_ref() instead of thunar_vfs_path_ref().

ThunarCreateDialog

Has references to

  • ThunarVfsMimeInfo

Solution

ThunarCreateDialog

Replace ThunarVfsMimeInfo *mime_info member with const gchar *content_type. Same goes for the mime-info property which has to be turned into a content-type string property.

thunar_create_dialog_{get,set}_mime_info()

Rename to thunar_create_dialog_{get,set}_content_type().

thunar_create_Dialog_update_image()

Instead of using ThunarVfsMimeInfo to create the dialog icon, we can simply use

GIcon *icon = g_content_type_get_icon (dialog->content_type);
gtk_image_set_from_gicon (GTK_IMAGE (dialog->image), icon, GTK_ICON_SIZE_DIALOG);
thunar_show_create_dialog()

Change the ThunarVfsMimeInfo *mime_info parameter to const gchar* content_type.

ThunarDBusService

Has references to

  • ThunarVfsPath

Solution

thunar_dbus_service_connect_trash_bin()

Replace ThunarVfsPath with GFile:

GFile *trash_bin_path;
...
trash_bin_path = g_file_new_for_uri ("trash://");
dbus_service->trash_bin = thunar_file_new (trash_bin_path);

thunar_file_load_async (...)
...
thunar_dbus_service_display_folder_and_select()

Replace ThunarVfsPath with GFile. Instead of thunar_vfs_path_relative() use g_file_resolve_relative_path(). Instead of thunar_file_get_for_path() use thunar_file_new() in combination with thunar_file_load_async().

thunar_dbus_service_move_to_trash()

Replace ThunarVfsPath with GFile.

ThunarFile

Each instance of the ThunarFile class represents one file/node in the filesystem. It wraps both ThunarVfsPath and ThunarVfsInfo with a huge number of convenience functions and macros.

Of course all these functions could easily be ported to GIO. A number of function signatures will have to be changed to get rid of ThunarVFS references. However, we have to do something about blocking GFileInfo queries inside ThunarFile.

First of all, the constructor should be split up from

ThunarFile *thunar_file_get_for_info (ThunarVfsInfo       *info);
ThunarFile *thunar_file_get_for_path (ThunarVfsPath       *path, 
                                      GError             **error);
ThunarFile *thunar_file_get_for_uri  (const gchar         *uri,
                                      GError             **error);

into something like this:

ThunarFile *thunar_file_get          (GFile               *file);
gboolean    thunar_file_load         (ThunarFile          *file,
                                      GCancellable        *cancellable,
                                      GError             **error);

Maybe alternatively add an asynchronous way to load files:

void        thunar_file_load_async   (ThunarFile          *file,
                                      GCancellable        *cancellable,
                                      GAsyncReadyCallback *callback,
                                      gpointer             user_data);
gboolean    thunar_file_load_finish  (ThunarFile          *file,
                                      GAsyncResult        *result,
                                      GError             **error);
gboolean    thunar_file_is_loaded    (ThunarFile          *file);

ThunarFolder

The ThunarFolder class transparently hides/handles loading the contents of a directory as well as monitoring a directory. The API has no references to ThunarVFS. However, ThunarVFS is used almost everywhere in the code of ThunarFolder:

  • ThunarVfsMonitor is used for monitoring the directory for changes
  • ThunarVfsJob is used for loading the files inside the directory via thunar_vfs_listdir()
  • ThunarVfsPath is used in several places

These could possible be replaced with

  • GFileMonitor for monitoring the directory
  • GFileEnumerator for loading the files inside the directory
  • GFile as an equivalent to ThunarVfsPath

However, the constructor should probably be split up from

ThunarFolder *thunar_folder_get_for_file (ThunarFile *file);

into something like this:

ThunarFolder *thunar_folder_new         (ThunarFile          *file);
gboolean      thunar_folder_load        (ThunarFolder        *folder,
                                         GCancellable        *cancellable,
                                         GError             **error); 

If this in combination with the function thunar_folder_get_loading() is not enough, we could add an asynchronous alternative like this:

void          thunar_folder_load_async  (ThunarFolder        *folder,
                                         GCancellable        *cancellable,
                                         GAsyncReadyCallback *callback);
void          thunar_folder_load_finish (ThunarFolder        *folder,
                                         GAsyncResult        *result,
                                         GError             **error);

ThunarIconFactory

Has references to

  • ThunarVfsFileTime
  • ThunarVfsInfo
  • ThunarVfsPath
  • ThunarVfsThumbFactory

ThunarListModel

Has references to

  • ThunarVfsFileMode
  • ThunarVfsFileSize
  • ThunarVfsFileTime
  • ThunarVfsGroup
  • ThunarVfsMimeInfo
  • ThunarVfsUser
  • ThunarVfsVolumeManager

ThunarLocationButton

Has references to

  • ThunarVfsPath

Solution

thunar_location_button_finalize()

Use the new method g_file_list_free() instead of thunar_vfs_path_list_free().

thunar_location_button_drag_data_get()

Use the new method g_file_list_to_string() instead of thunar_vfs_path_list_to_string().

thunar_location_button_drag_data_received()

Use the new method g_file_list_from_string() instead of thunar_vfs_path_list_from_string().

thunar_location_button_drag_leave()

Use the new method g_file_list_free() instead of thunar_vfs_path_list_free().

ThunarLocationButtons

Has references to

  • ThunarVfsMimeDatabase
  • ThunarVfsMimeInfo
  • ThunarVfsPath

Solution

thunar_location_buttons_action_create_folder()

Pass the content type “inode/directory” to thunar_show_create_dialog() instead of ThunarVfsMimeInfo.

Use g_file_resolve_relative_path() instead of thunar_vfs_path_relative().

ThunarLocationEntry

Has references to

  • ThunarVfsVolume

ThunarMetaFile

Has references to

  • ThunarVfsPath

Solution

thunar_metafile_fetch()

Use g_file_get_uri_scheme() instead of thunar_vfs_path_get_scheme() and perform a string comparison with “file”. Use g_file_get_string() and g_file_get_uri() instead of thunar_vfs_path_to_string() and thunar_vfs_path_to_uri().

thunar_metafile_store()

See thunar_metafile_fetch().

ThunarPathEntry

Has references to

  • ThunarVfsPath

Solution

thunar_path_entry_drag_data_get()

Use new method g_file_list_to_string() instead of thunar_vfs_path_list_to_string().

thunar_path_entry_changed()

Add new method g_file_new_from_string() to thunar-glib-extensions.c which creates a GFile based on a string. The string can be a URI or an absolute or relative path.

Replace thunar_path_entry_parse() with a new implementation that takes a string and returns folder and file part for a URI or an absolute/relative path.

Rework thunar_path_entry_changed() based on this.

thunar_path_entry_parse()

See thunar_path_entry_changed().

thunar_path_entry_set_current_file()

Use g_file_get_uri_scheme() instead of thunar_vfs_path_get_scheme(). And g_file_get_uri() instead of thunar_vfs_path_dup_string().

ThunarPermissionsChooser

Has references to

  • ThunarVfsFileMode
  • ThunarVfsGroup
  • ThunarVfsGroupId
  • ThunarVfsJob
  • ThunarVfsJobResponse
  • ThunarVfsUser
  • ThunarVfsUserManager

Solution

thunar_permissions_chooser_finalize()

Call thunar_job_cancel() instead of thunar_vfs_job_cancel().

thunar_permissions_chooser_change_group()

Use ThunarJob instead of ThunarVfsJob. Initialize the job like this:

job = thunar_job_new_change_group (thunar_file_get_path (chooser->file), gid, recursive);
thunar_permissions_chooser_change_mode()

Use ThunarJob instead of ThunarVfsJob. Initialize the job like this:

job = thunar_job_new_change_mode (thunar_file_get_path (chooser->file), 
                                  dir_mask, dir_mode, file_mask, file_mode, recursive);
group_compare()

Use ThunarGroup or ThunarxGroup instead of ThunarVfsGroup.

thunar_permissions_chooser_file_changed()

Use ThunarUserManager or ThunarxUserManager instead of ThunarVfsUserManager. Same goes for ThunarVfsUser and ThunarVfsGroup.

thunar_permissions_chooser_fixperm_clicked()

Rename ThunarVfsFileMode to ThunarFileMode or something similar. Use ThunarJob instead of ThunarVfsJob. Instead of thunar_vfs_change_mode() use thunar_job_new_change_mode() as in thunar_permissions_chooser_change_mode().

thunar_permissions_chooser_job_ask()

Use ThunarJobResponse instead of ThunarVfsJobResponse.

thunar_permissions_chooser_job_cancel()

Call thunar_job_cancel() instead of thunar_vfs_job_cancel().

thunar_permissions_chooser_job_error()

Use ThunarJob instead of ThunarVfsJob.

thunar_permissions_chooser_job_finished()

Use ThunarJob instead of ThunarVfsJob.

thunar_permissions_chooser_job_percent()

Use ThunarJob instead of ThunarVfsJob.

thunar_permissions_chooser_job_start()

Use ThunarJob instead of ThunarVfsJob.

ThunarPreferencesDialog

Has references to

  • ThunarVfsVolumeManager

ThunarProgressDialog

Has references to

  • ThunarVfsInfo
  • ThunarVfsJob
  • ThunarVfsJobResponse

Solution

Rewrite the progress dialog. A shared dialog as presented here would be nice (with a little more control e.g. via cancel buttons).

ThunarPropertiesDialog

Has references to

  • ThunarVfsFileSize
  • ThunarVfsMimeInfo
  • ThunarVfsVolume
  • ThunarVfsVolumeManager

ThunarRenamerDialog

Has references to

  • ThunarVfsPath

Solution

thunar_renamer_dialog_drag_data_received()

Use new methods g_file_list_from_string() and g_object_unref() instead of thunar_vfs_path_list_from_string() and thunar_vfs_path_unref().

ThunarRenamerModel

Has references to

  • ThunarVfsInfo
  • ThunarVfsPath

Solution

ThunarRenamerModelItem

Change ThunarVfsInfo to GFileInfo.

thunar_renamer_model_file_changed()

Don't check with thunar_vfs_info_matches() whether the file infos match or not. Just copy the info from file into item→info. That way we don't need to call thunar_vfs_info_ref (thunar_file_get_info (file)) either.

trm_same_directory()

Use GFile instead of ThunarVfsPath and g_file_get_parent (thunar_file_get_path (…)) instead of thunar_vfs_path_get_parent (thunar_file_get_path (…)). Return the result of g_file_equal (parent_a, parent_b).

thunar_renamer_model_item_new()

Use g_object_ref() instead of thunar_vfs_info_ref() as thunar_file_get_info() returns a GFileInfo instead of a ThunarVfsInfo now.

thunar_renamer_model_item_free()

Use g_object_unref() instead of thunar_vfs_info_unref().

ThunarShortcutsIconRenderer

Has references to

  • ThunarVfsVolume

Solution

ThunarShortcutsIconRenderer

Replace the ThunarVfsVolume with GVolume. Change the “volume” property according to this.

thunar_shortcuts_icon_renderer_render()

Use g_volume_get_icon() instead of thunar_vfs_volume_lookup_icon_name(). Use g_volume_get_mount() != NULL instead of thunar_vfs_volume_is_mounted().

ThunarShortcutsModel

Has references to

  • ThunarVfsPath
  • ThunarVfsVolume
  • ThunarVfsVolumeManager

ThunarShortcutsView

Has references to

  • ThunarVfsPath
  • ThunarVfsVolume

ThunarSizeLabel

Has references to

  • ThunarVfsFileSize
  • ThunarVfsJob

Solution

ThunarSizeLabel

Replace the ThunarVfsJob member with ThunarJob.

thunar_size_label_finalize()

Call thunar_job_cancel() instead of thunar_vfs_job_cancel().

thunar_size_label_button_press_event()

Call thunar_job_cancel() instead of thunar_vfs_job_cancel().

thunar_size_label_file_changed()

Call thunar_job_cancel() instead of thunar_vfs_job_cancel(). Initialize the job using

size_label->job = thunar_deep_count_job_new (thunar_file_get_path (file), 
                                             G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS);

Use this job for files and directories. We can get rid of lines 408-433 then.

thunar_size_label_status_ready()

Use the new function g_humanize_size() instead of thunar_vfs_humanize_size().

thunar_size_label_error(), thunar_size_label_finished(), thunar_size_label_status_ready()

Use ThunarJob/ThunarDeepCountJob instead of ThunarVfsJob. Use the new function g_humanize_size() instead of thunar_vfs_humanize_size().

ThunarStandardView

Has references to

  • ThunarVfsInfo
  • ThunarVfsMimeInfo
  • ThunarVfsMonitor
  • ThunarVfsPath

Solution

thunar_standard_view_action_create_empty_file()

Create the fake path list with g_file_resolve_relative_path() and free the path using g_object_unref() instead of thunar_vfs_path_unref().

Change the usage of thunar_application_creat() to match the changes in ThunarApplication.

thunar_standard_view_action_create_folder()

See thunar_standard_view_action_create_empty_file().

thunar_standard_view_action_create_template()

Replace const ThunarVfsInfo *info in the function signature to const GFileInfo *info or maybe even const ThunarFile *file because we need the path information. Create the source and target path lists using GFile instead of ThunarVfsPath.

Change the usage of thunar_application_copy_to() to match the changes in ThunarApplication.

thunar_standard_view_action_duplicate()

Change the usage of thunar_application_copy_into() to match the changes in ThunarApplication. Replace thunar_vfs_path_list_free() with the new g_file_list_free() function from thunar-glib-extensions.c.

thunar_standard_view_action_make_link()

Change the usage of thunar_application_link_into() to match the changes in ThunarApplication. Replace thunar_vfs_path_list_free() with the new g_file_list_free() function from thunar-glib-extensions.c.

thunar_standard_view_new_files()

Use new function g_file_list_free() instead of thunar_vfs_path_list_free() and g_file_list_copy() (or maybe call it g_file_list_dup()?) instead of thunar_vfs_path_list_copy().

tsv_reload_directory()

Replace thunar_vfs_path_new() with g_file_new_for_uri(). Since there is no singleton monitor anymore, we either have to obtain the corresponding ThunarFile and call thunar_file_monitor_file_changed() instead of thunar_vfs_monitor_feed(). Or we have to figure out a completely different way to reload the directory which doesn't use a fake monitor event.

thunar_standard_view_drag_leave()

Replace thunar_vfs_path_list_free() with g_file_list_free().

thunar_standard_view_drag_begin()

Replace thunar_vfs_path_list_free() with g_file_list_free().

thunar_standard_view_drag_data_get()

Use g_file_list_to_string() instead of thunar_vfs_path_list_to_string().

thunar_standard_view_drag_end()

Use g_file_list_free() instead of thunar_vfs_path_list_free().

thunar_standard_view_finalize()

Use g_file_list_free() instead of thunar_vfs_path_list_free().

thunar_standard_view_set_loading()

Use g_file_list_free() instead of thunar_vfs_path_list_free().

ThunarTemplatesAction

Has references to

  • ThunarVfsInfo
  • ThunarVfsMimeInfo
  • ThunarVfsPath

Solution

This has to be rewritten around a new job to generate the template actions menu. This job could either be a ThunarSimpleJob or a new job type called ThunarLoadTemplatesJob (with a “new-template” signal).

ThunarThumbnailGenerator

Has references to

  • ThunarVfsInfo
  • ThunarVfsThumbFactory

Solution

ThunarThumbnailGenerator

Use ThunarThumbnailFactory instead of ThunarVfsThumbFactory.

ThunarThumbnailInfo

Remove the ThunarVfsInfo member.

thunar_thumbnail_generator_thread()

Use thunar_thumbnail_factory_generate_thumbnail() and thunar_thumbnail_factory_store_thumbnail() instead of thunar_vfs_thumb_factory_generate_thumbnail() and thunar_vfs_thumb_factory_store_thumbnail().

Instead of the ThunarVfsInfo pass the ThunarFile to the factory functions.

thunar_thumbnail_info_free()

No need to free the ThunarVfsInfo anymore.

thunar_thumbnail_generator_enqueue()

Remove all the ThunarVfsInfo code.

ThunarTrashAction

Has references to

  • ThunarVfsPath
thunar_trash_action_init()

Use g_file_new_for_uri (“trash:”) (plus two slashes) and g_object_unref() instead of thunar_vfs_path_get_for_trash() and thunar_vfs_path_unref().

ThunarTreeModel

Has references to

  • ThunarVfsVolume
  • ThunarVfsVolumeManager
  • ThunarVfsPath

Solution

thunar_tree_model_init()

Use new methods g_file_new_for_home() instead of thunar_vfs_path_get_for_home(), g_file_new_for_trash() instead of thunar_vfs_path_get_for_trash() and g_file_new_for_root() instead of thunar_vfs_path_get_for_root().

Use GVolumeMonitor instead of ThunarVfsVolumeManager and connect to the “volume-added”, “volume-removed” and “volume-changed” signals. Maybe we also need “drive-added” etc.

Use g_object_unref() instead of thunar_vfs_path_unref().

Use g_volume_monitor_get_volumes() instead of thunar_vfs_volume_manager_get_volumes() and call thunar_tree_model_volume_added() for each of the returned volumes.

thunar_tree_model_get_value()

Use g_volume_get_name() instead of thunar_vfs_volume_get_name().

thunar_tree_model_volume_changed()

There doesn't seem to be a direct equivalent to thunar_vfs_volume_is_present(). Figure out how to determine whether a volume is present or not. Use g_volume_can_eject() instead of thunar_vfs_volume_is_removable().

Use g_volume_get_mount() != NULL instead of thunar_vfs_volume_is_mounted(). Use a combination of g_volume_get_mount() and g_volume_get_root() instead of thunar_vfs_volume_get_mount_point().

thunar_tree_model_item_new_with_volume()

Use g_volume_get_mount() instead of thunar_vfs_volume_is_mounted(). Use a combination of g_volume_get_mount() and g_volume_get_root() instead of thunar_vfs_volume_get_mount_point().

thunar_tree_model_item_load_idle()

See thunar_tree_model_item_new_with_volume().

ThunarTreeView

Has references to

  • ThunarVfsJob
  • ThunarVfsMimeDatabase
  • ThunarVfsMimeInfo
  • ThunarVfsPath
  • ThunarVfsVolume

Solution

thunar_tree_view_finalize()

Call g_file_list_free() instead of thunar_vfs_path_list_free().

thunar_tree_view_drag_data_received()

Use new method g_file_list_from_string() instead of thunar_vfs_path_list_from_string().

thunar_tree_view_drag_leave()

Use g_file_list_free() instead of thunar_vfs_path_list_free().

thunar_tree_view_test_expand_row()

We need to replace this function with something else: assume that every node can be expanded unless it is a file. Mounting happens asynchonously, so we'll need a to find a way to expand the tree asynchronously as well.

thunar_tree_view_context_menu()

Use g_volume_get_mount() != NULL instead of thunar_vfs_volume_is_mounted() and g_volume_can_eject() instead of thunar_vfs_volume_is_ejectable().

thunar_tree_view_action_create_folder()

Use g_file_resolve_relative_path() instead of thunar_vfs_path_relative() and g_object_unref() instead of thunar_vfs_path_unref().

thunar_tree_view_action_eject()

Make the function asynchronous and use g_volume_eject()/g_volume_eject_finish() instead of thunar_vfs_volume_eject().

thunar_tree_view_action_mount()

Make the function asynchronous and use g_volume_mount()/g_volume_mount_finish() instead of thunar_vfs_volume_mount().

thunar_tree_view_action_unmount()

There's no such thing as unmounting for volumes, so remove this one.

ThunarWindow

Has references to

  • ThunarVfsPath
  • ThunarVfsVolume
  • ThunarVfsVolumeManager

Solution

thunar_window_init()

Use GVolumeMonitor instead of ThunarVfsVolumeManager. Connect to “mount-pre-unmount” instead of “volume-pre-unmount”.

thunar_window_action_open_trash()

We'll have to mount the trash unless it was mounted before, so we probably have to make this function asynchronous.

thunar_window_current_directory_destroy()

Rewrite this function to detect the first still mounted parent properly, based on g_volume_get_mount(), g_mount_get_root() and g_file_get_parent().

thunar_window_volume_pre_unmount()

Use g_volume_get_mount() and g_mount_get_root() instead of thunar_vfs_volume_get_mount_point(). Maybe g_file_find_enclosing_mount() is also helpful here.

main.c

Has references to

  • thunar_vfs_init()
  • thunar_vfs_shutdown()

Solution

Make sure to setup GIO correctly by following these steps:

  1. Call g_desktop_app_info_set_desktop_env(“XFCE”) before anything else
  2. More?

thunar-util.c

Has references to

  • ThunarVfsFileTime
Solution

Use guint64 here.

Thunarx

Thunarx has a few references to ThunarVFS in ThunarxFileInfo which have to be replaced with GIO equivalents:

  • ThunarVfsInfo *thunarx_file_info_get_vfs_info (ThunarxFileInfo *file_info)
  • ThunarVfsInfo *(*get_vfs_info) (ThunarxFileInfo *file_info) in ThunarxFileInfoIface

Thunar Extensions

There is a number of extensions for Thunar, like

Most of them have references to ThunarVFS or rely on ThunarVFS to work (as is the case with thumbnailers which don't support GIO).

Thunar Volume Manager

thunar-volman uses ThunarVFS everywhere and will have to be ported to GIO as well.

 
preparation/thunar-vfs-references.txt · Last modified: 2009/04/15 00:49 by jannis
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki