public SourceMenu (ImportCommand command) { this.command = command; source_count = 0; SourceItem item = new SourceItem (new BrowseSource ()); item.Activated += HandleActivated; this.Append (item); this.Append (new Gtk.SeparatorMenuItem ()); // Add external hard drives to the menu foreach (Gnome.Vfs.Volume vol in monitor.MountedVolumes) { if (!vol.IsUserVisible || vol.DeviceType == Gnome.Vfs.DeviceType.Unknown) continue; System.Console.WriteLine ("{0} - {1} - {2} {3} {4} {5} {6}", vol.DisplayName, vol.Icon, vol.VolumeType.ToString (), vol.ActivationUri, vol.IsUserVisible, vol.IsMounted, vol.DeviceType); if (vol.Drive != null) System.Console.WriteLine (vol.Drive.DeviceType.ToString ()); ImportSource source = new VolumeSource (vol); item = new SourceItem (source); item.Activated += HandleActivated; this.Append (item); source_count++; } GPhotoCamera cam = new GPhotoCamera (); cam.DetectCameras (); int camera_count = cam.CameraList.Count (); if (camera_count > 0) { source_count += camera_count; for (int i = 0; i < camera_count; i++) { string handle = cam.CameraList.GetValue (i); if (camera_count == 1 || handle != "usb:") { if (handle.StartsWith ("disk:")) { string path = handle.Substring ("disk:".Length); if (FindItemPosition (path) != -1) continue; } ImportSource source = new CameraSource (cam, i); item = new SourceItem (source); item.Activated += HandleActivated; this.Append (item); } } } else { ImportSource source = new BrowseSource (Catalog.GetString ("(No Cameras Detected)"), "emblem-camera"); item = new SourceItem (source); item.Activated += HandleActivated; item.Sensitive = false; this.Append (item); } /* this.Append (new Gtk.SeparatorMenuItem ()); foreach (Gnome.Vfs.Drive drive in monitor.ConnectedDrives) { ImportSource source = new DriveSource (drive); Gtk.ImageMenuItem item = new SourceItem (source); item.Sensitive = drive.IsMounted; this.Append (item); } */ this.ShowAll (); }
public SourceMenu(ImportCommand command) { this.command = command; source_count = 0; SourceItem item = new SourceItem(new BrowseSource()); item.Activated += HandleActivated; this.Append(item); this.Append(new Gtk.SeparatorMenuItem()); // Add external hard drives to the menu foreach (Gnome.Vfs.Volume vol in monitor.MountedVolumes) { if (!vol.IsUserVisible || vol.DeviceType == Gnome.Vfs.DeviceType.Unknown) { continue; } System.Console.WriteLine("{0} - {1} - {2} {3} {4} {5} {6}", vol.DisplayName, vol.Icon, vol.VolumeType.ToString(), vol.ActivationUri, vol.IsUserVisible, vol.IsMounted, vol.DeviceType); if (vol.Drive != null) { System.Console.WriteLine(vol.Drive.DeviceType.ToString()); } ImportSource source = new VolumeSource(vol); item = new SourceItem(source); item.Activated += HandleActivated; this.Append(item); source_count++; } GPhotoCamera cam = new GPhotoCamera(); cam.DetectCameras(); int camera_count = cam.CameraList.Count(); if (camera_count > 0) { source_count += camera_count; for (int i = 0; i < camera_count; i++) { string handle = cam.CameraList.GetValue(i); if (camera_count == 1 || handle != "usb:") { if (handle.StartsWith("disk:")) { string path = handle.Substring("disk:".Length); if (FindItemPosition(path) != -1) { continue; } } ImportSource source = new CameraSource(cam, i); item = new SourceItem(source); item.Activated += HandleActivated; this.Append(item); } } } else { ImportSource source = new BrowseSource(Catalog.GetString("(No Cameras Detected)"), "emblem-camera"); item = new SourceItem(source); item.Activated += HandleActivated; item.Sensitive = false; this.Append(item); } /* * this.Append (new Gtk.SeparatorMenuItem ()); * * foreach (Gnome.Vfs.Drive drive in monitor.ConnectedDrives) { * ImportSource source = new DriveSource (drive); * * Gtk.ImageMenuItem item = new SourceItem (source); * item.Sensitive = drive.IsMounted; * this.Append (item); * } */ this.ShowAll(); }