GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit c1b1a146 authored by Alexander Mikhaylenko's avatar Alexander Mikhaylenko

savestates-list: Move Delete button to an actionbar

It makes more sense for it to be there, since there will be a Rename
button there too. Additionally, it's more compact in mobile mode.
parent e3e9bb29
......@@ -149,19 +149,6 @@
<property name="pack-type">end</property>
</packing>
</child>
<child>
<object class="GtkButton" id="savestates_delete_btn">
<property name="sensitive">False</property>
<property name="visible">True</property>
<property name="valign">center</property>
<property name="use-underline">True</property>
<property name="label" translatable="yes">_Delete</property>
<signal name="clicked" handler="on_savestates_delete_clicked"/>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
<child>
<object class="GtkButton" id="savestates_back">
<property name="visible">True</property>
......@@ -207,11 +194,4 @@
</object>
</child>
</object>
<object class="GtkSizeGroup">
<property name="mode">GTK_SIZE_GROUP_HORIZONTAL</property>
<widgets>
<widget name="savestates_load_btn"/>
<widget name="savestates_delete_btn"/>
</widgets>
</object>
</interface>
......@@ -19,54 +19,79 @@
</object>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolled_window">
<object class="GtkBox">
<property name="visible">True</property>
<property name="vexpand">True</property>
<property name="width-request">350</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkListBox" id="list_box">
<object class="GtkScrolledWindow" id="scrolled_window">
<property name="visible">True</property>
<signal name="row-activated" after="yes" handler="on_row_activated"/>
<style>
<class name="sidebar"/>
</style>
<property name="vexpand">True</property>
<property name="width-request">350</property>
<child>
<object class="GtkListBoxRow" id="new_savestate_row">
<object class="GtkListBox" id="list_box">
<property name="visible">True</property>
<signal name="row-activated" after="yes" handler="on_row_activated"/>
<style>
<class name="savestate-row"/>
<class name="sidebar"/>
</style>
<child>
<object class="GtkBox">
<object class="GtkListBoxRow" id="new_savestate_row">
<property name="visible">True</property>
<style>
<class name="savestate-row"/>
</style>
<child>
<object class="GtkImage">
<object class="GtkBox">
<property name="visible">True</property>
<property name="icon-name">list-add-symbolic</property>
<property name="pixel-size">32</property>
<style>
<class name="savestate-thumbnail"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="margin">12</property>
<property name="label">Create new savestate</property>
<attributes>
<!-- "1.2" is the value of "large" -->
<attribute name="scale" value="1.2"/>
</attributes>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-name">list-add-symbolic</property>
<property name="pixel-size">32</property>
<style>
<class name="savestate-thumbnail"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="margin">12</property>
<property name="label">Create new savestate</property>
<attributes>
<!-- "1.2" is the value of "large" -->
<attribute name="scale" value="1.2"/>
</attributes>
</object>
</child>
</object>
</child>
</object>
</child>
<style>
<class name="savestates-list"/>
</style>
</object>
</child>
</object>
</child>
<child>
<object class="GtkActionBar">
<property name="visible">True</property>
<child>
<object class="GtkButton" id="delete_btn">
<property name="visible">True</property>
<property name="use-underline">True</property>
<property name="label" translatable="yes">_Delete</property>
<signal name="clicked" handler="on_delete_clicked"/>
<style>
<class name="destructive-action"/>
</style>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
<style>
<class name="savestates-list"/>
</style>
</object>
</child>
</object>
......
......@@ -86,8 +86,6 @@ private class Games.DisplayHeaderBar : Gtk.Stack {
private Gtk.HeaderBar savestates_header_bar;
[GtkChild]
private Gtk.Button savestates_load_btn;
[GtkChild]
private Gtk.Button savestates_delete_btn;
private Settings settings;
......@@ -136,11 +134,6 @@ private class Games.DisplayHeaderBar : Gtk.Stack {
savestates_list_state.load_clicked ();
}
[GtkCallback]
private void on_savestates_delete_clicked () {
savestates_list_state.delete_clicked ();
}
[GtkCallback]
private void on_savestates_back_clicked () {
runner.preview_current_state ();
......@@ -156,6 +149,5 @@ private class Games.DisplayHeaderBar : Gtk.Stack {
private void on_selected_savestate_changed () {
savestates_load_btn.sensitive = (savestates_list_state.selected_savestate != null);
savestates_delete_btn.sensitive = (savestates_list_state.selected_savestate != null);
}
}
......@@ -10,6 +10,8 @@ private class Games.SavestatesList : Gtk.Box {
private Gtk.ListBoxRow new_savestate_row;
[GtkChild]
private Gtk.ScrolledWindow scrolled_window;
[GtkChild]
private Gtk.Button delete_btn;
private SavestatesListState _state;
public SavestatesListState state {
......@@ -124,6 +126,7 @@ private class Games.SavestatesList : Gtk.Box {
state.on_revealer_transition_end ();
}
[GtkCallback]
private void on_delete_clicked () {
var selected_row = list_box.get_selected_row ();
var selected_row_index = selected_row.get_index ();
......@@ -177,5 +180,7 @@ private class Games.SavestatesList : Gtk.Box {
runner.preview_savestate (savestate);
state.selected_savestate = savestate;
}
delete_btn.sensitive = (state.selected_savestate != null);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment