1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2025-01-05 19:15:32 +00:00

calls-record: Introduce the protocol property

This is in preparation for supporting multiple providers (which are handling
different protocols/URI schemes).

This commit also changes the underlying database schema.
This commit is contained in:
Evangelos Ribeiro Tzaras 2021-04-12 11:44:30 +02:00
parent 53f69b06dd
commit 6d8c227b24
2 changed files with 25 additions and 2 deletions

View file

@ -31,11 +31,12 @@ struct _CallsCallRecord
{
GomResource parent_instance;
guint id;
gchar *target;
char *target;
gboolean inbound;
GDateTime *start;
GDateTime *answered;
GDateTime *end;
char *protocol;
gboolean complete;
};
@ -50,6 +51,7 @@ enum {
PROP_START,
PROP_ANSWERED,
PROP_END,
PROP_PROTOCOL,
PROP_LAST_PROP,
};
static GParamSpec *props[PROP_LAST_PROP];
@ -95,6 +97,10 @@ get_property (GObject *object,
g_value_set_boxed (value, self->end);
break;
case PROP_PROTOCOL:
g_value_set_string (value, self->protocol);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@ -151,6 +157,11 @@ set_property (GObject *object,
set_date_time (&self->end, value);
break;
case PROP_PROTOCOL:
g_free (self->protocol);
self->protocol = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@ -167,6 +178,7 @@ finalize (GObject *object)
g_clear_pointer (&self->answered, g_date_time_unref);
g_clear_pointer (&self->start, g_date_time_unref);
g_free (self->target);
g_free (self->protocol);
G_OBJECT_CLASS (calls_call_record_parent_class)->finalize (object);
}
@ -258,6 +270,16 @@ calls_call_record_class_init (CallsCallRecordClass *klass)
g_object_class_install_property (object_class, PROP_END, props[PROP_END]);
props[PROP_PROTOCOL] =
g_param_spec_string ("protocol",
"Protocol",
"The URI protocol for this call",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
g_object_class_install_property (object_class, PROP_PROTOCOL, props[PROP_PROTOCOL]);
gom_resource_class_set_property_new_in_version (resource_class, "protocol", 2);
/*
* NB: ANY ADDITIONS TO THIS LIST REQUIRE AN INCREASE IN

View file

@ -36,7 +36,7 @@
#define RECORD_STORE_FILENAME "records.db"
#define RECORD_STORE_VERSION 1
#define RECORD_STORE_VERSION 2
typedef enum
@ -490,6 +490,7 @@ record_call (CallsRecordStore *self,
"repository", self->repository,
"target", calls_call_get_number (call),
"inbound", calls_call_get_inbound (call),
"protocol", calls_call_get_protocol (call),
"start", start,
NULL);