[Spice-devel] [PATCH spice-gtk 2/5] Add SPICE_MAX_CLIPBOARD environment variable

Marc-André Lureau marcandre.lureau at gmail.com
Wed Nov 6 13:25:09 PST 2013


From: Marc-André Lureau <marcandre.lureau at redhat.com>

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



More information about the Spice-devel mailing list