diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2012-10-07 23:42:49 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2012-10-08 00:04:47 +0200 |
commit | 6c925b7092c32181c59136e8658b2af45c49a35f (patch) | |
tree | 24de354ef0ab2a6be95e7c03911238961ee46f43 /liblogdiag | |
parent | 4196a10ece29cf8aa34f2c7c29524eb0de93ca65 (diff) | |
download | logdiag-6c925b7092c32181c59136e8658b2af45c49a35f.tar.gz logdiag-6c925b7092c32181c59136e8658b2af45c49a35f.tar.xz logdiag-6c925b7092c32181c59136e8658b2af45c49a35f.zip |
Clean up LdDiagram.
* Don't emit signals when disposing.
* Remove some leftovers.
Diffstat (limited to 'liblogdiag')
-rw-r--r-- | liblogdiag/ld-diagram.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/liblogdiag/ld-diagram.c b/liblogdiag/ld-diagram.c index 2f5732e..bac45db 100644 --- a/liblogdiag/ld-diagram.c +++ b/liblogdiag/ld-diagram.c @@ -31,7 +31,6 @@ * each containing a #GList of #LdUndoAction subactions. * @objects: all objects in the diagram. * @selection: all currently selected objects. - * @connections: connections between objects. */ struct _LdDiagramPrivate { @@ -43,7 +42,6 @@ struct _LdDiagramPrivate GList *objects; GList *selection; - GList *connections; }; typedef struct _ObjectActionData ObjectActionData; @@ -76,6 +74,7 @@ static void ld_diagram_set_property (GObject *object, guint property_id, static void ld_diagram_dispose (GObject *gobject); static void ld_diagram_finalize (GObject *gobject); static void ld_diagram_real_changed (LdDiagram *self); +static void ld_diagram_clear_internal (LdDiagram *self, gboolean emit_signals); static gboolean write_signature (GOutputStream *stream, GError **error); @@ -232,7 +231,7 @@ ld_diagram_dispose (GObject *gobject) LdDiagram *self; self = LD_DIAGRAM (gobject); - ld_diagram_clear (self); + ld_diagram_clear_internal (self, FALSE); /* Chain up to the parent class. */ G_OBJECT_CLASS (ld_diagram_parent_class)->dispose (gobject); @@ -287,23 +286,22 @@ ld_diagram_new (void) void ld_diagram_clear (LdDiagram *self) { + g_return_if_fail (LD_IS_DIAGRAM (self)); + ld_diagram_clear_internal (self, TRUE); +} + +static void +ld_diagram_clear_internal (LdDiagram *self, gboolean emit_signals) +{ gboolean changed = FALSE; gboolean selection_changed = FALSE; - g_return_if_fail (LD_IS_DIAGRAM (self)); - if (self->priv->selection) { ld_diagram_unselect_all_internal (self); selection_changed = TRUE; } - if (self->priv->connections) - { - g_list_free (self->priv->connections); - self->priv->connections = NULL; - changed = TRUE; - } if (self->priv->objects) { g_list_foreach (self->priv->objects, (GFunc) uninstall_object, self); @@ -315,15 +313,18 @@ ld_diagram_clear (LdDiagram *self) destroy_action_stack (&self->priv->undo_stack); destroy_action_stack (&self->priv->redo_stack); - g_object_notify (G_OBJECT (self), "can-undo"); - g_object_notify (G_OBJECT (self), "can-redo"); - - if (changed) - g_signal_emit (self, - LD_DIAGRAM_GET_CLASS (self)->changed_signal, 0); - if (selection_changed) - g_signal_emit (self, - LD_DIAGRAM_GET_CLASS (self)->selection_changed_signal, 0); + if (emit_signals) + { + g_object_notify (G_OBJECT (self), "can-undo"); + g_object_notify (G_OBJECT (self), "can-redo"); + + if (changed) + g_signal_emit (self, + LD_DIAGRAM_GET_CLASS (self)->changed_signal, 0); + if (selection_changed) + g_signal_emit (self, + LD_DIAGRAM_GET_CLASS (self)->selection_changed_signal, 0); + } } /** |