[Xfce4-commits] <thunar:jannis/new-shortcuts-pane> Kinda sorta somewhat fix the size calculation for real.

Jannis Pohlmann noreply at xfce.org
Tue Jun 7 02:08:02 CEST 2011


Updating branch refs/heads/jannis/new-shortcuts-pane
         to 59330eb9335940b23288f74e62a42c0e1a7e6912 (commit)
       from 780ba31dd2afa5794785988b05580e27ffd6d8ca (commit)

commit 59330eb9335940b23288f74e62a42c0e1a7e6912
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Tue Jun 7 02:05:53 2011 +0200

    Kinda sorta somewhat fix the size calculation for real.

 thunar/thunar-shortcut-row.c |   35 ++++++++++++++++++++++++-----------
 1 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/thunar/thunar-shortcut-row.c b/thunar/thunar-shortcut-row.c
index a37f5d5..d6aa85f 100644
--- a/thunar/thunar-shortcut-row.c
+++ b/thunar/thunar-shortcut-row.c
@@ -38,7 +38,7 @@
 
 
 
-#define THUNAR_SHORTCUT_ROW_MIN_HEIGHT 26
+#define THUNAR_SHORTCUT_ROW_MIN_HEIGHT 20
 
 
 
@@ -299,6 +299,11 @@ thunar_shortcut_row_init (ThunarShortcutRow *row)
   gtk_button_set_image (GTK_BUTTON (row->action_button), row->action_image);
   gtk_widget_show (row->action_image);
 
+  /* default to "media-eject", we only set this for the button size
+  * to be computed so that all rows have equal heights */
+  gtk_image_set_from_icon_name (GTK_IMAGE (row->action_image), "media-eject",
+                                GTK_ICON_SIZE_MENU);
+
   /* update the icon size whenever necessary */
   row->preferences = thunar_preferences_get ();
   exo_binding_new (G_OBJECT (row->preferences), "shortcuts-icon-size",
@@ -656,23 +661,21 @@ thunar_shortcut_row_size_request (GtkWidget      *widget,
                                   GtkRequisition *requisition)
 {
   ThunarShortcutRow *row = THUNAR_SHORTCUT_ROW (widget);
+  GtkRequisition     button_requisition;
 
   _thunar_return_if_fail (THUNAR_IS_SHORTCUT_ROW (widget));
 
   /* let the event box class compute the size we need for its children */
   (*GTK_WIDGET_CLASS (thunar_shortcut_row_parent_class)->size_request) (widget, requisition);
 
-  g_debug ("computed height: %i", requisition->height);
-
-  g_debug ("  icon size + 2: %i", row->icon_size + 2);
-  g_debug ("     min height: %i", THUNAR_SHORTCUT_ROW_MIN_HEIGHT);
+  /* compute the button size */
+  gtk_widget_size_request (row->action_button, &button_requisition);
 
   /* use the maximum of the computed requisition height, the button height,
    * the icon size + 4, and the minimum allowed height for rows */
-  requisition->height = MAX (requisition->height, (gint) row->icon_size + 2);
+  requisition->height = MAX (requisition->height, button_requisition.height);
+  requisition->height = MAX (requisition->height, (gint) row->icon_size + 4);
   requisition->height = MAX (requisition->height, THUNAR_SHORTCUT_ROW_MIN_HEIGHT);
-
-  g_debug ("  => %i", requisition->height);
 }
 
 
@@ -957,9 +960,19 @@ thunar_shortcut_row_eject_icon_changed (ThunarShortcutRow *row)
 {
   _thunar_return_if_fail (THUNAR_IS_SHORTCUT_ROW (row));
 
-  /* update the action button image */
-  gtk_image_set_from_gicon (GTK_IMAGE (row->action_image), row->eject_icon, 
-                            GTK_ICON_SIZE_MENU);
+  if (row->eject_icon != NULL)
+    {
+      /* update the action button image */
+      gtk_image_set_from_gicon (GTK_IMAGE (row->action_image), row->eject_icon, 
+                                GTK_ICON_SIZE_MENU);
+    }
+  else
+    {
+      /* default to "media-eject", we only set this for the button size
+       * to be computed so that all rows have equal heights */
+      gtk_image_set_from_icon_name (GTK_IMAGE (row->action_image), "media-eject",
+                                    GTK_ICON_SIZE_MENU);
+    }
 }
 
 



More information about the Xfce4-commits mailing list