Replace GSList with GList in LdDiagram.

This has been an unnecessary limitation.
This commit is contained in:
Přemysl Eric Janouch 2011-01-09 05:58:34 +01:00
parent 9de3a0976d
commit 911fac4c2f
3 changed files with 33 additions and 33 deletions

View File

@ -829,11 +829,11 @@ move_object_to_coords (LdCanvas *self, LdDiagramObject *object,
static LdDiagramObject *
get_object_at_coords (LdCanvas *self, gdouble x, gdouble y)
{
GSList *objects, *iter;
GList *objects, *iter;
/* Iterate from the top object downwards. */
objects = (GSList *) ld_diagram_get_objects (self->priv->diagram);
for (iter = objects; iter; iter = g_slist_next (iter))
objects = (GList *) ld_diagram_get_objects (self->priv->diagram);
for (iter = objects; iter; iter = g_list_next (iter))
{
LdDiagramObject *object;
@ -847,7 +847,7 @@ get_object_at_coords (LdCanvas *self, gdouble x, gdouble y)
static gboolean
is_object_selected (LdCanvas *self, LdDiagramObject *object)
{
return g_slist_find (ld_diagram_get_selection (self->priv->diagram),
return g_list_find (ld_diagram_get_selection (self->priv->diagram),
object) != NULL;
}
@ -934,13 +934,13 @@ object_hit_test (LdCanvas *self, LdDiagramObject *object, gdouble x, gdouble y)
static void
check_terminals (LdCanvas *self, gdouble x, gdouble y)
{
GSList *objects, *iter;
GList *objects, *iter;
LdDiagramSymbol *closest_symbol = NULL;
gdouble closest_distance = TERMINAL_HOVER_TOLERANCE;
LdPoint closest_terminal;
objects = (GSList *) ld_diagram_get_objects (self->priv->diagram);
for (iter = objects; iter; iter = g_slist_next (iter))
objects = (GList *) ld_diagram_get_objects (self->priv->diagram);
for (iter = objects; iter; iter = g_list_next (iter))
{
LdDiagramObject *diagram_object;
gdouble object_x, object_y;
@ -1246,7 +1246,7 @@ draw_terminal (GtkWidget *widget, DrawData *data)
static void
draw_diagram (GtkWidget *widget, DrawData *data)
{
GSList *objects;
GList *objects;
if (!data->self->priv->diagram)
return;
@ -1257,7 +1257,7 @@ draw_diagram (GtkWidget *widget, DrawData *data)
/* Draw objects from the diagram. */
objects = ld_diagram_get_objects (data->self->priv->diagram);
g_slist_foreach (objects, (GFunc) draw_object, data);
g_list_foreach (objects, (GFunc) draw_object, data);
switch (data->self->priv->operation)
{

View File

@ -36,9 +36,9 @@ struct _LdDiagramPrivate
{
gboolean modified;
GSList *objects;
GSList *selection;
GSList *connections;
GList *objects;
GList *selection;
GList *connections;
};
enum
@ -220,11 +220,11 @@ ld_diagram_clear_internal (LdDiagram *self)
{
ld_diagram_unselect_all (self);
g_slist_free (self->priv->connections);
g_list_free (self->priv->connections);
self->priv->connections = NULL;
g_slist_foreach (self->priv->objects, (GFunc) g_object_unref, NULL);
g_slist_free (self->priv->objects);
g_list_foreach (self->priv->objects, (GFunc) g_object_unref, NULL);
g_list_free (self->priv->objects);
self->priv->objects = NULL;
}
@ -343,7 +343,7 @@ ld_diagram_set_modified (LdDiagram *self, gboolean value)
* Get a list of objects in the diagram.
* You mustn't make any changes to the list.
*/
GSList *
GList *
ld_diagram_get_objects (LdDiagram *self)
{
g_return_val_if_fail (LD_IS_DIAGRAM (self), NULL);
@ -365,10 +365,10 @@ ld_diagram_insert_object (LdDiagram *self, LdDiagramObject *object, gint pos)
g_return_if_fail (LD_IS_DIAGRAM (self));
g_return_if_fail (LD_IS_DIAGRAM_OBJECT (object));
if (!g_slist_find (self->priv->objects, object))
if (!g_list_find (self->priv->objects, object))
{
self->priv->objects =
g_slist_insert (self->priv->objects, object, pos);
g_list_insert (self->priv->objects, object, pos);
g_object_ref (object);
g_signal_emit (self,
@ -389,11 +389,11 @@ ld_diagram_remove_object (LdDiagram *self, LdDiagramObject *object)
g_return_if_fail (LD_IS_DIAGRAM (self));
g_return_if_fail (LD_IS_DIAGRAM_OBJECT (object));
if (g_slist_find (self->priv->objects, object))
if (g_list_find (self->priv->objects, object))
{
ld_diagram_selection_remove (self, object);
self->priv->objects = g_slist_remove (self->priv->objects, object);
self->priv->objects = g_list_remove (self->priv->objects, object);
g_object_unref (object);
g_signal_emit (self,
@ -408,7 +408,7 @@ ld_diagram_remove_object (LdDiagram *self, LdDiagramObject *object)
* Get a list of objects that are currently selected in the diagram.
* You mustn't make any changes to the list.
*/
GSList *
GList *
ld_diagram_get_selection (LdDiagram *self)
{
g_return_val_if_fail (LD_IS_DIAGRAM (self), NULL);
@ -430,12 +430,12 @@ ld_diagram_selection_add (LdDiagram *self, LdDiagramObject *object, gint pos)
g_return_if_fail (LD_IS_DIAGRAM (self));
g_return_if_fail (LD_IS_DIAGRAM_OBJECT (object));
g_return_if_fail (g_slist_find (self->priv->objects, object) != NULL);
g_return_if_fail (g_list_find (self->priv->objects, object) != NULL);
if (!g_slist_find (self->priv->selection, object))
if (!g_list_find (self->priv->selection, object))
{
self->priv->selection =
g_slist_insert (self->priv->selection, object, pos);
g_list_insert (self->priv->selection, object, pos);
g_object_ref (object);
g_signal_emit (self,
@ -456,9 +456,9 @@ ld_diagram_selection_remove (LdDiagram *self, LdDiagramObject *object)
g_return_if_fail (LD_IS_DIAGRAM (self));
g_return_if_fail (LD_IS_DIAGRAM_OBJECT (object));
if (g_slist_find (self->priv->selection, object))
if (g_list_find (self->priv->selection, object))
{
self->priv->selection = g_slist_remove (self->priv->selection, object);
self->priv->selection = g_list_remove (self->priv->selection, object);
g_object_unref (object);
g_signal_emit (self,
@ -479,8 +479,8 @@ ld_diagram_select_all (LdDiagram *self)
ld_diagram_unselect_all_internal (self);
self->priv->selection = g_slist_copy (self->priv->objects);
g_slist_foreach (self->priv->selection, (GFunc) g_object_ref, NULL);
self->priv->selection = g_list_copy (self->priv->objects);
g_list_foreach (self->priv->selection, (GFunc) g_object_ref, NULL);
g_signal_emit (self,
LD_DIAGRAM_GET_CLASS (self)->selection_changed_signal, 0);
@ -506,7 +506,7 @@ ld_diagram_unselect_all (LdDiagram *self)
static void
ld_diagram_unselect_all_internal (LdDiagram *self)
{
g_slist_foreach (self->priv->selection, (GFunc) g_object_unref, NULL);
g_slist_free (self->priv->selection);
g_list_foreach (self->priv->selection, (GFunc) g_object_unref, NULL);
g_list_free (self->priv->selection);
self->priv->selection = NULL;
}

View File

@ -68,13 +68,13 @@ gboolean ld_diagram_save_to_file (LdDiagram *self,
gboolean ld_diagram_get_modified (LdDiagram *self);
void ld_diagram_set_modified (LdDiagram *self, gboolean value);
GSList *ld_diagram_get_objects (LdDiagram *self);
GList *ld_diagram_get_objects (LdDiagram *self);
void ld_diagram_insert_object (LdDiagram *self,
LdDiagramObject *object, gint pos);
void ld_diagram_remove_object (LdDiagram *self,
LdDiagramObject *object);
GSList *ld_diagram_get_selection (LdDiagram *self);
GList *ld_diagram_get_selection (LdDiagram *self);
void ld_diagram_selection_add (LdDiagram *self,
LdDiagramObject *object, gint pos);
void ld_diagram_selection_remove (LdDiagram *self,
@ -84,7 +84,7 @@ void ld_diagram_select_all (LdDiagram *self);
void ld_diagram_unselect_all (LdDiagram *self);
/*
GSList *ld_diagram_get_connections (LdDiagram *self);
GList *ld_diagram_get_connections (LdDiagram *self);
void ld_diagram_connection_add (LdDiagram *self,
LdConnection *connection, gint pos);
void ld_diagram_connection_remove (LdDiagram *self,