[bijiben] Editor : check title before assining it to note



commit 95facc801097df57e7a10426849fa2b7042c64cc
Author: Pierre-Yves Luyten <py luyten fr>
Date:   Wed Dec 5 00:46:44 2012 +0100

    Editor : check title before assining it to note

 src/libbiji/editor/biji-webkit-editor.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/libbiji/editor/biji-webkit-editor.c b/src/libbiji/editor/biji-webkit-editor.c
index 5e4bb3f..061e05c 100644
--- a/src/libbiji/editor/biji-webkit-editor.c
+++ b/src/libbiji/editor/biji-webkit-editor.c
@@ -262,8 +262,18 @@ on_content_changed (WebKitWebView *view)
     rows = g_strsplit (html, "<div", 2);
     g_warning ("title is %s", rows[0]);
 
+    /* if we have a carriage return and thus, a proper title
+     * we still need to ensure it's clean */
     if (g_strv_length (rows) > 1)
-      biji_note_obj_set_title (note, rows[0]);
+    {
+      gchar *sanitized_title;
+
+      sanitized_title = biji_str_mass_replace (rows[0],
+                                               "&nbsp;", "",
+                                               NULL);
+      biji_note_obj_set_title (note, sanitized_title);
+      g_free (sanitized_title);
+    }
 
     g_strfreev (rows);
   }



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