Changeset 42eed7fcd5c2709d714983be46e3a133cc732b73

Show
Ignore:
Timestamp:
01/06/07 23:43:14 (6 years ago)
Author:
Philipp Kern <phil@…>
Parents:
4d93728da871025d81db8def0f0fe41be31a0a8f
Children:
1d335d377d393ba74eac67877822b19cfaeb31fa
git-committer:
Philipp Kern <phil@0x539.de> / 2007-01-06T22:43:14Z+0000
Message:

[project @ First attempt to allow opening files by dropping them on a document, doesn't work.]

Original author: Armin Burgmeier <armin@…>
Date: 2005-07-23 20:52:11+00:00

Files:
3 modified

Legend:

Unmodified
Added
Removed
  • inc/document.hpp

    r5e8e3af r42eed7f  
    161161        void on_gui_subscribe(); 
    162162 
     163#if 0 
     164        /** Drag+Drop. 
     165         */ 
     166        virtual bool on_drag_motion( 
     167                const Glib::RefPtr<Gdk::DragContext>& context, 
     168                int x, int y, guint32 time 
     169        ); 
     170#endif 
     171 
    163172        /** TextBuffer signal handlers. 
    164173         */ 
  • src/document.cpp

    r5e8e3af r42eed7f  
    100100                sigc::mem_fun(*this, &Document::on_obby_user_unsubscribe) ); 
    101101 
     102#if 0 
     103        // Allow drag+drop of uri-lists and plaintext. uri-list is forwarded to 
     104        // the window while plaintext will be inserted into the document. 
     105        std::list<Gtk::TargetEntry> targets; 
     106        targets.push_back(Gtk::TargetEntry("text/uri-list") ); 
     107        targets.push_back(Gtk::TargetEntry("text/plain") ); 
     108        drag_dest_set(targets); 
     109#endif 
     110 
    102111        // GUI signal handlers 
    103112        m_btn_subscribe.signal_clicked().connect( 
     
    415424        m_btn_subscribe.set_sensitive(false); 
    416425} 
     426 
     427#if 0 
     428// Hack to allow to drop files on a document. They will be opened as new 
     429// documents if the contained data is an uri list, inserted into this document 
     430// if its text. 
     431bool Gobby::Document::on_drag_motion( 
     432        const Glib::RefPtr<Gdk::DragContext>& context, 
     433        int x, int y, guint32 time 
     434) 
     435{ 
     436        // Check available targets 
     437        std::vector<std::string> targets = context->get_targets(); 
     438        for(unsigned int i = 0; i < targets.size(); ++ i) 
     439                // Is one of them uri-lists? 
     440                if(targets[i] == "text/uri-list") 
     441                        // Yes so stop here to not show the insertion marker 
     442                        // The event will be delayed to 
     443                        return false; 
     444 
     445        // Call base function otherwise 
     446        return Gtk::SourceView::on_drag_motion(context, x, y, time); 
     447} 
     448#endif 
    417449 
    418450void Gobby::Document::on_insert_before(const Gtk::TextBuffer::iterator& begin, 
  • src/window.cpp

    r4d93728 r42eed7f  
    596596                // Get files by dragdata 
    597597                std::vector<std::string> files = data.get_uris(); 
     598                //std::unique(files.begin(), files.end() ); 
    598599 
    599600                // Open all of them 
     
    677678        m_chat.obby_document_insert(local_doc); 
    678679        m_statusbar.obby_document_insert(local_doc); 
     680 
     681#if 0 
     682        // Get last page (the newly inserted one) 
     683        DocWindow* doc = static_cast<DocWindow*>( 
     684                m_folder.get_nth_page(m_folder.get_n_pages() - 1) ); 
     685 
     686        doc->get_document().signal_drag_data_received().connect( 
     687                sigc::mem_fun(*this, &Window::on_drag_data_received) ); 
     688#endif 
    679689} 
    680690