[gimp] app: GimpGeglTool: show the operations' title, if they have one
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: GimpGeglTool: show the operations' title, if they have one
- Date: Tue, 10 Jun 2014 01:15:55 +0000 (UTC)
commit 7496a0471ba8259926b36028b79b5a0e62ecf03c
Author: Michael Natterer <mitch gimp org>
Date: Tue Jun 10 03:11:54 2014 +0200
app: GimpGeglTool: show the operations' title, if they have one
app/tools/gimpgegltool.c | 39 +++++++++++++++++++++++++++------------
1 files changed, 27 insertions(+), 12 deletions(-)
---
diff --git a/app/tools/gimpgegltool.c b/app/tools/gimpgegltool.c
index a293de6..7156122 100644
--- a/app/tools/gimpgegltool.c
+++ b/app/tools/gimpgegltool.c
@@ -273,7 +273,13 @@ static gint
gimp_gegl_tool_compare_operation_names (GeglOperationClass *a,
GeglOperationClass *b)
{
- return strcmp (a->name, b->name);
+ const gchar *name_a = gegl_operation_class_get_key (a, "title");
+ const gchar *name_b = gegl_operation_class_get_key (b, "title");
+
+ if (! name_a) name_a = a->name;
+ if (! name_b) name_b = b->name;
+
+ return strcmp (name_a, name_b);
}
static GList *
@@ -325,26 +331,32 @@ gimp_gegl_tool_dialog (GimpImageMapTool *image_map_tool)
for (iter = opclasses; iter; iter = iter->next)
{
- GeglOperationClass *opclass = GEGL_OPERATION_CLASS (iter->data);
- const gchar *icon_name;
- const gchar *label;
+ GeglOperationClass *opclass = GEGL_OPERATION_CLASS (iter->data);
+ const gchar *icon_name = NULL;
+ const gchar *op_name = opclass->name;
+ const gchar *title;
+ gchar *label;
if (g_str_has_prefix (opclass->name, "gegl:"))
- {
- label = opclass->name + strlen ("gegl:");
- icon_name = GIMP_STOCK_GEGL;
- }
+ icon_name = GIMP_STOCK_GEGL;
+
+ if (g_str_has_prefix (op_name, "gegl:"))
+ op_name += strlen ("gegl:");
+
+ title = gegl_operation_class_get_key (opclass, "title");
+
+ if (title)
+ label = g_strdup_printf ("%s (%s)", title, op_name);
else
- {
- label = opclass->name;
- icon_name = NULL;
- }
+ label = g_strdup (op_name);
gtk_list_store_insert_with_values (store, NULL, -1,
COLUMN_NAME, opclass->name,
COLUMN_LABEL, label,
COLUMN_ICON_NAME, icon_name,
-1);
+
+ g_free (label);
}
g_list_free (opclasses);
@@ -360,6 +372,9 @@ gimp_gegl_tool_dialog (GimpImageMapTool *image_map_tool)
"icon-name", COLUMN_ICON_NAME);
cell = gtk_cell_renderer_text_new ();
+ g_object_set (cell,
+ "ellipsize", PANGO_ELLIPSIZE_MIDDLE,
+ NULL);
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE);
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), cell,
"text", COLUMN_LABEL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]