[gnote] * Drag and drop of notes to a notebook (Close #579637)



commit fca33aa8af184e6062ce7ba26617d8c259701010
Author: Hubert Figuiere <hub figuiere net>
Date:   Tue Apr 21 23:47:49 2009 -0400

      * Drag and drop of notes to a notebook (Close #579637)
---
 NEWS                  |    1 +
 src/recentchanges.cpp |   14 +++++---------
 src/utils.cpp         |    7 ++++++-
 src/utils.hpp         |    2 +-
 4 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/NEWS b/NEWS
index 9fd5a5c..44e0352 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,7 @@ Fixes:
   * Fix offsets on WikiWord (similar to bug #579225)
   * Initialize gettext properly (Close #579520)
   * Properly check for libxml2.
+  * Drag and drop of notes to a notebook (Close #579637)
 
 Translations:
 
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index 17c033a..39f1efe 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -707,18 +707,14 @@ namespace gnote {
       return;
     }
                   
-    std::string uris;
+    std::vector<std::string> uris;
     for(Note::List::const_iterator iter = selected_notes.begin();
         iter != selected_notes.end(); ++iter) {
-      if (!uris.empty()) {
-        uris += "\n";
-      }
-      uris += (*iter)->uri();
+
+      uris.push_back((*iter)->uri());
     }
-                  
-    // FIXME: Gtk.SelectionData has no way to get the
-    //        requested target.
-    selection_data.set ("text/uri-list", uris.c_str());
+    
+    selection_data.set_uris(uris);
                   
     if (selected_notes.size() == 1) {
       selection_data.set_text(selected_notes.front()->get_title());
diff --git a/src/utils.cpp b/src/utils.cpp
index 388a193..5df8ee0 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -425,6 +425,11 @@ namespace gnote {
     {
       std::vector<std::string> items;
       sharp::string_split(items, data, "\n");
+      load_from_string_list(items);
+    }
+
+    void UriList::load_from_string_list(const std::vector<std::string> & items)
+    {
       for(std::vector<std::string>::const_iterator iter = items.begin();
           iter != items.end(); ++iter) {
 
@@ -457,7 +462,7 @@ namespace gnote {
     UriList::UriList(const Gtk::SelectionData & selection)
     {
       if(selection.get_length() > 0) {
-        load_from_string(selection.get_text());
+        load_from_string_list(selection.get_uris());
       }
     }
 
diff --git a/src/utils.hpp b/src/utils.hpp
index 92edad2..b240690 100644
--- a/src/utils.hpp
+++ b/src/utils.hpp
@@ -117,7 +117,7 @@ namespace gnote {
       
     private:
       void load_from_string(const std::string & data);
-      
+      void load_from_string_list(const std::vector<std::string> & items);
     };
 
     class XmlEncoder



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