[gtk+/wip/csoriano/pathbar-bin-view-window] Implement new pathbar



commit b76e57ab73bd86c0ee1133d08e3ae6160918a3f6
Author: Carlos Soriano <csoriano gnome org>
Date:   Wed Nov 4 14:36:29 2015 +0100

    Implement new pathbar

 gtk/Makefile.am                          |    6 +-
 gtk/glade/gtk-private-widgets.xml        |    2 -
 gtk/gtk.h                                |    3 +
 gtk/gtkbox.c                             |    5 +
 gtk/gtkfilechooserwidget.c               |   45 +-
 gtk/gtkfilespathbar.c                    |  541 ++++++++
 gtk/gtkfilespathbar.h                    |   83 ++
 gtk/gtkgrid.c                            |    8 +
 gtk/gtkpathbar.c                         | 2231 +++++++++---------------------
 gtk/gtkpathbar.h                         |  107 +-
 gtk/gtkpathbarcontainer.c                |  967 +++++++++++++
 gtk/gtkpathbarcontainer.h                |   84 ++
 gtk/gtkwindow.c                          |    3 +-
 gtk/makefile.msc.in                      |    1 +
 gtk/theme/Adwaita/_common.scss           |   71 +-
 gtk/theme/Adwaita/gtk-contained-dark.css |   60 +-
 gtk/theme/Adwaita/gtk-contained.css      |   60 +-
 gtk/ui/gtkfilechooserwidget.ui           |    4 +-
 tests/Makefile.am                        |   10 +
 tests/testpathbar.c                      |  330 +++++
 tests/testpathbarcontainer.c             |  149 ++
 21 files changed, 3066 insertions(+), 1704 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 2f05cbb..895019d 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -197,6 +197,7 @@ gtk_public_h_sources =              \
        gtkfilechoosernative.h  \
        gtkfilechooserwidget.h  \
        gtkfilefilter.h         \
+       gtkfilespathbar.h       \
        gtkfixed.h              \
        gtkflowbox.h            \
        gtkfontbutton.h         \
@@ -252,6 +253,7 @@ gtk_public_h_sources =              \
        gtkpagesetup.h          \
        gtkpaned.h              \
        gtkpapersize.h          \
+       gtkpathbar.h            \
        gtkplacessidebar.h      \
        gtkplug.h               \
        gtkpopover.h            \
@@ -518,8 +520,8 @@ gtk_private_h_sources =             \
        gtkmountoperationprivate.h \
        gtknativedialogprivate.h \
        gtkorientableprivate.h  \
+       gtkpathbarcontainer.h   \
        gtkpango.h              \
-       gtkpathbar.h            \
        gtkplacessidebarprivate.h       \
        gtkplacesviewprivate.h  \
        gtkplacesviewrowprivate.h       \
@@ -756,6 +758,7 @@ gtk_base_c_sources =                \
        gtkfilechooserutils.c   \
        gtkfilechooserwidget.c  \
        gtkfilefilter.c         \
+       gtkfilespathbar.c       \
        gtkfilesystem.c         \
        gtkfilesystemmodel.c    \
        gtkfixed.c              \
@@ -832,6 +835,7 @@ gtk_base_c_sources =                \
        gtkpango.c              \
        gtkpapersize.c          \
        gtkpathbar.c            \
+       gtkpathbarcontainer.c   \
        gtkplacessidebar.c      \
        gtkplacesview.c         \
        gtkplacesviewrow.c      \
diff --git a/gtk/glade/gtk-private-widgets.xml b/gtk/glade/gtk-private-widgets.xml
index d15a568..91758e4 100644
--- a/gtk/glade/gtk-private-widgets.xml
+++ b/gtk/glade/gtk-private-widgets.xml
@@ -6,7 +6,6 @@
 
   <glade-widget-classes>
     <!-- base GTK+ private widgets -->
-    <glade-widget-class name="GtkPathBar" generic-name="pathbar" title="Path Bar" 
icon-name="widget-gtk-toolbar"/>
     <glade-widget-class name="GtkColorEditor" generic-name="coloreditor" title="Color Editor" 
icon-name="widget-gtk-colorselection"/>
     <glade-widget-class name="GtkColorSwatch" generic-name="colorswatch" title="Color Swatch" 
icon-name="widget-gtk-colorselection"/>
     <glade-widget-class name="GtkColorPlane" generic-name="colorplane" title="Color Plane" 
icon-name="widget-gtk-colorselection"/>
@@ -23,7 +22,6 @@
   </glade-widget-classes>
   
   <glade-widget-group name="gtk-private" title="Private GTK+ Classes">
-    <glade-widget-class-ref name="GtkPathBar"/>
     <glade-widget-class-ref name="GtkColorEditor"/>
     <glade-widget-class-ref name="GtkColorSwatch"/>
     <glade-widget-class-ref name="GtkColorPlane"/>
diff --git a/gtk/gtk.h b/gtk/gtk.h
index a7233da..915b12a 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -102,6 +102,7 @@
 #include <gtk/gtkfilechoosernative.h>
 #include <gtk/gtkfilechooserwidget.h>
 #include <gtk/gtkfilefilter.h>
+#include <gtk/gtkfilespathbar.h>
 #include <gtk/gtkflowbox.h>
 #include <gtk/gtkfontbutton.h>
 #include <gtk/gtkfontchooser.h>
@@ -120,6 +121,7 @@
 #include <gtk/gtkglarea.h>
 #include <gtk/gtkgrid.h>
 #include <gtk/gtkheaderbar.h>
+#include <gtk/gtkpathbarcontainer.h>
 #include <gtk/gtkicontheme.h>
 #include <gtk/gtkiconview.h>
 #include <gtk/gtkimage.h>
@@ -154,6 +156,7 @@
 #include <gtk/gtkoverlay.h>
 #include <gtk/gtkpagesetup.h>
 #include <gtk/gtkpapersize.h>
+#include <gtk/gtkpathbar.h>
 #include <gtk/gtkpaned.h>
 #include <gtk/gtkplacessidebar.h>
 #include <gtk/gtkpopover.h>
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 93206cf..bcf8220 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -479,7 +479,12 @@ count_expand_children (GtkBox *box,
        {
          *visible_children += 1;
          if (child->expand || gtk_widget_compute_expand (child->widget, private->orientation))
+            {
+
+              if (GTK_IS_REVEALER (child->widget))
+                g_print ("########################## IT IS\n");
            *expand_children += 1;
+            }
        }
     }
 }
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 79a099e..333f9bc 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -49,7 +49,7 @@
 #include "gtkmessagedialog.h"
 #include "gtkmountoperation.h"
 #include "gtkpaned.h"
-#include "gtkpathbar.h"
+#include "gtkfilespathbar.h"
 #include "gtkplacessidebar.h"
 #include "gtkplacessidebarprivate.h"
 #include "gtkplacesviewprivate.h"
@@ -550,11 +550,9 @@ static void list_row_activated         (GtkTreeView           *tree_view,
 static void list_cursor_changed        (GtkTreeView           *treeview,
                                         GtkFileChooserWidget  *impl);
 
-static void path_bar_clicked (GtkPathBar            *path_bar,
-                              GFile                 *file,
-                              GFile                 *child,
-                              gboolean               child_is_hidden,
-                              GtkFileChooserWidget *impl);
+static void on_path_bar_file (GtkFilesPathBar            *path_bar,
+                              GParamSpec                 *pspec,
+                              GtkFileChooserWidget       *impl);
 
 static void update_cell_renderer_attributes (GtkFileChooserWidget *impl);
 
@@ -3034,7 +3032,7 @@ put_recent_folder_in_pathbar (GtkFileChooserWidget *impl, GtkTreeIter *iter)
   gtk_tree_model_get (GTK_TREE_MODEL (priv->recent_model), iter,
                       MODEL_COL_FILE, &file,
                       -1);
-  _gtk_path_bar_set_file (GTK_PATH_BAR (priv->browse_path_bar), file, FALSE);
+  gtk_files_path_bar_set_file (GTK_FILES_PATH_BAR (priv->browse_path_bar), file);
   g_object_unref (file);
 }
 
@@ -5482,7 +5480,7 @@ update_current_folder_get_info_cb (GCancellable *cancellable,
   if (! _gtk_file_info_consider_as_directory (info))
     goto out;
 
-  _gtk_path_bar_set_file (GTK_PATH_BAR (priv->browse_path_bar), data->file, data->keep_trail);
+  gtk_files_path_bar_set_file (GTK_FILES_PATH_BAR (priv->browse_path_bar), data->file);
 
   if (priv->current_folder != data->file)
     {
@@ -7845,24 +7843,15 @@ list_row_activated (GtkTreeView          *tree_view,
 }
 
 static void
-path_bar_clicked (GtkPathBar           *path_bar,
-                  GFile                *file,
-                  GFile                *child_file,
-                  gboolean              child_is_hidden,
+on_path_bar_file (GtkFilesPathBar      *path_bar,
+                  GParamSpec           *pspec,
                   GtkFileChooserWidget *impl)
 {
-  if (child_file)
-    pending_select_files_add (impl, child_file);
+  GFile *file;
 
-  if (!change_folder_and_display_error (impl, file, FALSE))
-    return;
+  file = gtk_files_path_bar_get_file (path_bar);
 
-  /* Say we have "/foo/bar/[.baz]" and the user clicks on "bar".  We should then
-   * show hidden files so that ".baz" appears in the file list, as it will still
-   * be shown in the path bar: "/foo/[bar]/.baz"
-   */
-  if (child_is_hidden)
-    g_object_set (impl, "show-hidden", TRUE, NULL);
+  change_folder_and_display_error (impl, file, FALSE);
 }
 
 static void
@@ -7960,7 +7949,7 @@ up_folder_handler (GtkFileChooserWidget *impl)
 {
   GtkFileChooserWidgetPrivate *priv = impl->priv;
 
-  _gtk_path_bar_up (GTK_PATH_BAR (priv->browse_path_bar));
+  //_gtk_path_bar_up (GTK_PATH_BAR (priv->browse_path_bar));
 }
 
 /* Handler for the "down-folder" keybinding signal */
@@ -7969,7 +7958,7 @@ down_folder_handler (GtkFileChooserWidget *impl)
 {
   GtkFileChooserWidgetPrivate *priv = impl->priv;
 
-  _gtk_path_bar_down (GTK_PATH_BAR (priv->browse_path_bar));
+  //_gtk_path_bar_down (GTK_PATH_BAR (priv->browse_path_bar));
 }
 
 /* Handler for the "home-folder" keybinding signal */
@@ -8498,7 +8487,7 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
   gtk_widget_class_bind_template_callback (widget_class, list_selection_changed);
   gtk_widget_class_bind_template_callback (widget_class, list_cursor_changed);
   gtk_widget_class_bind_template_callback (widget_class, filter_combo_changed);
-  gtk_widget_class_bind_template_callback (widget_class, path_bar_clicked);
+  gtk_widget_class_bind_template_callback (widget_class, on_path_bar_file);
   gtk_widget_class_bind_template_callback (widget_class, places_sidebar_open_location_cb);
   gtk_widget_class_bind_template_callback (widget_class, places_sidebar_show_error_message_cb);
   gtk_widget_class_bind_template_callback (widget_class, places_sidebar_show_other_locations_with_flags_cb);
@@ -8564,10 +8553,8 @@ post_process_ui (GtkFileChooserWidget *impl)
 
   g_list_free (cells);
 
-  /* Set the GtkPathBar file system backend */
-  _gtk_path_bar_set_file_system (GTK_PATH_BAR (impl->priv->browse_path_bar), impl->priv->file_system);
   file = g_file_new_for_path ("/");
-  _gtk_path_bar_set_file (GTK_PATH_BAR (impl->priv->browse_path_bar), file, FALSE);
+  gtk_files_path_bar_set_file (GTK_FILES_PATH_BAR (impl->priv->browse_path_bar), file);
   g_object_unref (file);
 
   /* Set the fixed size icon renderer, this requires
@@ -8634,7 +8621,7 @@ gtk_file_chooser_widget_init (GtkFileChooserWidget *impl)
   /* Ensure GTK+ private types used by the template
    * definition before calling gtk_widget_init_template()
    */
-  g_type_ensure (GTK_TYPE_PATH_BAR);
+  g_type_ensure (GTK_TYPE_FILES_PATH_BAR);
   g_type_ensure (GTK_TYPE_PLACES_VIEW);
 
   gtk_widget_init_template (GTK_WIDGET (impl));
diff --git a/gtk/gtkfilespathbar.c b/gtk/gtkfilespathbar.c
new file mode 100644
index 0000000..7400bae
--- /dev/null
+++ b/gtk/gtkfilespathbar.c
@@ -0,0 +1,541 @@
+/* gtkfilespathbar.c
+ *
+ * Copyright (C) 2015 Red Hat
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Carlos Soriano <csoriano gnome org>
+ */
+
+#include "config.h"
+
+#include "gtkfilespathbar.h"
+#include "gtkpathbar.h"
+#include "gtkpopover.h"
+
+#include "gtkintl.h"
+#include "gtkmarshalers.h"
+#include "gtktypebuiltins.h"
+
+#define LOCAL_FILESYSTEM_ROOT_URI "file:///"
+#define OTHER_LOCATIONS_URI "other-locations:///"
+/**
+ * SECTION:gtkfilespathbar
+ * @Short_description: Widget that displays a path in UNIX format in a button-like manner
+ * @Title: GtkFilesPathBar
+ * @See_also: #GtkPathBar, #GtkFileChooser
+ *
+ * #GtkFilesPathBar is a stock widget that displays a path in UNIX format in a way that
+ * the user can interact with it, selecting part of it or providing menus for
+ * every part of the path.
+ *
+ * Given the usual big lenght of paths, it conveniently manages the overflow of it,
+ * hiding the parts of the path that doesn't have snouegh space to be displayed
+ * in a overflow popover
+ */
+
+struct _GtkFilesPathBarPrivate
+{
+  GtkWidget *path_bar;
+
+  GFile *file;
+  GCancellable *cancellable;
+  GFileMonitor *monitor;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GtkFilesPathBar, gtk_files_path_bar, GTK_TYPE_BIN)
+
+enum {
+  POPULATE_POPUP,
+  LAST_SIGNAL
+};
+
+enum {
+  PROP_0,
+  PROP_FILE,
+  LAST_PROP
+};
+
+static GParamSpec *files_path_bar_properties[LAST_PROP] = { NULL, };
+static guint files_path_bar_signals[LAST_SIGNAL] = { 0 };
+
+typedef struct {
+  GtkFilesPathBar *path_bar;
+  GString *display_path;
+  GFile *root_file;
+  gchar *root_label;
+  GIcon *root_icon;
+  GCancellable *cancellable;
+} PathFilesInfo;
+
+static GMount*
+get_mounted_mount_for_root (GFile *file)
+{
+  GVolumeMonitor *volume_monitor;
+  GList *mounts;
+  GList *l;
+  GMount *mount;
+  GMount *result = NULL;
+  GFile *root = NULL;
+  GFile *default_location = NULL;
+
+  volume_monitor = g_volume_monitor_get ();
+  mounts = g_volume_monitor_get_mounts (volume_monitor);
+
+  for (l = mounts; l != NULL; l = l->next)
+    {
+      mount = l->data;
+
+      if (g_mount_is_shadowed (mount))
+        continue;
+
+      root = g_mount_get_root (mount);
+      if (g_file_equal (file, root))
+        {
+          result = g_object_ref (mount);
+          break;
+        }
+
+      default_location = g_mount_get_default_location (mount);
+      if (!g_file_equal (default_location, root) &&
+          g_file_equal (file, default_location))
+        {
+          result = g_object_ref (mount);
+          break;
+        }
+    }
+
+  g_clear_object (&root);
+  g_clear_object (&default_location);
+  g_list_free_full (mounts, g_object_unref);
+
+  return result;
+}
+
+static gboolean
+file_is_home_dir (GFile *file)
+{
+  gboolean is_home_dir;
+  gchar *path;
+
+  path = g_file_get_path (file);
+
+  is_home_dir = g_strcmp0 (path, g_get_home_dir ()) == 0;
+
+  if (path)
+    g_free (path);
+
+  return is_home_dir;
+}
+
+static gboolean
+file_is_absolute_root (GFile *file)
+{
+  gboolean is_filesystem_root;
+  gchar *file_basename;
+
+  file_basename = g_file_get_basename (file);
+  is_filesystem_root = g_strcmp0 (file_basename, G_DIR_SEPARATOR_S) == 0;
+
+  g_free (file_basename);
+
+  return is_filesystem_root;
+}
+
+static gboolean
+file_is_root (GFile *file)
+{
+  GMount *mount;
+  gboolean is_root = FALSE;
+
+  mount = get_mounted_mount_for_root (file);
+
+  is_root = file_is_absolute_root (file) || file_is_home_dir (file) || mount;
+
+  g_clear_object (&mount);
+
+  return is_root;
+}
+
+static GIcon*
+get_root_icon (GFile *file)
+{
+  GIcon *icon = NULL;
+  GFile *local_filesystem_file;
+
+  local_filesystem_file = g_file_new_for_uri (LOCAL_FILESYSTEM_ROOT_URI);
+  if (g_file_equal (file, local_filesystem_file))
+    icon = g_themed_icon_new ("drive-harddisk");
+
+  g_object_unref (local_filesystem_file);
+
+  return icon;
+}
+
+static gchar*
+get_root_label (GFile *file)
+{
+  gchar *label = NULL;
+  gchar *path;
+  GMount *mount;
+  GFile *other_locations;
+
+  path = g_file_get_path (file);
+  mount = get_mounted_mount_for_root (file);
+  other_locations = g_file_new_for_uri (OTHER_LOCATIONS_URI);
+  if (g_strcmp0 (path, g_get_home_dir ()) == 0)
+    label = g_strdup (_("Home"));
+  else if (g_file_equal (file, other_locations))
+    label = g_strdup (_("Other Locations"));
+  else if (mount)
+    label = g_mount_get_name (mount);
+
+  if (path)
+    g_free (path);
+  g_clear_object (&mount);
+  g_object_unref (other_locations);
+
+  return label;
+}
+
+static void
+free_path_files_info (PathFilesInfo *path_files_info)
+{
+  if (path_files_info->display_path)
+    g_string_free (path_files_info->display_path, TRUE);
+  if (path_files_info->root_label)
+    g_free (path_files_info->root_label);
+
+  g_clear_object (&path_files_info->cancellable);
+  g_clear_object (&path_files_info->root_file);
+  g_clear_object (&path_files_info->root_icon);
+
+  g_slice_free (PathFilesInfo, path_files_info);
+}
+
+static void
+on_all_path_files_info_queried (PathFilesInfo *path_files_info)
+{
+  GtkFilesPathBarPrivate *priv = gtk_files_path_bar_get_instance_private (path_files_info->path_bar);
+  gchar *root_uri;
+
+  root_uri = g_file_get_uri (path_files_info->root_file);
+  gtk_path_bar_set_path_extended (GTK_PATH_BAR (priv->path_bar),
+                                  path_files_info->display_path->str, root_uri,
+                                  path_files_info->root_label, path_files_info->root_icon);
+
+  g_free (root_uri);
+  free_path_files_info (path_files_info);
+}
+
+static void
+on_queried_file_info (GObject      *object,
+                      GAsyncResult *result,
+                      gpointer      user_data)
+{
+  GFile *file = G_FILE (object);
+  GError *error = NULL;
+  PathFilesInfo *path_files_info = (PathFilesInfo *) user_data;
+  GFileInfo *file_info = NULL;
+  gchar *uri;
+
+  uri = g_file_get_uri (file);
+  if (g_cancellable_is_cancelled (path_files_info->cancellable))
+    {
+      free_path_files_info (path_files_info);
+      goto out;
+    }
+
+  file_info = g_file_query_info_finish (file, result, &error);
+  if (!error || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED))
+    {
+      if (file_is_root (file))
+        {
+
+          uri = g_file_get_uri (file);
+          path_files_info->root_icon = get_root_icon (file);
+          path_files_info->root_label = get_root_label (file);
+          path_files_info->root_file = g_object_ref (file);
+          /* If it is not specific root managed by us, just query display name */
+          if (!path_files_info->root_label && !path_files_info->root_icon)
+            {
+              if (!error)
+                {
+                  path_files_info->root_label = g_strdup (g_file_info_get_display_name (file_info));
+                }
+              else
+                {
+                  g_warning ("Error trying to get info from %s, location not supported", uri);
+
+                  free_path_files_info (path_files_info);
+
+                  goto out;
+                }
+            }
+
+          g_string_prepend (path_files_info->display_path, uri);
+          on_all_path_files_info_queried (path_files_info);
+        }
+      else
+        {
+          GFile *parent;
+
+          parent = g_file_get_parent (file);
+
+          g_string_prepend (path_files_info->display_path, g_file_info_get_display_name (file_info));
+          g_string_prepend (path_files_info->display_path, G_DIR_SEPARATOR_S);
+          g_file_query_info_async (parent,
+                                   "standard::display-name",
+                                   G_FILE_QUERY_INFO_NONE,
+                                   G_PRIORITY_DEFAULT,
+                                   path_files_info->cancellable,
+                                   on_queried_file_info,
+                                   path_files_info);
+        }
+    }
+  else
+    {
+      g_warning ("%s", error->message);
+
+      free_path_files_info (path_files_info);
+    }
+
+out:
+  g_object_unref (file);
+  g_clear_object (&file_info);
+  if (error)
+    g_error_free (error);
+  g_free (uri);
+}
+
+static void
+on_path_bar_populate_popup (GtkPathBar      *path_bar,
+                            GtkWidget       *container,
+                            const gchar     *selected_path,
+                            GtkFilesPathBar *self)
+{
+  GFile *file;
+
+  file = g_file_new_for_path (selected_path);
+  g_signal_emit (self, files_path_bar_signals[POPULATE_POPUP], 0,
+                 container, file);
+}
+
+static void
+on_path_bar_selected_path (GtkPathBar      *path_bar,
+                           GParamSpec      *pspec,
+                           GtkFilesPathBar *self)
+{
+  GFile *file;
+
+  file = g_file_new_for_uri (gtk_path_bar_get_selected_path (path_bar));
+
+  gtk_files_path_bar_set_file (self, file);
+
+  g_object_unref (file);
+}
+
+static void
+gtk_files_path_bar_dispose (GObject *object)
+{
+  GtkFilesPathBar *self = (GtkFilesPathBar *)object;
+  GtkFilesPathBarPrivate *priv = gtk_files_path_bar_get_instance_private (self);
+
+  g_cancellable_cancel (priv->cancellable);
+  g_clear_object (&priv->cancellable);
+  g_clear_object (&priv->file);
+
+  G_OBJECT_CLASS (gtk_files_path_bar_parent_class)->dispose (object);
+}
+
+static void
+gtk_files_path_bar_get_property (GObject    *object,
+                                 guint       prop_id,
+                                 GValue     *value,
+                                 GParamSpec *pspec)
+{
+  GtkFilesPathBar *self = GTK_FILES_PATH_BAR (object);
+  GtkFilesPathBarPrivate *priv = gtk_files_path_bar_get_instance_private (self);
+
+  switch (prop_id)
+    {
+    case PROP_FILE:
+      g_value_set_object (value, priv->file);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+gtk_files_path_bar_set_property (GObject      *object,
+                           guint         prop_id,
+                           const GValue *value,
+                           GParamSpec   *pspec)
+{
+  GtkFilesPathBar *self = GTK_FILES_PATH_BAR (object);
+
+  switch (prop_id)
+    {
+    case PROP_FILE:
+      gtk_files_path_bar_set_file (self, g_value_get_object (value));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+gtk_files_path_bar_class_init (GtkFilesPathBarClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  object_class->dispose = gtk_files_path_bar_dispose;
+  object_class->get_property = gtk_files_path_bar_get_property;
+  object_class->set_property = gtk_files_path_bar_set_property;
+
+  /**
+   * GtkFilesPathBar::populate-popup:
+   * @files_path_bar: the object which received the signal.
+   * @container: (type Gtk.Widget): a #GtkContainer
+   * @path: (type const gchar*): string of the path where the user performed a right click.
+   *
+   * The path bar emits this signal when the user invokes a contextual
+   * popup on one of its items. In the signal handler, the application may
+   * add extra items to the menu as appropriate. For example, a file manager
+   * may want to add a "Properties" command to the menu.
+   *
+   * The @container and all its contents are destroyed after the user
+   * dismisses the popup. The popup is re-created (and thus, this signal is
+   * emitted) every time the user activates the contextual menu.
+   *
+   * Since: 3.20
+   */
+  files_path_bar_signals [POPULATE_POPUP] =
+          g_signal_new (I_("populate-popup"),
+                        G_OBJECT_CLASS_TYPE (object_class),
+                        G_SIGNAL_RUN_FIRST,
+                        G_STRUCT_OFFSET (GtkFilesPathBarClass, populate_popup),
+                        NULL, NULL,
+                        _gtk_marshal_VOID__OBJECT_STRING,
+                        G_TYPE_NONE, 2,
+                        GTK_TYPE_WIDGET,
+                        G_TYPE_STRING);
+
+  files_path_bar_properties[PROP_FILE] =
+          g_param_spec_object ("file",
+                               P_("File"),
+                               P_("The file set in the path bar."),
+                               G_TYPE_FILE,
+                               G_PARAM_READWRITE);
+
+  g_object_class_install_properties (object_class, LAST_PROP, files_path_bar_properties);
+
+  gtk_widget_class_set_css_name (widget_class, "files-path-bar");
+}
+
+static void
+gtk_files_path_bar_init (GtkFilesPathBar *self)
+{
+  GtkFilesPathBarPrivate *priv = gtk_files_path_bar_get_instance_private (self);
+
+  g_type_ensure (GTK_TYPE_FILES_PATH_BAR);
+
+  priv->path_bar = gtk_path_bar_new ();
+  gtk_path_bar_set_inverted (GTK_PATH_BAR (priv->path_bar), TRUE);
+  gtk_widget_show (priv->path_bar);
+  g_signal_connect (GTK_PATH_BAR (priv->path_bar), "populate-popup",
+                    G_CALLBACK (on_path_bar_populate_popup), self);
+  g_signal_connect (GTK_PATH_BAR (priv->path_bar), "notify::selected-path",
+                    G_CALLBACK (on_path_bar_selected_path), self);
+  gtk_container_add (GTK_CONTAINER (self), priv->path_bar);
+}
+
+/**
+ * gtk_files_path_bar_get_file:
+ * @files_path_bar: a #GtkFilesPathBar
+ *
+ * Get the path represented by the files path bar
+ *
+ * Returns: (transfer none): The current #GFile.
+ *
+ * Since: 3.20
+ */
+GFile*
+gtk_files_path_bar_get_file (GtkFilesPathBar *self)
+{
+  GtkFilesPathBarPrivate *priv;
+
+  g_return_val_if_fail (GTK_IS_FILES_PATH_BAR (self), NULL);
+
+  priv = gtk_files_path_bar_get_instance_private (GTK_FILES_PATH_BAR (self));
+
+  return priv->file;
+}
+
+/**
+ * gtk_files_path_bar_set_file:
+ * @files_path_bar: a #GtkFilesPathBar
+ * @file: the #GFile.
+ *
+ * Set the #GFile represented by the path bar.
+ *
+ * Since: 3.20
+ */
+void
+gtk_files_path_bar_set_file (GtkFilesPathBar *self,
+                             GFile           *file)
+{
+  GtkFilesPathBarPrivate *priv;
+  PathFilesInfo *path_files_info;
+
+  g_return_if_fail (GTK_IS_FILES_PATH_BAR (self));
+
+  priv = gtk_files_path_bar_get_instance_private (GTK_FILES_PATH_BAR (self));
+
+  if (priv->file && g_file_equal (priv->file, file))
+    return;
+
+  g_cancellable_cancel (priv->cancellable);
+  g_clear_object (&priv->cancellable);
+  priv->cancellable = g_cancellable_new ();
+
+  g_clear_object (&priv->file);
+  priv->file = g_object_ref (file);
+
+  path_files_info = g_slice_new (PathFilesInfo);
+  path_files_info->path_bar = self;
+  path_files_info->display_path = g_string_new ("");
+  path_files_info->root_file = NULL;
+  path_files_info->root_label = NULL;
+  path_files_info->root_icon = NULL;
+  path_files_info->cancellable = g_object_ref (priv->cancellable);
+
+  g_file_query_info_async (g_object_ref (file),
+                           "standard::display-name",
+                           G_FILE_QUERY_INFO_NONE,
+                           G_PRIORITY_DEFAULT,
+                           path_files_info->cancellable,
+                           on_queried_file_info,
+                           path_files_info);
+
+  g_object_notify_by_pspec (G_OBJECT (self), files_path_bar_properties[PROP_FILE]);
+}
+
+GtkWidget *
+gtk_files_path_bar_new (void)
+{
+  return g_object_new (GTK_TYPE_FILES_PATH_BAR, NULL);
+}
diff --git a/gtk/gtkfilespathbar.h b/gtk/gtkfilespathbar.h
new file mode 100644
index 0000000..498335f
--- /dev/null
+++ b/gtk/gtkfilespathbar.h
@@ -0,0 +1,83 @@
+/* gtkfilespathbar.h
+ *
+ * Copyright (C) 2015 Red Hat
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Carlos Soriano <csoriano gnome org>
+ */
+
+#ifndef __GTK_FILES_PATH_BAR_H__
+#define __GTK_FILES_PATH_BAR_H__
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#include <gtk/gtkbin.h>
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_FILES_PATH_BAR            (gtk_files_path_bar_get_type())
+#define GTK_FILES_PATH_BAR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FILES_PATH_BAR, 
GtkFilesPathBar))
+#define GTK_FILES_PATH_BAR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FILES_PATH_BAR, 
GtkFilesPathBarClass))
+#define GTK_IS_FILES_PATH_BAR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FILES_PATH_BAR))
+#define GTK_IS_FILES_PATH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FILES_PATH_BAR)
+#define GTK_FILES_PATH_BAR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FILES_PATH_BAR, 
GtkFilesPathBarClass))
+
+typedef struct _GtkFilesPathBar GtkFilesPathBar;
+typedef struct _GtkFilesPathBarClass GtkFilesPathBarClass;
+typedef struct _GtkFilesPathBarPrivate GtkFilesPathBarPrivate;
+
+struct _GtkFilesPathBarClass
+{
+  GtkBinClass parent;
+
+  /*< public >*/
+
+  void                (* populate_popup)              (GtkFilesPathBar       *files_path_bar,
+                                                       GFile                 *selected_file);
+  /*< private >*/
+
+  /* Padding for future expansion */
+  gpointer reserved[10];
+};
+
+struct _GtkFilesPathBar
+{
+  GtkBin parent_instance;
+};
+
+GDK_AVAILABLE_IN_3_20
+GType                 gtk_files_path_bar_get_type              (void) G_GNUC_CONST;
+GDK_AVAILABLE_IN_3_20
+GtkWidget*            gtk_files_path_bar_new                   (void);
+GDK_AVAILABLE_IN_3_20
+void                  gtk_files_path_bar_set_file              (GtkFilesPathBar       *files_path_bar,
+                                                                GFile                 *file);
+GDK_AVAILABLE_IN_3_20
+GFile*                gtk_files_path_bar_get_file              (GtkFilesPathBar       *files_path_bar);
+
+GDK_AVAILABLE_IN_3_20
+gboolean              gtk_files_path_bar_get_edit_mode_enabled (GtkFilesPathBar       *files_path_bar);
+
+GDK_AVAILABLE_IN_3_20
+void                  gtk_files_path_bar_set_edit_mode_enabled (GtkFilesPathBar       *files_path_bar,
+                                                                gboolean               enable);
+
+
+G_END_DECLS
+
+#endif /* __GTK_FILES_PATH_BAR_H__ */
diff --git a/gtk/gtkgrid.c b/gtk/gtkgrid.c
index 5fed33f..a7e2c50 100644
--- a/gtk/gtkgrid.c
+++ b/gtk/gtkgrid.c
@@ -29,6 +29,7 @@
 #include "gtkcontainerprivate.h"
 #include "gtkcsscustomgadgetprivate.h"
 #include "gtkprivate.h"
+#include "gtkrevealer.h"
 #include "gtkintl.h"
 
 
@@ -1000,7 +1001,12 @@ gtk_grid_request_compute_expand (GtkGridRequest *request,
       line = &lines->lines[attach->pos - lines->min];
       line->empty = FALSE;
       if (gtk_widget_compute_expand (child->widget, orientation))
+        {
+
+              if (GTK_IS_REVEALER (child->widget))
+                g_print ("########################## IT IS\n");
         line->expand = TRUE;
+        }
     }
 
   for (list = priv->children; list; list = list->next)
@@ -1030,6 +1036,8 @@ gtk_grid_request_compute_expand (GtkGridRequest *request,
 
       if (!has_expand && gtk_widget_compute_expand (child->widget, orientation))
         {
+              if (GTK_IS_REVEALER (child->widget))
+                g_print ("########################## IT IS\n");
           for (i = 0; i < attach->span; i++)
             {
              if (attach->pos + i >= max || attach->pos + 1 < min)
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index c626a3e..485f8bb 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -1,1849 +1,928 @@
-/* -*- Mode: C; c-file-style: "gnu"; tab-width: 8 -*- */
-/* gtkpathbar.c
- * Copyright (C) 2004  Red Hat, Inc.,  Jonathan Blandford <jrb gnome org>
+/* gtkpath_bar.c
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Copyright (C) 2015 Red Hat
  *
- * This library is distributed in the hope that it will be useful,
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
- * You should have received a copy of the GNU Library General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ * Authors: Carlos Soriano <csoriano gnome org>
  */
 
 #include "config.h"
 
+#include "gtkmain.h"
 #include "gtkpathbar.h"
-
-#include <string.h>
-
+#include "gtkstack.h"
+#include "gtkentry.h"
+#include "gtkbutton.h"
+#include "gtktogglebutton.h"
+#include "gtklabel.h"
 #include "gtkbox.h"
-#include "gtkcssnodeprivate.h"
-#include "gtkdnd.h"
-#include "gtkdragsource.h"
-#include "gtkicontheme.h"
-#include "gtkimage.h"
+#include "gtkmenubutton.h"
+#include "gtkpopover.h"
+#include "gtkbuilder.h"
+#include "gtkstylecontext.h"
+
 #include "gtkintl.h"
-#include "gtklabel.h"
-#include "gtkmain.h"
 #include "gtkmarshalers.h"
-#include "gtksettings.h"
-#include "gtktogglebutton.h"
-#include "gtkwidgetpath.h"
-#include "gtkwidgetprivate.h"
+#include "gtktypebuiltins.h"
+#include "gtkpathbarcontainer.h"
+
+/**
+ * SECTION:gtkpath_bar
+ * @Short_description: Widget that displays a path in UNIX format in a button-like manner
+ * @Title: GtkPathBar
+ * @See_also: #GtkFileChooser
+ *
+ * #GtkPathBar is a stock widget that displays a path in UNIX format in a way that
+ * the user can interact with it, selecting part of it or providing menus for
+ * every part of the path.
+ *
+ * Given the usual big lenght of paths, it conveniently manages the overflow of it,
+ * hiding the parts of the path that doesn't have snouegh space to be displayed
+ * in a overflow popover
+ *
+ * The #GtkPathBar does not perform any file handling.
+ * If file handling is needed #GtkFilesPathBar is the correct widget.
+ */
 
 struct _GtkPathBarPrivate
 {
-  GtkFileSystem *file_system;
-  GFile *root_file;
-  GFile *home_file;
-  GFile *desktop_file;
-
-  GCancellable *get_info_cancellable;
+  GtkWidget *path_bar_containers_stack;
+  GtkWidget *path_bar_container_1;
+  GtkWidget *path_bar_container_2;
+  GtkWidget *path_box_1;
+  GtkWidget *path_box_2;
+  GtkWidget *overflow_button_1;
+  GtkWidget *overflow_button_2;
+  GtkWidget *path_chunk_popover_container;
 
   GIcon *root_icon;
-  GIcon *home_icon;
-  GIcon *desktop_icon;
-
-  GdkWindow *event_window;
-
-  GList *button_list;
-  GList *first_scrolled_button;
-  GList *fake_root;
-  GtkWidget *up_slider_button;
-  GtkWidget *down_slider_button;
-  guint settings_signal_id;
-  gint16 slider_width;
-  gint16 button_offset;
-  guint timer;
-  guint slider_visible : 1;
-  guint need_timer     : 1;
-  guint ignore_click   : 1;
-  guint scrolling_up   : 1;
-  guint scrolling_down : 1;
+  gchar *root_label;
+  gchar *root_path;
+
+  gchar *path;
+  gchar *selected_path;
+  gint inverted :1;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (GtkPathBar, gtk_path_bar, GTK_TYPE_BIN)
+
 enum {
-  PATH_CLICKED,
+  POPULATE_POPUP,
   LAST_SIGNAL
 };
 
-typedef enum {
-  NORMAL_BUTTON,
-  ROOT_BUTTON,
-  HOME_BUTTON,
-  DESKTOP_BUTTON
-} ButtonType;
-
-#define BUTTON_DATA(x) ((ButtonData *)(x))
-
-#define SCROLL_DELAY_FACTOR 5
-#define TIMEOUT_INITIAL     500
-#define TIMEOUT_REPEAT      50
-
-static guint path_bar_signals [LAST_SIGNAL] = { 0 };
-
-/* Icon size for if we can't get it from the theme */
-#define FALLBACK_ICON_SIZE 16
+enum {
+  PROP_0,
+  PROP_PATH,
+  PROP_SELECTED_PATH,
+  PROP_INVERTED,
+  LAST_PROP
+};
 
-typedef struct _ButtonData ButtonData;
+static GParamSpec *path_bar_properties[LAST_PROP] = { NULL, };
+static guint path_bar_signals[LAST_SIGNAL] = { 0 };
 
-struct _ButtonData
-{
+typedef struct {
   GtkWidget *button;
-  ButtonType type;
-  char *dir_name;
-  GFile *file;
-  GtkWidget *image;
-  GtkWidget *label;
-  GCancellable *cancellable;
-  guint ignore_changes : 1;
-  guint file_is_hidden : 1;
-};
-/* This macro is used to check if a button can be used as a fake root.
- * All buttons in front of a fake root are automatically hidden when in a
- * directory below a fake root and replaced with the "<" arrow button.
- */
-#define BUTTON_IS_FAKE_ROOT(button) ((button)->type == HOME_BUTTON)
-
-G_DEFINE_TYPE_WITH_PRIVATE (GtkPathBar, gtk_path_bar, GTK_TYPE_CONTAINER)
-
-static void gtk_path_bar_finalize                 (GObject          *object);
-static void gtk_path_bar_dispose                  (GObject          *object);
-static void gtk_path_bar_realize                  (GtkWidget        *widget);
-static void gtk_path_bar_unrealize                (GtkWidget        *widget);
-static void gtk_path_bar_get_preferred_width      (GtkWidget        *widget,
-                                                   gint             *minimum,
-                                                   gint             *natural);
-static void gtk_path_bar_get_preferred_height     (GtkWidget        *widget,
-                                                   gint             *minimum,
-                                                   gint             *natural);
-static void gtk_path_bar_map                      (GtkWidget        *widget);
-static void gtk_path_bar_unmap                    (GtkWidget        *widget);
-static void gtk_path_bar_size_allocate            (GtkWidget        *widget,
-                                                  GtkAllocation    *allocation);
-static void gtk_path_bar_add                      (GtkContainer     *container,
-                                                  GtkWidget        *widget);
-static void gtk_path_bar_remove                   (GtkContainer     *container,
-                                                  GtkWidget        *widget);
-static void gtk_path_bar_forall                   (GtkContainer     *container,
-                                                  gboolean          include_internals,
-                                                  GtkCallback       callback,
-                                                  gpointer          callback_data);
-static gboolean gtk_path_bar_scroll               (GtkWidget        *widget,
-                                                  GdkEventScroll   *event);
-static void gtk_path_bar_scroll_up                (GtkPathBar       *path_bar);
-static void gtk_path_bar_scroll_down              (GtkPathBar       *path_bar);
-static void gtk_path_bar_stop_scrolling           (GtkPathBar       *path_bar);
-static gboolean gtk_path_bar_slider_up_defocus    (GtkWidget        *widget,
-                                                  GdkEventButton   *event,
-                                                  GtkPathBar       *path_bar);
-static gboolean gtk_path_bar_slider_down_defocus  (GtkWidget        *widget,
-                                                  GdkEventButton   *event,
-                                                  GtkPathBar       *path_bar);
-static gboolean gtk_path_bar_slider_button_press  (GtkWidget        *widget,
-                                                  GdkEventButton   *event,
-                                                  GtkPathBar       *path_bar);
-static gboolean gtk_path_bar_slider_button_release(GtkWidget        *widget,
-                                                  GdkEventButton   *event,
-                                                  GtkPathBar       *path_bar);
-static void gtk_path_bar_grab_notify              (GtkWidget        *widget,
-                                                  gboolean          was_grabbed);
-static void gtk_path_bar_state_changed            (GtkWidget        *widget,
-                                                  GtkStateType      previous_state);
-static void gtk_path_bar_style_updated            (GtkWidget        *widget);
-static void gtk_path_bar_screen_changed           (GtkWidget        *widget,
-                                                  GdkScreen        *previous_screen);
-static void gtk_path_bar_check_icon_theme         (GtkPathBar       *path_bar);
-static void gtk_path_bar_update_button_appearance (GtkPathBar       *path_bar,
-                                                  ButtonData       *button_data,
-                                                  gboolean          current_dir);
-
-static void
-on_slider_unmap (GtkWidget  *widget,
-                GtkPathBar *path_bar)
-{
-  if (path_bar->priv->timer &&
-      ((widget == path_bar->priv->up_slider_button && path_bar->priv->scrolling_up) ||
-       (widget == path_bar->priv->down_slider_button && path_bar->priv->scrolling_down)))
-    gtk_path_bar_stop_scrolling (path_bar);
-}
+  GIcon *icon;
+  gchar *label;
+  gchar *path;
+  GtkPathBar *path_bar;
+} PathChunkData;
 
 static void
-gtk_path_bar_init (GtkPathBar *path_bar)
+emit_populate_popup (GtkPathBar  *self,
+                     const gchar *path)
 {
-  GtkStyleContext *context;
-
-  path_bar->priv = gtk_path_bar_get_instance_private (path_bar);
-
-  gtk_widget_init_template (GTK_WIDGET (path_bar));
-
-  /* Add the children manually because GtkPathBar derives from an abstract class,
-   * Glade cannot edit a <template> in gtkpathbar.ui if it's only a GtkContainer.
-   */
-  gtk_container_add (GTK_CONTAINER (path_bar), path_bar->priv->up_slider_button);
-  gtk_container_add (GTK_CONTAINER (path_bar), path_bar->priv->down_slider_button);
-
-  /* GtkBuilder wont let us connect 'swapped' without specifying the signal's
-   * user data in the .ui file
-   */
-  g_signal_connect_swapped (path_bar->priv->up_slider_button, "clicked",
-                           G_CALLBACK (gtk_path_bar_scroll_up), path_bar);
-  g_signal_connect_swapped (path_bar->priv->down_slider_button, "clicked",
-                           G_CALLBACK (gtk_path_bar_scroll_down), path_bar);
-
-  gtk_widget_set_has_window (GTK_WIDGET (path_bar), FALSE);
-  gtk_widget_set_redraw_on_allocate (GTK_WIDGET (path_bar), FALSE);
-
-  context = gtk_widget_get_style_context (GTK_WIDGET (path_bar));
-  gtk_style_context_add_class (context, "path-bar");
-  gtk_style_context_add_class (context, GTK_STYLE_CLASS_LINKED);
+  GtkPathBarPrivate *priv = gtk_path_bar_get_instance_private (GTK_PATH_BAR (self));
 
-  path_bar->priv->get_info_cancellable = NULL;
+  g_signal_emit (self, path_bar_signals[POPULATE_POPUP], 0,
+                 priv->path_chunk_popover_container, path);
 }
 
 static void
-gtk_path_bar_class_init (GtkPathBarClass *path_bar_class)
+get_path_bar_widgets (GtkPathBar *self,
+                      GtkWidget  **path_bar,
+                      GtkWidget  **overflow_button,
+                      GtkWidget  **path_box,
+                      gboolean    current)
 {
-  GObjectClass *gobject_class;
-  GtkWidgetClass *widget_class;
-  GtkContainerClass *container_class;
-
-  gobject_class = (GObjectClass *) path_bar_class;
-  widget_class = (GtkWidgetClass *) path_bar_class;
-  container_class = (GtkContainerClass *) path_bar_class;
-
-  gobject_class->finalize = gtk_path_bar_finalize;
-  gobject_class->dispose = gtk_path_bar_dispose;
-
-  widget_class->get_preferred_width = gtk_path_bar_get_preferred_width;
-  widget_class->get_preferred_height = gtk_path_bar_get_preferred_height;
-  widget_class->realize = gtk_path_bar_realize;
-  widget_class->unrealize = gtk_path_bar_unrealize;
-  widget_class->map = gtk_path_bar_map;
-  widget_class->unmap = gtk_path_bar_unmap;
-  widget_class->size_allocate = gtk_path_bar_size_allocate;
-  widget_class->style_updated = gtk_path_bar_style_updated;
-  widget_class->screen_changed = gtk_path_bar_screen_changed;
-  widget_class->grab_notify = gtk_path_bar_grab_notify;
-  widget_class->state_changed = gtk_path_bar_state_changed;
-  widget_class->scroll_event = gtk_path_bar_scroll;
-
-  container_class->add = gtk_path_bar_add;
-  container_class->forall = gtk_path_bar_forall;
-  container_class->remove = gtk_path_bar_remove;
-  gtk_container_class_handle_border_width (container_class);
-  /* FIXME: */
-  /*  container_class->child_type = gtk_path_bar_child_type;*/
-
-  path_bar_signals [PATH_CLICKED] =
-    g_signal_new (I_("path-clicked"),
-                 G_OBJECT_CLASS_TYPE (gobject_class),
-                 G_SIGNAL_RUN_FIRST,
-                 G_STRUCT_OFFSET (GtkPathBarClass, path_clicked),
-                 NULL, NULL,
-                 _gtk_marshal_VOID__POINTER_POINTER_BOOLEAN,
-                 G_TYPE_NONE, 3,
-                 G_TYPE_POINTER,
-                 G_TYPE_POINTER,
-                 G_TYPE_BOOLEAN);
-
-  /* Bind class to template
-   */
-  gtk_widget_class_set_template_from_resource (widget_class,
-                                              "/org/gtk/libgtk/ui/gtkpathbar.ui");
-
-  gtk_widget_class_bind_template_child_private (widget_class, GtkPathBar, up_slider_button);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkPathBar, down_slider_button);
-
-  gtk_widget_class_bind_template_callback (widget_class, gtk_path_bar_slider_button_press);
-  gtk_widget_class_bind_template_callback (widget_class, gtk_path_bar_slider_button_release);
-  gtk_widget_class_bind_template_callback (widget_class, gtk_path_bar_slider_up_defocus);
-  gtk_widget_class_bind_template_callback (widget_class, gtk_path_bar_slider_down_defocus);
-  gtk_widget_class_bind_template_callback (widget_class, gtk_path_bar_scroll_up);
-  gtk_widget_class_bind_template_callback (widget_class, gtk_path_bar_scroll_down);
-  gtk_widget_class_bind_template_callback (widget_class, on_slider_unmap);
-}
-
-
-static void
-gtk_path_bar_finalize (GObject *object)
-{
-  GtkPathBar *path_bar;
-
-  path_bar = GTK_PATH_BAR (object);
-
-  gtk_path_bar_stop_scrolling (path_bar);
-
-  g_list_free (path_bar->priv->button_list);
-  g_clear_object (&path_bar->priv->root_file);
-  g_clear_object (&path_bar->priv->home_file);
-  g_clear_object (&path_bar->priv->desktop_file);
-
-  g_clear_object (&path_bar->priv->root_icon);
-  g_clear_object (&path_bar->priv->home_icon);
-  g_clear_object (&path_bar->priv->desktop_icon);
-
-  g_clear_object (&path_bar->priv->file_system);
-
-  G_OBJECT_CLASS (gtk_path_bar_parent_class)->finalize (object);
-}
+  GtkPathBarPrivate *priv = gtk_path_bar_get_instance_private (GTK_PATH_BAR (self));
+  GtkWidget *current_path_bar;
 
-/* Removes the settings signal handler.  It's safe to call multiple times */
-static void
-remove_settings_signal (GtkPathBar *path_bar,
-                       GdkScreen  *screen)
-{
-  if (path_bar->priv->settings_signal_id)
+  current_path_bar = gtk_stack_get_visible_child (GTK_STACK (priv->path_bar_containers_stack));
+  if (current_path_bar == NULL ||
+      (current_path_bar == priv->path_bar_container_1 && current) ||
+      (current_path_bar == priv->path_bar_container_2 && !current))
     {
-      GtkSettings *settings;
-
-      settings = gtk_settings_get_for_screen (screen);
-      g_signal_handler_disconnect (settings,
-                                  path_bar->priv->settings_signal_id);
-      path_bar->priv->settings_signal_id = 0;
+      if (path_bar)
+        *path_bar = priv->path_bar_container_1;
+      if (overflow_button)
+        *overflow_button = priv->overflow_button_1;
+      if (path_box)
+        *path_box = priv->path_box_1;
+    }
+  else
+    {
+      if (path_bar)
+        *path_bar = priv->path_bar_container_2;
+      if (overflow_button)
+        *overflow_button = priv->overflow_button_2;
+      if (path_box)
+        *path_box = priv->path_box_2;
     }
 }
 
 static void
-gtk_path_bar_dispose (GObject *object)
+on_path_chunk_popover_destroyed (GtkPathBar *self)
 {
-  GtkPathBar *path_bar = GTK_PATH_BAR (object);
+  GtkPathBarPrivate *priv;
 
-  remove_settings_signal (path_bar, gtk_widget_get_screen (GTK_WIDGET (object)));
-
-  if (path_bar->priv->get_info_cancellable)
-    g_cancellable_cancel (path_bar->priv->get_info_cancellable);
-  path_bar->priv->get_info_cancellable = NULL;
+  if (self == NULL)
+    return;
 
-  G_OBJECT_CLASS (gtk_path_bar_parent_class)->dispose (object);
+  priv = gtk_path_bar_get_instance_private (GTK_PATH_BAR (self));
+  priv->path_chunk_popover_container = NULL;
 }
 
-/* Size requisition:
- * 
- * Ideally, our size is determined by another widget, and we are just filling
- * available space.
- */
 static void
-gtk_path_bar_get_preferred_width (GtkWidget *widget,
-                                  gint      *minimum,
-                                  gint      *natural)
+show_path_chunk_popover (GtkPathBar *self,
+                         GtkWidget  *path_chunk)
 {
-  ButtonData *button_data;
-  GtkPathBar *path_bar;
-  GList *list;
-  gint child_height;
-  gint height;
-  gint child_min, child_nat;
+  GtkPathBarPrivate *priv = gtk_path_bar_get_instance_private (GTK_PATH_BAR (self));
+  GtkWidget *popover;
 
-  path_bar = GTK_PATH_BAR (widget);
-
-  *minimum = *natural = 0;
-  height = 0;
-
-  for (list = path_bar->priv->button_list; list; list = list->next)
+  if (priv->path_chunk_popover_container != NULL)
     {
-      button_data = BUTTON_DATA (list->data);
-      gtk_widget_get_preferred_width (button_data->button, &child_min, &child_nat);
-      gtk_widget_get_preferred_height (button_data->button, &child_height, NULL);
-      height = MAX (height, child_height);
-
-      if (button_data->type == NORMAL_BUTTON)
-        {
-          /* Use 2*Height as button width because of ellipsized label.  */
-          child_min = MAX (child_min, child_height * 2);
-          child_nat = MAX (child_min, child_height * 2);
-        }
-
-      *minimum = MAX (*minimum, child_min);
-      *natural = *natural + child_nat;
+      popover = gtk_widget_get_ancestor (priv->path_chunk_popover_container,
+                                         GTK_TYPE_POPOVER);
+      gtk_widget_destroy (popover);
     }
 
-  /* Add space for slider, if we have more than one path */
-  /* Theoretically, the slider could be bigger than the other button.  But we're
-   * not going to worry about that now.
-   */
-  path_bar->priv->slider_width = 0;
-
-  gtk_widget_get_preferred_width (path_bar->priv->up_slider_button, &child_min, &child_nat);
-  if (path_bar->priv->button_list && path_bar->priv->button_list->next != NULL)
-    {
-      *minimum += child_min;
-      *natural += child_nat;
-    }
-  path_bar->priv->slider_width = MAX (path_bar->priv->slider_width, child_min);
+  popover = gtk_popover_new (path_chunk);
+  priv->path_chunk_popover_container = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+  gtk_container_add (GTK_CONTAINER (popover), priv->path_chunk_popover_container);
+  /* Clean private pointer when its destroyed, most of the times due to its
+   * relative_to associated widget being destroyed */
+  g_signal_connect_swapped (popover, "destroy",
+                            G_CALLBACK (on_path_chunk_popover_destroyed), self);
 
-  gtk_widget_get_preferred_width (path_bar->priv->down_slider_button, &child_min, &child_nat);
-  if (path_bar->priv->button_list && path_bar->priv->button_list->next != NULL)
-    {
-      *minimum += child_min;
-      *natural += child_nat;
-    }
-  path_bar->priv->slider_width = MAX (path_bar->priv->slider_width, child_min);
+  gtk_widget_show (popover);
 }
 
 static void
-gtk_path_bar_get_preferred_height (GtkWidget *widget,
-                                   gint      *minimum,
-                                   gint      *natural)
+hide_path_chunk_popover_if_empty (GtkPathBar *self)
 {
-  ButtonData *button_data;
-  GtkPathBar *path_bar;
-  GList *list;
-  gint child_min, child_nat;
-
-  path_bar = GTK_PATH_BAR (widget);
+  GtkPathBarPrivate *priv = gtk_path_bar_get_instance_private (GTK_PATH_BAR (self));
+  GList *children;
+  GtkWidget *popover;
 
-  *minimum = *natural = 0;
+  children = gtk_container_get_children (GTK_CONTAINER (priv->path_chunk_popover_container));
+  popover = gtk_widget_get_ancestor (priv->path_chunk_popover_container,
+                                         GTK_TYPE_POPOVER);
+  if (g_list_length (children) == 0)
+    gtk_widget_destroy (popover);
 
-  for (list = path_bar->priv->button_list; list; list = list->next)
-    {
-      button_data = BUTTON_DATA (list->data);
-      gtk_widget_get_preferred_height (button_data->button, &child_min, &child_nat);
+  g_list_free (children);
+}
 
-      *minimum = MAX (*minimum, child_min);
-      *natural = MAX (*natural, child_nat);
-    }
+static gboolean
+on_path_chunk_button_release_event (GtkWidget      *path_chunk,
+                                    GdkEventButton *event)
+{
+  PathChunkData *data;
+  GtkPathBarPrivate *priv;
 
-  gtk_widget_get_preferred_height (path_bar->priv->up_slider_button, &child_min, &child_nat);
-  *minimum = MAX (*minimum, child_min);
-  *natural = MAX (*natural, child_nat);
+  data = g_object_get_data (G_OBJECT (path_chunk), "data");
+  g_assert (data != NULL);
 
-  gtk_widget_get_preferred_height (path_bar->priv->down_slider_button, &child_min, &child_nat);
-  *minimum = MAX (*minimum, child_min);
-  *natural = MAX (*natural, child_nat);
-}
+  priv = gtk_path_bar_get_instance_private (GTK_PATH_BAR (data->path_bar));
 
-static void
-gtk_path_bar_update_slider_buttons (GtkPathBar *path_bar)
-{
-  if (path_bar->priv->button_list)
+  if (event->type == GDK_BUTTON_RELEASE)
     {
-      GtkWidget *button;
-
-      button = BUTTON_DATA (path_bar->priv->button_list->data)->button;
-      if (gtk_widget_get_child_visible (button))
-       {
-         gtk_path_bar_stop_scrolling (path_bar);
-         gtk_widget_set_sensitive (path_bar->priv->down_slider_button, FALSE);
-       }
-      else
-       gtk_widget_set_sensitive (path_bar->priv->down_slider_button, TRUE);
-
-      button = BUTTON_DATA (g_list_last (path_bar->priv->button_list)->data)->button;
-      if (gtk_widget_get_child_visible (button))
-       {
-         gtk_path_bar_stop_scrolling (path_bar);
-         gtk_widget_set_sensitive (path_bar->priv->up_slider_button, FALSE);
-       }
-      else
-       gtk_widget_set_sensitive (path_bar->priv->up_slider_button, TRUE);
-    }
-}
+      switch (event->button)
+        {
+        case GDK_BUTTON_PRIMARY:
+          gtk_path_bar_set_selected_path (data->path_bar, data->path);
 
-static void
-gtk_path_bar_map (GtkWidget *widget)
-{
-  gdk_window_show (GTK_PATH_BAR (widget)->priv->event_window);
+          return TRUE;
 
-  GTK_WIDGET_CLASS (gtk_path_bar_parent_class)->map (widget);
-}
+        case GDK_BUTTON_SECONDARY:
+          show_path_chunk_popover (data->path_bar, path_chunk);
+          emit_populate_popup (data->path_bar, data->path);
+          hide_path_chunk_popover_if_empty (data->path_bar);
 
-static void
-gtk_path_bar_unmap (GtkWidget *widget)
-{
-  gtk_path_bar_stop_scrolling (GTK_PATH_BAR (widget));
-  gdk_window_hide (GTK_PATH_BAR (widget)->priv->event_window);
+          return TRUE;
 
-  GTK_WIDGET_CLASS (gtk_path_bar_parent_class)->unmap (widget);
-}
+        default:
+          break;
+        }
+    }
 
-static void
-gtk_path_bar_realize (GtkWidget *widget)
-{
-  GtkPathBar *path_bar;
-  GtkAllocation allocation;
-  GdkWindow *window;
-  GdkWindowAttr attributes;
-  gint attributes_mask;
-
-  gtk_widget_set_realized (widget, TRUE);
-
-  path_bar = GTK_PATH_BAR (widget);
-  window = gtk_widget_get_parent_window (widget);
-  gtk_widget_set_window (widget, window);
-  g_object_ref (window);
-
-  gtk_widget_get_allocation (widget, &allocation);
-
-  attributes.window_type = GDK_WINDOW_CHILD;
-  attributes.x = allocation.x;
-  attributes.y = allocation.y;
-  attributes.width = allocation.width;
-  attributes.height = allocation.height;
-  attributes.wclass = GDK_INPUT_ONLY;
-  attributes.event_mask = gtk_widget_get_events (widget);
-  attributes.event_mask |= GDK_SCROLL_MASK;
-  attributes_mask = GDK_WA_X | GDK_WA_Y;
-
-  path_bar->priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
-                                           &attributes, attributes_mask);
-  gtk_widget_register_window (widget, path_bar->priv->event_window);
+  return FALSE;
 }
 
 static void
-gtk_path_bar_unrealize (GtkWidget *widget)
+free_path_chunk_data (PathChunkData *data)
 {
-  GtkPathBar *path_bar;
-
-  path_bar = GTK_PATH_BAR (widget);
-
-  gtk_widget_unregister_window (widget, path_bar->priv->event_window);
-  gdk_window_destroy (path_bar->priv->event_window);
-  path_bar->priv->event_window = NULL;
-
-  GTK_WIDGET_CLASS (gtk_path_bar_parent_class)->unrealize (widget);
+  if (data->label)
+    g_free (data->label);
+  g_free (data->path);
+  g_clear_object (&data->icon);
+  g_slice_free (PathChunkData, data);
 }
 
-/* This is a tad complicated
- */
-static void
-gtk_path_bar_size_allocate (GtkWidget     *widget,
-                           GtkAllocation *allocation)
+static GtkWidget *
+create_path_chunk (GtkPathBar  *self,
+                   const gchar *path,
+                   const gchar *label,
+                   GIcon       *icon,
+                   gboolean     add_separator,
+                   gboolean     separator_after_button)
 {
-  GtkWidget *child;
-  GtkPathBar *path_bar = GTK_PATH_BAR (widget);
-  GtkTextDirection direction;
-  GtkAllocation child_allocation;
-  GList *list, *first_button;
-  gint width;
-  gint allocation_width;
-  gboolean need_sliders = TRUE;
-  gint up_slider_offset = 0;
-  gint down_slider_offset = 0;
-  GtkRequisition child_requisition;
-
-  gtk_widget_set_allocation (widget, allocation);
-
-  if (gtk_widget_get_realized (widget))
-    gdk_window_move_resize (path_bar->priv->event_window,
-                           allocation->x, allocation->y,
-                           allocation->width, allocation->height);
-
-  /* No path is set; we don't have to allocate anything. */
-  if (path_bar->priv->button_list == NULL)
-    {
-      _gtk_widget_set_simple_clip (widget, NULL);
-
-      return;
-    }
-
-  direction = gtk_widget_get_direction (widget);
-  allocation_width = allocation->width;
+  GtkWidget *button;
+  GtkWidget *separator;
+  GtkWidget *path_chunk;
+  GtkWidget *button_label;
+  GtkWidget *image;
+  GtkStyleContext *style;
+  PathChunkData *path_chunk_data;
 
-  /* First, we check to see if we need the scrollbars. */
-  if (path_bar->priv->fake_root)
-    width = path_bar->priv->slider_width;
-  else
-    width = 0;
+  path_chunk = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+  button = gtk_toggle_button_new ();
 
-  for (list = path_bar->priv->button_list; list; list = list->next)
+  if (icon)
     {
-      child = BUTTON_DATA (list->data)->button;
-
-      gtk_widget_get_preferred_size (child, &child_requisition, NULL);
-
-      width += child_requisition.width;
-      if (list == path_bar->priv->fake_root)
-       break;
+      image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU);
+      gtk_button_set_image (GTK_BUTTON (button), image);
     }
-
-  if (width <= allocation_width)
+  else if (label)
     {
-      if (path_bar->priv->fake_root)
-       first_button = path_bar->priv->fake_root;
-      else
-       first_button = g_list_last (path_bar->priv->button_list);
+      button_label = gtk_label_new (label);
+      gtk_label_set_ellipsize (GTK_LABEL (button_label), PANGO_ELLIPSIZE_MIDDLE);
+      // FIXME: the GtkLabel requests more than the number of chars set here.
+      // For visual testing for now substract 2 chars.
+      gtk_label_set_width_chars (GTK_LABEL (button_label),
+                                 MIN (strlen (label), 10));
+      gtk_container_add (GTK_CONTAINER (button), button_label);
     }
   else
     {
-      gboolean reached_end = FALSE;
-      gint slider_space = 2 * path_bar->priv->slider_width;
-
-      if (path_bar->priv->first_scrolled_button)
-       first_button = path_bar->priv->first_scrolled_button;
-      else
-       first_button = path_bar->priv->button_list;
-      need_sliders = TRUE;
-
-      /* To see how much space we have, and how many buttons we can display.
-       * We start at the first button, count forward until hit the new
-       * button, then count backwards.
-       */
-      /* Count down the path chain towards the end. */
-      gtk_widget_get_preferred_size (BUTTON_DATA (first_button->data)->button,
-                                     &child_requisition, NULL);
-
-      width = child_requisition.width;
-      list = first_button->prev;
-      while (list && !reached_end)
-       {
-         child = BUTTON_DATA (list->data)->button;
-
-          gtk_widget_get_preferred_size (child, &child_requisition, NULL);
-
-         if (width + child_requisition.width + slider_space > allocation_width)
-           reached_end = TRUE;
-         else if (list == path_bar->priv->fake_root)
-           break;
-         else
-           width += child_requisition.width;
-
-         list = list->prev;
-       }
-
-      /* Finally, we walk up, seeing how many of the previous buttons we can
-       * add */
-      while (first_button->next && !reached_end)
-       {
-         child = BUTTON_DATA (first_button->next->data)->button;
-
-          gtk_widget_get_preferred_size (child, &child_requisition, NULL);
-
-         if (width + child_requisition.width + slider_space > allocation_width)
-           {
-             reached_end = TRUE;
-           }
-         else
-           {
-             width += child_requisition.width;
-             if (first_button == path_bar->priv->fake_root)
-               break;
-             first_button = first_button->next;
-           }
-       }
+      g_critical ("Path chunk doesn't provide either icon or label");
     }
 
-  /* Now, we allocate space to the buttons */
-  child_allocation.y = allocation->y;
-  child_allocation.height = allocation->height;
+  style = gtk_widget_get_style_context (button);
+  gtk_style_context_add_class (style, "flat");
 
-  if (direction == GTK_TEXT_DIR_RTL)
-    {
-      child_allocation.x = allocation->x + allocation->width;
-      if (need_sliders || path_bar->priv->fake_root)
-       {
-         child_allocation.x -= path_bar->priv->slider_width;
-         up_slider_offset = allocation->width - path_bar->priv->slider_width;
-       }
-    }
-  else
-    {
-      child_allocation.x = allocation->x;
-      if (need_sliders || path_bar->priv->fake_root)
-       {
-         up_slider_offset = 0;
-         child_allocation.x += path_bar->priv->slider_width;
-       }
-    }
+  g_signal_connect_swapped (button, "button-release-event",
+                            G_CALLBACK (on_path_chunk_button_release_event), path_chunk);
 
-  for (list = first_button; list; list = list->prev)
-    {
-      GtkAllocation widget_allocation;
-      ButtonData *button_data;
-
-      button_data = BUTTON_DATA (list->data);
-      child = button_data->button;
-
-      gtk_widget_get_preferred_size (child, &child_requisition, NULL);
-
-      child_allocation.width = MIN (child_requisition.width,
-                                   allocation_width - 2 * path_bar->priv->slider_width);
-
-      if (direction == GTK_TEXT_DIR_RTL)
-       child_allocation.x -= child_allocation.width;
-
-      /* Check to see if we've don't have any more space to allocate buttons */
-      if (need_sliders && direction == GTK_TEXT_DIR_RTL)
-       {
-          gtk_widget_get_allocation (widget, &widget_allocation);
-         if (child_allocation.x - path_bar->priv->slider_width < widget_allocation.x)
-           break;
-       }
-      else if (need_sliders && direction == GTK_TEXT_DIR_LTR)
-       {
-          gtk_widget_get_allocation (widget, &widget_allocation);
-         if (child_allocation.x + child_allocation.width + path_bar->priv->slider_width >
-             widget_allocation.x + allocation_width)
-           break;
-       }
-
-      if (child_allocation.width < child_requisition.width)
-       {
-         if (!gtk_widget_get_has_tooltip (child))
-           gtk_widget_set_tooltip_text (child, button_data->dir_name);
-       }
-      else if (gtk_widget_get_has_tooltip (child))
-       gtk_widget_set_tooltip_text (child, NULL);
-      
-      gtk_widget_set_child_visible (child, TRUE);
-      gtk_widget_size_allocate (child, &child_allocation);
-
-      if (direction == GTK_TEXT_DIR_RTL)
-        {
-          down_slider_offset = child_allocation.x - allocation->x - path_bar->priv->slider_width;
-        }
-      else
-        {
-          down_slider_offset += child_allocation.width;
-          child_allocation.x += child_allocation.width;
-        }
-    }
-  /* Now we go hide all the widgets that don't fit */
-  while (list)
+  if (add_separator && !separator_after_button)
     {
-      child = BUTTON_DATA (list->data)->button;
-      gtk_widget_set_child_visible (child, FALSE);
-      list = list->prev;
+      separator = gtk_label_new (G_DIR_SEPARATOR_S);
+      gtk_widget_set_sensitive (separator, FALSE);
+      gtk_container_add (GTK_CONTAINER (path_chunk), separator);
     }
-  for (list = first_button->next; list; list = list->next)
+  gtk_container_add (GTK_CONTAINER (path_chunk), button);
+  if (add_separator && separator_after_button)
     {
-      child = BUTTON_DATA (list->data)->button;
-      gtk_widget_set_child_visible (child, FALSE);
+      separator = gtk_label_new (G_DIR_SEPARATOR_S);
+      gtk_widget_set_sensitive (separator, FALSE);
+      gtk_container_add (GTK_CONTAINER (path_chunk), separator);
     }
 
-  if (need_sliders || path_bar->priv->fake_root)
-    {
-      child_allocation.width = path_bar->priv->slider_width;
-      child_allocation.x = up_slider_offset + allocation->x;
-      gtk_widget_size_allocate (path_bar->priv->up_slider_button, &child_allocation);
-
-      gtk_widget_set_child_visible (path_bar->priv->up_slider_button, TRUE);
-      gtk_widget_show_all (path_bar->priv->up_slider_button);
-
-      if (direction == GTK_TEXT_DIR_LTR)
-        down_slider_offset += path_bar->priv->slider_width;
-    }
+  path_chunk_data = g_slice_new (PathChunkData);
+  if (label)
+    path_chunk_data->label = g_strdup (label);
   else
-    {
-      gtk_widget_set_child_visible (path_bar->priv->up_slider_button, FALSE);
-    }
+    path_chunk_data->label = NULL;
 
-  if (need_sliders)
-    {
-      child_allocation.width = path_bar->priv->slider_width;
-      child_allocation.x = down_slider_offset + allocation->x;
-      
-      gtk_widget_size_allocate (path_bar->priv->down_slider_button, &child_allocation);
-
-      gtk_widget_set_child_visible (path_bar->priv->down_slider_button, TRUE);
-      gtk_widget_show_all (path_bar->priv->down_slider_button);
-      gtk_path_bar_update_slider_buttons (path_bar);
-    }
+  if (icon)
+    path_chunk_data->icon = g_object_ref (icon);
   else
-    {
-      gtk_widget_set_child_visible (path_bar->priv->down_slider_button, FALSE);
-    }
+    path_chunk_data->icon = NULL;
 
-  _gtk_widget_set_simple_clip (widget, NULL);
-}
+  path_chunk_data->path = g_strdup (path);
+  path_chunk_data->path_bar = self;
+  path_chunk_data->button = button;
+  g_object_set_data_full (G_OBJECT (path_chunk), "data",
+                          path_chunk_data, (GDestroyNotify) free_path_chunk_data);
 
-static void
-gtk_path_bar_style_updated (GtkWidget *widget)
-{
-  GTK_WIDGET_CLASS (gtk_path_bar_parent_class)->style_updated (widget);
+  gtk_widget_show_all (path_chunk);
 
-  gtk_path_bar_check_icon_theme (GTK_PATH_BAR (widget));
+  return path_chunk;
 }
 
-static void
-gtk_path_bar_screen_changed (GtkWidget *widget,
-                            GdkScreen *previous_screen)
+static gchar**
+get_splitted_path (const gchar* path)
 {
-  if (GTK_WIDGET_CLASS (gtk_path_bar_parent_class)->screen_changed)
-    GTK_WIDGET_CLASS (gtk_path_bar_parent_class)->screen_changed (widget, previous_screen);
+  gchar *path_no_first_slash;
+  gchar **splitted_path;
 
-  /* We might nave a new settings, so we remove the old one */
-  if (previous_screen)
-    remove_settings_signal (GTK_PATH_BAR (widget), previous_screen);
+  path_no_first_slash = g_utf8_substring (path, 1, strlen (path));
+  splitted_path = g_strsplit (path_no_first_slash, G_DIR_SEPARATOR_S, -1);
 
-  gtk_path_bar_check_icon_theme (GTK_PATH_BAR (widget));
-}
+  g_free (path_no_first_slash);
 
-static gboolean
-gtk_path_bar_scroll (GtkWidget      *widget,
-                    GdkEventScroll *event)
-{
-  switch (event->direction)
-    {
-    case GDK_SCROLL_RIGHT:
-    case GDK_SCROLL_DOWN:
-      gtk_path_bar_scroll_down (GTK_PATH_BAR (widget));
-      break;
-    case GDK_SCROLL_LEFT:
-    case GDK_SCROLL_UP:
-      gtk_path_bar_scroll_up (GTK_PATH_BAR (widget));
-      break;
-    case GDK_SCROLL_SMOOTH:
-      break;
-    }
-
-  return TRUE;
-}
-
-static void
-gtk_path_bar_add (GtkContainer *container,
-                 GtkWidget    *widget)
-
-{
-  gtk_widget_set_parent (widget, GTK_WIDGET (container));
+  return splitted_path;
 }
 
-static void
-gtk_path_bar_remove_1 (GtkContainer *container,
-                      GtkWidget    *widget)
+static gboolean
+is_absolute_root (const gchar *path)
 {
-  gboolean was_visible = gtk_widget_get_visible (widget);
-  gtk_widget_unparent (widget);
-  if (was_visible)
-    gtk_widget_queue_resize (GTK_WIDGET (container));
+  return g_strcmp0 (path, G_DIR_SEPARATOR_S) == 0;
 }
 
-static void
-gtk_path_bar_remove (GtkContainer *container,
-                    GtkWidget    *widget)
+static gboolean
+validate_path (const gchar *path)
 {
-  GtkPathBar *path_bar;
-  GList *children;
+  GFile *file = NULL;
+  gboolean valid = FALSE;
 
-  path_bar = GTK_PATH_BAR (container);
-
-  if (widget == path_bar->priv->up_slider_button)
-    {
-      gtk_path_bar_remove_1 (container, widget);
-      path_bar->priv->up_slider_button = NULL;
-      return;
-    }
+  if (!path || strlen (path) == 0)
+    goto out;
 
-  if (widget == path_bar->priv->down_slider_button)
-    {
-      gtk_path_bar_remove_1 (container, widget);
-      path_bar->priv->down_slider_button = NULL;
-      return;
-    }
+  if (!g_utf8_validate (path, -1, NULL))
+    goto out;
 
-  children = path_bar->priv->button_list;
-  while (children)
+  /* Special case absolute root which is always valid */
+  if (is_absolute_root (path))
     {
-      if (widget == BUTTON_DATA (children->data)->button)
-       {
-         gtk_path_bar_remove_1 (container, widget);
-         path_bar->priv->button_list = g_list_remove_link (path_bar->priv->button_list, children);
-         g_list_free (children);
-         return;
-       }
-      
-      children = children->next;
+      valid = TRUE;
+      goto out;
     }
-}
 
-static void
-gtk_path_bar_forall (GtkContainer *container,
-                    gboolean      include_internals,
-                    GtkCallback   callback,
-                    gpointer      callback_data)
-{
-  GtkPathBar *path_bar;
-  GList *children;
-
-  g_return_if_fail (callback != NULL);
-  path_bar = GTK_PATH_BAR (container);
+  file = g_file_new_for_uri (path);
+  if (!file)
+    goto out;
 
-  children = path_bar->priv->button_list;
-  while (children)
-    {
-      GtkWidget *child;
-      child = BUTTON_DATA (children->data)->button;
-      children = children->next;
+  valid = TRUE;
 
-      (* callback) (child, callback_data);
-    }
-
-  if (path_bar->priv->up_slider_button)
-    (* callback) (path_bar->priv->up_slider_button, callback_data);
+out:
+  g_clear_object (&file);
 
-  if (path_bar->priv->down_slider_button)
-    (* callback) (path_bar->priv->down_slider_button, callback_data);
+  return valid;
 }
 
-static void
-gtk_path_bar_scroll_down (GtkPathBar *path_bar)
+static gboolean
+validate_root_path (const gchar *path,
+                    const gchar *root_path)
 {
-  GtkAllocation allocation, button_allocation;
-  GList *list;
-  GList *down_button = NULL;
-  gint space_available;
-
-  if (path_bar->priv->ignore_click)
-    {
-      path_bar->priv->ignore_click = FALSE;
-      return;   
-    }
-
-  if (gtk_widget_get_child_visible (BUTTON_DATA (path_bar->priv->button_list->data)->button))
-    {
-      /* Return if the last button is already visible */
-      return;
-    }
-
-  gtk_widget_queue_resize (GTK_WIDGET (path_bar));
-
-  /* We find the button at the 'down' end that we have to make
-   * visible */
-  for (list = path_bar->priv->button_list; list; list = list->next)
-    {
-      if (list->next && gtk_widget_get_child_visible (BUTTON_DATA (list->next->data)->button))
-       {
-         down_button = list;
-         break;
-       }
-    }
-
-  gtk_widget_get_allocation (GTK_WIDGET (path_bar), &allocation);
-  gtk_widget_get_allocation (BUTTON_DATA (down_button->data)->button, &button_allocation);
-
-  space_available = (allocation.width
-                    - 2 * path_bar->priv->slider_width
-                     - button_allocation.width);
-  path_bar->priv->first_scrolled_button = down_button;
-  
-  /* We have space_available free space that's not being used.  
-   * So we walk down from the end, adding buttons until we use all free space.
-   */
-  while (space_available > 0)
-    {
-      path_bar->priv->first_scrolled_button = down_button;
-      down_button = down_button->next;
-      if (!down_button)
-       break;
-      space_available -= button_allocation.width;
-    }
+  return validate_path (root_path) &&
+         (g_str_has_prefix (path, root_path) || g_strcmp0 (path, root_path) == 0);
 }
 
 static void
-gtk_path_bar_scroll_up (GtkPathBar *path_bar)
+update_path_bar (GtkPathBar  *self)
 {
-  GList *list;
+  GtkPathBarPrivate *priv = gtk_path_bar_get_instance_private (self);
+  GtkWidget *path_chunk;
+  GtkWidget *path_box;
+  GtkWidget *overflow_button;
+  GtkWidget *path_bar;
+  GtkWidget *root_chunk;
+  gchar *unprefixed_path;
 
-  if (path_bar->priv->ignore_click)
-    {
-      path_bar->priv->ignore_click = FALSE;
-      return;   
-    }
+  get_path_bar_widgets (GTK_PATH_BAR (self), &path_bar, &overflow_button, &path_box, FALSE);
 
-  list = g_list_last (path_bar->priv->button_list);
+  /* Make sure we dismiss all popovers */
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->overflow_button_1), FALSE);
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->overflow_button_2), FALSE);
 
-  if (gtk_widget_get_child_visible (BUTTON_DATA (list->data)->button))
-    {
-      /* Return if the first button is already visible */
-      return;
-    }
-
-  gtk_widget_queue_resize (GTK_WIDGET (path_bar));
+  gtk_container_foreach (GTK_CONTAINER (path_box), (GtkCallback) gtk_widget_destroy, NULL);
 
-  for ( ; list; list = list->prev)
+  if (priv->root_path)
     {
-      if (list->prev && gtk_widget_get_child_visible (BUTTON_DATA (list->prev->data)->button))
-       {
-         if (list->prev == path_bar->priv->fake_root)
-           path_bar->priv->fake_root = NULL;
-         path_bar->priv->first_scrolled_button = list;
-         return;
-       }
-    }
-}
-
-static gboolean
-gtk_path_bar_scroll_timeout (GtkPathBar *path_bar)
-{
-  gboolean retval = FALSE;
+      root_chunk = create_path_chunk (self, priv->root_path, priv->root_label,
+                                      priv->root_icon, TRUE, TRUE);
 
-  if (path_bar->priv->timer)
-    {
-      if (path_bar->priv->scrolling_up)
-       gtk_path_bar_scroll_up (path_bar);
-      else if (path_bar->priv->scrolling_down)
-       gtk_path_bar_scroll_down (path_bar);
-
-      if (path_bar->priv->need_timer) 
-       {
-         path_bar->priv->need_timer = FALSE;
-
-         path_bar->priv->timer = gdk_threads_add_timeout (TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
-                                          (GSourceFunc)gtk_path_bar_scroll_timeout,
-                                          path_bar);
-          g_source_set_name_by_id (path_bar->priv->timer, "[gtk+] gtk_path_bar_scroll_timeout");
-       }
-      else
-       retval = TRUE;
+      gtk_container_add (GTK_CONTAINER (path_box), root_chunk);
     }
 
-  return retval;
-}
+  if (g_strcmp0 (priv->root_path, priv->path) == 0)
+    goto done;
 
-static void 
-gtk_path_bar_stop_scrolling (GtkPathBar *path_bar)
-{
-  if (path_bar->priv->timer)
+  /* We always expect a path in the format /path/path in UNIX or \path\path in Windows.
+   * However, the OS separator alone is a valid path, so we need to handle it
+   * ourselves if the client didn't set a root label or icon for it.
+   */
+  if (!is_absolute_root (priv->path) || priv->root_path)
     {
-      g_source_remove (path_bar->priv->timer);
-      path_bar->priv->timer = 0;
-      path_bar->priv->need_timer = FALSE;
-    }
-}
-
-static gboolean
-gtk_path_bar_slider_up_defocus (GtkWidget      *widget,
-                                    GdkEventButton *event,
-                                    GtkPathBar     *path_bar)
-{
-  GList *list;
-  GList *up_button = NULL;
+      GString *current_path = NULL;
+      gchar **splitted_path;
+      gboolean add_separator;
+      gboolean separator_after_button;
+      gint length;
+      gint i;
 
-  if (event->type != GDK_FOCUS_CHANGE)
-    return FALSE;
-
-  for (list = g_list_last (path_bar->priv->button_list); list; list = list->prev)
-    {
-      if (gtk_widget_get_child_visible (BUTTON_DATA (list->data)->button))
+      current_path = g_string_new ("");
+      if (priv->root_path && !is_absolute_root (priv->root_path))
         {
-          up_button = list;
-          break;
+          g_string_append (current_path, priv->root_path);
+          unprefixed_path = g_utf8_substring (priv->path, strlen (priv->root_path),
+                                              strlen (priv->path));
         }
-    }
-
-  /* don't let the focus vanish */
-  if ((!gtk_widget_is_sensitive (path_bar->priv->up_slider_button)) ||
-      (!gtk_widget_get_child_visible (path_bar->priv->up_slider_button)))
-    gtk_widget_grab_focus (BUTTON_DATA (up_button->data)->button);
-
-  return FALSE;
-}
-
-static gboolean
-gtk_path_bar_slider_down_defocus (GtkWidget      *widget,
-                                    GdkEventButton *event,
-                                    GtkPathBar     *path_bar)
-{
-  GList *list;
-  GList *down_button = NULL;
-
-  if (event->type != GDK_FOCUS_CHANGE)
-    return FALSE;
-
-  for (list = path_bar->priv->button_list; list; list = list->next)
-    {
-      if (gtk_widget_get_child_visible (BUTTON_DATA (list->data)->button))
+      else
         {
-          down_button = list;
-          break;
+          unprefixed_path = g_strdup (priv->path);
         }
-    }
-
-  /* don't let the focus vanish */
-  if ((!gtk_widget_is_sensitive (path_bar->priv->down_slider_button)) ||
-      (!gtk_widget_get_child_visible (path_bar->priv->down_slider_button)))
-    gtk_widget_grab_focus (BUTTON_DATA (down_button->data)->button);
-
-  return FALSE;
-}
-
-static gboolean
-gtk_path_bar_slider_button_press (GtkWidget      *widget, 
-                                 GdkEventButton *event,
-                                 GtkPathBar     *path_bar)
-{
-  if (event->type != GDK_BUTTON_PRESS || event->button != GDK_BUTTON_PRIMARY)
-    return FALSE;
 
-  path_bar->priv->ignore_click = FALSE;
+      splitted_path = get_splitted_path (unprefixed_path);
+      length = g_strv_length (splitted_path);
+      for (i = 0; i < length; i++)
+        {
+          g_string_append (current_path, G_DIR_SEPARATOR_S);
+          g_string_append (current_path, splitted_path[i]);
+
+          /* We add a separator for all items except the last one, which will result
+           * in a path_bar in the form of "Home/Documents/Example".
+           * However, if only one item is present, add a separator at the end since
+           * is visually more pleasant. The result will be in the form of "Home/" */
+          add_separator = length == 1 || (i != length - 1 && priv->inverted) ||
+                          (i != 0 && !priv->inverted);
+          separator_after_button = length == 1 || priv->inverted;
+
+          path_chunk = create_path_chunk (self, current_path->str, splitted_path[i],
+                                          NULL, add_separator, separator_after_button);
+          gtk_container_add (GTK_CONTAINER (path_box), path_chunk);
+        }
 
-  if (widget == path_bar->priv->up_slider_button)
-    {
-      path_bar->priv->scrolling_down = FALSE;
-      path_bar->priv->scrolling_up = TRUE;
-      gtk_path_bar_scroll_up (path_bar);
-    }
-  else if (widget == path_bar->priv->down_slider_button)
-    {
-      path_bar->priv->scrolling_up = FALSE;
-      path_bar->priv->scrolling_down = TRUE;
-      gtk_path_bar_scroll_down (path_bar);
+      g_strfreev (splitted_path);
+      g_string_free (current_path, TRUE);
+      g_free (unprefixed_path);
     }
-
-  if (!path_bar->priv->timer)
+  else
     {
-      path_bar->priv->need_timer = TRUE;
-      path_bar->priv->timer = gdk_threads_add_timeout (TIMEOUT_INITIAL,
-                                      (GSourceFunc)gtk_path_bar_scroll_timeout,
-                                      path_bar);
-      g_source_set_name_by_id (path_bar->priv->timer, "[gtk+] gtk_path_bar_scroll_timeout");
+      path_chunk = create_path_chunk (self, G_DIR_SEPARATOR_S, G_DIR_SEPARATOR_S,
+                                      NULL, FALSE, FALSE);
+      gtk_container_add (GTK_CONTAINER (path_box), path_chunk);
     }
 
-  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->priv->ignore_click = TRUE;
-  gtk_path_bar_stop_scrolling (path_bar);
-
-  return FALSE;
+done:
+  gtk_stack_set_visible_child (GTK_STACK (priv->path_bar_containers_stack), path_bar);
 }
 
 static void
-gtk_path_bar_grab_notify (GtkWidget *widget,
-                         gboolean   was_grabbed)
+update_selected_path (GtkPathBar  *self)
 {
-  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;
-
-  g_clear_object (&path_bar->priv->root_icon);
-  g_clear_object (&path_bar->priv->home_icon);
-  g_clear_object (&path_bar->priv->desktop_icon);
+  GtkPathBarPrivate *priv = gtk_path_bar_get_instance_private (self);
+  PathChunkData *data;
+  GList *children;
+  GList *overflow_children;
+  GList *l;
+  GtkWidget *path_box;
+  GtkWidget *overflow_button;
+  GtkPopover *overflow_popover;
+  GtkWidget *overflow_container;
 
-  for (list = path_bar->priv->button_list; list; list = list->next)
+  get_path_bar_widgets (GTK_PATH_BAR (self), NULL, &overflow_button, &path_box, TRUE);
+  overflow_popover = gtk_menu_button_get_popover (GTK_MENU_BUTTON (overflow_button));
+  overflow_container = gtk_bin_get_child (GTK_BIN (overflow_popover));
+  children = gtk_container_get_children (GTK_CONTAINER (path_box));
+  overflow_children = gtk_container_get_children (GTK_CONTAINER (overflow_container));
+  for (l = children; l != NULL; l = l->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);
-       }
+      data = g_object_get_data (G_OBJECT (l->data), "data");
+      g_signal_handlers_block_by_func (data->button,
+                                       G_CALLBACK (on_path_chunk_button_release_event),
+                                       data);
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->button),
+                                    g_strcmp0 (data->path, priv->selected_path) == 0);
+      g_signal_handlers_unblock_by_func (data->button,
+                                         G_CALLBACK (on_path_chunk_button_release_event),
+                                         data);
     }
-}
-
-static void
-change_icon_theme (GtkPathBar *path_bar)
-{
-  reload_icons (path_bar);
-}
-
-/* Callback used when a GtkSettings value changes */
-static void
-settings_notify_cb (GObject    *object,
-                   GParamSpec *pspec,
-                   GtkPathBar *path_bar)
-{
-  const char *name;
-
-  name = g_param_spec_get_name (pspec);
-
-  if (strcmp (name, "gtk-icon-theme-name") == 0)
-    change_icon_theme (path_bar);
-}
 
-static void
-gtk_path_bar_check_icon_theme (GtkPathBar *path_bar)
-{
-  if (path_bar->priv->settings_signal_id == 0)
+  for (l = overflow_children; l != NULL; l = l->next)
     {
-      GtkSettings *settings;
-
-      settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (path_bar)));
-      path_bar->priv->settings_signal_id = g_signal_connect (settings, "notify",
-                                                             G_CALLBACK (settings_notify_cb), path_bar);
+      data = g_object_get_data (G_OBJECT (l->data), "data");
+      g_signal_handlers_block_by_func (data->button,
+                                       G_CALLBACK (on_path_chunk_button_release_event),
+                                       data);
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->button),
+                                    g_strcmp0 (data->path, priv->selected_path) == 0);
+      g_signal_handlers_unblock_by_func (data->button,
+                                         G_CALLBACK (on_path_chunk_button_release_event),
+                                         data);
     }
 
-  change_icon_theme (path_bar);
+  g_list_free (children);
+  g_list_free (overflow_children);
 }
 
-/* Public functions and their helpers */
 static void
-gtk_path_bar_clear_buttons (GtkPathBar *path_bar)
+populate_overflow_popover (GtkPathBar *self)
 {
-  while (path_bar->priv->button_list != NULL)
-    {
-      gtk_container_remove (GTK_CONTAINER (path_bar), BUTTON_DATA 
(path_bar->priv->button_list->data)->button);
-    }
-  path_bar->priv->first_scrolled_button = NULL;
-  path_bar->priv->fake_root = NULL;
-}
-
-static void
-button_clicked_cb (GtkWidget *button,
-                  gpointer   data)
-{
-  ButtonData *button_data;
-  GtkPathBar *path_bar;
-  GList *button_list;
-  gboolean child_is_hidden;
-  GFile *child_file;
-
-  button_data = BUTTON_DATA (data);
-  if (button_data->ignore_changes)
-    return;
-
-  path_bar = GTK_PATH_BAR (gtk_widget_get_parent (button));
+  GList *overflow_children;
+  GList *l;
+  PathChunkData *data;
+  GtkWidget *path_chunk;
+  GtkWidget *path_box;
+  GtkWidget *overflow_button;
+  GtkPopover *overflow_popover;
+  GtkWidget *overflow_container;
 
-  button_list = g_list_find (path_bar->priv->button_list, button_data);
-  g_assert (button_list != NULL);
+  get_path_bar_widgets (self, NULL, &overflow_button, &path_box, TRUE);
+  overflow_popover = gtk_menu_button_get_popover (GTK_MENU_BUTTON (overflow_button));
+  overflow_container = gtk_bin_get_child (GTK_BIN (overflow_popover));
 
-  g_signal_handlers_block_by_func (button,
-                                  G_CALLBACK (button_clicked_cb), data);
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
-  g_signal_handlers_unblock_by_func (button,
-                                    G_CALLBACK (button_clicked_cb), data);
+  gtk_container_foreach (GTK_CONTAINER (overflow_container),
+                         (GtkCallback) gtk_widget_destroy, NULL);
 
-  if (button_list->prev)
-    {
-      ButtonData *child_data;
-
-      child_data = BUTTON_DATA (button_list->prev->data);
-      child_file = child_data->file;
-      child_is_hidden = child_data->file_is_hidden;
-    }
-  else
+  overflow_children = gtk_path_bar_container_get_overflow_children (GTK_PATH_BAR_CONTAINER (path_box));
+  for (l = overflow_children; l != NULL; l = l->next)
     {
-      child_file = NULL;
-      child_is_hidden = FALSE;
+      data = g_object_get_data (l->data, "data");
+      path_chunk = create_path_chunk (self, data->path, data->label, data->icon, FALSE, FALSE);
+      gtk_container_add (GTK_CONTAINER (overflow_container), path_chunk);
     }
 
-  g_signal_emit (path_bar, path_bar_signals [PATH_CLICKED], 0,
-                button_data->file, child_file, child_is_hidden);
-}
+  update_selected_path (self);
 
-struct SetButtonImageData
-{
-  GtkPathBar *path_bar;
-  ButtonData *button_data;
-};
+  g_list_free (overflow_children);
+}
 
 static void
-set_button_image_get_info_cb (GCancellable *cancellable,
-                             GFileInfo    *info,
-                             const GError *error,
-                             gpointer      user_data)
+gtk_path_bar_finalize (GObject *object)
 {
-  gboolean cancelled = g_cancellable_is_cancelled (cancellable);
-  GIcon *icon;
-  struct SetButtonImageData *data = user_data;
+  GtkPathBar *self = (GtkPathBar *)object;
+  GtkPathBarPrivate *priv = gtk_path_bar_get_instance_private (self);
 
-  if (cancellable != data->button_data->cancellable)
-    goto out;
-
-  data->button_data->cancellable = NULL;
-
-  if (!data->button_data->button)
-    {
-      g_free (data->button_data);
-      goto out;
-    }
-
-  if (cancelled || error)
-    goto out;
+  if (priv->path)
+    g_free (priv->path);
+  if (priv->selected_path)
+    g_free (priv->selected_path);
 
-  icon = g_file_info_get_symbolic_icon (info);
-  gtk_image_set_from_gicon (GTK_IMAGE (data->button_data->image), icon, GTK_ICON_SIZE_BUTTON);
-
-  switch (data->button_data->type)
-    {
-      case HOME_BUTTON:
-        g_set_object (&data->path_bar->priv->home_icon, icon);
-       break;
-
-      case DESKTOP_BUTTON:
-        g_set_object (&data->path_bar->priv->desktop_icon, icon);
-       break;
-
-      default:
-       break;
-    };
-
-out:
-  g_free (data);
-  g_object_unref (cancellable);
+  G_OBJECT_CLASS (gtk_path_bar_parent_class)->finalize (object);
 }
 
 static void
-set_button_image (GtkPathBar *path_bar,
-                 ButtonData *button_data)
+gtk_path_bar_get_property (GObject    *object,
+                           guint       prop_id,
+                           GValue     *value,
+                           GParamSpec *pspec)
 {
-  GtkFileSystemVolume *volume;
-  struct SetButtonImageData *data;
+  GtkPathBar *self = GTK_PATH_BAR (object);
+  GtkPathBarPrivate *priv = gtk_path_bar_get_instance_private (self);
 
-  switch (button_data->type)
+  switch (prop_id)
     {
-    case ROOT_BUTTON:
-
-      if (path_bar->priv->root_icon != NULL)
-        {
-          gtk_image_set_from_gicon (GTK_IMAGE (button_data->image), path_bar->priv->root_icon, 
GTK_ICON_SIZE_BUTTON);
-         break;
-       }
-
-      volume = _gtk_file_system_get_volume_for_file (path_bar->priv->file_system, path_bar->priv->root_file);
-      if (volume == NULL)
-       return;
-
-      path_bar->priv->root_icon = _gtk_file_system_volume_get_symbolic_icon (volume);
-      _gtk_file_system_volume_unref (volume);
-      gtk_image_set_from_gicon (GTK_IMAGE (button_data->image), path_bar->priv->root_icon, 
GTK_ICON_SIZE_BUTTON);
-
+    case PROP_PATH:
+      g_value_set_string (value, priv->path);
       break;
-
-    case HOME_BUTTON:
-      if (path_bar->priv->home_icon != NULL)
-        {
-          gtk_image_set_from_gicon (GTK_IMAGE (button_data->image), path_bar->priv->home_icon, 
GTK_ICON_SIZE_BUTTON);
-         break;
-       }
-
-      data = g_new0 (struct SetButtonImageData, 1);
-      data->path_bar = path_bar;
-      data->button_data = button_data;
-
-      if (button_data->cancellable)
-       g_cancellable_cancel (button_data->cancellable);
-
-      button_data->cancellable =
-        _gtk_file_system_get_info (path_bar->priv->file_system,
-                                  path_bar->priv->home_file,
-                                  "standard::symbolic-icon",
-                                  set_button_image_get_info_cb,
-                                  data);
+    case PROP_SELECTED_PATH:
+      g_value_set_string (value, priv->selected_path);
       break;
-
-    case DESKTOP_BUTTON:
-      if (path_bar->priv->desktop_icon != NULL)
-        {
-          gtk_image_set_from_gicon (GTK_IMAGE (button_data->image), path_bar->priv->desktop_icon, 
GTK_ICON_SIZE_BUTTON);
-         break;
-       }
-
-      data = g_new0 (struct SetButtonImageData, 1);
-      data->path_bar = path_bar;
-      data->button_data = button_data;
-
-      if (button_data->cancellable)
-       g_cancellable_cancel (button_data->cancellable);
-
-      button_data->cancellable =
-        _gtk_file_system_get_info (path_bar->priv->file_system,
-                                  path_bar->priv->desktop_file,
-                                  "standard::symbolic-icon",
-                                  set_button_image_get_info_cb,
-                                  data);
+    case PROP_INVERTED:
+      g_value_set_boolean (value, priv->inverted);
       break;
     default:
-      break;
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
 }
 
 static void
-button_data_free (ButtonData *button_data)
-{
-  if (button_data->file)
-    g_object_unref (button_data->file);
-  button_data->file = NULL;
-
-  g_free (button_data->dir_name);
-  button_data->dir_name = NULL;
-
-  button_data->button = NULL;
-
-  if (button_data->cancellable)
-    g_cancellable_cancel (button_data->cancellable);
-  else
-    g_free (button_data);
-}
-
-static const char *
-get_dir_name (ButtonData *button_data)
-{
-  return button_data->dir_name;
-}
-
-static void
-gtk_path_bar_update_button_appearance (GtkPathBar *path_bar,
-                                      ButtonData *button_data,
-                                      gboolean    current_dir)
+gtk_path_bar_set_property (GObject      *object,
+                           guint         prop_id,
+                           const GValue *value,
+                           GParamSpec   *pspec)
 {
-  const gchar *dir_name = get_dir_name (button_data);
-  GtkStyleContext *context;
-
-  context = gtk_widget_get_style_context (button_data->button);
-
-  gtk_style_context_remove_class (context, "text-button");
-  gtk_style_context_remove_class (context, "image-button");
-
-  if (button_data->label != NULL)
-    {
-      gtk_label_set_text (GTK_LABEL (button_data->label), dir_name);
-      if (button_data->image == NULL)
-        gtk_style_context_add_class (context, "text-button");
-    }
-
-  if (button_data->image != NULL)
-    {
-      set_button_image (path_bar, button_data);
-      if (button_data->label == NULL)
-        gtk_style_context_add_class (context, "image-button");
-    }
+  GtkPathBar *self = GTK_PATH_BAR (object);
 
-  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_data->button)) != current_dir)
+  switch (prop_id)
     {
-      button_data->ignore_changes = TRUE;
-      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button_data->button), current_dir);
-      button_data->ignore_changes = FALSE;
+    case PROP_PATH:
+      gtk_path_bar_set_path (self, g_value_get_string (value));
+      break;
+    case PROP_SELECTED_PATH:
+      gtk_path_bar_set_selected_path (self, g_value_get_string (value));
+      break;
+    case PROP_INVERTED:
+      gtk_path_bar_set_inverted (self, g_value_get_boolean (value));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
 }
 
-static ButtonType
-find_button_type (GtkPathBar  *path_bar,
-                 GFile       *file)
+static GtkSizeRequestMode
+get_request_mode (GtkWidget *self)
 {
-  if (path_bar->priv->root_file != NULL &&
-      g_file_equal (file, path_bar->priv->root_file))
-    return ROOT_BUTTON;
-  if (path_bar->priv->home_file != NULL &&
-      g_file_equal (file, path_bar->priv->home_file))
-    return HOME_BUTTON;
-  if (path_bar->priv->desktop_file != NULL &&
-      g_file_equal (file, path_bar->priv->desktop_file))
-    return DESKTOP_BUTTON;
-
- return NORMAL_BUTTON;
+  return GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT;
 }
 
 static void
-button_drag_data_get_cb (GtkWidget        *widget,
-                         GdkDragContext   *context,
-                         GtkSelectionData *selection_data,
-                         guint             info,
-                         guint             time_,
-                         gpointer          data)
+gtk_path_bar_class_init (GtkPathBarClass *klass)
 {
-  ButtonData *button_data;
-  char *uris[2];
-
-  button_data = data;
-
-  uris[0] = g_file_get_uri (button_data->file);
-  uris[1] = NULL;
-
-  gtk_selection_data_set_uris (selection_data, uris);
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  g_free (uris[0]);
-}
+  object_class->finalize = gtk_path_bar_finalize;
+  object_class->get_property = gtk_path_bar_get_property;
+  object_class->set_property = gtk_path_bar_set_property;
 
-static ButtonData *
-make_directory_button (GtkPathBar  *path_bar,
-                      const char  *dir_name,
-                      GFile       *file,
-                      gboolean     current_dir,
-                      gboolean     file_is_hidden)
-{
-  AtkObject *atk_obj;
-  GtkWidget *child = NULL;
-  ButtonData *button_data;
+  widget_class->get_request_mode = get_request_mode;
 
-  file_is_hidden = !! file_is_hidden;
-  /* Is it a special button? */
-  button_data = g_new0 (ButtonData, 1);
+  /**
+   * GtkPathBar::populate-popup:
+   * @path_bar: the object which received the signal.
+   * @container: (type Gtk.Widget): a #GtkContainer
+   * @path: (type const gchar*): string of the path where the user performed a right click.
+   *
+   * The path bar emits this signal when the user invokes a contextual
+   * popup on one of its items. In the signal handler, the application may
+   * add extra items to the menu as appropriate. For example, a file manager
+   * may want to add a "Properties" command to the menu.
+   *
+   * The @container and all its contents are destroyed after the user
+   * dismisses the popup. The popup is re-created (and thus, this signal is
+   * emitted) every time the user activates the contextual menu.
+   *
+   * Since: 3.20
+   */
+  path_bar_signals [POPULATE_POPUP] =
+          g_signal_new (I_("populate-popup"),
+                        G_OBJECT_CLASS_TYPE (object_class),
+                        G_SIGNAL_RUN_FIRST,
+                        G_STRUCT_OFFSET (GtkPathBarClass, populate_popup),
+                        NULL, NULL,
+                        _gtk_marshal_VOID__OBJECT_STRING,
+                        G_TYPE_NONE, 2,
+                        GTK_TYPE_WIDGET,
+                        G_TYPE_STRING);
 
-  button_data->type = find_button_type (path_bar, file);
-  button_data->button = gtk_toggle_button_new ();
-  atk_obj = gtk_widget_get_accessible (button_data->button);
-  gtk_widget_set_focus_on_click (button_data->button, FALSE);
-  gtk_widget_add_events (button_data->button, GDK_SCROLL_MASK);
+  path_bar_properties[PROP_PATH] =
+          g_param_spec_string ("path",
+                               P_("Path"),
+                               P_("The path set in the path bar. Should use UNIX path specs"),
+                               NULL,
+                               G_PARAM_READWRITE);
 
-  switch (button_data->type)
-    {
-    case ROOT_BUTTON:
-      button_data->image = gtk_image_new ();
-      child = button_data->image;
-      button_data->label = NULL;
-      atk_object_set_name (atk_obj, _("File System Root"));
-      break;
-    case HOME_BUTTON:
-    case DESKTOP_BUTTON:
-      button_data->image = gtk_image_new ();
-      button_data->label = gtk_label_new (NULL);
-      child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-      gtk_box_pack_start (GTK_BOX (child), button_data->image, FALSE, FALSE, 0);
-      gtk_box_pack_start (GTK_BOX (child), button_data->label, FALSE, FALSE, 0);
-      break;
-    case NORMAL_BUTTON:
-    default:
-      button_data->label = gtk_label_new (NULL);
-      child = button_data->label;
-      button_data->image = NULL;
-    }
+  path_bar_properties[PROP_SELECTED_PATH] =
+          g_param_spec_string ("selected-path",
+                               P_("Selected path"),
+                               P_("The path selected. Should be a sufix of the path currently set"),
+                               NULL,
+                               G_PARAM_READWRITE);
 
-  button_data->dir_name = g_strdup (dir_name);
-  button_data->file = g_object_ref (file);
-  button_data->file_is_hidden = file_is_hidden;
+  path_bar_properties[PROP_INVERTED] =
+          g_param_spec_boolean ("inverted",
+                                P_("Direction of hiding children inverted"),
+                                P_("If false the container will start hiding widgets from the end when there 
is not enough space, and the oposite in case inverted is true."),
+                                FALSE,
+                                G_PARAM_READWRITE);
 
-  gtk_container_add (GTK_CONTAINER (button_data->button), child);
-  gtk_widget_show_all (button_data->button);
+  g_object_class_install_properties (object_class, LAST_PROP, path_bar_properties);
 
-  gtk_path_bar_update_button_appearance (path_bar, button_data, current_dir);
+  gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/ui/gtkpath_bar.ui");
 
-  g_signal_connect (button_data->button, "clicked",
-                   G_CALLBACK (button_clicked_cb),
-                   button_data);
-  g_object_weak_ref (G_OBJECT (button_data->button),
-                    (GWeakNotify) button_data_free, button_data);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkPathBar, path_bar_containers_stack);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkPathBar, path_bar_container_1);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkPathBar, path_bar_container_2);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkPathBar, overflow_button_1);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkPathBar, overflow_button_2);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkPathBar, path_box_1);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkPathBar, path_box_2);
 
-  gtk_drag_source_set (button_data->button,
-                      GDK_BUTTON1_MASK,
-                      NULL, 0,
-                      GDK_ACTION_COPY);
-  gtk_drag_source_add_uri_targets (button_data->button);
-  g_signal_connect (button_data->button, "drag-data-get",
-                   G_CALLBACK (button_drag_data_get_cb), button_data);
+  gtk_widget_class_bind_template_callback (widget_class, populate_overflow_popover);
 
-  return button_data;
+  gtk_widget_class_set_css_name (widget_class, "path-bar");
 }
 
-static gboolean
-gtk_path_bar_check_parent_path (GtkPathBar         *path_bar,
-                               GFile              *file)
+static void
+gtk_path_bar_init (GtkPathBar *self)
 {
-  GList *list;
-  GList *current_path = NULL;
-  gboolean need_new_fake_root = FALSE;
+  GtkPathBarPrivate *priv = gtk_path_bar_get_instance_private (self);
 
-  for (list = path_bar->priv->button_list; list; list = list->next)
-    {
-      ButtonData *button_data;
-
-      button_data = list->data;
-      if (g_file_equal (file, button_data->file))
-       {
-         current_path = list;
-         break;
-       }
-      if (list == path_bar->priv->fake_root)
-       need_new_fake_root = TRUE;
-    }
+  g_type_ensure (GTK_TYPE_PATH_BAR_CONTAINER);
+  gtk_widget_init_template (GTK_WIDGET (self));
 
-  if (current_path)
-    {
-      if (need_new_fake_root)
-       {
-         path_bar->priv->fake_root = NULL;
-         for (list = current_path; list; list = list->next)
-           {
-             ButtonData *button_data;
-
-             button_data = list->data;
-             if (BUTTON_IS_FAKE_ROOT (button_data))
-               {
-                 path_bar->priv->fake_root = list;
-                 break;
-               }
-           }
-       }
-
-      for (list = path_bar->priv->button_list; list; list = list->next)
-       {
-         gtk_path_bar_update_button_appearance (path_bar,
-                                                BUTTON_DATA (list->data),
-                                                (list == current_path) ? TRUE : FALSE);
-       }
-
-      if (!gtk_widget_get_child_visible (BUTTON_DATA (current_path->data)->button))
-       {
-         path_bar->priv->first_scrolled_button = current_path;
-         gtk_widget_queue_resize (GTK_WIDGET (path_bar));
-       }
-
-      return TRUE;
-    }
-  return FALSE;
+  priv->inverted = FALSE;
 }
 
 
-struct SetFileInfo
+void
+gtk_path_bar_set_path_extended (GtkPathBar  *self,
+                                const gchar *path,
+                                const gchar *root_path,
+                                const gchar *root_label,
+                                GIcon       *root_icon)
 {
-  GFile *file;
-  GFile *parent_file;
-  GtkPathBar *path_bar;
-  GList *new_buttons;
-  GList *fake_root;
-  gboolean first_directory;
-};
+  GtkPathBarPrivate *priv;
+  gchar *old_path;
 
-static void
-gtk_path_bar_set_file_finish (struct SetFileInfo *info,
-                              gboolean            result)
-{
-  if (result)
-    {
-      GList *l;
-      GtkCssNode *prev;
-
-      gtk_path_bar_clear_buttons (info->path_bar);
-      info->path_bar->priv->button_list = g_list_reverse (info->new_buttons);
-      info->path_bar->priv->fake_root = info->fake_root;
-      prev = gtk_widget_get_css_node (info->path_bar->priv->down_slider_button);
-
-      for (l = info->path_bar->priv->button_list; l; l = l->next)
-       {
-         GtkWidget *button = BUTTON_DATA (l->data)->button;
-          GtkCssNode *node = gtk_widget_get_css_node (button);
-
-          gtk_css_node_insert_before (gtk_widget_get_css_node (GTK_WIDGET (info->path_bar)),
-                                      node,
-                                      prev);
-         gtk_container_add (GTK_CONTAINER (info->path_bar), button);
-          prev = node;
-       }
-    }
-  else
-    {
-      GList *l;
+  g_return_if_fail (GTK_IS_PATH_BAR (self));
+  g_return_if_fail (validate_path (path));
+  g_return_if_fail (!root_path || validate_root_path (path, root_path));
 
-      for (l = info->new_buttons; l; l = l->next)
-       {
-         ButtonData *button_data;
+  priv = gtk_path_bar_get_instance_private (GTK_PATH_BAR (self));
 
-         button_data = BUTTON_DATA (l->data);
-         gtk_widget_destroy (button_data->button);
-       }
-
-      g_list_free (info->new_buttons);
+  if (priv->root_icon)
+    {
+      g_object_unref (priv->root_icon);
+      priv->root_icon = NULL;
     }
-
-  if (info->file)
-    g_object_unref (info->file);
-  if (info->parent_file)
-    g_object_unref (info->parent_file);
-
-  g_free (info);
-}
-
-static void
-gtk_path_bar_get_info_callback (GCancellable *cancellable,
-                               GFileInfo    *info,
-                               const GError *error,
-                               gpointer      data)
-{
-  gboolean cancelled = g_cancellable_is_cancelled (cancellable);
-  struct SetFileInfo *file_info = data;
-  ButtonData *button_data;
-  const gchar *display_name;
-  gboolean is_hidden;
-
-  if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
-    return;
-
-  if (cancellable != file_info->path_bar->priv->get_info_cancellable)
+  if (priv->root_path)
     {
-      gtk_path_bar_set_file_finish (file_info, FALSE);
-      g_object_unref (cancellable);
-      return;
+      g_free (priv->root_path);
+      priv->root_path = NULL;
     }
-
-  g_object_unref (cancellable);
-  file_info->path_bar->priv->get_info_cancellable = NULL;
-
-  if (cancelled || !info)
+  if (priv->root_label)
     {
-      gtk_path_bar_set_file_finish (file_info, FALSE);
-      return;
+      g_free (priv->root_label);
+      priv->root_label = NULL;
     }
 
-  display_name = g_file_info_get_display_name (info);
-  is_hidden = g_file_info_get_is_hidden (info) || g_file_info_get_is_backup (info);
+  if (root_icon)
+    priv->root_icon = g_object_ref (root_icon);
+  if (root_path)
+    priv->root_path = g_strdup (root_path);
+  if (root_label)
+    priv->root_label = g_strdup (root_label);
 
-  button_data = make_directory_button (file_info->path_bar, display_name,
-                                       file_info->file,
-                                      file_info->first_directory, is_hidden);
-  g_object_unref (file_info->file);
+  old_path = priv->path;
+  priv->path = g_strdup (path);
 
-  file_info->new_buttons = g_list_prepend (file_info->new_buttons, button_data);
+  update_path_bar (self);
 
-  if (BUTTON_IS_FAKE_ROOT (button_data))
-    file_info->fake_root = file_info->new_buttons;
+  if (old_path)
+    {
+      if (g_strcmp0 (old_path, path) != 0)
+        g_object_notify_by_pspec (G_OBJECT (self), path_bar_properties[PROP_PATH]);
+      g_free (old_path);
+    }
 
-  /* We have assigned the info for the innermost button, i.e. the deepest directory.
-   * Now, go on to fetch the info for this directory's parent.
-   */
+  gtk_path_bar_set_selected_path (self, priv->path);
+}
 
-  file_info->file = file_info->parent_file;
-  file_info->first_directory = FALSE;
+/**
+ * gtk_path_bar_get_selected_path:
+ * @path_bar: a #GtkPathBar
+ *
+ * Get the path represented by the path bar
+ *
+ * Returns: (transfer none): a string that represents the current path.
+ *
+ * Since: 3.20
+ */
+const gchar*
+gtk_path_bar_get_path (GtkPathBar *self)
+{
+  GtkPathBarPrivate *priv;
 
-  if (!file_info->file)
-    {
-      /* No parent?  Okay, we are done. */
-      gtk_path_bar_set_file_finish (file_info, TRUE);
-      return;
-    }
+  g_return_val_if_fail (GTK_IS_PATH_BAR (self), NULL);
 
-  file_info->parent_file = g_file_get_parent (file_info->file);
+  priv = gtk_path_bar_get_instance_private (GTK_PATH_BAR (self));
 
-  /* Recurse asynchronously */
-  file_info->path_bar->priv->get_info_cancellable =
-    _gtk_file_system_get_info (file_info->path_bar->priv->file_system,
-                              file_info->file,
-                              "standard::display-name,standard::is-hidden,standard::is-backup",
-                              gtk_path_bar_get_info_callback,
-                              file_info);
+  return priv->path;
 }
 
+/**
+ * gtk_path_bar_set_path:
+ * @path_bar: a #GtkPathBar
+ * @path: a string representing a path in UNIX style.
+ *
+ * Set the path represented by the path bar.
+ *
+ * Note that if the path is not in the UNIX format behaviour is undefined,
+ * however the path bar will try to represent it, and therefore the path set
+ * by this function could be different than the actual one.
+ *
+ * Since: 3.20
+ */
 void
-_gtk_path_bar_set_file (GtkPathBar *path_bar,
-                        GFile      *file,
-                        gboolean    keep_trail)
+gtk_path_bar_set_path (GtkPathBar  *self,
+                       const gchar *path)
 {
-  struct SetFileInfo *info;
-
-  g_return_if_fail (GTK_IS_PATH_BAR (path_bar));
-  g_return_if_fail (G_IS_FILE (file));
-
-  /* Check whether the new path is already present in the pathbar as buttons.
-   * This could be a parent directory or a previous selected subdirectory.
-   */
-  if (keep_trail && gtk_path_bar_check_parent_path (path_bar, file))
-    return;
+  gtk_path_bar_set_path_extended (self, path, NULL, NULL, NULL);
+}
 
-  info = g_new0 (struct SetFileInfo, 1);
-  info->file = g_object_ref (file);
-  info->path_bar = path_bar;
-  info->first_directory = TRUE;
-  info->parent_file = g_file_get_parent (info->file);
+/**
+ * gtk_path_bar_get_selected_path:
+ * @path_bar: a #GtkPathBar
+ *
+ * Get the selected path
+ *
+ * Returns: (transfer none): a string that represents the selected path.
+ *
+ * Since: 3.20
+ */
+const gchar*
+gtk_path_bar_get_selected_path (GtkPathBar *self)
+{
+  GtkPathBarPrivate *priv;
 
-  if (path_bar->priv->get_info_cancellable)
-    g_cancellable_cancel (path_bar->priv->get_info_cancellable);
+  g_return_val_if_fail (GTK_IS_PATH_BAR (self), NULL);
 
-  path_bar->priv->get_info_cancellable =
-    _gtk_file_system_get_info (path_bar->priv->file_system,
-                               info->file,
-                               "standard::display-name,standard::is-hidden,standard::is-backup",
-                               gtk_path_bar_get_info_callback,
-                               info);
+  priv = gtk_path_bar_get_instance_private (GTK_PATH_BAR (self));
 
+  return priv->selected_path;
 }
 
-/* FIXME: This should be a construct-only property */
+/**
+ * gtk_path_bar_set_selected_path:
+ * @path_bar: a #GtkPathBar
+ * @path: a string representing a path in UNIX style.
+ *
+ * Set the path selected by the path bar.
+ *
+ * The path must be a prefix of the current #path.
+ *
+ * Since: 3.20
+ */
 void
-_gtk_path_bar_set_file_system (GtkPathBar    *path_bar,
-                              GtkFileSystem *file_system)
+gtk_path_bar_set_selected_path (GtkPathBar  *self,
+                                const gchar *path)
 {
-  const char *home;
+  GtkPathBarPrivate *priv ;
 
-  g_return_if_fail (GTK_IS_PATH_BAR (path_bar));
+  g_return_if_fail (GTK_IS_PATH_BAR (self));
 
-  g_assert (path_bar->priv->file_system == NULL);
+  priv = gtk_path_bar_get_instance_private (GTK_PATH_BAR (self));
 
-  path_bar->priv->file_system = g_object_ref (file_system);
+  g_return_if_fail (g_str_has_prefix (priv->path, path) ||
+                    g_strcmp0 (priv->path, path) == 0);
 
-  home = g_get_home_dir ();
-  if (home != NULL)
+  if (g_strcmp0 (priv->selected_path, path) != 0)
     {
-      const gchar *desktop;
-
-      path_bar->priv->home_file = g_file_new_for_path (home);
-      /* FIXME: Need file system backend specific way of getting the
-       * Desktop path.
-       */
-      desktop = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
-      if (desktop != NULL)
-        path_bar->priv->desktop_file = g_file_new_for_path (desktop);
-      else 
-        path_bar->priv->desktop_file = NULL;
+      if (priv->selected_path)
+        g_free (priv->selected_path);
+
+      priv->selected_path = g_strdup (path);
+      update_selected_path (self);
+      g_object_notify_by_pspec (G_OBJECT (self), path_bar_properties[PROP_SELECTED_PATH]);
     }
   else
     {
-      path_bar->priv->home_file = NULL;
-      path_bar->priv->desktop_file = NULL;
+      /* Update the style in any case */
+      update_selected_path (self);
     }
-  path_bar->priv->root_file = g_file_new_for_path ("/");
 }
 
 /**
- * _gtk_path_bar_up:
+ * gtk_path_bar_get_inverted:
  * @path_bar: a #GtkPathBar
- * 
- * If the selected button in the pathbar is not the furthest button “up” (in the
- * root direction), act as if the user clicked on the next button up.
- **/
-void
-_gtk_path_bar_up (GtkPathBar *path_bar)
+ *
+ * Returns a wheter the path bar hides children in the inverted direction.
+ *
+ * Since: 3.20
+ */
+gboolean
+gtk_path_bar_get_inverted (GtkPathBar *self)
 {
-  GList *l;
+  GtkPathBarPrivate *priv ;
 
-  for (l = path_bar->priv->button_list; l; l = l->next)
-    {
-      GtkWidget *button = BUTTON_DATA (l->data)->button;
-      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
-       {
-         if (l->next)
-           {
-             GtkWidget *next_button = BUTTON_DATA (l->next->data)->button;
-             button_clicked_cb (next_button, l->next->data);
-           }
-         break;
-       }
-    }
+  g_return_val_if_fail (GTK_IS_PATH_BAR (self), 0);
+
+  priv = gtk_path_bar_get_instance_private (GTK_PATH_BAR (self));
+
+  return priv->inverted;
 }
 
 /**
- * _gtk_path_bar_down:
+ * gtk_path_bar_set_inverted:
  * @path_bar: a #GtkPathBar
- * 
- * If the selected button in the pathbar is not the furthest button “down” (in the
- * leaf direction), act as if the user clicked on the next button down.
- **/
+ * @inverted: Wheter the path bar will start hiding widgets in the oposite direction.
+ *
+ * If %FALSE, the path bar will start hiding widgets from the end of it, and from
+ * the start in the oposite case.
+ *
+ * Since: 3.20
+ */
 void
-_gtk_path_bar_down (GtkPathBar *path_bar)
+gtk_path_bar_set_inverted (GtkPathBar *self,
+                           gboolean    inverted)
 {
-  GList *l;
+  GtkPathBarPrivate *priv ;
+
+  g_return_if_fail (GTK_IS_PATH_BAR (self));
 
-  for (l = path_bar->priv->button_list; l; l = l->next)
+  priv = gtk_path_bar_get_instance_private (GTK_PATH_BAR (self));
+
+  if (priv->inverted != inverted)
     {
-      GtkWidget *button = BUTTON_DATA (l->data)->button;
-      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
-       {
-         if (l->prev)
-           {
-             GtkWidget *prev_button = BUTTON_DATA (l->prev->data)->button;
-             button_clicked_cb (prev_button, l->prev->data);
-           }
-         break;
-       }
+      priv->inverted = inverted != FALSE;
+      gtk_path_bar_container_set_inverted (GTK_PATH_BAR_CONTAINER (priv->path_box_1), inverted);
+      gtk_path_bar_container_set_inverted (GTK_PATH_BAR_CONTAINER (priv->path_box_2), inverted);
+
+      g_object_notify (G_OBJECT (self), "inverted");
     }
 }
+
+GtkWidget *
+gtk_path_bar_new (void)
+{
+  return g_object_new (GTK_TYPE_PATH_BAR, NULL);
+}
diff --git a/gtk/gtkpathbar.h b/gtk/gtkpathbar.h
index 7fdd7b3..7572ec2 100644
--- a/gtk/gtkpathbar.h
+++ b/gtk/gtkpathbar.h
@@ -1,67 +1,94 @@
 /* gtkpathbar.h
- * Copyright (C) 2004  Red Hat, Inc.,  Jonathan Blandford <jrb gnome org>
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Copyright (C) 2015 Red Hat
  *
- * This library is distributed in the hope that it will be useful,
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
- * You should have received a copy of the GNU Library General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ * Authors: Carlos Soriano <csoriano gnome org>
  */
 
 #ifndef __GTK_PATH_BAR_H__
 #define __GTK_PATH_BAR_H__
 
-#include "gtkcontainer.h"
-#include "gtkfilesystem.h"
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#include <gtk/gtkbin.h>
 
 G_BEGIN_DECLS
 
-typedef struct _GtkPathBar        GtkPathBar;
-typedef struct _GtkPathBarClass   GtkPathBarClass;
+#define GTK_TYPE_PATH_BAR            (gtk_path_bar_get_type())
+#define GTK_PATH_BAR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PATH_BAR, GtkPathBar))
+#define GTK_PATH_BAR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PATH_BAR, GtkPathBarClass))
+#define GTK_IS_PATH_BAR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PATH_BAR))
+#define GTK_IS_PATH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PATH_BAR)
+#define GTK_PATH_BAR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PATH_BAR, GtkPathBarClass))
+
+typedef struct _GtkPathBar GtkPathBar;
+typedef struct _GtkPathBarClass GtkPathBarClass;
 typedef struct _GtkPathBarPrivate GtkPathBarPrivate;
 
+struct _GtkPathBarClass
+{
+  GtkBinClass parent;
 
-#define GTK_TYPE_PATH_BAR                 (gtk_path_bar_get_type ())
-#define GTK_PATH_BAR(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PATH_BAR, GtkPathBar))
-#define GTK_PATH_BAR_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PATH_BAR, 
GtkPathBarClass))
-#define GTK_IS_PATH_BAR(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PATH_BAR))
-#define GTK_IS_PATH_BAR_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PATH_BAR))
-#define GTK_PATH_BAR_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PATH_BAR, 
GtkPathBarClass))
+  /*< public >*/
 
-struct _GtkPathBar
-{
-  GtkContainer parent;
+  void                (* populate_popup)              (GtkPathBar       *path_bar,
+                                                       const gchar      *selected_path);
+  /*< private >*/
 
-  GtkPathBarPrivate *priv;
+  /* Padding for future expansion */
+  gpointer reserved[10];
 };
 
-struct _GtkPathBarClass
+struct _GtkPathBar
 {
-  GtkContainerClass parent_class;
-
-  void (* path_clicked) (GtkPathBar  *path_bar,
-                        GFile       *file,
-                        GFile       *child_file,
-                        gboolean     child_is_hidden);
+  GtkBin parent_instance;
 };
 
-GDK_AVAILABLE_IN_ALL
-GType    gtk_path_bar_get_type (void) G_GNUC_CONST;
-void     _gtk_path_bar_set_file_system (GtkPathBar         *path_bar,
-                                       GtkFileSystem      *file_system);
-void     _gtk_path_bar_set_file        (GtkPathBar         *path_bar,
-                                       GFile              *file,
-                                       gboolean            keep_trail);
-void     _gtk_path_bar_up              (GtkPathBar *path_bar);
-void     _gtk_path_bar_down            (GtkPathBar *path_bar);
+GDK_AVAILABLE_IN_3_20
+GType                 gtk_path_bar_get_type              (void) G_GNUC_CONST;
+GDK_AVAILABLE_IN_3_20
+GtkWidget*            gtk_path_bar_new                   (void);
+GDK_AVAILABLE_IN_3_20
+void                  gtk_path_bar_set_path              (GtkPathBar       *path_bar,
+                                                          const gchar      *path);
+GDK_AVAILABLE_IN_3_20
+const gchar*          gtk_path_bar_get_path              (GtkPathBar       *path_bar);
+
+GDK_AVAILABLE_IN_3_20
+void                  gtk_path_bar_set_path_extended     (GtkPathBar       *self,
+                                                          const gchar      *path,
+                                                          const gchar      *root_path,
+                                                          const gchar      *root_label,
+                                                          GIcon            *root_icon);
+
+GDK_AVAILABLE_IN_3_20
+void                  gtk_path_bar_set_selected_path     (GtkPathBar       *path_bar,
+                                                          const gchar      *path);
+GDK_AVAILABLE_IN_3_20
+const gchar*          gtk_path_bar_get_selected_path     (GtkPathBar       *path_bar);
+
+GDK_AVAILABLE_IN_3_20
+void                  gtk_path_bar_set_inverted          (GtkPathBar       *path_bar,
+                                                          gboolean          inverted);
+GDK_AVAILABLE_IN_3_20
+gboolean              gtk_path_bar_get_inverted          (GtkPathBar       *path_bar);
 
 G_END_DECLS
 
 #endif /* __GTK_PATH_BAR_H__ */
+
diff --git a/gtk/gtkpathbarcontainer.c b/gtk/gtkpathbarcontainer.c
new file mode 100644
index 0000000..6125c4e
--- /dev/null
+++ b/gtk/gtkpathbarcontainer.c
@@ -0,0 +1,967 @@
+/*
+ * Copyright (C) 2016 Carlos Soriano <csoriano gnome org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "config.h"
+
+#include "glib.h"
+
+#include "gtkpathbarcontainer.h"
+#include "gtkwidgetprivate.h"
+#include "gtkintl.h"
+#include "gtksizerequest.h"
+#include "gtkbuildable.h"
+#include "gtkrevealer.h"
+#include "gtkbox.h"
+
+//TODO remove
+#include "gtkbutton.h"
+
+#define REVEALER_ANIMATION_TIME 250 //ms
+#define INVERT_ANIMATION_SPEED 1.2 //px/ms
+#define INVERT_ANIMATION_MAX_TIME 750 //px/ms
+
+struct _GtkPathBarContainerPrivate
+{
+  GList *children;
+  gint inverted :1;
+  GList *widgets_to_hide;
+  GList *widgets_to_show;
+  GList *widgets_to_remove;
+  gint current_width;
+  gint current_height;
+  guint needs_update :1;
+
+  gboolean invert_animation;
+
+  GdkWindow *bin_window;
+  GdkWindow *view_window;
+
+  GtkWidget *children_box;
+
+  guint invert_animation_tick_id;
+  double invert_animation_progress;
+  gint invert_animation_initial_children_width;
+  guint64 invert_animation_initial_time;
+  gint allocated_children_width;
+  gint total_children_width;
+  gint previous_child_width;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GtkPathBarContainer, gtk_path_bar_container, GTK_TYPE_BIN)
+
+enum {
+  PROP_0,
+  PROP_INVERTED,
+  LAST_PROP
+};
+
+static GParamSpec *path_bar_container_properties[LAST_PROP] = { NULL, };
+
+static void
+gtk_path_bar_container_set_property (GObject      *object,
+                                    guint         prop_id,
+                                    const GValue *value,
+                                    GParamSpec   *pspec)
+{
+  GtkPathBarContainer *children_box = GTK_PATH_BAR_CONTAINER (object);
+
+  switch (prop_id)
+    {
+    case PROP_INVERTED:
+      gtk_path_bar_container_set_inverted (children_box, g_value_get_boolean (value));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+gtk_path_bar_container_get_property (GObject    *object,
+                                    guint       prop_id,
+                                    GValue     *value,
+                                    GParamSpec *pspec)
+{
+  GtkPathBarContainer *children_box = GTK_PATH_BAR_CONTAINER (object);
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (children_box);
+
+  switch (prop_id)
+    {
+    case PROP_INVERTED:
+      g_value_set_boolean (value, priv->inverted);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+void
+gtk_path_bar_container_add (GtkPathBarContainer *self,
+                           GtkWidget           *widget)
+{
+  GtkPathBarContainer *children_box = GTK_PATH_BAR_CONTAINER (self);
+  GtkWidget *revealer;
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (children_box);
+  GtkStyleContext *style_context;
+
+  revealer = gtk_revealer_new ();
+  style_context = gtk_widget_get_style_context (revealer);
+  //gtk_style_context_add_class (style_context, "pathbar-initial-opacity");
+  gtk_revealer_set_transition_type (GTK_REVEALER (revealer),
+                                    GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT);
+  gtk_container_add (GTK_CONTAINER (revealer), widget);
+  g_print ("children_box fine? %s \n", G_OBJECT_TYPE_NAME (priv->children_box));
+  gtk_container_add (GTK_CONTAINER (priv->children_box), revealer);
+  priv->children = g_list_append (priv->children, widget);
+  gtk_widget_show_all (revealer);
+
+  g_print ("add\n");
+}
+
+static void
+really_remove_child (GtkPathBarContainer *self,
+                     GtkWidget           *widget)
+{
+  GList *child;
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
+
+  g_print ("really remove child %p %s\n", widget, gtk_button_get_label (GTK_BUTTON (widget)));
+  for (child = priv->widgets_to_remove; child != NULL; child = child->next)
+    {
+      GtkWidget *revealer;
+
+      revealer = gtk_widget_get_parent (child->data);
+      g_print ("aver %p\n", child->data);
+      if (child->data == widget && !gtk_revealer_get_child_revealed (GTK_REVEALER (revealer)))
+        {
+          g_print ("############################## INSIDE\n");
+          gboolean was_visible = gtk_widget_get_visible (widget);
+
+          priv->widgets_to_remove = g_list_remove (priv->widgets_to_remove,
+                                                   child->data);
+          gtk_container_remove (GTK_CONTAINER (priv->children_box), revealer);
+
+          if (was_visible)
+            gtk_widget_queue_resize (GTK_WIDGET (self));
+
+          break;
+        }
+    }
+}
+
+static void
+unrevealed_really_remove_child (GObject    *widget,
+                                GParamSpec *pspec,
+                                gpointer    user_data)
+{
+  GtkPathBarContainer *self = GTK_PATH_BAR_CONTAINER (user_data);
+
+  g_print ("unrevelaed really remove child %p %s\n", widget, G_OBJECT_TYPE_NAME (widget));
+  g_signal_handlers_disconnect_by_func (widget, unrevealed_really_remove_child, self);
+  really_remove_child (self, gtk_bin_get_child (GTK_BIN (widget)));
+}
+
+void
+gtk_path_bar_container_remove (GtkPathBarContainer *self,
+                       GtkWidget    *widget)
+{
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
+  GtkWidget *to_remove;
+
+  g_print ("remove %p %s\n", widget, G_OBJECT_TYPE_NAME (widget));
+  if (GTK_IS_REVEALER (widget) && gtk_widget_get_parent (widget) == priv->children_box)
+    to_remove = gtk_bin_get_child (GTK_BIN (widget));
+  else
+    to_remove = widget;
+
+  priv->widgets_to_remove = g_list_append (priv->widgets_to_remove, to_remove);
+  priv->children = g_list_remove (priv->children, to_remove);
+  priv->needs_update = TRUE;
+
+  gtk_widget_queue_resize (GTK_WIDGET (self));
+}
+
+static GtkAllocation*
+get_children_allocation (GtkPathBarContainer *self,
+                         gboolean             inverted)
+{
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
+  GtkAllocation *children_allocation;
+  GtkAllocation *allocation;
+  GtkWidget *child_widget;
+  GList *child;
+  GtkRequestedSize *sizes_temp;
+  gint i;
+  GList *children;
+  gint current_children_min_width = 0;
+  gint current_children_nat_width = 0;
+
+  children = g_list_copy (priv->children);
+  sizes_temp = g_newa (GtkRequestedSize, g_list_length (priv->children));
+  allocation = g_new (GtkAllocation, 1);
+  gtk_widget_get_allocation (GTK_WIDGET (self), allocation);
+  children_allocation = g_new (GtkAllocation, 1);
+  children_allocation->x = 0;
+  children_allocation->y = 0;
+  children_allocation->height = allocation->height;
+
+  if (inverted)
+    children = g_list_reverse (children);
+
+  /* Retrieve desired size for visible children. */
+  for (i = 0, child = children; child != NULL; i++, child = child->next)
+    {
+      child_widget = GTK_WIDGET (child->data);
+
+      /* If we are in the middle of a revealer animation, get the revealer
+       * allocation */
+      gtk_widget_get_preferred_width_for_height (gtk_widget_get_parent (child_widget),
+                                                 allocation->height,
+                                                 &sizes_temp[i].minimum_size,
+                                                 &sizes_temp[i].natural_size);
+
+      current_children_min_width += sizes_temp[i].minimum_size;
+      current_children_nat_width += sizes_temp[i].natural_size;
+      if (current_children_min_width > allocation->width)
+        {
+          current_children_min_width -= sizes_temp[i].minimum_size;
+          current_children_nat_width -= sizes_temp[i].natural_size;
+          break;
+        }
+    }
+
+  if (current_children_nat_width > allocation->width)
+    children_allocation->width = current_children_min_width;
+  else
+    children_allocation->width = current_children_nat_width;
+
+  g_list_free (children);
+  g_free (allocation);
+
+  return children_allocation;
+}
+
+static void
+update_children_visibility (GtkPathBarContainer *self,
+                            GtkAllocation       *allocation)
+{
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
+  GtkWidget *child_widget;
+  GList *child;
+  GtkRequestedSize *sizes_temp;
+  gint i;
+  GList *children;
+  gboolean allocate_more_children = TRUE;
+  gint current_children_width = 0;
+
+  g_list_free (priv->widgets_to_show);
+  priv->widgets_to_show = NULL;
+  g_list_free (priv->widgets_to_hide);
+  priv->widgets_to_hide = NULL;
+  children = g_list_copy (priv->children);
+  sizes_temp = g_newa (GtkRequestedSize, g_list_length (priv->children));
+  if (priv->inverted)
+    children = g_list_reverse (children);
+
+  /* Retrieve desired size for visible children. */
+  for (i = 0, child = children; child != NULL; i++, child = child->next)
+    {
+      child_widget = GTK_WIDGET (child->data);
+
+      gtk_widget_get_preferred_width_for_height (child_widget,
+                                                 allocation->height,
+                                                 &sizes_temp[i].minimum_size,
+                                                 &sizes_temp[i].natural_size);
+
+      current_children_width += sizes_temp[i].minimum_size;
+
+      if (!allocate_more_children || current_children_width > allocation->width)
+        {
+          if (allocate_more_children)
+            priv->allocated_children_width = current_children_width - sizes_temp[i].minimum_size;
+          allocate_more_children = FALSE;
+          priv->previous_child_width = sizes_temp[i].minimum_size;
+          if (gtk_revealer_get_child_revealed (GTK_REVEALER (gtk_widget_get_parent (child_widget))))
+            priv->widgets_to_hide = g_list_append (priv->widgets_to_hide, child_widget);
+
+          continue;
+        }
+
+      if (!g_list_find (priv->widgets_to_remove, child_widget))
+        priv->widgets_to_show = g_list_append (priv->widgets_to_show, child_widget);
+    }
+
+  priv->total_children_width = current_children_width;
+  g_list_free (children);
+}
+
+static void
+add_opacity_class (GtkWidget   *widget,
+                   const gchar *class_name)
+{
+  GtkStyleContext *style_context;
+
+  style_context = gtk_widget_get_style_context (widget);
+
+  gtk_style_context_add_class (style_context, class_name);
+}
+
+static void
+remove_opacity_classes (GtkWidget *widget)
+{
+  GtkStyleContext *style_context;
+
+  style_context = gtk_widget_get_style_context (widget);
+
+  gtk_style_context_remove_class (style_context, "pathbar-initial-opacity");
+  gtk_style_context_remove_class (style_context, "pathbar-opacity-on");
+  gtk_style_context_remove_class (style_context, "pathbar-opacity-off");
+  gtk_style_context_remove_class (style_context, "pathbar-invert-animation-opacity-off");
+  gtk_style_context_remove_class (style_context, "pathbar-invert-animation-opacity-on");
+}
+
+static void
+revealer_on_show_completed (GObject    *widget,
+                            GParamSpec *pspec,
+                            gpointer    user_data)
+{
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (GTK_PATH_BAR_CONTAINER 
(user_data));
+
+  g_print ("opacity on!!!!!\n");
+  remove_opacity_classes (GTK_WIDGET (widget));
+  g_signal_handlers_disconnect_by_func (widget, revealer_on_show_completed, user_data);
+  priv->widgets_to_show = g_list_remove (priv->widgets_to_show,
+                                         gtk_bin_get_child (GTK_BIN (widget)));
+}
+
+static void
+revealer_on_hide_completed (GObject    *widget,
+                            GParamSpec *pspec,
+                            gpointer    user_data)
+{
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (GTK_PATH_BAR_CONTAINER 
(user_data));
+
+  g_print ("opacity off!!!!!\n");
+  remove_opacity_classes (GTK_WIDGET (widget));
+  g_signal_handlers_disconnect_by_func (widget, revealer_on_hide_completed,
+                                        user_data);
+  priv->widgets_to_hide = g_list_remove (priv->widgets_to_hide,
+                                         gtk_bin_get_child (GTK_BIN (widget)));
+}
+
+static void
+idle_update_revealers (GtkPathBarContainer *self)
+{
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
+  GList *l;
+
+  /* The invert animation is handled in a tick callback, do nothing here */
+  if (priv->invert_animation)
+    return;
+
+  for (l = priv->widgets_to_hide; l != NULL; l = l->next)
+    {
+      GtkWidget *revealer;
+
+      revealer = gtk_widget_get_parent (l->data);
+      if (gtk_revealer_get_child_revealed (GTK_REVEALER (revealer)) &&
+          gtk_revealer_get_reveal_child (GTK_REVEALER (revealer)))
+        {
+          g_signal_handlers_disconnect_by_func (revealer, revealer_on_hide_completed, self);
+          g_signal_connect (revealer, "notify::child-revealed", (GCallback) revealer_on_hide_completed, 
self);
+
+          remove_opacity_classes (revealer);
+          add_opacity_class (revealer, "pathbar-opacity-off");
+
+          gtk_revealer_set_reveal_child (GTK_REVEALER (revealer), FALSE);
+        }
+    }
+
+  for (l = priv->widgets_to_remove; l != NULL; l = l->next)
+    {
+      GtkWidget *revealer;
+
+      revealer = gtk_widget_get_parent (l->data);
+      if (gtk_revealer_get_child_revealed (GTK_REVEALER (revealer)))
+        {
+          g_signal_handlers_disconnect_by_func (revealer, revealer_on_hide_completed, self);
+          g_signal_connect (revealer, "notify::child-revealed",
+                            (GCallback) unrevealed_really_remove_child, self);
+
+          remove_opacity_classes (revealer);
+          add_opacity_class (revealer, "pathbar-opacity-off");
+
+          gtk_revealer_set_reveal_child (GTK_REVEALER (revealer), FALSE);
+        }
+      else
+        {
+          really_remove_child (self, l->data);
+        }
+    }
+
+  /* We want to defer to show revealers until the animation of those that needs
+   * to be hidden or removed are done
+   */
+  if (priv->widgets_to_remove || priv->widgets_to_hide)
+    return;
+
+  for (l = priv->widgets_to_show; l != NULL; l = l->next)
+    {
+      GtkWidget *revealer;
+
+      revealer = gtk_widget_get_parent (l->data);
+      if (!gtk_revealer_get_reveal_child (GTK_REVEALER (revealer)))
+        {
+          g_signal_handlers_disconnect_by_func (revealer, revealer_on_show_completed, self);
+          g_signal_connect (revealer, "notify::child-revealed", (GCallback) revealer_on_show_completed, 
self);
+
+          remove_opacity_classes (revealer);
+          add_opacity_class (revealer, "pathbar-opacity-on");
+
+          gtk_revealer_set_reveal_child (GTK_REVEALER (revealer), TRUE);
+        }
+    }
+
+}
+
+static gint
+get_max_scroll (GtkPathBarContainer *self)
+{
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
+  GtkAllocation *used_children_allocation;
+  gint children_width;
+  gdouble max_scroll;
+
+  used_children_allocation = get_children_allocation (self, TRUE);
+  children_width = gtk_widget_get_allocated_width (priv->children_box);
+
+  if (priv->invert_animation)
+    {
+      if (priv->inverted)
+        {
+          max_scroll = MAX (0, children_width - used_children_allocation->width);
+        }
+      else
+        {
+          max_scroll = children_width - used_children_allocation->width;
+        }
+    }
+  else
+    {
+      max_scroll = MAX (0, children_width - used_children_allocation->width);
+    }
+
+  return max_scroll;
+}
+
+static void
+update_scrolling (GtkPathBarContainer *self)
+{
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
+  GtkAllocation allocation;
+  GtkAllocation child_allocation;
+  gint scroll_value;
+  gint max_scroll;
+
+  gtk_widget_get_allocation (GTK_WIDGET (self), &allocation);
+  gtk_widget_get_allocation (priv->children_box, &child_allocation);
+  max_scroll = get_max_scroll (self);
+
+  if (gtk_widget_get_realized (GTK_WIDGET (self)))
+    {
+      if (priv->invert_animation)
+        {
+          /* We only move the window to the left of the allocation, so negative values */
+          if (priv->inverted)
+            scroll_value = - priv->invert_animation_progress * max_scroll;
+          else
+            scroll_value = - (1 - priv->invert_animation_progress) * max_scroll;
+        }
+      else
+        {
+          scroll_value = 0;
+        }
+
+      gdk_window_move_resize (priv->bin_window,
+                              scroll_value, 0,
+                              child_allocation.width, child_allocation.height);
+    }
+}
+
+static void
+gtk_path_bar_container_size_allocate (GtkWidget     *widget,
+                                     GtkAllocation *allocation)
+{
+  GtkPathBarContainer *self = GTK_PATH_BAR_CONTAINER (widget);
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
+  GtkAllocation child_allocation;
+  GtkRequestedSize *sizes;
+  GtkRequisition minimum_size;
+  GtkRequisition natural_size;
+
+  gtk_widget_set_allocation (widget, allocation);
+
+  sizes = g_newa (GtkRequestedSize, g_list_length (priv->children));
+
+  update_children_visibility (self, allocation);
+  idle_update_revealers (self);
+
+  gtk_widget_get_preferred_size (priv->children_box, &minimum_size, &natural_size);
+  child_allocation.x = 0;
+  child_allocation.y = 0;
+  child_allocation.width = natural_size.width;
+  child_allocation.height = natural_size.height;
+  gtk_widget_size_allocate (priv->children_box, &child_allocation);
+
+  update_scrolling (self);
+
+  if (gtk_widget_get_realized (widget))
+    {
+      gdk_window_move_resize (priv->view_window,
+                              allocation->x, allocation->y,
+                              allocation->width, allocation->height);
+      gdk_window_show (priv->view_window);
+    }
+}
+
+static void
+finish_invert_animation (GtkPathBarContainer *self)
+{
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
+  GtkAllocation allocation;
+  GList *widgets_to_hide_copy;
+  GList *l;
+
+  /* Hide the revealers that need to be hidden now. */
+  update_children_visibility (self, &allocation);
+  widgets_to_hide_copy = g_list_copy (priv->widgets_to_hide);
+  for (l = widgets_to_hide_copy; l != NULL; l = l->next)
+    {
+      GtkWidget *revealer;
+      double animation_time;
+
+      revealer = gtk_widget_get_parent (l->data);
+      remove_opacity_classes (revealer);
+
+      add_opacity_class (revealer, "pathbar-invert-animation-opacity-off");
+      g_signal_handlers_disconnect_by_func (revealer, revealer_on_hide_completed, self);
+      g_signal_connect (revealer, "notify::child-revealed", (GCallback) revealer_on_hide_completed, self);
+
+      /* If the animation we just did was to the inverted state, we
+       * have the revealers that need to be hidden out of the view, so
+       * there's no point on animating them.
+       * Not only that, we want to update the scroll in a way that takes
+       * into account the state when the animation is finished, if not
+       * we are going to show the animation of the revealers next time
+       * the scroll is updated
+       */
+      animation_time =  priv->inverted ? 0 : REVEALER_ANIMATION_TIME;
+      gtk_revealer_set_transition_duration (GTK_REVEALER (revealer),
+                                            animation_time);
+      gtk_revealer_set_reveal_child (GTK_REVEALER (revealer), FALSE);
+      gtk_revealer_set_transition_duration (GTK_REVEALER (revealer),
+                                            REVEALER_ANIMATION_TIME);
+    }
+
+  priv->invert_animation = FALSE;
+  priv->invert_animation_progress = 0;
+  priv->invert_animation_initial_time = 0;
+  gtk_widget_remove_tick_callback (priv->children_box,
+                                   priv->invert_animation_tick_id);
+  priv->invert_animation_tick_id = 0;
+}
+
+
+static gboolean
+invert_animation_on_tick (GtkWidget     *widget,
+                          GdkFrameClock *frame_clock,
+                          gpointer       user_data)
+{
+  GtkPathBarContainer *self = GTK_PATH_BAR_CONTAINER (user_data);
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
+  guint64 elapsed;
+  gint max_scroll;
+  double animation_speed;
+  GtkAllocation *used_children_allocation;
+  GtkAllocation child_allocation;
+  GtkAllocation allocation;
+
+  /* Initialize the frame clock the first time this is called */
+  if (priv->invert_animation_initial_time == 0)
+    priv->invert_animation_initial_time = gdk_frame_clock_get_frame_time (frame_clock);
+
+  gtk_widget_get_allocation (GTK_WIDGET (self), &allocation);
+  gtk_widget_get_allocation (priv->children_box, &child_allocation);
+  used_children_allocation = get_children_allocation (self, TRUE);
+
+  max_scroll = get_max_scroll (self);
+  if (!max_scroll)
+    return TRUE;
+
+  /* If there are several items the animation can take some time, so let's limit
+   * it to some extend
+   */
+  if (max_scroll / INVERT_ANIMATION_SPEED > INVERT_ANIMATION_MAX_TIME)
+    animation_speed = max_scroll / INVERT_ANIMATION_MAX_TIME;
+  else
+    animation_speed = INVERT_ANIMATION_SPEED;
+
+  elapsed = gdk_frame_clock_get_frame_time (frame_clock) - priv->invert_animation_initial_time;
+  priv->invert_animation_progress = MIN (1, elapsed * animation_speed / (1000. * max_scroll));
+  g_print ("################animation progres %d %d %d %f %f\n", gtk_widget_get_allocated_width (GTK_WIDGET 
(self)), used_children_allocation->width, max_scroll, elapsed / 1000., priv->invert_animation_progress);
+  update_scrolling (self);
+
+  if (priv->invert_animation_progress >= 1)
+    {
+      finish_invert_animation (self);
+
+      return FALSE;
+    }
+
+  return TRUE;
+}
+
+static void
+start_invert_animation (GtkPathBarContainer *self)
+{
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
+  GList *child;
+
+  if (priv->invert_animation)
+    finish_invert_animation (self);
+
+  priv->invert_animation = TRUE;
+  priv->invert_animation_progress = 0;
+  priv->invert_animation_initial_children_width = gtk_widget_get_allocated_width (GTK_WIDGET (self));
+
+  for (child = priv->children; child != NULL; child = child->next)
+    {
+      GtkWidget *revealer;
+
+      revealer = gtk_widget_get_parent (GTK_WIDGET (child->data));
+
+      remove_opacity_classes (revealer);
+      add_opacity_class (revealer, "pathbar-invert-animation-opacity-on");
+
+      gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 0);
+      gtk_revealer_set_reveal_child (GTK_REVEALER (revealer), TRUE);
+      gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), REVEALER_ANIMATION_TIME);
+    }
+
+  priv->invert_animation_tick_id = gtk_widget_add_tick_callback (priv->children_box,
+                                                                 (GtkTickCallback) invert_animation_on_tick,
+                                                                 self, NULL);
+}
+
+static void
+gtk_path_bar_container_get_preferred_width (GtkWidget *widget,
+                                           gint      *minimum_width,
+                                           gint      *natural_width)
+{
+  GtkPathBarContainer *self = GTK_PATH_BAR_CONTAINER (widget);
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
+  gint child_minimum_width;
+  gint child_natural_width;
+  GList *child;
+  gint n_visible_children;
+  gboolean have_min = FALSE;
+  GList *children;
+
+  *minimum_width = 0;
+  *natural_width = 0;
+
+  children = g_list_copy (priv->children);
+  if (priv->inverted)
+    children = g_list_reverse (children);
+
+  n_visible_children = 0;
+  for (child = children; child != NULL; child = child->next)
+    {
+      if (!gtk_widget_is_visible (child->data))
+        continue;
+
+      ++n_visible_children;
+      gtk_widget_get_preferred_width (child->data, &child_minimum_width, &child_natural_width);
+      /* Minimum is a minimum of the first visible child */
+      if (!have_min)
+        {
+          *minimum_width = child_minimum_width;
+          have_min = TRUE;
+        }
+      /* Natural is a sum of all visible children */
+      *natural_width += child_natural_width;
+    }
+
+  g_list_free (children);
+}
+
+static void
+gtk_path_bar_container_get_preferred_width_for_height (GtkWidget *widget,
+                                                      gint       height,
+                                                      gint      *minimum_width_out,
+                                                      gint      *natural_width_out)
+{
+  gtk_path_bar_container_get_preferred_width (widget, minimum_width_out, natural_width_out);
+}
+
+static void
+gtk_path_bar_container_get_preferred_height (GtkWidget *widget,
+                                            gint      *minimum_height,
+                                            gint      *natural_height)
+{
+  GtkPathBarContainer *children_box = GTK_PATH_BAR_CONTAINER (widget);
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (children_box);
+  gint child_minimum_height;
+  gint child_natural_height;
+  GList *child;
+
+  *minimum_height = 0;
+  *natural_height = 0;
+  for (child = priv->children; child != NULL; child = child->next)
+    {
+      if (!gtk_widget_is_visible (child->data))
+        continue;
+
+      gtk_widget_get_preferred_height (child->data, &child_minimum_height, &child_natural_height);
+      *minimum_height = MAX (*minimum_height, child_minimum_height);
+      *natural_height = MAX (*natural_height, child_natural_height);
+    }
+}
+
+static GtkSizeRequestMode
+gtk_path_bar_container_get_request_mode (GtkWidget *self)
+{
+  return GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT;
+}
+
+static void
+gtk_path_bar_container_container_add (GtkContainer *container,
+                              GtkWidget    *child)
+{
+  g_return_if_fail (child != NULL);
+
+  g_error ("Path bar cannot add children. Use the path bar API instead");
+
+  return;
+}
+
+static void
+gtk_path_bar_container_container_remove (GtkContainer *container,
+                                 GtkWidget    *child)
+{
+  g_return_if_fail (child != NULL);
+
+  g_error ("Path bar cannot remove children. Use the path bar API instead");
+
+  return;
+}
+
+static void
+gtk_path_bar_container_unrealize (GtkWidget *widget)
+{
+  GtkPathBarContainer *self = GTK_PATH_BAR_CONTAINER (widget);
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
+
+  gtk_widget_unregister_window (widget, priv->bin_window);
+  gdk_window_destroy (priv->bin_window);
+  priv->view_window = NULL;
+
+  GTK_WIDGET_CLASS (gtk_path_bar_container_parent_class)->unrealize (widget);
+}
+
+static void
+gtk_path_bar_container_realize (GtkWidget *widget)
+{
+  GtkPathBarContainer *self = GTK_PATH_BAR_CONTAINER (widget);
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
+  GtkAllocation allocation;
+  GtkAllocation *children_allocation;
+  GdkWindowAttr attributes = { 0 };
+  GdkWindowAttributesType attributes_mask;
+
+  g_print ("realize\n");
+  gtk_widget_set_realized (widget, TRUE);
+
+  gtk_widget_get_allocation (widget, &allocation);
+
+  attributes.x = allocation.x;
+  attributes.y = allocation.y;
+  attributes.width = allocation.width;
+  attributes.height = allocation.height;
+  attributes.window_type = GDK_WINDOW_CHILD;
+  attributes.wclass = GDK_INPUT_OUTPUT;
+  attributes.visual = gtk_widget_get_visual (widget);
+  attributes.event_mask = gtk_widget_get_events (widget);
+  attributes_mask = (GDK_WA_X | GDK_WA_Y) | GDK_WA_VISUAL;
+
+  priv->view_window = gdk_window_new (gtk_widget_get_parent_window (GTK_WIDGET (self)),
+                                      &attributes, attributes_mask);
+  gtk_widget_set_window (widget, priv->view_window);
+  gtk_widget_register_window (widget, priv->view_window);
+
+  children_allocation = get_children_allocation (self, priv->inverted);
+  attributes.x = 0;
+  attributes.y = 0;
+  attributes.width = children_allocation->width;
+  attributes.height = children_allocation->height;
+
+  priv->bin_window = gdk_window_new (priv->view_window, &attributes,
+                                     attributes_mask);
+  gtk_widget_register_window (widget, priv->bin_window);
+
+  gtk_widget_set_parent_window (priv->children_box, priv->bin_window);
+
+  gdk_window_show (priv->bin_window);
+  gdk_window_show (priv->view_window);
+  gtk_widget_show_all (priv->children_box);
+}
+
+static gboolean
+gtk_path_bar_container_draw (GtkWidget *widget,
+                     cairo_t   *cr)
+{
+  GtkPathBarContainer *self = GTK_PATH_BAR_CONTAINER (widget);
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
+
+  if (gtk_cairo_should_draw_window (cr, priv->bin_window))
+    {
+      GTK_WIDGET_CLASS (gtk_path_bar_container_parent_class)->draw (widget, cr);
+    }
+
+  return GDK_EVENT_PROPAGATE;
+}
+
+static void
+gtk_path_bar_container_init (GtkPathBarContainer *self)
+{
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
+
+  gtk_widget_set_has_window (GTK_WIDGET (self), TRUE);
+  gtk_widget_set_redraw_on_allocate (GTK_WIDGET (self), TRUE);
+
+  priv->children_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+  gtk_widget_set_parent_window (priv->children_box, priv->bin_window);
+  GTK_CONTAINER_CLASS (gtk_path_bar_container_parent_class)->add (GTK_CONTAINER (self), priv->children_box);
+
+  gtk_widget_show (priv->children_box);
+
+  priv->invert_animation = FALSE;
+  priv->inverted = FALSE;
+  priv->invert_animation_tick_id = 0;
+  priv->widgets_to_hide = NULL;
+  priv->widgets_to_show = NULL;
+  priv->widgets_to_remove = NULL;
+
+  g_print ("init\n");
+}
+
+static void
+gtk_path_bar_container_class_init (GtkPathBarContainerClass *class)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (class);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
+  GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class);
+
+  object_class->set_property = gtk_path_bar_container_set_property;
+  object_class->get_property = gtk_path_bar_container_get_property;
+
+  widget_class->size_allocate = gtk_path_bar_container_size_allocate;
+  widget_class->get_preferred_width = gtk_path_bar_container_get_preferred_width;
+  widget_class->get_preferred_height = gtk_path_bar_container_get_preferred_height;
+  widget_class->get_preferred_width_for_height = gtk_path_bar_container_get_preferred_width_for_height;
+  widget_class->get_request_mode = gtk_path_bar_container_get_request_mode;
+  widget_class->realize = gtk_path_bar_container_realize;
+  widget_class->unrealize = gtk_path_bar_container_unrealize;
+  widget_class->draw = gtk_path_bar_container_draw;
+
+  container_class->add = gtk_path_bar_container_container_add;
+  container_class->remove = gtk_path_bar_container_container_remove;
+
+  path_bar_container_properties[PROP_INVERTED] =
+           g_param_spec_int ("inverted",
+                             _("Direction of hiding children inverted"),
+                             P_("If false the container will start hiding widgets from the end when there is 
not enough space, and the oposite in case inverted is true."),
+                             0, G_MAXINT, 0,
+                             G_PARAM_READWRITE);
+
+  g_object_class_install_properties (object_class, LAST_PROP, path_bar_container_properties);
+  g_print ("class init\n");
+}
+
+/**
+ * gtk_path_bar_container_new:
+ *
+ * Creates a new #GtkPathBarContainer.
+ *
+ * Returns: a new #GtkPathBarContainer.
+ **/
+GtkWidget *
+gtk_path_bar_container_new (void)
+{
+  return g_object_new (GTK_TYPE_PATH_BAR_CONTAINER, NULL);
+}
+
+void
+gtk_path_bar_container_set_inverted (GtkPathBarContainer *self,
+                                     gboolean             inverted)
+{
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
+  g_return_if_fail (GTK_IS_PATH_BAR_CONTAINER (self));
+
+  if (priv->inverted != inverted)
+    {
+      priv->inverted = inverted != FALSE;
+
+      g_object_notify (G_OBJECT (self), "inverted");
+
+      start_invert_animation (self);
+      gtk_widget_queue_resize (GTK_WIDGET (self));
+    }
+}
+
+gboolean
+gtk_path_bar_container_get_inverted (GtkPathBarContainer *self)
+{
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
+  g_return_val_if_fail (GTK_IS_PATH_BAR_CONTAINER (self), 0);
+
+  priv = gtk_path_bar_container_get_instance_private (self);
+
+  return priv->inverted;
+}
+
+GList *
+gtk_path_bar_container_get_overflow_children (GtkPathBarContainer *self)
+{
+  GtkPathBarContainerPrivate *priv = gtk_path_bar_container_get_instance_private (self);
+  GList *result = NULL;
+  GList *l;
+
+  g_return_val_if_fail (GTK_IS_PATH_BAR_CONTAINER (self), 0);
+
+  priv = gtk_path_bar_container_get_instance_private (self);
+
+  for (l = priv->children; l != NULL; l = l->next)
+    if (gtk_widget_is_visible (l->data) && !gtk_widget_get_child_visible (l->data))
+      result = g_list_append (result, l->data);
+
+  return result;
+}
diff --git a/gtk/gtkpathbarcontainer.h b/gtk/gtkpathbarcontainer.h
new file mode 100644
index 0000000..25d39b9
--- /dev/null
+++ b/gtk/gtkpathbarcontainer.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2016 Carlos Soriano <csoriano gnome org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __GTK_PATH_BAR_CONTAINER_H__
+#define __GTK_PATH_BAR_CONTAINER_H__
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#include <gtk/gtkbin.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_PATH_BAR_CONTAINER            (gtk_path_bar_container_get_type())
+#define GTK_PATH_BAR_CONTAINER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GTK_TYPE_PATH_BAR_CONTAINER, GtkPathBarContainer))
+#define GTK_PATH_BAR_CONTAINER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), 
GTK_TYPE_PATH_BAR_CONTAINER, GtkPathBarContainerClass))
+#define GTK_IS_PATH_BAR_CONTAINER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GTK_TYPE_PATH_BAR_CONTAINER))
+#define GTK_IS_PATH_BAR_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GTK_TYPE_PATH_BAR_CONTAINER)
+#define GTK_PATH_BAR_CONTAINER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GTK_TYPE_PATH_BAR_CONTAINER, GtkPathBarContainerClass))
+
+typedef struct _GtkPathBarContainer GtkPathBarContainer;
+typedef struct _GtkPathBarContainerClass GtkPathBarContainerClass;
+typedef struct _GtkPathBarContainerPrivate GtkPathBarContainerPrivate;
+
+struct _GtkPathBarContainerClass
+{
+  GtkBinClass parent;
+
+  /* Padding for future expansion */
+  gpointer reserved[10];
+};
+
+struct _GtkPathBarContainer
+{
+  GtkBin parent_instance;
+};
+
+GDK_AVAILABLE_IN_3_20
+GType             gtk_path_bar_container_get_type                (void) G_GNUC_CONST;
+
+GDK_AVAILABLE_IN_3_20
+GtkWidget        *gtk_path_bar_container_new                     (void);
+GDK_AVAILABLE_IN_3_20
+void              gtk_path_bar_container_set_spacing             (GtkPathBarContainer      *box,
+                                                                  gint                      spacing);
+GDK_AVAILABLE_IN_3_20
+gint              gtk_path_bar_container_get_spacing             (GtkPathBarContainer      *box);
+
+GDK_AVAILABLE_IN_3_20
+void              gtk_path_bar_container_set_inverted            (GtkPathBarContainer      *box,
+                                                                  gboolean                  inverted);
+GDK_AVAILABLE_IN_3_20
+gboolean          gtk_path_bar_container_get_inverted            (GtkPathBarContainer      *box);
+
+GDK_AVAILABLE_IN_3_20
+GList             *gtk_path_bar_container_get_overflow_children  (GtkPathBarContainer      *box);
+
+GDK_AVAILABLE_IN_3_20
+void              gtk_path_bar_container_add                     (GtkPathBarContainer      *self,
+                                                                  GtkWidget                *widget);
+GDK_AVAILABLE_IN_3_20
+void              gtk_path_bar_container_remove                  (GtkPathBarContainer      *self,
+                                                                  GtkWidget                *widget);
+G_END_DECLS
+
+#endif /* GTK_PATH_BAR_CONTAINER_H_ */
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 95beb5d..3b55c63 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -6107,7 +6107,8 @@ gtk_window_show (GtkWidget *widget)
 
   _gtk_widget_set_visible_flag (widget, TRUE);
 
-  gtk_css_node_validate (gtk_widget_get_css_node (widget));
+  if (gtk_widget_get_css_node (widget))
+    gtk_css_node_validate (gtk_widget_get_css_node (widget));
 
   gtk_widget_realize (widget);
 
diff --git a/gtk/makefile.msc.in b/gtk/makefile.msc.in
index 78a5244..fcce86b 100644
--- a/gtk/makefile.msc.in
+++ b/gtk/makefile.msc.in
@@ -446,6 +446,7 @@ gtk_public_h_sources =              \
        gtkpagesetup.h          \
        gtkpaned.h              \
        gtkpapersize.h          \
+       gtkpathbar.h            \
        gtkplug.h               \
        gtkprintcontext.h       \
        gtkprintoperation.h     \
diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss
index c211afe..c594463 100644
--- a/gtk/theme/Adwaita/_common.scss
+++ b/gtk/theme/Adwaita/_common.scss
@@ -1574,31 +1574,60 @@ headerbar {
 /************
  * Pathbars *
  ************/
-.path-bar button {
-  &.text-button, &.image-button, & {
-    padding-left: 4px;
-    padding-right: 4px;
-  }
 
-  &.text-button.image-button label {
-    padding-left: 0;
-    padding-right: 0;
-  }
+path-bar button.flat, .path-bar-overflow-popover button.flat {
+    background-image: none;
+    border-radius: 0px;
+    border-color: transparent;
+    border-width: 2px 0px 2px 0px;
+    box-shadow: 0px 0px 0px;
+    margin: 0px;
+    opacity: 0.55;
+    padding: 3px 8px 4px;
+    background-color: transparent;
 
-  &.text-button.image-button, & {
-    label:last-child { padding-right: 8px; }
-    label:first-child { padding-left: 8px; }
-  }
+    &:checked {
+      opacity: 1;
+    }
 
-  image {
-    padding-left: 4px;
-    padding-right: 4px;
-  }
+    &:hover {
+      border-bottom-color: mix($selected_bg_color, $selected_fg_color, 75%);
+    }
 
-  &.slider-button {
-    padding-left: 0;
-    padding-right: 0;
-  }
+    &:backdrop, &:backdrop:checked {
+      background-color: transparent;
+      border-color: transparent;
+      background-image: none;
+    }
+}
+
+.pathbar-initial-opacity {
+    opacity: 0;
+}
+
+.pathbar-opacity-off {
+    opacity: 0;
+    transition-duration: 1000ms;
+}
+
+ keyframes pathbar-opactiy-on-keyframes {
+  from {opacity: 0; color:red;}
+  to {opacity: 1; color:blue;}
+}
+
+.pathbar-opacity-on {
+    animation-name: pathbar-opacity-on-keyframes;
+    animation-duration: 1000ms;
+}
+
+.pathbar-invert-animation-opacity-on {
+    animation-name: pathbar-opacity-on-keyframes;
+    transition-duration: 300ms;
+}
+
+.pathbar-invert-animation-opacity-off {
+    opacity: 0;
+    transition-duration: 100ms;
 }
 
 /**************
diff --git a/gtk/theme/Adwaita/gtk-contained-dark.css b/gtk/theme/Adwaita/gtk-contained-dark.css
index 257f9a0..1616143 100644
--- a/gtk/theme/Adwaita/gtk-contained-dark.css
+++ b/gtk/theme/Adwaita/gtk-contained-dark.css
@@ -2081,22 +2081,50 @@ window.csd > .titlebar:not(headerbar) {
 /************
  * Pathbars *
  ************/
-.path-bar button.text-button, .path-bar button.image-button, .path-bar button {
-  padding-left: 4px;
-  padding-right: 4px; }
-.path-bar button.text-button.image-button label {
-  padding-left: 0;
-  padding-right: 0; }
-.path-bar button.text-button.image-button label:last-child, .path-bar button label:last-child {
-  padding-right: 8px; }
-.path-bar button.text-button.image-button label:first-child, .path-bar button label:first-child {
-  padding-left: 8px; }
-.path-bar button image {
-  padding-left: 4px;
-  padding-right: 4px; }
-.path-bar button.slider-button {
-  padding-left: 0;
-  padding-right: 0; }
+path-bar button.flat, .path-bar-overflow-popover button.flat {
+  background-image: none;
+  border-radius: 0px;
+  border-color: transparent;
+  border-width: 2px 0px 2px 0px;
+  box-shadow: 0px 0px 0px;
+  margin: 0px;
+  opacity: 0.55;
+  padding: 3px 8px 4px;
+  background-color: transparent; }
+  path-bar button.flat:checked, .path-bar-overflow-popover button.flat:checked {
+    opacity: 1; }
+  path-bar button.flat:hover, .path-bar-overflow-popover button.flat:hover {
+    border-bottom-color: #5986b5; }
+  path-bar button.flat:backdrop, path-bar button.flat:backdrop:checked, .path-bar-overflow-popover 
button.flat:backdrop, .path-bar-overflow-popover button.flat:backdrop:checked {
+    background-color: transparent;
+    border-color: transparent;
+    background-image: none; }
+
+.pathbar-initial-opacity {
+  opacity: 0; }
+
+.pathbar-opacity-off {
+  opacity: 0;
+  transition-duration: 1000ms; }
+
+ keyframes pathbar-opactiy-on-keyframes {
+  from {
+    opacity: 0;
+    color: red; }
+  to {
+    opacity: 1;
+    color: blue; } }
+.pathbar-opacity-on {
+  animation-name: pathbar-opacity-on-keyframes;
+  animation-duration: 1000ms; }
+
+.pathbar-invert-animation-opacity-on {
+  animation-name: pathbar-opacity-on-keyframes;
+  transition-duration: 300ms; }
+
+.pathbar-invert-animation-opacity-off {
+  opacity: 0;
+  transition-duration: 100ms; }
 
 /**************
  * Tree Views *
diff --git a/gtk/theme/Adwaita/gtk-contained.css b/gtk/theme/Adwaita/gtk-contained.css
index 14f2c7c..ac627e9 100644
--- a/gtk/theme/Adwaita/gtk-contained.css
+++ b/gtk/theme/Adwaita/gtk-contained.css
@@ -2090,22 +2090,50 @@ window.csd > .titlebar:not(headerbar) {
 /************
  * Pathbars *
  ************/
-.path-bar button.text-button, .path-bar button.image-button, .path-bar button {
-  padding-left: 4px;
-  padding-right: 4px; }
-.path-bar button.text-button.image-button label {
-  padding-left: 0;
-  padding-right: 0; }
-.path-bar button.text-button.image-button label:last-child, .path-bar button label:last-child {
-  padding-right: 8px; }
-.path-bar button.text-button.image-button label:first-child, .path-bar button label:first-child {
-  padding-left: 8px; }
-.path-bar button image {
-  padding-left: 4px;
-  padding-right: 4px; }
-.path-bar button.slider-button {
-  padding-left: 0;
-  padding-right: 0; }
+path-bar button.flat, .path-bar-overflow-popover button.flat {
+  background-image: none;
+  border-radius: 0px;
+  border-color: transparent;
+  border-width: 2px 0px 2px 0px;
+  box-shadow: 0px 0px 0px;
+  margin: 0px;
+  opacity: 0.55;
+  padding: 3px 8px 4px;
+  background-color: transparent; }
+  path-bar button.flat:checked, .path-bar-overflow-popover button.flat:checked {
+    opacity: 1; }
+  path-bar button.flat:hover, .path-bar-overflow-popover button.flat:hover {
+    border-bottom-color: #77ace3; }
+  path-bar button.flat:backdrop, path-bar button.flat:backdrop:checked, .path-bar-overflow-popover 
button.flat:backdrop, .path-bar-overflow-popover button.flat:backdrop:checked {
+    background-color: transparent;
+    border-color: transparent;
+    background-image: none; }
+
+.pathbar-initial-opacity {
+  opacity: 0; }
+
+.pathbar-opacity-off {
+  opacity: 0;
+  transition-duration: 1000ms; }
+
+ keyframes pathbar-opactiy-on-keyframes {
+  from {
+    opacity: 0;
+    color: red; }
+  to {
+    opacity: 1;
+    color: blue; } }
+.pathbar-opacity-on {
+  animation-name: pathbar-opacity-on-keyframes;
+  animation-duration: 1000ms; }
+
+.pathbar-invert-animation-opacity-on {
+  animation-name: pathbar-opacity-on-keyframes;
+  transition-duration: 300ms; }
+
+.pathbar-invert-animation-opacity-off {
+  opacity: 0;
+  transition-duration: 100ms; }
 
 /**************
  * Tree Views *
diff --git a/gtk/ui/gtkfilechooserwidget.ui b/gtk/ui/gtkfilechooserwidget.ui
index b42c2cc..5861dd8 100644
--- a/gtk/ui/gtkfilechooserwidget.ui
+++ b/gtk/ui/gtkfilechooserwidget.ui
@@ -56,9 +56,9 @@
                                 <property name="spacing">6</property>
                                 <property name="border-width">6</property>
                                 <child>
-                                  <object class="GtkPathBar" id="browse_path_bar">
+                                  <object class="GtkFilesPathBar" id="browse_path_bar">
                                     <property name="visible">True</property>
-                                    <signal name="path-clicked" handler="path_bar_clicked" after="yes" 
swapped="no"/>
+                                    <signal name="notify::file" handler="on_path_bar_file"/>
                                   </object>
                                   <packing>
                                     <property name="expand">1</property>
diff --git a/tests/Makefile.am b/tests/Makefile.am
index aeb51a6..f892f2c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -86,6 +86,7 @@ noinst_PROGRAMS =  $(TEST_PROGS)      \
        testgtk                         \
        testheaderbar                   \
        testheightforwidth              \
+       testpathbarcontainer            \
        testiconview                    \
        testiconview-keynav             \
        testicontheme                   \
@@ -108,6 +109,7 @@ noinst_PROGRAMS =  $(TEST_PROGS)    \
        testorientable                  \
        testoverlay                     \
        testoverlaystyleclass           \
+       testpathbar                     \
        testprint                       \
        testrecentchooser               \
        testrecentchoosermenu           \
@@ -291,6 +293,8 @@ testanimation_DEPENDENCIES = $(TEST_DEPS)
 testpixbuf_save_DEPENDENCIES = $(TEST_DEPS)
 testpixbuf_color_DEPENDENCIES = $(TEST_DEPS)
 testpixbuf_scale_DEPENDENCIES = $(TEST_DEPS)
+testpathbar_DEPENDENCIES = $(TEST_DEPS)
+testpathbarcontainer_DEPENDENCIES = $(TEST_DEPS)
 testgmenu_DEPENDENCIES = $(TEST_DEPS)
 testlogout_DEPENDENCIES = $(TEST_DEPS)
 teststack_DEPENDENCIES = $(TEST_DEPS)
@@ -391,6 +395,12 @@ testtoolbar_SOURCES =      \
 testmenubutton_SOURCES =       \
        testmenubutton.c
 
+testpathbar_SOURCES =          \
+       testpathbar.c
+
+testpathbarcontainer_SOURCES =         \
+       testpathbarcontainer.c
+
 testprint_SOURCES =            \
        testprint.c             \
        testprintfileoperation.h \
diff --git a/tests/testpathbar.c b/tests/testpathbar.c
new file mode 100644
index 0000000..31c4922
--- /dev/null
+++ b/tests/testpathbar.c
@@ -0,0 +1,330 @@
+#include "config.h"
+#include "glib.h"
+#include <gtk/gtk.h>
+
+static GActionGroup *action_group;
+static GtkWidget *path_bar;
+static GtkWidget *path_bar_inverted;
+static GtkWidget *path_bar_slash;
+static GtkWidget *path_bar_custom_root_label;
+static GtkWidget *path_bar_custom_root_icon;
+static GtkWidget *files_path_bar_random;
+static GtkWidget *files_path_bar_recent;
+static const gchar* REAL_LOCATION_RANDOM = "file:///boot/efi/EFI/BOOT";
+static const gchar* REAL_LOCATION_RECENT = "recent:///";
+static const gchar* ORIGINAL_PATH = "/test/test 2/test 3/asda lkasdl/pppppppppppppppp/ alskd";
+static const gchar* ROOT_PATH = "/test/test 2/test 3";
+static const gchar* DISPLAY_PATH = "/test/test 2/This Is A Root/asda lkasdl/pppppppppppppppp/ alskd";
+
+static void
+action_menu_1 (GSimpleAction *action,
+               GVariant      *variant,
+               gpointer       user_data)
+{
+  g_print ("Menu 1 action\n");
+}
+
+static void
+action_menu_2 (GSimpleAction *action,
+               GVariant      *variant,
+               gpointer       user_data)
+{
+  g_print ("Menu 2 action\n");
+}
+
+static void
+action_special (GSimpleAction *action,
+                GVariant      *variant,
+                gpointer       user_data)
+{
+  g_print ("Special action\n");
+}
+
+const GActionEntry entries[] = {
+  { "menu_1",  action_menu_1 },
+  { "menu_2",  action_menu_2 },
+  { "special", action_special },
+};
+
+static void
+on_populate_popup (GtkPathBar  *path_bar,
+                   GtkWidget   *container,
+                   const gchar *selected_path)
+{
+  GtkWidget *menu_item;
+
+  menu_item = gtk_model_button_new ();
+  gtk_actionable_set_action_name (GTK_ACTIONABLE (menu_item),
+                                  "action_group.menu_1");
+  g_object_set (menu_item, "text", "Menu 1", NULL);
+  gtk_container_add (GTK_CONTAINER (container), menu_item);
+
+  menu_item = gtk_model_button_new ();
+  gtk_actionable_set_action_name (GTK_ACTIONABLE (menu_item),
+                                  "action_group.menu_2");
+  g_object_set (menu_item, "text", "Menu 2", NULL);
+  gtk_container_add (GTK_CONTAINER (container), menu_item);
+
+  if (g_strcmp0 (selected_path, "/test/test 2/test 3") == 0)
+    {
+      menu_item = gtk_model_button_new ();
+      gtk_actionable_set_action_name (GTK_ACTIONABLE (menu_item),
+                                      "action_group.special");
+      g_object_set (menu_item, "text", "Special", NULL);
+      gtk_container_add (GTK_CONTAINER (container), menu_item);
+    }
+
+  gtk_widget_show_all (container);
+
+  g_print ("Populate popup\n");
+}
+
+static void
+on_path_selected (GtkPathBar *path_bar,
+                  GParamSpec *pspec,
+                  gpointer   *user_data)
+{
+  g_print ("Path selected: %s\n", gtk_path_bar_get_selected_path (path_bar));
+}
+
+static gchar*
+get_display_path_from_selected (const gchar *selected_path)
+{
+  gchar **splitted_path;
+  gchar **display_splitted_path;
+  gint i;
+  GString *display_path;
+  gchar *display_path_gchar;
+
+  splitted_path = g_strsplit (selected_path, "/", -1);
+  display_splitted_path = g_strsplit (DISPLAY_PATH, "/", -1);
+  display_path = g_string_new ("");
+  /* Skip the first empty split part */
+  for (i = 1; i < g_strv_length (splitted_path); i++)
+    {
+      g_string_append (display_path, "/");
+      g_string_append (display_path, display_splitted_path[i]);
+    }
+
+  display_path_gchar = display_path->str;
+
+  g_string_free (display_path, FALSE);
+  g_strfreev (splitted_path);
+  g_strfreev (display_splitted_path);
+
+  return display_path_gchar;
+}
+
+static void
+on_path_selected_set_path (GtkPathBar *path_bar,
+                           GParamSpec *pspec,
+                           gpointer   *user_data)
+{
+  gchar *selected_path;
+  gchar *new_display_path;
+
+  selected_path = g_strdup (gtk_path_bar_get_selected_path (path_bar));
+  new_display_path = get_display_path_from_selected (selected_path);
+  g_print ("Path selected: %s, setting path to GtkPathBar and new display path %s\n", selected_path, 
new_display_path);
+  if (path_bar == GTK_PATH_BAR (path_bar_custom_root_label))
+    {
+      gtk_path_bar_set_path_extended (GTK_PATH_BAR (path_bar_custom_root_label),
+                                      selected_path, ROOT_PATH, "This Is A Root", NULL);
+    }
+  else if (path_bar == GTK_PATH_BAR (path_bar_custom_root_icon))
+    {
+      GIcon *icon;
+
+      icon = g_themed_icon_new ("drive-harddisk");
+      gtk_path_bar_set_path_extended (GTK_PATH_BAR (path_bar_custom_root_icon),
+                                      selected_path, "/", NULL, icon);
+      g_object_unref (icon);
+    }
+  else
+    {
+      gtk_path_bar_set_path (path_bar, selected_path);
+    }
+
+  g_free (selected_path);
+  g_free (new_display_path);
+}
+
+static void
+on_file_changed (GtkFilesPathBar *path_bar,
+                 GParamSpec      *pspec,
+                 gpointer        *user_data)
+{
+  GFile *file;
+  gchar *uri;
+
+  file = gtk_files_path_bar_get_file (path_bar);
+  uri = g_file_get_uri (file);
+  g_print ("File selected: %s in GtkFilesPathBar\n", uri);
+  g_free (uri);
+}
+
+
+static void
+connect_path_bar (GtkPathBar *path_bar)
+{
+  g_signal_connect (GTK_PATH_BAR (path_bar), "populate-popup",
+                    G_CALLBACK (on_populate_popup), NULL);
+  g_signal_connect (GTK_PATH_BAR (path_bar), "notify::selected-path",
+                    G_CALLBACK (on_path_selected), NULL);
+}
+
+static void
+connect_path_bar_set_path (GtkPathBar *path_bar)
+{
+  g_signal_connect (GTK_PATH_BAR (path_bar), "populate-popup",
+                    G_CALLBACK (on_populate_popup), NULL);
+  g_signal_connect (GTK_PATH_BAR (path_bar), "notify::selected-path",
+                    G_CALLBACK (on_path_selected_set_path), NULL);
+}
+
+static void
+connect_files_path_bar (GtkFilesPathBar *files_path_bar)
+{
+  g_signal_connect (GTK_FILES_PATH_BAR (files_path_bar), "populate-popup",
+                    G_CALLBACK (on_populate_popup), NULL);
+  g_signal_connect (GTK_FILES_PATH_BAR (files_path_bar), "notify::file",
+                    G_CALLBACK (on_file_changed), NULL);
+}
+
+static void
+on_reset_button_clicked (GtkButton *reset_button)
+{
+  GFile *file;
+  GIcon *icon;
+
+  gtk_path_bar_set_path (GTK_PATH_BAR (path_bar), ORIGINAL_PATH);
+  gtk_path_bar_set_path (GTK_PATH_BAR (path_bar_inverted), ORIGINAL_PATH);
+  gtk_path_bar_set_path (GTK_PATH_BAR (path_bar_slash), "/");
+  gtk_path_bar_set_path_extended (GTK_PATH_BAR (path_bar_custom_root_label),
+                                  ORIGINAL_PATH, ROOT_PATH, "This Is A Root", NULL);
+  icon = g_themed_icon_new ("drive-harddisk");
+  gtk_path_bar_set_path_extended (GTK_PATH_BAR (path_bar_custom_root_icon),
+                                  ORIGINAL_PATH, "/", NULL, icon);
+  g_object_unref (icon);
+
+  file = g_file_new_for_uri (REAL_LOCATION_RANDOM);
+  gtk_files_path_bar_set_file (GTK_FILES_PATH_BAR (files_path_bar_random), file);
+  g_object_unref (file);
+  file = g_file_new_for_uri (REAL_LOCATION_RECENT);
+  gtk_files_path_bar_set_file (GTK_FILES_PATH_BAR (files_path_bar_recent), file);
+  g_object_unref (file);
+
+}
+
+int
+main (int argc, char *argv[])
+{
+  GtkWidget *window;
+  GtkWidget *grid;
+  GtkWidget *reset_button;
+  GtkWidget *label;
+  GFile *file = NULL;
+  GIcon *icon;
+
+  gtk_init (&argc, &argv);
+
+  window = g_object_connect (g_object_new (gtk_window_get_type (),
+                                           "type", GTK_WINDOW_TOPLEVEL,
+                                           "title", "Test path bar",
+                                           "resizable", TRUE,
+                                           "default-height", 200,
+                                           NULL),
+                             "signal::destroy", gtk_main_quit, NULL,
+                             NULL);
+
+  action_group = G_ACTION_GROUP (g_simple_action_group_new ());
+  g_action_map_add_action_entries (G_ACTION_MAP (action_group), entries,
+                                   G_N_ELEMENTS (entries), window);
+
+  gtk_widget_insert_action_group (window, "action_group", action_group);
+
+  grid = gtk_grid_new ();
+  g_type_ensure (GTK_TYPE_PATH_BAR);
+
+  label = gtk_label_new ("Generic GtkPathBar tests");
+  gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 2, 1);
+
+  /* ----------------------------------------------------------------------- */
+  path_bar = gtk_path_bar_new ();
+  gtk_grid_attach (GTK_GRID (grid), path_bar, 0, 1, 1, 1);
+  gtk_path_bar_set_path (GTK_PATH_BAR (path_bar), ORIGINAL_PATH);
+  connect_path_bar (GTK_PATH_BAR (path_bar));
+
+  /* ----------------------------------------------------------------------- */
+  path_bar_inverted = gtk_path_bar_new ();
+  gtk_path_bar_set_inverted (GTK_PATH_BAR (path_bar_inverted), TRUE);
+  gtk_path_bar_set_path (GTK_PATH_BAR (path_bar_inverted), ORIGINAL_PATH);
+  connect_path_bar (GTK_PATH_BAR (path_bar_inverted));
+  gtk_grid_attach (GTK_GRID (grid), path_bar_inverted, 0, 2, 1, 1);
+
+  label = gtk_label_new ("“/” a.k.a root, special case");
+  gtk_grid_attach (GTK_GRID (grid), label, 0, 3, 2, 1);
+
+  /* ----------------------------------------------------------------------- */
+  path_bar_slash = gtk_path_bar_new ();
+  gtk_path_bar_set_inverted (GTK_PATH_BAR (path_bar_slash), TRUE);
+  gtk_path_bar_set_path (GTK_PATH_BAR (path_bar_slash), "/");
+  connect_path_bar_set_path (GTK_PATH_BAR (path_bar_slash));
+  gtk_grid_attach (GTK_GRID (grid), path_bar_slash, 0, 4, 1, 1);
+
+  label = gtk_label_new ("GtkPathBar with special roots");
+  gtk_grid_attach (GTK_GRID (grid), label, 0, 5, 2, 1);
+
+  /* ----------------------------------------------------------------------- */
+  path_bar_custom_root_label = gtk_path_bar_new ();
+  gtk_path_bar_set_inverted (GTK_PATH_BAR (path_bar_custom_root_label), TRUE);
+  gtk_path_bar_set_path_extended (GTK_PATH_BAR (path_bar_custom_root_label),
+                                  ORIGINAL_PATH, ROOT_PATH, "This Is A Root", NULL);
+  connect_path_bar_set_path (GTK_PATH_BAR (path_bar_custom_root_label));
+  gtk_grid_attach (GTK_GRID (grid), path_bar_custom_root_label, 0, 6, 1, 1);
+
+  /* ----------------------------------------------------------------------- */
+  path_bar_custom_root_icon = gtk_path_bar_new ();
+  gtk_path_bar_set_inverted (GTK_PATH_BAR (path_bar_custom_root_icon), TRUE);
+  icon = g_themed_icon_new ("drive-harddisk");
+  gtk_path_bar_set_path_extended (GTK_PATH_BAR (path_bar_custom_root_icon),
+                                  ORIGINAL_PATH, "/", NULL, icon);
+  g_object_unref (icon);
+  connect_path_bar_set_path (GTK_PATH_BAR (path_bar_custom_root_icon));
+  gtk_grid_attach (GTK_GRID (grid), path_bar_custom_root_icon, 0, 7, 1, 1);
+
+  /* GtkFilesPathBar tests */
+  label = gtk_label_new ("GtkFilesPathBar tests");
+  gtk_grid_attach (GTK_GRID (grid), label, 0, 8, 2, 1);
+
+  /* ----------------------------------------------------------------------- */
+  files_path_bar_random = gtk_files_path_bar_new ();
+  file = g_file_new_for_uri (REAL_LOCATION_RANDOM);
+  gtk_files_path_bar_set_file (GTK_FILES_PATH_BAR (files_path_bar_random), file);
+  connect_files_path_bar (GTK_FILES_PATH_BAR (files_path_bar_random));
+  gtk_grid_attach (GTK_GRID (grid), files_path_bar_random, 0, 9, 1, 1);
+
+  g_clear_object (&file);
+
+  files_path_bar_recent = gtk_files_path_bar_new ();
+  file = g_file_new_for_uri (REAL_LOCATION_RECENT);
+  gtk_files_path_bar_set_file (GTK_FILES_PATH_BAR (files_path_bar_recent), file);
+  connect_files_path_bar (GTK_FILES_PATH_BAR (files_path_bar_recent));
+  gtk_grid_attach (GTK_GRID (grid), files_path_bar_recent, 0, 10, 1, 1);
+
+  g_clear_object (&file);
+
+  /* Reset button */
+  reset_button = gtk_button_new_with_label ("Reset State");
+  gtk_widget_set_hexpand (reset_button, TRUE);
+  g_signal_connect (GTK_BUTTON (reset_button), "clicked",
+                    G_CALLBACK (on_reset_button_clicked), window);
+  gtk_grid_attach (GTK_GRID (grid), reset_button, 0, 11, 2, 1);
+
+  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_widget_show_all (window);
+
+  gtk_main ();
+
+  return 0;
+}
diff --git a/tests/testpathbarcontainer.c b/tests/testpathbarcontainer.c
new file mode 100644
index 0000000..097839f
--- /dev/null
+++ b/tests/testpathbarcontainer.c
@@ -0,0 +1,149 @@
+#include "config.h"
+#include "glib.h"
+#include <gtk/gtk.h>
+
+#define N_BUTTONS 10
+
+static GtkWidget *path_bar_container;
+static char *lorem_ipsum = "Loremipsumdolorsitamet, consecteturadipisicingelit,";
+
+static char*
+get_lorem_ipsum ()
+{
+  static char **lorem_ipsum_split;
+  static int n_lorem_ipsum_words;
+
+  if (!lorem_ipsum_split)
+    {
+      lorem_ipsum_split = g_strsplit (lorem_ipsum, " ", -1);
+      n_lorem_ipsum_words = g_strv_length (lorem_ipsum_split);
+    }
+
+  return lorem_ipsum_split [g_random_int_range (0, n_lorem_ipsum_words)];
+}
+
+static void
+on_button_clicked (GtkWidget *button,
+                   gpointer   user_data)
+{
+
+#if 0
+  g_print ("button clicked\n");
+  gtk_container_remove (GTK_CONTAINER (user_data), button);
+#endif
+}
+
+static void
+on_reset_button_clicked (GtkButton *reset_button)
+{
+  GtkWidget *button;
+
+#if 0
+  gtk_container_foreach (GTK_CONTAINER (path_bar_container), (GtkCallback) gtk_widget_destroy, NULL);
+
+  for (int i = 0; i < N_BUTTONS; i++)
+    {
+      button = gtk_button_new_with_label (get_lorem_ipsum ());
+      g_signal_connect (button, "clicked", (GCallback) on_button_clicked, path_bar_container);
+      gtk_path_bar_container_add (GTK_PATH_BAR_CONTAINER (path_bar_container), button);
+    }
+
+  gtk_widget_show_all (path_bar_container);
+#endif
+}
+
+static void
+on_add_button (gint line)
+{
+  GtkWidget *button;
+
+  button = gtk_button_new_with_label (get_lorem_ipsum ());
+  gtk_widget_show (button);
+  g_signal_connect (button, "clicked", (GCallback) on_button_clicked, path_bar_container);
+  gtk_path_bar_container_add (GTK_PATH_BAR_CONTAINER (path_bar_container), button);
+}
+
+static void
+on_remove_button (gint line)
+{
+  GList *children;
+  GList *last;
+
+#if 0
+  children = gtk_container_get_children (path_bar_container);
+  last = g_list_last (children);
+  if (last)
+    gtk_container_remove (path_bar_container, GTK_WIDGET (last->data));
+#endif
+}
+
+static void
+on_invert_button (gint line)
+{
+  gtk_path_bar_container_set_inverted (GTK_PATH_BAR_CONTAINER (path_bar_container),
+                               !gtk_path_bar_container_get_inverted (GTK_PATH_BAR_CONTAINER 
(path_bar_container)));
+}
+
+int
+main (int argc, char *argv[])
+{
+  GtkWidget *window;
+  GtkWidget *grid;
+  GtkWidget *reset_button;
+  GtkWidget *add_button;
+  GtkWidget *remove_button;
+  GtkWidget *invert_button;
+  GtkWidget *label;
+
+  gtk_init (&argc, &argv);
+
+  window = g_object_connect (g_object_new (gtk_window_get_type (),
+                                           "type", GTK_WINDOW_TOPLEVEL,
+                                           "title", "Test path bar",
+                                           "resizable", TRUE,
+                                           "default-height", 200,
+                                           NULL),
+                             "signal::destroy", gtk_main_quit, NULL,
+                             NULL);
+
+  grid = gtk_grid_new ();
+  g_type_ensure (GTK_TYPE_PATH_BAR_CONTAINER);
+
+  label = gtk_label_new ("Generic GtkPathBar tests");
+  gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 2, 1);
+
+  /* ----------------------------------------------------------------------- */
+  path_bar_container = gtk_path_bar_container_new ();
+  gtk_grid_attach (GTK_GRID (grid), path_bar_container, 0, 1, 1, 1);
+  gtk_widget_show_all (path_bar_container);
+  /* Add/Remove buttons */
+  add_button = gtk_button_new_with_label ("Add");
+  gtk_widget_set_halign (add_button, GTK_ALIGN_END);
+  remove_button = gtk_button_new_with_label ("Remove");
+  gtk_widget_set_halign (remove_button, GTK_ALIGN_END);
+  gtk_grid_attach_next_to (GTK_GRID (grid), add_button, path_bar_container, GTK_POS_RIGHT, 1, 1);
+  g_signal_connect_swapped (add_button, "clicked", (GCallback) on_add_button, GINT_TO_POINTER (0));
+  gtk_grid_attach_next_to (GTK_GRID (grid), remove_button, add_button, GTK_POS_RIGHT, 1, 1);
+  g_signal_connect_swapped (remove_button, "clicked", (GCallback) on_remove_button, GINT_TO_POINTER (0));
+  gtk_widget_show (add_button);
+  gtk_widget_show (remove_button);
+  /* Inverted button */
+  invert_button = gtk_button_new_with_label ("Invert");
+  gtk_widget_set_halign (invert_button, GTK_ALIGN_END);
+  gtk_grid_attach_next_to (GTK_GRID (grid), invert_button, remove_button, GTK_POS_RIGHT, 1, 1);
+  g_signal_connect_swapped (invert_button, "clicked", (GCallback) on_invert_button, GINT_TO_POINTER (0));
+
+  /* Reset button */
+  reset_button = gtk_button_new_with_label ("Reset State");
+  gtk_widget_set_hexpand (reset_button, TRUE);
+  g_signal_connect (GTK_BUTTON (reset_button), "clicked",
+                    G_CALLBACK (on_reset_button_clicked), window);
+  gtk_grid_attach (GTK_GRID (grid), reset_button, 0, 11, 2, 1);
+
+  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_widget_show_all (window);
+
+  gtk_main ();
+
+  return 0;
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]