+static gboolean
+gtk_path_bar_scroll_timeout (GtkPathBar *path_bar)
+{
+ gboolean retval = FALSE;
+
+ GDK_THREADS_ENTER ();
+
+ if (path_bar->timer)
+ {
+ if (path_bar->scrolling_up)
+ gtk_path_bar_scroll_up (path_bar->up_slider_button, path_bar);
+ else if (path_bar->scrolling_down)
+ gtk_path_bar_scroll_down (path_bar->down_slider_button, path_bar);
+
+ if (path_bar->need_timer)
+ {
+ GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (path_bar));
+ guint timeout;
+
+ g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
+
+ path_bar->need_timer = FALSE;
+
+ path_bar->timer = g_timeout_add (timeout * SCROLL_DELAY_FACTOR,
+ (GSourceFunc)gtk_path_bar_scroll_timeout,
+ path_bar);
+ }
+ else
+ retval = TRUE;
+ }
+
+ GDK_THREADS_LEAVE ();
+
+ return retval;
+}
+
+static void
+gtk_path_bar_stop_scrolling (GtkPathBar *path_bar)
+{
+ if (path_bar->timer)
+ {
+ g_source_remove (path_bar->timer);
+ path_bar->timer = 0;
+ path_bar->need_timer = FALSE;
+ }
+}
+
+static gboolean
+gtk_path_bar_slider_button_press (GtkWidget *widget,
+ GdkEventButton *event,
+ GtkPathBar *path_bar)
+{
+ if (event->type != GDK_BUTTON_PRESS || event->button != 1)
+ return FALSE;
+
+ path_bar->ignore_click = FALSE;
+
+ if (widget == path_bar->up_slider_button)
+ {
+ path_bar->scrolling_down = FALSE;
+ path_bar->scrolling_up = TRUE;
+ gtk_path_bar_scroll_up (path_bar->up_slider_button, path_bar);
+ }
+ else if (widget == path_bar->down_slider_button)
+ {
+ path_bar->scrolling_up = FALSE;
+ path_bar->scrolling_down = TRUE;
+ gtk_path_bar_scroll_down (path_bar->down_slider_button, path_bar);
+ }
+
+ if (!path_bar->timer)
+ {
+ GtkSettings *settings = gtk_widget_get_settings (widget);
+ guint timeout;
+
+ g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
+
+ path_bar->need_timer = TRUE;
+ path_bar->timer = g_timeout_add (timeout,
+ (GSourceFunc)gtk_path_bar_scroll_timeout,
+ path_bar);
+ }
+
+ return FALSE;
+}
+
+static gboolean
+gtk_path_bar_slider_button_release (GtkWidget *widget,
+ GdkEventButton *event,
+ GtkPathBar *path_bar)
+{
+ if (event->type != GDK_BUTTON_RELEASE)
+ return FALSE;
+
+ path_bar->ignore_click = TRUE;
+ gtk_path_bar_stop_scrolling (path_bar);
+
+ return FALSE;
+}
+
+static void
+gtk_path_bar_grab_notify (GtkWidget *widget,
+ gboolean was_grabbed)
+{
+ if (!was_grabbed)
+ gtk_path_bar_stop_scrolling (GTK_PATH_BAR (widget));
+}
+
+static void
+gtk_path_bar_state_changed (GtkWidget *widget,
+ GtkStateType previous_state)
+{
+ if (!GTK_WIDGET_IS_SENSITIVE (widget))
+ gtk_path_bar_stop_scrolling (GTK_PATH_BAR (widget));
+}
+
+
+/* Changes the icons wherever it is needed */
+static void
+reload_icons (GtkPathBar *path_bar)
+{
+ GList *list;
+
+ if (path_bar->root_icon)
+ {
+ g_object_unref (path_bar->root_icon);
+ path_bar->root_icon = NULL;
+ }
+ if (path_bar->home_icon)
+ {
+ g_object_unref (path_bar->home_icon);
+ path_bar->home_icon = NULL;
+ }
+ if (path_bar->desktop_icon)
+ {
+ g_object_unref (path_bar->desktop_icon);
+ path_bar->desktop_icon = NULL;
+ }
+
+ for (list = path_bar->button_list; list; list = list->next)
+ {
+ ButtonData *button_data;
+ gboolean current_dir;
+
+ button_data = BUTTON_DATA (list->data);
+ if (button_data->type != NORMAL_BUTTON)
+ {
+ current_dir = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_data->button));
+ gtk_path_bar_update_button_appearance (path_bar, button_data, current_dir);
+ }
+ }
+
+}
+
+static void
+change_icon_theme (GtkPathBar *path_bar)
+{
+ GtkSettings *settings;
+ gint width, height;