summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/caja-emblem-sidebar.c6
-rw-r--r--src/caja-navigation-window-pane.c16
-rw-r--r--src/caja-side-pane.c16
-rw-r--r--src/caja-zoom-control.c79
-rw-r--r--src/file-manager/fm-tree-view.c5
5 files changed, 23 insertions, 99 deletions
diff --git a/src/caja-emblem-sidebar.c b/src/caja-emblem-sidebar.c
index 5e2fadda..05a77861 100644
--- a/src/caja-emblem-sidebar.c
+++ b/src/caja-emblem-sidebar.c
@@ -187,10 +187,8 @@ caja_emblem_sidebar_button_press_cb (GtkWidget *widget,
gtk_widget_set_sensitive (emblem_sidebar->details->popup_rename,
caja_emblem_can_rename_emblem (keyword));
-
- gtk_menu_popup (GTK_MENU (emblem_sidebar->details->popup),
- NULL, NULL, NULL, NULL, event->button,
- event->time);
+ gtk_menu_popup_at_pointer (GTK_MENU (emblem_sidebar->details->popup),
+ (const GdkEvent*) event);
}
return TRUE;
diff --git a/src/caja-navigation-window-pane.c b/src/caja-navigation-window-pane.c
index aa700830..84ae7f11 100644
--- a/src/caja-navigation-window-pane.c
+++ b/src/caja-navigation-window-pane.c
@@ -358,7 +358,6 @@ notebook_popup_menu_show (CajaNavigationWindowPane *pane,
{
GtkWidget *popup;
GtkWidget *item;
- int button, event_time;
gboolean can_move_left, can_move_right;
CajaNotebook *notebook;
@@ -409,24 +408,13 @@ notebook_popup_menu_show (CajaNavigationWindowPane *pane,
gtk_widget_show_all (popup);
- if (event)
- {
- button = event->button;
- event_time = event->time;
- }
- else
- {
- button = 0;
- event_time = gtk_get_current_event_time ();
- }
-
/* TODO is this correct? */
gtk_menu_attach_to_widget (GTK_MENU (popup),
pane->notebook,
NULL);
- gtk_menu_popup (GTK_MENU (popup), NULL, NULL, NULL, NULL,
- button, event_time);
+ gtk_menu_popup_at_pointer (GTK_MENU (popup),
+ (const GdkEvent*) event);
}
/* emitted when the user clicks the "close" button of tabs */
diff --git a/src/caja-side-pane.c b/src/caja-side-pane.c
index e22f517a..fb25b4fb 100644
--- a/src/caja-side-pane.c
+++ b/src/caja-side-pane.c
@@ -228,9 +228,11 @@ select_button_press_callback (GtkWidget *widget,
gtk_widget_grab_focus (widget);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
- gtk_menu_popup (GTK_MENU (side_pane->details->menu),
- NULL, NULL, menu_position_under, widget,
- event->button, event->time);
+ gtk_menu_popup_at_widget (GTK_MENU (side_pane->details->menu),
+ widget,
+ GDK_GRAVITY_SOUTH_WEST,
+ GDK_GRAVITY_NORTH_WEST,
+ (const GdkEvent*) event);
return TRUE;
}
@@ -252,9 +254,11 @@ select_button_key_press_callback (GtkWidget *widget,
event->keyval == GDK_KEY_KP_Enter)
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
- gtk_menu_popup (GTK_MENU (side_pane->details->menu),
- NULL, NULL, menu_position_under, widget,
- 1, event->time);
+ gtk_menu_popup_at_widget (GTK_MENU (side_pane->details->menu),
+ widget,
+ GDK_GRAVITY_SOUTH_WEST,
+ GDK_GRAVITY_NORTH_WEST,
+ (const GdkEvent*) event);
return TRUE;
}
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);
}
diff --git a/src/file-manager/fm-tree-view.c b/src/file-manager/fm-tree-view.c
index 346d51a7..5f23b045 100644
--- a/src/file-manager/fm-tree-view.c
+++ b/src/file-manager/fm-tree-view.c
@@ -861,9 +861,8 @@ button_pressed_callback (GtkTreeView *treeview, GdkEventButton *event,
gtk_widget_hide (view->details->popup_unmount_separator);
}
- gtk_menu_popup (GTK_MENU (view->details->popup),
- NULL, NULL, NULL, NULL,
- event->button, event->time);
+ gtk_menu_popup_at_pointer (GTK_MENU (view->details->popup),
+ (const GdkEvent*) event);
gtk_tree_view_set_cursor (view->details->tree_widget, cursor_path, NULL, FALSE);
gtk_tree_path_free (cursor_path);