[gnome-builder] project-tree: clamp popover to visible region of widget
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] project-tree: clamp popover to visible region of widget
- Date: Sat, 11 Apr 2015 05:56:35 +0000 (UTC)
commit 706e8c1f5638ba229b8014d05650d9113627c285
Author: Christian Hergert <christian hergert me>
Date: Fri Apr 10 22:56:23 2015 -0700
project-tree: clamp popover to visible region of widget
If the treeview is scrollable, we could end up with a row that will put
us past the widget. GtkPopover really doesn't seem to like that. So
instead, clap the rectangle to the visible width of the widget.
src/project-tree/gb-project-tree-actions.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/project-tree/gb-project-tree-actions.c b/src/project-tree/gb-project-tree-actions.c
index cefa3f8..d10f0b0 100644
--- a/src/project-tree/gb-project-tree-actions.c
+++ b/src/project-tree/gb-project-tree-actions.c
@@ -331,8 +331,9 @@ gb_project_tree_actions_new (GbProjectTree *self,
GbTreeNode *selected;
GObject *item;
GtkPopover *popover;
- GdkRectangle rect;
IdeProjectFile *project_file;
+ GdkRectangle rect;
+ GtkAllocation alloc;
GFile *file;
g_assert (GB_IS_PROJECT_TREE (self));
@@ -359,8 +360,12 @@ gb_project_tree_actions_new (GbProjectTree *self,
if ((self->expanded_in_new = !gb_tree_node_get_expanded (selected)))
gb_tree_node_expand (selected, FALSE);
+ gtk_widget_get_allocation (GTK_WIDGET (self), &alloc);
gb_tree_node_get_area (selected, &rect);
+ if ((rect.x + rect.width) > (alloc.x + alloc.width))
+ rect.width = (alloc.x + alloc.width) - rect.x;
+
popover = g_object_new (GB_TYPE_NEW_FILE_POPOVER, NULL);
gtk_popover_set_relative_to (popover, GTK_WIDGET (self));
gtk_popover_set_pointing_to (popover, &rect);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]