Merge branch 'builder-problems' into 'master'

user-controls: Add a fallback bus connection

See merge request pwithnall/malcontent!60
This commit is contained in:
Philip Withnall 2020-04-07 13:27:23 +00:00
commit 980f035ea9
2 changed files with 13 additions and 2 deletions

View File

@ -728,6 +728,17 @@ mct_user_controls_constructed (GObject *object)
/* Chain up. */
G_OBJECT_CLASS (mct_user_controls_parent_class)->constructed (object);
/* FIXME: Ideally there wouldnt be this sync call in a constructor, but there
* seems to be no way around it if #MctUserControls is to be used from a
* GtkBuilder template: templates are initialised from within the parent
* widgets init() function (not its constructed() function), so none of its
* properties will have been set and it wont reasonably have been able to
* make an async call to initialise the bus connection itself. Binding
* construct-only properties in GtkBuilder doesnt work (and wouldnt help if
* it did). */
if (self->dbus_connection == NULL)
self->dbus_connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
g_assert (self->dbus_connection != NULL);
self->manager = mct_manager_new (self->dbus_connection);
}

View File

@ -98,7 +98,7 @@ mct_manager_set_property (GObject *object,
switch ((MctManagerProperty) property_id)
{
case PROP_CONNECTION:
/* Construct-only. May be %NULL. */
/* Construct-only. May not be %NULL. */
g_assert (self->connection == NULL);
self->connection = g_value_dup_object (value);
g_assert (self->connection != NULL);
@ -167,7 +167,7 @@ mct_manager_class_init (MctManagerClass *klass)
object_class->set_property = mct_manager_set_property;
/**
* MctManager:connection:
* MctManager:connection: (not nullable)
*
* A connection to the system bus, where accounts-service runs. Its provided
* mostly for testing purposes, or to allow an existing connection to be