[gnome-boxes] libvirt-machine-props: Drop troubleshoot log dialog



commit 61fde557ff56e3f99457848f27492984dcdb2aba
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Dec 3 17:32:29 2014 +0000

    libvirt-machine-props: Drop troubleshoot log dialog
    
    Instead of creating and launching a separate dialog to show
    troubleshooting log to user, use the new PropertiesWindow API to do so.
    
    Nested dialogs is something we want to avoid according to our designers.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741047

 src/libvirt-machine-properties.vala |   51 +----------------------------------
 1 files changed, 1 insertions(+), 50 deletions(-)
---
diff --git a/src/libvirt-machine-properties.vala b/src/libvirt-machine-properties.vala
index 0ce8523..18c07f4 100644
--- a/src/libvirt-machine-properties.vala
+++ b/src/libvirt-machine-properties.vala
@@ -429,56 +429,7 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
         grid.attach (button, 0, 0, 1, 1);
         button.clicked.connect (() => {
             var log = collect_logs ();
-            var dialog = new Gtk.Dialog.with_buttons (_("Troubleshooting log"),
-                                                      machine.window,
-                                                      DialogFlags.DESTROY_WITH_PARENT,
-                                                      _("_Save"), 100,
-                                                      _("Copy to clipboard"), 101,
-                                                      _("_Close"), ResponseType.OK);
-            dialog.modal = true;
-            dialog.set_default_size (640, 480);
-            var text = new Gtk.TextView ();
-            text.editable = false;
-            var scroll = new Gtk.ScrolledWindow (null, null);
-            scroll.add (text);
-            scroll.vexpand = true;
-
-            dialog.get_content_area ().add (scroll);
-            text.buffer.set_text (log);
-            dialog.show_all ();
-
-            dialog.response.connect ( (response_id) => {
-                if (response_id == 100) {
-                    var chooser = new Gtk.FileChooserDialog (_("Save log"), machine.window,
-                                                             Gtk.FileChooserAction.SAVE,
-                                                             _("_Save"), ResponseType.OK);
-                    chooser.modal = true;
-                    chooser.local_only = false;
-                    chooser.do_overwrite_confirmation = true;
-                    chooser.response.connect ((response_id) => {
-                        if (response_id == ResponseType.OK) {
-                            var file = chooser.get_file ();
-                            try {
-                                file.replace_contents (log.data, null, false,
-                                                       FileCreateFlags.REPLACE_DESTINATION, null);
-                            } catch (GLib.Error e) {
-                                var message = _("Error saving: %s").printf (e.message);
-                                machine.window.notificationbar.display_error (message);
-                                return;
-                            }
-                            chooser.destroy ();
-                        } else {
-                            chooser.destroy ();
-                        }
-                    });
-                    chooser.show_all ();
-                } else if (response_id == 101){
-                    Gtk.Clipboard.get_for_display (dialog.get_display (),
-                                                   Gdk.SELECTION_CLIPBOARD).set_text (log, -1);
-                } else {
-                        dialog.destroy ();
-                }
-            });
+            machine.window.props_window.show_troubleshoot_log (log);
         });
 
         button = new Gtk.Button.with_label (_("Force Shutdown"));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]