diff options
| author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2014-11-12 12:06:54 +0100 |
|---|---|---|
| committer | Marc-André Lureau <marcandre.lureau@gmail.com> | 2014-11-25 13:00:49 +0100 |
| commit | 15c7d17b9683015edee76ec3840fed657f1cc95d (patch) | |
| tree | 0b40473427a5cdba04ff9c93bdb580619b9b31b5 /src | |
| parent | 71f156caf5fbe5ad78c9caeb44f7a25c299ceba4 (diff) | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/remote-viewer.c | 12 | ||||
| -rw-r--r-- | src/virt-viewer-util.h | 1 | ||||
| -rw-r--r-- | src/virt-viewer-vm-connection.c | 4 | ||||
| -rw-r--r-- | src/virt-viewer.c | 6 |
4 files changed, 5 insertions, 18 deletions
diff --git a/src/remote-viewer.c b/src/remote-viewer.c index 435cad7..818c421 100644 --- a/src/remote-viewer.c +++ b/src/remote-viewer.c @@ -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; diff --git a/src/virt-viewer-util.h b/src/virt-viewer-util.h index 262ecf8..1df81a5 100644 --- a/src/virt-viewer-util.h +++ b/src/virt-viewer-util.h @@ -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 () diff --git a/src/virt-viewer-vm-connection.c b/src/virt-viewer-vm-connection.c index 1b00562..4a3feba 100644 --- a/src/virt-viewer-vm-connection.c +++ b/src/virt-viewer-vm-connection.c @@ -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); diff --git a/src/virt-viewer.c b/src/virt-viewer.c index 329eada..6dfbdbc 100644 --- a/src/virt-viewer.c +++ b/src/virt-viewer.c @@ -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; |
