mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-06 11:35:32 +00:00
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:
parent
50847dfe43
commit
f206b7d257
15 changed files with 122 additions and 122 deletions
|
@ -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",
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -24,13 +24,13 @@ test_dummy_call_object (CallFixture *fixture,
|
|||
|
||||
|
||||
static void
|
||||
test_dummy_call_get_number (CallFixture *fixture,
|
||||
test_dummy_call_get_id (CallFixture *fixture,
|
||||
gconstpointer user_data)
|
||||
{
|
||||
const gchar *number;
|
||||
number = calls_call_get_number (CALLS_CALL (fixture->dummy_call));
|
||||
g_assert_nonnull (number);
|
||||
g_assert_cmpstr (number, ==, TEST_CALL_NUMBER);
|
||||
const char *id;
|
||||
id = calls_call_get_id (CALLS_CALL (fixture->dummy_call));
|
||||
g_assert_nonnull (id);
|
||||
g_assert_cmpstr (id, ==, TEST_CALL_NUMBER);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -71,7 +71,7 @@ main (gint argc,
|
|||
#define add_test(name) add_calls_test(Call, call, name)
|
||||
|
||||
add_test(object);
|
||||
add_test(get_number);
|
||||
add_test(get_id);
|
||||
add_test(get_state);
|
||||
add_test(hang_up);
|
||||
|
||||
|
|
Loading…
Reference in a new issue