[Xfce4-commits] <midori:master> Avoid g_list_nth on app infos in katze utils

Christian Dywan noreply at xfce.org
Wed Mar 27 01:08:01 CET 2013


Updating branch refs/heads/master
         to ef5f7e82c99bdf146c3f4fc9e567bbc2fe083817 (commit)
       from a9cbd57bcfb6e33056409e39ad58469561618312 (commit)

commit ef5f7e82c99bdf146c3f4fc9e567bbc2fe083817
Author: Christian Dywan <christian at twotoasts.de>
Date:   Wed Mar 27 01:05:59 2013 +0100

    Avoid g_list_nth on app infos in katze utils

 katze/katze-utils.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/katze/katze-utils.c b/katze/katze-utils.c
index 239785d..ebf7477 100644
--- a/katze/katze-utils.c
+++ b/katze/katze-utils.c
@@ -316,10 +316,11 @@ katze_app_info_get_all_for_category (const gchar* category)
     GList* all_apps = g_app_info_get_all ();
     #endif
     GList* apps = NULL;
-    guint i = 0;
     GAppInfo* info;
-    while ((info = g_list_nth_data (all_apps, i++)))
+    GList* app;
+    for (app = apps; app; app = g_list_next (app))
     {
+        GAppInfo* info = app->data;
         #ifdef GDK_WINDOWING_X11
         gchar* filename = g_strconcat ("applications/", g_app_info_get_id (info), NULL);
         GKeyFile* file = g_key_file_new ();
@@ -573,10 +574,10 @@ katze_property_proxy (gpointer     object,
 
         if (apps != NULL)
         {
-            gint i = 0;
-
-            while ((info = g_list_nth_data (apps, i++)))
+            GList* app;
+            for (app = apps; app; app = g_list_next (app))
             {
+                GAppInfo* info = app->data;
                 const gchar* name = g_app_info_get_name (info);
                 GIcon* icon = g_app_info_get_icon (info);
                 gchar* icon_name;


More information about the Xfce4-commits mailing list