summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-06-08 13:12:24 +0200
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-06-08 13:12:24 +0200
commit7f527c149ea36b3c7006fb1654a783fa398a8a2e (patch)
treef6bd7ef64303d46870e73f9dcf584551e12f9b24 /plugins
parentdc028e1a6ac839b2d524b459ebc9b677aa5c8397 (diff)
gtkui: popup-menu event handler
Diffstat (limited to 'plugins')
-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) {