[gnome-sound-recorder/bilelmoussaoui/misc: 6/6] misc: rename MainWindow to Window



commit 0a7dd32bd0dbb128a79915b7873f4fae6f5d10e3
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Sun Jun 14 15:52:34 2020 +0200

    misc: rename MainWindow to Window
    
    we only have one window...
    this also makes stack pages names consistent

 data/ui/window.ui                                | 13 ++++++-------
 po/POTFILES.in                                   |  2 +-
 src/application.js                               |  4 ++--
 src/org.gnome.SoundRecorder.src.gresource.xml.in |  2 +-
 src/{mainWindow.js => window.js}                 | 18 +++++++++---------
 5 files changed, 19 insertions(+), 20 deletions(-)
---
diff --git a/data/ui/window.ui b/data/ui/window.ui
index 155388e..41bf9c8 100644
--- a/data/ui/window.ui
+++ b/data/ui/window.ui
@@ -3,7 +3,7 @@
 <interface>
   <requires lib="gtk+" version="3.12"/>
   <requires lib="libhandy" version="0.0"/>
-  <template class="Gjs_MainWindow" parent="HdyApplicationWindow">
+  <template class="Gjs_Window" parent="HdyApplicationWindow">
     <property name="width_request">350</property>
     <property name="height_request">480</property>
     <property name="can_focus">False</property>
@@ -149,7 +149,7 @@
                 </child>
               </object>
               <packing>
-                <property name="name">mainView</property>
+                <property name="name">recordings</property>
               </packing>
             </child>
             <child>
@@ -166,14 +166,14 @@
                     <property name="margin_bottom">24</property>
                     <property name="orientation">vertical</property>
                     <child>
-                      <object class="GtkBox" id="recordGrid">
+                      <object class="GtkBox" id="recorderBox">
                         <property name="height_request">230</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="valign">center</property>
                         <property name="orientation">vertical</property>
                         <child>
-                          <object class="GtkLabel" id="recordTimeLabel">
+                          <object class="GtkLabel" id="recorderTime">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="margin_top">18</property>
@@ -198,7 +198,6 @@
                     </child>
                     <child>
                       <object class="GtkBox">
-                        <property name="width_request">150</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="halign">center</property>
@@ -306,7 +305,7 @@
                 </child>
               </object>
               <packing>
-                <property name="name">recorderView</property>
+                <property name="name">recorder</property>
                 <property name="position">1</property>
               </packing>
             </child>
@@ -373,7 +372,7 @@
                 </child>
               </object>
               <packing>
-                <property name="name">emptyView</property>
+                <property name="name">empty</property>
                 <property name="position">2</property>
               </packing>
             </child>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 61e82d9..a476c18 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -7,9 +7,9 @@ data/ui/row.ui
 data/ui/window.ui
 src/application.js
 src/main.js
-src/mainWindow.js
 src/player.js
 src/recorder.js
 src/row.js
 src/utils.js
 src/waveform.js
+src/window.js
diff --git a/src/application.js b/src/application.js
index 5052b95..4ece8bf 100644
--- a/src/application.js
+++ b/src/application.js
@@ -24,7 +24,7 @@ const { Gdk, Gio, GLib, GObject, Gst, Gtk } = imports.gi;
 const RecordingsDir = Gio.file_new_for_path(GLib.build_filenamev([GLib.get_home_dir(), _('Recordings')]));
 const Settings = new Gio.Settings({ schema: pkg.name });
 
-const { MainWindow } = imports.mainWindow;
+const { Window } = imports.window;
 
 var Application = GObject.registerClass(class Application extends Gtk.Application {
     _init() {
@@ -140,7 +140,7 @@ var Application = GObject.registerClass(class Application extends Gtk.Applicatio
     }
 
     vfunc_activate() {
-        this.window = new MainWindow({ application: this });
+        this.window = new Window({ application: this });
         if (pkg.name.endsWith('Devel'))
             this.window.get_style_context().add_class('devel');
         this.window.show();
diff --git a/src/org.gnome.SoundRecorder.src.gresource.xml.in 
b/src/org.gnome.SoundRecorder.src.gresource.xml.in
index 7ead7f0..d7a54cb 100644
--- a/src/org.gnome.SoundRecorder.src.gresource.xml.in
+++ b/src/org.gnome.SoundRecorder.src.gresource.xml.in
@@ -7,9 +7,9 @@
     <file>recording.js</file>
     <file>row.js</file>
     <file>main.js</file>
-    <file>mainWindow.js</file>
     <file>player.js</file>
     <file>recorder.js</file>
     <file>waveform.js</file>
+    <file>window.js</file>
   </gresource>
 </gresources>
diff --git a/src/mainWindow.js b/src/window.js
similarity index 85%
rename from src/mainWindow.js
rename to src/window.js
index 103f53f..a5e46dc 100644
--- a/src/mainWindow.js
+++ b/src/window.js
@@ -1,4 +1,4 @@
-/* exported MainWindow */
+/* exported Window */
 /*
 * Copyright 2013 Meg Ford
 * This library is free software; you can redistribute it and/or
@@ -27,10 +27,10 @@ const Utils = imports.utils;
 const { WaveForm } = imports.waveform;
 
 
-var MainWindow = GObject.registerClass({
+var Window = GObject.registerClass({
     Template: 'resource:///org/gnome/SoundRecorder/ui/window.ui',
-    InternalChildren: ['recordTimeLabel', 'mainStack', 'recordGrid', 'listBox', 'emptyIcon', 
'playbackStack', 'headerRevealer'],
-}, class MainWindow extends Handy.ApplicationWindow {
+    InternalChildren: ['recorderTime', 'mainStack', 'recorderBox', 'listBox', 'emptyIcon', 'playbackStack', 
'headerRevealer'],
+}, class Window extends Handy.ApplicationWindow {
 
     _init(params) {
         super._init(Object.assign({
@@ -40,14 +40,14 @@ var MainWindow = GObject.registerClass({
         this.recorder = new Recorder();
         this.player = new Player();
         this.waveform = new WaveForm();
-        this._recordGrid.add(this.waveform);
+        this._recorderBox.add(this.waveform);
 
         this.recorder.connect('waveform', (_, time, peak) => {
             this.waveform.drawAt(time, peak);
         });
 
         this.recorder.connect('notify::duration', _recorder => {
-            this._recordTimeLabel.label = Utils.Time.formatTime(_recorder.duration);
+            this._recorderTime.label = Utils.Time.formatTime(_recorder.duration);
         });
 
         this.connect('destroy', () => {
@@ -94,7 +94,7 @@ var MainWindow = GObject.registerClass({
         this.player.stop();
 
         this._headerRevealer.reveal_child = false;
-        this._mainStack.visible_child_name = 'recorderView';
+        this._mainStack.visible_child_name = 'recorder';
         this._playbackStack.visible_child_name = 'recorder-pause';
 
         this.recorder.start();
@@ -112,8 +112,8 @@ var MainWindow = GObject.registerClass({
 
     _refreshView() {
         if (this._recordingList.get_n_items() === 0)
-            this._mainStack.visible_child_name = 'emptyView';
+            this._mainStack.visible_child_name = 'empty';
         else
-            this._mainStack.visible_child_name = 'mainView';
+            this._mainStack.visible_child_name = 'recordings';
     }
 });


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