[gnome-control-center] info: Set the StaticHostname
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] info: Set the StaticHostname
- Date: Fri, 13 May 2011 15:08:42 +0000 (UTC)
commit 018848689070c3dae16eb4d6ee6046764be32129
Author: Bastien Nocera <hadess hadess net>
Date: Fri May 13 16:07:55 2011 +0100
info: Set the StaticHostname
when changing the PrettyHostname
https://bugzilla.gnome.org/show_bug.cgi?id=650044
panels/info/cc-info-panel.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/panels/info/cc-info-panel.c b/panels/info/cc-info-panel.c
index 5e83e91..f190cd2 100644
--- a/panels/info/cc-info-panel.c
+++ b/panels/info/cc-info-panel.c
@@ -36,6 +36,8 @@
#include <glibtop/mem.h>
#include <glibtop/sysinfo.h>
+#include "hostname-helper.h"
+
#define GNOME_SESSION_MANAGER_SCHEMA "org.gnome.desktop.session"
#define KEY_SESSION_NAME "session-name"
@@ -1100,6 +1102,7 @@ text_changed_cb (GtkEntry *entry,
CcInfoPanel *self)
{
const char *text;
+ char *hostname;
GVariant *variant;
GError *error = NULL;
@@ -1119,6 +1122,26 @@ text_changed_cb (GtkEntry *entry,
{
g_variant_unref (variant);
}
+
+ /* Set the static hostname */
+ hostname = pretty_hostname_to_static (text, FALSE);
+ g_assert (hostname);
+
+ variant = g_dbus_proxy_call_sync (self->priv->hostnamed_proxy,
+ "SetStaticHostname",
+ g_variant_new ("(sb)", hostname, FALSE),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1, NULL, &error);
+ if (variant == NULL)
+ {
+ g_warning ("Could not set StaticHostname: %s", error->message);
+ g_error_free (error);
+ }
+ else
+ {
+ g_variant_unref (variant);
+ }
+ g_free (hostname);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]