summaryrefslogtreecommitdiff
path: root/src/nautilus-pathbar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nautilus-pathbar.c')
-rw-r--r--src/nautilus-pathbar.c58
1 files changed, 11 insertions, 47 deletions
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index a0eed276c..2a44c476a 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -97,6 +97,9 @@ struct _NautilusPathBarDetails {
G_DEFINE_TYPE (NautilusPathBar, nautilus_path_bar,
GTK_TYPE_CONTAINER);
+#define ARROW_LEFT "pan-start-symbolic"
+#define ARROW_RIGHT "pan-end-symbolic"
+
static void nautilus_path_bar_scroll_up (NautilusPathBar *path_bar);
static void nautilus_path_bar_scroll_down (NautilusPathBar *path_bar);
static void nautilus_path_bar_stop_scrolling (NautilusPathBar *path_bar);
@@ -115,21 +118,18 @@ static void nautilus_path_bar_update_path (NautilusPathBar *pat
static GtkWidget *
get_slider_button (NautilusPathBar *path_bar,
- GtkArrowType arrow_type)
+ const gchar *arrow_type)
{
- GtkWidget *button;
-
- gtk_widget_push_composite_child ();
+ GtkWidget *button, *arrow;
+ arrow = gtk_image_new_from_icon_name (arrow_type, GTK_ICON_SIZE_MENU);
button = gtk_button_new ();
gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
gtk_widget_add_events (button, GDK_SCROLL_MASK);
- gtk_container_add (GTK_CONTAINER (button), gtk_arrow_new (arrow_type, GTK_SHADOW_OUT));
+ gtk_container_add (GTK_CONTAINER (button), arrow);
gtk_container_add (GTK_CONTAINER (path_bar), button);
gtk_widget_show_all (button);
- gtk_widget_pop_composite_child ();
-
return button;
}
@@ -205,8 +205,8 @@ nautilus_path_bar_init (NautilusPathBar *path_bar)
gtk_widget_set_has_window (GTK_WIDGET (path_bar), FALSE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (path_bar), FALSE);
- path_bar->priv->up_slider_button = get_slider_button (path_bar, GTK_ARROW_LEFT);
- path_bar->priv->down_slider_button = get_slider_button (path_bar, GTK_ARROW_RIGHT);
+ path_bar->priv->up_slider_button = get_slider_button (path_bar, ARROW_LEFT);
+ path_bar->priv->down_slider_button = get_slider_button (path_bar, ARROW_RIGHT);
g_signal_connect_swapped (path_bar->priv->up_slider_button, "clicked", G_CALLBACK (nautilus_path_bar_scroll_up), path_bar);
g_signal_connect_swapped (path_bar->priv->down_slider_button, "clicked", G_CALLBACK (nautilus_path_bar_scroll_down), path_bar);
@@ -467,24 +467,6 @@ _set_simple_bottom_clip (GtkWidget *widget,
gtk_widget_set_clip (widget, &clip);
}
-static void
-child_ordering_changed (NautilusPathBar *path_bar)
-{
- GList *l;
-
- if (path_bar->priv->up_slider_button) {
- gtk_style_context_invalidate (gtk_widget_get_style_context (path_bar->priv->up_slider_button));
- }
- if (path_bar->priv->down_slider_button) {
- gtk_style_context_invalidate (gtk_widget_get_style_context (path_bar->priv->down_slider_button));
- }
-
- for (l = path_bar->priv->button_list; l; l = l->next) {
- ButtonData *data = l->data;
- gtk_style_context_invalidate (gtk_widget_get_style_context (data->button));
- }
-}
-
/* This is a tad complicated */
static void
nautilus_path_bar_size_allocate (GtkWidget *widget,
@@ -501,7 +483,6 @@ nautilus_path_bar_size_allocate (GtkWidget *widget,
gint up_slider_offset;
gint down_slider_offset;
GtkRequisition child_requisition;
- gboolean needs_reorder = FALSE;
need_sliders = FALSE;
up_slider_offset = 0;
@@ -633,7 +614,6 @@ nautilus_path_bar_size_allocate (GtkWidget *widget,
}
}
- needs_reorder |= gtk_widget_get_child_visible (child) == FALSE;
gtk_widget_set_child_visible (child, TRUE);
gtk_widget_size_allocate (child, &child_allocation);
@@ -647,13 +627,11 @@ nautilus_path_bar_size_allocate (GtkWidget *widget,
/* Now we go hide all the widgets that don't fit */
while (list) {
child = BUTTON_DATA (list->data)->button;
- needs_reorder |= gtk_widget_get_child_visible (child) == TRUE;
gtk_widget_set_child_visible (child, FALSE);
list = list->prev;
}
for (list = first_button->next; list; list = list->next) {
child = BUTTON_DATA (list->data)->button;
- needs_reorder |= gtk_widget_get_child_visible (child) == TRUE;
gtk_widget_set_child_visible (child, FALSE);
}
@@ -662,7 +640,6 @@ nautilus_path_bar_size_allocate (GtkWidget *widget,
child_allocation.x = up_slider_offset + allocation->x;
gtk_widget_size_allocate (path_bar->priv->up_slider_button, &child_allocation);
- needs_reorder |= gtk_widget_get_child_visible (path_bar->priv->up_slider_button) == FALSE;
gtk_widget_set_child_visible (path_bar->priv->up_slider_button, TRUE);
gtk_widget_show_all (path_bar->priv->up_slider_button);
@@ -670,7 +647,6 @@ nautilus_path_bar_size_allocate (GtkWidget *widget,
down_slider_offset += path_bar->priv->slider_width;
}
} else {
- needs_reorder |= gtk_widget_get_child_visible (path_bar->priv->up_slider_button) == TRUE;
gtk_widget_set_child_visible (path_bar->priv->up_slider_button, FALSE);
}
@@ -679,19 +655,13 @@ nautilus_path_bar_size_allocate (GtkWidget *widget,
child_allocation.x = down_slider_offset + allocation->x;
gtk_widget_size_allocate (path_bar->priv->down_slider_button, &child_allocation);
- needs_reorder |= gtk_widget_get_child_visible (path_bar->priv->down_slider_button) == FALSE;
gtk_widget_set_child_visible (path_bar->priv->down_slider_button, TRUE);
gtk_widget_show_all (path_bar->priv->down_slider_button);
nautilus_path_bar_update_slider_buttons (path_bar);
} else {
- needs_reorder |= gtk_widget_get_child_visible (path_bar->priv->down_slider_button) == TRUE;
gtk_widget_set_child_visible (path_bar->priv->down_slider_button, FALSE);
}
- if (needs_reorder) {
- child_ordering_changed (path_bar);
- }
-
_set_simple_bottom_clip (widget, BUTTON_BOTTOM_SHADOW);
}
@@ -1748,8 +1718,6 @@ nautilus_path_bar_update_path (NautilusPathBar *path_bar,
file = nautilus_file_get (file_path);
- gtk_widget_push_composite_child ();
-
while (file != NULL) {
NautilusFile *parent_file;
@@ -1779,15 +1747,11 @@ nautilus_path_bar_update_path (NautilusPathBar *path_bar,
GtkWidget *button;
button = BUTTON_DATA (l->data)->button;
gtk_container_add (GTK_CONTAINER (path_bar), button);
- }
-
- gtk_widget_pop_composite_child ();
-
- child_ordering_changed (path_bar);
+ }
}
void
-nautilus_path_bar_set_path (NautilusPathBar *path_bar,
+nautilus_path_bar_set_path (NautilusPathBar *path_bar,
GFile *file_path)
{
ButtonData *button_data;