Example #1
0
    def __init__(self, config, window, on_streams_button_press, on_add_item,
                 settings_save, TAB_STREAMS, new_tab):
        self.config = config
        self.window = window
        self.on_streams_button_press = on_streams_button_press
        self.on_add_item = on_add_item
        self.settings_save = settings_save

        # Streams tab
        self.streams = ui.treeview()
        self.streams_selection = self.streams.get_selection()
        self.streamswindow = ui.scrollwindow(add=self.streams)

        self.tab = new_tab(self.streamswindow, gtk.STOCK_NETWORK, TAB_STREAMS,
                           self.streams)

        self.streams.connect('button_press_event',
                             self.on_streams_button_press)
        self.streams.connect('row_activated', self.on_streams_activated)
        self.streams.connect('key-press-event', self.on_streams_key_press)

        # Initialize streams data and widget
        self.streamsdata = gtk.ListStore(str, str, str)
        self.streams.set_model(self.streamsdata)
        self.streams.set_search_column(1)
        self.streamsimg = gtk.CellRendererPixbuf()
        self.streamscell = gtk.CellRendererText()
        self.streamscell.set_property("ellipsize", pango.ELLIPSIZE_END)
        self.streamscolumn = gtk.TreeViewColumn()
        self.streamscolumn.pack_start(self.streamsimg, False)
        self.streamscolumn.pack_start(self.streamscell, True)
        self.streamscolumn.set_attributes(self.streamsimg, stock_id=0)
        self.streamscolumn.set_attributes(self.streamscell, markup=1)
        self.streams.append_column(self.streamscolumn)
        self.streams_selection.set_mode(gtk.SELECTION_MULTIPLE)
Example #2
0
	def __init__(self, config, window, on_streams_button_press, on_add_item, settings_save, TAB_STREAMS, new_tab):
		self.config = config
		self.window = window
		self.on_streams_button_press = on_streams_button_press
		self.on_add_item = on_add_item
		self.settings_save = settings_save

		# Streams tab
		self.streams = ui.treeview()
		self.streams_selection = self.streams.get_selection()
		self.streamswindow = ui.scrollwindow(add=self.streams)

		self.tab = new_tab(self.streamswindow, gtk.STOCK_NETWORK, TAB_STREAMS, self.streams)

		self.streams.connect('button_press_event', self.on_streams_button_press)
		self.streams.connect('row_activated', self.on_streams_activated)
		self.streams.connect('key-press-event', self.on_streams_key_press)

		# Initialize streams data and widget
		self.streamsdata = gtk.ListStore(str, str, str)
		self.streams.set_model(self.streamsdata)
		self.streams.set_search_column(1)
		self.streamsimg = gtk.CellRendererPixbuf()
		self.streamscell = gtk.CellRendererText()
		self.streamscell.set_property("ellipsize", pango.ELLIPSIZE_END)
		self.streamscolumn = gtk.TreeViewColumn()
		self.streamscolumn.pack_start(self.streamsimg, False)
		self.streamscolumn.pack_start(self.streamscell, True)
		self.streamscolumn.set_attributes(self.streamsimg, stock_id=0)
		self.streamscolumn.set_attributes(self.streamscell, markup=1)
		self.streams.append_column(self.streamscolumn)
		self.streams_selection.set_mode(gtk.SELECTION_MULTIPLE)
Example #3
0
    def __init__(self, config, window, client, UIManager,
                 update_menu_visibility, iterate_now, on_add_item,
                 on_playlists_button_press, get_current_songs, connected,
                 add_selected_to_playlist, TAB_PLAYLISTS):
        self.config = config
        self.window = window
        self.client = client
        self.UIManager = UIManager
        self.update_menu_visibility = update_menu_visibility
        self.iterate_now = iterate_now  # XXX Do we really need this?
        self.on_add_item = on_add_item
        self.on_playlists_button_press = on_playlists_button_press
        self.get_current_songs = get_current_songs
        self.add_selected_to_playlist = add_selected_to_playlist
        self.connected = connected

        self.mergepl_id = None
        self.actionGroupPlaylists = None

        # Playlists tab
        self.playlists = ui.treeview()
        self.playlists_selection = self.playlists.get_selection()
        self.playlistswindow = ui.scrollwindow(add=self.playlists)

        self.tab = (self.playlistswindow, gtk.STOCK_JUSTIFY_CENTER,
                    TAB_PLAYLISTS, self.playlists)

        self.playlists.connect('button_press_event',
                               self.on_playlists_button_press)
        self.playlists.connect('row_activated', self.playlists_activated)
        self.playlists.connect('key-press-event', self.playlists_key_press)

        # Initialize playlist data and widget
        self.playlistsdata = gtk.ListStore(str, str)
        self.playlists.set_model(self.playlistsdata)
        self.playlists.set_search_column(1)
        self.playlistsimg = gtk.CellRendererPixbuf()
        self.playlistscell = gtk.CellRendererText()
        self.playlistscell.set_property("ellipsize", pango.ELLIPSIZE_END)
        self.playlistscolumn = gtk.TreeViewColumn()
        self.playlistscolumn.pack_start(self.playlistsimg, False)
        self.playlistscolumn.pack_start(self.playlistscell, True)
        self.playlistscolumn.set_attributes(self.playlistsimg, stock_id=0)
        self.playlistscolumn.set_attributes(self.playlistscell, markup=1)
        self.playlists.append_column(self.playlistscolumn)
        self.playlists_selection.set_mode(gtk.SELECTION_MULTIPLE)

        pluginsystem.plugin_infos.append(
            BuiltinPlugin('playlists', "Playlists", "A tab for playlists.",
                          {'tabs': 'construct_tab'}, self))
Example #4
0
    def __init__(self, config, window, client, UIManager,
                 update_menu_visibility, iterate_now, on_add_item,
                 on_playlists_button_press, get_current_songs, connected,
                 add_selected_to_playlist, TAB_PLAYLISTS):
        self.config = config
        self.window = window
        self.client = client
        self.UIManager = UIManager
        self.update_menu_visibility = update_menu_visibility
        self.iterate_now = iterate_now # XXX Do we really need this?
        self.on_add_item = on_add_item
        self.on_playlists_button_press = on_playlists_button_press
        self.get_current_songs = get_current_songs
        self.add_selected_to_playlist = add_selected_to_playlist
        self.connected = connected

        self.mergepl_id = None
        self.actionGroupPlaylists = None

        # Playlists tab
        self.playlists = ui.treeview()
        self.playlists_selection = self.playlists.get_selection()
        self.playlistswindow = ui.scrollwindow(add=self.playlists)

        self.tab = (self.playlistswindow, gtk.STOCK_JUSTIFY_CENTER,
                    TAB_PLAYLISTS, self.playlists)

        self.playlists.connect('button_press_event',
                               self.on_playlists_button_press)
        self.playlists.connect('row_activated', self.playlists_activated)
        self.playlists.connect('key-press-event', self.playlists_key_press)

        # Initialize playlist data and widget
        self.playlistsdata = gtk.ListStore(str, str)
        self.playlists.set_model(self.playlistsdata)
        self.playlists.set_search_column(1)
        self.playlistsimg = gtk.CellRendererPixbuf()
        self.playlistscell = gtk.CellRendererText()
        self.playlistscell.set_property("ellipsize", pango.ELLIPSIZE_END)
        self.playlistscolumn = gtk.TreeViewColumn()
        self.playlistscolumn.pack_start(self.playlistsimg, False)
        self.playlistscolumn.pack_start(self.playlistscell, True)
        self.playlistscolumn.set_attributes(self.playlistsimg, stock_id=0)
        self.playlistscolumn.set_attributes(self.playlistscell, markup=1)
        self.playlists.append_column(self.playlistscolumn)
        self.playlists_selection.set_mode(gtk.SELECTION_MULTIPLE)

        pluginsystem.plugin_infos.append(BuiltinPlugin(
                'playlists', "Playlists", "A tab for playlists.",
                {'tabs': 'construct_tab'}, self))
Example #5
0
    def __init__(self, config, window, client, UIManager,
                 update_menu_visibility, iterate_now, on_add_item,
                 on_playlists_button_press, get_current_songs, connected,
                 TAB_PLAYLISTS):
        self.config = config
        self.window = window
        self.client = client
        self.UIManager = UIManager
        self.update_menu_visibility = update_menu_visibility
        self.iterate_now = iterate_now  # XXX Do we really need this?
        self.on_add_item = on_add_item
        self.on_playlists_button_press = on_playlists_button_press
        self.get_current_songs = get_current_songs
        self.connected = connected
        self.TAB_PLAYLISTS = TAB_PLAYLISTS

        self.mergepl_id = None
        self.actionGroupPlaylists = None

        # Playlists tab
        self.playlists = ui.treeview()
        self.playlists_selection = self.playlists.get_selection()
        self.playlistswindow = ui.scrollwindow(add=self.playlists)
        playlistshbox = gtk.HBox()
        playlistshbox.pack_start(ui.image(stock=gtk.STOCK_JUSTIFY_CENTER),
                                 False, False, 2)
        playlistshbox.pack_start(ui.label(text=self.TAB_PLAYLISTS), False,
                                 False, 2)
        self.playlistsevbox = ui.eventbox(add=playlistshbox)
        self.playlistsevbox.show_all()

        self.playlists.connect('button_press_event',
                               self.on_playlists_button_press)
        self.playlists.connect('row_activated', self.playlists_activated)
        self.playlists.connect('key-press-event', self.playlists_key_press)

        # Initialize playlist data and widget
        self.playlistsdata = gtk.ListStore(str, str)
        self.playlists.set_model(self.playlistsdata)
        self.playlists.set_search_column(1)
        self.playlistsimg = gtk.CellRendererPixbuf()
        self.playlistscell = gtk.CellRendererText()
        self.playlistscell.set_property("ellipsize", pango.ELLIPSIZE_END)
        self.playlistscolumn = gtk.TreeViewColumn()
        self.playlistscolumn.pack_start(self.playlistsimg, False)
        self.playlistscolumn.pack_start(self.playlistscell, True)
        self.playlistscolumn.set_attributes(self.playlistsimg, stock_id=0)
        self.playlistscolumn.set_attributes(self.playlistscell, markup=1)
        self.playlists.append_column(self.playlistscolumn)
        self.playlists_selection.set_mode(gtk.SELECTION_MULTIPLE)
Example #6
0
	def __init__(self, config, window, client, UIManager, update_menu_visibility, iterate_now, on_add_item, on_playlists_button_press, get_current_songs, connected, TAB_PLAYLISTS):
		self.config = config
		self.window = window
		self.client = client
		self.UIManager = UIManager
		self.update_menu_visibility = update_menu_visibility
		self.iterate_now = iterate_now # XXX Do we really need this?
		self.on_add_item = on_add_item
		self.on_playlists_button_press = on_playlists_button_press
		self.get_current_songs = get_current_songs
		self.connected = connected
		self.TAB_PLAYLISTS = TAB_PLAYLISTS

		self.mergepl_id = None
		self.actionGroupPlaylists = None

		# Playlists tab
		self.playlists = ui.treeview()
		self.playlists_selection = self.playlists.get_selection()
		self.playlistswindow = ui.scrollwindow(add=self.playlists)
		playlistshbox = gtk.HBox()
		playlistshbox.pack_start(ui.image(stock=gtk.STOCK_JUSTIFY_CENTER), False, False, 2)
		playlistshbox.pack_start(ui.label(text=self.TAB_PLAYLISTS), False, False, 2)
		self.playlistsevbox = ui.eventbox(add=playlistshbox)
		self.playlistsevbox.show_all()

		self.playlists.connect('button_press_event', self.on_playlists_button_press)
		self.playlists.connect('row_activated', self.playlists_activated)
		self.playlists.connect('key-press-event', self.playlists_key_press)

		# Initialize playlist data and widget
		self.playlistsdata = gtk.ListStore(str, str)
		self.playlists.set_model(self.playlistsdata)
		self.playlists.set_search_column(1)
		self.playlistsimg = gtk.CellRendererPixbuf()
		self.playlistscell = gtk.CellRendererText()
		self.playlistscell.set_property("ellipsize", pango.ELLIPSIZE_END)
		self.playlistscolumn = gtk.TreeViewColumn()
		self.playlistscolumn.pack_start(self.playlistsimg, False)
		self.playlistscolumn.pack_start(self.playlistscell, True)
		self.playlistscolumn.set_attributes(self.playlistsimg, stock_id=0)
		self.playlistscolumn.set_attributes(self.playlistscell, markup=1)
		self.playlists.append_column(self.playlistscolumn)
		self.playlists_selection.set_mode(gtk.SELECTION_MULTIPLE)
Example #7
0
	def __init__(self, config, window, on_streams_button_press, on_add_item, settings_save, iterate_now, TAB_STREAMS):
		self.config = config
		self.window = window
		self.on_streams_button_press = on_streams_button_press
		self.on_add_item = on_add_item
		self.settings_save = settings_save
		self.iterate_now = iterate_now # XXX Do we really need this?
		self.TAB_STREAMS = TAB_STREAMS

		# Streams tab
		self.streams = ui.treeview()
		self.streams_selection = self.streams.get_selection()
		self.streamswindow = ui.scrollwindow(add=self.streams)
		streamshbox = gtk.HBox()
		streamshbox.pack_start(ui.image(stock=gtk.STOCK_NETWORK), False, False, 2)
		streamshbox.pack_start(ui.label(text=self.TAB_STREAMS), False, False, 2)
		self.streamsevbox = ui.eventbox(add=streamshbox)
		self.streamsevbox.show_all()

		self.streams.connect('button_press_event', self.on_streams_button_press)
		self.streams.connect('row_activated', self.on_streams_activated)
		self.streams.connect('key-press-event', self.on_streams_key_press)

		# Initialize streams data and widget
		self.streamsdata = gtk.ListStore(str, str, str)
		self.streams.set_model(self.streamsdata)
		self.streams.set_search_column(1)
		self.streamsimg = gtk.CellRendererPixbuf()
		self.streamscell = gtk.CellRendererText()
		self.streamscell.set_property("ellipsize", pango.ELLIPSIZE_END)
		self.streamscolumn = gtk.TreeViewColumn()
		self.streamscolumn.pack_start(self.streamsimg, False)
		self.streamscolumn.pack_start(self.streamscell, True)
		self.streamscolumn.set_attributes(self.streamsimg, stock_id=0)
		self.streamscolumn.set_attributes(self.streamscell, markup=1)
		self.streams.append_column(self.streamscolumn)
		self.streams_selection.set_mode(gtk.SELECTION_MULTIPLE)
Example #8
0
    def __init__(
        self,
        config,
        client,
        TAB_CURRENT,
        on_current_button_press,
        parse_formatting_colnames,
        parse_formatting,
        connected,
        sonata_loaded,
        songinfo,
        update_statusbar,
        iterate_now,
        libsearchfilter_get_style,
    ):
        self.config = config
        self.client = client
        self.TAB_CURRENT = TAB_CURRENT
        self.on_current_button_press = on_current_button_press
        self.parse_formatting_colnames = parse_formatting_colnames
        self.parse_formatting = parse_formatting
        self.connected = connected
        self.sonata_loaded = sonata_loaded
        self.songinfo = songinfo
        self.update_statusbar = update_statusbar
        self.iterate_now = iterate_now
        self.libsearchfilter_get_style = libsearchfilter_get_style

        self.currentdata = None
        self.filterbox_visible = False
        self.current_update_skip = False
        self.filter_row_mapping = []  # Mapping between filter rows and self.currentdata rows
        self.columnformat = None
        self.columns = None

        self.current_songs = None
        self.filterbox_cmd_buf = None
        self.filterbox_cond = None
        self.filterbox_source = None
        self.column_sorted = (None, gtk.SORT_DESCENDING)  # TreeViewColumn, order
        self.total_time = 0
        self.edit_style_orig = None
        self.resizing_columns = None
        self.prev_boldrow = -1
        self.prevtodo = None
        self.plpos = None
        self.playlist_pos_before_filter = None
        self.sel_rows = None

        # Current tab
        self.current = ui.treeview(reorder=True, search=False, headers=True)
        self.current_selection = self.current.get_selection()
        self.expanderwindow = ui.scrollwindow(shadow=gtk.SHADOW_IN, add=self.current)
        self.filterpattern = ui.entry()
        self.filterbox = gtk.HBox()
        self.filterbox.pack_start(ui.label(text=_("Filter") + ":"), False, False, 5)
        self.filterbox.pack_start(self.filterpattern, True, True, 5)
        filterclosebutton = ui.button(img=ui.image(stock=gtk.STOCK_CLOSE), relief=gtk.RELIEF_NONE)
        self.filterbox.pack_start(filterclosebutton, False, False, 0)
        self.filterbox.set_no_show_all(True)
        self.vbox_current = gtk.VBox()
        self.vbox_current.pack_start(self.expanderwindow, True, True)
        self.vbox_current.pack_start(self.filterbox, False, False, 5)
        playlisthbox = gtk.HBox()
        playlisthbox.pack_start(ui.image(stock=gtk.STOCK_CDROM), False, False, 2)
        playlisthbox.pack_start(ui.label(text=self.TAB_CURRENT), False, False, 2)
        self.playlistevbox = ui.eventbox(add=playlisthbox)
        self.playlistevbox.show_all()

        self.current.connect("drag_data_received", self.on_dnd)
        self.current.connect("row_activated", self.on_current_click)
        self.current.connect("button_press_event", self.on_current_button_press)
        self.current.connect("drag-begin", self.on_current_drag_begin)
        self.current.connect_after("drag-begin", self.dnd_after_current_drag_begin)
        self.current.connect("button_release_event", self.on_current_button_release)

        self.filter_changed_handler = self.filterpattern.connect("changed", self.searchfilter_feed_loop)
        self.filterpattern.connect("activate", self.searchfilter_on_enter)
        self.filterpattern.connect("key-press-event", self.searchfilter_key_pressed)
        filterclosebutton.connect("clicked", self.searchfilter_toggle)

        # Set up current view
        self.initialize_columns()
        self.current_selection.set_mode(gtk.SELECTION_MULTIPLE)
        target_reorder = ("MY_TREE_MODEL_ROW", gtk.TARGET_SAME_WIDGET, 0)
        target_file_managers = ("text/uri-list", 0, 0)
        self.current.enable_model_drag_source(
            gtk.gdk.BUTTON1_MASK, [target_reorder, target_file_managers], gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_DEFAULT
        )
        self.current.enable_model_drag_dest(
            [target_reorder, target_file_managers], gtk.gdk.ACTION_MOVE | gtk.gdk.ACTION_DEFAULT
        )
        self.current.connect("drag-data-get", self.dnd_get_data_for_file_managers)
Example #9
0
    def __init__(self, config, client, TAB_CURRENT, on_current_button_press,
                 parse_formatting_colnames, parse_formatting, connected,
                 sonata_loaded, songinfo, update_statusbar, iterate_now,
                 libsearchfilter_get_style, new_tab):
        self.config = config
        self.client = client
        self.on_current_button_press = on_current_button_press
        self.parse_formatting_colnames = parse_formatting_colnames
        self.parse_formatting = parse_formatting
        self.connected = connected
        self.sonata_loaded = sonata_loaded
        self.songinfo = songinfo
        self.update_statusbar = update_statusbar
        self.iterate_now = iterate_now
        self.libsearchfilter_get_style = libsearchfilter_get_style

        self.currentdata = None
        self.filterbox_visible = False
        self.current_update_skip = False
        self.filter_row_mapping = [
        ]  # Mapping between filter rows and self.currentdata rows
        self.columnformat = None
        self.columns = None

        self.current_songs = None
        self.filterbox_cmd_buf = None
        self.filterbox_cond = None
        self.filterbox_source = None
        self.column_sorted = (None, gtk.SORT_DESCENDING
                              )  # TreeViewColumn, order
        self.total_time = 0
        self.edit_style_orig = None
        self.resizing_columns = None
        self.prev_boldrow = -1
        self.prevtodo = None
        self.plpos = None
        self.playlist_pos_before_filter = None
        self.sel_rows = None

        # Current tab
        self.current = ui.treeview(reorder=True, search=False, headers=True)
        self.current_selection = self.current.get_selection()
        self.expanderwindow = ui.scrollwindow(shadow=gtk.SHADOW_IN,
                                              add=self.current)
        self.filterpattern = ui.entry()
        self.filterbox = gtk.HBox()
        self.filterbox.pack_start(ui.label(text=_("Filter") + ":"), False,
                                  False, 5)
        self.filterbox.pack_start(self.filterpattern, True, True, 5)
        filterclosebutton = ui.button(img=ui.image(stock=gtk.STOCK_CLOSE),
                                      relief=gtk.RELIEF_NONE)
        self.filterbox.pack_start(filterclosebutton, False, False, 0)
        self.filterbox.set_no_show_all(True)
        self.vbox_current = gtk.VBox()
        self.vbox_current.pack_start(self.expanderwindow, True, True)
        self.vbox_current.pack_start(self.filterbox, False, False, 5)

        self.tab = new_tab(self.vbox_current, gtk.STOCK_CDROM, TAB_CURRENT,
                           self.current)

        self.current.connect('drag_data_received', self.on_dnd)
        self.current.connect('row_activated', self.on_current_click)
        self.current.connect('button_press_event',
                             self.on_current_button_press)
        self.current.connect('drag-begin', self.on_current_drag_begin)
        self.current.connect_after('drag-begin',
                                   self.dnd_after_current_drag_begin)
        self.current.connect('button_release_event',
                             self.on_current_button_release)

        self.filter_changed_handler = self.filterpattern.connect(
            'changed', self.searchfilter_feed_loop)
        self.filterpattern.connect('activate', self.searchfilter_on_enter)
        self.filterpattern.connect('key-press-event',
                                   self.searchfilter_key_pressed)
        filterclosebutton.connect('clicked', self.searchfilter_toggle)

        # Set up current view
        self.initialize_columns()
        self.current_selection.set_mode(gtk.SELECTION_MULTIPLE)
        target_reorder = ('MY_TREE_MODEL_ROW', gtk.TARGET_SAME_WIDGET, 0)
        target_file_managers = ('text/uri-list', 0, 0)
        self.current.enable_model_drag_source(
            gtk.gdk.BUTTON1_MASK, [target_reorder, target_file_managers],
            gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_DEFAULT)
        self.current.enable_model_drag_dest(
            [target_reorder, target_file_managers],
            gtk.gdk.ACTION_MOVE | gtk.gdk.ACTION_DEFAULT)
        self.current.connect('drag-data-get',
                             self.dnd_get_data_for_file_managers)
Example #10
0
	def plugins_tab(self, cbs=None):
		"""Construct and layout the plugins tab"""
		plugin_actions = (
			('plugin_about', gtk.STOCK_ABOUT, _('_About'), None,
				None, self.plugin_about),
			('plugin_configure', gtk.STOCK_PREFERENCES,
				_('_Configure...'), None, None,
				self.plugin_configure))
		
		uiDescription = """
			<ui>
			  <popup name="pluginmenu">
			    <menuitem action="plugin_configure"/>
			    <menuitem action="plugin_about"/>
			  </popup>
			</ui>
			"""

		self.plugin_UIManager = gtk.UIManager()
		actionGroup = gtk.ActionGroup('PluginActions')
		actionGroup.add_actions(plugin_actions)
		self.plugin_UIManager.insert_action_group(actionGroup, 0)
		self.plugin_UIManager.add_ui_from_string(uiDescription)

		self.pluginview = ui.treeview()
		self.pluginview.set_headers_visible(True)
		self.pluginselection = self.pluginview.get_selection()
		self.pluginselection.set_mode(gtk.SELECTION_SINGLE)
		self.pluginview.set_rules_hint(True)
		self.pluginview.set_property('can-focus', False)
		pluginwindow = ui.scrollwindow(add=self.pluginview)
		plugindata = gtk.ListStore(bool, gtk.gdk.Pixbuf, str)
		self.pluginview.set_model(plugindata)
		self.pluginview.connect('button-press-event', self.plugin_click)

		plugincheckcell = gtk.CellRendererToggle()
		plugincheckcell.set_property('activatable', True)
		plugincheckcell.connect('toggled', self.plugin_toggled,
			(plugindata, 0))
		pluginpixbufcell = gtk.CellRendererPixbuf()
		plugintextcell = ui.CellRendererTextWrap()

		plugincol0 = gtk.TreeViewColumn()
		self.pluginview.append_column(plugincol0)
		plugincol0.pack_start(plugincheckcell, True)
		plugincol0.set_attributes(plugincheckcell, active=0)
		plugincol0.set_title(_("Enabled"))
		
		plugincol1 = gtk.TreeViewColumn()
		plugincol1.set_properties(
			max_width=0, # will expand to fill view and not more
			spacing=10) # space between icon and text
		self.pluginview.append_column(plugincol1)
		plugincol1.pack_start(pluginpixbufcell, False)
		plugincol1.pack_start(plugintextcell, True)
		plugintextcell.set_column(plugincol1)
		plugincol1.set_attributes(pluginpixbufcell, pixbuf=1)
		plugincol1.set_attributes(plugintextcell, markup=2)
		plugincol1.set_title(_("Description"))

		plugindata.clear()
		for plugin in pluginsystem.get_info():
			pb = self.plugin_get_icon_pixbuf(plugin)
			plugin_text = "<b>" + plugin.longname + "</b> " + plugin.version_string
			plugin_text += "\n" + plugin.description
			enabled = plugin.get_enabled()
			plugindata.append((enabled, pb, plugin_text))
		return pluginwindow
Example #11
0
	def __init__(self, config, client, artwork, TAB_LIBRARY, album_filename, settings_save, filtering_entry_make_red, filtering_entry_revert_color, filter_key_pressed, on_add_item, parse_formatting, connected, on_library_button_press, on_library_search_text_click):
		self.artwork = artwork
		self.config = config
		self.client = client
		self.librarymenu = None # cyclic dependency, set later
		self.TAB_LIBRARY = TAB_LIBRARY
		self.album_filename = album_filename
		self.settings_save = settings_save
		self.filtering_entry_make_red = filtering_entry_make_red
		self.filtering_entry_revert_color = filtering_entry_revert_color
		self.filter_key_pressed = filter_key_pressed
		self.on_add_item = on_add_item
		self.parse_formatting = parse_formatting
		self.connected = connected
		self.on_library_button_press = on_library_button_press
		self.on_library_search_text_click = on_library_search_text_click

		self.NOTAG = _("Untagged")
		self.VAstr = _("Various Artists")
		self.search_terms = [_('Artist'), _('Title'), _('Album'), _('Genre'), _('Filename'), _('Everything')]
		self.search_terms_mpd = ['artist', 'title', 'album', 'genre', 'file', 'any']

		self.libfilterbox_cmd_buf = None
		self.libfilterbox_cond = None
		self.libfilterbox_source = None

		self.prevlibtodo_base = None
		self.prevlibtodo_base_results = None
		self.prevlibtodo = None

		self.save_timeout = None
		self.libsearch_last_tooltip = None

		self.lib_view_filesystem_cache = None
		self.lib_view_artist_cache = None
		self.lib_view_genre_cache = None
		self.lib_view_album_cache = None
		self.lib_list_genres = None
		self.lib_list_artists = None
		self.lib_list_albums = None
		self.lib_list_years = None
		self.view_caches_reset()

		self.libraryvbox = gtk.VBox()
		self.library = ui.treeview()
		self.library_selection = self.library.get_selection()
		expanderwindow2 = ui.scrollwindow(add=self.library)
		self.searchbox = gtk.HBox()
		self.searchcombo = ui.combo(items=self.search_terms)
		self.searchtext = ui.entry()
		self.searchbutton = ui.button(text=_('_End Search'), img=ui.image(stock=gtk.STOCK_CLOSE), h=self.searchcombo.size_request()[1])
		self.searchbutton.set_no_show_all(True)
		self.searchbutton.hide()
		self.libraryview = ui.button(relief=gtk.RELIEF_NONE)
		self.libraryview.set_tooltip_text(_("Library browsing view"))
		self.library_view_assign_image()
		self.searchbox.pack_start(self.libraryview, False, False, 1)
		self.searchbox.pack_start(gtk.VSeparator(), False, False, 0)
		self.searchbox.pack_start(self.searchcombo, False, False, 2)
		self.searchbox.pack_start(self.searchtext, True, True, 2)
		self.searchbox.pack_start(self.searchbutton, False, False, 2)
		self.libraryvbox.pack_start(expanderwindow2, True, True, 2)
		self.libraryvbox.pack_start(self.searchbox, False, False, 2)
		libraryhbox = gtk.HBox()
		libraryhbox.pack_start(ui.image(stock=gtk.STOCK_HARDDISK), False, False, 2)
		libraryhbox.pack_start(ui.label(text=self.TAB_LIBRARY), False, False, 2)
		self.libraryevbox = ui.eventbox(add=libraryhbox)
		self.libraryevbox.show_all()

		# Assign some pixbufs for use in self.library
		self.openpb = self.library.render_icon(gtk.STOCK_OPEN, gtk.ICON_SIZE_LARGE_TOOLBAR)
		self.harddiskpb = self.library.render_icon(gtk.STOCK_HARDDISK, gtk.ICON_SIZE_LARGE_TOOLBAR)
		self.albumpb = gtk.gdk.pixbuf_new_from_file_at_size(album_filename, consts.LIB_COVER_SIZE, consts.LIB_COVER_SIZE)
		self.genrepb = self.library.render_icon('gtk-orientation-portrait', gtk.ICON_SIZE_LARGE_TOOLBAR)
		self.artistpb = self.library.render_icon('artist', gtk.ICON_SIZE_LARGE_TOOLBAR)
		self.sonatapb = self.library.render_icon('sonata', gtk.ICON_SIZE_MENU)

		self.library.connect('row_activated', self.on_library_row_activated)
		self.library.connect('button_press_event', self.on_library_button_press)
		self.library.connect('key-press-event', self.on_library_key_press)
		self.library.connect('query-tooltip', self.on_library_query_tooltip)
		expanderwindow2.connect('scroll-event', self.on_library_scrolled)
		self.libraryview.connect('clicked', self.library_view_popup)
		self.searchtext.connect('button_press_event', self.on_library_search_text_click)
		self.searchtext.connect('key-press-event', self.libsearchfilter_key_pressed)
		self.searchtext.connect('activate', self.libsearchfilter_on_enter)
		self.searchbutton.connect('clicked', self.on_search_end)

		self.libfilter_changed_handler = self.searchtext.connect('changed', self.libsearchfilter_feed_loop)
		searchcombo_changed_handler = self.searchcombo.connect('changed', self.on_library_search_combo_change)

		# Initialize library data and widget
		self.libraryposition = {}
		self.libraryselectedpath = {}
		self.searchcombo.handler_block(searchcombo_changed_handler)
		self.searchcombo.set_active(self.config.last_search_num)
		self.searchcombo.handler_unblock(searchcombo_changed_handler)
		self.librarydata = gtk.ListStore(gtk.gdk.Pixbuf, str, str)
		self.library.set_model(self.librarydata)
		self.library.set_search_column(2)
		self.librarycell = gtk.CellRendererText()
		self.librarycell.set_property("ellipsize", pango.ELLIPSIZE_END)
		self.libraryimg = gtk.CellRendererPixbuf()
		self.librarycolumn = gtk.TreeViewColumn()
		self.librarycolumn.pack_start(self.libraryimg, False)
		self.librarycolumn.pack_start(self.librarycell, True)
		self.librarycolumn.set_attributes(self.libraryimg, pixbuf=0)
		self.librarycolumn.set_attributes(self.librarycell, markup=2)
		self.librarycolumn.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
		self.library.append_column(self.librarycolumn)
		self.library_selection.set_mode(gtk.SELECTION_MULTIPLE)
	def plugins_tab(self, cbs=None):
		"""Construct and layout the plugins tab"""
		plugin_actions = (
			('plugin_about', gtk.STOCK_ABOUT, _('_About'), None,
				None, self.plugin_about),
			('plugin_configure', gtk.STOCK_PREFERENCES,
				_('_Configure...'), None, None,
				self.plugin_configure))
		
		uiDescription = """
			<ui>
			  <popup name="pluginmenu">
			    <menuitem action="plugin_configure"/>
			    <menuitem action="plugin_about"/>
			  </popup>
			</ui>
			"""

		self.plugin_UIManager = gtk.UIManager()
		actionGroup = gtk.ActionGroup('PluginActions')
		actionGroup.add_actions(plugin_actions)
		self.plugin_UIManager.insert_action_group(actionGroup, 0)
		self.plugin_UIManager.add_ui_from_string(uiDescription)

		self.pluginview = ui.treeview()
		self.pluginview.set_headers_visible(True)
		self.pluginselection = self.pluginview.get_selection()
		self.pluginselection.set_mode(gtk.SELECTION_SINGLE)
		self.pluginview.set_rules_hint(True)
		self.pluginview.set_property('can-focus', False)
		pluginwindow = ui.scrollwindow(add=self.pluginview)
		plugindata = gtk.ListStore(bool, gtk.gdk.Pixbuf, str)
		self.pluginview.set_model(plugindata)
		self.pluginview.connect('button-press-event', self.plugin_click)

		plugincheckcell = gtk.CellRendererToggle()
		plugincheckcell.set_property('activatable', True)
		plugincheckcell.connect('toggled', self.plugin_toggled,
			(plugindata, 0))
		pluginpixbufcell = gtk.CellRendererPixbuf()
		plugintextcell = gtk.CellRendererText()

		plugincol0 = gtk.TreeViewColumn()
		self.pluginview.append_column(plugincol0)
		plugincol0.pack_start(plugincheckcell, True)
		plugincol0.set_attributes(plugincheckcell, active=0)
		plugincol0.set_title("  " + _("Enabled") + "  ")
		
		plugincol1 = gtk.TreeViewColumn()
		self.pluginview.append_column(plugincol1)
		plugincol1.pack_start(pluginpixbufcell, False)
		plugincol1.pack_start(plugintextcell, True)
		plugincol1.set_attributes(pluginpixbufcell, pixbuf=1)
		plugincol1.set_attributes(plugintextcell, markup=2)
		plugincol1.set_title(_("Description"))

		plugindata.clear()
		for plugin in pluginsystem.get_info():
			pb = self.plugin_get_icon_pixbuf(plugin)
			plugin_text = "<b> " + plugin.longname + "</b>   " + plugin.version_string
			plugin_text += "\n " + plugin.description
			enabled = plugin.get_enabled()
			plugindata.append((enabled, pb, plugin_text))
		return pluginwindow
	def on_prefs_real(self, parent_window, popuptimes, scrobbler, trayicon_available, trayicon_in_use, reconnect, renotify, reinfofile, prefs_notif_toggled, prefs_stylized_toggled, prefs_art_toggled, prefs_playback_toggled, prefs_progress_toggled, prefs_statusbar_toggled, prefs_lyrics_toggled, prefs_trayicon_toggled, prefs_crossfade_toggled, prefs_crossfade_changed, prefs_window_response, prefs_last_tab):
		"""Display the preferences dialog"""
		self.window = parent_window
		self.scrobbler = scrobbler
		self.reconnect = reconnect
		self.renotify = renotify
		self.reinfofile = reinfofile
		self.last_tab = prefs_last_tab

		self.prefswindow = ui.dialog(title=_("Preferences"), parent=self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT, role='preferences', resizable=False, separator=False)
		hbox = gtk.HBox()
		prefsnotebook = gtk.Notebook()
		# MPD tab
		mpdlabel = ui.label(markup='<b>' + _('MPD Connection') + '</b>', y=1)
		mpd_frame = gtk.Frame()
		mpd_frame.set_label_widget(mpdlabel)
		mpd_frame.set_shadow_type(gtk.SHADOW_NONE)
		controlbox = gtk.HBox()
		profiles = ui.combo()
		add_profile = ui.button(img=ui.image(stock=gtk.STOCK_ADD))
		remove_profile = ui.button(img=ui.image(stock=gtk.STOCK_REMOVE))
		self.prefs_populate_profile_combo(profiles, self.config.profile_num, remove_profile)
		controlbox.pack_start(profiles, False, False, 2)
		controlbox.pack_start(remove_profile, False, False, 2) 
		controlbox.pack_start(add_profile, False, False, 2)
		namelabel = ui.label(textmn=_("_Name") + ":")
		nameentry = ui.entry()
		namelabel.set_mnemonic_widget(nameentry)
		hostlabel = ui.label(textmn=_("_Host") + ":")
		hostentry = ui.entry()
		hostlabel.set_mnemonic_widget(hostentry)
		portlabel = ui.label(textmn=_("_Port") + ":")
		portentry = gtk.SpinButton(gtk.Adjustment(0 ,0 ,65535, 1),1)
		portentry.set_numeric(True)
		portlabel.set_mnemonic_widget(portentry)
		dirlabel = ui.label(textmn=_("_Music dir") + ":")
		direntry = gtk.FileChooserButton(_('Select a Music Directory'))
		direntry.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
		direntry.connect('selection-changed', self.prefs_direntry_changed, profiles)
		dirlabel.set_mnemonic_widget(direntry)
		passwordlabel = ui.label(textmn=_("Pa_ssword") + ":")
		passwordentry = ui.entry(password=True)
		passwordlabel.set_mnemonic_widget(passwordentry)
		passwordentry.set_tooltip_text(_("Leave blank if no password is required."))
		autoconnect = gtk.CheckButton(_("_Autoconnect on start"))
		autoconnect.set_active(self.config.autoconnect)
		autoconnect.connect('toggled', self.prefs_config_widget_active, 'autoconnect')
		# Fill in entries with current profile:
		self.prefs_profile_chosen(profiles, nameentry, hostentry, portentry, passwordentry, direntry)
		# Update display if $MPD_HOST or $MPD_PORT is set:
		host, port, password = misc.mpd_env_vars()
		if host or port:
			using_mpd_env_vars = True
			if not host:
				host = ""
			if not port:
				port = 0
			if not password:
				password = ""
			hostentry.set_text(str(host))
			portentry.set_value(port)
			passwordentry.set_text(str(password))
			nameentry.set_text(_("Using MPD_HOST/PORT"))
			for widget in [hostentry, portentry, passwordentry, nameentry, profiles, add_profile, remove_profile]:
				widget.set_sensitive(False)
		else:
			using_mpd_env_vars = False
			nameentry.connect('changed', self.prefs_nameentry_changed, profiles, remove_profile)
			hostentry.connect('changed', self.prefs_hostentry_changed, profiles)
			portentry.connect('value-changed', self.prefs_portentry_changed, profiles)
			passwordentry.connect('changed', self.prefs_passwordentry_changed, profiles)
			profiles.connect('changed', self.prefs_profile_chosen, nameentry, hostentry, portentry, passwordentry, direntry)
			add_profile.connect('clicked', self.prefs_add_profile, nameentry, profiles, remove_profile)
			remove_profile.connect('clicked', self.prefs_remove_profile, profiles, remove_profile)

		rows = [(namelabel, nameentry),
			(hostlabel, hostentry),
			(portlabel, portentry),
			(passwordlabel, passwordentry),
			(dirlabel, direntry)]

		connection_table = gtk.Table(len(rows), 2)
		connection_table.set_col_spacings(12)
		for i, (label, entry) in enumerate(rows):
			connection_table.attach(label, 0, 1, i, i+1, gtk.FILL,
				gtk.FILL)
			connection_table.attach(entry, 1, 2, i, i+1,
				gtk.FILL|gtk.EXPAND, gtk.FILL)

		connection_alignment = gtk.Alignment(0.5, 0.5, 1.0, 1.0)
		connection_alignment.set_padding(12, 12, 12, 12)
		connection_alignment.add(connection_table)
		connection_frame = gtk.Frame()
		connection_frame.set_label_widget(controlbox)
		connection_frame.add(connection_alignment)
		mpd_table = gtk.Table(2, 1)
		mpd_table.set_row_spacings(12)
		mpd_table.attach(connection_frame, 0, 1, 0, 1,
			gtk.FILL|gtk.EXPAND, gtk.FILL)
		mpd_table.attach(autoconnect, 0, 1, 1, 2, gtk.FILL|gtk.EXPAND,
			gtk.FILL)
		mpd_alignment = gtk.Alignment(0.5, 0.5, 1.0, 1.0)
		mpd_alignment.set_padding(12, 0, 12, 0)
		mpd_alignment.add(mpd_table)
		mpd_frame.add(mpd_alignment)
		mpd_tab = gtk.Alignment(0.5, 0.5, 1.0, 1.0)
		mpd_tab.set_padding(12, 12, 12, 12)
		mpd_tab.add(mpd_frame)

		# Extras tab
		if not self.scrobbler.imported():
			self.config.as_enabled = False
		as_label = ui.label(markup='<b>' + _('Extras') + '</b>')
		extras_frame = gtk.Frame()
		extras_frame.set_label_widget(as_label)
		extras_frame.set_shadow_type(gtk.SHADOW_NONE)

		as_checkbox = gtk.CheckButton(_("_Audioscrobbling (Last.fm)"))
		as_checkbox.set_active(self.config.as_enabled)
		as_user_label = ui.label(textmn=_("_Username:"******"_Password:"******"Popup _notification on song changes"))
		display_notification.set_active(self.config.show_notification)

		time_names = ["%s %s" %
			(i , gettext.ngettext('second', 'seconds', int(i)))
			for i in popuptimes if i != _('Entire song')]
		time_names.append(_('Entire song'))
		notification_options = ui.combo(items=time_names, active=self.config.popup_option, changed_cb=self.prefs_notiftime_changed)

		notification_locs = ui.combo(items=self.popuplocations, active=self.config.traytips_notifications_location, changed_cb=self.prefs_notiflocation_changed)
		notifhbox = gtk.HBox(spacing=6)
		notifhbox.pack_end(notification_locs, False, False)
		notifhbox.pack_end(notification_options, False, False)
		display_notification.connect('toggled', prefs_notif_toggled, notifhbox)
		if not self.config.show_notification:
			notifhbox.set_sensitive(False)
		crossfadespin = gtk.SpinButton()
		crossfadespin.set_range(1, 30)
		crossfadespin.set_value(self.config.xfade)
		crossfadespin.set_numeric(True)
		crossfadespin.set_increments(1, 5)
		crossfadespin.connect('value-changed', prefs_crossfade_changed)
		crossfadelabel2 = ui.label(text=_("Fade length") + ":")
		crossfadelabel2 = ui.label(textmn=_("_Fade length") + ":")
		crossfadelabel2.set_mnemonic_widget(crossfadespin)
		crossfadelabel3 = ui.label(text=_("sec"))
		crossfadebox = gtk.HBox(spacing=12)
		crossfadebox.pack_end(crossfadelabel3, False, False)
		crossfadebox.pack_end(crossfadespin, False, False)
		crossfadebox.pack_end(crossfadelabel2, False, False)
		crossfadecheck = gtk.CheckButton(_("C_rossfade"))
		crossfadecheck.connect('toggled', self.prefs_crossfadecheck_toggled, crossfadespin, crossfadelabel2, crossfadelabel3)
		crossfadecheck.connect('toggled', prefs_crossfade_toggled, crossfadespin)
		crossfadecheck.set_active(self.config.xfade_enabled)
		crossfadecheck.toggled() # Force the toggled callback

		extras_widgets = (as_checkbox, as_entries, display_notification,
			notifhbox, crossfadecheck, crossfadebox)
		extras_table = gtk.Table(len(extras_widgets), 1)
		extras_table.set_col_spacings(12)
		extras_table.set_row_spacings(6)
		for i, widget in enumerate(extras_widgets):
			extras_table.attach(widget, 0, 1, i, i+1,
				gtk.FILL|gtk.EXPAND, gtk.FILL)
		extras_alignment = gtk.Alignment(0.5, 0.5, 1.0, 1.0)
		extras_alignment.set_padding(12, 0, 12, 0)
		extras_alignment.add(extras_table)
		extras_frame.add(extras_alignment)
		extras_tab = gtk.Alignment(0.5, 0.5, 1.0, 1.0)
		extras_tab.set_padding(12, 12, 12, 12)
		extras_tab.add(extras_frame)

		as_checkbox.connect('toggled', self.prefs_as_enabled_toggled, as_user_entry, as_pass_entry, as_user_label, as_pass_label)
		if not self.config.as_enabled or not self.scrobbler.imported():
			for widget in (as_user_entry, as_pass_entry,
					as_user_label, as_pass_label):
				widget.set_sensitive(False)
		# Display tab
		displaylabel = ui.label(markup='<b>' + _('Display') + '</b>')
		display_frame = gtk.Frame()
		display_frame.set_label_widget(displaylabel)
		display_frame.set_shadow_type(gtk.SHADOW_NONE)

		display_art = gtk.CheckButton(_("_Album art"))
		display_art.set_active(self.config.show_covers)
		display_stylized_combo = ui.combo(items=[_("Standard"), _("Stylized")], active=self.config.covers_type, changed_cb=prefs_stylized_toggled)
		display_stylized_hbox = gtk.HBox(spacing=12)
		display_stylized_hbox.pack_end(display_stylized_combo, False, False)
		display_stylized_hbox.pack_end(ui.label(text=_("Artwork style:")), False, False)
		display_stylized_hbox.set_sensitive(self.config.show_covers)
		display_art_combo = ui.combo(items=[_("Local only"), _("Local and remote")], active=self.config.covers_pref)
		display_art_combo.connect('changed', self.prefs_config_widget_active, 'covers_pref')
		orderart_label = ui.label(text=_("Search locations:"))
		display_art_hbox = gtk.HBox(spacing=12)
		display_art_hbox.pack_end(display_art_combo, False, False)
		display_art_hbox.pack_end(orderart_label, False, False)
		display_art_hbox.set_sensitive(self.config.show_covers)

		art_paths = ["~/.covers/"]
		art_paths += ("%s/%s" % (_("SONG_DIR"), item)
			for item in ("cover.jpg", "album.jpg", "folder.jpg",
				_("custom")))
		display_art_location = ui.combo(items=art_paths, active=self.config.art_location, changed_cb=self.prefs_art_location_changed)

		display_art_location_hbox = gtk.HBox(spacing=12)
		display_art_location_hbox.pack_end(display_art_location, False, False)
		display_art_location_hbox.pack_end(ui.label(text=_("Save art to:")), False, False)
		display_art_location_hbox.set_sensitive(self.config.show_covers)
		display_art.connect('toggled', prefs_art_toggled, display_art_hbox, display_art_location_hbox, display_stylized_hbox)
		display_playback = gtk.CheckButton(_("_Playback/volume buttons"))
		display_playback.set_active(self.config.show_playback)
		display_playback.connect('toggled', prefs_playback_toggled)
		display_progress = gtk.CheckButton(_("Pr_ogressbar"))
		display_progress.set_active(self.config.show_progress)
		display_progress.connect('toggled', prefs_progress_toggled)
		display_statusbar = gtk.CheckButton(_("_Statusbar"))
		display_statusbar.set_active(self.config.show_statusbar)
		display_statusbar.connect('toggled', prefs_statusbar_toggled)
		display_lyrics = gtk.CheckButton(_("Song Ly_rics"))
		display_lyrics.set_active(self.config.show_lyrics)
		savelyrics_label = ui.label(text=_("Save lyrics to:"), x=1)
		display_lyrics_location = ui.combo(items=["~/.lyrics/", _("SONG_DIR") + "/"], active=self.config.lyrics_location, changed_cb=self.prefs_lyrics_location_changed)
		display_lyrics_location_hbox = gtk.HBox(spacing=12)
		display_lyrics_location_hbox.pack_end(display_lyrics_location,
			False, False)
		display_lyrics_location_hbox.pack_end(savelyrics_label, False,
			False)
		display_lyrics_location_hbox.set_sensitive(self.config.show_lyrics)
		display_lyrics.connect('toggled', prefs_lyrics_toggled, display_lyrics_location_hbox)
		display_trayicon = gtk.CheckButton(_("System _tray icon"))
		display_trayicon.set_active(self.config.show_trayicon)
		display_trayicon.set_sensitive(trayicon_available)

		display_widgets = (display_playback, display_progress,
			display_statusbar, display_trayicon, display_lyrics,
			display_lyrics_location_hbox, display_art,
			display_stylized_hbox, display_art_hbox,
			display_art_location_hbox)
		display_table = gtk.Table(len(display_widgets), 1, False)
		for i, widget in enumerate(display_widgets):
			display_table.attach(widget, 0, 1, i, i+1,
				gtk.FILL|gtk.EXPAND, gtk.FILL)
		display_alignment = gtk.Alignment(0.5, 0.5, 1.0, 1.0)
		display_alignment.set_padding(12, 0, 12, 0)
		display_alignment.add(display_table)
		display_frame.add(display_alignment)
		display_tab = gtk.Alignment(0.5, 0.5, 1.0, 1.0)
		display_tab.set_padding(12, 12, 12, 12)
		display_tab.add(display_frame)

		# Behavior tab
		windowlabel = ui.label(markup='<b>'+_('Window Behavior')+'</b>')
		window_frame = gtk.Frame()
		window_frame.set_label_widget(windowlabel)
		window_frame.set_shadow_type(gtk.SHADOW_NONE)
		win_sticky = gtk.CheckButton(_("_Show window on all workspaces"))
		win_sticky.set_active(self.config.sticky)
		win_sticky.connect('toggled', self.prefs_config_widget_active, 'sticky')
		win_ontop = gtk.CheckButton(_("_Keep window above other windows"))
		win_ontop.set_active(self.config.ontop)
		win_ontop.connect('toggled', self.prefs_config_widget_active, 'ontop')
		win_decor = gtk.CheckButton(_("_Hide window titlebar"))
		win_decor.set_active(not self.config.decorated)
		win_decor.connect('toggled',
			lambda w: setattr(self.config, 'decorated',
				not w.get_active()))
		minimize = gtk.CheckButton(_("_Minimize to system tray on close/escape"))
		minimize.set_active(self.config.minimize_to_systray)
		minimize.set_tooltip_text(_("If enabled, closing Sonata will minimize it to the system tray. Note that it's currently impossible to detect if there actually is a system tray, so only check this if you have one."))
		minimize.connect('toggled', self.prefs_config_widget_active, 'minimize_to_systray')
		display_trayicon.connect('toggled', prefs_trayicon_toggled, minimize)
		minimize.set_sensitive(trayicon_in_use)
		widgets = (win_sticky, win_ontop, win_decor, minimize)
		window_table = gtk.Table(len(widgets), 1)
		for i, widget in enumerate(widgets):
			window_table.attach(widget, 0, 1, i, i+1,
				gtk.FILL|gtk.EXPAND, gtk.FILL)
		window_alignment = gtk.Alignment()
		window_alignment.set_padding(12, 0, 12, 0)
		window_alignment.add(window_table)
		window_frame.add(window_alignment)

		misclabel = ui.label(markup='<b>' + _('Miscellaneous') + '</b>')
		misc_frame = gtk.Frame()
		misc_frame.set_label_widget(misclabel)
		misc_frame.set_shadow_type(gtk.SHADOW_NONE)
		update_start = gtk.CheckButton(_("_Update MPD library on start"))
		update_start.set_active(self.config.update_on_start)
		update_start.set_tooltip_text(_("If enabled, Sonata will automatically update your MPD library when it starts up."))
		update_start.connect('toggled', self.prefs_config_widget_active, 'update_on_start')
		exit_stop = gtk.CheckButton(_("S_top playback on exit"))
		exit_stop.set_active(self.config.stop_on_exit)
		exit_stop.set_tooltip_text(_("MPD allows playback even when the client is not open. If enabled, Sonata will behave like a more conventional music player and, instead, stop playback upon exit."))
		exit_stop.connect('toggled', self.prefs_config_widget_active, 'stop_on_exit')
		infofile_usage = gtk.CheckButton(_("_Write status file:"))
		infofile_usage.set_active(self.config.use_infofile)
		infofile_usage.set_tooltip_text(_("If enabled, Sonata will create a xmms-infopipe like file containing information about the current song. Many applications support the xmms-info file (Instant Messengers, IRC Clients...)"))
		infopath_options = ui.entry(text=self.config.infofile_path)
		infopath_options.set_tooltip_text(_("If enabled, Sonata will create a xmms-infopipe like file containing information about the current song. Many applications support the xmms-info file (Instant Messengers, IRC Clients...)"))
		if not self.config.use_infofile:
			infopath_options.set_sensitive(False)
		infofile_usage.connect('toggled', self.prefs_infofile_toggled, infopath_options)
		infofilebox = gtk.HBox(spacing=6)
		infofilebox.pack_start(infofile_usage, False, False)
		infofilebox.pack_start(infopath_options, True, True)
		widgets = (update_start, exit_stop, infofilebox)
		misc_table = gtk.Table(len(widgets), 1)
		for i, widget in enumerate(widgets):
			misc_table.attach(widget, 0, 1, i, i+1,
				gtk.FILL|gtk.EXPAND, gtk.FILL)
		misc_alignment = gtk.Alignment()
		misc_alignment.set_padding(12, 0, 12, 0)
		misc_alignment.add(misc_table)
		misc_frame.add(misc_alignment)

		behavior_table = gtk.Table(2, 1)
		behavior_table.set_row_spacings(12)
		behavior_table.attach(window_frame, 0, 1, 0, 1, gtk.FILL|gtk.EXPAND, gtk.FILL)
		behavior_table.attach(misc_frame, 0, 1, 1, 2, gtk.FILL|gtk.EXPAND, gtk.FILL)
		behavior_tab = gtk.Alignment()
		behavior_tab.set_padding(12, 12, 12, 12)
		behavior_tab.add(behavior_table)

		# Format tab
		formatlabel = ui.label(markup='<b>'+_('Song Formatting')+'</b>')
		format_frame = gtk.Frame()
		format_frame.set_label_widget(formatlabel)
		format_frame.set_shadow_type(gtk.SHADOW_NONE)

		rows = [(_("C_urrent playlist:"), self.config.currentformat),
			(_("_Library:"), self.config.libraryformat),
			(_("_Window title:"), self.config.titleformat),
			(_("Current _song line 1:"),
				self.config.currsongformat1),
			(_("Current s_ong line 2:"),
				self.config.currsongformat2)]

		format_labels = []
		format_entries = []
		for label_text, entry_text in rows:
			label = ui.label(textmn=label_text)
			entry = ui.entry(text=entry_text)

			label.set_mnemonic_widget(entry)

			format_labels.append(label)
			format_entries.append(entry)

		currentoptions = format_entries[0]
		libraryoptions = format_entries[1]
		titleoptions = format_entries[2]
		currsongoptions1 = format_entries[3]
		currsongoptions2 = format_entries[4]

		availableheading = ui.label(markup='<small>' + _('Available options') + ':</small>', y=0)
		availablevbox = gtk.VBox()
		availableformatbox = gtk.HBox()
		# XXX get these directly from the formatting function:
		formatcodes = [('A', _('Artist name')),
			       ('B', _('Album name')),
			       ('T', _('Track name')),
			       ('N', _('Track number')),
			       ('D', _('Disc number')),
			       ('Y', _('Year')),
			       ('G', _('Genre')),
			       ('P', _('File path')),
			       ('F', _('File name')),
			       ('S', _('Stream name')),
			       ('L', _('Song length')),
			       ('E', _('Elapsed time (title only)')),
			       ]
		for codes in [formatcodes[:(len(formatcodes)+1)/2], 
			      formatcodes[(len(formatcodes)+1)/2:]]:
			rows = '\n'.join('<tt>%' + code + '</tt> - ' + help 
					 for code, help in codes)
			markup = '<small>' + rows + '</small>'
			formattinghelp = ui.label(markup=markup, y=0)
			availableformatbox.pack_start(formattinghelp)

		availablevbox.pack_start(availableformatbox, False, False, 0)
		additionalinfo = ui.label(markup='<small><tt>{ }</tt> - ' + _('Info displayed only if all enclosed tags are defined') + '\n' + '<tt>|</tt> - ' + _('Creates columns in the current playlist') + '</small>', y=0)
		availablevbox.pack_start(additionalinfo, False, False, 4)

		num_rows = len(rows) + 2
		format_table = gtk.Table(num_rows, 2)
		format_table.set_col_spacings(12)
		label_entries = enumerate(zip(format_labels, format_entries))
		for i, (label, entry) in label_entries:
			format_table.attach(label, 0, 1, i, i+1, gtk.FILL)
			format_table.attach(entry, 1, 2, i, i+1)
		format_table.attach(availableheading, 0, 2, num_rows-2,
			num_rows-1, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND,
			0, 6)
		format_table.attach(availablevbox, 0, 2, num_rows-1, num_rows)
		format_alignment = gtk.Alignment(0.5, 0.5, 1.0, 1.0)
		format_alignment.set_padding(12, 0, 12, 0)
		format_alignment.add(format_table)
		format_frame.add(format_alignment)
		format_tab = gtk.Alignment(0.5, 0.5, 1.0, 1.0)
		format_tab.set_padding(12, 12, 12, 12)
		format_tab.add(format_frame)

		# Plugins tab

		plugin_actions = (
			('plugin_about', gtk.STOCK_ABOUT, _('_About'), None, None, self.plugin_about),
			('plugin_configure', gtk.STOCK_PREFERENCES, _('_Configure...'), None, None, self.plugin_configure),
			)
		
		uiDescription = """
			<ui>
			  <popup name="pluginmenu">
			    <menuitem action="plugin_configure"/>
			    <menuitem action="plugin_about"/>
			  </popup>
			</ui>
			"""

		self.plugin_UIManager = gtk.UIManager()
		actionGroup = gtk.ActionGroup('PluginActions')
		actionGroup.add_actions(plugin_actions)
		self.plugin_UIManager.insert_action_group(actionGroup, 0)
		self.plugin_UIManager.add_ui_from_string(uiDescription)

		self.pluginview = ui.treeview()
		self.pluginview.set_headers_visible(True)
		self.pluginselection = self.pluginview.get_selection()
		self.pluginselection.set_mode(gtk.SELECTION_SINGLE)
		self.pluginview.set_rules_hint(True)
		self.pluginview.set_property('can-focus', False)
		pluginwindow = ui.scrollwindow(add=self.pluginview)
		plugindata = gtk.ListStore(bool, gtk.gdk.Pixbuf, str)
		self.pluginview.set_model(plugindata)
		self.pluginview.connect('button-press-event', self.plugin_click)

		plugincheckcell = gtk.CellRendererToggle()
		plugincheckcell.set_property('activatable', True)
		plugincheckcell.connect('toggled', self.plugin_toggled, (plugindata, 0))
		pluginpixbufcell = gtk.CellRendererPixbuf()
		plugintextcell = gtk.CellRendererText()

		plugincol0 = gtk.TreeViewColumn()
		self.pluginview.append_column(plugincol0)
		plugincol0.pack_start(plugincheckcell, True)
		plugincol0.set_attributes(plugincheckcell, active=0)
		plugincol0.set_title("  " + _("Loaded") + "  ")
		
		plugincol1 = gtk.TreeViewColumn()
		self.pluginview.append_column(plugincol1)
		plugincol1.pack_start(pluginpixbufcell, False)
		plugincol1.pack_start(plugintextcell, True)
		plugincol1.set_attributes(pluginpixbufcell, pixbuf=1)
		plugincol1.set_attributes(plugintextcell, markup=2)
		plugincol1.set_title(_("Description"))

		plugindata.clear()
		for plugin in pluginsystem.get_info():
			pb = self.plugin_get_icon_pixbuf(plugin)
			plugin_text = "<b> " + plugin.longname + "</b>   " + plugin.version_string
			plugin_text += "\n " + plugin.description
			enabled = True
			plugindata.append((enabled, pb, plugin_text))
		
		# Set up table
		tables = [(_("MPD"), mpd_tab),
		               (_("Display"), display_tab),
		               (_("Behavior"), behavior_tab),
		               (_("Format"), format_tab),
		               (_("Extras"), extras_tab)]
					   # XXX Plugins temporarily disabled
		               #(_("Plugins"), pluginwindow)]
		for table_name, table in tables:
			tmplabel = ui.label(text=table_name)
			prefsnotebook.append_page(table, tmplabel)
		hbox.pack_start(prefsnotebook, False, False, 10)
		self.prefswindow.vbox.pack_start(hbox, False, False, 10)
		close_button = self.prefswindow.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
		self.prefswindow.show_all()
		prefsnotebook.set_current_page(self.last_tab)
		close_button.grab_focus()
		self.prefswindow.connect('response', prefs_window_response, prefsnotebook, direntry, currentoptions, libraryoptions, titleoptions, currsongoptions1, currsongoptions2, infopath_options, using_mpd_env_vars, self.prev_host, self.prev_port, self.prev_password)
		# Save previous connection properties to determine if we should try to
		# connect to MPD after prefs are closed:
		self.prev_host = self.config.host[self.config.profile_num]
		self.prev_port = self.config.port[self.config.profile_num]
		self.prev_password = self.config.password[self.config.profile_num]