gimp r27352 - in branches/gimp-2-6: . app/tools



Author: neo
Date: Tue Oct 21 14:37:06 2008
New Revision: 27352
URL: http://svn.gnome.org/viewvc/gimp?rev=27352&view=rev

Log:
2008-10-21  Sven Neumann  <sven gimp org>

	Merged from trunk:

	* app/tools/gimpgegltool.c (gimp_param_spec_duplicate):
	GEGL_IS_PARAM_SPEC_PATH() became GEGL_IS_PARAM_SPEC_FILE_PATH()
	in GEGL 0.0.21.

	* app/tools/gimpgegltool.c (gimp_gegl_tool_dialog): for the
	combo-box, strip known prefixes from the GEGL operation names 
and
	use icons instead.



Modified:
   branches/gimp-2-6/ChangeLog
   branches/gimp-2-6/app/tools/gimpgegltool.c

Modified: branches/gimp-2-6/app/tools/gimpgegltool.c
==============================================================================
--- branches/gimp-2-6/app/tools/gimpgegltool.c	(original)
+++ branches/gimp-2-6/app/tools/gimpgegltool.c	Tue Oct 21 14:37:06 2008
@@ -45,6 +45,15 @@
 #include "gimp-intl.h"
 
 
+enum
+{
+  COLUMN_NAME,
+  COLUMN_LABEL,
+  COLUMN_STOCK_ID,
+  NUM_COLUMNS
+};
+
+
 /*  local function prototypes  */
 
 static void       gimp_gegl_tool_finalize          (GObject           *object);
@@ -330,11 +339,12 @@
   gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
   gtk_widget_show (label);
 
-  store = gtk_list_store_new (1, G_TYPE_STRING);
+  store = gtk_list_store_new (NUM_COLUMNS,
+			      G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
 
   opclasses = gimp_get_geglopclasses ();
 
-  for (iter = opclasses; iter; iter=iter->next)
+  for (iter = opclasses; iter; iter = iter->next)
     {
       GeglOperationClass *opclass = GEGL_OPERATION_CLASS (iter->data);
 
@@ -345,8 +355,29 @@
           strstr (opclass->categories, "edge")    ||
           strstr (opclass->categories, "render"))
         {
+	  const gchar *stock_id;
+	  const gchar *label;
+	  
+	  if (g_str_has_prefix (opclass->name, "gegl:"))
+	    {
+	      label    = opclass->name + strlen ("gegl:");
+	      stock_id = GIMP_STOCK_GEGL;
+	    }
+	  else if (g_str_has_prefix (opclass->name, "gimp:"))
+	    {
+	      label    = opclass->name + strlen ("gimp:");
+	      stock_id = GIMP_STOCK_WILBER;
+	    }
+	  else
+	    {
+	      label    = opclass->name;
+	      stock_id = NULL;
+	    }
+
           gtk_list_store_insert_with_values (store, NULL, -1,
-                                             0, opclass->name,
+                                             COLUMN_NAME,     opclass->name,
+					     COLUMN_LABEL,    label,
+					     COLUMN_STOCK_ID, stock_id,
                                              -1);
         }
     }
@@ -354,14 +385,19 @@
   g_list_free (opclasses);
 
   combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store));
-  cell = gtk_cell_renderer_text_new ();
-  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE);
-  gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), cell,
-                                 "text", 0);
+  g_object_unref (store);
   gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
   gtk_widget_show (combo);
 
-  g_object_unref (store);
+  cell = gtk_cell_renderer_pixbuf_new ();
+  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, FALSE);
+  gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), cell,
+                                 "stock-id", COLUMN_STOCK_ID);
+
+  cell = gtk_cell_renderer_text_new ();
+  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE);
+  gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), cell,
+                                 "text", COLUMN_LABEL);
 
   g_signal_connect (combo, "changed",
                     G_CALLBACK (gimp_gegl_tool_operation_changed),
@@ -410,7 +446,13 @@
     {
       GParamSpecString *spec = G_PARAM_SPEC_STRING (pspec);
 
+#if ((GEGL_MAGOR_VERSION == 0) && \
+     (GEGL_MINOR_VERSION == 0) && \
+     (GEGL_MICRO_VERSION >= 21))
+      if (GEGL_IS_PARAM_SPEC_FILE_PATH (pspec))
+#else
       if (GEGL_IS_PARAM_SPEC_PATH (pspec))
+#endif
         {
           return gimp_param_spec_config_path (pspec->name,
                                               g_param_spec_get_nick (pspec),
@@ -742,7 +784,7 @@
     }
 
   gtk_tree_model_get (model, &iter,
-                      0, &tool->operation,
+                      COLUMN_NAME, &tool->operation,
                       -1);
 
   if (! tool->operation)



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