diff options
author | William Hua <william.hua@canonical.com> | 2016-07-12 14:08:36 -0400 |
---|---|---|
committer | William Hua <william.hua@canonical.com> | 2016-07-19 09:38:54 -0400 |
commit | 8701e34f749cf196c9726c01c03f35ce4eb39836 (patch) | |
tree | 1608d0bcc69917633b1640dfa7a3651158868880 /gtk/gtkmountoperation.c | |
parent | 05b9bc5cff5f2bd625412ddac2184af8c026895b (diff) | |
download | gtk+-8701e34f749cf196c9726c01c03f35ce4eb39836.tar.gz |
port to new gtk_menu_popup_at_* () functions
https://bugzilla.gnome.org/show_bug.cgi?id=756579
Diffstat (limited to 'gtk/gtkmountoperation.c')
-rw-r--r-- | gtk/gtkmountoperation.c | 39 |
1 files changed, 8 insertions, 31 deletions
diff --git a/gtk/gtkmountoperation.c b/gtk/gtkmountoperation.c index e78a5e235a..95d856c7b2 100644 --- a/gtk/gtkmountoperation.c +++ b/gtk/gtkmountoperation.c @@ -1299,16 +1299,11 @@ on_end_process_activated (GtkMenuItem *item, static gboolean do_popup_menu_for_process_tree_view (GtkWidget *widget, - GdkEventButton *event, + const GdkEvent *event, GtkMountOperation *op) { GtkWidget *menu; GtkWidget *item; - gint button; - gint event_time; - gboolean popped_up_menu; - - popped_up_menu = FALSE; menu = gtk_menu_new (); gtk_style_context_add_class (gtk_widget_get_style_context (menu), @@ -1321,14 +1316,14 @@ do_popup_menu_for_process_tree_view (GtkWidget *widget, gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show_all (menu); - if (event != NULL) + if (event && gdk_event_triggers_context_menu (event)) { GtkTreePath *path; GtkTreeSelection *selection; if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (op->priv->process_tree_view), - (gint) event->x, - (gint) event->y, + (gint) event->button.x, + (gint) event->button.y, &path, NULL, NULL, @@ -1341,30 +1336,12 @@ do_popup_menu_for_process_tree_view (GtkWidget *widget, else { /* don't popup a menu if the user right-clicked in an area with no rows */ - goto out; + return FALSE; } - - button = event->button; - event_time = event->time; - } - else - { - button = 0; - event_time = gtk_get_current_event_time (); } - gtk_menu_popup (GTK_MENU (menu), - NULL, - widget, - NULL, - NULL, - button, - event_time); - - popped_up_menu = TRUE; - - out: - return popped_up_menu; + gtk_menu_popup_at_pointer (GTK_MENU (menu), event); + return TRUE; } static gboolean @@ -1387,7 +1364,7 @@ on_button_press_event_for_process_tree_view (GtkWidget *widget, if (gdk_event_triggers_context_menu ((GdkEvent *) event)) { - ret = do_popup_menu_for_process_tree_view (widget, event, op); + ret = do_popup_menu_for_process_tree_view (widget, (GdkEvent *) event, op); } return ret; |