[Xfce4-commits] <garcon:master> Use else if.

Nick Schermer nick at xfce.org
Tue Aug 18 19:38:01 CEST 2009


Updating branch refs/heads/master
         to 4019f0dd48c2f4ec8320a58890730937eb455107 (commit)
       from d68e0db46e0ab86c33a0ca3365f86d80a6d8e180 (commit)

commit 4019f0dd48c2f4ec8320a58890730937eb455107
Author: Nick Schermer <nick at xfce.org>
Date:   Tue Aug 18 18:16:30 2009 +0200

    Use else if.

 garcon/garcon-menu.c |   31 +++++++++++++------------------
 1 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/garcon/garcon-menu.c b/garcon/garcon-menu.c
index 8b786e1..629d9c2 100644
--- a/garcon/garcon-menu.c
+++ b/garcon/garcon-menu.c
@@ -871,8 +871,7 @@ garcon_menu_collect_files_from_path (GarconMenu  *menu,
     return;
 
   /* Skip directory if it's not a directory */
-  if (G_UNLIKELY (g_file_query_file_type (dir,
-                                          G_FILE_QUERY_INFO_NONE,
+  if (G_UNLIKELY (g_file_query_file_type (dir, G_FILE_QUERY_INFO_NONE,
                                           NULL) != G_FILE_TYPE_DIRECTORY))
     {
       return;
@@ -912,23 +911,19 @@ garcon_menu_collect_files_from_path (GarconMenu  *menu,
           /* Free id prefix */
           g_free (new_id_prefix);
         }
-      else
+      else if (G_LIKELY (g_str_has_suffix (base_name, ".desktop")))
         {
-          /* Skip all filenames which do not end with .desktop */
-          if (G_LIKELY (g_str_has_suffix (base_name, ".desktop")))
-            {
-              /* Create desktop-file id */
-              if (G_LIKELY (id_prefix == NULL))
-                desktop_id = g_strdup (base_name);
-              else
-                desktop_id = g_strjoin ("-", id_prefix, base_name, NULL);
-
-              /* Insert into the files hash table if the desktop-file id does not exist there yet */
-              if (G_LIKELY (g_hash_table_lookup (desktop_id_table, desktop_id) == NULL))
-                g_hash_table_insert (desktop_id_table, desktop_id, g_file_get_uri (file));
-              else
-                g_free (desktop_id);
-            }
+          /* Create desktop-file id */
+          if (G_LIKELY (id_prefix == NULL))
+            desktop_id = g_strdup (base_name);
+          else
+            desktop_id = g_strjoin ("-", id_prefix, base_name, NULL);
+
+          /* Insert into the files hash table if the desktop-file id does not exist there yet */
+          if (G_LIKELY (g_hash_table_lookup (desktop_id_table, desktop_id) == NULL))
+            g_hash_table_insert (desktop_id_table, desktop_id, g_file_get_uri (file));
+          else
+            g_free (desktop_id);
         }
 
       /* Free absolute path */



More information about the Xfce4-commits mailing list