GNOME Bugzilla – Bug 104072
Nautilus context menu for 'rb'
Last modified: 2004-12-22 21:47:04 UTC
Just found this document .. "http://cvs.gnome.org/lxr/source/nautilus/docs/nautilus-context-menus.txt" Using this and the 'file-roller' component, it should be possible to build this functionality into the 'rb' source. I'll look at it tonite!
Attached is the first step in getting this working. Unzip to create the component directory, and then apply the addition patch to get the component to build. This adds the context menu option into Nautilus when right-clicking on a mp3/off file. The actual starting of rb and adding the file(s) is not there yet.
Created attachment 13725 [details] Unzip and create a component directory.
Created attachment 13726 [details] [review] Patch to the Makefile / configure files.
Created attachment 13728 [details] Replacement code for the component subfolders.
The code in the latest tar file registers the component, so that the option is on the context menu, and will call 'rb'. It still needs work to actually get the file to be added. Will look at this tomorrow.
Created attachment 13735 [details] Replacement for the component subfolder.
Latest version of the additions. This actually adds the selected files to the Rhythmbox library. Also changed the string in the context-menu to say "Add To Music Player Library...".
Cool. :) Sorry I did not reply earlier, I've been a bit busy... but I will look at it soonish.
For the 2.2 version of Nautilus, the api has changed. The following changes will need to be made .. Before .. // Try the old version of the code, in case Nautilus is still old! list = (CORBA_sequence_CORBA_string *)args; /* New Nautilus version after API changes ... */ // if (!CORBA_TypeCode_equivalent (args->_type, TC_CORBA_sequence_CORBA_string, ev)) // { // return; // } // list = (CORBA_sequence_CORBA_string *)args->_value; Needs to be ... if (!CORBA_TypeCode_equivalent (args->_type, TC_CORBA_sequence_CORBA_string, ev)) { return; } list = (CORBA_sequence_CORBA_string *)args->_value; This should fix an issue with Nautilus freezing and having to be killed!
Could this patch also go into the 0.4.4.99 branch?
Started looking at this again, and have 4 problems, a) the nautilus component crashes due to a free on an unallocated buffer b) Its Nautilus version specific - the API has changed, but most people should be on the new version by now c) It doesn't seem to work! The application is started, but the file to be added is not passed. d) The addFile mechanism in Rhythmbox doesn't work as before, and even when the command is typed at the command line, the file is not added. This is a different problem to (c)
(a) Solved and fixed (b) Solved and fixed (c) ??? (d) Working on reintoducing this mechanism.
(d) It works, I was being stupid! This just leaves (c)!
(c) Solved.
Created attachment 16427 [details] [review] Patch to get the component subdir built
Created attachment 16428 [details] Untar to give a 'component' subdir
Created attachment 16429 [details] Replace component/Makefile.am with this, and it will build properly
This should do a CORBA call, rather than spawn a process - as suggested by Yann Rouillard. Will work on a patch with him!
Created attachment 18598 [details] Nautilus context menu using corba call
I attached my code with old commented codes removed. I investigated the crash which happens when using the context menu with Rhythmbox not launched. What happens is that bonobo-activation laucnh with rhythmbox with the following arguments: rhythmbox --oaf-activate-iid=OAFIID:GNOME_Rhythmbox_Factory --oaf-ior-fd=20 which raises the following error: ** ERROR **: This process has not registered the required OAFIID your source code should register 'OAFIID:GNOME_Rhythmbox_Factory'. If your code is performing delayed registration and this message is trapped in error, see bonobo_activation_idle_reg_check_set. Indeed Rhythmbox never registers "OAFIID:GNOME_Rhythmbox_Factory", it registers "OAFIID:GNOME_Rhythmbox" instead, I tried to change this behaviour as a result Rhythmbox is launched without crashing but files are not added anymore to the library (I suppose that the Corba interface isn't registered anymore). I think me (or Rhythmbox) must not corba/bonobo things correctly but I don't understand bonobo enough to understand.
Yann, I'm going to try and get your patch integrated with the layout of my patch, so we can see whether your problem is something in the build mechanism or an issue with 'rb'.
Concerning the mime types, we should use the generic audio mime types because Rhythmbox is potentially able to support more mime type than just ogg, mp3 and wav. <oaf_attribute name="bonobo:supported_mime_types" type="stringv"> <item value="x-directory/normal"/> <item value="audio/*"/> <item value="application/x-ogg"/> <item value="application/ogg"/> </oaf_attribute>
Having patched my code to do your corba activation, I get the same errors as you did.... ** ERROR **: This process has not registered the required OAFIID your source code should register 'OAFIID:GNOME_Rhythmbox_Factory'. If your code is performing delayed registration and this message is trapped in error, see bonobo_activation_idle_reg_check_set. So something is up with the corba registration.
I ad a look a Gedit code and it register the factory OAFIID at the beginning so I think this is correct behaviour I changed this in rhythmbox but I get segfault. The rb_library_add_uri is called but the library argument is NULL !
Created attachment 18623 [details] A tiny patch to have the contexy menu working correctly
That works for me! I get a crash on exit, but I get that whatever happens. If you roll all the patches together, then we should push for this to be applied.
Created attachment 18801 [details] This archive contains the context menu code source (in component subdirectory) and the pach to apply to have the context menu compiling and working.
This patch has been applied in CVS. Thanks!