[Spice-devel] [[PATCH] spice-gtk: ] Minor clean-up

Zeeshan Ali (Khattak) zeeshanak at gnome.org
Tue May 24 13:13:28 PDT 2011


Prefer 'if/else' over 'switch' when dealing with only 2 possibilities.
---
 gtk/spicy.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/gtk/spicy.c b/gtk/spicy.c
index 82d8de2..0120692 100644
--- a/gtk/spicy.c
+++ b/gtk/spicy.c
@@ -239,18 +239,14 @@ static int connect_dialog(GtkWidget *parent, SpiceSession *session)
 #endif
     /* show and wait for response */
     gtk_widget_show_all(dialog);
-    switch (gtk_dialog_run(GTK_DIALOG(dialog))) {
-    case GTK_RESPONSE_ACCEPT:
+    if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
         for (i = 0; i < SPICE_N_ELEMENTS(connect_entries); i++) {
             txt = gtk_entry_get_text(GTK_ENTRY(connect_entries[i].entry));
             g_object_set(session, connect_entries[i].prop, txt, NULL);
         }
 	retval = 0;
-	break;
-    default:
+    } else
 	retval = -1;
-	break;
-    }
     gtk_widget_destroy(dialog);
     return retval;
 }
-- 
1.7.5.1



More information about the Spice-devel mailing list