diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2018-01-16 17:34:21 +0000 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2018-01-16 17:34:21 +0000 |
commit | 02e2208f46f4e2c00fb9743cbc47350bdd233bfa (patch) | |
tree | 132dd60828854db4f65f30f9230f43d9602507ff /media-plugins/gkrellmpc/files | |
parent | 8be70107efbb417f839292165ee39d07a062046f (diff) |
gentoo resync : 16.01.2018
Diffstat (limited to 'media-plugins/gkrellmpc/files')
-rw-r--r-- | media-plugins/gkrellmpc/files/gkrellmpc-0.1_beta9-mt.patch | 152 |
1 files changed, 0 insertions, 152 deletions
diff --git a/media-plugins/gkrellmpc/files/gkrellmpc-0.1_beta9-mt.patch b/media-plugins/gkrellmpc/files/gkrellmpc-0.1_beta9-mt.patch deleted file mode 100644 index 4de5688a2b5e..000000000000 --- a/media-plugins/gkrellmpc/files/gkrellmpc-0.1_beta9-mt.patch +++ /dev/null @@ -1,152 +0,0 @@ -diff -uNr gkrellmpc-0.1_beta9/gkrellmpc.c gkrellmpc-0.1_beta9.mine/gkrellmpc.c ---- gkrellmpc-0.1_beta9/gkrellmpc.c 2005-01-05 22:33:16.000000000 +0300 -+++ gkrellmpc-0.1_beta9.mine/gkrellmpc.c 2009-04-05 19:51:12.000000000 +0400 -@@ -132,7 +132,7 @@ - /* Create the status decal */ - mpc_status_decal = gkrellm_create_decal_pixmap(mpc_panel, gkrellm_decal_misc_pixmap(), gkrellm_decal_misc_mask(), N_MISC_DECALS, style, 0, t); - mpc_status_decal->x = w - mpc_status_decal->w; -- gkrellm_draw_decal_pixmap(mpc_panel, mpc_status_decal, (mpc_mpd ? D_MISC_LED1 : D_MISC_LED0)); -+ gkrellm_draw_decal_pixmap(mpc_panel, mpc_status_decal, (mpc_mpd_connected() ? D_MISC_LED1 : D_MISC_LED0)); - - /* Update t */ - t += mpc_label_decal->h > mpc_status_decal->h ? mpc_label_decal->h : mpc_status_decal->h; -@@ -254,7 +254,7 @@ - static gint x_scroll; - - /* Try to connect to mpd */ -- if (!mpc_mpd && mpc_ticker->ten_second_tick) { -+ if (!mpc_mpd_connected() && mpc_ticker->ten_second_tick) { - mpc_mpd_connect(); - } - -@@ -428,7 +428,7 @@ - status = mpc_mpd_get("status\n"); - currentsong = mpc_mpd_get("currentsong\n"); - -- if (!mpc_mpd) { -+ if (!mpc_mpd_connected()) { - mpc_update_label("NO MPD"); - mpc_update_songname(""); - } -diff -uNr gkrellmpc-0.1_beta9/mpd.c gkrellmpc-0.1_beta9.mine/mpd.c ---- gkrellmpc-0.1_beta9/mpd.c 2005-01-05 22:33:16.000000000 +0300 -+++ gkrellmpc-0.1_beta9.mine/mpd.c 2009-04-05 20:30:38.000000000 +0400 -@@ -12,18 +12,32 @@ - #include <sys/socket.h> - #include <netdb.h> - -+#include <errno.h> -+#include <pthread.h> -+ - GIOChannel * mpc_mpd = NULL; -+pthread_mutex_t mpc_mutex = { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0, { 0 } } }; //PTHREAD_MUTEX_INITIALIZER; -+ -+gboolean mpc_mpd_connected() { -+ if(pthread_mutex_trylock(&mpc_mutex)){ -+ return (FALSE); -+ } -+ pthread_mutex_unlock(&mpc_mutex); -+ return (gboolean)mpc_mpd; -+} - - /* - * Connects to the MPD server, sets up the mpd object, sets the status decal to ON - */ --gboolean mpc_mpd_connect() { -+void* mpc_mpd_connect_worker(void* arg) { - int sockfd; - struct hostent *server; - struct sockaddr_in serv_addr; - gchar * line; - gchar ** parts; - gboolean retval; -+ -+ pthread_mutex_lock(&mpc_mutex); - - if (mpc_mpd) { - /* -@@ -33,11 +47,11 @@ - } - - if (!mpc_conf_hostname || !mpc_conf_port) { -- return (FALSE); -+ goto err; - } - -- if ((sockfd = socket(PF_INET, SOCK_STREAM, 0)) == -1) return(FALSE); -- if (!(server = gethostbyname(mpc_conf_hostname))) return(FALSE); -+ if ((sockfd = socket(PF_INET, SOCK_STREAM, 0)) == -1) goto err; -+ if (!(server = gethostbyname(mpc_conf_hostname))) goto err; - - bzero((char *) &serv_addr, sizeof(serv_addr)); - serv_addr.sin_family = AF_INET; -@@ -46,7 +60,7 @@ - server->h_length); - serv_addr.sin_port = htons(mpc_conf_port); - -- if (connect(sockfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) < 0) return(FALSE); -+ if (connect(sockfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) < 0) goto err; - - /* Getup the mpd object */ - mpc_mpd = g_io_channel_unix_new(sockfd); -@@ -72,29 +86,40 @@ - retval = FALSE; - } - -- if (retval) { -- gkrellm_draw_decal_pixmap(mpc_panel, mpc_status_decal, D_MISC_LED1); -- mpc_update_label("MPD"); -- mpc_update_songname(""); -- } - -- return(retval); -+err: -+ pthread_mutex_unlock(&mpc_mutex); -+ return NULL; -+} -+ -+gboolean mpc_mpd_connect() { -+ pthread_attr_t attr; -+ pthread_t thread_id; -+ -+ if(pthread_mutex_trylock(&mpc_mutex)){ -+ return (FALSE); -+ } -+ -+ pthread_attr_init(&attr); -+ pthread_create(&thread_id, &attr, mpc_mpd_connect_worker, NULL); -+ -+ pthread_mutex_unlock(&mpc_mutex); -+ -+ return (FALSE); - } - - /* - * Disconnects from MPD, destroys the mpd object, sets the status decal to off - */ - gboolean mpc_mpd_disconnect() { -- -+ pthread_mutex_lock(&mpc_mutex); - if (mpc_mpd) { - g_io_channel_shutdown(mpc_mpd, FALSE, NULL); - free(mpc_mpd); - mpc_mpd = NULL; - } - -- gkrellm_draw_decal_pixmap(mpc_panel, mpc_status_decal, D_MISC_LED0); -- mpc_update_label("NO MPD"); -- mpc_update_songname(""); -+ pthread_mutex_unlock(&mpc_mutex); - return (TRUE); - } - -diff -uNr gkrellmpc-0.1_beta9/mpd.h gkrellmpc-0.1_beta9.mine/mpd.h ---- gkrellmpc-0.1_beta9/mpd.h 2005-01-05 22:33:16.000000000 +0300 -+++ gkrellmpc-0.1_beta9.mine/mpd.h 2009-04-05 19:51:25.000000000 +0400 -@@ -10,5 +10,6 @@ - gboolean mpc_mpd_do(gchar *); - GHashTable * mpc_mpd_get(gchar *); - GPtrArray * mpc_mpd_get_clumps(gchar *, gboolean); -+gboolean mpc_mpd_connected(); - - #endif |