[gimp] app: add gimp_layer_mode_box_set_label() and set_ellipsize()



commit 6e522d735f088981ff6009f5de9c26c8bee5bb48
Author: Michael Natterer <mitch gimp org>
Date:   Mon Jan 30 13:21:41 2017 +0100

    app: add gimp_layer_mode_box_set_label() and set_ellipsize()
    
    so it can be configured like the old paint mode menu.

 app/widgets/gimplayermodebox.c |   42 +++++++++++++++++++++++++++++++--------
 app/widgets/gimplayermodebox.h |   17 ++++++++++-----
 2 files changed, 44 insertions(+), 15 deletions(-)
---
diff --git a/app/widgets/gimplayermodebox.c b/app/widgets/gimplayermodebox.c
index 13febe2..fcf7737 100644
--- a/app/widgets/gimplayermodebox.c
+++ b/app/widgets/gimplayermodebox.c
@@ -56,9 +56,12 @@ enum
 
 struct _GimpLayerModeBoxPrivate
 {
-  GimpLayerMode      layer_mode;
-  gboolean           with_behind;
-  gboolean           with_replace;
+  GimpLayerMode  layer_mode;
+  gboolean       with_behind;
+  gboolean       with_replace;
+
+  GtkWidget     *mode_combo;
+  GtkWidget     *group_combo;
 };
 
 
@@ -138,10 +141,9 @@ gimp_layer_mode_box_constructed (GObject *object)
 
   G_OBJECT_CLASS (parent_class)->constructed (object);
 
-  mode_combo = gimp_layer_mode_combo_box_new (box->priv->with_behind,
-                                              box->priv->with_replace);
-  gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (mode_combo),
-                                _("Mode"));
+  box->priv->mode_combo = mode_combo =
+    gimp_layer_mode_combo_box_new (box->priv->with_behind,
+                                   box->priv->with_replace);
   gtk_box_pack_start (GTK_BOX (box), mode_combo, TRUE, TRUE, 0);
   gtk_widget_show (mode_combo);
 
@@ -150,8 +152,9 @@ gimp_layer_mode_box_constructed (GObject *object)
                           G_BINDING_BIDIRECTIONAL |
                           G_BINDING_SYNC_CREATE);
 
-  group_combo = gimp_prop_enum_combo_box_new (G_OBJECT (mode_combo),
-                                              "group", 0, 0);
+  box->priv->group_combo = group_combo =
+    gimp_prop_enum_combo_box_new (G_OBJECT (mode_combo),
+                                  "group", 0, 0);
   gtk_box_pack_start (GTK_BOX (box), group_combo, FALSE, FALSE, 0);
   gtk_widget_show (group_combo);
 
@@ -280,3 +283,24 @@ gimp_layer_mode_box_get_mode (GimpLayerModeBox *box)
 
   return box->priv->layer_mode;
 }
+
+void
+gimp_layer_mode_box_set_label (GimpLayerModeBox *box,
+                               const gchar      *label)
+{
+  g_return_if_fail (GIMP_IS_LAYER_MODE_BOX (box));
+
+  gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (box->priv->mode_combo),
+                                label);
+}
+
+void
+gimp_layer_mode_box_set_ellipsize (GimpLayerModeBox   *box,
+                                   PangoEllipsizeMode  mode)
+{
+  g_return_if_fail (GIMP_IS_LAYER_MODE_BOX (box));
+
+  g_object_set (box->priv->mode_combo,
+                "ellipsize", mode,
+                NULL);
+}
diff --git a/app/widgets/gimplayermodebox.h b/app/widgets/gimplayermodebox.h
index 73ac4c9..c6ab35f 100644
--- a/app/widgets/gimplayermodebox.h
+++ b/app/widgets/gimplayermodebox.h
@@ -46,14 +46,19 @@ struct _GimpLayerModeBoxClass
 };
 
 
-GType           gimp_layer_mode_box_get_type (void) G_GNUC_CONST;
+GType           gimp_layer_mode_box_get_type      (void) G_GNUC_CONST;
 
-GtkWidget     * gimp_layer_mode_box_new      (gboolean          with_behind,
-                                              gboolean          with_replace);
+GtkWidget     * gimp_layer_mode_box_new           (gboolean            with_behind,
+                                                   gboolean            with_replace);
 
-void            gimp_layer_mode_box_set_mode (GimpLayerModeBox *combo,
-                                              GimpLayerMode     mode);
-GimpLayerMode   gimp_layer_mode_box_get_mode (GimpLayerModeBox *combo);
+void            gimp_layer_mode_box_set_mode      (GimpLayerModeBox   *box,
+                                                   GimpLayerMode       mode);
+GimpLayerMode   gimp_layer_mode_box_get_mode      (GimpLayerModeBox   *box);
+
+void            gimp_layer_mode_box_set_label     (GimpLayerModeBox   *box,
+                                                   const gchar        *label);
+void            gimp_layer_mode_box_set_ellipsize (GimpLayerModeBox   *box,
+                                                   PangoEllipsizeMode  mode);
 
 
 #endif  /* __GIMP_LAYER_MODE_BOX_H__ */


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