mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-06 03:25:31 +00:00
parent
66224c9a48
commit
fbbe17139d
6 changed files with 44 additions and 1 deletions
|
@ -397,6 +397,7 @@ on_apply_clicked (CallsSipAccountWidget *self)
|
|||
gtk_entry_get_text (self->display_name),
|
||||
get_selected_protocol (self),
|
||||
get_port (self),
|
||||
FALSE,
|
||||
TRUE);
|
||||
|
||||
update_header (self);
|
||||
|
|
|
@ -74,6 +74,7 @@ enum {
|
|||
PROP_ACC_ADDRESS,
|
||||
PROP_CALLS,
|
||||
PROP_COUNTRY_CODE,
|
||||
PROP_CAN_TEL,
|
||||
PROP_LAST_PROP,
|
||||
};
|
||||
static GParamSpec *props[PROP_LAST_PROP];
|
||||
|
@ -109,6 +110,7 @@ struct _CallsSipOrigin
|
|||
char *transport_protocol;
|
||||
gboolean auto_connect;
|
||||
gboolean direct_mode;
|
||||
gboolean can_tel;
|
||||
gint local_port;
|
||||
|
||||
const char *protocol_prefix;
|
||||
|
@ -1102,10 +1104,13 @@ supports_protocol (CallsOrigin *origin,
|
|||
|
||||
if (g_strcmp0 (protocol, "sip") == 0)
|
||||
return TRUE;
|
||||
|
||||
if (g_strcmp0 (protocol, "sips") == 0)
|
||||
return g_strcmp0 (self->protocol_prefix, "sips") == 0;
|
||||
|
||||
/* TODO need to set a property (from the UI) to allow using origin for telephony */
|
||||
if (g_strcmp0 (protocol, "tel") == 0)
|
||||
return self->can_tel;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1184,6 +1189,10 @@ calls_sip_origin_set_property (GObject *object,
|
|||
self->local_port = g_value_get_int (value);
|
||||
break;
|
||||
|
||||
case PROP_CAN_TEL:
|
||||
self->can_tel = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
|
@ -1256,6 +1265,10 @@ calls_sip_origin_get_property (GObject *object,
|
|||
g_value_set_string (value, NULL);
|
||||
break;
|
||||
|
||||
case PROP_CAN_TEL:
|
||||
g_value_set_boolean (value, self->can_tel);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
|
@ -1407,6 +1420,14 @@ calls_sip_origin_class_init (CallsSipOriginClass *klass)
|
|||
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
|
||||
g_object_class_install_property (object_class, PROP_SIP_CONTEXT, props[PROP_SIP_CONTEXT]);
|
||||
|
||||
props[PROP_CAN_TEL] =
|
||||
g_param_spec_boolean ("can-tel",
|
||||
"Can telephone",
|
||||
"Whether to this account can be used for PSTN telephony",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
g_object_class_install_property (object_class, PROP_CAN_TEL, props[PROP_CAN_TEL]);
|
||||
|
||||
g_object_class_override_property (object_class, PROP_ACC_STATE, "account-state");
|
||||
props[PROP_ACC_STATE] = g_object_class_find_property (object_class, "account-state");
|
||||
|
||||
|
@ -1472,6 +1493,7 @@ calls_sip_origin_set_credentials (CallsSipOrigin *self,
|
|||
const char *display_name,
|
||||
const char *transport_protocol,
|
||||
gint port,
|
||||
gboolean can_tel,
|
||||
gboolean auto_connect)
|
||||
{
|
||||
g_return_if_fail (CALLS_IS_SIP_ORIGIN (self));
|
||||
|
@ -1509,5 +1531,7 @@ calls_sip_origin_set_credentials (CallsSipOrigin *self,
|
|||
|
||||
self->port = port;
|
||||
|
||||
self->can_tel = can_tel;
|
||||
|
||||
recreate_sip (self);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ void calls_sip_origin_set_credentials (CallsSipOrigin *sel
|
|||
const char *display_name,
|
||||
const char *transport_protocol,
|
||||
gint port,
|
||||
gboolean use_for_tel,
|
||||
gboolean auto_connect);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -114,6 +114,7 @@ on_origin_pw_looked_up (GObject *source,
|
|||
gint local_port = 0;
|
||||
gboolean auto_connect = TRUE;
|
||||
gboolean direct_mode = FALSE;
|
||||
gboolean can_tel = FALSE;
|
||||
|
||||
g_assert (user_data);
|
||||
|
||||
|
@ -136,6 +137,10 @@ on_origin_pw_looked_up (GObject *source,
|
|||
if (g_key_file_has_key (data->key_file, data->name, "DirectMode", NULL))
|
||||
direct_mode = g_key_file_get_boolean (data->key_file, data->name, "DirectMode", NULL);
|
||||
|
||||
if (g_key_file_has_key (data->key_file, data->name, "CanTel", NULL))
|
||||
can_tel =
|
||||
g_key_file_get_boolean (data->key_file, data->name, "CanTel", NULL);
|
||||
|
||||
/* PW */
|
||||
password = secret_password_lookup_finish (result, &error);
|
||||
if (!direct_mode && error) {
|
||||
|
@ -164,6 +169,7 @@ on_origin_pw_looked_up (GObject *source,
|
|||
auto_connect,
|
||||
direct_mode,
|
||||
local_port,
|
||||
can_tel,
|
||||
FALSE);
|
||||
}
|
||||
static void
|
||||
|
@ -265,6 +271,7 @@ origin_to_keyfile (CallsSipOrigin *origin,
|
|||
gint local_port;
|
||||
gboolean auto_connect;
|
||||
gboolean direct_mode;
|
||||
gboolean can_tel;
|
||||
|
||||
g_assert (CALLS_IS_SIP_ORIGIN (origin));
|
||||
g_assert (key_file);
|
||||
|
@ -279,6 +286,7 @@ origin_to_keyfile (CallsSipOrigin *origin,
|
|||
"auto-connect", &auto_connect,
|
||||
"direct-mode", &direct_mode,
|
||||
"local-port", &local_port,
|
||||
"can-tel", &can_tel,
|
||||
NULL);
|
||||
|
||||
g_key_file_set_string (key_file, name, "Host", host);
|
||||
|
@ -289,6 +297,7 @@ origin_to_keyfile (CallsSipOrigin *origin,
|
|||
g_key_file_set_boolean (key_file, name, "AutoConnect", auto_connect);
|
||||
g_key_file_set_boolean (key_file, name, "DirectMode", direct_mode);
|
||||
g_key_file_set_integer (key_file, name, "LocalPort", local_port);
|
||||
g_key_file_set_boolean (key_file, name, "CanTel", can_tel);
|
||||
|
||||
label_secret = g_strdup_printf ("Calls Password for %s",
|
||||
calls_account_get_address (CALLS_ACCOUNT (origin)));
|
||||
|
@ -639,6 +648,7 @@ calls_sip_provider_add_origin (CallsSipProvider *self,
|
|||
TRUE,
|
||||
FALSE,
|
||||
0,
|
||||
FALSE,
|
||||
store_credentials);
|
||||
}
|
||||
|
||||
|
@ -653,6 +663,7 @@ calls_sip_provider_add_origin (CallsSipProvider *self,
|
|||
* @auto_connect: Whether to automatically try going online
|
||||
* @direct_mode: Whether to use direct connection mode. Useful when you don't want to
|
||||
* connect to a SIP server. Mostly useful for testing and debugging.
|
||||
* @can_tel: Whether this origin can be used for PSTN telephony
|
||||
* @store_credentials: Whether to store credentials for this origin to disk
|
||||
*
|
||||
* Adds a new origin (SIP account). If @direct_mode is %TRUE then @host, @user and
|
||||
|
@ -671,6 +682,7 @@ calls_sip_provider_add_origin_full (CallsSipProvider *self,
|
|||
gboolean auto_connect,
|
||||
gboolean direct_mode,
|
||||
gint local_port,
|
||||
gboolean can_tel,
|
||||
gboolean store_credentials)
|
||||
{
|
||||
g_autoptr (CallsSipOrigin) origin = NULL;
|
||||
|
@ -702,6 +714,7 @@ calls_sip_provider_add_origin_full (CallsSipProvider *self,
|
|||
"auto-connect", auto_connect,
|
||||
"direct-mode", direct_mode,
|
||||
"local-port", local_port,
|
||||
"can-tel", can_tel,
|
||||
NULL);
|
||||
|
||||
g_list_store_append (self->origins, origin);
|
||||
|
|
|
@ -55,6 +55,7 @@ CallsSipOrigin *calls_sip_provider_add_origin_full (CallsSipProvider *s
|
|||
gboolean auto_connect,
|
||||
gboolean direct_mode,
|
||||
gint local_port,
|
||||
gboolean use_for_tel,
|
||||
gboolean store_credentials);
|
||||
gboolean calls_sip_provider_remove_origin (CallsSipProvider *self,
|
||||
CallsSipOrigin *origin);
|
||||
|
|
|
@ -371,6 +371,7 @@ setup_sip_origins (SipFixture *fixture,
|
|||
FALSE,
|
||||
TRUE,
|
||||
5060,
|
||||
FALSE,
|
||||
FALSE);
|
||||
|
||||
fixture->origin_bob =
|
||||
|
@ -384,6 +385,7 @@ setup_sip_origins (SipFixture *fixture,
|
|||
FALSE,
|
||||
TRUE,
|
||||
5061,
|
||||
FALSE,
|
||||
FALSE);
|
||||
|
||||
fixture->origin_offline =
|
||||
|
@ -397,6 +399,7 @@ setup_sip_origins (SipFixture *fixture,
|
|||
FALSE,
|
||||
FALSE,
|
||||
0,
|
||||
FALSE,
|
||||
FALSE);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue