Skip to content

Commit 0fd2124

Browse files
raveit65raveit65
authored andcommitted
ev-sidebar-links: replace deprecated gtk_menu_popup function
1 parent be5fadc commit 0fd2124

File tree

4 files changed

+3
-98
lines changed

4 files changed

+3
-98
lines changed

‎help/reference/shell/atril-sections.txt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,6 @@ ev_keyring_save_password
447447

448448
<SECTION>
449449
<FILE>ev-utils</FILE>
450-
ev_gui_menu_position_tree_selection
451450
file_chooser_dialog_add_writable_pixbuf_formats
452451
get_gdk_pixbuf_format_by_extension
453452
</SECTION>

‎shell/ev-sidebar-links.c‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,7 @@ popup_menu_cb (GtkWidget *treeview, EvSidebarLinks *sidebar)
347347
{
348348
GtkMenu *menu = build_popup_menu (sidebar);
349349

350-
gtk_menu_popup (menu, NULL, NULL,
351-
ev_gui_menu_position_tree_selection,
352-
sidebar->priv->tree_view, 0,
353-
gtk_get_current_event_time ());
350+
gtk_menu_popup_at_pointer (menu, NULL);
354351
gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE);
355352
}
356353

@@ -369,9 +366,8 @@ button_press_cb (GtkWidget *treeview,
369366
NULL, NULL, NULL)) {
370367
gtk_tree_view_set_cursor (GTK_TREE_VIEW (treeview),
371368
path, NULL, FALSE);
372-
gtk_menu_popup (build_popup_menu (sidebar), NULL,
373-
NULL, NULL, NULL, event->button,
374-
gtk_get_current_event_time ());
369+
gtk_menu_popup_at_pointer (build_popup_menu (sidebar),
370+
(const GdkEvent*) event);
375371
gtk_tree_path_free (path);
376372

377373
return TRUE;

‎shell/ev-utils.c‎

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -26,90 +26,6 @@
2626
#include <string.h>
2727
#include <glib/gi18n.h>
2828

29-
static int
30-
_gtk_get_monitor_num (GdkMonitor *monitor)
31-
{
32-
GdkDisplay *display;
33-
int n_monitors, i;
34-
35-
display = gdk_monitor_get_display (monitor);
36-
n_monitors = gdk_display_get_n_monitors (display);
37-
38-
for(i = 0; i < n_monitors; i++)
39-
{
40-
if (gdk_display_get_monitor (display, i) == monitor) return i;
41-
}
42-
43-
return -1;
44-
}
45-
46-
static void
47-
ev_gui_sanitise_popup_position (GtkMenu *menu,
48-
GtkWidget *widget,
49-
gint *x,
50-
gint *y)
51-
{
52-
GdkDisplay *display = gtk_widget_get_display (widget);
53-
GdkMonitor *monitor_num;
54-
GdkRectangle monitor;
55-
GtkRequisition req;
56-
57-
g_return_if_fail (widget != NULL);
58-
59-
gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL);
60-
61-
monitor_num = gdk_display_get_monitor_at_point (display, *x, *y);
62-
gtk_menu_set_monitor (menu, _gtk_get_monitor_num (monitor_num));
63-
gdk_monitor_get_geometry (monitor_num, &monitor);
64-
65-
*x = CLAMP (*x, monitor.x, monitor.x + MAX (0, monitor.width - req.width));
66-
*y = CLAMP (*y, monitor.y, monitor.y + MAX (0, monitor.height - req.height));
67-
}
68-
69-
void
70-
ev_gui_menu_position_tree_selection (GtkMenu *menu,
71-
gint *x,
72-
gint *y,
73-
gboolean *push_in,
74-
gpointer user_data)
75-
{
76-
GtkTreeSelection *selection;
77-
GList *selected_rows;
78-
GtkTreeModel *model;
79-
GtkTreeView *tree_view = GTK_TREE_VIEW (user_data);
80-
GtkWidget *widget = GTK_WIDGET (user_data);
81-
GtkRequisition req;
82-
GtkAllocation allocation;
83-
GdkRectangle visible;
84-
85-
gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL);
86-
gdk_window_get_origin (gtk_widget_get_window (widget), x, y);
87-
gtk_widget_get_allocation (widget, &allocation);
88-
89-
*x += (allocation.width - req.width) / 2;
90-
91-
/* Add on height for the treeview title */
92-
gtk_tree_view_get_visible_rect (tree_view, &visible);
93-
*y += allocation.height - visible.height;
94-
95-
selection = gtk_tree_view_get_selection (tree_view);
96-
selected_rows = gtk_tree_selection_get_selected_rows (selection, &model);
97-
if (selected_rows)
98-
{
99-
GdkRectangle cell_rect;
100-
101-
gtk_tree_view_get_cell_area (tree_view, selected_rows->data,
102-
NULL, &cell_rect);
103-
104-
*y += CLAMP (cell_rect.y + cell_rect.height, 0, visible.height);
105-
106-
g_list_foreach (selected_rows, (GFunc)gtk_tree_path_free, NULL);
107-
g_list_free (selected_rows);
108-
}
109-
110-
ev_gui_sanitise_popup_position (menu, widget, x, y);
111-
}
112-
11329
void
11430
file_chooser_dialog_add_writable_pixbuf_formats (GtkFileChooser *chooser)
11531
{

‎shell/ev-utils.h‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@
2626

2727
G_BEGIN_DECLS
2828

29-
void ev_gui_menu_position_tree_selection (GtkMenu *menu,
30-
gint *x,
31-
gint *y,
32-
gboolean *push_in,
33-
gpointer user_data);
34-
3529
void file_chooser_dialog_add_writable_pixbuf_formats (GtkFileChooser *chooser);
3630
GdkPixbufFormat* get_gdk_pixbuf_format_by_extension (gchar *uri);
3731

0 commit comments

Comments
 (0)