[gtkmm-documentation] Adapt to the use of vector instead of *Handle in gtkmm 3.



commit b5390c2bc64edfd42a862b4c7bfb2c3579a72d50
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Jan 28 10:49:18 2011 +0100

    Adapt to the use of vector instead of *Handle in gtkmm 3.
    
    * examples/book/: Use std::vector instead of std::list, now that we don't
    use *Handle, which allowed both. We made that change because too many people
    were confused by the intermediate *Handle type.

 ChangeLog                                          |    8 ++++++++
 examples/book/clipboard/ideal/examplewindow.cc     |    4 ++--
 examples/book/dialogs/aboutdialog/examplewindow.cc |    2 +-
 examples/book/drag_and_drop/dndwindow.cc           |    2 +-
 examples/book/giomm/volumes/main.cc                |   12 ++++++------
 examples/book/iconview/examplewindow.cc            |    4 ++--
 examples/book/toolpalette/canvas.cc                |    4 ++--
 examples/book/toolpalette/canvas.h                 |    4 ++--
 examples/others/dnd/dndwindow.cc                   |    4 ++--
 examples/others/dnd/dndwindow.h                    |    4 ++--
 .../others/treemodelcustom/exampletreemodel.cc     |    2 +-
 examples/others/treemodelcustom/exampletreemodel.h |    4 ++--
 12 files changed, 31 insertions(+), 23 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index db61971..2af8bd4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-01-28  Murray Cumming  <murrayc murrayc com>
+
+	Adapt to the use of vector instead of *Handle in gtkmm 3.
+
+	* examples/book/: Use std::vector instead of std::list, now that we don't 
+	use *Handle, which allowed both. We made that change because too many people 
+	were confused by the intermediate *Handle type.
+
 2011-01-26  Murray Cumming  <murrayc murrayc com>
 
 	ListViewText: Adapt to the append_text() change to append().
diff --git a/examples/book/clipboard/ideal/examplewindow.cc b/examples/book/clipboard/ideal/examplewindow.cc
index 029c54a..d0b13e8 100644
--- a/examples/book/clipboard/ideal/examplewindow.cc
+++ b/examples/book/clipboard/ideal/examplewindow.cc
@@ -91,7 +91,7 @@ void ExampleWindow::on_button_copy()
   Glib::RefPtr<Gtk::Clipboard> refClipboard = Gtk::Clipboard::get();
 
   //Targets:
-  std::list<Gtk::TargetEntry> listTargets;
+  std::vector<Gtk::TargetEntry> listTargets;
 
   listTargets.push_back( Gtk::TargetEntry(example_target_custom) );
   listTargets.push_back( Gtk::TargetEntry(example_target_text) );
@@ -199,7 +199,7 @@ void ExampleWindow::on_clipboard_received_targets(
   const Glib::StringArrayHandle& targets_array)
 {
   // Get the list of available clipboard targets:
-  std::list<std::string> targets = targets_array;
+  std::vector<std::string> targets = targets_array;
 
   const bool bPasteIsPossible =
     std::find(targets.begin(), targets.end(),
diff --git a/examples/book/dialogs/aboutdialog/examplewindow.cc b/examples/book/dialogs/aboutdialog/examplewindow.cc
index 09273fb..a2ca340 100644
--- a/examples/book/dialogs/aboutdialog/examplewindow.cc
+++ b/examples/book/dialogs/aboutdialog/examplewindow.cc
@@ -43,7 +43,7 @@ ExampleWindow::ExampleWindow()
   m_Dialog.set_website("http://www.gtkmm.org";);
   m_Dialog.set_website_label("gtkmm website");
 
-  std::list<Glib::ustring> list_authors;
+  std::vector<Glib::ustring> list_authors;
   list_authors.push_back("Murray Cumming");
   list_authors.push_back("Somebody Else");
   list_authors.push_back("AN Other");
diff --git a/examples/book/drag_and_drop/dndwindow.cc b/examples/book/drag_and_drop/dndwindow.cc
index ae883ca..8983af3 100644
--- a/examples/book/drag_and_drop/dndwindow.cc
+++ b/examples/book/drag_and_drop/dndwindow.cc
@@ -28,7 +28,7 @@ DnDWindow::DnDWindow()
   add(m_HBox);
 
   //Targets:
-  std::list<Gtk::TargetEntry> listTargets;
+  std::vector<Gtk::TargetEntry> listTargets;
   listTargets.push_back( Gtk::TargetEntry("STRING") );
   listTargets.push_back( Gtk::TargetEntry("text/plain") );
 
diff --git a/examples/book/giomm/volumes/main.cc b/examples/book/giomm/volumes/main.cc
index 937d3c9..470fd71 100644
--- a/examples/book/giomm/volumes/main.cc
+++ b/examples/book/giomm/volumes/main.cc
@@ -12,22 +12,22 @@ int main(int /* argc */, char** /* argv */)
       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();
+    typedef std::vector< Glib::RefPtr<Gio::Drive> > type_vec_drives;
+    type_vec_drives list_drives = volume_monitor->get_connected_drives();
 
     if(list_drives.empty())
       std::cout << "No drives are connected." << std::endl;
 
-    for(type_list_drives::iterator iter = list_drives.begin(); iter != list_drives.end(); ++iter)
+    for(type_vec_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;
 
       //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();
+      typedef std::vector< Glib::RefPtr<Gio::Volume> > type_vec_volumes;
+      type_vec_volumes list_volumes = volume_monitor->get_volumes();
 
-      for(type_list_volumes::iterator iter = list_volumes.begin(); iter != list_volumes.end(); ++iter)
+      for(type_vec_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;
diff --git a/examples/book/iconview/examplewindow.cc b/examples/book/iconview/examplewindow.cc
index 02c2900..cef9a06 100644
--- a/examples/book/iconview/examplewindow.cc
+++ b/examples/book/iconview/examplewindow.cc
@@ -126,8 +126,8 @@ void ExampleWindow::on_item_activated(const Gtk::TreeModel::Path& path)
 
 void ExampleWindow::on_selection_changed()
 {
-  typedef std::list<Gtk::TreeModel::Path> type_list_paths;
-  type_list_paths selected = m_IconView.get_selected_items();
+  typedef std::vector<Gtk::TreeModel::Path> type_vec_paths;
+  type_vec_paths selected = m_IconView.get_selected_items();
   if(!selected.empty())
   {
     const Gtk::TreeModel::Path& path = *selected.begin();
diff --git a/examples/book/toolpalette/canvas.cc b/examples/book/toolpalette/canvas.cc
index 32df7f9..707c38a 100644
--- a/examples/book/toolpalette/canvas.cc
+++ b/examples/book/toolpalette/canvas.cc
@@ -30,7 +30,7 @@ Canvas::~Canvas()
 {
   while(!m_canvas_items.empty())
   {
-    type_list_items::iterator iter = m_canvas_items.begin();
+    type_vec_items::iterator iter = m_canvas_items.begin();
     CanvasItem* item = *iter;
     delete item;
     m_canvas_items.erase(iter);
@@ -67,7 +67,7 @@ bool Canvas::on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
   cr->rectangle(0, 0, allocation.get_width(), allocation.get_height());
   cr->fill();
 
-  for(type_list_items::iterator iter = m_canvas_items.begin();
+  for(type_vec_items::iterator iter = m_canvas_items.begin();
     iter != m_canvas_items.end(); ++iter )
   {
     item_draw(*iter, cr, false);
diff --git a/examples/book/toolpalette/canvas.h b/examples/book/toolpalette/canvas.h
index 9c7f816..8e9d36b 100644
--- a/examples/book/toolpalette/canvas.h
+++ b/examples/book/toolpalette/canvas.h
@@ -61,8 +61,8 @@ private:
   bool m_drag_data_requested_for_drop; //So we know what to do in on_drag_data_received().
   CanvasItem* m_drop_item;
   
-  typedef std::list<CanvasItem*> type_list_items;
-  type_list_items m_canvas_items;
+  typedef std::vector<CanvasItem*> type_vec_items;
+  type_vec_items m_canvas_items;
 };
 
 #endif //GTKMM_EXAMPLE_CANVAS_H
diff --git a/examples/others/dnd/dndwindow.cc b/examples/others/dnd/dndwindow.cc
index c5953cb..de29274 100644
--- a/examples/others/dnd/dndwindow.cc
+++ b/examples/others/dnd/dndwindow.cc
@@ -158,7 +158,7 @@ bool DnDWindow::on_image_drag_motion(const Glib::RefPtr<Gdk::DragContext>& conte
            G_OBJECT_TYPE_NAME (source_widget) :
            "NULL");
 
-  typedef std::list<Glib::ustring> type_targets;
+  typedef std::vector<std::string> type_targets;
   const type_targets targets = context->list_targets();
   for(type_targets::const_iterator iter = targets.begin(); iter != targets.end(); ++iter)
   {
@@ -184,7 +184,7 @@ bool DnDWindow::on_image_drag_drop(const Glib::RefPtr<Gdk::DragContext>& context
 
   m_Image.set(m_trashcan_closed);
 
-  std::vector<Glib::ustring> targets = context->list_targets();
+  std::vector<std::string> targets = context->list_targets();
   if(!targets.empty())
   {
     drag_get_data( context, targets[0], time );
diff --git a/examples/others/dnd/dndwindow.h b/examples/others/dnd/dndwindow.h
index 1ba804d..7e5ee98 100644
--- a/examples/others/dnd/dndwindow.h
+++ b/examples/others/dnd/dndwindow.h
@@ -78,8 +78,8 @@ protected:
   };
 
   //Targets:
-  typedef std::list<Gtk::TargetEntry> type_listTargets;
-  type_listTargets m_listTargets, m_listTargetsNoRoot;
+  typedef std::vector<Gtk::TargetEntry> type_vecTargets;
+  type_vecTargets m_listTargets, m_listTargetsNoRoot;
 };
 
 #endif // GTKMM_EXAMPLE_DNDWINDOW_H
diff --git a/examples/others/treemodelcustom/exampletreemodel.cc b/examples/others/treemodelcustom/exampletreemodel.cc
index 0ba5c32..8811bcd 100644
--- a/examples/others/treemodelcustom/exampletreemodel.cc
+++ b/examples/others/treemodelcustom/exampletreemodel.cc
@@ -36,7 +36,7 @@ ExampleTreeModel::GlueList::GlueList()
 ExampleTreeModel::GlueList::~GlueList()
 {
   //Delete each GlueItem in the list:
-  for(type_listOfGlue::iterator iter = m_list.begin(); iter != m_list.end(); ++iter)
+  for(type_vecOfGlue::iterator iter = m_list.begin(); iter != m_list.end(); ++iter)
   {
     ExampleTreeModel::GlueItem* pItem = *iter;
     delete pItem;
diff --git a/examples/others/treemodelcustom/exampletreemodel.h b/examples/others/treemodelcustom/exampletreemodel.h
index c312d53..bc0d241 100644
--- a/examples/others/treemodelcustom/exampletreemodel.h
+++ b/examples/others/treemodelcustom/exampletreemodel.h
@@ -89,8 +89,8 @@ private:
      ~GlueList();
 
      //This is just a list of stuff to delete later:
-     typedef std::list<GlueItem*> type_listOfGlue;
-     type_listOfGlue m_list;
+     typedef std::vector<GlueItem*> type_vecOfGlue;
+     type_vecOfGlue m_list;
    };
 
    typeListOfRows::iterator get_data_row_iter_from_tree_row_iter(const iterator& iter);



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