~sschuhmann/scratch/gtk-stack

« back to all changes in this revision

Viewing changes to src/Widgets/DocumentView.vala

  • Committer: Steffen Schuhmann
  • Date: 2014-04-14 20:05:11 UTC
  • mfrom: (1253.2.29 scratch)
  • Revision ID: schuhmannsteffen+bazaar@mailbox.org-20140414200511-w5ofz70pm1dvu8pu
Merged upstream to resolve mergingconflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
164
164
                files += doc.file.get_uri ();
165
165
                settings.schema.set_strv ("opened-files", files);
166
166
            }
 
167
            
 
168
            // Handle Drag-and-drop functionality on source-view
 
169
            Gtk.TargetEntry uris = {"text/uri-list", 0, 0};
 
170
            Gtk.TargetEntry text = {"text/plain", 0, 0};
 
171
            Gtk.drag_dest_set (doc.source_view, Gtk.DestDefaults.ALL, {uris, text}, Gdk.DragAction.COPY);
 
172
            doc.source_view.drag_data_received.connect (this.drag_received);
167
173
        }
168
174
        
169
175
        private void remove_document (Document doc) {
178
184
                }
179
185
                settings.schema.set_strv ("opened-files", opened);
180
186
            }
 
187
            
 
188
            doc.source_view.drag_data_received.disconnect (this.drag_received);
 
189
        }
 
190
        
 
191
        private void drag_received(Gdk.DragContext ctx, int x, int y, Gtk.SelectionData sel,  uint info, uint time){
 
192
            var uris = sel.get_uris ();
 
193
            if (uris.length > 0){
 
194
                for (var i = 0; i < uris.length; i++){
 
195
                    string filename = uris[i];
 
196
                    File file = File.new_for_uri(filename);
 
197
                    Document doc = new Document(file);
 
198
                    this.open_document(doc);
 
199
                }
 
200
                
 
201
                Gtk.drag_finish (ctx, true, false, time);
 
202
            }
181
203
        }
182
204
        
183
205
        public Document? get_current_document () {
198
220
        
199
221
    }
200
222
    
201
 
}
 
223
}
 
 
b'\\ No newline at end of file'