From 3167b97d8848e4f64065f3486ecdb3783eb7e7bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Tue, 29 May 2018 15:26:17 +0200 Subject: [PATCH 1/5] build: gtk-doc: Rebuild types and sections This makes sure we stay up to date and get the object hierarchy generated. --- doc/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Makefile.am b/doc/Makefile.am index 3628c6c..d11a150 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -12,7 +12,7 @@ DOC_MODULE=UPower DOC_MAIN_SGML_FILE=upower-docs.xml # Extra options to supply to gtkdoc-scan -SCAN_OPTIONS=--ignore-headers=config.h +SCAN_OPTIONS=--ignore-headers=config.h --rebuild-types --rebuild-sections # The directory containing the source code. Relative to $(srcdir) DOC_SOURCE_DIR=../libupower-glib -- GitLab From 0c180d044f05895eeff746e6aaf3227df7ac2f3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Tue, 29 May 2018 15:30:00 +0200 Subject: [PATCH 2/5] lib: Work-around to fix gtk-doc's type detection Without the braces on the same line gtk-doc adds function pointers as functions to the documentation and fails to detect the types as GObjects. This fixes object names in the index and cross refs. See the examples in https://developer.gnome.org/gtk-doc-manual/stable/documenting_symbols.html.en --- libupower-glib/up-client.h | 8 ++++---- libupower-glib/up-device.h | 8 +++----- libupower-glib/up-history-item.h | 6 ++---- libupower-glib/up-stats-item.h | 6 ++---- libupower-glib/up-wakeup-item.h | 6 ++---- 5 files changed, 13 insertions(+), 21 deletions(-) diff --git a/libupower-glib/up-client.h b/libupower-glib/up-client.h index 2342a48..0180dd4 100644 --- a/libupower-glib/up-client.h +++ b/libupower-glib/up-client.h @@ -44,15 +44,15 @@ G_BEGIN_DECLS typedef struct _UpClientPrivate UpClientPrivate; -typedef struct -{ +typedef struct { GObject parent; UpClientPrivate *priv; } UpClient; -typedef struct -{ +typedef struct { + /*< private >*/ GObjectClass parent_class; + /*< public >*/ void (*device_added) (UpClient *client, UpDevice *device); void (*device_removed) (UpClient *client, diff --git a/libupower-glib/up-device.h b/libupower-glib/up-device.h index 5186796..22d168a 100644 --- a/libupower-glib/up-device.h +++ b/libupower-glib/up-device.h @@ -44,16 +44,14 @@ G_BEGIN_DECLS typedef struct _UpDevicePrivate UpDevicePrivate; -typedef struct -{ +typedef struct { GObject parent; UpDevicePrivate *priv; } UpDevice; -typedef struct -{ - GObjectClass parent_class; +typedef struct { /*< private >*/ + GObjectClass parent_class; /* Padding for future expansion */ void (*_up_device_reserved1) (void); void (*_up_device_reserved2) (void); diff --git a/libupower-glib/up-history-item.h b/libupower-glib/up-history-item.h index 8378060..0175cdf 100644 --- a/libupower-glib/up-history-item.h +++ b/libupower-glib/up-history-item.h @@ -40,14 +40,12 @@ G_BEGIN_DECLS typedef struct UpHistoryItemPrivate UpHistoryItemPrivate; -typedef struct -{ +typedef struct { GObject parent; UpHistoryItemPrivate *priv; } UpHistoryItem; -typedef struct -{ +typedef struct { GObjectClass parent_class; } UpHistoryItemClass; diff --git a/libupower-glib/up-stats-item.h b/libupower-glib/up-stats-item.h index 85b8a6d..ee6c33c 100644 --- a/libupower-glib/up-stats-item.h +++ b/libupower-glib/up-stats-item.h @@ -39,14 +39,12 @@ G_BEGIN_DECLS typedef struct UpStatsItemPrivate UpStatsItemPrivate; -typedef struct -{ +typedef struct { GObject parent; UpStatsItemPrivate *priv; } UpStatsItem; -typedef struct -{ +typedef struct { GObjectClass parent_class; } UpStatsItemClass; diff --git a/libupower-glib/up-wakeup-item.h b/libupower-glib/up-wakeup-item.h index 3e32559..e0dd6b3 100644 --- a/libupower-glib/up-wakeup-item.h +++ b/libupower-glib/up-wakeup-item.h @@ -40,14 +40,12 @@ G_BEGIN_DECLS typedef struct UpWakeupItemPrivate UpWakeupItemPrivate; -typedef struct -{ +typedef struct { GObject parent; UpWakeupItemPrivate *priv; } UpWakeupItem; -typedef struct -{ +typedef struct { GObjectClass parent_class; } UpWakeupItemClass; -- GitLab From 409b2ccc89b55d43456a419e7923b9db5eee2b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Tue, 29 May 2018 15:38:25 +0200 Subject: [PATCH 3/5] lib: Use @see_also instead of "See also" This ensures consistent rendering. See https://developer.gnome.org/gtk-doc-manual/stable/documenting_sections.html.en --- libupower-glib/up-client.c | 3 +-- libupower-glib/up-device.c | 3 +-- libupower-glib/up-history-item.c | 3 +-- libupower-glib/up-stats-item.c | 3 +-- libupower-glib/up-types.c | 3 +-- libupower-glib/up-version.h.in | 3 +-- libupower-glib/up-wakeup-item.c | 3 +-- libupower-glib/upower.h | 3 +-- 8 files changed, 8 insertions(+), 16 deletions(-) diff --git a/libupower-glib/up-client.c b/libupower-glib/up-client.c index 6a48780..bc9c17e 100644 --- a/libupower-glib/up-client.c +++ b/libupower-glib/up-client.c @@ -22,11 +22,10 @@ /** * SECTION:up-client * @short_description: Main client object for accessing the UPower daemon + * @see_also: #UpDevice * * A helper GObject to use for accessing UPower information, and to be notified * when it is changed. - * - * See also: #UpDevice */ #include "config.h" diff --git a/libupower-glib/up-device.c b/libupower-glib/up-device.c index 8bfd98a..2f2c4cf 100644 --- a/libupower-glib/up-device.c +++ b/libupower-glib/up-device.c @@ -22,11 +22,10 @@ /** * SECTION:up-device * @short_description: Client object for accessing information about UPower devices + * @see_also: #UpClient * * A helper GObject to use for accessing UPower devices, and to be notified * when it is changed. - * - * See also: #UpClient */ #include "config.h" diff --git a/libupower-glib/up-history-item.c b/libupower-glib/up-history-item.c index bb8e4e4..19f4c5d 100644 --- a/libupower-glib/up-history-item.c +++ b/libupower-glib/up-history-item.c @@ -22,11 +22,10 @@ /** * SECTION:up-history-item * @short_description: Helper object representing one item of historical data. + * @see_also: #UpDevice, #UpClient * * This object represents one item of data which may be returned from the * daemon in response to a query. - * - * See also: #UpDevice, #UpClient */ #include "config.h" diff --git a/libupower-glib/up-stats-item.c b/libupower-glib/up-stats-item.c index afa9f7e..555aa3a 100644 --- a/libupower-glib/up-stats-item.c +++ b/libupower-glib/up-stats-item.c @@ -22,11 +22,10 @@ /** * SECTION:up-stats-item * @short_description: Helper object representing one item of statistics data. + * @see_also: #UpDevice, #UpClient * * This object represents one item of data which may be returned from the * daemon in response to a query. - * - * See also: #UpDevice, #UpClient */ #include "config.h" diff --git a/libupower-glib/up-types.c b/libupower-glib/up-types.c index 0984ad9..525cd02 100644 --- a/libupower-glib/up-types.c +++ b/libupower-glib/up-types.c @@ -22,11 +22,10 @@ /** * SECTION:up-types * @short_description: Types used by UPower and libupower-glib + * @see_also: #UpClient, #UpDevice * * These helper functions provide a way to marshal enumerated values to * text and back again. - * - * See also: #UpClient, #UpDevice */ #include "config.h" diff --git a/libupower-glib/up-version.h.in b/libupower-glib/up-version.h.in index 9d502fb..f2bd261 100644 --- a/libupower-glib/up-version.h.in +++ b/libupower-glib/up-version.h.in @@ -22,11 +22,10 @@ /** * SECTION:up-version * @short_description: Obtains the version for the installed UPower + * @see_also: #UpClient, #UpDevice * * These compile time macros allow the user to enable parts of client code * depending on the version of libupower-glib installed. - * - * See also: #UpClient, #UpDevice */ #if !defined (__UPOWER_H_INSIDE__) && !defined (UP_COMPILATION) diff --git a/libupower-glib/up-wakeup-item.c b/libupower-glib/up-wakeup-item.c index c11f7a7..cefbe62 100644 --- a/libupower-glib/up-wakeup-item.c +++ b/libupower-glib/up-wakeup-item.c @@ -22,11 +22,10 @@ /** * SECTION:up-wakeup-item * @short_description: Helper object representing one item of wakeup data. + * @see_also: #UpDevice, #UpClient * * This object represents one item of data which may be returned from the * daemon in response to a query. - * - * See also: #UpDevice, #UpClient */ #include "config.h" diff --git a/libupower-glib/upower.h b/libupower-glib/upower.h index 681bc2b..3d7c98e 100644 --- a/libupower-glib/upower.h +++ b/libupower-glib/upower.h @@ -22,11 +22,10 @@ /** * SECTION:upower * @short_description: Client objects for accessing UPower + * @see_also: #UpClient, #UpDevice * * These objects allow client programs to trivially get details about the power * state, and about devices on the system. - * - * See also: #UpClient, #UpDevice */ #ifndef __UPOWER_H__ -- GitLab From afdf4f99192120e3c5fc0611eb54f0f2d6cf722c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Tue, 29 May 2018 15:57:18 +0200 Subject: [PATCH 4/5] lib: UpClient: Fix stray '%' --- libupower-glib/up-client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libupower-glib/up-client.c b/libupower-glib/up-client.c index bc9c17e..7172ae4 100644 --- a/libupower-glib/up-client.c +++ b/libupower-glib/up-client.c @@ -524,7 +524,7 @@ up_client_finalize (GObject *object) * @error: Return location for error or %NULL. * * Creates a new #UpClient object. If connecting to upowerd on D-Bus fails, - % this returns %NULL and sets @error. + * this returns %NULL and sets @error. * * Return value: a new UpClient object, or %NULL on failure. * -- GitLab From 5ffcb1c2697cf4259470229f8fe8cb4c85faf76e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Tue, 29 May 2018 16:03:57 +0200 Subject: [PATCH 5/5] lib: UpClient: up_client_get_display_device returns a UpDevice It doesn't return a UpClient. --- libupower-glib/up-client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libupower-glib/up-client.c b/libupower-glib/up-client.c index 7172ae4..1491a98 100644 --- a/libupower-glib/up-client.c +++ b/libupower-glib/up-client.c @@ -151,7 +151,7 @@ up_client_get_devices2 (UpClient *client) * @client: a #UpClient instance. * * Get the composite display device. - * Return value: (transfer full): a #UpClient object, or %NULL on error. + * Return value: (transfer full): a #UpDevice object, or %NULL on error. * * Since: 1.0 **/ -- GitLab