diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2014-09-03 15:09:26 -0700 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2014-09-03 15:16:21 -0700 |
commit | 1a05544bf0eb59928d911bf66a7bbf1d1bf7cc0d (patch) | |
tree | c7b988155008fecd47c7518e66020e206415c32e | |
parent | 7d4491cece91ca3f3d0c963cf006cb4d39f22071 (diff) | |
download | nautilus-1a05544bf0eb59928d911bf66a7bbf1d1bf7cc0d.tar.gz |
pathbar: add clip hack to buttons
Not very pretty, but this is the best we can do right now with public
API...
-rw-r--r-- | src/nautilus-pathbar.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c index 4893a59f0..a0eed276c 100644 --- a/src/nautilus-pathbar.c +++ b/src/nautilus-pathbar.c @@ -437,6 +437,35 @@ nautilus_path_bar_map (GtkWidget *widget) GTK_WIDGET_CLASS (nautilus_path_bar_parent_class)->map (widget); } +#define BUTTON_BOTTOM_SHADOW 1 + +static void +union_with_clip (GtkWidget *widget, + gpointer clip) +{ + GtkAllocation widget_clip; + + if (!gtk_widget_is_drawable (widget)) { + return; + } + + gtk_widget_get_clip (widget, &widget_clip); + + gdk_rectangle_union (&widget_clip, clip, clip); +} + +static void +_set_simple_bottom_clip (GtkWidget *widget, + gint pixels) +{ + GtkAllocation clip; + + gtk_widget_get_allocation (widget, &clip); + clip.height += pixels; + + gtk_container_forall (GTK_CONTAINER (widget), union_with_clip, &clip); + gtk_widget_set_clip (widget, &clip); +} static void child_ordering_changed (NautilusPathBar *path_bar) @@ -489,6 +518,7 @@ nautilus_path_bar_size_allocate (GtkWidget *widget, /* No path is set so we don't have to allocate anything. */ if (path_bar->priv->button_list == NULL) { + _set_simple_bottom_clip (widget, BUTTON_BOTTOM_SHADOW); return; } direction = gtk_widget_get_direction (widget); @@ -661,6 +691,8 @@ nautilus_path_bar_size_allocate (GtkWidget *widget, if (needs_reorder) { child_ordering_changed (path_bar); } + + _set_simple_bottom_clip (widget, BUTTON_BOTTOM_SHADOW); } static void |