window: sources are unique

There's no need to loop through the rest of the list once the ESource has been
found
This commit is contained in:
Erick Pérez Castellanos
2015-05-25 12:36:53 -04:00
parent 44480da71a
commit b04720135f
+4 -6
View File
@@ -880,23 +880,21 @@ remove_source (GcalManager *manager,
gpointer user_data)
{
GcalWindowPrivate *priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
GtkWidget *row;
GList *children, *aux;
children = gtk_container_get_children (GTK_CONTAINER (priv->calendar_listbox));
row = NULL;
for (aux = children; aux != NULL; aux = aux->next)
{
ESource *child_source = g_object_get_data (G_OBJECT (aux->data), "source");
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);
}