messenger-gtk

Gtk+3 graphical user interfaces for GNUnet Messenger
Log | Files | Refs | Submodules | README | LICENSE

commit 3a89feb75936fb70c5852e8254d225ed7a20a0fb
parent f52675513361ac166800d2216969ab370c845318
Author: TheJackiMonster <thejackimonster@gmail.com>
Date:   Thu, 17 Mar 2022 13:48:53 +0100

Adjusted setting a custom name to renaming identity with your contact

Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>

Diffstat:
Msrc/ui/contact_info.c | 20+++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/ui/contact_info.c b/src/ui/contact_info.c @@ -44,14 +44,24 @@ handle_contact_edit_button_click(UNUSED GtkButton *button, ) ); + if ((!editable) || (!contact)) + goto skip_change_name; + const gchar *name = gtk_entry_get_text(handle->contact_name_entry); - if ((editable) && (contact)) - GNUNET_CHAT_contact_set_name( - contact, - (name) && (g_utf8_strlen(name, 1))? name : NULL - ); + if ((name) && (0 == g_utf8_strlen(name, 1))) + name = NULL; + + if (GNUNET_CHAT_contact_is_owned(contact)) + if (GNUNET_YES != GNUNET_CHAT_set_name(contact, name)) + gtk_entry_set_text( + handle->contact_name_entry, + GNUNET_CHAT_contact_get_name(contact) + ); + else + GNUNET_CHAT_contact_set_name(contact, name); +skip_change_name: gtk_image_set_from_icon_name( handle->contact_edit_symbol, editable?