[gnome-boxes] Clean-up open wizard from command line code
- From: Marc-Andre Lureau <malureau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Clean-up open wizard from command line code
- Date: Fri, 6 Jan 2012 22:40:43 +0000 (UTC)
commit c4aa53b418b9defeaada1437167068131452c3e1
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date: Thu Jan 5 19:30:26 2012 +0100
Clean-up open wizard from command line code
This is a bit nicer to deal with, since we have only one constructor,
and is a bit more easy to read, also don't need to pass arguments via App.
https://bugzilla.gnome.org/show_bug.cgi?id=667435
src/app.vala | 7 -------
src/main.vala | 8 +++++---
src/wizard.vala | 18 ++++++++++--------
3 files changed, 15 insertions(+), 18 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index 82fb50b..4d53f54 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -63,13 +63,6 @@ private class Boxes.App: Boxes.UI {
setup_sources.begin ();
}
- public App.with_uri (string uri) {
- this ();
- this.uri = uri;
-
- ui_state = UIState.WIZARD;
- }
-
public void set_category (Category category) {
topbar.label.set_text (category.name);
view.category = category;
diff --git a/src/main.vala b/src/main.vala
index f3708e7..0f775a6 100644
--- a/src/main.vala
+++ b/src/main.vala
@@ -65,12 +65,14 @@ public void main (string[] args) {
warning (error.message);
}
+ var app = new Boxes.App ();
+
if (uris != null) {
// FIXME: We only handle a single URI from commandline
var file = File.new_for_commandline_arg (uris[0]);
- new Boxes.App.with_uri (file.get_uri ());
- } else
- new Boxes.App ();
+ app.wizard.open_with_uri (file.get_uri ());
+ }
+
Gtk.main ();
}
diff --git a/src/wizard.vala b/src/wizard.vala
index e20574d..d38ff0f 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -459,17 +459,19 @@ private class Boxes.Wizard: Boxes.UI {
notebook.show_all ();
}
+ public void open_with_uri (string uri) {
+ ui_state = UIState.WIZARD;
+
+ page = WizardPage.SOURCE;
+ wizard_source.page = SourcePage.URL;
+ wizard_source.uri = uri;
+ page = WizardPage.PREPARATION;
+ }
+
public override void ui_state_changed () {
switch (ui_state) {
case UIState.WIZARD:
- if (app.uri != null) {
- page = WizardPage.SOURCE;
- wizard_source.page = SourcePage.URL;
- wizard_source.uri = app.uri;
- page = WizardPage.PREPARATION;
- app.uri = null;
- } else
- page = WizardPage.INTRODUCTION;
+ page = WizardPage.INTRODUCTION;
break;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]