diff options
author | raveit65 <[email protected]> | 2018-05-05 21:23:26 +0200 |
---|---|---|
committer | lukefromdc <[email protected]> | 2018-05-07 16:04:11 -0400 |
commit | ddf6f38db4e842abecd4f2ee77012050822b3775 (patch) | |
tree | 385890e85b2de303f8b1897f72de3b777ff6532b /src/caja-zoom-control.c | |
parent | ded490e1bc432210e6006e94273cc160a0af8e75 (diff) | |
download | caja-ddf6f38db4e842abecd4f2ee77012050822b3775.tar.bz2 caja-ddf6f38db4e842abecd4f2ee77012050822b3775.tar.xz |
Replace deprecated gtk_menu_popup
Replace deprecated gtk_menu_popup in eel-editable-label,caja-dnd, emblem-sidebar,caja-side-pane, fm-tree-view, caja-navigation-window-pane, and caja-zoom-control
Diffstat (limited to 'src/caja-zoom-control.c')
-rw-r--r-- | src/caja-zoom-control.c | 79 |
1 files changed, 7 insertions, 72 deletions
diff --git a/src/caja-zoom-control.c b/src/caja-zoom-control.c index c21e06e4..99f1b5e0 100644 --- a/src/caja-zoom-control.c +++ b/src/caja-zoom-control.c @@ -133,83 +133,18 @@ zoom_popup_menu_show (GdkEventButton *event, CajaZoomControl *zoom_control) } static void -menu_position_under_widget (GtkMenu *menu, - gint *x, - gint *y, - gboolean *push_in, - gpointer user_data) -{ - GtkWidget *widget; - GtkWidget *container; - GtkRequisition req; - GtkRequisition menu_req; - GdkRectangle monitor; - GdkMonitor *monitor_num; - GdkDisplay *display; - GtkAllocation allocation; - - widget = GTK_WIDGET (user_data); - g_assert (GTK_IS_WIDGET (widget)); - - container = gtk_widget_get_ancestor (widget, GTK_TYPE_CONTAINER); - g_assert (container != NULL); - - gtk_widget_get_preferred_size (GTK_WIDGET (menu), &menu_req, NULL); - gtk_widget_get_preferred_size (widget, &req, NULL); - gtk_widget_get_allocation (widget, &allocation); - - display = gtk_widget_get_display (GTK_WIDGET (menu)); - monitor_num = gdk_display_get_monitor_at_window (display, gtk_widget_get_window (widget)); - if (monitor_num == NULL) - monitor_num = gdk_display_get_monitor (display, 0); - gdk_monitor_get_geometry (monitor_num, &monitor); - - gdk_window_get_origin (gtk_widget_get_window (widget), x, y); - if (!gtk_widget_get_has_window (widget)) - { - *x += allocation.x; - *y += allocation.y; - } - - if (gtk_widget_get_direction (container) == GTK_TEXT_DIR_LTR) - { - *x += allocation.width - req.width; - } - else - { - *x += req.width - menu_req.width; - } - - if ((*y + allocation.height + menu_req.height) <= monitor.y + monitor.height) - { - *y += allocation.height; - } - else if ((*y - menu_req.height) >= monitor.y) - { - *y -= menu_req.height; - } - else if (monitor.y + monitor.height - (*y + allocation.height) > *y) - { - *y += allocation.height; - } - else - { - *y -= menu_req.height; - } - - *push_in = FALSE; -} - - -static void zoom_popup_menu (GtkWidget *widget, CajaZoomControl *zoom_control) { GtkMenu *menu; + GdkEvent *event; menu = create_zoom_menu (zoom_control); - gtk_menu_popup (menu, NULL, NULL, - menu_position_under_widget, widget, - 0, gtk_get_current_event_time ()); + gtk_menu_popup_at_widget (menu, + widget, + GDK_GRAVITY_SOUTH_WEST, + GDK_GRAVITY_NORTH_WEST, + (const GdkEvent*) event); + gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE); } |