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

@@ -340,7 +340,7 @@ setup_contact (CallsCallRecordRow *self)
// Look up the best match object
contacts_provider = calls_manager_get_contacts_provider (calls_manager_get_default ());
self->contact = calls_contacts_provider_lookup_phone_number (contacts_provider, target);
self->contact = calls_contacts_provider_lookup_id (contacts_provider, target);
g_object_bind_property (self->contact, "name",
self->target, "label",

View File

@@ -135,12 +135,12 @@ calls_create_widget_cb (CallsCallSelectorItem *item,
static void
new_call_submitted_cb (CallsCallWindow *self,
CallsOrigin *origin,
const gchar *number,
const gchar *id,
CallsNewCallBox *new_call_box)
{
g_return_if_fail (CALLS_IS_CALL_WINDOW (self));
calls_origin_dial (origin, number);
calls_origin_dial (origin, id);
}
@@ -189,7 +189,7 @@ add_call (CallsCallWindow *self,
display = cui_call_display_new (CUI_CALL (call_data));
item = calls_call_selector_item_new (display);
gtk_stack_add_named (self->call_stack, GTK_WIDGET (display),
calls_call_get_number (call));
calls_call_get_id (call));
g_list_store_append (self->calls, item);

View File

@@ -36,7 +36,7 @@
* @short_description: A call.
* @Title: CallsCall
*
* This is the interface to a call. It has a number, name and a
* This is the interface to a call. It has a id, name and a
* state. Only the state changes after creation. If the state is
* #CALL_CALL_STATE_INCOMING, the call can be answered with #answer.
* The call can also be hung up at any time with #hang_up.
@@ -52,7 +52,7 @@ G_DEFINE_ABSTRACT_TYPE (CallsCall, calls_call, G_TYPE_OBJECT)
enum {
PROP_0,
PROP_INBOUND,
PROP_NUMBER,
PROP_ID,
PROP_NAME,
PROP_STATE,
PROP_PROTOCOL,
@@ -68,7 +68,7 @@ static GParamSpec *properties[N_PROPS];
static guint signals[N_SIGNALS];
static const char *
calls_call_real_get_number (CallsCall *self)
calls_call_real_get_id (CallsCall *self)
{
return NULL;
}
@@ -128,8 +128,8 @@ calls_call_get_property (GObject *object,
g_value_set_boolean (value, calls_call_get_inbound (self));
break;
case PROP_NUMBER:
g_value_set_string (value, calls_call_get_number (self));
case PROP_ID:
g_value_set_string (value, calls_call_get_id (self));
break;
case PROP_NAME:
@@ -156,7 +156,7 @@ calls_call_class_init (CallsCallClass *klass)
object_class->get_property = calls_call_get_property;
klass->get_number = calls_call_real_get_number;
klass->get_id = calls_call_real_get_id;
klass->get_name = calls_call_real_get_name;
klass->get_state = calls_call_real_get_state;
klass->get_inbound = calls_call_real_get_inbound;
@@ -172,10 +172,10 @@ calls_call_class_init (CallsCallClass *klass)
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
properties[PROP_NUMBER] =
g_param_spec_string ("number",
"Number",
"The number the call is connected to if known",
properties[PROP_ID] =
g_param_spec_string ("id",
"Id",
"The id the call is connected to if known",
NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -227,21 +227,21 @@ calls_call_init (CallsCall *self)
}
/**
* calls_call_get_number:
* calls_call_get_id:
* @self: a #CallsCall
*
* Get the number the call is connected to. It is possible that this
* could return NULL if the number is not known, for example if an
* Get the id the call is connected to. It is possible that this
* could return NULL if the id is not known, for example if an
* incoming PTSN call has no caller ID information.
*
* Returns: (transfer none): the number, or NULL
* Returns: (transfer none): the id, or NULL
*/
const char *
calls_call_get_number (CallsCall *self)
calls_call_get_id (CallsCall *self)
{
g_return_val_if_fail (CALLS_IS_CALL (self), NULL);
return CALLS_CALL_GET_CLASS (self)->get_number (self);
return CALLS_CALL_GET_CLASS (self)->get_id (self);
}
/**
@@ -251,7 +251,7 @@ calls_call_get_number (CallsCall *self)
* Get the name of the party the call is connected to, if the network
* provides it.
*
* Returns the number, or NULL
* Returns the id, or NULL
*/
const char *
calls_call_get_name (CallsCall *self)
@@ -379,7 +379,7 @@ calls_call_send_dtmf_tone (CallsCall *self,
* @self: a #CallsCall
*
* This a convenience function to optain the #CallsBestMatch matching the
* phone number of the #CallsCall.
* phone id of the #CallsCall.
*
* Returns: (transfer full): A #CallsBestMatch
*/
@@ -393,8 +393,8 @@ calls_call_get_contact (CallsCall *self)
contacts_provider =
calls_manager_get_contacts_provider (calls_manager_get_default ());
return calls_contacts_provider_lookup_phone_number (contacts_provider,
calls_call_get_number (self));
return calls_contacts_provider_lookup_id (contacts_provider,
calls_call_get_id (self));
}
void

View File

@@ -50,7 +50,7 @@ struct _CallsCallClass
{
GObjectClass parent_iface;
const char *(*get_number) (CallsCall *self);
const char *(*get_id) (CallsCall *self);
const char *(*get_name) (CallsCall *self);
CallsCallState (*get_state) (CallsCall *self);
gboolean (*get_inbound) (CallsCall *self);
@@ -61,17 +61,17 @@ struct _CallsCallClass
char key);
};
const char *calls_call_get_number (CallsCall *self);
const char *calls_call_get_name (CallsCall *self);
CallsCallState calls_call_get_state (CallsCall *self);
gboolean calls_call_get_inbound (CallsCall *self);
const char *calls_call_get_protocol (CallsCall *self);
void calls_call_answer (CallsCall *self);
void calls_call_hang_up (CallsCall *self);
gboolean calls_call_can_dtmf (CallsCall *self);
void calls_call_send_dtmf_tone (CallsCall *self,
gchar key);
CallsBestMatch * calls_call_get_contact (CallsCall *self);
const char *calls_call_get_id (CallsCall *self);
const char *calls_call_get_name (CallsCall *self);
CallsCallState calls_call_get_state (CallsCall *self);
gboolean calls_call_get_inbound (CallsCall *self);
const char *calls_call_get_protocol (CallsCall *self);
void calls_call_answer (CallsCall *self);
void calls_call_hang_up (CallsCall *self);
gboolean calls_call_can_dtmf (CallsCall *self);
void calls_call_send_dtmf_tone (CallsCall *self,
char key);
CallsBestMatch *calls_call_get_contact (CallsCall *self);
void calls_call_state_to_string (GString *string,
CallsCallState state);

View File

@@ -50,7 +50,7 @@ struct _CallsContactsProvider
FolksIndividualAggregator *folks_aggregator;
CallsSettings *settings;
GHashTable *phone_number_best_matches;
GHashTable *best_matches;
};
G_DEFINE_TYPE (CallsContactsProvider, calls_contacts_provider, G_TYPE_OBJECT)
@@ -195,7 +195,7 @@ calls_contacts_provider_finalize (GObject *object)
g_clear_object (&self->folks_aggregator);
g_clear_object (&self->settings);
g_clear_pointer (&self->phone_number_best_matches, g_hash_table_unref);
g_clear_pointer (&self->best_matches, g_hash_table_unref);
G_OBJECT_CLASS (calls_contacts_provider_parent_class)->finalize (object);
}
@@ -261,10 +261,10 @@ calls_contacts_provider_init (CallsContactsProvider *self)
folks_individual_aggregator_prepare (self->folks_aggregator, folks_prepare_cb, self);
self->phone_number_best_matches = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
g_object_unref);
self->best_matches = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
g_object_unref);
}
CallsContactsProvider *
@@ -289,23 +289,23 @@ calls_contacts_provider_get_individuals (CallsContactsProvider *self)
}
/*
* calls_contacts_provider_lookup_phone_number:
* calls_contacts_provider_lookup_id:
* @self: The #CallsContactsProvider
* @number: The phonenumber
* @id: The id (f.e. a phone number)
*
* Get a best contact match for a phone number
* Get a best contact match for a id
*
* Returns: (transfer full): The best match as #CallsBestMatch
*/
CallsBestMatch *
calls_contacts_provider_lookup_phone_number (CallsContactsProvider *self,
const gchar *number)
calls_contacts_provider_lookup_id (CallsContactsProvider *self,
const char *id)
{
g_autoptr (CallsBestMatch) best_match = NULL;
g_return_val_if_fail (CALLS_IS_CONTACTS_PROVIDER (self), NULL);
best_match = g_hash_table_lookup (self->phone_number_best_matches, number);
best_match = g_hash_table_lookup (self->best_matches, id);
if (best_match) {
g_object_ref (best_match);
@@ -313,13 +313,13 @@ calls_contacts_provider_lookup_phone_number (CallsContactsProvider *self,
return g_steal_pointer (&best_match);
}
best_match = calls_best_match_new (number);
best_match = calls_best_match_new (id);
g_object_bind_property (self->settings, "country-code",
best_match, "country-code",
G_BINDING_SYNC_CREATE);
g_hash_table_insert (self->phone_number_best_matches, g_strdup (number), g_object_ref (best_match));
g_hash_table_insert (self->best_matches, g_strdup (id), g_object_ref (best_match));
return g_steal_pointer (&best_match);
}

View File

@@ -52,8 +52,8 @@ G_DECLARE_FINAL_TYPE (CallsContactsProvider, calls_contacts_provider, CALLS, CON
CallsContactsProvider *calls_contacts_provider_new (CallsSettings *settings);
GeeCollection *calls_contacts_provider_get_individuals (CallsContactsProvider *self);
CallsBestMatch *calls_contacts_provider_lookup_phone_number (CallsContactsProvider *self,
const gchar *number);
CallsBestMatch *calls_contacts_provider_lookup_id (CallsContactsProvider *self,
const char *id);
void calls_contacts_provider_consume_iter_on_idle (GeeIterator *iter,
IdleCallback callback,
gpointer user_data);

View File

@@ -206,7 +206,7 @@ call_added_cb (CallsDBusManager *self, CallsCall *call)
NULL);
g_object_bind_property (call, "state", iface, "state", G_BINDING_SYNC_CREATE);
g_object_bind_property (call, "inbound", iface, "inbound", G_BINDING_SYNC_CREATE);
g_object_bind_property (call, "number", iface, "id", G_BINDING_SYNC_CREATE);
g_object_bind_property (call, "id", iface, "id", G_BINDING_SYNC_CREATE);
g_object_bind_property (call, "protocol", iface, "protocol", G_BINDING_SYNC_CREATE);
g_object_set (iface, "can-dtmf", calls_call_can_dtmf (call), NULL);
/* TODO: once calls supports encryption */

View File

@@ -51,8 +51,8 @@ notify (CallsNotifier *self, CallsCall *call)
g_autofree gchar *ref = NULL;
g_autofree gchar *label_callback = NULL;
const char *name;
const char *number;
gboolean got_number;
const char *id;
gboolean got_id;
#if GLIB_CHECK_VERSION(2,70,0)
g_notification_set_category (notification, "x-gnome.call.unanswered");
@@ -60,27 +60,27 @@ notify (CallsNotifier *self, CallsCall *call)
contact = calls_call_get_contact (call);
// TODO: We need to update the notification when the contact name changes
name = calls_best_match_get_name (contact);
number = calls_call_get_number (call);
id = calls_call_get_id (call);
got_number = !!number && (g_strcmp0 (number, "") != 0);
got_id = !!id && (g_strcmp0 (id, "") != 0);
if (calls_best_match_has_individual (contact))
/* %s is a name here */
msg = g_strdup_printf (_("Missed call from <b>%s</b>"), name);
else if (got_number)
/* %s is a number here */
msg = g_strdup_printf (_("Missed call from %s"), number);
else if (got_id)
/* %s is a id here */
msg = g_strdup_printf (_("Missed call from %s"), id);
else
msg = g_strdup (_("Missed call from unknown caller"));
g_notification_set_body (notification, msg);
if (got_number) {
label_callback = g_strdup_printf ("app.dial::%s", number);
if (got_id) {
label_callback = g_strdup_printf ("app.dial::%s", id);
g_notification_add_button (notification, _("Call back"), label_callback);
}
ref = g_strdup_printf ("missed-call-%s", number ?: "unknown");
ref = g_strdup_printf ("missed-call-%s", id ?: "unknown");
g_application_send_notification (app, ref, notification);
}

View File

@@ -446,7 +446,7 @@ record_call (CallsRecordStore *self,
record = g_object_new (CALLS_TYPE_CALL_RECORD,
"repository", self->repository,
"target", calls_call_get_number (call),
"target", calls_call_get_id (call),
"inbound", calls_call_get_inbound (call),
"protocol", calls_call_get_protocol (call),
"start", start,

View File

@@ -58,7 +58,7 @@ calls_ui_call_data_get_id (CuiCall *call_data)
g_return_val_if_fail (CALLS_IS_UI_CALL_DATA (self), NULL);
g_return_val_if_fail (!!self->call, NULL);
return calls_call_get_number (self->call);
return calls_call_get_id (self->call);
}
static CuiCallState
@@ -223,8 +223,8 @@ set_call_data (CallsUiCallData *self,
contacts_provider = calls_manager_get_contacts_provider (manager);
self->best_match =
calls_contacts_provider_lookup_phone_number (contacts_provider,
calls_call_get_number (call));
calls_contacts_provider_lookup_id (contacts_provider,
calls_call_get_id (call));
g_signal_connect_object (self->best_match,
"notify::name",