summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Maddela <[email protected]>2018-12-08 16:38:08 +1100
committerraveit65 <[email protected]>2019-01-19 18:49:12 +0100
commitc85aaec1c46afdd1d7a975dd32d25c835b6daf10 (patch)
tree0156b8faae9a7f23bcf95e9dbbd6329740d3c68b
parent167bfabfc228801bf99736bebb01ccbf2c9a76a8 (diff)
downloadcaja-dropbox-c85aaec1c46afdd1d7a975dd32d25c835b6daf10.tar.bz2
caja-dropbox-c85aaec1c46afdd1d7a975dd32d25c835b6daf10.tar.xz
Remove deprecated glib2.0 API calls
origin commit from: https://github.com/dropbox/nautilus-dropbox/pull/62
-rw-r--r--src/caja-dropbox.c17
-rw-r--r--src/caja-dropbox.h2
-rw-r--r--src/dropbox-command-client.c18
-rw-r--r--src/dropbox-command-client.h2
4 files changed, 15 insertions, 24 deletions
diff --git a/src/caja-dropbox.c b/src/caja-dropbox.c
index c0ffad5..c7e8930 100644
--- a/src/caja-dropbox.c
+++ b/src/caja-dropbox.c
@@ -693,17 +693,12 @@ caja_dropbox_get_file_items(CajaMenuProvider *provider,
CajaDropbox *cvs = CAJA_DROPBOX(provider);
dropbox_command_client_request(&(cvs->dc.dcc), (DropboxCommand *) dgc);
- GTimeVal gtv;
-
/*
* 4. We have to block until it's done because caja expects a reply. But we will
* only block for 50 ms for a reply.
*/
- g_get_current_time(&gtv);
- g_time_val_add(&gtv, 50000);
-
- GHashTable *context_options_response = g_async_queue_timed_pop(reply_queue, &gtv);
+ GHashTable *context_options_response = g_async_queue_timeout_pop(reply_queue, 50000);
g_async_queue_unref(reply_queue);
if (!context_options_response) {
@@ -831,13 +826,13 @@ void get_emblem_paths_cb(GHashTable *emblem_paths_response, CajaDropbox *cvs)
g_hash_table_ref(emblem_paths_response);
}
- g_mutex_lock(cvs->emblem_paths_mutex);
+ g_mutex_lock(&(cvs->emblem_paths_mutex));
if (cvs->emblem_paths) {
g_idle_add((GSourceFunc) remove_emblem_paths, cvs->emblem_paths);
cvs->emblem_paths = NULL;
}
cvs->emblem_paths = emblem_paths_response;
- g_mutex_unlock(cvs->emblem_paths_mutex);
+ g_mutex_unlock(&(cvs->emblem_paths_mutex));
g_idle_add((GSourceFunc) add_emblem_paths, g_hash_table_ref(emblem_paths_response));
g_idle_add((GSourceFunc) reset_all_files, cvs);
@@ -856,11 +851,11 @@ static void
on_disconnect(CajaDropbox *cvs) {
reset_all_files(cvs);
- g_mutex_lock(cvs->emblem_paths_mutex);
+ g_mutex_lock(&(cvs->emblem_paths_mutex));
/* This call will free the data too. */
g_idle_add((GSourceFunc) remove_emblem_paths, cvs->emblem_paths);
cvs->emblem_paths = NULL;
- g_mutex_unlock(cvs->emblem_paths_mutex);
+ g_mutex_unlock(&(cvs->emblem_paths_mutex));
}
@@ -887,7 +882,7 @@ caja_dropbox_instance_init (CajaDropbox *cvs) {
(GEqualFunc) g_direct_equal,
(GDestroyNotify) NULL,
(GDestroyNotify) g_free);
- cvs->emblem_paths_mutex = g_mutex_new();
+ g_mutex_init(&(cvs->emblem_paths_mutex));
cvs->emblem_paths = NULL;
/* setup the connection obj*/
diff --git a/src/caja-dropbox.h b/src/caja-dropbox.h
index 0628e06..c9765a3 100644
--- a/src/caja-dropbox.h
+++ b/src/caja-dropbox.h
@@ -49,7 +49,7 @@ struct _CajaDropbox {
GObject parent_slot;
GHashTable *filename2obj;
GHashTable *obj2filename;
- GMutex *emblem_paths_mutex;
+ GMutex emblem_paths_mutex;
GHashTable *emblem_paths;
DropboxClient dc;
};
diff --git a/src/dropbox-command-client.c b/src/dropbox-command-client.c
index 29025bf..c0005b9 100644
--- a/src/dropbox-command-client.c
+++ b/src/dropbox-command-client.c
@@ -645,9 +645,9 @@ dropbox_command_client_thread(DropboxCommandClient *dcc) {
g_io_channel_set_line_term(chan, "\n", -1);
#define SET_CONNECTED_STATE(s) { \
- g_mutex_lock(dcc->command_connected_mutex); \
+ g_mutex_lock(&(dcc->command_connected_mutex)); \
dcc->command_connected = s; \
- g_mutex_unlock(dcc->command_connected_mutex); \
+ g_mutex_unlock(&(dcc->command_connected_mutex)); \
}
SET_CONNECTED_STATE(TRUE);
@@ -658,12 +658,9 @@ dropbox_command_client_thread(DropboxCommandClient *dcc) {
DropboxCommand *dc;
while (1) {
- GTimeVal gtv;
- g_get_current_time(&gtv);
- g_time_val_add(&gtv, G_USEC_PER_SEC / 10);
/* get a request from caja */
- dc = g_async_queue_timed_pop(dcc->command_queue, &gtv);
+ dc = g_async_queue_timeout_pop(dcc->command_queue, G_USEC_PER_SEC / 10);
if (dc != NULL) {
break;
}
@@ -735,9 +732,9 @@ gboolean
dropbox_command_client_is_connected(DropboxCommandClient *dcc) {
gboolean command_connected;
- g_mutex_lock(dcc->command_connected_mutex);
+ g_mutex_lock(&(dcc->command_connected_mutex));
command_connected = dcc->command_connected;
- g_mutex_unlock(dcc->command_connected_mutex);
+ g_mutex_unlock(&(dcc->command_connected_mutex));
return command_connected;
}
@@ -760,7 +757,7 @@ dropbox_command_client_request(DropboxCommandClient *dcc, DropboxCommand *dc) {
void
dropbox_command_client_setup(DropboxCommandClient *dcc) {
dcc->command_queue = g_async_queue_new();
- dcc->command_connected_mutex = g_mutex_new();
+ g_mutex_init(&(dcc->command_connected_mutex));
dcc->command_connected = FALSE;
dcc->ca_hooklist = NULL;
@@ -814,8 +811,7 @@ void
dropbox_command_client_start(DropboxCommandClient *dcc) {
/* setup the connect to the command server */
debug("starting command thread");
- g_thread_create((gpointer (*)(gpointer data)) dropbox_command_client_thread,
- dcc, FALSE, NULL);
+ g_thread_new(NULL, (GThreadFunc) dropbox_command_client_thread, dcc);
}
/* thread safe */
diff --git a/src/dropbox-command-client.h b/src/dropbox-command-client.h
index 1c1b279..0f46f00 100644
--- a/src/dropbox-command-client.h
+++ b/src/dropbox-command-client.h
@@ -65,7 +65,7 @@ typedef void (*DropboxCommandClientConnectionAttemptHook)(guint, gpointer);
typedef GHookFunc DropboxCommandClientConnectHook;
typedef struct {
- GMutex *command_connected_mutex;
+ GMutex command_connected_mutex;
gboolean command_connected;
GAsyncQueue *command_queue;
GList *ca_hooklist;