[dia/dia-next: 49/59] Move final (non-style) properties to DiaUmlClassEditor



commit 04d91d605ef02612f333d5f378bbf93503457d03
Author: Zander Brown <zbrown gnome org>
Date:   Thu Jan 3 01:11:38 2019 +0000

    Move final (non-style) properties to DiaUmlClassEditor

 data/dia-uml-class-editor.ui              | 461 +++++++++++++++++++++++++++++-
 data/dia-uml-formal-parameter-dialog.ui   |   2 -
 objects/UML/class_dialog.c                | 294 ++-----------------
 objects/UML/class_dialog.h                |  32 +--
 objects/UML/class_operations_dialog.c     | 146 ----------
 objects/UML/dia-uml-class.c               | 275 ++++++++++++++++--
 objects/UML/dia-uml-class.h               |   5 +-
 objects/UML/editor/dia-uml-class-editor.c |  69 ++++-
 8 files changed, 811 insertions(+), 473 deletions(-)
---
diff --git a/data/dia-uml-class-editor.ui b/data/dia-uml-class-editor.ui
index 947bad40..aa0fd413 100644
--- a/data/dia-uml-class-editor.ui
+++ b/data/dia-uml-class-editor.ui
@@ -2,6 +2,20 @@
 <!-- Generated with glade 3.22.1 -->
 <interface>
   <requires lib="gtk+" version="3.20"/>
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="lower">17</property>
+    <property name="upper">200</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">5</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment2">
+    <property name="upper">200</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">5</property>
+  </object>
+  <object class="GtkTextBuffer" id="comment">
+    <property name="text" translatable="yes">  </property>
+  </object>
   <template class="DiaUmlClassEditor" parent="GtkScrolledWindow">
     <property name="visible">True</property>
     <property name="can_focus">True</property>
@@ -24,6 +38,210 @@
             <property name="margin_bottom">16</property>
             <property name="orientation">vertical</property>
             <property name="spacing">8</property>
+            <child>
+              <object class="GtkGrid">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="row_spacing">8</property>
+                <property name="column_spacing">16</property>
+                <property name="row_homogeneous">True</property>
+                <child>
+                  <object class="GtkEntry" id="name">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="max_length">30</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="stereotype">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hexpand">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Name</property>
+                    <property name="width_chars">15</property>
+                    <property name="xalign">0</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Stereotype</property>
+                    <property name="width_chars">15</property>
+                    <property name="xalign">0</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Comment</property>
+                    <property name="width_chars">15</property>
+                    <property name="xalign">0</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkScrolledWindow">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="shadow_type">in</property>
+                    <child>
+                      <object class="GtkTextView">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="vexpand">False</property>
+                        <property name="left_margin">8</property>
+                        <property name="right_margin">8</property>
+                        <property name="top_margin">8</property>
+                        <property name="bottom_margin">8</property>
+                        <property name="buffer">comment</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">2</property>
+                    <property name="height">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Comments</property>
+                    <property name="xalign">0</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">5</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Comment wrap point</property>
+                    <property name="xalign">0</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">6</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="comments_wrap_point">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="halign">end</property>
+                    <property name="valign">center</property>
+                    <property name="adjustment">adjustment1</property>
+                    <property name="climb_rate">0.10000000000000001</property>
+                    <property name="snap_to_ticks">True</property>
+                    <property name="numeric">True</property>
+                    <property name="value">17</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">6</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSwitch" id="comments">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="halign">end</property>
+                    <property name="valign">center</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">5</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Abstract</property>
+                    <property name="xalign">0</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Documentation tag</property>
+                    <property name="xalign">0</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">7</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSwitch" id="abstract">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="halign">end</property>
+                    <property name="valign">center</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSwitch" id="doc_tag">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="halign">end</property>
+                    <property name="valign">center</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">7</property>
+                  </packing>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
             <child>
               <object class="GtkLabel">
                 <property name="visible">True</property>
@@ -37,7 +255,79 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">0</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="spacing">16</property>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Visible</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSwitch" id="attr_visible">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="pack_type">end</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="spacing">16</property>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Suppress</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSwitch" id="attr_suppress">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="pack_type">end</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">3</property>
               </packing>
             </child>
             <child>
@@ -62,7 +352,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">1</property>
+                <property name="position">4</property>
               </packing>
             </child>
             <child>
@@ -78,7 +368,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">2</property>
+                <property name="position">5</property>
               </packing>
             </child>
             <child>
@@ -94,7 +384,158 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">3</property>
+                <property name="position">6</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="spacing">16</property>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Visible</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSwitch" id="op_visible">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="pack_type">end</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">7</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="spacing">16</property>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Suppress</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSwitch" id="op_suppress">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="pack_type">end</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">8</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="spacing">16</property>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Wrap</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSwitch" id="op_wrap">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="pack_type">end</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">9</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="spacing">16</property>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Wrap at</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="op_wrap_point">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="halign">end</property>
+                    <property name="valign">center</property>
+                    <property name="adjustment">adjustment2</property>
+                    <property name="climb_rate">0.10000000000000001</property>
+                    <property name="snap_to_ticks">True</property>
+                    <property name="numeric">True</property>
+                    <property name="value">40</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="pack_type">end</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">10</property>
               </packing>
             </child>
             <child>
@@ -119,7 +560,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">4</property>
+                <property name="position">12</property>
               </packing>
             </child>
             <child>
@@ -135,7 +576,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">5</property>
+                <property name="position">13</property>
               </packing>
             </child>
             <child>
@@ -151,7 +592,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">6</property>
+                <property name="position">14</property>
               </packing>
             </child>
             <child>
@@ -187,7 +628,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">7</property>
+                <property name="position">15</property>
               </packing>
             </child>
             <child>
@@ -212,7 +653,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">8</property>
+                <property name="position">16</property>
               </packing>
             </child>
             <child>
@@ -228,7 +669,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">9</property>
+                <property name="position">17</property>
               </packing>
             </child>
           </object>
diff --git a/data/dia-uml-formal-parameter-dialog.ui b/data/dia-uml-formal-parameter-dialog.ui
index b8efe1ab..723f20f2 100644
--- a/data/dia-uml-formal-parameter-dialog.ui
+++ b/data/dia-uml-formal-parameter-dialog.ui
@@ -73,7 +73,6 @@
                 <property name="can_focus">True</property>
                 <property name="valign">center</property>
                 <property name="hexpand">True</property>
-                <property name="width_chars">25</property>
               </object>
               <packing>
                 <property name="left_attach">1</property>
@@ -86,7 +85,6 @@
                 <property name="can_focus">True</property>
                 <property name="valign">center</property>
                 <property name="hexpand">True</property>
-                <property name="width_chars">25</property>
               </object>
               <packing>
                 <property name="left_attach">1</property>
diff --git a/objects/UML/class_dialog.c b/objects/UML/class_dialog.c
index fec82842..6e5bfb71 100644
--- a/objects/UML/class_dialog.c
+++ b/objects/UML/class_dialog.c
@@ -50,7 +50,6 @@
 void 
 umlclass_dialog_free (UMLClassDialog *dialog)
 {
-  g_list_free(dialog->deleted_connections);
   gtk_widget_destroy(dialog->dialog);
   /* destroy-signal destroy_properties_dialog already does 'g_free(dialog);' and more */
 }
@@ -86,8 +85,8 @@ new_umlclass_change (UMLClass    *obj,
 
 /**** Utility functions ******/
 void
-_umlclass_store_disconnects(UMLClassDialog *prop_dialog,
-                          ConnectionPoint *cp)
+_umlclass_store_disconnects (ConnectionPoint  *cp,
+                             GList           **disconnected)
 {
   Disconnect *dis;
   DiaObject *connected_obj;
@@ -100,13 +99,11 @@ _umlclass_store_disconnects(UMLClassDialog *prop_dialog,
     
     for (i=0;i<connected_obj->num_handles;i++) {
       if (connected_obj->handles[i]->connected_to == cp) {
-       dis = g_new0(Disconnect, 1);
-       dis->cp = cp;
-       dis->other_object = connected_obj;
-       dis->other_handle = connected_obj->handles[i];
-
-       prop_dialog->disconnected_connections =
-         g_list_prepend(prop_dialog->disconnected_connections, dis);
+        dis = g_new0(Disconnect, 1);
+        dis->cp = cp;
+        dis->other_object = connected_obj;
+        dis->other_handle = connected_obj->handles[i];
+        *disconnected = g_list_prepend(*disconnected, dis);
       }
     }
     list = g_list_next(list);
@@ -120,45 +117,6 @@ _umlclass_store_disconnects(UMLClassDialog *prop_dialog,
 static void
 class_read_from_dialog(UMLClass *umlclass, UMLClassDialog *prop_dialog)
 {
-  const gchar *s;
-
-  if (umlclass->name != NULL)
-    g_free(umlclass->name);
-
-  s = gtk_entry_get_text (prop_dialog->classname);
-  if (s && s[0])
-    umlclass->name = g_strdup (s);
-  else
-    umlclass->name = NULL;
-
-  if (umlclass->stereotype != NULL)
-    g_free(umlclass->stereotype);
-  
-  s = gtk_entry_get_text(prop_dialog->stereotype);
-  if (s && s[0])
-    umlclass->stereotype = g_strdup (s);
-  else
-    umlclass->stereotype = NULL;
-  
-  if (umlclass->comment != NULL)
-    g_free (umlclass->comment);
-
-  s = _class_get_comment(prop_dialog->comment);
-  if (s && s[0])
-    umlclass->comment = g_strdup (s);
-  else
-    umlclass->comment = NULL;
-  
-  umlclass->abstract = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->abstract_class));
-  umlclass->visible_attributes = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->attr_vis));
-  umlclass->visible_operations = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->op_vis));
-  umlclass->wrap_operations = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->op_wrap));
-  umlclass->wrap_after_char = gtk_spin_button_get_value_as_int(prop_dialog->wrap_after_char);
-  umlclass->comment_line_length = gtk_spin_button_get_value_as_int(prop_dialog->comment_line_length);
-  umlclass->comment_tagging = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON 
(prop_dialog->comment_tagging));
-  umlclass->visible_comments = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->comments_vis));
-  umlclass->suppress_attributes = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->attr_supp));
-  umlclass->suppress_operations = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->op_supp));
   umlclass->line_width = gtk_spin_button_get_value(prop_dialog->line_width);
   gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (prop_dialog->text_color),
                               &umlclass->text_color);
@@ -189,28 +147,6 @@ class_fill_in_dialog(UMLClass *umlclass)
 
   prop_dialog = umlclass->properties_dialog;
 
-  if (umlclass->name)
-    gtk_entry_set_text(prop_dialog->classname, umlclass->name);
-  if (umlclass->stereotype != NULL)
-    gtk_entry_set_text(prop_dialog->stereotype, umlclass->stereotype);
-  else
-    gtk_entry_set_text(prop_dialog->stereotype, "");
-
-  if (umlclass->comment != NULL)
-    _class_set_comment(prop_dialog->comment, umlclass->comment);
-  else
-    _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);
-  gtk_toggle_button_set_active(prop_dialog->op_vis, umlclass->visible_operations);
-  gtk_toggle_button_set_active(prop_dialog->op_wrap, umlclass->wrap_operations);
-  gtk_spin_button_set_value (prop_dialog->wrap_after_char, umlclass->wrap_after_char);
-  gtk_spin_button_set_value (prop_dialog->comment_line_length, umlclass->comment_line_length);
-  gtk_toggle_button_set_active(prop_dialog->comment_tagging, umlclass->comment_tagging);
-  gtk_toggle_button_set_active(prop_dialog->comments_vis, umlclass->visible_comments);
-  gtk_toggle_button_set_active(prop_dialog->attr_supp, umlclass->suppress_attributes);
-  gtk_toggle_button_set_active(prop_dialog->op_supp, umlclass->suppress_operations);
   gtk_spin_button_set_value (prop_dialog->line_width, umlclass->line_width);
   gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (prop_dialog->text_color),
                               &umlclass->text_color);
@@ -259,136 +195,20 @@ create_font_props_row (GtkGrid    *table,
 }
 
 static void 
-class_create_page(GtkNotebook *notebook,  UMLClass *umlclass)
+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;
-  GtkAdjustment *adj;
-
-  prop_dialog = umlclass->properties_dialog;
-
+ 
   /* Class page: */
   page_label = gtk_label_new_with_mnemonic (_("_Class"));
   
-  vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
-  gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
-  
-  table = gtk_grid_new ();
-  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_label_set_xalign (GTK_LABEL (label), 0.0);
-  gtk_label_set_yalign (GTK_LABEL (label), 0.5);
-  gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
-  
-  gtk_widget_set_hexpand (label, TRUE);
-  gtk_grid_attach (GTK_GRID (table), entry, 1, 0, 1, 1);
-
-  label = gtk_label_new(_("Stereotype:"));
-  entry = gtk_entry_new();
-  prop_dialog->stereotype = GTK_ENTRY(entry);
-
-  gtk_label_set_xalign (GTK_LABEL (label), 0.0);
-  gtk_label_set_yalign (GTK_LABEL (label), 0.5);
-  gtk_grid_attach (GTK_GRID (table), label, 0, 1, 1, 1);
+  umlclass->properties_dialog->editor = dia_uml_class_editor_new (dia_uml_class_new (umlclass));
   
-  gtk_widget_set_hexpand (label, TRUE);
-  gtk_grid_attach (GTK_GRID (table), entry, 1, 1, 1, 1);
-
-  label = gtk_label_new(_("Comment:"));
-  scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
-  gtk_grid_attach (GTK_GRID (table), scrolledwindow, 1, 2, 1, 1);
-  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_label_set_xalign (GTK_LABEL (label), 0.0);
-  gtk_label_set_yalign (GTK_LABEL (label), 0.5);
-  gtk_grid_attach (GTK_GRID (table), label, 0, 2, 1, 1);
-  gtk_container_add (GTK_CONTAINER (scrolledwindow), entry);
-
-  hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 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_box_new(GTK_ORIENTATION_HORIZONTAL, 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_box_new(GTK_ORIENTATION_HORIZONTAL, 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_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
-  gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
-  hbox2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 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 (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_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
-  gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
-  hbox2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 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 (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_box_new(GTK_ORIENTATION_HORIZONTAL, 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);
-  
-}
+  gtk_widget_show (umlclass->properties_dialog->editor);
 
+  gtk_notebook_append_page (notebook, umlclass->properties_dialog->editor, page_label);  
+}
 
 static void 
 style_create_page(GtkNotebook *notebook,  UMLClass *umlclass)
@@ -551,9 +371,10 @@ umlclass_apply_props_from_dialog(UMLClass *umlclass, GtkWidget *widget)
   DiaObject *obj;
   GList *list;
   int num_attrib, num_ops;
-  GList *added, *deleted, *disconnected;
+  GList *added = NULL, *deleted = NULL, *disconnected = NULL;
   DiaUmlClass *old_state = NULL;
   DiaUmlClass *editor_state;
+  gboolean vis, sup;
   
 #ifdef DEBUG
   umlclass_sanity_check(umlclass, "Apply from dialog start");
@@ -567,18 +388,20 @@ umlclass_apply_props_from_dialog(UMLClass *umlclass, GtkWidget *widget)
   
   /* Allocate enought connection points for attributes and operations. */
   /* (two per op/attr) */
-  if (
-    ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->attr_vis ))) &&
-    (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->attr_supp)))
-  ) {
+  g_object_get (editor_state,
+                "attributes-visible", &vis,
+                "attributes-suppress", &sup,
+                NULL);
+  if (vis && !sup) {
     num_attrib = g_list_model_get_n_items (dia_uml_class_get_attributes (editor_state));
   } else {
     num_attrib = 0;
   }
-  if (
-    ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->op_vis ))) &&
-    (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->op_supp)))
-  ) {
+  g_object_get (editor_state,
+                "operations-visible", &vis,
+                "operations-suppress", &sup,
+                NULL);
+  if (vis && !sup) {
     num_ops = g_list_model_get_n_items (dia_uml_class_get_operations (editor_state));
   } else {
     num_ops = 0;
@@ -599,7 +422,7 @@ umlclass_apply_props_from_dialog(UMLClass *umlclass, GtkWidget *widget)
   class_read_from_dialog(umlclass, prop_dialog);
   /* ^^^ attribs must be called before ops, to get the right order of the
      connectionpoints. */
-  _operations_read_from_dialog(umlclass, prop_dialog, UMLCLASS_CONNECTIONPOINTS);
+  dia_uml_class_store (editor_state, umlclass, &added, &deleted, &disconnected);
 
   /* Reestablish mainpoint */
 #ifdef UML_MAINPOINT
@@ -608,25 +431,16 @@ umlclass_apply_props_from_dialog(UMLClass *umlclass, GtkWidget *widget)
 #endif
 
   /* unconnect from all deleted connectionpoints. */
-  list = prop_dialog->deleted_connections;
+  list = deleted;
   while (list != NULL) {
     ConnectionPoint *connection = (ConnectionPoint *) list->data;
 
-    _umlclass_store_disconnects(prop_dialog, connection);
+    _umlclass_store_disconnects (connection, &disconnected);
     object_remove_connections_to(connection);
     
     list = g_list_next(list);
   }
   
-  deleted = prop_dialog->deleted_connections;
-  prop_dialog->deleted_connections = NULL;
-  
-  added = prop_dialog->added_connections;
-  prop_dialog->added_connections = NULL;
-    
-  disconnected = prop_dialog->disconnected_connections;
-  prop_dialog->disconnected_connections = NULL;
-
   /* Update data: */
   umlclass_calculate_data(umlclass);
   umlclass_update_data(umlclass);
@@ -639,19 +453,10 @@ umlclass_apply_props_from_dialog(UMLClass *umlclass, GtkWidget *widget)
   return new_umlclass_change(umlclass, old_state, added, deleted, disconnected);
 }
 
-static void
-create_dialog_pages(GtkNotebook *notebook, UMLClass *umlclass)
-{
-  class_create_page(notebook, umlclass);
-  _operations_create_page(notebook, umlclass);
-  style_create_page(notebook, umlclass);
-}
-
 GtkWidget *
 umlclass_get_properties(UMLClass *umlclass, gboolean is_default)
 {
   UMLClassDialog *prop_dialog;
-  GtkWidget *vbox;
   GtkWidget *notebook;
 
 #ifdef DEBUG
@@ -660,26 +465,18 @@ umlclass_get_properties(UMLClass *umlclass, gboolean is_default)
   if (umlclass->properties_dialog == NULL) {
     prop_dialog = g_new(UMLClassDialog, 1);
     umlclass->properties_dialog = prop_dialog;
-
-    vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
-    g_object_ref_sink(vbox);
-    prop_dialog->dialog = vbox;
-
-    prop_dialog->deleted_connections = NULL;
-    prop_dialog->added_connections = NULL;
-    prop_dialog->disconnected_connections = NULL;
     
     notebook = gtk_notebook_new ();
     gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
-    gtk_box_pack_start (GTK_BOX (vbox),        notebook, TRUE, TRUE, 0);
-    gtk_container_set_border_width (GTK_CONTAINER (notebook), 10);
+     prop_dialog->dialog = notebook;
 
     g_object_set_data(G_OBJECT(notebook), "user_data", (gpointer) umlclass);
     
     g_signal_connect (G_OBJECT (umlclass->properties_dialog->dialog), "destroy",
                      G_CALLBACK(destroy_properties_dialog), umlclass);
     
-    create_dialog_pages(GTK_NOTEBOOK( notebook ), umlclass);
+    class_create_page(notebook, umlclass);
+    style_create_page(notebook, umlclass);
 
     gtk_widget_show (notebook);
   }
@@ -872,32 +669,3 @@ new_umlclass_change (UMLClass    *obj,
 
   return (ObjectChange *)change;
 }
-/*
-        get the contents of a comment text view.
-*/
-const gchar *
-_class_get_comment(GtkTextView *view)
-{
-  GtkTextBuffer * buffer = gtk_text_view_get_buffer(view);
-  GtkTextIter start;
-  GtkTextIter end;
-
-  gtk_text_buffer_get_start_iter(buffer, &start);
-  gtk_text_buffer_get_end_iter(buffer, &end);
-
-  return gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
-}
-
-void
-_class_set_comment(GtkTextView *view, gchar *text)
-{
-  GtkTextBuffer * buffer = gtk_text_view_get_buffer(view);
-  GtkTextIter start;
-  GtkTextIter end;
-
-  gtk_text_buffer_get_start_iter(buffer, &start);
-  gtk_text_buffer_get_end_iter(buffer, &end);
-  gtk_text_buffer_delete(buffer,&start,&end);
-  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
index 3042f44a..cac814af 100644
--- a/objects/UML/class_dialog.h
+++ b/objects/UML/class_dialog.h
@@ -12,17 +12,6 @@
 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;
@@ -35,30 +24,13 @@ struct _UMLClassDialog {
   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; 
-
-  GtkWidget *attr_visible;
 
   GtkWidget *editor;
 };
 
-void _umlclass_store_disconnects(UMLClassDialog *prop_dialog, ConnectionPoint *cp);
-
-const gchar *_class_get_comment(GtkTextView *);
-void _class_set_comment(GtkTextView *, gchar *);
-
-void _operations_read_from_dialog(UMLClass *umlclass, UMLClassDialog *prop_dialog, int connection_index);
-
-void _operations_create_page(GtkNotebook *notebook,  UMLClass *umlclass);
+void _umlclass_store_disconnects (ConnectionPoint  *cp,
+                                  GList           **disconnected);
diff --git a/objects/UML/class_operations_dialog.c b/objects/UML/class_operations_dialog.c
index 9d51f527..7e429ed1 100644
--- a/objects/UML/class_operations_dialog.c
+++ b/objects/UML/class_operations_dialog.c
@@ -20,152 +20,6 @@
 
 #include <gtk/gtk.h>
 
-#include "class.h"
-#include "class_dialog.h"
-#include "dia_dirs.h"
-#include "editor/dia-uml-class-editor.h"
-#include "editor/dia-uml-list-store.h"
-#include "dia-uml-class.h"
-
-/*************************************************************
- ******************** OPERATIONS *****************************
- *************************************************************/
-
-void
-_operations_read_from_dialog (UMLClass *umlclass,
-                              UMLClassDialog *prop_dialog,
-                              int connection_index)
-{
-  GListModel *list_store;
-  DiaUmlListData *itm;
-  DiaObject *obj;
-  DiaUmlClass *editor_state;
-  gboolean attr_visible = TRUE;
-  gboolean op_visible = TRUE;
-  int i = 0;
-
-  /* Cast to DiaObject (UMLClass -> Element -> DiaObject) */
-  obj = &umlclass->element.object;
-
-  editor_state = dia_uml_class_editor_get_class (DIA_UML_CLASS_EDITOR (umlclass->properties_dialog->editor));
-
-  /* Free current attributes: */
-  g_list_free_full (umlclass->attributes, g_object_unref);
-  umlclass->attributes = NULL;
-
-  /* Free current operations: */
-  /* Clear those already stored */
-  g_list_free_full (umlclass->operations, g_object_unref);
-  umlclass->operations = NULL;
-
-  /* Free current formal parameters: */
-  g_list_free_full (umlclass->formal_params, g_object_unref);
-  umlclass->formal_params = NULL;
-
-  /* If attributes visible and not suppressed */
-  attr_visible = ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->attr_vis ))) &&
-                 (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->attr_supp)));
-
-  /* If operations visible and not suppressed */
-  op_visible = ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->op_vis ))) &&
-               (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->op_supp)));
-
-
-  /* Insert new attributes and remove them from gtklist: */
-  i = 0;
-  list_store = dia_uml_class_get_attributes (editor_state);
-  /* Insert new operations and remove them from gtklist: */
-  while ((itm = g_list_model_get_item (list_store, i))) {
-    DiaUmlAttribute *attr = DIA_UML_ATTRIBUTE (itm);
-
-    umlclass->attributes = g_list_append (umlclass->attributes, g_object_ref (attr));
-    
-    if (attr->left_connection == NULL) {
-      dia_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 (attr_visible) { 
-      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);
-    }
-
-    i++;
-  }
-
-  i = 0;
-  list_store = dia_uml_class_get_operations (editor_state);
-  /* Insert new operations and remove them from gtklist: */
-  while ((itm = g_list_model_get_item (list_store, i))) {
-    DiaUmlOperation *op = DIA_UML_OPERATION (itm);
-
-    umlclass->operations = g_list_append(umlclass->operations, g_object_ref (op));
-
-    if (op->l_connection == NULL) {
-      dia_uml_operation_ensure_connection_points (op, obj);
-      
-      prop_dialog->added_connections = g_list_prepend (prop_dialog->added_connections,
-                                                       op->l_connection);
-      prop_dialog->added_connections = g_list_prepend (prop_dialog->added_connections,
-                                                       op->r_connection);
-    }
-
-    if (op_visible) { 
-      obj->connections[connection_index] = op->l_connection;
-      connection_index++;
-      obj->connections[connection_index] = op->r_connection;
-      connection_index++;
-    } else {
-      _umlclass_store_disconnects(prop_dialog, op->l_connection);
-      object_remove_connections_to(op->l_connection);
-      _umlclass_store_disconnects(prop_dialog, op->r_connection);
-      object_remove_connections_to(op->r_connection);
-    }
-
-    i++;
-  }
-
-  umlclass->template = dia_uml_class_is_template (editor_state);
-
-  /* Insert new formal params and remove them from gtklist: */
-  i = 0;
-  list_store = dia_uml_class_get_formal_parameters (editor_state);
-  /* Insert new operations and remove them from gtklist: */
-  while ((itm = g_list_model_get_item (list_store, i))) {
-    DiaUmlFormalParameter *param = DIA_UML_FORMAL_PARAMETER (itm);
-
-    umlclass->formal_params = g_list_append(umlclass->formal_params, g_object_ref (param));
-
-    i++;
-  }
-}
-
-void 
-_operations_create_page(GtkNotebook *notebook, UMLClass *umlclass)
-{
-  GtkWidget *page_label;
-
-  /* Operations page: */
-  page_label = gtk_label_new_with_mnemonic (_("_Operations"));
-  umlclass->properties_dialog->editor = dia_uml_class_editor_new (dia_uml_class_new (umlclass));
-
-  gtk_widget_show (page_label);
-  gtk_widget_show (umlclass->properties_dialog->editor);
-
-  gtk_notebook_append_page (notebook, umlclass->properties_dialog->editor, page_label);
-}
-
 void
 list_box_separators (GtkListBoxRow *row,
                      GtkListBoxRow *before,
diff --git a/objects/UML/dia-uml-class.c b/objects/UML/dia-uml-class.c
index cbfb00bd..e179d95a 100644
--- a/objects/UML/dia-uml-class.c
+++ b/objects/UML/dia-uml-class.c
@@ -3,6 +3,7 @@
 #include "dia-uml-attribute.h"
 #include "dia-uml-formal-parameter.h"
 #include "editor/dia-uml-list-store.h"
+#include "class_dialog.h"
 
 struct _DiaUmlClass {
   GObject parent;
@@ -42,8 +43,6 @@ struct _DiaUmlClass {
   GdkRGBA fill_color;
   GdkRGBA text_color;
 
-  /* Maybe we could use GListStore for these? */
-
   /* Attributes: */
   DiaUmlListStore *attributes;
 
@@ -58,7 +57,20 @@ struct _DiaUmlClass {
 G_DEFINE_TYPE (DiaUmlClass, dia_uml_class, G_TYPE_OBJECT)
 
 enum {
-  PROP_IS_TEMPLATE = 1,
+  PROP_NAME = 1,
+  PROP_STEREOTYPE,
+  PROP_COMMENT,
+  PROP_ABSTRACT,
+  PROP_COMMENTS,
+  PROP_COMMENT_WRAP_POINT,
+  PROP_DOCUMENTATION_TAG,
+  PROP_ATTRIBUTES_VISIBLE,
+  PROP_ATTRIBUTES_SUPPRESS,
+  PROP_OPERATIONS_VISIBLE,
+  PROP_OPERATIONS_SUPPRESS,
+  PROP_OPERATIONS_WRAP,
+  PROP_OPERATIONS_WRAP_POINT,
+  PROP_IS_TEMPLATE,
   N_PROPS
 };
 static GParamSpec* properties[N_PROPS];
@@ -99,6 +111,45 @@ dia_uml_class_set_property (GObject      *object,
   DiaUmlClass *self = DIA_UML_CLASS (object);
 
   switch (property_id) {
+    case PROP_NAME:
+      self->name = g_value_dup_string (value);
+      break;
+    case PROP_STEREOTYPE:
+      self->stereotype = g_value_dup_string (value);
+      break;
+    case PROP_COMMENT:
+      self->comment = g_value_dup_string (value);
+      break;
+    case PROP_ABSTRACT:
+      self->abstract = g_value_get_boolean (value);
+      break;
+    case PROP_COMMENTS:
+      self->visible_comments = g_value_get_boolean (value);
+      break;
+    case PROP_COMMENT_WRAP_POINT:
+      self->comment_line_length = g_value_get_int (value);
+      break;
+    case PROP_DOCUMENTATION_TAG:
+      self->comment_tagging = g_value_get_boolean (value);
+      break;
+    case PROP_ATTRIBUTES_VISIBLE:
+      self->visible_attributes = g_value_get_boolean (value);
+      break;
+    case PROP_ATTRIBUTES_SUPPRESS:
+      self->suppress_attributes = g_value_get_boolean (value);
+      break;
+    case PROP_OPERATIONS_VISIBLE:
+      self->visible_operations = g_value_get_boolean (value);
+      break;
+    case PROP_OPERATIONS_SUPPRESS:
+      self->suppress_operations = g_value_get_boolean (value);
+      break;
+    case PROP_OPERATIONS_WRAP:
+      self->wrap_operations = g_value_get_boolean (value);
+      break;
+    case PROP_OPERATIONS_WRAP_POINT:
+      self->wrap_after_char = g_value_get_int (value);
+      break;
     case PROP_IS_TEMPLATE:
       self->is_template = g_value_get_boolean (value);
       break;
@@ -117,6 +168,45 @@ dia_uml_class_get_property (GObject    *object,
   DiaUmlClass *self = DIA_UML_CLASS (object);
 
   switch (property_id) {
+    case PROP_NAME:
+      g_value_set_string (value, self->name);
+      break;
+    case PROP_STEREOTYPE:
+      g_value_set_string (value, self->stereotype ? self->stereotype : "");
+      break;
+    case PROP_COMMENT:
+      g_value_set_string (value, self->comment ? self->comment : "");
+      break;
+    case PROP_ABSTRACT:
+      g_value_set_boolean (value, self->abstract);
+      break;
+    case PROP_COMMENTS:
+      g_value_set_boolean (value, self->visible_comments);
+      break;
+    case PROP_COMMENT_WRAP_POINT:
+      g_value_set_int (value, self->comment_line_length);
+      break;
+    case PROP_DOCUMENTATION_TAG:
+      g_value_set_boolean (value, self->comment_tagging);
+      break;
+    case PROP_ATTRIBUTES_VISIBLE:
+      g_value_set_boolean (value, self->visible_attributes);
+      break;
+    case PROP_ATTRIBUTES_SUPPRESS:
+      g_value_set_boolean (value, self->suppress_attributes);
+      break;
+    case PROP_OPERATIONS_VISIBLE:
+      g_value_set_boolean (value, self->visible_operations);
+      break;
+    case PROP_OPERATIONS_SUPPRESS:
+      g_value_set_boolean (value, self->suppress_operations);
+      break;
+    case PROP_OPERATIONS_WRAP:
+      g_value_set_boolean (value, self->wrap_operations);
+      break;
+    case PROP_OPERATIONS_WRAP_POINT:
+      g_value_set_int (value, self->wrap_after_char);
+      break;
     case PROP_IS_TEMPLATE:
       g_value_set_boolean (value, self->is_template);
       break;
@@ -135,6 +225,75 @@ dia_uml_class_class_init (DiaUmlClassClass *klass)
   object_class->set_property = dia_uml_class_set_property;
   object_class->get_property = dia_uml_class_get_property;
 
+  properties[PROP_NAME] = g_param_spec_string ("name",
+                                               "Name",
+                                               "Class name",
+                                               "",
+                                               G_PARAM_READWRITE);
+  properties[PROP_STEREOTYPE] = g_param_spec_string ("stereotype",
+                                                     "Stereotype",
+                                                     "Parent type",
+                                                     "",
+                                                     G_PARAM_READWRITE);
+  properties[PROP_COMMENT] = g_param_spec_string ("comment",
+                                                  "Comment",
+                                                  "Class comment",
+                                                  "",
+                                                  G_PARAM_READWRITE);
+  properties[PROP_ABSTRACT] = g_param_spec_boolean ("abstract",
+                                                    "Abstract",
+                                                    "Is an abstract class",
+                                                    FALSE,
+                                                    G_PARAM_READWRITE);
+  properties[PROP_COMMENTS] = g_param_spec_boolean ("comments",
+                                                    "Comments",
+                                                    "Show comments",
+                                                    FALSE,
+                                                    G_PARAM_READWRITE);
+  properties[PROP_COMMENT_WRAP_POINT] = g_param_spec_int ("comment-wrap-point",
+                                                          "Comments",
+                                                          "Show comments",
+                                                           17,
+                                                           200,
+                                                           17,
+                                                           G_PARAM_READWRITE);
+  properties[PROP_DOCUMENTATION_TAG] = g_param_spec_boolean ("documentation-tag",
+                                                             "Documentation tag",
+                                                             "Show documentation tag",
+                                                             FALSE,
+                                                             G_PARAM_READWRITE);
+  properties[PROP_ATTRIBUTES_VISIBLE] = g_param_spec_boolean ("attributes-visible",
+                                                              "Attributes visible",
+                                                              "Are attributes visible",
+                                                              TRUE,
+                                                              G_PARAM_READWRITE);
+  properties[PROP_ATTRIBUTES_SUPPRESS] = g_param_spec_boolean ("attributes-suppress",
+                                                               "Attributes suppress",
+                                                               "Are attributes supressed",
+                                                               FALSE,
+                                                               G_PARAM_READWRITE);
+  properties[PROP_OPERATIONS_VISIBLE] = g_param_spec_boolean ("operations-visible",
+                                                              "Operations visible",
+                                                              "Are operations visible",
+                                                              TRUE,
+                                                              G_PARAM_READWRITE);
+  properties[PROP_OPERATIONS_SUPPRESS] = g_param_spec_boolean ("operations-suppress",
+                                                               "Operations suppress",
+                                                               "Are operations supressed",
+                                                               FALSE,
+                                                               G_PARAM_READWRITE);
+  properties[PROP_OPERATIONS_WRAP] = g_param_spec_boolean ("operations-wrap",
+                                                           "Operations wrap",
+                                                           "Should operations be wrapped",
+                                                           TRUE,
+                                                           G_PARAM_READWRITE);
+  properties[PROP_OPERATIONS_WRAP_POINT] = g_param_spec_int ("operations-wrap-point",
+                                                             "Operations wrap point",
+                                                             "Where operations should be wrapped",
+                                                             0,
+                                                             200,
+                                                             40,
+                                                             G_PARAM_READWRITE);
   properties[PROP_IS_TEMPLATE] = g_param_spec_boolean ("is-template",
                                                        "Is template",
                                                        "Is a template class",
@@ -250,11 +409,21 @@ dia_uml_class_load (DiaUmlClass *self,
 /* Sync from self to klass */
 void
 dia_uml_class_store (DiaUmlClass *self,
-                     UMLClass    *klass)
+                     UMLClass    *klass,
+                     GList      **added,
+                     GList      **removed,
+                     GList      **disconnected)
 {
-  GList *list;
+  GListModel *list_store;
   DiaUmlListData *itm;
+  DiaObject *obj;
+  gboolean attr_visible = TRUE;
+  gboolean op_visible = TRUE;
   int i = 0;
+  int connection_index = UMLCLASS_CONNECTIONPOINTS;
+
+  /* Cast to DiaObject (UMLClass -> Element -> DiaObject) */
+  obj = &klass->element.object;
 
   klass->font_height = self->font_height;
   klass->abstract_font_height = self->abstract_font_height;
@@ -293,37 +462,103 @@ dia_uml_class_store (DiaUmlClass *self,
   klass->comment_line_length = self->comment_line_length;
   klass->comment_tagging = self->comment_tagging;
 
+  klass->template = self->is_template;
+
   klass->line_color = self->line_color;
   klass->fill_color = self->fill_color;
   klass->text_color = self->text_color;
 
-  /* TODO: List stuff */
-  list = NULL;
+  /* Free current attributes: */
+  g_list_free_full (klass->attributes, g_object_unref);
+  klass->attributes = NULL;
+
+  /* Free current operations: */
+  /* Clear those already stored */
+  g_list_free_full (klass->operations, g_object_unref);
+  klass->operations = NULL;
+
+  /* Free current formal parameters: */
+  g_list_free_full (klass->formal_params, g_object_unref);
+  klass->formal_params = NULL;
+
+  /* If attributes visible and not suppressed */
+  attr_visible = (self->visible_attributes) && (!self->suppress_attributes);
+
+  /* Insert new attributes and remove them from gtklist: */
   i = 0;
-  while ((itm = g_list_model_get_item (G_LIST_MODEL (self->attributes), i))) {
-    list = g_list_append (list, itm);
+  list_store = dia_uml_class_get_attributes (self);
+  /* Insert new operations and remove them from gtklist: */
+  while ((itm = g_list_model_get_item (list_store, i))) {
+    DiaUmlAttribute *attr = DIA_UML_ATTRIBUTE (itm);
+
+    klass->attributes = g_list_append (klass->attributes, g_object_ref (attr));
+    
+    if (attr->left_connection == NULL) {
+      dia_uml_attribute_ensure_connection_points (attr, obj);
+
+      *added = g_list_prepend (*added, attr->left_connection);
+      *added = g_list_prepend (*added, attr->right_connection);
+    }
+
+    if (attr_visible) { 
+      obj->connections[connection_index] = attr->left_connection;
+      connection_index++;
+      obj->connections[connection_index] = attr->right_connection;
+      connection_index++;
+    } else {
+      _umlclass_store_disconnects (attr->left_connection, disconnected);
+      object_remove_connections_to(attr->left_connection);
+      _umlclass_store_disconnects (attr->right_connection, disconnected);
+      object_remove_connections_to(attr->right_connection);
+    }
+
     i++;
   }
-  klass->attributes = list;
 
+  /* If operations visible and not suppressed */
+  op_visible = (self->visible_operations) && (!self->suppress_operations);
 
-  list = NULL;
   i = 0;
-  while ((itm = g_list_model_get_item (G_LIST_MODEL (self->operations), i))) {
-    list = g_list_append (list, itm);
+  list_store = dia_uml_class_get_operations (self);
+  /* Insert new operations and remove them from gtklist: */
+  while ((itm = g_list_model_get_item (list_store, i))) {
+    DiaUmlOperation *op = DIA_UML_OPERATION (itm);
+
+    klass->operations = g_list_append(klass->operations, g_object_ref (op));
+
+    if (op->l_connection == NULL) {
+      dia_uml_operation_ensure_connection_points (op, obj);
+      
+      *added = g_list_prepend (*added, op->l_connection);
+      *added = g_list_prepend (*added, op->r_connection);
+    }
+
+    if (op_visible) { 
+      obj->connections[connection_index] = op->l_connection;
+      connection_index++;
+      obj->connections[connection_index] = op->r_connection;
+      connection_index++;
+    } else {
+      _umlclass_store_disconnects (op->l_connection, disconnected);
+      object_remove_connections_to(op->l_connection);
+      _umlclass_store_disconnects (op->r_connection, disconnected);
+      object_remove_connections_to(op->r_connection);
+    }
+
     i++;
   }
-  klass->operations = list;
-
-  klass->template = self->is_template;
 
-  list = NULL;
+  /* Insert new formal params and remove them from gtklist: */
   i = 0;
-  while ((itm = g_list_model_get_item (G_LIST_MODEL (self->formal_params), i))) {
-    list = g_list_append (list, itm);
+  list_store = dia_uml_class_get_formal_parameters (self);
+  /* Insert new operations and remove them from gtklist: */
+  while ((itm = g_list_model_get_item (list_store, i))) {
+    DiaUmlFormalParameter *param = DIA_UML_FORMAL_PARAMETER (itm);
+
+    klass->formal_params = g_list_append(klass->formal_params, g_object_ref (param));
+
     i++;
   }
-  klass->formal_params = list;
 }
 
 gboolean
diff --git a/objects/UML/dia-uml-class.h b/objects/UML/dia-uml-class.h
index 9debbdad..ab9f61cc 100644
--- a/objects/UML/dia-uml-class.h
+++ b/objects/UML/dia-uml-class.h
@@ -17,7 +17,10 @@ DiaUmlClass     *dia_uml_class_new                     (UMLClass              *k
 void             dia_uml_class_load                    (DiaUmlClass           *self,
                                                         UMLClass              *klass);
 void             dia_uml_class_store                   (DiaUmlClass           *self,
-                                                        UMLClass              *klass);
+                                                        UMLClass              *klass,
+                                                        GList                **added,
+                                                        GList                **removed,
+                                                        GList                **disconnected);
 gboolean         dia_uml_class_is_template             (DiaUmlClass           *klass);
 GListModel      *dia_uml_class_get_attributes          (DiaUmlClass           *self);
 void             dia_uml_class_remove_attribute        (DiaUmlClass           *self,
diff --git a/objects/UML/editor/dia-uml-class-editor.c b/objects/UML/editor/dia-uml-class-editor.c
index ceaf3265..58fd3e75 100644
--- a/objects/UML/editor/dia-uml-class-editor.c
+++ b/objects/UML/editor/dia-uml-class-editor.c
@@ -9,10 +9,25 @@
 struct _DiaUmlClassEditor {
   GtkScrolledWindow parent;
 
+  GtkWidget *name;
+  GtkWidget *stereotype;
+  GtkTextBuffer *comment;
+  GtkWidget *abstract;
+  GtkWidget *comments;
+  GtkWidget *comments_wrap_point;
+  GtkWidget *doc_tag;
+
+  GtkWidget *attr_visible;
+  GtkWidget *attr_suppress;
+  GtkWidget *op_visible;
+  GtkWidget *op_suppress;
+  GtkWidget *op_wrap;
+  GtkWidget *op_wrap_point;
+  GtkWidget *is_template;
+
   GtkWidget *attributes;
   GtkWidget *operations;
   GtkWidget *templates;
-  GtkWidget *is_template;
 
   DiaUmlClass *klass;
 };
@@ -197,6 +212,45 @@ dia_uml_class_editor_set_property (GObject      *object,
   switch (property_id) {
     case UML_CEDIT_PROP_CLASS:
       self->klass = g_value_dup_object (value);
+      g_object_bind_property (G_OBJECT (self->klass), "name",
+                              G_OBJECT (self->name), "text",
+                              G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+      g_object_bind_property (G_OBJECT (self->klass), "stereotype",
+                              G_OBJECT (self->stereotype), "text",
+                              G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+      g_object_bind_property (G_OBJECT (self->klass), "comment",
+                              G_OBJECT (self->comment), "text",
+                              G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+      g_object_bind_property (G_OBJECT (self->klass), "abstract",
+                              G_OBJECT (self->abstract), "active",
+                              G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+      g_object_bind_property (G_OBJECT (self->klass), "comments",
+                              G_OBJECT (self->comments), "active",
+                              G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+      g_object_bind_property (G_OBJECT (self->klass), "comment-wrap-point",
+                              G_OBJECT (self->comments_wrap_point), "value",
+                              G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+      g_object_bind_property (G_OBJECT (self->klass), "documentation-tag",
+                              G_OBJECT (self->doc_tag), "active",
+                              G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+      g_object_bind_property (G_OBJECT (self->klass), "attributes-visible",
+                              G_OBJECT (self->attr_visible), "active",
+                              G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+      g_object_bind_property (G_OBJECT (self->klass), "attributes-suppress",
+                              G_OBJECT (self->attr_suppress), "active",
+                              G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+      g_object_bind_property (G_OBJECT (self->klass), "operations-visible",
+                              G_OBJECT (self->op_visible), "active",
+                              G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+      g_object_bind_property (G_OBJECT (self->klass), "operations-suppress",
+                              G_OBJECT (self->op_suppress), "active",
+                              G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+      g_object_bind_property (G_OBJECT (self->klass), "operations-wrap",
+                              G_OBJECT (self->op_wrap), "active",
+                              G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+      g_object_bind_property (G_OBJECT (self->klass), "operations-wrap-point",
+                              G_OBJECT (self->op_wrap_point), "value",
+                              G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
       g_object_bind_property (G_OBJECT (self->klass), "is-template",
                               G_OBJECT (self->is_template), "active",
                               G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
@@ -258,6 +312,19 @@ dia_uml_class_editor_class_init (DiaUmlClassEditorClass *klass)
 
   gtk_widget_class_set_template (widget_class, template);
 
+  gtk_widget_class_bind_template_child (widget_class, DiaUmlClassEditor, name);
+  gtk_widget_class_bind_template_child (widget_class, DiaUmlClassEditor, stereotype);
+  gtk_widget_class_bind_template_child (widget_class, DiaUmlClassEditor, comment);
+  gtk_widget_class_bind_template_child (widget_class, DiaUmlClassEditor, abstract);
+  gtk_widget_class_bind_template_child (widget_class, DiaUmlClassEditor, comments);
+  gtk_widget_class_bind_template_child (widget_class, DiaUmlClassEditor, comments_wrap_point);
+  gtk_widget_class_bind_template_child (widget_class, DiaUmlClassEditor, doc_tag);
+  gtk_widget_class_bind_template_child (widget_class, DiaUmlClassEditor, attr_visible);
+  gtk_widget_class_bind_template_child (widget_class, DiaUmlClassEditor, attr_suppress);
+  gtk_widget_class_bind_template_child (widget_class, DiaUmlClassEditor, op_visible);
+  gtk_widget_class_bind_template_child (widget_class, DiaUmlClassEditor, op_suppress);
+  gtk_widget_class_bind_template_child (widget_class, DiaUmlClassEditor, op_wrap);
+  gtk_widget_class_bind_template_child (widget_class, DiaUmlClassEditor, op_wrap_point);
   gtk_widget_class_bind_template_child (widget_class, DiaUmlClassEditor, is_template);
 
   gtk_widget_class_bind_template_child (widget_class, DiaUmlClassEditor, attributes);


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