diff -Nru cdcollect-0.6.0-orig/resources/glade/gui.glade cdcollect-0.6.0/resources/glade/gui.glade
--- cdcollect-0.6.0-orig/resources/glade/gui.glade 2006-11-24 18:12:13.000000000 +0100
+++ cdcollect-0.6.0/resources/glade/gui.glade 2007-07-16 21:30:02.000000000 +0200
@@ -1143,7 +1143,7 @@
<child>
<widget class="GtkLabel" id="label10">
<property name="visible">True</property>
- <property name="label" translatable="yes">Mount Point:</property>
+ <property name="label" translatable="yes">Device:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -1169,7 +1169,7 @@
</child>
<child>
- <widget class="GtkEntry" id="entry_mount">
+ <widget class="GtkEntry" id="entry_device">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Mount directory for CDs (CD must already be mounted)</property>
<property name="can_focus">True</property>
diff -Nru cdcollect-0.6.0-orig/src/Conf.cs cdcollect-0.6.0/src/Conf.cs
--- cdcollect-0.6.0-orig/src/Conf.cs 2006-11-24 18:12:13.000000000 +0100
+++ cdcollect-0.6.0/src/Conf.cs 2007-07-16 21:48:45.000000000 +0200
@@ -35,7 +35,6 @@
public string default_cd_device;
- public string default_cd_mount;
public Conf ()
{
@@ -61,9 +60,6 @@
/* Get the CD device */
default_cd_device = "/dev/hdc";
- /* Get the mount point for */
- default_cd_mount = "/media/cdrom";
-
/* create home dirs if they not exists */
create_home_dirs ();
}
diff -Nru cdcollect-0.6.0-orig/src/ImportCDWindow.cs cdcollect-0.6.0/src/ImportCDWindow.cs
--- cdcollect-0.6.0-orig/src/ImportCDWindow.cs 2006-11-24 18:12:13.000000000 +0100
+++ cdcollect-0.6.0/src/ImportCDWindow.cs 2007-07-16 22:45:47.000000000 +0200
@@ -50,6 +50,7 @@
// Private variables
private static Glade.XML gxml;
private string mount;
+ private string device;
private bool use_infoplugins, use_compplugins, compplugins_recursive, use_thumbs;
private int key = -10;
@@ -67,7 +68,7 @@
// Methods
- public ImportCDWindow (string mount_point, bool info, bool comp, bool recursive, bool thumbs, Gtk.Window parent) : base (IntPtr.Zero)
+ public ImportCDWindow (string default_device, bool info, bool comp, bool recursive, bool thumbs, Gtk.Window parent) : base (IntPtr.Zero)
{
/* Show Main Dialog using glade */
gxml = new Glade.XML (null, "gui.glade", "win_importcd", null);
@@ -80,7 +81,8 @@
/* Prepare gui */
prepare_gui ();
- mount = mount_point;
+ device = default_device;
+ mount = get_mount();
use_infoplugins = info;
use_compplugins = comp;
compplugins_recursive = recursive;
@@ -330,10 +332,10 @@
/* Open the device */
try {
- fdev = new FileStream (CDCollect.conf.default_cd_device,
+ fdev = new FileStream (device,
System.IO.FileMode.Open, System.IO.FileAccess.Read);
} catch {
- Console.WriteLine ("Can not open device " + CDCollect.conf.default_cd_device);
+ Console.WriteLine ("Can not open device " + device);
return("Unknown");
}
@@ -343,7 +345,7 @@
fdev.Seek (32808, SeekOrigin.Begin);
r = fdev.Read (buf, 0, 32);
} catch (System.Exception e) {
- Console.WriteLine ("Can not read device " + CDCollect.conf.default_cd_device);
+ Console.WriteLine ("Can not read device " + device);
return ("Unknown");
}
@@ -373,6 +375,33 @@
}
}
+
+ private string get_mount ()
+ {
+ TextReader f;
+ string line;
+ string mount = "none";
+ string [] fields;
+
+ /* Open the /etc/mtab */
+ try {
+ f = new StreamReader("/etc/mtab");
+ } catch {
+ Console.WriteLine ("Can not open /etc/mtab");
+ return(mount);
+ }
+ /* Read all line, check whether it contains our device and filesystem type is iso9660 */
+ while ((line = f.ReadLine()) != null) {
+ fields = line.Split(' ');
+ if ((fields[0] == device) && (fields[2] == "iso9660")) {
+ mount = fields[1];
+ }
+ }
+
+ f.Close();
+
+ return (mount);
+ }
}
diff -Nru cdcollect-0.6.0-orig/src/Main.cs cdcollect-0.6.0/src/Main.cs
--- cdcollect-0.6.0-orig/src/Main.cs 2006-11-24 18:12:13.000000000 +0100
+++ cdcollect-0.6.0/src/Main.cs 2007-07-16 21:48:14.000000000 +0200
@@ -572,7 +572,7 @@
{
/* Create import window */
ImportCDWindow win_importcd = new ImportCDWindow(
- (string) conf.getkey ("prefs/mount_point",conf.default_cd_mount),
+ (string) conf.getkey ("prefs/device",conf.default_cd_device),
(bool) conf.getkey ("prefs/use_information_plugins",true),
(bool) conf.getkey ("prefs/use_compression_plugins",true),
(bool) conf.getkey ("prefs/compression_plugins_recursive",true),
@@ -591,8 +591,8 @@
/* Check if CD has been read */
if (key==-1) {
new ErrorDialog (String.Format (Catalog.GetString (
- "Directory <b>{0}</b> not found.\nPlease change the CD mount point in the Preferences window."),
- (string) conf.getkey ("prefs/mount_point",conf.default_cd_mount)), win_main);
+ "Directory <b>{0}</b> not found.\nPlease change the CD device in the Preferences window."),
+ (string) conf.getkey ("prefs/device",conf.default_cd_device)), win_main);
} else if (key==-2) {
new ErrorDialog (Catalog.GetString ("The mount directory is empty. Please make sure the CD is mounted."), win_main);
} else if (key==-3) {
@@ -637,7 +637,7 @@
{
/* Create Preferences window */
new PreferencesWindow(
- (string) conf.getkey ("prefs/mount_point",conf.default_cd_mount),
+ (string) conf.getkey ("prefs/device",conf.default_cd_device),
(bool) conf.getkey ("prefs/use_information_plugins",true),
(bool) conf.getkey ("prefs/use_compression_plugins",true),
(bool) conf.getkey ("prefs/compression_plugins_recursive",true),
diff -Nru cdcollect-0.6.0-orig/src/PreferencesWindow.cs cdcollect-0.6.0/src/PreferencesWindow.cs
--- cdcollect-0.6.0-orig/src/PreferencesWindow.cs 2006-11-24 18:12:13.000000000 +0100
+++ cdcollect-0.6.0/src/PreferencesWindow.cs 2007-07-16 21:45:51.000000000 +0200
@@ -37,7 +37,7 @@
[Glade.Widget] public Gtk.Window win_prefs;
[Glade.Widget] public Gtk.Button btn_ok;
[Glade.Widget] public Gtk.Button btn_cancel;
- [Glade.Widget] public Gtk.Entry entry_mount;
+ [Glade.Widget] public Gtk.Entry entry_device;
[Glade.Widget] public Gtk.CheckButton cbtn_info;
[Glade.Widget] public Gtk.CheckButton cbtn_comp;
@@ -50,7 +50,7 @@
private static Glade.XML gxml;
// Methods
- public PreferencesWindow (string mount, bool info, bool comp, bool recursive, bool thumbs, Gtk.Window parent) : base (IntPtr.Zero)
+ public PreferencesWindow (string device, bool info, bool comp, bool recursive, bool thumbs, Gtk.Window parent) : base (IntPtr.Zero)
{
// Show Main Dialog using glade
gxml = new Glade.XML (null, "gui.glade", "win_prefs", null);
@@ -65,7 +65,7 @@
win_prefs.Title = Catalog.GetString ("CDCollect: Preferences");
// Fill preferences
- entry_mount.Text = mount;
+ entry_device.Text = device;
cbtn_info.Active = info;
cbtn_comp.Active = comp;
cbtn_recursive.Active = recursive;
@@ -79,7 +79,7 @@
win_prefs.ShowAll ();
// Select focus
- entry_mount.GrabFocus();
+ entry_device.GrabFocus();
}
@@ -94,7 +94,7 @@
public void on_ok_clicked (object o, EventArgs args)
{
- CDCollect.conf.setkey ("prefs/mount_point", entry_mount.Text);
+ CDCollect.conf.setkey ("prefs/device", entry_device.Text);
CDCollect.conf.setkey ("prefs/use_information_plugins", cbtn_info.Active);
CDCollect.conf.setkey ("prefs/use_compression_plugins", cbtn_comp.Active);
CDCollect.conf.setkey ("prefs/compression_plugins_recursive", cbtn_recursive.Active);