static void panel_menu_button_load (const char *menu_path, gboolean use_menu_path, const char *custom_icon, gboolean use_custom_icon, const char *tooltip, PanelWidget *panel, gboolean locked, int position, gboolean exactpos, const char *id) { PanelMenuButton *button; AppletInfo *info; g_return_if_fail (panel != NULL); button = g_object_new (PANEL_TYPE_MENU_BUTTON, "menu-path", menu_path, "custom-icon", custom_icon, "tooltip", tooltip, "use-menu-path", use_menu_path, "use-custom-icon", use_custom_icon, "has-arrow", TRUE, NULL); info = panel_applet_register (GTK_WIDGET (button), NULL, NULL, panel, locked, position, exactpos, PANEL_OBJECT_MENU, id); if (!info) { gtk_widget_destroy (GTK_WIDGET (button)); return; } button->priv->applet_id = g_strdup (info->id); panel_applet_add_callback (info, "help", GTK_STOCK_HELP, _("_Help"), NULL); if (panel_is_program_in_path ("alacarte") || panel_is_program_in_path ("gmenu-simple-editor")) panel_applet_add_callback (info, "edit", NULL, _("_Edit Menus"), NULL); panel_widget_set_applet_expandable (panel, GTK_WIDGET (button), FALSE, TRUE); panel_widget_set_applet_size_constrained (panel, GTK_WIDGET (button), TRUE); panel_menu_button_connect_to_gconf (button); panel_lockdown_notify_add (G_CALLBACK (panel_menu_button_recreate_menu), button); }
static void panel_action_lock_setup_menu (PanelActionButton *button) { panel_applet_add_callback (button->priv->info, "lock", NULL, _("_Lock Screen"), panel_action_lock_is_enabled); panel_applet_add_callback (button->priv->info, "activate", NULL, _("_Activate Screensaver"), NULL); panel_applet_add_callback (button->priv->info, "prefs", GTK_STOCK_PROPERTIES, _("_Properties"), screensaver_properties_enabled); }
static Launcher * load_launcher_applet (const char *location, PanelWidget *panel, const char *id, GSettings *settings) { Launcher *launcher; launcher = create_launcher (location); if (!launcher) return NULL; launcher->info = panel_applet_register (launcher->button, panel, PANEL_OBJECT_LAUNCHER, id, settings, launcher, free_launcher); if (!launcher->info) { free_launcher (launcher); return NULL; } panel_applet_add_callback (launcher->info, "launch", _("_Launch"), NULL); panel_applet_add_callback (launcher->info, "properties", _("_Properties"), lancher_properties_enabled); panel_widget_set_applet_expandable (panel, GTK_WIDGET (launcher->button), FALSE, TRUE); panel_widget_set_applet_size_constrained (panel, GTK_WIDGET (launcher->button), TRUE); /* setup button according to ditem */ setup_button (launcher); return launcher; }
void panel_menu_bar_load (PanelWidget *panel, const char *id, GSettings *settings) { PanelMenuBar *menubar; g_return_if_fail (panel != NULL); menubar = g_object_new (PANEL_TYPE_MENU_BAR, NULL); menubar->priv->info = panel_applet_register ( GTK_WIDGET (menubar), panel, PANEL_OBJECT_MENU_BAR, id, settings, NULL, NULL); if (!menubar->priv->info) { gtk_widget_destroy (GTK_WIDGET (menubar)); return; } if (panel_is_program_in_path ("alacarte") || panel_is_program_in_path ("gmenu-simple-editor")) { panel_applet_add_callback (menubar->priv->info, "edit", NULL, _("_Edit Menus"), panel_lockdown_get_not_panels_locked_down_s); } panel_applet_add_callback (menubar->priv->info, "help", GTK_STOCK_HELP, _("_Help"), NULL); panel_menu_bar_object_object_load_finish (PANEL_MENU_BAR_OBJECT (menubar), panel); }
static void load_drawer_applet (char *toplevel_id, const char *custom_icon, gboolean use_custom_icon, const char *tooltip, PanelToplevel *parent_toplevel, gboolean locked, int pos, gboolean exactpos, const char *id) { PanelOrientation orientation; PanelToplevel *toplevel = NULL; Drawer *drawer = NULL; PanelWidget *panel_widget; orientation = panel_toplevel_get_orientation (parent_toplevel); if (toplevel_id) toplevel = panel_profile_get_toplevel_by_id (toplevel_id); if (!toplevel) toplevel = create_drawer_toplevel (id); if (toplevel) { panel_toplevel_hide (toplevel, FALSE, -1); drawer = create_drawer_applet (toplevel, parent_toplevel, tooltip, custom_icon, use_custom_icon, orientation); } if (!drawer) return; panel_widget = panel_toplevel_get_panel_widget (parent_toplevel); drawer->info = panel_applet_register (drawer->button, drawer, (GDestroyNotify) g_free, panel_widget, locked, pos, exactpos, PANEL_OBJECT_DRAWER, id); if (!drawer->info) { gtk_widget_destroy (GTK_WIDGET (toplevel)); return; } g_signal_connect_after (drawer->button, "size_allocate", G_CALLBACK (drawer_button_size_allocated), drawer); panel_widget_add_forbidden (panel_toplevel_get_panel_widget (drawer->toplevel)); panel_widget_set_applet_expandable (panel_widget, GTK_WIDGET (drawer->button), FALSE, TRUE); panel_widget_set_applet_size_constrained (panel_widget, GTK_WIDGET (drawer->button), TRUE); panel_applet_add_callback (drawer->info, "add", GTK_STOCK_ADD, _("_Add to Drawer..."), drawer_changes_enabled); panel_applet_add_callback (drawer->info, "properties", GTK_STOCK_PROPERTIES, _("_Properties"), drawer_changes_enabled); panel_applet_add_callback (drawer->info, "help", GTK_STOCK_HELP, _("_Help"), NULL); panel_drawer_connect_to_gconf (drawer); }