summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2021-02-19 14:43:19 +0100
committerBastien Nocera <hadess@hadess.net>2021-02-19 14:45:46 +0100
commit0d686bf856b1ca67ab5a606c4287f3250b01a432 (patch)
treef918b2f384989d920333e530ef5748ed91ff0b28
parent92997846a2d1b51b8c63749bad6d8f83cd0a755f (diff)
downloadgnome-bluetooth-0d686bf856b1ca67ab5a606c4287f3250b01a432.tar.gz
settings-widget: Add a "time-created" property for settings rows
This captures when the device was discovered, or when a widget was created for it, which should be good enough to know when a particular device was discovered after another.
-rw-r--r--lib/bluetooth-settings-row.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/bluetooth-settings-row.c b/lib/bluetooth-settings-row.c
index d9be4ff2..619db396 100644
--- a/lib/bluetooth-settings-row.c
+++ b/lib/bluetooth-settings-row.c
@@ -52,6 +52,7 @@ struct _BluetoothSettingsRowPrivate {
char *alias;
char *bdaddr;
gboolean legacy_pairing;
+ gint64 time_created;
gboolean pairing;
};
@@ -67,7 +68,8 @@ enum {
PROP_ALIAS,
PROP_ADDRESS,
PROP_PAIRING,
- PROP_LEGACY_PAIRING
+ PROP_LEGACY_PAIRING,
+ PROP_TIME_CREATED
};
G_DEFINE_TYPE_WITH_PRIVATE(BluetoothSettingsRow, bluetooth_settings_row, GTK_TYPE_LIST_BOX_ROW)
@@ -102,6 +104,8 @@ bluetooth_settings_row_init (BluetoothSettingsRow *self)
priv->status, "visible", G_BINDING_INVERT_BOOLEAN | G_BINDING_BIDIRECTIONAL);
g_object_bind_property (priv->spinner, "active",
priv->status, "visible", G_BINDING_INVERT_BOOLEAN | G_BINDING_BIDIRECTIONAL);
+
+ priv->time_created = g_get_monotonic_time();
}
static void
@@ -158,6 +162,9 @@ bluetooth_settings_row_get_property (GObject *object,
case PROP_LEGACY_PAIRING:
g_value_set_boolean (value, priv->legacy_pairing);
break;
+ case PROP_TIME_CREATED:
+ g_value_set_int64 (value, priv->time_created);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
break;
@@ -288,6 +295,10 @@ bluetooth_settings_row_class_init (BluetoothSettingsRowClass *klass)
g_param_spec_boolean ("legacy-pairing", NULL,
"Legacy pairing",
FALSE, G_PARAM_READWRITE));
+ g_object_class_install_property (object_class, PROP_TIME_CREATED,
+ g_param_spec_int64 ("time-created", NULL,
+ "Time Created",
+ G_MININT64, G_MAXINT64, 0, G_PARAM_READABLE));
/* Bind class to template */
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/bluetooth/bluetooth-settings-row.ui");