Xfce Wiki

Sub domains
 

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dev:xfdesktop:port-to-gio [2010/09/12 16:55] jannisdev:xfdesktop:port-to-gio [2010/10/17 13:10] (current) 217.229.117.83
Line 40: Line 40:
  
 Make the interface method ''peek_info'' return a ''GFileInfo''. Make the interface method ''peek_info'' return a ''GFileInfo''.
- 
 ==== xfdesktop-file-icon-manager.{c,h} ==== ==== xfdesktop-file-icon-manager.{c,h} ====
  
Line 182: Line 181:
 === xfdesktop_file_icon_manager_add_removable_volume() === === xfdesktop_file_icon_manager_add_removable_volume() ===
  
-TODO+The calls to ''thunar_vfs_is_removable()'' and ''thunar_vfs_volume_is_present()'' 
 +need to be replaced with something similar based on ''GVolume''. Thunar has the 
 +same problem solved with this code: 
 + 
 +  * http://git.xfce.org/xfce/thunar/tree/thunar/thunar-gio-extensions.c#n389 
 +  * http://git.xfce.org/xfce/thunar/tree/thunar/thunar-gio-extensions.c#n455
  
 === xfdesktop_file_icon_manager_volumes_added() === === xfdesktop_file_icon_manager_volumes_added() ===
  
-TODO+This will be replaced with a handler for the ''volume-added'' signal of  
 +''GVolumeMonitor'' which should call  
 +''xfdesktop_file_icon_manager_add_removable_volume()'' as well.
  
 === xfdesktop_file_icon_manager_volumes_removed() === === xfdesktop_file_icon_manager_volumes_removed() ===
  
-TODO+Similar to the previous function, this one should be replaced with one 
 +that handles a single ''GVolume'' volume only.
  
 === xfdesktop_file_icon_manager_load_removable_media() === === xfdesktop_file_icon_manager_load_removable_media() ===
  
-TODO+Use the ''GVolumeMonitor'' here and connect to the right signals.  
 +We'll need new callbacks for some of them.
  
 === xfdesktop_file_icon_manager_remove_removable_media() === === xfdesktop_file_icon_manager_remove_removable_media() ===
  
-TODO+Needs to iterate over the volumes hash table, disconnect from all 
 +returned volumes, destroy all volume icons and disconnect from the 
 +''GVolumeMonitor''.
  
 === xfdesktop_file_icon_manager_real_init() === === xfdesktop_file_icon_manager_real_init() ===
  
-TODO+Get rid of the ''ThunarVfsMimeDatabase'' and the global ''ThunarVfsVolumeManager''
 +The hash table needs to use either URIs or ''GFile'' as well as the right hash 
 +and equal functions for them. URIs are easier due to the availability of string 
 +hash and equal functions, I guess. 
 + 
 +We'll have to change the ''ThunarVfsInfo'' parameter of ''xfdesktop_regular_file_icon_new()'' 
 +to a ''GFile'' or ''GFileInfo''. We can use ''g_file_new_for_path()'' instead of  
 +''thunar_vfs_info_new_for_path()'' here when creating the ''GFile'' for the desktop folder, 
 +if the ''folder'' member isn't a ''GFile'' already.
  
 === xfdesktop_file_icon_manager_fini() === === xfdesktop_file_icon_manager_fini() ===
  
-TODO+The counterpart to the previous function. Same deal.
  
 === xfdesktop_file_icon_manager_drag_drop() === === xfdesktop_file_icon_manager_drag_drop() ===
  
-TODO+Use '''xfdesktop_file_icon_peek_file()'' instead of ''..._peek_info()''. The file type 
 +can then be determined with ''g_file_query_file_type()''.  
 + 
 +Use ''g_file_get_child()'' instead of ''thunar_vfs_path_relative()'' and ''g_file_get_uri()'' 
 +instead of ''thunar_vfs_path_dup_uri()''.
  
 === xfdesktop_file_icon_manager_drag_data_received() === === xfdesktop_file_icon_manager_drag_data_received() ===
  
-TODO+Use ''..._peek_file()'' **and** ''..._peek_info()'' (we need both this time around) and  
 +''GFile'' functions instead of ''ThunarVfsPath''. To convert the string list into a list 
 +of ''GFile'' objects, we can use something similar to Thunar's solution: 
 + 
 +  * http://git.xfce.org/xfce/thunar/tree/thunar/thunar-gio-extensions.c#n262 
 + 
 +We'll need a bit of custom code to execute the executable target file with the dropped 
 +files as parameters. There are two possibilities: either the target is a desktop entry, 
 +then we can parse it into a ''GDesktopAppInfo'', or it is a regular executable file,  
 +then we can simply spawn it (make sure to pass the file parameters and implement startup 
 +notification). 
 + 
 +The code block dealing with jobs needs to be reworked around ''GFile'', ''GFileInfo'' 
 +and the Thunar D-Bus API completely. Maybe danielm's branch implements this already?
  
 === xfdesktop_file_icon_manager_drag_data_get() === === xfdesktop_file_icon_manager_drag_data_get() ===
  
-TODO+We need to replace ''xfdesktop_file_utils_file_icon_list_to_path_list()'' with something 
 +like ''xfdesktop_file_utils_file_icon_list_to_g_file_list()'' and then call  
 +''g_file_list_to_string()'' instead of ''thunar_vfs_path_list_to_string()''. Again, 
 +Thunar can serve as an inspiration here: 
 + 
 +  * http://git.xfce.org/xfce/thunar/tree/thunar/thunar-gio-extensions.c#n295
  
 === xfdesktop_file_icon_manager_new() === === xfdesktop_file_icon_manager_new() ===
  
-TODO+Change the ''ThunarVfsPath'' parameter to a ''GFile''. That's all.
  
 === _XfdesktopFileIconManagerPrivate === === _XfdesktopFileIconManagerPrivate ===
  
-TODO+Change the ''ThunarVfsPath'' folder member to a ''GFile''.  
 + 
 +Replace the ''ThunarVfsMonitor'' with a ''GVolumeMonitor'' and remove  
 +the ''ThunarVfsMonitorHandle''
 + 
 +Remove the ''ThunarVfsJob *list_job'' member.
  
 === xfdesktop_file_icon_manager_class_init() === === xfdesktop_file_icon_manager_class_init() ===
  
-TODO+Alter the "folder" property so that it becomes an object property  
 +using the ''G_TYPE_FILE'' object type.
  
 === xfdesktop_file_icon_manager_set_property() === === xfdesktop_file_icon_manager_set_property() ===
  
-TODO+Change the "folder" property code to reflect the changes to the property 
 +type made in the class_init function.
  
 === xfdesktop_file_icon_manager_get_property() === === xfdesktop_file_icon_manager_get_property() ===
  
-TODO+Same here, see above.
  
 === xfdesktop_file_icon_manager_finalize() === === xfdesktop_file_icon_manager_finalize() ===
  
-TODO+Use ''g_object_unref()'' instead of ''thunar_vfs_path_unref()''.
  
 === xfdesktop_file_icon_manager_check_create_desktop_folder() === === xfdesktop_file_icon_manager_check_create_desktop_folder() ===
 +
 +Replace the code with something similar based on ''GFile'', ''g_file_query_exists()'',
 +''g_file_query_file_type()'' and ''g_file_make_directory()''.
 +
 +==== xfdesktop-file-properties-dialog.{c,h} ====
 +
 +Remove entirely. We'll re-use Thunar's properties dialog via its D-Bus API.
 +==== xfdesktop-file-utils.{c,h} ====
 +
 +=== xfdesktop_file_utils_interactive_job_ask() ===
 +
 +Remove. We'll no longer implement anything job-related in xfdesktop itself.
 +
 +=== xfdesktop_file_utils_handle_fileop_error() ===
 +
 +Remove as well.
 +
 +=== xfdesktop_file_utils_get_file_kind() ===
 +
 +If this is still needed after refactoring, then make it take a ''GFileInfo''
 +and rewrite the checks based on ''GFileInfo'' attributes.
 +
 +=== xfdesktop_file_utils_file_icon_list_to_path_list() ===
 +
 +Replace with a function called ''xfdesktop_file_utils_file_icon_list_to_g_file_list()''
 +that creates a list of ''GFile'' objects.
 +
 +=== xfdesktop_file_utils_get_fallback_icon() ===
 +
 +No longer needed, remove. ''g_file_info_get_icon()'' always returns a valid ''GIcon''.
 +
 +=== xfdesktop_file_utils_get_file_icon() ===
 +
 +We have two options here: either remove and use ''g_file_info_get_icon()'' or make it
 +load and return a ''GdkPixbuf'' from the ''GIcon''
 +
 +TODO We'll have to investigate where ''xfdesktop_file_utils_get_file_icon()'' is 
 +being used and how.
 +
 +=== xfdesktop_file_utils_launch_fallback() ===
 +
 +Remove. We don't use a D-Bus fallback here as we rely on the D-Bus API of Thunar so
 +hard that we can't provide any real functionality without it anyway.
 +
 +=== xfdesktop_file_utils_display_folder_cb() ===
 +
 +Remove fallback code.
 +==== xfdesktop-regular-file-icon.{c,h} ====
 +
 +=== _XfdesktopRegularFileIconPrivate ===
 +
 +Replace the ''ThunarVfsInfo *info'' member with ''GFile'' and ''GFileInfo'' members.
 +
 +=== xfdesktop_regular_file_icon_peek_info() ===
 +
 +Return a ''GFileInfo''.
 +
 +=== xfdesktop_regular_file_icon_update_info() ===
 +
 +TODO: Replace the ''ThunarVfsInfo'' parameter with ''GFileInfo''. Maybe we also need
 +to add a ''GFile'' parameter because ''GFileInfo'' contains no path information.
 +
 +=== xfdesktop_delete_regular_file_finished() ===
 +
 +Remove.
 +
 +=== xfdesktop_regular_file_icon_finalize() ===
 +
 +Call ''g_object_unref()'' instead of ''thunar_vfs_info_unref()''. Also release the
 +new ''GFile'' member.
 +
 +=== xfdesktop_regular_file_icon_tfi_init() ===
 +
 +Update this to Thunarx 2. Need to set ''iface->get_file_info'', ''iface->get_filesystem_info''
 +and ''iface->get_location''.
 +
 +=== xfdesktop_regular_file_icon_peek_pixbuf() ===
 +
 +Need to rewrite this to make use of ''g_file_get_icon()'' and tumbler. Maybe a new thumbnailer
 +or icon factory class like in thunar could be introduced.
 +
 +=== xfdesktop_regular_file_icon_get_allowed_drag_actions() ===
 +
 +Use ''GFileInfo'' instead of ''ThunarVfsInfo''. Instead of ''ThunarVfsInfo'' flags we have
 +to query ''GFileInfo'' attributes to determine the readable/writable state of the target icon.
 +
 +=== xfdesktop_regular_file_icon_get_allowed_drop_actions() ===
 +
 +See the previous function.
 +
 +=== xfdesktop_regular_file_icon_drag_job_error() ===
 +
 +I don't think we need this any longer. Thunar will display errors for us.
 +
 +=== xfdesktop_regular_file_icon_interactive_job_ask() ===
 +
 +Remove.
 +
 +=== xfdesktop_regular_file_icon_drag_job_finished() ===
 +
 +Remove.
 +
 +=== xfdesktop_regular_file_icon_do_drop_dest() ===
 +
 +Rewrite the code based on ''GFileInfo'' and ''GFile''. Use the Thunar D-Bus API
 +to launch executable files. Use a NULL check with ''g_file_get_parent()'' to
 +replace the call to ''thunar_vfs_path_is_root()''. Instead of ''thunar_vfs_move_file()'',
 +''thunar_vfs_copy_file()'' etc. use the Thunar D-Bus API.
 +
 +Instead of implement the Thunar D-Bus client manually we could rely on code
 +generation.
 +
 +=== xfdesktop_regular_file_icon_peek_tooltip() ===
 +
 +What we need is to read the last modification time, the file type and a human readable
 +version of the size of the file. There are attributes for the modification time, the
 +file type and the file size in ''GFileInfo''. To humanize the file time we can use
 +something similar to [[http://git.xfce.org/xfce/thunar/tree/thunar/thunar-util.c#n140|what Thunar is doing]],
 +for the file size we can use ''g_format_size_for_display()''.
 +
 +=== xfdesktop_regular_file_can_write_parent() ===
 +
 +Here we can simply rewrite the code to use ''GFile'' and ''GFileInfo''.
 +
 +=== xfdesktop_delete_file_error() ===
 +
 +Remove.
 +
 +=== xfdesktop_delete_file_finished() ===
 +
 +Remove.
 +
 +=== xfdesktop_regular_file_icon_delete_file() ===
 +
 +Instead of ''thunar_vfs_unlink_file()'', use the Thunar D-Bus API here. Fire
 +and forget.
 +
 +=== xfdesktop_regular_file_icon_rename_file() ===
 +
 +See previous function.
 +
 +=== xfdesktop_regular_file_icon_peek_info() ===
 +
 +Change the return type to ''GFileInfo''.
 +
 +=== xfdesktop_regular_file_icon_update_info() ===
 +
 +TODO: Check how and where this function is being used and what we can do in order
 +to replace the ''ThunarVfsInfo'' parameter.
 +
 +=== xfdesktop_regular_file_icon_new() ===
 +
 +Add a ''GFile'' parameter, update the code to use ''g_object_ref()'' instead of
 +''thunar_vfs_info_ref()''.
 +
 +==== xfdesktop_special_file_icon.{c,h} ====
 +
 +=== _XfdesktopSpecialFileIconPrivate ===
 +
 +TODO
 +
 +=== xfdesktop_special_file_icon_finalize() ===
 +
 +TODO
 +
 +=== xfdesktop_special_file_icon_tfi_init() ===
 +
 +TODO
 +
 +=== xfdesktop_special_file_icon_get_allowed_drag_actions() ===
 +
 +TODO: we no longer need the thunar-vfs workaround I think.
 +
 +=== xfdesktop_special_file_icon_get_allowed_drop_actions() ===
 +
 +TODO
 +
 +=== xfdesktop_special_file_icon_drag_job_error() ===
 +
 +TODO
 +
 +=== xfdesktop_special_file_icon_interactive_job_ask() ===
 +
 +TODO
 +
 +=== xfdesktop_special_file_icon_drag_job_finished() ===
 +
 +TODO
 +
 +=== xfdesktop_special_file_icon_do_drop_dest() ===
 +
 +TODO
 +
 +=== xfdesktop_special_file_icon_peek_tooltip() ===
 +
 +TODO
 +
 +=== xfdesktop_special_file_icon_peek_info() ===
 +
 +TODO
 +
 +=== xfdesktop_special_file_icon_new() ===
 +
 +TODO
 +==== xfdesktop-volume-icon.{c,h} ====
 +
 +=== _XfdesktopVolumeIconPrivate ===
 +
 +TODO
 +
 +=== xfdesktop_volume_icon_finalize() ===
 +
 +TODO
 +
 +=== xfdesktop_volume_icon_tfi_init() ===
 +
 +TODO
 +
 +=== xfdesktop_volume_icon_volume_changed_cb() ===
 +
 +TODO
 +
 +=== xfdesktop_volume_icon_peek_pixbuf() ===
 +
 +TODO
 +
 +=== xfdesktop_volume_icon_peek_label() ===
 +
 +TODO
 +
 +=== xfdesktop_volume_icon_get_allowed_drag_actions() ===
 +
 +TODO
 +
 +=== xfdesktop_volume_icon_get_allowed_drop_actions() ===
 +
 +TODO
 +
 +=== xfdesktop_volume_icon_drag_job_error() ===
 +
 +TODO
 +
 +=== xfdesktop_volume_icon_interactive_job_ask() ===
 +
 +TODO
 +
 +=== xfdesktop_volume_icon_drag_job_finished() ===
 +
 +TODO
 +
 +=== xfdesktop_volume_icon_do_drop_dest() ===
 +
 +TODO
 +
 +=== xfdesktop_volume_icon_peek_tooltip() ===
 +
 +TODO
 +
 +=== xfdesktop_volume_icon_menu_toggle_mount() ===
 +
 +TODO
 +
 +=== xfdesktop_volume_icon_menu_eject() ===
 +
 +TODO
 +
 +=== xfdesktop_volume_icon_populate_context_menu() ===
 +
 +TODO
 +
 +=== xfdesktop_volume_icon_peek_info() ===
 +
 +TODO
 +
 +=== xfdesktop_volume_icon_update_info() ===
 +
 +TODO
 +
 +=== xfdesktop_volume_icon_activated() ===
 +
 +TODO
 +
 +=== xfdesktop_volume_icon_new() ===
 +
 +TODO
 +
 +=== xfdesktop_volume_icon_peek_volume() ===
  
 TODO TODO