[Xfce4-commits] <garcon:nick/xfcerc> Do utf-8 checking in the set functions.

Nick Schermer noreply at xfce.org
Mon Jun 27 21:06:01 CEST 2011


Updating branch refs/heads/nick/xfcerc
         to ee83103b04771908e1e5776d30df62960685980d (commit)
       from 8fde40208288410f8d6705f4f59be8453e16bc1e (commit)

commit ee83103b04771908e1e5776d30df62960685980d
Author: Nick Schermer <nick at xfce.org>
Date:   Mon Jun 27 20:46:56 2011 +0200

    Do utf-8 checking in the set functions.

 garcon/garcon-menu-directory.c |    3 ++-
 garcon/garcon-menu-item.c      |    4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/garcon/garcon-menu-directory.c b/garcon/garcon-menu-directory.c
index b82d812..6c5de3c 100644
--- a/garcon/garcon-menu-directory.c
+++ b/garcon/garcon-menu-directory.c
@@ -438,7 +438,7 @@ garcon_menu_directory_set_name (GarconMenuDirectory *directory,
                                 const gchar         *name)
 {
   g_return_if_fail (GARCON_IS_MENU_DIRECTORY (directory));
-  g_return_if_fail (name != NULL);
+  g_return_if_fail (g_utf8_validate (name, -1, NULL));
 
   if (g_strcmp0 (directory->priv->name, name) == 0)
     return;
@@ -484,6 +484,7 @@ garcon_menu_directory_set_comment (GarconMenuDirectory *directory,
                                    const gchar         *comment)
 {
   g_return_if_fail (GARCON_IS_MENU_DIRECTORY (directory));
+  g_return_if_fail (comment == NULL || g_utf8_validate (comment, -1, NULL));
 
   if (g_strcmp0 (directory->priv->comment, comment) == 0)
     return;
diff --git a/garcon/garcon-menu-item.c b/garcon/garcon-menu-item.c
index 0638914..d6686d6 100644
--- a/garcon/garcon-menu-item.c
+++ b/garcon/garcon-menu-item.c
@@ -730,7 +730,7 @@ garcon_menu_item_new (GFile *file)
   exec = xfce_rc_read_entry_untranslated (rc, G_KEY_FILE_DESKTOP_KEY_EXEC, NULL);
 
   /* Validate Name and Exec fields */
-  if (G_LIKELY (exec != NULL && name != NULL && g_utf8_validate (name, -1, NULL)))
+  if (G_LIKELY (exec != NULL && name != NULL))
     {
       /* Determine other application properties */
       generic_name = xfce_rc_read_entry (rc, G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME, NULL);
@@ -875,7 +875,7 @@ garcon_menu_item_reload_from_file (GarconMenuItem  *item,
   /* Check if there is a name and exec key */
   name = xfce_rc_read_entry (rc, G_KEY_FILE_DESKTOP_KEY_NAME, NULL);
   exec = xfce_rc_read_entry_untranslated (rc, G_KEY_FILE_DESKTOP_KEY_EXEC, NULL);
-  if (G_UNLIKELY (name == NULL || exec == NULL || !g_utf8_validate (name, -1, NULL)))
+  if (G_UNLIKELY (name == NULL || exec == NULL))
     {
       g_set_error_literal (error, 0, 0, "Either the name or exec key was not defined.");
       xfce_rc_close (rc);



More information about the Xfce4-commits mailing list