[gnome-boxes/troubleshoot-button-on-notification: 2/2] machine: Add "Troubleshoot" button to "Start failed" notification
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/troubleshoot-button-on-notification: 2/2] machine: Add "Troubleshoot" button to "Start failed" notification
- Date: Thu, 1 Feb 2018 15:56:14 +0000 (UTC)
commit 2fd72429388ad35f39c4a3d5aa3427bcf48d46b8
Author: Felipe Borges <felipeborges gnome org>
Date: Mon Jan 29 18:21:07 2018 +0100
machine: Add "Troubleshoot" button to "Start failed" notification
This way users know better where to look for logs and errors to
solve their issue.
Fixes #86
src/libvirt-machine-properties.vala | 2 +-
src/machine.vala | 16 +++++++++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/libvirt-machine-properties.vala b/src/libvirt-machine-properties.vala
index 4df0bd3e..f5931ed7 100644
--- a/src/libvirt-machine-properties.vala
+++ b/src/libvirt-machine-properties.vala
@@ -31,7 +31,7 @@ private bool save_machine_name_change () {
}
}
- private string collect_logs () {
+ public string collect_logs () {
var builder = new StringBuilder ();
builder.append_printf ("Broker URL: %s\n", machine.source.uri);
diff --git a/src/machine.vala b/src/machine.vala
index dbb93d8d..1c507fde 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -619,7 +619,21 @@ private async void try_connect_display (ConnectFlags flags = ConnectFlags.NONE)
} catch (Boxes.Error.START_FAILED e) {
warning ("Failed to start %s: %s", name, e.message);
window.set_state (UIState.COLLECTION);
- window.notificationbar.display_error (_("Failed to start ā%sā").printf (name));
+
+ var msg = _("Failed to start ā%sā").printf (name);
+ if (this is LibvirtMachine) {
+ Notification.OKFunc troubleshoot = () => {
+ window.current_item = this;
+ window.show_properties ();
+
+ var logs = (this as LibvirtMachine).properties.collect_logs ();
+ window.props_window.show_troubleshoot_log (logs);
+ };
+
+ window.notificationbar.display_for_action (msg, _("Troubleshooting Log"), (owned)
troubleshoot, null);
+ } else {
+ window.notificationbar.display_error (msg);
+ }
} catch (GLib.Error e) {
warning ("Failed to connect to %s: %s", name, e.message);
window.set_state (UIState.COLLECTION);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]