Refactor: DECLARE_FINAL GncSxInstanceModel < GObject

This commit is contained in:
Richard Cohen 2023-06-28 13:26:09 +01:00
parent 9713683ee3
commit d30fdd8071
2 changed files with 12 additions and 19 deletions

View File

@ -90,6 +90,14 @@ typedef struct
gnc_numeric amount;
} ScrubItem;
enum
{
REMOVING, UPDATED, ADDED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
static void
scrub_sx_split_numeric (Split* split, gboolean is_credit, GList **changes)
{
@ -670,7 +678,7 @@ gnc_sx_instance_model_class_init (GncSxInstanceModelClass *klass)
object_class->dispose = gnc_sx_instance_model_dispose;
object_class->finalize = gnc_sx_instance_model_finalize;
klass->removing_signal_id =
signals[REMOVING] =
g_signal_new("removing",
GNC_TYPE_SX_INSTANCE_MODEL,
G_SIGNAL_RUN_FIRST,
@ -682,7 +690,7 @@ gnc_sx_instance_model_class_init (GncSxInstanceModelClass *klass)
1,
G_TYPE_POINTER);
klass->updated_signal_id =
signals[UPDATED] =
g_signal_new("updated",
GNC_TYPE_SX_INSTANCE_MODEL,
G_SIGNAL_RUN_FIRST,
@ -694,7 +702,7 @@ gnc_sx_instance_model_class_init (GncSxInstanceModelClass *klass)
1,
G_TYPE_POINTER);
klass->added_signal_id =
signals[ADDED] =
g_signal_new("added",
GNC_TYPE_SX_INSTANCE_MODEL,
G_SIGNAL_RUN_FIRST,

View File

@ -35,11 +35,7 @@
G_BEGIN_DECLS
#define GNC_TYPE_SX_INSTANCE_MODEL (gnc_sx_instance_model_get_type ())
#define GNC_SX_INSTANCE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_SX_INSTANCE_MODEL, GncSxInstanceModel))
#define GNC_SX_INSTANCE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_SX_INSTANCE_MODEL, GncSxInstanceModelClass))
#define GNC_IS_SX_INSTANCE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_SX_INSTANCE_MODEL))
#define GNC_IS_SX_INSTANCE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_SX_INSTANCE_MODEL))
#define GNC_SX_INSTANCE_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_SX_INSTANCE_MODEL, GncSxInstanceModelClass))
G_DECLARE_FINAL_TYPE (GncSxInstanceModel, gnc_sx_instance_model, GNC, SX_INSTANCE_MODEL, GObject)
typedef struct _GncSxInstanceModel
{
@ -59,15 +55,6 @@ typedef struct _GncSxInstanceModel
GList *sx_instance_list; /* <GncSxInstances*> */
} GncSxInstanceModel;
typedef struct _GncSxInstanceModelClass
{
GObjectClass parent;
guint removing_signal_id;
guint updated_signal_id;
guint added_signal_id;
} GncSxInstanceModelClass;
typedef struct _GncSxInstances
{
SchedXaction *sx;
@ -113,8 +100,6 @@ typedef struct _GncSxVariableNeeded
GncSxVariable *variable;
} GncSxVariableNeeded;
GType gnc_sx_instance_model_get_type(void);
/** Shorthand for get_instances(now, FALSE); */
GncSxInstanceModel* gnc_sx_get_current_instances(void);