mirror of
https://gitlab.com/virt-viewer/virt-viewer.git
synced 2025-03-09 08:58:17 +03:00
virt-viewer-app: create_session() should return a boolean
By convention functions that take GError parameters should return FALSE (or NULL) or error. Related: rhbz#1085216
This commit is contained in:
parent
f9c4a03bd7
commit
f1204f0e69
@ -950,7 +950,7 @@ create_ovirt_session(VirtViewerApp *app, const char *uri, GError **err)
|
||||
virt_viewer_app_set_connect_info(app, NULL, ghost, gport, gtlsport,
|
||||
session_type, NULL, NULL, 0, NULL);
|
||||
|
||||
if (virt_viewer_app_create_session(app, session_type, &error) < 0)
|
||||
if (!virt_viewer_app_create_session(app, session_type, &error))
|
||||
goto error;
|
||||
|
||||
#ifdef HAVE_SPICE_GTK
|
||||
@ -1221,7 +1221,7 @@ remote_viewer_start(VirtViewerApp *app, GError **err)
|
||||
g_signal_connect(app, "notify", G_CALLBACK(app_notified), self);
|
||||
|
||||
if (priv->controller) {
|
||||
if (virt_viewer_app_create_session(app, "spice", &error) < 0) {
|
||||
if (!virt_viewer_app_create_session(app, "spice", &error)) {
|
||||
virt_viewer_app_simple_message_dialog(app, _("Couldn't create a Spice session"));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -1283,7 +1283,7 @@ retry_dialog:
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (virt_viewer_app_create_session(app, type, &error) < 0)
|
||||
if (!virt_viewer_app_create_session(app, type, &error))
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1051,13 +1051,13 @@ static void notify_software_reader_cb(GObject *gobject G_GNUC_UNUSED,
|
||||
virt_viewer_update_smartcard_accels(VIRT_VIEWER_APP(user_data));
|
||||
}
|
||||
|
||||
int
|
||||
gboolean
|
||||
virt_viewer_app_create_session(VirtViewerApp *self, const gchar *type, GError **error)
|
||||
{
|
||||
g_return_val_if_fail(VIRT_VIEWER_IS_APP(self), -1);
|
||||
g_return_val_if_fail(VIRT_VIEWER_IS_APP(self), FALSE);
|
||||
VirtViewerAppPrivate *priv = self->priv;
|
||||
g_return_val_if_fail(priv->session == NULL, -1);
|
||||
g_return_val_if_fail(type != NULL, -1);
|
||||
g_return_val_if_fail(priv->session == NULL, FALSE);
|
||||
g_return_val_if_fail(type != NULL, FALSE);
|
||||
|
||||
#ifdef HAVE_GTK_VNC
|
||||
if (g_ascii_strcasecmp(type, "vnc") == 0) {
|
||||
@ -1084,7 +1084,7 @@ virt_viewer_app_create_session(VirtViewerApp *self, const gchar *type, GError **
|
||||
priv->guest_name, type);
|
||||
virt_viewer_app_simple_message_dialog(self, _("Unknown graphic type for the guest %s"),
|
||||
priv->guest_name);
|
||||
return -1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_signal_connect(priv->session, "session-initialized",
|
||||
@ -1119,7 +1119,7 @@ virt_viewer_app_create_session(VirtViewerApp *self, const gchar *type, GError **
|
||||
|
||||
g_signal_connect(priv->session, "notify::software-smartcard-reader",
|
||||
(GCallback)notify_software_reader_cb, self);
|
||||
return 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -68,7 +68,7 @@ void virt_viewer_app_trace(VirtViewerApp *self, const char *fmt, ...);
|
||||
void virt_viewer_app_simple_message_dialog(VirtViewerApp *self, const char *fmt, ...);
|
||||
gboolean virt_viewer_app_is_active(VirtViewerApp *app);
|
||||
void virt_viewer_app_free_connect_info(VirtViewerApp *self);
|
||||
int virt_viewer_app_create_session(VirtViewerApp *self, const gchar *type, GError **error);
|
||||
gboolean virt_viewer_app_create_session(VirtViewerApp *self, const gchar *type, GError **error);
|
||||
gboolean virt_viewer_app_activate(VirtViewerApp *self, GError **error);
|
||||
gboolean virt_viewer_app_initial_connect(VirtViewerApp *self, GError **error);
|
||||
void virt_viewer_app_set_zoom_level(VirtViewerApp *self, gint zoom_level);
|
||||
|
@ -420,7 +420,7 @@ virt_viewer_extract_connect_info(VirtViewer *self,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virt_viewer_app_create_session(app, type, error) < 0)
|
||||
if (!virt_viewer_app_create_session(app, type, error))
|
||||
goto cleanup;
|
||||
|
||||
xpath = g_strdup_printf("string(/domain/devices/graphics[@type='%s']/@port)", type);
|
||||
|
Loading…
x
Reference in New Issue
Block a user