示例#1
0
static gboolean
panel_popup_menu_left (PanelToplevel *toplevel,
                  guint          button,
                  guint32        activate_time)
{
        PanelWidget *panel_widget;
        GtkWidget   *menu;
        PanelData   *panel_data;
        GdkEvent    *current_event;

        panel_widget = panel_toplevel_get_panel_widget (toplevel);
        panel_data   = g_object_get_data (G_OBJECT (toplevel), "PanelData");

        current_event = gtk_get_current_event ();
        if (current_event->type == GDK_BUTTON_PRESS)
                panel_data->insertion_pos = panel_widget_get_cursorloc (panel_widget);
        else
                panel_data->insertion_pos = -1;

        menu = make_popup_panel_menu (panel_widget);
	//gtk_widget_set_usize(GTK_WINDOW (menu),10,10);
        if (!menu)
                return FALSE;

        gtk_menu_set_screen (GTK_MENU (menu),
                             gtk_window_get_screen (GTK_WINDOW (toplevel)));
        gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, button, activate_time);
        gtk_menu_popdown (GTK_MENU (menu));


        return FALSE;
}
示例#2
0
static gboolean
panel_popup_menu (PanelToplevel *toplevel,
		  guint          button,
		  guint32        activate_time)
{
	PanelWidget *panel_widget;
	GtkWidget   *menu;
	PanelData   *panel_data;
	GdkEvent    *current_event;

	panel_widget = panel_toplevel_get_panel_widget (toplevel);
	panel_data   = g_object_get_data (G_OBJECT (toplevel), "PanelData");

	current_event = gtk_get_current_event ();
	if (current_event->type == GDK_BUTTON_PRESS)
		panel_data->insert_pack_type = panel_widget_get_insert_pack_type_at_cursor (panel_widget);
	else
		panel_data->insert_pack_type = PANEL_OBJECT_PACK_START;
	
	menu = make_popup_panel_menu (panel_widget);
	if (!menu)
		return FALSE;

	gtk_menu_set_screen (GTK_MENU (menu),
			     gtk_window_get_screen (GTK_WINDOW (toplevel)));

	gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, button, activate_time);

	return TRUE;
}