Commit b6185e96 authored by Stepan Salenikovich's avatar Stepan Salenikovich Committed by gerrit2

Don't show bad username icon without blockchain

When not unchecking the option to use the blockchain, don't show
the bad username icon if the username is empty.

Change-Id: I664ab8b44e58574df670ca28f206574e95b6ae65
parent a6035428
......@@ -231,26 +231,30 @@ entry_username_changed(UsernameRegistrationBox *view)
}
gtk_widget_set_sensitive(priv->button_register_username, FALSE);
if (strlen(username) == 0) {
// don't lookup empty username
gtk_image_set_from_icon_name(GTK_IMAGE(priv->icon_username_availability), "error", GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_widget_show(priv->icon_username_availability);
if (priv->use_blockchain) {
gtk_widget_hide(priv->spinner);
gtk_spinner_stop(GTK_SPINNER(priv->spinner));
gtk_label_set_text(GTK_LABEL(priv->label_status), "");
} else if (priv->use_blockchain) {
gtk_widget_hide(priv->icon_username_availability);
gtk_widget_show(priv->spinner);
gtk_spinner_start(GTK_SPINNER(priv->spinner));
gtk_label_set_text(GTK_LABEL(priv->label_status), _("Looking up username availability..."));
// queue lookup with a 500ms delay
priv->lookup_timeout = g_timeout_add(500, (GSourceFunc)lookup_username, view);
if (strlen(username) == 0) {
// don't lookup empty username
gtk_image_set_from_icon_name(GTK_IMAGE(priv->icon_username_availability), "error", GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_widget_show(priv->icon_username_availability);
gtk_widget_hide(priv->spinner);
gtk_spinner_stop(GTK_SPINNER(priv->spinner));
gtk_label_set_text(GTK_LABEL(priv->label_status), "");
} else {
gtk_widget_hide(priv->icon_username_availability);
gtk_widget_show(priv->spinner);
gtk_spinner_start(GTK_SPINNER(priv->spinner));
gtk_label_set_text(GTK_LABEL(priv->label_status), _("Looking up username availability..."));
// queue lookup with a 500ms delay
priv->lookup_timeout = g_timeout_add(500, (GSourceFunc)lookup_username, view);
}
} else {
// not using blockchain, any name > 0 is OK
gtk_image_set_from_icon_name(GTK_IMAGE(priv->icon_username_availability), "emblem-default", GTK_ICON_SIZE_SMALL_TOOLBAR);
// not using blockchain, so don't care about username validity
gtk_image_clear(GTK_IMAGE(priv->icon_username_availability));
gtk_widget_show(priv->icon_username_availability);
gtk_widget_set_size_request(priv->icon_username_availability, 16, 16); // ensure min size of empty icon
gtk_widget_hide(priv->spinner);
gtk_spinner_stop(GTK_SPINNER(priv->spinner));
gtk_label_set_text(GTK_LABEL(priv->label_status), "");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment