summaryrefslogtreecommitdiff
path: root/rbutil/rbutilCtrls.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilCtrls.cpp')
-rw-r--r--rbutil/rbutilCtrls.cpp38
1 files changed, 37 insertions, 1 deletions
diff --git a/rbutil/rbutilCtrls.cpp b/rbutil/rbutilCtrls.cpp
index 6164c7dcdd..85545159b5 100644
--- a/rbutil/rbutilCtrls.cpp
+++ b/rbutil/rbutilCtrls.cpp
@@ -435,6 +435,29 @@ void DeviceSelectorCtrl::OnAutoDetect(wxCommandEvent& event)
435 AutoDetect(); 435 AutoDetect();
436} 436}
437 437
438#if !(defined( __WXMSW__ ) || defined( __DARWIN__))
439wxString resolve_mount_point( const wxString device )
440{
441 FILE *fp = fopen( "/proc/mounts", "r" );
442 if( !fp ) return wxT("");
443 char *dev, *dir;
444 while( fscanf( fp, "%as %as %*s %*s %*s %*s", &dev, &dir ) != EOF )
445 {
446 if( wxString( dev, wxConvUTF8 ) == device )
447 {
448 wxString directory = wxString( dir, wxConvUTF8 );
449 free( dev );
450 free( dir );
451 return directory;
452 }
453 free( dev );
454 free( dir );
455 }
456 fclose( fp );
457 return wxT("");
458}
459#endif
460
438void DeviceSelectorCtrl::AutoDetect() 461void DeviceSelectorCtrl::AutoDetect()
439{ 462{
440 struct ipod_t ipod; 463 struct ipod_t ipod;
@@ -445,6 +468,12 @@ void DeviceSelectorCtrl::AutoDetect()
445 int index = gv->plat_bootloadername.Index(temp); // use the bootloader names.. 468 int index = gv->plat_bootloadername.Index(temp); // use the bootloader names..
446 m_deviceCbx->SetValue(gv->plat_name[index]); 469 m_deviceCbx->SetValue(gv->plat_name[index]);
447 gv->curplat=gv->plat_id[index]; 470 gv->curplat=gv->plat_id[index];
471
472#if !(defined( __WXMSW__ ) || defined( __DARWIN__))
473 wxString tmp = resolve_mount_point(wxString(ipod.diskname,wxConvUTF8)+wxT("2"));
474 if( tmp != wxT("") )
475 gv->curdestdir = tmp;
476#endif
448 return; 477 return;
449 } 478 }
450 else if (n > 1) 479 else if (n > 1)
@@ -461,6 +490,12 @@ void DeviceSelectorCtrl::AutoDetect()
461 int index = gv->plat_id.Index(wxT("sansae200")); 490 int index = gv->plat_id.Index(wxT("sansae200"));
462 m_deviceCbx->SetValue(gv->plat_name[index]); 491 m_deviceCbx->SetValue(gv->plat_name[index]);
463 gv->curplat=gv->plat_id[index]; 492 gv->curplat=gv->plat_id[index];
493
494#if !(defined( __WXMSW__ ) || defined( __DARWIN__))
495 wxString tmp = resolve_mount_point(wxString(ipod.diskname,wxConvUTF8)+wxT("1"));
496 if( tmp != wxT("") )
497 gv->curdestdir = tmp;
498#endif
464 return; 499 return;
465 } 500 }
466 else if (n2 > 1) 501 else if (n2 > 1)
@@ -544,7 +579,8 @@ void DevicePositionCtrl::setDefault()
544void DevicePositionCtrl::OnBrowseBtn(wxCommandEvent& event) 579void DevicePositionCtrl::OnBrowseBtn(wxCommandEvent& event)
545{ 580{
546 const wxString& temp = wxDirSelector( 581 const wxString& temp = wxDirSelector(
547 wxT("Please select the location of your audio device"), gv->curdestdir); 582 wxT("Please select the location of your audio device"), gv->curdestdir,
583 0, wxDefaultPosition, this);
548 584
549 if (!temp.empty()) 585 if (!temp.empty())
550 { 586 {