[Spice-devel] [PATCH spice-gtk 3/7] SpiceDisplay: Use SpiceGtkSession auto-clipboard value as default

Hans de Goede hdegoede at redhat.com
Mon Oct 10 06:18:40 PDT 2011


Hi,

On 10/10/2011 02:51 PM, Marc-André Lureau wrote:
> This should rather be done in GObjectClass.constructed()

That is too late we *must* chain up to the GObjectClass constructor
as the first thing we do in our own constructor, and that calls
spice_display_set_property() for all our properties, either
with a provided value, or with the default, this in turn
causes a call to g_object_set on the SpiceGtkSession with possibly
the *wrong* value, followed by a g_object_notify, which will get
executed while the property has the wrong value.

Regards,

Hans


>
> On Mon, Oct 10, 2011 at 2:34 PM, Hans de Goede<hdegoede at redhat.com>  wrote:
>> The auto-clipboard setting now lives in the SpiceGtkSession, if that
>> was changed to FALSE (from the default of TRUE) and later another SpiceDisplay
>> was created for this session that would change it back to TRUE again.
>> This patch fixes this.
>>
>> Signed-off-by: Hans de Goede<hdegoede at redhat.com>
>> ---
>>   gtk/spice-widget.c |   12 ++++++++++--
>>   1 files changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
>> index 06e5113..5678a81 100644
>> --- a/gtk/spice-widget.c
>> +++ b/gtk/spice-widget.c
>> @@ -1659,8 +1659,16 @@ static void channel_destroy(SpiceSession *s, SpiceChannel *channel, gpointer dat
>>   **/
>>   SpiceDisplay *spice_display_new(SpiceSession *session, int id)
>>   {
>> -    return g_object_new(SPICE_TYPE_DISPLAY, "session", session,
>> -                        "channel-id", id, NULL);
>> +    gboolean auto_clipboard;
>> +
>> +    g_object_get(spice_gtk_session_get(session),
>> +                 "auto-clipboard",&auto_clipboard, NULL);
>> +
>> +    return g_object_new(SPICE_TYPE_DISPLAY,
>> +                        "session", session,
>> +                        "channel-id", id,
>> +                        "auto-clipboard", auto_clipboard,
>> +                        NULL);
>>   }
>>
>>   /**
>> --
>> 1.7.6.4
>>
>> _______________________________________________
>> Spice-devel mailing list
>> Spice-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>>
>
>
>


More information about the Spice-devel mailing list