aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-11-10 04:33:17 +0800
committerChristian Persch <chpe@src.gnome.org>2004-11-10 04:33:17 +0800
commitcc7ae54f94c12a5a8dc48b517e92edcea5d63a03 (patch)
tree35acc8c3e1ebff36f269438ff312fc7e111d677c
parente636504fb5e674353ff0964f221d94f4ae446092 (diff)
downloadgsoc2013-epiphany-cc7ae54f94c12a5a8dc48b517e92edcea5d63a03.tar
gsoc2013-epiphany-cc7ae54f94c12a5a8dc48b517e92edcea5d63a03.tar.gz
gsoc2013-epiphany-cc7ae54f94c12a5a8dc48b517e92edcea5d63a03.tar.bz2
gsoc2013-epiphany-cc7ae54f94c12a5a8dc48b517e92edcea5d63a03.tar.lz
gsoc2013-epiphany-cc7ae54f94c12a5a8dc48b517e92edcea5d63a03.tar.xz
gsoc2013-epiphany-cc7ae54f94c12a5a8dc48b517e92edcea5d63a03.tar.zst
gsoc2013-epiphany-cc7ae54f94c12a5a8dc48b517e92edcea5d63a03.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.
-rw-r--r--ChangeLog9
-rw-r--r--lib/ephy-gui.c13
2 files changed, 16 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 51adda229..aba75a194 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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,