Add UI to import folders

This commit is contained in:
Elias Projahn 2021-01-26 17:51:19 +01:00
parent 0eacd255e8
commit 3b82bb3ef2
2 changed files with 22 additions and 43 deletions

View file

@ -48,49 +48,27 @@
</object> </object>
</child> </child>
<child> <child>
<object class="GtkBox"> <object class="HdyStatusPage">
<property name="vexpand">True</property> <property name="vexpand">true</property>
<property name="halign">center</property> <property name="icon-name">folder-music-symbolic</property>
<property name="valign">center</property> <property name="title" translatable="yes">Import music</property>
<property name="margin-top">18</property> <property name="description" translatable="yes">Select the source which contains the new audio files below.</property>
<property name="margin-bottom">18</property>
<property name="margin-start">18</property>
<property name="margin-end">18</property>
<property name="orientation">vertical</property>
<property name="spacing">18</property>
<child> <child>
<object class="GtkImage"> <object class="GtkBox">
<property name="opacity">0.5019607843137255</property> <property name="orientation">horizontal</property>
<property name="pixel-size">80</property> <property name="homogeneous">true</property>
<property name="icon-name">media-optical-cd-audio-symbolic</property> <property name="spacing">6</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="opacity">0.5019607843137255</property>
<property name="label" translatable="yes">Import from audio CD</property>
<attributes>
<attribute name="size" value="16384"/>
</attributes>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="opacity">0.5019607843137255</property>
<property name="label" translatable="yes">Insert an audio compact disc into your drive and click the button below. The disc will be copied in the background while you set up the metadata.</property>
<property name="justify">center</property>
<property name="wrap">True</property>
<property name="max-width-chars">40</property>
</object>
</child>
<child>
<object class="GtkButton" id="import_button">
<property name="label" translatable="yes">Import</property>
<property name="receives-default">True</property>
<property name="halign">center</property> <property name="halign">center</property>
<style> <child>
<class name="suggested-action"/> <object class="GtkButton" id="folder_button">
</style> <property name="label" translatable="true">Select folder</property>
</object>
</child>
<child>
<object class="GtkButton" id="disc_button">
<property name="label" translatable="true">Copy audio CD</property>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>

View file

@ -28,7 +28,8 @@ impl SourceSelector {
get_widget!(builder, gtk::Button, back_button); get_widget!(builder, gtk::Button, back_button);
get_widget!(builder, gtk::Stack, stack); get_widget!(builder, gtk::Stack, stack);
get_widget!(builder, gtk::InfoBar, info_bar); get_widget!(builder, gtk::InfoBar, info_bar);
get_widget!(builder, gtk::Button, import_button); get_widget!(builder, gtk::Button, folder_button);
get_widget!(builder, gtk::Button, disc_button);
let this = Rc::new(Self { let this = Rc::new(Self {
backend, backend,
@ -47,7 +48,7 @@ impl SourceSelector {
} }
})); }));
import_button.connect_clicked(clone!(@strong this => move |_| { disc_button.connect_clicked(clone!(@strong this => move |_| {
this.stack.set_visible_child_name("loading"); this.stack.set_visible_child_name("loading");
let context = glib::MainContext::default(); let context = glib::MainContext::default();