Commit 0fa8919f authored by David Emory Watson's avatar David Emory Watson

Allow submenus to have pixbufs.

* libnautilus-private/nautilus-bonobo-extensions.c:
(nautilus_bonobo_add_submenu): Allow submenus to have pixbufs.

* libnautilus-private/nautilus-bonobo-extensions.h: Add pixbuf argument
to prototype for nautilus_bonobo_add_submenu ()

* src/nautilus-window-menus.c:
(create_menu_item_from_node): Make reference to
nautilus_bonobo_add_submenu conform to new prototype.

* src/file-manager/fm-directory-view.c
(add_submenu): Make reference to nautilus_bonobo_add_submenu conform to
new prototype and remove FIXME.
parent c94e1063
......@@ -369,17 +369,25 @@ nautilus_bonobo_add_numbered_radio_menu_item (BonoboUIComponent *ui,
void
nautilus_bonobo_add_submenu (BonoboUIComponent *ui,
const char *path,
const char *label)
const char *label,
GdkPixbuf *pixbuf)
{
char *xml_string, *name;
char *xml_string, *name, *pixbuf_data;
/* Labels may contain characters that are illegal in names. So
* we create the name by URI-encoding the label.
*/
name = gnome_vfs_escape_string (label);
xml_string = g_strdup_printf ("<submenu name=\"%s\" label=\"%s\"/>\n",
name, label);
if (pixbuf != NULL) {
pixbuf_data = bonobo_ui_util_pixbuf_to_xml (pixbuf);
xml_string = g_strdup_printf ("<submenu name=\"%s\" label=\"%s\" pixtype=\"pixbuf\" pixname=\"%s\"/>\n",
name, label, pixbuf_data);
g_free (pixbuf_data);
} else {
xml_string = g_strdup_printf ("<submenu name=\"%s\" label=\"%s\"/>\n",
name, label);
}
bonobo_ui_component_set (ui, path, xml_string, NULL);
g_free (name);
......
......@@ -85,7 +85,8 @@ char * nautilus_bonobo_get_numbered_menu_item_container_path_from_comm
(const char *command);
void nautilus_bonobo_add_submenu (BonoboUIComponent *ui,
const char *container_path,
const char *label);
const char *label,
GdkPixbuf *pixbuf);
void nautilus_bonobo_add_menu_separator (BonoboUIComponent *ui,
const char *path);
void nautilus_bonobo_remove_menu_items_and_commands (BonoboUIComponent *ui,
......
......@@ -3267,16 +3267,15 @@ add_numbered_menu_item (BonoboUIComponent *ui,
static void
add_submenu (BonoboUIComponent *ui,
const char *parent_path,
const char *label,
GdkPixbuf *pixbuf)
const char *parent_path,
const char *label,
GdkPixbuf *pixbuf)
{
char *escaped_label;
escaped_label = eel_str_double_underscores (label);
nautilus_bonobo_add_submenu (ui, parent_path, escaped_label);
nautilus_bonobo_add_submenu (ui, parent_path, escaped_label, pixbuf);
g_free (escaped_label);
/* FIXME: Set icon too. */
}
static void
......
......@@ -906,7 +906,7 @@ create_menu_item_from_node (NautilusWindow *window,
append_separator (window, menu_path);
} else if (strcmp (node->name, "folder") == 0) {
xml_folder_name = eel_xml_get_property_translated (node, "name");
nautilus_bonobo_add_submenu (window->details->shell_ui, menu_path, xml_folder_name);
nautilus_bonobo_add_submenu (window->details->shell_ui, menu_path, xml_folder_name, NULL);
/* Construct path and make sure it is escaped properly */
escaped_name = gnome_vfs_escape_string (xml_folder_name);
......
......@@ -906,7 +906,7 @@ create_menu_item_from_node (NautilusWindow *window,
append_separator (window, menu_path);
} else if (strcmp (node->name, "folder") == 0) {
xml_folder_name = eel_xml_get_property_translated (node, "name");
nautilus_bonobo_add_submenu (window->details->shell_ui, menu_path, xml_folder_name);
nautilus_bonobo_add_submenu (window->details->shell_ui, menu_path, xml_folder_name, NULL);
/* Construct path and make sure it is escaped properly */
escaped_name = gnome_vfs_escape_string (xml_folder_name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment