Porting CList to GTK2
- From: Adam Tee <adam ajtee uklinux net>
- To: gtk-app-devel-list gnome org
- Subject: Porting CList to GTK2
- Date: Mon, 31 Mar 2003 11:07:12 +0100
Hi,
I have the following code which uses a Clist which I need to
port to GTK2. Does anyone know whether I can just simply change
the Clist to a GtkListStore or is it not that simple.
Here's the code:
the_file_list = GTK_CLIST (GTK_FILE_SELECTION (file_selection)->file_list);
gtk_clist_clear (the_file_list);
the_directory =
(gchar*)gtk_file_selection_get_filename (GTK_FILE_SELECTION
(file_selection));
files_count =
scandir (the_directory, &directory_entries, not_a_dot_file,
alphasort);
gtk_clist_freeze (the_file_list);
for (entry = 0; entry < files_count; ++entry)
{
file_entry_name[0] = directory_entries[entry]->d_name;
full_path_name =
g_strjoin ("/", the_directory, file_entry_name[0], NULL);
/* file exists, that should be obvious but... */
if (!stat (full_path_name, &file_information))
{
/* file is not a directory... */
if (!S_ISDIR (file_information.st_mode))
{
/* ...and matches the pattern */
if (fnmatch (the_pattern, file_entry_name[0], 0) == 0)
{
gtk_clist_append (the_file_list, file_entry_name);
}
};
};
/* don't use g_free, cause that's allocated with malloc () */
free (directory_entries[entry]);
g_free (full_path_name);
};
gtk_clist_thaw (the_file_list);
Thanks in advance
Adam
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]