[gnome-boxes/wip/rishi/rhel: 2/9] wizard, wizard-source: Use the headerbar to go back from "Enter URL"
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/wip/rishi/rhel: 2/9] wizard, wizard-source: Use the headerbar to go back from "Enter URL"
- Date: Thu, 31 Aug 2017 13:23:11 +0000 (UTC)
commit 76e6ed1bfc9d4be7f9483eaddb0cc930cf62da6f
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Aug 23 18:35:10 2017 +0200
wizard, wizard-source: Use the headerbar to go back from "Enter URL"
This makes the "Enter URL" page visually consistent with the others,
and enables the alt+<left> keyboard shortcut.
https://bugzilla.gnome.org/show_bug.cgi?id=786689
data/ui/wizard-source.ui | 42 ------------------------------------------
src/wizard-source.vala | 13 ++++++-------
src/wizard.vala | 20 +++++++++++++++-----
3 files changed, 21 insertions(+), 54 deletions(-)
---
diff --git a/data/ui/wizard-source.ui b/data/ui/wizard-source.ui
index d85376c..4664fe7 100644
--- a/data/ui/wizard-source.ui
+++ b/data/ui/wizard-source.ui
@@ -202,48 +202,6 @@
<class name="boxes-menu"/>
</style>
<child>
- <object class="GtkButton" id="url_back_button">
- <property name="visible">True</property>
- <signal name="clicked" handler="on_url_back_button_clicked"/>
- <style>
- <class name="boxes-menu-row"/>
- </style>
- <child>
- <object class="GtkBox" id="url_back_box">
- <property name="visible">True</property>
- <property name="margin-top">10</property>
- <property name="margin-bottom">10</property>
- <property name="margin-start">20</property>
- <property name="margin-end">20</property>
- <property name="spacing">20</property>
- <property name="orientation">horizontal</property>
- <child>
- <object class="GtkLabel" id="enter_url_back_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">◀</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="enter_url_label2">
- <property name="visible">True</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Enter URL</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
-
- <child>
<object class="GtkBox" id="url_entry_vbox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
diff --git a/src/wizard-source.vala b/src/wizard-source.vala
index eb99882..4f7613d 100644
--- a/src/wizard-source.vala
+++ b/src/wizard-source.vala
@@ -126,6 +126,8 @@ private class Boxes.WizardSource: Gtk.Stack {
private AppWindow window;
+ private weak Wizard wizard;
+
private Gtk.Box media_vbox;
public MediaManager media_manager;
@@ -145,6 +147,7 @@ private class Boxes.WizardSource: Gtk.Stack {
set {
_page = value;
+ wizard.update_back_button_sensitivity ();
visible_child_name = page_names[value];
if (selected != null)
@@ -177,10 +180,12 @@ private class Boxes.WizardSource: Gtk.Stack {
transition_type = Gtk.StackTransitionType.SLIDE_LEFT_RIGHT; // FIXME: Why this won't work from .ui
file?
}
- public void setup_ui (AppWindow window) {
+ public void setup_ui (AppWindow window, WizardWindow wizard_window) {
assert (window != null);
+ assert (wizard_window != null);
this.window = window;
+ wizard = wizard_window.wizard;
var os_db = media_manager.os_db;
os_db.get_all_media_urls_as_store.begin ((db, result) => {
@@ -223,12 +228,6 @@ private class Boxes.WizardSource: Gtk.Stack {
activated ();
}
- [GtkCallback]
- private void on_url_back_button_clicked () {
- selected = null;
- page = SourcePage.MAIN;
- }
-
private async void add_media_entries () {
var medias = yield media_manager.list_installer_medias ();
diff --git a/src/wizard.vala b/src/wizard.vala
index 16879ad..069004c 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -132,7 +132,7 @@ private class Boxes.Wizard: Gtk.Stack, Boxes.UI {
return;
_page = value;
- back_button.sensitive = (value != WizardPage.SOURCE);
+ update_back_button_sensitivity ();
wizard_window.topbar.set_title_for_page (value);
visible_child_name = page_names[value];
@@ -629,9 +629,14 @@ private class Boxes.Wizard: Gtk.Stack, Boxes.UI {
cancel_button.clicked.connect (cancel);
back_button = wizard_window.topbar.back_btn;
back_button.clicked.connect (() => {
- prepare_cancellable.cancel ();
-
- page = page - 1;
+ if (page == WizardPage.SOURCE) {
+ return_if_fail (wizard_source.page == SourcePage.URL);
+ wizard_source.selected = null;
+ wizard_source.page = SourcePage.MAIN;
+ } else {
+ prepare_cancellable.cancel ();
+ page = page - 1;
+ }
});
continue_button = wizard_window.topbar.continue_btn;
continue_button.clicked.connect (() => {
@@ -643,7 +648,12 @@ private class Boxes.Wizard: Gtk.Stack, Boxes.UI {
page = WizardPage.LAST;
});
- wizard_source.setup_ui (window);
+ wizard_source.setup_ui (window, wizard_window);
+ }
+
+ public void update_back_button_sensitivity () {
+ var disable_back_button = page == WizardPage.SOURCE && wizard_source.page == SourcePage.MAIN;
+ back_button.sensitive = !disable_back_button;
}
public void open_with_uri (string uri, bool skip_review_for_live = true) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]