static void panel_addto_add_item (PanelAddtoDialog *dialog, PanelAddtoItemInfo *item_info) { g_assert (item_info != NULL); switch (item_info->type) { case PANEL_ADDTO_APPLET: mate_panel_applet_frame_create (dialog->panel_widget->toplevel, dialog->insertion_position, item_info->iid); break; case PANEL_ADDTO_ACTION: panel_action_button_create (dialog->panel_widget->toplevel, dialog->insertion_position, item_info->action_type); break; case PANEL_ADDTO_LAUNCHER_MENU: panel_addto_present_applications (dialog); break; case PANEL_ADDTO_LAUNCHER: panel_launcher_create (dialog->panel_widget->toplevel, dialog->insertion_position, item_info->launcher_path); break; case PANEL_ADDTO_LAUNCHER_NEW: ask_about_launcher (NULL, dialog->panel_widget, dialog->insertion_position, FALSE); break; case PANEL_ADDTO_MENU: panel_menu_button_create (dialog->panel_widget->toplevel, dialog->insertion_position, item_info->menu_filename, item_info->menu_path, item_info->menu_path != NULL, item_info->name); break; case PANEL_ADDTO_MENUBAR: panel_menu_bar_create (dialog->panel_widget->toplevel, dialog->insertion_position); break; case PANEL_ADDTO_SEPARATOR: panel_separator_create (dialog->panel_widget->toplevel, dialog->insertion_position); break; case PANEL_ADDTO_DRAWER: panel_drawer_create (dialog->panel_widget->toplevel, dialog->insertion_position, NULL, FALSE, NULL); break; } }
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); }
static gboolean drop_menu (PanelWidget *panel, int position, const char *menu_filename, const char *menu_path) { if (!panel_profile_id_lists_are_writable ()) return FALSE; return panel_menu_button_create (panel->toplevel, position, menu_filename, menu_path, menu_path != NULL, NULL); }
static gboolean drop_menu (PanelWidget *panel, PanelObjectPackType pack_type, int pack_index, const char *menu_filename, const char *menu_path) { if (!panel_layout_is_writable ()) return FALSE; return panel_menu_button_create (panel->toplevel, pack_type, pack_index, menu_filename, menu_path, NULL); }