diff src/view_dir.c @ 395:c359fc2c5a1f

Move common menu position callback to view_dir.c.
author zas_
date Thu, 17 Apr 2008 16:33:31 +0000
parents 4a5e1377f3d7
children a01535f52b56
line wrap: on
line diff
--- a/src/view_dir.c	Thu Apr 17 14:51:32 2008 +0000
+++ b/src/view_dir.c	Thu Apr 17 16:33:31 2008 +0000
@@ -849,3 +849,26 @@
 			 G_CALLBACK(vd_dnd_drop_leave), vd);
 }
 
+/*
+ *----------------------------------------------------------------------------
+ * callbacks
+ *----------------------------------------------------------------------------
+ */
+
+void vd_menu_position_cb(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data)
+{
+	ViewDir *vd = data;
+	GtkTreeModel *store;
+	GtkTreeIter iter;
+	GtkTreePath *tpath;
+	gint cw, ch;
+
+	if (vd_find_row(vd, vd->click_fd, &iter) < 0) return;
+	store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view));
+	tpath = gtk_tree_model_get_path(store, &iter);
+	tree_view_get_cell_clamped(GTK_TREE_VIEW(vd->view), tpath, 0, TRUE, x, y, &cw, &ch);
+	gtk_tree_path_free(tpath);
+	*y += ch;
+	popup_menu_position_clamp(menu, x, y, 0);
+}
+