[maemo-commits] [maemo-commits] r12803 - in projects/haf/trunk/hildon-help: . debian src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Jul 24 14:20:36 EEST 2007
Author: schulhof
Date: 2007-07-24 14:20:33 +0300 (Tue, 24 Jul 2007)
New Revision: 12803

Modified:
   projects/haf/trunk/hildon-help/ChangeLog
   projects/haf/trunk/hildon-help/configure.ac
   projects/haf/trunk/hildon-help/debian/changelog
   projects/haf/trunk/hildon-help/src/osso-helplib.c
Log:
Skip empty folders


Modified: projects/haf/trunk/hildon-help/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-help/ChangeLog	2007-07-24 11:10:11 UTC (rev 12802)
+++ projects/haf/trunk/hildon-help/ChangeLog	2007-07-24 11:20:33 UTC (rev 12803)
@@ -1,5 +1,10 @@
 2007-07-02 Gabriel Schulhof <gabriel.schulhof at nokia.com>
 
+	* Version 1.9.4
+	* Skip empty folders
+
+2007-07-02 Gabriel Schulhof <gabriel.schulhof at nokia.com>
+
 	* Remove direct dependency on libpng and libjpeg via gdk_pixbuf_get_file_info()
 	* Patch from Tommi Komulainen
 

Modified: projects/haf/trunk/hildon-help/configure.ac
===================================================================
--- projects/haf/trunk/hildon-help/configure.ac	2007-07-24 11:10:11 UTC (rev 12802)
+++ projects/haf/trunk/hildon-help/configure.ac	2007-07-24 11:20:33 UTC (rev 12803)
@@ -7,7 +7,7 @@
 
 # Mandatory, initializes autoconf.
 #
-AC_INIT(libhildonhelp, 1.9.3)
+AC_INIT(libhildonhelp, 1.9.4)
 
 # Tests that source dir exists
 AC_CONFIG_SRCDIR(src/hildon-help.h)

Modified: projects/haf/trunk/hildon-help/debian/changelog
===================================================================
--- projects/haf/trunk/hildon-help/debian/changelog	2007-07-24 11:10:11 UTC (rev 12802)
+++ projects/haf/trunk/hildon-help/debian/changelog	2007-07-24 11:20:33 UTC (rev 12803)
@@ -1,3 +1,9 @@
+libhildonhelp (1.9.4-1) unstable; urgency=low
+
+  * Skip empty folders
+
+ -- Gabriel Schulhof <gabriel.schulhof at nokia.com>  Tue, 24 Jul 2007 14:18:51 +0300
+
 libhildonhelp (1.9.3-1) unstable; urgency=low
 
   * Remove direct dependency on libpng and libjpeg via gdk_pixbuf_get_file_info()

Modified: projects/haf/trunk/hildon-help/src/osso-helplib.c
===================================================================
--- projects/haf/trunk/hildon-help/src/osso-helplib.c	2007-07-24 11:10:11 UTC (rev 12802)
+++ projects/haf/trunk/hildon-help/src/osso-helplib.c	2007-07-24 11:20:33 UTC (rev 12803)
@@ -719,7 +719,21 @@
     return ret;
 }
 
+static gboolean
+is_folder_empty(const char *branch)
+{
+  gboolean is_empty = TRUE;
+  h_OssoHelpWalker h = g_new0(struct s_OssoHelpWalker, 1);
 
+  g_assert(h);
+
+  is_empty = !contents(h, branch);
+
+  g_free(h);
+
+  return is_empty;
+}
+
 /*---( docs in header )---*/
 const char *ossohelp_next( h_OssoHelpWalker* h_ref,
                            const char *branch )
@@ -732,16 +746,28 @@
         g_assert(*h_ref);   /* 'g_new0()' always returns non-NULL */
     }
 
-    str = contents( *h_ref, branch );
-    if (str) {
-        /* Why do we need this strcpy_safe_auto?
-        contents() basically returns this value, doesn't it */
-        /*strcpy_safe_auto( (*h_ref)->key, str );*/ /* name of the next one */
-        return (*h_ref)->key;
-    } else {    /* end of looping (free resources) */
-        g_free(*h_ref);
-        *h_ref= NULL;
-        return NULL;
+    while (TRUE) {
+      str = contents( *h_ref, branch );
+      if (str) {
+          const char *key = (*h_ref)->key;
+
+          /* Skip empty folders */
+          if ((*key) != 0)
+            if (str[strlen(key) - 1] == '/')
+              if (is_folder_empty(key)) {
+                g_warning("ossohelp_next: folder '%s' is empty\n", key);
+                continue;
+              }
+              
+          /* Why do we need this strcpy_safe_auto?
+          contents() basically returns this value, doesn't it */
+          /*strcpy_safe_auto( (*h_ref)->key, str );*/ /* name of the next one */
+          return key;
+      } else {    /* end of looping (free resources) */
+          g_free(*h_ref);
+          *h_ref= NULL;
+          return NULL;
+      }
     }
 }
 


More information about the maemo-commits mailing list