[Spice-devel] [PATCH spice-server] fixup! Convert RedChannelClient hierarchy to GObject
Frediano Ziglio
fziglio at redhat.com
Tue Oct 4 08:11:43 UTC 2016
>
> On Fri, Sep 30, 2016 at 02:57:14PM +0100, Frediano Ziglio wrote:
> > Split lines with more than 100 characters
>
> > diff --git a/server/main-channel-client.h b/server/main-channel-client.h
> > index f95ddef..360c61e 100644
> > --- a/server/main-channel-client.h
> > +++ b/server/main-channel-client.h
> > @@ -212,7 +214,8 @@ red_channel_client_set_property(GObject *object,
> > if (caps) {
> > self->priv->remote_caps.num_caps = caps->len;
> > free(self->priv->remote_caps.caps);
> > - self->priv->remote_caps.caps =
> > spice_memdup(caps->data, caps->len * sizeof(uint32_t));
> > + self->priv->remote_caps.caps =
> > + spice_memdup(caps->data, caps->len *
> > sizeof(uint32_t));
> > }
> > }
> > break;
> > @@ -308,7 +311,8 @@ static void
> > red_channel_client_class_init(RedChannelClientClass *klass)
> > g_object_class_install_property(object_class,
> > PROP_MONITOR_LATENCY,
> > g_param_spec_boolean("monitor-latency",
> > "monitor-latency",
> > - "Whether to
> > monitor latency for this client",
> > + "Whether to
> > monitor latency "
> > + "for this
> > client",
>
> I'd keep this one on a single line even if it's a bit more than 100 chars,
> more readable this way imo.
>
Don't like either. Looks like we are not able to respect the rules
we decide.
> > FALSE,
> > G_PARAM_STATIC_STRINGS
> > | G_PARAM_READWRITE
> > | |
>
What about something like
diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 1e80199..e860390 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -275,6 +275,7 @@ static void red_channel_client_constructed(GObject *object)
static void red_channel_client_class_init(RedChannelClientClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS(klass);
+ GParamSpec *spec;
g_debug("%s", G_STRFUNC);
g_type_class_add_private(klass, sizeof(RedChannelClientPrivate));
@@ -287,52 +288,50 @@ static void red_channel_client_class_init(RedChannelClientClass *klass)
klass->is_connected = red_channel_client_default_is_connected;
klass->disconnect = red_channel_client_default_disconnect;
- g_object_class_install_property(object_class,
- PROP_STREAM,
- g_param_spec_pointer("stream", "stream",
- "Associated RedStream",
- G_PARAM_STATIC_STRINGS
- | G_PARAM_READWRITE
- | G_PARAM_CONSTRUCT_ONLY));
- g_object_class_install_property(object_class,
- PROP_CHANNEL,
- g_param_spec_pointer("channel", "channel",
- "Associated RedChannel",
- G_PARAM_STATIC_STRINGS
- | G_PARAM_READWRITE
- | G_PARAM_CONSTRUCT_ONLY));
- g_object_class_install_property(object_class,
- PROP_CLIENT,
- g_param_spec_pointer("client", "client",
- "Associated RedClient",
- G_PARAM_STATIC_STRINGS
- | G_PARAM_READWRITE
- | G_PARAM_CONSTRUCT_ONLY));
- g_object_class_install_property(object_class,
- PROP_MONITOR_LATENCY,
- g_param_spec_boolean("monitor-latency", "monitor-latency",
- "Whether to monitor latency "
- "for this client",
- FALSE,
- G_PARAM_STATIC_STRINGS
- | G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY));
- g_object_class_install_property(object_class,
- PROP_COMMON_CAPS,
- g_param_spec_boxed("common-caps", "common-caps",
- "Common Capabilities",
- G_TYPE_ARRAY,
- G_PARAM_STATIC_STRINGS
- | G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY));
- g_object_class_install_property(object_class,
- PROP_CAPS,
- g_param_spec_boxed("caps", "caps",
- "Capabilities",
- G_TYPE_ARRAY,
- G_PARAM_STATIC_STRINGS
- | G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY));
+ spec = g_param_spec_pointer("stream", "stream",
+ "Associated RedStream",
+ G_PARAM_STATIC_STRINGS
+ | G_PARAM_READWRITE
+ | G_PARAM_CONSTRUCT_ONLY);
+ g_object_class_install_property(object_class, PROP_STREAM, spec);
+
+ spec = g_param_spec_pointer("channel", "channel",
+ "Associated RedChannel",
+ G_PARAM_STATIC_STRINGS
+ | G_PARAM_READWRITE
+ | G_PARAM_CONSTRUCT_ONLY);
+ g_object_class_install_property(object_class, PROP_CHANNEL, spec);
+
+ spec = g_param_spec_pointer("client", "client",
+ "Associated RedClient",
+ G_PARAM_STATIC_STRINGS
+ | G_PARAM_READWRITE
+ | G_PARAM_CONSTRUCT_ONLY);
+ g_object_class_install_property(object_class, PROP_CLIENT, spec);
+
+ spec = g_param_spec_boolean("monitor-latency", "monitor-latency",
+ "Whether to monitor latency for this client",
+ FALSE,
+ G_PARAM_STATIC_STRINGS
+ | G_PARAM_READWRITE
+ | G_PARAM_CONSTRUCT_ONLY);
+ g_object_class_install_property(object_class, PROP_MONITOR_LATENCY, spec);
+
+ spec = g_param_spec_boxed("common-caps", "common-caps",
+ "Common Capabilities",
+ G_TYPE_ARRAY,
+ G_PARAM_STATIC_STRINGS
+ | G_PARAM_READWRITE
+ | G_PARAM_CONSTRUCT_ONLY);
+ g_object_class_install_property(object_class, PROP_COMMON_CAPS, spec);
+
+ spec = g_param_spec_boxed("caps", "caps",
+ "Capabilities",
+ G_TYPE_ARRAY,
+ G_PARAM_STATIC_STRINGS
+ | G_PARAM_READWRITE
+ | G_PARAM_CONSTRUCT_ONLY);
+ g_object_class_install_property(object_class, PROP_CAPS, spec);
}
static void
(not also that previously some flag concatenation line started with
"|" and in some other the previous line ended with "|").
Frediano
More information about the Spice-devel
mailing list