Add debug info + minor next/prev function changes
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Mon, 8 Dec 2014 10:45:43 +0000 (11:45 +0100)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Mon, 8 Dec 2014 10:45:43 +0000 (11:45 +0100)
src/flat_navi.c

index db9d78b..4298af5 100644 (file)
@@ -217,6 +217,28 @@ _flat_review_candidates_get(AtspiAccessible *root)
    return ret;
 }
 
+static void
+debug(FlatNaviContext *ctx)
+{
+   Eina_List *l1, *l2, *line;
+   AtspiAccessible *obj;
+   int i, l = 0;
+
+   EINA_LIST_FOREACH(ctx->lines, l1, line)
+     {
+        i = 0;
+        DEBUG("Line %d", l);
+        EINA_LIST_FOREACH(line, l2, obj)
+          {
+             char *name = atspi_accessible_get_name(obj, NULL);
+             char *role = atspi_accessible_get_role_name(obj, NULL);
+             DEBUG("%d %s %s, ", i++, name, role);
+             if (name) g_free(name);
+             if (role) g_free(role);
+          }
+     }
+}
+
 FlatNaviContext *flat_navi_context_create(AtspiAccessible *root)
 {
    FlatNaviContext *ret;
@@ -230,6 +252,8 @@ FlatNaviContext *flat_navi_context_create(AtspiAccessible *root)
    ret->current_line = ret->lines;
    ret->current = eina_list_data_get(ret->current_line);
 
+   debug(ret);
+
    return ret;
 }
 
@@ -278,8 +302,8 @@ AtspiAccessible *flat_navi_context_next(FlatNaviContext *ctx)
 
    if (new)
      ctx->current = new;
-   else if (!flat_navi_context_line_next(ctx))
-     return NULL;
+   else
+     return flat_navi_context_line_next(ctx);
 
    return eina_list_data_get(ctx->current);
 }
@@ -290,8 +314,8 @@ AtspiAccessible *flat_navi_context_prev(FlatNaviContext *ctx)
 
    if (new)
      ctx->current = new;
-   else if (!flat_navi_context_line_prev(ctx))
-     return NULL;
+   else
+     return flat_navi_context_line_prev(ctx);
 
    return eina_list_data_get(ctx->current);
 }