Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
ced9d1e5
Commit
ced9d1e5
authored
Sep 12, 2011
by
Rafaël Carré
Browse files
* #5695 : addressbook : remove unused stuff, use static mutex
parent
bc2ebf3a
Changes
3
Hide whitespace changes
Inline
Side-by-side
plugins/addressbook/evolution/addressbook.c
View file @
ced9d1e5
...
...
@@ -131,8 +131,6 @@ addressbook_init(gchar **book_list)
{
printf
(
"Addressbook: Initialize addressbook
\n
"
);
init_eds_mutex
();
fill_books_data
();
addressbook_config_books
(
book_list
);
determine_default_addressbook
();
...
...
plugins/addressbook/evolution/eds.c
View file @
ced9d1e5
...
...
@@ -64,7 +64,7 @@ authenticate_source (EBook *);
* The global addressbook list
*/
GSList
*
books_data
=
NULL
;
G
Mutex
*
books_data_mutex
=
NULL
;
static
GStatic
Mutex
books_data_mutex
=
G_STATIC_MUTEX_INIT
;
/**
* Size of image that will be displayed in contact list
...
...
@@ -106,15 +106,15 @@ books_ready()
{
gboolean
returnValue
;
g_mutex_lock
(
books_data_mutex
);
g_
static_
mutex_lock
(
&
books_data_mutex
);
if
(
books_data
==
NULL
)
{
g_mutex_unlock
(
books_data_mutex
);
g_
static_
mutex_unlock
(
&
books_data_mutex
);
return
FALSE
;
}
returnValue
=
(
g_slist_length
(
books_data
)
>
0
);
g_mutex_unlock
(
books_data_mutex
);
g_
static_
mutex_unlock
(
&
books_data_mutex
);
return
returnValue
;
}
...
...
@@ -128,11 +128,11 @@ books_active()
GSList
*
book_list_iterator
;
book_data_t
*
book_data
;
g_mutex_lock
(
books_data_mutex
);
g_
static_
mutex_lock
(
&
books_data_mutex
);
if
(
books_data
==
NULL
)
{
printf
(
"Addressbook: No books data (%s:%d)
\n
"
,
__FILE__
,
__LINE__
);
g_mutex_unlock
(
books_data_mutex
);
g_
static_
mutex_unlock
(
&
books_data_mutex
);
return
FALSE
;
}
...
...
@@ -142,12 +142,12 @@ books_active()
book_data
=
(
book_data_t
*
)
book_list_iterator
->
data
;
if
(
book_data
->
active
)
{
g_mutex_unlock
(
books_data_mutex
);
g_
static_
mutex_unlock
(
&
books_data_mutex
);
return
TRUE
;
}
}
g_mutex_unlock
(
books_data_mutex
);
g_
static_
mutex_unlock
(
&
books_data_mutex
);
// If no result
return
FALSE
;
...
...
@@ -161,11 +161,11 @@ books_get_book_data_by_uid (gchar *uid)
GSList
*
book_list_iterator
;
book_data_t
*
book_data
;
g_mutex_lock
(
books_data_mutex
);
g_
static_
mutex_lock
(
&
books_data_mutex
);
if
(
books_data
==
NULL
)
{
printf
(
"Addressbook: No books data (%s:%d)
\n
"
,
__FILE__
,
__LINE__
);
g_mutex_unlock
(
books_data_mutex
);
g_
static_
mutex_unlock
(
&
books_data_mutex
);
return
NULL
;
}
...
...
@@ -178,12 +178,12 @@ books_get_book_data_by_uid (gchar *uid)
if
(
strcmp
(
book_data
->
uid
,
uid
)
==
0
)
{
printf
(
"Addressbook: Book %s found
\n
"
,
uid
);
g_mutex_unlock
(
books_data_mutex
);
g_
static_
mutex_unlock
(
&
books_data_mutex
);
return
book_data
;
}
}
g_mutex_unlock
(
books_data_mutex
);
g_
static_
mutex_unlock
(
&
books_data_mutex
);
printf
(
"Addressbook: Could not found Book %s
\n
"
,
uid
);
// If no result
...
...
@@ -440,11 +440,11 @@ init_eds ()
printf
(
"Addressbook: Init evolution data server
\n
"
);
g_mutex_lock
(
books_data_mutex
);
g_
static_
mutex_lock
(
&
books_data_mutex
);
if
(
books_data
==
NULL
)
{
printf
(
"Addressbook: No books data (%s:%d)
\n
"
,
__FILE__
,
__LINE__
);
g_mutex_unlock
(
books_data_mutex
);
g_
static_
mutex_unlock
(
&
books_data_mutex
);
return
;
}
...
...
@@ -469,13 +469,7 @@ init_eds ()
printf
(
"END EVOLUTION INIT %s, %s, %s
\n
"
,
current_uri
,
current_uid
,
current_name
);
g_mutex_unlock
(
books_data_mutex
);
}
void
init_eds_mutex
()
{
books_data_mutex
=
g_mutex_new
();
g_static_mutex_unlock
(
&
books_data_mutex
);
}
/**
...
...
@@ -565,7 +559,7 @@ fill_books_data ()
return
;
}
g_mutex_lock
(
books_data_mutex
);
g_
static_
mutex_lock
(
&
books_data_mutex
);
if
(
books_data
!=
NULL
)
{
empty_books_data
();
...
...
@@ -613,7 +607,7 @@ fill_books_data ()
g_free
(
absuri
);
}
g_mutex_unlock
(
books_data_mutex
);
g_
static_
mutex_unlock
(
&
books_data_mutex
);
g_object_unref
(
source_list
);
}
...
...
@@ -621,7 +615,7 @@ fill_books_data ()
void
determine_default_addressbook
()
{
g_mutex_lock
(
books_data_mutex
);
g_
static_
mutex_lock
(
&
books_data_mutex
);
GSList
*
list_element
=
books_data
;
gboolean
default_found
=
FALSE
;
...
...
@@ -657,7 +651,7 @@ determine_default_addressbook()
list_element
=
g_slist_next
(
list_element
);
}
g_mutex_unlock
(
books_data_mutex
);
g_
static_
mutex_unlock
(
&
books_data_mutex
);
}
void
...
...
@@ -759,11 +753,11 @@ set_current_addressbook (const gchar *name)
if
(
name
==
NULL
)
return
;
g_mutex_lock
(
books_data_mutex
);
g_
static_
mutex_lock
(
&
books_data_mutex
);
if
(
!
books_data
)
{
printf
(
"Addressbook: No books data (%s:%d)
\n
"
,
__FILE__
,
__LINE__
);
g_mutex_unlock
(
books_data_mutex
);
g_
static_
mutex_unlock
(
&
books_data_mutex
);
return
;
}
...
...
@@ -781,7 +775,7 @@ set_current_addressbook (const gchar *name)
printf
(
"Addressbook: Set current addressbook %s, %s, %s
\n
"
,
current_uri
,
current_uid
,
current_name
);
g_mutex_unlock
(
books_data_mutex
);
g_
static_
mutex_unlock
(
&
books_data_mutex
);
}
...
...
plugins/addressbook/evolution/eds.h
View file @
ced9d1e5
...
...
@@ -50,55 +50,12 @@
G_BEGIN_DECLS
/**
* Current search id used to prevent processing
* of previous search
*/
int
current_search_id
;
/**
* Represent a contact entry
*/
/*
typedef struct _Hit {
gchar *name;
GdkPixbuf *photo;
gchar *phone_business;
gchar *phone_home;
gchar *phone_mobile;
} Hit;
*/
/**
* Book structure for "outside world"
*/
/*
typedef struct {
gchar *uid;
gchar *uri;
gchar *name;
gboolean active;
gboolean isdefault;
} book_data_t;
*/
/**
* Free a contact entry
*/
void
free_hit
(
Hit
*
h
);
/**
* Template callback function for the asynchronous search
*/
typedef
void
(
*
SearchAsyncHandler
)
(
GList
*
hits
,
gpointer
user_data
);
/**
* Template callback function for the asynchronous open
*/
typedef
void
(
*
OpenAsyncHandler
)
();
/**
* Initialize the address book.
* Connection to evolution data server
...
...
@@ -106,13 +63,6 @@ typedef void
void
init_eds
();
/**
* We need to initialize multi-threading capabilities
* due to asynchronous callbacks
*/
void
init_eds_mutex
(
void
);
/**
* Fill list of addressbooks
*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment