diff --git a/src/accountcreationwizard.cpp b/src/accountcreationwizard.cpp index b5de4504bdabb0b470a909f4fb7b4f1fe7e03c60..fc9d7296220a9684431c39702f6156754eee2825 100644 --- a/src/accountcreationwizard.cpp +++ b/src/accountcreationwizard.cpp @@ -85,13 +85,13 @@ struct _AccountCreationWizardPrivate GtkWidget *entry_username; GtkWidget *entry_password; GtkWidget *entry_password_confirm; + GtkWidget *label_password_error; GtkWidget *button_account_creation_next; GtkWidget *button_account_creation_previous; GtkWidget *box_avatarselection; GtkWidget *avatar_manipulation; - GtkWidget *label_password_error; GtkWidget *box_username_entry; - GtkWidget *checkbutton_sign_up_blockchain; + GtkWidget *switch_register; GtkWidget *username_registration_box; GtkWidget *entry_display_name; @@ -175,7 +175,7 @@ account_creation_wizard_class_init(AccountCreationWizardClass *klass) gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountCreationWizard, box_avatarselection); gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountCreationWizard, label_password_error); gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountCreationWizard, box_username_entry); - gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountCreationWizard, checkbutton_sign_up_blockchain); + gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountCreationWizard, switch_register); gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountCreationWizard, entry_display_name); /* generating_account_spinner */ @@ -459,7 +459,7 @@ entries_new_account_changed(AccountCreationWizard *view) const gchar *display_name = gtk_entry_get_text(GTK_ENTRY(priv->entry_display_name)); const gchar *username = gtk_entry_get_text(GTK_ENTRY(priv->entry_username)); - const gboolean sign_up_blockchain = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->checkbutton_sign_up_blockchain)); + const gboolean sign_up_blockchain = gtk_switch_get_active(GTK_SWITCH(priv->switch_register)); if ( strlen(display_name) > 0 && // Display name is longer than 0 @@ -478,11 +478,10 @@ entries_new_account_changed(AccountCreationWizard *view) } static void -checkbutton_sign_up_blockchain_toggled(GtkToggleButton *toggle_button, AccountCreationWizard *view) +sign_up_blockchain_switched(GtkSwitch* switch_btn, GParamSpec*, AccountCreationWizard *view) { AccountCreationWizardPrivate *priv = ACCOUNT_CREATION_WIZARD_GET_PRIVATE(view); - gboolean sign_up_blockchain = gtk_toggle_button_get_active(toggle_button); - + gboolean sign_up_blockchain = gtk_switch_get_active(switch_btn); username_registration_box_set_use_blockchain( USERNAME_REGISTRATION_BOX(priv->username_registration_box), @@ -498,7 +497,7 @@ checkbutton_sign_up_blockchain_toggled(GtkToggleButton *toggle_button, AccountCr /* Unchecking blockchain signup when there is an empty username should * result in activating the next button. - */ + */ entries_new_account_changed(view); } @@ -528,7 +527,7 @@ build_creation_wizard_view(AccountCreationWizard *view, gboolean show_cancel_but /* create the username_registration_box */ priv->username_registration_box = username_registration_box_new_empty(false); - gtk_container_add(GTK_CONTAINER(priv->box_username_entry), priv->username_registration_box); + gtk_box_pack_end(GTK_BOX(priv->box_username_entry), GTK_WIDGET(priv->username_registration_box), false, false, 0); gtk_widget_show(priv->username_registration_box); priv->entry_username = GTK_WIDGET( username_registration_box_get_entry( @@ -564,9 +563,8 @@ build_creation_wizard_view(AccountCreationWizard *view, gboolean show_cancel_but g_signal_connect(priv->button_account_creation_previous, "clicked", G_CALLBACK(account_creation_previous_clicked), view); g_signal_connect_swapped(priv->entry_password, "changed", G_CALLBACK(entries_new_account_changed), view); g_signal_connect_swapped(priv->entry_password_confirm, "changed", G_CALLBACK(entries_new_account_changed), view); - g_signal_connect_swapped(priv->entry_username, "changed", G_CALLBACK(entries_new_account_changed), view); g_signal_connect_swapped(priv->entry_display_name, "changed", G_CALLBACK(entries_new_account_changed), view); - g_signal_connect(priv->checkbutton_sign_up_blockchain, "toggled", G_CALLBACK(checkbutton_sign_up_blockchain_toggled), view); + g_signal_connect(priv->switch_register, "notify::active", G_CALLBACK(sign_up_blockchain_switched), view); g_signal_connect_swapped(priv->username_registration_box, "username-availability-changed", G_CALLBACK(username_availability_changed), view); /* existing_account signals */ @@ -581,6 +579,8 @@ build_creation_wizard_view(AccountCreationWizard *view, gboolean show_cancel_but show_choose_account_type(view); + gtk_button_set_relief(GTK_BUTTON(priv->button_show_advanced), GTK_RELIEF_NONE); + auto provider = gtk_css_provider_new(); gtk_css_provider_load_from_data(provider, ".black { color: grey; font-size: 0.8em; }\ diff --git a/ui/accountcreationwizard.ui b/ui/accountcreationwizard.ui index a6a7d6906edf09c562324a431cbb8b63a94be4e0..6ad64d971c9d7d2f82b8c22876d106b8b9b1913b 100644 --- a/ui/accountcreationwizard.ui +++ b/ui/accountcreationwizard.ui @@ -257,187 +257,276 @@ <object class="GtkBox" id="account_creation"> <property name="visible">True</property> <property name="valign">center</property> + <property name="halign">center</property> <property name="border_width">10</property> <property name="orientation">vertical</property> <property name="spacing">15</property> + <child> <object class="GtkBox"> <property name="visible">True</property> - <property name="valign">center</property> <property name="orientation">vertical</property> - <property name="spacing">10</property> - <!-- Start of profile frame child --> + <property name="halign">fill</property> + <property name="spacing">8</property> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Profile</property> + <property name="halign">start</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> <child> - <!-- Start of profile frame object --> <object class="GtkFrame"> <property name="visible">True</property> - <!-- Start of profile box child --> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">out</property> <child> - <!-- Start of profile box object --> <object class="GtkBox"> <property name="visible">True</property> <property name="orientation">vertical</property> - <property name="spacing">10</property> + <property name="spacing">0</property> <child> - <object class="GtkLabel"> + <object class="GtkListBox"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Profile</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - </child> - <child> - <object class="GtkBox" id="box_avatarselection"> - <property name="visible">True</property> - <property name="halign">center</property> - <property name="valign">center</property> - <property name="orientation">vertical</property> + <property name="can_focus">True</property> + <property name="halign">fill</property> + <property name="valign">fill</property> + <property name="selection_mode">none</property> <child> - <placeholder/> + <!-- Avatar --> + <object class="GtkListBoxRow"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="halign">fill</property> + <child> + <object class="GtkBox" id="box_avatarselection"> + <property name="visible">True</property> + <property name="valign">end</property> + <property name="halign">center</property> + <property name="orientation">vertical</property> + <property name="margin_top">10</property> + <property name="spacing">5</property> + <child> + <object class="GtkEntry" id="entry_display_name"> + <property name="margin_bottom">10</property> + <property name="margin_left">10</property> + <property name="margin_right">10</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="halign">fill</property> + <property name="xalign">0.5</property> + </object> + <packing> + <property name="pack_type">end</property> + </packing> + </child> + </object> + </child> + </object> </child> </object> </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="label" translatable="yes">Full name:</property> - </object> - </child> - <child> - <object class="GtkEntry" id="entry_display_name"> - <property name="halign">center</property> - <property name="width-chars">40</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="xalign">0.5</property> - <property name="visibility">True</property> - </object> - <packing> - <property name="padding">10</property> - </packing> - </child> - <!-- End of profile box object --> </object> - <!-- End of profile box child --> </child> - <!-- end of profile frame object --> </object> - <!-- End of profile frame child --> </child> - <!-- Start of account frame child --> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="valign">end</property> + <property name="orientation">vertical</property> + <property name="spacing">8</property> + <child> + <object class="GtkLabel" id="label_name_server"> + <property name="visible">True</property> + <property name="halign">start</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Account</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> <child> - <!-- Start of account frame object --> <object class="GtkFrame"> <property name="visible">True</property> - <!-- Start of account box child --> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">out</property> <child> - <!-- Start of account box object --> - <object class="GtkBox"> + <object class="GtkListBox"> <property name="visible">True</property> - <property name="orientation">vertical</property> - <property name="spacing">10</property> + <property name="can_focus">True</property> + <property name="halign">fill</property> + <property name="selection_mode">none</property> <child> - <object class="GtkLabel"> + <!-- Username --> + <object class="GtkListBoxRow"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Ring Account</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="orientation">horizontal</property> - <property name="halign">center</property> + <property name="can_focus">True</property> + <property name="halign">fill</property> <child> - <object class="GtkCheckButton" id="checkbutton_sign_up_blockchain"> - <property name="label" translatable="yes">Register public username (experimental):</property> + <object class="GtkBox"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="active">True</property> - <property name="draw_indicator">True</property> - <property name="tooltip_text" translatable="yes">By checking this, you will register a unique username on the Ring network. People can use it to contact you instead of using your RingID, which is 40 characters long.</property> + <property name="halign">fill</property> + <property name="orientation">horizontal</property> + <property name="margin_left">10</property> + <property name="margin_right">10</property> + <property name="margin_top">10</property> + <property name="margin_bottom">10</property> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Register username</property> + <property name="tooltip_text" translatable="yes">By checking this, you will register a unique username on the Ring network. People can use it to contact you instead of using your RingID, which is 40 characters long.</property> + </object> + </child> + <child> + <object class="GtkSwitch" id="switch_register"> + <property name="active">True</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + </object> + <packing> + <property name="pack_type">end</property> + </packing> + </child> </object> </child> </object> </child> <child> - <object class="GtkBox" id="box_username_entry"> + <!-- entry username --> + <object class="GtkListBoxRow"> <property name="visible">True</property> - <property name="valign">center</property> - <property name="halign">center</property> - <property name="orientation">horizontal</property> - <property name="spacing">10</property> - <property name="margin-start">26</property> - </object> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="halign">center</property> - <property name="orientation">horizontal</property> + <property name="can_focus">True</property> + <property name="halign">fill</property> <child> - <object class="GtkLabel" id="label_enter_password"> + <object class="GtkBox" id="box_username_entry"> <property name="visible">True</property> - <property name="label" translatable="yes">Password (confirm):</property> - <property name="tooltip_text" translatable="yes">This password will be used to encrypt your account data and to link new devices to your account.</property> + <property name="halign">fill</property> + <property name="orientation">horizontal</property> + <property name="margin_left">10</property> + <property name="margin_right">10</property> + <property name="margin_top">10</property> + <property name="margin_bottom">10</property> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Username</property> + </object> + </child> </object> </child> </object> </child> <child> - <object class="GtkEntry" id="entry_password"> - <property name="halign">center</property> - <property name="width-chars">40</property> + <!-- Password --> + <object class="GtkListBoxRow"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="xalign">0.5</property> - <property name="visibility">False</property> - <property name="primary_icon_stock">gtk-dialog-authentication</property> - <property name="input_purpose">password</property> + <property name="halign">fill</property> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="halign">fill</property> + <property name="orientation">horizontal</property> + <property name="margin_left">10</property> + <property name="margin_right">10</property> + <property name="margin_top">10</property> + <property name="margin_bottom">10</property> + <property name="spacing">10</property> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Password</property> + <property name="tooltip_text" translatable="yes">This password will be used to encrypt your account data and to link new devices to your account.</property> + </object> + </child> + <child> + <object class="GtkEntry" id="entry_password"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="primary_icon_stock">gtk-dialog-authentication</property> + <property name="visibility">False</property> + <property name="input_purpose">password</property> + </object> + <packing> + <property name="pack_type">end</property> + </packing> + </child> + </object> + </child> </object> </child> <child> - <object class="GtkEntry" id="entry_password_confirm"> - <property name="halign">center</property> - <property name="width-chars">40</property> + <!-- Password confirm --> + <object class="GtkListBoxRow"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="xalign">0.5</property> - <property name="visibility">False</property> - <property name="primary_icon_stock">gtk-dialog-authentication</property> - <property name="input_purpose">password</property> - </object> - </child> - <child> - <object class="GtkLabel" id="label_password_error"> - <property name="visible">True</property> - <attributes> - <attribute name="weight" value="bold"/> - <attribute name="foreground" value="red"/> - </attributes> + <property name="halign">fill</property> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="halign">fill</property> + <property name="orientation">horizontal</property> + <property name="margin_left">10</property> + <property name="margin_right">10</property> + <property name="margin_top">10</property> + <property name="margin_bottom">10</property> + <property name="spacing">10</property> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Confirm password</property> + </object> + </child> + <child> + <object class="GtkEntry" id="entry_password_confirm"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="primary_icon_stock">gtk-dialog-authentication</property> + <property name="visibility">False</property> + <property name="input_purpose">password</property> + </object> + <packing> + <property name="pack_type">end</property> + </packing> + </child> + </object> + </child> </object> </child> </object> </child> - <!-- End of profile box object --> </object> - <!-- End of profile box child --> </child> - <!-- end of profile frame object --> + <child> + <object class="GtkLabel" id="label_password_error"> + <property name="visible">True</property> + <attributes> + <attribute name="weight" value="bold"/> + <attribute name="foreground" value="red"/> + </attributes> + </object> + </child> </object> - <!-- End of profile frame child --> </child> <child> <object class="GtkButtonBox">