[gnome-games/wip/exalm/snapshot: 1/6] ui: Rename SavestateListBoxRow to SnapshotRow



commit 84b87f89cd1945652aba8f0c226b531b5a08e00e
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Sun Mar 8 18:43:36 2020 +0500

    ui: Rename SavestateListBoxRow to SnapshotRow

 data/gtk-style.css                                 | 10 ++--
 data/org.gnome.Games.gresource.xml                 |  2 +-
 data/ui/savestates-list.ui                         | 10 ++--
 .../{savestate-listbox-row.ui => snapshot-row.ui}  | 10 ++--
 src/meson.build                                    |  2 +-
 src/ui/savestates-list.vala                        | 60 +++++++++++-----------
 ...avestate-listbox-row.vala => snapshot-row.vala} |  6 +--
 7 files changed, 50 insertions(+), 50 deletions(-)
---
diff --git a/data/gtk-style.css b/data/gtk-style.css
index 591dcf18..77d4ac32 100644
--- a/data/gtk-style.css
+++ b/data/gtk-style.css
@@ -1,26 +1,26 @@
 /* This file is part of GNOME Games. License: GPL-3.0+. */
 
-.savestate-row {
+.snapshot-row {
        padding: 0;
 }
 
-.savestate-thumbnail {
+.snapshot-thumbnail {
        color: rgba(255, 255, 255, 0.5);
        background: rgba(0, 0, 0, .5);
        border: 1px solid rgba(0, 0, 0, .5);
        border-radius: 5px;
 }
 
-.savestate-name {
+.snapshot-name {
        font-size: large;
 }
 
-.savestate-date {
+.snapshot-date {
        opacity: 0.5;
        font-size: small;
 }
 
-.savestates-list {
+.snapshot-list {
        border-left: none;
        border-right: none;
 }
diff --git a/data/org.gnome.Games.gresource.xml b/data/org.gnome.Games.gresource.xml
index 74e89ab6..feacfcda 100644
--- a/data/org.gnome.Games.gresource.xml
+++ b/data/org.gnome.Games.gresource.xml
@@ -48,9 +48,9 @@
     <file preprocess="xml-stripblanks">ui/reset-controller-mapping-dialog.ui</file>
     <file preprocess="xml-stripblanks">ui/resume-dialog.ui</file>
     <file preprocess="xml-stripblanks">ui/resume-failed-dialog.ui</file>
-    <file preprocess="xml-stripblanks">ui/savestate-listbox-row.ui</file>
     <file preprocess="xml-stripblanks">ui/savestates-list.ui</file>
     <file preprocess="xml-stripblanks">ui/search-bar.ui</file>
     <file preprocess="xml-stripblanks">ui/shortcuts-window.ui</file>
+    <file preprocess="xml-stripblanks">ui/snapshot-row.ui</file>
   </gresource>
 </gresources>
diff --git a/data/ui/savestates-list.ui b/data/ui/savestates-list.ui
index 6d488241..77b0752e 100644
--- a/data/ui/savestates-list.ui
+++ b/data/ui/savestates-list.ui
@@ -31,11 +31,11 @@
                       <class name="sidebar"/>
                     </style>
                     <child>
-                      <object class="GtkListBoxRow" id="new_savestate_row">
+                      <object class="GtkListBoxRow" id="new_snapshot_row">
                         <property name="visible">True</property>
                         <property name="selectable">False</property>
                         <style>
-                          <class name="savestate-row"/>
+                          <class name="snapshot-row"/>
                         </style>
                         <child>
                           <object class="GtkBox">
@@ -50,7 +50,7 @@
                                 <property name="height-request">66</property>
                                 <property name="margin">6</property>
                                 <style>
-                                  <class name="savestate-thumbnail"/>
+                                  <class name="snapshot-thumbnail"/>
                                 </style>
                               </object>
                             </child>
@@ -64,7 +64,7 @@
                                 <property name="label" translatable="yes">Create new snapshot</property>
                                 <property name="wrap">True</property>
                                 <style>
-                                  <class name="savestate-name"/>
+                                  <class name="snapshot-name"/>
                                 </style>
                               </object>
                             </child>
@@ -73,7 +73,7 @@
                       </object>
                     </child>
                     <style>
-                      <class name="savestates-list"/>
+                      <class name="snapshot-list"/>
                     </style>
                   </object>
                 </child>
diff --git a/data/ui/savestate-listbox-row.ui b/data/ui/snapshot-row.ui
similarity index 91%
rename from data/ui/savestate-listbox-row.ui
rename to data/ui/snapshot-row.ui
index ddf66e45..da81b1b8 100644
--- a/data/ui/savestate-listbox-row.ui
+++ b/data/ui/snapshot-row.ui
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk+" version="3.24"/>
-  <template class="GamesSavestateListBoxRow" parent="GtkListBoxRow">
+  <template class="GamesSnapshotRow" parent="GtkListBoxRow">
     <property name="visible">true</property>
     <signal name="notify::scale-factor" handler="on_scale_factor_changed"/>
     <style>
-      <class name="savestate-row"/>
+      <class name="snapshot-row"/>
     </style>
     <child>
       <object class="GtkRevealer" id="revealer">
@@ -24,7 +24,7 @@
                 <property name="margin">6</property>
                 <signal name="draw" handler="on_draw_image"/>
                 <style>
-                  <class name="savestate-thumbnail"/>
+                  <class name="snapshot-thumbnail"/>
                 </style>
               </object>
             </child>
@@ -47,7 +47,7 @@
                     <property name="yalign">0.75</property>
                     <property name="vexpand">True</property>
                     <style>
-                      <class name="savestate-name"/>
+                      <class name="snapshot-name"/>
                     </style>
                   </object>
                 </child>
@@ -59,7 +59,7 @@
                     <property name="yalign">0.25</property>
                     <property name="vexpand">True</property>
                     <style>
-                      <class name="savestate-date"/>
+                      <class name="snapshot-date"/>
                     </style>
                   </object>
                 </child>
diff --git a/src/meson.build b/src/meson.build
index f5d53eee..adb03498 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -148,10 +148,10 @@ vala_sources = [
   'ui/reset-controller-mapping-dialog.vala',
   'ui/resume-dialog.vala',
   'ui/resume-failed-dialog.vala',
-  'ui/savestate-listbox-row.vala',
   'ui/savestates-list.vala',
   'ui/search-bar.vala',
   'ui/shortcuts-window.vala',
+  'ui/snapshot-row.vala',
   'ui/ui-view.vala',
 
   'utils/composite-cover.vala',
diff --git a/src/ui/savestates-list.vala b/src/ui/savestates-list.vala
index 109fcc1b..1132b4c5 100644
--- a/src/ui/savestates-list.vala
+++ b/src/ui/savestates-list.vala
@@ -7,7 +7,7 @@ private class Games.SavestatesList : Gtk.Box {
        [GtkChild]
        private Gtk.ListBox list_box;
        [GtkChild]
-       private Gtk.ListBoxRow new_savestate_row;
+       private Gtk.ListBoxRow new_snapshot_row;
        [GtkChild]
        private Gtk.ScrolledWindow scrolled_window;
        [GtkChild]
@@ -41,43 +41,43 @@ private class Games.SavestatesList : Gtk.Box {
        private void on_move_cursor () {
                var row = list_box.get_selected_row ();
 
-               if (row != null && row is SavestateListBoxRow) {
-                       var savestate_row = row as SavestateListBoxRow;
-                       var savestate = savestate_row.savestate;
+               if (row != null && row is SnapshotRow) {
+                       var snapshot_row = row as SnapshotRow;
+                       var savestate = snapshot_row.savestate;
 
                        if (savestate != selected_savestate)
-                               select_savestate_row (row);
+                               select_snapshot_row (row);
                }
        }
 
        [GtkCallback]
        private void on_row_activated (Gtk.ListBoxRow activated_row) {
-               if (activated_row == new_savestate_row) {
+               if (activated_row == new_snapshot_row) {
                        var savestate = runner.try_create_savestate (false);
 
                        if (savestate != null) {
-                               var savestate_row = new SavestateListBoxRow (savestate);
+                               var snapshot_row = new SnapshotRow (savestate);
 
-                               list_box.insert (savestate_row, 1);
-                               select_savestate_row (savestate_row);
-                               savestate_row.reveal ();
+                               list_box.insert (snapshot_row, 1);
+                               select_snapshot_row (snapshot_row);
+                               snapshot_row.reveal ();
                        }
                        else {
                                // Savestate creation failed
-                               select_savestate_row (list_box.get_row_at_index (1));
+                               select_snapshot_row (list_box.get_row_at_index (1));
 
                                // TODO: Perhaps we should warn the user that the creation of
                                // the savestate failed via an in-app notification ?
                        }
                } else
-                       select_savestate_row (activated_row);
+                       select_snapshot_row (activated_row);
        }
 
        private void populate_list_box () {
                // Remove current savestate rows
                var list_rows = list_box.get_children ();
                foreach (var row in list_rows) {
-                       if (row != new_savestate_row)
+                       if (row != new_snapshot_row)
                                list_box.remove (row);
                }
 
@@ -86,10 +86,10 @@ private class Games.SavestatesList : Gtk.Box {
 
                var savestates = _runner.get_savestates ();
                foreach (var savestate in savestates) {
-                       var list_row = new SavestateListBoxRow (savestate);
+                       var list_row = new SnapshotRow (savestate);
+
                        // Reveal it early so that it doesn't animate
                        list_row.reveal ();
-
                        list_box.add (list_row);
                }
        }
@@ -99,7 +99,7 @@ private class Games.SavestatesList : Gtk.Box {
                if (is_revealed) {
                        runner.pause ();
                        populate_list_box ();
-                       select_savestate_row (null);
+                       select_snapshot_row (null);
                }
        }
 
@@ -113,8 +113,8 @@ private class Games.SavestatesList : Gtk.Box {
        private void on_delete_clicked () {
                var selected_row = list_box.get_selected_row ();
                var selected_row_index = selected_row.get_index ();
-               var savestate_row = selected_row as SavestateListBoxRow;
-               var savestate = savestate_row.savestate;
+               var snapshot_row = selected_row as SnapshotRow;
+               var savestate = snapshot_row.savestate;
 
                ensure_row_is_visible (selected_row);
                runner.delete_savestate (savestate);
@@ -140,11 +140,11 @@ private class Games.SavestatesList : Gtk.Box {
                }
 
                if (new_selected_row != null && new_selected_row.selectable)
-                       select_savestate_row (new_selected_row);
+                       select_snapshot_row (new_selected_row);
                else
-                       select_savestate_row (null);
+                       select_snapshot_row (null);
 
-               savestate_row.remove_animated ();
+               snapshot_row.remove_animated ();
        }
 
        [GtkCallback]
@@ -194,11 +194,11 @@ private class Games.SavestatesList : Gtk.Box {
                }
 
                foreach (var list_child in list_box.get_children ()) {
-                       if (!(list_child is SavestateListBoxRow))
+                       if (!(list_child is SnapshotRow))
                                continue; // Ignore the new savestate row;
 
-                       var savestate_row = list_child as SavestateListBoxRow;
-                       var savestate = savestate_row.savestate;
+                       var snapshot_row = list_child as SnapshotRow;
+                       var savestate = snapshot_row.savestate;
 
                        if (savestate.is_automatic)
                                continue;
@@ -223,9 +223,9 @@ private class Games.SavestatesList : Gtk.Box {
        [GtkCallback]
        private void apply_rename () {
                var selected_row = list_box.get_selected_row ();
-               var savestate_row = selected_row as SavestateListBoxRow;
+               var snapshot_row = selected_row as SnapshotRow;
 
-               savestate_row.set_name (rename_entry.text.strip ());
+               snapshot_row.set_name (rename_entry.text.strip ());
                rename_popover.popdown ();
        }
 
@@ -246,7 +246,7 @@ private class Games.SavestatesList : Gtk.Box {
                return action as SimpleAction;
        }
 
-       private void select_savestate_row (Gtk.ListBoxRow? row) {
+       private void select_snapshot_row (Gtk.ListBoxRow? row) {
                list_box.select_row (row);
 
                if (row == null) {
@@ -257,11 +257,11 @@ private class Games.SavestatesList : Gtk.Box {
                else {
                        row.grab_focus ();
 
-                       if (!(row is SavestateListBoxRow))
+                       if (!(row is SnapshotRow))
                                return;
 
-                       var savestate_row = row as SavestateListBoxRow;
-                       var savestate = savestate_row.savestate;
+                       var snapshot_row = row as SnapshotRow;
+                       var savestate = snapshot_row.savestate;
 
                        if (savestate == selected_savestate) {
                                lookup_action ("load-snapshot").activate (null);
diff --git a/src/ui/savestate-listbox-row.vala b/src/ui/snapshot-row.vala
similarity index 97%
rename from src/ui/savestate-listbox-row.vala
rename to src/ui/snapshot-row.vala
index ea7ab984..82fe277f 100644
--- a/src/ui/savestate-listbox-row.vala
+++ b/src/ui/snapshot-row.vala
@@ -1,7 +1,7 @@
 // This file is part of GNOME Games. License: GPL-3.0+.
 
-[GtkTemplate (ui = "/org/gnome/Games/ui/savestate-listbox-row.ui")]
-private class Games.SavestateListBoxRow : Gtk.ListBoxRow {
+[GtkTemplate (ui = "/org/gnome/Games/ui/snapshot-row.ui")]
+private class Games.SnapshotRow : Gtk.ListBoxRow {
        public const int THUMBNAIL_SIZE = 64;
 
        [GtkChild]
@@ -34,7 +34,7 @@ private class Games.SavestateListBoxRow : Gtk.ListBoxRow {
 
        private Gdk.Pixbuf pixbuf;
 
-       public SavestateListBoxRow (Savestate savestate) {
+       public SnapshotRow (Savestate savestate) {
                Object (savestate: savestate);
        }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]