[Sugar-devel] [PATCH sugar] Drop support for XdndDirectSave

Manuel Quiñones manuq at laptop.org
Fri Aug 24 09:50:07 EDT 2012


Thanks Daniel!

Yes indeed XdndDirectSave can be dropped.

2012/8/24 Daniel Narvaez <dwnarvaez at gmail.com>:
> From: Daniel Narvaez <dwnarvaez at gmail.com>
>
> It was added to allow dragging images from the old mozilla based
> web browser to the frame. The mozilla side of the patch was never
> upstreamed and anyway the new webkit based browser doesn't support
> the protocol.
>
> This is preliminary to the gtk3 port, we are trying to get rid of
> window.property_change calls which are not working with introspection.

Acked-by: Manuel Quiñones <manuq at laptop.org>

> ---
>  src/jarabe/frame/clipboard.py     |    6 +-----
>  src/jarabe/frame/clipboardtray.py |   36 +++---------------------------------
>  2 files changed, 4 insertions(+), 38 deletions(-)
>
> diff --git a/src/jarabe/frame/clipboard.py b/src/jarabe/frame/clipboard.py
> index a09ac5b..09e652a 100644
> --- a/src/jarabe/frame/clipboard.py
> +++ b/src/jarabe/frame/clipboard.py
> @@ -84,11 +84,7 @@ class Clipboard(gobject.GObject):
>          logging.debug('Clipboard.add_object_format')
>          cb_object = self._objects[object_id]
>
> -        if format_type == 'XdndDirectSave0':
> -            format_ = Format('text/uri-list', data + '\r\n', on_disk)
> -            format_.owns_disk_data = True
> -            cb_object.add_format(format_)
> -        elif on_disk and cb_object.get_percent() == 100:
> +        if on_disk and cb_object.get_percent() == 100:
>              new_uri = self._copy_file(data)
>              cb_object.add_format(Format(format_type, new_uri, on_disk))
>              logging.debug('Added format of type ' + format_type
> diff --git a/src/jarabe/frame/clipboardtray.py b/src/jarabe/frame/clipboardtray.py
> index 779ffed..2c9eaf7 100644
> --- a/src/jarabe/frame/clipboardtray.py
> +++ b/src/jarabe/frame/clipboardtray.py
> @@ -158,28 +158,9 @@ class ClipboardTray(tray.VTray):
>
>          self._context_map.add_context(context, object_id, len(context.targets))
>
> -        if 'XdndDirectSave0' in context.targets:
> -            window = context.source_window
> -            prop_type, format_, filename = \
> -                window.property_get('XdndDirectSave0', 'text/plain')
> -
> -            # FIXME query the clipboard service for a filename?
> -            base_dir = tempfile.gettempdir()
> -            dest_filename = util.unique_id()
> -
> -            name_, dot, extension = filename.rpartition('.')
> -            dest_filename += dot + extension
> -
> -            dest_uri = 'file://' + os.path.join(base_dir, dest_filename)
> -
> -            window.property_change('XdndDirectSave0', prop_type, format_,
> -                                   gtk.gdk.PROP_MODE_REPLACE, dest_uri)
> -
> -            widget.drag_get_data(context, 'XdndDirectSave0', time)
> -        else:
> -            for target in context.targets:
> -                if str(target) not in ('TIMESTAMP', 'TARGETS', 'MULTIPLE'):
> -                    widget.drag_get_data(context, target, time)
> +        for target in context.targets:
> +            if str(target) not in ('TIMESTAMP', 'TARGETS', 'MULTIPLE'):
> +                widget.drag_get_data(context, target, time)
>
>          cb_service.set_object_percent(object_id, percent=100)
>
> @@ -195,17 +176,6 @@ class ClipboardTray(tray.VTray):
>              if selection is None:
>                  logging.warn('ClipboardTray: empty selection for target %s',
>                      selection.target)
> -            elif selection.target == 'XdndDirectSave0':
> -                if selection.data == 'S':
> -                    window = context.source_window
> -
> -                    prop_type, format_, dest = window.property_get(
> -                        'XdndDirectSave0', 'text/plain')
> -
> -                    clipboardservice = clipboard.get_instance()
> -                    clipboardservice.add_object_format(object_id,
> -                                                       'XdndDirectSave0',
> -                                                       dest, on_disk=True)
>              else:
>                  self._add_selection(object_id, selection)
>
> --
> 1.7.10.2
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel



-- 
.. manuq ..


More information about the Sugar-devel mailing list