summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-gtk-extensions.c
diff options
context:
space:
mode:
authorJohn Sullivan <sullivan@src.gnome.org>2000-02-15 01:13:52 +0000
committerJohn Sullivan <sullivan@src.gnome.org>2000-02-15 01:13:52 +0000
commit21586bbcfbdb8174ba5d63dcb77a5e72f19f8c9d (patch)
tree1a7ff56d3b64772667a1c4a27129b0e050d21c56 /libnautilus-private/nautilus-gtk-extensions.c
parentf90a9976f6c6e1e711b11d8b03858d1a8bb2a508 (diff)
downloadnautilus-21586bbcfbdb8174ba5d63dcb77a5e72f19f8c9d.tar.gz
First checkin for right-click menus on the Back and Forward buttons. They work,
but there are a few finishing touches outstanding.
Diffstat (limited to 'libnautilus-private/nautilus-gtk-extensions.c')
-rw-r--r--libnautilus-private/nautilus-gtk-extensions.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/libnautilus-private/nautilus-gtk-extensions.c b/libnautilus-private/nautilus-gtk-extensions.c
index ede48c6b9..60577e5c9 100644
--- a/libnautilus-private/nautilus-gtk-extensions.c
+++ b/libnautilus-private/nautilus-gtk-extensions.c
@@ -133,3 +133,32 @@ nautilus_gtk_selection_data_free_deep (GtkSelectionData *data)
g_free (data->data);
gtk_selection_data_free (data);
}
+
+/**
+ * nautilus_pop_up_context_menu:
+ *
+ * Pop up a context menu under the mouse. This assumes that
+ * a mouse down event just occurred, with the 3rd button pressed.
+ * (Context menus only appear with the 3rd mouse button, by UI
+ * convention.) The menu is sunk after use, so it will be destroyed
+ * unless the caller first ref'ed it.
+ *
+ * This function is more of a helper function than a gtk extension,
+ * so perhaps it belongs in a different file.
+ *
+ * @menu: The menu to pop up under the mouse.
+ **/
+void
+nautilus_pop_up_context_menu (GtkMenu *menu)
+{
+ g_return_if_fail (GTK_IS_MENU (menu));
+
+ /* We pass current time here instead of extracting it from
+ * the event, for API simplicity. This does not seem to make
+ * any practical difference. See man XGrabPointer for details.
+ */
+ gtk_menu_popup (menu, NULL, NULL, NULL,
+ NULL, 3, GDK_CURRENT_TIME);
+
+ gtk_object_sink (GTK_OBJECT(menu));
+}