Re: Filesel dnd patch



Alex Larsson <alexl redhat com> writes:

> On Tue, 28 Aug 2001, Darin Adler wrote:
> 
> > On Tuesday, August 28, 2001, at 12:59  PM, Alex Larsson wrote:
> > 
> > > +  /* We don't actually try to validate the URI according to RFC
> > > +   * 2396, or even check for allowed characters - we just ignore
> > > +   * comments and trim whitespace off the ends.  We also
> > > +   * allow LF delimination as well as the specified CRLF.
> > > +   */
> > 
> > Comment doesn't mention "#" handling.
> > 
> > > +  filename = g_filename_from_uri (uri, NULL, &error);
> > 
> > Is ignoring the hostname the right thing to do here? What if the hostname 
> > is the name of another computer?
> 
> Ok. New version. This one ignores drags of files from another computer.
> Dunno if this is the right thing to do. How do i kickback from the drop 
> code?

You need to not include GTK_DEST_DEFAULT_DROP in your mask for 
gtk_drag_dest_set(). 

Then you supply a ::drag_drop callback, that:

  - calls gtk_drag_get_data() to get the data in the format you want
  - returns TRUE

And a ::drag_data_received callback that:

  - call gtk_drag_finish() with the appropriate value for success 
    when you actually receive the data and figure out if it is
    OK or not.

If you are being super-cool, you don't supply DRAG_DEFAULT_MOTION
either and provide the correct feedback by calling gtk_drag_get_data()
from your ::drag_motion callback and calling gdk_drag_status()
when you get the data. It's considered bad form to tell the 
user that they can drop then snap back when they release.

Actually, for the file selector, I think you might just want to
accept paths even if they have the wrong hostname; in some sense
the user is dropping the path not the file that the path points.

Easier too,
                                        Owen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]