[gnome-control-center] sharing: Fix "format not a string literal" error



commit 70672c36581c33cf72be4de80b4dccadc429abb0
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 6da32ba..3370634 100644
--- a/panels/sharing/cc-sharing-panel.c
+++ b/panels/sharing/cc-sharing-panel.c
@@ -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);
 
-      /* 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);
 }
@@ -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);
         }
diff --git a/panels/sharing/sharing.ui b/panels/sharing/sharing.ui
index 3b0fc02..c71efd0 100644
--- a/panels/sharing/sharing.ui
+++ b/panels/sharing/sharing.ui
@@ -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>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]