call: Rename property from "number" to "id"

The term number is not necessarily accurate when dealing with f.e. SIP.
This commit is contained in:
Evangelos Ribeiro Tzaras
2021-10-22 07:21:11 +02:00
parent 50847dfe43
commit f206b7d257
15 changed files with 122 additions and 122 deletions

View File

@@ -32,7 +32,7 @@
struct _CallsDummyCall
{
GObject parent_instance;
gchar *number;
gchar *id;
gboolean inbound;
CallsCallState state;
};
@@ -45,7 +45,7 @@ G_DEFINE_TYPE_WITH_CODE (CallsDummyCall, calls_dummy_call, CALLS_TYPE_CALL,
enum {
PROP_0,
PROP_NUMBER_CONSTRUCTOR,
PROP_ID_CONSTRUCTOR,
PROP_INBOUND_CONSTRUCTOR,
PROP_LAST_PROP
};
@@ -71,11 +71,11 @@ change_state (CallsDummyCall *self,
}
static const char *
calls_dummy_call_get_number (CallsCall *call)
calls_dummy_call_get_id (CallsCall *call)
{
CallsDummyCall *self = CALLS_DUMMY_CALL (call);
return self->number;
return self->id;
}
static CallsCallState
@@ -157,13 +157,13 @@ outbound_timeout_cb (CallsDummyCall *self)
CallsDummyCall *
calls_dummy_call_new (const gchar *number,
calls_dummy_call_new (const gchar *id,
gboolean inbound)
{
g_return_val_if_fail (number != NULL, NULL);
g_return_val_if_fail (id != NULL, NULL);
return g_object_new (CALLS_TYPE_DUMMY_CALL,
"number-constructor", number,
"id-constructor", id,
"inbound-constructor", inbound,
NULL);
}
@@ -178,8 +178,8 @@ set_property (GObject *object,
CallsDummyCall *self = CALLS_DUMMY_CALL (object);
switch (property_id) {
case PROP_NUMBER_CONSTRUCTOR:
self->number = g_value_dup_string (value);
case PROP_ID_CONSTRUCTOR:
self->id = g_value_dup_string (value);
break;
case PROP_INBOUND_CONSTRUCTOR:
@@ -216,7 +216,7 @@ finalize (GObject *object)
{
CallsDummyCall *self = CALLS_DUMMY_CALL (object);
g_free (self->number);
g_free (self->id);
G_OBJECT_CLASS (calls_dummy_call_parent_class)->finalize (object);
}
@@ -232,7 +232,7 @@ calls_dummy_call_class_init (CallsDummyCallClass *klass)
object_class->constructed = constructed;
object_class->finalize = finalize;
call_class->get_number = calls_dummy_call_get_number;
call_class->get_id = calls_dummy_call_get_id;
call_class->get_state = calls_dummy_call_get_state;
call_class->get_inbound = calls_dummy_call_get_inbound;
call_class->get_protocol = calls_dummy_call_get_protocol;
@@ -240,13 +240,13 @@ calls_dummy_call_class_init (CallsDummyCallClass *klass)
call_class->hang_up = calls_dummy_call_hang_up;
call_class->send_dtmf_tone = calls_dummy_call_send_dtmf_tone;
props[PROP_NUMBER_CONSTRUCTOR] =
g_param_spec_string ("number-constructor",
"Number (constructor)",
"The dialed number (dummy class constructor)",
props[PROP_ID_CONSTRUCTOR] =
g_param_spec_string ("id-constructor",
"Id (constructor)",
"The dialed id (dummy class constructor)",
"+441234567890",
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_NUMBER_CONSTRUCTOR, props[PROP_NUMBER_CONSTRUCTOR]);
g_object_class_install_property (object_class, PROP_ID_CONSTRUCTOR, props[PROP_ID_CONSTRUCTOR]);
props[PROP_INBOUND_CONSTRUCTOR] =
g_param_spec_boolean ("inbound-constructor",

View File

@@ -37,7 +37,7 @@ struct _CallsMMCall
{
GObject parent_instance;
MMCall *mm_call;
GString *number;
GString *id;
CallsCallState state;
gchar *disconnect_reason;
};
@@ -76,11 +76,11 @@ change_state (CallsMMCall *self,
static void
notify_number_cb (CallsMMCall *self,
const gchar *number)
notify_id_cb (CallsMMCall *self,
const gchar *id)
{
g_string_assign (self->number, number);
g_object_notify (G_OBJECT (self), "number");
g_string_assign (self->id, id);
g_object_notify (G_OBJECT (self), "id");
}
@@ -101,7 +101,7 @@ static const struct CallsMMCallStateReasonMap STATE_REASON_MAP[] = {
row (ACCEPTED, N_("Call accepted")),
row (TERMINATED, N_("Call ended")),
row (REFUSED_OR_BUSY, N_("Call disconnected (busy or call refused)")),
row (ERROR, N_("Call disconnected (wrong number or network problem)")),
row (ERROR, N_("Call disconnected (wrong id or network problem)")),
row (AUDIO_SETUP_FAILED, N_("Call disconnected (error setting up audio channel)")),
row (TRANSFERRED, N_("Call transferred")),
row (DEFLECTED, N_("Call deflected")),
@@ -192,11 +192,11 @@ state_changed_cb (CallsMMCall *self,
}
static const char *
calls_mm_call_get_number (CallsCall *call)
calls_mm_call_get_id (CallsCall *call)
{
CallsMMCall *self = CALLS_MM_CALL (call);
return self->number->str;
return self->id->str;
}
static CallsCallState
@@ -243,7 +243,7 @@ operation_cb (MMCall *mm_call,
if (!ok)
{
g_warning ("Error %s ModemManager call to `%s': %s",
data->desc, data->self->number->str, error->message);
data->desc, data->self->id->str, error->message);
CALLS_ERROR (data->self, error);
}
@@ -324,11 +324,11 @@ constructed (GObject *object)
MMCallState state;
g_signal_connect_swapped (gdbus_call, "notify::number",
G_CALLBACK (notify_number_cb), self);
G_CALLBACK (notify_id_cb), self);
g_signal_connect_swapped (gdbus_call, "state-changed",
G_CALLBACK (state_changed_cb), self);
notify_number_cb (self, mm_call_get_number (self->mm_call));
notify_id_cb (self, mm_call_get_number (self->mm_call));
state = mm_call_get_state (self->mm_call);
state_changed_cb (self,
@@ -363,7 +363,7 @@ finalize (GObject *object)
CallsMMCall *self = CALLS_MM_CALL (object);
g_free (self->disconnect_reason);
g_string_free (self->number, TRUE);
g_string_free (self->id, TRUE);
G_OBJECT_CLASS (calls_mm_call_parent_class)->finalize (object);
}
@@ -380,7 +380,7 @@ calls_mm_call_class_init (CallsMMCallClass *klass)
object_class->dispose = dispose;
object_class->finalize = finalize;
call_class->get_number = calls_mm_call_get_number;
call_class->get_id = calls_mm_call_get_id;
call_class->get_state = calls_mm_call_get_state;
call_class->get_inbound = calls_mm_call_get_inbound;
call_class->get_protocol = calls_mm_call_get_protocol;
@@ -405,7 +405,7 @@ calls_mm_call_message_source_interface_init (CallsMessageSourceInterface *iface)
static void
calls_mm_call_init (CallsMMCall *self)
{
self->number = g_string_new (NULL);
self->id = g_string_new (NULL);
}

View File

@@ -35,7 +35,7 @@ struct _CallsOfonoCall
{
GObject parent_instance;
GDBOVoiceCall *voice_call;
gchar *number;
gchar *id;
gchar *name;
CallsCallState state;
gchar *disconnect_reason;
@@ -85,11 +85,11 @@ change_state (CallsOfonoCall *self,
}
static const char *
calls_ofono_call_get_number (CallsCall *call)
calls_ofono_call_get_id (CallsCall *call)
{
CallsOfonoCall *self = CALLS_OFONO_CALL (call);
return self->number;
return self->id;
}
static const char *
@@ -142,7 +142,7 @@ operation_cb (GDBOVoiceCall *voice_call,
if (!ok)
{
g_warning ("Error %s oFono voice call to `%s': %s",
data->desc, data->self->number, error->message);
data->desc, data->self->id, error->message);
CALLS_ERROR (data->self, error);
}
@@ -194,7 +194,7 @@ calls_ofono_call_send_dtmf_tone (CallsCall *call, gchar key)
if (self->state != CALLS_CALL_STATE_ACTIVE)
{
g_warning ("Tone start requested for non-active call to `%s'",
self->number);
self->id);
return;
}
@@ -210,7 +210,7 @@ set_properties (CallsOfonoCall *self,
g_return_if_fail (call_props != NULL);
g_variant_lookup (call_props, "LineIdentification", "s", &self->number);
g_variant_lookup (call_props, "LineIdentification", "s", &self->id);
g_variant_lookup (call_props, "Name", "s", &self->name);
g_variant_lookup (call_props, "State", "&s", &str);
@@ -261,7 +261,7 @@ property_changed_cb (CallsOfonoCall *self,
{
gchar *text = g_variant_print (value, TRUE);
g_debug ("Property `%s' for oFono call to `%s' changed to: %s",
name, self->number, text);
name, self->id, text);
g_free (text);
}
@@ -283,7 +283,7 @@ property_changed_cb (CallsOfonoCall *self,
{
g_warning ("Could not parse new state `%s'"
" of oFono call to `%s'",
str, self->number);
str, self->id);
}
g_variant_unref (str_var);
@@ -337,7 +337,7 @@ finalize (GObject *object)
g_free (self->disconnect_reason);
g_free (self->name);
g_free (self->number);
g_free (self->id);
G_OBJECT_CLASS (calls_ofono_call_parent_class)->finalize (object);
}
@@ -355,7 +355,7 @@ calls_ofono_call_class_init (CallsOfonoCallClass *klass)
object_class->dispose = dispose;
object_class->finalize = finalize;
call_class->get_number = calls_ofono_call_get_number;
call_class->get_id = calls_ofono_call_get_id;
call_class->get_name = calls_ofono_call_get_name;
call_class->get_state = calls_ofono_call_get_state;
call_class->get_inbound = calls_ofono_call_get_inbound;

View File

@@ -57,7 +57,7 @@ static GParamSpec *props[PROP_LAST_PROP];
struct _CallsSipCall
{
GObject parent_instance;
gchar *number;
gchar *id;
gboolean inbound;
CallsCallState state;
@@ -118,11 +118,11 @@ try_setting_up_media_pipeline (CallsSipCall *self)
}
static const char *
calls_sip_call_get_number (CallsCall *call)
calls_sip_call_get_id (CallsCall *call)
{
CallsSipCall *self = CALLS_SIP_CALL (call);
return self->number;
return self->id;
}
@@ -149,7 +149,7 @@ calls_sip_call_get_protocol (CallsCall *call)
{
CallsSipCall *self = CALLS_SIP_CALL (call);
return get_protocol_from_address (self->number);
return get_protocol_from_address (self->id);
}
@@ -274,7 +274,7 @@ calls_sip_call_finalize (GObject *object)
{
CallsSipCall *self = CALLS_SIP_CALL (object);
g_free (self->number);
g_free (self->id);
if (self->pipeline) {
calls_sip_media_pipeline_stop (self->pipeline);
@@ -297,7 +297,7 @@ calls_sip_call_class_init (CallsSipCallClass *klass)
object_class->set_property = calls_sip_call_set_property;
object_class->finalize = calls_sip_call_finalize;
call_class->get_number = calls_sip_call_get_number;
call_class->get_id = calls_sip_call_get_id;
call_class->get_state = calls_sip_call_get_state;
call_class->get_inbound = calls_sip_call_get_inbound;
call_class->get_protocol = calls_sip_call_get_protocol;
@@ -394,19 +394,19 @@ calls_sip_call_activate_media (CallsSipCall *self,
CallsSipCall *
calls_sip_call_new (const gchar *number,
calls_sip_call_new (const gchar *id,
gboolean inbound,
nua_handle_t *handle)
{
CallsSipCall *call;
g_return_val_if_fail (number != NULL, NULL);
g_return_val_if_fail (id != NULL, NULL);
call = g_object_new (CALLS_TYPE_SIP_CALL,
"nua-handle", handle,
NULL);
call->number = g_strdup (number);
call->id = g_strdup (id);
call->inbound = inbound;
if (inbound)