mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/virt-viewer
synced 2025-12-29 00:15:15 +00:00
Remove VIRT_VIEWER_VM_CHOOSE_DIALOG_CANCELLED
This error type isn't really an error, it is used to skip error report code. The functions can simply return FALSE on failure, without GError set, to indicate that program should quit normally.
This commit is contained in:
parent
71f156caf5
commit
15c7d17b96
@ -1241,15 +1241,9 @@ retry_dialog:
|
||||
if (g_strcmp0(type, "ovirt") == 0) {
|
||||
if (!create_ovirt_session(app, guri, &error)) {
|
||||
if (error) {
|
||||
if (!g_error_matches(error,
|
||||
VIRT_VIEWER_ERROR,
|
||||
VIRT_VIEWER_VM_CHOOSE_DIALOG_CANCELLED)) {
|
||||
virt_viewer_app_simple_message_dialog(app,
|
||||
_("Couldn't open oVirt session: %s"),
|
||||
error->message);
|
||||
}
|
||||
} else {
|
||||
virt_viewer_app_simple_message_dialog(app, _("Couldn't open oVirt session"));
|
||||
virt_viewer_app_simple_message_dialog(app,
|
||||
_("Couldn't open oVirt session: %s"),
|
||||
error->message);
|
||||
}
|
||||
g_clear_error(&error);
|
||||
goto cleanup;
|
||||
|
||||
@ -30,7 +30,6 @@ extern gboolean doDebug;
|
||||
|
||||
enum {
|
||||
VIRT_VIEWER_ERROR_FAILED,
|
||||
VIRT_VIEWER_VM_CHOOSE_DIALOG_CANCELLED,
|
||||
};
|
||||
|
||||
#define VIRT_VIEWER_ERROR virt_viewer_error_quark ()
|
||||
|
||||
@ -84,10 +84,6 @@ virt_viewer_vm_connection_choose_name_dialog(GtkTreeModel *model, GError **error
|
||||
if (dialog_response == GTK_RESPONSE_ACCEPT &&
|
||||
gtk_tree_selection_get_selected(selection, &model, &iter)) {
|
||||
gtk_tree_model_get(model, &iter, 0, &vm_name, -1);
|
||||
} else {
|
||||
g_set_error_literal(error,
|
||||
VIRT_VIEWER_ERROR, VIRT_VIEWER_VM_CHOOSE_DIALOG_CANCELLED,
|
||||
_("No virtual machine was chosen"));
|
||||
}
|
||||
|
||||
gtk_widget_destroy(dialog);
|
||||
|
||||
@ -663,8 +663,7 @@ virt_viewer_initial_connect(VirtViewerApp *app, GError **error)
|
||||
goto done;
|
||||
} else {
|
||||
dom = choose_vm(&priv->domkey, priv->conn, &err);
|
||||
if (dom == NULL &&
|
||||
!g_error_matches(err, VIRT_VIEWER_ERROR, VIRT_VIEWER_VM_CHOOSE_DIALOG_CANCELLED)) {
|
||||
if (dom == NULL && err != NULL) {
|
||||
virt_viewer_app_simple_message_dialog(app, err->message);
|
||||
goto cleanup;
|
||||
}
|
||||
@ -856,8 +855,7 @@ virt_viewer_connect(VirtViewerApp *app)
|
||||
}
|
||||
|
||||
if (!virt_viewer_app_initial_connect(app, &error)) {
|
||||
if (error &&
|
||||
!g_error_matches(error, VIRT_VIEWER_ERROR, VIRT_VIEWER_VM_CHOOSE_DIALOG_CANCELLED))
|
||||
if (error != NULL)
|
||||
g_warning("%s", error->message);
|
||||
g_clear_error(&error);
|
||||
return -1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user