Skip to content

Commit

Permalink
Simplify version support
Browse files Browse the repository at this point in the history
Not necessary at all to override the property.
Just set its initial value.
  • Loading branch information
Matthias Clasen committed Jan 18, 2017
1 parent 3ab700b commit fd3d94a
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 372 deletions.
40 changes: 2 additions & 38 deletions src/account.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,51 +203,15 @@ account_iface_init (XdpAccountIface *iface)
iface->handle_get_user_information = handle_get_user_information;
}

enum {
PROP_0,
PROP_VERSION
};

static void
account_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}

static void
account_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
switch (prop_id)
{
case PROP_VERSION:
g_value_set_uint (value, 1);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}


static void
account_init (Account *fc)
account_init (Account *account)
{
xdp_account_set_version (XDP_ACCOUNT (account), 1);
}

static void
account_class_init (AccountClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);

object_class->set_property = account_set_property;
object_class->get_property = account_get_property;

xdp_account_override_properties (object_class, PROP_VERSION);
}

GDBusInterfaceSkeleton *
Expand Down
39 changes: 2 additions & 37 deletions src/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,50 +327,15 @@ device_iface_init (XdpDeviceIface *iface)
iface->handle_access_device = handle_access_device;
}

enum {
PROP_0,
PROP_VERSION
};

static void
device_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}

static void
device_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
switch (prop_id)
{
case PROP_VERSION:
g_value_set_uint (value, 1);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}

static void
device_init (Device *fc)
device_init (Device *device)
{
xdp_device_set_version (XDP_DEVICE (device), 1);
}

static void
device_class_init (DeviceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);

object_class->set_property = device_set_property;
object_class->get_property = device_get_property;

xdp_device_override_properties (object_class, PROP_VERSION);
}

GDBusInterfaceSkeleton *
Expand Down
37 changes: 1 addition & 36 deletions src/file-chooser.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,50 +558,15 @@ file_chooser_iface_init (XdpFileChooserIface *iface)
iface->handle_save_file = handle_save_file;
}

enum {
PROP_0,
PROP_VERSION
};

static void
file_chooser_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}

static void
file_chooser_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
switch (prop_id)
{
case PROP_VERSION:
g_value_set_uint (value, 1);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}

static void
file_chooser_init (FileChooser *fc)
{
xdp_file_chooser_set_version (XDP_FILE_CHOOSER (fc), 1);
}

static void
file_chooser_class_init (FileChooserClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);

object_class->set_property = file_chooser_set_property;
object_class->get_property = file_chooser_get_property;

xdp_file_chooser_override_properties (object_class, PROP_VERSION);
}

GDBusInterfaceSkeleton *
Expand Down
43 changes: 4 additions & 39 deletions src/inhibit.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,55 +204,20 @@ inhibit_handle_inhibit (XdpInhibit *object,
return TRUE;
}

enum {
PROP_0,
PROP_VERSION
};

static void
inhibit_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
inhibit_iface_init (XdpInhibitIface *iface)
{
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
iface->handle_inhibit = inhibit_handle_inhibit;
}

static void
inhibit_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
inhibit_init (Inhibit *inhibit)
{
switch (prop_id)
{
case PROP_VERSION:
g_value_set_uint (value, 1);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
xdp_inhibit_set_version (XDP_INHIBIT (inhibit), 1);
}

static void
inhibit_class_init (InhibitClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);

object_class->set_property = inhibit_set_property;
object_class->get_property = inhibit_get_property;

xdp_inhibit_override_properties (object_class, PROP_VERSION);
}

static void
inhibit_iface_init (XdpInhibitIface *iface)
{
iface->handle_inhibit = inhibit_handle_inhibit;
}

static void
inhibit_init (Inhibit *resolver)
{
}

Expand Down
38 changes: 1 addition & 37 deletions src/network-monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,37 +78,6 @@ changed (GNetworkMonitor *monitor,
xdp_network_monitor_emit_changed (nm, available);
}

enum {
PROP_0,
PROP_VERSION
};

static void
network_monitor_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}

static void
network_monitor_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
switch (prop_id)
{
case PROP_VERSION:
g_value_set_uint (value, 1);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}


static void
network_monitor_init (NetworkMonitor *nm)
{
Expand All @@ -123,17 +92,12 @@ network_monitor_init (NetworkMonitor *nm)
g_network_monitor_get_network_metered (nm->monitor));
xdp_network_monitor_set_connectivity (XDP_NETWORK_MONITOR (nm),
g_network_monitor_get_connectivity (nm->monitor));
xdp_network_monitor_set_version (XDP_NETWORK_MONITOR (nm), 1);
}

static void
network_monitor_class_init (NetworkMonitorClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);

object_class->set_property = network_monitor_set_property;
object_class->get_property = network_monitor_get_property;

xdp_network_monitor_override_properties (object_class, PROP_VERSION);
}

GDBusInterfaceSkeleton *
Expand Down
39 changes: 2 additions & 37 deletions src/notification.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,50 +520,15 @@ notification_iface_init (XdpNotificationIface *iface)
iface->handle_remove_notification = notification_handle_remove_notification;
}

enum {
PROP_0,
PROP_VERSION
};

static void
notification_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}

static void
notification_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
switch (prop_id)
{
case PROP_VERSION:
g_value_set_uint (value, 1);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}

static void
notification_init (Notification *resolver)
notification_init (Notification *notification)
{
xdp_notification_set_version (XDP_NOTIFICATION (notification), 1);
}

static void
notification_class_init (NotificationClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);

object_class->set_property = notification_set_property;
object_class->get_property = notification_get_property;

xdp_notification_override_properties (object_class, PROP_VERSION);
}

GDBusInterfaceSkeleton *
Expand Down
37 changes: 1 addition & 36 deletions src/open-uri.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,50 +537,15 @@ open_uri_iface_init (XdpOpenURIIface *iface)
iface->handle_open_uri = handle_open_uri;
}

enum {
PROP_0,
PROP_VERSION
};

static void
open_uri_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}

static void
open_uri_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
switch (prop_id)
{
case PROP_VERSION:
g_value_set_uint (value, 1);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}

static void
open_uri_init (OpenURI *fc)
{
xdp_open_uri_set_version (XDP_OPEN_URI (fc), 1);
}

static void
open_uri_class_init (OpenURIClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);

object_class->set_property = open_uri_set_property;
object_class->get_property = open_uri_get_property;

xdp_open_uri_override_properties (object_class, PROP_VERSION);
}

GDBusInterfaceSkeleton *
Expand Down
Loading

0 comments on commit fd3d94a

Please sign in to comment.