[Ekiga-devel-list] Patch to remove some code



Hi,

since glib 2.8 has now been around since a while (august 2005), I figured it was reasonable to depend on it.

It allowed me to remove some ugly code.

Is this patch ok to commit?

Snark
diff -ur ekiga.cvs/ChangeLog ekiga.patched/ChangeLog
--- ekiga.cvs/ChangeLog	2006-10-31 11:14:06.000000000 +0100
+++ ekiga.patched/ChangeLog	2006-11-01 21:54:34.000000000 +0100
@@ -1,3 +1,10 @@
+2006-11-01  Julien Puydt  <jpuydt free fr>
+
+	* configure.in: Made requirement on glib at least 2.8 explicit.
+	* lib/toolbox.h, lib/toolbox-common.c: Removed gm_mkdir_with_parents,
+	since glib has g_mkdir_with_parents.
+	* lib/gmconf/gmconf-glib.c: Stop using gm_mkdir_with_parents.
+
 2006-10-31  Julien Puydt  <jpuydt free fr>
 
 	* lib/gmconf/gmconf-glib.c: Fixed some g_return_if_fail which
diff -ur ekiga.cvs/configure.in ekiga.patched/configure.in
--- ekiga.cvs/configure.in	2006-10-06 12:48:10.000000000 +0200
+++ ekiga.patched/configure.in	2006-11-01 21:53:09.000000000 +0100
@@ -106,10 +106,10 @@
 PKG_PROG_PKG_CONFIG
 
 if test ${enable_gnome} = no; then
-PKG_CHECK_MODULES(EKIGA, gtk+-2.0 >= 2.4.0 gthread-2.0 >= 2.4.0 libxml-2.0 >= 2.5.0)
+PKG_CHECK_MODULES(EKIGA, glib-2.0 >= 2.8.0 gtk+-2.0 >= 2.4.0 gthread-2.0 >= 2.4.0 libxml-2.0 >= 2.5.0)
 EKIGA_CFLAGS="$EKIGA_CFLAGS -DDISABLE_GNOME"
 else
-PKG_CHECK_MODULES(EKIGA, gtk+-2.0 >= 2.4.0 gthread-2.0 >= 2.4.0 esound >= 0.2.28 gconf-2.0 >= 2.2.0 libgnome-2.0 >= 2.14.0 libgnomeui-2.0 >= 2.14.0)
+PKG_CHECK_MODULES(EKIGA, glib-2.0 >= 2.8.0 gtk+-2.0 >= 2.4.0 gthread-2.0 >= 2.4.0 esound >= 0.2.28 gconf-2.0 >= 2.2.0 libgnome-2.0 >= 2.14.0 libgnomeui-2.0 >= 2.14.0)
 PKG_CHECK_MODULES(EDS, libebook-1.2 >= 1.1.3,ebook12=yes,ebook12=no)
 if test x"${ebook12}" = xno ; then
 PKG_CHECK_MODULES(EDS, libebook-1.0 >= 0.0.94)
diff -ur ekiga.cvs/lib/gmconf/gmconf-glib.c ekiga.patched/lib/gmconf/gmconf-glib.c
--- ekiga.cvs/lib/gmconf/gmconf-glib.c	2006-10-31 11:12:14.000000000 +0100
+++ ekiga.patched/lib/gmconf/gmconf-glib.c	2006-11-01 21:49:58.000000000 +0100
@@ -985,7 +985,7 @@
 
   dirname = g_path_get_dirname (filename);
   if (!g_file_test (dirname, G_FILE_TEST_IS_DIR)) {
-    if (!gm_mkdir_with_parents (dirname, S_IRWXU))
+    if (!g_mkdir_with_parents (dirname, S_IRWXU))
       g_warning ("Unable to create directory %s\n", dirname);
   }
   g_free (dirname);
diff -ur ekiga.cvs/lib/toolbox/toolbox-common.c ekiga.patched/lib/toolbox/toolbox-common.c
--- ekiga.cvs/lib/toolbox/toolbox-common.c	2006-09-16 11:06:01.000000000 +0200
+++ ekiga.patched/lib/toolbox/toolbox-common.c	2006-11-01 21:50:57.000000000 +0100
@@ -38,75 +38,6 @@
 
 #include <string.h>
 
-/* gm_mkdir_with_parents taken more or less 1:1 from glib 2.8 */
-gboolean
-gm_mkdir_with_parents (const gchar *pathname,
-		        int mode)
-{
-  gchar *fn, *p;
-
-  if (pathname == NULL)
-    return FALSE;
-
-  fn = g_strdup (pathname);
-
-  if (g_path_is_absolute (fn))
-    p = (gchar *) g_path_skip_root (fn);
-    /* p is now a pointer INSIDE the memory of fn, not a new string, see GLib doc
-     * for g_path_skip_root()
-     */
-  else
-    p = fn;
-
-  /* the following loop means for fn="/dir1/dir2/dir3" per iteration:
-   * fn == "/dir1"
-   * fn == "/dir1/dir2"
-   * fn == "/dir1/dir2/dir3"
-   *
-   * This is done by setting the terminating \0 at the position of
-   * every found dir separator per iteration.
-   */
-  do {
-    /* increase p, until we reach the first dir separator */
-    while (*p && !G_IS_DIR_SEPARATOR (*p))
-      p++;
-
-    if (!*p)
-      /* did we reach the end? */
-      p = NULL;
-    else
-      /* this has the effect to give fn a new \0 at
-       * the dir separator for termination */
-      *p = '\0';
-
-    if (!g_file_test (fn, G_FILE_TEST_EXISTS)) {
-      if (g_mkdir (fn, mode) == -1) {
-	g_free (fn);
-	return FALSE;
-      }
-    }
-    
-    else if (!g_file_test (fn, G_FILE_TEST_IS_DIR)) {
-      g_free (fn);
-      return FALSE;
-    }
-    
-    if (p) {
-      /* restore the dir separator and search the next one */
-      *p++ = G_DIR_SEPARATOR;
-      while (*p && G_IS_DIR_SEPARATOR (*p))
-	p++;
-    }
-  } while (p);
-
-  /* we only need to free fn here, as p doesn't point to extra
-   * allocated memory, it points "inside" fn
-   */
-  g_free (fn);
-
-  return TRUE;
-}
-
 
 GSList
 *gm_string_gslist_remove_dups (GSList *origlist)
diff -ur ekiga.cvs/lib/toolbox/toolbox.h ekiga.patched/lib/toolbox/toolbox.h
--- ekiga.cvs/lib/toolbox/toolbox.h	2006-09-14 15:37:20.000000000 +0200
+++ ekiga.patched/lib/toolbox/toolbox.h	2006-11-01 21:50:35.000000000 +0100
@@ -45,15 +45,6 @@
  */
 void gm_open_uri (const gchar *uri);
 
-/* DESCRIPTION  : safely create an unknown directory
- * BEHAVIOR     : creates a dir with all non-existing parents
- * PRE          : a non-NULL directory, and a mode specified
- *                (glib/POSIX S_I* values for filemodes)
- */
-
-gboolean gm_mkdir_with_parents (const gchar *pathname,
-			         int mode);
-
 
 /*!\fm gm_string_gslist_remove_dups (GSlist*)
  * \brief remove dups in a GSList of strings, return the new list start


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]