// MainWindow Constructor public MainWindow() : base(Gtk.WindowType.Toplevel) { Build (); entry_dvd.Changed += OnEntry_dvdChanged; // Adds "*.dvd" fillter to FileChooserDialog FileFilter filter = new FileFilter(); filter.Name="*.dvd"; filter.AddPattern("*.dvd"); filechooserbutton.AddFilter(filter); UnixUserInfo user = UnixUserInfo.GetRealUser(); // Checks existing of configuration file and loads configuration of the programm if (!Directory.Exists(user.HomeDirectory + "/.linxbox360burner")) Directory.CreateDirectory(user.HomeDirectory + "/.linxbox360burner"); if (!File.Exists(user.HomeDirectory + "/.linxbox360burner/conf")) { config = new Conf(); config.Commit(); } else { config = new Conf(user.HomeDirectory + "/.linxbox360burner/conf"); } if (config.dvdrwremember) entry_dvd.Text = config.dvdrw; dvddrive = new DVDdrive (entry_dvd.Text); dvddrive.GetMediaInfo(); Gnome.Vfs.Vfs.Initialize(); vm = Gnome.Vfs.VolumeMonitor.Get(); vm.VolumeMounted += delegate(object o, Gnome.Vfs.VolumeMountedArgs args) { DriveStateChanged(); }; vm.VolumeUnmounted += delegate(object o, Gnome.Vfs.VolumeUnmountedArgs args) { DriveStateChanged(); }; }
public Dvdrwchoose() { this.Build(); dvdrwlist = new List<string>(); // Vfs.Initialize(); VolumeMonitor vm = VolumeMonitor.Get(); Drive [] drives = vm.ConnectedDrives; foreach (Drive d in drives) { if (d.DeviceType == DeviceType.Cdrom) { dvdrwlist.Add(d.DevicePath); DVDdrive dvd = new DVDdrive(d.DevicePath); dvd.GetMediaInfo(); combobox.AppendText(dvd.Name + " (" + d.DevicePath +")"); } } combobox.Active = 0; }
void DriveStateChanged() { ListStore ls = new ListStore(typeof(string)); combobox_speed.Model = ls; dvddrive = new DVDdrive(entry_dvd.Text); dvddrive.GetMediaInfo(); if (dvddrive.DiskInserted) { foreach (string d in dvddrive.WriteSpeeds) { combobox_speed.AppendText(d); } combobox_speed.Active = 0; combobox_speed.Sensitive = true; } else { combobox_speed.AppendText("No media"); combobox_speed.Active = 0; combobox_speed.Sensitive = false; } ls.Dispose(); TryState(); }