GNOME Bugzilla – Bug 516090
Port to gio
Last modified: 2008-08-29 14:32:51 UTC
Gnome-media has gnome-vfs in grecord and the audio profiles dialog. I'm taking a whack to switch them over to gio (and by the looks of it, to the new recent manager stuff as a consequence...).
I have started some work on this front. I am attaching the patch to the audio profiles dialog right now, and am currently working on the do_save_file and fill_in_information functions of grecord/src/gsr-window.c files.
Created attachment 107741 [details] [review] audio profiles port to GIO
Created attachment 107756 [details] [review] grecord window stuff ported to gio I had to write a custom function to format the size of the file to be human-readable, since I did not find anything in glib that does what gnome-vfs's gnome_vfs_format_file_size_for_display function does. A function like that should probably be merged into glib.
excellent, altough I think there is still some todo left, and gnome-vfs is still a dependency: grecord/recent-files/egg-recent-item.c, & gnome_vfs_make_uri_from_shell_arg. Do you have plan to deprecate egg-recent too :)?
That's the idea =).
(In reply to comment #5) > That's the idea =). > note the dependency that I added: bug 404877, there is already some trial patch.
Created attachment 108014 [details] [review] Another version of gio porting (In reply to comment #3) > Created an attachment (id=107756) [edit] > grecord window stuff ported to gio Hrm, I actually had these done already a while ago but got swept away with work stuff and forgot to attach the patches... > I had to write a custom function to format the size of the file to be > human-readable, since I did not find anything in glib that does what > gnome-vfs's gnome_vfs_format_file_size_for_display function does. A function > like that should probably be merged into glib. Already is, it's just not blatantly obvious in the docs: - human = gnome_vfs_format_file_size_for_display (file_size); + human = g_format_size_for_display (file_size); Some comments on this patch: + if (src_gfile && dst_gfile) { From the docs of g_file_new_*(): "Constructs a GFile for a given URI. This operation never fails [...]" so in my opinion there is no point in checking if they failed, the function is guaranteed to always return a valid object. I've changed that if to directly test the result of the copy operation in my patch, which simplifies the code a bit. I'll attach my patch for reference.
Created attachment 108016 [details] [review] Another version of audio profiles gio porting (In reply to comment #2) > Created an attachment (id=107741) [edit] > audio profiles port to GIO > + mime_type_description = g_content_type_get_description (temp_file_name); Does this really work on unix? The content type is supposed to be a platform-specific string (mimetype on unix, suffix on windows), not a file name according to docs. I think the proper way is to use g_content_type_guess() to get the content type and then use that to get the description. And apparently my patch leaks the description so it would need fixing too...
I thought the same, but then I read the code for g_content_type_get_description, and decided it would work. I tried it, and it did. I think your grecord patch is more correct, though, and there's nothing I would change in it, so I'd advocate for your patch being applied. I think my patch for audio-profiles is correct, though, and would be my choice.
ok, just marking the patch as suggested by Gustavo.
*ping* - just asking for progress here to clean up our stack.
*ping*
*ping* - gnome 2.24 is getting close and this should be fixed in advance
(In reply to comment #13) > *ping* - gnome 2.24 is getting close and this should be fixed in advance > Please help to fix bug 404877 then.
2008-08-29 Bastien Nocera <hadess@hadess.net> * configure.in: * profiles/audio-profile-choose.c (gm_audio_profile_choose_new): Patch from Gustavo Noronha <gns@gnome.org> to port the media profiles to use GIO (Helps: #516090)
The patch didn't apply cleanly anymore, was missing a declaration for utf8_name, as well as porting for gnome_vfs_make_uri_from_shell_arg(). 2008-08-29 Bastien Nocera <hadess@hadess.net> * configure.in: Port gnome-sound-recorder to GIO (Helps: #516090) 2008-08-29 Bastien Nocera <hadess@hadess.net> * src/gsr-window.c (do_save_file), (fill_in_information), (play_cb): Port to GIO from gnome-vfs, based on patch by Kalle Vahlman <zuh@iki.fi> (Helps: #516090)
2008-08-29 Bastien Nocera <hadess@hadess.net> * configure.in: Remove last bit of gnome-vfs from the configure (Closes: #516090)