[gimp] gimp_item_tree_view_style_set(): set the style of the lock buttons



commit 402408db1aa9da54e2cfdaec504c1f11c9b683d5
Author: Michael Natterer <mitch gimp org>
Date:   Thu Sep 3 13:22:17 2009 +0200

    gimp_item_tree_view_style_set(): set the style of the lock buttons
    
    Honor the "button-relief" and "button-icon-size" style properties for
    the lock buttons.

 app/widgets/gimpitemtreeview.c |   61 ++++++++++++++++++++++++++++++++-------
 1 files changed, 50 insertions(+), 11 deletions(-)
---
diff --git a/app/widgets/gimpitemtreeview.c b/app/widgets/gimpitemtreeview.c
index 5cc5ef7..3d51ccd 100644
--- a/app/widgets/gimpitemtreeview.c
+++ b/app/widgets/gimpitemtreeview.c
@@ -487,23 +487,26 @@ gimp_item_tree_view_style_set (GtkWidget *widget,
                                GtkStyle  *prev_style)
 {
   GimpItemTreeView *view = GIMP_ITEM_TREE_VIEW (widget);
+  GList            *children;
+  GList            *list;
+  GtkReliefStyle    button_relief;
+  GtkIconSize       button_icon_size;
+  gint              content_spacing;
+  gint              button_spacing;
+
+  gtk_widget_style_get (widget,
+                        "button-relief",    &button_relief,
+                        "button-icon-size", &button_icon_size,
+                        "content-spacing",  &content_spacing,
+                        "button-spacing",   &button_spacing,
+                        NULL);
 
   if (view->priv->options_box)
     {
-      GList *children;
-      GList *list;
-      gint   content_spacing;
-      gint   button_spacing;
-
-      gtk_widget_style_get (widget,
-                            "content-spacing", &content_spacing,
-                            "button-spacing",  &button_spacing,
-                            NULL);
-
       gtk_box_set_spacing (GTK_BOX (view->priv->options_box), content_spacing);
-      gtk_box_set_spacing (GTK_BOX (view->priv->lock_box), button_spacing);
 
-      children = gtk_container_get_children (GTK_CONTAINER (view->priv->options_box));
+      children =
+        gtk_container_get_children (GTK_CONTAINER (view->priv->options_box));
 
       for (list = children; list; list = g_list_next (list))
         {
@@ -515,6 +518,42 @@ gimp_item_tree_view_style_set (GtkWidget *widget,
       g_list_free (list);
     }
 
+  if (view->priv->lock_box)
+    {
+      gtk_box_set_spacing (GTK_BOX (view->priv->lock_box), button_spacing);
+
+      children =
+        gtk_container_get_children (GTK_CONTAINER (view->priv->lock_box));
+
+      for (list = children; list; list = g_list_next (list))
+        {
+          GtkWidget *child = list->data;
+
+          if (GTK_IS_BUTTON (child))
+            {
+              GtkWidget *image;
+
+              gtk_button_set_relief (GTK_BUTTON (child), button_relief);
+
+              image = gtk_bin_get_child (GTK_BIN (child));
+
+              if (GTK_IS_IMAGE (image))
+                {
+                  GtkIconSize  old_size;
+                  gchar       *stock_id;
+
+                  gtk_image_get_stock (GTK_IMAGE (image), &stock_id, &old_size);
+
+                  if (button_icon_size != old_size)
+                    gtk_image_set_from_stock (GTK_IMAGE (image),
+                                              stock_id, button_icon_size);
+                }
+            }
+        }
+
+      g_list_free (list);
+    }
+
   GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
 }
 



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