[gimp] app: add icons to the group selector in GimpLayerModeBox



commit 3fa931eb6801799a74b8d249dd6b2b33fa0a3c35
Author: Michael Natterer <mitch gimp org>
Date:   Mon Jan 30 12:20:29 2017 +0100

    app: add icons to the group selector in GimpLayerModeBox
    
    still completely horrible.

 app/widgets/gimplayermodebox.c |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/app/widgets/gimplayermodebox.c b/app/widgets/gimplayermodebox.c
index 7cdaaa9..13febe2 100644
--- a/app/widgets/gimplayermodebox.c
+++ b/app/widgets/gimplayermodebox.c
@@ -131,8 +131,10 @@ gimp_layer_mode_box_constructed (GObject *object)
   GimpLayerModeBox *box = GIMP_LAYER_MODE_BOX (object);
   GtkWidget        *mode_combo;
   GtkWidget        *group_combo;
+  GtkTreeModel     *group_model;
   GtkCellLayout    *layout;
   GtkCellRenderer  *cell;
+  gint              i;
 
   G_OBJECT_CLASS (parent_class)->constructed (object);
 
@@ -156,14 +158,30 @@ gimp_layer_mode_box_constructed (GObject *object)
   layout = GTK_CELL_LAYOUT (gtk_bin_get_child (GTK_BIN (group_combo)));
   gtk_cell_layout_clear (layout);
 
-  cell = gtk_cell_renderer_text_new ();
-  g_object_set (cell,
-                "width-chars", 1,
-                NULL);
+  group_model = gtk_combo_box_get_model (GTK_COMBO_BOX (group_combo));
 
-  gtk_cell_layout_pack_start (layout, cell, TRUE);
+  for (i = 0; i < 4; i++)
+    {
+      static const gchar *icons[] =
+      {
+        "gimp-reset",
+        "gimp-histogram-linear",
+        "gimp-visible",
+        "gimp-wilber-eek"
+      };
+
+      GtkTreeIter iter;
+
+      if (gimp_int_store_lookup_by_value (group_model, i, &iter))
+        gtk_list_store_set (GTK_LIST_STORE (group_model), &iter,
+                            GIMP_INT_STORE_ICON_NAME, icons[i],
+                            -1);
+    }
+
+  cell = gtk_cell_renderer_pixbuf_new ();
+  gtk_cell_layout_pack_start (layout, cell, FALSE);
   gtk_cell_layout_set_attributes (layout, cell,
-                                  "text", GIMP_INT_STORE_LABEL,
+                                  "icon-name", GIMP_INT_STORE_ICON_NAME,
                                   NULL);
 }
 


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