summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Venhoda <lvenhoda@redhat.com>2015-06-15 12:47:29 +0200
committerPavel Grunt <pgrunt@redhat.com>2015-06-16 14:10:03 +0200
commite7dcc5a4971348b54973f4805b9cb708aecff860 (patch)
tree380b87a97187490d7cd6f5caa298762fa63c66f6
parentf4018a8dbe6b987f1dd5259fa9e3d0b0466ab6ed (diff)
remote-viewer-connect: Changed response to gboolean
remote_viewer_connect_dialog now returns TRUE and FALSE, instead of 0 and -1. Added a doxygen style comment to document this in code also.
-rw-r--r--src/remote-viewer-connect.c19
-rw-r--r--src/remote-viewer-connect.h2
-rw-r--r--src/remote-viewer.c2
3 files changed, 17 insertions, 6 deletions
diff --git a/src/remote-viewer-connect.c b/src/remote-viewer-connect.c
index a459f6a..5c3b03f 100644
--- a/src/remote-viewer-connect.c
+++ b/src/remote-viewer-connect.c
@@ -91,7 +91,18 @@ make_label_bold(GtkLabel* label)
pango_attr_list_unref(attributes);
}
-gint
+/**
+* remote_viewer_connect_dialog
+*
+* @brief Opens connect dialog for remote viewer
+*
+* @param main_window Parent window of the dialog
+* @param uri For returning the uri of chosen server
+*
+* @return TRUE if Connect or ENTER is pressed
+* @return FALSE if Cancel is pressed or dialog is closed
+*/
+gboolean
remote_viewer_connect_dialog(GtkWindow *main_window, gchar **uri)
{
GtkWidget *dialog, *area, *box, *label, *entry, *recent;
@@ -99,7 +110,7 @@ remote_viewer_connect_dialog(GtkWindow *main_window, gchar **uri)
GtkWidget *alignment;
#endif
GtkRecentFilter *rfilter;
- gint retval;
+ gboolean retval;
/* Create the widgets */
dialog = gtk_dialog_new_with_buttons(_("Connection details"),
@@ -170,10 +181,10 @@ remote_viewer_connect_dialog(GtkWindow *main_window, gchar **uri)
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
*uri = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
g_strstrip(*uri);
- retval = 0;
+ retval = TRUE;
} else {
*uri = NULL;
- retval = -1;
+ retval = FALSE;
}
gtk_widget_destroy(dialog);
diff --git a/src/remote-viewer-connect.h b/src/remote-viewer-connect.h
index 86705d7..99779ef 100644
--- a/src/remote-viewer-connect.h
+++ b/src/remote-viewer-connect.h
@@ -23,7 +23,7 @@
#include <gtk/gtk.h>
-gint remote_viewer_connect_dialog(GtkWindow *main_window, gchar **uri);
+gboolean remote_viewer_connect_dialog(GtkWindow *main_window, gchar **uri);
#endif /* REMOTE_VIEWER_CONNECT_H */
diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 76b12ae..04d7bf0 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -1098,7 +1098,7 @@ remote_viewer_start(VirtViewerApp *app, GError **err)
retry_dialog:
main_window = virt_viewer_app_get_main_window(app);
if (priv->open_recent_dialog) {
- if (remote_viewer_connect_dialog(virt_viewer_window_get_window(main_window), &guri) != 0) {
+ if (!remote_viewer_connect_dialog(virt_viewer_window_get_window(main_window), &guri)) {
g_set_error_literal(&error,
VIRT_VIEWER_ERROR, VIRT_VIEWER_ERROR_CANCELLED,
_("No connection was chosen"));