[Goodies-commits] r7812 - in xfce4-mpc-plugin/trunk: . panel-plugin

Landry Breuil landry at xfce.org
Fri Jul 24 18:56:19 CEST 2009


Author: landry
Date: 2009-07-24 16:56:18 +0000 (Fri, 24 Jul 2009)
New Revision: 7812

Modified:
   xfce4-mpc-plugin/trunk/configure.ac
   xfce4-mpc-plugin/trunk/panel-plugin/Makefile.am
   xfce4-mpc-plugin/trunk/panel-plugin/xfce4-mpc-plugin.c
Log:
Use exo_str_replace(), instead of hand-rolling our own hacky implem.
Pointed our by Mike Massonnet.


Modified: xfce4-mpc-plugin/trunk/configure.ac
===================================================================
--- xfce4-mpc-plugin/trunk/configure.ac	2009-07-24 16:31:40 UTC (rev 7811)
+++ xfce4-mpc-plugin/trunk/configure.ac	2009-07-24 16:56:18 UTC (rev 7812)
@@ -34,6 +34,7 @@
 
 dnl configure the panel plugin
 XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.3.22])
+XDT_CHECK_PACKAGE([EXO], [exo-0.3], [0.3.1.1])
 
 dnl check for libmpd presence
 AC_ARG_WITH(libmpd,

Modified: xfce4-mpc-plugin/trunk/panel-plugin/Makefile.am
===================================================================
--- xfce4-mpc-plugin/trunk/panel-plugin/Makefile.am	2009-07-24 16:31:40 UTC (rev 7811)
+++ xfce4-mpc-plugin/trunk/panel-plugin/Makefile.am	2009-07-24 16:56:18 UTC (rev 7812)
@@ -3,9 +3,11 @@
 
 xfce4_mpc_plugin_CFLAGS =						\
 	-DPACKAGE_LOCALE_DIR=\"$(localedir)\"				\
+	@EXO_CFLAGS@							\
 	@LIBXFCE4PANEL_CFLAGS@
 
 xfce4_mpc_plugin_LDADD =						\
+	@EXO_LIBS@							\
 	@LIBXFCE4PANEL_LIBS@
 
 

Modified: xfce4-mpc-plugin/trunk/panel-plugin/xfce4-mpc-plugin.c
===================================================================
--- xfce4-mpc-plugin/trunk/panel-plugin/xfce4-mpc-plugin.c	2009-07-24 16:31:40 UTC (rev 7811)
+++ xfce4-mpc-plugin/trunk/panel-plugin/xfce4-mpc-plugin.c	2009-07-24 16:56:18 UTC (rev 7812)
@@ -23,6 +23,7 @@
 #endif
 
 #include <libxfcegui4/libxfcegui4.h>
+#include <exo/exo.h>
 #include <string.h>
 #include <stdlib.h>
 #include <glib/gprintf.h>
@@ -346,12 +347,9 @@
 void
 str_replace(GString *str, gchar* pattern, gchar* replacement)
 {
-   gchar **arr;
-   if (replacement == NULL)
-      replacement = "";
-   arr = g_strsplit (str->str, pattern, -1);
-   if (arr != NULL && arr[0] != NULL)
-      g_string_assign(str, g_strjoinv (replacement, arr));
+   gchar *nstr = exo_str_replace(str->str, pattern, replacement);
+   g_string_assign(str, nstr);
+   g_free(nstr);
 }
 
 void




More information about the Goodies-commits mailing list