[dia/dia-next: 52/59] Move DiaUmlList* to libdia as they may be useful elsewhere
- From: Zander <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia/dia-next: 52/59] Move DiaUmlList* to libdia as they may be useful elsewhere
- Date: Wed, 9 Jan 2019 18:38:40 +0000 (UTC)
commit 2d5f1295b13e8d9217261f0b029ffd582e82f7d4
Author: Zander Brown <zbrown gnome org>
Date: Mon Jan 7 15:36:14 2019 +0000
Move DiaUmlList* to libdia as they may be useful elsewhere
Hacky workaround to load/save parameters in UML
.gitignore | 2 +
app/exit_dialog.c | 2 +-
data/{dia-uml-list-row.ui => dia-list-row.ui} | 6 +-
lib/Makefile.am | 3 +
lib/geometry.c | 1 -
.../list/dia-list-data.c | 20 ++---
lib/list/dia-list-data.h | 18 ++++
.../dia-uml-list-row.c => lib/list/dia-list-row.c | 82 +++++++++---------
lib/list/dia-list-row.h | 14 ++++
.../list/dia-list-store.c | 98 +++++++++++-----------
lib/list/dia-list-store.h | 24 ++++++
lib/properties.c | 1 -
lib/renderer/diacairo.h | 2 +-
lib/widgets/dia-line-chooser-popover.h | 2 +-
objects/UML/Makefile.am | 3 -
objects/UML/class_dialog.c | 4 +-
objects/UML/dia-uml-attribute.c | 22 ++---
objects/UML/dia-uml-attribute.h | 2 +-
objects/UML/dia-uml-class.c | 36 ++++----
objects/UML/dia-uml-formal-parameter.c | 14 ++--
objects/UML/dia-uml-formal-parameter.h | 2 +-
objects/UML/dia-uml-operation.c | 80 +++++++++++-------
objects/UML/dia-uml-operation.h | 7 +-
objects/UML/dia-uml-parameter.c | 20 ++---
objects/UML/editor/dia-uml-class-editor.c | 22 ++---
objects/UML/editor/dia-uml-list-data.h | 18 ----
objects/UML/editor/dia-uml-list-row.h | 14 ----
objects/UML/editor/dia-uml-list-store.h | 24 ------
objects/UML/editor/dia-uml-operation-dialog.c | 3 +-
.../UML/editor/dia-uml-operation-parameter-row.c | 24 +++---
.../UML/editor/dia-uml-operation-parameter-row.h | 4 +-
po/POTFILES.in | 14 ----
32 files changed, 297 insertions(+), 291 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index caef0bb8..3ba6c96a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -46,3 +46,5 @@ compile
.vscode/
tests/sizeof
tests/testsvg
+bindings/html
+**/.dirstamp
diff --git a/app/exit_dialog.c b/app/exit_dialog.c
index e09f1000..03042778 100644
--- a/app/exit_dialog.c
+++ b/app/exit_dialog.c
@@ -105,7 +105,7 @@ exit_dialog_make (GtkWindow * parent_window,
/* Scrolled window for displaying things which need saving */
scrolled = gtk_scrolled_window_new (NULL, NULL);
g_object_set (scrolled,
- "height-request", 60,
+ "height-request", 100,
"shadow-type", GTK_SHADOW_IN,
NULL);
gtk_box_pack_start (GTK_BOX (vbox), scrolled, TRUE, TRUE, 0);
diff --git a/data/dia-uml-list-row.ui b/data/dia-list-row.ui
similarity index 96%
rename from data/dia-uml-list-row.ui
rename to data/dia-list-row.ui
index 290300ad..1d73c0c9 100644
--- a/data/dia-uml-list-row.ui
+++ b/data/dia-list-row.ui
@@ -12,7 +12,7 @@
<property name="can_focus">False</property>
<property name="icon_name">go-down-symbolic</property>
</object>
- <template class="DiaUmlListRow" parent="GtkListBoxRow">
+ <template class="DiaListRow" parent="GtkListBoxRow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
@@ -49,7 +49,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">image1</property>
- <signal name="clicked" handler="move_up" object="DiaUmlListRow" swapped="yes"/>
+ <signal name="clicked" handler="move_up" object="DiaListRow" swapped="yes"/>
</object>
<packing>
<property name="expand">False</property>
@@ -63,7 +63,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">image2</property>
- <signal name="clicked" handler="move_down" object="DiaUmlListRow" swapped="yes"/>
+ <signal name="clicked" handler="move_down" object="DiaListRow" swapped="yes"/>
</object>
<packing>
<property name="expand">False</property>
diff --git a/lib/Makefile.am b/lib/Makefile.am
index b8d47059..fd3e0ab1 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -3,6 +3,9 @@
SUBDIRS=pixmaps
stdprop_files = \
+ list/dia-list-data.c \
+ list/dia-list-store.c \
+ list/dia-list-row.c \
properties.h \
properties.c \
propinternals.h \
diff --git a/lib/geometry.c b/lib/geometry.c
index 8f4810c8..c6972e2c 100644
--- a/lib/geometry.c
+++ b/lib/geometry.c
@@ -26,7 +26,6 @@
/* include normal versions of the inlined functions here ... */
#undef G_INLINE_FUNC
#define G_INLINE_FUNC extern
-#define G_CAN_INLINE 1
#include "geometry.h"
#include "object.h"
diff --git a/objects/UML/editor/dia-uml-list-data.c b/lib/list/dia-list-data.c
similarity index 55%
rename from objects/UML/editor/dia-uml-list-data.c
rename to lib/list/dia-list-data.c
index 0e908a89..ae58450d 100644
--- a/objects/UML/editor/dia-uml-list-data.c
+++ b/lib/list/dia-list-data.c
@@ -1,7 +1,7 @@
#include <glib-object.h>
-#include "dia-uml-list-data.h"
+#include "dia-list-data.h"
-G_DEFINE_INTERFACE (DiaUmlListData, dia_uml_list_data, G_TYPE_OBJECT)
+G_DEFINE_INTERFACE (DiaListData, dia_list_data, G_TYPE_OBJECT)
enum {
CHANGED,
@@ -10,15 +10,15 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
static const gchar *
-dia_uml_list_data_default_format (DiaUmlListData *self)
+dia_list_data_default_format (DiaListData *self)
{
return G_OBJECT_TYPE_NAME (self);
}
static void
-dia_uml_list_data_default_init (DiaUmlListDataInterface *iface)
+dia_list_data_default_init (DiaListDataInterface *iface)
{
- iface->format = dia_uml_list_data_default_format;
+ iface->format = dia_list_data_default_format;
signals[CHANGED] = g_signal_new ("changed",
G_TYPE_FROM_CLASS (iface),
@@ -28,19 +28,19 @@ dia_uml_list_data_default_init (DiaUmlListDataInterface *iface)
}
void
-dia_uml_list_data_changed (DiaUmlListData *self)
+dia_list_data_changed (DiaListData *self)
{
g_signal_emit (G_OBJECT (self), signals[CHANGED], 0);
}
const gchar *
-dia_uml_list_data_format (DiaUmlListData *self)
+dia_list_data_format (DiaListData *self)
{
- DiaUmlListDataInterface *iface;
+ DiaListDataInterface *iface;
- g_return_val_if_fail (DIA_UML_IS_LIST_DATA (self), NULL);
+ g_return_val_if_fail (DIA_IS_LIST_DATA (self), NULL);
- iface = DIA_UML_LIST_DATA_GET_IFACE (self);
+ iface = DIA_LIST_DATA_GET_IFACE (self);
g_return_val_if_fail (iface->format != NULL, NULL);
return iface->format (self);
diff --git a/lib/list/dia-list-data.h b/lib/list/dia-list-data.h
new file mode 100644
index 00000000..f92576e8
--- /dev/null
+++ b/lib/list/dia-list-data.h
@@ -0,0 +1,18 @@
+#include <glib-object.h>
+
+#ifndef LIST_DATA_H
+#define LIST_DATA_H
+
+#define DIA_TYPE_LIST_DATA (dia_list_data_get_type ())
+G_DECLARE_INTERFACE (DiaListData, dia_list_data, DIA, LIST_DATA, GObject)
+
+struct _DiaListDataInterface {
+ GTypeInterface parent_iface;
+
+ const gchar * (* format) (DiaListData *self);
+};
+
+void dia_list_data_changed (DiaListData *self);
+const gchar *dia_list_data_format (DiaListData *self);
+
+#endif
diff --git a/objects/UML/editor/dia-uml-list-row.c b/lib/list/dia-list-row.c
similarity index 59%
rename from objects/UML/editor/dia-uml-list-row.c
rename to lib/list/dia-list-row.c
index e7226ffa..6a715bb8 100644
--- a/objects/UML/editor/dia-uml-list-row.c
+++ b/lib/list/dia-list-row.c
@@ -1,17 +1,17 @@
-#include "dia-uml-list-data.h"
-#include "dia-uml-list-row.h"
+#include "dia-list-data.h"
+#include "dia-list-row.h"
#include "dia_dirs.h"
-struct _DiaUmlListRow {
+struct _DiaListRow {
GtkListBoxRow parent;
GtkWidget *title;
- DiaUmlListData *data;
- DiaUmlListStore *model;
+ DiaListData *data;
+ DiaListStore *model;
};
-G_DEFINE_TYPE (DiaUmlListRow, dia_uml_list_row, GTK_TYPE_LIST_BOX_ROW)
+G_DEFINE_TYPE (DiaListRow, dia_list_row, GTK_TYPE_LIST_BOX_ROW)
enum {
PROP_DATA = 1,
@@ -21,29 +21,29 @@ enum {
static GParamSpec* properties[N_PROPS];
static void
-dia_uml_list_row_finalize (GObject *object)
+dia_list_row_finalize (GObject *object)
{
- DiaUmlListRow *self = DIA_UML_LIST_ROW (object);
+ DiaListRow *self = DIA_LIST_ROW (object);
g_clear_object (&self->data);
g_clear_object (&self->model);
}
static void
-display_op (DiaUmlListData *op,
- DiaUmlListRow *row)
+display_op (DiaListData *op,
+ DiaListRow *row)
{
gtk_label_set_label (GTK_LABEL (row->title),
- dia_uml_list_data_format (op));
+ dia_list_data_format (op));
}
static void
-dia_uml_list_row_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+dia_list_row_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- DiaUmlListRow *self = DIA_UML_LIST_ROW (object);
+ DiaListRow *self = DIA_LIST_ROW (object);
switch (property_id) {
case PROP_DATA:
self->data = g_value_dup_object (value);
@@ -61,12 +61,12 @@ dia_uml_list_row_set_property (GObject *object,
}
static void
-dia_uml_list_row_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+dia_list_row_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- DiaUmlListRow *self = DIA_UML_LIST_ROW (object);
+ DiaListRow *self = DIA_LIST_ROW (object);
switch (property_id) {
case PROP_DATA:
g_value_set_object (value, self->data);
@@ -81,33 +81,33 @@ dia_uml_list_row_get_property (GObject *object,
}
static void
-move_up (DiaUmlListRow *self)
+move_up (DiaListRow *self)
{
int index;
index = gtk_list_box_row_get_index (GTK_LIST_BOX_ROW (self));
g_object_ref (self->data);
- dia_uml_list_store_remove (self->model, self->data);
- dia_uml_list_store_insert (self->model, self->data, index - 1);
+ dia_list_store_remove (self->model, self->data);
+ dia_list_store_insert (self->model, self->data, index - 1);
g_object_unref (self->data);
}
static void
-move_down (DiaUmlListRow *self)
+move_down (DiaListRow *self)
{
int index;
index = gtk_list_box_row_get_index (GTK_LIST_BOX_ROW (self));
g_object_ref (self->data);
- dia_uml_list_store_remove (self->model, self->data);
- dia_uml_list_store_insert (self->model, self->data, index + 1);
+ dia_list_store_remove (self->model, self->data);
+ dia_list_store_insert (self->model, self->data, index + 1);
g_object_unref (self->data);
}
static void
-dia_uml_list_row_class_init (DiaUmlListRowClass *klass)
+dia_list_row_class_init (DiaListRowClass *klass)
{
GFile *template_file;
GBytes *template;
@@ -115,22 +115,22 @@ dia_uml_list_row_class_init (DiaUmlListRowClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- object_class->finalize = dia_uml_list_row_finalize;
- object_class->set_property = dia_uml_list_row_set_property;
- object_class->get_property = dia_uml_list_row_get_property;
+ object_class->finalize = dia_list_row_finalize;
+ object_class->set_property = dia_list_row_set_property;
+ object_class->get_property = dia_list_row_get_property;
properties[PROP_DATA] =
g_param_spec_object ("data",
"Data",
"Data this row represents",
- DIA_UML_TYPE_LIST_DATA,
+ DIA_TYPE_LIST_DATA,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
properties[PROP_MODEL] =
g_param_spec_object ("model",
"Model",
"Model this row belongs to",
- DIA_UML_TYPE_LIST_STORE,
+ DIA_TYPE_LIST_STORE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_properties (object_class,
@@ -138,14 +138,14 @@ dia_uml_list_row_class_init (DiaUmlListRowClass *klass)
properties);
/* TODO: Use GResource */
- template_file = g_file_new_for_path (build_ui_filename ("ui/dia-uml-list-row.ui"));
+ template_file = g_file_new_for_path (build_ui_filename ("ui/dia-list-row.ui"));
template = g_file_load_bytes (template_file, NULL, NULL, &err);
if (err)
g_critical ("Failed to load template: %s", err->message);
gtk_widget_class_set_template (widget_class, template);
- gtk_widget_class_bind_template_child (widget_class, DiaUmlListRow, title);
+ gtk_widget_class_bind_template_child (widget_class, DiaListRow, title);
gtk_widget_class_bind_template_callback (widget_class, move_up);
gtk_widget_class_bind_template_callback (widget_class, move_down);
@@ -153,23 +153,23 @@ dia_uml_list_row_class_init (DiaUmlListRowClass *klass)
}
static void
-dia_uml_list_row_init (DiaUmlListRow *self)
+dia_list_row_init (DiaListRow *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
}
GtkWidget *
-dia_uml_list_row_new (DiaUmlListData *data,
- DiaUmlListStore *model)
+dia_list_row_new (DiaListData *data,
+ DiaListStore *model)
{
- return g_object_new (DIA_UML_TYPE_LIST_ROW,
+ return g_object_new (DIA_TYPE_LIST_ROW,
"data", data,
"model", model,
NULL);
}
-DiaUmlListData *
-dia_uml_list_row_get_data (DiaUmlListRow *self)
+DiaListData *
+dia_list_row_get_data (DiaListRow *self)
{
return g_object_ref (self->data);
}
diff --git a/lib/list/dia-list-row.h b/lib/list/dia-list-row.h
new file mode 100644
index 00000000..a3c34d82
--- /dev/null
+++ b/lib/list/dia-list-row.h
@@ -0,0 +1,14 @@
+#include <gtk/gtk.h>
+#include "dia-list-data.h"
+#include "dia-list-store.h"
+
+G_BEGIN_DECLS
+
+#define DIA_TYPE_LIST_ROW (dia_list_row_get_type ())
+G_DECLARE_FINAL_TYPE (DiaListRow, dia_list_row, DIA, LIST_ROW, GtkListBoxRow)
+
+GtkWidget *dia_list_row_new (DiaListData *data,
+ DiaListStore *model);
+DiaListData *dia_list_row_get_data (DiaListRow *self);
+
+G_END_DECLS
diff --git a/objects/UML/editor/dia-uml-list-store.c b/lib/list/dia-list-store.c
similarity index 51%
rename from objects/UML/editor/dia-uml-list-store.c
rename to lib/list/dia-list-store.c
index ce4b0ab1..fa438bec 100644
--- a/objects/UML/editor/dia-uml-list-store.c
+++ b/lib/list/dia-list-store.c
@@ -1,8 +1,8 @@
-#include "dia-uml-list-store.h"
+#include "dia-list-store.h"
#include <glib.h>
#include <gio/gio.h>
-struct _DiaUmlListStore
+struct _DiaListStore
{
GObject parent_instance;
@@ -22,30 +22,30 @@ enum {
};
static guint signals[LAST_SIGNAL] = { 0 };
-static void dia_uml_list_store_iface_init (GListModelInterface *iface);
+static void dia_list_store_iface_init (GListModelInterface *iface);
-G_DEFINE_TYPE_WITH_CODE (DiaUmlListStore, dia_uml_list_store, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, dia_uml_list_store_iface_init));
+G_DEFINE_TYPE_WITH_CODE (DiaListStore, dia_list_store, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, dia_list_store_iface_init));
static void
-dia_uml_list_store_dispose (GObject *object)
+dia_list_store_dispose (GObject *object)
{
- DiaUmlListStore *store = DIA_UML_LIST_STORE (object);
+ DiaListStore *store = DIA_LIST_STORE (object);
g_list_free_full (store->data, g_object_unref);
- G_OBJECT_CLASS (dia_uml_list_store_parent_class)->dispose (object);
+ G_OBJECT_CLASS (dia_list_store_parent_class)->dispose (object);
}
static void
-dia_uml_list_store_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+dia_list_store_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
switch (property_id) {
case PROP_ITEM_TYPE:
- g_value_set_gtype (value, DIA_UML_TYPE_LIST_DATA);
+ g_value_set_gtype (value, DIA_TYPE_LIST_DATA);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -53,15 +53,15 @@ dia_uml_list_store_get_property (GObject *object,
}
static void
-dia_uml_list_store_class_init (DiaUmlListStoreClass *klass)
+dia_list_store_class_init (DiaListStoreClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->dispose = dia_uml_list_store_dispose;
- object_class->get_property = dia_uml_list_store_get_property;
+ object_class->dispose = dia_list_store_dispose;
+ object_class->get_property = dia_list_store_get_property;
g_object_class_install_property (object_class, PROP_ITEM_TYPE,
- g_param_spec_gtype ("item-type", "", "", DIA_UML_TYPE_LIST_DATA,
+ g_param_spec_gtype ("item-type", "", "", DIA_TYPE_LIST_DATA,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
@@ -70,29 +70,29 @@ dia_uml_list_store_class_init (DiaUmlListStoreClass *klass)
G_SIGNAL_RUN_FIRST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 1,
- DIA_UML_TYPE_LIST_DATA);
+ DIA_TYPE_LIST_DATA);
}
static GType
-dia_uml_list_store_get_item_type (GListModel *list)
+dia_list_store_get_item_type (GListModel *list)
{
- return DIA_UML_TYPE_LIST_DATA;
+ return DIA_TYPE_LIST_DATA;
}
static guint
-dia_uml_list_store_get_n_items (GListModel *list)
+dia_list_store_get_n_items (GListModel *list)
{
- DiaUmlListStore *store = DIA_UML_LIST_STORE (list);
+ DiaListStore *store = DIA_LIST_STORE (list);
return g_list_length (store->data);
}
static gpointer
-dia_uml_list_store_get_item (GListModel *list,
- guint position)
+dia_list_store_get_item (GListModel *list,
+ guint position)
{
- DiaUmlListStore *store = DIA_UML_LIST_STORE (list);
- DiaUmlListData *item;
+ DiaListStore *store = DIA_LIST_STORE (list);
+ DiaListData *item;
item = g_list_nth_data (store->data, position);
@@ -103,41 +103,41 @@ dia_uml_list_store_get_item (GListModel *list,
}
static void
-dia_uml_list_store_iface_init (GListModelInterface *iface)
+dia_list_store_iface_init (GListModelInterface *iface)
{
- iface->get_item_type = dia_uml_list_store_get_item_type;
- iface->get_n_items = dia_uml_list_store_get_n_items;
- iface->get_item = dia_uml_list_store_get_item;
+ iface->get_item_type = dia_list_store_get_item_type;
+ iface->get_n_items = dia_list_store_get_n_items;
+ iface->get_item = dia_list_store_get_item;
}
static void
-dia_uml_list_store_init (DiaUmlListStore *store)
+dia_list_store_init (DiaListStore *store)
{
store->data = NULL;
}
-DiaUmlListStore *
-dia_uml_list_store_new ()
+DiaListStore *
+dia_list_store_new ()
{
- return g_object_new (DIA_UML_TYPE_LIST_STORE, NULL);
+ return g_object_new (DIA_TYPE_LIST_STORE, NULL);
}
static void
-bubble_change (DiaUmlListData *itm,
- DiaUmlListStore *self)
+bubble_change (DiaListData *itm,
+ DiaListStore *self)
{
g_signal_emit (self, signals[CHANGED], 0, itm);
}
void
-dia_uml_list_store_insert (DiaUmlListStore *store,
- DiaUmlListData *item,
- int index)
+dia_list_store_insert (DiaListStore *store,
+ DiaListData *item,
+ int index)
{
- g_return_if_fail (DIA_UML_IS_LIST_STORE (store));
+ g_return_if_fail (DIA_IS_LIST_STORE (store));
if (index >= g_list_length (store->data)) {
- dia_uml_list_store_add (store, item);
+ dia_list_store_add (store, item);
return;
}
@@ -148,12 +148,12 @@ dia_uml_list_store_insert (DiaUmlListStore *store,
}
void
-dia_uml_list_store_add (DiaUmlListStore *store,
- DiaUmlListData *item)
+dia_list_store_add (DiaListStore *store,
+ DiaListData *item)
{
guint n_items;
- g_return_if_fail (DIA_UML_IS_LIST_STORE (store));
+ g_return_if_fail (DIA_IS_LIST_STORE (store));
n_items = g_list_length (store->data);
store->data = g_list_append (store->data, g_object_ref (item));
@@ -163,12 +163,12 @@ dia_uml_list_store_add (DiaUmlListStore *store,
}
void
-dia_uml_list_store_remove (DiaUmlListStore *store,
- DiaUmlListData *item)
+dia_list_store_remove (DiaListStore *store,
+ DiaListData *item)
{
int index;
- g_return_if_fail (DIA_UML_IS_LIST_STORE (store));
+ g_return_if_fail (DIA_IS_LIST_STORE (store));
index = g_list_index (store->data, item);
store->data = g_list_remove (store->data, item);
@@ -179,12 +179,12 @@ dia_uml_list_store_remove (DiaUmlListStore *store,
}
void
-dia_uml_list_store_empty (DiaUmlListStore *store)
+dia_list_store_empty (DiaListStore *store)
{
guint n_items;
GList *list;
- g_return_if_fail (DIA_UML_IS_LIST_STORE (store));
+ g_return_if_fail (DIA_IS_LIST_STORE (store));
n_items = g_list_length (store->data);
list = store->data;
diff --git a/lib/list/dia-list-store.h b/lib/list/dia-list-store.h
new file mode 100644
index 00000000..e0691d0b
--- /dev/null
+++ b/lib/list/dia-list-store.h
@@ -0,0 +1,24 @@
+#include <glib-object.h>
+#include "dia-list-data.h"
+
+#ifndef LIST_STORE_H
+#define LIST_STORE_H
+
+G_BEGIN_DECLS
+
+#define DIA_TYPE_LIST_STORE (dia_list_store_get_type ())
+G_DECLARE_FINAL_TYPE (DiaListStore, dia_list_store, DIA, LIST_STORE, GObject)
+
+DiaListStore *dia_list_store_new (void);
+void dia_list_store_insert (DiaListStore *store,
+ DiaListData *item,
+ int index);
+void dia_list_store_add (DiaListStore *store,
+ DiaListData *item);
+void dia_list_store_remove (DiaListStore *store,
+ DiaListData *item);
+void dia_list_store_empty (DiaListStore *store);
+
+G_END_DECLS
+
+#endif
diff --git a/lib/properties.c b/lib/properties.c
index e70de410..21dbbcfb 100644
--- a/lib/properties.c
+++ b/lib/properties.c
@@ -34,7 +34,6 @@
#endif
#undef G_INLINE_FUNC
#define G_INLINE_FUNC extern
-#define G_CAN_INLINE 1
#include "properties.h"
#include "propinternals.h"
diff --git a/lib/renderer/diacairo.h b/lib/renderer/diacairo.h
index 061ff200..260ec667 100644
--- a/lib/renderer/diacairo.h
+++ b/lib/renderer/diacairo.h
@@ -112,6 +112,6 @@ gboolean cairo_export_data (DiagramData *data,
/* FIXME: need to think about proper registration */
GType dia_cairo_interactive_renderer_get_type (void) G_GNUC_CONST;
-DiaRenderer *dia_cairo_interactive_renderer_new ();
+DiaRenderer *dia_cairo_interactive_renderer_new (void);
G_END_DECLS
diff --git a/lib/widgets/dia-line-chooser-popover.h b/lib/widgets/dia-line-chooser-popover.h
index 164c4032..5d3f7e71 100644
--- a/lib/widgets/dia-line-chooser-popover.h
+++ b/lib/widgets/dia-line-chooser-popover.h
@@ -15,7 +15,7 @@ struct _DiaLineChooserPopoverClass {
GtkPopoverClass parent_class;
};
-GtkWidget *dia_line_chooser_popover_new ();
+GtkWidget *dia_line_chooser_popover_new (void);
LineStyle dia_line_chooser_popover_get_line_style (DiaLineChooserPopover *self,
gdouble *length);
void dia_line_chooser_popover_set_line_style (DiaLineChooserPopover *self,
diff --git a/objects/UML/Makefile.am b/objects/UML/Makefile.am
index 498fcbba..147cf4ba 100644
--- a/objects/UML/Makefile.am
+++ b/objects/UML/Makefile.am
@@ -13,9 +13,6 @@ libuml_objects_la_SOURCES = \
class.h \
class_dialog.h \
class_dialog.c \
- editor/dia-uml-list-data.c \
- editor/dia-uml-list-store.c \
- editor/dia-uml-list-row.c \
editor/dia-uml-class-editor.c \
editor/dia-uml-operation-dialog.c \
editor/dia-uml-operation-parameter-row.c \
diff --git a/objects/UML/class_dialog.c b/objects/UML/class_dialog.c
index 95e44035..257b5f7e 100644
--- a/objects/UML/class_dialog.c
+++ b/objects/UML/class_dialog.c
@@ -195,7 +195,7 @@ create_font_props_row (GtkGrid *table,
}
static void
-class_create_page(GtkNotebook *notebook, UMLClass *umlclass)
+class_create_page(GtkWidget *notebook, UMLClass *umlclass)
{
GtkWidget *page_label;
@@ -207,7 +207,7 @@ class_create_page(GtkNotebook *notebook, UMLClass *umlclass)
gtk_widget_show (page_label);
gtk_widget_show (umlclass->properties_dialog->editor);
- gtk_notebook_append_page (notebook, umlclass->properties_dialog->editor, page_label);
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), umlclass->properties_dialog->editor, page_label);
}
static void
diff --git a/objects/UML/dia-uml-attribute.c b/objects/UML/dia-uml-attribute.c
index 8bb7baca..85d097f9 100644
--- a/objects/UML/dia-uml-attribute.c
+++ b/objects/UML/dia-uml-attribute.c
@@ -29,7 +29,7 @@
#include "uml.h"
#include "dia-uml-attribute.h"
-#include "editor/dia-uml-list-data.h"
+#include "list/dia-list-data.h"
#include "properties.h"
extern PropEnumData _uml_visibilities[];
@@ -73,10 +73,10 @@ PropDescDArrayExtra umlattribute_extra = {
};
static void
-dia_uml_attribute_list_data_init (DiaUmlListDataInterface *iface);
+dia_uml_attribute_list_data_init (DiaListDataInterface *iface);
G_DEFINE_TYPE_WITH_CODE (DiaUmlAttribute, dia_uml_attribute, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (DIA_UML_TYPE_LIST_DATA,
+ G_IMPLEMENT_INTERFACE (DIA_TYPE_LIST_DATA,
dia_uml_attribute_list_data_init))
enum {
@@ -121,32 +121,32 @@ dia_uml_attribute_set_property (GObject *object,
case PROP_NAME:
self->name = g_value_dup_string (value);
g_object_notify_by_pspec (object, properties[PROP_NAME]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
case PROP_TYPE:
self->type = g_value_dup_string (value);
g_object_notify_by_pspec (object, properties[PROP_TYPE]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
case PROP_VALUE:
self->value = g_value_dup_string (value);
g_object_notify_by_pspec (object, properties[PROP_VALUE]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
case PROP_COMMENT:
self->comment = g_value_dup_string (value);
g_object_notify_by_pspec (object, properties[PROP_COMMENT]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
case PROP_VISIBILITY:
self->visibility = g_value_get_int (value);
g_object_notify_by_pspec (object, properties[PROP_VISIBILITY]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
case PROP_CLASS_SCOPE:
self->class_scope = g_value_get_boolean (value);
g_object_notify_by_pspec (object, properties[PROP_CLASS_SCOPE]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -188,13 +188,13 @@ dia_uml_attribute_get_property (GObject *object,
}
static const gchar *
-format (DiaUmlListData *self)
+format (DiaListData *self)
{
return dia_uml_attribute_format (DIA_UML_ATTRIBUTE (self));
}
static void
-dia_uml_attribute_list_data_init (DiaUmlListDataInterface *iface)
+dia_uml_attribute_list_data_init (DiaListDataInterface *iface)
{
iface->format = format;
}
diff --git a/objects/UML/dia-uml-attribute.h b/objects/UML/dia-uml-attribute.h
index 984a6320..f03f1087 100644
--- a/objects/UML/dia-uml-attribute.h
+++ b/objects/UML/dia-uml-attribute.h
@@ -26,7 +26,7 @@ struct _DiaUmlAttribute {
ConnectionPoint* right_connection; /**< right */
};
-DiaUmlAttribute *dia_uml_attribute_new ();
+DiaUmlAttribute *dia_uml_attribute_new (void);
/** calculated the 'formated' representation */
gchar *dia_uml_attribute_format (DiaUmlAttribute *attribute);
DiaUmlAttribute *dia_uml_attribute_copy (DiaUmlAttribute *attr);
diff --git a/objects/UML/dia-uml-class.c b/objects/UML/dia-uml-class.c
index e179d95a..b018ca4b 100644
--- a/objects/UML/dia-uml-class.c
+++ b/objects/UML/dia-uml-class.c
@@ -2,7 +2,7 @@
#include "dia-uml-operation.h"
#include "dia-uml-attribute.h"
#include "dia-uml-formal-parameter.h"
-#include "editor/dia-uml-list-store.h"
+#include "list/dia-list-store.h"
#include "class_dialog.h"
struct _DiaUmlClass {
@@ -44,14 +44,14 @@ struct _DiaUmlClass {
GdkRGBA text_color;
/* Attributes: */
- DiaUmlListStore *attributes;
+ DiaListStore *attributes;
/* Operators: */
- DiaUmlListStore *operations;
+ DiaListStore *operations;
/* Template: */
gboolean is_template;
- DiaUmlListStore *formal_params;
+ DiaListStore *formal_params;
};
G_DEFINE_TYPE (DiaUmlClass, dia_uml_class, G_TYPE_OBJECT)
@@ -367,7 +367,7 @@ dia_uml_class_load (DiaUmlClass *self,
self->text_color = klass->text_color;
list = klass->attributes;
- self->attributes = dia_uml_list_store_new ();
+ self->attributes = dia_list_store_new ();
while (list != NULL) {
DiaUmlAttribute *attr = (DiaUmlAttribute *)list->data;
DiaUmlAttribute *attr_copy;
@@ -377,31 +377,31 @@ dia_uml_class_load (DiaUmlClass *self,
attr_copy->left_connection = attr->left_connection;
attr_copy->right_connection = attr->right_connection;
- dia_uml_list_store_add (self->attributes, DIA_UML_LIST_DATA (attr_copy));
+ dia_list_store_add (self->attributes, DIA_LIST_DATA (attr_copy));
list = g_list_next(list);
}
list = klass->operations;
- self->operations = dia_uml_list_store_new ();
+ self->operations = dia_list_store_new ();
while (list != NULL) {
DiaUmlOperation *op = (DiaUmlOperation *)list->data;
DiaUmlOperation *copy = dia_uml_operation_copy (op);
dia_uml_operation_connection_thing (copy, op);
- dia_uml_list_store_add (self->operations, DIA_UML_LIST_DATA (copy));
+ dia_list_store_add (self->operations, DIA_LIST_DATA (copy));
list = g_list_next(list);
}
self->is_template = klass->template;
list = klass->formal_params;
- self->formal_params = dia_uml_list_store_new ();
+ self->formal_params = dia_list_store_new ();
while (list != NULL) {
DiaUmlFormalParameter *param = (DiaUmlFormalParameter *)list->data;
DiaUmlFormalParameter *copy = dia_uml_formal_parameter_copy (param);
- dia_uml_list_store_add (self->formal_params, DIA_UML_LIST_DATA (copy));
+ dia_list_store_add (self->formal_params, DIA_LIST_DATA (copy));
list = g_list_next(list);
}
}
@@ -415,7 +415,7 @@ dia_uml_class_store (DiaUmlClass *self,
GList **disconnected)
{
GListModel *list_store;
- DiaUmlListData *itm;
+ DiaListData *itm;
DiaObject *obj;
gboolean attr_visible = TRUE;
gboolean op_visible = TRUE;
@@ -588,7 +588,7 @@ dia_uml_class_get_formal_parameters (DiaUmlClass *self)
/*
* Don't rely on these six being called!
*
- * The DiaUmlListStore can/will be edited directly (e.g. by DiaUmlClassEditor)
+ * The DiaListStore can/will be edited directly (e.g. by DiaUmlClassEditor)
* so connect to items-changed if you want to observe these!
*/
@@ -597,14 +597,14 @@ dia_uml_class_insert_operation (DiaUmlClass *self,
DiaUmlOperation *operation,
int index)
{
- dia_uml_list_store_insert (self->operations, DIA_UML_LIST_DATA (operation), index);
+ dia_list_store_insert (self->operations, DIA_LIST_DATA (operation), index);
}
void
dia_uml_class_remove_operation (DiaUmlClass *self,
DiaUmlOperation *operation)
{
- dia_uml_list_store_remove (self->operations, DIA_UML_LIST_DATA (operation));
+ dia_list_store_remove (self->operations, DIA_LIST_DATA (operation));
}
void
@@ -612,14 +612,14 @@ dia_uml_class_insert_attribute (DiaUmlClass *self,
DiaUmlAttribute *attribute,
int index)
{
- dia_uml_list_store_insert (self->attributes, DIA_UML_LIST_DATA (attribute), index);
+ dia_list_store_insert (self->attributes, DIA_LIST_DATA (attribute), index);
}
void
dia_uml_class_remove_attribute (DiaUmlClass *self,
DiaUmlAttribute *attribute)
{
- dia_uml_list_store_remove (self->attributes, DIA_UML_LIST_DATA (attribute));
+ dia_list_store_remove (self->attributes, DIA_LIST_DATA (attribute));
}
void
@@ -627,12 +627,12 @@ dia_uml_class_insert_formal_parameter (DiaUmlClass *self,
DiaUmlFormalParameter *param,
int index)
{
- dia_uml_list_store_insert (self->formal_params, DIA_UML_LIST_DATA (param), index);
+ dia_list_store_insert (self->formal_params, DIA_LIST_DATA (param), index);
}
void
dia_uml_class_remove_formal_parameter (DiaUmlClass *self,
DiaUmlFormalParameter *param)
{
- dia_uml_list_store_remove (self->formal_params, DIA_UML_LIST_DATA (param));
+ dia_list_store_remove (self->formal_params, DIA_LIST_DATA (param));
}
diff --git a/objects/UML/dia-uml-formal-parameter.c b/objects/UML/dia-uml-formal-parameter.c
index fae4b1ce..da571771 100644
--- a/objects/UML/dia-uml-formal-parameter.c
+++ b/objects/UML/dia-uml-formal-parameter.c
@@ -30,7 +30,7 @@
#include "uml.h"
#include "properties.h"
#include "dia-uml-formal-parameter.h"
-#include "editor/dia-uml-list-data.h"
+#include "list/dia-list-data.h"
static PropDescription umlformalparameter_props[] = {
{ "name", PROP_TYPE_STRING, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
@@ -55,10 +55,10 @@ PropDescDArrayExtra umlformalparameter_extra = {
static void
-dia_uml_formal_parameter_list_data_init (DiaUmlListDataInterface *iface);
+dia_uml_formal_parameter_list_data_init (DiaListDataInterface *iface);
G_DEFINE_TYPE_WITH_CODE (DiaUmlFormalParameter, dia_uml_formal_parameter, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (DIA_UML_TYPE_LIST_DATA,
+ G_IMPLEMENT_INTERFACE (DIA_TYPE_LIST_DATA,
dia_uml_formal_parameter_list_data_init))
enum {
@@ -91,12 +91,12 @@ dia_uml_formal_parameter_set_property (GObject *object,
case PROP_NAME:
self->name = g_value_dup_string (value);
g_object_notify_by_pspec (object, properties[PROP_NAME]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
case PROP_TYPE:
self->type = g_value_dup_string (value);
g_object_notify_by_pspec (object, properties[PROP_TYPE]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -126,13 +126,13 @@ dia_uml_formal_parameter_get_property (GObject *object,
}
static const gchar *
-format (DiaUmlListData *self)
+format (DiaListData *self)
{
return dia_uml_formal_parameter_format (DIA_UML_FORMAL_PARAMETER (self));
}
static void
-dia_uml_formal_parameter_list_data_init (DiaUmlListDataInterface *iface)
+dia_uml_formal_parameter_list_data_init (DiaListDataInterface *iface)
{
iface->format = format;
}
diff --git a/objects/UML/dia-uml-formal-parameter.h b/objects/UML/dia-uml-formal-parameter.h
index b9da5ea4..09e1447b 100644
--- a/objects/UML/dia-uml-formal-parameter.h
+++ b/objects/UML/dia-uml-formal-parameter.h
@@ -17,7 +17,7 @@ struct _DiaUmlFormalParameter {
gchar *type; /**< Can be NULL => Type parameter */
};
-DiaUmlFormalParameter *dia_uml_formal_parameter_new ();
+DiaUmlFormalParameter *dia_uml_formal_parameter_new (void);
/** calculated the 'formated' representation */
gchar *dia_uml_formal_parameter_format (DiaUmlFormalParameter *self);
DiaUmlFormalParameter *dia_uml_formal_parameter_copy (DiaUmlFormalParameter *self);
diff --git a/objects/UML/dia-uml-operation.c b/objects/UML/dia-uml-operation.c
index 60efad0d..36548e02 100644
--- a/objects/UML/dia-uml-operation.c
+++ b/objects/UML/dia-uml-operation.c
@@ -54,14 +54,14 @@ for c in theClasses :
#include "uml.h"
#include "properties.h"
#include "dia-uml-operation.h"
-#include "editor/dia-uml-list-data.h"
-#include "editor/dia-uml-list-store.h"
+#include "list/dia-list-data.h"
+#include "list/dia-list-store.h"
static void
-dia_uml_operation_list_data_init (DiaUmlListDataInterface *iface);
+dia_uml_operation_list_data_init (DiaListDataInterface *iface);
G_DEFINE_TYPE_WITH_CODE (DiaUmlOperation, dia_uml_operation, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (DIA_UML_TYPE_LIST_DATA,
+ G_IMPLEMENT_INTERFACE (DIA_TYPE_LIST_DATA,
dia_uml_operation_list_data_init))
enum {
@@ -98,10 +98,8 @@ static PropDescription umloperation_props[] = {
N_("Query"), NULL, N_("C++ const method") },
{ "class_scope", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_("Scope"), NULL, N_("Class scope (C++ static method)") },
- /* It'a a ListModel not List now :-(
{ "parameters", PROP_TYPE_DARRAY, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_("Parameters"), NULL, NULL },
- */
PROP_DESC_END
};
@@ -115,7 +113,7 @@ static PropOffset umloperation_offsets[] = {
{ "inheritance_type", PROP_TYPE_ENUM, offsetof(DiaUmlOperation, inheritance_type) },
{ "query", PROP_TYPE_BOOL, offsetof(DiaUmlOperation, query) },
{ "class_scope", PROP_TYPE_BOOL, offsetof(DiaUmlOperation, class_scope) },
- /*{ "parameters", PROP_TYPE_DARRAY, offsetof(DiaUmlOperation, parameters) },*/
+ { "parameters", PROP_TYPE_DARRAY, offsetof(DiaUmlOperation, parameters_hack) },
{ NULL, 0, 0 },
};
@@ -129,8 +127,9 @@ DiaUmlOperation *
dia_uml_operation_copy (DiaUmlOperation *srcop)
{
DiaUmlOperation *destop;
+ GListModel *params;
DiaUmlParameter *newparam;
- DiaUmlListData *itm;
+ DiaListData *itm;
int i = 0;
destop = g_object_new (DIA_UML_TYPE_OPERATION, NULL);
@@ -174,7 +173,8 @@ dia_uml_operation_copy (DiaUmlOperation *srcop)
destop->inheritance_type = srcop->inheritance_type;
destop->query = srcop->query;
- while ((itm = g_list_model_get_item (G_LIST_MODEL (srcop->parameters), i))) {
+ params = dia_uml_operation_get_parameters (srcop);
+ while ((itm = g_list_model_get_item (params, i))) {
DiaUmlParameter *param = DIA_UML_PARAMETER (itm);
newparam = dia_uml_parameter_new ();
@@ -205,11 +205,12 @@ dia_uml_operation_copy (DiaUmlOperation *srcop)
void
uml_operation_write(AttributeNode attr_node, DiaUmlOperation *op, DiaContext *ctx)
{
+ GListModel *params;
DiaUmlParameter *param;
DataNode composite;
DataNode composite2;
AttributeNode attr_node2;
- DiaUmlListData *itm;
+ DiaListData *itm;
int i = 0;
composite = data_add_composite(attr_node, "umloperation", ctx);
@@ -236,7 +237,8 @@ uml_operation_write(AttributeNode attr_node, DiaUmlOperation *op, DiaContext *ct
attr_node2 = composite_add_attribute(composite, "parameters");
- while ((itm = g_list_model_get_item (G_LIST_MODEL (op->parameters), i))) {
+ params = dia_uml_operation_get_parameters (op);
+ while ((itm = g_list_model_get_item (params, i))) {
param = DIA_UML_PARAMETER (itm);
composite2 = data_add_composite(attr_node2, "umlparameter", ctx);
@@ -262,9 +264,10 @@ dia_uml_operation_format (DiaUmlOperation *operation)
{
int len;
char *str;
- DiaUmlListData *itm;
+ DiaListData *itm;
int i = 0;
gboolean first = TRUE;
+ GListModel *params;
/* Calculate length: */
len = 1 + (operation->name ? strlen (operation->name) : 0) + 1;
@@ -273,7 +276,8 @@ dia_uml_operation_format (DiaUmlOperation *operation)
}
first = TRUE;
- while ((itm = g_list_model_get_item (G_LIST_MODEL (operation->parameters), i))) {
+ params = dia_uml_operation_get_parameters (operation);
+ while ((itm = g_list_model_get_item (params, i))) {
DiaUmlParameter *param = DIA_UML_PARAMETER (itm);
i++;
@@ -334,7 +338,7 @@ dia_uml_operation_format (DiaUmlOperation *operation)
i = 0;
first = TRUE;
- while ((itm = g_list_model_get_item (G_LIST_MODEL (operation->parameters), i))) {
+ while ((itm = g_list_model_get_item (params, i))) {
DiaUmlParameter *param = DIA_UML_PARAMETER (itm);
i++;
@@ -438,6 +442,7 @@ dia_uml_operation_finalize (GObject *object)
if (self->wrappos) {
g_list_free (self->wrappos);
}
+ g_list_free_full (self->parameters_hack, g_object_unref);
/* freed elsewhere */
/* These are merely temporary reminders, don't need to unconnect */
@@ -459,42 +464,42 @@ dia_uml_operation_set_property (GObject *object,
case UML_OP_NAME:
self->name = g_value_dup_string (value);
g_object_notify_by_pspec (object, uml_op_properties[UML_OP_NAME]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
case UML_OP_TYPE:
self->type = g_value_dup_string (value);
g_object_notify_by_pspec (object, uml_op_properties[UML_OP_TYPE]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
case UML_OP_COMMENT:
self->comment = g_value_dup_string (value);
g_object_notify_by_pspec (object, uml_op_properties[UML_OP_COMMENT]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
case UML_OP_STEREOTYPE:
self->stereotype = g_value_dup_string (value);
g_object_notify_by_pspec (object, uml_op_properties[UML_OP_STEREOTYPE]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
case UML_OP_VISIBILITY:
self->visibility = g_value_get_int (value);
g_object_notify_by_pspec (object, uml_op_properties[UML_OP_VISIBILITY]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
case UML_OP_INHERITANCE_TYPE:
self->inheritance_type = g_value_get_int (value);
g_object_notify_by_pspec (object, uml_op_properties[UML_OP_INHERITANCE_TYPE]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
case UML_OP_QUERY:
self->query = g_value_get_boolean (value);
g_object_notify_by_pspec (object, uml_op_properties[UML_OP_QUERY]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
case UML_OP_CLASS_SCOPE:
self->class_scope = g_value_get_boolean (value);
g_object_notify_by_pspec (object, uml_op_properties[UML_OP_CLASS_SCOPE]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -542,13 +547,13 @@ dia_uml_operation_get_property (GObject *object,
}
static const gchar *
-format (DiaUmlListData *self)
+format (DiaListData *self)
{
return dia_uml_operation_format (DIA_UML_OPERATION (self));
}
static void
-dia_uml_operation_list_data_init (DiaUmlListDataInterface *iface)
+dia_uml_operation_list_data_init (DiaListDataInterface *iface)
{
iface->format = format;
}
@@ -613,11 +618,11 @@ dia_uml_operation_class_init (DiaUmlOperationClass *klass)
}
static void
-bubble (DiaUmlListStore *store,
- DiaUmlListData *itm,
+bubble (DiaListStore *store,
+ DiaListData *itm,
DiaUmlOperation *self)
{
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
}
static void
@@ -627,7 +632,7 @@ items_changed (GListModel *list,
guint added,
DiaUmlOperation *self)
{
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
}
static void
@@ -643,7 +648,7 @@ dia_uml_operation_init (DiaUmlOperation *self)
self->stereotype = g_strdup("");
self->visibility = UML_PUBLIC;
self->inheritance_type = UML_LEAF;
- self->parameters = dia_uml_list_store_new ();
+ self->parameters = dia_list_store_new ();
g_signal_connect (self->parameters, "changed",
G_CALLBACK (bubble), self);
g_signal_connect (self->parameters, "items-changed",
@@ -661,18 +666,31 @@ dia_uml_operation_insert_parameter (DiaUmlOperation *self,
DiaUmlParameter *parameter,
int index)
{
- dia_uml_list_store_insert (self->parameters, DIA_UML_LIST_DATA (parameter), index);
+ dia_list_store_insert (self->parameters, DIA_LIST_DATA (parameter), index);
}
void
dia_uml_operation_remove_parameter (DiaUmlOperation *self,
DiaUmlParameter *parameter)
{
- dia_uml_list_store_remove (self->parameters, DIA_UML_LIST_DATA (parameter));
+ dia_list_store_remove (self->parameters, DIA_LIST_DATA (parameter));
}
GListModel *
dia_uml_operation_get_parameters (DiaUmlOperation *self)
{
+ /* Instead of teaching Dia how to read into a DiaListStore we have this hack */
+ if (g_list_model_get_n_items (G_LIST_MODEL (self->parameters)) == 0 && self->parameters_hack) {
+ GList *list = self->parameters_hack;
+ while (list) {
+ GObject *itm = list->data;
+
+ dia_list_store_add (self->parameters, DIA_LIST_DATA (itm));
+
+ list = g_list_next (list);
+ }
+ g_list_free_full (self->parameters_hack, g_object_unref);
+ self->parameters_hack = NULL;
+ }
return G_LIST_MODEL (self->parameters);
}
diff --git a/objects/UML/dia-uml-operation.h b/objects/UML/dia-uml-operation.h
index b6263bdd..e61cbf1b 100644
--- a/objects/UML/dia-uml-operation.h
+++ b/objects/UML/dia-uml-operation.h
@@ -1,7 +1,7 @@
#include <glib-object.h>
#include "uml.h"
#include "dia-uml-parameter.h"
-#include "editor/dia-uml-list-store.h"
+#include "list/dia-list-store.h"
#ifndef UML_OP_H
#define UML_OP_H
@@ -32,7 +32,8 @@ struct _DiaUmlOperation {
UMLInheritanceType inheritance_type;
int query; /**< Do not modify the object, in C++ this is a const function */
int class_scope;
- DiaUmlListStore *parameters; /**< List of DiaUmlParameter */
+ DiaListStore *parameters; /**< List of DiaUmlParameter */
+ GList *parameters_hack;
ConnectionPoint* l_connection; /**< left */
ConnectionPoint* r_connection; /**< right */
@@ -43,7 +44,7 @@ struct _DiaUmlOperation {
double ascent; /** The ascent amount used for line distance in wrapping */
};
-DiaUmlOperation *dia_uml_operation_new ();
+DiaUmlOperation *dia_uml_operation_new (void);
/** calculated the 'formated' representation */
gchar *dia_uml_operation_format (DiaUmlOperation *operation);
/* TODO: Why */
diff --git a/objects/UML/dia-uml-parameter.c b/objects/UML/dia-uml-parameter.c
index 11f4752f..ea757dce 100644
--- a/objects/UML/dia-uml-parameter.c
+++ b/objects/UML/dia-uml-parameter.c
@@ -28,14 +28,14 @@
#include <string.h>
#include "dia-uml-parameter.h"
-#include "editor/dia-uml-list-data.h"
+#include "list/dia-list-data.h"
#include "properties.h"
static void
-dia_uml_parameter_list_data_init (DiaUmlListDataInterface *iface);
+dia_uml_parameter_list_data_init (DiaListDataInterface *iface);
G_DEFINE_TYPE_WITH_CODE (DiaUmlParameter, dia_uml_parameter, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (DIA_UML_TYPE_LIST_DATA,
+ G_IMPLEMENT_INTERFACE (DIA_TYPE_LIST_DATA,
dia_uml_parameter_list_data_init))
enum {
@@ -180,27 +180,27 @@ dia_uml_parameter_set_property (GObject *object,
case UML_PARA_NAME:
self->name = g_value_dup_string (value);
g_object_notify_by_pspec (object, uml_para_properties[UML_PARA_NAME]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
case UML_PARA_TYPE:
self->type = g_value_dup_string (value);
g_object_notify_by_pspec (object, uml_para_properties[UML_PARA_TYPE]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
case UML_PARA_VALUE:
self->value = g_value_dup_string (value);
g_object_notify_by_pspec (object, uml_para_properties[UML_PARA_VALUE]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
case UML_PARA_COMMENT:
self->comment = g_value_dup_string (value);
g_object_notify_by_pspec (object, uml_para_properties[UML_PARA_COMMENT]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
case UML_PARA_KIND:
self->kind = g_value_get_int (value);
g_object_notify_by_pspec (object, uml_para_properties[UML_PARA_KIND]);
- dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+ dia_list_data_changed (DIA_LIST_DATA (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -239,13 +239,13 @@ dia_uml_parameter_get_property (GObject *object,
}
static const gchar *
-format (DiaUmlListData *self)
+format (DiaListData *self)
{
return dia_uml_parameter_format (DIA_UML_PARAMETER (self));
}
static void
-dia_uml_parameter_list_data_init (DiaUmlListDataInterface *iface)
+dia_uml_parameter_list_data_init (DiaListDataInterface *iface)
{
iface->format = format;
}
diff --git a/objects/UML/editor/dia-uml-class-editor.c b/objects/UML/editor/dia-uml-class-editor.c
index 58fd3e75..060662a5 100644
--- a/objects/UML/editor/dia-uml-class-editor.c
+++ b/objects/UML/editor/dia-uml-class-editor.c
@@ -1,6 +1,6 @@
#include "dia-uml-class-editor.h"
-#include "dia-uml-list-row.h"
-#include "dia-uml-list-store.h"
+#include "list/dia-list-row.h"
+#include "list/dia-list-store.h"
#include "dia-uml-operation-dialog.h"
#include "dia-uml-attribute-dialog.h"
#include "dia-uml-formal-parameter-dialog.h"
@@ -47,17 +47,17 @@ build_lists (DiaUmlClassEditor *self)
store = dia_uml_class_get_attributes (self->klass);
gtk_list_box_bind_model (GTK_LIST_BOX (self->attributes), store,
- (GtkListBoxCreateWidgetFunc) dia_uml_list_row_new,
+ (GtkListBoxCreateWidgetFunc) dia_list_row_new,
store, NULL);
store = dia_uml_class_get_operations (self->klass);
gtk_list_box_bind_model (GTK_LIST_BOX (self->operations), store,
- (GtkListBoxCreateWidgetFunc) dia_uml_list_row_new,
+ (GtkListBoxCreateWidgetFunc) dia_list_row_new,
store, NULL);
store = dia_uml_class_get_formal_parameters (self->klass);
gtk_list_box_bind_model (GTK_LIST_BOX (self->templates), store,
- (GtkListBoxCreateWidgetFunc) dia_uml_list_row_new,
+ (GtkListBoxCreateWidgetFunc) dia_list_row_new,
store, NULL);
}
@@ -94,11 +94,11 @@ edit_operation (DiaUmlClassEditor *self,
GtkWidget *parent;
DiaUmlOperation *op;
- if (!DIA_UML_IS_LIST_ROW (row))
+ if (!DIA_IS_LIST_ROW (row))
return;
parent = gtk_widget_get_toplevel (GTK_WIDGET (self));
- op = DIA_UML_OPERATION (dia_uml_list_row_get_data (DIA_UML_LIST_ROW (row)));
+ op = DIA_UML_OPERATION (dia_list_row_get_data (DIA_LIST_ROW (row)));
dlg = dia_uml_operation_dialog_new (GTK_WINDOW (parent), op);
g_signal_connect (dlg, "operation-deleted", G_CALLBACK (remove_op), self);
gtk_widget_show (dlg);
@@ -138,11 +138,11 @@ edit_attribute (DiaUmlClassEditor *self,
GtkWidget *parent;
DiaUmlAttribute *attr;
- if (!DIA_UML_IS_LIST_ROW (row))
+ if (!DIA_IS_LIST_ROW (row))
return;
parent = gtk_widget_get_toplevel (GTK_WIDGET (self));
- attr = DIA_UML_ATTRIBUTE (dia_uml_list_row_get_data (DIA_UML_LIST_ROW (row)));
+ attr = DIA_UML_ATTRIBUTE (dia_list_row_get_data (DIA_LIST_ROW (row)));
dlg = dia_uml_attribute_dialog_new (GTK_WINDOW (parent), attr);
g_signal_connect (dlg, "attribute-deleted", G_CALLBACK (remove_attr), self);
gtk_widget_show (dlg);
@@ -182,11 +182,11 @@ edit_template (DiaUmlClassEditor *self,
GtkWidget *parent;
DiaUmlFormalParameter *param;
- if (!DIA_UML_IS_LIST_ROW (row))
+ if (!DIA_IS_LIST_ROW (row))
return;
parent = gtk_widget_get_toplevel (GTK_WIDGET (self));
- param = DIA_UML_FORMAL_PARAMETER (dia_uml_list_row_get_data (DIA_UML_LIST_ROW (row)));
+ param = DIA_UML_FORMAL_PARAMETER (dia_list_row_get_data (DIA_LIST_ROW (row)));
dlg = dia_uml_formal_parameter_dialog_new (GTK_WINDOW (parent), param);
g_signal_connect (dlg, "template-deleted", G_CALLBACK (remove_template), self);
gtk_widget_show (dlg);
diff --git a/objects/UML/editor/dia-uml-operation-dialog.c b/objects/UML/editor/dia-uml-operation-dialog.c
index 92c1cff7..3a8886f9 100644
--- a/objects/UML/editor/dia-uml-operation-dialog.c
+++ b/objects/UML/editor/dia-uml-operation-dialog.c
@@ -1,6 +1,6 @@
#include "dia-uml-operation-dialog.h"
#include "dia-uml-operation-parameter-row.h"
-#include "dia-uml-list-store.h"
+#include "list/dia-list-store.h"
#include "dia_dirs.h"
G_DEFINE_TYPE (DiaUmlOperationDialog, dia_uml_operation_dialog, GTK_TYPE_DIALOG)
@@ -151,6 +151,7 @@ dia_uml_operation_dialog_set_property (GObject *object,
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
paras = dia_uml_operation_get_parameters (self->operation);
+ g_message ("Got %i", g_list_model_get_n_items (paras));
gtk_list_box_bind_model (GTK_LIST_BOX (self->list), paras,
(GtkListBoxCreateWidgetFunc) dia_uml_operation_parameter_row_new,
paras, NULL);
diff --git a/objects/UML/editor/dia-uml-operation-parameter-row.c
b/objects/UML/editor/dia-uml-operation-parameter-row.c
index 157a51a5..500f064f 100644
--- a/objects/UML/editor/dia-uml-operation-parameter-row.c
+++ b/objects/UML/editor/dia-uml-operation-parameter-row.c
@@ -1,6 +1,6 @@
#include "dia-uml-parameter.h"
#include "dia-uml-operation-parameter-row.h"
-#include "dia-uml-list-store.h"
+#include "list/dia-list-store.h"
#include "dia_dirs.h"
struct _DiaUmlOperationParameterRow {
@@ -14,7 +14,7 @@ struct _DiaUmlOperationParameterRow {
GtkTextBuffer *comment;
DiaUmlParameter *parameter;
- DiaUmlListStore *model;
+ DiaListStore *model;
};
G_DEFINE_TYPE (DiaUmlOperationParameterRow, dia_uml_operation_parameter_row, GTK_TYPE_LIST_BOX_ROW)
@@ -78,11 +78,11 @@ direction_from (GBinding *binding,
}
static void
-display_op (DiaUmlListData *op,
+display_op (DiaListData *op,
DiaUmlOperationParameterRow *row)
{
gtk_label_set_label (GTK_LABEL (row->title),
- dia_uml_list_data_format (op));
+ dia_list_data_format (op));
}
static void
@@ -117,7 +117,7 @@ dia_uml_operation_parameter_row_set_property (GObject *object,
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
g_signal_connect (G_OBJECT (self->parameter), "changed",
G_CALLBACK (display_op), self);
- display_op (DIA_UML_LIST_DATA (self->parameter), self);
+ display_op (DIA_LIST_DATA (self->parameter), self);
break;
case UML_OP_PROW_PROP_MODEL:
self->model = g_value_dup_object (value);
@@ -156,8 +156,8 @@ move_up (DiaUmlOperationParameterRow *self)
index = gtk_list_box_row_get_index (GTK_LIST_BOX_ROW (self));
g_object_ref (self->parameter);
- dia_uml_list_store_remove (self->model, DIA_UML_LIST_DATA (self->parameter));
- dia_uml_list_store_insert (self->model, DIA_UML_LIST_DATA (self->parameter), index - 1);
+ dia_list_store_remove (self->model, DIA_LIST_DATA (self->parameter));
+ dia_list_store_insert (self->model, DIA_LIST_DATA (self->parameter), index - 1);
g_object_unref (self->parameter);
}
@@ -169,15 +169,15 @@ move_down (DiaUmlOperationParameterRow *self)
index = gtk_list_box_row_get_index (GTK_LIST_BOX_ROW (self));
g_object_ref (self->parameter);
- dia_uml_list_store_remove (self->model, DIA_UML_LIST_DATA (self->parameter));
- dia_uml_list_store_insert (self->model, DIA_UML_LIST_DATA (self->parameter), index + 1);
+ dia_list_store_remove (self->model, DIA_LIST_DATA (self->parameter));
+ dia_list_store_insert (self->model, DIA_LIST_DATA (self->parameter), index + 1);
g_object_unref (self->parameter);
}
static void
remove_param (DiaUmlOperationParameterRow *self)
{
- dia_uml_list_store_remove (self->model, DIA_UML_LIST_DATA (self->parameter));
+ dia_list_store_remove (self->model, DIA_LIST_DATA (self->parameter));
}
static void
@@ -204,7 +204,7 @@ dia_uml_operation_parameter_row_class_init (DiaUmlOperationParameterRowClass *kl
g_param_spec_object ("model",
"Model",
"Model this for is for",
- DIA_UML_TYPE_LIST_STORE,
+ DIA_TYPE_LIST_STORE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_properties (object_class,
@@ -240,7 +240,7 @@ dia_uml_operation_parameter_row_init (DiaUmlOperationParameterRow *self)
GtkWidget *
dia_uml_operation_parameter_row_new (DiaUmlParameter *op,
- DiaUmlListStore *model)
+ DiaListStore *model)
{
return g_object_new (DIA_UML_TYPE_OPERATION_PARAMETER_ROW,
"parameter", op,
diff --git a/objects/UML/editor/dia-uml-operation-parameter-row.h
b/objects/UML/editor/dia-uml-operation-parameter-row.h
index 1400af3c..42d5ffb0 100644
--- a/objects/UML/editor/dia-uml-operation-parameter-row.h
+++ b/objects/UML/editor/dia-uml-operation-parameter-row.h
@@ -1,6 +1,6 @@
#include <gtk/gtk.h>
#include "uml.h"
-#include "dia-uml-list-store.h"
+#include "list/dia-list-store.h"
G_BEGIN_DECLS
@@ -8,7 +8,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (DiaUmlOperationParameterRow, dia_uml_operation_parameter_row, DIA_UML,
OPERATION_PARAMETER_ROW, GtkListBoxRow)
GtkWidget *dia_uml_operation_parameter_row_new (DiaUmlParameter *parameter,
- DiaUmlListStore *model);
+ DiaListStore *model);
DiaUmlParameter *dia_uml_operation_parameter_row_get_parameter (DiaUmlOperationParameterRow *self);
G_END_DECLS
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 136add3c..9f8b78b4 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -2,7 +2,6 @@
# Please keep this file sorted alphabetically.
app/app_procs.c
app/autosave.c
-app/color_area.c
app/commands.c
app/confirm.c
app/create_object.c
@@ -19,7 +18,6 @@ app/filedlg.c
app/find-and-replace.c
app/interface.c
app/layer_dialog.c
-app/linewidth_area.c
app/load_save.c
app/menus.c
app/modify_tool.c
@@ -40,16 +38,10 @@ lib/arrows.c
lib/attributes.c
lib/bezier_conn.c
lib/create.c
-lib/diaarrowchooser.c
-lib/diaarrowselector.c
-lib/diacolorselector.c
lib/dia_dirs.c
-lib/diadynamicmenu.c
lib/diafontselector.c
lib/diagramdata.c
lib/dia_image.c
-lib/dialinechooser.c
-lib/dialinestyleselector.c
lib/dialogs.c
lib/diaoptionmenu.c
lib/diapatternselector.c
@@ -165,12 +157,10 @@ objects/standard/zigzagline.c
objects/UML/activity.c
objects/UML/actor.c
objects/UML/association.c
-objects/UML/class_attributes_dialog.c
objects/UML/class.c
objects/UML/class_dialog.c
objects/UML/classicon.c
objects/UML/class_operations_dialog.c
-objects/UML/class_templates_dialog.c
objects/UML/component.c
objects/UML/component_feature.c
objects/UML/constraint.c
@@ -188,11 +178,7 @@ objects/UML/small_package.c
objects/UML/state.c
objects/UML/state_term.c
objects/UML/transition.c
-objects/UML/umlattribute.c
objects/UML/uml.c
-objects/UML/umlformalparameter.c
-objects/UML/umloperation.c
-objects/UML/umlparameter.c
objects/UML/usecase.c
plug-ins/cairo/diacairo.c
plug-ins/cgm/cgm.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]