[dia] uml: split class dialog into pieces



commit 70e5f81b02129d6413ff7f93b6c31e44e31c3109
Author: Hans Breuer <hans breuer org>
Date:   Sun Sep 4 21:22:17 2011 +0200

    uml: split class dialog into pieces
    
    This is in preparation of de-deprecation and possibly
    integration with the meta info property page. No functional
    change just yet.

 objects/UML/Makefile.am               |    4 +
 objects/UML/class_attributes_dialog.c |  603 ++++++++
 objects/UML/class_dialog.c            | 2669 +++------------------------------
 objects/UML/class_dialog.h            |  106 ++
 objects/UML/class_operations_dialog.c | 1145 ++++++++++++++
 objects/UML/class_templates_dialog.c  |  465 ++++++
 objects/makefile.msc                  |    3 +
 po/POTFILES.in                        |    3 +
 8 files changed, 2552 insertions(+), 2446 deletions(-)
---
diff --git a/objects/UML/Makefile.am b/objects/UML/Makefile.am
index d3eb603..b939f45 100644
--- a/objects/UML/Makefile.am
+++ b/objects/UML/Makefile.am
@@ -6,7 +6,11 @@ libuml_objects_la_SOURCES = \
 			uml.c \
 			class.c \
 			class.h \
+			class_dialog.h \
 			class_dialog.c \
+			class_attributes_dialog.c \
+			class_operations_dialog.c \
+			class_templates_dialog.c \
 			note.c \
 			actor.c \
 			usecase.c \
diff --git a/objects/UML/class_attributes_dialog.c b/objects/UML/class_attributes_dialog.c
new file mode 100644
index 0000000..0b6a39c
--- /dev/null
+++ b/objects/UML/class_attributes_dialog.c
@@ -0,0 +1,603 @@
+/* Dia -- an diagram creation/manipulation program
+ * Copyright (C) 1998 Alexander Larsson
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+#include <config.h>
+
+#include <assert.h>
+#undef GTK_DISABLE_DEPRECATED /* GtkList, ... */
+#include <gtk/gtk.h>
+
+#include "class.h"
+#include "diaoptionmenu.h"
+
+#include "class_dialog.h"
+
+/************************************************************
+ ******************** ATTRIBUTES ****************************
+ ************************************************************/
+
+static void
+attributes_set_sensitive(UMLClassDialog *prop_dialog, gint val)
+{
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->attr_name), val);
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->attr_type), val);
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->attr_value), val);
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->attr_comment), val);
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->attr_visible), val);
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->attr_class_scope), val);
+}
+
+static void
+attributes_set_values(UMLClassDialog *prop_dialog, UMLAttribute *attr)
+{
+  gtk_entry_set_text(prop_dialog->attr_name, attr->name);
+  gtk_entry_set_text(prop_dialog->attr_type, attr->type);
+  if (attr->value != NULL)
+    gtk_entry_set_text(prop_dialog->attr_value, attr->value);
+  else
+    gtk_entry_set_text(prop_dialog->attr_value, "");
+
+  if (attr->comment != NULL)
+    _class_set_comment(prop_dialog->attr_comment, attr->comment);
+  else
+    _class_set_comment(prop_dialog->attr_comment, "");
+
+
+  dia_option_menu_set_active(prop_dialog->attr_visible, attr->visibility);
+  gtk_toggle_button_set_active(prop_dialog->attr_class_scope, attr->class_scope);
+}
+
+static void
+attributes_clear_values(UMLClassDialog *prop_dialog)
+{
+  gtk_entry_set_text(prop_dialog->attr_name, "");
+  gtk_entry_set_text(prop_dialog->attr_type, "");
+  gtk_entry_set_text(prop_dialog->attr_value, "");
+  _class_set_comment(prop_dialog->attr_comment, "");
+  gtk_toggle_button_set_active(prop_dialog->attr_class_scope, FALSE);
+}
+
+static void
+attributes_get_values (UMLClassDialog *prop_dialog, UMLAttribute *attr)
+{
+  g_free (attr->name);
+  g_free (attr->type);
+  if (attr->value != NULL)
+    g_free (attr->value);
+
+  attr->name = g_strdup (gtk_entry_get_text (prop_dialog->attr_name));
+  attr->type = g_strdup (gtk_entry_get_text (prop_dialog->attr_type));
+  
+  attr->value = g_strdup (gtk_entry_get_text(prop_dialog->attr_value));
+  attr->comment = g_strdup (_class_get_comment(prop_dialog->attr_comment));
+
+  attr->visibility = (UMLVisibility)dia_option_menu_get_active (prop_dialog->attr_visible);
+    
+  attr->class_scope = prop_dialog->attr_class_scope->active;
+}
+
+void
+_attributes_get_current_values(UMLClassDialog *prop_dialog)
+{
+  UMLAttribute *current_attr;
+  GtkLabel *label;
+  char *new_str;
+
+  if (prop_dialog != NULL && prop_dialog->current_attr != NULL) {
+    current_attr = (UMLAttribute *)
+      g_object_get_data(G_OBJECT(prop_dialog->current_attr), "user_data");
+    if (current_attr != NULL) {
+      attributes_get_values(prop_dialog, current_attr);
+      label = GTK_LABEL(GTK_BIN(prop_dialog->current_attr)->child);
+      new_str = uml_get_attribute_string(current_attr);
+      gtk_label_set_text (label, new_str);
+      g_free (new_str);
+    }
+  }
+}
+
+static void
+attribute_list_item_destroy_callback(GtkWidget *list_item,
+				     gpointer data)
+{
+  UMLAttribute *attr;
+
+  attr = (UMLAttribute *) g_object_get_data(G_OBJECT(list_item), "user_data");
+
+  if (attr != NULL) {
+    uml_attribute_destroy(attr);
+    /*printf("Destroying list_item's user_data!\n");*/
+  }
+}
+
+static void
+attributes_list_selection_changed_callback(GtkWidget *gtklist,
+					   UMLClass *umlclass)
+{
+  GList *list;
+  UMLClassDialog *prop_dialog;
+  GtkObject *list_item;
+  UMLAttribute *attr;
+
+  /* Due to GtkList oddities, this may get called during destroy.
+   * But it'll reference things that are already dead and crash.
+   * Thus, we stop it before it gets that bad.  See bug #156706 for
+   * one example.
+   */
+  if (umlclass->destroyed)
+    return;
+
+  prop_dialog = umlclass->properties_dialog;
+
+  if (!prop_dialog)
+    return;
+
+  _attributes_get_current_values(prop_dialog);
+  
+  list = GTK_LIST(gtklist)->selection;
+  if (!list && prop_dialog) { /* No selected */
+    attributes_set_sensitive(prop_dialog, FALSE);
+    attributes_clear_values(prop_dialog);
+    prop_dialog->current_attr = NULL;
+    return;
+  }
+  
+  list_item = GTK_OBJECT(list->data);
+  attr = (UMLAttribute *)g_object_get_data(G_OBJECT(list_item), "user_data");
+  attributes_set_values(prop_dialog, attr);
+  attributes_set_sensitive(prop_dialog, TRUE);
+
+  prop_dialog->current_attr = GTK_LIST_ITEM(list_item);
+  gtk_widget_grab_focus(GTK_WIDGET(prop_dialog->attr_name));
+}
+
+static void
+attributes_list_new_callback(GtkWidget *button,
+			     UMLClass *umlclass)
+{
+  GList *list;
+  UMLClassDialog *prop_dialog;
+  GtkWidget *list_item;
+  UMLAttribute *attr;
+  char *utfstr;
+  prop_dialog = umlclass->properties_dialog;
+
+  _attributes_get_current_values(prop_dialog);
+
+  attr = uml_attribute_new();
+  /* need to make the new ConnectionPoint valid and remember them */
+  uml_attribute_ensure_connection_points (attr, &umlclass->element.object);
+  prop_dialog->added_connections = 
+    g_list_prepend(prop_dialog->added_connections, attr->left_connection);
+  prop_dialog->added_connections = 
+    g_list_prepend(prop_dialog->added_connections, attr->right_connection);
+
+  utfstr = uml_get_attribute_string (attr);
+  list_item = gtk_list_item_new_with_label (utfstr);
+  gtk_widget_show (list_item);
+  g_free (utfstr);
+
+  g_object_set_data(G_OBJECT(list_item), "user_data", attr);
+  g_signal_connect (G_OBJECT (list_item), "destroy",
+		    G_CALLBACK (attribute_list_item_destroy_callback), NULL);
+  
+  list = g_list_append(NULL, list_item);
+  gtk_list_append_items(prop_dialog->attributes_list, list);
+
+  if (prop_dialog->attributes_list->children != NULL)
+    gtk_list_unselect_child(prop_dialog->attributes_list,
+			    GTK_WIDGET(prop_dialog->attributes_list->children->data));
+  gtk_list_select_child(prop_dialog->attributes_list, list_item);
+}
+
+static void
+attributes_list_delete_callback(GtkWidget *button,
+				UMLClass *umlclass)
+{
+  GList *list;
+  UMLClassDialog *prop_dialog;
+  GtkList *gtklist;
+  UMLAttribute *attr;
+
+  prop_dialog = umlclass->properties_dialog;
+  gtklist = GTK_LIST(prop_dialog->attributes_list);
+
+  if (gtklist->selection != NULL) {
+    attr = (UMLAttribute *)
+      g_object_get_data(G_OBJECT(gtklist->selection->data), "user_data");
+
+    if (attr->left_connection != NULL) {
+      prop_dialog->deleted_connections =
+	g_list_prepend(prop_dialog->deleted_connections,
+		       attr->left_connection);
+      prop_dialog->deleted_connections =
+	g_list_prepend(prop_dialog->deleted_connections,
+		       attr->right_connection);
+    }
+    
+    list = g_list_prepend(NULL, gtklist->selection->data);
+    gtk_list_remove_items(gtklist, list);
+    g_list_free(list);
+    attributes_clear_values(prop_dialog);
+    attributes_set_sensitive(prop_dialog, FALSE);
+  }
+}
+
+static void
+attributes_list_move_up_callback(GtkWidget *button,
+				 UMLClass *umlclass)
+{
+  GList *list;
+  UMLClassDialog *prop_dialog;
+  GtkList *gtklist;
+  GtkWidget *list_item;
+  int i;
+  
+  prop_dialog = umlclass->properties_dialog;
+  gtklist = GTK_LIST(prop_dialog->attributes_list);
+
+  if (gtklist->selection != NULL) {
+    list_item = GTK_WIDGET(gtklist->selection->data);
+    
+    i = gtk_list_child_position(gtklist, list_item);
+    if (i>0)
+      i--;
+
+    g_object_ref(list_item);
+    list = g_list_prepend(NULL, list_item);
+    gtk_list_remove_items(gtklist, list);
+    gtk_list_insert_items(gtklist, list, i);
+    g_object_unref(list_item);
+
+    gtk_list_select_child(gtklist, list_item);
+  }
+}
+
+static void
+attributes_list_move_down_callback(GtkWidget *button,
+				   UMLClass *umlclass)
+{
+  GList *list;
+  UMLClassDialog *prop_dialog;
+  GtkList *gtklist;
+  GtkWidget *list_item;
+  int i;
+
+  prop_dialog = umlclass->properties_dialog;
+  gtklist = GTK_LIST(prop_dialog->attributes_list);
+
+  if (gtklist->selection != NULL) {
+    list_item = GTK_WIDGET(gtklist->selection->data);
+    
+    i = gtk_list_child_position(gtklist, list_item);
+    if (i<(g_list_length(gtklist->children)-1))
+      i++;
+
+    
+    g_object_ref(list_item);
+    list = g_list_prepend(NULL, list_item);
+    gtk_list_remove_items(gtklist, list);
+    gtk_list_insert_items(gtklist, list, i);
+    g_object_unref(list_item);
+
+    gtk_list_select_child(gtklist, list_item);
+  }
+}
+
+void
+_attributes_read_from_dialog(UMLClass *umlclass,
+			    UMLClassDialog *prop_dialog,
+			    int connection_index)
+{
+  GList *list;
+  UMLAttribute *attr;
+  GtkWidget *list_item;
+  GList *clear_list;
+  DiaObject *obj;
+
+  obj = &umlclass->element.object;
+
+  /* if the currently select attribute is changed, update the state in the
+   * dialog info from widgets */
+  _attributes_get_current_values(prop_dialog);
+  /* Free current attributes: */
+  list = umlclass->attributes;
+  while (list != NULL) {
+    attr = (UMLAttribute *)list->data;
+    uml_attribute_destroy(attr);
+    list = g_list_next(list);
+  }
+  g_list_free (umlclass->attributes);
+  umlclass->attributes = NULL;
+
+  /* Insert new attributes and remove them from gtklist: */
+  list = GTK_LIST (prop_dialog->attributes_list)->children;
+  clear_list = NULL;
+  while (list != NULL) {
+    list_item = GTK_WIDGET(list->data);
+    
+    clear_list = g_list_prepend (clear_list, list_item);
+    attr = (UMLAttribute *)
+      g_object_get_data(G_OBJECT(list_item), "user_data");
+    g_object_set_data(G_OBJECT(list_item), "user_data", NULL);
+    umlclass->attributes = g_list_append(umlclass->attributes, attr);
+    
+    if (attr->left_connection == NULL) {
+      uml_attribute_ensure_connection_points (attr, obj);
+
+      prop_dialog->added_connections =
+	g_list_prepend(prop_dialog->added_connections,
+		       attr->left_connection);
+      prop_dialog->added_connections =
+	g_list_prepend(prop_dialog->added_connections,
+		       attr->right_connection);
+    }
+
+    if ( (prop_dialog->attr_vis->active) &&
+	 (!prop_dialog->attr_supp->active) ) { 
+      obj->connections[connection_index] = attr->left_connection;
+      connection_index++;
+      obj->connections[connection_index] = attr->right_connection;
+      connection_index++;
+    } else {
+      _umlclass_store_disconnects(prop_dialog, attr->left_connection);
+      object_remove_connections_to(attr->left_connection);
+      _umlclass_store_disconnects(prop_dialog, attr->right_connection);
+      object_remove_connections_to(attr->right_connection);
+    }
+
+    list = g_list_next(list);
+  }
+  clear_list = g_list_reverse (clear_list);
+  gtk_list_remove_items (GTK_LIST (prop_dialog->attributes_list), clear_list);
+  g_list_free (clear_list);
+
+#if 0 /* UMLClass is *known* to be in an incositent state here, check later or crash ... */
+  umlclass_sanity_check(umlclass, "Read from dialog");
+#endif
+}
+
+void
+_attributes_fill_in_dialog(UMLClass *umlclass)
+{
+  UMLClassDialog *prop_dialog;
+  UMLAttribute *attr_copy;
+  GtkWidget *list_item;
+  GList *list;
+  int i;
+
+#ifdef DEBUG
+  umlclass_sanity_check(umlclass, "Filling in dialog");  
+#endif
+
+  prop_dialog = umlclass->properties_dialog;
+
+  /* copy in new attributes: */
+  if (prop_dialog->attributes_list->children == NULL) {
+    i = 0;
+    list = umlclass->attributes;
+    while (list != NULL) {
+      UMLAttribute *attr = (UMLAttribute *)list->data;
+      gchar *attrstr = uml_get_attribute_string(attr);
+
+      list_item = gtk_list_item_new_with_label (attrstr);
+      attr_copy = uml_attribute_copy(attr);
+      /* looks wrong but required for complicated ConnectionPoint memory management */
+      attr_copy->left_connection = attr->left_connection;
+      attr_copy->right_connection = attr->right_connection;
+      g_object_set_data(G_OBJECT(list_item), "user_data", (gpointer) attr_copy);
+      g_signal_connect (G_OBJECT (list_item), "destroy",
+			G_CALLBACK (attribute_list_item_destroy_callback), NULL);
+      gtk_container_add (GTK_CONTAINER (prop_dialog->attributes_list), list_item);
+      gtk_widget_show (list_item);
+      
+      list = g_list_next(list); i++;
+      g_free (attrstr);
+    }
+    /* set attributes non-sensitive */
+    prop_dialog->current_attr = NULL;
+    attributes_set_sensitive(prop_dialog, FALSE);
+    attributes_clear_values(prop_dialog);
+  }
+}
+
+static void
+attributes_update(GtkWidget *widget, UMLClass *umlclass)
+{
+  _attributes_get_current_values(umlclass->properties_dialog);
+}
+
+static int
+attributes_update_event(GtkWidget *widget, GdkEventFocus *ev, UMLClass *umlclass)
+{
+  _attributes_get_current_values(umlclass->properties_dialog);
+  return 0;
+}
+
+void 
+_attributes_create_page(GtkNotebook *notebook,  UMLClass *umlclass)
+{
+  UMLClassDialog *prop_dialog;
+  GtkWidget *page_label;
+  GtkWidget *label;
+  GtkWidget *hbox;
+  GtkWidget *vbox;
+  GtkWidget *vbox2;
+  GtkWidget *hbox2;
+  GtkWidget *table;
+  GtkWidget *entry;
+  GtkWidget *checkbox;
+  GtkWidget *scrolled_win;
+  GtkWidget *button;
+  GtkWidget *list;
+  GtkWidget *frame;
+  GtkWidget *omenu;
+  GtkWidget *scrolledwindow;
+
+  prop_dialog = umlclass->properties_dialog;
+
+  /* Attributes page: */
+  page_label = gtk_label_new_with_mnemonic (_("_Attributes"));
+  
+  vbox = gtk_vbox_new(FALSE, 5);
+  gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
+
+  hbox = gtk_hbox_new(FALSE, 5);
+  
+  scrolled_win = gtk_scrolled_window_new (NULL, NULL);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
+				  GTK_POLICY_AUTOMATIC, 
+				  GTK_POLICY_AUTOMATIC);
+  gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
+  gtk_widget_show (scrolled_win);
+
+  list = gtk_list_new ();
+  prop_dialog->attributes_list = GTK_LIST(list);
+  gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_SINGLE);
+  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), list);
+  gtk_container_set_focus_vadjustment (GTK_CONTAINER (list),
+				       gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_win)));
+  gtk_widget_show (list);
+
+  g_signal_connect (G_OBJECT (list), "selection_changed",
+		    G_CALLBACK(attributes_list_selection_changed_callback), umlclass);
+
+  vbox2 = gtk_vbox_new(FALSE, 5);
+
+  button = gtk_button_new_from_stock (GTK_STOCK_NEW);
+  g_signal_connect (G_OBJECT (button), "clicked",
+		    G_CALLBACK(attributes_list_new_callback), umlclass);
+  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
+  gtk_widget_show (button);
+  button = gtk_button_new_from_stock (GTK_STOCK_DELETE);
+  g_signal_connect (G_OBJECT (button), "clicked",
+		    G_CALLBACK(attributes_list_delete_callback), umlclass);
+  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
+  gtk_widget_show (button);
+  button = gtk_button_new_from_stock (GTK_STOCK_GO_UP);
+  g_signal_connect (G_OBJECT (button), "clicked",
+		    G_CALLBACK(attributes_list_move_up_callback), umlclass);
+  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
+  gtk_widget_show (button);
+  button = gtk_button_new_from_stock (GTK_STOCK_GO_DOWN);
+  g_signal_connect (G_OBJECT (button), "clicked",
+		    G_CALLBACK(attributes_list_move_down_callback), umlclass);
+  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
+  gtk_widget_show (button);
+
+  gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, TRUE, 0);
+
+  gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
+
+  frame = gtk_frame_new(_("Attribute data"));
+  vbox2 = gtk_vbox_new(FALSE, 5);
+  gtk_container_set_border_width (GTK_CONTAINER (vbox2), 10);
+  gtk_container_add (GTK_CONTAINER (frame), vbox2);
+  gtk_widget_show(frame);
+  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
+
+  table = gtk_table_new (5, 2, FALSE);
+  gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
+
+  label = gtk_label_new(_("Name:"));
+  entry = gtk_entry_new();
+  prop_dialog->attr_name = GTK_ENTRY(entry);
+  g_signal_connect (G_OBJECT (entry), "focus_out_event",
+		    G_CALLBACK (attributes_update_event), umlclass);
+  g_signal_connect (G_OBJECT (entry), "activate",
+		    G_CALLBACK (attributes_update), umlclass);
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 0,1,0,1, GTK_FILL,0, 0,0);
+  gtk_table_attach (GTK_TABLE (table), entry, 1,2,0,1, GTK_FILL | GTK_EXPAND,0, 0,2);
+
+  label = gtk_label_new(_("Type:"));
+  entry = gtk_entry_new();
+  prop_dialog->attr_type = GTK_ENTRY(entry);
+  g_signal_connect (G_OBJECT (entry), "focus_out_event",
+		    G_CALLBACK (attributes_update_event), umlclass);
+  g_signal_connect (G_OBJECT (entry), "activate",
+		    G_CALLBACK (attributes_update), umlclass);
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 0,1,1,2, GTK_FILL,0, 0,0);
+  gtk_table_attach (GTK_TABLE (table), entry, 1,2,1,2, GTK_FILL | GTK_EXPAND,0, 0,2);
+
+  label = gtk_label_new(_("Value:"));
+  entry = gtk_entry_new();
+  prop_dialog->attr_value = GTK_ENTRY(entry);
+  g_signal_connect (G_OBJECT (entry), "focus_out_event",
+		    G_CALLBACK (attributes_update_event), umlclass);
+  g_signal_connect (G_OBJECT (entry), "activate",
+		    G_CALLBACK (attributes_update), umlclass);
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 0,1,2,3, GTK_FILL,0, 0,0);
+  gtk_table_attach (GTK_TABLE (table), entry, 1,2,2,3, GTK_FILL | GTK_EXPAND,0, 0,2);
+
+  label = gtk_label_new(_("Comment:"));
+  scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
+  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow),
+				       GTK_SHADOW_IN);
+  entry = gtk_text_view_new ();
+  prop_dialog->attr_comment = GTK_TEXT_VIEW(entry);
+  gtk_container_add (GTK_CONTAINER (scrolledwindow), entry);
+  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (entry), GTK_WRAP_WORD);
+  gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW (entry),TRUE);
+  g_signal_connect (G_OBJECT (entry), "focus_out_event",
+		    G_CALLBACK (attributes_update_event), umlclass);
+#if 0 /* while the GtkEntry has a "activate" signal, GtkTextView does not.
+       * Maybe we should connect to "set-focus-child" instead? 
+       */
+  g_signal_connect (G_OBJECT (entry), "activate",
+		    G_CALLBACK (attributes_update), umlclass);
+#endif
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 0,1,3,4, GTK_FILL,0, 0,0);
+  gtk_table_attach (GTK_TABLE (table), scrolledwindow, 1,2,3,4, GTK_FILL | GTK_EXPAND,0, 0,2);
+
+
+  label = gtk_label_new(_("Visibility:"));
+
+  prop_dialog->attr_visible = omenu = dia_option_menu_new ();
+  g_signal_connect (G_OBJECT (omenu), "changed",
+		    G_CALLBACK (attributes_update), umlclass);
+  dia_option_menu_add_item(omenu, _("Public"), UML_PUBLIC);
+  dia_option_menu_add_item(omenu, _("Private"), UML_PRIVATE);
+  dia_option_menu_add_item(omenu, _("Protected"), UML_PROTECTED);
+  dia_option_menu_add_item(omenu, _("Implementation"), UML_IMPLEMENTATION);
+
+  { 
+    GtkWidget * align;
+    align = gtk_alignment_new(0.0, 0.5, 0.0, 0.0);
+    gtk_container_add(GTK_CONTAINER(align), omenu);
+    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+    gtk_table_attach (GTK_TABLE (table), label, 0,1,4,5, GTK_FILL,0, 0,3);
+    gtk_table_attach (GTK_TABLE (table), align, 1,2,4,5, GTK_FILL,0, 0,3);
+  }
+
+  hbox2 = gtk_hbox_new(FALSE, 5);
+  checkbox = gtk_check_button_new_with_label(_("Class scope"));
+  prop_dialog->attr_class_scope = GTK_TOGGLE_BUTTON(checkbox);
+  gtk_box_pack_start (GTK_BOX (hbox2), checkbox, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, TRUE, 0);
+  
+  gtk_widget_show(vbox2);
+  
+  gtk_widget_show_all (vbox);
+  gtk_widget_show (page_label);
+  gtk_notebook_append_page(notebook, vbox, page_label);
+  
+}
diff --git a/objects/UML/class_dialog.c b/objects/UML/class_dialog.c
index dbdb361..2910924 100644
--- a/objects/UML/class_dialog.c
+++ b/objects/UML/class_dialog.c
@@ -29,9 +29,7 @@
 **                                                                          **
 **--------------------------------------------------------------------------*/
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include <assert.h>
 #undef GTK_DISABLE_DEPRECATED /* GtkList, ... */
@@ -45,91 +43,8 @@
 #include "class.h"
 #include "diaoptionmenu.h"
 #include "diafontselector.h"
-/**
- * \brief Very special user interface for UMLClass parametrization
- *
- * There is a (too) tight coupling between the UMLClass and it's user interface. 
- * And the dialog is too huge in code as well as on screen.
- */
-struct _UMLClassDialog {
-  GtkWidget *dialog;
-
-  GtkEntry *classname;
-  GtkEntry *stereotype;
-  GtkTextView *comment;
-
-  GtkToggleButton *abstract_class;
-  GtkToggleButton *attr_vis;
-  GtkToggleButton *attr_supp;
-  GtkToggleButton *op_vis;
-  GtkToggleButton *op_supp;
-  GtkToggleButton *comments_vis;
-  GtkToggleButton *op_wrap;
-  DiaFontSelector *normal_font;
-  DiaFontSelector *abstract_font;
-  DiaFontSelector *polymorphic_font;
-  DiaFontSelector *classname_font;
-  DiaFontSelector *abstract_classname_font;
-  DiaFontSelector *comment_font;
-  GtkSpinButton *normal_font_height;
-  GtkSpinButton *abstract_font_height;
-  GtkSpinButton *polymorphic_font_height;
-  GtkSpinButton *classname_font_height;
-  GtkSpinButton *abstract_classname_font_height;
-  GtkSpinButton *comment_font_height;
-  GtkSpinButton *wrap_after_char;  
-  GtkSpinButton *comment_line_length;
-  GtkToggleButton *comment_tagging;
-  GtkSpinButton *line_width;
-  DiaColorSelector *text_color;
-  DiaColorSelector *line_color;
-  DiaColorSelector *fill_color;
-  GtkLabel *max_length_label;
-  GtkLabel *Comment_length_label;
-
-  GList *disconnected_connections;
-  GList *added_connections; 
-  GList *deleted_connections; 
-
-  GtkList *attributes_list;
-  GtkListItem *current_attr;
-  GtkEntry *attr_name;
-  GtkEntry *attr_type;
-  GtkEntry *attr_value;
-  GtkTextView *attr_comment;
-  GtkWidget *attr_visible;
-  GtkToggleButton *attr_class_scope;
-  
-  GtkList *operations_list;
-  GtkListItem *current_op;
-  GtkEntry *op_name;
-  GtkEntry *op_type;
-  GtkEntry *op_stereotype;
-  GtkTextView *op_comment;
-
-  GtkWidget *op_visible;
-  GtkToggleButton *op_class_scope;
-  GtkWidget *op_inheritance_type;
-  GtkToggleButton *op_query;  
-  
-  GtkList *parameters_list;
-  GtkListItem *current_param;
-  GtkEntry *param_name;
-  GtkEntry *param_type;
-  GtkEntry *param_value;
-  GtkTextView *param_comment;
-  GtkWidget *param_kind;
-  GtkWidget *param_new_button;
-  GtkWidget *param_delete_button;
-  GtkWidget *param_up_button;
-  GtkWidget *param_down_button;
-  
-  GtkList *templates_list;
-  GtkListItem *current_templ;
-  GtkToggleButton *templ_template;
-  GtkEntry *templ_name;
-  GtkEntry *templ_type;
-};
+
+#include "class_dialog.h"
 
 /* hide this functionality before rewrite;) */
 void 
@@ -216,12 +131,10 @@ static UMLClassState *umlclass_get_state(UMLClass *umlclass);
 static ObjectChange *new_umlclass_change(UMLClass *obj, UMLClassState *saved_state,
 					 GList *added, GList *deleted,
 					 GList *disconnected);
-static  const gchar *get_comment(GtkTextView *);
-static void set_comment(GtkTextView *, gchar *);
 
 /**** Utility functions ******/
-static void
-umlclass_store_disconnects(UMLClassDialog *prop_dialog,
+void
+_umlclass_store_disconnects(UMLClassDialog *prop_dialog,
 			   ConnectionPoint *cp)
 {
   Disconnect *dis;
@@ -278,7 +191,7 @@ class_read_from_dialog(UMLClass *umlclass, UMLClassDialog *prop_dialog)
   if (umlclass->comment != NULL)
     g_free (umlclass->comment);
 
-  s = get_comment(prop_dialog->comment);
+  s = _class_get_comment(prop_dialog->comment);
   if (s && s[0])
     umlclass->comment = g_strdup (s);
   else
@@ -329,9 +242,9 @@ class_fill_in_dialog(UMLClass *umlclass)
     gtk_entry_set_text(prop_dialog->stereotype, "");
 
   if (umlclass->comment != NULL)
-    set_comment(prop_dialog->comment, umlclass->comment);
+    _class_set_comment(prop_dialog->comment, umlclass->comment);
   else
-    set_comment(prop_dialog->comment, "");
+    _class_set_comment(prop_dialog->comment, "");
 
   gtk_toggle_button_set_active(prop_dialog->abstract_class, umlclass->abstract);
   gtk_toggle_button_set_active(prop_dialog->attr_vis, umlclass->visible_attributes);
@@ -382,2382 +295,247 @@ create_font_props_row (GtkTable   *table,
 
   adj = gtk_adjustment_new (height, 0.1, 10.0, 0.1, 1.0, 0);
   *heightsel = GTK_SPIN_BUTTON (gtk_spin_button_new (GTK_ADJUSTMENT(adj), 1.0, 2));
-  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (*heightsel), TRUE);
-  gtk_table_attach_defaults (table, GTK_WIDGET (*heightsel), 2, 3, row, row+1);
-}
-
-static void 
-class_create_page(GtkNotebook *notebook,  UMLClass *umlclass)
-{
-  UMLClassDialog *prop_dialog;
-  GtkWidget *page_label;
-  GtkWidget *label;
-  GtkWidget *hbox;
-  GtkWidget *hbox2;
-  GtkWidget *vbox;
-  GtkWidget *entry;
-  GtkWidget *scrolledwindow;
-  GtkWidget *checkbox;
-  GtkWidget *table;
-  GtkObject *adj;
-
-  prop_dialog = umlclass->properties_dialog;
-
-  /* Class page: */
-  page_label = gtk_label_new_with_mnemonic (_("_Class"));
-  
-  vbox = gtk_vbox_new(FALSE, 5);
-  gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
-  
-  table = gtk_table_new (3, 2, FALSE);
-  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
-
-  label = gtk_label_new(_("Class name:"));
-  entry = gtk_entry_new();
-  prop_dialog->classname = GTK_ENTRY(entry);
-  gtk_widget_grab_focus(entry);
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0,1,0,1, GTK_FILL,0, 0,0);
-  gtk_table_attach (GTK_TABLE (table), entry, 1,2,0,1, GTK_FILL | GTK_EXPAND,0, 0,2);
-
-  label = gtk_label_new(_("Stereotype:"));
-  entry = gtk_entry_new();
-  prop_dialog->stereotype = GTK_ENTRY(entry);
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0,1,1,2, GTK_FILL,0, 0,0);
-  gtk_table_attach (GTK_TABLE (table), entry, 1,2,1,2, GTK_FILL | GTK_EXPAND,0, 0,2);
-
-  label = gtk_label_new(_("Comment:"));
-  scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
-  gtk_table_attach (GTK_TABLE (table), scrolledwindow, 1, 2, 2, 3,
-		    (GtkAttachOptions) (GTK_FILL),
-		    (GtkAttachOptions) (GTK_FILL), 0, 0);
-  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow),
-				       GTK_SHADOW_IN);
-  entry = gtk_text_view_new ();
-  prop_dialog->comment = GTK_TEXT_VIEW(entry);
-  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (entry), GTK_WRAP_WORD);
- 
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0,1,2,3, GTK_FILL,0, 0,0);
-  gtk_container_add (GTK_CONTAINER (scrolledwindow), entry);
-
-  hbox = gtk_hbox_new(FALSE, 5);
-  checkbox = gtk_check_button_new_with_label(_("Abstract"));
-  prop_dialog->abstract_class = GTK_TOGGLE_BUTTON( checkbox );
-  gtk_box_pack_start (GTK_BOX (hbox), checkbox, TRUE, TRUE, 0);
-  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
-
-  hbox = gtk_hbox_new(FALSE, 5);
-  checkbox = gtk_check_button_new_with_label(_("Attributes visible"));
-  prop_dialog->attr_vis = GTK_TOGGLE_BUTTON( checkbox );
-  gtk_box_pack_start (GTK_BOX (hbox), checkbox, TRUE, TRUE, 0);
-  checkbox = gtk_check_button_new_with_label(_("Suppress Attributes"));
-  prop_dialog->attr_supp = GTK_TOGGLE_BUTTON( checkbox );
-  gtk_box_pack_start (GTK_BOX (hbox), checkbox, TRUE, TRUE, 0);
-  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
-
-  hbox = gtk_hbox_new(FALSE, 5);
-  checkbox = gtk_check_button_new_with_label(_("Operations visible"));
-  prop_dialog->op_vis = GTK_TOGGLE_BUTTON( checkbox );
-  gtk_box_pack_start (GTK_BOX (hbox), checkbox, TRUE, TRUE, 0);
-  checkbox = gtk_check_button_new_with_label(_("Suppress operations"));
-  prop_dialog->op_supp = GTK_TOGGLE_BUTTON( checkbox );
-  gtk_box_pack_start (GTK_BOX (hbox), checkbox, TRUE, TRUE, 0);
-  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
-
-  hbox  = gtk_hbox_new(TRUE, 5);
-  hbox2 = gtk_hbox_new(FALSE, 5);
-  checkbox = gtk_check_button_new_with_label(_("Wrap Operations"));
-  prop_dialog->op_wrap = GTK_TOGGLE_BUTTON( checkbox );
-  gtk_box_pack_start (GTK_BOX (hbox), checkbox, TRUE, TRUE, 0);
-  adj = gtk_adjustment_new( umlclass->wrap_after_char, 0.0, 200.0, 1.0, 5.0, 0);
-  prop_dialog->wrap_after_char = GTK_SPIN_BUTTON(gtk_spin_button_new( GTK_ADJUSTMENT( adj), 0.1, 0));
-  gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( prop_dialog->wrap_after_char), TRUE);
-  gtk_spin_button_set_snap_to_ticks( GTK_SPIN_BUTTON( prop_dialog->wrap_after_char), TRUE);
-  prop_dialog->max_length_label = GTK_LABEL( gtk_label_new( _("Wrap after this length: ")));
-  gtk_box_pack_start (GTK_BOX (hbox2), GTK_WIDGET( prop_dialog->max_length_label), FALSE, TRUE, 0);
-  gtk_box_pack_start (GTK_BOX (hbox2), GTK_WIDGET( prop_dialog->wrap_after_char), TRUE, TRUE, 0);
-  gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET( hbox2), TRUE, TRUE, 0);
-  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
-
-  hbox = gtk_hbox_new(TRUE, 5);
-  hbox2 = gtk_hbox_new(FALSE, 5);
-  checkbox = gtk_check_button_new_with_label(_("Comments visible"));
-  prop_dialog->comments_vis = GTK_TOGGLE_BUTTON( checkbox );
-  gtk_box_pack_start (GTK_BOX (hbox), checkbox, TRUE, TRUE, 0);
-  adj = gtk_adjustment_new( umlclass->comment_line_length, 17.0, 200.0, 1.0, 5.0, 0);
-  prop_dialog->comment_line_length = GTK_SPIN_BUTTON(gtk_spin_button_new( GTK_ADJUSTMENT( adj), 0.1, 0));
-  gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( prop_dialog->comment_line_length), TRUE);
-  gtk_spin_button_set_snap_to_ticks( GTK_SPIN_BUTTON( prop_dialog->comment_line_length), TRUE);
-  prop_dialog->Comment_length_label = GTK_LABEL( gtk_label_new( _("Wrap comment after this length: ")));
-  gtk_box_pack_start (GTK_BOX (hbox2), GTK_WIDGET( prop_dialog->Comment_length_label), FALSE, TRUE, 0);
-  gtk_box_pack_start (GTK_BOX (hbox2), GTK_WIDGET( prop_dialog->comment_line_length), TRUE, TRUE, 0);
-  gtk_box_pack_start (GTK_BOX (hbox),  GTK_WIDGET( hbox2), TRUE, TRUE, 0);
-  gtk_box_pack_start (GTK_BOX (vbox),  hbox, FALSE, TRUE, 0);
-
-  hbox = gtk_hbox_new(FALSE, 5);
-  checkbox = gtk_check_button_new_with_label(_("Show documentation tag"));
-  prop_dialog->comment_tagging = GTK_TOGGLE_BUTTON( checkbox );
-  gtk_box_pack_start (GTK_BOX (hbox), checkbox, TRUE, TRUE, 0);
-  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
-
-  gtk_widget_show_all (vbox);
-  gtk_widget_show (page_label);
-  gtk_notebook_append_page(notebook, vbox, page_label);
-  
-}
-
-
-static void 
-style_create_page(GtkNotebook *notebook,  UMLClass *umlclass)
-{
-  UMLClassDialog *prop_dialog;
-  GtkWidget *page_label;
-  GtkWidget *label;
-  GtkWidget *vbox;
-  GtkWidget *line_width;
-  GtkWidget *text_color;
-  GtkWidget *fill_color;
-  GtkWidget *line_color;
-  GtkWidget *table;
-  GtkObject *adj;
-
-  prop_dialog = umlclass->properties_dialog;
-
-  /** Fonts and Colors selection **/
-  page_label = gtk_label_new_with_mnemonic (_("_Style"));
-  
-  vbox = gtk_vbox_new(FALSE, 5);
-  gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
-  
-  table = gtk_table_new (5, 6, TRUE);
-  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
-  gtk_table_set_homogeneous (GTK_TABLE (table), FALSE);
-
-  /* head line */
-  label = gtk_label_new (_("Kind"));
-                                                    /* L, R, T, B */
-  gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1);
-  label = gtk_label_new (_("Font"));
-  gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 0, 1);
-  label = gtk_label_new (_("Size"));
-  gtk_table_attach_defaults (GTK_TABLE (table), label, 2, 3, 0, 1);
-  
-  /* property rows */
-  create_font_props_row (GTK_TABLE (table), _("Normal"), 1,
-                         umlclass->normal_font,
-                         umlclass->font_height,
-                         &(prop_dialog->normal_font),
-                         &(prop_dialog->normal_font_height));
-  create_font_props_row (GTK_TABLE (table), _("Polymorphic"), 2,
-                         umlclass->polymorphic_font,
-                         umlclass->polymorphic_font_height,
-                         &(prop_dialog->polymorphic_font),
-                         &(prop_dialog->polymorphic_font_height));
-  create_font_props_row (GTK_TABLE (table), _("Abstract"), 3,
-                         umlclass->abstract_font,
-                         umlclass->abstract_font_height,
-                         &(prop_dialog->abstract_font),
-                         &(prop_dialog->abstract_font_height));
-  create_font_props_row (GTK_TABLE (table), _("Class Name"), 4,
-                         umlclass->classname_font,
-                         umlclass->classname_font_height,
-                         &(prop_dialog->classname_font),
-                         &(prop_dialog->classname_font_height));
-  create_font_props_row (GTK_TABLE (table), _("Abstract Class"), 5,
-                         umlclass->abstract_classname_font,
-                         umlclass->abstract_classname_font_height,
-                         &(prop_dialog->abstract_classname_font),
-                         &(prop_dialog->abstract_classname_font_height));
-  create_font_props_row (GTK_TABLE (table), _("Comment"), 6,
-                         umlclass->comment_font,
-                         umlclass->comment_font_height,
-                         &(prop_dialog->comment_font),
-                         &(prop_dialog->comment_font_height));
-
-
-
-  table = gtk_table_new (2, 4, TRUE);
-  gtk_box_pack_start (GTK_BOX (vbox),
-		      table, FALSE, TRUE, 0);
-  /* should probably be refactored too. */
-  label = gtk_label_new(_("Line Width"));
-  gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, 0, 0, 2);
-  adj = gtk_adjustment_new(umlclass->line_width, 0.0, G_MAXFLOAT, 0.1, 1.0, 0);
-  line_width = gtk_spin_button_new (GTK_ADJUSTMENT(adj), 1.0, 2);
-  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (line_width), TRUE);
-  prop_dialog->line_width = GTK_SPIN_BUTTON(line_width);
-  gtk_table_attach (GTK_TABLE (table), line_width, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 3, 2);
-
-  label = gtk_label_new(_("Text Color"));
-  gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, 0, 0, 2);
-  text_color = dia_color_selector_new();
-  dia_color_selector_set_use_alpha (text_color, TRUE);
-  dia_color_selector_set_color(text_color, &umlclass->text_color);
-  prop_dialog->text_color = (DiaColorSelector *)text_color;
-  gtk_table_attach (GTK_TABLE (table), text_color, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 3, 2);
-
-  label = gtk_label_new(_("Foreground Color"));
-  gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, 0, 0, 2);
-  line_color = dia_color_selector_new();
-  dia_color_selector_set_use_alpha (line_color, TRUE);
-  dia_color_selector_set_color(line_color, &umlclass->line_color);
-  prop_dialog->line_color = (DiaColorSelector *)line_color;
-  gtk_table_attach (GTK_TABLE (table), line_color, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, 0, 3, 2);
-  
-  label = gtk_label_new(_("Background Color"));
-  gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4, GTK_EXPAND | GTK_FILL, 0, 0, 2);
-  fill_color = dia_color_selector_new();
-  dia_color_selector_set_color(fill_color, &umlclass->fill_color);
-  prop_dialog->fill_color = (DiaColorSelector *)fill_color;
-  gtk_table_attach (GTK_TABLE (table), fill_color, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, 0, 3, 2);
-
-  gtk_widget_show_all (vbox);
-  gtk_widget_show (page_label);
-  gtk_notebook_append_page(notebook, vbox, page_label);
-  
-}
-
-
-/************************************************************
- ******************** ATTRIBUTES ****************************
- ************************************************************/
-
-static void
-attributes_set_sensitive(UMLClassDialog *prop_dialog, gint val)
-{
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->attr_name), val);
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->attr_type), val);
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->attr_value), val);
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->attr_comment), val);
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->attr_visible), val);
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->attr_class_scope), val);
-}
-
-static void
-attributes_set_values(UMLClassDialog *prop_dialog, UMLAttribute *attr)
-{
-  gtk_entry_set_text(prop_dialog->attr_name, attr->name);
-  gtk_entry_set_text(prop_dialog->attr_type, attr->type);
-  if (attr->value != NULL)
-    gtk_entry_set_text(prop_dialog->attr_value, attr->value);
-  else
-    gtk_entry_set_text(prop_dialog->attr_value, "");
-
-  if (attr->comment != NULL)
-    set_comment(prop_dialog->attr_comment, attr->comment);
-  else
-    set_comment(prop_dialog->attr_comment, "");
-
-
-  dia_option_menu_set_active(prop_dialog->attr_visible, attr->visibility);
-  gtk_toggle_button_set_active(prop_dialog->attr_class_scope, attr->class_scope);
-}
-
-static void
-attributes_clear_values(UMLClassDialog *prop_dialog)
-{
-  gtk_entry_set_text(prop_dialog->attr_name, "");
-  gtk_entry_set_text(prop_dialog->attr_type, "");
-  gtk_entry_set_text(prop_dialog->attr_value, "");
-  set_comment(prop_dialog->attr_comment, "");
-  gtk_toggle_button_set_active(prop_dialog->attr_class_scope, FALSE);
-}
-
-static void
-attributes_get_values (UMLClassDialog *prop_dialog, UMLAttribute *attr)
-{
-  g_free (attr->name);
-  g_free (attr->type);
-  if (attr->value != NULL)
-    g_free (attr->value);
-
-  attr->name = g_strdup (gtk_entry_get_text (prop_dialog->attr_name));
-  attr->type = g_strdup (gtk_entry_get_text (prop_dialog->attr_type));
-  
-  attr->value = g_strdup (gtk_entry_get_text(prop_dialog->attr_value));
-  attr->comment = g_strdup (get_comment(prop_dialog->attr_comment));
-
-  attr->visibility = (UMLVisibility)dia_option_menu_get_active (prop_dialog->attr_visible);
-    
-  attr->class_scope = prop_dialog->attr_class_scope->active;
-}
-
-static void
-attributes_get_current_values(UMLClassDialog *prop_dialog)
-{
-  UMLAttribute *current_attr;
-  GtkLabel *label;
-  char *new_str;
-
-  if (prop_dialog != NULL && prop_dialog->current_attr != NULL) {
-    current_attr = (UMLAttribute *)
-      g_object_get_data(G_OBJECT(prop_dialog->current_attr), "user_data");
-    if (current_attr != NULL) {
-      attributes_get_values(prop_dialog, current_attr);
-      label = GTK_LABEL(GTK_BIN(prop_dialog->current_attr)->child);
-      new_str = uml_get_attribute_string(current_attr);
-      gtk_label_set_text (label, new_str);
-      g_free (new_str);
-    }
-  }
-}
-
-static void
-attribute_list_item_destroy_callback(GtkWidget *list_item,
-				     gpointer data)
-{
-  UMLAttribute *attr;
-
-  attr = (UMLAttribute *) g_object_get_data(G_OBJECT(list_item), "user_data");
-
-  if (attr != NULL) {
-    uml_attribute_destroy(attr);
-    /*printf("Destroying list_item's user_data!\n");*/
-  }
-}
-
-static void
-attributes_list_selection_changed_callback(GtkWidget *gtklist,
-					   UMLClass *umlclass)
-{
-  GList *list;
-  UMLClassDialog *prop_dialog;
-  GtkObject *list_item;
-  UMLAttribute *attr;
-
-  /* Due to GtkList oddities, this may get called during destroy.
-   * But it'll reference things that are already dead and crash.
-   * Thus, we stop it before it gets that bad.  See bug #156706 for
-   * one example.
-   */
-  if (umlclass->destroyed)
-    return;
-
-  prop_dialog = umlclass->properties_dialog;
-
-  if (!prop_dialog)
-    return;
-
-  attributes_get_current_values(prop_dialog);
-  
-  list = GTK_LIST(gtklist)->selection;
-  if (!list && prop_dialog) { /* No selected */
-    attributes_set_sensitive(prop_dialog, FALSE);
-    attributes_clear_values(prop_dialog);
-    prop_dialog->current_attr = NULL;
-    return;
-  }
-  
-  list_item = GTK_OBJECT(list->data);
-  attr = (UMLAttribute *)g_object_get_data(G_OBJECT(list_item), "user_data");
-  attributes_set_values(prop_dialog, attr);
-  attributes_set_sensitive(prop_dialog, TRUE);
-
-  prop_dialog->current_attr = GTK_LIST_ITEM(list_item);
-  gtk_widget_grab_focus(GTK_WIDGET(prop_dialog->attr_name));
-}
-
-static void
-attributes_list_new_callback(GtkWidget *button,
-			     UMLClass *umlclass)
-{
-  GList *list;
-  UMLClassDialog *prop_dialog;
-  GtkWidget *list_item;
-  UMLAttribute *attr;
-  char *utfstr;
-  prop_dialog = umlclass->properties_dialog;
-
-  attributes_get_current_values(prop_dialog);
-
-  attr = uml_attribute_new();
-  /* need to make the new ConnectionPoint valid and remember them */
-  uml_attribute_ensure_connection_points (attr, &umlclass->element.object);
-  prop_dialog->added_connections = 
-    g_list_prepend(prop_dialog->added_connections, attr->left_connection);
-  prop_dialog->added_connections = 
-    g_list_prepend(prop_dialog->added_connections, attr->right_connection);
-
-  utfstr = uml_get_attribute_string (attr);
-  list_item = gtk_list_item_new_with_label (utfstr);
-  gtk_widget_show (list_item);
-  g_free (utfstr);
-
-  g_object_set_data(G_OBJECT(list_item), "user_data", attr);
-  g_signal_connect (G_OBJECT (list_item), "destroy",
-		    G_CALLBACK (attribute_list_item_destroy_callback), NULL);
-  
-  list = g_list_append(NULL, list_item);
-  gtk_list_append_items(prop_dialog->attributes_list, list);
-
-  if (prop_dialog->attributes_list->children != NULL)
-    gtk_list_unselect_child(prop_dialog->attributes_list,
-			    GTK_WIDGET(prop_dialog->attributes_list->children->data));
-  gtk_list_select_child(prop_dialog->attributes_list, list_item);
-}
-
-static void
-attributes_list_delete_callback(GtkWidget *button,
-				UMLClass *umlclass)
-{
-  GList *list;
-  UMLClassDialog *prop_dialog;
-  GtkList *gtklist;
-  UMLAttribute *attr;
-
-  prop_dialog = umlclass->properties_dialog;
-  gtklist = GTK_LIST(prop_dialog->attributes_list);
-
-  if (gtklist->selection != NULL) {
-    attr = (UMLAttribute *)
-      g_object_get_data(G_OBJECT(gtklist->selection->data), "user_data");
-
-    if (attr->left_connection != NULL) {
-      prop_dialog->deleted_connections =
-	g_list_prepend(prop_dialog->deleted_connections,
-		       attr->left_connection);
-      prop_dialog->deleted_connections =
-	g_list_prepend(prop_dialog->deleted_connections,
-		       attr->right_connection);
-    }
-    
-    list = g_list_prepend(NULL, gtklist->selection->data);
-    gtk_list_remove_items(gtklist, list);
-    g_list_free(list);
-    attributes_clear_values(prop_dialog);
-    attributes_set_sensitive(prop_dialog, FALSE);
-  }
-}
-
-static void
-attributes_list_move_up_callback(GtkWidget *button,
-				 UMLClass *umlclass)
-{
-  GList *list;
-  UMLClassDialog *prop_dialog;
-  GtkList *gtklist;
-  GtkWidget *list_item;
-  int i;
-  
-  prop_dialog = umlclass->properties_dialog;
-  gtklist = GTK_LIST(prop_dialog->attributes_list);
-
-  if (gtklist->selection != NULL) {
-    list_item = GTK_WIDGET(gtklist->selection->data);
-    
-    i = gtk_list_child_position(gtklist, list_item);
-    if (i>0)
-      i--;
-
-    g_object_ref(list_item);
-    list = g_list_prepend(NULL, list_item);
-    gtk_list_remove_items(gtklist, list);
-    gtk_list_insert_items(gtklist, list, i);
-    g_object_unref(list_item);
-
-    gtk_list_select_child(gtklist, list_item);
-  }
-}
-
-static void
-attributes_list_move_down_callback(GtkWidget *button,
-				   UMLClass *umlclass)
-{
-  GList *list;
-  UMLClassDialog *prop_dialog;
-  GtkList *gtklist;
-  GtkWidget *list_item;
-  int i;
-
-  prop_dialog = umlclass->properties_dialog;
-  gtklist = GTK_LIST(prop_dialog->attributes_list);
-
-  if (gtklist->selection != NULL) {
-    list_item = GTK_WIDGET(gtklist->selection->data);
-    
-    i = gtk_list_child_position(gtklist, list_item);
-    if (i<(g_list_length(gtklist->children)-1))
-      i++;
-
-    
-    g_object_ref(list_item);
-    list = g_list_prepend(NULL, list_item);
-    gtk_list_remove_items(gtklist, list);
-    gtk_list_insert_items(gtklist, list, i);
-    g_object_unref(list_item);
-
-    gtk_list_select_child(gtklist, list_item);
-  }
-}
-
-static void
-attributes_read_from_dialog(UMLClass *umlclass,
-			    UMLClassDialog *prop_dialog,
-			    int connection_index)
-{
-  GList *list;
-  UMLAttribute *attr;
-  GtkWidget *list_item;
-  GList *clear_list;
-  DiaObject *obj;
-
-  obj = &umlclass->element.object;
-
-  /* if the currently select attribute is changed, update the state in the
-   * dialog info from widgets */
-  attributes_get_current_values(prop_dialog);
-  /* Free current attributes: */
-  list = umlclass->attributes;
-  while (list != NULL) {
-    attr = (UMLAttribute *)list->data;
-    uml_attribute_destroy(attr);
-    list = g_list_next(list);
-  }
-  g_list_free (umlclass->attributes);
-  umlclass->attributes = NULL;
-
-  /* Insert new attributes and remove them from gtklist: */
-  list = GTK_LIST (prop_dialog->attributes_list)->children;
-  clear_list = NULL;
-  while (list != NULL) {
-    list_item = GTK_WIDGET(list->data);
-    
-    clear_list = g_list_prepend (clear_list, list_item);
-    attr = (UMLAttribute *)
-      g_object_get_data(G_OBJECT(list_item), "user_data");
-    g_object_set_data(G_OBJECT(list_item), "user_data", NULL);
-    umlclass->attributes = g_list_append(umlclass->attributes, attr);
-    
-    if (attr->left_connection == NULL) {
-      uml_attribute_ensure_connection_points (attr, obj);
-
-      prop_dialog->added_connections =
-	g_list_prepend(prop_dialog->added_connections,
-		       attr->left_connection);
-      prop_dialog->added_connections =
-	g_list_prepend(prop_dialog->added_connections,
-		       attr->right_connection);
-    }
-
-    if ( (prop_dialog->attr_vis->active) &&
-	 (!prop_dialog->attr_supp->active) ) { 
-      obj->connections[connection_index] = attr->left_connection;
-      connection_index++;
-      obj->connections[connection_index] = attr->right_connection;
-      connection_index++;
-    } else {
-      umlclass_store_disconnects(prop_dialog, attr->left_connection);
-      object_remove_connections_to(attr->left_connection);
-      umlclass_store_disconnects(prop_dialog, attr->right_connection);
-      object_remove_connections_to(attr->right_connection);
-    }
-
-    list = g_list_next(list);
-  }
-  clear_list = g_list_reverse (clear_list);
-  gtk_list_remove_items (GTK_LIST (prop_dialog->attributes_list), clear_list);
-  g_list_free (clear_list);
-
-#if 0 /* UMLClass is *known* to be in an incositent state here, check later or crash ... */
-  umlclass_sanity_check(umlclass, "Read from dialog");
-#endif
-}
-
-static void
-attributes_fill_in_dialog(UMLClass *umlclass)
-{
-  UMLClassDialog *prop_dialog;
-  UMLAttribute *attr_copy;
-  GtkWidget *list_item;
-  GList *list;
-  int i;
-
-#ifdef DEBUG
-  umlclass_sanity_check(umlclass, "Filling in dialog");  
-#endif
-
-  prop_dialog = umlclass->properties_dialog;
-
-  /* copy in new attributes: */
-  if (prop_dialog->attributes_list->children == NULL) {
-    i = 0;
-    list = umlclass->attributes;
-    while (list != NULL) {
-      UMLAttribute *attr = (UMLAttribute *)list->data;
-      gchar *attrstr = uml_get_attribute_string(attr);
-
-      list_item = gtk_list_item_new_with_label (attrstr);
-      attr_copy = uml_attribute_copy(attr);
-      /* looks wrong but required for complicated ConnectionPoint memory management */
-      attr_copy->left_connection = attr->left_connection;
-      attr_copy->right_connection = attr->right_connection;
-      g_object_set_data(G_OBJECT(list_item), "user_data", (gpointer) attr_copy);
-      g_signal_connect (G_OBJECT (list_item), "destroy",
-			G_CALLBACK (attribute_list_item_destroy_callback), NULL);
-      gtk_container_add (GTK_CONTAINER (prop_dialog->attributes_list), list_item);
-      gtk_widget_show (list_item);
-      
-      list = g_list_next(list); i++;
-      g_free (attrstr);
-    }
-    /* set attributes non-sensitive */
-    prop_dialog->current_attr = NULL;
-    attributes_set_sensitive(prop_dialog, FALSE);
-    attributes_clear_values(prop_dialog);
-  }
-}
-
-static void
-attributes_update(GtkWidget *widget, UMLClass *umlclass)
-{
-  attributes_get_current_values(umlclass->properties_dialog);
-}
-
-static int
-attributes_update_event(GtkWidget *widget, GdkEventFocus *ev, UMLClass *umlclass)
-{
-  attributes_get_current_values(umlclass->properties_dialog);
-  return 0;
-}
-
-static void 
-attributes_create_page(GtkNotebook *notebook,  UMLClass *umlclass)
-{
-  UMLClassDialog *prop_dialog;
-  GtkWidget *page_label;
-  GtkWidget *label;
-  GtkWidget *hbox;
-  GtkWidget *vbox;
-  GtkWidget *vbox2;
-  GtkWidget *hbox2;
-  GtkWidget *table;
-  GtkWidget *entry;
-  GtkWidget *checkbox;
-  GtkWidget *scrolled_win;
-  GtkWidget *button;
-  GtkWidget *list;
-  GtkWidget *frame;
-  GtkWidget *omenu;
-  GtkWidget *scrolledwindow;
-
-  prop_dialog = umlclass->properties_dialog;
-
-  /* Attributes page: */
-  page_label = gtk_label_new_with_mnemonic (_("_Attributes"));
-  
-  vbox = gtk_vbox_new(FALSE, 5);
-  gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
-
-  hbox = gtk_hbox_new(FALSE, 5);
-  
-  scrolled_win = gtk_scrolled_window_new (NULL, NULL);
-  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
-				  GTK_POLICY_AUTOMATIC, 
-				  GTK_POLICY_AUTOMATIC);
-  gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
-  gtk_widget_show (scrolled_win);
-
-  list = gtk_list_new ();
-  prop_dialog->attributes_list = GTK_LIST(list);
-  gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_SINGLE);
-  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), list);
-  gtk_container_set_focus_vadjustment (GTK_CONTAINER (list),
-				       gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_win)));
-  gtk_widget_show (list);
-
-  g_signal_connect (G_OBJECT (list), "selection_changed",
-		    G_CALLBACK(attributes_list_selection_changed_callback), umlclass);
-
-  vbox2 = gtk_vbox_new(FALSE, 5);
-
-  button = gtk_button_new_from_stock (GTK_STOCK_NEW);
-  g_signal_connect (G_OBJECT (button), "clicked",
-		    G_CALLBACK(attributes_list_new_callback), umlclass);
-  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
-  gtk_widget_show (button);
-  button = gtk_button_new_from_stock (GTK_STOCK_DELETE);
-  g_signal_connect (G_OBJECT (button), "clicked",
-		    G_CALLBACK(attributes_list_delete_callback), umlclass);
-  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
-  gtk_widget_show (button);
-  button = gtk_button_new_from_stock (GTK_STOCK_GO_UP);
-  g_signal_connect (G_OBJECT (button), "clicked",
-		    G_CALLBACK(attributes_list_move_up_callback), umlclass);
-  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
-  gtk_widget_show (button);
-  button = gtk_button_new_from_stock (GTK_STOCK_GO_DOWN);
-  g_signal_connect (G_OBJECT (button), "clicked",
-		    G_CALLBACK(attributes_list_move_down_callback), umlclass);
-  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
-  gtk_widget_show (button);
-
-  gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, TRUE, 0);
-
-  gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
-
-  frame = gtk_frame_new(_("Attribute data"));
-  vbox2 = gtk_vbox_new(FALSE, 5);
-  gtk_container_set_border_width (GTK_CONTAINER (vbox2), 10);
-  gtk_container_add (GTK_CONTAINER (frame), vbox2);
-  gtk_widget_show(frame);
-  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
-
-  table = gtk_table_new (5, 2, FALSE);
-  gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
-
-  label = gtk_label_new(_("Name:"));
-  entry = gtk_entry_new();
-  prop_dialog->attr_name = GTK_ENTRY(entry);
-  g_signal_connect (G_OBJECT (entry), "focus_out_event",
-		    G_CALLBACK (attributes_update_event), umlclass);
-  g_signal_connect (G_OBJECT (entry), "activate",
-		    G_CALLBACK (attributes_update), umlclass);
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0,1,0,1, GTK_FILL,0, 0,0);
-  gtk_table_attach (GTK_TABLE (table), entry, 1,2,0,1, GTK_FILL | GTK_EXPAND,0, 0,2);
-
-  label = gtk_label_new(_("Type:"));
-  entry = gtk_entry_new();
-  prop_dialog->attr_type = GTK_ENTRY(entry);
-  g_signal_connect (G_OBJECT (entry), "focus_out_event",
-		    G_CALLBACK (attributes_update_event), umlclass);
-  g_signal_connect (G_OBJECT (entry), "activate",
-		    G_CALLBACK (attributes_update), umlclass);
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0,1,1,2, GTK_FILL,0, 0,0);
-  gtk_table_attach (GTK_TABLE (table), entry, 1,2,1,2, GTK_FILL | GTK_EXPAND,0, 0,2);
-
-  label = gtk_label_new(_("Value:"));
-  entry = gtk_entry_new();
-  prop_dialog->attr_value = GTK_ENTRY(entry);
-  g_signal_connect (G_OBJECT (entry), "focus_out_event",
-		    G_CALLBACK (attributes_update_event), umlclass);
-  g_signal_connect (G_OBJECT (entry), "activate",
-		    G_CALLBACK (attributes_update), umlclass);
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0,1,2,3, GTK_FILL,0, 0,0);
-  gtk_table_attach (GTK_TABLE (table), entry, 1,2,2,3, GTK_FILL | GTK_EXPAND,0, 0,2);
-
-  label = gtk_label_new(_("Comment:"));
-  scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
-  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow),
-				       GTK_SHADOW_IN);
-  entry = gtk_text_view_new ();
-  prop_dialog->attr_comment = GTK_TEXT_VIEW(entry);
-  gtk_container_add (GTK_CONTAINER (scrolledwindow), entry);
-  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (entry), GTK_WRAP_WORD);
-  gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW (entry),TRUE);
-  g_signal_connect (G_OBJECT (entry), "focus_out_event",
-		    G_CALLBACK (attributes_update_event), umlclass);
-#if 0 /* while the GtkEntry has a "activate" signal, GtkTextView does not.
-       * Maybe we should connect to "set-focus-child" instead? 
-       */
-  g_signal_connect (G_OBJECT (entry), "activate",
-		    G_CALLBACK (attributes_update), umlclass);
-#endif
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0,1,3,4, GTK_FILL,0, 0,0);
-  gtk_table_attach (GTK_TABLE (table), scrolledwindow, 1,2,3,4, GTK_FILL | GTK_EXPAND,0, 0,2);
-
-
-  label = gtk_label_new(_("Visibility:"));
-
-  prop_dialog->attr_visible = omenu = dia_option_menu_new ();
-  g_signal_connect (G_OBJECT (omenu), "changed",
-		    G_CALLBACK (attributes_update), umlclass);
-  dia_option_menu_add_item(omenu, _("Public"), UML_PUBLIC);
-  dia_option_menu_add_item(omenu, _("Private"), UML_PRIVATE);
-  dia_option_menu_add_item(omenu, _("Protected"), UML_PROTECTED);
-  dia_option_menu_add_item(omenu, _("Implementation"), UML_IMPLEMENTATION);
-
-  { 
-    GtkWidget * align;
-    align = gtk_alignment_new(0.0, 0.5, 0.0, 0.0);
-    gtk_container_add(GTK_CONTAINER(align), omenu);
-    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-    gtk_table_attach (GTK_TABLE (table), label, 0,1,4,5, GTK_FILL,0, 0,3);
-    gtk_table_attach (GTK_TABLE (table), align, 1,2,4,5, GTK_FILL,0, 0,3);
-  }
-
-  hbox2 = gtk_hbox_new(FALSE, 5);
-  checkbox = gtk_check_button_new_with_label(_("Class scope"));
-  prop_dialog->attr_class_scope = GTK_TOGGLE_BUTTON(checkbox);
-  gtk_box_pack_start (GTK_BOX (hbox2), checkbox, TRUE, TRUE, 0);
-  gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, TRUE, 0);
-  
-  gtk_widget_show(vbox2);
-  
-  gtk_widget_show_all (vbox);
-  gtk_widget_show (page_label);
-  gtk_notebook_append_page(notebook, vbox, page_label);
-  
-}
-
-/*************************************************************
- ******************** OPERATIONS *****************************
- *************************************************************/
-
-/* Forward declaration: */
-static void operations_get_current_values(UMLClassDialog *prop_dialog);
-
-static void
-parameters_set_sensitive(UMLClassDialog *prop_dialog, gint val)
-{
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->param_name), val);
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->param_type), val);
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->param_value), val);
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->param_comment), val);
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->param_kind), val);
-}
-
-static void
-parameters_set_values(UMLClassDialog *prop_dialog, UMLParameter *param)
-{
-  gtk_entry_set_text(prop_dialog->param_name, param->name);
-  gtk_entry_set_text(prop_dialog->param_type, param->type);
-  if (param->value != NULL)
-    gtk_entry_set_text(prop_dialog->param_value, param->value);
-  else
-    gtk_entry_set_text(prop_dialog->param_value, "");
-  if (param->comment != NULL)
-    set_comment(prop_dialog->param_comment, param->comment);
-  else
-    set_comment(prop_dialog->param_comment, "");
-
-  dia_option_menu_set_active(prop_dialog->param_kind, param->kind);
-}
-
-static void
-parameters_clear_values(UMLClassDialog *prop_dialog)
-{
-  gtk_entry_set_text(prop_dialog->param_name, "");
-  gtk_entry_set_text(prop_dialog->param_type, "");
-  gtk_entry_set_text(prop_dialog->param_value, "");
-  set_comment(prop_dialog->param_comment, "");
-  dia_option_menu_set_active(prop_dialog->param_kind, UML_UNDEF_KIND);
-
-}
-
-static void
-parameters_get_values (UMLClassDialog *prop_dialog, UMLParameter *param)
-{
-  g_free(param->name);
-  g_free(param->type);
-  g_free(param->comment);
-  if (param->value != NULL)
-    g_free(param->value);
-  
-  param->name = g_strdup (gtk_entry_get_text (prop_dialog->param_name));
-  param->type = g_strdup (gtk_entry_get_text (prop_dialog->param_type));
-  
-  param->value = g_strdup (gtk_entry_get_text(prop_dialog->param_value));
-  param->comment = g_strdup (get_comment(prop_dialog->param_comment));
-
-  param->kind = (UMLParameterKind) dia_option_menu_get_active(prop_dialog->param_kind);
-}
-
-static void
-parameters_get_current_values(UMLClassDialog *prop_dialog)
-{
-  UMLParameter *current_param;
-  GtkLabel *label;
-  char *new_str;
-
-  if (prop_dialog->current_param != NULL) {
-    current_param = (UMLParameter *)
-      g_object_get_data(G_OBJECT(prop_dialog->current_param), "user_data");
-    if (current_param != NULL) {
-      parameters_get_values(prop_dialog, current_param);
-      label = GTK_LABEL(GTK_BIN(prop_dialog->current_param)->child);
-      new_str = uml_get_parameter_string(current_param);
-      gtk_label_set_text(label, new_str);
-      g_free(new_str);
-    }
-  }
-}
-
-
-static void
-parameters_list_selection_changed_callback(GtkWidget *gtklist,
-					   UMLClass *umlclass)
-{
-  GList *list;
-  UMLClassDialog *prop_dialog;
-  GtkObject *list_item;
-  UMLParameter *param;
-
-  prop_dialog = umlclass->properties_dialog;
-
-  if (!prop_dialog)
-    return; /* maybe hiding a bug elsewhere */
-
-  parameters_get_current_values(prop_dialog);
-  
-  list = GTK_LIST(gtklist)->selection;
-  if (!list) { /* No selected */
-    parameters_set_sensitive(prop_dialog, FALSE);
-    parameters_clear_values(prop_dialog);
-    prop_dialog->current_param = NULL;
-    return;
-  }
-  
-  list_item = GTK_OBJECT(list->data);
-  param = (UMLParameter *)g_object_get_data(G_OBJECT(list_item), "user_data");
-  parameters_set_values(prop_dialog, param);
-  parameters_set_sensitive(prop_dialog, TRUE);
-
-  prop_dialog->current_param = GTK_LIST_ITEM(list_item);
-  gtk_widget_grab_focus(GTK_WIDGET(prop_dialog->param_name));
-}
-
-static void
-parameters_list_new_callback(GtkWidget *button,
-			     UMLClass *umlclass)
-{
-  GList *list;
-  UMLClassDialog *prop_dialog;
-  GtkWidget *list_item;
-  UMLOperation *current_op;
-  UMLParameter *param;
-  char *utf;
-
-  prop_dialog = umlclass->properties_dialog;
-
-  parameters_get_current_values(prop_dialog);
-
-  current_op = (UMLOperation *)
-    g_object_get_data(G_OBJECT(prop_dialog->current_op), "user_data");
-  
-  param = uml_parameter_new();
-
-  utf = uml_get_parameter_string (param);
-  list_item = gtk_list_item_new_with_label (utf);
-  gtk_widget_show (list_item);
-  g_free (utf);
-
-  g_object_set_data(G_OBJECT(list_item), "user_data", param);
-
-  current_op->parameters = g_list_append(current_op->parameters,
-					 (gpointer) param);
-  
-  list = g_list_append(NULL, list_item);
-  gtk_list_append_items(prop_dialog->parameters_list, list);
-
-  if (prop_dialog->parameters_list->children != NULL)
-    gtk_list_unselect_child(prop_dialog->parameters_list,
-			    GTK_WIDGET(prop_dialog->parameters_list->children->data));
-  gtk_list_select_child(prop_dialog->parameters_list, list_item);
-
-  prop_dialog->current_param = GTK_LIST_ITEM(list_item);
-}
-
-static void
-parameters_list_delete_callback(GtkWidget *button,
-				UMLClass *umlclass)
-{
-  GList *list;
-  UMLClassDialog *prop_dialog;
-  GtkList *gtklist;
-  UMLOperation *current_op;
-  UMLParameter *param;
-  
-  prop_dialog = umlclass->properties_dialog;
-  gtklist = GTK_LIST(prop_dialog->parameters_list);
-
-
-  if (gtklist->selection != NULL) {
-    /* Remove from current operations parameter list: */
-    current_op = (UMLOperation *)
-      g_object_get_data(G_OBJECT(prop_dialog->current_op), "user_data");
-    param = (UMLParameter *)
-      g_object_get_data(G_OBJECT(prop_dialog->current_param), "user_data");
-    
-    current_op->parameters = g_list_remove(current_op->parameters,
-					   (gpointer) param);
-    uml_parameter_destroy(param);
-    
-    /* Remove from gtk list: */
-    list = g_list_prepend(NULL, prop_dialog->current_param);
-
-    prop_dialog->current_param = NULL;
-
-    gtk_list_remove_items(gtklist, list);
-    g_list_free(list);
-  }
-}
-
-static void
-parameters_list_move_up_callback(GtkWidget *button,
-				 UMLClass *umlclass)
-{
-  GList *list;
-  UMLClassDialog *prop_dialog;
-  GtkList *gtklist;
-  GtkWidget *list_item;
-  UMLOperation *current_op;
-  UMLParameter *param;
-  int i;
-  
-  prop_dialog = umlclass->properties_dialog;
-  gtklist = GTK_LIST(prop_dialog->parameters_list);
-
-  if (gtklist->selection != NULL) {
-    list_item = GTK_WIDGET(gtklist->selection->data);
-    
-    i = gtk_list_child_position(gtklist, list_item);
-    if (i>0)
-      i--;
-
-    param = (UMLParameter *) g_object_get_data(G_OBJECT(list_item), "user_data");
-
-    /* Move parameter in current operations list: */
-    current_op = (UMLOperation *)
-      g_object_get_data(G_OBJECT(prop_dialog->current_op), "user_data");
-    
-    current_op->parameters = g_list_remove(current_op->parameters,
-					   (gpointer) param);
-    current_op->parameters = g_list_insert(current_op->parameters,
-					   (gpointer) param,
-					   i);
-
-    /* Move parameter in gtk list: */
-    g_object_ref(list_item);
-    list = g_list_prepend(NULL, list_item);
-    gtk_list_remove_items(gtklist, list);
-    gtk_list_insert_items(gtklist, list, i);
-    g_object_unref(list_item);
-
-    gtk_list_select_child(gtklist, list_item);
-
-    operations_get_current_values(prop_dialog);
-  }
-}
-
-static void
-parameters_list_move_down_callback(GtkWidget *button,
-				   UMLClass *umlclass)
-{
-  GList *list;
-  UMLClassDialog *prop_dialog;
-  GtkList *gtklist;
-  GtkWidget *list_item;
-  UMLOperation *current_op;
-  UMLParameter *param;
-  int i;
-  
-  prop_dialog = umlclass->properties_dialog;
-  gtklist = GTK_LIST(prop_dialog->parameters_list);
-
-  if (gtklist->selection != NULL) {
-    list_item = GTK_WIDGET(gtklist->selection->data);
-    
-    i = gtk_list_child_position(gtklist, list_item);
-    if (i<(g_list_length(gtklist->children)-1))
-      i++;
-
-    param = (UMLParameter *) g_object_get_data(G_OBJECT(list_item), "user_data");
-
-    /* Move parameter in current operations list: */
-    current_op = (UMLOperation *)
-      g_object_get_data(G_OBJECT(prop_dialog->current_op), "user_data");
-    
-    current_op->parameters = g_list_remove(current_op->parameters,
-					   (gpointer) param);
-    current_op->parameters = g_list_insert(current_op->parameters,
-					   (gpointer) param,
-					   i);
-
-    /* Move parameter in gtk list: */
-    g_object_ref(list_item);
-    list = g_list_prepend(NULL, list_item);
-    gtk_list_remove_items(gtklist, list);
-    gtk_list_insert_items(gtklist, list, i);
-    g_object_unref(list_item);
-
-    gtk_list_select_child(gtklist, list_item);
-
-    operations_get_current_values(prop_dialog);
-  }
-}
-
-static void
-operations_set_sensitive(UMLClassDialog *prop_dialog, gint val)
-{
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->op_name), val);
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->op_type), val);
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->op_stereotype), val);
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->op_comment), val);
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->op_visible), val);
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->op_class_scope), val);
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->op_inheritance_type), val);
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->op_query), val);
-
-  gtk_widget_set_sensitive(prop_dialog->param_new_button, val);
-  gtk_widget_set_sensitive(prop_dialog->param_delete_button, val);
-  gtk_widget_set_sensitive(prop_dialog->param_down_button, val);
-  gtk_widget_set_sensitive(prop_dialog->param_up_button, val);
-}
-
-static void
-operations_set_values(UMLClassDialog *prop_dialog, UMLOperation *op)
-{
-  GList *list;
-  UMLParameter *param;
-  GtkWidget *list_item;
-  gchar *str;
-
-  gtk_entry_set_text(prop_dialog->op_name, op->name);
-  if (op->type != NULL)
-    gtk_entry_set_text(prop_dialog->op_type, op->type);
-  else
-    gtk_entry_set_text(prop_dialog->op_type, "");
-
-  if (op->stereotype != NULL)
-    gtk_entry_set_text(prop_dialog->op_stereotype, op->stereotype);
-  else
-    gtk_entry_set_text(prop_dialog->op_stereotype, "");
-
-  if (op->comment != NULL)
-    set_comment(prop_dialog->op_comment, op->comment);
-  else
-    set_comment(prop_dialog->op_comment, "");
-
-  dia_option_menu_set_active(prop_dialog->op_visible, op->visibility);
-  gtk_toggle_button_set_active(prop_dialog->op_class_scope, op->class_scope);
-  gtk_toggle_button_set_active(prop_dialog->op_query, op->query);
-  dia_option_menu_set_active(prop_dialog->op_inheritance_type, op->inheritance_type);
-
-  gtk_list_clear_items(prop_dialog->parameters_list, 0, -1);
-  prop_dialog->current_param = NULL;
-  parameters_set_sensitive(prop_dialog, FALSE);
-
-  list = op->parameters;
-  while (list != NULL) {
-    param = (UMLParameter *)list->data;
-
-    str = uml_get_parameter_string (param);
-    list_item = gtk_list_item_new_with_label (str);
-    g_free (str);
-
-    g_object_set_data(G_OBJECT(list_item), "user_data", (gpointer) param);
-    gtk_container_add (GTK_CONTAINER (prop_dialog->parameters_list), list_item);
-    gtk_widget_show (list_item);
-    
-    list = g_list_next(list);
-  }
-}
-
-static void
-operations_clear_values(UMLClassDialog *prop_dialog)
-{
-  gtk_entry_set_text(prop_dialog->op_name, "");
-  gtk_entry_set_text(prop_dialog->op_type, "");
-  gtk_entry_set_text(prop_dialog->op_stereotype, "");
-  set_comment(prop_dialog->op_comment, "");
-  gtk_toggle_button_set_active(prop_dialog->op_class_scope, FALSE);
-  gtk_toggle_button_set_active(prop_dialog->op_query, FALSE);
-
-  gtk_list_clear_items(prop_dialog->parameters_list, 0, -1);
-  prop_dialog->current_param = NULL;
-  parameters_set_sensitive(prop_dialog, FALSE);
-}
-
-
-static void
-operations_get_values(UMLClassDialog *prop_dialog, UMLOperation *op)
-{
-  const gchar *s;
-
-  g_free(op->name);
-  if (op->type != NULL)
-	  g_free(op->type);
-
-  op->name = g_strdup(gtk_entry_get_text(prop_dialog->op_name));
-  op->type = g_strdup (gtk_entry_get_text(prop_dialog->op_type));
-  op->comment = g_strdup(get_comment(prop_dialog->op_comment));
-
-  s = gtk_entry_get_text(prop_dialog->op_stereotype);
-  if (s && s[0])
-    op->stereotype = g_strdup (s);
-  else
-    op->stereotype = NULL;
-
-  op->visibility = (UMLVisibility)dia_option_menu_get_active(prop_dialog->op_visible);
-    
-  op->class_scope = prop_dialog->op_class_scope->active;
-  op->inheritance_type = (UMLInheritanceType)dia_option_menu_get_active(prop_dialog->op_inheritance_type);
-
-  op->query = prop_dialog->op_query->active;
-
-}
-
-static void
-operations_get_current_values(UMLClassDialog *prop_dialog)
-{
-  UMLOperation *current_op;
-  GtkLabel *label;
-  char *new_str;
-
-  parameters_get_current_values(prop_dialog);
-
-  if (prop_dialog->current_op != NULL) {
-    current_op = (UMLOperation *)
-      g_object_get_data(G_OBJECT(prop_dialog->current_op), "user_data");
-    if (current_op != NULL) {
-      operations_get_values(prop_dialog, current_op);
-      label = GTK_LABEL(GTK_BIN(prop_dialog->current_op)->child);
-      new_str = uml_get_operation_string(current_op);
-      gtk_label_set_text (label, new_str);
-      g_free (new_str);
-    }
-  }
-}
-
-static void
-operations_list_item_destroy_callback(GtkWidget *list_item,
-				      gpointer data)
-{
-  UMLOperation *op;
-
-  op = (UMLOperation *) g_object_get_data(G_OBJECT(list_item), "user_data");
-
-  if (op != NULL) {
-    uml_operation_destroy(op);
-    /*printf("Destroying operation list_item's user_data!\n");*/
-  }
-}
-
-static void
-operations_list_selection_changed_callback(GtkWidget *gtklist,
-					   UMLClass *umlclass)
-{
-  GList *list;
-  UMLClassDialog *prop_dialog;
-  GtkObject *list_item;
-  UMLOperation *op;
-
-  prop_dialog = umlclass->properties_dialog;
-
-  if (!prop_dialog)
-    return; /* maybe hiding a bug elsewhere */
-
-  operations_get_current_values(prop_dialog);
-  
-  list = GTK_LIST(gtklist)->selection;
-  if (!list) { /* No selected */
-    operations_set_sensitive(prop_dialog, FALSE);
-    operations_clear_values(prop_dialog);
-    prop_dialog->current_op = NULL;
-    return;
-  }
-  
-  list_item = GTK_OBJECT(list->data);
-  op = (UMLOperation *)g_object_get_data(G_OBJECT(list_item), "user_data");
-  operations_set_values(prop_dialog, op);
-  operations_set_sensitive(prop_dialog, TRUE);
-
-  prop_dialog->current_op = GTK_LIST_ITEM(list_item);
-  gtk_widget_grab_focus(GTK_WIDGET(prop_dialog->op_name));
-}
-
-static void
-operations_list_new_callback(GtkWidget *button,
-			     UMLClass *umlclass)
-{
-  GList *list;
-  UMLClassDialog *prop_dialog;
-  GtkWidget *list_item;
-  UMLOperation *op;
-  char *utfstr;
-
-  prop_dialog = umlclass->properties_dialog;
-
-  operations_get_current_values(prop_dialog);
-
-  op = uml_operation_new();
-  /* need to make new ConnectionPoints valid and remember them */
-  uml_operation_ensure_connection_points (op, &umlclass->element.object);
-  prop_dialog->added_connections = 
-    g_list_prepend(prop_dialog->added_connections, op->left_connection);
-  prop_dialog->added_connections = 
-    g_list_prepend(prop_dialog->added_connections, op->right_connection);
-
-
-  utfstr = uml_get_operation_string (op);
-  list_item = gtk_list_item_new_with_label (utfstr);
-  gtk_widget_show (list_item);
-  g_free (utfstr);
-
-  g_object_set_data(G_OBJECT(list_item), "user_data", op);
-  g_signal_connect (G_OBJECT (list_item), "destroy",
-		    G_CALLBACK (operations_list_item_destroy_callback), NULL);
-  
-  list = g_list_append(NULL, list_item);
-  gtk_list_append_items(prop_dialog->operations_list, list);
-
-  if (prop_dialog->operations_list->children != NULL)
-    gtk_list_unselect_child(prop_dialog->operations_list,
-			    GTK_WIDGET(prop_dialog->operations_list->children->data));
-  gtk_list_select_child(prop_dialog->operations_list, list_item);
-}
-
-static void
-operations_list_delete_callback(GtkWidget *button,
-				UMLClass *umlclass)
-{
-  GList *list;
-  UMLClassDialog *prop_dialog;
-  GtkList *gtklist;
-  UMLOperation *op;
-  
-
-  prop_dialog = umlclass->properties_dialog;
-  gtklist = GTK_LIST(prop_dialog->operations_list);
-
-  if (gtklist->selection != NULL) {
-    op = (UMLOperation *)
-      g_object_get_data(G_OBJECT(gtklist->selection->data), "user_data");
-
-    if (op->left_connection != NULL) {
-      prop_dialog->deleted_connections =
-	g_list_prepend(prop_dialog->deleted_connections,
-		       op->left_connection);
-      prop_dialog->deleted_connections =
-	g_list_prepend(prop_dialog->deleted_connections,
-		       op->right_connection);
-    }
-
-    list = g_list_prepend(NULL, gtklist->selection->data);
-    gtk_list_remove_items(gtklist, list);
-    g_list_free(list);
-    operations_clear_values(prop_dialog);
-    operations_set_sensitive(prop_dialog, FALSE);
-  }
-}
-
-static void
-operations_list_move_up_callback(GtkWidget *button,
-				 UMLClass *umlclass)
-{
-  GList *list;
-  UMLClassDialog *prop_dialog;
-  GtkList *gtklist;
-  GtkWidget *list_item;
-  int i;
-  
-  prop_dialog = umlclass->properties_dialog;
-  gtklist = GTK_LIST(prop_dialog->operations_list);
-
-  if (gtklist->selection != NULL) {
-    list_item = GTK_WIDGET(gtklist->selection->data);
-    
-    i = gtk_list_child_position(gtklist, list_item);
-    if (i>0)
-      i--;
-
-    g_object_ref(list_item);
-    list = g_list_prepend(NULL, list_item);
-    gtk_list_remove_items(gtklist, list);
-    gtk_list_insert_items(gtklist, list, i);
-    g_object_unref(list_item);
-
-    gtk_list_select_child(gtklist, list_item);
-  }
-
-}
-
-static void
-operations_list_move_down_callback(GtkWidget *button,
-				   UMLClass *umlclass)
-{
-  GList *list;
-  UMLClassDialog *prop_dialog;
-  GtkList *gtklist;
-  GtkWidget *list_item;
-  int i;
-  
-  prop_dialog = umlclass->properties_dialog;
-  gtklist = GTK_LIST(prop_dialog->operations_list);
-
-  if (gtklist->selection != NULL) {
-    list_item = GTK_WIDGET(gtklist->selection->data);
-    
-    i = gtk_list_child_position(gtklist, list_item);
-    if (i<(g_list_length(gtklist->children)-1))
-      i++;
-
-    g_object_ref(list_item);
-    list = g_list_prepend(NULL, list_item);
-    gtk_list_remove_items(gtklist, list);
-    gtk_list_insert_items(gtklist, list, i);
-    g_object_unref(list_item);
-
-    gtk_list_select_child(gtklist, list_item);
-  }
-}
-
-static void
-operations_read_from_dialog(UMLClass *umlclass,
-			    UMLClassDialog *prop_dialog,
-			    int connection_index)
-{
-  GList *list;
-  UMLOperation *op;
-  GtkWidget *list_item;
-  GList *clear_list;
-  DiaObject *obj;
-
-  obj = &umlclass->element.object;
-
-  /* if currently select op is changed in the entries, update from widgets */
-  operations_get_current_values(prop_dialog);
-
-  /* Free current operations: */
-  list = umlclass->operations;
-  while (list != NULL) {
-    op = (UMLOperation *)list->data;
-    uml_operation_destroy(op);
-    list = g_list_next(list);
-  }
-  g_list_free (umlclass->operations);
-  umlclass->operations = NULL;
-
-  /* Insert new operations and remove them from gtklist: */
-  list = GTK_LIST (prop_dialog->operations_list)->children;
-  clear_list = NULL;
-  while (list != NULL) {
-    list_item = GTK_WIDGET(list->data);
-    
-    clear_list = g_list_prepend (clear_list, list_item);
-    op = (UMLOperation *)
-      g_object_get_data(G_OBJECT(list_item), "user_data");
-    g_object_set_data(G_OBJECT(list_item), "user_data", NULL);
-    umlclass->operations = g_list_append(umlclass->operations, op);
-    
-    if (op->left_connection == NULL) {
-      uml_operation_ensure_connection_points (op, obj);
-      
-      prop_dialog->added_connections =
-	g_list_prepend(prop_dialog->added_connections,
-		       op->left_connection);
-      prop_dialog->added_connections =
-	g_list_prepend(prop_dialog->added_connections,
-		       op->right_connection);
-    }
-    
-    if ( (prop_dialog->op_vis->active) &&
-	 (!prop_dialog->op_supp->active) ) { 
-      obj->connections[connection_index] = op->left_connection;
-      connection_index++;
-      obj->connections[connection_index] = op->right_connection;
-      connection_index++;
-    } else {
-      umlclass_store_disconnects(prop_dialog, op->left_connection);
-      object_remove_connections_to(op->left_connection);
-      umlclass_store_disconnects(prop_dialog, op->right_connection);
-      object_remove_connections_to(op->right_connection);
-    }
-    
-    list = g_list_next(list);
-  }
-  clear_list = g_list_reverse (clear_list);
-  gtk_list_remove_items (GTK_LIST (prop_dialog->operations_list), clear_list);
-  g_list_free (clear_list);
-}
-
-static void
-operations_fill_in_dialog(UMLClass *umlclass)
-{
-  UMLClassDialog *prop_dialog;
-  UMLOperation *op_copy;
-  GtkWidget *list_item;
-  GList *list;
-  int i;
-
-  prop_dialog = umlclass->properties_dialog;
-
-  if (prop_dialog->operations_list->children == NULL) {
-    i = 0;
-    list = umlclass->operations;
-    while (list != NULL) {
-      UMLOperation *op = (UMLOperation *)list->data;
-      gchar *opstr = uml_get_operation_string (op);
-
-      list_item = gtk_list_item_new_with_label (opstr);
-      op_copy = uml_operation_copy (op);
-      /* Looks wrong but is required for the complicate connections memory management */
-      op_copy->left_connection = op->left_connection;
-      op_copy->right_connection = op->right_connection;
-      g_object_set_data(G_OBJECT(list_item), "user_data", (gpointer) op_copy);
-      g_signal_connect (G_OBJECT (list_item), "destroy",
-			G_CALLBACK (operations_list_item_destroy_callback), NULL);
-      gtk_container_add (GTK_CONTAINER (prop_dialog->operations_list), list_item);
-      gtk_widget_show (list_item);
-      
-      list = g_list_next(list); i++;
-      g_free (opstr);
-    }
-
-    /* set operations non-sensitive */
-    prop_dialog->current_op = NULL;
-    operations_set_sensitive(prop_dialog, FALSE);
-    operations_clear_values(prop_dialog);
-  }
-}
-
-static void
-operations_update(GtkWidget *widget, UMLClass *umlclass)
-{
-  operations_get_current_values(umlclass->properties_dialog);
-}
-
-static int
-operations_update_event(GtkWidget *widget, GdkEventFocus *ev, UMLClass *umlclass)
-{
-  operations_get_current_values(umlclass->properties_dialog);
-  return 0;
-}
-
-static GtkWidget*
-operations_data_create_hbox (UMLClass *umlclass)
-{
-  UMLClassDialog *prop_dialog;
-  GtkWidget *hbox;
-  GtkWidget *vbox2;
-  GtkWidget *table;
-  GtkWidget *label;
-  GtkWidget *entry;
-  GtkWidget *omenu;
-  GtkWidget *scrolledwindow;
-  GtkWidget *checkbox;
-
-  prop_dialog = umlclass->properties_dialog;
-
-  hbox = gtk_hbox_new(FALSE, 5);
-  gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
-
-  vbox2 = gtk_vbox_new(FALSE, 0);
-
-  /* table containing operation 'name' up to 'query' and also the comment */
-  table = gtk_table_new (5, 3, FALSE);
-  gtk_table_set_col_spacings (GTK_TABLE (table), 5);
-  gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
-
-  label = gtk_label_new(_("Name:"));
-  entry = gtk_entry_new();
-  prop_dialog->op_name = GTK_ENTRY(entry);
-  g_signal_connect (G_OBJECT (entry), "focus_out_event",
-		    G_CALLBACK (operations_update_event), umlclass);
-  g_signal_connect (G_OBJECT (entry), "activate",
-		    G_CALLBACK (operations_update), umlclass);
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0,1,0,1, GTK_FILL,0, 0,0);
-  gtk_table_attach (GTK_TABLE (table), entry, 1,2,0,1, GTK_FILL | GTK_EXPAND,0, 0,2);
-
-  label = gtk_label_new(_("Type:"));
-  entry = gtk_entry_new();
-  prop_dialog->op_type = GTK_ENTRY(entry);
-  g_signal_connect (G_OBJECT (entry), "focus_out_event",
-		    G_CALLBACK (operations_update_event), umlclass);
-  g_signal_connect (G_OBJECT (entry), "activate",
-		    G_CALLBACK (operations_update), umlclass);
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0,1,1,2, GTK_FILL,0, 0,0);
-  gtk_table_attach (GTK_TABLE (table), entry, 1,2,1,2, GTK_FILL | GTK_EXPAND,0, 0,2);
-
-  label = gtk_label_new(_("Stereotype:"));
-  entry = gtk_entry_new();
-  prop_dialog->op_stereotype = GTK_ENTRY(entry);
-  g_signal_connect (G_OBJECT (entry), "focus_out_event",
-		    G_CALLBACK (operations_update_event), umlclass);
-  g_signal_connect (G_OBJECT (entry), "activate",
-		    G_CALLBACK (operations_update), umlclass);
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0,1,2,3, GTK_FILL,0, 0,0);
-  gtk_table_attach (GTK_TABLE (table), entry, 1,2,2,3, GTK_FILL | GTK_EXPAND,0, 0,2);
-
-
-  label = gtk_label_new(_("Visibility:"));
-
-  prop_dialog->op_visible = omenu = dia_option_menu_new ();
-  g_signal_connect (G_OBJECT (omenu), "changed",
-		    G_CALLBACK (operations_update), umlclass);
-  dia_option_menu_add_item(omenu, _("Public"), UML_PUBLIC);
-  dia_option_menu_add_item(omenu, _("Private"), UML_PRIVATE);
-  dia_option_menu_add_item(omenu, _("Protected"), UML_PROTECTED);
-  dia_option_menu_add_item(omenu, _("Implementation"), UML_IMPLEMENTATION);
-
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-					/* left, right, top, bottom */
-  gtk_table_attach (GTK_TABLE (table), label, 2,3,0,1, GTK_FILL,0, 0,0);
-  gtk_table_attach (GTK_TABLE (table), omenu, 3,4,0,1, GTK_FILL | GTK_EXPAND,0, 0,2);
-  /* end: Visibility */
-
-  label = gtk_label_new(_("Inheritance type:"));
-
-  prop_dialog->op_inheritance_type = omenu = dia_option_menu_new ();
-  g_signal_connect (G_OBJECT (omenu), "changed",
-		    G_CALLBACK (operations_update), umlclass);
-  dia_option_menu_add_item(omenu, _("Abstract"), UML_ABSTRACT);
-  dia_option_menu_add_item(omenu, _("Polymorphic (virtual)"), UML_POLYMORPHIC);
-  dia_option_menu_add_item(omenu, _("Leaf (final)"), UML_LEAF);
-
-  gtk_table_attach (GTK_TABLE (table), label, 2,3,1,2, GTK_FILL,0, 0,0);
-  gtk_table_attach (GTK_TABLE (table), omenu, 3,4,1,2, GTK_FILL | GTK_EXPAND,0, 0,2);
-  /* end: Inheritance type */
-
-  checkbox = gtk_check_button_new_with_label(_("Class scope"));
-  prop_dialog->op_class_scope = GTK_TOGGLE_BUTTON(checkbox);
-  gtk_table_attach (GTK_TABLE (table), checkbox, 2,3,2,3, GTK_FILL,0, 0,2);
-
-  checkbox = gtk_check_button_new_with_label(_("Query"));
-  prop_dialog->op_query = GTK_TOGGLE_BUTTON(checkbox);
-  gtk_table_attach (GTK_TABLE (table), checkbox, 3,4,2,3, GTK_FILL,0, 2,0);
-
-  label = gtk_label_new(_("Comment:"));
-  scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
-  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_SHADOW_IN);
-  /* with GTK_POLICY_NEVER the comment filed gets smaller unti l text is entered; than it would resize the dialog! */
-  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-
-  entry = gtk_text_view_new ();
-  prop_dialog->op_comment = GTK_TEXT_VIEW(entry);
-  gtk_container_add (GTK_CONTAINER (scrolledwindow), entry);
-  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (entry), GTK_WRAP_WORD);
-  gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW (entry),TRUE);
-
-  g_signal_connect (G_OBJECT (entry), "focus_out_event",
-		    G_CALLBACK (operations_update_event), umlclass);
-
-  gtk_table_attach (GTK_TABLE (table), label, 4,5,0,1, GTK_FILL,0, 0,0);
-  gtk_table_attach (GTK_TABLE (table), scrolledwindow, 4,5,1,3, GTK_FILL | GTK_EXPAND,0, 0,0);
-  gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
-
-  return hbox;  
-}
-
-static GtkWidget*
-operations_parameters_editor_create_vbox (UMLClass *umlclass)
-{
-  UMLClassDialog *prop_dialog;
-  GtkWidget *vbox2;
-  GtkWidget *hbox2;
-  GtkWidget *vbox3;
-  GtkWidget *label;
-  GtkWidget *scrolled_win;
-  GtkWidget *list;
-  GtkWidget *button;
-
-  prop_dialog = umlclass->properties_dialog;
-
-  vbox2 = gtk_vbox_new(FALSE, 5);
-  /* Parameters list label */
-  hbox2 = gtk_hbox_new(FALSE, 5);
-
-  label = gtk_label_new(_("Parameters:"));
-  gtk_box_pack_start( GTK_BOX(hbox2), label, FALSE, TRUE, 0);
-  
-  gtk_box_pack_start (GTK_BOX (vbox2), hbox2, TRUE, TRUE, 0);
-
-  /* Parameters list editor - with of list at least width of buttons*/
-  hbox2 = gtk_hbox_new(TRUE, 5);
-  
-  scrolled_win = gtk_scrolled_window_new (NULL, NULL);
-  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
-				  GTK_POLICY_AUTOMATIC, 
-				  GTK_POLICY_AUTOMATIC);
-  gtk_box_pack_start (GTK_BOX (hbox2), scrolled_win, TRUE, TRUE, 0);
-  gtk_widget_show (scrolled_win);
-
-  list = gtk_list_new ();
-  prop_dialog->parameters_list = GTK_LIST(list);
-  gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_SINGLE);
-  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), list);
-  gtk_container_set_focus_vadjustment (GTK_CONTAINER (list),
-				       gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_win)));
-  gtk_widget_show (list);
-
-  g_signal_connect (G_OBJECT (list), "selection_changed",
-		    G_CALLBACK(parameters_list_selection_changed_callback),
-		    umlclass);
-
-  vbox3 = gtk_vbox_new(FALSE, 5);
-
-  button = gtk_button_new_from_stock (GTK_STOCK_NEW);
-  prop_dialog->param_new_button = button;
-  g_signal_connect (G_OBJECT (button), "clicked",
-		    G_CALLBACK(parameters_list_new_callback), umlclass);
-  gtk_box_pack_start (GTK_BOX (vbox3), button, FALSE, TRUE, 0);
-  gtk_widget_show (button);
-  button = gtk_button_new_from_stock (GTK_STOCK_DELETE);
-  prop_dialog->param_delete_button = button;
-  g_signal_connect (G_OBJECT (button), "clicked",
-		    G_CALLBACK(parameters_list_delete_callback), umlclass);
-  gtk_box_pack_start (GTK_BOX (vbox3), button, FALSE, TRUE, 0);
-  gtk_widget_show (button);
-  button = gtk_button_new_from_stock (GTK_STOCK_GO_UP);
-  prop_dialog->param_up_button = button;
-  g_signal_connect (G_OBJECT (button), "clicked",
-		    G_CALLBACK(parameters_list_move_up_callback), umlclass);
-  gtk_box_pack_start (GTK_BOX (vbox3), button, FALSE, TRUE, 0);
-  gtk_widget_show (button);
-  button = gtk_button_new_from_stock (GTK_STOCK_GO_DOWN);
-  prop_dialog->param_down_button = button;
-  g_signal_connect (G_OBJECT (button), "clicked",
-		    G_CALLBACK(parameters_list_move_down_callback), umlclass);
-  gtk_box_pack_start (GTK_BOX (vbox3), button, FALSE, TRUE, 0);
-  gtk_widget_show (button);
-
-  gtk_box_pack_start (GTK_BOX (hbox2), vbox3, FALSE, TRUE, 0);
-
-  gtk_box_pack_start (GTK_BOX (vbox2), hbox2, TRUE, TRUE, 0);
-  /* end: Parameter list editor */
-  
-  return vbox2;
-}
-
-static GtkWidget*
-operations_parameters_data_create_vbox (UMLClass *umlclass)
-{
-  UMLClassDialog *prop_dialog;
-  GtkWidget *vbox2;
-  GtkWidget *frame;
-  GtkWidget *vbox3;
-  GtkWidget *table;
-  GtkWidget *label;
-  GtkWidget *entry;
-  GtkWidget *scrolledwindow;
-  GtkWidget *omenu;
-  
-  prop_dialog = umlclass->properties_dialog;
-
-  vbox2 = gtk_vbox_new(FALSE, 5);
-  frame = gtk_frame_new(_("Parameter data"));
-  vbox3 = gtk_vbox_new(FALSE, 5);
-  gtk_container_set_border_width (GTK_CONTAINER (vbox3), 5);
-  gtk_container_add (GTK_CONTAINER (frame), vbox3);
-  gtk_widget_show(frame);
-  gtk_box_pack_start (GTK_BOX (vbox2), frame, FALSE, TRUE, 0);
-  
-  table = gtk_table_new (3, 4, FALSE);
-  gtk_table_set_col_spacings (GTK_TABLE (table), 5);
-  gtk_box_pack_start (GTK_BOX (vbox3), table, FALSE, FALSE, 0);
-
-  label = gtk_label_new(_("Name:"));
-  entry = gtk_entry_new();
-  prop_dialog->param_name = GTK_ENTRY(entry);
-  g_signal_connect (G_OBJECT (entry), "focus_out_event",
-		    G_CALLBACK (operations_update_event), umlclass);
-  g_signal_connect (G_OBJECT (entry), "activate",
-		    G_CALLBACK (operations_update), umlclass);
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0,1,0,1, GTK_FILL,0, 0,0);
-  gtk_table_attach (GTK_TABLE (table), entry, 1,2,0,1, GTK_FILL | GTK_EXPAND,0, 0,2);
-
-  label = gtk_label_new(_("Type:"));
-  entry = gtk_entry_new();
-  g_signal_connect (G_OBJECT (entry), "focus_out_event",
-		    G_CALLBACK (operations_update_event), umlclass);
-  g_signal_connect (G_OBJECT (entry), "activate",
-		    G_CALLBACK (operations_update), umlclass);
-  prop_dialog->param_type = GTK_ENTRY(entry);
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0,1,1,2, GTK_FILL,0, 0,0);
-  gtk_table_attach (GTK_TABLE (table), entry, 1,2,1,2, GTK_FILL | GTK_EXPAND,0, 0,2);
-
-  label = gtk_label_new(_("Def. value:"));
-  entry = gtk_entry_new();
-  prop_dialog->param_value = GTK_ENTRY(entry);
-  g_signal_connect (G_OBJECT (entry), "focus_out_event",
-		    G_CALLBACK (operations_update_event), umlclass);
-  g_signal_connect (G_OBJECT (entry), "activate",
-		    G_CALLBACK (operations_update), umlclass);
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0,1,2,3, GTK_FILL,0, 0,0);
-  gtk_table_attach (GTK_TABLE (table), entry, 1,2,2,3, GTK_FILL | GTK_EXPAND,0, 0,2);
-
-  label = gtk_label_new(_("Comment:"));
-  scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
-  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow),
-				       GTK_SHADOW_IN);
-  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), 
-				  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-
-  entry = gtk_text_view_new ();
-  prop_dialog->param_comment = GTK_TEXT_VIEW(entry);
-  gtk_container_add (GTK_CONTAINER (scrolledwindow), entry);
-  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (entry), GTK_WRAP_WORD);
-  gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW (entry),TRUE);
-
-  g_signal_connect (G_OBJECT (entry), "focus_out_event",
-		    G_CALLBACK (operations_update_event), umlclass);
-
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 2,3,1,2, GTK_FILL,0, 0,0);
-  gtk_table_attach (GTK_TABLE (table), scrolledwindow, 3,4,1,3, GTK_FILL | GTK_EXPAND,0, 0,2);
-
-  label = gtk_label_new(_("Direction:"));
-
-  prop_dialog->param_kind = omenu = dia_option_menu_new ();    
-  g_signal_connect (G_OBJECT (omenu), "changed",
-		    G_CALLBACK (operations_update), umlclass);
-  dia_option_menu_add_item(omenu, _("Undefined"), UML_UNDEF_KIND);
-  dia_option_menu_add_item(omenu, _("In"), UML_IN);
-  dia_option_menu_add_item(omenu, _("Out"), UML_OUT);
-  dia_option_menu_add_item(omenu, _("In & Out"), UML_INOUT);
-
-  { 
-    GtkWidget * align;
-    align = gtk_alignment_new(0.0, 0.5, 0.0, 0.0);
-    gtk_container_add(GTK_CONTAINER(align), omenu);
-    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-    gtk_table_attach (GTK_TABLE (table), label, 2,3,0,1, GTK_FILL,0, 0,3);
-    gtk_table_attach (GTK_TABLE (table), align, 3,4,0,1, GTK_FILL,0, 0,3);
-  }
-
-  return vbox2;
-}
-
-static void 
-operations_create_page(GtkNotebook *notebook,  UMLClass *umlclass)
-{
-  UMLClassDialog *prop_dialog;
-  GtkWidget *page_label;
-  GtkWidget *hbox;
-  GtkWidget *vbox;
-  GtkWidget *vbox2;
-  GtkWidget *vbox3;
-  GtkWidget *scrolled_win;
-  GtkWidget *button;
-  GtkWidget *list;
-  GtkWidget *frame;
-
-  prop_dialog = umlclass->properties_dialog;
-
-  /* Operations page: */
-  page_label = gtk_label_new_with_mnemonic (_("_Operations"));
-  
-  vbox = gtk_vbox_new(FALSE, 5);
-  gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
-
-  hbox = gtk_hbox_new(FALSE, 5);
-  
-  scrolled_win = gtk_scrolled_window_new (NULL, NULL);
-  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
-				  GTK_POLICY_AUTOMATIC, 
-				  GTK_POLICY_AUTOMATIC);
-  gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
-  gtk_widget_show (scrolled_win);
-
-  list = gtk_list_new ();
-  prop_dialog->operations_list = GTK_LIST(list);
-  gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_SINGLE);
-  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), list);
-  gtk_container_set_focus_vadjustment (GTK_CONTAINER (list),
-				       gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_win)));
-  gtk_widget_show (list);
-
-  g_signal_connect (G_OBJECT (list), "selection_changed",
-		    G_CALLBACK(operations_list_selection_changed_callback),
-		    umlclass);
-
-  vbox2 = gtk_vbox_new(FALSE, 5);
-
-  button = gtk_button_new_from_stock (GTK_STOCK_NEW);
-  g_signal_connect (G_OBJECT (button), "clicked",
-		    G_CALLBACK(operations_list_new_callback),
-		    umlclass);
-  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
-  gtk_widget_show (button);
-  button = gtk_button_new_from_stock (GTK_STOCK_DELETE);
-  g_signal_connect (G_OBJECT (button), "clicked",
-		    G_CALLBACK(operations_list_delete_callback), umlclass);
-  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
-  gtk_widget_show (button);
-  button = gtk_button_new_from_stock (GTK_STOCK_GO_UP);
-  g_signal_connect (G_OBJECT (button), "clicked",
-		    G_CALLBACK(operations_list_move_up_callback), umlclass);
-  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
-  gtk_widget_show (button);
-  button = gtk_button_new_from_stock (GTK_STOCK_GO_DOWN);
-  g_signal_connect (G_OBJECT (button), "clicked",
-		    G_CALLBACK(operations_list_move_down_callback), umlclass);
-
-  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
-  gtk_widget_show (button);
-
-  gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, TRUE, 0);
-
-  gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
-
-  frame = gtk_frame_new(_("Operation data"));
-  vbox2 = gtk_vbox_new(FALSE, 0);
-  hbox = operations_data_create_hbox (umlclass);
-  gtk_box_pack_start (GTK_BOX (vbox2), hbox, TRUE, TRUE, 0);
-  gtk_container_add (GTK_CONTAINER (frame), vbox2);
-  gtk_widget_show(frame);
-  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
-  
-  /* parameter stuff below operation stuff */
-  hbox = gtk_hbox_new (FALSE, 5);
-  vbox3 = operations_parameters_editor_create_vbox (umlclass);
-  gtk_box_pack_start (GTK_BOX (hbox), vbox3, TRUE, TRUE, 5);
-
-  vbox3 = operations_parameters_data_create_vbox (umlclass);
-  gtk_box_pack_start (GTK_BOX (hbox), vbox3, TRUE, TRUE, 5);
-  
-  gtk_box_pack_start (GTK_BOX (vbox2), hbox, TRUE, TRUE, 5);
- 
-  gtk_widget_show_all (vbox);
-  gtk_widget_show (page_label);
-  gtk_notebook_append_page (notebook, vbox, page_label);
-}
-
-/************************************************************
- ******************** TEMPLATES *****************************
- ************************************************************/
-
-static void
-templates_set_sensitive(UMLClassDialog *prop_dialog, gint val)
-{
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->templ_name), val);
-  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->templ_type), val);
-}
-
-static void
-templates_set_values (UMLClassDialog *prop_dialog,
-		      UMLFormalParameter *param)
-{
-  if (param->name)
-    gtk_entry_set_text(prop_dialog->templ_name, param->name);
-  if (param->type != NULL)
-    gtk_entry_set_text(prop_dialog->templ_type, param->type);
-}
-
-static void
-templates_clear_values(UMLClassDialog *prop_dialog)
-{
-  gtk_entry_set_text(prop_dialog->templ_name, "");
-  gtk_entry_set_text(prop_dialog->templ_type, "");
-}
-
-static void
-templates_get_values(UMLClassDialog *prop_dialog, UMLFormalParameter *param)
-{
-  g_free(param->name);
-  if (param->type != NULL)
-    g_free(param->type);
-
-  param->name = g_strdup (gtk_entry_get_text (prop_dialog->templ_name));
-  param->type = g_strdup (gtk_entry_get_text (prop_dialog->templ_type));
-}
-
-
-static void
-templates_get_current_values(UMLClassDialog *prop_dialog)
-{
-  UMLFormalParameter *current_param;
-  GtkLabel *label;
-  gchar* new_str;
-
-  if (prop_dialog->current_templ != NULL) {
-    current_param = (UMLFormalParameter *)
-      g_object_get_data(G_OBJECT(prop_dialog->current_templ), "user_data");
-    if (current_param != NULL) {
-      templates_get_values(prop_dialog, current_param);
-      label = GTK_LABEL(GTK_BIN(prop_dialog->current_templ)->child);
-      new_str = uml_get_formalparameter_string (current_param);
-      gtk_label_set_text(label, new_str);
-      g_free(new_str);
-    }
-  }
-}
-
-static void
-templates_list_item_destroy_callback(GtkWidget *list_item,
-				     gpointer data)
-{
-  UMLFormalParameter *param;
-
-  param = (UMLFormalParameter *)
-    g_object_get_data(G_OBJECT(list_item), "user_data");
-
-  if (param != NULL) {
-    uml_formalparameter_destroy(param);
-    /*printf("Destroying list_item's user_data!\n"); */
-  }
-}
-
-static void
-templates_list_selection_changed_callback(GtkWidget *gtklist,
-					  UMLClass *umlclass)
-{
-  GList *list;
-  UMLClassDialog *prop_dialog;
-  GtkObject *list_item;
-  UMLFormalParameter *param;
-
-  prop_dialog = umlclass->properties_dialog;
-
-  if (!prop_dialog)
-    return; /* maybe hiding a bug elsewhere */
-
-  templates_get_current_values(prop_dialog);
-  
-  list = GTK_LIST(gtklist)->selection;
-  if (!list) { /* No selected */
-    templates_set_sensitive(prop_dialog, FALSE);
-    templates_clear_values(prop_dialog);
-    prop_dialog->current_templ = NULL;
-    return;
-  }
-  
-  list_item = GTK_OBJECT(list->data);
-  param = (UMLFormalParameter *)g_object_get_data(G_OBJECT(list_item), "user_data");
-  templates_set_values(prop_dialog, param);
-  templates_set_sensitive(prop_dialog, TRUE);
-
-  prop_dialog->current_templ = GTK_LIST_ITEM(list_item);
-  gtk_widget_grab_focus(GTK_WIDGET(prop_dialog->templ_name));
-}
-
-static void
-templates_list_new_callback(GtkWidget *button,
-			    UMLClass *umlclass)
-{
-  GList *list;
-  UMLClassDialog *prop_dialog;
-  GtkWidget *list_item;
-  UMLFormalParameter *param;
-  char *utfstr;
-
-  prop_dialog = umlclass->properties_dialog;
-
-  templates_get_current_values(prop_dialog);
-
-  param = uml_formalparameter_new();
-
-  utfstr = uml_get_formalparameter_string (param);
-  list_item = gtk_list_item_new_with_label (utfstr);
-  gtk_widget_show (list_item);
-  g_free (utfstr);
-
-  g_object_set_data(G_OBJECT(list_item), "user_data", param);
-  g_signal_connect (G_OBJECT (list_item), "destroy",
-		    G_CALLBACK (templates_list_item_destroy_callback), NULL);
-  
-  list = g_list_append(NULL, list_item);
-  gtk_list_append_items(prop_dialog->templates_list, list);
-
-  if (prop_dialog->templates_list->children != NULL)
-    gtk_list_unselect_child(prop_dialog->templates_list,
-			    GTK_WIDGET(prop_dialog->templates_list->children->data));
-  gtk_list_select_child(prop_dialog->templates_list, list_item);
-}
-
-static void
-templates_list_delete_callback(GtkWidget *button,
-			       UMLClass *umlclass)
-{
-  GList *list;
-  UMLClassDialog *prop_dialog;
-  GtkList *gtklist;
-
-  prop_dialog = umlclass->properties_dialog;
-  gtklist = GTK_LIST(prop_dialog->templates_list);
-
-  if (gtklist->selection != NULL) {
-    list = g_list_prepend(NULL, gtklist->selection->data);
-    gtk_list_remove_items(gtklist, list);
-    g_list_free(list);
-    templates_clear_values(prop_dialog);
-    templates_set_sensitive(prop_dialog, FALSE);
-  }
-}
-
-static void
-templates_list_move_up_callback(GtkWidget *button,
-				UMLClass *umlclass)
-{
-  GList *list;
-  UMLClassDialog *prop_dialog;
-  GtkList *gtklist;
-  GtkWidget *list_item;
-  int i;
-  
-  prop_dialog = umlclass->properties_dialog;
-  gtklist = GTK_LIST(prop_dialog->templates_list);
-
-  if (gtklist->selection != NULL) {
-    list_item = GTK_WIDGET(gtklist->selection->data);
-    
-    i = gtk_list_child_position(gtklist, list_item);
-    if (i>0)
-      i--;
-
-    g_object_ref(list_item);
-    list = g_list_prepend(NULL, list_item);
-    gtk_list_remove_items(gtklist, list);
-    gtk_list_insert_items(gtklist, list, i);
-    g_object_unref(list_item);
-
-    gtk_list_select_child(gtklist, list_item);
-  }
+  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (*heightsel), TRUE);
+  gtk_table_attach_defaults (table, GTK_WIDGET (*heightsel), 2, 3, row, row+1);
 }
 
-static void
-templates_list_move_down_callback(GtkWidget *button,
-				   UMLClass *umlclass)
+static void 
+class_create_page(GtkNotebook *notebook,  UMLClass *umlclass)
 {
-  GList *list;
   UMLClassDialog *prop_dialog;
-  GtkList *gtklist;
-  GtkWidget *list_item;
-  int i;
+  GtkWidget *page_label;
+  GtkWidget *label;
+  GtkWidget *hbox;
+  GtkWidget *hbox2;
+  GtkWidget *vbox;
+  GtkWidget *entry;
+  GtkWidget *scrolledwindow;
+  GtkWidget *checkbox;
+  GtkWidget *table;
+  GtkObject *adj;
 
   prop_dialog = umlclass->properties_dialog;
-  gtklist = GTK_LIST(prop_dialog->templates_list);
-
-  if (gtklist->selection != NULL) {
-    list_item = GTK_WIDGET(gtklist->selection->data);
-    
-    i = gtk_list_child_position(gtklist, list_item);
-    if (i<(g_list_length(gtklist->children)-1))
-      i++;
-
-    g_object_ref(list_item);
-    list = g_list_prepend(NULL, list_item);
-    gtk_list_remove_items(gtklist, list);
-    gtk_list_insert_items(gtklist, list, i);
-    g_object_unref(list_item);
-
-    gtk_list_select_child(gtklist, list_item);
-  }
-}
 
+  /* Class page: */
+  page_label = gtk_label_new_with_mnemonic (_("_Class"));
+  
+  vbox = gtk_vbox_new(FALSE, 5);
+  gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
+  
+  table = gtk_table_new (3, 2, FALSE);
+  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
 
-static void
-templates_read_from_dialog(UMLClass *umlclass, UMLClassDialog *prop_dialog)
-{
-  GList *list;
-  UMLFormalParameter *param;
-  GtkWidget *list_item;
-  GList *clear_list;
+  label = gtk_label_new(_("Class name:"));
+  entry = gtk_entry_new();
+  prop_dialog->classname = GTK_ENTRY(entry);
+  gtk_widget_grab_focus(entry);
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 0,1,0,1, GTK_FILL,0, 0,0);
+  gtk_table_attach (GTK_TABLE (table), entry, 1,2,0,1, GTK_FILL | GTK_EXPAND,0, 0,2);
 
-  templates_get_current_values(prop_dialog); /* if changed, update from widgets */
+  label = gtk_label_new(_("Stereotype:"));
+  entry = gtk_entry_new();
+  prop_dialog->stereotype = GTK_ENTRY(entry);
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 0,1,1,2, GTK_FILL,0, 0,0);
+  gtk_table_attach (GTK_TABLE (table), entry, 1,2,1,2, GTK_FILL | GTK_EXPAND,0, 0,2);
 
-  umlclass->template = prop_dialog->templ_template->active;
+  label = gtk_label_new(_("Comment:"));
+  scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
+  gtk_table_attach (GTK_TABLE (table), scrolledwindow, 1, 2, 2, 3,
+		    (GtkAttachOptions) (GTK_FILL),
+		    (GtkAttachOptions) (GTK_FILL), 0, 0);
+  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow),
+				       GTK_SHADOW_IN);
+  entry = gtk_text_view_new ();
+  prop_dialog->comment = GTK_TEXT_VIEW(entry);
+  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (entry), GTK_WRAP_WORD);
+ 
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 0,1,2,3, GTK_FILL,0, 0,0);
+  gtk_container_add (GTK_CONTAINER (scrolledwindow), entry);
 
-  /* Free current formal parameters: */
-  list = umlclass->formal_params;
-  while (list != NULL) {
-    param = (UMLFormalParameter *)list->data;
-    uml_formalparameter_destroy(param);
-    list = g_list_next(list);
-  }
-  g_list_free (umlclass->formal_params);
-  umlclass->formal_params = NULL;
+  hbox = gtk_hbox_new(FALSE, 5);
+  checkbox = gtk_check_button_new_with_label(_("Abstract"));
+  prop_dialog->abstract_class = GTK_TOGGLE_BUTTON( checkbox );
+  gtk_box_pack_start (GTK_BOX (hbox), checkbox, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
 
-  /* Insert new formal params and remove them from gtklist: */
-  list = GTK_LIST (prop_dialog->templates_list)->children;
-  clear_list = NULL;
-  while (list != NULL) {
-    list_item = GTK_WIDGET(list->data);
-    clear_list = g_list_prepend (clear_list, list_item);
-    param = (UMLFormalParameter *)
-      g_object_get_data(G_OBJECT(list_item), "user_data");
-    g_object_set_data(G_OBJECT(list_item), "user_data", NULL);
-    umlclass->formal_params = g_list_append(umlclass->formal_params, param);
-    list = g_list_next(list);
-  }
-  clear_list = g_list_reverse (clear_list);
-  gtk_list_remove_items (GTK_LIST (prop_dialog->templates_list), clear_list);
-  g_list_free (clear_list);
-}
+  hbox = gtk_hbox_new(FALSE, 5);
+  checkbox = gtk_check_button_new_with_label(_("Attributes visible"));
+  prop_dialog->attr_vis = GTK_TOGGLE_BUTTON( checkbox );
+  gtk_box_pack_start (GTK_BOX (hbox), checkbox, TRUE, TRUE, 0);
+  checkbox = gtk_check_button_new_with_label(_("Suppress Attributes"));
+  prop_dialog->attr_supp = GTK_TOGGLE_BUTTON( checkbox );
+  gtk_box_pack_start (GTK_BOX (hbox), checkbox, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
 
-static void
-templates_fill_in_dialog(UMLClass *umlclass)
-{
-  UMLClassDialog *prop_dialog;
-  UMLFormalParameter *param_copy;
-  GList *list;
-  GtkWidget *list_item;
-  int i;
-  prop_dialog = umlclass->properties_dialog;
+  hbox = gtk_hbox_new(FALSE, 5);
+  checkbox = gtk_check_button_new_with_label(_("Operations visible"));
+  prop_dialog->op_vis = GTK_TOGGLE_BUTTON( checkbox );
+  gtk_box_pack_start (GTK_BOX (hbox), checkbox, TRUE, TRUE, 0);
+  checkbox = gtk_check_button_new_with_label(_("Suppress operations"));
+  prop_dialog->op_supp = GTK_TOGGLE_BUTTON( checkbox );
+  gtk_box_pack_start (GTK_BOX (hbox), checkbox, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
 
-  gtk_toggle_button_set_active(prop_dialog->templ_template, umlclass->template);
-
-  /* copy in new template-parameters: */
-  if (prop_dialog->templates_list->children == NULL) {
-    i = 0;
-    list = umlclass->formal_params;
-    while (list != NULL) {
-      UMLFormalParameter *param = (UMLFormalParameter *)list->data;
-      gchar *paramstr = uml_get_formalparameter_string(param);
-
-      list_item = gtk_list_item_new_with_label (paramstr);
-      param_copy = uml_formalparameter_copy(param);
-      g_object_set_data(G_OBJECT(list_item), "user_data", 
-			       (gpointer) param_copy);
-      g_signal_connect (G_OBJECT (list_item), "destroy",
-			G_CALLBACK (templates_list_item_destroy_callback), NULL);
-      gtk_container_add (GTK_CONTAINER (prop_dialog->templates_list),
-			 list_item);
-      gtk_widget_show (list_item);
-      
-      list = g_list_next(list); i++;
-      g_free (paramstr);
-    }
-    /* set templates non-sensitive */
-    prop_dialog->current_templ = NULL;
-    templates_set_sensitive(prop_dialog, FALSE);
-    templates_clear_values(prop_dialog);
-  }
+  hbox  = gtk_hbox_new(TRUE, 5);
+  hbox2 = gtk_hbox_new(FALSE, 5);
+  checkbox = gtk_check_button_new_with_label(_("Wrap Operations"));
+  prop_dialog->op_wrap = GTK_TOGGLE_BUTTON( checkbox );
+  gtk_box_pack_start (GTK_BOX (hbox), checkbox, TRUE, TRUE, 0);
+  adj = gtk_adjustment_new( umlclass->wrap_after_char, 0.0, 200.0, 1.0, 5.0, 0);
+  prop_dialog->wrap_after_char = GTK_SPIN_BUTTON(gtk_spin_button_new( GTK_ADJUSTMENT( adj), 0.1, 0));
+  gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( prop_dialog->wrap_after_char), TRUE);
+  gtk_spin_button_set_snap_to_ticks( GTK_SPIN_BUTTON( prop_dialog->wrap_after_char), TRUE);
+  prop_dialog->max_length_label = GTK_LABEL( gtk_label_new( _("Wrap after this length: ")));
+  gtk_box_pack_start (GTK_BOX (hbox2), GTK_WIDGET( prop_dialog->max_length_label), FALSE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (hbox2), GTK_WIDGET( prop_dialog->wrap_after_char), TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET( hbox2), TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
 
-}
+  hbox = gtk_hbox_new(TRUE, 5);
+  hbox2 = gtk_hbox_new(FALSE, 5);
+  checkbox = gtk_check_button_new_with_label(_("Comments visible"));
+  prop_dialog->comments_vis = GTK_TOGGLE_BUTTON( checkbox );
+  gtk_box_pack_start (GTK_BOX (hbox), checkbox, TRUE, TRUE, 0);
+  adj = gtk_adjustment_new( umlclass->comment_line_length, 17.0, 200.0, 1.0, 5.0, 0);
+  prop_dialog->comment_line_length = GTK_SPIN_BUTTON(gtk_spin_button_new( GTK_ADJUSTMENT( adj), 0.1, 0));
+  gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( prop_dialog->comment_line_length), TRUE);
+  gtk_spin_button_set_snap_to_ticks( GTK_SPIN_BUTTON( prop_dialog->comment_line_length), TRUE);
+  prop_dialog->Comment_length_label = GTK_LABEL( gtk_label_new( _("Wrap comment after this length: ")));
+  gtk_box_pack_start (GTK_BOX (hbox2), GTK_WIDGET( prop_dialog->Comment_length_label), FALSE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (hbox2), GTK_WIDGET( prop_dialog->comment_line_length), TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (hbox),  GTK_WIDGET( hbox2), TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox),  hbox, FALSE, TRUE, 0);
 
+  hbox = gtk_hbox_new(FALSE, 5);
+  checkbox = gtk_check_button_new_with_label(_("Show documentation tag"));
+  prop_dialog->comment_tagging = GTK_TOGGLE_BUTTON( checkbox );
+  gtk_box_pack_start (GTK_BOX (hbox), checkbox, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
 
-static void
-templates_update(GtkWidget *widget, UMLClass *umlclass)
-{
-  templates_get_current_values(umlclass->properties_dialog);
+  gtk_widget_show_all (vbox);
+  gtk_widget_show (page_label);
+  gtk_notebook_append_page(notebook, vbox, page_label);
+  
 }
 
-static int
-templates_update_event(GtkWidget *widget, GdkEventFocus *ev, UMLClass *umlclass)
-{
-  templates_get_current_values(umlclass->properties_dialog);
-  return 0;
-}
 
 static void 
-templates_create_page(GtkNotebook *notebook,  UMLClass *umlclass)
+style_create_page(GtkNotebook *notebook,  UMLClass *umlclass)
 {
   UMLClassDialog *prop_dialog;
   GtkWidget *page_label;
   GtkWidget *label;
-  GtkWidget *hbox;
   GtkWidget *vbox;
-  GtkWidget *vbox2;
-  GtkWidget *hbox2;
+  GtkWidget *line_width;
+  GtkWidget *text_color;
+  GtkWidget *fill_color;
+  GtkWidget *line_color;
   GtkWidget *table;
-  GtkWidget *entry;
-  GtkWidget *checkbox;
-  GtkWidget *scrolled_win;
-  GtkWidget *button;
-  GtkWidget *list;
-  GtkWidget *frame;
-  
+  GtkObject *adj;
+
   prop_dialog = umlclass->properties_dialog;
 
-  /* Templates page: */
-  page_label = gtk_label_new_with_mnemonic (_("_Templates"));
+  /** Fonts and Colors selection **/
+  page_label = gtk_label_new_with_mnemonic (_("_Style"));
   
   vbox = gtk_vbox_new(FALSE, 5);
   gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
-
-  hbox2 = gtk_hbox_new(FALSE, 5);
-  checkbox = gtk_check_button_new_with_label(_("Template class"));
-  prop_dialog->templ_template = GTK_TOGGLE_BUTTON(checkbox);
-  gtk_box_pack_start (GTK_BOX (hbox2), checkbox, TRUE, TRUE, 0);
-  gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, TRUE, 0);
   
-  hbox = gtk_hbox_new(FALSE, 5);
+  table = gtk_table_new (5, 6, TRUE);
+  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
+  gtk_table_set_homogeneous (GTK_TABLE (table), FALSE);
+
+  /* head line */
+  label = gtk_label_new (_("Kind"));
+                                                    /* L, R, T, B */
+  gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1);
+  label = gtk_label_new (_("Font"));
+  gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 0, 1);
+  label = gtk_label_new (_("Size"));
+  gtk_table_attach_defaults (GTK_TABLE (table), label, 2, 3, 0, 1);
   
-  scrolled_win = gtk_scrolled_window_new (NULL, NULL);
-  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
-				  GTK_POLICY_AUTOMATIC, 
-				  GTK_POLICY_AUTOMATIC);
-  gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
-  gtk_widget_show (scrolled_win);
-
-  list = gtk_list_new ();
-  prop_dialog->templates_list = GTK_LIST(list);
-  gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_SINGLE);
-  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), list);
-  gtk_container_set_focus_vadjustment (GTK_CONTAINER (list),
-				       gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_win)));
-  gtk_widget_show (list);
-
-  g_signal_connect (G_OBJECT (list), "selection_changed",
-		    G_CALLBACK(templates_list_selection_changed_callback), umlclass);
-
-  vbox2 = gtk_vbox_new(FALSE, 5);
-
-  button = gtk_button_new_from_stock (GTK_STOCK_NEW);
-  g_signal_connect (G_OBJECT (button), "clicked",
-		    G_CALLBACK(templates_list_new_callback), umlclass);
-  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
-  gtk_widget_show (button);
-  button = gtk_button_new_from_stock (GTK_STOCK_DELETE);
-  g_signal_connect (G_OBJECT (button), "clicked",
-		    G_CALLBACK(templates_list_delete_callback), umlclass);
-  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
-  gtk_widget_show (button);
-  button = gtk_button_new_from_stock (GTK_STOCK_GO_UP);
-  g_signal_connect (G_OBJECT (button), "clicked",
-		    G_CALLBACK(templates_list_move_up_callback), umlclass);
-  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
-  gtk_widget_show (button);
-  button = gtk_button_new_from_stock (GTK_STOCK_GO_DOWN);
-  g_signal_connect (G_OBJECT (button), "clicked",
-		    G_CALLBACK(templates_list_move_down_callback), umlclass);
-  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
-  gtk_widget_show (button);
-
-  gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, TRUE, 0);
-
-  gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
-
-  frame = gtk_frame_new(_("Formal parameter data"));
-  vbox2 = gtk_vbox_new(FALSE, 5);
-  gtk_container_set_border_width (GTK_CONTAINER (vbox2), 10);
-  gtk_container_add (GTK_CONTAINER (frame), vbox2);
-  gtk_widget_show(frame);
-  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
-
-  table = gtk_table_new (2, 2, FALSE);
-  gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
-
-  label = gtk_label_new(_("Name:"));
-  entry = gtk_entry_new();
-  prop_dialog->templ_name = GTK_ENTRY(entry);
-  g_signal_connect (G_OBJECT (entry), "focus_out_event",
-		    G_CALLBACK (templates_update_event), umlclass); 
-  g_signal_connect (G_OBJECT (entry), "activate",
-		    G_CALLBACK (templates_update), umlclass); 
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0,1,0,1, GTK_FILL,0, 0,0);
-  gtk_table_attach (GTK_TABLE (table), entry, 1,2,0,1, GTK_FILL | GTK_EXPAND,0, 0,2);
+  /* property rows */
+  create_font_props_row (GTK_TABLE (table), _("Normal"), 1,
+                         umlclass->normal_font,
+                         umlclass->font_height,
+                         &(prop_dialog->normal_font),
+                         &(prop_dialog->normal_font_height));
+  create_font_props_row (GTK_TABLE (table), _("Polymorphic"), 2,
+                         umlclass->polymorphic_font,
+                         umlclass->polymorphic_font_height,
+                         &(prop_dialog->polymorphic_font),
+                         &(prop_dialog->polymorphic_font_height));
+  create_font_props_row (GTK_TABLE (table), _("Abstract"), 3,
+                         umlclass->abstract_font,
+                         umlclass->abstract_font_height,
+                         &(prop_dialog->abstract_font),
+                         &(prop_dialog->abstract_font_height));
+  create_font_props_row (GTK_TABLE (table), _("Class Name"), 4,
+                         umlclass->classname_font,
+                         umlclass->classname_font_height,
+                         &(prop_dialog->classname_font),
+                         &(prop_dialog->classname_font_height));
+  create_font_props_row (GTK_TABLE (table), _("Abstract Class"), 5,
+                         umlclass->abstract_classname_font,
+                         umlclass->abstract_classname_font_height,
+                         &(prop_dialog->abstract_classname_font),
+                         &(prop_dialog->abstract_classname_font_height));
+  create_font_props_row (GTK_TABLE (table), _("Comment"), 6,
+                         umlclass->comment_font,
+                         umlclass->comment_font_height,
+                         &(prop_dialog->comment_font),
+                         &(prop_dialog->comment_font_height));
 
-  label = gtk_label_new(_("Type:"));
-  entry = gtk_entry_new();
-  prop_dialog->templ_type = GTK_ENTRY(entry);
-  g_signal_connect (G_OBJECT (entry), "focus_out_event",
-		    G_CALLBACK (templates_update_event), umlclass);
-  g_signal_connect (G_OBJECT (entry), "activate",
-		    G_CALLBACK (templates_update), umlclass);
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0,1,1,2, GTK_FILL,0, 0,0);
-  gtk_table_attach (GTK_TABLE (table), entry, 1,2,1,2, GTK_FILL | GTK_EXPAND,0, 0,2);
 
-  gtk_widget_show(vbox2);
-  
-  /* TODO: Add stuff here! */
+
+  table = gtk_table_new (2, 4, TRUE);
+  gtk_box_pack_start (GTK_BOX (vbox),
+		      table, FALSE, TRUE, 0);
+  /* should probably be refactored too. */
+  label = gtk_label_new(_("Line Width"));
+  gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, 0, 0, 2);
+  adj = gtk_adjustment_new(umlclass->line_width, 0.0, G_MAXFLOAT, 0.1, 1.0, 0);
+  line_width = gtk_spin_button_new (GTK_ADJUSTMENT(adj), 1.0, 2);
+  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (line_width), TRUE);
+  prop_dialog->line_width = GTK_SPIN_BUTTON(line_width);
+  gtk_table_attach (GTK_TABLE (table), line_width, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 3, 2);
+
+  label = gtk_label_new(_("Text Color"));
+  gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, 0, 0, 2);
+  text_color = dia_color_selector_new();
+  dia_color_selector_set_use_alpha (text_color, TRUE);
+  dia_color_selector_set_color(text_color, &umlclass->text_color);
+  prop_dialog->text_color = (DiaColorSelector *)text_color;
+  gtk_table_attach (GTK_TABLE (table), text_color, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 3, 2);
+
+  label = gtk_label_new(_("Foreground Color"));
+  gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, 0, 0, 2);
+  line_color = dia_color_selector_new();
+  dia_color_selector_set_use_alpha (line_color, TRUE);
+  dia_color_selector_set_color(line_color, &umlclass->line_color);
+  prop_dialog->line_color = (DiaColorSelector *)line_color;
+  gtk_table_attach (GTK_TABLE (table), line_color, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, 0, 3, 2);
   
+  label = gtk_label_new(_("Background Color"));
+  gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4, GTK_EXPAND | GTK_FILL, 0, 0, 2);
+  fill_color = dia_color_selector_new();
+  dia_color_selector_set_color(fill_color, &umlclass->fill_color);
+  prop_dialog->fill_color = (DiaColorSelector *)fill_color;
+  gtk_table_attach (GTK_TABLE (table), fill_color, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, 0, 3, 2);
+
   gtk_widget_show_all (vbox);
   gtk_widget_show (page_label);
-  gtk_notebook_append_page (notebook, vbox, page_label);
+  gtk_notebook_append_page(notebook, vbox, page_label);
+  
 }
 
-
-
 /******************************************************
  ******************** ALL *****************************
  ******************************************************/
@@ -2775,9 +553,9 @@ switch_page_callback(GtkNotebook *notebook,
   prop_dialog = umlclass->properties_dialog;
 
   if (prop_dialog != NULL) {
-    attributes_get_current_values(prop_dialog);
-    operations_get_current_values(prop_dialog);
-    templates_get_current_values(prop_dialog);
+    _attributes_get_current_values(prop_dialog);
+    _operations_get_current_values(prop_dialog);
+    _templates_get_current_values(prop_dialog);
   }
 }
 
@@ -2799,9 +577,9 @@ fill_in_dialog(UMLClass *umlclass)
   umlclass_sanity_check(umlclass, "Filling in dialog before attrs");
 #endif
   class_fill_in_dialog(umlclass);
-  attributes_fill_in_dialog(umlclass);
-  operations_fill_in_dialog(umlclass);
-  templates_fill_in_dialog(umlclass);
+  _attributes_fill_in_dialog(umlclass);
+  _operations_fill_in_dialog(umlclass);
+  _templates_fill_in_dialog(umlclass);
 }
 
 ObjectChange *
@@ -2846,11 +624,11 @@ umlclass_apply_props_from_dialog(UMLClass *umlclass, GtkWidget *widget)
   
   /* Read from dialog and put in object: */
   class_read_from_dialog(umlclass, prop_dialog);
-  attributes_read_from_dialog(umlclass, prop_dialog, UMLCLASS_CONNECTIONPOINTS);
+  _attributes_read_from_dialog(umlclass, prop_dialog, UMLCLASS_CONNECTIONPOINTS);
   /* ^^^ attribs must be called before ops, to get the right order of the
      connectionpoints. */
-  operations_read_from_dialog(umlclass, prop_dialog, UMLCLASS_CONNECTIONPOINTS+num_attrib*2);
-  templates_read_from_dialog(umlclass, prop_dialog);
+  _operations_read_from_dialog(umlclass, prop_dialog, UMLCLASS_CONNECTIONPOINTS+num_attrib*2);
+  _templates_read_from_dialog(umlclass, prop_dialog);
 
   /* Reestablish mainpoint */
 #ifdef UML_MAINPOINT
@@ -2863,7 +641,7 @@ umlclass_apply_props_from_dialog(UMLClass *umlclass, GtkWidget *widget)
   while (list != NULL) {
     ConnectionPoint *connection = (ConnectionPoint *) list->data;
 
-    umlclass_store_disconnects(prop_dialog, connection);
+    _umlclass_store_disconnects(prop_dialog, connection);
     object_remove_connections_to(connection);
     
     list = g_list_next(list);
@@ -2894,9 +672,9 @@ static void
 create_dialog_pages(GtkNotebook *notebook, UMLClass *umlclass)
 {
   class_create_page(notebook, umlclass);
-  attributes_create_page(notebook, umlclass);
-  operations_create_page(notebook, umlclass);
-  templates_create_page(notebook, umlclass);
+  _attributes_create_page(notebook, umlclass);
+  _operations_create_page(notebook, umlclass);
+  _templates_create_page(notebook, umlclass);
   style_create_page(notebook, umlclass);
 }
 
@@ -3312,7 +1090,8 @@ new_umlclass_change(UMLClass *obj, UMLClassState *saved_state,
 /*
         get the contents of a comment text view.
 */
-const gchar * get_comment(GtkTextView *view)
+const gchar *
+_class_get_comment(GtkTextView *view)
 {
   GtkTextBuffer * buffer = gtk_text_view_get_buffer(view);
   GtkTextIter start;
@@ -3325,7 +1104,7 @@ const gchar * get_comment(GtkTextView *view)
 }
 
 void
-set_comment(GtkTextView *view, gchar *text)
+_class_set_comment(GtkTextView *view, gchar *text)
 {
   GtkTextBuffer * buffer = gtk_text_view_get_buffer(view);
   GtkTextIter start;
@@ -3337,5 +1116,3 @@ set_comment(GtkTextView *view, gchar *text)
   gtk_text_buffer_get_start_iter(buffer, &start);
   gtk_text_buffer_insert( buffer, &start, text, strlen(text));
 }
-
-
diff --git a/objects/UML/class_dialog.h b/objects/UML/class_dialog.h
new file mode 100644
index 0000000..4589379
--- /dev/null
+++ b/objects/UML/class_dialog.h
@@ -0,0 +1,106 @@
+/**
+ * \brief Very special user interface for UMLClass parametrization
+ *
+ * There is a (too) tight coupling between the UMLClass and it's user interface. 
+ * And the dialog is too huge in code as well as on screen.
+ */
+struct _UMLClassDialog {
+  GtkWidget *dialog;
+
+  GtkEntry *classname;
+  GtkEntry *stereotype;
+  GtkTextView *comment;
+
+  GtkToggleButton *abstract_class;
+  GtkToggleButton *attr_vis;
+  GtkToggleButton *attr_supp;
+  GtkToggleButton *op_vis;
+  GtkToggleButton *op_supp;
+  GtkToggleButton *comments_vis;
+  GtkToggleButton *op_wrap;
+  DiaFontSelector *normal_font;
+  DiaFontSelector *abstract_font;
+  DiaFontSelector *polymorphic_font;
+  DiaFontSelector *classname_font;
+  DiaFontSelector *abstract_classname_font;
+  DiaFontSelector *comment_font;
+  GtkSpinButton *normal_font_height;
+  GtkSpinButton *abstract_font_height;
+  GtkSpinButton *polymorphic_font_height;
+  GtkSpinButton *classname_font_height;
+  GtkSpinButton *abstract_classname_font_height;
+  GtkSpinButton *comment_font_height;
+  GtkSpinButton *wrap_after_char;  
+  GtkSpinButton *comment_line_length;
+  GtkToggleButton *comment_tagging;
+  GtkSpinButton *line_width;
+  DiaColorSelector *text_color;
+  DiaColorSelector *line_color;
+  DiaColorSelector *fill_color;
+  GtkLabel *max_length_label;
+  GtkLabel *Comment_length_label;
+
+  GList *disconnected_connections;
+  GList *added_connections; 
+  GList *deleted_connections; 
+
+  GtkList *attributes_list;
+  GtkListItem *current_attr;
+  GtkEntry *attr_name;
+  GtkEntry *attr_type;
+  GtkEntry *attr_value;
+  GtkTextView *attr_comment;
+  GtkWidget *attr_visible;
+  GtkToggleButton *attr_class_scope;
+  
+  GtkList *operations_list;
+  GtkListItem *current_op;
+  GtkEntry *op_name;
+  GtkEntry *op_type;
+  GtkEntry *op_stereotype;
+  GtkTextView *op_comment;
+
+  GtkWidget *op_visible;
+  GtkToggleButton *op_class_scope;
+  GtkWidget *op_inheritance_type;
+  GtkToggleButton *op_query;  
+  
+  GtkList *parameters_list;
+  GtkListItem *current_param;
+  GtkEntry *param_name;
+  GtkEntry *param_type;
+  GtkEntry *param_value;
+  GtkTextView *param_comment;
+  GtkWidget *param_kind;
+  GtkWidget *param_new_button;
+  GtkWidget *param_delete_button;
+  GtkWidget *param_up_button;
+  GtkWidget *param_down_button;
+  
+  GtkList *templates_list;
+  GtkListItem *current_templ;
+  GtkToggleButton *templ_template;
+  GtkEntry *templ_name;
+  GtkEntry *templ_type;
+};
+
+void _umlclass_store_disconnects(UMLClassDialog *prop_dialog, ConnectionPoint *cp);
+
+const gchar *_class_get_comment(GtkTextView *);
+void _class_set_comment(GtkTextView *, gchar *);
+
+void _attributes_get_current_values(UMLClassDialog *prop_dialog);
+void _operations_get_current_values(UMLClassDialog *prop_dialog);
+void _templates_get_current_values(UMLClassDialog *prop_dialog);
+
+void _attributes_fill_in_dialog(UMLClass *umlclass);
+void _operations_fill_in_dialog(UMLClass *umlclass);
+void _templates_fill_in_dialog(UMLClass *umlclass);
+
+void _attributes_read_from_dialog(UMLClass *umlclass, UMLClassDialog *prop_dialog, int connection_index);
+void _operations_read_from_dialog(UMLClass *umlclass, UMLClassDialog *prop_dialog, int connection_index);
+void _templates_read_from_dialog(UMLClass *umlclass, UMLClassDialog *prop_dialog);
+
+void _attributes_create_page(GtkNotebook *notebook,  UMLClass *umlclass);
+void _operations_create_page(GtkNotebook *notebook,  UMLClass *umlclass);
+void _templates_create_page(GtkNotebook *notebook,  UMLClass *umlclass);
diff --git a/objects/UML/class_operations_dialog.c b/objects/UML/class_operations_dialog.c
new file mode 100644
index 0000000..927c9ce
--- /dev/null
+++ b/objects/UML/class_operations_dialog.c
@@ -0,0 +1,1145 @@
+/* Dia -- an diagram creation/manipulation program
+ * Copyright (C) 1998 Alexander Larsson
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+#include <config.h>
+
+#include <assert.h>
+#undef GTK_DISABLE_DEPRECATED /* GtkList, ... */
+#include <gtk/gtk.h>
+
+#include "class.h"
+#include "diaoptionmenu.h"
+
+#include "class_dialog.h"
+
+/*************************************************************
+ ******************** OPERATIONS *****************************
+ *************************************************************/
+
+static void
+parameters_set_sensitive(UMLClassDialog *prop_dialog, gint val)
+{
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->param_name), val);
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->param_type), val);
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->param_value), val);
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->param_comment), val);
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->param_kind), val);
+}
+
+static void
+parameters_set_values(UMLClassDialog *prop_dialog, UMLParameter *param)
+{
+  gtk_entry_set_text(prop_dialog->param_name, param->name);
+  gtk_entry_set_text(prop_dialog->param_type, param->type);
+  if (param->value != NULL)
+    gtk_entry_set_text(prop_dialog->param_value, param->value);
+  else
+    gtk_entry_set_text(prop_dialog->param_value, "");
+  if (param->comment != NULL)
+    _class_set_comment(prop_dialog->param_comment, param->comment);
+  else
+    _class_set_comment(prop_dialog->param_comment, "");
+
+  dia_option_menu_set_active(prop_dialog->param_kind, param->kind);
+}
+
+static void
+parameters_clear_values(UMLClassDialog *prop_dialog)
+{
+  gtk_entry_set_text(prop_dialog->param_name, "");
+  gtk_entry_set_text(prop_dialog->param_type, "");
+  gtk_entry_set_text(prop_dialog->param_value, "");
+  _class_set_comment(prop_dialog->param_comment, "");
+  dia_option_menu_set_active(prop_dialog->param_kind, UML_UNDEF_KIND);
+
+}
+
+static void
+parameters_get_values (UMLClassDialog *prop_dialog, UMLParameter *param)
+{
+  g_free(param->name);
+  g_free(param->type);
+  g_free(param->comment);
+  if (param->value != NULL)
+    g_free(param->value);
+  
+  param->name = g_strdup (gtk_entry_get_text (prop_dialog->param_name));
+  param->type = g_strdup (gtk_entry_get_text (prop_dialog->param_type));
+  
+  param->value = g_strdup (gtk_entry_get_text(prop_dialog->param_value));
+  param->comment = g_strdup (_class_get_comment(prop_dialog->param_comment));
+
+  param->kind = (UMLParameterKind) dia_option_menu_get_active(prop_dialog->param_kind);
+}
+
+static void
+parameters_get_current_values(UMLClassDialog *prop_dialog)
+{
+  UMLParameter *current_param;
+  GtkLabel *label;
+  char *new_str;
+
+  if (prop_dialog->current_param != NULL) {
+    current_param = (UMLParameter *)
+      g_object_get_data(G_OBJECT(prop_dialog->current_param), "user_data");
+    if (current_param != NULL) {
+      parameters_get_values(prop_dialog, current_param);
+      label = GTK_LABEL(GTK_BIN(prop_dialog->current_param)->child);
+      new_str = uml_get_parameter_string(current_param);
+      gtk_label_set_text(label, new_str);
+      g_free(new_str);
+    }
+  }
+}
+
+
+static void
+parameters_list_selection_changed_callback(GtkWidget *gtklist,
+					   UMLClass *umlclass)
+{
+  GList *list;
+  UMLClassDialog *prop_dialog;
+  GtkObject *list_item;
+  UMLParameter *param;
+
+  prop_dialog = umlclass->properties_dialog;
+
+  if (!prop_dialog)
+    return; /* maybe hiding a bug elsewhere */
+
+  parameters_get_current_values(prop_dialog);
+  
+  list = GTK_LIST(gtklist)->selection;
+  if (!list) { /* No selected */
+    parameters_set_sensitive(prop_dialog, FALSE);
+    parameters_clear_values(prop_dialog);
+    prop_dialog->current_param = NULL;
+    return;
+  }
+  
+  list_item = GTK_OBJECT(list->data);
+  param = (UMLParameter *)g_object_get_data(G_OBJECT(list_item), "user_data");
+  parameters_set_values(prop_dialog, param);
+  parameters_set_sensitive(prop_dialog, TRUE);
+
+  prop_dialog->current_param = GTK_LIST_ITEM(list_item);
+  gtk_widget_grab_focus(GTK_WIDGET(prop_dialog->param_name));
+}
+
+static void
+parameters_list_new_callback(GtkWidget *button,
+			     UMLClass *umlclass)
+{
+  GList *list;
+  UMLClassDialog *prop_dialog;
+  GtkWidget *list_item;
+  UMLOperation *current_op;
+  UMLParameter *param;
+  char *utf;
+
+  prop_dialog = umlclass->properties_dialog;
+
+  parameters_get_current_values(prop_dialog);
+
+  current_op = (UMLOperation *)
+    g_object_get_data(G_OBJECT(prop_dialog->current_op), "user_data");
+  
+  param = uml_parameter_new();
+
+  utf = uml_get_parameter_string (param);
+  list_item = gtk_list_item_new_with_label (utf);
+  gtk_widget_show (list_item);
+  g_free (utf);
+
+  g_object_set_data(G_OBJECT(list_item), "user_data", param);
+
+  current_op->parameters = g_list_append(current_op->parameters,
+					 (gpointer) param);
+  
+  list = g_list_append(NULL, list_item);
+  gtk_list_append_items(prop_dialog->parameters_list, list);
+
+  if (prop_dialog->parameters_list->children != NULL)
+    gtk_list_unselect_child(prop_dialog->parameters_list,
+			    GTK_WIDGET(prop_dialog->parameters_list->children->data));
+  gtk_list_select_child(prop_dialog->parameters_list, list_item);
+
+  prop_dialog->current_param = GTK_LIST_ITEM(list_item);
+}
+
+static void
+parameters_list_delete_callback(GtkWidget *button,
+				UMLClass *umlclass)
+{
+  GList *list;
+  UMLClassDialog *prop_dialog;
+  GtkList *gtklist;
+  UMLOperation *current_op;
+  UMLParameter *param;
+  
+  prop_dialog = umlclass->properties_dialog;
+  gtklist = GTK_LIST(prop_dialog->parameters_list);
+
+
+  if (gtklist->selection != NULL) {
+    /* Remove from current operations parameter list: */
+    current_op = (UMLOperation *)
+      g_object_get_data(G_OBJECT(prop_dialog->current_op), "user_data");
+    param = (UMLParameter *)
+      g_object_get_data(G_OBJECT(prop_dialog->current_param), "user_data");
+    
+    current_op->parameters = g_list_remove(current_op->parameters,
+					   (gpointer) param);
+    uml_parameter_destroy(param);
+    
+    /* Remove from gtk list: */
+    list = g_list_prepend(NULL, prop_dialog->current_param);
+
+    prop_dialog->current_param = NULL;
+
+    gtk_list_remove_items(gtklist, list);
+    g_list_free(list);
+  }
+}
+
+static void
+parameters_list_move_up_callback(GtkWidget *button,
+				 UMLClass *umlclass)
+{
+  GList *list;
+  UMLClassDialog *prop_dialog;
+  GtkList *gtklist;
+  GtkWidget *list_item;
+  UMLOperation *current_op;
+  UMLParameter *param;
+  int i;
+  
+  prop_dialog = umlclass->properties_dialog;
+  gtklist = GTK_LIST(prop_dialog->parameters_list);
+
+  if (gtklist->selection != NULL) {
+    list_item = GTK_WIDGET(gtklist->selection->data);
+    
+    i = gtk_list_child_position(gtklist, list_item);
+    if (i>0)
+      i--;
+
+    param = (UMLParameter *) g_object_get_data(G_OBJECT(list_item), "user_data");
+
+    /* Move parameter in current operations list: */
+    current_op = (UMLOperation *)
+      g_object_get_data(G_OBJECT(prop_dialog->current_op), "user_data");
+    
+    current_op->parameters = g_list_remove(current_op->parameters,
+					   (gpointer) param);
+    current_op->parameters = g_list_insert(current_op->parameters,
+					   (gpointer) param,
+					   i);
+
+    /* Move parameter in gtk list: */
+    g_object_ref(list_item);
+    list = g_list_prepend(NULL, list_item);
+    gtk_list_remove_items(gtklist, list);
+    gtk_list_insert_items(gtklist, list, i);
+    g_object_unref(list_item);
+
+    gtk_list_select_child(gtklist, list_item);
+
+    _operations_get_current_values(prop_dialog);
+  }
+}
+
+static void
+parameters_list_move_down_callback(GtkWidget *button,
+				   UMLClass *umlclass)
+{
+  GList *list;
+  UMLClassDialog *prop_dialog;
+  GtkList *gtklist;
+  GtkWidget *list_item;
+  UMLOperation *current_op;
+  UMLParameter *param;
+  int i;
+  
+  prop_dialog = umlclass->properties_dialog;
+  gtklist = GTK_LIST(prop_dialog->parameters_list);
+
+  if (gtklist->selection != NULL) {
+    list_item = GTK_WIDGET(gtklist->selection->data);
+    
+    i = gtk_list_child_position(gtklist, list_item);
+    if (i<(g_list_length(gtklist->children)-1))
+      i++;
+
+    param = (UMLParameter *) g_object_get_data(G_OBJECT(list_item), "user_data");
+
+    /* Move parameter in current operations list: */
+    current_op = (UMLOperation *)
+      g_object_get_data(G_OBJECT(prop_dialog->current_op), "user_data");
+    
+    current_op->parameters = g_list_remove(current_op->parameters,
+					   (gpointer) param);
+    current_op->parameters = g_list_insert(current_op->parameters,
+					   (gpointer) param,
+					   i);
+
+    /* Move parameter in gtk list: */
+    g_object_ref(list_item);
+    list = g_list_prepend(NULL, list_item);
+    gtk_list_remove_items(gtklist, list);
+    gtk_list_insert_items(gtklist, list, i);
+    g_object_unref(list_item);
+
+    gtk_list_select_child(gtklist, list_item);
+
+    _operations_get_current_values(prop_dialog);
+  }
+}
+
+static void
+operations_set_sensitive(UMLClassDialog *prop_dialog, gint val)
+{
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->op_name), val);
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->op_type), val);
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->op_stereotype), val);
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->op_comment), val);
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->op_visible), val);
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->op_class_scope), val);
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->op_inheritance_type), val);
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->op_query), val);
+
+  gtk_widget_set_sensitive(prop_dialog->param_new_button, val);
+  gtk_widget_set_sensitive(prop_dialog->param_delete_button, val);
+  gtk_widget_set_sensitive(prop_dialog->param_down_button, val);
+  gtk_widget_set_sensitive(prop_dialog->param_up_button, val);
+}
+
+static void
+operations_set_values(UMLClassDialog *prop_dialog, UMLOperation *op)
+{
+  GList *list;
+  UMLParameter *param;
+  GtkWidget *list_item;
+  gchar *str;
+
+  gtk_entry_set_text(prop_dialog->op_name, op->name);
+  if (op->type != NULL)
+    gtk_entry_set_text(prop_dialog->op_type, op->type);
+  else
+    gtk_entry_set_text(prop_dialog->op_type, "");
+
+  if (op->stereotype != NULL)
+    gtk_entry_set_text(prop_dialog->op_stereotype, op->stereotype);
+  else
+    gtk_entry_set_text(prop_dialog->op_stereotype, "");
+
+  if (op->comment != NULL)
+    _class_set_comment(prop_dialog->op_comment, op->comment);
+  else
+    _class_set_comment(prop_dialog->op_comment, "");
+
+  dia_option_menu_set_active(prop_dialog->op_visible, op->visibility);
+  gtk_toggle_button_set_active(prop_dialog->op_class_scope, op->class_scope);
+  gtk_toggle_button_set_active(prop_dialog->op_query, op->query);
+  dia_option_menu_set_active(prop_dialog->op_inheritance_type, op->inheritance_type);
+
+  gtk_list_clear_items(prop_dialog->parameters_list, 0, -1);
+  prop_dialog->current_param = NULL;
+  parameters_set_sensitive(prop_dialog, FALSE);
+
+  list = op->parameters;
+  while (list != NULL) {
+    param = (UMLParameter *)list->data;
+
+    str = uml_get_parameter_string (param);
+    list_item = gtk_list_item_new_with_label (str);
+    g_free (str);
+
+    g_object_set_data(G_OBJECT(list_item), "user_data", (gpointer) param);
+    gtk_container_add (GTK_CONTAINER (prop_dialog->parameters_list), list_item);
+    gtk_widget_show (list_item);
+    
+    list = g_list_next(list);
+  }
+}
+
+static void
+operations_clear_values(UMLClassDialog *prop_dialog)
+{
+  gtk_entry_set_text(prop_dialog->op_name, "");
+  gtk_entry_set_text(prop_dialog->op_type, "");
+  gtk_entry_set_text(prop_dialog->op_stereotype, "");
+  _class_set_comment(prop_dialog->op_comment, "");
+  gtk_toggle_button_set_active(prop_dialog->op_class_scope, FALSE);
+  gtk_toggle_button_set_active(prop_dialog->op_query, FALSE);
+
+  gtk_list_clear_items(prop_dialog->parameters_list, 0, -1);
+  prop_dialog->current_param = NULL;
+  parameters_set_sensitive(prop_dialog, FALSE);
+}
+
+
+static void
+operations_get_values(UMLClassDialog *prop_dialog, UMLOperation *op)
+{
+  const gchar *s;
+
+  g_free(op->name);
+  if (op->type != NULL)
+	  g_free(op->type);
+
+  op->name = g_strdup(gtk_entry_get_text(prop_dialog->op_name));
+  op->type = g_strdup (gtk_entry_get_text(prop_dialog->op_type));
+  op->comment = g_strdup(_class_get_comment(prop_dialog->op_comment));
+
+  s = gtk_entry_get_text(prop_dialog->op_stereotype);
+  if (s && s[0])
+    op->stereotype = g_strdup (s);
+  else
+    op->stereotype = NULL;
+
+  op->visibility = (UMLVisibility)dia_option_menu_get_active(prop_dialog->op_visible);
+    
+  op->class_scope = prop_dialog->op_class_scope->active;
+  op->inheritance_type = (UMLInheritanceType)dia_option_menu_get_active(prop_dialog->op_inheritance_type);
+
+  op->query = prop_dialog->op_query->active;
+
+}
+
+void
+_operations_get_current_values(UMLClassDialog *prop_dialog)
+{
+  UMLOperation *current_op;
+  GtkLabel *label;
+  char *new_str;
+
+  parameters_get_current_values(prop_dialog);
+
+  if (prop_dialog->current_op != NULL) {
+    current_op = (UMLOperation *)
+      g_object_get_data(G_OBJECT(prop_dialog->current_op), "user_data");
+    if (current_op != NULL) {
+      operations_get_values(prop_dialog, current_op);
+      label = GTK_LABEL(GTK_BIN(prop_dialog->current_op)->child);
+      new_str = uml_get_operation_string(current_op);
+      gtk_label_set_text (label, new_str);
+      g_free (new_str);
+    }
+  }
+}
+
+static void
+operations_list_item_destroy_callback(GtkWidget *list_item,
+				      gpointer data)
+{
+  UMLOperation *op;
+
+  op = (UMLOperation *) g_object_get_data(G_OBJECT(list_item), "user_data");
+
+  if (op != NULL) {
+    uml_operation_destroy(op);
+    /*printf("Destroying operation list_item's user_data!\n");*/
+  }
+}
+
+static void
+operations_list_selection_changed_callback(GtkWidget *gtklist,
+					   UMLClass *umlclass)
+{
+  GList *list;
+  UMLClassDialog *prop_dialog;
+  GtkObject *list_item;
+  UMLOperation *op;
+
+  prop_dialog = umlclass->properties_dialog;
+
+  if (!prop_dialog)
+    return; /* maybe hiding a bug elsewhere */
+
+  _operations_get_current_values(prop_dialog);
+  
+  list = GTK_LIST(gtklist)->selection;
+  if (!list) { /* No selected */
+    operations_set_sensitive(prop_dialog, FALSE);
+    operations_clear_values(prop_dialog);
+    prop_dialog->current_op = NULL;
+    return;
+  }
+  
+  list_item = GTK_OBJECT(list->data);
+  op = (UMLOperation *)g_object_get_data(G_OBJECT(list_item), "user_data");
+  operations_set_values(prop_dialog, op);
+  operations_set_sensitive(prop_dialog, TRUE);
+
+  prop_dialog->current_op = GTK_LIST_ITEM(list_item);
+  gtk_widget_grab_focus(GTK_WIDGET(prop_dialog->op_name));
+}
+
+static void
+operations_list_new_callback(GtkWidget *button,
+			     UMLClass *umlclass)
+{
+  GList *list;
+  UMLClassDialog *prop_dialog;
+  GtkWidget *list_item;
+  UMLOperation *op;
+  char *utfstr;
+
+  prop_dialog = umlclass->properties_dialog;
+
+  _operations_get_current_values(prop_dialog);
+
+  op = uml_operation_new();
+  /* need to make new ConnectionPoints valid and remember them */
+  uml_operation_ensure_connection_points (op, &umlclass->element.object);
+  prop_dialog->added_connections = 
+    g_list_prepend(prop_dialog->added_connections, op->left_connection);
+  prop_dialog->added_connections = 
+    g_list_prepend(prop_dialog->added_connections, op->right_connection);
+
+
+  utfstr = uml_get_operation_string (op);
+  list_item = gtk_list_item_new_with_label (utfstr);
+  gtk_widget_show (list_item);
+  g_free (utfstr);
+
+  g_object_set_data(G_OBJECT(list_item), "user_data", op);
+  g_signal_connect (G_OBJECT (list_item), "destroy",
+		    G_CALLBACK (operations_list_item_destroy_callback), NULL);
+  
+  list = g_list_append(NULL, list_item);
+  gtk_list_append_items(prop_dialog->operations_list, list);
+
+  if (prop_dialog->operations_list->children != NULL)
+    gtk_list_unselect_child(prop_dialog->operations_list,
+			    GTK_WIDGET(prop_dialog->operations_list->children->data));
+  gtk_list_select_child(prop_dialog->operations_list, list_item);
+}
+
+static void
+operations_list_delete_callback(GtkWidget *button,
+				UMLClass *umlclass)
+{
+  GList *list;
+  UMLClassDialog *prop_dialog;
+  GtkList *gtklist;
+  UMLOperation *op;
+  
+
+  prop_dialog = umlclass->properties_dialog;
+  gtklist = GTK_LIST(prop_dialog->operations_list);
+
+  if (gtklist->selection != NULL) {
+    op = (UMLOperation *)
+      g_object_get_data(G_OBJECT(gtklist->selection->data), "user_data");
+
+    if (op->left_connection != NULL) {
+      prop_dialog->deleted_connections =
+	g_list_prepend(prop_dialog->deleted_connections,
+		       op->left_connection);
+      prop_dialog->deleted_connections =
+	g_list_prepend(prop_dialog->deleted_connections,
+		       op->right_connection);
+    }
+
+    list = g_list_prepend(NULL, gtklist->selection->data);
+    gtk_list_remove_items(gtklist, list);
+    g_list_free(list);
+    operations_clear_values(prop_dialog);
+    operations_set_sensitive(prop_dialog, FALSE);
+  }
+}
+
+static void
+operations_list_move_up_callback(GtkWidget *button,
+				 UMLClass *umlclass)
+{
+  GList *list;
+  UMLClassDialog *prop_dialog;
+  GtkList *gtklist;
+  GtkWidget *list_item;
+  int i;
+  
+  prop_dialog = umlclass->properties_dialog;
+  gtklist = GTK_LIST(prop_dialog->operations_list);
+
+  if (gtklist->selection != NULL) {
+    list_item = GTK_WIDGET(gtklist->selection->data);
+    
+    i = gtk_list_child_position(gtklist, list_item);
+    if (i>0)
+      i--;
+
+    g_object_ref(list_item);
+    list = g_list_prepend(NULL, list_item);
+    gtk_list_remove_items(gtklist, list);
+    gtk_list_insert_items(gtklist, list, i);
+    g_object_unref(list_item);
+
+    gtk_list_select_child(gtklist, list_item);
+  }
+
+}
+
+static void
+operations_list_move_down_callback(GtkWidget *button,
+				   UMLClass *umlclass)
+{
+  GList *list;
+  UMLClassDialog *prop_dialog;
+  GtkList *gtklist;
+  GtkWidget *list_item;
+  int i;
+  
+  prop_dialog = umlclass->properties_dialog;
+  gtklist = GTK_LIST(prop_dialog->operations_list);
+
+  if (gtklist->selection != NULL) {
+    list_item = GTK_WIDGET(gtklist->selection->data);
+    
+    i = gtk_list_child_position(gtklist, list_item);
+    if (i<(g_list_length(gtklist->children)-1))
+      i++;
+
+    g_object_ref(list_item);
+    list = g_list_prepend(NULL, list_item);
+    gtk_list_remove_items(gtklist, list);
+    gtk_list_insert_items(gtklist, list, i);
+    g_object_unref(list_item);
+
+    gtk_list_select_child(gtklist, list_item);
+  }
+}
+
+void
+_operations_read_from_dialog(UMLClass *umlclass,
+			    UMLClassDialog *prop_dialog,
+			    int connection_index)
+{
+  GList *list;
+  UMLOperation *op;
+  GtkWidget *list_item;
+  GList *clear_list;
+  DiaObject *obj;
+
+  obj = &umlclass->element.object;
+
+  /* if currently select op is changed in the entries, update from widgets */
+  _operations_get_current_values(prop_dialog);
+
+  /* Free current operations: */
+  list = umlclass->operations;
+  while (list != NULL) {
+    op = (UMLOperation *)list->data;
+    uml_operation_destroy(op);
+    list = g_list_next(list);
+  }
+  g_list_free (umlclass->operations);
+  umlclass->operations = NULL;
+
+  /* Insert new operations and remove them from gtklist: */
+  list = GTK_LIST (prop_dialog->operations_list)->children;
+  clear_list = NULL;
+  while (list != NULL) {
+    list_item = GTK_WIDGET(list->data);
+    
+    clear_list = g_list_prepend (clear_list, list_item);
+    op = (UMLOperation *)
+      g_object_get_data(G_OBJECT(list_item), "user_data");
+    g_object_set_data(G_OBJECT(list_item), "user_data", NULL);
+    umlclass->operations = g_list_append(umlclass->operations, op);
+    
+    if (op->left_connection == NULL) {
+      uml_operation_ensure_connection_points (op, obj);
+      
+      prop_dialog->added_connections =
+	g_list_prepend(prop_dialog->added_connections,
+		       op->left_connection);
+      prop_dialog->added_connections =
+	g_list_prepend(prop_dialog->added_connections,
+		       op->right_connection);
+    }
+    
+    if ( (prop_dialog->op_vis->active) &&
+	 (!prop_dialog->op_supp->active) ) { 
+      obj->connections[connection_index] = op->left_connection;
+      connection_index++;
+      obj->connections[connection_index] = op->right_connection;
+      connection_index++;
+    } else {
+      _umlclass_store_disconnects(prop_dialog, op->left_connection);
+      object_remove_connections_to(op->left_connection);
+      _umlclass_store_disconnects(prop_dialog, op->right_connection);
+      object_remove_connections_to(op->right_connection);
+    }
+    
+    list = g_list_next(list);
+  }
+  clear_list = g_list_reverse (clear_list);
+  gtk_list_remove_items (GTK_LIST (prop_dialog->operations_list), clear_list);
+  g_list_free (clear_list);
+}
+
+void
+_operations_fill_in_dialog(UMLClass *umlclass)
+{
+  UMLClassDialog *prop_dialog;
+  UMLOperation *op_copy;
+  GtkWidget *list_item;
+  GList *list;
+  int i;
+
+  prop_dialog = umlclass->properties_dialog;
+
+  if (prop_dialog->operations_list->children == NULL) {
+    i = 0;
+    list = umlclass->operations;
+    while (list != NULL) {
+      UMLOperation *op = (UMLOperation *)list->data;
+      gchar *opstr = uml_get_operation_string (op);
+
+      list_item = gtk_list_item_new_with_label (opstr);
+      op_copy = uml_operation_copy (op);
+      /* Looks wrong but is required for the complicate connections memory management */
+      op_copy->left_connection = op->left_connection;
+      op_copy->right_connection = op->right_connection;
+      g_object_set_data(G_OBJECT(list_item), "user_data", (gpointer) op_copy);
+      g_signal_connect (G_OBJECT (list_item), "destroy",
+			G_CALLBACK (operations_list_item_destroy_callback), NULL);
+      gtk_container_add (GTK_CONTAINER (prop_dialog->operations_list), list_item);
+      gtk_widget_show (list_item);
+      
+      list = g_list_next(list); i++;
+      g_free (opstr);
+    }
+
+    /* set operations non-sensitive */
+    prop_dialog->current_op = NULL;
+    operations_set_sensitive(prop_dialog, FALSE);
+    operations_clear_values(prop_dialog);
+  }
+}
+
+static void
+operations_update(GtkWidget *widget, UMLClass *umlclass)
+{
+  _operations_get_current_values(umlclass->properties_dialog);
+}
+
+static int
+operations_update_event(GtkWidget *widget, GdkEventFocus *ev, UMLClass *umlclass)
+{
+  _operations_get_current_values(umlclass->properties_dialog);
+  return 0;
+}
+
+static GtkWidget*
+operations_data_create_hbox (UMLClass *umlclass)
+{
+  UMLClassDialog *prop_dialog;
+  GtkWidget *hbox;
+  GtkWidget *vbox2;
+  GtkWidget *table;
+  GtkWidget *label;
+  GtkWidget *entry;
+  GtkWidget *omenu;
+  GtkWidget *scrolledwindow;
+  GtkWidget *checkbox;
+
+  prop_dialog = umlclass->properties_dialog;
+
+  hbox = gtk_hbox_new(FALSE, 5);
+  gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
+
+  vbox2 = gtk_vbox_new(FALSE, 0);
+
+  /* table containing operation 'name' up to 'query' and also the comment */
+  table = gtk_table_new (5, 3, FALSE);
+  gtk_table_set_col_spacings (GTK_TABLE (table), 5);
+  gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
+
+  label = gtk_label_new(_("Name:"));
+  entry = gtk_entry_new();
+  prop_dialog->op_name = GTK_ENTRY(entry);
+  g_signal_connect (G_OBJECT (entry), "focus_out_event",
+		    G_CALLBACK (operations_update_event), umlclass);
+  g_signal_connect (G_OBJECT (entry), "activate",
+		    G_CALLBACK (operations_update), umlclass);
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 0,1,0,1, GTK_FILL,0, 0,0);
+  gtk_table_attach (GTK_TABLE (table), entry, 1,2,0,1, GTK_FILL | GTK_EXPAND,0, 0,2);
+
+  label = gtk_label_new(_("Type:"));
+  entry = gtk_entry_new();
+  prop_dialog->op_type = GTK_ENTRY(entry);
+  g_signal_connect (G_OBJECT (entry), "focus_out_event",
+		    G_CALLBACK (operations_update_event), umlclass);
+  g_signal_connect (G_OBJECT (entry), "activate",
+		    G_CALLBACK (operations_update), umlclass);
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 0,1,1,2, GTK_FILL,0, 0,0);
+  gtk_table_attach (GTK_TABLE (table), entry, 1,2,1,2, GTK_FILL | GTK_EXPAND,0, 0,2);
+
+  label = gtk_label_new(_("Stereotype:"));
+  entry = gtk_entry_new();
+  prop_dialog->op_stereotype = GTK_ENTRY(entry);
+  g_signal_connect (G_OBJECT (entry), "focus_out_event",
+		    G_CALLBACK (operations_update_event), umlclass);
+  g_signal_connect (G_OBJECT (entry), "activate",
+		    G_CALLBACK (operations_update), umlclass);
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 0,1,2,3, GTK_FILL,0, 0,0);
+  gtk_table_attach (GTK_TABLE (table), entry, 1,2,2,3, GTK_FILL | GTK_EXPAND,0, 0,2);
+
+
+  label = gtk_label_new(_("Visibility:"));
+
+  prop_dialog->op_visible = omenu = dia_option_menu_new ();
+  g_signal_connect (G_OBJECT (omenu), "changed",
+		    G_CALLBACK (operations_update), umlclass);
+  dia_option_menu_add_item(omenu, _("Public"), UML_PUBLIC);
+  dia_option_menu_add_item(omenu, _("Private"), UML_PRIVATE);
+  dia_option_menu_add_item(omenu, _("Protected"), UML_PROTECTED);
+  dia_option_menu_add_item(omenu, _("Implementation"), UML_IMPLEMENTATION);
+
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+					/* left, right, top, bottom */
+  gtk_table_attach (GTK_TABLE (table), label, 2,3,0,1, GTK_FILL,0, 0,0);
+  gtk_table_attach (GTK_TABLE (table), omenu, 3,4,0,1, GTK_FILL | GTK_EXPAND,0, 0,2);
+  /* end: Visibility */
+
+  label = gtk_label_new(_("Inheritance type:"));
+
+  prop_dialog->op_inheritance_type = omenu = dia_option_menu_new ();
+  g_signal_connect (G_OBJECT (omenu), "changed",
+		    G_CALLBACK (operations_update), umlclass);
+  dia_option_menu_add_item(omenu, _("Abstract"), UML_ABSTRACT);
+  dia_option_menu_add_item(omenu, _("Polymorphic (virtual)"), UML_POLYMORPHIC);
+  dia_option_menu_add_item(omenu, _("Leaf (final)"), UML_LEAF);
+
+  gtk_table_attach (GTK_TABLE (table), label, 2,3,1,2, GTK_FILL,0, 0,0);
+  gtk_table_attach (GTK_TABLE (table), omenu, 3,4,1,2, GTK_FILL | GTK_EXPAND,0, 0,2);
+  /* end: Inheritance type */
+
+  checkbox = gtk_check_button_new_with_label(_("Class scope"));
+  prop_dialog->op_class_scope = GTK_TOGGLE_BUTTON(checkbox);
+  gtk_table_attach (GTK_TABLE (table), checkbox, 2,3,2,3, GTK_FILL,0, 0,2);
+
+  checkbox = gtk_check_button_new_with_label(_("Query"));
+  prop_dialog->op_query = GTK_TOGGLE_BUTTON(checkbox);
+  gtk_table_attach (GTK_TABLE (table), checkbox, 3,4,2,3, GTK_FILL,0, 2,0);
+
+  label = gtk_label_new(_("Comment:"));
+  scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
+  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_SHADOW_IN);
+  /* with GTK_POLICY_NEVER the comment filed gets smaller unti l text is entered; than it would resize the dialog! */
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+  entry = gtk_text_view_new ();
+  prop_dialog->op_comment = GTK_TEXT_VIEW(entry);
+  gtk_container_add (GTK_CONTAINER (scrolledwindow), entry);
+  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (entry), GTK_WRAP_WORD);
+  gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW (entry),TRUE);
+
+  g_signal_connect (G_OBJECT (entry), "focus_out_event",
+		    G_CALLBACK (operations_update_event), umlclass);
+
+  gtk_table_attach (GTK_TABLE (table), label, 4,5,0,1, GTK_FILL,0, 0,0);
+  gtk_table_attach (GTK_TABLE (table), scrolledwindow, 4,5,1,3, GTK_FILL | GTK_EXPAND,0, 0,0);
+  gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
+
+  return hbox;  
+}
+
+static GtkWidget*
+operations_parameters_editor_create_vbox (UMLClass *umlclass)
+{
+  UMLClassDialog *prop_dialog;
+  GtkWidget *vbox2;
+  GtkWidget *hbox2;
+  GtkWidget *vbox3;
+  GtkWidget *label;
+  GtkWidget *scrolled_win;
+  GtkWidget *list;
+  GtkWidget *button;
+
+  prop_dialog = umlclass->properties_dialog;
+
+  vbox2 = gtk_vbox_new(FALSE, 5);
+  /* Parameters list label */
+  hbox2 = gtk_hbox_new(FALSE, 5);
+
+  label = gtk_label_new(_("Parameters:"));
+  gtk_box_pack_start( GTK_BOX(hbox2), label, FALSE, TRUE, 0);
+  
+  gtk_box_pack_start (GTK_BOX (vbox2), hbox2, TRUE, TRUE, 0);
+
+  /* Parameters list editor - with of list at least width of buttons*/
+  hbox2 = gtk_hbox_new(TRUE, 5);
+  
+  scrolled_win = gtk_scrolled_window_new (NULL, NULL);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
+				  GTK_POLICY_AUTOMATIC, 
+				  GTK_POLICY_AUTOMATIC);
+  gtk_box_pack_start (GTK_BOX (hbox2), scrolled_win, TRUE, TRUE, 0);
+  gtk_widget_show (scrolled_win);
+
+  list = gtk_list_new ();
+  prop_dialog->parameters_list = GTK_LIST(list);
+  gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_SINGLE);
+  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), list);
+  gtk_container_set_focus_vadjustment (GTK_CONTAINER (list),
+				       gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_win)));
+  gtk_widget_show (list);
+
+  g_signal_connect (G_OBJECT (list), "selection_changed",
+		    G_CALLBACK(parameters_list_selection_changed_callback),
+		    umlclass);
+
+  vbox3 = gtk_vbox_new(FALSE, 5);
+
+  button = gtk_button_new_from_stock (GTK_STOCK_NEW);
+  prop_dialog->param_new_button = button;
+  g_signal_connect (G_OBJECT (button), "clicked",
+		    G_CALLBACK(parameters_list_new_callback), umlclass);
+  gtk_box_pack_start (GTK_BOX (vbox3), button, FALSE, TRUE, 0);
+  gtk_widget_show (button);
+  button = gtk_button_new_from_stock (GTK_STOCK_DELETE);
+  prop_dialog->param_delete_button = button;
+  g_signal_connect (G_OBJECT (button), "clicked",
+		    G_CALLBACK(parameters_list_delete_callback), umlclass);
+  gtk_box_pack_start (GTK_BOX (vbox3), button, FALSE, TRUE, 0);
+  gtk_widget_show (button);
+  button = gtk_button_new_from_stock (GTK_STOCK_GO_UP);
+  prop_dialog->param_up_button = button;
+  g_signal_connect (G_OBJECT (button), "clicked",
+		    G_CALLBACK(parameters_list_move_up_callback), umlclass);
+  gtk_box_pack_start (GTK_BOX (vbox3), button, FALSE, TRUE, 0);
+  gtk_widget_show (button);
+  button = gtk_button_new_from_stock (GTK_STOCK_GO_DOWN);
+  prop_dialog->param_down_button = button;
+  g_signal_connect (G_OBJECT (button), "clicked",
+		    G_CALLBACK(parameters_list_move_down_callback), umlclass);
+  gtk_box_pack_start (GTK_BOX (vbox3), button, FALSE, TRUE, 0);
+  gtk_widget_show (button);
+
+  gtk_box_pack_start (GTK_BOX (hbox2), vbox3, FALSE, TRUE, 0);
+
+  gtk_box_pack_start (GTK_BOX (vbox2), hbox2, TRUE, TRUE, 0);
+  /* end: Parameter list editor */
+  
+  return vbox2;
+}
+
+static GtkWidget*
+operations_parameters_data_create_vbox (UMLClass *umlclass)
+{
+  UMLClassDialog *prop_dialog;
+  GtkWidget *vbox2;
+  GtkWidget *frame;
+  GtkWidget *vbox3;
+  GtkWidget *table;
+  GtkWidget *label;
+  GtkWidget *entry;
+  GtkWidget *scrolledwindow;
+  GtkWidget *omenu;
+  
+  prop_dialog = umlclass->properties_dialog;
+
+  vbox2 = gtk_vbox_new(FALSE, 5);
+  frame = gtk_frame_new(_("Parameter data"));
+  vbox3 = gtk_vbox_new(FALSE, 5);
+  gtk_container_set_border_width (GTK_CONTAINER (vbox3), 5);
+  gtk_container_add (GTK_CONTAINER (frame), vbox3);
+  gtk_widget_show(frame);
+  gtk_box_pack_start (GTK_BOX (vbox2), frame, FALSE, TRUE, 0);
+  
+  table = gtk_table_new (3, 4, FALSE);
+  gtk_table_set_col_spacings (GTK_TABLE (table), 5);
+  gtk_box_pack_start (GTK_BOX (vbox3), table, FALSE, FALSE, 0);
+
+  label = gtk_label_new(_("Name:"));
+  entry = gtk_entry_new();
+  prop_dialog->param_name = GTK_ENTRY(entry);
+  g_signal_connect (G_OBJECT (entry), "focus_out_event",
+		    G_CALLBACK (operations_update_event), umlclass);
+  g_signal_connect (G_OBJECT (entry), "activate",
+		    G_CALLBACK (operations_update), umlclass);
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 0,1,0,1, GTK_FILL,0, 0,0);
+  gtk_table_attach (GTK_TABLE (table), entry, 1,2,0,1, GTK_FILL | GTK_EXPAND,0, 0,2);
+
+  label = gtk_label_new(_("Type:"));
+  entry = gtk_entry_new();
+  g_signal_connect (G_OBJECT (entry), "focus_out_event",
+		    G_CALLBACK (operations_update_event), umlclass);
+  g_signal_connect (G_OBJECT (entry), "activate",
+		    G_CALLBACK (operations_update), umlclass);
+  prop_dialog->param_type = GTK_ENTRY(entry);
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 0,1,1,2, GTK_FILL,0, 0,0);
+  gtk_table_attach (GTK_TABLE (table), entry, 1,2,1,2, GTK_FILL | GTK_EXPAND,0, 0,2);
+
+  label = gtk_label_new(_("Def. value:"));
+  entry = gtk_entry_new();
+  prop_dialog->param_value = GTK_ENTRY(entry);
+  g_signal_connect (G_OBJECT (entry), "focus_out_event",
+		    G_CALLBACK (operations_update_event), umlclass);
+  g_signal_connect (G_OBJECT (entry), "activate",
+		    G_CALLBACK (operations_update), umlclass);
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 0,1,2,3, GTK_FILL,0, 0,0);
+  gtk_table_attach (GTK_TABLE (table), entry, 1,2,2,3, GTK_FILL | GTK_EXPAND,0, 0,2);
+
+  label = gtk_label_new(_("Comment:"));
+  scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
+  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow),
+				       GTK_SHADOW_IN);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), 
+				  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+  entry = gtk_text_view_new ();
+  prop_dialog->param_comment = GTK_TEXT_VIEW(entry);
+  gtk_container_add (GTK_CONTAINER (scrolledwindow), entry);
+  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (entry), GTK_WRAP_WORD);
+  gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW (entry),TRUE);
+
+  g_signal_connect (G_OBJECT (entry), "focus_out_event",
+		    G_CALLBACK (operations_update_event), umlclass);
+
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 2,3,1,2, GTK_FILL,0, 0,0);
+  gtk_table_attach (GTK_TABLE (table), scrolledwindow, 3,4,1,3, GTK_FILL | GTK_EXPAND,0, 0,2);
+
+  label = gtk_label_new(_("Direction:"));
+
+  prop_dialog->param_kind = omenu = dia_option_menu_new ();    
+  g_signal_connect (G_OBJECT (omenu), "changed",
+		    G_CALLBACK (operations_update), umlclass);
+  dia_option_menu_add_item(omenu, _("Undefined"), UML_UNDEF_KIND);
+  dia_option_menu_add_item(omenu, _("In"), UML_IN);
+  dia_option_menu_add_item(omenu, _("Out"), UML_OUT);
+  dia_option_menu_add_item(omenu, _("In & Out"), UML_INOUT);
+
+  { 
+    GtkWidget * align;
+    align = gtk_alignment_new(0.0, 0.5, 0.0, 0.0);
+    gtk_container_add(GTK_CONTAINER(align), omenu);
+    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+    gtk_table_attach (GTK_TABLE (table), label, 2,3,0,1, GTK_FILL,0, 0,3);
+    gtk_table_attach (GTK_TABLE (table), align, 3,4,0,1, GTK_FILL,0, 0,3);
+  }
+
+  return vbox2;
+}
+
+void 
+_operations_create_page(GtkNotebook *notebook,  UMLClass *umlclass)
+{
+  UMLClassDialog *prop_dialog;
+  GtkWidget *page_label;
+  GtkWidget *hbox;
+  GtkWidget *vbox;
+  GtkWidget *vbox2;
+  GtkWidget *vbox3;
+  GtkWidget *scrolled_win;
+  GtkWidget *button;
+  GtkWidget *list;
+  GtkWidget *frame;
+
+  prop_dialog = umlclass->properties_dialog;
+
+  /* Operations page: */
+  page_label = gtk_label_new_with_mnemonic (_("_Operations"));
+  
+  vbox = gtk_vbox_new(FALSE, 5);
+  gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
+
+  hbox = gtk_hbox_new(FALSE, 5);
+  
+  scrolled_win = gtk_scrolled_window_new (NULL, NULL);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
+				  GTK_POLICY_AUTOMATIC, 
+				  GTK_POLICY_AUTOMATIC);
+  gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
+  gtk_widget_show (scrolled_win);
+
+  list = gtk_list_new ();
+  prop_dialog->operations_list = GTK_LIST(list);
+  gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_SINGLE);
+  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), list);
+  gtk_container_set_focus_vadjustment (GTK_CONTAINER (list),
+				       gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_win)));
+  gtk_widget_show (list);
+
+  g_signal_connect (G_OBJECT (list), "selection_changed",
+		    G_CALLBACK(operations_list_selection_changed_callback),
+		    umlclass);
+
+  vbox2 = gtk_vbox_new(FALSE, 5);
+
+  button = gtk_button_new_from_stock (GTK_STOCK_NEW);
+  g_signal_connect (G_OBJECT (button), "clicked",
+		    G_CALLBACK(operations_list_new_callback),
+		    umlclass);
+  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
+  gtk_widget_show (button);
+  button = gtk_button_new_from_stock (GTK_STOCK_DELETE);
+  g_signal_connect (G_OBJECT (button), "clicked",
+		    G_CALLBACK(operations_list_delete_callback), umlclass);
+  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
+  gtk_widget_show (button);
+  button = gtk_button_new_from_stock (GTK_STOCK_GO_UP);
+  g_signal_connect (G_OBJECT (button), "clicked",
+		    G_CALLBACK(operations_list_move_up_callback), umlclass);
+  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
+  gtk_widget_show (button);
+  button = gtk_button_new_from_stock (GTK_STOCK_GO_DOWN);
+  g_signal_connect (G_OBJECT (button), "clicked",
+		    G_CALLBACK(operations_list_move_down_callback), umlclass);
+
+  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
+  gtk_widget_show (button);
+
+  gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, TRUE, 0);
+
+  gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
+
+  frame = gtk_frame_new(_("Operation data"));
+  vbox2 = gtk_vbox_new(FALSE, 0);
+  hbox = operations_data_create_hbox (umlclass);
+  gtk_box_pack_start (GTK_BOX (vbox2), hbox, TRUE, TRUE, 0);
+  gtk_container_add (GTK_CONTAINER (frame), vbox2);
+  gtk_widget_show(frame);
+  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
+  
+  /* parameter stuff below operation stuff */
+  hbox = gtk_hbox_new (FALSE, 5);
+  vbox3 = operations_parameters_editor_create_vbox (umlclass);
+  gtk_box_pack_start (GTK_BOX (hbox), vbox3, TRUE, TRUE, 5);
+
+  vbox3 = operations_parameters_data_create_vbox (umlclass);
+  gtk_box_pack_start (GTK_BOX (hbox), vbox3, TRUE, TRUE, 5);
+  
+  gtk_box_pack_start (GTK_BOX (vbox2), hbox, TRUE, TRUE, 5);
+ 
+  gtk_widget_show_all (vbox);
+  gtk_widget_show (page_label);
+  gtk_notebook_append_page (notebook, vbox, page_label);
+}
diff --git a/objects/UML/class_templates_dialog.c b/objects/UML/class_templates_dialog.c
new file mode 100644
index 0000000..52ba7d1
--- /dev/null
+++ b/objects/UML/class_templates_dialog.c
@@ -0,0 +1,465 @@
+/* Dia -- an diagram creation/manipulation program
+ * Copyright (C) 1998 Alexander Larsson
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+#include <config.h>
+
+#include <assert.h>
+#undef GTK_DISABLE_DEPRECATED /* GtkList, ... */
+#include <gtk/gtk.h>
+
+#include "class.h"
+#include "diaoptionmenu.h"
+
+#include "class_dialog.h"
+
+/************************************************************
+ ******************** TEMPLATES *****************************
+ ************************************************************/
+
+static void
+templates_set_sensitive(UMLClassDialog *prop_dialog, gint val)
+{
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->templ_name), val);
+  gtk_widget_set_sensitive(GTK_WIDGET(prop_dialog->templ_type), val);
+}
+
+static void
+templates_set_values (UMLClassDialog *prop_dialog,
+		      UMLFormalParameter *param)
+{
+  if (param->name)
+    gtk_entry_set_text(prop_dialog->templ_name, param->name);
+  if (param->type != NULL)
+    gtk_entry_set_text(prop_dialog->templ_type, param->type);
+}
+
+static void
+templates_clear_values(UMLClassDialog *prop_dialog)
+{
+  gtk_entry_set_text(prop_dialog->templ_name, "");
+  gtk_entry_set_text(prop_dialog->templ_type, "");
+}
+
+static void
+templates_get_values(UMLClassDialog *prop_dialog, UMLFormalParameter *param)
+{
+  g_free(param->name);
+  if (param->type != NULL)
+    g_free(param->type);
+
+  param->name = g_strdup (gtk_entry_get_text (prop_dialog->templ_name));
+  param->type = g_strdup (gtk_entry_get_text (prop_dialog->templ_type));
+}
+
+
+void
+_templates_get_current_values(UMLClassDialog *prop_dialog)
+{
+  UMLFormalParameter *current_param;
+  GtkLabel *label;
+  gchar* new_str;
+
+  if (prop_dialog->current_templ != NULL) {
+    current_param = (UMLFormalParameter *)
+      g_object_get_data(G_OBJECT(prop_dialog->current_templ), "user_data");
+    if (current_param != NULL) {
+      templates_get_values(prop_dialog, current_param);
+      label = GTK_LABEL(GTK_BIN(prop_dialog->current_templ)->child);
+      new_str = uml_get_formalparameter_string (current_param);
+      gtk_label_set_text(label, new_str);
+      g_free(new_str);
+    }
+  }
+}
+
+static void
+templates_list_item_destroy_callback(GtkWidget *list_item,
+				     gpointer data)
+{
+  UMLFormalParameter *param;
+
+  param = (UMLFormalParameter *)
+    g_object_get_data(G_OBJECT(list_item), "user_data");
+
+  if (param != NULL) {
+    uml_formalparameter_destroy(param);
+    /*printf("Destroying list_item's user_data!\n"); */
+  }
+}
+
+static void
+templates_list_selection_changed_callback(GtkWidget *gtklist,
+					  UMLClass *umlclass)
+{
+  GList *list;
+  UMLClassDialog *prop_dialog;
+  GtkObject *list_item;
+  UMLFormalParameter *param;
+
+  prop_dialog = umlclass->properties_dialog;
+
+  if (!prop_dialog)
+    return; /* maybe hiding a bug elsewhere */
+
+  _templates_get_current_values(prop_dialog);
+  
+  list = GTK_LIST(gtklist)->selection;
+  if (!list) { /* No selected */
+    templates_set_sensitive(prop_dialog, FALSE);
+    templates_clear_values(prop_dialog);
+    prop_dialog->current_templ = NULL;
+    return;
+  }
+  
+  list_item = GTK_OBJECT(list->data);
+  param = (UMLFormalParameter *)g_object_get_data(G_OBJECT(list_item), "user_data");
+  templates_set_values(prop_dialog, param);
+  templates_set_sensitive(prop_dialog, TRUE);
+
+  prop_dialog->current_templ = GTK_LIST_ITEM(list_item);
+  gtk_widget_grab_focus(GTK_WIDGET(prop_dialog->templ_name));
+}
+
+static void
+templates_list_new_callback(GtkWidget *button,
+			    UMLClass *umlclass)
+{
+  GList *list;
+  UMLClassDialog *prop_dialog;
+  GtkWidget *list_item;
+  UMLFormalParameter *param;
+  char *utfstr;
+
+  prop_dialog = umlclass->properties_dialog;
+
+  _templates_get_current_values(prop_dialog);
+
+  param = uml_formalparameter_new();
+
+  utfstr = uml_get_formalparameter_string (param);
+  list_item = gtk_list_item_new_with_label (utfstr);
+  gtk_widget_show (list_item);
+  g_free (utfstr);
+
+  g_object_set_data(G_OBJECT(list_item), "user_data", param);
+  g_signal_connect (G_OBJECT (list_item), "destroy",
+		    G_CALLBACK (templates_list_item_destroy_callback), NULL);
+  
+  list = g_list_append(NULL, list_item);
+  gtk_list_append_items(prop_dialog->templates_list, list);
+
+  if (prop_dialog->templates_list->children != NULL)
+    gtk_list_unselect_child(prop_dialog->templates_list,
+			    GTK_WIDGET(prop_dialog->templates_list->children->data));
+  gtk_list_select_child(prop_dialog->templates_list, list_item);
+}
+
+static void
+templates_list_delete_callback(GtkWidget *button,
+			       UMLClass *umlclass)
+{
+  GList *list;
+  UMLClassDialog *prop_dialog;
+  GtkList *gtklist;
+
+  prop_dialog = umlclass->properties_dialog;
+  gtklist = GTK_LIST(prop_dialog->templates_list);
+
+  if (gtklist->selection != NULL) {
+    list = g_list_prepend(NULL, gtklist->selection->data);
+    gtk_list_remove_items(gtklist, list);
+    g_list_free(list);
+    templates_clear_values(prop_dialog);
+    templates_set_sensitive(prop_dialog, FALSE);
+  }
+}
+
+static void
+templates_list_move_up_callback(GtkWidget *button,
+				UMLClass *umlclass)
+{
+  GList *list;
+  UMLClassDialog *prop_dialog;
+  GtkList *gtklist;
+  GtkWidget *list_item;
+  int i;
+  
+  prop_dialog = umlclass->properties_dialog;
+  gtklist = GTK_LIST(prop_dialog->templates_list);
+
+  if (gtklist->selection != NULL) {
+    list_item = GTK_WIDGET(gtklist->selection->data);
+    
+    i = gtk_list_child_position(gtklist, list_item);
+    if (i>0)
+      i--;
+
+    g_object_ref(list_item);
+    list = g_list_prepend(NULL, list_item);
+    gtk_list_remove_items(gtklist, list);
+    gtk_list_insert_items(gtklist, list, i);
+    g_object_unref(list_item);
+
+    gtk_list_select_child(gtklist, list_item);
+  }
+}
+
+static void
+templates_list_move_down_callback(GtkWidget *button,
+				   UMLClass *umlclass)
+{
+  GList *list;
+  UMLClassDialog *prop_dialog;
+  GtkList *gtklist;
+  GtkWidget *list_item;
+  int i;
+
+  prop_dialog = umlclass->properties_dialog;
+  gtklist = GTK_LIST(prop_dialog->templates_list);
+
+  if (gtklist->selection != NULL) {
+    list_item = GTK_WIDGET(gtklist->selection->data);
+    
+    i = gtk_list_child_position(gtklist, list_item);
+    if (i<(g_list_length(gtklist->children)-1))
+      i++;
+
+    g_object_ref(list_item);
+    list = g_list_prepend(NULL, list_item);
+    gtk_list_remove_items(gtklist, list);
+    gtk_list_insert_items(gtklist, list, i);
+    g_object_unref(list_item);
+
+    gtk_list_select_child(gtklist, list_item);
+  }
+}
+
+
+void
+_templates_read_from_dialog(UMLClass *umlclass, UMLClassDialog *prop_dialog)
+{
+  GList *list;
+  UMLFormalParameter *param;
+  GtkWidget *list_item;
+  GList *clear_list;
+
+  _templates_get_current_values(prop_dialog); /* if changed, update from widgets */
+
+  umlclass->template = prop_dialog->templ_template->active;
+
+  /* Free current formal parameters: */
+  list = umlclass->formal_params;
+  while (list != NULL) {
+    param = (UMLFormalParameter *)list->data;
+    uml_formalparameter_destroy(param);
+    list = g_list_next(list);
+  }
+  g_list_free (umlclass->formal_params);
+  umlclass->formal_params = NULL;
+
+  /* Insert new formal params and remove them from gtklist: */
+  list = GTK_LIST (prop_dialog->templates_list)->children;
+  clear_list = NULL;
+  while (list != NULL) {
+    list_item = GTK_WIDGET(list->data);
+    clear_list = g_list_prepend (clear_list, list_item);
+    param = (UMLFormalParameter *)
+      g_object_get_data(G_OBJECT(list_item), "user_data");
+    g_object_set_data(G_OBJECT(list_item), "user_data", NULL);
+    umlclass->formal_params = g_list_append(umlclass->formal_params, param);
+    list = g_list_next(list);
+  }
+  clear_list = g_list_reverse (clear_list);
+  gtk_list_remove_items (GTK_LIST (prop_dialog->templates_list), clear_list);
+  g_list_free (clear_list);
+}
+
+void
+_templates_fill_in_dialog(UMLClass *umlclass)
+{
+  UMLClassDialog *prop_dialog;
+  UMLFormalParameter *param_copy;
+  GList *list;
+  GtkWidget *list_item;
+  int i;
+  prop_dialog = umlclass->properties_dialog;
+
+  gtk_toggle_button_set_active(prop_dialog->templ_template, umlclass->template);
+
+  /* copy in new template-parameters: */
+  if (prop_dialog->templates_list->children == NULL) {
+    i = 0;
+    list = umlclass->formal_params;
+    while (list != NULL) {
+      UMLFormalParameter *param = (UMLFormalParameter *)list->data;
+      gchar *paramstr = uml_get_formalparameter_string(param);
+
+      list_item = gtk_list_item_new_with_label (paramstr);
+      param_copy = uml_formalparameter_copy(param);
+      g_object_set_data(G_OBJECT(list_item), "user_data", 
+			       (gpointer) param_copy);
+      g_signal_connect (G_OBJECT (list_item), "destroy",
+			G_CALLBACK (templates_list_item_destroy_callback), NULL);
+      gtk_container_add (GTK_CONTAINER (prop_dialog->templates_list),
+			 list_item);
+      gtk_widget_show (list_item);
+      
+      list = g_list_next(list); i++;
+      g_free (paramstr);
+    }
+    /* set templates non-sensitive */
+    prop_dialog->current_templ = NULL;
+    templates_set_sensitive(prop_dialog, FALSE);
+    templates_clear_values(prop_dialog);
+  }
+
+}
+
+
+static void
+templates_update(GtkWidget *widget, UMLClass *umlclass)
+{
+  _templates_get_current_values(umlclass->properties_dialog);
+}
+
+static int
+templates_update_event(GtkWidget *widget, GdkEventFocus *ev, UMLClass *umlclass)
+{
+  _templates_get_current_values(umlclass->properties_dialog);
+  return 0;
+}
+
+void 
+_templates_create_page(GtkNotebook *notebook,  UMLClass *umlclass)
+{
+  UMLClassDialog *prop_dialog;
+  GtkWidget *page_label;
+  GtkWidget *label;
+  GtkWidget *hbox;
+  GtkWidget *vbox;
+  GtkWidget *vbox2;
+  GtkWidget *hbox2;
+  GtkWidget *table;
+  GtkWidget *entry;
+  GtkWidget *checkbox;
+  GtkWidget *scrolled_win;
+  GtkWidget *button;
+  GtkWidget *list;
+  GtkWidget *frame;
+  
+  prop_dialog = umlclass->properties_dialog;
+
+  /* Templates page: */
+  page_label = gtk_label_new_with_mnemonic (_("_Templates"));
+  
+  vbox = gtk_vbox_new(FALSE, 5);
+  gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
+
+  hbox2 = gtk_hbox_new(FALSE, 5);
+  checkbox = gtk_check_button_new_with_label(_("Template class"));
+  prop_dialog->templ_template = GTK_TOGGLE_BUTTON(checkbox);
+  gtk_box_pack_start (GTK_BOX (hbox2), checkbox, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, TRUE, 0);
+  
+  hbox = gtk_hbox_new(FALSE, 5);
+  
+  scrolled_win = gtk_scrolled_window_new (NULL, NULL);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
+				  GTK_POLICY_AUTOMATIC, 
+				  GTK_POLICY_AUTOMATIC);
+  gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
+  gtk_widget_show (scrolled_win);
+
+  list = gtk_list_new ();
+  prop_dialog->templates_list = GTK_LIST(list);
+  gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_SINGLE);
+  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), list);
+  gtk_container_set_focus_vadjustment (GTK_CONTAINER (list),
+				       gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_win)));
+  gtk_widget_show (list);
+
+  g_signal_connect (G_OBJECT (list), "selection_changed",
+		    G_CALLBACK(templates_list_selection_changed_callback), umlclass);
+
+  vbox2 = gtk_vbox_new(FALSE, 5);
+
+  button = gtk_button_new_from_stock (GTK_STOCK_NEW);
+  g_signal_connect (G_OBJECT (button), "clicked",
+		    G_CALLBACK(templates_list_new_callback), umlclass);
+  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
+  gtk_widget_show (button);
+  button = gtk_button_new_from_stock (GTK_STOCK_DELETE);
+  g_signal_connect (G_OBJECT (button), "clicked",
+		    G_CALLBACK(templates_list_delete_callback), umlclass);
+  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
+  gtk_widget_show (button);
+  button = gtk_button_new_from_stock (GTK_STOCK_GO_UP);
+  g_signal_connect (G_OBJECT (button), "clicked",
+		    G_CALLBACK(templates_list_move_up_callback), umlclass);
+  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
+  gtk_widget_show (button);
+  button = gtk_button_new_from_stock (GTK_STOCK_GO_DOWN);
+  g_signal_connect (G_OBJECT (button), "clicked",
+		    G_CALLBACK(templates_list_move_down_callback), umlclass);
+  gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, TRUE, 0);
+  gtk_widget_show (button);
+
+  gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, TRUE, 0);
+
+  gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
+
+  frame = gtk_frame_new(_("Formal parameter data"));
+  vbox2 = gtk_vbox_new(FALSE, 5);
+  gtk_container_set_border_width (GTK_CONTAINER (vbox2), 10);
+  gtk_container_add (GTK_CONTAINER (frame), vbox2);
+  gtk_widget_show(frame);
+  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
+
+  table = gtk_table_new (2, 2, FALSE);
+  gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
+
+  label = gtk_label_new(_("Name:"));
+  entry = gtk_entry_new();
+  prop_dialog->templ_name = GTK_ENTRY(entry);
+  g_signal_connect (G_OBJECT (entry), "focus_out_event",
+		    G_CALLBACK (templates_update_event), umlclass); 
+  g_signal_connect (G_OBJECT (entry), "activate",
+		    G_CALLBACK (templates_update), umlclass); 
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 0,1,0,1, GTK_FILL,0, 0,0);
+  gtk_table_attach (GTK_TABLE (table), entry, 1,2,0,1, GTK_FILL | GTK_EXPAND,0, 0,2);
+
+  label = gtk_label_new(_("Type:"));
+  entry = gtk_entry_new();
+  prop_dialog->templ_type = GTK_ENTRY(entry);
+  g_signal_connect (G_OBJECT (entry), "focus_out_event",
+		    G_CALLBACK (templates_update_event), umlclass);
+  g_signal_connect (G_OBJECT (entry), "activate",
+		    G_CALLBACK (templates_update), umlclass);
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 0,1,1,2, GTK_FILL,0, 0,0);
+  gtk_table_attach (GTK_TABLE (table), entry, 1,2,1,2, GTK_FILL | GTK_EXPAND,0, 0,2);
+
+  gtk_widget_show(vbox2);
+  
+  /* TODO: Add stuff here! */
+  
+  gtk_widget_show_all (vbox);
+  gtk_widget_show (page_label);
+  gtk_notebook_append_page (notebook, vbox, page_label);
+}
diff --git a/objects/makefile.msc b/objects/makefile.msc
index c6e9781..7630b45 100644
--- a/objects/makefile.msc
+++ b/objects/makefile.msc
@@ -323,6 +323,9 @@ OBJECTS = \
 	branch.obj \
 	class.obj \
 	class_dialog.obj \
+	class_attributes_dialog.obj \
+	class_operations_dialog.obj \
+	class_templates_dialog.obj \
 	classicon.obj \
 	component.obj \
 	component_feature.obj \
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7725712..a667011 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -132,7 +132,10 @@ objects/UML/activity.c
 objects/UML/actor.c
 objects/UML/association.c
 objects/UML/class.c
+objects/UML/class_attributes_dialog.c
 objects/UML/class_dialog.c
+objects/UML/class_operations_dialog.c
+objects/UML/class_templates_dialog.c
 objects/UML/classicon.c
 objects/UML/component.c
 objects/UML/component_feature.c



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