View Single Post
nicolai's Avatar
Posts: 1,637 | Thanked: 4,424 times | Joined on Apr 2009 @ Germany
#3
Originally Posted by b-man View Post
It seems that I have ran into another problem while using hildon touch selector . I´m trying to have hildon touch selector display l list of files from a directory as items on the selector, but i haven´t been able to find any documentation for this function. Can anyone help me with this?

here´s a code snippet of what i have so far; the ¨const gchar *items[] = {Splash *}; function would be replaced by the file list function.

...
I don't know if there is a hildon filechooser. Maybe you can use
GtkFileChooser. Or if you are searching for a way to retrieve a list of files,
look at gio api .
Short snippet:
Code:
#include <gio/gio.h>
#include <stdio.h>

int main(int argc, char** argv)
{
  gtk_init(&argc, &argv);
  char* path = "/home";
  GFile* file = g_file_new_for_path(path);
  printf("path name: %s\n", g_file_get_basename(file));
  GFileEnumerator* files = g_file_enumerate_children(file,
						    G_FILE_ATTRIBUTE_STANDARD_NAME,
						    G_FILE_QUERY_INFO_NONE,
						    NULL,
						    NULL);
  if(files!=NULL)
  {
    GFileInfo* info = g_file_enumerator_next_file(files, NULL, NULL);
    while(info)
    {
      printf("name %s\n", g_file_info_get_name(info));
      info = g_file_enumerator_next_file(files, NULL, NULL);
    }
    g_object_unref(files);
  }
  return 0;
}
nicolai

Last edited by nicolai; 2009-10-22 at 23:41.
 

The Following User Says Thank You to nicolai For This Useful Post: