[mutter] screen: Simplify meta_screen_get_workspace_by_index



commit 320f38de4794eee9026022560ed70ddac7011f9a
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Aug 15 19:41:37 2014 -0400

    screen: Simplify meta_screen_get_workspace_by_index

 src/core/screen.c |   22 +---------------------
 1 files changed, 1 insertions(+), 21 deletions(-)
---
diff --git a/src/core/screen.c b/src/core/screen.c
index 0630d6f..d0318dc 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -1055,27 +1055,7 @@ MetaWorkspace*
 meta_screen_get_workspace_by_index (MetaScreen  *screen,
                                     int          idx)
 {
-  GList *tmp;
-  int i;
-
-  /* should be robust, idx is maybe from an app */
-  if (idx < 0)
-    return NULL;
-
-  i = 0;
-  tmp = screen->workspaces;
-  while (tmp != NULL)
-    {
-      MetaWorkspace *w = tmp->data;
-
-      if (i == idx)
-        return w;
-
-      ++i;
-      tmp = tmp->next;
-    }
-
-  return NULL;
+  return g_list_nth_data (screen->workspaces, idx);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]