[Xfce4-commits] r23191 - in xarchiver/branches/xarchiver-psybsd: libxarchiver src
Stephan Arts
stephan at xfce.org
Wed Sep 20 22:30:20 UTC 2006
Author: stephan
Date: 2006-09-20 22:30:19 +0000 (Wed, 20 Sep 2006)
New Revision: 23191
Modified:
xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.c
xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.h
xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c
xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.h
xarchiver/branches/xarchiver-psybsd/src/main.c
xarchiver/branches/xarchiver-psybsd/src/main_window.c
Log:
More archive contents are now displayed.
Memory usage is improved.
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.c 2006-09-20 21:24:42 UTC (rev 23190)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.c 2006-09-20 22:30:19 UTC (rev 23191)
@@ -36,7 +36,12 @@
{
LXA_ARCHIVE_SUPPORT_GNU_TAR_EXTRACT_OVERWRITE = 1,
LXA_ARCHIVE_SUPPORT_GNU_TAR_EXTRACT_TOUCH,
- LXA_ARCHIVE_SUPPORT_GNU_TAR_EXTRACT_STRIP
+ LXA_ARCHIVE_SUPPORT_GNU_TAR_EXTRACT_STRIP,
+ LXA_ARCHIVE_SUPPORT_GNU_TAR_VIEW_SIZE,
+ LXA_ARCHIVE_SUPPORT_GNU_TAR_VIEW_DATE,
+ LXA_ARCHIVE_SUPPORT_GNU_TAR_VIEW_TIME,
+ LXA_ARCHIVE_SUPPORT_GNU_TAR_VIEW_OWNER,
+ LXA_ARCHIVE_SUPPORT_GNU_TAR_VIEW_RIGHTS
};
void
@@ -146,6 +151,42 @@
0,
G_PARAM_READWRITE);
g_object_class_install_property(object_class, LXA_ARCHIVE_SUPPORT_GNU_TAR_EXTRACT_STRIP, pspec);
+
+ pspec = g_param_spec_boolean("view-size",
+ "View file-size",
+ "View file-size",
+ FALSE,
+ G_PARAM_READWRITE);
+ g_object_class_install_property(object_class, LXA_ARCHIVE_SUPPORT_GNU_TAR_VIEW_SIZE, pspec);
+
+ pspec = g_param_spec_boolean("view-rights",
+ "View permissions",
+ "View permissions",
+ FALSE,
+ G_PARAM_READWRITE);
+ g_object_class_install_property(object_class, LXA_ARCHIVE_SUPPORT_GNU_TAR_VIEW_RIGHTS, pspec);
+
+ pspec = g_param_spec_boolean("view-owner",
+ "View owner",
+ "View owner",
+ FALSE,
+ G_PARAM_READWRITE);
+ g_object_class_install_property(object_class, LXA_ARCHIVE_SUPPORT_GNU_TAR_VIEW_OWNER, pspec);
+
+ pspec = g_param_spec_boolean("view-date",
+ "View date",
+ "View date",
+ FALSE,
+ G_PARAM_READWRITE);
+ g_object_class_install_property(object_class, LXA_ARCHIVE_SUPPORT_GNU_TAR_VIEW_DATE, pspec);
+
+ pspec = g_param_spec_boolean("view-time",
+ "View time",
+ "View time",
+ TRUE,
+ G_PARAM_READWRITE);
+ g_object_class_install_property(object_class, LXA_ARCHIVE_SUPPORT_GNU_TAR_VIEW_TIME, pspec);
+
}
LXAArchiveSupport*
@@ -153,7 +194,7 @@
{
LXAArchiveSupportGnuTar *support;
- support = g_object_new(LXA_TYPE_ARCHIVE_SUPPORT_GNU_TAR, NULL);
+ support = g_object_new(LXA_TYPE_ARCHIVE_SUPPORT_GNU_TAR, "view-time", TRUE, "view-date", TRUE, "view-owner", TRUE, "view-rights", TRUE, NULL);
return LXA_ARCHIVE_SUPPORT(support);
}
@@ -324,6 +365,7 @@
gint
lxa_archive_support_gnu_tar_refresh(LXAArchive *archive)
{
+ guint i = 1;
if(!LXA_IS_ARCHIVE_SUPPORT_GNU_TAR(archive->support))
{
g_critical("Support is not GNU TAR");
@@ -337,12 +379,55 @@
else
{
archive->column_number = 1;
- archive->column_types = g_new0(GType, 1);
+ archive->entry_props_size = 0;
+
+ if(LXA_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->_view_rights)
+ archive->column_number++;
+ if(LXA_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->_view_owner)
+ archive->column_number++;
+ if(LXA_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->_view_date)
+ archive->column_number++;
+ if(LXA_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->_view_time)
+ archive->column_number++;
+ if(LXA_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->_view_size)
+ archive->column_number++;
+
+ archive->column_types = g_new0(GType, archive->column_number);
+ archive->column_names = g_new0(gchar *, archive->column_number);
+
archive->column_types[0] = G_TYPE_STRING;
- archive->column_names = g_new0(gchar *, 1);
- archive->column_names[0] = g_strdup("filename");
- //empty archive-tree
- /* use tvf once implementation of path recognition is stable */
+ archive->column_names[0] = g_strdup("Filename");
+ if(LXA_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->_view_rights) {
+ archive->column_types[i] = G_TYPE_STRING;
+ archive->column_names[i] = g_strdup("Rights");
+ i++;
+ archive->entry_props_size += sizeof(gchar *);
+ }
+ if(LXA_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->_view_owner) {
+ archive->column_types[i] = G_TYPE_STRING;
+ archive->column_names[i] = g_strdup("Owner");
+ i++;
+ archive->entry_props_size += sizeof(gchar *);
+ }
+ if(LXA_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->_view_size) {
+ archive->column_types[i] = G_TYPE_UINT64;
+ archive->column_names[i] = g_strdup("Size");
+ i++;
+ archive->entry_props_size += sizeof(guint64);
+ }
+ if(LXA_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->_view_date) {
+ archive->column_types[i] = G_TYPE_STRING;
+ archive->column_names[i] = g_strdup("Date");
+ i++;
+ archive->entry_props_size += sizeof(gchar *);
+ }
+ if(LXA_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->_view_time) {
+ archive->column_types[i] = G_TYPE_STRING;
+ archive->column_names[i] = g_strdup("Time");
+ i++;
+ archive->entry_props_size += sizeof(gchar *);
+ }
+ //TODO: empty archive-tree
gchar *command = g_strconcat(LXA_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->app_name, " tvf " , archive->path, NULL);
lxa_execute(command, archive, NULL, NULL, lxa_archive_support_gnu_tar_refresh_parse_output, NULL);
g_free(command);
@@ -373,6 +458,7 @@
lxa_execute(command, archive, NULL, NULL, lxa_archive_support_gnu_tar_compress_parse_output, NULL);
}
+/* TODO: fix g_value stuff */
gboolean
lxa_archive_support_gnu_tar_refresh_parse_output(GIOChannel *ioc, GIOCondition cond, gpointer data)
{
@@ -381,8 +467,9 @@
gchar *line = NULL;
LXAEntry *entry;
- GValue *props = NULL;
- gint n = 0, a = 0;
+ gpointer props = NULL;
+ gpointer props_iter = NULL;
+ gint n = 0, a = 0, i = 0;
gchar *temp_filename = NULL;
gchar *_size = NULL;
@@ -391,78 +478,85 @@
{
while(TRUE)
{
+ i = 0;
+
status = g_io_channel_read_line(ioc, &line, NULL,NULL,NULL);
if (line == NULL)
break;
- props = g_new0(GValue, 6);
+ props = g_malloc0(archive->entry_props_size);
+ props_iter = props;
- g_value_init(&props[0], G_TYPE_INT);
- gint _rights = 0;
- /* _rights |= (line[0] == '-')?0x0:0x00000001; // folder / file? */
- _rights |= (line[1] == '-')?0x0:0x00000001;
- _rights |= (line[2] == '-')?0x0:0x00000002;
- _rights |= (line[3] == '-')?0x0:0x00000004;
- _rights |= (line[4] == '-')?0x0:0x00000008;
- _rights |= (line[5] == '-')?0x0:0x00000010;
- _rights |= (line[6] == '-')?0x0:0x00000020;
- _rights |= (line[7] == '-')?0x0:0x00000040;
- _rights |= (line[9] == '-')?0x0:0x00000080;
- _rights |= (line[10] == '-')?0x0:0x00000100;
- g_value_set_int(&props[0], _rights);
+ if(LXA_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->_view_rights)
+ {
+ (*(gchar **)props_iter) = g_strndup (line, 10);
+ props_iter += sizeof(gchar *);
+ }
+
for(n=13; n < strlen(line); n++)
if(line[n] == ' ') break;
- g_value_init(&props[1], G_TYPE_STRING);
- g_value_set_string(&props[1], g_strndup(&line[11], n-11));
+ if(LXA_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->_view_owner)
+ {
+ (*(gchar **)props_iter) = g_strndup (&line[11], n-11);
+ props_iter += sizeof(gchar *);
+ }
for(; n < strlen(line); n++)
if(line[n] >= '0' && line[n] <= '9') break;
- a = n;
+ a = ++n;
for(; n < strlen(line); n++)
if(line[n] == ' ') break;
- g_value_init(&props[2], G_TYPE_UINT64);
- _size = g_strndup(&line[a], n-a);
- g_value_set_uint64(&props[2], (guint64)atof ( _size ));
- g_free (_size);
+ if(LXA_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->_view_size)
+ {
+ _size = g_strndup(&line[a], n-a);
+ (*((guint64 *)props_iter)) = g_ascii_strtoull( _size, NULL, 0);
+ g_free (_size);
+ props_iter += sizeof(guint64);
+ }
- a = n++;
+ a = ++n;
for(; n < strlen(line); n++) // DATE
if(line[n] == ' ') break;
- g_value_init(&props[3], G_TYPE_STRING);
- g_value_set_string ( &props[3], g_strndup (&line[n-10], 10) );
+ if(LXA_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->_view_date)
+ {
+ (*(gchar **)props_iter) = g_strndup (&line[a], n-a);
+ props_iter += sizeof(gchar *);
+ }
- a = n++;
+ a = ++n;
for (; n < strlen(line); n++) // TIME
if (line[n] == ' ') break;
- g_value_init(&props[4], G_TYPE_STRING);
- g_value_set_string ( &props[4], g_strndup (&line[n-8], 8) );
+ if(LXA_ARCHIVE_SUPPORT_GNU_TAR(archive->support)->_view_time)
+ {
+ (*(gchar **)props_iter) = g_strndup (&line[a], n-a);
+ props_iter += sizeof(gchar *);
+ }
- g_value_init(&props[5], G_TYPE_STRING);
+ /* g_value_init(&props[5], G_TYPE_STRING);*/
gchar *temp = g_strrstr (&line[n],"->");
if (temp )
{
temp_filename = g_strstrip(g_strndup(&line[n], strlen(line) - strlen(temp) - n ));
- g_value_set_string (&props[5], g_strstrip(g_strndup (&temp[3] , strlen(temp))) );
+ /*g_value_set_string (&props[5], g_strstrip(g_strndup (&temp[3] , strlen(temp))) ); */
}
else
{
temp_filename = g_strstrip(g_strndup(&line[n], strlen(line)-n-1));
- g_value_set_string (&props[5], g_strdup(" ") );
+ /*g_value_set_string (&props[5], g_strdup(" ") ); */
}
entry = lxa_archive_add_file(archive, temp_filename);
entry->props = props;
g_free(line);
- /* TODO: Add data */
}
}
if(cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL) )
@@ -591,6 +685,22 @@
case LXA_ARCHIVE_SUPPORT_GNU_TAR_EXTRACT_STRIP:
LXA_ARCHIVE_SUPPORT_GNU_TAR(object)->_extr_strip = g_value_get_uint(value);
break;
+
+ case LXA_ARCHIVE_SUPPORT_GNU_TAR_VIEW_SIZE:
+ LXA_ARCHIVE_SUPPORT_GNU_TAR(object)->_view_size = g_value_get_boolean(value);
+ break;
+ case LXA_ARCHIVE_SUPPORT_GNU_TAR_VIEW_DATE:
+ LXA_ARCHIVE_SUPPORT_GNU_TAR(object)->_view_date = g_value_get_boolean(value);
+ break;
+ case LXA_ARCHIVE_SUPPORT_GNU_TAR_VIEW_TIME:
+ LXA_ARCHIVE_SUPPORT_GNU_TAR(object)->_view_time = g_value_get_boolean(value);
+ break;
+ case LXA_ARCHIVE_SUPPORT_GNU_TAR_VIEW_OWNER:
+ LXA_ARCHIVE_SUPPORT_GNU_TAR(object)->_view_owner = g_value_get_boolean(value);
+ break;
+ case LXA_ARCHIVE_SUPPORT_GNU_TAR_VIEW_RIGHTS:
+ LXA_ARCHIVE_SUPPORT_GNU_TAR(object)->_view_rights = g_value_get_boolean(value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object,prop_id,pspec);
break;
@@ -611,6 +721,22 @@
case LXA_ARCHIVE_SUPPORT_GNU_TAR_EXTRACT_STRIP:
g_value_set_uint(value, LXA_ARCHIVE_SUPPORT_GNU_TAR(object)->_extr_strip);
break;
+
+ case LXA_ARCHIVE_SUPPORT_GNU_TAR_VIEW_SIZE:
+ g_value_set_boolean(value, LXA_ARCHIVE_SUPPORT_GNU_TAR(object)->_view_size);
+ break;
+ case LXA_ARCHIVE_SUPPORT_GNU_TAR_VIEW_DATE:
+ g_value_set_boolean(value, LXA_ARCHIVE_SUPPORT_GNU_TAR(object)->_view_date);
+ break;
+ case LXA_ARCHIVE_SUPPORT_GNU_TAR_VIEW_TIME:
+ g_value_set_boolean(value, LXA_ARCHIVE_SUPPORT_GNU_TAR(object)->_view_time);
+ break;
+ case LXA_ARCHIVE_SUPPORT_GNU_TAR_VIEW_OWNER:
+ g_value_set_boolean(value, LXA_ARCHIVE_SUPPORT_GNU_TAR(object)->_view_owner);
+ break;
+ case LXA_ARCHIVE_SUPPORT_GNU_TAR_VIEW_RIGHTS:
+ g_value_set_boolean(value, LXA_ARCHIVE_SUPPORT_GNU_TAR(object)->_view_rights);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object,prop_id,pspec);
break;
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.h 2006-09-20 21:24:42 UTC (rev 23190)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-gnu-tar.h 2006-09-20 22:30:19 UTC (rev 23191)
@@ -50,6 +50,12 @@
gboolean _extr_overwrite;
gboolean _extr_touch;
guint _extr_strip;
+
+ gboolean _view_size;
+ gboolean _view_date;
+ gboolean _view_time;
+ gboolean _view_owner;
+ gboolean _view_rights;
};
typedef struct _LXAArchiveSupportGnuTarClass LXAArchiveSupportGnuTarClass;
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c 2006-09-20 21:24:42 UTC (rev 23190)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.c 2006-09-20 22:30:19 UTC (rev 23191)
@@ -38,6 +38,9 @@
static void
lxa_archive_finalize(GObject *object);
+void
+lxa_archive_free_entry(LXAEntry *entry, LXAArchive *archive);
+
static gint lxa_archive_signals[1];
@@ -89,9 +92,7 @@
static void
lxa_archive_init(LXAArchive *archive)
{
- archive->root_entry.filename = g_new0(GValue, 1);
- archive->root_entry.filename = g_value_init(archive->root_entry.filename, G_TYPE_STRING);
- g_value_set_string(archive->root_entry.filename, "/");
+ archive->root_entry.filename = g_strdup("/");
}
static void
@@ -100,8 +101,8 @@
LXAArchive *archive = LXA_ARCHIVE(object);
if(archive->path)
g_free(archive->path);
- g_free(archive->root_entry.filename);
/* TODO: free archive->root_entry.children */
+ lxa_archive_free_entry(&archive->root_entry, archive);
}
LXAArchive *
@@ -146,7 +147,7 @@
gint
lxa_archive_lookup_dir(gpointer entry, gconstpointer filename)
{
- return strcmp(g_value_get_string(((LXAEntry *)entry)->filename), filename);
+ return strcmp(((LXAEntry *)entry)->filename, filename);
}
/*
@@ -168,9 +169,7 @@
if(!tmp_list)
{
tmp_entry = g_new0(LXAEntry, 1);
- tmp_entry->filename = g_new0(GValue, 1);
- tmp_entry->filename = g_value_init(tmp_entry->filename, G_TYPE_STRING);
- g_value_set_string(tmp_entry->filename, path_items[0]);
+ tmp_entry->filename = g_strdup(path_items[0]);
archive->root_entry.children = g_slist_prepend(archive->root_entry.children, tmp_entry);
tmp_list = archive->root_entry.children;
}
@@ -180,9 +179,7 @@
if(!tmp_list_children)
{
tmp_entry = g_new0(LXAEntry, 1);
- tmp_entry->filename = g_new0(GValue, 1);
- tmp_entry->filename = g_value_init(tmp_entry->filename, G_TYPE_STRING);
- g_value_set_string(tmp_entry->filename, path_items[i]);
+ tmp_entry->filename = g_strdup(path_items[i]);
((LXAEntry *)tmp_list->data)->children = g_slist_prepend(((LXAEntry *)tmp_list->data)->children, tmp_entry);
tmp_list_children = ((LXAEntry *)tmp_list->data)->children;
}
@@ -198,3 +195,30 @@
GSList *list = g_slist_find_custom(entry->children, filename,(GCompareFunc)lxa_archive_lookup_dir);
return (LXAEntry *)list->data;
}
+
+void
+lxa_archive_free_entry(LXAEntry *entry, LXAArchive *archive)
+{
+ gint i = 0;
+ gpointer props_iter = entry->props;
+
+ g_slist_foreach(entry->children, (GFunc)lxa_archive_free_entry, archive);
+ if(entry->props)
+ {
+ switch(archive->column_types[i])
+ {
+ case(G_TYPE_STRING):
+ g_free(*(gchar **)props_iter);
+ props_iter += sizeof(gchar *);
+ break;
+ case(G_TYPE_UINT):
+ props_iter += sizeof(guint);
+ break;
+ case(G_TYPE_UINT64):
+ props_iter += sizeof(guint64);
+ break;
+ }
+ g_free(entry->props);
+ }
+ g_free(entry->filename);
+}
Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.h 2006-09-20 21:24:42 UTC (rev 23190)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/archive.h 2006-09-20 22:30:19 UTC (rev 23191)
@@ -33,12 +33,11 @@
} LXAArchiveStatus;
typedef struct {
- GValue *filename;
- GValue *props;
+ gchar *filename;
GSList *children;
+ gpointer props;
} LXAEntry;
-
#define LXA_ARCHIVE(obj) ( \
G_TYPE_CHECK_INSTANCE_CAST ((obj), \
lxa_archive_get_type(), \
@@ -73,10 +72,11 @@
gchar *tmp_file;
gchar *files;
gboolean has_passwd;
- gint column_number;
+ guint column_number;
GType *column_types;
gchar **column_names;
LXAEntry root_entry;
+ gushort entry_props_size;
};
typedef struct _LXAArchiveClass LXAArchiveClass;
Modified: xarchiver/branches/xarchiver-psybsd/src/main.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main.c 2006-09-20 21:24:42 UTC (rev 23190)
+++ xarchiver/branches/xarchiver-psybsd/src/main.c 2006-09-20 22:30:19 UTC (rev 23191)
@@ -217,14 +217,18 @@
if(!new_archive && !add_archive_path && !extract_archive && !extract_archive_path)
{
- if(argc > 1)
- lxa_open_archive(argv[1], &lp_xa_archive);
/* Show main window */
main_window = xa_main_window_new();
gtk_widget_set_size_request(main_window, 400, 300);
gtk_widget_show_all(main_window);
g_signal_connect(G_OBJECT(main_window), "destroy", gtk_main_quit, NULL);
+
+ if(argc > 1)
+ {
+ lxa_open_archive(argv[1], &lp_xa_archive);
+ g_signal_connect(G_OBJECT(lp_archive), "lxa_status_changed", G_CALLBACK(xa_main_window_archive_status_changed), main_window);
+ }
} else
if(!opened_archives)
return 0;
Modified: xarchiver/branches/xarchiver-psybsd/src/main_window.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main_window.c 2006-09-20 21:24:42 UTC (rev 23190)
+++ xarchiver/branches/xarchiver-psybsd/src/main_window.c 2006-09-20 22:30:19 UTC (rev 23191)
@@ -324,6 +324,7 @@
g_slist_free(parent_window->working_node);
parent_window->working_node = NULL;
lpSupport = lxa_get_support_for_mime(lp_xa_archive->mime);
+
lxa_archive_support_refresh(lpSupport, lp_xa_archive);
}
@@ -354,11 +355,13 @@
}
g_list_free(columns);
liststore = gtk_list_store_newv(archive->column_number, archive->column_types);
+
for(x = 0; x < archive->column_number; x++)
{
switch(archive->column_types[x])
{
case(G_TYPE_STRING):
+ case(G_TYPE_UINT64):
renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(archive->column_names[x], renderer, "text", x, NULL);
break;
@@ -382,15 +385,50 @@
void
xa_main_window_set_contents(XAMainWindow *main_window, LXAArchive *archive, GSList *items)
{
+ gint i = 0;
GtkTreeIter iter;
GtkTreeModel *liststore = gtk_tree_view_get_model(GTK_TREE_VIEW(main_window->treeview));
+ GValue *tmp_value;
+ gpointer props;
+ gpointer props_iter;
gtk_list_store_clear(GTK_LIST_STORE(liststore));
while(items)
{
gtk_list_store_append(GTK_LIST_STORE(liststore), &iter);
- gtk_list_store_set_value(GTK_LIST_STORE(liststore), &iter, 0, ((LXAEntry *)items->data)->filename);
+ tmp_value = g_new0(GValue, 1);
+ tmp_value = g_value_init(tmp_value, G_TYPE_STRING);
+ g_value_set_string(tmp_value, ((LXAEntry *)items->data)->filename);
+ gtk_list_store_set_value(GTK_LIST_STORE(liststore), &iter, 0, tmp_value);
+
+ props = ((LXAEntry *)items->data)->props;
+ if(props)
+ {
+ props_iter = props;
+ for(i = 0; i < archive->column_number-1; i++)
+ {
+ tmp_value = g_new0(GValue, 1);
+ tmp_value = g_value_init(tmp_value, archive->column_types[i]);
+ switch(archive->column_types[i])
+ {
+ case(G_TYPE_UINT):
+ g_value_set_uint(tmp_value, *(guint *)props_iter);
+ props_iter += sizeof(guint);
+ break;
+ case(G_TYPE_STRING):
+ g_value_set_string(tmp_value, *(gchar **)props_iter);
+ props_iter += sizeof(gchar *);
+ break;
+ case(G_TYPE_UINT64):
+ g_value_set_uint64(tmp_value, *(guint64 *)props_iter);
+ props_iter += sizeof(guint64);
+ break;
+ }
+ gtk_list_store_set_value(GTK_LIST_STORE(liststore), &iter, i+1, tmp_value);
+ g_free(tmp_value);
+ }
+ }
items = items->next;
}
if(g_slist_length(main_window->working_node) > 1)
More information about the Xfce4-commits
mailing list