[gimp] gimp_editor_set_box_style(): small optimization



commit efd5018420008bd358e062e92105097ba05e3d0f
Author: Michael Natterer <mitch gimp org>
Date:   Thu Sep 3 13:24:30 2009 +0200

    gimp_editor_set_box_style(): small optimization
    
    Don't set set icon again if the icon size has not actually changed.

 app/widgets/gimpeditor.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/app/widgets/gimpeditor.c b/app/widgets/gimpeditor.c
index 659b250..d39507d 100644
--- a/app/widgets/gimpeditor.c
+++ b/app/widgets/gimpeditor.c
@@ -775,11 +775,14 @@ gimp_editor_set_box_style (GimpEditor *editor,
 
           if (GTK_IS_IMAGE (child))
             {
-              gchar *stock_id;
+              GtkIconSize  old_size;
+              gchar       *stock_id;
 
-              gtk_image_get_stock (GTK_IMAGE (child), &stock_id, NULL);
-              gtk_image_set_from_stock (GTK_IMAGE (child),
-                                        stock_id, button_icon_size);
+              gtk_image_get_stock (GTK_IMAGE (child), &stock_id, &old_size);
+
+              if (button_icon_size != old_size)
+                gtk_image_set_from_stock (GTK_IMAGE (child),
+                                          stock_id, button_icon_size);
             }
         }
     }



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