Fixed a slight bug in the context menu query code, and added a bit of

2002-11-10  James Willcox  <jwillcox@gnome.org>

	* docs/nautilus-context-menus.txt:
	* libnautilus-private/nautilus-mime-actions.c:
	(nautilus_mime_get_popup_components_for_file):

	Fixed a slight bug in the context menu query code, and added a bit of
	documentation.
This commit is contained in:
James Willcox 2002-11-10 09:13:34 +00:00 committed by James Willcox
parent bd427ade3e
commit d316d57725
3 changed files with 45 additions and 1 deletions

View file

@ -1,3 +1,12 @@
2002-11-10 James Willcox <jwillcox@gnome.org>
* docs/nautilus-context-menus.txt:
* libnautilus-private/nautilus-mime-actions.c:
(nautilus_mime_get_popup_components_for_file):
Fixed a slight bug in the context menu query code, and added a bit of
documentation.
2002-11-09 Dmitry G. Mastrukov <dmitry@taurussoft.org>
* configure.in: Added Belarusian to ALL_LINGUAS

View file

@ -0,0 +1,35 @@
Adding Mime-Type Sensitive Context Menus to Nautilus
November 10, 2002
James Willcox <jwillcox@gnome.org>
Ok, this is how it works:
1) User selects one or more files in the icon or list view
2) Nautilus queries bonobo-activation for all components that have the
following properties:
a) Has an attribute named "nautilus:context_menu_handler", which is
a boolean.
b) Has an attribute named "nautilus:can_handle_multiple_files", which
is also a boolean (I think its meaning is self explanatory)
c) Implements IDL:Bonobo/Listener:1.0
Also, the normal nautilus component selection rules apply here, so it
will look at it bonobo:supported_mime_types,
bonobo:supported_uri_schemes, etc. as well.
3) Then, we look at each component, and find all attributes that start with
"nautilusverb:". The part following the colon will be the event name that
gets passed to Bonobo::Listener::event(). The value of this attribute is
the text that should be displayed in the menu item. So, you might have
something like the following for unpacking an archive:
<oaf_attribute name="nautilusverb:DoExtract" type="string" _value="Extract To..."/>
If the component has "nauitlus:can_handle_multiple_files" set to false,
the item will still be displayed when multiple files are selected, but
it will be insensitive. When the user clicks the menu item, nautilus
activates the component, and invoked Bonobo::Listener::event() on it,
passing the event name and a CORBA sequence of the selected URIs as the
args.

View file

@ -827,7 +827,7 @@ nautilus_mime_get_popup_components_for_file (NautilusFile *file)
item_mime_types = NULL;
}
extra_reqs = "repo_ids.has ('IDL:Bonobo/Listener:1.0') AND (nautilus:context_menu_handler == true)";
extra_reqs = "repo_ids.has ('IDL:Bonobo/Listener:1.0') AND (nautilus:context_menu_handler == true) AND nautilus:can_handle_multiple_files.defined()";
info_list = nautilus_do_component_query (mime_type, uri_scheme,
item_mime_types, FALSE,