static void panel_menu_button_parent_set (GtkWidget *widget, GtkWidget *previous_parent) { PanelMenuButton *button = PANEL_MENU_BUTTON (widget); g_return_if_fail (!widget->parent || PANEL_IS_WIDGET (widget->parent)); if (widget->parent) button->priv->toplevel = PANEL_WIDGET (widget->parent)->toplevel; else button->priv->toplevel = NULL; panel_menu_button_associate_panel (button); panel_menu_button_set_icon (button); if (GTK_WIDGET_CLASS (parent_class)->parent_set) GTK_WIDGET_CLASS (parent_class)->parent_set (widget, previous_parent); }
static GtkWidget * panel_menu_button_create_menu (PanelMenuButton *button) { PanelWidget *panel_widget; if (button->priv->menu) return button->priv->menu; if (!button->priv->toplevel) return NULL; panel_widget = panel_toplevel_get_panel_widget (button->priv->toplevel); if (button->priv->use_menu_path && button->priv->path_root > FIRST_MENU && button->priv->path_root < LAST_MENU) { const char *filename; filename = panel_menu_path_root_to_filename (button->priv->path_root); button->priv->menu = create_applications_menu (filename, button->priv->menu_path, TRUE); } else button->priv->menu = create_main_menu (panel_widget); gtk_menu_attach_to_widget (GTK_MENU (button->priv->menu), GTK_WIDGET (button), (GtkMenuDetachFunc) panel_menu_button_menu_detacher); panel_menu_button_associate_panel (button); g_signal_connect_swapped (button->priv->menu, "deactivate", G_CALLBACK (panel_menu_button_menu_deactivated), button); return button->priv->menu; }