~fdemmer/exaile/0.3.x

« back to all changes in this revision

Viewing changes to xlgui/__init__.py

  • Committer: Aren Olson
  • Date: 2010-01-07 19:30:25 UTC
  • mfrom: (2796.1.2 exaile)
  • Revision ID: reacocard@gmail.com-20100107193025-v0b23xf7p6us2vl1
add support for opening multiple dirs. needs ui work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
190
190
                gtk.STOCK_OPEN, gtk.RESPONSE_OK))
191
191
        dialog.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
192
192
        dialog.set_local_only(False) # enable gio
 
193
        dialog.set_select_multiple(True)
193
194
 
194
195
        supported_file_filter = gtk.FileFilter()
195
196
        supported_file_filter.set_name(_("Supported Files"))
223
224
            for f in files:
224
225
                self.open_uri(f, play=False)
225
226
 
 
227
    def open_dir(self, *e):
 
228
        """
 
229
            Shows a dialog for opening (multiple) directories
 
230
        """
 
231
 
 
232
        dialog = gtk.FileChooserDialog(_("Choose a file to open"),
 
233
            self.main.window, buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
 
234
                gtk.STOCK_OPEN, gtk.RESPONSE_OK))
 
235
        dialog.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
 
236
        dialog.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
 
237
        dialog.set_select_multiple(True)
 
238
 
 
239
        result = dialog.run()
 
240
        dialog.hide()
 
241
        if result == gtk.RESPONSE_OK:
 
242
            files = dialog.get_filenames()
 
243
            for file in files:
 
244
                self.open_uri(file, play=False)
 
245
 
226
246
    def open_uri(self, uri, play=True):
227
247
        """
228
248
            Proxy for _open_uri