[Xfce4-commits] <thunar:master> Add hidden option to show full path in window title (bug #6412).

Nick Schermer noreply at xfce.org
Fri Sep 28 19:04:01 CEST 2012


Updating branch refs/heads/master
         to 3ee371cfd06dcf78d7766e10cb462b1bcc422f46 (commit)
       from 7cb0de9b35f1bb0bbc5dc3104a25bcd79cb8b374 (commit)

commit 3ee371cfd06dcf78d7766e10cb462b1bcc422f46
Author: Nick Schermer <nick at xfce.org>
Date:   Fri Sep 28 19:01:26 2012 +0200

    Add hidden option to show full path in window title (bug #6412).
    
    Set MiscFullPathInTitle=TRUE in the thunarrc to enable the
    option.

 thunar/thunar-preferences.c |   15 +++++++++++++++
 thunar/thunar-window.c      |   13 ++++++++++++-
 2 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/thunar/thunar-preferences.c b/thunar/thunar-preferences.c
index 84d1f9b..7e6acc6 100644
--- a/thunar/thunar-preferences.c
+++ b/thunar/thunar-preferences.c
@@ -72,6 +72,7 @@ enum
   PROP_MISC_CASE_SENSITIVE,
   PROP_MISC_DATE_STYLE,
   PROP_MISC_FOLDERS_FIRST,
+  PROP_MISC_FULL_PATH_IN_TITLE,
   PROP_MISC_HORIZONTAL_WHEEL_NAVIGATES,
   PROP_MISC_RECURSIVE_PERMISSIONS,
   PROP_MISC_REMEMBER_GEOMETRY,
@@ -470,6 +471,20 @@ thunar_preferences_class_init (ThunarPreferencesClass *klass)
                                                          EXO_PARAM_READWRITE));
 
   /**
+   * ThunarPreferences:misc-full-path-in-title:
+   *
+   * Show the full directory path in the window title, instead of
+   * only the directory name.
+   **/
+  g_object_class_install_property (gobject_class,
+                                   PROP_MISC_FULL_PATH_IN_TITLE,
+                                   g_param_spec_boolean ("misc-full-path-in-title",
+                                                         "MiscFullPathInTitle",
+                                                         "misc-full-path-in-title",
+                                                         FALSE,
+                                                         EXO_PARAM_READWRITE));
+
+  /**
    * ThunarPreferences:misc-horizontal-wheel-navigates:
    *
    * Whether the horizontal mouse wheel is used to navigate
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index 0b83674..0ab4b05 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -2402,6 +2402,9 @@ thunar_window_current_directory_changed (ThunarFile   *current_directory,
   GtkAction    *action;
   gchar        *icon_name;
   gchar        *title;
+  gboolean      show_full_path;
+  gchar        *parse_name = NULL;
+  const gchar  *name;
 
   _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
   _thunar_return_if_fail (THUNAR_IS_FILE (current_directory));
@@ -2412,10 +2415,18 @@ thunar_window_current_directory_changed (ThunarFile   *current_directory,
   gtk_action_set_sensitive (action, (thunar_file_get_item_count (current_directory) > 0));
   gtk_action_set_visible (action, (thunar_file_is_root (current_directory) && thunar_file_is_trashed (current_directory)));
 
+  /* get name of directory or full path */
+  g_object_get (G_OBJECT (window->preferences), "misc-full-path-in-title", &show_full_path, NULL);
+  if (G_UNLIKELY (show_full_path))
+    name = parse_name = g_file_get_parse_name (thunar_file_get_file (current_directory));
+  else
+    name = thunar_file_get_display_name (current_directory);
+
   /* set window title */
-  title = g_strdup_printf ("%s - %s", thunar_file_get_display_name (current_directory), _("File Manager"));
+  title = g_strdup_printf ("%s - %s", name, _("File Manager"));
   gtk_window_set_title (GTK_WINDOW (window), title);
   g_free (title);
+  g_free (parse_name);
 
   /* set window icon */
   icon_theme = gtk_icon_theme_get_default ();


More information about the Xfce4-commits mailing list