[Xfce4-commits] <garcon:master> Optimize the garcon_menu_item_only_show_in_environment function.
Nick Schermer
nick at xfce.org
Mon Aug 17 18:16:04 CEST 2009
Updating branch refs/heads/master
to d72666bbb1beeaa9571eea3753e10a2164840213 (commit)
from 6a867e6cddd4e7b48054475e57988af693c477da (commit)
commit d72666bbb1beeaa9571eea3753e10a2164840213
Author: Nick Schermer <nick at xfce.org>
Date: Mon Aug 17 17:34:50 2009 +0200
Optimize the garcon_menu_item_only_show_in_environment function.
garcon/garcon-menu-item.c | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/garcon/garcon-menu-item.c b/garcon/garcon-menu-item.c
index 3259a82..f0601ff 100644
--- a/garcon/garcon-menu-item.c
+++ b/garcon/garcon-menu-item.c
@@ -1156,7 +1156,6 @@ gboolean
garcon_menu_item_only_show_in_environment (GarconMenuItem *item)
{
const gchar *env;
- gboolean show = FALSE;
guint i;
g_return_val_if_fail (GARCON_IS_MENU_ITEM (item), FALSE);
@@ -1171,15 +1170,14 @@ garcon_menu_item_only_show_in_environment (GarconMenuItem *item)
/* Check if we have an OnlyShowIn list */
if (G_UNLIKELY (item->priv->only_show_in != NULL))
{
- for (i = 0; i < g_strv_length (item->priv->only_show_in); ++i)
- if (G_UNLIKELY (g_utf8_collate (item->priv->only_show_in[i], env) == 0))
- {
- show = TRUE;
- break;
- }
+ /* Check if your environemnt is in OnlyShowIn list */
+ for (i = 0; item->priv->only_show_in[i] != NULL; i++)
+ if (g_utf8_collate (item->priv->only_show_in[i], env) == 0)
+ return TRUE;
}
- return show;
+ /* Not in the list or not list, hide it */
+ return FALSE;
}
More information about the Xfce4-commits
mailing list