[evince] ev-sidebar-annotations: Remove GTK < 3.22 popup code
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] ev-sidebar-annotations: Remove GTK < 3.22 popup code
- Date: Wed, 5 Feb 2020 02:24:25 +0000 (UTC)
commit e1cb37f54d2987d4a439cc39ca1fcb68e2514512
Author: Jason Crain <jcrain inspiresomeone us>
Date: Mon Feb 3 12:27:11 2020 -0700
ev-sidebar-annotations: Remove GTK < 3.22 popup code
We already require GTK version >= 3.22 to build. This allows us to
delete some menu positioning code from ev-utils.
help/reference/shell/evince-sections.txt | 1 -
shell/ev-sidebar-annotations.c | 16 ------
shell/ev-utils.c | 85 --------------------------------
shell/ev-utils.h | 5 --
4 files changed, 107 deletions(-)
---
diff --git a/help/reference/shell/evince-sections.txt b/help/reference/shell/evince-sections.txt
index d3d4e9e6..984af03f 100644
--- a/help/reference/shell/evince-sections.txt
+++ b/help/reference/shell/evince-sections.txt
@@ -365,7 +365,6 @@ ev_keyring_save_password
<FILE>ev-utils</FILE>
ev_pixbuf_add_shadow
ev_print_region_contents
-ev_gui_menu_position_tree_selection
get_num_monitors
file_chooser_dialog_add_writable_pixbuf_formats
get_gdk_pixbuf_format_by_extension
diff --git a/shell/ev-sidebar-annotations.c b/shell/ev-sidebar-annotations.c
index 55e4048e..fd1be900 100644
--- a/shell/ev-sidebar-annotations.c
+++ b/shell/ev-sidebar-annotations.c
@@ -589,24 +589,8 @@ ev_sidebar_annotations_popup_menu_show (EvSidebarAnnotations *sidebar_annots,
window = gtk_widget_get_toplevel (GTK_WIDGET (sidebar_annots));
ev_window_handle_annot_popup (EV_WINDOW (window), EV_ANNOTATION (annot_mapping->data));
-
-#if GTK_CHECK_VERSION (3, 22, 0)
gtk_menu_popup_at_rect (GTK_MENU (priv->popup), rect_window, rect,
GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, event);
-#else
- if (event != NULL)
- gtk_menu_popup_for_device (GTK_MENU (priv->popup),
- gdk_event_get_device (event),
- NULL, NULL, NULL, NULL, NULL, 0,
- gdk_event_get_time (event));
- else
- /* popup was triggered from keyboard */
- gtk_menu_popup (GTK_MENU (priv->popup), NULL, NULL,
- ev_gui_menu_position_tree_selection,
- priv->tree_view, 0,
- gtk_get_current_event_time ());
-#endif
-
return TRUE;
}
diff --git a/shell/ev-utils.c b/shell/ev-utils.c
index fd427387..51aaa840 100644
--- a/shell/ev-utils.c
+++ b/shell/ev-utils.c
@@ -212,91 +212,6 @@ ev_print_region_contents (cairo_region_t *region)
}
}
-static gint
-get_monitor_number (GdkDisplay *display,
- GdkMonitor *monitor)
-{
- gint i;
-
- for (i = 0; i < gdk_display_get_n_monitors (display); i++) {
- if (monitor == gdk_display_get_monitor (display, i))
- return i;
- }
- /* Assume monitor 0 if none */
- return 0;
-}
-
-static void
-ev_gui_sanitise_popup_position (GtkMenu *menu,
- GtkWidget *widget,
- gint *x,
- gint *y)
-{
- GdkDisplay *display;
- GdkMonitor *monitor;
- GdkRectangle geometry;
- gint monitor_num;
- GtkRequisition req;
-
- g_return_if_fail (widget != NULL);
-
- gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL);
-
- display = gtk_widget_get_display (widget);
- monitor = gdk_display_get_monitor_at_point (display, *x, *y);
- monitor_num = get_monitor_number (display, monitor);
- gtk_menu_set_monitor (menu, monitor_num);
-
- gdk_monitor_get_geometry (monitor, &geometry);
-
- *x = CLAMP (*x, geometry.x, geometry.x + MAX (0, geometry.width - req.width));
- *y = CLAMP (*y, geometry.y, geometry.y + MAX (0, geometry.height - req.height));
-}
-
-void
-ev_gui_menu_position_tree_selection (GtkMenu *menu,
- gint *x,
- gint *y,
- gboolean *push_in,
- gpointer user_data)
-{
- GtkTreeSelection *selection;
- GList *selected_rows;
- GtkTreeModel *model;
- GtkTreeView *tree_view = GTK_TREE_VIEW (user_data);
- GtkWidget *widget = GTK_WIDGET (user_data);
- GtkRequisition req;
- GtkAllocation allocation;
- GdkRectangle visible;
-
- gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL);
- gdk_window_get_origin (gtk_widget_get_window (widget), x, y);
- gtk_widget_get_allocation (widget, &allocation);
-
- *x += (allocation.width - req.width) / 2;
-
- /* Add on height for the treeview title */
- gtk_tree_view_get_visible_rect (tree_view, &visible);
- *y += allocation.height - visible.height;
-
- selection = gtk_tree_view_get_selection (tree_view);
- selected_rows = gtk_tree_selection_get_selected_rows (selection, &model);
- if (selected_rows)
- {
- GdkRectangle cell_rect;
-
- gtk_tree_view_get_cell_area (tree_view, selected_rows->data,
- NULL, &cell_rect);
-
- *y += CLAMP (cell_rect.y + cell_rect.height, 0, visible.height);
-
- g_list_foreach (selected_rows, (GFunc)gtk_tree_path_free, NULL);
- g_list_free (selected_rows);
- }
-
- ev_gui_sanitise_popup_position (menu, widget, x, y);
-}
-
/**
* ev_gui_menu_popup_at_tree_view_selection:
* @menu: a #GtkMenu to show
diff --git a/shell/ev-utils.h b/shell/ev-utils.h
index f9e3020f..846df37c 100644
--- a/shell/ev-utils.h
+++ b/shell/ev-utils.h
@@ -31,11 +31,6 @@ GdkPixbuf* ev_pixbuf_add_shadow (GdkPixbuf *src, int size,
void ev_print_region_contents (cairo_region_t *region);
-void ev_gui_menu_position_tree_selection (GtkMenu *menu,
- gint *x,
- gint *y,
- gboolean *push_in,
- gpointer user_data);
void ev_gui_menu_popup_at_tree_view_selection (GtkMenu *menu,
GtkTreeView *tree_view);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]