[Spice-devel] [spice-gtk 1/2] clipboard: Add fixup_clipboard_text helper

Christophe Fergeau cfergeau at redhat.com
Wed Aug 31 08:52:06 UTC 2016


On Mon, Aug 15, 2016 at 12:37:51PM +0200, Pavel Grunt wrote:
> Hi Christophe,
> 
> On Wed, 2016-08-10 at 12:26 +0200, Christophe Fergeau wrote:
> > This makes clipboard_received_cb a bit shorter, and will be useful
> > in the next commit.
> > ---
> >  src/spice-gtk-session.c | 63 +++++++++++++++++++++++++++++-------------------
> > -
> >  1 file changed, 38 insertions(+), 25 deletions(-)
> > 
> > diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
> > index 6cdae87..1343302 100644
> > --- a/src/spice-gtk-session.c
> > +++ b/src/spice-gtk-session.c
> > @@ -910,6 +910,43 @@ static gboolean
> > check_clipboard_size_limits(SpiceGtkSession *session,
> >      return TRUE;
> >  }
> >  
> > +static char *fixup_clipboard_text(SpiceGtkSession *self, const char *text,
> > int *len)
> 
> In my opinion would be better if the function worked with
> 'const GtkSelectionData *' instead of text & len pair. Or keep len as output
> only parameter ?

After the second patch, we don't have a GtkSelectionData instance we can
pass to that method, so this would not be so convenient. I can change
fixup_clipboard_text() to return a GString though if you think it would
make things more readable. Or I can add a comment explaining what the
method is doing, and that 'len' may be modified.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160831/dbcd1778/attachment-0001.sig>


More information about the Spice-devel mailing list