1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-12-12 07:37:35 +00:00

call-record: Get rid of macros

While these macros are not too bad, they will still be removed for the sake
of consistency (no other purism project uses macros this heavily).

Fixes part of #214
This commit is contained in:
Evangelos Ribeiro Tzaras 2021-04-12 11:20:30 +02:00
parent 70cb120951
commit 042478a8eb

View file

@ -72,20 +72,29 @@ get_property (GObject *object,
switch (property_id) { switch (property_id) {
#define case_set(prop,type,member) \ case PROP_ID:
case PROP_##prop: \ g_value_set_uint (value, self->id);
g_value_set_##type (value, self->member); \ break;
break;
case_set(ID, uint, id); case PROP_TARGET:
case_set(TARGET, string, target); g_value_set_string (value, self->target);
case_set(INBOUND, boolean, inbound); break;
case_set(START, boxed, start);
case_set(ANSWERED, boxed, answered);
case_set(END, boxed, end);
#undef case_set case PROP_INBOUND:
g_value_set_boolean (value, self->inbound);
break;
case PROP_START:
g_value_set_boxed (value, self->start);
break;
case PROP_ANSWERED:
g_value_set_boxed (value, self->answered);
break;
case PROP_END:
g_value_set_boxed (value, self->end);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@ -184,11 +193,6 @@ calls_call_record_class_init (CallsCallRecordClass *klass)
gom_resource_class_set_table (resource_class, "calls"); gom_resource_class_set_table (resource_class, "calls");
#define install(NAME) \
g_object_class_install_property \
(object_class, PROP_##NAME, props[PROP_##NAME])
/* /*
* NB: ANY ADDITIONS TO THIS LIST REQUIRE AN INCREASE IN * NB: ANY ADDITIONS TO THIS LIST REQUIRE AN INCREASE IN
* RECORD_STORE_VERSION IN calls-record-store.c AND THE USE OF * RECORD_STORE_VERSION IN calls-record-store.c AND THE USE OF
@ -205,7 +209,8 @@ calls_call_record_class_init (CallsCallRecordClass *klass)
"The row ID", "The row ID",
0, G_MAXUINT, 0, 0, G_MAXUINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT); G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
install (ID);
g_object_class_install_property (object_class, PROP_ID, props[PROP_ID]);
gom_resource_class_set_primary_key (resource_class, "id"); gom_resource_class_set_primary_key (resource_class, "id");
props[PROP_TARGET] = props[PROP_TARGET] =
@ -214,7 +219,8 @@ calls_call_record_class_init (CallsCallRecordClass *klass)
"The PTSN phone number or other address of the call", "The PTSN phone number or other address of the call",
NULL, NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT); G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
install (TARGET);
g_object_class_install_property (object_class, PROP_TARGET, props[PROP_TARGET]);
props[PROP_INBOUND] = props[PROP_INBOUND] =
g_param_spec_boolean ("inbound", g_param_spec_boolean ("inbound",
@ -222,7 +228,8 @@ calls_call_record_class_init (CallsCallRecordClass *klass)
"Whether the call was an inbound call", "Whether the call was an inbound call",
FALSE, FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT); G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
install (INBOUND);
g_object_class_install_property (object_class, PROP_INBOUND, props[PROP_INBOUND]);
props[PROP_START] = props[PROP_START] =
g_param_spec_boxed ("start", g_param_spec_boxed ("start",
@ -230,7 +237,8 @@ calls_call_record_class_init (CallsCallRecordClass *klass)
"Time stamp of the start of the call", "Time stamp of the start of the call",
G_TYPE_DATE_TIME, G_TYPE_DATE_TIME,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT); G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
install (START);
g_object_class_install_property (object_class, PROP_START, props[PROP_START]);
props[PROP_ANSWERED] = props[PROP_ANSWERED] =
g_param_spec_boxed ("answered", g_param_spec_boxed ("answered",
@ -238,7 +246,8 @@ calls_call_record_class_init (CallsCallRecordClass *klass)
"Time stamp of when the call was answered", "Time stamp of when the call was answered",
G_TYPE_DATE_TIME, G_TYPE_DATE_TIME,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT); G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
install (ANSWERED);
g_object_class_install_property (object_class, PROP_ANSWERED, props[PROP_ANSWERED]);
props[PROP_END] = props[PROP_END] =
g_param_spec_boxed ("end", g_param_spec_boxed ("end",
@ -246,7 +255,9 @@ calls_call_record_class_init (CallsCallRecordClass *klass)
"Time stamp of the end of the call", "Time stamp of the end of the call",
G_TYPE_DATE_TIME, G_TYPE_DATE_TIME,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT); G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
install (END);
g_object_class_install_property (object_class, PROP_END, props[PROP_END]);
/* /*
* NB: ANY ADDITIONS TO THIS LIST REQUIRE AN INCREASE IN * NB: ANY ADDITIONS TO THIS LIST REQUIRE AN INCREASE IN
@ -258,7 +269,6 @@ calls_call_record_class_init (CallsCallRecordClass *klass)
* HERE. * HERE.
*/ */
#undef install
} }