[gnome-boxes] wizard-toolbar: Content for file chooser view
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] wizard-toolbar: Content for file chooser view
- Date: Wed, 10 Dec 2014 00:01:38 +0000 (UTC)
commit 8f7c3655845bb557b33f365917b106dfa0821a3d
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Dec 3 17:31:11 2014 +0000
wizard-toolbar: Content for file chooser view
The wizard topbar should provide a different set of controls and title
when file chooser view is visible in the properties window.
https://bugzilla.gnome.org/show_bug.cgi?id=741046
data/ui/wizard-toolbar.ui | 55 +++++++++++++++++++++++++++++++++++++++++++++
src/wizard-toolbar.vala | 38 +++++++++++++++++++++++++++++++
2 files changed, 93 insertions(+), 0 deletions(-)
---
diff --git a/data/ui/wizard-toolbar.ui b/data/ui/wizard-toolbar.ui
index 811c884..2db3470 100644
--- a/data/ui/wizard-toolbar.ui
+++ b/data/ui/wizard-toolbar.ui
@@ -131,6 +131,61 @@
</packing>
</child>
+ <!-- File chooser page -->
+ <child>
+ <object class="GtkHeaderBar" id="file_chooser">
+ <property name="visible">True</property>
+ <property name="show-close-button">False</property>
+ <property name="title" translatable="yes">Select a device or ISO file</property>
+ <style>
+ <class name="titlebar"/>
+ </style>
+
+ <child>
+ <object class="GtkButton" id="file_chooser_cancel_button">
+ <property name="visible">True</property>
+ <property name="valign">center</property>
+ <property name="use-underline">True</property>
+ <property name="label" translatable="yes">_Cancel</property>
+ <signal name="clicked" handler="on_file_chooser_cancel_clicked"/>
+ <style>
+ <class name="text-button"/>
+ </style>
+
+ </object>
+
+ <packing>
+ <property name="pack-type">start</property>
+ </packing>
+ </child>
+
+ <child>
+ <object class="GtkButton" id="file_chooser_open_button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="valign">center</property>
+ <property name="use-underline">True</property>
+ <property name="label" translatable="yes">_Open</property>
+ <signal name="clicked" handler="on_file_chooser_open_clicked"/>
+ <style>
+ <class name="text-button"/>
+ </style>
+
+ </object>
+
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+
+ </object>
+
+ <packing>
+ <property name="name">file_chooser</property>
+ </packing>
+ </child>
+
+
</template>
<object class="GtkSizeGroup" id="sizegroup">
diff --git a/src/wizard-toolbar.vala b/src/wizard-toolbar.vala
index 10e4dcf..021ba0d 100644
--- a/src/wizard-toolbar.vala
+++ b/src/wizard-toolbar.vala
@@ -25,10 +25,20 @@ private class Boxes.WizardToolbar: Gtk.Stack {
[GtkChild]
public Button create_btn;
+ [GtkChild]
+ private Button file_chooser_open_button;
+
private unowned WizardWindow wizard_window;
public void setup_ui (WizardWindow wizard_window) {
this.wizard_window = wizard_window;
+
+ var file_chooser = wizard_window.file_chooser;
+ file_chooser.selection_changed.connect (() => {
+ var path = file_chooser.get_filename ();
+
+ file_chooser_open_button.sensitive = (path != null);
+ });
}
public void click_back_button () {
@@ -61,4 +71,32 @@ private class Boxes.WizardToolbar: Gtk.Stack {
private void on_customization_back_clicked () requires (page == WizardWindowPage.CUSTOMIZATION) {
wizard_window.page = WizardWindowPage.MAIN;
}
+
+ [GtkCallback]
+ private void on_file_chooser_cancel_clicked () requires (page == WizardWindowPage.FILE_CHOOSER) {
+ wizard_window.page = WizardWindowPage.MAIN;
+ }
+
+ [GtkCallback]
+ private void on_file_chooser_open_clicked () requires (page == WizardWindowPage.FILE_CHOOSER) {
+ var file_chooser = wizard_window.file_chooser;
+ var file = file_chooser.get_file ();
+ assert (file != null);
+ var file_type = file.query_file_type (FileQueryInfoFlags.NONE, null);
+
+ switch (file_type) {
+ case GLib.FileType.REGULAR:
+ case GLib.FileType.SYMBOLIC_LINK:
+ file_chooser.file_activated ();
+ break;
+
+ case GLib.FileType.DIRECTORY:
+ file_chooser.set_current_folder (file.get_path ());
+ break;
+
+ default:
+ debug ("Unknown file type selected");
+ break;
+ }
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]