[gnome-control-center] sharing: ensure the hostname in labels is updated
- From: Thomas Wood <thos src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] sharing: ensure the hostname in labels is updated
- Date: Fri, 4 Oct 2013 09:13:23 +0000 (UTC)
commit 1288d64952a61a6b8cf255b9003c947414c92008
Author: Thomas Wood <thomas wood intel com>
Date: Thu Oct 3 10:38:16 2013 +0100
sharing: ensure the hostname in labels is updated
https://bugzilla.gnome.org/show_bug.cgi?id=698421
panels/sharing/cc-sharing-panel.c | 26 +++++++++++++++++++++++---
1 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/panels/sharing/cc-sharing-panel.c b/panels/sharing/cc-sharing-panel.c
index bca8b2f..a5498cb 100644
--- a/panels/sharing/cc-sharing-panel.c
+++ b/panels/sharing/cc-sharing-panel.c
@@ -41,6 +41,9 @@ CC_PANEL_REGISTER (CcSharingPanel, cc_sharing_panel)
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_SHARING_PANEL, CcSharingPanelPrivate))
+static void cc_sharing_panel_setup_label_with_hostname (CcSharingPanel *self, GtkWidget *label);
+
+
static GtkWidget *
_gtk_builder_get_widget (GtkBuilder *builder,
const gchar *name)
@@ -201,6 +204,14 @@ cc_sharing_panel_run_dialog (CcSharingPanel *self,
dialog = WID (dialog_name);
+ /* ensure labels with the hostname are updated if the hostname has changed */
+ cc_sharing_panel_setup_label_with_hostname (self,
+ WID ("screen-sharing-label"));
+ cc_sharing_panel_setup_label_with_hostname (self, WID ("remote-login-label"));
+ cc_sharing_panel_setup_label_with_hostname (self,
+ WID ("personal-file-sharing-label"));
+
+
parent = cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (self)));
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
@@ -603,12 +614,21 @@ cc_sharing_panel_setup_label (GtkLabel *label,
const gchar *hostname)
{
gchar *text;
+ const gchar *format;
- hostname = g_strdup (hostname);
+ format = g_object_get_data (G_OBJECT (label), "format-label");
+ if (!format)
+ {
+ format = gtk_label_get_label (label);
+
+ /* save the original format string so that it can be used again later */
+ g_object_set_data_full (G_OBJECT (label), "format-label",
+ g_strdup (format), g_free);
+ }
- text = g_strdup_printf (gtk_label_get_label (GTK_LABEL (label)), hostname, hostname);
+ text = g_strdup_printf (format, hostname, hostname);
- gtk_label_set_label (GTK_LABEL (label), text);
+ gtk_label_set_label (label, text);
g_free (text);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]