info: Set the transient hostname too
As we need that to get the right name from "hostname".
This commit is contained in:
parent
c95de81b30
commit
7889482576
2 changed files with 19 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
polkit.addRule(function(action, subject) {
|
||||
if (action.id == "org.freedesktop.hostname1.set-static-hostname" &&
|
||||
if ((action.id == "org.freedesktop.hostname1.set-static-hostname" ||
|
||||
action.id == "org.freedesktop.hostname1.set-hostname") &&
|
||||
subject.local &&
|
||||
subject.active &&
|
||||
subject.isInGroup ("wheel")) {
|
||||
|
|
|
@ -1651,7 +1651,7 @@ info_panel_set_hostname (CcInfoPanel *self)
|
|||
g_variant_unref (variant);
|
||||
}
|
||||
|
||||
/* Set the static hostname */
|
||||
/* Set the static and transient hostname */
|
||||
hostname = pretty_hostname_to_static (text, FALSE);
|
||||
g_assert (hostname);
|
||||
|
||||
|
@ -1670,6 +1670,22 @@ info_panel_set_hostname (CcInfoPanel *self)
|
|||
{
|
||||
g_variant_unref (variant);
|
||||
}
|
||||
|
||||
g_debug ("Setting Hostname to '%s'", hostname);
|
||||
variant = g_dbus_proxy_call_sync (self->priv->hostnamed_proxy,
|
||||
"SetHostname",
|
||||
g_variant_new ("(sb)", hostname, FALSE),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1, NULL, &error);
|
||||
if (variant == NULL)
|
||||
{
|
||||
g_warning ("Could not set Hostname: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_variant_unref (variant);
|
||||
}
|
||||
g_free (hostname);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue