4
* Copyright (C) 2005 Giuseppe Torelli - Colossus
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
23
extern int output_fd,error_fd,child_pid,child_status;
25
void OpenTar ( gboolean mode , gchar *path)
27
gchar *command = g_strconcat ( "tar tfv " , path, NULL );
28
compressor_pid = SpawnAsyncProcess ( command , 1 , 0);
30
if ( compressor_pid == 0 ) return;
31
char *names[]= {(_("Filename")),(_("Permissions")),(_("Owner/Group")),(_("Size")),(_("Date")),(_("Time"))};
32
GType types[]= {G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_UINT,G_TYPE_STRING,G_TYPE_STRING};
33
CreateListStore ( 6, names , (GType *)types );
34
SetIOChannel (output_fd, G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_HUP|G_IO_NVAL,TarOpen, (gpointer) mode );
35
SetIOChannel (error_fd, G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_HUP|G_IO_NVAL,GenError, NULL );
36
WaitExitStatus ( child_pid , NULL );
39
static gboolean TarOpen (GIOChannel *ioc, GIOCondition cond, gpointer data)
44
if (cond & (G_IO_IN | G_IO_PRI) )
46
g_io_channel_read_line ( ioc, &line, NULL, NULL, NULL );
47
if (line != NULL && data ) gtk_text_buffer_insert (textbuf, &enditer, line, strlen ( line ) );
48
fields = split_line (line,5);
49
filename = get_last_field (line,6);
50
gtk_list_store_append (liststore, &iter);
51
if ( filename[strlen(filename) - 1] != '/')
53
for ( x = 0; x < 5; x++)
55
if (x == 2) gtk_list_store_set (liststore, &iter,x+1,atoi(fields[x]),-1);
56
else gtk_list_store_set (liststore, &iter,x+1,fields[x],-1);
59
gtk_list_store_set (liststore, &iter,0,filename,-1);
60
gtk_progress_bar_pulse ( GTK_PROGRESS_BAR (progressbar) );
61
while (gtk_events_pending() )
63
g_strfreev ( fields );
67
else if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL) )
69
g_io_channel_shutdown ( ioc,TRUE,NULL );
70
g_io_channel_unref (ioc);