[gnome-calendar] source-dialog: refactor code



commit fda5684371cf9e8462b07890eb2d827395dab871
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Apr 9 15:45:26 2015 -0300

    source-dialog: refactor code

 src/gcal-source-dialog.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/src/gcal-source-dialog.c b/src/gcal-source-dialog.c
index 655378b..9cadd9a 100644
--- a/src/gcal-source-dialog.c
+++ b/src/gcal-source-dialog.c
@@ -297,13 +297,11 @@ back_button_clicked (GtkButton *button,
                      gpointer   user_data)
 {
   GcalSourceDialogPrivate *priv = GCAL_SOURCE_DIALOG (user_data)->priv;
+  const gchar *visible_child;
 
-  /*
-   * TODO: when editing a GOA calendar, it should
-   * go back to the GOA calendar selection page.
-   */
+  visible_child = gtk_stack_get_visible_child_name (GTK_STACK (priv->stack));
 
-  if (g_strcmp0 (gtk_stack_get_visible_child_name (GTK_STACK (priv->stack)), "edit") == 0)
+  if (g_strcmp0 (visible_child, "edit") == 0)
     {
       // Save the source before leaving
       gcal_manager_save_source (priv->manager, priv->source);
@@ -311,9 +309,9 @@ back_button_clicked (GtkButton *button,
       // Release the source ref we acquired
       g_object_unref (priv->source);
       priv->source = NULL;
-
-      gcal_source_dialog_set_mode (GCAL_SOURCE_DIALOG (user_data), GCAL_SOURCE_DIALOG_MODE_NORMAL);
     }
+
+  gcal_source_dialog_set_mode (GCAL_SOURCE_DIALOG (user_data), GCAL_SOURCE_DIALOG_MODE_NORMAL);
 }
 
 static gint


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]