[gnome-boxes] Add ability to take URLs from commandline
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Add ability to take URLs from commandline
- Date: Wed, 2 Nov 2011 02:26:23 +0000 (UTC)
commit 02406f0b79941067830593a11263a47a13189a3d
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Tue Nov 1 19:43:03 2011 +0200
Add ability to take URLs from commandline
src/app.vala | 9 +++++++--
src/boxes-main.vala | 5 ++++-
src/wizard-source.vala | 5 ++++-
src/wizard.vala | 11 +++++++----
4 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index f578a74..1efcad7 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -24,6 +24,7 @@ private class Boxes.App: Boxes.UI {
public Wizard wizard;
public Properties properties;
public DisplayPage display_page;
+ public string? uri { get; private set; }
private Clutter.TableLayout box_table;
private Collection collection;
@@ -31,7 +32,8 @@ private class Boxes.App: Boxes.UI {
private HashTable<string,GVir.Connection> connections;
- public App () {
+ public App (string? uri) {
+ this.uri = uri;
settings = new GLib.Settings ("org.gnome.boxes");
setup_ui ();
collection = new Collection (this);
@@ -164,7 +166,10 @@ private class Boxes.App: Boxes.UI {
wizard = new Wizard (this);
properties = new Properties (this);
- ui_state = UIState.COLLECTION;
+ if (uri != null)
+ ui_state = UIState.WIZARD;
+ else
+ ui_state = UIState.COLLECTION;
}
private void set_main_ui_state (string clutter_state) {
diff --git a/src/boxes-main.vala b/src/boxes-main.vala
index d8c7937..6364665 100644
--- a/src/boxes-main.vala
+++ b/src/boxes-main.vala
@@ -3,9 +3,11 @@ using Config;
using Posix;
private static bool version;
+private static string[] uris;
private const OptionEntry[] options = {
{ "version", 0, 0, OptionArg.NONE, ref version, N_("Display version number"), null },
+ { "", 0, 0, OptionArg.STRING_ARRAY, ref uris, N_("URI to display, broker or installer media"), null },
{ null }
};
@@ -64,7 +66,8 @@ public void main (string[] args) {
warning (error.message);
}
- new Boxes.App ();
+ // FIXME: We only handle a single URI from commandline
+ new Boxes.App ((uris != null)? uris[0] : null);
Gtk.main ();
}
diff --git a/src/wizard-source.vala b/src/wizard-source.vala
index 8e7b84c..bb801e9 100644
--- a/src/wizard-source.vala
+++ b/src/wizard-source.vala
@@ -27,7 +27,7 @@ private class Boxes.WizardSource: GLib.Object {
private Gtk.Notebook notebook;
private Gtk.Entry url_entry;
- public WizardSource () {
+ public WizardSource (string? uri) {
notebook = new Gtk.Notebook ();
notebook.get_style_context ().add_class ("boxes-source-nb");
notebook.show_tabs = false;
@@ -84,6 +84,9 @@ private class Boxes.WizardSource: GLib.Object {
label.wrap = true;
hbox.pack_start (label, true, true);
+ if (uri != null)
+ url_entry.text = uri;
+
notebook.show_all ();
}
diff --git a/src/wizard.vala b/src/wizard.vala
index 183ce06..53c168e 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -64,11 +64,11 @@ private class Boxes.Wizard: Boxes.UI {
construct {
steps = new GenericArray<Gtk.Label> ();
steps.length = WizardPage.LAST;
- wizard_source = new Boxes.WizardSource ();
}
public Wizard (App app) {
this.app = app;
+ wizard_source = new Boxes.WizardSource (app.uri);
setup_ui ();
}
@@ -131,9 +131,8 @@ private class Boxes.Wizard: Boxes.UI {
summary.clear ();
if (this.wizard_source.page == Boxes.SourcePage.URL ||
- this.wizard_source.page == Boxes.SourcePage.FILE) {
+ this.wizard_source.page == Boxes.SourcePage.FILE)
prepare_for_location (this.wizard_source.uri);
- }
}
private void add_step (Gtk.Widget widget, string label, WizardPage page) {
@@ -243,7 +242,11 @@ private class Boxes.Wizard: Boxes.UI {
public override void ui_state_changed () {
switch (ui_state) {
case UIState.WIZARD:
- page = WizardPage.INTRODUCTION;
+ if (app.uri != null) {
+ page = WizardPage.SOURCE;
+ wizard_source.page = SourcePage.URL;
+ } else
+ page = WizardPage.INTRODUCTION;
break;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]