aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-11-10 04:32:01 +0800
committerChristian Persch <chpe@src.gnome.org>2004-11-10 04:32:01 +0800
commit489e77d814f2ce449e87ba61590eb9ca9bd711bc (patch)
treed19238740164e0990d1498061d9800ef8c40a050 /lib
parent7000fbcb2798ff9a87604a0ea400881075c6be93 (diff)
downloadgsoc2013-epiphany-489e77d814f2ce449e87ba61590eb9ca9bd711bc.tar
gsoc2013-epiphany-489e77d814f2ce449e87ba61590eb9ca9bd711bc.tar.gz
gsoc2013-epiphany-489e77d814f2ce449e87ba61590eb9ca9bd711bc.tar.bz2
gsoc2013-epiphany-489e77d814f2ce449e87ba61590eb9ca9bd711bc.tar.lz
gsoc2013-epiphany-489e77d814f2ce449e87ba61590eb9ca9bd711bc.tar.xz
gsoc2013-epiphany-489e77d814f2ce449e87ba61590eb9ca9bd711bc.tar.zst
gsoc2013-epiphany-489e77d814f2ce449e87ba61590eb9ca9bd711bc.zip
Better positioning for the context menu popup in a treeview. Patch by
2004-11-09 Christian Persch <chpe@cvs.gnome.org> * lib/ephy-gui.c: (ephy_gui_menu_position_tree_selection): Better positioning for the context menu popup in a treeview. Patch by Crispin Flowerday. Remove obsolete global variables.
Diffstat (limited to 'lib')
-rw-r--r--lib/ephy-gui.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/ephy-gui.c b/lib/ephy-gui.c
index 2e2d355c1..ae389b01f 100644
--- a/lib/ephy-gui.c
+++ b/lib/ephy-gui.c
@@ -36,10 +36,6 @@
#include <gtk/gtkmain.h>
#include <gtk/gtktreeselection.h>
-/* Styles for tab labels */
-GtkStyle *loading_text_style = NULL;
-GtkStyle *new_text_style = NULL;
-
void
ephy_gui_sanitise_popup_position (GtkMenu *menu,
GtkWidget *widget,
@@ -76,12 +72,17 @@ ephy_gui_menu_position_tree_selection (GtkMenu *menu,
GtkTreeView *tree_view = GTK_TREE_VIEW (user_data);
GtkWidget *widget = GTK_WIDGET (user_data);
GtkRequisition req;
+ GdkRectangle visible;
gtk_widget_size_request (GTK_WIDGET (menu), &req);
gdk_window_get_origin (widget->window, x, y);
*x += (widget->allocation.width - req.width) / 2;
+ /* Add on height for the treeview title */
+ gtk_tree_view_get_visible_rect (tree_view, &visible);
+ *y += widget->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)
@@ -91,7 +92,7 @@ ephy_gui_menu_position_tree_selection (GtkMenu *menu,
gtk_tree_view_get_cell_area (tree_view, selected_rows->data,
NULL, &cell_rect);
- *y += CLAMP (cell_rect.y + cell_rect.height, 0, widget->allocation.height);
+ *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);
@@ -101,7 +102,7 @@ ephy_gui_menu_position_tree_selection (GtkMenu *menu,
}
/**
- * gul_gui_menu_position_under_widget:
+ * ephy_gui_menu_position_under_widget:
*/
void
ephy_gui_menu_position_under_widget (GtkMenu *menu,