[gnome-boxes/nuke-old-wizard: 7/8] app, remote-connection: Let the assistant handle cmdline arguments



commit 52136f327b8e16a1a6d8a2938b2fdd25a17bda73
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Feb 26 16:12:43 2020 +0100

    app, remote-connection: Let the assistant handle cmdline arguments
    
    Pass command-line arguments that are URIs to the remote-connection
    assistant.

 src/app-window.vala                  | 4 ++--
 src/app.vala                         | 4 ++--
 src/assistant/remote-connection.vala | 4 +++-
 3 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/app-window.vala b/src/app-window.vala
index 03ec5243..b3ed8cc5 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -285,8 +285,8 @@ public void foreach_view (Func<ICollectionView> func) {
             func (view);
     }
 
-    public void show_remote_connection_assistant () {
-        new Boxes.RemoteConnectionAssistant (this).run ();
+    public void show_remote_connection_assistant (string? uri = null) {
+        new Boxes.RemoteConnectionAssistant (this, uri).run ();
     }
 
     public void show_vm_assistant (string? path = null) {
diff --git a/src/app.vala b/src/app.vala
index 0986dc4e..ae613deb 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -238,11 +238,11 @@ public override int command_line (GLib.ApplicationCommandLine cmdline) {
 
                 if (file.query_exists ()) {
                     if (is_uri)
-                        main_window.wizard_window.wizard.open_with_uri (arg);
+                        main_window.show_remote_connection_assistant (arg);
                     else
                         main_window.show_vm_assistant (file.get_path ());
                 } else if (is_uri)
-                    main_window.wizard_window.wizard.open_with_uri (arg);
+                    main_window.show_remote_connection_assistant (arg);
                 else
                     open_name (arg);
             });
diff --git a/src/assistant/remote-connection.vala b/src/assistant/remote-connection.vala
index d2342815..1a2111a4 100644
--- a/src/assistant/remote-connection.vala
+++ b/src/assistant/remote-connection.vala
@@ -15,7 +15,7 @@
         use_header_bar = 1;
     }
 
-    public RemoteConnectionAssistant (AppWindow app_window) {
+    public RemoteConnectionAssistant (AppWindow app_window, string? uri = null) {
         this.app_window = app_window;
 
         set_transient_for (app_window);
@@ -23,6 +23,8 @@ public RemoteConnectionAssistant (AppWindow app_window) {
         url_entry.changed.connect (on_url_entry_changed);
         connect_button.clicked.connect (on_connect_button_clicked);
         connect_button.get_style_context ().add_class ("suggested-action");
+
+        url_entry.set_text (uri);
     }
 
     private void on_url_entry_changed () {


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