[Spice-devel] [spicy PATCH 2/7 v4] spicy: Changed response to gboolean

Lukas Venhoda lvenhoda at redhat.com
Tue Jun 16 02:41:52 PDT 2015


spicy_connect_dialog now returns TRUE and FALSE instead of 0 and -1.
---
No changes since v3

Changes since v2
 - New patch
---
 src/spicy-connect.c | 9 +++++----
 src/spicy-connect.h | 2 +-
 src/spicy.c         | 6 ++----
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/spicy-connect.c b/src/spicy-connect.c
index 991aaab..2656c24 100644
--- a/src/spicy-connect.c
+++ b/src/spicy-connect.c
@@ -69,11 +69,12 @@ static void recent_item_activated_dialog_cb(GtkRecentChooser *chooser, gpointer
 }
 #endif

-int spicy_connect_dialog(SpiceSession *session)
+gboolean spicy_connect_dialog(SpiceSession *session)
 {
     GtkWidget *dialog, *area, *label;
     GtkTable *table;
-    int i, retval;
+    gboolean retval;
+    int i;

     /* Create the widgets */
     dialog = gtk_dialog_new_with_buttons(_("Connect to SPICE"),
@@ -135,9 +136,9 @@ int spicy_connect_dialog(SpiceSession *session)
             txt = gtk_entry_get_text(GTK_ENTRY(connect_entries[i].entry));
             g_object_set(session, connect_entries[i].prop, txt, NULL);
         }
-        retval = 0;
+        retval = TRUE;
     } else
-        retval = -1;
+        retval = FALSE;
     gtk_widget_destroy(dialog);
     return retval;
 }
diff --git a/src/spicy-connect.h b/src/spicy-connect.h
index e693f2b..56b2d80 100644
--- a/src/spicy-connect.h
+++ b/src/spicy-connect.h
@@ -21,6 +21,6 @@

 #include "spice-widget.h"

-int spicy_connect_dialog(SpiceSession *session);
+gboolean spicy_connect_dialog(SpiceSession *session);

 #endif
diff --git a/src/spicy.c b/src/spicy.c
index f58d33e..3442db0 100644
--- a/src/spicy.c
+++ b/src/spicy.c
@@ -1119,8 +1119,7 @@ static void main_channel_event(SpiceChannel *channel, SpiceChannelEvent event,
             g_message("channel error: %s", error->message);
         }

-        rc = spicy_connect_dialog(conn->session);
-        if (rc == 0) {
+        if (spicy_connect_dialog(conn->session)) {
             connection_connect(conn);
         } else {
             connection_disconnect(conn);
@@ -1699,8 +1698,7 @@ int main(int argc, char *argv[])
     /* If user doesn't provide hostname and port, show the dialog window
        instead of connecting to server automatically */
     if ((host == NULL || (port == NULL && tls_port == NULL)) && unix_path == NULL) {
-        int ret = spicy_connect_dialog(conn->session);
-        if (ret != 0) {
+        if (!spicy_connect_dialog(conn->session)) {
             exit(0);
         }
     }
--
2.4.2



More information about the Spice-devel mailing list