~niclasl/scratch/fix-905706

« back to all changes in this revision

Viewing changes to src/Widgets/DocumentView.vala

  • Committer: Niclas Lockner
  • Date: 2014-04-13 16:59:28 UTC
  • mfrom: (1273.1.8 scratch)
  • Revision ID: niclaslockner@gmail.com-20140413165928-84zn9b0botgpuyn2
Merge changes from lp:scratch

Show diffs side-by-side

added added

removed removed

Lines of Context:
169
169
                files += doc.file.get_uri ();
170
170
                settings.schema.set_strv ("opened-files", files);
171
171
            }
 
172
            
 
173
            doc.source_view.drag_data_received.connect (this.drag_received);
172
174
        }
173
175
 
174
176
        private void on_doc_removed (Granite.Widgets.Tab tab) {
176
178
 
177
179
            this.docs.remove (doc);
178
180
            doc.source_view.focus_in_event.disconnect (on_focus_in_event);
 
181
            doc.source_view.drag_data_received.disconnect (this.drag_received);
179
182
 
180
183
            // Update the opened-files setting
181
184
            if (settings.show_at_start == "last-tabs") {
218
221
                document_change (doc);
219
222
            }
220
223
 
221
 
            return true;
222
 
        }
223
 
    }   
 
224
            return true;  
 
225
        }
 
226
        
 
227
        private void drag_received(Gdk.DragContext ctx, int x, int y, Gtk.SelectionData sel,  uint info, uint time){
 
228
            var uris = sel.get_uris ();
 
229
            if (uris.length > 0) {
 
230
                for (var i = 0; i < uris.length; i++) {
 
231
                    string filename = uris[i];
 
232
                    File file = File.new_for_uri (filename);
 
233
                    Document doc = new Document (window.main_actions, file);
 
234
                    this.open_document (doc);
 
235
                }
 
236
                
 
237
                Gtk.drag_finish (ctx, true, false, time);
 
238
            }
 
239
        }
 
240
    }
224
241
}
 
 
b'\\ No newline at end of file'