diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | lib/ephy-gui.c | 13 |
2 files changed, 16 insertions, 6 deletions
@@ -1,3 +1,12 @@ + 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. + 2004-11-09 Christian Persch <chpe@cvs.gnome.org> * src/ephy-history-window.c: (add_by_date_filter): diff --git a/lib/ephy-gui.c b/lib/ephy-gui.c index 4fb3490fc..344625cd5 100644 --- a/lib/ephy-gui.c +++ b/lib/ephy-gui.c @@ -41,10 +41,6 @@ #include <gtk/gtkicontheme.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, @@ -81,12 +77,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) @@ -96,7 +97,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); @@ -106,7 +107,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, |