[gnome-calendar/calendar-editor] source-dialog: join two conditionals
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/calendar-editor] source-dialog: join two conditionals
- Date: Sat, 16 May 2015 22:14:59 +0000 (UTC)
commit 9caa4794f197c6655391ec9fcd09fd5234600c71
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Sat May 16 18:07:34 2015 -0400
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 files changed, 13 insertions(+), 23 deletions(-)
---
diff --git a/src/gcal-source-dialog.c b/src/gcal-source-dialog.c
index 0f704c4..79b3cea 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;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]