This is an old revision of the document!
xfdesktop: Port to GIO
References to ThunarVFS
main.c
Calls thunar_vfs_init()
and thunar_vfs_shutdown()
. Those calls can be removed.
xfce-desktop.c
xfce_desktop_setup_icon_view()
Use a GFile
instead of a ThunarVfsPath
when creating the file icon manager.
Pass the GFile
to the manager object instead of the ThunarVfsPath
.
xfdesktop-clipboard-manager.c
XfdesktopClipboardPasteRequest
Use a GFile
instead of the ThunarVfsPath
for the target_path
struct member.
xfdesktop_clipboard_manager_get_callback()
Make xfdesktop_file_utils_file_icon_list_to_path_list()
return a list of GFile
objects.
Reuse thunar_g_file_list_to_string()
instead of using thunar_vfs_path_list_to_string()
.
Use g_list_foreach()
and g_list_free()
instead of thunar_vfs_path_list_free()
.
xfdesktop-file-icon.{c,h}
xfdesktop_file_icon_finalize()
There's no need for cancelling jobs if we don't use jobs anymore. Instead we'll use the new D-Bus methods that have been added to Thunar. When using those we can just fire and forget.
xfdesktop_file_icon_activated()
We don't need the file info here. Just launch the file using Thunar's Launch()
D-Bus
method. Add an interface method get_file
and make it return a GFile
. Use this
GFile
to compute the URI to be passed to Launch()
.
Make the interface method peek_info
return a GFileInfo
.
xfdesktop-file-icon-manager.{c,h}
xfdesktop_file_icon_menu_rename()
Use Thunar's Rename()
(or RenameFiles?
) D-Bus method. For this we only
need the GFile
of the icon, not the file info. Use xfdesktop_file_icon_get_file()
instead of xfdesktop_file_icon_peek_info()
.
xfdesktop_file_icon_manager_trash_files()
Again, use xfdesktop_file_icon_get_file()
instead of xfdesktop_file_icon_peek_info()
to obtain the URIs of the files supposed to be trashed.
xfdesktop_file_icon_menu_mime_app_executed()
Use GAppInfo
instead of ThunarVfsMimeApplication
and call g_app_info_launch()
instead of thunar_vfs_mime_handler_exec()
. Make sure to change the working directory
before and after this call (similar to how Thunar does it).
xfdesktop_menu_item_from_mime_handler()
Replace this method with a similar one based on GAppInfo
instead of
ThunarVfsMimeApplication
.
xfdesktop_file_icon_menu_open_folder()
We don't need the ThunarVfsInfo
here. Use xfdesktop_file_icon_get_file()
instead of xfdesktop_file_icon_peek_info()
. Make xfdesktop_file_utils_open_folder()
take a GFile
instead of a ThunarVfsInfo
.
xfdesktop_file_icon_menu_open_desktop()
See the previous function.
xfdesktop_file_icon_menu_other_app()
Again, we only need the GFile
, not the file info, in order to obtain the file URI.
Replace xfdesktop_file_icon_peek_info()
with xfdesktop_file_icon_get_file()
and ThunarVfsInfo
/ThunarVfsPath
with GFile
.
xfdesktop_file_icon_menu_properties()
Again, we only need the GFile
to obtain the URI. Don't use the no-D-Bus-fallback
properties dialog (what's it good for? Thunar should always be running for other
parts of xfdesktop to be working anyway).
xfdesktop_file_icon_create_directory_error()
Remove this function. We'll create directories through the Thunar D-Bus API. We'll probably have to add another D-Bus method for creating directories.
xfdesktop_file_icon_menu_create_launcher()
Use a GFile
instead of the ThunarVfsInfo
and ThunarVfsPath
to obtain
the file URI. Feed exo-desktop-item-edit with the URI instead of a local path.
The function launcher_dialog_item_button_clicked()
in
xfce4-panel/plugins/launcher/launcher-dialog.c has an example of how we can do
this.
xfdesktop_file_icon_menu_create_folder()
Create the directory using a new Thunar D-Bus method instead of implementing
this feature in xfdesktop internally. We'll have to create the D-Bus method
first. It should be called CreateFolder()
or CreateFile()
(with a
type parameter). Need to think about this a bit more.
xfdesktop_file_icon_create_file_error()
Remove this function.
xfdesktop_file_icon_interactive_job_ask()
Remove this function.
xfdesktop_file_icon_template_item_activated()
TODO: This needs more thought. Thunar implements the same functionality, so
maybe we can reuse its implementation through D-Bus. If not, then at least
the ThunarVFS stuff should be replaced with GFile
and GFileInfo
. The
calls to thunar_vfs_copy_file()
and thunar_vfs_create_file()
should
be replaced with Thunar D-Bus method calls.
info_compare()
If this is still needed after the other refactorings, make it compare
GFileInfo
objects instead of ThunarVfsInfo
structs.
xfdesktop_file_icon_menu_fill_template_menu()
Use GFile
, GFileEnumerator
and GFileInfo
instead of the corresponding
ThunarVFS structures. Maybe we can reuse some code from Thunar implementing
the same thing.
xfdesktop_file_icon_manager_populate_context_menu()
Use GFileInfo
instead of ThunarVfsInfo
and GFile
instead of ThunarVfsPath
.
Use GAppInfo
instead of ThunarVfsMimeDatabase
and
ThunarVfsMimeHandler
/ThunarVfsMimeApplication
.
xfdesktop_file_icon_manager_add_icon()
Use GFile
instead of ThunarVfsInfo
.
xfdesktop_file_icon_manager_add_regular_icon()
Use GFileInfo
to query the content type and GFile
instead of
ThunarVfsPath
to query the file path passed to XfceRc
.
xfdesktop_file_icon_manager_add_volume_icon()
Use GVolume
instead of ThunarVfsVolume
.
xfdesktop_file_icon_manager_vfs_monitor_cb()
Replace this with a monitor callback for GFileMonitor
.
xfdesktop_file_icon_manager_listdir_infos_ready_cb()
This function will have to be replaced with something similar because we cannot use the list dir job from ThunarVfsJob anymore.
xfdesktop_file_icon_manager_listdir_finished_cb()
This function will have to be replaced with something similar because we cannot use the list dir job from ThunarVfsJob anymore.
xfdesktop_file_icon_manager_listdir_error_cb()
This function will have to be replaced with something similar because we cannot use the list dir job from ThunarVfsJob anymore.
xfdesktop_file_icon_manager_load_desktop_folder()
Asynchronously load the folder using GFileEnumerator
.
xfdesktop_file_icon_manager_volume_changed()
Replace this function with a similar one based on GVolumeMonitor
.
xfdesktop_file_icon_manager_add_removable_volume()
TODO
xfdesktop_file_icon_manager_volumes_added()
TODO
xfdesktop_file_icon_manager_volumes_removed()
TODO
xfdesktop_file_icon_manager_load_removable_media()
TODO
xfdesktop_file_icon_manager_remove_removable_media()
TODO
xfdesktop_file_icon_manager_real_init()
TODO
xfdesktop_file_icon_manager_fini()
TODO
xfdesktop_file_icon_manager_drag_drop()
TODO
xfdesktop_file_icon_manager_drag_data_received()
TODO
xfdesktop_file_icon_manager_drag_data_get()
TODO
xfdesktop_file_icon_manager_new()
TODO
_XfdesktopFileIconManagerPrivate
TODO
xfdesktop_file_icon_manager_class_init()
TODO
xfdesktop_file_icon_manager_set_property()
TODO
xfdesktop_file_icon_manager_get_property()
TODO
xfdesktop_file_icon_manager_finalize()
TODO
xfdesktop_file_icon_manager_check_create_desktop_folder()
TODO