[Xfce4-commits] <thunar:master> Don't show the root label in the pathbar. Center the icon (bug #5291).

Jannis Pohlmann jannis at xfce.org
Fri Sep 4 15:04:01 CEST 2009


Updating branch refs/heads/master
         to 2b6761afd4fa0d02e1140df35e891aaa65e9b0a9 (commit)
       from 4911ff1ed0f3fe2d7299a35cb72f0d6dcffcac79 (commit)

commit 2b6761afd4fa0d02e1140df35e891aaa65e9b0a9
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Fri Sep 4 14:58:10 2009 +0200

    Don't show the root label in the pathbar. Center the icon (bug #5291).
    
    Centering the icon is done by hiding the alignment in which the label
    would otherwise be presented. The alignment wastes space even if the
    label is empty or hidden.

 thunar/thunar-location-button.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/thunar/thunar-location-button.c b/thunar/thunar-location-button.c
index 9d35793..49be1f4 100644
--- a/thunar/thunar-location-button.c
+++ b/thunar/thunar-location-button.c
@@ -257,8 +257,8 @@ thunar_location_button_class_init (ThunarLocationButtonClass *klass)
 static void
 thunar_location_button_init (ThunarLocationButton *location_button)
 {
-  GtkWidget *button;
   GtkWidget *align;
+  GtkWidget *button;
   GtkWidget *hbox;
 
   /* create the toggle button */
@@ -423,8 +423,8 @@ thunar_location_button_file_changed (ThunarLocationButton *location_button,
   ThunarIconFactory *icon_factory;
   GtkIconTheme      *icon_theme;
   GtkSettings       *settings;
-  gchar             *icon_name;
   GdkPixbuf         *icon;
+  gchar             *icon_name;
   gint               height;
   gint               width;
   gint               size;
@@ -436,9 +436,18 @@ thunar_location_button_file_changed (ThunarLocationButton *location_button,
   /* determine the icon theme for the widget */
   icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (location_button)));
 
-  /* update and show the label widget */
-  gtk_label_set_text (GTK_LABEL (location_button->label), thunar_file_get_display_name (file));
-  gtk_widget_show (location_button->label);
+  /* update and show the label widget (hide for the local root folder) */
+  if (thunar_file_is_local (file) && thunar_file_is_root (file)) 
+    {
+      /* hide the alignment in which the label would otherwise show up */
+      gtk_widget_hide (gtk_widget_get_parent (location_button->label));
+    }
+  else
+    {
+      /* set label to the file's display name and show the alignment (and thereby the label) */
+      gtk_label_set_text (GTK_LABEL (location_button->label), thunar_file_get_display_name (file));
+      gtk_widget_show (gtk_widget_get_parent (location_button->label));
+    }
 
   /* the image is only visible for certain special paths */
   if (thunar_file_is_home (file) || thunar_file_is_desktop (file) || thunar_file_is_root (file))



More information about the Xfce4-commits mailing list