diff options
author | Samuli Suominen <ssuominen@gentoo.org> | 2009-05-11 22:08:53 +0000 |
---|---|---|
committer | Samuli Suominen <ssuominen@gentoo.org> | 2009-05-11 22:08:53 +0000 |
commit | a772d2b1aa9da1b739a0cbb736cd9d2fe704e427 (patch) | |
tree | 5f5ee9fbc5e1df512b8c83f2469121c893633d16 /media-plugins/gkrellmpc | |
parent | New version for GNOME 2.26. Clean up old revisions. (diff) | |
download | historical-a772d2b1aa9da1b739a0cbb736cd9d2fe704e427.tar.gz historical-a772d2b1aa9da1b739a0cbb736cd9d2fe704e427.tar.bz2 historical-a772d2b1aa9da1b739a0cbb736cd9d2fe704e427.zip |
Use separate thread to init connection patch by dimonb wrt #264986.
Package-Manager: portage-2.1.6.13/cvs/Linux x86_64
Diffstat (limited to 'media-plugins/gkrellmpc')
-rw-r--r-- | media-plugins/gkrellmpc/ChangeLog | 11 | ||||
-rw-r--r-- | media-plugins/gkrellmpc/Manifest | 16 | ||||
-rw-r--r-- | media-plugins/gkrellmpc/files/gkrellmpc-0.1_beta9-mt.patch | 152 | ||||
-rw-r--r-- | media-plugins/gkrellmpc/gkrellmpc-0.1_beta9-r1.ebuild | 26 | ||||
-rw-r--r-- | media-plugins/gkrellmpc/gkrellmpc-0.1_beta9.ebuild | 18 |
5 files changed, 203 insertions, 20 deletions
diff --git a/media-plugins/gkrellmpc/ChangeLog b/media-plugins/gkrellmpc/ChangeLog index 935a69db761f..e88c854f89ea 100644 --- a/media-plugins/gkrellmpc/ChangeLog +++ b/media-plugins/gkrellmpc/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for media-plugins/gkrellmpc -# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/media-plugins/gkrellmpc/ChangeLog,v 1.8 2008/05/30 06:59:59 phreak Exp $ +# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/media-plugins/gkrellmpc/ChangeLog,v 1.9 2009/05/11 22:08:53 ssuominen Exp $ + +*gkrellmpc-0.1_beta9-r1 (11 May 2009) + + 11 May 2009; Samuli Suominen <ssuominen@gentoo.org> + gkrellmpc-0.1_beta9.ebuild, +gkrellmpc-0.1_beta9-r1.ebuild, + +files/gkrellmpc-0.1_beta9-mt.patch: + Use separate thread to init connection patch by dimonb wrt #264986. 30 May 2008; Christian Heim <phreak@gentoo.org> metadata.xml: Removing Andrej Kacian (Ticho) from metadata.xml (as per #59986). diff --git a/media-plugins/gkrellmpc/Manifest b/media-plugins/gkrellmpc/Manifest index 10be1310603e..51d4a141a5f0 100644 --- a/media-plugins/gkrellmpc/Manifest +++ b/media-plugins/gkrellmpc/Manifest @@ -1,14 +1,6 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - +AUX gkrellmpc-0.1_beta9-mt.patch 4427 RMD160 f5a84395ce5661d822a2e204000885676bf1b2aa SHA1 c5cff57a1f877b9c0a1928802df809f347218038 SHA256 7d4489d8980048fba81604b312ee5db3806296e2d249d318643d75fffd9741bd DIST gkrellmpc-0.1_beta9.tar.gz 22029 RMD160 760d2565b17bbd667ed259da4214b516a98e551c SHA1 c19f842307086fd3783a825e2073111b2eb33727 SHA256 b4fed5b55afdeefe978d1ab7f82a0e2f79b15ea2158110775cf6e05616ded9e2 -EBUILD gkrellmpc-0.1_beta9.ebuild 520 RMD160 31d82653e6600fb92e50dba0b1c7707b1a867c6a SHA1 f8434dee6439fdb36451a27f22e0063b5468ed15 SHA256 7860c20fa2642144b1d02376e75a104ca63a032a488ed7a1fa0a2edf6d9c9bf3 -MISC ChangeLog 1290 RMD160 eabdfe38689896584bd061dd6211a86452de1c9a SHA1 1812719cbea13da49d8cf7b3f24889c247a37f6f SHA256 d6f14668171b261aafc2a56b868f800cbcd4b7e68e57695cc0cb55eba559f7bb +EBUILD gkrellmpc-0.1_beta9-r1.ebuild 671 RMD160 8470305f0b1ea3a608e8a7cfc5b80ea883613fb8 SHA1 0aa4e177d2391e1161f66fc55469cc2735a07747 SHA256 5651374e8b4d6d14993177129d62091c7bde864e5e7a923b030304d3789c7e67 +EBUILD gkrellmpc-0.1_beta9.ebuild 605 RMD160 33421bf593e0756bb18a6064aa4385020ea605a6 SHA1 bef6754d8534d333c6081c8b316a2f6d215d0579 SHA256 b1da060d8030adb2e7ffbd3ac9f06e50f28ffb9505af7584ea6ac9f49372b9fa +MISC ChangeLog 1558 RMD160 aa09a994fa54a03acd12f1558cb89d450ab64912 SHA1 05fbd47033a57b965a202fdcad040518c37fcc08 SHA256 d99ebae2f60b8cec4b7b99fdc4f6ba5de5063894dc925cd6ebb49be0e9107007 MISC metadata.xml 269 RMD160 ac9a6fbfe315f3efc9968d21629ea693e658458e SHA1 1f7c600137b4fe96c901cd65121fb45930d670a6 SHA256 051bba0aec5d21799d64cf9c74690f4c457989d425ee711b5b36861915df7cbd ------BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.9 (GNU/Linux) - -iEYEARECAAYFAkg/pfQACgkQyuNVb5qfaOb19ACdFZDFQ4up/Q15B1OH5K7Ifm3d -45sAnRa6fmQv/5abTxdBc4XPguveKIFm -=h9v2 ------END PGP SIGNATURE----- diff --git a/media-plugins/gkrellmpc/files/gkrellmpc-0.1_beta9-mt.patch b/media-plugins/gkrellmpc/files/gkrellmpc-0.1_beta9-mt.patch new file mode 100644 index 000000000000..4de5688a2b5e --- /dev/null +++ b/media-plugins/gkrellmpc/files/gkrellmpc-0.1_beta9-mt.patch @@ -0,0 +1,152 @@ +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 diff --git a/media-plugins/gkrellmpc/gkrellmpc-0.1_beta9-r1.ebuild b/media-plugins/gkrellmpc/gkrellmpc-0.1_beta9-r1.ebuild new file mode 100644 index 000000000000..28889261792c --- /dev/null +++ b/media-plugins/gkrellmpc/gkrellmpc-0.1_beta9-r1.ebuild @@ -0,0 +1,26 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/media-plugins/gkrellmpc/gkrellmpc-0.1_beta9-r1.ebuild,v 1.1 2009/05/11 22:08:53 ssuominen Exp $ + +EAPI=2 +inherit eutils gkrellm-plugin toolchain-funcs + +DESCRIPTION="A gkrellm plugin to control the MPD (Music Player Daemon)" +HOMEPAGE="http://mpd.wikicities.com/wiki/Client:GKrellMPC" +SRC_URI="http://www.topfx.com/dist/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +RDEPEND="net-misc/curl" + +src_prepare() { + epatch "${FILESDIR}"/${P}-mt.patch +} + +src_compile() { + tc-export CC + emake || die "emake failed" +} diff --git a/media-plugins/gkrellmpc/gkrellmpc-0.1_beta9.ebuild b/media-plugins/gkrellmpc/gkrellmpc-0.1_beta9.ebuild index b46740acba7d..ee97006c886c 100644 --- a/media-plugins/gkrellmpc/gkrellmpc-0.1_beta9.ebuild +++ b/media-plugins/gkrellmpc/gkrellmpc-0.1_beta9.ebuild @@ -1,16 +1,22 @@ -# Copyright 1999-2007 Gentoo Foundation +# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/media-plugins/gkrellmpc/gkrellmpc-0.1_beta9.ebuild,v 1.7 2007/07/10 23:08:59 mr_bones_ Exp $ +# $Header: /var/cvsroot/gentoo-x86/media-plugins/gkrellmpc/gkrellmpc-0.1_beta9.ebuild,v 1.8 2009/05/11 22:08:53 ssuominen Exp $ -inherit gkrellm-plugin +EAPI=2 +inherit gkrellm-plugin toolchain-funcs DESCRIPTION="A gkrellm plugin to control the MPD (Music Player Daemon)" HOMEPAGE="http://mpd.wikicities.com/wiki/Client:GKrellMPC" SRC_URI="http://www.topfx.com/dist/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 x86" IUSE="" RDEPEND="net-misc/curl" -SLOT="0" -LICENSE="GPL-2" -KEYWORDS="x86 ~amd64" +src_compile() { + tc-export CC + emake || die "emake failed" +} |