gthreadedresolver: Port to G_DECLARE_FINAL_TYPE

The class and its header are not public, so this should not be an API or
ABI break.

This just simplifies the code a little and allows for easy extension of
the object’s private data in future commits.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall 2023-03-30 12:02:40 +01:00
parent bf92bae481
commit 6e499764e4
2 changed files with 14 additions and 15 deletions

View File

@ -38,6 +38,10 @@
#include "gsocketaddress.h"
#include "gsrvtarget.h"
struct _GThreadedResolver
{
GResolver parent_instance;
};
G_DEFINE_TYPE (GThreadedResolver, g_threaded_resolver, G_TYPE_RESOLVER)

View File

@ -21,28 +21,23 @@
#ifndef __G_THREADED_RESOLVER_H__
#define __G_THREADED_RESOLVER_H__
#include <gio/gio.h>
#include <gio/gresolver.h>
G_BEGIN_DECLS
/**
* GThreadedResolver:
*
* #GThreadedResolver is an implementation of #GResolver which calls the libc
* lookup functions in threads to allow them to run asynchronously.
*
* Since: 2.20
*/
#define G_TYPE_THREADED_RESOLVER (g_threaded_resolver_get_type ())
#define G_THREADED_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_THREADED_RESOLVER, GThreadedResolver))
#define G_THREADED_RESOLVER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_THREADED_RESOLVER, GThreadedResolverClass))
#define G_IS_THREADED_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_THREADED_RESOLVER))
#define G_IS_THREADED_RESOLVER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_THREADED_RESOLVER))
#define G_THREADED_RESOLVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_THREADED_RESOLVER, GThreadedResolverClass))
typedef struct {
GResolver parent_instance;
} GThreadedResolver;
typedef struct {
GResolverClass parent_class;
} GThreadedResolverClass;
GIO_AVAILABLE_IN_ALL
GType g_threaded_resolver_get_type (void) G_GNUC_CONST;
G_DECLARE_FINAL_TYPE (GThreadedResolver, g_threaded_resolver, G, THREADED_RESOLVER, GResolver)
/* Used for a private test API */
#ifdef G_OS_UNIX