[gnome-control-center/gnome-3-14] sharing: Fix "format not a string literal" error
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gnome-3-14] sharing: Fix "format not a string literal" error
- Date: Tue, 26 Apr 2016 11:03:14 +0000 (UTC)
commit 1ebd0925b498cba0aa8b2615bc81b603380cddb6
Author: Bastien Nocera <hadess hadess net>
Date: Thu Mar 24 16:23:25 2016 +0100
sharing: Fix "format not a string literal" error
https://bugzilla.gnome.org/show_bug.cgi?id=764150
panels/sharing/cc-sharing-panel.c | 34 ++++++++++++++++------------------
panels/sharing/sharing.ui | 6 +++---
2 files changed, 19 insertions(+), 21 deletions(-)
---
diff --git a/panels/sharing/cc-sharing-panel.c b/panels/sharing/cc-sharing-panel.c
index e3675e0..031ab76 100644
--- a/panels/sharing/cc-sharing-panel.c
+++ b/panels/sharing/cc-sharing-panel.c
@@ -788,25 +788,23 @@ copy_uri_to_clipboard (GtkMenuItem *item,
}
static void
-cc_sharing_panel_setup_label (GtkLabel *label,
- const gchar *hostname)
+cc_sharing_panel_setup_label (CcSharingPanel *self,
+ GtkWidget *label,
+ const gchar *hostname)
{
+ CcSharingPanelPrivate *priv = self->priv;
gchar *text;
- const gchar *format;
-
- 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 (format, hostname, hostname);
+ if (label == WID ("personal-file-sharing-label"))
+ text = g_strdup_printf (_("Personal File Sharing allows you to share your Public folder with others on
your current network using: <a href=\"dav://%s\">dav://%s</a>"), hostname, hostname);
+ else if (label == WID ("remote-login-label"))
+ text = g_strdup_printf (_("Allow remote users to connect using the Secure Shell command:\n<a href=\"ssh
%s\">ssh %s</a>"), hostname, hostname);
+ else if (label == WID ("screen-sharing-label"))
+ text = g_strdup_printf (_("Allow remote users to view or control your screen by connecting to: <a
href=\"vnc://%s\">vnc://%s</a>"), hostname, hostname);
+ else
+ g_assert_not_reached ();
- gtk_label_set_label (label, text);
+ gtk_label_set_label (GTK_LABEL (label), text);
g_free (text);
}
@@ -839,7 +837,7 @@ cc_sharing_panel_get_host_name_fqdn_done (GDBusConnection *connection,
hostname = cc_hostname_entry_get_hostname (CC_HOSTNAME_ENTRY (data->panel->priv->hostname_entry));
- cc_sharing_panel_setup_label (GTK_LABEL (data->label), hostname);
+ cc_sharing_panel_setup_label (data->panel, data->label, hostname);
g_free (hostname);
}
@@ -851,7 +849,7 @@ cc_sharing_panel_get_host_name_fqdn_done (GDBusConnection *connection,
g_variant_get (variant, "(&s)", &fqdn);
- cc_sharing_panel_setup_label (GTK_LABEL (data->label), fqdn);
+ cc_sharing_panel_setup_label (data->panel, data->label, fqdn);
g_variant_unref (variant);
g_object_unref (connection);
@@ -878,7 +876,7 @@ cc_sharing_panel_bus_ready (GObject *object,
hostname = cc_hostname_entry_get_hostname (CC_HOSTNAME_ENTRY (data->panel->priv->hostname_entry));
- cc_sharing_panel_setup_label (GTK_LABEL (data->label), hostname);
+ cc_sharing_panel_setup_label (data->panel, data->label, hostname);
g_free (hostname);
}
diff --git a/panels/sharing/sharing.ui b/panels/sharing/sharing.ui
index 32fc322..6cb57ed 100644
--- a/panels/sharing/sharing.ui
+++ b/panels/sharing/sharing.ui
@@ -407,7 +407,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Personal File Sharing allows you to share your
Public folder with others on your current network using: <a
href="dav://%s">dav://%s</a></property>
+ <property name="label">Personal File Sharing allows you to share your Public folder with
others on your current network using: <a href="dav://%s">dav://%s</a></property>
<property name="use_markup">True</property>
<property name="wrap">True</property>
<property name="max-width-chars">40</property>
@@ -548,7 +548,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Allow remote users to connect using the Secure
Shell command:
+ <property name="label">Allow remote users to connect using the Secure Shell command:
<a href="ssh %s">ssh %s</a></property>
<property name="use_markup">True</property>
<property name="wrap">True</property>
@@ -639,7 +639,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Allow remote users to view or control your
screen by connecting to: <a href="vnc://%s">vnc://%s</a></property>
+ <property name="label">Allow remote users to view or control your screen by connecting
to: <a href="vnc://%s">vnc://%s</a></property>
<property name="use_markup">True</property>
<property name="wrap">True</property>
<property name="max-width-chars">40</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]