From 46a92fd96bb4acca7586897ff82a969615be0041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erick=20P=C3=A9rez=20Castellanos?= Date: Sat, 16 May 2015 18:07:34 -0400 Subject: [PATCH] source-dialog: join two conditionals Below the main conditionals were another if with no else block. Those can be joined using && operator. Some minor style fixes in here also. --- src/gcal-source-dialog.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/src/gcal-source-dialog.c b/src/gcal-source-dialog.c index 9e60d62b..bb52620a 100644 --- a/src/gcal-source-dialog.c +++ b/src/gcal-source-dialog.c @@ -739,34 +739,24 @@ response_signal (GtkDialog *dialog, g_clear_object (&priv->source); } - /* commit the new source */ - if (priv->mode == GCAL_SOURCE_DIALOG_MODE_NORMAL && response_id == GTK_RESPONSE_APPLY) - { - /* save the current page's source */ - if (priv->remote_sources != NULL) - { - GList *l; + /* commit the new source; save the current page's source */ + if (priv->mode == GCAL_SOURCE_DIALOG_MODE_NORMAL && response_id == GTK_RESPONSE_APPLY && priv->remote_sources != NULL) + { + GList *l; - for (l = priv->remote_sources; l != NULL; l = l->next) - { - // Commit each new remote source - gcal_manager_save_source (priv->manager, l->data); - } + // Commit each new remote source + for (l = priv->remote_sources; l != NULL; l = l->next) + gcal_manager_save_source (priv->manager, l->data); - g_list_free (priv->remote_sources); - - priv->remote_sources = NULL; - } - } + g_list_free (priv->remote_sources); + priv->remote_sources = NULL; + } /* Destroy the source when the operation is cancelled */ - if (priv->mode == GCAL_SOURCE_DIALOG_MODE_NORMAL && response_id == GTK_RESPONSE_CANCEL) + if (priv->mode == GCAL_SOURCE_DIALOG_MODE_NORMAL && response_id == GTK_RESPONSE_CANCEL && priv->remote_sources != NULL) { - if (priv->remote_sources != NULL) - { - g_list_free_full (priv->remote_sources, g_object_unref); - priv->remote_sources = NULL; - } + g_list_free_full (priv->remote_sources, g_object_unref); + priv->remote_sources = NULL; } }