Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
c71baeaf
Commit
c71baeaf
authored
14 years ago
by
Alexandre Savard
Browse files
Options
Downloads
Patches
Plain Diff
[#5695] Fix addressbook initialization and search bar update
parent
3dba0947
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
sflphone-client-gnome/src/contacts/addressbook/eds.c
+59
-8
59 additions, 8 deletions
sflphone-client-gnome/src/contacts/addressbook/eds.c
sflphone-client-gnome/src/contacts/searchbar.c
+11
-8
11 additions, 8 deletions
sflphone-client-gnome/src/contacts/searchbar.c
with
70 additions
and
16 deletions
sflphone-client-gnome/src/contacts/addressbook/eds.c
+
59
−
8
View file @
c71baeaf
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
e_book
* Additional permission under GNU GPL version 3 section 7:
* Additional permission under GNU GPL version 3 section 7:
*
*
* If you modify this program, or any covered work, by linking or
* If you modify this program, or any covered work, by linking or
...
@@ -44,6 +44,8 @@
...
@@ -44,6 +44,8 @@
#include
<addressbook-config.h>
#include
<addressbook-config.h>
#include
<libedataserver/e-source.h>
#include
<libedataserver/e-source.h>
// #define LIBEBOOK_VERSION_230
/**
/**
* Structure used to store search callback and data
* Structure used to store search callback and data
*/
*/
...
@@ -75,7 +77,6 @@ static const int pixbuf_size = 32;
...
@@ -75,7 +77,6 @@ static const int pixbuf_size = 32;
static
gchar
*
current_uri
=
NULL
;
static
gchar
*
current_uri
=
NULL
;
static
gchar
*
current_uid
=
NULL
;
static
gchar
*
current_uid
=
NULL
;
static
gchar
*
current_name
=
"Default"
;
static
gchar
*
current_name
=
"Default"
;
static
book_data_t
*
current_book
=
NULL
;
static
EBookQueryTest
current_test
=
E_BOOK_QUERY_BEGINS_WITH
;
static
EBookQueryTest
current_test
=
E_BOOK_QUERY_BEGINS_WITH
;
...
@@ -309,16 +310,28 @@ view_finish_callback (EBookView *book_view, Search_Handler_And_Data *had)
...
@@ -309,16 +310,28 @@ view_finish_callback (EBookView *book_view, Search_Handler_And_Data *had)
/**
/**
* Callback called after a contact have been found in EDS by search_async_by_contacts.
* Callback called after a contact have been found in EDS by search_async_by_contacts.
*/
*/
#ifdef LIBEBOOK_VERSION_230
static
void
eds_query_result_cb
(
EBook
*
book
,
EBookStatus
status
,
GList
*
contacts
,
gpointer
user_data
)
{
DEBUG
(
"Addressbook: Search Result callback called"
);
if
(
status
!=
E_BOOK_ERROR_OK
)
{
ERROR
(
"Addressbook: Error: "
);
return
;
}
#else
void
void
eds_query_result_cb
(
EBook
*
book
,
const
GError
*
error
,
GList
*
contacts
,
gpointer
user_data
)
eds_query_result_cb
(
EBook
*
book
,
const
GError
*
error
,
GList
*
contacts
,
gpointer
user_data
)
{
{
DEBUG
(
"Addressbook: Search Result callback called"
);
DEBUG
(
"Addressbook: Search Result callback called"
);
if
(
error
)
{
if
(
error
)
{
ERROR
(
"Addressbook: Error: %s"
,
error
->
message
);
ERROR
(
"Addressbook: Error: %s"
,
error
->
message
);
return
;
return
;
}
}
#endif
Search_Handler_And_Data
*
had
=
(
Search_Handler_And_Data
*
)
user_data
;
Search_Handler_And_Data
*
had
=
(
Search_Handler_And_Data
*
)
user_data
;
...
@@ -376,6 +389,18 @@ eds_query_result_cb (EBook *book, const GError *error, GList *contacts, gpointer
...
@@ -376,6 +389,18 @@ eds_query_result_cb (EBook *book, const GError *error, GList *contacts, gpointer
/**
/**
* Callback for asynchronous open of books
* Callback for asynchronous open of books
*/
*/
#ifdef LIBEBOOK_VERSION_230
static
void
eds_async_open_callback
(
EBook
*
book
,
EBookStatus
status
,
gpointer
closure
)
{
ESource
*
source
;
const
gchar
*
uri
;
if
(
status
==
E_BOOK_ERROR_OK
)
{
ERROR
(
"Addressbook: Error: "
);
return
;
}
#else
void
void
eds_async_open_callback
(
EBook
*
book
,
const
GError
*
error
,
gpointer
closure
)
eds_async_open_callback
(
EBook
*
book
,
const
GError
*
error
,
gpointer
closure
)
{
{
...
@@ -389,6 +414,8 @@ eds_async_open_callback (EBook *book, const GError *error, gpointer closure)
...
@@ -389,6 +414,8 @@ eds_async_open_callback (EBook *book, const GError *error, gpointer closure)
return
;
return
;
}
}
#endif
Search_Handler_And_Data
*
had
=
(
Search_Handler_And_Data
*
)
closure
;
Search_Handler_And_Data
*
had
=
(
Search_Handler_And_Data
*
)
closure
;
if
(
!
(
source
=
e_book_get_source
(
book
)))
{
if
(
!
(
source
=
e_book_get_source
(
book
)))
{
...
@@ -406,9 +433,15 @@ eds_async_open_callback (EBook *book, const GError *error, gpointer closure)
...
@@ -406,9 +433,15 @@ eds_async_open_callback (EBook *book, const GError *error, gpointer closure)
e_book_open
(
book
,
FALSE
,
NULL
);
e_book_open
(
book
,
FALSE
,
NULL
);
}
}
#ifdef LIBEBOOK_VERSION_230
if
(
e_book_async_get_contacts
(
book
,
had
->
equery
,
eds_query_result_cb
,
had
))
ERROR
(
"Addressbook: Error: While querying addressbook"
);
#else
if
(
!
e_book_get_contacts_async
(
book
,
had
->
equery
,
eds_query_result_cb
,
had
))
{
if
(
!
e_book_get_contacts_async
(
book
,
had
->
equery
,
eds_query_result_cb
,
had
))
{
ERROR
(
"Addressbook: Error: While querying addressbook"
);
ERROR
(
"Addressbook: Error: While querying addressbook"
);
}
}
#endif
}
}
/**
/**
...
@@ -449,7 +482,7 @@ init_eds ()
...
@@ -449,7 +482,7 @@ init_eds ()
}
}
}
}
DEBUG
(
"END EVOLUTION %s, %s, %s"
,
current_uri
,
current_uid
,
current_name
);
DEBUG
(
"END EVOLUTION
INIT
%s, %s, %s"
,
current_uri
,
current_uid
,
current_name
);
g_mutex_unlock
(
books_data_mutex
);
g_mutex_unlock
(
books_data_mutex
);
}
}
...
@@ -613,8 +646,12 @@ determine_default_addressbook()
...
@@ -613,8 +646,12 @@ determine_default_addressbook()
while
(
list_element
&&
!
default_found
)
{
while
(
list_element
&&
!
default_found
)
{
book_data_t
*
book_data
=
list_element
->
data
;
book_data_t
*
book_data
=
list_element
->
data
;
if
(
book_data
->
isdefault
)
if
(
book_data
->
isdefault
)
{
default_found
=
TRUE
;
default_found
=
TRUE
;
current_uri
=
book_data
->
uri
;
current_uid
=
book_data
->
uid
;
current_name
=
book_data
->
name
;
}
list_element
=
g_slist_next
(
list_element
);
list_element
=
g_slist_next
(
list_element
);
}
}
...
@@ -626,9 +663,12 @@ determine_default_addressbook()
...
@@ -626,9 +663,12 @@ determine_default_addressbook()
book_data_t
*
book_data
=
list_element
->
data
;
book_data_t
*
book_data
=
list_element
->
data
;
if
(
book_data
->
active
)
{
if
(
book_data
->
active
)
{
default_found
=
TRUE
;
book_data
->
isdefault
=
TRUE
;
book_data
->
isdefault
=
TRUE
;
current_uri
=
book_data
->
uri
;
current_uid
=
book_data
->
uid
;
current_name
=
book_data
->
name
;
DEBUG
(
"Addressbook: No default addressbook found, using %s addressbook as default"
,
book_data
->
name
);
DEBUG
(
"Addressbook: No default addressbook found, using %s addressbook as default"
,
book_data
->
name
);
default_found
=
TRUE
;
}
}
list_element
=
g_slist_next
(
list_element
);
list_element
=
g_slist_next
(
list_element
);
...
@@ -683,7 +723,7 @@ search_async_by_contacts (const char *query, int max_results, SearchAsyncHandler
...
@@ -683,7 +723,7 @@ search_async_by_contacts (const char *query, int max_results, SearchAsyncHandler
had
->
equery
=
create_query
(
query
,
current_test
,
(
AddressBook_Config
*
)
(
user_data
));
had
->
equery
=
create_query
(
query
,
current_test
,
(
AddressBook_Config
*
)
(
user_data
));
if
(
!
current_uri
)
{
if
(
!
current_uri
)
{
ERROR
(
"Addressbook: Error: Current addressbook uri not specified
uri
"
);
ERROR
(
"Addressbook: Error: Current addressbook uri not specified"
);
}
}
DEBUG
(
"Addressbook: Opening addressbook: uri: %s"
,
current_uri
);
DEBUG
(
"Addressbook: Opening addressbook: uri: %s"
,
current_uri
);
...
@@ -698,8 +738,15 @@ search_async_by_contacts (const char *query, int max_results, SearchAsyncHandler
...
@@ -698,8 +738,15 @@ search_async_by_contacts (const char *query, int max_results, SearchAsyncHandler
if
(
book
)
{
if
(
book
)
{
DEBUG
(
"Addressbook: Created empty book successfully"
);
DEBUG
(
"Addressbook: Created empty book successfully"
);
#ifdef LIBEBOOK_VERSION_230
// Asynchronous open
// Asynchronous open
e_book_async_open
(
book
,
TRUE
,
eds_async_open_callback
,
had
);
#else
e_book_open_async
(
book
,
TRUE
,
eds_async_open_callback
,
had
);
e_book_open_async
(
book
,
TRUE
,
eds_async_open_callback
,
had
);
#endif
}
else
{
}
else
{
ERROR
(
"Addressbook: Error: No book available"
);
ERROR
(
"Addressbook: Error: No book available"
);
}
}
...
@@ -730,6 +777,9 @@ set_current_addressbook (const gchar *name)
...
@@ -730,6 +777,9 @@ set_current_addressbook (const gchar *name)
GSList
*
book_list_iterator
;
GSList
*
book_list_iterator
;
book_data_t
*
book_data
;
book_data_t
*
book_data
;
if
(
name
==
NULL
)
return
;
g_mutex_lock
(
books_data_mutex
);
g_mutex_lock
(
books_data_mutex
);
if
(
!
books_data
)
{
if
(
!
books_data
)
{
...
@@ -747,10 +797,11 @@ set_current_addressbook (const gchar *name)
...
@@ -747,10 +797,11 @@ set_current_addressbook (const gchar *name)
current_uri
=
book_data
->
uri
;
current_uri
=
book_data
->
uri
;
current_uid
=
book_data
->
uid
;
current_uid
=
book_data
->
uid
;
current_name
=
book_data
->
name
;
current_name
=
book_data
->
name
;
current_book
=
book_data
;
}
}
}
}
DEBUG
(
"Addressbook: Set current addressbook %s, %s, %s"
,
current_uri
,
current_uid
,
current_name
);
g_mutex_unlock
(
books_data_mutex
);
g_mutex_unlock
(
books_data_mutex
);
}
}
...
...
This diff is collapsed.
Click to expand it.
sflphone-client-gnome/src/contacts/searchbar.c
+
11
−
8
View file @
c71baeaf
...
@@ -97,7 +97,7 @@ void update_searchbar_addressbook_list()
...
@@ -97,7 +97,7 @@ void update_searchbar_addressbook_list()
GtkTreeIter
iter
,
activeIter
;
GtkTreeIter
iter
,
activeIter
;
gchar
*
activeText
;
gchar
*
activeText
;
GSList
*
book_list_iterator
;
GSList
*
book_list_iterator
;
book_data_t
*
book_data
;
book_data_t
*
book_data
,
*
activeBook
;
GSList
*
books_data
=
addressbook_get_books_data
();
GSList
*
books_data
=
addressbook_get_books_data
();
DEBUG
(
"Searchbar: Update addressbook list"
);
DEBUG
(
"Searchbar: Update addressbook list"
);
...
@@ -132,10 +132,18 @@ void update_searchbar_addressbook_list()
...
@@ -132,10 +132,18 @@ void update_searchbar_addressbook_list()
}
}
}
}
if
(
activeIsSet
)
if
(
activeIsSet
)
{
gtk_combo_box_set_active_iter
(
GTK_COMBO_BOX
(
cbox
),
&
activeIter
);
gtk_combo_box_set_active_iter
(
GTK_COMBO_BOX
(
cbox
),
&
activeIter
);
else
set_current_addressbook
(
activeText
);
}
else
{
gtk_combo_box_set_active
(
GTK_COMBO_BOX
(
cbox
),
0
);
gtk_combo_box_set_active
(
GTK_COMBO_BOX
(
cbox
),
0
);
gtk_combo_box_get_active_text
(
GTK_COMBO_BOX
(
cbox
));
set_current_addressbook
(
gtk_combo_box_get_active_text
(
GTK_COMBO_BOX
(
cbox
)));
}
g_free
(
activeText
);
g_free
(
activeText
);
cboxSignalId
=
gtk_signal_connect
(
GTK_OBJECT
(
cbox
),
"changed"
,
G_CALLBACK
(
cbox_changed_cb
),
NULL
);
cboxSignalId
=
gtk_signal_connect
(
GTK_OBJECT
(
cbox
),
"changed"
,
G_CALLBACK
(
cbox_changed_cb
),
NULL
);
...
@@ -293,11 +301,6 @@ void searchbar_init (calltab_t *tab)
...
@@ -293,11 +301,6 @@ void searchbar_init (calltab_t *tab)
}
}
}
}
void
addressbook_searchbar_update
()
{
}
GtkWidget
*
history_searchbar_new
(
void
)
GtkWidget
*
history_searchbar_new
(
void
)
{
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment