Commit e46cc732 authored by Alberts Muktupāvels's avatar Alberts Muktupāvels

menu: add gp_menu_get_icon

parent c268691b
......@@ -625,6 +625,36 @@ gp_menu_set_path (GpMenu *menu,
queue_reload (menu);
}
GIcon *
gp_menu_get_icon (GpMenu *menu)
{
const gchar *path;
GMenuTreeDirectory *directory;
GIcon *icon;
if (!menu->loaded)
return NULL;
path = menu->path && *menu->path != '\0' ? menu->path : "/";
directory = gmenu_tree_get_directory_from_path (menu->tree, path);
if (directory == NULL)
return NULL;
icon = gmenu_tree_directory_get_icon (directory);
if (icon == NULL)
{
gmenu_tree_item_unref (directory);
return NULL;
}
g_object_ref (icon);
gmenu_tree_item_unref (directory);
return icon;
}
void
gp_menu_set_append_func (GpMenu *menu,
GpAppendMenuItemsFunc append_func,
......
......@@ -33,6 +33,8 @@ GtkWidget *gp_menu_new (GpApplet *applet,
void gp_menu_set_path (GpMenu *menu,
const gchar *path);
GIcon *gp_menu_get_icon (GpMenu *menu);
void gp_menu_set_append_func (GpMenu *menu,
GpAppendMenuItemsFunc append_func,
gpointer user_data);
......
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