示例#1
0
def create_source_selector():
	source_selector = hildon.TouchSelector()

	type_list = gtk.ListStore(int, str)
	type_list.append([consts.DATASOURCE_BUILTIN, "Built-in"])
	renderer = gtk.CellRendererText()
	column = source_selector.append_column(type_list, renderer, text=1)
	column.set_property("text-column", 1)

	source_selector.connect("changed", source_selector_changed)

	picker = hildon.PickerButton(gtk.HILDON_SIZE_AUTO | \
			gtk.HILDON_SIZE_FINGER_HEIGHT, 
			hildon.BUTTON_ARRANGEMENT_HORIZONTAL)
	picker.set_title("Local Data Source")
	picker.set_selector(source_selector)

	# default on Built-In
	picker.set_active(0)

	return picker
示例#2
0
    def _show_tile_select_dialog(self, zoom_steps):
        sel_zoom = hildon.TouchSelector(text=True)
        current_zoom = self.map.get_zoom()

        for zoom, size, count in zoom_steps:
            sel_zoom.append_text(
                'Zoom %d (Current+%d) ~%s' %
                (zoom, zoom - current_zoom, self.core.format_file_size(size)))

        sel_zoom.set_column_selection_mode(
            hildon.TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE)
        pick_zoom = hildon.PickerButton(
            gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
            hildon.BUTTON_ARRANGEMENT_HORIZONTAL)
        pick_zoom.set_selector(sel_zoom)
        pick_zoom.set_title("Select Zoom Levels")

        def print_func(widget):
            size = sum(zoom_steps[x][1]
                       for x, in sel_zoom.get_selected_rows(0))
            pick_zoom.set_value('~' + self.core.format_file_size(size))

        pick_zoom.connect('value-changed', print_func)
        pick_zoom.connect('realize', print_func)

        dialog = gtk.Dialog("Download Map Tiles", self.window,
                            gtk.DIALOG_DESTROY_WITH_PARENT,
                            (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
        dialog.vbox.pack_start(pick_zoom)
        dialog.show_all()
        res = dialog.run()
        dialog.hide()

        if res != gtk.RESPONSE_ACCEPT:
            return []

        steps = [zoom_steps[x] for x, in sel_zoom.get_selected_rows(0)]
        return steps
示例#3
0
def create_direction_selector():
	global direction_selector

	direction_selector = hildon.TouchSelector()

	type_list = gtk.ListStore(int, str)
	type_list.append([consts.DIRECTION_BOTH, "Both"])
	type_list.append([consts.DIRECTION_FROM_GOOGLE_ONLY, "From Google Only"])
	type_list.append([consts.DIRECTION_TO_GOOGLE_ONLY, "To Google Only"])
	renderer = gtk.CellRendererText()
	column = direction_selector.append_column(type_list, renderer, text=1)
	column.set_property("text-column", 1)

	picker = hildon.PickerButton(gtk.HILDON_SIZE_AUTO | \
			gtk.HILDON_SIZE_FINGER_HEIGHT, 
			hildon.BUTTON_ARRANGEMENT_HORIZONTAL)
	picker.set_title("Synchronization direction")
	picker.set_selector(direction_selector)

	# default on Built-In
	picker.set_active(0)

	return picker
示例#4
0
def create_account_selector():
	global account_selector
	global account_list

	account_selector = hildon.TouchSelector()

	account_list = gtk.ListStore(int, str)

	renderer = gtk.CellRendererText()
	column = account_selector.append_column(account_list, renderer, text=1)
	column.set_property("text-column", 1)

	account_selector.connect("changed", account_selector_changed)

	picker = hildon.PickerButton(gtk.HILDON_SIZE_AUTO | \
			gtk.HILDON_SIZE_FINGER_HEIGHT, 
			hildon.BUTTON_ARRANGEMENT_HORIZONTAL)
	picker.set_title("Google Account")
	picker.set_selector(account_selector)

	for id, acct in google_accounts.get_registered_accounts():
		account_list.append([int(id), acct])

	return picker
示例#5
0
    def _display_results(self, caches, truncated):
        sortfuncs = [
            ('Dist', lambda x, y: cmp(x.prox, y.prox)),
            ('Name', lambda x, y: cmp(x.title, y.title)),
            ('Diff',
             lambda x, y: cmp(x.difficulty
                              if x.difficulty > 0 else 100, y.difficulty
                              if y.difficulty > 0 else 100)),
            ('Terr', lambda x, y: cmp(x.terrain
                                      if x.terrain > 0 else 100, y.terrain
                                      if y.terrain > 0 else 100)),
            ('Size', lambda x, y: cmp(x.size if x.size > 0 else 100, y.size
                                      if y.size > 0 else 100)),
            ('Type', lambda x, y: cmp(x.type, y.type)),
        ]

        if self.gps_data != None and self.gps_data.position != None:
            for c in caches:
                c.prox = c.distance_to(self.gps_data.position)
        else:
            for c in caches:
                c.prox = None

        win = hildon.StackableWindow()
        win.set_title("Search results")
        ls = gtk.ListStore(str, str, str, str, object)

        tv = hildon.TouchSelector()
        col1 = tv.append_column(ls, gtk.CellRendererText())

        c1cr = gtk.CellRendererText()
        c1cr.ellipsize = pango.ELLIPSIZE_MIDDLE
        c2cr = gtk.CellRendererText()
        c3cr = gtk.CellRendererText()
        c4cr = gtk.CellRendererText()

        col1.pack_start(c1cr, True)
        col1.pack_end(c2cr, False)
        col1.pack_start(c3cr, False)
        col1.pack_end(c4cr, False)

        col1.set_attributes(c1cr, text=0)
        col1.set_attributes(c2cr, text=1)
        col1.set_attributes(c3cr, text=2)
        col1.set_attributes(c4cr, text=3)

        def select_cache(widget, data, more):
            self.show_cache(self._get_selected(tv)[4])

        tv.connect("changed", select_cache, None)

        def on_change_sort(widget, sortfunc):
            tv.handler_block_by_func(select_cache)
            ls.clear()
            caches.sort(cmp=sortfunc)
            for c in caches:
                ls.append([
                    self.shorten_name(c.title, 40), " " + c.get_size_string(),
                    ' D%s T%s' % (c.get_difficulty(), c.get_terrain()),
                    " " + geo.Coordinate.format_distance(c.prox), c
                ])
            tv.handler_unblock_by_func(select_cache)

        menu = hildon.AppMenu()
        button = None
        for name, function in sortfuncs:
            button = hildon.GtkRadioButton(gtk.HILDON_SIZE_AUTO, button)
            button.set_label(name)
            button.connect("clicked", on_change_sort, function)
            menu.add_filter(button)
            button.set_mode(False)

        def download_geocaches(widget):
            self.core.download_cache_details_list(caches)

        button = hildon.Button(gtk.HILDON_SIZE_AUTO,
                               hildon.BUTTON_ARRANGEMENT_VERTICAL)
        button.set_title("Download Details")
        button.set_value("for all Geocaches")
        button.connect("clicked", download_geocaches)
        menu.append(button)

        menu.show_all()
        win.set_app_menu(menu)
        win.add(tv)

        on_change_sort(None, sortfuncs[0][1])

        win.show_all()
        if truncated:
            hildon.hildon_banner_show_information_with_markup(
                win, "hu", "Showing only the first %d results." % len(caches))

        win.connect('delete_event', self.hide_search_view)
示例#6
0
    def _on_show_search(self, widget, data):

        name = hildon.Entry(gtk.HILDON_SIZE_AUTO_WIDTH
                            | gtk.HILDON_SIZE_FINGER_HEIGHT)
        name.set_placeholder("search for name...")
        name_hbox = hildon.Caption(None, "Name", name, None,
                                   hildon.CAPTION_OPTIONAL)

        sel_dist_type = hildon.TouchSelector(text=True)
        sel_dist_type.append_text('anywhere')
        sel_dist_type.append_text('around my position')
        sel_dist_type.append_text('around the current map center')
        pick_dist_type = hildon.PickerButton(
            gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
            hildon.BUTTON_ARRANGEMENT_HORIZONTAL)
        pick_dist_type.set_selector(sel_dist_type)
        pick_dist_type.set_title("Search")
        sel_dist_type.select_iter(0,
                                  sel_dist_type.get_model(0).get_iter(1),
                                  False)

        list_dist_radius = (1, 5, 10, 20, 50, 100, 200)
        sel_dist_radius = hildon.TouchSelector(text=True)
        for x in list_dist_radius:
            sel_dist_radius.append_text('%d km' % x)
        pick_dist_radius = hildon.PickerButton(
            gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
            hildon.BUTTON_ARRANGEMENT_HORIZONTAL)
        pick_dist_radius.set_selector(sel_dist_radius)
        pick_dist_radius.set_title("Radius")
        pick_dist_type.connect(
            'value-changed', lambda caller: pick_dist_radius.set_sensitive(
                sel_dist_type.get_selected_rows(0)[0][0] != 0))
        sel_dist_radius.select_iter(0,
                                    sel_dist_radius.get_model(0).get_iter(1),
                                    False)

        sel_size = hildon.TouchSelector(text=True)
        sel_size.append_text('micro')
        sel_size.append_text('small')
        sel_size.append_text('regular')
        sel_size.append_text('huge')
        sel_size.append_text('other')
        sel_size.set_column_selection_mode(
            hildon.TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE)
        pick_size = hildon.PickerButton(
            gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
            hildon.BUTTON_ARRANGEMENT_HORIZONTAL)
        pick_size.set_selector(sel_size)
        pick_size.set_title("Select Size(s)")
        for i in xrange(5):
            sel_size.select_iter(0, sel_size.get_model(0).get_iter(i), False)

        sel_type = hildon.TouchSelector(text=True)
        sel_type.append_text('traditional')
        sel_type.append_text('multi-stage')
        sel_type.append_text('virtual')
        sel_type.append_text('earth')
        sel_type.append_text('event')
        sel_type.append_text('mystery')
        sel_type.append_text('all')
        sel_type.set_column_selection_mode(
            hildon.TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE)
        pick_type = hildon.PickerButton(
            gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
            hildon.BUTTON_ARRANGEMENT_HORIZONTAL)
        pick_type.set_selector(sel_type)
        pick_type.set_title("Select Type(s)")
        sel_type.unselect_all(0)
        sel_type.select_iter(0, sel_type.get_model(0).get_iter(6), False)

        sel_status = hildon.TouchSelector(text=True)
        sel_status.append_text('any')
        sel_status.append_text("Geocaches I haven't found")
        sel_status.append_text("Geocaches I have found")
        sel_status.append_text("Marked Geocaches")
        sel_status.append_text("Marked Geocaches I haven't found")
        pick_status = hildon.PickerButton(
            gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
            hildon.BUTTON_ARRANGEMENT_HORIZONTAL)
        pick_status.set_selector(sel_status)
        pick_status.set_title("Select Status")

        sel_status.unselect_all(0)
        sel_status.select_iter(0, sel_status.get_model(0).get_iter(0), False)

        sel_diff = hildon.TouchSelector(text=True)
        sel_diff.append_text('1..2.5')
        sel_diff.append_text('3..4')
        sel_diff.append_text('4.5..5')
        sel_diff.set_column_selection_mode(
            hildon.TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE)
        pick_diff = hildon.PickerButton(
            gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
            hildon.BUTTON_ARRANGEMENT_HORIZONTAL)
        pick_diff.set_selector(sel_diff)
        pick_diff.set_title("Select Difficulty")
        for i in xrange(3):
            sel_diff.select_iter(0, sel_diff.get_model(0).get_iter(i), False)

        sel_terr = hildon.TouchSelector(text=True)
        sel_terr.append_text('1..2.5')
        sel_terr.append_text('3..4')
        sel_terr.append_text('4.5..5')
        sel_terr.set_column_selection_mode(
            hildon.TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE)
        pick_terr = hildon.PickerButton(
            gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
            hildon.BUTTON_ARRANGEMENT_HORIZONTAL)
        pick_terr.set_selector(sel_terr)
        pick_terr.set_title("Select Terrain")
        for i in xrange(3):
            sel_terr.select_iter(0, sel_terr.get_model(0).get_iter(i), False)

        RESPONSE_SHOW_LIST, RESPONSE_RESET, RESPONSE_LAST_RESULTS = range(3)
        dialog = gtk.Dialog("Search", self.window,
                            gtk.DIALOG_DESTROY_WITH_PARENT,
                            ("OK", RESPONSE_SHOW_LIST))
        dialog.add_button("Filter Map", gtk.RESPONSE_ACCEPT)
        if self.map_filter_active:
            dialog.add_button("Reset Filter", RESPONSE_RESET)
        if self.old_search_window != None:
            dialog.add_button("Last Results", RESPONSE_LAST_RESULTS)
        dialog.set_size_request(800, 800)
        pan = hildon.PannableArea()
        options = gtk.VBox()
        pan.add_with_viewport(options)
        dialog.vbox.pack_start(pan)

        options.pack_start(gtk.Label("Search Geocaches"))
        options.pack_start(name_hbox)
        options.pack_start(pick_dist_type)
        options.pack_start(pick_dist_radius)
        options.pack_start(pick_type)
        options.pack_start(pick_status)

        options.pack_start(gtk.Label("Details..."))
        w = gtk.Label(
            "If you select something here, only geocaches for which details were downloaded will be shown in the result."
        )
        w.set_line_wrap(True)
        w.set_alignment(0, 0.5)
        options.pack_start(w)

        options.pack_start(pick_size)
        options.pack_start(pick_diff)
        options.pack_start(pick_terr)

        while True:
            dialog.show_all()
            response = dialog.run()
            dialog.hide()

            if response == RESPONSE_RESET:
                self.core.reset_filter()
                self.map_filter_active = False
                self.show_success("Showing all geocaches.")
                return
            elif response == RESPONSE_LAST_RESULTS:
                if self.old_search_window == None:
                    return
                hildon.WindowStack.get_default().push_1(self.old_search_window)

                return

            name_search = name.get_text().strip().lower()

            sizes = [x + 1 for x, in sel_size.get_selected_rows(0)]
            if sizes == [1, 2, 3, 4, 5]:
                sizes = None

            typelist = [
                geocaching.GeocacheCoordinate.TYPE_REGULAR,
                geocaching.GeocacheCoordinate.TYPE_MULTI,
                geocaching.GeocacheCoordinate.TYPE_VIRTUAL,
                geocaching.GeocacheCoordinate.TYPE_EARTH,
                geocaching.GeocacheCoordinate.TYPE_EVENT,
                geocaching.GeocacheCoordinate.TYPE_MYSTERY,
                geocaching.GeocacheCoordinate.TYPE_UNKNOWN
            ]

            types = [typelist[x] for x, in sel_type.get_selected_rows(0)]
            if geocaching.GeocacheCoordinate.TYPE_UNKNOWN in types:
                types = None

            # found, marked
            statuslist = [
                (None, None),
                (False, None),
                (True, None),
                (None, True),
                (False, True),
            ]
            found, marked = statuslist[sel_status.get_selected_rows(0)[0][0]]

            numberlist = [[1, 1.5, 2, 2.5], [3, 3.5, 4], [4.5, 5]]

            difficulties = []
            count = 0
            for x, in sel_diff.get_selected_rows(0):
                difficulties += numberlist[x]
                count += 1
            if count == len(numberlist):
                difficulties = None

            terrains = []
            count = 0
            for x, in sel_terr.get_selected_rows(0):
                terrains += numberlist[x]
                count += 1
            if count == len(numberlist):
                terrains = None

            center = None
            dist_type = sel_dist_type.get_selected_rows(0)[0][0]
            if dist_type == 1:
                try:
                    center = self.gps_last_good_fix.position
                except AttributeError:
                    logger.debug("No current Fix.")
                    pass
            elif dist_type == 2:
                center = self.map.get_center()
            if center != None:
                radius = list_dist_radius[sel_dist_radius.get_selected_rows(0)
                                          [0][0]]
                sqrt_2 = 1.41421356
                c1 = center.transform(-45, radius * 1000 * sqrt_2)
                c2 = center.transform(-45 + 180, radius * 1000 * sqrt_2)
                location = (c1, c2)
            else:
                location = None

            if response == RESPONSE_SHOW_LIST:
                points, truncated = self.core.get_points_filter(
                    found=found,
                    name_search=name_search,
                    size=sizes,
                    terrain=terrains,
                    diff=difficulties,
                    ctype=types,
                    marked=marked,
                    location=location)
                if len(points) > 0:
                    self._display_results(points, truncated)
                    break
                else:
                    self.show_error(
                        "Search returned no geocaches. Please remember that search works only within the downloaded geocaches."
                    )

            elif response == gtk.RESPONSE_ACCEPT:
                self.core.set_filter(found=found,
                                     name_search=name_search,
                                     size=sizes,
                                     terrain=terrains,
                                     diff=difficulties,
                                     ctype=types,
                                     marked=marked)
                self.show_success(
                    "Filter for map activated, ignoring distance restrictions."
                )
                self.map_filter_active = True
                break
            else:
                break
示例#7
0
    def _on_show_log_fieldnote_dialog(self, widget, data):

        from time import gmtime
        from time import localtime
        from time import strftime

        if self.current_cache == None:
            return

        sel_type = hildon.TouchSelector(text=True)
        sel_type.append_text('Post as Log')
        sel_type.append_text('Upload as Fieldnote')
        #sel_type.set_column_selection_mode(hildon.TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE)
        pick_type = hildon.PickerButton(
            gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
            hildon.BUTTON_ARRANGEMENT_HORIZONTAL)
        pick_type.set_selector(sel_size)
        pick_type.set_title("Select Type")
        selected = cache.upload_as if (cache.upload_as != Null) else 0
        sel_type.select_iter(0,
                             sel_type.get_model(0).get_iter(selected), False)

        statuses = [("Don't upload", geocaching.GeocacheCoordinate.LOG_NO_LOG),
                    ("Found it", geocaching.GeocacheCoordinate.LOG_AS_FOUND),
                    ("Did not find it",
                     geocaching.GeocacheCoordinate.LOG_AS_NOTFOUND),
                    ("Post a note", geocaching.GeocacheCoordinate.LOG_AS_NOTE)]

        cache = self.current_cache
        dialog = gtk.Dialog("Write Log/Fieldnote", self.window,
                            gtk.DIALOG_DESTROY_WITH_PARENT,
                            (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))

        if cache.logdate == '':
            try:
                text = strftime(self.settings['options_default_log_text'],
                                localtime()) % {
                                    'machine': 'N900'
                                }
            except ValueError:
                text = self.settings['options_default_log_text']
        else:
            text = cache.fieldnotes

        fieldnotes = gtk.TextView()
        #fieldnotes.set_placeholder("Your fieldnote text...")
        fieldnotes.get_buffer().set_text(text)

        fieldnotes_log_as_selector = hildon.TouchSelector(text=True)

        for text, status in statuses:
            fieldnotes_log_as_selector.append_text(text)
        i = 0
        for text, status in statuses:
            if cache.logas == status:
                fieldnotes_log_as_selector.select_iter(
                    0,
                    fieldnotes_log_as_selector.get_model(0).get_iter(i), False)
            i += 1
        fieldnotes_log_as = hildon.PickerButton(
            gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
            hildon.BUTTON_ARRANGEMENT_HORIZONTAL)
        fieldnotes_log_as.set_title('Log Type')
        fieldnotes_log_as.set_selector(fieldnotes_log_as_selector)

        dialog.vbox.pack_start(sel_type, False)
        dialog.vbox.pack_start(fieldnotes_log_as, False)
        dialog.vbox.pack_start(fieldnotes, True)
        #dialog.vbox.pack_start(hildon.Caption(None, "Text", fieldnotes, None, hildon.CAPTION_OPTIONAL))
        dialog.show_all()
        result = dialog.run()
        dialog.hide()
        if result != gtk.RESPONSE_ACCEPT:
            logger.debug('Not logging this fieldnote')
            return

        cache.upload_as = sel_type.get_selected_rows(0)[0][0]
        cache.logas = statuses[fieldnotes_log_as_selector.get_selected_rows(0)
                               [0][0]][1]
        cache.logdate = strftime('%Y-%m-%d', gmtime())
        cache.fieldnotes = fieldnotes.get_buffer().get_text(
            fieldnotes.get_buffer().get_start_iter(),
            fieldnotes.get_buffer().get_end_iter())
        self.core.save_fieldnote(cache)
示例#8
0
    def new(self):
        # Store the current configuration options in case we cancel later
        self._config_backup = self._config.get_backup()
        self._do_restore_config = True
        self.main_window.connect('destroy', self.on_destroy)

        self.save_button = self.main_window.add_button(gtk.STOCK_SAVE, 1)
        self.save_button.connect('clicked', self.on_save_button_clicked)

        self.touch_selector_orientation = hildon.TouchSelector(text=True)
        for caption in FremantleRotation.MODE_CAPTIONS:
            self.touch_selector_orientation.append_text(caption)
        self.touch_selector_orientation.set_active(0,
                                                   self._config.rotation_mode)
        self.picker_orientation.set_selector(self.touch_selector_orientation)

        if not self._config.auto_update_feeds:
            self._config.auto_update_frequency = 0

        # Create a mapping from minute values to touch selector indices
        minute_index_mapping = dict(
            (b, a) for a, b in enumerate(x[0] for x in self.UPDATE_INTERVALS))

        self.touch_selector_interval = hildon.TouchSelector(text=True)
        for value, caption in self.UPDATE_INTERVALS:
            self.touch_selector_interval.append_text(caption)
        interval = self._config.auto_update_frequency
        if interval in minute_index_mapping:
            self._custom_interval = 0
            self.touch_selector_interval.set_active(
                0, minute_index_mapping[interval])
        else:
            self._custom_interval = self._config.auto_update_frequency
            self.touch_selector_interval.append_text(
                N_('Every %(count)d minute', 'Every %(count)d minutes',
                   interval) % {'count': interval})
            self.touch_selector_interval.set_active(0,
                                                    len(self.UPDATE_INTERVALS))
        self.picker_interval.set_selector(self.touch_selector_interval)

        # Create a mapping from download methods to touch selector indices
        download_method_mapping = dict(
            (b, a) for a, b in enumerate(x[0] for x in self.DOWNLOAD_METHODS))

        self.touch_selector_download = hildon.TouchSelector(text=True)
        for value, caption in self.DOWNLOAD_METHODS:
            self.touch_selector_download.append_text(caption)

        if self._config.auto_download not in (x[0]
                                              for x in self.DOWNLOAD_METHODS):
            self._config.auto_download = self.DOWNLOAD_METHODS[0][0]

        self.touch_selector_download.set_active(
            0, download_method_mapping[self._config.auto_download])
        self.picker_download.set_selector(self.touch_selector_download)

        # Determine possible audio and video players (only installed ones)
        self.audio_players = [(c, l) for c, l in self.AUDIO_PLAYERS
                              if c == 'default' or util.find_command(c)]
        self.video_players = [(c, l) for c, l in self.VIDEO_PLAYERS
                              if c == 'default' or util.find_command(c)]

        # Create a mapping from audio players to touch selector indices
        audio_player_mapping = dict(
            (b, a) for a, b in enumerate(x[0] for x in self.audio_players))

        self.touch_selector_audio_player = hildon.TouchSelector(text=True)
        for value, caption in self.audio_players:
            self.touch_selector_audio_player.append_text(caption)

        if self._config.player not in (x[0] for x in self.audio_players):
            self._config.player = self.audio_players[0][0]

        self.touch_selector_audio_player.set_active(
            0, audio_player_mapping[self._config.player])
        self.picker_audio_player.set_selector(self.touch_selector_audio_player)

        # Create a mapping from video players to touch selector indices
        video_player_mapping = dict(
            (b, a) for a, b in enumerate(x[0] for x in self.video_players))

        self.touch_selector_video_player = hildon.TouchSelector(text=True)
        for value, caption in self.video_players:
            self.touch_selector_video_player.append_text(caption)

        if self._config.videoplayer not in (x[0] for x in self.video_players):
            self._config.videoplayer = self.video_players[0][0]

        self.touch_selector_video_player.set_active(
            0, video_player_mapping[self._config.videoplayer])
        self.picker_video_player.set_selector(self.touch_selector_video_player)

        # Fix the styling and layout of the picker buttons
        for button in (self.picker_orientation, \
                       self.picker_interval, \
                       self.picker_download, \
                       self.picker_audio_player, \
                       self.picker_video_player):
            # Work around Maemo bug #4718
            button.set_name('HildonButton-finger')
            # Fix alignment problems (Maemo bug #6205)
            button.set_alignment(.0, .5, 1., 0.)
            child = button.get_child()
            child.set_padding(0, 0, 12, 0)

        self.button_enable_mygpo.set_name('HildonCheckButton-finger')

        self.check_view_all_episodes = hildon.CheckButton(
            gtk.HILDON_SIZE_FINGER_HEIGHT)
        self.check_view_all_episodes.set_label(_('Show "All episodes" view'))
        self.check_view_all_episodes.set_active(
            self._config.podcast_list_view_all)
        self.pannable_vbox.add(self.check_view_all_episodes)
        self.pannable_vbox.reorder_child(self.check_view_all_episodes, 2)

        # Disable capitalization word completion
        self.entry_mygpo_username.set_property('hildon-input-mode', \
                gtk.HILDON_GTK_INPUT_MODE_FULL)
        self.entry_mygpo_password.set_property('hildon-input-mode', \
                gtk.HILDON_GTK_INPUT_MODE_FULL)

        self.entry_mygpo_password.set_visibility(False)

        self.button_enable_mygpo.set_active(self._config.mygpo_enabled)
        self.entry_mygpo_username.set_text(self._config.mygpo_username)
        self.entry_mygpo_password.set_text(self._config.mygpo_password)
        self.entry_mygpo_device.set_text(self._config.mygpo_device_caption)

        if self._config.auto_remove_played_episodes:
            adjustment_expiration = self.hscale_expiration.get_adjustment()
            if self._config.episode_old_age > adjustment_expiration.upper:
                # Patch the adjustment to include the higher current value
                adjustment_expiration.upper = self._config.episode_old_age

            self.hscale_expiration.set_value(self._config.episode_old_age)
        else:
            self.hscale_expiration.set_value(0)

        self.gPodderPreferences.show_all()