static gint item_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data) { if (!((event->type == GDK_BUTTON_PRESS) && (event->button.button == 3))) return FALSE; gnome_popup_menu_do_popup (GTK_WIDGET (data), NULL, NULL, (GdkEventButton *) event, item, NULL); return TRUE; }
/* Callback used when a button is pressed in a widget attached to a popup * menu. It decides whether the menu should be popped up and does the * appropriate stuff. */ static gint real_popup_button_pressed (GtkWidget *widget, GdkEventButton *event, gpointer data) { GtkWidget *popup; gpointer user_data; popup = data; /* * Fetch the attachment user data from the widget and install * it in the popup menu -- it will be used by the callback * mashaller to pass the data to the callbacks. * */ user_data = g_object_get_data (G_OBJECT (widget), "gnome_popup_menu_attach_user_data"); gnome_popup_menu_do_popup (popup, NULL, NULL, event, user_data, widget); return TRUE; }