[gnome-boxes] Do not enable 'continue' button until url is not empty
- From: Marc-Andre Lureau <malureau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Do not enable 'continue' button until url is not empty
- Date: Wed, 2 Nov 2011 23:57:45 +0000 (UTC)
commit eae1fac72234ac6b63f782cbdbcc78eb58caab7b
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date: Thu Nov 3 00:56:57 2011 +0100
Do not enable 'continue' button until url is not empty
src/wizard-source.vala | 4 +++-
src/wizard.vala | 20 ++++++++++++++++++--
2 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/src/wizard-source.vala b/src/wizard-source.vala
index d6adf59..18e5aae 100644
--- a/src/wizard-source.vala
+++ b/src/wizard-source.vala
@@ -18,6 +18,8 @@ private class Boxes.WizardSource: GLib.Object {
set {
_page = value;
notebook.set_current_page (page);
+ if (page == SourcePage.URL)
+ url_entry.changed ();
}
}
public string uri {
@@ -26,7 +28,7 @@ private class Boxes.WizardSource: GLib.Object {
}
private Gtk.Notebook notebook;
- private Gtk.Entry url_entry;
+ public Gtk.Entry url_entry;
public WizardSource () {
notebook = new Gtk.Notebook ();
diff --git a/src/wizard.vala b/src/wizard.vala
index 24fecf2..6ac7399 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -36,6 +36,15 @@ private class Boxes.Wizard: Boxes.UI {
get { return _page; }
set {
switch (value) {
+ case WizardPage.INTRODUCTION:
+ next_button.sensitive = true;
+ break;
+
+ case WizardPage.SOURCE:
+ // reset page to notify deeply widgets states
+ wizard_source.page = wizard_source.page;
+ break;
+
case WizardPage.PREPARATION:
try {
prepare ();
@@ -72,8 +81,8 @@ private class Boxes.Wizard: Boxes.UI {
/* highlight in white current page label */
steps.get (page).modify_fg (Gtk.StateType.NORMAL, get_color ("white"));
- back_button.set_sensitive (page != WizardPage.INTRODUCTION);
- next_button.set_label (page != WizardPage.REVIEW ? _("Continue") : _("Create"));
+ back_button.sensitive = page != WizardPage.INTRODUCTION;
+ next_button.label = page != WizardPage.REVIEW ? _("Continue") : _("Create");
}
}
@@ -81,6 +90,13 @@ private class Boxes.Wizard: Boxes.UI {
steps = new GenericArray<Gtk.Label> ();
steps.length = WizardPage.LAST;
wizard_source = new Boxes.WizardSource ();
+ wizard_source.notify["page"].connect(() => {
+ if (wizard_source.page == Boxes.SourcePage.MAIN)
+ next_button.sensitive = false;
+ });
+ wizard_source.url_entry.changed.connect (() => {
+ next_button.sensitive = wizard_source.uri.len () != 0;
+ });
}
public Wizard (App app) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]