mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-27 11:29:24 +00:00
Allow the context menu to supply an icon.
2003-06-08 Dave Camp <dave@ximian.com> * src/file-manager/fm-directory-view.c: (add_bonobo_menu_ui_and_verbs): Allow the context menu to supply an icon.
This commit is contained in:
parent
f9ad144ff8
commit
87cab375fe
|
@ -1,3 +1,9 @@
|
|||
2003-06-08 Dave Camp <dave@ximian.com>
|
||||
|
||||
* src/file-manager/fm-directory-view.c:
|
||||
(add_bonobo_menu_ui_and_verbs): Allow the context menu to supply
|
||||
an icon.
|
||||
|
||||
2003-06-08 Dave Camp <dave@ximian.com>
|
||||
|
||||
* src/file-manager/fm-properties-window.c:
|
||||
|
|
|
@ -27,6 +27,13 @@ Ok, this is how it works:
|
|||
|
||||
<oaf_attribute name="nautilusverb:DoExtract" type="string" _value="Extract To..."/>
|
||||
|
||||
To specify an icon to display next to the context menu, you can
|
||||
specify a nautilusverbicon property:
|
||||
|
||||
<oaf_attribute name="nautilusverbicon:DoExtract" type="string" _value="icon-name"/>
|
||||
|
||||
The icon will be taken from the current icon theme.
|
||||
|
||||
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
|
||||
|
|
|
@ -3698,8 +3698,40 @@ add_bonobo_menu_ui_and_verbs (FMDirectoryView *view, GList *files,
|
|||
/* build the UI */
|
||||
for (l = verb_names; l; l = l->next) {
|
||||
char *verb = l->data;
|
||||
char *icon_attribute_name;
|
||||
const char *icon_name;
|
||||
char *pixbuf_data;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
g_string_append_printf (ui_xml, "<menuitem name=\"%s\" verb=\"%s\"/>", verb, verb);
|
||||
g_string_append_printf (ui_xml,
|
||||
"<menuitem name=\"%s\" verb=\"%s\"",
|
||||
verb, verb);
|
||||
|
||||
icon_attribute_name = g_strdup_printf ("nautilusverbicon:%s",
|
||||
verb);
|
||||
icon_name = bonobo_server_info_prop_lookup (info,
|
||||
icon_attribute_name,
|
||||
langs_cpy);
|
||||
g_free (icon_attribute_name);
|
||||
if (!icon_name) {
|
||||
icon_name = bonobo_server_info_prop_lookup (info, "nautilus:icon",
|
||||
langs_cpy);
|
||||
}
|
||||
|
||||
if (icon_name) {
|
||||
pixbuf = nautilus_icon_factory_get_pixbuf_from_name
|
||||
(icon_name,
|
||||
NULL,
|
||||
NAUTILUS_ICON_SIZE_FOR_MENUS,
|
||||
NULL);
|
||||
if (pixbuf) {
|
||||
pixbuf_data = bonobo_ui_util_pixbuf_to_xml (pixbuf);
|
||||
g_string_append_printf (ui_xml, " pixtype=\"pixbuf\" pixname=\"%s\"", pixbuf_data);
|
||||
g_free (pixbuf_data);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
}
|
||||
g_string_append (ui_xml, "/>");
|
||||
}
|
||||
|
||||
ui_xml = g_string_append (ui_xml, "</placeholder></popup></popups></Root>");
|
||||
|
|
Loading…
Reference in a new issue