[rubyripper] push by boukewou...@gmail.com - Finishing touch for issue 555. on 2013-01-24 20:07 GMT

1 view
Skip to first unread message

rubyr...@googlecode.com

unread,
Jan 24, 2013, 3:07:24 PM1/24/13
to rubyrippe...@googlegroups.com
Revision: 8bf1e4153590
Author: Bouke Woudstra <boukew...@gmail.com>
Date: Thu Jan 24 12:06:30 2013
Log: Finishing touch for issue 555.

http://code.google.com/p/rubyripper/source/detail?r=8bf1e4153590

Modified:
/lib/rubyripper/gtk2/gtkPreferences.rb

=======================================
--- /lib/rubyripper/gtk2/gtkPreferences.rb Thu Jan 24 11:26:07 2013
+++ /lib/rubyripper/gtk2/gtkPreferences.rb Thu Jan 24 12:06:30 2013
@@ -27,6 +27,7 @@
DEFAULT_COLUMN_SPACINGS = 5
DEFAULT_ROW_SPACINGS = 4
DEFAULT_BORDER_WIDTH = 7
+ CODEC_LABELS = {'flac' => 'FLAC', 'wavpack' => 'WavPack', 'other' =>
_('Other')}

def initialize(prefs=nil, deps=nil)
@prefs = prefs ? prefs : Preferences::Main.instance
@@ -174,9 +175,9 @@
@prefs.preGaps = @appendPregaps.active? ? 'append' : 'prepend'
@prefs.preEmphasis = @correctPreEmphasis.active? ? 'sox' : 'cue'
#codec settings
- @codecRows.each do |codec, objects|
- @prefs.send(codec + '=', true)
- @prefs.send('settings' + codec.capitalize + '=', objects[1].text)
+ @codecRows.each do |label, objects|
+ @prefs.send(getCodecForLabel(label) + '=', true)
+ @prefs.send('settings' + getCodecForLabel(label).capitalize + '=',
objects[1].text)
end
@prefs.playlist = @playlist.active?
@prefs.noSpaces = @noSpaces.active?
@@ -460,7 +461,7 @@
end

def createCodecRow(codec)
- @codecRows[codec] = [Gtk::Label.new(codec.capitalize)]
+ @codecRows[codec] = [Gtk::Label.new(getLabelForCodec(codec))]
@codecRows[codec][0].set_alignment(0, 0.5)
if codec == 'wav'
@codecRows[codec] << Gtk::Label.new(_('No settings available'))
@@ -481,6 +482,14 @@
end
end

+ def getLabelForCodec(codec)
+ CODEC_LABELS.key?(codec) ? CODEC_LABELS[codec] : codec.capitalize
+ end
+
+ def getCodecForLabel(label)
+ CODEC_LABELS.value?(label) ? CODEC_LABELS.key(label) : label.downcase
+ end
+
def updateCodecsView
@selectCodecsTable.each{|child| @selectCodecsTable.remove(child)}
@selectCodecsTable.resize(@codecRows.size + 1, columns = 3)
@@ -508,7 +517,7 @@
def createAddCodecRow
@addCodecComboBox = Gtk::ComboBox.new()
@prefs.allCodecs.each do |codec|
- @addCodecComboBox.append_text(codec.capitalize) unless
@codecRows.key?(codec)
+ @addCodecComboBox.append_text(getLabelForCodec(codec)) unless
@codecRows.key?(codec)
end

if @addCodecLabel.nil?
@@ -519,9 +528,9 @@
# create the signal for the button
@addCodecButton.signal_connect("button_release_event") do |a, b|

- codec = @addCodecComboBox.active_text
- if not codec.nil?
- createCodecRow(codec.downcase)
+ label = @addCodecComboBox.active_text
+ if not label.nil?
+ createCodecRow(getCodecForLabel(label))
updateCodecsView()
end
end
Reply all
Reply to author
Forward
0 new messages