Exemplo n.º 1
0
static void
panel_addto_prepend_directory (GSList             **parent_list,
			       MateMenuTreeDirectory  *directory,
			       const char          *filename)
{
	PanelAddtoAppList *data;

	data = g_new0 (PanelAddtoAppList, 1);

	data->item_info.type          = PANEL_ADDTO_MENU;
	data->item_info.name          = g_strdup (matemenu_tree_directory_get_name (directory));
	data->item_info.description   = g_strdup (matemenu_tree_directory_get_comment (directory));
	data->item_info.icon          = g_strdup (matemenu_tree_directory_get_icon (directory));
	data->item_info.menu_filename = g_strdup (filename);
	data->item_info.menu_path     = matemenu_tree_directory_make_path (directory, NULL);
	data->item_info.static_data   = FALSE;

	/* We should set the iid here to something and do
	 * iid = g_strdup_printf ("MENU:%s", tfr->name)
	 * but this means we'd have to free the iid later
	 * and this would complexify too much the free
	 * function.
	 * So the iid is built when we select the row.
	 */

	*parent_list = g_slist_prepend (*parent_list, data);

	panel_addto_make_application_list (&data->children, directory, filename);
}
Exemplo n.º 2
0
static void
add_menu_to_panel (GtkWidget      *menuitem,
		   MateMenuTreeEntry *entry)
{
	MateMenuTreeDirectory *directory;
	MateMenuTree          *tree;
	PanelWidget        *panel;
	PanelData          *pd;
	int                 insertion_pos;
	char               *menu_path;
	const char         *menu_filename;

	directory = matemenu_tree_item_get_parent (MATEMENU_TREE_ITEM (entry));
	if (!directory) {
		g_warning ("Cannot find the filename for the menu: no directory");
		return;
	}

	tree = matemenu_tree_directory_get_tree (directory);
	if (!tree) {
		matemenu_tree_item_unref (directory);
		g_warning ("Cannot find the filename for the menu: no tree");
		return;
	}

	menu_filename = matemenu_tree_get_menu_file (tree);
	matemenu_tree_unref (tree);
	if (!menu_filename) {
		matemenu_tree_item_unref (directory);
		g_warning ("Cannot find the filename for the menu: no filename");
		return;
	}

	panel = menu_get_panel (menuitem);

	pd = g_object_get_data (G_OBJECT (panel->toplevel), "PanelData");
	insertion_pos = pd ? pd->insertion_pos : -1;

	menu_path = matemenu_tree_directory_make_path (directory, NULL);

	panel_menu_button_create (panel->toplevel,
				  insertion_pos,
				  menu_filename,
				  menu_path,
				  TRUE,
				  matemenu_tree_directory_get_name (directory));

	g_free (menu_path);

	matemenu_tree_item_unref (directory);
}