I have a problem knowing when I can remove a file in /tmp after it has been placed on the clipboard successfully.<br><br>Responding to a key-press-event callback, I call the following:<br><font size="2"><br></font><div style="margin-left: 40px;">
<font size="2"><span style="font-family: courier new,monospace;">gtk.Clipboard().set_with_data( [(&#39;text/uri-list&#39;, 0, 0)], self._clipboardGetFuncCb, self._clipboardClearFuncCb, tempImgPath )</span></font><br style="font-family: courier new,monospace;">
</div><br>which, in turn, calls back:<br><font size="2"><br></font><div style="margin-left: 40px;"><font size="2"><span style="font-family: courier new,monospace;">def _clipboardGetFuncCb( self, clipboard, selection_data, info, tempImgPath):
</span></font><br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp; tempImgUri = &quot;file://&quot; + tempImgPath</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp; selection_data.set( &quot;text/uri-list&quot;, 8, tempImgUri )</span></font><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">def _clipboardClearFuncCb( self, clipboard, tempImgPath):</span></font><br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">
&nbsp;&nbsp;&nbsp;&nbsp; if (tempImgPath != None):</span></font><br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (os.path.exists(tempImgPath)):</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; os.remove( tempImgPath )</span></font><br></div><br><font size="2">_clipboardGetFuncCb is called before </font><font size="2">_clipboardClearFuncCb, but the second callback prevents any data from being placed on the clipboard (an image icon appears, but it has no data).&nbsp; If the second callback doesn&#39;t delete the file, the copy works!&nbsp; It would seem I need a callback to know when the clipboard has completed copying the data from /tmp before deleting the file from /tmp. 
<br><br>Looking into the clipboardservice.py code, it seems that a &quot;</font><font size="2">_handle_file_completed&quot; call can fire a </font>&quot;file-completed&quot;... but I am not sure of the right way for an activity to plug into that logic.&nbsp; Suggestions?
<br><br>Thanks.<br>Erik<font size="2"><span style="font-family: courier new,monospace;"></span></font><br>