daemon: Change ActiveTransaction value
Change the ActiveTransaction property from the bus address of the active transaction to a string tuple: (method name, sender name) The bus address was only a placeholder, and not very useful since each transaction only accepts one connection (presumably the method caller).
This commit is contained in:
parent
495bf4c3f3
commit
188be0cd58
@ -7,7 +7,8 @@
|
|||||||
<!-- The booted OSName -->
|
<!-- The booted OSName -->
|
||||||
<property name="Booted" type="o" access="read"/>
|
<property name="Booted" type="o" access="read"/>
|
||||||
|
|
||||||
<property name="ActiveTransaction" type="s" access="read"/>
|
<!-- The values are (method-name, sender-name) -->
|
||||||
|
<property name="ActiveTransaction" type="(ss)" access="read"/>
|
||||||
|
|
||||||
<method name="CreateOSName">
|
<method name="CreateOSName">
|
||||||
<arg type="s" name="name"/>
|
<arg type="s" name="name"/>
|
||||||
@ -100,8 +101,6 @@
|
|||||||
</interface>
|
</interface>
|
||||||
|
|
||||||
<interface name="org.projectatomic.rpmostree1.Transaction">
|
<interface name="org.projectatomic.rpmostree1.Transaction">
|
||||||
<property name="MethodName" type="s" access="read"/>
|
|
||||||
<property name="Owner" type="s" access="read"/>
|
|
||||||
<property name="Active" type="b" access="read"/>
|
<property name="Active" type="b" access="read"/>
|
||||||
|
|
||||||
<!-- Yes, we can. -->
|
<!-- Yes, we can. -->
|
||||||
|
@ -443,23 +443,30 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
sysroot_transform_transaction_to_address (GBinding *binding,
|
sysroot_transform_transaction_to_attrs (GBinding *binding,
|
||||||
const GValue *src_value,
|
const GValue *src_value,
|
||||||
GValue *dst_value,
|
GValue *dst_value,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
Transaction *transaction;
|
Transaction *transaction;
|
||||||
const char *client_address = NULL;
|
GVariant *variant;
|
||||||
|
const char *method_name = "";
|
||||||
|
const char *sender_name = "";
|
||||||
|
|
||||||
transaction = g_value_get_object (src_value);
|
transaction = g_value_get_object (src_value);
|
||||||
|
|
||||||
if (transaction != NULL)
|
if (transaction != NULL)
|
||||||
client_address = transaction_get_client_address (transaction);
|
{
|
||||||
|
GDBusMethodInvocation *invocation;
|
||||||
|
|
||||||
if (client_address == NULL)
|
invocation = transaction_get_invocation (transaction);
|
||||||
client_address = "";
|
method_name = g_dbus_method_invocation_get_method_name (invocation);
|
||||||
|
sender_name = g_dbus_method_invocation_get_sender (invocation);
|
||||||
|
}
|
||||||
|
|
||||||
g_value_set_string (dst_value, client_address);
|
variant = g_variant_new ("(ss)", method_name, sender_name);
|
||||||
|
|
||||||
|
g_value_set_variant (dst_value, variant);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -571,7 +578,7 @@ sysroot_constructed (GObject *object)
|
|||||||
"active-transaction",
|
"active-transaction",
|
||||||
G_BINDING_DEFAULT |
|
G_BINDING_DEFAULT |
|
||||||
G_BINDING_SYNC_CREATE,
|
G_BINDING_SYNC_CREATE,
|
||||||
sysroot_transform_transaction_to_address,
|
sysroot_transform_transaction_to_attrs,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -400,19 +400,13 @@ transaction_constructed (GObject *object)
|
|||||||
if (priv->invocation != NULL)
|
if (priv->invocation != NULL)
|
||||||
{
|
{
|
||||||
GDBusConnection *connection;
|
GDBusConnection *connection;
|
||||||
const char *method_name;
|
|
||||||
const char *sender;
|
const char *sender;
|
||||||
|
|
||||||
connection = g_dbus_method_invocation_get_connection (priv->invocation);
|
connection = g_dbus_method_invocation_get_connection (priv->invocation);
|
||||||
method_name = g_dbus_method_invocation_get_method_name (priv->invocation);
|
|
||||||
sender = g_dbus_method_invocation_get_sender (priv->invocation);
|
sender = g_dbus_method_invocation_get_sender (priv->invocation);
|
||||||
|
|
||||||
/* Initialize D-Bus properties. */
|
/* Initialize D-Bus properties. */
|
||||||
g_object_set (self,
|
rpmostree_transaction_set_active (RPMOSTREE_TRANSACTION (self), TRUE);
|
||||||
"method-name", method_name,
|
|
||||||
"owner", sender,
|
|
||||||
"active", TRUE,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
priv->watch_id = g_bus_watch_name_on_connection (connection,
|
priv->watch_id = g_bus_watch_name_on_connection (connection,
|
||||||
sender,
|
sender,
|
||||||
@ -624,6 +618,18 @@ transaction_get_sysroot (Transaction *transaction)
|
|||||||
return priv->sysroot;
|
return priv->sysroot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GDBusMethodInvocation *
|
||||||
|
transaction_get_invocation (Transaction *transaction)
|
||||||
|
{
|
||||||
|
TransactionPrivate *priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (IS_TRANSACTION (transaction), NULL);
|
||||||
|
|
||||||
|
priv = transaction_get_private (transaction);
|
||||||
|
|
||||||
|
return priv->invocation;
|
||||||
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
transaction_get_client_address (Transaction *transaction)
|
transaction_get_client_address (Transaction *transaction)
|
||||||
{
|
{
|
||||||
|
@ -46,6 +46,8 @@ struct _TransactionClass
|
|||||||
|
|
||||||
GType transaction_get_type (void) G_GNUC_CONST;
|
GType transaction_get_type (void) G_GNUC_CONST;
|
||||||
OstreeSysroot * transaction_get_sysroot (Transaction *transaction);
|
OstreeSysroot * transaction_get_sysroot (Transaction *transaction);
|
||||||
|
GDBusMethodInvocation *
|
||||||
|
transaction_get_invocation (Transaction *transaction);
|
||||||
const char * transaction_get_client_address (Transaction *transaction);
|
const char * transaction_get_client_address (Transaction *transaction);
|
||||||
void transaction_emit_message_printf (Transaction *transaction,
|
void transaction_emit_message_printf (Transaction *transaction,
|
||||||
const char *format,
|
const char *format,
|
||||||
|
Loading…
Reference in New Issue
Block a user