Skip to content
Snippets Groups Projects
Unverified Commit f74c7b5d authored by aviau's avatar aviau
Browse files

ringwelcomeview: display registered name

- change the behaviour of the ringwelcomeview to display the Ring
username when available.

- change the label of the QR code button to "Ring ID QR code" to avoid
confusion when displaying the username. The QR code is not a QR code for
the username but always for the Ring ID.

- make the label of the QR code button translatable. Even if its only a
couple non-translatable words, some languages have different word orders
or whatever...

Tuleap: #681
Change-Id: Ic4ddfae34bbc7120d94e2c6ef7e8f323f8cecef6
parent 3e5f1b62
No related branches found
No related tags found
No related merge requests found
...@@ -63,10 +63,23 @@ update_view(RingWelcomeView *self) { ...@@ -63,10 +63,23 @@ update_view(RingWelcomeView *self) {
auto account = get_active_ring_account(); auto account = get_active_ring_account();
if (account != nullptr) { if (account != nullptr) {
gchar *ring_id = nullptr; gchar *ring_id = nullptr;
if (!account->username().isEmpty()) { if(!account->registeredName().isEmpty()){
gtk_label_set_text(
GTK_LABEL(priv->label_explanation),
_("This is your Ring username.\nCopy and share it with your friends!")
);
ring_id = g_markup_printf_escaped("<span fgcolor=\"black\">ring:%s</span>",
account->registeredName().toUtf8().constData());
}
else if (!account->username().isEmpty()) {
gtk_label_set_text(
GTK_LABEL(priv->label_explanation),
C_("Do not translate \"RingID\"", "This is your RingID.\nCopy and share it with your friends!")
);
ring_id = g_markup_printf_escaped("<span fgcolor=\"black\">%s</span>", ring_id = g_markup_printf_escaped("<span fgcolor=\"black\">%s</span>",
account->username().toUtf8().constData()); account->username().toUtf8().constData());
} else { } else {
gtk_label_set_text(GTK_LABEL(priv->label_explanation), NULL);
ring_id = g_markup_printf_escaped("<span fgcolor=\"gray\">%s</span>", ring_id = g_markup_printf_escaped("<span fgcolor=\"gray\">%s</span>",
_("fetching RingID...")); _("fetching RingID..."));
} }
...@@ -134,7 +147,7 @@ ring_welcome_view_init(RingWelcomeView *self) ...@@ -134,7 +147,7 @@ ring_welcome_view_init(RingWelcomeView *self)
gtk_widget_set_visible(GTK_WIDGET(label_welcome_text), TRUE); gtk_widget_set_visible(GTK_WIDGET(label_welcome_text), TRUE);
/* RingID explanation */ /* RingID explanation */
priv->label_explanation = gtk_label_new(C_("Do not translate \"RingID\"", "This is your RingID.\nCopy and share it with your friends!")); priv->label_explanation = gtk_label_new(NULL);
auto context = gtk_widget_get_style_context(priv->label_explanation); auto context = gtk_widget_get_style_context(priv->label_explanation);
gtk_style_context_add_class(context, GTK_STYLE_CLASS_DIM_LABEL); gtk_style_context_add_class(context, GTK_STYLE_CLASS_DIM_LABEL);
gtk_label_set_justify(GTK_LABEL(priv->label_explanation), GTK_JUSTIFY_CENTER); gtk_label_set_justify(GTK_LABEL(priv->label_explanation), GTK_JUSTIFY_CENTER);
...@@ -169,7 +182,7 @@ ring_welcome_view_init(RingWelcomeView *self) ...@@ -169,7 +182,7 @@ ring_welcome_view_init(RingWelcomeView *self)
gtk_widget_set_visible(priv->revealer_qrcode, FALSE); gtk_widget_set_visible(priv->revealer_qrcode, FALSE);
/* QR code button */ /* QR code button */
priv->button_qrcode = gtk_button_new_with_label("QR code"); priv->button_qrcode = gtk_button_new_with_label(C_("Do not translate \"Ring ID\"", "Ring ID QR code"));
gtk_widget_set_hexpand(priv->button_qrcode, FALSE); gtk_widget_set_hexpand(priv->button_qrcode, FALSE);
gtk_widget_set_size_request(priv->button_qrcode,10,10); gtk_widget_set_size_request(priv->button_qrcode,10,10);
g_signal_connect_swapped(priv->button_qrcode, "clicked", G_CALLBACK(switch_qrcode), self); g_signal_connect_swapped(priv->button_qrcode, "clicked", G_CALLBACK(switch_qrcode), self);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment