[Xfce4-commits] [xfce/thunar] 18/46: Rework how location bar selection works

noreply at xfce.org noreply at xfce.org
Tue Aug 15 02:35:26 CEST 2017


This is an automated email from the git hooks/post-receive script.

a   n   d   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/thunar.

commit fc53ebd55aac4e080a3a948f84847b9cb0d5201d
Author: Jonas Kümmerlin <rgcjonas at gmail.com>
Date:   Mon Aug 24 19:06:54 2015 +0200

    Rework how location bar selection works
    
    ThunarLocationBar now isn't an interface, but an actual widget hosting the
    different location bars. Unfortunately, there is still some code left in
    ThunarWindow, but this is expected to go away when GtkAction finally dies.
    
    On the plus side, we got rid of GtkUIManager inside the location bars
    and also nuked ThunarLocationDialog from orbit.
---
 thunar/Makefile.am                    |   6 -
 thunar/thunar-location-bar.c          | 362 ++++++++++++++++++++++++++++------
 thunar/thunar-location-bar.h          |  19 +-
 thunar/thunar-location-button.c       |   2 -
 thunar/thunar-location-buttons-ui.xml |  25 ---
 thunar/thunar-location-buttons.c      | 357 +++++++++++++++++----------------
 thunar/thunar-location-dialog.c       | 167 ----------------
 thunar/thunar-location-dialog.h       |  64 ------
 thunar/thunar-location-entry.c        | 145 ++++++--------
 thunar/thunar-location-entry.h        |   2 +
 thunar/thunar-window.c                | 198 ++++++-------------
 11 files changed, 606 insertions(+), 741 deletions(-)

diff --git a/thunar/Makefile.am b/thunar/Makefile.am
index 4ee978e..00f6bd6 100644
--- a/thunar/Makefile.am
+++ b/thunar/Makefile.am
@@ -27,7 +27,6 @@ thunar_built_sources =							\
 	thunar-abstract-icon-view-ui.h					\
 	thunar-details-view-ui.h					\
 	thunar-launcher-ui.h						\
-	thunar-location-buttons-ui.h					\
 	thunar-shortcuts-pane-ui.h					\
 	thunar-renamer-dialog-ui.h					\
 	thunar-standard-view-ui.h					\
@@ -130,8 +129,6 @@ thunar_SOURCES =							\
 	thunar-location-button.h					\
 	thunar-location-buttons.c					\
 	thunar-location-buttons.h					\
-	thunar-location-dialog.c					\
-	thunar-location-dialog.h					\
 	thunar-location-entry.c						\
 	thunar-location-entry.h						\
 	thunar-misc-jobs.c						\
@@ -334,9 +331,6 @@ thunar-details-view-ui.h: Makefile $(srcdir)/thunar-details-view-ui.xml
 thunar-launcher-ui.h: Makefile $(srcdir)/thunar-launcher-ui.xml
 	$(AM_V_GEN) exo-csource --strip-comments --strip-content --static --name=thunar_launcher_ui $(srcdir)/thunar-launcher-ui.xml > thunar-launcher-ui.h
 
-thunar-location-buttons-ui.h: Makefile $(srcdir)/thunar-location-buttons-ui.xml
-	$(AM_V_GEN) exo-csource --strip-comments --strip-content --static --name=thunar_location_buttons_ui $(srcdir)/thunar-location-buttons-ui.xml > thunar-location-buttons-ui.h
-
 thunar-shortcuts-pane-ui.h: Makefile $(srcdir)/thunar-shortcuts-pane-ui.xml
 	$(AM_V_GEN) exo-csource --strip-comments --strip-content --static --name=thunar_shortcuts_pane_ui $(srcdir)/thunar-shortcuts-pane-ui.xml > thunar-shortcuts-pane-ui.h
 
diff --git a/thunar/thunar-location-bar.c b/thunar/thunar-location-bar.c
index e06d95f..edf6f83 100644
--- a/thunar/thunar-location-bar.c
+++ b/thunar/thunar-location-bar.c
@@ -1,6 +1,6 @@
 /* vi:set et ai sw=2 sts=2 ts=2: */
 /*-
- * Copyright (c) 2005-2006 Benedikt Meurer <benny at xfce.org>
+ * Copyright (c) 2015 Jonas Kümmerlin <rgcjonas at gmail.com>
  *
  * 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
@@ -23,83 +23,325 @@
 
 #include <thunar/thunar-location-bar.h>
 #include <thunar/thunar-private.h>
+#include <thunar/thunar-navigator.h>
+#include <thunar/thunar-location-entry.h>
+#include <thunar/thunar-location-buttons.h>
+#include <thunar/thunar-preferences.h>
 
 
+struct _ThunarLocationBarClass
+{
+  GtkBinClass __parent__;
+
+  /* signals */
+  void (*reload_requested) (void);
+  void (*entry_done) (void);
+};
+
+struct _ThunarLocationBar
+{
+  GtkBin __parent__;
+
+  ThunarFile *current_directory;
+};
+
+
+
+enum
+{
+  PROP_0,
+  PROP_CURRENT_DIRECTORY,
+};
+
+
+static void         thunar_location_bar_navigator_init             (ThunarNavigatorIface *iface);
+static void         thunar_location_bar_get_property               (GObject              *object,
+                                                                    guint                 prop_id,
+                                                                    GValue               *value,
+                                                                    GParamSpec           *pspec);
+static void         thunar_location_bar_set_property               (GObject              *object,
+                                                                    guint                 prop_id,
+                                                                    const GValue         *value,
+                                                                    GParamSpec           *pspec);
+static ThunarFile  *thunar_location_bar_get_current_directory      (ThunarNavigator      *navigator);
+static void         thunar_location_bar_set_current_directory      (ThunarNavigator      *navigator,
+                                                                    ThunarFile           *current_directory);
+static GtkWidget   *thunar_location_bar_install_widget             (ThunarLocationBar    *bar,
+                                                                    GType                 type);
+static void         thunar_location_bar_reload_requested           (ThunarLocationBar    *bar);
+static gboolean     thunar_location_bar_settings_changed           (ThunarLocationBar    *bar);
+static void         thunar_location_bar_on_enry_edit_done          (ThunarLocationEntry  *entry,
+                                                                    ThunarLocationBar    *bar);
+
+
+
+G_DEFINE_TYPE_WITH_CODE (ThunarLocationBar, thunar_location_bar, GTK_TYPE_BIN,
+                         G_IMPLEMENT_INTERFACE (THUNAR_TYPE_NAVIGATOR, thunar_location_bar_navigator_init));
+
+
+
+GtkWidget *
+thunar_location_bar_new (void)
+{
+  return gtk_widget_new (THUNAR_TYPE_LOCATION_BAR, NULL);
+}
+
+
+
+static void
+thunar_location_bar_class_init (ThunarLocationBarClass *klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+  gobject_class->get_property = thunar_location_bar_get_property;
+  gobject_class->set_property = thunar_location_bar_set_property;
+
+  klass->reload_requested = exo_noop;
+
+  /* Override ThunarNavigator's properties */
+  g_object_class_override_property (gobject_class, PROP_CURRENT_DIRECTORY, "current-directory");
+
+  /* install signals */
+
+  /**
+   * ThunarLocationBar::reload-requested:
+   * @location_bar : a #ThunarLocationBar.
+   *
+   * Emitted by @location_bar whenever the user clicked a "reload" button
+   **/
+  g_signal_new ("reload-requested",
+                G_TYPE_FROM_CLASS (klass),
+                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+                G_STRUCT_OFFSET (ThunarLocationBarClass, reload_requested),
+                NULL, NULL,
+                NULL,
+                G_TYPE_NONE, 0);
+
+  /**
+   * ThunarLocationBar::entry-done:
+   * @location_bar : a #ThunarLocationBar.
+   *
+   * Emitted by @location_bar exactly once after an entry has been requested using
+   * #thunar_location_bar_request_entry and the user has finished editing the entry.
+   **/
+  g_signal_new ("entry-done",
+                G_TYPE_FROM_CLASS (klass),
+                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+                G_STRUCT_OFFSET (ThunarLocationBarClass, entry_done),
+                NULL, NULL,
+                NULL,
+                G_TYPE_NONE, 0);
+}
+
 
-GType
-thunar_location_bar_get_type (void)
+
+static void
+thunar_location_bar_init (ThunarLocationBar *bar)
 {
-  static volatile gsize type__volatile = 0;
-  GType                 type;
+  ThunarPreferences *preferences = thunar_preferences_get ();
+
+  bar->current_directory = NULL;
+
+  thunar_location_bar_settings_changed (bar);
+
+  g_signal_connect_object (preferences, "notify::last-location-bar", G_CALLBACK (thunar_location_bar_settings_changed), bar, G_CONNECT_SWAPPED);
+}
+
 
-  if (g_once_init_enter (&type__volatile))
+
+static void
+thunar_location_bar_navigator_init (ThunarNavigatorIface *iface)
+{
+  iface->set_current_directory = thunar_location_bar_set_current_directory;
+  iface->get_current_directory = thunar_location_bar_get_current_directory;
+}
+
+
+
+static void
+thunar_location_bar_get_property (GObject              *object,
+                                  guint                 prop_id,
+                                  GValue               *value,
+                                  GParamSpec           *pspec)
+{
+  switch (prop_id)
     {
-      type = g_type_register_static_simple (G_TYPE_INTERFACE,
-                                            I_("ThunarLocationBar"),
-                                            sizeof (ThunarLocationBarIface),
-                                            NULL,
-                                            0,
-                                            NULL,
-                                            0);
+    case PROP_CURRENT_DIRECTORY:
+      g_value_set_object (value, thunar_navigator_get_current_directory (THUNAR_NAVIGATOR (object)));
+      break;
 
-      g_type_interface_add_prerequisite (type, THUNAR_TYPE_COMPONENT);
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+
+
+static void thunar_location_bar_set_property   (GObject              *object,
+                                                guint                 prop_id,
+                                                const GValue         *value,
+                                                GParamSpec           *pspec)
+{
+  switch (prop_id)
+    {
+    case PROP_CURRENT_DIRECTORY:
+      thunar_navigator_set_current_directory (THUNAR_NAVIGATOR (object), g_value_get_object (value));
+      break;
 
-      g_once_init_leave (&type__volatile, type);
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
     }
+}
+
 
-  return type__volatile;
+
+static ThunarFile *
+thunar_location_bar_get_current_directory (ThunarNavigator *navigator)
+{
+  return THUNAR_LOCATION_BAR (navigator)->current_directory;
 }
 
 
 
-/**
- * thunar_location_bar_accept_focus:
- * @location_bar : a #ThunarLocationBar.
- * @initial_text : the inital text for @location_bar if
- *                 focus is accepted, or %NULL if the
- *                 text of @location_bar shouldn't be
- *                 altered.
- *
- * If the implementation of the #ThunarLocationBar interface
- * supports entering a location into a text widget, then the
- * text widget will be focused and the method will return
- * %TRUE. The #ThunarLocationEntry is an example for such
- * an implementation.
- *
- * Else if the implementation offers no way to enter a new
- * location as text, it will simply return %FALSE here. The
- * #ThunarLocationButtons class is an example for such an
- * implementation.
- *
- * Return value: %TRUE if the @location_bar gave focus to
- *               a text entry widget provided by @location_bar,
- *               else %FALSE.
- **/
-gboolean
-thunar_location_bar_accept_focus (ThunarLocationBar *location_bar,
-                                  const gchar       *initial_text)
-{
-  _thunar_return_val_if_fail (THUNAR_IS_LOCATION_BAR (location_bar), FALSE);
-  return (*THUNAR_LOCATION_BAR_GET_IFACE (location_bar)->accept_focus) (location_bar, initial_text);
+static void
+thunar_location_bar_set_current_directory (ThunarNavigator      *navigator,
+                                           ThunarFile           *current_directory)
+{
+  ThunarLocationBar *bar = THUNAR_LOCATION_BAR (navigator);
+  GtkWidget         *child;
+
+  if (bar->current_directory) g_object_unref (bar->current_directory);
+  bar->current_directory = current_directory;
+
+  if (current_directory) g_object_ref (current_directory);
+
+  if ((child = gtk_bin_get_child (GTK_BIN (bar))) && THUNAR_IS_NAVIGATOR (child))
+    thunar_navigator_set_current_directory (THUNAR_NAVIGATOR (child), current_directory);
+
+  g_object_notify (G_OBJECT (bar), "current-directory");
+}
+
+
+
+static void
+thunar_location_bar_reload_requested (ThunarLocationBar *bar)
+{
+  g_signal_emit_by_name (bar, "reload-requested");
+}
+
+
+
+static GtkWidget *
+thunar_location_bar_install_widget (ThunarLocationBar    *bar,
+                                    GType                 type)
+{
+  GtkWidget *widget, *child;
+
+  /* check if the the right type is already installed */
+  if ((child = gtk_bin_get_child (GTK_BIN (bar))) && G_TYPE_CHECK_INSTANCE_TYPE (child, type))
+    return child;
+
+  widget = gtk_widget_new (type, "current-directory", bar->current_directory, NULL);
+
+  /* forward signals */
+  g_signal_connect_swapped (widget, "change-directory", G_CALLBACK (thunar_navigator_change_directory), THUNAR_NAVIGATOR (bar));
+  g_signal_connect_swapped (widget, "open-new-tab", G_CALLBACK (thunar_navigator_open_new_tab), THUNAR_NAVIGATOR (bar));
+
+  if (type == THUNAR_TYPE_LOCATION_ENTRY)
+    {
+      g_signal_connect_swapped (widget, "reload-requested", G_CALLBACK (thunar_location_bar_reload_requested), bar);
+    }
+  else if (type == THUNAR_TYPE_LOCATION_BUTTONS)
+    {
+      g_signal_connect_swapped (widget, "entry-requested", G_CALLBACK (thunar_location_bar_request_entry), bar);
+    }
+
+  if ((child = gtk_bin_get_child (GTK_BIN (bar))))
+    gtk_widget_destroy (child);
+
+  gtk_container_add (GTK_CONTAINER (bar), widget);
+  gtk_widget_show (widget);
+
+  return widget;
+}
+
+
+
+static void
+thunar_location_bar_on_enry_edit_done (ThunarLocationEntry *entry,
+                                       ThunarLocationBar   *bar)
+{
+  g_signal_handlers_disconnect_by_func (entry, thunar_location_bar_on_enry_edit_done, bar);
+
+  g_object_ref (bar);
+  g_idle_add_full (G_PRIORITY_HIGH_IDLE, (GSourceFunc)thunar_location_bar_settings_changed, bar, g_object_unref);
+
+  g_signal_emit_by_name (bar, "entry-done");
 }
 
 
 
 /**
- * thunar_location_bar_is_standalone:
- * @location_bar : a #ThunarLocationBar.
- *
- * Returns %TRUE if @location_bar should not be placed in the location
- * toolbar, but should be treated as a standalone component, which is
- * placed near to the view pane. Else, if %FALSE is returned, the
- * @location_bar will be placed into the location toolbar.
+ * thunar_location_bar_request_entry
+ * @bar          : The #ThunarLocationBar
+ * @initial_text : The initial text to be placed inside the entry, or NULL to
+ *                 use the path of the current directory.
  *
- * Return value: %FALSE to embed @location_bar into the location toolbar,
- *               %TRUE to treat it as a standalone component.
- **/
-gboolean
-thunar_location_bar_is_standalone (ThunarLocationBar *location_bar)
-{
-  _thunar_return_val_if_fail (THUNAR_IS_LOCATION_BAR (location_bar), FALSE);
-  return (*THUNAR_LOCATION_BAR_GET_IFACE (location_bar)->is_standalone) (location_bar);
+ * Makes the location bar display an entry with the given text and places the cursor
+ * accordingly. If the currently displayed location widget is a path bar, it will be
+ * temporarily swapped for an entry widget and swapped back once the user completed
+ * (or aborted) the input.
+ */
+void
+thunar_location_bar_request_entry (ThunarLocationBar *bar,
+                                   const gchar       *initial_text)
+{
+  GtkWidget *child;
+
+  child = gtk_bin_get_child (GTK_BIN (bar));
+
+  _thunar_return_if_fail (child != NULL && GTK_IS_WIDGET (child));
+
+  if (THUNAR_IS_LOCATION_ENTRY (child))
+    {
+      /* already have an entry */
+      thunar_location_entry_accept_focus (THUNAR_LOCATION_ENTRY (child), initial_text);
+    }
+  else
+    {
+      /* not an entry => temporarily replace it */
+      child = thunar_location_bar_install_widget (bar, THUNAR_TYPE_LOCATION_ENTRY);
+      thunar_location_entry_accept_focus (THUNAR_LOCATION_ENTRY (child), initial_text);
+    }
+
+  g_signal_connect (child, "edit-done", G_CALLBACK (thunar_location_bar_on_enry_edit_done), bar);
+}
+
+
+
+static gboolean
+thunar_location_bar_settings_changed (ThunarLocationBar *bar)
+{
+  gchar *last_location_bar;
+  GType  type;
+
+  g_object_get (thunar_preferences_get(), "last-location-bar", &last_location_bar, NULL);
+
+  /* validate it */
+  if (!strcmp (last_location_bar, g_type_name (THUNAR_TYPE_LOCATION_BUTTONS)))
+    type = THUNAR_TYPE_LOCATION_BUTTONS;
+  else if (!strcmp (last_location_bar, g_type_name (THUNAR_TYPE_LOCATION_ENTRY)))
+    type = THUNAR_TYPE_LOCATION_ENTRY;
+  else
+    type = THUNAR_TYPE_LOCATION_ENTRY; /* fallback */
+
+  g_free (last_location_bar);
+
+  thunar_location_bar_install_widget (bar, type);
+
+  return FALSE;
 }
+
+
diff --git a/thunar/thunar-location-bar.h b/thunar/thunar-location-bar.h
index d8faebc..0703cfb 100644
--- a/thunar/thunar-location-bar.h
+++ b/thunar/thunar-location-bar.h
@@ -24,29 +24,20 @@
 
 G_BEGIN_DECLS;
 
-typedef struct _ThunarLocationBarIface ThunarLocationBarIface;
+typedef struct _ThunarLocationBarClass ThunarLocationBarClass;
 typedef struct _ThunarLocationBar      ThunarLocationBar;
 
 #define THUNAR_TYPE_LOCATION_BAR            (thunar_location_bar_get_type ())
 #define THUNAR_LOCATION_BAR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), THUNAR_TYPE_LOCATION_BAR, ThunarLocationBar))
 #define THUNAR_IS_LOCATION_BAR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THUNAR_TYPE_LOCATION_BAR))
-#define THUNAR_LOCATION_BAR_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), THUNAR_TYPE_LOCATION_BAR, ThunarLocationBarIface))
+#define THUNAR_LOCATION_BAR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), THUNAR_TYPE_LOCATION_BAR, ThunarLocationBarClass))
 
-struct _ThunarLocationBarIface
-{
-  GTypeInterface __parent__;
 
-  /* virtual methods */
-  gboolean (*accept_focus)  (ThunarLocationBar *location_bar,
-                             const gchar       *initial_text);
-  gboolean (*is_standalone) (ThunarLocationBar *location_bar);
-};
+GType      thunar_location_bar_get_type      (void) G_GNUC_CONST;
 
-GType    thunar_location_bar_get_type     (void) G_GNUC_CONST;
+GtkWidget *thunar_location_bar_new           (void);
 
-gboolean thunar_location_bar_accept_focus  (ThunarLocationBar *location_bar,
-                                            const gchar       *initial_text);
-gboolean thunar_location_bar_is_standalone (ThunarLocationBar *location_bar);
+void       thunar_location_bar_request_entry (ThunarLocationBar *bar, const gchar *initial_text);
 
 G_END_DECLS;
 
diff --git a/thunar/thunar-location-button.c b/thunar/thunar-location-button.c
index 3aef435..0116adc 100644
--- a/thunar/thunar-location-button.c
+++ b/thunar/thunar-location-button.c
@@ -465,7 +465,6 @@ thunar_location_button_file_destroy (ThunarLocationButton *location_button,
 static void
 thunar_location_button_apply_label_size (ThunarLocationButton *location_button)
 {
-#if 0
   GtkRequisition normal_size;
   GtkRequisition bold_size;
   gint           width, height;
@@ -504,7 +503,6 @@ thunar_location_button_apply_label_size (ThunarLocationButton *location_button)
       gtk_widget_set_size_request (GTK_WIDGET (location_button->label), width, height);
       gtk_widget_set_tooltip_text (location_button->label, NULL);
     }
-#endif
 }
 
 
diff --git a/thunar/thunar-location-buttons-ui.xml b/thunar/thunar-location-buttons-ui.xml
deleted file mode 100644
index f6a809f..0000000
--- a/thunar/thunar-location-buttons-ui.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<ui>
-
-  <!--
-    Copyright (c) 2006 Benedikt Meurer <benny at xfce.org>
-
-    Thunar path bar user interface description file. Do NOT
-    simply edit this file if you don't know how the whole system
-    works, because it's too easy to break something.
-  -->
-
-  <accelerator action="location-buttons-down-folder" />
-
-  <popup action="location-buttons-context-menu">
-    <menuitem action="location-buttons-open" />
-    <menuitem action="location-buttons-open-in-new-tab" />
-    <menuitem action="location-buttons-open-in-new-window" />
-    <separator />
-    <menuitem action="location-buttons-create-folder" />
-    <menuitem action="location-buttons-empty-trash" />
-    <separator />
-    <menuitem action="location-buttons-paste-into-folder" />
-    <separator />
-    <menuitem action="location-buttons-properties" />
-  </popup>
-</ui>
diff --git a/thunar/thunar-location-buttons.c b/thunar/thunar-location-buttons.c
index b062796..9940876 100644
--- a/thunar/thunar-location-buttons.c
+++ b/thunar/thunar-location-buttons.c
@@ -33,7 +33,6 @@
 #include <thunar/thunar-gtk-extensions.h>
 #include <thunar/thunar-location-button.h>
 #include <thunar/thunar-location-buttons.h>
-#include <thunar/thunar-location-buttons-ui.h>
 #include <thunar/thunar-private.h>
 #include <thunar/thunar-properties-dialog.h>
 
@@ -48,15 +47,11 @@ enum
 {
   PROP_0,
   PROP_CURRENT_DIRECTORY,
-  PROP_SELECTED_FILES,
-  PROP_UI_MANAGER,
 };
 
 
 
-static void           thunar_location_buttons_component_init            (ThunarComponentIface       *iface);
 static void           thunar_location_buttons_navigator_init            (ThunarNavigatorIface       *iface);
-static void           thunar_location_buttons_location_bar_init         (ThunarLocationBarIface     *iface);
 static void           thunar_location_buttons_finalize                  (GObject                    *object);
 static void           thunar_location_buttons_get_property              (GObject                    *object,
                                                                          guint                       prop_id,
@@ -66,13 +61,13 @@ static void           thunar_location_buttons_set_property              (GObject
                                                                          guint                       prop_id,
                                                                          const GValue               *value,
                                                                          GParamSpec                 *pspec);
-static GtkUIManager  *thunar_location_buttons_get_ui_manager            (ThunarComponent            *component);
-static void           thunar_location_buttons_set_ui_manager            (ThunarComponent            *component,
-                                                                         GtkUIManager               *ui_manager);
 static ThunarFile    *thunar_location_buttons_get_current_directory     (ThunarNavigator            *navigator);
 static void           thunar_location_buttons_set_current_directory     (ThunarNavigator            *navigator,
                                                                          ThunarFile                 *current_directory);
 static void           thunar_location_buttons_unmap                     (GtkWidget                  *widget);
+static void           thunar_location_buttons_on_filler_enter           (GtkWidget                  *filler);
+static void           thunar_location_buttons_on_filler_leave           (GtkWidget                  *filler);
+static void           thunar_location_buttons_on_filler_clicked         (ThunarLocationButtons      *buttons);
 static void           thunar_location_buttons_get_preferred_width       (GtkWidget                  *widget,
                                                                          gint                       *minimum,
                                                                          gint                       *natural);
@@ -145,6 +140,8 @@ static void           thunar_location_buttons_action_properties         (GtkActi
 struct _ThunarLocationButtonsClass
 {
   GtkContainerClass __parent__;
+
+  void (*entry_requested)(const gchar *initial_text);
 };
 
 struct _ThunarLocationButtons
@@ -152,11 +149,10 @@ struct _ThunarLocationButtons
   GtkContainer __parent__;
 
   GtkActionGroup    *action_group;
-  GtkUIManager      *ui_manager;
-  guint              ui_merge_id;
 
   GtkWidget         *left_slider;
   GtkWidget         *right_slider;
+  GtkWidget         *filler_widget;
 
   ThunarFile        *current_directory;
 
@@ -192,9 +188,7 @@ static const GtkActionEntry action_entries[] =
 
 
 G_DEFINE_TYPE_WITH_CODE (ThunarLocationButtons, thunar_location_buttons, GTK_TYPE_CONTAINER,
-    G_IMPLEMENT_INTERFACE (THUNAR_TYPE_NAVIGATOR, thunar_location_buttons_navigator_init)
-    G_IMPLEMENT_INTERFACE (THUNAR_TYPE_COMPONENT, thunar_location_buttons_component_init)
-    G_IMPLEMENT_INTERFACE (THUNAR_TYPE_LOCATION_BAR, thunar_location_buttons_location_bar_init))
+    G_IMPLEMENT_INTERFACE (THUNAR_TYPE_NAVIGATOR, thunar_location_buttons_navigator_init))
 
 
 
@@ -228,38 +222,22 @@ thunar_location_buttons_class_init (ThunarLocationButtonsClass *klass)
   /* Override ThunarNavigator's properties */
   g_object_class_override_property (gobject_class, PROP_CURRENT_DIRECTORY, "current-directory");
 
-  /* Override ThunarComponent's properties */
-  g_object_class_override_property (gobject_class, PROP_SELECTED_FILES, "selected-files");
-  g_object_class_override_property (gobject_class, PROP_UI_MANAGER, "ui-manager");
-
-  /**
-   * ThunarLocationButtons:spacing:
-   *
-   * The amount of space between the path buttons.
-   **/
-  gtk_widget_class_install_style_property (gtkwidget_class,
-                                           g_param_spec_int ("spacing",
-                                                             _("Spacing"),
-                                                             _("The amount of space between the path buttons"),
-                                                             0, G_MAXINT, 3,
-                                                             G_PARAM_READABLE));
-
-  thunar_file_quark = g_quark_from_static_string ("button-thunar-file");
-}
-
+  /* signals */
+  g_signal_new ("entry-requested",
+                G_TYPE_FROM_CLASS (klass),
+                G_SIGNAL_RUN_LAST,
+                G_STRUCT_OFFSET (ThunarLocationButtonsClass, entry_requested),
+                NULL, NULL,
+                NULL,
+                G_TYPE_NONE,
+                1,
+                G_TYPE_STRING);
 
 
-static void
-thunar_location_buttons_component_init (ThunarComponentIface *iface)
-{
-  iface->get_selected_files = (gpointer) exo_noop_null;
-  iface->set_selected_files = (gpointer) exo_noop;
-  iface->get_ui_manager = thunar_location_buttons_get_ui_manager;
-  iface->set_ui_manager = thunar_location_buttons_set_ui_manager;
+  thunar_file_quark = g_quark_from_static_string ("button-thunar-file");
 }
 
 
-
 static void
 thunar_location_buttons_navigator_init (ThunarNavigatorIface *iface)
 {
@@ -270,10 +248,9 @@ thunar_location_buttons_navigator_init (ThunarNavigatorIface *iface)
 
 
 static void
-thunar_location_buttons_location_bar_init (ThunarLocationBarIface *iface)
+thunar_location_buttons_on_filler_clicked (ThunarLocationButtons *buttons)
 {
-  iface->accept_focus = (gpointer) exo_noop_false;
-  iface->is_standalone = (gpointer) exo_noop_true;
+  g_signal_emit_by_name (buttons, "entry-requested", NULL);
 }
 
 
@@ -281,10 +258,13 @@ thunar_location_buttons_location_bar_init (ThunarLocationBarIface *iface)
 static void
 thunar_location_buttons_init (ThunarLocationButtons *buttons)
 {
-  GtkWidget *arrow;
+  GtkWidget       *arrow;
+  GList           *list, *lp;
+  GtkStyleContext *context;
 
   /* setup the action group for the location buttons */
   buttons->action_group = gtk_action_group_new ("ThunarLocationButtons");
+  gtk_action_group_set_accel_group (buttons->action_group, gtk_accel_group_new ());
   gtk_action_group_set_translation_domain (buttons->action_group, GETTEXT_PACKAGE);
   gtk_action_group_add_actions (buttons->action_group, action_entries, G_N_ELEMENTS (action_entries), buttons);
 
@@ -313,6 +293,25 @@ thunar_location_buttons_init (ThunarLocationButtons *buttons)
   gtk_container_add (GTK_CONTAINER (buttons->right_slider), arrow);
   gtk_widget_show (arrow);
 
+  buttons->filler_widget = gtk_button_new ();
+  g_signal_connect_swapped (buttons->filler_widget, "clicked", G_CALLBACK (thunar_location_buttons_on_filler_clicked), buttons);
+  g_signal_connect (buttons->filler_widget, "enter-notify-event", G_CALLBACK (thunar_location_buttons_on_filler_enter), buttons);
+  g_signal_connect (buttons->filler_widget, "leave-notify-event", G_CALLBACK (thunar_location_buttons_on_filler_leave), buttons);
+  g_signal_connect (buttons->filler_widget, "unmap", G_CALLBACK (thunar_location_buttons_on_filler_leave), buttons);
+
+  context = gtk_widget_get_style_context (buttons->filler_widget);
+  list = gtk_style_context_list_classes (context);
+  for (lp = list; lp != NULL; lp = lp->next)
+    gtk_style_context_remove_class (context, lp->data);
+  g_list_free (list);
+
+  gtk_style_context_add_class (context, "entry");
+
+  gtk_container_add (GTK_CONTAINER (buttons), buttons->filler_widget);
+  gtk_widget_show (buttons->filler_widget);
+
+  g_object_set (buttons, "valign", GTK_ALIGN_CENTER, NULL);
+
   /* setup style classes */
   gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (buttons)),
                                GTK_STYLE_CLASS_LINKED);
@@ -323,16 +322,38 @@ thunar_location_buttons_init (ThunarLocationButtons *buttons)
 
 
 static void
+thunar_location_buttons_on_filler_enter (GtkWidget *filler)
+{
+  GdkCursor *cursor;
+  GdkWindow *window;
+
+  window = gtk_widget_get_window (filler);
+  cursor = gdk_cursor_new_for_display (gdk_window_get_display (window), GDK_XTERM);
+
+  gdk_window_set_cursor (window, cursor);
+}
+
+
+
+static void
+thunar_location_buttons_on_filler_leave (GtkWidget *filler)
+{
+  GdkWindow *window;
+
+  window = gtk_widget_get_window (filler);
+
+  gdk_window_set_cursor (window, NULL);
+}
+
+
+
+static void
 thunar_location_buttons_finalize (GObject *object)
 {
   ThunarLocationButtons *buttons = THUNAR_LOCATION_BUTTONS (object);
 
   _thunar_return_if_fail (THUNAR_IS_LOCATION_BUTTONS (buttons));
 
-  /* disconnect from the selected files and the UI manager */
-  thunar_component_set_selected_files (THUNAR_COMPONENT (buttons), NULL);
-  thunar_component_set_ui_manager (THUNAR_COMPONENT (buttons), NULL);
-
   /* be sure to cancel the scrolling */
   thunar_location_buttons_stop_scrolling (buttons);
 
@@ -359,14 +380,6 @@ thunar_location_buttons_get_property (GObject    *object,
       g_value_set_object (value, thunar_navigator_get_current_directory (THUNAR_NAVIGATOR (object)));
       break;
 
-    case PROP_SELECTED_FILES:
-      g_value_set_boxed (value, thunar_component_get_selected_files (THUNAR_COMPONENT (object)));
-      break;
-
-    case PROP_UI_MANAGER:
-      g_value_set_object (value, thunar_component_get_ui_manager (THUNAR_COMPONENT (object)));
-      break;
-
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -387,14 +400,6 @@ thunar_location_buttons_set_property (GObject      *object,
       thunar_navigator_set_current_directory (THUNAR_NAVIGATOR (object), g_value_get_object (value));
       break;
 
-    case PROP_SELECTED_FILES:
-      thunar_component_set_selected_files (THUNAR_COMPONENT (object), g_value_get_boxed (value));
-      break;
-
-    case PROP_UI_MANAGER:
-      thunar_component_set_ui_manager (THUNAR_COMPONENT (object), g_value_get_object (value));
-      break;
-
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -403,61 +408,6 @@ thunar_location_buttons_set_property (GObject      *object,
 
 
 
-static GtkUIManager*
-thunar_location_buttons_get_ui_manager (ThunarComponent *component)
-{
-  return THUNAR_LOCATION_BUTTONS (component)->ui_manager;
-}
-
-
-
-static void
-thunar_location_buttons_set_ui_manager (ThunarComponent *component,
-                                        GtkUIManager    *ui_manager)
-{
-  ThunarLocationButtons *buttons = THUNAR_LOCATION_BUTTONS (component);
-  GError                *error = NULL;
-
-  /* disconnect from the previous ui manager */
-  if (G_UNLIKELY (buttons->ui_manager != NULL))
-    {
-      /* drop our action group from the previous UI manager */
-      gtk_ui_manager_remove_action_group (buttons->ui_manager, buttons->action_group);
-
-      /* unmerge our ui controls from the previous UI manager */
-      gtk_ui_manager_remove_ui (buttons->ui_manager, buttons->ui_merge_id);
-
-      /* drop our reference on the previous UI manager */
-      g_object_unref (G_OBJECT (buttons->ui_manager));
-    }
-
-  /* activate the new UI manager */
-  buttons->ui_manager = ui_manager;
-
-  /* connect to the new UI manager */
-  if (G_LIKELY (ui_manager != NULL))
-    {
-      /* we keep a reference on the new manager */
-      g_object_ref (G_OBJECT (ui_manager));
-
-      /* add our action group to the new manager */
-      gtk_ui_manager_insert_action_group (ui_manager, buttons->action_group, -1);
-
-      /* merge our UI control items with the new manager */
-      buttons->ui_merge_id = gtk_ui_manager_add_ui_from_string (ui_manager, thunar_location_buttons_ui, thunar_location_buttons_ui_length, &error);
-      if (G_UNLIKELY (buttons->ui_merge_id == 0))
-        {
-          g_error ("Failed to merge ThunarLocationButtons menus: %s", error->message);
-          g_error_free (error);
-        }
-    }
-
-  /* notify listeners */
-  g_object_notify (G_OBJECT (buttons), "ui-manager");
-}
-
-
-
 static ThunarFile*
 thunar_location_buttons_get_current_directory (ThunarNavigator *navigator)
 {
@@ -683,6 +633,8 @@ thunar_location_buttons_get_path_for_child (GtkContainer *container,
           visible_children = g_list_prepend (visible_children, path_bar->right_slider);
         }
 
+      visible_children = g_list_prepend (visible_children, path_bar->filler_widget);
+
       for (l = path_bar->list; l; l = l->next)
         {
           if (gtk_widget_get_visible (GTK_WIDGET (l->data)) &&
@@ -909,6 +861,32 @@ thunar_location_buttons_size_allocate (GtkWidget     *widget,
         }
     }
 
+  /* allocate the filler */
+  if (direction == GTK_TEXT_DIR_RTL)
+    {
+      if (need_sliders)
+        {
+          child_allocation.width = child_allocation.x - allocation->x - right_slider_offset - buttons->slider_width;
+          child_allocation.x = right_slider_offset + buttons->slider_width;
+        }
+      else
+        {
+          child_allocation.width = child_allocation.x - allocation->x - border_width;
+          child_allocation.x = border_width;
+        }
+    }
+  else
+    {
+      if (need_sliders)
+        child_allocation.width = right_slider_offset - child_allocation.x + allocation->x;
+      else
+        child_allocation.width = allocation->width - border_width - child_allocation.x + allocation->x;
+    }
+
+  gtk_widget_get_preferred_size (GTK_WIDGET (buttons->filler_widget), &child_requisition, NULL);
+  gtk_widget_size_allocate (GTK_WIDGET (buttons->filler_widget), &child_allocation);
+  gtk_widget_set_child_visible (GTK_WIDGET (buttons->filler_widget), TRUE);
+
   /* now we go hide all the buttons that don't fit */
   for (; lp != NULL; lp = lp->prev)
     {
@@ -957,6 +935,8 @@ thunar_location_buttons_size_allocate (GtkWidget     *widget,
 
   if (need_reorder)
     thunar_location_buttons_child_ordering_changed (buttons);
+
+  gtk_widget_queue_draw (GTK_WIDGET (buttons));
 }
 
 
@@ -1071,6 +1051,9 @@ thunar_location_buttons_forall (GtkContainer *container,
 
   if (buttons->right_slider != NULL && include_internals)
     (*callback) (buttons->right_slider, callback_data);
+
+  if (buttons->filler_widget != NULL && include_internals)
+    (*callback) (buttons->filler_widget, callback_data);
 }
 
 
@@ -1422,7 +1405,7 @@ thunar_location_buttons_context_menu (ThunarLocationButton  *button,
   const gchar            *display_name;
   ThunarFile             *file;
   GtkAction              *action;
-  GtkWidget              *menu;
+  GtkWidget              *menu, *item;
 
   _thunar_return_if_fail (THUNAR_IS_LOCATION_BUTTONS (buttons));
   _thunar_return_if_fail (THUNAR_IS_LOCATION_BUTTON (button));
@@ -1431,67 +1414,79 @@ thunar_location_buttons_context_menu (ThunarLocationButton  *button,
   file = thunar_location_button_get_file (button);
   if (G_LIKELY (file != NULL))
     {
-      /* we cannot popup the context menu without an ui manager */
-      if (G_LIKELY (buttons->ui_manager != NULL))
-        {
-          /* determine the display name of the file */
-          display_name = thunar_file_get_display_name (file);
-
-          /* be sure to keep a reference on the navigation bar */
-          g_object_ref (G_OBJECT (buttons));
-
-          /* grab a reference on the clipboard manager for this display */
-          clipboard = thunar_clipboard_manager_get_for_display (gtk_widget_get_display (GTK_WIDGET (buttons)));
-
-          /* setup the "Open" action */
-          action = gtk_action_group_get_action (buttons->action_group, "location-buttons-open");
-          thunar_gtk_action_set_tooltip (action, _("Open \"%s\" in this window"), display_name);
-          g_object_set_qdata_full (G_OBJECT (action), thunar_file_quark, g_object_ref (G_OBJECT (file)), (GDestroyNotify) g_object_unref);
-          gtk_action_set_sensitive (action, (file != buttons->current_directory));
-
-          /* setup the "Open in New Window" action */
-          action = gtk_action_group_get_action (buttons->action_group, "location-buttons-open-in-new-window");
-          thunar_gtk_action_set_tooltip (action, _("Open \"%s\" in a new window"), display_name);
-          g_object_set_qdata_full (G_OBJECT (action), thunar_file_quark, g_object_ref (G_OBJECT (file)), (GDestroyNotify) g_object_unref);
-
-          /* setup the "Open in New Tab" action */
-          action = gtk_action_group_get_action (buttons->action_group, "location-buttons-open-in-new-tab");
-          thunar_gtk_action_set_tooltip (action, _("Open \"%s\" in a new tab"), display_name);
-          g_object_set_qdata_full (G_OBJECT (action), thunar_file_quark, g_object_ref (G_OBJECT (file)), (GDestroyNotify) g_object_unref);
-
-          /* setup the "Create Folder..." action */
-          action = gtk_action_group_get_action (buttons->action_group, "location-buttons-create-folder");
-          thunar_gtk_action_set_tooltip (action, _("Create a new folder in \"%s\""), display_name);
-          g_object_set_qdata_full (G_OBJECT (action), thunar_file_quark, g_object_ref (G_OBJECT (file)), (GDestroyNotify) g_object_unref);
-          gtk_action_set_sensitive (action, thunar_file_is_writable (file));
-          gtk_action_set_visible (action, !thunar_file_is_trashed (file));
-
-          /* setup the "Empty Trash" action */
-          action = gtk_action_group_get_action (buttons->action_group, "location-buttons-empty-trash");
-          gtk_action_set_visible (action, (thunar_file_is_root (file) && thunar_file_is_trashed (file)));
-          gtk_action_set_sensitive (action, (thunar_file_get_size (file) > 0));
-
-          /* setup the "Paste Into Folder" action */
-          action = gtk_action_group_get_action (buttons->action_group, "location-buttons-paste-into-folder");
-          thunar_gtk_action_set_tooltip (action, _("Move or copy files previously selected by a Cut or Copy command into \"%s\""), display_name);
-          g_object_set_qdata_full (G_OBJECT (action), thunar_file_quark, g_object_ref (G_OBJECT (file)), (GDestroyNotify) g_object_unref);
-          gtk_action_set_sensitive (action, thunar_clipboard_manager_get_can_paste (clipboard));
-
-          /* setup the "Properties..." action */
-          action = gtk_action_group_get_action (buttons->action_group, "location-buttons-properties");
-          thunar_gtk_action_set_tooltip (action, _("View the properties of the folder \"%s\""), display_name);
-          g_object_set_qdata_full (G_OBJECT (action), thunar_file_quark, g_object_ref (G_OBJECT (file)), (GDestroyNotify) g_object_unref);
-
-          /* run the menu on the screen on the buttons' screen */
-          menu = gtk_ui_manager_get_widget (buttons->ui_manager, "/location-buttons-context-menu");
-          thunar_gtk_menu_run (GTK_MENU (menu), GTK_WIDGET (buttons), NULL, NULL, 0, gtk_get_current_event_time ());
-
-          /* cleanup */
-          g_object_unref (G_OBJECT (buttons));
-          g_object_unref (G_OBJECT (clipboard));
-
-          return TRUE;
-        }
+      menu = gtk_menu_new ();
+
+      /* determine the display name of the file */
+      display_name = thunar_file_get_display_name (file);
+
+      /* be sure to keep a reference on the navigation bar */
+      g_object_ref (G_OBJECT (buttons));
+
+      /* grab a reference on the clipboard manager for this display */
+      clipboard = thunar_clipboard_manager_get_for_display (gtk_widget_get_display (GTK_WIDGET (buttons)));
+
+      /* setup the "Open" action */
+      action = gtk_action_group_get_action (buttons->action_group, "location-buttons-open");
+      thunar_gtk_action_set_tooltip (action, _("Open \"%s\" in this window"), display_name);
+      g_object_set_qdata_full (G_OBJECT (action), thunar_file_quark, g_object_ref (G_OBJECT (file)), (GDestroyNotify) g_object_unref);
+      gtk_action_set_sensitive (action, (file != buttons->current_directory));
+      gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_action_create_menu_item (action));
+
+      /* setup the "Open in New Tab" action */
+      action = gtk_action_group_get_action (buttons->action_group, "location-buttons-open-in-new-tab");
+      thunar_gtk_action_set_tooltip (action, _("Open \"%s\" in a new tab"), display_name);
+      g_object_set_qdata_full (G_OBJECT (action), thunar_file_quark, g_object_ref (G_OBJECT (file)), (GDestroyNotify) g_object_unref);
+      gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_action_create_menu_item (action));
+
+      /* setup the "Open in New Window" action */
+      action = gtk_action_group_get_action (buttons->action_group, "location-buttons-open-in-new-window");
+      thunar_gtk_action_set_tooltip (action, _("Open \"%s\" in a new window"), display_name);
+      g_object_set_qdata_full (G_OBJECT (action), thunar_file_quark, g_object_ref (G_OBJECT (file)), (GDestroyNotify) g_object_unref);
+      gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_action_create_menu_item (action));
+
+      /* setup the "Create Folder..." action */
+      action = gtk_action_group_get_action (buttons->action_group, "location-buttons-create-folder");
+      thunar_gtk_action_set_tooltip (action, _("Create a new folder in \"%s\""), display_name);
+      g_object_set_qdata_full (G_OBJECT (action), thunar_file_quark, g_object_ref (G_OBJECT (file)), (GDestroyNotify) g_object_unref);
+      gtk_action_set_sensitive (action, thunar_file_is_writable (file));
+      gtk_action_set_visible (action, !thunar_file_is_trashed (file));
+      gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_action_create_menu_item (action));
+
+      /* setup the "Empty Trash" action */
+      action = gtk_action_group_get_action (buttons->action_group, "location-buttons-empty-trash");
+      gtk_action_set_visible (action, (thunar_file_is_root (file) && thunar_file_is_trashed (file)));
+      gtk_action_set_sensitive (action, (thunar_file_get_size (file) > 0));
+      gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_action_create_menu_item (action));
+
+      item = gtk_separator_menu_item_new ();
+      gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+      gtk_widget_show (item);
+
+      /* setup the "Paste Into Folder" action */
+      action = gtk_action_group_get_action (buttons->action_group, "location-buttons-paste-into-folder");
+      thunar_gtk_action_set_tooltip (action, _("Move or copy files previously selected by a Cut or Copy command into \"%s\""), display_name);
+      g_object_set_qdata_full (G_OBJECT (action), thunar_file_quark, g_object_ref (G_OBJECT (file)), (GDestroyNotify) g_object_unref);
+      gtk_action_set_sensitive (action, thunar_clipboard_manager_get_can_paste (clipboard));
+      gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_action_create_menu_item (action));
+
+      item = gtk_separator_menu_item_new ();
+      gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+      gtk_widget_show (item);
+
+      /* setup the "Properties..." action */
+      action = gtk_action_group_get_action (buttons->action_group, "location-buttons-properties");
+      thunar_gtk_action_set_tooltip (action, _("View the properties of the folder \"%s\""), display_name);
+      g_object_set_qdata_full (G_OBJECT (action), thunar_file_quark, g_object_ref (G_OBJECT (file)), (GDestroyNotify) g_object_unref);
+      gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_action_create_menu_item (action));
+
+      /* run the menu on the screen on the buttons' screen */
+      thunar_gtk_menu_run (GTK_MENU (menu), GTK_WIDGET (buttons), NULL, NULL, 0, gtk_get_current_event_time ());
+
+      /* cleanup */
+      g_object_unref (buttons);
+      g_object_unref (clipboard);
+
+      return TRUE;
     }
 
   return FALSE;
diff --git a/thunar/thunar-location-dialog.c b/thunar/thunar-location-dialog.c
deleted file mode 100644
index c8d96c4..0000000
--- a/thunar/thunar-location-dialog.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/* vi:set et ai sw=2 sts=2 ts=2: */
-/*-
- * Copyright (c) 2005-2006 Benedikt Meurer <benny at xfce.org>
- * Copyright (c) 2010 Jannis Pohlmann <jannis at xfce.org>
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <thunar/thunar-gtk-extensions.h>
-#include <thunar/thunar-location-dialog.h>
-#include <thunar/thunar-path-entry.h>
-#include <thunar/thunar-private.h>
-
-
-
-G_DEFINE_TYPE (ThunarLocationDialog, thunar_location_dialog, THUNAR_TYPE_ABSTRACT_DIALOG)
-
-
-
-static gboolean
-transform_object_to_boolean (const GValue *src_value,
-                             GValue       *dst_value,
-                             gpointer      user_data)
-{
-  g_value_set_boolean (dst_value, (g_value_get_object (src_value) != NULL));
-  return TRUE;
-}
-
-
-
-static void
-thunar_location_dialog_class_init (ThunarLocationDialogClass *klass)
-{
-}
-
-
-
-static void
-thunar_location_dialog_init (ThunarLocationDialog *location_dialog)
-{
-  GtkWidget *open_button;
-  GtkWidget *hbox;
-  GtkWidget *label;
-
-  gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (location_dialog))), 2);
-  gtk_container_set_border_width (GTK_CONTAINER (location_dialog), 5);
-  gtk_window_set_default_size (GTK_WINDOW (location_dialog), 350, -1);
-  gtk_window_set_title (GTK_WINDOW (location_dialog), _("Open Location"));
-
-  gtk_dialog_add_button (GTK_DIALOG (location_dialog), _("_Cancel"), GTK_RESPONSE_CANCEL);
-
-  open_button = gtk_dialog_add_button (GTK_DIALOG (location_dialog), _("_Open"), GTK_RESPONSE_ACCEPT);
-  gtk_window_set_default (GTK_WINDOW (location_dialog), open_button);
-
-  hbox = g_object_new (GTK_TYPE_HBOX,
-                       "border-width", 5,
-                       "spacing", 12,
-                       NULL);
-  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (location_dialog))), hbox, FALSE, FALSE, 0);
-  gtk_widget_show (hbox);
-
-  label = gtk_label_new_with_mnemonic (_("_Location:"));
-  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-  gtk_widget_show (label);
-
-  location_dialog->entry = thunar_path_entry_new ();
-  gtk_entry_set_activates_default (GTK_ENTRY (location_dialog->entry), TRUE);
-  gtk_box_pack_start (GTK_BOX (hbox), location_dialog->entry, TRUE, TRUE, 0);
-  thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), location_dialog->entry);
-  gtk_label_set_mnemonic_widget (GTK_LABEL (label), location_dialog->entry);
-  gtk_widget_show (location_dialog->entry);
-
-  /* the "Open" button is only sensitive if a valid file is entered */
-  exo_binding_new_full (G_OBJECT (location_dialog->entry), "current-file",
-                        G_OBJECT (open_button), "sensitive",
-                        transform_object_to_boolean, NULL, NULL);
-}
-
-
-
-/**
- * thunar_location_dialog_new:
- * 
- * Allocates a new #ThunarLocationDialog instance.
- *
- * Return value: the newly allocated #ThunarLocationDialog.
- **/
-GtkWidget*
-thunar_location_dialog_new (void)
-{
-  return g_object_new (THUNAR_TYPE_LOCATION_DIALOG, NULL);
-}
-
-
-
-/**
- * thunar_location_dialog_get_selected_file:
- * @location_dialog : a #ThunarLocationDialog.
- *
- * Returns the file selected for the @dialog or
- * %NULL if the file entered is not valid.
- *
- * Return value: the selected #ThunarFile or %NULL.
- **/
-ThunarFile*
-thunar_location_dialog_get_selected_file (ThunarLocationDialog *location_dialog)
-{
-  _thunar_return_val_if_fail (THUNAR_IS_LOCATION_DIALOG (location_dialog), NULL);
-
-  return thunar_path_entry_get_current_file (THUNAR_PATH_ENTRY (location_dialog->entry));
-}
-
-
-
-/**
- * thunar_location_dialog_set_selected_file:
- * @location_dialog : a #ThunarLocationDialog.
- * @selected_file   : a #ThunarFile or %NULL.
- *
- * Sets the file for @location_dialog to @selected_file.
- **/
-void
-thunar_location_dialog_set_selected_file (ThunarLocationDialog *location_dialog,
-                                          ThunarFile           *selected_file)
-{
-  _thunar_return_if_fail (THUNAR_IS_LOCATION_DIALOG (location_dialog));
-  _thunar_return_if_fail (selected_file == NULL || THUNAR_IS_FILE (selected_file));
-
-  thunar_path_entry_set_current_file (THUNAR_PATH_ENTRY (location_dialog->entry), 
-                                      selected_file);
-}
-
-
-/**
- * thunar_location_dialog_set_working_directory:
- * @location_dialog : a #ThunarLocationDialog.
- * @directory       : a #ThunarFile or %NULL.
- *
- * Sets the working directory of @location_dialog to @directory.
- **/
-void
-thunar_location_dialog_set_working_directory (ThunarLocationDialog *location_dialog,
-                                              ThunarFile           *directory)
-{
-  _thunar_return_if_fail (THUNAR_IS_LOCATION_DIALOG (location_dialog));
-  _thunar_return_if_fail (directory == NULL || THUNAR_IS_FILE (directory));
-
-  thunar_path_entry_set_working_directory (THUNAR_PATH_ENTRY (location_dialog->entry),
-                                           directory);
-}
diff --git a/thunar/thunar-location-dialog.h b/thunar/thunar-location-dialog.h
deleted file mode 100644
index 441e8a0..0000000
--- a/thunar/thunar-location-dialog.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* vi:set et ai sw=2 sts=2 ts=2: */
-/*-
- * Copyright (c) 2005-2006 Benedikt Meurer <benny at xfce.org>
- * Copyright (c) 2010 Jannis Pohlmann <jannis at xfce.org>
- *
- * 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 __THUNAR_LOCATION_DIALOG_H__
-#define __THUNAR_LOCATION_DIALOG_H__
-
-#include <thunar/thunar-abstract-dialog.h>
-#include <thunar/thunar-file.h>
-
-G_BEGIN_DECLS;
-
-typedef struct _ThunarLocationDialogClass ThunarLocationDialogClass;
-typedef struct _ThunarLocationDialog      ThunarLocationDialog;
-
-#define THUNAR_TYPE_LOCATION_DIALOG             (thunar_location_dialog_get_type ())
-#define THUNAR_LOCATION_DIALOG(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), THUNAR_TYPE_LOCATION_DIALOG, ThunarLocationDialog))
-#define THUNAR_LOCATION_DIALOG_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), THUNAR_TYPE_LOCATION_DIALOG, ThunarLocationDialogClass))
-#define THUNAR_IS_LOCATION_DIALOG(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THUNAR_TYPE_LOCATION_DIALOG))
-#define THUNAR_IS_LOCATION_DIALOG_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), THUNAR_TYPE_LOCATION_DIALOG))
-#define THUNAR_LOCATION_DIALOG_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), THUNAR_TYPE_LOCATION_DIALOG, ThunarLocationDialogClass))
-
-struct _ThunarLocationDialogClass
-{
-  ThunarAbstractDialogClass __parent__;
-};
-
-struct _ThunarLocationDialog
-{
-  ThunarAbstractDialog __parent__;
-  GtkWidget           *entry;
-};
-
-GType       thunar_location_dialog_get_type              (void) G_GNUC_CONST;
-
-GtkWidget  *thunar_location_dialog_new                   (void) G_GNUC_MALLOC;
-
-ThunarFile *thunar_location_dialog_get_selected_file     (ThunarLocationDialog *location_dialog);
-void        thunar_location_dialog_set_selected_file     (ThunarLocationDialog *location_dialog,
-                                                          ThunarFile           *selected_file);
-void        thunar_location_dialog_set_working_directory (ThunarLocationDialog *location_dialog,
-                                                          ThunarFile           *directory);
-
-G_END_DECLS;
-
-#endif /* !__THUNAR_LOCATION_DIALOG_H__ */
diff --git a/thunar/thunar-location-entry.c b/thunar/thunar-location-entry.c
index 06f5f14..c5902bf 100644
--- a/thunar/thunar-location-entry.c
+++ b/thunar/thunar-location-entry.c
@@ -42,15 +42,11 @@ enum
 {
   PROP_0,
   PROP_CURRENT_DIRECTORY,
-  PROP_SELECTED_FILES,
-  PROP_UI_MANAGER,
 };
 
 
 
-static void        thunar_location_entry_component_init           (ThunarComponentIface     *iface);
 static void        thunar_location_entry_navigator_init           (ThunarNavigatorIface     *iface);
-static void        thunar_location_entry_location_bar_init        (ThunarLocationBarIface   *iface);
 static void        thunar_location_entry_finalize                 (GObject                  *object);
 static void        thunar_location_entry_get_property             (GObject                  *object,
                                                                    guint                     prop_id,
@@ -63,10 +59,6 @@ static void        thunar_location_entry_set_property             (GObject
 static ThunarFile *thunar_location_entry_get_current_directory    (ThunarNavigator          *navigator);
 static void        thunar_location_entry_set_current_directory    (ThunarNavigator          *navigator,
                                                                    ThunarFile               *current_directory);
-static void        thunar_location_entry_component_set_ui_manager (ThunarComponent          *component,
-                                                                   GtkUIManager             *ui_manager);
-static gboolean    thunar_location_entry_accept_focus             (ThunarLocationBar        *location_bar,
-                                                                   const gchar              *initial_text);
 static void        thunar_location_entry_activate                 (GtkWidget                *path_entry,
                                                                    ThunarLocationEntry      *location_entry);
 static gboolean    thunar_location_entry_reset                    (ThunarLocationEntry      *location_entry);
@@ -74,6 +66,7 @@ static void        thunar_location_entry_reload                   (GtkEntry
                                                                    GtkEntryIconPosition      icon_pos,
                                                                    GdkEvent                 *event,
                                                                    ThunarLocationEntry      *location_entry);
+static void        thunar_location_entry_emit_edit_done           (ThunarLocationEntry      *entry);
 
 
 
@@ -83,6 +76,10 @@ struct _ThunarLocationEntryClass
 
   /* internal action signals */
   gboolean (*reset) (ThunarLocationEntry *location_entry);
+
+  /* externally visible signals */
+  void (*reload_requested) (void);
+  void (*edit_done) (void);
 };
 
 struct _ThunarLocationEntry
@@ -91,16 +88,13 @@ struct _ThunarLocationEntry
 
   ThunarFile   *current_directory;
   GtkWidget    *path_entry;
-  GtkUIManager *ui_manager;
 };
 
 
 
 G_DEFINE_TYPE_WITH_CODE (ThunarLocationEntry, thunar_location_entry, GTK_TYPE_HBOX,
   G_IMPLEMENT_INTERFACE (THUNAR_TYPE_BROWSER, NULL)
-  G_IMPLEMENT_INTERFACE (THUNAR_TYPE_NAVIGATOR, thunar_location_entry_navigator_init)
-  G_IMPLEMENT_INTERFACE (THUNAR_TYPE_COMPONENT, thunar_location_entry_component_init)
-  G_IMPLEMENT_INTERFACE (THUNAR_TYPE_LOCATION_BAR, thunar_location_entry_location_bar_init))
+  G_IMPLEMENT_INTERFACE (THUNAR_TYPE_NAVIGATOR, thunar_location_entry_navigator_init))
 
 
 
@@ -120,10 +114,6 @@ thunar_location_entry_class_init (ThunarLocationEntryClass *klass)
   /* override ThunarNavigator's properties */
   g_object_class_override_property (gobject_class, PROP_CURRENT_DIRECTORY, "current-directory");
 
-  /* override ThunarComponent's properties */
-  g_object_class_override_property (gobject_class, PROP_SELECTED_FILES, "selected-files");
-  g_object_class_override_property (gobject_class, PROP_UI_MANAGER, "ui-manager");
-
   /**
    * ThunarLocationEntry::reset:
    * @location_entry : a #ThunarLocationEntry.
@@ -140,24 +130,42 @@ thunar_location_entry_class_init (ThunarLocationEntryClass *klass)
                 _thunar_marshal_BOOLEAN__VOID,
                 G_TYPE_BOOLEAN, 0);
 
+  /**
+   * ThunarLocationEntry::reload-requested:
+   * @location_entry : a #ThunarLocationEntry.
+   *
+   * Emitted by @location_entry whenever the user clicked a "reload" button
+   **/
+  g_signal_new ("reload-requested",
+                G_TYPE_FROM_CLASS (klass),
+                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+                G_STRUCT_OFFSET (ThunarLocationEntryClass, reload_requested),
+                NULL, NULL,
+                NULL,
+                G_TYPE_NONE, 0);
+
+  /**
+   * ThunarLocationEntry::edit-done:
+   * @location_entry : a #ThunarLocationEntry.
+   *
+   * Emitted by @location_entry whenever the user finished or aborted an edit
+   * operation by either changing to a directory, pressing Escape or moving the
+   * focus away from the entry.
+   **/
+  g_signal_new ("edit-done",
+                G_TYPE_FROM_CLASS (klass),
+                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+                G_STRUCT_OFFSET (ThunarLocationEntryClass, edit_done),
+                NULL, NULL,
+                NULL,
+                G_TYPE_NONE, 0);
+
   /* setup the key bindings for the location entry */
   binding_set = gtk_binding_set_by_class (klass);
   gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0, "reset", 0);
 }
 
 
-
-static void
-thunar_location_entry_component_init (ThunarComponentIface *iface)
-{
-  iface->get_selected_files = (gpointer) exo_noop_null;
-  iface->set_selected_files = (gpointer) exo_noop;
-  iface->get_ui_manager = (gpointer) exo_noop_null;
-  iface->set_ui_manager = thunar_location_entry_component_set_ui_manager;
-}
-
-
-
 static void
 thunar_location_entry_navigator_init (ThunarNavigatorIface *iface)
 {
@@ -168,15 +176,6 @@ thunar_location_entry_navigator_init (ThunarNavigatorIface *iface)
 
 
 static void
-thunar_location_entry_location_bar_init (ThunarLocationBarIface *iface)
-{
-  iface->accept_focus = thunar_location_entry_accept_focus;
-  iface->is_standalone = (gpointer) exo_noop_false;
-}
-
-
-
-static void
 thunar_location_entry_init (ThunarLocationEntry *location_entry)
 {
   gtk_box_set_spacing (GTK_BOX (location_entry), 0);
@@ -194,6 +193,9 @@ thunar_location_entry_init (ThunarLocationEntry *location_entry)
                                    GTK_ENTRY_ICON_SECONDARY, _("Reload the current folder"));
   g_signal_connect (G_OBJECT (location_entry->path_entry), "icon-release",
                     G_CALLBACK (thunar_location_entry_reload), location_entry);
+
+  /* make sure the edit-done signal is emitted upon moving the focus somewhere else */
+  g_signal_connect_swapped (location_entry->path_entry, "focus-out-event", G_CALLBACK (thunar_location_entry_emit_edit_done), location_entry);
 }
 
 
@@ -201,10 +203,6 @@ thunar_location_entry_init (ThunarLocationEntry *location_entry)
 static void
 thunar_location_entry_finalize (GObject *object)
 {
-  /* disconnect from the selected files and the UI manager */
-  thunar_component_set_selected_files (THUNAR_COMPONENT (object), NULL);
-  thunar_component_set_ui_manager (THUNAR_COMPONENT (object), NULL);
-
   /* disconnect from the current directory */
   thunar_navigator_set_current_directory (THUNAR_NAVIGATOR (object), NULL);
 
@@ -225,14 +223,6 @@ thunar_location_entry_get_property (GObject    *object,
       g_value_set_object (value, thunar_navigator_get_current_directory (THUNAR_NAVIGATOR (object)));
       break;
 
-    case PROP_SELECTED_FILES:
-      g_value_set_boxed (value, thunar_component_get_selected_files (THUNAR_COMPONENT (object)));
-      break;
-
-    case PROP_UI_MANAGER:
-      g_value_set_object (value, thunar_component_get_ui_manager (THUNAR_COMPONENT (object)));
-      break;
-
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -257,14 +247,6 @@ thunar_location_entry_set_property (GObject      *object,
                                                entry->current_directory);
       break;
 
-    case PROP_SELECTED_FILES:
-      thunar_component_set_selected_files (THUNAR_COMPONENT (object), g_value_get_boxed (value));
-      break;
-
-    case PROP_UI_MANAGER:
-      thunar_component_set_ui_manager (THUNAR_COMPONENT (object), g_value_get_object (value));
-      break;
-
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -304,30 +286,10 @@ thunar_location_entry_set_current_directory (ThunarNavigator *navigator,
 
 
 
-static void
-thunar_location_entry_component_set_ui_manager (ThunarComponent *component,
-                                                GtkUIManager    *ui_manager)
+void
+thunar_location_entry_accept_focus (ThunarLocationEntry *location_entry,
+                                    const gchar         *initial_text)
 {
-  ThunarLocationEntry *location_entry = THUNAR_LOCATION_ENTRY (component);
-
-  if (location_entry->ui_manager != NULL)
-    {
-      g_object_unref (location_entry->ui_manager);
-      location_entry->ui_manager = NULL;
-    }
-
-  if (ui_manager != NULL)
-    location_entry->ui_manager = g_object_ref (ui_manager);
-}
-
-
-
-static gboolean
-thunar_location_entry_accept_focus (ThunarLocationBar *location_bar,
-                                    const gchar       *initial_text)
-{
-  ThunarLocationEntry *location_entry = THUNAR_LOCATION_ENTRY (location_bar);
-
   /* give the keyboard focus to the path entry */
   gtk_widget_grab_focus (location_entry->path_entry);
 
@@ -345,8 +307,6 @@ thunar_location_entry_accept_focus (ThunarLocationBar *location_bar,
       /* select the whole path in the path entry */
       gtk_editable_select_region (GTK_EDITABLE (location_entry->path_entry), 0, -1);
     }
-
-  return TRUE;
 }
 
 
@@ -441,6 +401,8 @@ thunar_location_entry_activate (GtkWidget           *path_entry,
     {
       thunar_browser_poke_file (THUNAR_BROWSER (location_entry), file, path_entry,
                                 thunar_location_entry_poke_file_finish, NULL);
+
+      thunar_location_entry_emit_edit_done (location_entry);
     }
 }
 
@@ -455,6 +417,8 @@ thunar_location_entry_reset (ThunarLocationEntry *location_entry)
   /* ...and select the whole text again */
   gtk_editable_select_region (GTK_EDITABLE (location_entry->path_entry), 0, -1);
 
+  thunar_location_entry_emit_edit_done (location_entry);
+
   return TRUE;
 }
 
@@ -470,11 +434,18 @@ thunar_location_entry_reload (GtkEntry            *entry,
 
   _thunar_return_if_fail (THUNAR_IS_LOCATION_ENTRY (location_entry));
 
-  if (icon_pos == GTK_ENTRY_ICON_SECONDARY
-      && location_entry->ui_manager != NULL)
+  if (icon_pos == GTK_ENTRY_ICON_SECONDARY)
     {
-      action = gtk_ui_manager_get_action (location_entry->ui_manager, "/main-menu/view-menu/reload");
-      _thunar_return_if_fail (GTK_IS_ACTION (action));
-      gtk_action_activate (action);
+      g_signal_emit_by_name (location_entry, "reload-requested");
     }
 }
+
+
+
+static void
+thunar_location_entry_emit_edit_done (ThunarLocationEntry *entry)
+{
+    g_signal_emit_by_name (entry, "edit-done");
+}
+
+
diff --git a/thunar/thunar-location-entry.h b/thunar/thunar-location-entry.h
index cf9b444..11e2a2a 100644
--- a/thunar/thunar-location-entry.h
+++ b/thunar/thunar-location-entry.h
@@ -36,6 +36,8 @@ typedef struct _ThunarLocationEntry      ThunarLocationEntry;
 
 GType      thunar_location_entry_get_type (void) G_GNUC_CONST;
 
+void       thunar_location_entry_accept_focus (ThunarLocationEntry *entry, const gchar *initial_text);
+
 G_END_DECLS;
 
 #endif /* !__THUNAR_LOCATION_ENTRY_H__ */
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index 577d2c5..229b289 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -47,7 +47,6 @@
 #include <thunar/thunar-icon-view.h>
 #include <thunar/thunar-launcher.h>
 #include <thunar/thunar-location-buttons.h>
-#include <thunar/thunar-location-dialog.h>
 #include <thunar/thunar-location-entry.h>
 #include <thunar/thunar-marshal.h>
 #include <thunar/thunar-pango-extensions.h>
@@ -146,8 +145,8 @@ static void     thunar_window_notebook_insert             (ThunarWindow
 static void     thunar_window_merge_custom_preferences    (ThunarWindow           *window);
 static gboolean thunar_window_bookmark_merge              (gpointer                user_data);
 static void     thunar_window_merge_go_actions            (ThunarWindow           *window);
-static void     thunar_window_install_location_bar        (ThunarWindow           *window,
-                                                           GType                   type);
+static void     thunar_window_update_location_bar_visible (ThunarWindow           *window);
+static void     thunar_window_handle_reload_request       (ThunarWindow           *window);
 static void     thunar_window_install_sidepane            (ThunarWindow           *window,
                                                            GType                   type);
 static void     thunar_window_start_open_location         (ThunarWindow           *window,
@@ -711,6 +710,8 @@ thunar_window_init (ThunarWindow *window)
   gint            last_window_height;
   gboolean        last_window_maximized;
   gboolean        last_statusbar_visible;
+  GtkToolItem    *tool_item;
+  gboolean        small_icons;
   GtkRcStyle     *style;
 
   /* unset the view type */
@@ -733,6 +734,7 @@ thunar_window_init (ThunarWindow *window)
                 "last-location-bar", &last_location_bar,
                 "last-side-pane", &last_side_pane,
                 "last-statusbar-visible", &last_statusbar_visible,
+                "misc-small-toolbar-icons", &small_icons,
                 NULL);
 
   /* connect to the volume monitor */
@@ -885,20 +887,44 @@ thunar_window_init (ThunarWindow *window)
   gtk_widget_modify_style (window->notebook, style);
   g_object_unref (G_OBJECT (style));
 
-  /* determine the selected location selector */
-  if (exo_str_is_equal (last_location_bar, g_type_name (THUNAR_TYPE_LOCATION_BUTTONS)))
-    type = THUNAR_TYPE_LOCATION_BUTTONS;
-  else if (exo_str_is_equal (last_location_bar, g_type_name (THUNAR_TYPE_LOCATION_ENTRY)))
-    type = THUNAR_TYPE_LOCATION_ENTRY;
-  else
-    type = G_TYPE_NONE;
-  g_free (last_location_bar);
+  /* allocate the new location bar widget */
+  window->location_bar = thunar_location_bar_new ();
+  g_object_bind_property (G_OBJECT (window), "current-directory", G_OBJECT (window->location_bar), "current-directory", G_BINDING_SYNC_CREATE);
+  g_signal_connect_swapped (G_OBJECT (window->location_bar), "change-directory", G_CALLBACK (thunar_window_set_current_directory), window);
+  g_signal_connect_swapped (G_OBJECT (window->location_bar), "open-new-tab", G_CALLBACK (thunar_window_notebook_insert), window);
+  g_signal_connect_swapped (G_OBJECT (window->location_bar), "reload-requested", G_CALLBACK (thunar_window_handle_reload_request), window);
+  g_signal_connect_swapped (G_OBJECT (window->location_bar), "entry-done", G_CALLBACK (thunar_window_update_location_bar_visible), window);
+
+  /* setup the toolbar for the location bar */
+  window->location_toolbar = gtk_ui_manager_get_widget (window->ui_manager, "/location-toolbar");
+  gtk_toolbar_set_style (GTK_TOOLBAR (window->location_toolbar), GTK_TOOLBAR_ICONS);
+  gtk_toolbar_set_icon_size (GTK_TOOLBAR (window->location_toolbar),
+                              small_icons ? GTK_ICON_SIZE_SMALL_TOOLBAR : GTK_ICON_SIZE_LARGE_TOOLBAR);
+  gtk_table_attach (GTK_TABLE (window->table), window->location_toolbar, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+
+  /* add the location bar tool item */
+  tool_item = gtk_tool_item_new ();
+  gtk_tool_item_set_expand (tool_item, TRUE);
+  gtk_toolbar_insert (GTK_TOOLBAR (window->location_toolbar), tool_item, -1);
+  gtk_widget_show (GTK_WIDGET (tool_item));
+
+  /* add the location bar itself */
+  gtk_container_add (GTK_CONTAINER (tool_item), window->location_bar);
+
+  /* display the new location bar widget */
+  gtk_widget_show (window->location_bar);
 
   /* activate the selected location selector */
   action = gtk_action_group_get_action (window->action_group, "view-location-selector-pathbar");
-  gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), (type == THUNAR_TYPE_LOCATION_BUTTONS));
+  gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), !strcmp(last_location_bar, g_type_name (THUNAR_TYPE_LOCATION_BUTTONS)));
   action = gtk_action_group_get_action (window->action_group, "view-location-selector-toolbar");
-  gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), (type == THUNAR_TYPE_LOCATION_ENTRY));
+  gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), !strcmp(last_location_bar, g_type_name (THUNAR_TYPE_LOCATION_ENTRY)));
+
+  g_free (last_location_bar);
+
+  /* setup setting the location bar visibility on-demand */
+  g_signal_connect_swapped (G_OBJECT (window->preferences), "notify::last-location-bar", G_CALLBACK (thunar_window_update_location_bar_visible), window);
+  thunar_window_update_location_bar_visible (window);
 
   /* determine the selected side pane (FIXME: Should probably be last-shortcuts-visible and last-tree-visible preferences) */
   if (exo_str_is_equal (last_side_pane, g_type_name (THUNAR_TYPE_SHORTCUTS_PANE)))
@@ -1444,14 +1470,6 @@ thunar_window_notebook_switch_page (GtkWidget    *notebook,
   thunar_window_binding_create (window, page, "selected-files", window->launcher, "selected-files", G_BINDING_SYNC_CREATE);
   thunar_window_binding_create (window, page, "zoom-level", window, "zoom-level", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
 
-  /* connect to the location bar (if any) */
-  if (G_LIKELY (window->location_bar != NULL))
-    {
-      thunar_window_binding_create (window, page, "selected-files",
-                                    window->location_bar, "selected-files",
-                                    G_BINDING_SYNC_CREATE);
-    }
-
   /* connect to the sidepane (if any) */
   if (G_LIKELY (window->sidepane != NULL))
     {
@@ -1839,79 +1857,29 @@ thunar_window_update_directories (ThunarWindow *window,
 
 
 static void
-thunar_window_install_location_bar (ThunarWindow *window,
-                                    GType         type)
+thunar_window_update_location_bar_visible (ThunarWindow *window)
 {
-  GtkToolItem *item;
-  gboolean     small_icons;
+  gchar *last_location_bar = NULL;
 
-  _thunar_return_if_fail (type == G_TYPE_NONE || g_type_is_a (type, THUNAR_TYPE_LOCATION_BAR));
-  _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
+  g_object_get (window->preferences, "last-location-bar", &last_location_bar, NULL);
 
-  /* drop the previous location bar (if any) */
-  if (G_UNLIKELY (window->location_bar != NULL))
-    {
-      /* check if it was toolbar'ed (and thereby need to be disconnected from the toolbar) */
-      if (!thunar_location_bar_is_standalone (THUNAR_LOCATION_BAR (window->location_bar)))
-        {
-          /* disconnect the toolbar from the window */
-          gtk_container_remove (GTK_CONTAINER (window->table), window->location_toolbar);
-          window->location_toolbar = NULL;
-        }
+  if (strcmp (last_location_bar, g_type_name (G_TYPE_NONE)))
+    gtk_widget_show (window->location_toolbar);
+  else
+    gtk_widget_hide (window->location_toolbar);
 
-      /* destroy the location bar */
-      gtk_widget_destroy (window->location_bar);
-      window->location_bar = NULL;
-    }
+  g_free (last_location_bar);
+}
 
-  /* check if we have a new location bar */
-  if (G_LIKELY (type != G_TYPE_NONE))
-    {
-      /* allocate the new location bar widget */
-      window->location_bar = g_object_new (type, "ui-manager", window->ui_manager, NULL);
-      exo_binding_new (G_OBJECT (window), "current-directory", G_OBJECT (window->location_bar), "current-directory");
-      g_signal_connect_swapped (G_OBJECT (window->location_bar), "change-directory", G_CALLBACK (thunar_window_set_current_directory), window);
-      g_signal_connect_swapped (G_OBJECT (window->location_bar), "open-new-tab", G_CALLBACK (thunar_window_notebook_insert), window);
 
-      /* connect the location widget to the view (if any) */
-      if (G_LIKELY (window->view != NULL))
-        thunar_window_binding_create (window, window->view, "selected-files", window->location_bar, "selected-files", G_BINDING_SYNC_CREATE);
 
-      /* check if the location bar should be placed into a toolbar */
-      if (!thunar_location_bar_is_standalone (THUNAR_LOCATION_BAR (window->location_bar)))
-        {
-          /* setup the toolbar for the location bar */
-          window->location_toolbar = gtk_ui_manager_get_widget (window->ui_manager, "/location-toolbar");
-          g_object_get (G_OBJECT (window->preferences), "misc-small-toolbar-icons", &small_icons, NULL);
-          gtk_toolbar_set_style (GTK_TOOLBAR (window->location_toolbar), GTK_TOOLBAR_ICONS);
-          gtk_toolbar_set_icon_size (GTK_TOOLBAR (window->location_toolbar),
-                                     small_icons ? GTK_ICON_SIZE_SMALL_TOOLBAR : GTK_ICON_SIZE_LARGE_TOOLBAR);
-          gtk_table_attach (GTK_TABLE (window->table), window->location_toolbar, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
-          gtk_widget_show (window->location_toolbar);
-
-          /* add the location bar tool item (destroyed with the location bar) */
-          item = gtk_tool_item_new ();
-          gtk_tool_item_set_expand (item, TRUE);
-          g_signal_connect_object (G_OBJECT (window->location_bar), "destroy", G_CALLBACK (gtk_widget_destroy), item, G_CONNECT_SWAPPED);
-          gtk_toolbar_insert (GTK_TOOLBAR (window->location_toolbar), item, -1);
-          gtk_widget_show (GTK_WIDGET (item));
-
-          /* add the location bar itself */
-          gtk_container_add (GTK_CONTAINER (item), window->location_bar);
-        }
-      else
-        {
-          /* it's a standalone location bar, just place it above the view */
-          gtk_table_attach (GTK_TABLE (window->view_box), window->location_bar, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 6);
-        }
-
-      /* display the new location bar widget */
-      gtk_widget_show (window->location_bar);
-    }
+static void
+thunar_window_handle_reload_request (ThunarWindow *window)
+{
+  gboolean result;
 
-  /* remember the setting */
-  if (gtk_widget_get_visible (GTK_WIDGET (window)))
-    g_object_set (G_OBJECT (window->preferences), "last-location-bar", g_type_name (type), NULL);
+  /* force the view to reload */
+  g_signal_emit (G_OBJECT (window), window_signals[RELOAD], 0, TRUE, &result);
 }
 
 
@@ -2311,49 +2279,9 @@ thunar_window_start_open_location (ThunarWindow *window,
 
   _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
 
-  /* bring up the "Open Location"-dialog if the window has no location bar or the location bar
-   * in the window does not support text entry by the user.
-   */
-  if (window->location_bar == NULL || !thunar_location_bar_accept_focus (THUNAR_LOCATION_BAR (window->location_bar), initial_text))
-    {
-      /* allocate the "Open Location" dialog */
-      dialog = thunar_location_dialog_new ();
-      gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
-      gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
-      gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
-      thunar_location_dialog_set_working_directory (THUNAR_LOCATION_DIALOG (dialog),
-                                                    thunar_window_get_current_directory (window));
-      thunar_location_dialog_set_selected_file (THUNAR_LOCATION_DIALOG (dialog),
-                                                thunar_window_get_current_directory (window));
-
-      /* setup the initial text (if any) */
-      if (G_UNLIKELY (initial_text != NULL))
-        {
-          /* show, grab focus, set text and move cursor to the end */
-          gtk_widget_show_now (dialog);
-          gtk_widget_grab_focus (THUNAR_LOCATION_DIALOG (dialog)->entry);
-          gtk_entry_set_text (GTK_ENTRY (THUNAR_LOCATION_DIALOG (dialog)->entry), initial_text);
-          gtk_editable_set_position (GTK_EDITABLE (THUNAR_LOCATION_DIALOG (dialog)->entry), -1);
-        }
-
-      /* run the dialog */
-      if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
-        {
-          /* be sure to hide the location dialog first */
-          gtk_widget_hide (dialog);
-
-          /* check if we have a new directory or a file to launch */
-          selected_file = thunar_location_dialog_get_selected_file (THUNAR_LOCATION_DIALOG (dialog));
-          if (selected_file != NULL)
-            {
-              thunar_browser_poke_file (THUNAR_BROWSER (window), selected_file, window,
-                                        thunar_window_poke_file_finish, NULL);
-            }
-        }
-
-      /* destroy the dialog */
-      gtk_widget_destroy (dialog);
-    }
+  /* temporary show the location toolbar, even if it is normally hidden */
+  gtk_widget_show (window->location_toolbar);
+  thunar_location_bar_request_entry (THUNAR_LOCATION_BAR (window->location_bar), initial_text);
 }
 
 
@@ -2543,8 +2471,8 @@ static void
 thunar_window_action_pathbar_changed (GtkToggleAction *action,
                                       ThunarWindow    *window)
 {
-  GtkAction *other_action;
-  GType      type;
+  GtkAction   *other_action;
+  GType        type;
 
   _thunar_return_if_fail (GTK_IS_TOGGLE_ACTION (action));
   _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
@@ -2552,8 +2480,8 @@ thunar_window_action_pathbar_changed (GtkToggleAction *action,
   /* determine the new type of location bar */
   type = gtk_toggle_action_get_active (action) ? THUNAR_TYPE_LOCATION_BUTTONS : G_TYPE_NONE;
 
-  /* install the new location bar */
-  thunar_window_install_location_bar (window, type);
+  /* update the preferences */
+  g_object_set (window->preferences, "last-location-bar", g_type_name (type), NULL);
 
   /* check if we actually installed anything */
   if (G_LIKELY (type != G_TYPE_NONE))
@@ -2581,8 +2509,8 @@ thunar_window_action_toolbar_changed (GtkToggleAction *action,
   /* determine the new type of location bar */
   type = gtk_toggle_action_get_active (action) ? THUNAR_TYPE_LOCATION_ENTRY : G_TYPE_NONE;
 
-  /* install the new location bar */
-  thunar_window_install_location_bar (window, type);
+  /* update the preferences */
+  g_object_set (window->preferences, "last-location-bar", g_type_name (type), NULL);
 
   /* check if we actually installed anything */
   if (G_LIKELY (type != G_TYPE_NONE))

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list