gtkmm-documentation r30 - in trunk: . examples/book/giomm/volumes



Author: murrayc
Date: Sat Jan 26 10:03:25 2008
New Revision: 30
URL: http://svn.gnome.org/viewvc/gtkmm-documentation?rev=30&view=rev

Log:
2008-01-26  Murray Cumming  <murrayc murrayc com>

* examples/book/giomm/volumes/main.cc: Get the volumes for the drives 
too, though no drives are reported for some reason.

Modified:
   trunk/ChangeLog
   trunk/examples/book/giomm/volumes/main.cc

Modified: trunk/examples/book/giomm/volumes/main.cc
==============================================================================
--- trunk/examples/book/giomm/volumes/main.cc	(original)
+++ trunk/examples/book/giomm/volumes/main.cc	Sat Jan 26 10:03:25 2008
@@ -11,6 +11,7 @@
     if(!volume_monitor)
       std::cerr << "Gio::VolumeMonitor::get() failed." << std::endl;
 
+    //Get the drives:
     typedef std::list< Glib::RefPtr<Gio::Drive> > type_list_drives;
     type_list_drives list_drives = volume_monitor->get_connected_drives();
 
@@ -20,9 +21,17 @@
     for(type_list_drives::iterator iter = list_drives.begin(); iter != list_drives.end(); ++iter)
     {
       Glib::RefPtr<Gio::Drive> drive = *iter;
-      std::cout << "drive: " << drive->get_name() << std::endl;
+      std::cout << "Drive: " << drive->get_name() << std::endl;
 
-      //TODO: get the volumes in the drive.
+      //Get the volumes in the drive:
+      typedef std::list< Glib::RefPtr<Gio::Volume> > type_list_volumes;
+      type_list_volumes list_volumes = volume_monitor->get_volumes();
+
+      for(type_list_volumes::iterator iter = list_volumes.begin(); iter != list_volumes.end(); ++iter)
+      {
+        Glib::RefPtr<Gio::Volume> volume = *iter;
+        std::cout << "  Volume: " << volume->get_name() << std::endl;
+      }
     }
   }
   catch(const Glib::Exception& ex)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]