summaryrefslogtreecommitdiff
path: root/plugins/gtkui/ddblistview.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/gtkui/ddblistview.c')
-rw-r--r--plugins/gtkui/ddblistview.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/gtkui/ddblistview.c b/plugins/gtkui/ddblistview.c
index e5e5d584..83c8d7d6 100644
--- a/plugins/gtkui/ddblistview.c
+++ b/plugins/gtkui/ddblistview.c
@@ -204,6 +204,9 @@ ddb_listview_list_button_press_event (GtkWidget *widget,
gpointer user_data);
gboolean
+ddb_listview_list_popup_menu (GtkWidget *widget, gpointer user_data);
+
+gboolean
ddb_listview_list_drag_motion (GtkWidget *widget,
GdkDragContext *drag_context,
gint x,
@@ -446,6 +449,9 @@ ddb_listview_init(DdbListview *listview)
g_signal_connect_after ((gpointer) listview->list, "button_press_event",
G_CALLBACK (ddb_listview_list_button_press_event),
NULL);
+ g_signal_connect ((gpointer) listview->list, "popup_menu",
+ G_CALLBACK (ddb_listview_list_popup_menu),
+ NULL);
g_signal_connect ((gpointer) listview->list, "scroll_event",
G_CALLBACK (ddb_listview_vscroll_event),
NULL);
@@ -2154,6 +2160,23 @@ ddb_listview_handle_keypress (DdbListview *ps, int keyval, int state) {
return TRUE;
}
+gboolean
+ddb_listview_list_popup_menu (GtkWidget *widget, gpointer user_data) {
+ DdbListview *ps = DDB_LISTVIEW (g_object_get_data (G_OBJECT (widget), "owner"));
+ DdbListviewIter it = ps->binding->head ();
+ while (it && !ps->binding->is_selected (it)) {
+ DdbListviewIter next = ps->binding->next (it);
+ ps->binding->unref (it);
+ it = next;
+ }
+ if (it) {
+ int sel = ps->binding->get_idx (it);
+ ps->binding->list_context_menu (ps, it, sel);
+ ps->binding->unref (it);
+ }
+ return TRUE;
+}
+
int
ddb_listview_dragdrop_get_row_from_coord (DdbListview *listview, int y) {
if (y == -1) {