[gnome-control-center/wip/feborges/new-addprinter-dialog: 7/7] printers: Use "hostname" in the "Add Printer" dialog



commit b06e3e55775d414f03d1cdff371fa63f753430b4
Author: Felipe Borges <felipeborges gnome org>
Date:   Sat Nov 12 18:41:23 2016 +0100

    printers: Use "hostname" in the "Add Printer" dialog

 panels/printers/new-printer-dialog.ui   |    2 +-
 panels/printers/pp-new-printer-dialog.c |   13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/panels/printers/new-printer-dialog.ui b/panels/printers/new-printer-dialog.ui
index 633c5fc..eea1650 100644
--- a/panels/printers/new-printer-dialog.ui
+++ b/panels/printers/new-printer-dialog.ui
@@ -313,7 +313,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel">
+                  <object class="GtkLabel" id="authentication-title">
                     <property name="label" translatable="yes">Authentication Required</property>
                     <property name="xalign">0</property>
                     <attributes>
diff --git a/panels/printers/pp-new-printer-dialog.c b/panels/printers/pp-new-printer-dialog.c
index 14a01a7..b2f1503 100644
--- a/panels/printers/pp-new-printer-dialog.c
+++ b/panels/printers/pp-new-printer-dialog.c
@@ -398,6 +398,7 @@ on_authentication_required (PpHost   *host,
   PpNewPrinterDialogPrivate *priv;
   PpNewPrinterDialog        *dialog = PP_NEW_PRINTER_DIALOG (user_data);
   AuthenticationData        *data;
+  gchar                     *text, *hostname;
 
   priv = dialog->priv;
 
@@ -406,11 +407,23 @@ on_authentication_required (PpHost   *host,
   data->host = host;
 
   gtk_header_bar_set_subtitle (GTK_HEADER_BAR (WID ("headerbar")), NULL);
+
+  g_object_get (G_OBJECT (host), "hostname", &hostname, NULL);
+  /* Translators: Samba server needs authentication of the user to show list of its printers. */
+  text = g_strdup_printf (_("Unlock %s."), hostname);
+  gtk_label_set_text (GTK_LABEL (WID ("authentication-title")), text);
+  /* Translators: Samba server needs authentication of the user to show list of its printers. */
+  text = g_strdup_printf (_("Enter username and password to view printers on %s."), hostname);
+  gtk_label_set_text (GTK_LABEL (WID ("authentication-text")), text);
+
   go_to_page (dialog, AUTHENTICATION_PAGE);
 
   g_signal_connect (WID ("unlock-button"), "clicked", G_CALLBACK (on_authenticate), data);
   g_signal_connect (WID ("username-entry"), "activate", G_CALLBACK (on_authenticate), data);
   g_signal_connect (WID ("password-entry"), "activate", G_CALLBACK (on_authenticate), data);
+
+  g_free (text);
+  g_free (hostname);
 }
 static void
 auth_entries_changed (GtkEditable *editable,


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