def on_list_folder_view_drag_data_get( self, widget, drag_context, selection_data, info, timestamp, user_param1 = None ): iter = self.list_folder_view.get_selection().get_selected()[1] if not iter is None: path = self.store_folder_view.get_value( iter, 1 ) path = self.snapshots.get_snapshot_path_to( self.snapshot_id, path ) path = gnomevfs.escape_path_string( path ) selection_data.set_uris( [ 'file://' + path ] )
def path_get(clipboard, selectiondata, info, path): selectiondata.set_text(path) files = path.split("\n") file_paths = [] for copied_file in files: file_path = gnomevfs.escape_path_string(copied_file) file_paths.append('file://' + file_path) selectiondata.set_uris(file_paths) selectiondata.set('x-special/gnome-copied-files', 8, 'copy\n' + '\n'.join(file_paths))
def on_list_snapshots_drag_data_get(self, widget, drag_context, selection_data, info, timestamp, user_param1=None): iter = self.list_snapshots.get_selection().get_selected()[1] if not iter is None: path = self.store_snapshots.get_value(iter, 2) path = gnomevfs.escape_path_string(path) selection_data.set_uris(['file://' + path])
def get_icon( self, path ): if not os.path.exists(path): return gtk.STOCK_FILE #check if it is a special folder if path in self.special_folders: return self.special_folders[path] #get mime type mime_type = gnomevfs.get_mime_type( gnomevfs.escape_path_string( path ) ) mime_type = mime_type.replace( '/', '-' ) #search in the cache if mime_type in self.cache: return self.cache[mime_type] #print "path: " + path #print "mime: " + mime_type #try gnome mime items = mime_type.split('-') for aux in xrange(len(items)-1): icon_name = "gnome-mime-" + '-'.join(items[:len(items)-aux]) if icon_name in self.all_icons: #print "icon: " + icon_name self.cache[mime_type] = icon_name return icon_name #try folder if os.path.isdir( path ): icon_name = 'folder' if icon_name in self.all_icons: #print "icon: " + icon_name self.cache[mime_type] = icon_name return icon_name #print "icon: " + icon_name icon_name = gtk.STOCK_DIRECTORY self.cache[mime_type] = icon_name return icon_name #try simple mime for aux in xrange(len(items)-1): icon_name = '-'.join(items[:len(items)-aux]) if icon_name in self.all_icons: #print "icon: " + icon_name self.cache[mime_type] = icon_name return icon_name #file icon icon_name = gtk.STOCK_FILE self.cache[mime_type] = icon_name return icon_name
def __clipboard_copy_path_get(clipboard, selectiondata, info, path): selectiondata.set_text(path) path2 = gnomevfs.escape_path_string(path) selectiondata.set_uris(["file://" + path2]) selectiondata.set("x-special/gnome-copied-files", 8, "copy\nfile://" + path2)
def __clipboard_copy_path_get(clipboard, selectiondata, info, path): selectiondata.set_text(path) path2 = gnomevfs.escape_path_string(path) selectiondata.set_uris(['file://' + path2]) selectiondata.set('x-special/gnome-copied-files', 8, 'copy\nfile://' + path2)
def escape_path(path): return gnomevfs.escape_path_string(path)