Hide add contact icon in uribar when the contact is already a friend or if the uri bar is empty.

This commit is contained in:
Ghislain MARY 2015-10-22 11:00:47 +02:00
parent 6fab13434f
commit ed82602038
2 changed files with 6 additions and 3 deletions

View file

@ -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){

View file

@ -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