~ubuntu-branches/ubuntu/oneiric/rhythmbox/oneiric

« back to all changes in this revision

Viewing changes to plugins/jamendo/JamendoConfigureDialog.py

  • Committer: Bazaar Package Importer
  • Author(s): Rico Tzschichholz
  • Date: 2011-07-29 16:41:38 UTC
  • mto: This revision was merged to the branch mainline in revision 191.
  • Revision ID: james.westby@ubuntu.com-20110729164138-wwicy8nqalm18ck7
Tags: upstream-2.90.1~20110802
ImportĀ upstreamĀ versionĀ 2.90.1~20110802

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
 
 
3
# JamendoConfigureDialog.py
 
4
#
 
5
# Copyright (C) 2007 - Guillaume Desmottes
 
6
#
 
7
# This program is free software; you can redistribute it and/or modify
 
8
# it under the terms of the GNU General Public License as published by
 
9
# the Free Software Foundation; either version 2, or (at your option)
 
10
# any later version.
 
11
#
 
12
# This program is distributed in the hope that it will be useful,
 
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
# GNU General Public License for more details.
 
16
#
 
17
# You should have received a copy of the GNU General Public License
 
18
# along with this program; if not, write to the Free Software
 
19
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
20
 
 
21
import rb
 
22
from gi.repository import Gtk, Gio, GObject, PeasGtk
 
23
 
 
24
format_list = ['ogg3', 'mp32']
 
25
 
 
26
class JamendoConfigureDialog (GObject.Object, PeasGtk.Configurable):
 
27
        __gtype_name__ = 'JamendoConfigureDialog'
 
28
        object = GObject.property(type=GObject.Object)
 
29
 
 
30
        def __init__(self):
 
31
                GObject.Object.__init__(self)
 
32
                self.settings = Gio.Settings("org.gnome.rhythmbox.plugins.jamendo")
 
33
                self.hate = self
 
34
 
 
35
        def do_create_configure_widget(self):
 
36
                builder = Gtk.Builder()
 
37
                builder.add_from_file(rb.find_plugin_file(self, "jamendo-prefs.ui"))
 
38
 
 
39
                self.config = builder.get_object('config')
 
40
                self.audio_combobox = builder.get_object("audio_combobox")
 
41
 
 
42
                # probably should just bind this, but too lazy
 
43
 
 
44
                format_text = self.settings['format']
 
45
                if not format_text:
 
46
                        format_text = "ogg3"
 
47
                try:
 
48
                        format = format_list.index(format_text)
 
49
                except ValueError:
 
50
                        format = 0
 
51
                self.audio_combobox.set_active(format)
 
52
 
 
53
                self.audio_combobox.connect("changed", self.audio_combobox_changed)
 
54
                return self.config
 
55
 
 
56
        def audio_combobox_changed (self, combobox):
 
57
                format = self.audio_combobox.get_active()
 
58
                self.settings['format'] = format_list[format]