mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
LDAP search optimization: don't relaunch narrower search if results are alreay here.
+ fix alignment of buttons in UI
This commit is contained in:
parent
79d3a8d1a2
commit
963f650912
2 changed files with 30 additions and 26 deletions
24
gtk/main.c
24
gtk/main.c
|
|
@ -814,12 +814,22 @@ static gboolean launch_contact_provider_search(void *userdata)
|
|||
{
|
||||
LinphoneLDAPContactProvider* ldap = linphone_gtk_get_ldap();
|
||||
GtkWidget* uribar = GTK_WIDGET(userdata);
|
||||
const gchar* predicate = gtk_entry_get_text((GtkEntry*)uribar);
|
||||
const gchar* predicate = gtk_entry_get_text(GTK_ENTRY(uribar));
|
||||
gchar* previous_search = gtk_object_get_data(GTK_OBJECT(uribar), "previous_search");
|
||||
|
||||
if( ldap && strlen(predicate) >= 3 ){ // don't search too small predicates
|
||||
|
||||
ms_message("launch_contact_provider_search");
|
||||
if( previous_search && (strstr(predicate, previous_search) == predicate) ){
|
||||
ms_message("Don't launch search on already searched data (current: %s, old search: %s)",
|
||||
predicate, previous_search);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// save current search
|
||||
if( previous_search ) ms_free(previous_search);
|
||||
gtk_object_set_data(GTK_OBJECT(uribar), "previous_search", ms_strdup(predicate));
|
||||
|
||||
ms_message("launch_contact_provider_search");
|
||||
LinphoneContactSearch* search =
|
||||
BELLE_SIP_OBJECT_VPTR(ldap,LinphoneContactProvider)->begin_search(
|
||||
LINPHONE_CONTACT_PROVIDER(ldap),
|
||||
|
|
@ -827,13 +837,6 @@ static gboolean launch_contact_provider_search(void *userdata)
|
|||
on_contact_provider_search_results,
|
||||
uribar);
|
||||
|
||||
char *desc = belle_sip_object_to_string(ldap);
|
||||
|
||||
if( desc) {
|
||||
ms_message("ldap: %s", desc);
|
||||
ms_free(desc);
|
||||
}
|
||||
|
||||
if(search)
|
||||
belle_sip_object_ref(search);
|
||||
}
|
||||
|
|
@ -845,13 +848,12 @@ void linphone_gtk_on_uribar_changed(GtkEditable *uribar, gpointer user_data)
|
|||
#ifdef BUILD_LDAP
|
||||
gchar* text = gtk_editable_get_chars(uribar, 0,-1);
|
||||
gint timeout = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(uribar), "complete_timeout"));
|
||||
ms_message("URIBAR changed, new text: %s, userdata %p uribar @%p", text, user_data, uribar);
|
||||
if( text ) g_free(text);
|
||||
|
||||
|
||||
if( timeout != 0 ) {
|
||||
g_source_remove(timeout);
|
||||
}
|
||||
|
||||
timeout = g_timeout_add_seconds(1,(GSourceFunc)launch_contact_provider_search, uribar);
|
||||
|
||||
gtk_object_set_data(GTK_OBJECT(uribar),"complete_timeout", GINT_TO_POINTER(timeout) );
|
||||
|
|
|
|||
|
|
@ -2913,21 +2913,6 @@
|
|||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="ldap_reset">
|
||||
<property name="label" translatable="yes">Reset</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<signal name="clicked" handler="linphone_gtk_ldap_reset" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="ldap_save">
|
||||
<property name="label" translatable="yes">Save</property>
|
||||
|
|
@ -2940,6 +2925,23 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="ldap_reset">
|
||||
<property name="label" translatable="yes">Reset</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<signal name="clicked" handler="linphone_gtk_ldap_reset" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue