[seahorse] pgp: Cleanup headers with G_DECLARE_*_TYPE



commit 38105df8e789b7d08a9556b8f294123c6bfb7b80
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Thu Feb 18 13:53:38 2021 +0100

    pgp: Cleanup headers with G_DECLARE_*_TYPE

 pgp/seahorse-pgp-key.h   | 32 ++++++++-----------------------
 pgp/seahorse-pgp-photo.h |  2 +-
 pgp/seahorse-pgp-uid.c   | 10 +++++-----
 pgp/seahorse-pgp-uid.h   | 49 ++++++++++++++++--------------------------------
 4 files changed, 30 insertions(+), 63 deletions(-)
---
diff --git a/pgp/seahorse-pgp-key.h b/pgp/seahorse-pgp-key.h
index df6c5de8..179688ad 100644
--- a/pgp/seahorse-pgp-key.h
+++ b/pgp/seahorse-pgp-key.h
@@ -28,20 +28,8 @@ enum {
     SKEY_PGPSIG_PERSONAL = 0x0002
 };
 
-#define SEAHORSE_PGP_TYPE_KEY            (seahorse_pgp_key_get_type ())
-#define SEAHORSE_PGP_KEY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_PGP_TYPE_KEY, 
SeahorsePgpKey))
-#define SEAHORSE_PGP_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_PGP_TYPE_KEY, 
SeahorsePgpKeyClass))
-#define SEAHORSE_PGP_IS_KEY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_PGP_TYPE_KEY))
-#define SEAHORSE_PGP_IS_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_PGP_TYPE_KEY))
-#define SEAHORSE_PGP_KEY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_PGP_TYPE_KEY, 
SeahorsePgpKeyClass))
-
-
-typedef struct _SeahorsePgpKey SeahorsePgpKey;
-typedef struct _SeahorsePgpKeyClass SeahorsePgpKeyClass;
-
-struct _SeahorsePgpKey {
-    SeahorseObject parent;
-};
+#define SEAHORSE_PGP_TYPE_KEY (seahorse_pgp_key_get_type ())
+G_DECLARE_DERIVABLE_TYPE (SeahorsePgpKey, seahorse_pgp_key, SEAHORSE_PGP, KEY, SeahorseObject)
 
 struct _SeahorsePgpKeyClass {
     SeahorseObjectClass parent_class;
@@ -49,18 +37,14 @@ struct _SeahorsePgpKeyClass {
     /* virtual methods */
     GList* (*get_uids) (SeahorsePgpKey *self);
     void   (*set_uids) (SeahorsePgpKey *self, GList *uids);
-    
+
     GList* (*get_subkeys) (SeahorsePgpKey *self);
     void   (*set_subkeys) (SeahorsePgpKey *self, GList *uids);
-    
+
     GList* (*get_photos) (SeahorsePgpKey *self);
     void   (*set_photos) (SeahorsePgpKey *self, GList *uids);
 };
 
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (SeahorsePgpKey, g_object_unref)
-
-GType             seahorse_pgp_key_get_type             (void);
-
 SeahorsePgpKey *  seahorse_pgp_key_new                  (void);
 
 void              seahorse_pgp_key_realize              (SeahorsePgpKey *self);
@@ -80,7 +64,7 @@ GList*            seahorse_pgp_key_get_photos           (SeahorsePgpKey *self);
 void              seahorse_pgp_key_set_photos           (SeahorsePgpKey *self,
                                                          GList *subkeys);
 
-const gchar*      seahorse_pgp_key_get_fingerprint      (SeahorsePgpKey *self);
+const char*       seahorse_pgp_key_get_fingerprint      (SeahorsePgpKey *self);
 
 SeahorseValidity  seahorse_pgp_key_get_validity         (SeahorsePgpKey *self);
 
@@ -90,12 +74,12 @@ SeahorseValidity  seahorse_pgp_key_get_trust            (SeahorsePgpKey *self);
 
 guint             seahorse_pgp_key_get_length           (SeahorsePgpKey *self);
 
-const gchar*      seahorse_pgp_key_get_algo             (SeahorsePgpKey *self);
+const char*       seahorse_pgp_key_get_algo             (SeahorsePgpKey *self);
 
-const gchar*      seahorse_pgp_key_get_keyid            (SeahorsePgpKey *self);
+const char*       seahorse_pgp_key_get_keyid            (SeahorsePgpKey *self);
 
 gboolean          seahorse_pgp_key_has_keyid            (SeahorsePgpKey *self,
-                                                         const gchar *keyid);
+                                                         const char     *keyid);
 
 const char*       seahorse_pgp_key_calc_identifier      (const char *keyid);
 
diff --git a/pgp/seahorse-pgp-photo.h b/pgp/seahorse-pgp-photo.h
index 4a9e8dc6..fb5151c8 100644
--- a/pgp/seahorse-pgp-photo.h
+++ b/pgp/seahorse-pgp-photo.h
@@ -28,7 +28,7 @@ G_DECLARE_DERIVABLE_TYPE (SeahorsePgpPhoto, seahorse_pgp_photo,
                           GObject);
 
 struct _SeahorsePgpPhotoClass {
-       GObjectClass parent_class;
+    GObjectClass parent_class;
 };
 
 SeahorsePgpPhoto*   seahorse_pgp_photo_new               (GdkPixbuf *pixbuf);
diff --git a/pgp/seahorse-pgp-uid.c b/pgp/seahorse-pgp-uid.c
index ed5309c7..cc431f1f 100644
--- a/pgp/seahorse-pgp-uid.c
+++ b/pgp/seahorse-pgp-uid.c
@@ -39,15 +39,15 @@ enum {
     PROP_COMMENT
 };
 
-struct _SeahorsePgpUidPrivate {
+typedef struct _SeahorsePgpUidPrivate {
     SeahorsePgpKey *parent;
     GList *signatures;
     SeahorseValidity validity;
     gboolean realized;
-    gchar *name;
-    gchar *email;
-    gchar *comment;
-};
+    char *name;
+    char *email;
+    char *comment;
+} SeahorsePgpUidPrivate;
 
 G_DEFINE_TYPE_WITH_PRIVATE (SeahorsePgpUid, seahorse_pgp_uid, SEAHORSE_TYPE_OBJECT);
 
diff --git a/pgp/seahorse-pgp-uid.h b/pgp/seahorse-pgp-uid.h
index b3a31de9..26b90629 100644
--- a/pgp/seahorse-pgp-uid.h
+++ b/pgp/seahorse-pgp-uid.h
@@ -26,31 +26,14 @@
 #include "seahorse-pgp-key.h"
 
 #define SEAHORSE_PGP_TYPE_UID            (seahorse_pgp_uid_get_type ())
-
-#define SEAHORSE_PGP_UID(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_PGP_TYPE_UID, 
SeahorsePgpUid))
-#define SEAHORSE_PGP_UID_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_PGP_TYPE_UID, 
SeahorsePgpUidClass))
-#define SEAHORSE_PGP_IS_UID(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_PGP_TYPE_UID))
-#define SEAHORSE_PGP_IS_UID_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_PGP_TYPE_UID))
-#define SEAHORSE_PGP_UID_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_PGP_TYPE_UID, 
SeahorsePgpUidClass))
-
-typedef struct _SeahorsePgpUid SeahorsePgpUid;
-typedef struct _SeahorsePgpUidClass SeahorsePgpUidClass;
-typedef struct _SeahorsePgpUidPrivate SeahorsePgpUidPrivate;
-
-struct _SeahorsePgpUid {
-       SeahorseObject parent;
-};
+G_DECLARE_DERIVABLE_TYPE (SeahorsePgpUid, seahorse_pgp_uid, SEAHORSE_PGP, UID, SeahorseObject)
 
 struct _SeahorsePgpUidClass {
-       SeahorseObjectClass parent_class;
+    SeahorseObjectClass parent_class;
 };
 
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (SeahorsePgpUid, g_object_unref)
-
-GType             seahorse_pgp_uid_get_type             (void);
-
 SeahorsePgpUid*   seahorse_pgp_uid_new                  (SeahorsePgpKey *parent,
-                                                         const gchar *uid_string);
+                                                         const char     *uid_string);
 
 SeahorsePgpKey *  seahorse_pgp_uid_get_parent           (SeahorsePgpUid *self);
 
@@ -66,29 +49,29 @@ SeahorseValidity  seahorse_pgp_uid_get_validity         (SeahorsePgpUid *self);
 void              seahorse_pgp_uid_set_validity         (SeahorsePgpUid *self,
                                                          SeahorseValidity validity);
 
-const gchar*      seahorse_pgp_uid_get_name             (SeahorsePgpUid *self);
+const char *      seahorse_pgp_uid_get_name             (SeahorsePgpUid *self);
 
 void              seahorse_pgp_uid_set_name             (SeahorsePgpUid *self,
-                                                         const gchar *name);
+                                                         const char     *name);
 
-const gchar*      seahorse_pgp_uid_get_email            (SeahorsePgpUid *self);
+const char *      seahorse_pgp_uid_get_email            (SeahorsePgpUid *self);
 
 void              seahorse_pgp_uid_set_email            (SeahorsePgpUid *self,
-                                                         const gchar *comment);
+                                                         const char     *comment);
 
-const gchar*      seahorse_pgp_uid_get_comment          (SeahorsePgpUid *self);
+const char *      seahorse_pgp_uid_get_comment          (SeahorsePgpUid *self);
 
 void              seahorse_pgp_uid_set_comment          (SeahorsePgpUid *self,
-                                                         const gchar *comment);
+                                                         const char     *comment);
 
-gchar*            seahorse_pgp_uid_calc_label           (const gchar *name,
-                                                         const gchar *email,
-                                                         const gchar *comment);
+char *            seahorse_pgp_uid_calc_label           (const char *name,
+                                                         const char *email,
+                                                         const char *comment);
 
-gchar*            seahorse_pgp_uid_calc_markup          (const gchar *name,
-                                                         const gchar *email,
-                                                         const gchar *comment,
-                                                         guint flags);
+char *            seahorse_pgp_uid_calc_markup          (const char *name,
+                                                         const char *email,
+                                                         const char *comment,
+                                                         guint       flags);
 
 GQuark            seahorse_pgp_uid_calc_id              (GQuark key_id,
                                                          guint index);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]