source-dialog: sources are unique

Destroy the row and break the loop as soon as the source is found
This commit is contained in:
Erick Pérez Castellanos
2015-05-25 12:36:53 -04:00
parent cfa81e86a5
commit 798b63903d
+1 -6
View File
@@ -1637,13 +1637,11 @@ remove_source (GcalManager *manager,
ESource *source,
gpointer user_data)
{
GtkWidget *row;
GcalSourceDialogPrivate *priv;
GList *children, *aux;
priv = GCAL_SOURCE_DIALOG (user_data)->priv;
children = gtk_container_get_children (GTK_CONTAINER (priv->calendars_listbox));
row = NULL;
for (aux = children; aux != NULL; aux = aux->next)
{
@@ -1651,14 +1649,11 @@ remove_source (GcalManager *manager,
if (child_source != NULL && child_source == source)
{
row = aux->data;
gtk_widget_destroy (aux->data);
break;
}
}
if (row != NULL)
gtk_widget_destroy (row);
g_list_free (children);
}