[gnome-sound-recorder] multiple files: Implement gschema
- From: Meg Ford (Margaret) <megford src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sound-recorder] multiple files: Implement gschema
- Date: Wed, 7 May 2014 01:00:55 +0000 (UTC)
commit 88ebd295c791c8b8b64b32eb5feb771615d6d3d5
Author: Meg Ford <megford gnome org>
Date: Tue May 6 19:54:09 2014 -0500
multiple files: Implement gschema
The gschema settings were not being saved.
Closes Bug 727984 https://bugzilla.gnome.org/show_bug.cgi?id=727984
data/org.gnome.gnome-sound-recorder.gschema.xml | 31 +++++++--------------
src/application.js | 34 +++++++++++++++++++++--
src/mainWindow.js | 16 ++++++++---
3 files changed, 53 insertions(+), 28 deletions(-)
---
diff --git a/data/org.gnome.gnome-sound-recorder.gschema.xml b/data/org.gnome.gnome-sound-recorder.gschema.xml
index 0893668..f1d2474 100644
--- a/data/org.gnome.gnome-sound-recorder.gschema.xml
+++ b/data/org.gnome.gnome-sound-recorder.gschema.xml
@@ -1,7 +1,7 @@
<schemalist>
<schema id="org.gnome.gnome-sound-recorder" path="/org/gnome/gnome-sound-recorder/">
<key name="window-size" type="ai">
- <default>[700, 480]</default>
+ <default>[800, 480]</default>
<summary>Window size</summary>
<description>Window size (width and height).</description>
</key>
@@ -10,31 +10,20 @@
<summary>Window position</summary>
<description>Window position (x and y).</description>
</key>
- </schema>
- <schema id="org.gnome.gnome-sound-recorder.encoding-settings"
path="/org/gnome/gnome-sound-recorder/encoding-settings/">
- <key name="media-type" type="s">
- <default>'audio/x-vorbis'</default>
- <summary>Preferred media type for encoding audio when recording</summary>
- <description>Preferred media type for encoding audio when recording. 'audio/x-vorbis' for Ogg Vorbis,
or 'audio/mpeg' for MP3, for example. This is not a MIME type.</description>
- </key>
- <key name="media-type-presets" type="a{ss}">
- <default>[]</default>
+ <key name="media-type-preset" type="i">
+ <default>0</default>
<summary>Maps media types to audio encoder preset names.</summary>
- <description>Maps media types to audio encoder preset names. If there is no mapping for a media type,
the default encoder settings will be used.</description>
+ <description>Maps media types to audio encoder preset names. If there is no mapping set, the default
encoder settings will be used.</description>
</key>
- </schema>
- <schema id="org.gnome.gnome-sound-recorder.play" path="/org/gnome/gnome-sound-recorder/play/">
- <key name="volume" type="d">
+ <key name="mic-volume" type="d">
<default>0.75</default>
- <summary>Volume level</summary>
- <description>Volume level.</description>
+ <summary>Micophone volume level</summary>
+ <description>Micophone volume level.</description>
</key>
- </schema>
- <schema id="org.gnome.gnome-sound-recorder.record" path="/org/gnome/gnome-sound-recorder/record/">
- <key name="volume" type="d">
+ <key name="speaker-volume" type="d">
<default>0.75</default>
- <summary>Volume level</summary>
- <description>Volume level.</description>
+ <summary>Speaker volume level</summary>
+ <description>Speaker volume level.</description>
</key>
</schema>
</schemalist>
diff --git a/src/application.js b/src/application.js
index a1a3f31..6907a0c 100644
--- a/src/application.js
+++ b/src/application.js
@@ -24,10 +24,12 @@ const GLib = imports.gi.GLib;
const MainWindow = imports.mainWindow;
const Preferences = imports.preferences;
+
const SIGINT = 2;
const SIGTERM = 15;
let application = null;
+let settings = null;
const Application = new Lang.Class({
@@ -49,7 +51,6 @@ const Application = new Lang.Class({
section.append(_("About"), 'app.about');
section.append(_("Quit"),'app.quit');
this.set_app_menu(menu);
-
let preferences = new Gio.SimpleAction({ name: 'preferences' });
preferences.connect('activate', Lang.bind(this,
function() {
@@ -81,7 +82,7 @@ const Application = new Lang.Class({
Gst.init(null, 0);
this._initAppMenu();
application = this;
-
+ settings = new Gio.Settings({ schema: 'org.gnome.gnome-sound-recorder' });
/* Translators: "Recordings" here refers to the name of the directory where the application places
files */
let path = GLib.build_filenamev([GLib.get_home_dir(), _("Recordings")]);
@@ -97,7 +98,7 @@ const Application = new Lang.Class({
onWindowDestroy: function() {
if (MainWindow.wave.pipeline)
MainWindow.wave.pipeline.set_state(Gst.State.NULL);
-
+ media-type-preset
if (MainWindow._record.pipeline)
MainWindow._record.pipeline.set_state(Gst.State.NULL);
@@ -112,6 +113,33 @@ const Application = new Lang.Class({
function(widget, response) {
preferencesDialog.widget.destroy();
}));
+ },
+
+ getPreferences: function() {
+ let set = settings.get_int("media-type-preset");
+ return set;
+ },
+
+ setPreferences: function(profileName) {
+ settings.set_int("media-type-preset", profileName);
+ },
+
+ getMicVolume: function(level) {
+ let micVolLevel = settings.get_double("mic-volume");
+ return micVolLevel;
+ },
+
+ setMicVolume: function(level) {
+ settings.set_double("mic-volume", level);
+ },
+
+ getSpeakerVolume: function(level) {
+ let speakerVolLevel = settings.get_double("speaker-volume");
+ return speakerVolLevel;
+ },
+
+ setSpeakerVolume: function(level) {
+ settings.set_double("speaker-volume", level);
},
_showAbout: function() {
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 05c7b03..ef25fba 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -27,6 +27,7 @@ const Gio = imports.gi.Gio;
const Gst = imports.gi.Gst;
const Pango = imports.gi.Pango;
+const Application = imports.application;
const AudioProfile = imports.audioProfile;
const FileUtil = imports.fileUtil;
const Info = imports.info;
@@ -218,10 +219,13 @@ const MainView = new Lang.Class({
},
presetVolume: function(source, vol) {
- if (source == ActiveArea.PLAY)
+ if (source == ActiveArea.PLAY) {
volumeValue[0].play = vol;
- else
- volumeValue[0].record = vol;
+ Application.application.setSpeakerVolume(vol);
+ } else {
+ volumeValue[0].record = vol;
+ Application.application.setMicVolume(vol);
+ }
},
setVolume: function() {
@@ -241,7 +245,9 @@ const MainView = new Lang.Class({
listBoxAdd: function() {
selectable = true;
this.groupGrid = groupGrid;
- volumeValue.push({ record: 0.5, play: 0.5 });
+ let playVolume = Application.application.getSpeakerVolume();
+ let micVolume = Application.application.getMicVolume();
+ volumeValue.push({ record: micVolume, play: playVolume });
activeProfile = AudioProfile.comboBoxMap.OGG_VORBIS;
this.recordGrid = new Gtk.Grid({ orientation: Gtk.Orientation.HORIZONTAL,
@@ -813,12 +819,14 @@ const EncoderComboBox = new Lang.Class({
this.append_text(combo[i]);
this.set_property('valign', Gtk.Align.CENTER);
this.set_sensitive(true);
+ activeProfile = Application.application.getPreferences();
this.set_active(activeProfile);
this.connect("changed", Lang.bind(this, this._onComboBoxTextChanged));
},
_onComboBoxTextChanged: function() {
activeProfile = this.get_active();
+ Application.application.setPreferences(activeProfile);
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]