[file-roller/wip/jtojnar/gobject-modernization: 5/11] process: Use declare type macro
- From: Jan Tojnar <jtojnar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller/wip/jtojnar/gobject-modernization: 5/11] process: Use declare type macro
- Date: Fri, 12 Aug 2022 17:51:33 +0000 (UTC)
commit e030242d6205747f4f269475b6dfeb67a05658a8
Author: Jan Tojnar <jtojnar gmail com>
Date: Fri Aug 5 21:07:15 2022 +0200
process: Use declare type macro
Also make the class final. While at it, switch to g_signal_newv.
src/fr-process.c | 17 +++++++++--------
src/fr-process.h | 20 ++------------------
2 files changed, 11 insertions(+), 26 deletions(-)
---
diff --git a/src/fr-process.c b/src/fr-process.c
index a3ddc9f2..6c39592d 100644
--- a/src/fr-process.c
+++ b/src/fr-process.c
@@ -261,7 +261,7 @@ struct _FrProcessPrivate {
ExecuteData *exec_data;
};
-G_DEFINE_TYPE_WITH_PRIVATE (FrProcess, fr_process, G_TYPE_OBJECT)
+G_DEFINE_FINAL_TYPE_WITH_PRIVATE (FrProcess, fr_process, G_TYPE_OBJECT)
static void
@@ -293,13 +293,14 @@ fr_process_class_init (FrProcessClass *klass)
fr_process_parent_class = g_type_class_peek_parent (klass);
fr_process_signals[STICKY_ONLY] =
- g_signal_new ("sticky_only",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (FrProcessClass, sticky_only),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_newv ("sticky_only",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ /* class_closure = */ NULL,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0,
+ NULL);
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = fr_process_finalize;
diff --git a/src/fr-process.h b/src/fr-process.h
index 8d403ccd..3103501f 100644
--- a/src/fr-process.h
+++ b/src/fr-process.h
@@ -28,16 +28,9 @@
#include "fr-error.h"
#include "typedefs.h"
-#define FR_TYPE_PROCESS (fr_process_get_type ())
-#define FR_PROCESS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_PROCESS, FrProcess))
-#define FR_PROCESS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_PROCESS, FrProcessClass))
-#define FR_IS_PROCESS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_PROCESS))
-#define FR_IS_PROCESS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_PROCESS))
-#define FR_PROCESS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_PROCESS, FrProcessClass))
-
-typedef struct _FrProcess FrProcess;
-typedef struct _FrProcessClass FrProcessClass;
typedef struct _FrProcessPrivate FrProcessPrivate;
+#define FR_TYPE_PROCESS (fr_process_get_type ())
+G_DECLARE_FINAL_TYPE (FrProcess, fr_process, FR, PROCESS, GObject)
typedef void (*ProcFunc) (gpointer data);
typedef gboolean (*ContinueFunc) (FrError **error, gpointer data);
@@ -62,15 +55,6 @@ struct _FrProcess {
FrProcessPrivate *priv;
};
-struct _FrProcessClass {
- GObjectClass __parent_class;
-
- /* -- Signals -- */
-
- void (* sticky_only) (FrProcess *fr_proc);
-};
-
-GType fr_process_get_type (void);
FrProcess * fr_process_new (void);
void fr_process_clear (FrProcess *fr_proc);
void fr_process_begin_command (FrProcess *fr_proc,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]