From ed826020384584ac09f330aacf35fe704de139c8 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 22 Oct 2015 11:00:47 +0200 Subject: [PATCH] Hide add contact icon in uribar when the contact is already a friend or if the uri bar is empty. --- gtk/friendlist.c | 7 +++++-- gtk/main.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gtk/friendlist.c b/gtk/friendlist.c index 6cad96ad6..036f69d20 100644 --- a/gtk/friendlist.c +++ b/gtk/friendlist.c @@ -457,17 +457,19 @@ static void icon_press_handler(GtkEntry *entry){ } static void update_star(GtkEntry *entry, gboolean is_known){ - gtk_entry_set_icon_from_icon_name(entry,GTK_ENTRY_ICON_SECONDARY,"linphone-contact-add"); if (is_known){ + gtk_entry_set_icon_from_icon_name(entry,GTK_ENTRY_ICON_SECONDARY,NULL); gtk_entry_set_icon_sensitive(GTK_ENTRY(entry),GTK_ENTRY_ICON_SECONDARY,FALSE); gtk_entry_set_icon_tooltip_text(GTK_ENTRY(entry),GTK_ENTRY_ICON_SECONDARY,NULL); }else{ + gtk_entry_set_icon_from_icon_name(entry,GTK_ENTRY_ICON_SECONDARY,"linphone-contact-add"); gtk_entry_set_icon_sensitive(GTK_ENTRY(entry),GTK_ENTRY_ICON_SECONDARY,TRUE); gtk_entry_set_icon_tooltip_text(GTK_ENTRY(entry),GTK_ENTRY_ICON_SECONDARY,_("Add to addressbook")); } } static void check_contact(GtkEditable *editable, LinphoneCore *lc){ + bool_t known = TRUE; char *tmp=gtk_editable_get_chars(editable,0,-1); if (tmp!=NULL){ if (strlen(tmp)>0){ @@ -483,10 +485,11 @@ static void check_contact(GtkEditable *editable, LinphoneCore *lc){ return; } } + known = FALSE; } g_free(tmp); } - update_star(GTK_ENTRY(editable),FALSE); + update_star(GTK_ENTRY(editable), known); } static void linphone_gtk_init_bookmark_icon(void){ diff --git a/gtk/main.c b/gtk/main.c index 9debf60c4..0fbc92423 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1860,10 +1860,10 @@ static void linphone_gtk_init_main_window(){ GtkWidget *main_window; linphone_gtk_configure_main_window(); linphone_gtk_manage_login(); - load_uri_history(); linphone_gtk_load_identities(); linphone_gtk_set_my_presence(linphone_core_get_presence_info(linphone_gtk_get_core())); linphone_gtk_show_friends(); + load_uri_history(); linphone_core_reset_missed_calls_count(linphone_gtk_get_core()); main_window=linphone_gtk_get_main_window(); #ifndef CALL_LOGS_STORAGE_ENABLED