1
# -*- coding: utf-8 -*-
3
# JamendoConfigureDialog.py
5
# Copyright (C) 2007 - Guillaume Desmottes
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)
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.
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.
22
from gi.repository import Gtk, Gio, GObject, PeasGtk
24
format_list = ['ogg3', 'mp32']
26
class JamendoConfigureDialog (GObject.Object, PeasGtk.Configurable):
27
__gtype_name__ = 'JamendoConfigureDialog'
28
object = GObject.property(type=GObject.Object)
31
GObject.Object.__init__(self)
32
self.settings = Gio.Settings("org.gnome.rhythmbox.plugins.jamendo")
35
def do_create_configure_widget(self):
36
builder = Gtk.Builder()
37
builder.add_from_file(rb.find_plugin_file(self, "jamendo-prefs.ui"))
39
self.config = builder.get_object('config')
40
self.audio_combobox = builder.get_object("audio_combobox")
42
# probably should just bind this, but too lazy
44
format_text = self.settings['format']
48
format = format_list.index(format_text)
51
self.audio_combobox.set_active(format)
53
self.audio_combobox.connect("changed", self.audio_combobox_changed)
56
def audio_combobox_changed (self, combobox):
57
format = self.audio_combobox.get_active()
58
self.settings['format'] = format_list[format]