sharing: Fix "format not a string literal" error

https://bugzilla.gnome.org/show_bug.cgi?id=764150
This commit is contained in:
Bastien Nocera 2016-03-24 16:23:25 +01:00
parent afc0a1b142
commit 70672c3658
2 changed files with 19 additions and 21 deletions

View file

@ -669,25 +669,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);
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 ();
/* 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);
gtk_label_set_label (label, text);
gtk_label_set_label (GTK_LABEL (label), text);
g_free (text);
}
@ -720,7 +718,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);
}
@ -732,7 +730,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);
@ -759,7 +757,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);
}

View file

@ -266,7 +266,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: &lt;a href="dav://%s"&gt;dav://%s&lt;/a&gt;</property>
<property name="label">Personal File Sharing allows you to share your Public folder with others on your current network using: &lt;a href="dav://%s"&gt;dav://%s&lt;/a&gt;</property>
<property name="use_markup">True</property>
<property name="wrap">True</property>
<property name="max-width-chars">40</property>
@ -409,7 +409,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:
&lt;a href="ssh %s"&gt;ssh %s&lt;/a&gt;</property>
<property name="use_markup">True</property>
<property name="wrap">True</property>
@ -501,7 +501,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: &lt;a href="vnc://%s"&gt;vnc://%s&lt;/a&gt;</property>
<property name="label">Allow remote users to view or control your screen by connecting to: &lt;a href="vnc://%s"&gt;vnc://%s&lt;/a&gt;</property>
<property name="use_markup">True</property>
<property name="wrap">True</property>
<property name="max-width-chars">40</property>