mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-12-13 16:07:36 +00:00
call: Add "encrypted" property
This property indicates whether a call is using encryption.
This commit is contained in:
parent
e75e04fb4e
commit
be235189cc
3 changed files with 83 additions and 1 deletions
|
@ -54,6 +54,7 @@ enum {
|
|||
PROP_STATE,
|
||||
PROP_PROTOCOL,
|
||||
PROP_CALL_TYPE,
|
||||
PROP_ENCRYPTED,
|
||||
N_PROPS,
|
||||
};
|
||||
|
||||
|
@ -70,6 +71,7 @@ typedef struct {
|
|||
char *name;
|
||||
CallsCallState state;
|
||||
gboolean inbound;
|
||||
gboolean encrypted;
|
||||
CallsCallType call_type;
|
||||
} CallsCallPrivate;
|
||||
|
||||
|
@ -133,6 +135,10 @@ calls_call_set_property (GObject *object,
|
|||
priv->call_type = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
case PROP_ENCRYPTED:
|
||||
calls_call_set_encrypted (self, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
|
@ -172,6 +178,10 @@ calls_call_get_property (GObject *object,
|
|||
g_value_set_enum (value, calls_call_get_call_type (self));
|
||||
break;
|
||||
|
||||
case PROP_ENCRYPTED:
|
||||
g_value_set_boolean (value, calls_call_get_encrypted (self));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
|
@ -288,6 +298,19 @@ calls_call_class_init (CallsCallClass *klass)
|
|||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* CallsCall:encrypted:
|
||||
*
|
||||
* If the call is encrypted
|
||||
*/
|
||||
|
||||
properties[PROP_ENCRYPTED] =
|
||||
g_param_spec_boolean ("encrypted",
|
||||
"encrypted",
|
||||
"If the call is encrypted",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPS, properties);
|
||||
|
||||
/**
|
||||
|
@ -586,3 +609,44 @@ calls_call_state_parse_nick (CallsCallState *state,
|
|||
g_type_class_unref (klass);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* calls_call_get_encrypted:
|
||||
* @self: A #CallsCall
|
||||
*
|
||||
* Returns: %TRUE if the call is encrypted, %FALSE otherwise.
|
||||
*/
|
||||
gboolean
|
||||
calls_call_get_encrypted (CallsCall *self)
|
||||
{
|
||||
CallsCallPrivate *priv = calls_call_get_instance_private (self);
|
||||
|
||||
g_return_val_if_fail (CALLS_IS_CALL (self), FALSE);
|
||||
|
||||
return priv->encrypted;
|
||||
}
|
||||
|
||||
/**
|
||||
* calls_call_set_encrypted:
|
||||
* @self: A #CallsCall
|
||||
* @encrypted: A boolean indicating if the call is encrypted
|
||||
*
|
||||
* Set whether the call is encrypted or not.
|
||||
*/
|
||||
void
|
||||
calls_call_set_encrypted (CallsCall *self,
|
||||
gboolean encrypted)
|
||||
{
|
||||
CallsCallPrivate *priv = calls_call_get_instance_private (self);
|
||||
|
||||
g_return_if_fail (CALLS_IS_CALL (self));
|
||||
|
||||
if (priv->encrypted == encrypted)
|
||||
return;
|
||||
|
||||
g_debug ("Encryption %sabled", encrypted ? "en" : "dis");
|
||||
|
||||
priv->encrypted = encrypted;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ENCRYPTED]);
|
||||
}
|
||||
|
|
|
@ -68,6 +68,9 @@ void calls_call_set_name (CallsCall *self,
|
|||
CallsCallState calls_call_get_state (CallsCall *self);
|
||||
void calls_call_set_state (CallsCall *self,
|
||||
CallsCallState state);
|
||||
gboolean calls_call_get_encrypted (CallsCall *self);
|
||||
void calls_call_set_encrypted (CallsCall *self,
|
||||
gboolean encrypted);
|
||||
CallsCallType calls_call_get_call_type (CallsCall *self);
|
||||
gboolean calls_call_get_inbound (CallsCall *self);
|
||||
const char *calls_call_get_protocol (CallsCall *self);
|
||||
|
|
|
@ -123,7 +123,7 @@ calls_ui_call_data_get_encrypted (CuiCall *call_data)
|
|||
g_return_val_if_fail (CALLS_IS_UI_CALL_DATA (self), FALSE);
|
||||
g_return_val_if_fail (!!self->call, FALSE);
|
||||
|
||||
return FALSE;
|
||||
return calls_call_get_encrypted (self->call);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -307,6 +307,15 @@ on_notify_avatar (CallsUiCallData *self)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
on_notify_encrypted (CallsUiCallData *self)
|
||||
{
|
||||
g_assert (CALLS_IS_UI_CALL_DATA (self));
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_ENCRYPTED]);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_call_data (CallsUiCallData *self,
|
||||
CallsCall *call)
|
||||
|
@ -324,6 +333,12 @@ set_call_data (CallsUiCallData *self,
|
|||
self,
|
||||
G_CONNECT_SWAPPED);
|
||||
|
||||
g_signal_connect_object (self->call,
|
||||
"notify::encrypted",
|
||||
G_CALLBACK (on_notify_encrypted),
|
||||
self,
|
||||
G_CONNECT_SWAPPED);
|
||||
|
||||
on_notify_state (self);
|
||||
|
||||
manager = calls_manager_get_default ();
|
||||
|
|
Loading…
Reference in a new issue