gegl r2139 - in trunk: . bin



Author: martinn
Date: Sat Mar  1 20:36:17 2008
New Revision: 2139
URL: http://svn.gnome.org/viewvc/gegl?rev=2139&view=rev

Log:
2008-03-01  Martin Nordholts  <martinn svn gnome org>

	* bin/gegl-node-editor.[ch]: Decouple from the operation-switcher
	code, i.e. the code that knows about all existing
	GEGL-operations. This greatly increases reusability of this
	component.

	* bin/gegl-tree-editor.c (property_editor_rebuild): Add the
	operation-switcher widget manually rather than having the
	operation-switcher being part of the node editor UI itself.

	* bin/editor-optype.c (popup_properties): Adapt to new
	GeglNodeEditor interface.


Modified:
   trunk/ChangeLog
   trunk/bin/editor-optype.c
   trunk/bin/gegl-node-editor.c
   trunk/bin/gegl-node-editor.h
   trunk/bin/gegl-tree-editor.c

Modified: trunk/bin/editor-optype.c
==============================================================================
--- trunk/bin/editor-optype.c	(original)
+++ trunk/bin/editor-optype.c	Sat Mar  1 20:36:17 2008
@@ -70,7 +70,7 @@
                                         GTK_STOCK_OK,
                                         GTK_RESPONSE_NONE,
                                         NULL);
-  gtk_container_add (GTK_CONTAINER (vbox), gegl_node_editor_new (node, FALSE));
+  gtk_container_add (GTK_CONTAINER (vbox), gegl_node_editor_new (node));
   gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), vbox);
 
   g_signal_connect_swapped (dialog,

Modified: trunk/bin/gegl-node-editor.c
==============================================================================
--- trunk/bin/gegl-node-editor.c	(original)
+++ trunk/bin/gegl-node-editor.c	Sat Mar  1 20:36:17 2008
@@ -31,7 +31,7 @@
 
 #include "gegl-node-editor.h"
 #include "gegl-paramspecs.h"
-#include "editor-optype.h"
+
 
 enum
 {
@@ -81,21 +81,12 @@
                                                         G_TYPE_OBJECT,
                                                         G_PARAM_CONSTRUCT |
                                                         G_PARAM_WRITABLE));
-
-  g_object_class_install_property (gobject_class, PROP_OPERATION_SWITCHER,
-                                   g_param_spec_boolean ("operation-switcher",
-                                                        "operation-switcher",
-                                                        "Show an operation changer widget within (at the top of) this node property editor",
-                                                        TRUE,
-                                                        G_PARAM_CONSTRUCT |
-                                                        G_PARAM_WRITABLE));
 }
 
 static void
 gegl_node_editor_init (GeglNodeEditor *self)
 {
   self->node               = NULL;
-  self->operation_switcher = TRUE;
 }
 
 static void
@@ -112,10 +103,6 @@
       /* FIXME: reference counting? */
       self->node = GEGL_NODE (g_value_get_object (value));
       break;
-    case PROP_OPERATION_SWITCHER:
-      /* FIXME: reference counting? */
-      self->operation_switcher = g_value_get_boolean (value);
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, pspec);
       break;
@@ -157,11 +144,6 @@
   self->col1 = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
   self->col2 = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 
-  if (self->operation_switcher)
-    {
-      gtk_box_pack_start (GTK_BOX (object), gegl_typeeditor_optype (self->col1, self->col2, self), FALSE, FALSE, 0);
-    }
-
   gegl_node_editor_construct (GEGL_NODE_EDITOR (object));
 
   g_object_unref (self->col1);
@@ -944,8 +926,7 @@
 }
 
 GtkWidget *
-gegl_node_editor_new (GeglNode *node,
-                      gboolean  operation_switcher)
+gegl_node_editor_new (GeglNode *node)
 {
   GType        editor_type;
   const gchar *operation;
@@ -976,7 +957,7 @@
     g_free (heirs);
   }
 
-  return g_object_new (editor_type, "node", node,
-                                    "operation-switcher", operation_switcher,
-                                    NULL);
+  return g_object_new (editor_type,
+                       "node", node,
+                       NULL);
 }

Modified: trunk/bin/gegl-node-editor.h
==============================================================================
--- trunk/bin/gegl-node-editor.h	(original)
+++ trunk/bin/gegl-node-editor.h	Sat Mar  1 20:36:17 2008
@@ -35,7 +35,6 @@
 struct _GeglNodeEditor
 {
   GtkVBox       parent_instance;
-  gboolean      operation_switcher;
   GtkSizeGroup *col1;
   GtkSizeGroup *col2;
   GeglNode     *node;
@@ -54,8 +53,7 @@
 
 GType       gegl_node_editor_get_type          (void) G_GNUC_CONST;
 cairo_t *   gegl_widget_get_cr                 (GtkWidget *widget);
-GtkWidget * gegl_node_editor_new               (GeglNode  *node,
-                                                gboolean   operation_switcher);
+GtkWidget * gegl_node_editor_new               (GeglNode  *node);
 
 /* class functions */
 

Modified: trunk/bin/gegl-tree-editor.c
==============================================================================
--- trunk/bin/gegl-tree-editor.c	(original)
+++ trunk/bin/gegl-tree-editor.c	Sat Mar  1 20:36:17 2008
@@ -25,6 +25,7 @@
 #include "gegl.h"
 
 #include "editor.h"
+#include "editor-optype.h"
 #include "gegl-node-editor.h"
 #include "gegl-plugin.h"
 #include "gegl-store.h"
@@ -35,15 +36,26 @@
 void property_editor_rebuild (GtkWidget *container,
                               GeglNode  *node)
 {
-  GtkWidget *editor;
+  GeglNodeEditor *node_editor;
+  GtkWidget      *node_editor_widget;
+  GtkWidget      *operation_switcher;
 
   gtk_container_foreach (GTK_CONTAINER (container),
                          (GtkCallback) gtk_widget_destroy, NULL);
 
-  /*editor = property_editor_general (col1, col2, node);*/
-  editor = gegl_node_editor_new (node, TRUE);
-  if (editor)
-    gtk_box_pack_start (GTK_BOX (container), editor, TRUE, TRUE, 0);
+  node_editor_widget = gegl_node_editor_new (node);
+  node_editor        = GEGL_NODE_EDITOR (node_editor_widget);
+  operation_switcher = gegl_typeeditor_optype (node_editor->col1, node_editor->col2, node_editor);
+
+  if (operation_switcher)
+    {
+      gtk_box_pack_start (GTK_BOX (container), operation_switcher, FALSE, FALSE, 0);
+    }
+  if (node_editor_widget)
+    {
+      gtk_box_pack_start (GTK_BOX (container), node_editor_widget, TRUE, TRUE, 0);
+    }
+
   gtk_widget_show_all (container);
 }
 



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