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

Nick Schermer noreply at xfce.org
Tue Jun 28 23:46:05 CEST 2011


Updating branch refs/heads/master
         to 0e78e9a3279774c48ce181e0c3f8548faef3935e (commit)
       from 02f2f540a2dec91d4e1c845e3e03b1bf73b92fc2 (commit)

commit 0e78e9a3279774c48ce181e0c3f8548faef3935e
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 d648c7b..6539036 100644
--- a/garcon/garcon-menu-item.c
+++ b/garcon/garcon-menu-item.c
@@ -729,7 +729,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);
@@ -874,7 +874,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