From f74c7b5dbfebb267dfb1e0ec06da81f7631b2e11 Mon Sep 17 00:00:00 2001 From: aviau <alexandre@alexandreviau.net> Date: Thu, 1 Dec 2016 13:57:00 -0500 Subject: [PATCH] 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 --- src/ringwelcomeview.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/ringwelcomeview.cpp b/src/ringwelcomeview.cpp index 83b4ef60..3c7a25c7 100644 --- a/src/ringwelcomeview.cpp +++ b/src/ringwelcomeview.cpp @@ -63,10 +63,23 @@ update_view(RingWelcomeView *self) { auto account = get_active_ring_account(); if (account != 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>", account->username().toUtf8().constData()); } else { + gtk_label_set_text(GTK_LABEL(priv->label_explanation), NULL); ring_id = g_markup_printf_escaped("<span fgcolor=\"gray\">%s</span>", _("fetching RingID...")); } @@ -134,7 +147,7 @@ ring_welcome_view_init(RingWelcomeView *self) gtk_widget_set_visible(GTK_WIDGET(label_welcome_text), TRUE); /* 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); gtk_style_context_add_class(context, GTK_STYLE_CLASS_DIM_LABEL); gtk_label_set_justify(GTK_LABEL(priv->label_explanation), GTK_JUSTIFY_CENTER); @@ -169,7 +182,7 @@ ring_welcome_view_init(RingWelcomeView *self) gtk_widget_set_visible(priv->revealer_qrcode, FALSE); /* 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_size_request(priv->button_qrcode,10,10); g_signal_connect_swapped(priv->button_qrcode, "clicked", G_CALLBACK(switch_qrcode), self); -- GitLab