Commit 8ba5a67f authored by Philip Withnall's avatar Philip Withnall Committed by Ray Strode

act-user: Use G_DECLARE_FINAL_TYPE to declare ActUser

This tidies up the code a bit, and (critically) exposes a concrete
structure for `ActUser` and `ActUserClass`. Previously these were
dangling typedefs, which meant the compiler had no idea they derived
from `GObject`, and hence would give warnings about strict aliasing when
(for example) calling:
```
g_set_object (&my_user, user);
```
where `my_user` and `user` were both `ActUser*`.

This shouldn’t introduce any API or ABI changes, as the library
basically exposed no API in this area before. The autoptr cleanup
function is now defined by `G_DECLARE_FINAL_TYPE`.

libaccountsservice already depends on GLib 2.63, so no dependency bump
is needed.
Signed-off-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
parent 8d348ba2
Pipeline #112018 passed with stage
in 2 minutes
......@@ -66,10 +66,6 @@
* Mode for setting the user's password.
*/
#define ACT_USER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ACT_TYPE_USER, ActUserClass))
#define ACT_IS_USER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ACT_TYPE_USER))
#define ACT_USER_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), ACT_TYPE_USER, ActUserClass))
#define ACCOUNTS_NAME "org.freedesktop.Accounts"
#define ACCOUNTS_USER_INTERFACE "org.freedesktop.Accounts.User"
......@@ -118,11 +114,6 @@ struct _ActUser {
guint nonexistent : 1;
};
struct _ActUserClass
{
GObjectClass parent_class;
};
static void act_user_finalize (GObject *object);
static guint signals[LAST_SIGNAL] = { 0 };
......
......@@ -31,9 +31,8 @@
G_BEGIN_DECLS
#define ACT_TYPE_USER (act_user_get_type ())
#define ACT_USER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), ACT_TYPE_USER, ActUser))
#define ACT_IS_USER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), ACT_TYPE_USER))
#define ACT_TYPE_USER (act_user_get_type())
G_DECLARE_FINAL_TYPE (ActUser, act_user, ACT, USER, GObject)
typedef enum {
ACT_USER_ACCOUNT_TYPE_STANDARD,
......@@ -46,11 +45,6 @@ typedef enum {
ACT_USER_PASSWORD_MODE_NONE,
} ActUserPasswordMode;
typedef struct _ActUser ActUser;
typedef struct _ActUserClass ActUserClass;
GType act_user_get_type (void) G_GNUC_CONST;
const char *act_user_get_object_path (ActUser *user);
uid_t act_user_get_uid (ActUser *user);
......@@ -127,10 +121,6 @@ void act_user_set_locked (ActUser *user,
void act_user_set_automatic_login (ActUser *user,
gboolean enabled);
#if GLIB_CHECK_VERSION(2, 44, 0)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ActUser, g_object_unref)
#endif
G_END_DECLS
#endif /* __ACT_USER_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment