[gnome-sound-recorder] record.js, listview.js: Use the file array length to set clip number
- From: Meg Ford (Margaret) <megford src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sound-recorder] record.js, listview.js: Use the file array length to set clip number
- Date: Wed, 7 May 2014 01:00:45 +0000 (UTC)
commit 368d187ddd1fd4dfceced48fe5d4e505fc586017
Author: Meg Ford <megford gnome org>
Date: Mon May 5 14:16:16 2014 -0500
record.js, listview.js: Use the file array length to set clip number
Use the length of the array instead of GST_TAG_TITLE.
Number according to the number of files in the directory.
src/listview.js | 9 +--------
src/record.js | 16 +++++++++-------
2 files changed, 10 insertions(+), 15 deletions(-)
---
diff --git a/src/listview.js b/src/listview.js
index 74743a8..5596013 100644
--- a/src/listview.js
+++ b/src/listview.js
@@ -206,14 +206,7 @@ const Listview = new Lang.Class({
let dateTimeTag = this.tagInfo.get_date_time('datetime')[1];
let title = this.tagInfo.get_string('title')[1];
let durationInfo = info.get_duration();
- allFilesInfo[this.idx].duration = durationInfo;
-
- if (title != null) {
- allFilesInfo[this.idx].title = title;
- if (parseInt(title) > trackNumber)
- trackNumber = parseInt(title);
- }
-
+ allFilesInfo[this.idx].duration = durationInfo;
/* this.file.dateCreated will usually be null since time::created it doesn't usually exist.
Therefore, we prefer to set it with tags */
diff --git a/src/record.js b/src/record.js
index 8f9aa45..2194ea6 100644
--- a/src/record.js
+++ b/src/record.js
@@ -95,9 +95,7 @@ const Record = new Lang.Class({
this.taglist = Gst.TagList.new_empty();
this.taglist.add_value(Gst.TagMergeMode.APPEND, Gst.TAG_APPLICATION_NAME,
_("Sound Recorder"));
element.merge_tags(this.taglist, Gst.TagMergeMode.REPLACE);
- let trackNumber = Listview.trackNumber + 1;
- let trackNumberString = trackNumber.toString();
- this.taglist.add_value(Gst.TagMergeMode.APPEND, Gst.TAG_TITLE,
trackNumberString);
+ this.taglist.add_value(Gst.TagMergeMode.APPEND, Gst.TAG_TITLE,
this.initialFileName);
element.merge_tags(this.taglist, Gst.TagMergeMode.REPLACE);
this.taglist.add_value(Gst.TagMergeMode.APPEND, Gst.TAG_DATE_TIME,
this.gstreamerDateTime);
element.merge_tags(this.taglist, Gst.TagMergeMode.REPLACE);
@@ -157,7 +155,7 @@ const Record = new Lang.Class({
if (ret == Gst.StateChangeReturn.FAILURE) {
this._showErrorDialog(_('Unable to set the pipeline \n to the recording state'));
- this.initialFileName.delete_async(GLib.PRIORITY_DEFAULT, null, null);
+ this._buildFileName.getTitle().delete_async(GLib.PRIORITY_DEFAULT, null, null);
} else {
MainWindow.view.setVolume();
}
@@ -289,16 +287,20 @@ const BuildFileName = new Lang.Class({
let fileExtensionName = MainWindow.audioProfile.fileExtensionReturner();
let dir = Gio.Application.get_default().saveDir;
this.dateTime = GLib.DateTime.new_now_local();
- this.clipNumber = Listview.trackNumber + 1;
+ this.clipNumber = Listview.allFilesInfo.length + 1;
this.clipNumberString = this.clipNumber.toString();
/* Translators: ""Clip %d"" is the default name assigned to a file created
by the application (for example, "Clip 1"). */
let clipName = _("Clip %d").format(this.clipNumberString);
- let clip = dir.get_child_for_display_name(clipName);
- let file = clip.get_path();
+ this.clip = dir.get_child_for_display_name(clipName);
+ let file = this.clip.get_path();
return file;
},
+ getTitle: function() {
+ return this.clip;
+ },
+
getOrigin: function() {
return this.dateTime;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]