[gtk+/composite-templates-new: 28/30] GtkPathBar: Define children with a GtkBuilder template



commit 7e323859a9e4d3fa3bc3feff4cf729947c04c529
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Sat Mar 30 16:35:39 2013 +0900

    GtkPathBar: Define children with a GtkBuilder template

 gtk/Makefile.am       |    1 +
 gtk/gtk.gresource.xml |    1 +
 gtk/gtkpathbar.c      |  563 +++++++++++++++++++++++++------------------------
 gtk/gtkpathbar.h      |   35 +---
 gtk/gtkpathbar.ui     |   58 +++++
 gtk/tests/templates.c |    1 +
 po/POTFILES.in        |    1 +
 7 files changed, 349 insertions(+), 311 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 5565693..0133c14 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -1110,6 +1110,7 @@ COMPOSITE_TEMPLATES =                     \
        gtklockbutton.ui                \
        gtkmessagedialog.ui             \
        gtkpagesetupunixdialog.ui       \
+       gtkpathbar.ui                   \
        gtkprintunixdialog.ui           \
        gtkrecentchooserdefault.ui      \
        gtkscalebutton.ui               \
diff --git a/gtk/gtk.gresource.xml b/gtk/gtk.gresource.xml
index d2f26ea..29fcc61 100644
--- a/gtk/gtk.gresource.xml
+++ b/gtk/gtk.gresource.xml
@@ -26,6 +26,7 @@
     <file>gtklockbutton.ui</file>
     <file>gtkmessagedialog.ui</file>
     <file>gtkpagesetupunixdialog.ui</file>
+    <file>gtkpathbar.ui</file>
     <file>gtkprintunixdialog.ui</file>
     <file>gtkrecentchooserdefault.ui</file>
     <file>gtkscalebutton.ui</file>
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index b68be63..607e183 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -37,6 +37,38 @@
 #include "gtkwidgetpath.h"
 #include "gtkwidgetprivate.h"
 
+struct _GtkPathBarPrivate
+{
+  GtkFileSystem *file_system;
+  GFile *root_file;
+  GFile *home_file;
+  GFile *desktop_file;
+
+  GCancellable *get_info_cancellable;
+
+  GdkPixbuf *root_icon;
+  GdkPixbuf *home_icon;
+  GdkPixbuf *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;
+  gint icon_size;
+  gint16 slider_width;
+  gint16 spacing;
+  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;
+};
 
 enum {
   PATH_CLICKED,
@@ -138,75 +170,28 @@ static void
 on_slider_unmap (GtkWidget  *widget,
                 GtkPathBar *path_bar)
 {
-  if (path_bar->timer &&
-      ((widget == path_bar->up_slider_button && path_bar->scrolling_up) ||
-       (widget == path_bar->down_slider_button && path_bar->scrolling_down)))
+  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);
 }
 
-static GtkWidget *
-get_slider_button (GtkPathBar  *path_bar,
-                  GtkArrowType arrow_type)
-{
-  GtkWidget *button;
-  AtkObject *atk_obj;
-
-  button = gtk_button_new ();
-  atk_obj = gtk_widget_get_accessible (button);
-  if (arrow_type == GTK_ARROW_LEFT)
-    atk_object_set_name (atk_obj, _("Up Path"));
-  else
-    atk_object_set_name (atk_obj, _("Down Path"));
-
-  gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
-  gtk_widget_add_events (button, GDK_SCROLL_MASK);
-  gtk_container_add (GTK_CONTAINER (button),
-                     gtk_arrow_new (arrow_type, GTK_SHADOW_OUT));
-  gtk_container_add (GTK_CONTAINER (path_bar), button);
-  gtk_widget_show_all (button);
-
-  g_signal_connect (G_OBJECT (button), "unmap",
-                   G_CALLBACK (on_slider_unmap), path_bar);
-
-  return button;
-}
-
 static void
 gtk_path_bar_init (GtkPathBar *path_bar)
 {
-  GtkStyleContext *context;
+  path_bar->priv = G_TYPE_INSTANCE_GET_PRIVATE (path_bar,
+                                               GTK_TYPE_PATH_BAR,
+                                               GtkPathBarPrivate);
+
+  gtk_widget_init_template (GTK_WIDGET (path_bar));
 
   gtk_widget_set_has_window (GTK_WIDGET (path_bar), FALSE);
   gtk_widget_set_redraw_on_allocate (GTK_WIDGET (path_bar), FALSE);
 
-  path_bar->get_info_cancellable = NULL;
+  path_bar->priv->get_info_cancellable = NULL;
 
-  path_bar->spacing = 0;
-  path_bar->up_slider_button = get_slider_button (path_bar, GTK_ARROW_LEFT);
-  path_bar->down_slider_button = get_slider_button (path_bar, GTK_ARROW_RIGHT);
-  path_bar->icon_size = FALLBACK_ICON_SIZE;
-  
-  g_signal_connect_swapped (path_bar->up_slider_button, "clicked",
-                            G_CALLBACK (gtk_path_bar_scroll_up), path_bar);
-  g_signal_connect_swapped (path_bar->down_slider_button, "clicked",
-                            G_CALLBACK (gtk_path_bar_scroll_down), path_bar);
-
-  g_signal_connect (path_bar->up_slider_button, "focus-out-event",
-                    G_CALLBACK (gtk_path_bar_slider_up_defocus), path_bar);
-  g_signal_connect (path_bar->down_slider_button, "focus-out-event",
-                    G_CALLBACK (gtk_path_bar_slider_down_defocus), path_bar);
-
-  g_signal_connect (path_bar->up_slider_button, "button-press-event",
-                    G_CALLBACK (gtk_path_bar_slider_button_press), path_bar);
-  g_signal_connect (path_bar->up_slider_button, "button-release-event",
-                    G_CALLBACK (gtk_path_bar_slider_button_release), path_bar);
-  g_signal_connect (path_bar->down_slider_button, "button-press-event",
-                    G_CALLBACK (gtk_path_bar_slider_button_press), path_bar);
-  g_signal_connect (path_bar->down_slider_button, "button-release-event",
-                    G_CALLBACK (gtk_path_bar_slider_button_release), path_bar);
-
-  context = gtk_widget_get_style_context (GTK_WIDGET (path_bar));
-  gtk_style_context_add_class (context, GTK_STYLE_CLASS_LINKED);
+  path_bar->priv->spacing = 0;
+  path_bar->priv->icon_size = FALLBACK_ICON_SIZE;
 }
 
 static void
@@ -255,6 +240,24 @@ gtk_path_bar_class_init (GtkPathBarClass *path_bar_class)
                  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/gtkpathbar.ui");
+
+  gtk_widget_class_bind_child (widget_class, GtkPathBarPrivate, up_slider_button);
+  gtk_widget_class_bind_child (widget_class, GtkPathBarPrivate, down_slider_button);
+
+  gtk_widget_class_bind_callback (widget_class, gtk_path_bar_slider_button_press);
+  gtk_widget_class_bind_callback (widget_class, gtk_path_bar_slider_button_release);
+  gtk_widget_class_bind_callback (widget_class, gtk_path_bar_slider_up_defocus);
+  gtk_widget_class_bind_callback (widget_class, gtk_path_bar_slider_down_defocus);
+  gtk_widget_class_bind_callback (widget_class, gtk_path_bar_scroll_up);
+  gtk_widget_class_bind_callback (widget_class, gtk_path_bar_scroll_down);
+  gtk_widget_class_bind_callback (widget_class, on_slider_unmap);
+
+  g_type_class_add_private (gobject_class, sizeof (GtkPathBarPrivate));
 }
 
 
@@ -267,23 +270,23 @@ gtk_path_bar_finalize (GObject *object)
 
   gtk_path_bar_stop_scrolling (path_bar);
 
-  g_list_free (path_bar->button_list);
-  if (path_bar->root_file)
-    g_object_unref (path_bar->root_file);
-  if (path_bar->home_file)
-    g_object_unref (path_bar->home_file);
-  if (path_bar->desktop_file)
-    g_object_unref (path_bar->desktop_file);
+  g_list_free (path_bar->priv->button_list);
+  if (path_bar->priv->root_file)
+    g_object_unref (path_bar->priv->root_file);
+  if (path_bar->priv->home_file)
+    g_object_unref (path_bar->priv->home_file);
+  if (path_bar->priv->desktop_file)
+    g_object_unref (path_bar->priv->desktop_file);
 
-  if (path_bar->root_icon)
-    g_object_unref (path_bar->root_icon);
-  if (path_bar->home_icon)
-    g_object_unref (path_bar->home_icon);
-  if (path_bar->desktop_icon)
-    g_object_unref (path_bar->desktop_icon);
+  if (path_bar->priv->root_icon)
+    g_object_unref (path_bar->priv->root_icon);
+  if (path_bar->priv->home_icon)
+    g_object_unref (path_bar->priv->home_icon);
+  if (path_bar->priv->desktop_icon)
+    g_object_unref (path_bar->priv->desktop_icon);
 
-  if (path_bar->file_system)
-    g_object_unref (path_bar->file_system);
+  if (path_bar->priv->file_system)
+    g_object_unref (path_bar->priv->file_system);
 
   G_OBJECT_CLASS (gtk_path_bar_parent_class)->finalize (object);
 }
@@ -293,14 +296,14 @@ static void
 remove_settings_signal (GtkPathBar *path_bar,
                        GdkScreen  *screen)
 {
-  if (path_bar->settings_signal_id)
+  if (path_bar->priv->settings_signal_id)
     {
       GtkSettings *settings;
 
       settings = gtk_settings_get_for_screen (screen);
       g_signal_handler_disconnect (settings,
-                                  path_bar->settings_signal_id);
-      path_bar->settings_signal_id = 0;
+                                  path_bar->priv->settings_signal_id);
+      path_bar->priv->settings_signal_id = 0;
     }
 }
 
@@ -311,9 +314,9 @@ gtk_path_bar_dispose (GObject *object)
 
   remove_settings_signal (path_bar, gtk_widget_get_screen (GTK_WIDGET (object)));
 
-  if (path_bar->get_info_cancellable)
-    g_cancellable_cancel (path_bar->get_info_cancellable);
-  path_bar->get_info_cancellable = NULL;
+  if (path_bar->priv->get_info_cancellable)
+    g_cancellable_cancel (path_bar->priv->get_info_cancellable);
+  path_bar->priv->get_info_cancellable = NULL;
 
   G_OBJECT_CLASS (gtk_path_bar_parent_class)->dispose (object);
 }
@@ -340,7 +343,7 @@ gtk_path_bar_get_preferred_width (GtkWidget *widget,
   *minimum = *natural = 0;
   height = 0;
 
-  for (list = path_bar->button_list; list; list = list->next)
+  for (list = path_bar->priv->button_list; list; list = list->next)
     {
       button_data = BUTTON_DATA (list->data);
       gtk_widget_get_preferred_width (button_data->button, &child_min, &child_nat);
@@ -362,11 +365,11 @@ gtk_path_bar_get_preferred_width (GtkWidget *widget,
   /* Theoretically, the slider could be bigger than the other button.  But we're
    * not going to worry about that now.
    */
-  path_bar->slider_width = MIN (height * 2 / 3 + 5, height);
-  if (path_bar->button_list && path_bar->button_list->next != NULL)
+  path_bar->priv->slider_width = MIN (height * 2 / 3 + 5, height);
+  if (path_bar->priv->button_list && path_bar->priv->button_list->next != NULL)
     {
-      *minimum += (path_bar->spacing + path_bar->slider_width) * 2;
-      *natural += (path_bar->spacing + path_bar->slider_width) * 2;
+      *minimum += (path_bar->priv->spacing + path_bar->priv->slider_width) * 2;
+      *natural += (path_bar->priv->spacing + path_bar->priv->slider_width) * 2;
     }
 }
 
@@ -384,7 +387,7 @@ gtk_path_bar_get_preferred_height (GtkWidget *widget,
 
   *minimum = *natural = 0;
 
-  for (list = path_bar->button_list; list; list = list->next)
+  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);
@@ -397,34 +400,34 @@ gtk_path_bar_get_preferred_height (GtkWidget *widget,
 static void
 gtk_path_bar_update_slider_buttons (GtkPathBar *path_bar)
 {
-  if (path_bar->button_list)
+  if (path_bar->priv->button_list)
     {
       GtkWidget *button;
 
-      button = BUTTON_DATA (path_bar->button_list->data)->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->down_slider_button, FALSE);
+         gtk_widget_set_sensitive (path_bar->priv->down_slider_button, FALSE);
        }
       else
-       gtk_widget_set_sensitive (path_bar->down_slider_button, TRUE);
+       gtk_widget_set_sensitive (path_bar->priv->down_slider_button, TRUE);
 
-      button = BUTTON_DATA (g_list_last (path_bar->button_list)->data)->button;
+      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->up_slider_button, FALSE);
+         gtk_widget_set_sensitive (path_bar->priv->up_slider_button, FALSE);
        }
       else
-       gtk_widget_set_sensitive (path_bar->up_slider_button, TRUE);
+       gtk_widget_set_sensitive (path_bar->priv->up_slider_button, TRUE);
     }
 }
 
 static void
 gtk_path_bar_map (GtkWidget *widget)
 {
-  gdk_window_show (GTK_PATH_BAR (widget)->event_window);
+  gdk_window_show (GTK_PATH_BAR (widget)->priv->event_window);
 
   GTK_WIDGET_CLASS (gtk_path_bar_parent_class)->map (widget);
 }
@@ -433,7 +436,7 @@ static void
 gtk_path_bar_unmap (GtkWidget *widget)
 {
   gtk_path_bar_stop_scrolling (GTK_PATH_BAR (widget));
-  gdk_window_hide (GTK_PATH_BAR (widget)->event_window);
+  gdk_window_hide (GTK_PATH_BAR (widget)->priv->event_window);
 
   GTK_WIDGET_CLASS (gtk_path_bar_parent_class)->unmap (widget);
 }
@@ -466,9 +469,9 @@ gtk_path_bar_realize (GtkWidget *widget)
   attributes.event_mask |= GDK_SCROLL_MASK;
   attributes_mask = GDK_WA_X | GDK_WA_Y;
 
-  path_bar->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
+  path_bar->priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
                                            &attributes, attributes_mask);
-  gtk_widget_register_window (widget, path_bar->event_window);
+  gtk_widget_register_window (widget, path_bar->priv->event_window);
 }
 
 static void
@@ -478,9 +481,9 @@ gtk_path_bar_unrealize (GtkWidget *widget)
 
   path_bar = GTK_PATH_BAR (widget);
 
-  gtk_widget_unregister_window (widget, path_bar->event_window);
-  gdk_window_destroy (path_bar->event_window);
-  path_bar->event_window = NULL;
+  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);
 }
@@ -490,14 +493,14 @@ child_ordering_changed (GtkPathBar *path_bar)
 {
   GList *l;
 
-  if (path_bar->up_slider_button)
-    _gtk_widget_invalidate_style_context (path_bar->up_slider_button,
+  if (path_bar->priv->up_slider_button)
+    _gtk_widget_invalidate_style_context (path_bar->priv->up_slider_button,
                                           GTK_CSS_CHANGE_POSITION | GTK_CSS_CHANGE_SIBLING_POSITION);
-  if (path_bar->down_slider_button)
-    _gtk_widget_invalidate_style_context (path_bar->down_slider_button,
+  if (path_bar->priv->down_slider_button)
+    _gtk_widget_invalidate_style_context (path_bar->priv->down_slider_button,
                                           GTK_CSS_CHANGE_POSITION | GTK_CSS_CHANGE_SIBLING_POSITION);
 
-  for (l = path_bar->button_list; l; l = l->next)
+  for (l = path_bar->priv->button_list; l; l = l->next)
     {
       ButtonData *data = l->data;
 
@@ -527,50 +530,50 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
   gtk_widget_set_allocation (widget, allocation);
 
   if (gtk_widget_get_realized (widget))
-    gdk_window_move_resize (path_bar->event_window,
+    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->button_list == NULL)
+  if (path_bar->priv->button_list == NULL)
     return;
 
   direction = gtk_widget_get_direction (widget);
   allocation_width = allocation->width;
 
   /* First, we check to see if we need the scrollbars. */
-  if (path_bar->fake_root)
-    width = path_bar->spacing + path_bar->slider_width;
+  if (path_bar->priv->fake_root)
+    width = path_bar->priv->spacing + path_bar->priv->slider_width;
   else
     width = 0;
 
-  for (list = path_bar->button_list; list; list = list->next)
+  for (list = path_bar->priv->button_list; list; list = list->next)
     {
       child = BUTTON_DATA (list->data)->button;
 
       gtk_widget_get_preferred_size (child, &child_requisition, NULL);
 
-      width += child_requisition.width + path_bar->spacing;
-      if (list == path_bar->fake_root)
+      width += child_requisition.width + path_bar->priv->spacing;
+      if (list == path_bar->priv->fake_root)
        break;
     }
 
   if (width <= allocation_width)
     {
-      if (path_bar->fake_root)
-       first_button = path_bar->fake_root;
+      if (path_bar->priv->fake_root)
+       first_button = path_bar->priv->fake_root;
       else
-       first_button = g_list_last (path_bar->button_list);
+       first_button = g_list_last (path_bar->priv->button_list);
     }
   else
     {
       gboolean reached_end = FALSE;
-      gint slider_space = 2 * (path_bar->spacing + path_bar->slider_width);
+      gint slider_space = 2 * (path_bar->priv->spacing + path_bar->priv->slider_width);
 
-      if (path_bar->first_scrolled_button)
-       first_button = path_bar->first_scrolled_button;
+      if (path_bar->priv->first_scrolled_button)
+       first_button = path_bar->priv->first_scrolled_button;
       else
-       first_button = path_bar->button_list;
+       first_button = path_bar->priv->button_list;
       need_sliders = TRUE;
       
       /* To see how much space we have, and how many buttons we can display.
@@ -590,12 +593,12 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
           gtk_widget_get_preferred_size (child, &child_requisition, NULL);
 
          if (width + child_requisition.width +
-             path_bar->spacing + slider_space > allocation_width)
+             path_bar->priv->spacing + slider_space > allocation_width)
            reached_end = TRUE;
-         else if (list == path_bar->fake_root)
+         else if (list == path_bar->priv->fake_root)
            break;
          else
-           width += child_requisition.width + path_bar->spacing;
+           width += child_requisition.width + path_bar->priv->spacing;
 
          list = list->prev;
        }
@@ -608,14 +611,14 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
 
           gtk_widget_get_preferred_size (child, &child_requisition, NULL);
 
-         if (width + child_requisition.width + path_bar->spacing + slider_space > allocation_width)
+         if (width + child_requisition.width + path_bar->priv->spacing + slider_space > allocation_width)
            {
              reached_end = TRUE;
            }
          else
            {
-             width += child_requisition.width + path_bar->spacing;
-             if (first_button == path_bar->fake_root)
+             width += child_requisition.width + path_bar->priv->spacing;
+             if (first_button == path_bar->priv->fake_root)
                break;
              first_button = first_button->next;
            }
@@ -629,19 +632,19 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
   if (direction == GTK_TEXT_DIR_RTL)
     {
       child_allocation.x = allocation->x + allocation->width;
-      if (need_sliders || path_bar->fake_root)
+      if (need_sliders || path_bar->priv->fake_root)
        {
-         child_allocation.x -= (path_bar->spacing + path_bar->slider_width);
-         up_slider_offset = allocation->width - path_bar->slider_width;
+         child_allocation.x -= (path_bar->priv->spacing + 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->fake_root)
+      if (need_sliders || path_bar->priv->fake_root)
        {
          up_slider_offset = 0;
-         child_allocation.x += (path_bar->spacing + path_bar->slider_width);
+         child_allocation.x += (path_bar->priv->spacing + path_bar->priv->slider_width);
        }
     }
 
@@ -656,7 +659,7 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
       gtk_widget_get_preferred_size (child, &child_requisition, NULL);
 
       child_allocation.width = MIN (child_requisition.width,
-                                   allocation_width - (path_bar->spacing + path_bar->slider_width) * 2);
+                                   allocation_width - (path_bar->priv->spacing + 
path_bar->priv->slider_width) * 2);
 
       if (direction == GTK_TEXT_DIR_RTL)
        child_allocation.x -= child_allocation.width;
@@ -665,13 +668,13 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
       if (need_sliders && direction == GTK_TEXT_DIR_RTL)
        {
           gtk_widget_get_allocation (widget, &widget_allocation);
-         if (child_allocation.x - path_bar->spacing - path_bar->slider_width < widget_allocation.x)
+         if (child_allocation.x - path_bar->priv->spacing - 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->spacing + path_bar->slider_width >
+         if (child_allocation.x + child_allocation.width + path_bar->priv->spacing + 
path_bar->priv->slider_width >
              widget_allocation.x + allocation_width)
            break;
        }
@@ -689,9 +692,9 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
       gtk_widget_size_allocate (child, &child_allocation);
 
       if (direction == GTK_TEXT_DIR_RTL)
-       child_allocation.x -= path_bar->spacing;
+       child_allocation.x -= path_bar->priv->spacing;
       else
-       child_allocation.x += child_allocation.width + path_bar->spacing;
+       child_allocation.x += child_allocation.width + path_bar->priv->spacing;
     }
   /* Now we go hide all the widgets that don't fit */
   while (list)
@@ -708,44 +711,44 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
       gtk_widget_set_child_visible (child, FALSE);
     }
 
-  if (need_sliders || path_bar->fake_root)
+  if (need_sliders || path_bar->priv->fake_root)
     {
-      child_allocation.width = path_bar->slider_width;
+      child_allocation.width = path_bar->priv->slider_width;
       child_allocation.x = up_slider_offset + allocation->x;
-      gtk_widget_size_allocate (path_bar->up_slider_button, &child_allocation);
+      gtk_widget_size_allocate (path_bar->priv->up_slider_button, &child_allocation);
 
-      needs_reorder |= gtk_widget_get_child_visible (path_bar->up_slider_button) == FALSE;
-      gtk_widget_set_child_visible (path_bar->up_slider_button, TRUE);
-      gtk_widget_show_all (path_bar->up_slider_button);
+      needs_reorder |= gtk_widget_get_child_visible (path_bar->priv->up_slider_button) == FALSE;
+      gtk_widget_set_child_visible (path_bar->priv->up_slider_button, TRUE);
+      gtk_widget_show_all (path_bar->priv->up_slider_button);
     }
   else
     {
-      needs_reorder |= gtk_widget_get_child_visible (path_bar->up_slider_button) == TRUE;
-      gtk_widget_set_child_visible (path_bar->up_slider_button, FALSE);
+      needs_reorder |= gtk_widget_get_child_visible (path_bar->priv->up_slider_button) == TRUE;
+      gtk_widget_set_child_visible (path_bar->priv->up_slider_button, FALSE);
     }
       
   if (need_sliders)
     {
-      child_allocation.width = path_bar->slider_width;
+      child_allocation.width = path_bar->priv->slider_width;
 
       if (direction == GTK_TEXT_DIR_RTL)
        child_allocation.x = 0;
       else
-       child_allocation.x = allocation->width - path_bar->slider_width;
+       child_allocation.x = allocation->width - path_bar->priv->slider_width;
 
       child_allocation.x += allocation->x;
       
-      gtk_widget_size_allocate (path_bar->down_slider_button, &child_allocation);
+      gtk_widget_size_allocate (path_bar->priv->down_slider_button, &child_allocation);
 
-      needs_reorder |= gtk_widget_get_child_visible (path_bar->down_slider_button) == FALSE;
-      gtk_widget_set_child_visible (path_bar->down_slider_button, TRUE);
-      gtk_widget_show_all (path_bar->down_slider_button);
+      needs_reorder |= gtk_widget_get_child_visible (path_bar->priv->down_slider_button) == FALSE;
+      gtk_widget_set_child_visible (path_bar->priv->down_slider_button, TRUE);
+      gtk_widget_show_all (path_bar->priv->down_slider_button);
       gtk_path_bar_update_slider_buttons (path_bar);
     }
   else
     {
-      needs_reorder |= gtk_widget_get_child_visible (path_bar->down_slider_button) == TRUE;
-      gtk_widget_set_child_visible (path_bar->down_slider_button, FALSE);
+      needs_reorder |= gtk_widget_get_child_visible (path_bar->priv->down_slider_button) == TRUE;
+      gtk_widget_set_child_visible (path_bar->priv->down_slider_button, FALSE);
     }
 
   if (needs_reorder)
@@ -822,27 +825,27 @@ gtk_path_bar_remove (GtkContainer *container,
 
   path_bar = GTK_PATH_BAR (container);
 
-  if (widget == path_bar->up_slider_button)
+  if (widget == path_bar->priv->up_slider_button)
     {
       gtk_path_bar_remove_1 (container, widget);
-      path_bar->up_slider_button = NULL;
+      path_bar->priv->up_slider_button = NULL;
       return;
     }
 
-  if (widget == path_bar->down_slider_button)
+  if (widget == path_bar->priv->down_slider_button)
     {
       gtk_path_bar_remove_1 (container, widget);
-      path_bar->down_slider_button = NULL;
+      path_bar->priv->down_slider_button = NULL;
       return;
     }
 
-  children = path_bar->button_list;
+  children = path_bar->priv->button_list;
   while (children)
     {
       if (widget == BUTTON_DATA (children->data)->button)
        {
          gtk_path_bar_remove_1 (container, widget);
-         path_bar->button_list = g_list_remove_link (path_bar->button_list, children);
+         path_bar->priv->button_list = g_list_remove_link (path_bar->priv->button_list, children);
          g_list_free (children);
          return;
        }
@@ -863,7 +866,7 @@ gtk_path_bar_forall (GtkContainer *container,
   g_return_if_fail (callback != NULL);
   path_bar = GTK_PATH_BAR (container);
 
-  children = path_bar->button_list;
+  children = path_bar->priv->button_list;
   while (children)
     {
       GtkWidget *child;
@@ -873,11 +876,11 @@ gtk_path_bar_forall (GtkContainer *container,
       (* callback) (child, callback_data);
     }
 
-  if (path_bar->up_slider_button)
-    (* callback) (path_bar->up_slider_button, callback_data);
+  if (path_bar->priv->up_slider_button)
+    (* callback) (path_bar->priv->up_slider_button, callback_data);
 
-  if (path_bar->down_slider_button)
-    (* callback) (path_bar->down_slider_button, callback_data);
+  if (path_bar->priv->down_slider_button)
+    (* callback) (path_bar->priv->down_slider_button, callback_data);
 }
 
 static GtkWidgetPath *
@@ -904,11 +907,11 @@ gtk_path_bar_get_path_for_child (GtkContainer *container,
 
       visible_children = NULL;
 
-      if (gtk_widget_get_visible (path_bar->down_slider_button) &&
-          gtk_widget_get_child_visible (path_bar->down_slider_button))
-        visible_children = g_list_prepend (visible_children, path_bar->down_slider_button);
+      if (gtk_widget_get_visible (path_bar->priv->down_slider_button) &&
+          gtk_widget_get_child_visible (path_bar->priv->down_slider_button))
+        visible_children = g_list_prepend (visible_children, path_bar->priv->down_slider_button);
 
-      for (l = path_bar->button_list; l; l = l->next)
+      for (l = path_bar->priv->button_list; l; l = l->next)
         {
           ButtonData *data = l->data;
 
@@ -917,9 +920,9 @@ gtk_path_bar_get_path_for_child (GtkContainer *container,
             visible_children = g_list_prepend (visible_children, data->button);
         }
 
-      if (gtk_widget_get_visible (path_bar->up_slider_button) &&
-          gtk_widget_get_child_visible (path_bar->up_slider_button))
-        visible_children = g_list_prepend (visible_children, path_bar->up_slider_button);
+      if (gtk_widget_get_visible (path_bar->priv->up_slider_button) &&
+          gtk_widget_get_child_visible (path_bar->priv->up_slider_button))
+        visible_children = g_list_prepend (visible_children, path_bar->priv->up_slider_button);
 
       if (gtk_widget_get_direction (GTK_WIDGET (path_bar)) == GTK_TEXT_DIR_RTL)
         visible_children = g_list_reverse (visible_children);
@@ -964,13 +967,13 @@ gtk_path_bar_scroll_down (GtkPathBar *path_bar)
   GList *down_button = NULL;
   gint space_available;
 
-  if (path_bar->ignore_click)
+  if (path_bar->priv->ignore_click)
     {
-      path_bar->ignore_click = FALSE;
+      path_bar->priv->ignore_click = FALSE;
       return;   
     }
 
-  if (gtk_widget_get_child_visible (BUTTON_DATA (path_bar->button_list->data)->button))
+  if (gtk_widget_get_child_visible (BUTTON_DATA (path_bar->priv->button_list->data)->button))
     {
       /* Return if the last button is already visible */
       return;
@@ -980,7 +983,7 @@ gtk_path_bar_scroll_down (GtkPathBar *path_bar)
 
   /* We find the button at the 'down' end that we have to make
    * visible */
-  for (list = path_bar->button_list; list; list = list->next)
+  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))
        {
@@ -993,21 +996,21 @@ gtk_path_bar_scroll_down (GtkPathBar *path_bar)
   gtk_widget_get_allocation (BUTTON_DATA (down_button->data)->button, &button_allocation);
 
   space_available = (allocation.width
-                    - 2 * path_bar->spacing - 2 * path_bar->slider_width
+                    - 2 * path_bar->priv->spacing - 2 * path_bar->priv->slider_width
                      - button_allocation.width);
-  path_bar->first_scrolled_button = down_button;
+  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->first_scrolled_button = down_button;
+      path_bar->priv->first_scrolled_button = down_button;
       down_button = down_button->next;
       if (!down_button)
        break;
       space_available -= (button_allocation.width
-                         + path_bar->spacing);
+                         + path_bar->priv->spacing);
     }
 }
 
@@ -1016,13 +1019,13 @@ gtk_path_bar_scroll_up (GtkPathBar *path_bar)
 {
   GList *list;
 
-  if (path_bar->ignore_click)
+  if (path_bar->priv->ignore_click)
     {
-      path_bar->ignore_click = FALSE;
+      path_bar->priv->ignore_click = FALSE;
       return;   
     }
 
-  list = g_list_last (path_bar->button_list);
+  list = g_list_last (path_bar->priv->button_list);
 
   if (gtk_widget_get_child_visible (BUTTON_DATA (list->data)->button))
     {
@@ -1036,9 +1039,9 @@ gtk_path_bar_scroll_up (GtkPathBar *path_bar)
     {
       if (list->prev && gtk_widget_get_child_visible (BUTTON_DATA (list->prev->data)->button))
        {
-         if (list->prev == path_bar->fake_root)
-           path_bar->fake_root = NULL;
-         path_bar->first_scrolled_button = list;
+         if (list->prev == path_bar->priv->fake_root)
+           path_bar->priv->fake_root = NULL;
+         path_bar->priv->first_scrolled_button = list;
          return;
        }
     }
@@ -1049,23 +1052,23 @@ gtk_path_bar_scroll_timeout (GtkPathBar *path_bar)
 {
   gboolean retval = FALSE;
 
-  if (path_bar->timer)
+  if (path_bar->priv->timer)
     {
-      if (path_bar->scrolling_up)
+      if (path_bar->priv->scrolling_up)
        gtk_path_bar_scroll_up (path_bar);
-      else if (path_bar->scrolling_down)
+      else if (path_bar->priv->scrolling_down)
        gtk_path_bar_scroll_down (path_bar);
 
-      if (path_bar->need_timer) 
+      if (path_bar->priv->need_timer) 
        {
           GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (path_bar));
           guint        timeout;
 
           g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
 
-         path_bar->need_timer = FALSE;
+         path_bar->priv->need_timer = FALSE;
 
-         path_bar->timer = gdk_threads_add_timeout (timeout * SCROLL_DELAY_FACTOR,
+         path_bar->priv->timer = gdk_threads_add_timeout (timeout * SCROLL_DELAY_FACTOR,
                                           (GSourceFunc)gtk_path_bar_scroll_timeout,
                                           path_bar);
        }
@@ -1079,11 +1082,11 @@ gtk_path_bar_scroll_timeout (GtkPathBar *path_bar)
 static void 
 gtk_path_bar_stop_scrolling (GtkPathBar *path_bar)
 {
-  if (path_bar->timer)
+  if (path_bar->priv->timer)
     {
-      g_source_remove (path_bar->timer);
-      path_bar->timer = 0;
-      path_bar->need_timer = FALSE;
+      g_source_remove (path_bar->priv->timer);
+      path_bar->priv->timer = 0;
+      path_bar->priv->need_timer = FALSE;
     }
 }
 
@@ -1098,7 +1101,7 @@ gtk_path_bar_slider_up_defocus (GtkWidget      *widget,
   if (event->type != GDK_FOCUS_CHANGE)
     return FALSE;
 
-  for (list = g_list_last (path_bar->button_list); list; list = list->prev)
+  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))
         {
@@ -1108,8 +1111,8 @@ gtk_path_bar_slider_up_defocus (GtkWidget      *widget,
     }
 
   /* don't let the focus vanish */
-  if ((!gtk_widget_is_sensitive (path_bar->up_slider_button)) ||
-      (!gtk_widget_get_child_visible (path_bar->up_slider_button)))
+  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;
@@ -1126,7 +1129,7 @@ gtk_path_bar_slider_down_defocus (GtkWidget      *widget,
   if (event->type != GDK_FOCUS_CHANGE)
     return FALSE;
 
-  for (list = path_bar->button_list; list; list = list->next)
+  for (list = path_bar->priv->button_list; list; list = list->next)
     {
       if (gtk_widget_get_child_visible (BUTTON_DATA (list->data)->button))
         {
@@ -1136,8 +1139,8 @@ gtk_path_bar_slider_down_defocus (GtkWidget      *widget,
     }
 
   /* don't let the focus vanish */
-  if ((!gtk_widget_is_sensitive (path_bar->down_slider_button)) ||
-      (!gtk_widget_get_child_visible (path_bar->down_slider_button)))
+  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;
@@ -1151,30 +1154,30 @@ gtk_path_bar_slider_button_press (GtkWidget      *widget,
   if (event->type != GDK_BUTTON_PRESS || event->button != GDK_BUTTON_PRIMARY)
     return FALSE;
 
-  path_bar->ignore_click = FALSE;
+  path_bar->priv->ignore_click = FALSE;
 
-  if (widget == path_bar->up_slider_button)
+  if (widget == path_bar->priv->up_slider_button)
     {
-      path_bar->scrolling_down = FALSE;
-      path_bar->scrolling_up = TRUE;
+      path_bar->priv->scrolling_down = FALSE;
+      path_bar->priv->scrolling_up = TRUE;
       gtk_path_bar_scroll_up (path_bar);
     }
-  else if (widget == path_bar->down_slider_button)
+  else if (widget == path_bar->priv->down_slider_button)
     {
-      path_bar->scrolling_up = FALSE;
-      path_bar->scrolling_down = TRUE;
+      path_bar->priv->scrolling_up = FALSE;
+      path_bar->priv->scrolling_down = TRUE;
       gtk_path_bar_scroll_down (path_bar);
     }
 
-  if (!path_bar->timer)
+  if (!path_bar->priv->timer)
     {
       GtkSettings *settings = gtk_widget_get_settings (widget);
       guint        timeout;
 
       g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
 
-      path_bar->need_timer = TRUE;
-      path_bar->timer = gdk_threads_add_timeout (timeout,
+      path_bar->priv->need_timer = TRUE;
+      path_bar->priv->timer = gdk_threads_add_timeout (timeout,
                                       (GSourceFunc)gtk_path_bar_scroll_timeout,
                                       path_bar);
     }
@@ -1190,7 +1193,7 @@ gtk_path_bar_slider_button_release (GtkWidget      *widget,
   if (event->type != GDK_BUTTON_RELEASE)
     return FALSE;
 
-  path_bar->ignore_click = TRUE;
+  path_bar->priv->ignore_click = TRUE;
   gtk_path_bar_stop_scrolling (path_bar);
 
   return FALSE;
@@ -1219,23 +1222,23 @@ reload_icons (GtkPathBar *path_bar)
 {
   GList *list;
 
-  if (path_bar->root_icon)
+  if (path_bar->priv->root_icon)
     {
-      g_object_unref (path_bar->root_icon);
-      path_bar->root_icon = NULL;
+      g_object_unref (path_bar->priv->root_icon);
+      path_bar->priv->root_icon = NULL;
     }
-  if (path_bar->home_icon)
+  if (path_bar->priv->home_icon)
     {
-      g_object_unref (path_bar->home_icon);
-      path_bar->home_icon = NULL;
+      g_object_unref (path_bar->priv->home_icon);
+      path_bar->priv->home_icon = NULL;
     }
-  if (path_bar->desktop_icon)
+  if (path_bar->priv->desktop_icon)
     {
-      g_object_unref (path_bar->desktop_icon);
-      path_bar->desktop_icon = NULL;
+      g_object_unref (path_bar->priv->desktop_icon);
+      path_bar->priv->desktop_icon = NULL;
     }
 
-  for (list = path_bar->button_list; list; list = list->next)
+  for (list = path_bar->priv->button_list; list; list = list->next)
     {
       ButtonData *button_data;
       gboolean current_dir;
@@ -1259,9 +1262,9 @@ change_icon_theme (GtkPathBar *path_bar)
   settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (path_bar)));
 
   if (gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU, &width, &height))
-    path_bar->icon_size = MAX (width, height);
+    path_bar->priv->icon_size = MAX (width, height);
   else
-    path_bar->icon_size = FALLBACK_ICON_SIZE;
+    path_bar->priv->icon_size = FALLBACK_ICON_SIZE;
 
   reload_icons (path_bar);
 }
@@ -1285,11 +1288,11 @@ gtk_path_bar_check_icon_theme (GtkPathBar *path_bar)
 {
   GtkSettings *settings;
 
-  if (path_bar->settings_signal_id)
+  if (path_bar->priv->settings_signal_id)
     return;
 
   settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (path_bar)));
-  path_bar->settings_signal_id = g_signal_connect (settings, "notify", G_CALLBACK (settings_notify_cb), 
path_bar);
+  path_bar->priv->settings_signal_id = g_signal_connect (settings, "notify", G_CALLBACK 
(settings_notify_cb), path_bar);
 
   change_icon_theme (path_bar);
 }
@@ -1298,12 +1301,12 @@ gtk_path_bar_check_icon_theme (GtkPathBar *path_bar)
 static void
 gtk_path_bar_clear_buttons (GtkPathBar *path_bar)
 {
-  while (path_bar->button_list != NULL)
+  while (path_bar->priv->button_list != NULL)
     {
-      gtk_container_remove (GTK_CONTAINER (path_bar), BUTTON_DATA (path_bar->button_list->data)->button);
+      gtk_container_remove (GTK_CONTAINER (path_bar), BUTTON_DATA 
(path_bar->priv->button_list->data)->button);
     }
-  path_bar->first_scrolled_button = NULL;
-  path_bar->fake_root = NULL;
+  path_bar->priv->first_scrolled_button = NULL;
+  path_bar->priv->fake_root = NULL;
 }
 
 static void
@@ -1322,7 +1325,7 @@ button_clicked_cb (GtkWidget *button,
 
   path_bar = GTK_PATH_BAR (gtk_widget_get_parent (button));
 
-  button_list = g_list_find (path_bar->button_list, button_data);
+  button_list = g_list_find (path_bar->priv->button_list, button_data);
   g_assert (button_list != NULL);
 
   g_signal_handlers_block_by_func (button,
@@ -1380,23 +1383,23 @@ set_button_image_get_info_cb (GCancellable *cancellable,
     goto out;
 
   pixbuf = _gtk_file_info_render_icon (info, GTK_WIDGET (data->path_bar),
-                                      data->path_bar->icon_size);
+                                      data->path_bar->priv->icon_size);
   gtk_image_set_from_pixbuf (GTK_IMAGE (data->button_data->image), pixbuf);
 
   switch (data->button_data->type)
     {
       case HOME_BUTTON:
-       if (data->path_bar->home_icon)
+       if (data->path_bar->priv->home_icon)
          g_object_unref (pixbuf);
        else
-         data->path_bar->home_icon = pixbuf;
+         data->path_bar->priv->home_icon = pixbuf;
        break;
 
       case DESKTOP_BUTTON:
-       if (data->path_bar->desktop_icon)
+       if (data->path_bar->priv->desktop_icon)
          g_object_unref (pixbuf);
        else
-         data->path_bar->desktop_icon = pixbuf;
+         data->path_bar->priv->desktop_icon = pixbuf;
        break;
 
       default:
@@ -1419,29 +1422,29 @@ set_button_image (GtkPathBar *path_bar,
     {
     case ROOT_BUTTON:
 
-      if (path_bar->root_icon != NULL)
+      if (path_bar->priv->root_icon != NULL)
         {
-          gtk_image_set_from_pixbuf (GTK_IMAGE (button_data->image), path_bar->root_icon);
+          gtk_image_set_from_pixbuf (GTK_IMAGE (button_data->image), path_bar->priv->root_icon);
          break;
        }
 
-      volume = _gtk_file_system_get_volume_for_file (path_bar->file_system, path_bar->root_file);
+      volume = _gtk_file_system_get_volume_for_file (path_bar->priv->file_system, path_bar->priv->root_file);
       if (volume == NULL)
        return;
 
-      path_bar->root_icon = _gtk_file_system_volume_render_icon (volume,
+      path_bar->priv->root_icon = _gtk_file_system_volume_render_icon (volume,
                                                                 GTK_WIDGET (path_bar),
-                                                                path_bar->icon_size,
+                                                                path_bar->priv->icon_size,
                                                                 NULL);
       _gtk_file_system_volume_unref (volume);
 
-      gtk_image_set_from_pixbuf (GTK_IMAGE (button_data->image), path_bar->root_icon);
+      gtk_image_set_from_pixbuf (GTK_IMAGE (button_data->image), path_bar->priv->root_icon);
       break;
 
     case HOME_BUTTON:
-      if (path_bar->home_icon != NULL)
+      if (path_bar->priv->home_icon != NULL)
         {
-         gtk_image_set_from_pixbuf (GTK_IMAGE (button_data->image), path_bar->home_icon);
+         gtk_image_set_from_pixbuf (GTK_IMAGE (button_data->image), path_bar->priv->home_icon);
          break;
        }
 
@@ -1453,17 +1456,17 @@ set_button_image (GtkPathBar *path_bar,
        g_cancellable_cancel (button_data->cancellable);
 
       button_data->cancellable =
-        _gtk_file_system_get_info (path_bar->file_system,
-                                  path_bar->home_file,
+        _gtk_file_system_get_info (path_bar->priv->file_system,
+                                  path_bar->priv->home_file,
                                   "standard::icon",
                                   set_button_image_get_info_cb,
                                   data);
       break;
 
     case DESKTOP_BUTTON:
-      if (path_bar->desktop_icon != NULL)
+      if (path_bar->priv->desktop_icon != NULL)
         {
-         gtk_image_set_from_pixbuf (GTK_IMAGE (button_data->image), path_bar->desktop_icon);
+         gtk_image_set_from_pixbuf (GTK_IMAGE (button_data->image), path_bar->priv->desktop_icon);
          break;
        }
 
@@ -1475,8 +1478,8 @@ set_button_image (GtkPathBar *path_bar,
        g_cancellable_cancel (button_data->cancellable);
 
       button_data->cancellable =
-        _gtk_file_system_get_info (path_bar->file_system,
-                                  path_bar->desktop_file,
+        _gtk_file_system_get_info (path_bar->priv->file_system,
+                                  path_bar->priv->desktop_file,
                                   "standard::icon",
                                   set_button_image_get_info_cb,
                                   data);
@@ -1576,14 +1579,14 @@ static ButtonType
 find_button_type (GtkPathBar  *path_bar,
                  GFile       *file)
 {
-  if (path_bar->root_file != NULL &&
-      g_file_equal (file, path_bar->root_file))
+  if (path_bar->priv->root_file != NULL &&
+      g_file_equal (file, path_bar->priv->root_file))
     return ROOT_BUTTON;
-  if (path_bar->home_file != NULL &&
-      g_file_equal (file, path_bar->home_file))
+  if (path_bar->priv->home_file != NULL &&
+      g_file_equal (file, path_bar->priv->home_file))
     return HOME_BUTTON;
-  if (path_bar->desktop_file != NULL &&
-      g_file_equal (file, path_bar->desktop_file))
+  if (path_bar->priv->desktop_file != NULL &&
+      g_file_equal (file, path_bar->priv->desktop_file))
     return DESKTOP_BUTTON;
 
  return NORMAL_BUTTON;
@@ -1696,7 +1699,7 @@ gtk_path_bar_check_parent_path (GtkPathBar         *path_bar,
   GList *current_path = NULL;
   gboolean need_new_fake_root = FALSE;
 
-  for (list = path_bar->button_list; list; list = list->next)
+  for (list = path_bar->priv->button_list; list; list = list->next)
     {
       ButtonData *button_data;
 
@@ -1706,7 +1709,7 @@ gtk_path_bar_check_parent_path (GtkPathBar         *path_bar,
          current_path = list;
          break;
        }
-      if (list == path_bar->fake_root)
+      if (list == path_bar->priv->fake_root)
        need_new_fake_root = TRUE;
     }
 
@@ -1714,7 +1717,7 @@ gtk_path_bar_check_parent_path (GtkPathBar         *path_bar,
     {
       if (need_new_fake_root)
        {
-         path_bar->fake_root = NULL;
+         path_bar->priv->fake_root = NULL;
          for (list = current_path; list; list = list->next)
            {
              ButtonData *button_data;
@@ -1722,13 +1725,13 @@ gtk_path_bar_check_parent_path (GtkPathBar         *path_bar,
              button_data = list->data;
              if (BUTTON_IS_FAKE_ROOT (button_data))
                {
-                 path_bar->fake_root = list;
+                 path_bar->priv->fake_root = list;
                  break;
                }
            }
        }
 
-      for (list = path_bar->button_list; list; list = list->next)
+      for (list = path_bar->priv->button_list; list; list = list->next)
        {
          gtk_path_bar_update_button_appearance (path_bar,
                                                 BUTTON_DATA (list->data),
@@ -1737,7 +1740,7 @@ gtk_path_bar_check_parent_path (GtkPathBar         *path_bar,
 
       if (!gtk_widget_get_child_visible (BUTTON_DATA (current_path->data)->button))
        {
-         path_bar->first_scrolled_button = current_path;
+         path_bar->priv->first_scrolled_button = current_path;
          gtk_widget_queue_resize (GTK_WIDGET (path_bar));
        }
 
@@ -1766,10 +1769,10 @@ gtk_path_bar_set_file_finish (struct SetFileInfo *info,
       GList *l;
 
       gtk_path_bar_clear_buttons (info->path_bar);
-      info->path_bar->button_list = g_list_reverse (info->new_buttons);
-      info->path_bar->fake_root = info->fake_root;
+      info->path_bar->priv->button_list = g_list_reverse (info->new_buttons);
+      info->path_bar->priv->fake_root = info->fake_root;
 
-      for (l = info->path_bar->button_list; l; l = l->next)
+      for (l = info->path_bar->priv->button_list; l; l = l->next)
        {
          GtkWidget *button = BUTTON_DATA (l->data)->button;
          gtk_container_add (GTK_CONTAINER (info->path_bar), button);
@@ -1812,7 +1815,7 @@ gtk_path_bar_get_info_callback (GCancellable *cancellable,
   const gchar *display_name;
   gboolean is_hidden;
 
-  if (cancellable != file_info->path_bar->get_info_cancellable)
+  if (cancellable != file_info->path_bar->priv->get_info_cancellable)
     {
       gtk_path_bar_set_file_finish (file_info, FALSE);
       g_object_unref (cancellable);
@@ -1820,7 +1823,7 @@ gtk_path_bar_get_info_callback (GCancellable *cancellable,
     }
 
   g_object_unref (cancellable);
-  file_info->path_bar->get_info_cancellable = NULL;
+  file_info->path_bar->priv->get_info_cancellable = NULL;
 
   if (cancelled || !info)
     {
@@ -1858,8 +1861,8 @@ gtk_path_bar_get_info_callback (GCancellable *cancellable,
   file_info->parent_file = g_file_get_parent (file_info->file);
 
   /* Recurse asynchronously */
-  file_info->path_bar->get_info_cancellable =
-    _gtk_file_system_get_info (file_info->path_bar->file_system,
+  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,
@@ -1888,11 +1891,11 @@ _gtk_path_bar_set_file (GtkPathBar      *path_bar,
   info->first_directory = TRUE;
   info->parent_file = g_file_get_parent (info->file);
 
-  if (path_bar->get_info_cancellable)
-    g_cancellable_cancel (path_bar->get_info_cancellable);
+  if (path_bar->priv->get_info_cancellable)
+    g_cancellable_cancel (path_bar->priv->get_info_cancellable);
 
-  path_bar->get_info_cancellable =
-    _gtk_file_system_get_info (path_bar->file_system,
+  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,
@@ -1908,31 +1911,31 @@ _gtk_path_bar_set_file_system (GtkPathBar    *path_bar,
 
   g_return_if_fail (GTK_IS_PATH_BAR (path_bar));
 
-  g_assert (path_bar->file_system == NULL);
+  g_assert (path_bar->priv->file_system == NULL);
 
-  path_bar->file_system = g_object_ref (file_system);
+  path_bar->priv->file_system = g_object_ref (file_system);
 
   home = g_get_home_dir ();
   if (home != NULL)
     {
       const gchar *desktop;
 
-      path_bar->home_file = g_file_new_for_path (home);
+      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->desktop_file = g_file_new_for_path (desktop);
+        path_bar->priv->desktop_file = g_file_new_for_path (desktop);
       else 
-        path_bar->desktop_file = NULL;
+        path_bar->priv->desktop_file = NULL;
     }
   else
     {
-      path_bar->home_file = NULL;
-      path_bar->desktop_file = NULL;
+      path_bar->priv->home_file = NULL;
+      path_bar->priv->desktop_file = NULL;
     }
-  path_bar->root_file = g_file_new_for_path ("/");
+  path_bar->priv->root_file = g_file_new_for_path ("/");
 }
 
 /**
@@ -1947,7 +1950,7 @@ _gtk_path_bar_up (GtkPathBar *path_bar)
 {
   GList *l;
 
-  for (l = path_bar->button_list; l; l = l->next)
+  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)))
@@ -1974,7 +1977,7 @@ _gtk_path_bar_down (GtkPathBar *path_bar)
 {
   GList *l;
 
-  for (l = path_bar->button_list; l; l = l->next)
+  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)))
diff --git a/gtk/gtkpathbar.h b/gtk/gtkpathbar.h
index 12e3d34..bcaad75 100644
--- a/gtk/gtkpathbar.h
+++ b/gtk/gtkpathbar.h
@@ -23,8 +23,9 @@
 
 G_BEGIN_DECLS
 
-typedef struct _GtkPathBar      GtkPathBar;
-typedef struct _GtkPathBarClass GtkPathBarClass;
+typedef struct _GtkPathBar        GtkPathBar;
+typedef struct _GtkPathBarClass   GtkPathBarClass;
+typedef struct _GtkPathBarPrivate GtkPathBarPrivate;
 
 
 #define GTK_TYPE_PATH_BAR                 (gtk_path_bar_get_type ())
@@ -38,35 +39,7 @@ struct _GtkPathBar
 {
   GtkContainer parent;
 
-  GtkFileSystem *file_system;
-  GFile *root_file;
-  GFile *home_file;
-  GFile *desktop_file;
-
-  GCancellable *get_info_cancellable;
-
-  GdkPixbuf *root_icon;
-  GdkPixbuf *home_icon;
-  GdkPixbuf *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;
-  gint icon_size;
-  gint16 slider_width;
-  gint16 spacing;
-  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;
+  GtkPathBarPrivate *priv;
 };
 
 struct _GtkPathBarClass
diff --git a/gtk/gtkpathbar.ui b/gtk/gtkpathbar.ui
new file mode 100644
index 0000000..c717806
--- /dev/null
+++ b/gtk/gtkpathbar.ui
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface domain="gtk30">
+  <!-- interface-requires gtk+ 3.10 -->
+  <template class="GtkPathBar" parent="GtkBox">
+    <style>
+      <class name="linked"/>
+    </style>
+    <child>
+      <object class="GtkButton" id="up_slider_button">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">True</property>
+        <property name="focus_on_click">False</property>
+        <child internal-child="accessible">
+          <object class="AtkObject" id="up_slider_button-atkobject">
+            <property name="AtkObject::accessible-name" translatable="yes">Up Path</property>
+          </object>
+        </child>
+        <signal name="button-press-event" handler="gtk_path_bar_slider_button_press" swapped="no"/>
+        <signal name="unmap" handler="on_slider_unmap" swapped="no"/>
+        <signal name="button-release-event" handler="gtk_path_bar_slider_button_release" swapped="no"/>
+        <signal name="focus-out-event" handler="gtk_path_bar_slider_up_defocus" swapped="no"/>
+        <signal name="clicked" handler="gtk_path_bar_scroll_up" swapped="yes"/>
+        <child>
+          <object class="GtkArrow" id="arrow1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="arrow_type">left</property>
+          </object>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkButton" id="down_slider_button">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">True</property>
+        <property name="focus_on_click">False</property>
+        <child internal-child="accessible">
+          <object class="AtkObject" id="down_slider_button-atkobject">
+            <property name="AtkObject::accessible-name" translatable="yes">Down Path</property>
+          </object>
+        </child>
+        <signal name="button-press-event" handler="gtk_path_bar_slider_button_press" swapped="no"/>
+        <signal name="unmap" handler="on_slider_unmap" swapped="no"/>
+        <signal name="button-release-event" handler="gtk_path_bar_slider_button_release" swapped="no"/>
+        <signal name="focus-out-event" handler="gtk_path_bar_slider_down_defocus" swapped="no"/>
+        <signal name="clicked" handler="gtk_path_bar_scroll_down" swapped="yes"/>
+        <child>
+          <object class="GtkArrow" id="arrow2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/gtk/tests/templates.c b/gtk/tests/templates.c
index e7adca3..834d183 100644
--- a/gtk/tests/templates.c
+++ b/gtk/tests/templates.c
@@ -190,6 +190,7 @@ test_file_chooser_widget_basic (void)
 {
   GtkWidget *widget;
 
+  /* This test also tests the internal GtkPathBar widget */
   g_test_log_set_fatal_handler (ignore_gvfs_warning, NULL);
 
   widget = gtk_file_chooser_widget_new (GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
diff --git a/po/POTFILES.in b/po/POTFILES.in
index dee2a83..66d875b 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -289,6 +289,7 @@ modules/printbackends/test/gtkprintbackendtest.c
 [type: gettext/glade]gtk/gtklockbutton.ui
 [type: gettext/glade]gtk/gtkmessagedialog.ui
 [type: gettext/glade]gtk/gtkpagesetupunixdialog.ui
+[type: gettext/glade]gtk/gtkpathbar.ui
 [type: gettext/glade]gtk/gtkprintunixdialog.ui
 [type: gettext/glade]gtk/gtkrecentchooserdefault.ui
 [type: gettext/glade]gtk/gtkscalebutton.ui


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