I guess this would work for relatively simple cases (e.g. where the client doesn't change its max-clipboard property after construction), but if you wanted it to be a more reliable override, I'd suggested having a simple internal getter function something like static int get_max_clipboard(SpiceChannelMain* self) { static gint env = g_get_env(...) if (env) return env; return self->priv->max_clipboard; } and then use this everywhere instead of reading the data member directly. But I don't care too much. Jonathon ----- Original Message ----- > From: "Marc-André Lureau" <marcandre.lureau@xxxxxxxxx> > To: spice-devel@xxxxxxxxxxxxxxx > Sent: Wednesday, November 6, 2013 3:25:09 PM > Subject: [PATCH spice-gtk 2/5] Add SPICE_MAX_CLIPBOARD environment variable > > From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> > > Allow to easily override default max-clipboard value with environment > variable. > --- > gtk/channel-main.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/gtk/channel-main.c b/gtk/channel-main.c > index dbcaff8..75d0281 100644 > --- a/gtk/channel-main.c > +++ b/gtk/channel-main.c > @@ -394,6 +394,17 @@ static void spice_main_channel_reset(SpiceChannel > *channel, gboolean migrating) > SPICE_CHANNEL_CLASS(spice_main_channel_parent_class)->channel_reset(channel, > migrating); > } > > +static void spice_main_constructed(GObject *object) > +{ > + SpiceMainChannelPrivate *c = SPICE_MAIN_CHANNEL(object)->priv; > + > + if (g_getenv("SPICE_MAX_CLIPBOARD")) > + c->max_clipboard = atoi(g_getenv("SPICE_MAX_CLIPBOARD")); > + > + if (G_OBJECT_CLASS(spice_main_channel_parent_class)->constructed) > + > G_OBJECT_CLASS(spice_main_channel_parent_class)->constructed(object); > +} > + > static void spice_main_channel_class_init(SpiceMainChannelClass *klass) > { > GObjectClass *gobject_class = G_OBJECT_CLASS(klass); > @@ -403,6 +414,7 @@ static void > spice_main_channel_class_init(SpiceMainChannelClass *klass) > gobject_class->finalize = spice_main_channel_finalize; > gobject_class->get_property = spice_main_get_property; > gobject_class->set_property = spice_main_set_property; > + gobject_class->constructed = spice_main_constructed; > > channel_class->handle_msg = spice_main_handle_msg; > channel_class->iterate_write = spice_channel_iterate_write; > -- > 1.8.3.1 > > _______________________________________________ > Spice-devel mailing list > Spice-devel@xxxxxxxxxxxxxxxxxxxxx > http://lists.freedesktop.org/mailman/listinfo/spice-devel > _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel