[virt-tools-list] [PATCH virt-viewer 5/9] Remove VIRT_VIEWER_VM_CHOOSE_DIALOG_CANCELLED
Christophe Fergeau
cfergeau at redhat.com
Fri Nov 14 11:08:06 UTC 2014
On Thu, Nov 13, 2014 at 06:20:41PM +0100, Marc-André Lureau wrote:
> 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.
ACK, though an additional ACK from Pavel would be nice :)
Christophe
> ---
> src/remote-viewer.c | 12 +++---------
> src/virt-viewer-util.h | 1 -
> src/virt-viewer-vm-connection.c | 4 ----
> 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 ae522bc..6810908 100644
> --- a/src/virt-viewer.c
> +++ b/src/virt-viewer.c
> @@ -654,8 +654,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;
> }
> @@ -847,8 +846,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;
> --
> 1.9.3
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20141114/9f135241/attachment.sig>
More information about the virt-tools-list
mailing list