diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2011-01-05 04:28:24 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2011-01-05 04:35:25 +0100 |
commit | e92bebfa57215bb33136b078fd314df16a730224 (patch) | |
tree | 82b8956fa953b427f4482da4cf71a890d82c9b28 /src | |
parent | c4b8f092b7afa12349f8bf6c8a395f48dbef631b (diff) | |
download | logdiag-e92bebfa57215bb33136b078fd314df16a730224.tar.gz logdiag-e92bebfa57215bb33136b078fd314df16a730224.tar.xz logdiag-e92bebfa57215bb33136b078fd314df16a730224.zip |
Add ld_diagram_{select,unselect}_all().
Diffstat (limited to 'src')
-rw-r--r-- | src/ld-diagram.c | 41 | ||||
-rw-r--r-- | src/ld-diagram.h | 5 |
2 files changed, 40 insertions, 6 deletions
diff --git a/src/ld-diagram.c b/src/ld-diagram.c index 9bfe630..0d19e93 100644 --- a/src/ld-diagram.c +++ b/src/ld-diagram.c @@ -2,7 +2,7 @@ * ld-diagram.c * * This file is a part of logdiag. - * Copyright Přemysl Janouch 2010. All rights reserved. + * Copyright Přemysl Janouch 2010 - 2011. All rights reserved. * * See the file LICENSE for licensing information. * @@ -205,13 +205,11 @@ ld_diagram_clear (LdDiagram *self) static void ld_diagram_clear_internal (LdDiagram *self) { + ld_diagram_unselect_all (self); + g_slist_free (self->priv->connections); self->priv->connections = NULL; - g_slist_foreach (self->priv->selection, (GFunc) g_object_unref, NULL); - g_slist_free (self->priv->selection); - self->priv->selection = NULL; - g_slist_foreach (self->priv->objects, (GFunc) g_object_unref, NULL); g_slist_free (self->priv->objects); self->priv->objects = NULL; @@ -454,3 +452,36 @@ ld_diagram_selection_remove (LdDiagram *self, LdDiagramObject *object) LD_DIAGRAM_GET_CLASS (self)->changed_signal, 0); } } + +/** + * ld_diagram_select_all: + * @self: An #LdDiagram object. + * + * Include all objects in the document to the selection. + */ +void +ld_diagram_select_all (LdDiagram *self) +{ + g_return_if_fail (LD_IS_DIAGRAM (self)); + + ld_diagram_unselect_all (self); + + self->priv->selection = g_slist_copy (self->priv->objects); + g_slist_foreach (self->priv->selection, (GFunc) g_object_ref, NULL); +} + +/** + * ld_diagram_unselect_all: + * @self: An #LdDiagram object. + * + * Remove all objects from the current selection. + */ +void +ld_diagram_unselect_all (LdDiagram *self) +{ + g_return_if_fail (LD_IS_DIAGRAM (self)); + + g_slist_foreach (self->priv->selection, (GFunc) g_object_unref, NULL); + g_slist_free (self->priv->selection); + self->priv->selection = NULL; +} diff --git a/src/ld-diagram.h b/src/ld-diagram.h index ce3b39e..6a6120b 100644 --- a/src/ld-diagram.h +++ b/src/ld-diagram.h @@ -2,7 +2,7 @@ * ld-diagram.h * * This file is a part of logdiag. - * Copyright Přemysl Janouch 2010. All rights reserved. + * Copyright Přemysl Janouch 2010 - 2011. All rights reserved. * * See the file LICENSE for licensing information. * @@ -79,6 +79,9 @@ void ld_diagram_selection_add (LdDiagram *self, void ld_diagram_selection_remove (LdDiagram *self, LdDiagramObject *object); +void ld_diagram_select_all (LdDiagram *self); +void ld_diagram_unselect_all (LdDiagram *self); + /* GSList *ld_diagram_get_connections (LdDiagram *self); void ld_diagram_connection_add (LdDiagram *self, |