Author: colossus
Date: 2006-10-04 09:24:20 +0000 (Wed, 04 Oct 2006)
New Revision: 23278

Added:
   xarchiver/trunk/src/deb.c
   xarchiver/trunk/src/deb.h
Modified:
   xarchiver/trunk/doc/html/ch03s04.html
   xarchiver/trunk/doc/html/index.html
   xarchiver/trunk/doc/xarchiver.docbook
   xarchiver/trunk/src/Makefile.am
   xarchiver/trunk/src/archive.c
   xarchiver/trunk/src/archive.h
   xarchiver/trunk/src/callbacks.c
   xarchiver/trunk/src/callbacks.h
   xarchiver/trunk/src/extract_dialog.c
   xarchiver/trunk/src/main.c
Log:
Added a new archive format: deb; thanks to Lukasz for providing the skeleton 
code.
Sorted the archive filetypes in the open dialog filter.
Updated the documentation about the open dialog.


Modified: xarchiver/trunk/doc/html/ch03s04.html
===================================================================
--- xarchiver/trunk/doc/html/ch03s04.html       2006-10-04 06:26:18 UTC (rev 
23277)
+++ xarchiver/trunk/doc/html/ch03s04.html       2006-10-04 09:24:20 UTC (rev 
23278)
@@ -8,14 +8,16 @@
                                                        </p><div 
class="figure"><a id="id2482287"></a><p class="title"><b>Figure 3.1. New 
dialog</b></p><div><img src="images/new_dialog.png" alt="New dialog" 
/></div></div><p>
                                                </p></div><div class="section" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="open"></a>Open</h4></div></div></div><p>
                                                        Opens a new archive. If 
you force Xarchiver to open an unsupported archive
-                                                       type an error message 
will be emitted.
+                                                       type an error message 
will be emitted. The archive type is detected by its magic header and not by 
the extension. Password protected archives are supported also. The password 
detection is done by looking for the password flag inside the archive structure 
except for rar ones since encrypted files in rar archives have an asterisk 
right before their filename. 7zip encrypted archives are not detected due to 
the complexity of 7zip format. Please see <a 
href="http://sourceforge.net/forum/forum.php?thread_id=1378003&amp;forum_id=383044";
 target="_top">
+                               <em class="citetitle">this thread on sf.net</em>
+                               </a>for more information.
                                                </p></div><div class="section" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="test"></a>Test</h4></div></div></div><p>
                                                        Tests the current 
archive. This option is disabled when
                                                        the current archive was 
produced by an archiver who doesn't support testing.
                                                </p></div><div class="section" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="properties"></a>Properties</h4></div></div></div><p>
                                                        Shows an archive dialog 
with useful info about the archive.
                                                </p><p>
-                                                       </p><div 
class="figure"><a id="id2482343"></a><p class="title"><b>Figure 3.2. Archive 
properties dialog</b></p><div><img src="images/archive_properties.png" 
alt="Archive properties dialog" /></div></div><p>
+                                                       </p><div 
class="figure"><a id="id2482360"></a><p class="title"><b>Figure 3.2. Archive 
properties dialog</b></p><div><img src="images/archive_properties.png" 
alt="Archive properties dialog" /></div></div><p>
                                                </p></div><div class="section" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="close"></a>Close</h4></div></div></div><p>
                                                        Close the current 
archive and frees all the memory in use by it.
                                                </p></div><div class="section" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="quit"></a>Quit</h4></div></div></div><p>
@@ -23,11 +25,11 @@
                                                </p></div></div><div 
class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 
class="title"><a id="action_menu"></a>Action menu</h3></div></div></div><div 
class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 
class="title"><a id="add"></a>Add</h4></div></div></div><p>
                                                        Shows the add dialog 
featuring the most used archiver cmd-line options. The password entry is 
diabled when the archive doesn't support encryption.
                                                </p><p>
-                                                       </p><div 
class="figure"><a id="id2482405"></a><p class="title"><b>Figure 3.3. Add 
dialog</b></p><div><img src="images/add_dialog.png" alt="Add dialog" 
/></div></div><p>
+                                                       </p><div 
class="figure"><a id="id2482422"></a><p class="title"><b>Figure 3.3. Add 
dialog</b></p><div><img src="images/add_dialog.png" alt="Add dialog" 
/></div></div><p>
                                                </p></div><div class="section" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="extract"></a>Extract</h4></div></div></div><p>
                                                        Shows the extract 
dialog featuring the most used archiver cmd-line options. The password entry is 
disabled when the current archive is not encrypted; instead if the archive is 
encrypted and you don't fill this field, Xarchiver will request you the 
password to extract the archive.
                                                </p><p>
-                                                       </p><div 
class="figure"><a id="id2482429"></a><p class="title"><b>Figure 3.4. Extract 
dialog</b></p><div><img src="images/extract_dialog.png" alt="Extract dialog" 
/></div></div><p>
+                                                       </p><div 
class="figure"><a id="id2482446"></a><p class="title"><b>Figure 3.4. Extract 
dialog</b></p><div><img src="images/extract_dialog.png" alt="Extract dialog" 
/></div></div><p>
                                                </p></div><div class="section" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="sfx"></a>Make SFX</h4></div></div></div><p>
                                                        Convert the current 
archive to self-extracting. This option is disabled when the current archive 
doesn't support this feature (e.g. tar archives).
 
@@ -46,7 +48,7 @@
                                                </p></div><div class="section" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="iso_info"></a>Show ISO info</h4></div></div></div><p>
                                                        Opens an ISO properties 
dialog with useful info about the ISO image. This option is obviously disabled 
when no ISO image is loaded.
                                                </p><p>
-                                                       </p><div 
class="figure"><a id="id2482558"></a><p class="title"><b>Figure 3.5. ISO 
properties dialog</b></p><div><img src="images/iso_properties.png" alt="ISO 
properties dialog" /></div></div><p>
+                                                       </p><div 
class="figure"><a id="id2482576"></a><p class="title"><b>Figure 3.5. ISO 
properties dialog</b></p><div><img src="images/iso_properties.png" alt="ISO 
properties dialog" /></div></div><p>
                                                </p></div></div><div 
class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 
class="title"><a id="help_menu"></a>Help Menu</h3></div></div></div><div 
class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 
class="title"><a id="help"></a>Help</h4></div></div></div><p>
                                                                Show this 
documentation in system installed browser.
                                                                Currently 
firefox, opera and mozilla are supported.

Modified: xarchiver/trunk/doc/html/index.html
===================================================================
--- xarchiver/trunk/doc/html/index.html 2006-10-04 06:26:18 UTC (rev 23277)
+++ xarchiver/trunk/doc/html/index.html 2006-10-04 09:24:20 UTC (rev 23278)
@@ -15,6 +15,6 @@
                        Introduction
                </a></span></dt><dd><dl><dt><span class="section"><a 
href="ch01.html#id2481750">About Xarchiver</a></span></dt><dt><span 
class="section"><a href="ch01s02.html">Where to get it</a></span></dt><dt><span 
class="section"><a 
href="ch01s03.html">License</a></span></dt></dl></dd><dt><span 
class="chapter"><a href="ch02.html">2. 
                        Installation
-               </a></span></dt><dd><dl><dt><span class="section"><a 
href="ch02.html#id2481872">Requirements</a></span></dt><dt><span 
class="section"><a href="ch02s02.html">Source 
compilation</a></span></dt></dl></dd><dt><span class="chapter"><a 
href="ch03.html">3. Usage</a></span></dt><dd><dl><dt><span class="section"><a 
href="ch03.html#getting_started">Getting started</a></span></dt><dt><span 
class="section"><a href="ch03s02.html">Command line 
options</a></span></dt><dt><span class="section"><a 
href="ch03s03.html">General</a></span></dt><dd><dl><dt><span class="section"><a 
href="ch03s03.html#general_startup">Startup</a></span></dt><dt><span 
class="section"><a href="ch03s03.html#how_it_works">How it 
works</a></span></dt></dl></dd><dt><span class="section"><a 
href="ch03s04.html">Xarchiver menu</a></span></dt><dd><dl><dt><span 
class="section"><a href="ch03s04.html#file_menu">File 
menu</a></span></dt><dt><span class="section"><a 
href="ch03s04.html#action_menu">Action menu</a></span></dt><dt
 ><span class="section"><a href="ch03s04.html#help_menu">Help 
 >Menu</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a 
 >href="ch04.html">4. FAQ</a></span></dt><dd><dl><dt><span class="section"><a 
 >href="ch04.html#first">Why are ace archives not 
 >supported?</a></span></dt><dt><span class="section"><a 
 >href="ch04s02.html">How can I create an archive with some files password 
 >protected and others not?</a></span></dt><dt><span class="section"><a 
 >href="ch04s03.html">Why does Xarchiver emit this error message when handling 
 >tar archives?</a></span></dt><dt><span class="section"><a 
 >href="ch04s04.html">Why is the option "Extract with full path" disabled when 
 >using the -e switch with tar archives?</a></span></dt><dt><span 
 >class="section"><a href="ch04s05.html">Why does Xarchiver sometimes report 
 >errors but the Error messages window is empty?</a></span></dt><dt><span 
 >class="section"><a href="ch04s06.html">Why is the window sometimes empty when 
 >I click View?</a></span></dt></dl></
 dd></dl></div><div class="list-of-figures"><p><b>List of 
Figures</b></p><dl><dt>3.1. <a href="ch03s04.html#id2482287">New 
dialog</a></dt><dt>3.2. <a href="ch03s04.html#id2482343">Archive properties 
dialog</a></dt><dt>3.3. <a href="ch03s04.html#id2482405">Add 
dialog</a></dt><dt>3.4. <a href="ch03s04.html#id2482429">Extract 
dialog</a></dt><dt>3.5. <a href="ch03s04.html#id2482558">ISO properties 
dialog</a></dt></dl></div><div class="list-of-tables"><p><b>List of 
Tables</b></p><dl><dt>3.1. <a href="ch03s02.html#id2482072">Command line 
Options</a></dt></dl></div></div><div class="navfooter"><hr /><table 
width="100%" summary="Navigation footer"><tr><td width="40%" 
align="left"> </td><td width="20%" align="center"> </td><td width="40%" 
align="right"> <a accesskey="n" href="ch01.html">Next</a></td></tr><tr><td 
width="40%" align="left" valign="top"> </td><td width="20%" 
align="center"> </td><td width="40%" align="right" valign="top"> Chapter 1. 
+               </a></span></dt><dd><dl><dt><span class="section"><a 
href="ch02.html#id2481872">Requirements</a></span></dt><dt><span 
class="section"><a href="ch02s02.html">Source 
compilation</a></span></dt></dl></dd><dt><span class="chapter"><a 
href="ch03.html">3. Usage</a></span></dt><dd><dl><dt><span class="section"><a 
href="ch03.html#getting_started">Getting started</a></span></dt><dt><span 
class="section"><a href="ch03s02.html">Command line 
options</a></span></dt><dt><span class="section"><a 
href="ch03s03.html">General</a></span></dt><dd><dl><dt><span class="section"><a 
href="ch03s03.html#general_startup">Startup</a></span></dt><dt><span 
class="section"><a href="ch03s03.html#how_it_works">How it 
works</a></span></dt></dl></dd><dt><span class="section"><a 
href="ch03s04.html">Xarchiver menu</a></span></dt><dd><dl><dt><span 
class="section"><a href="ch03s04.html#file_menu">File 
menu</a></span></dt><dt><span class="section"><a 
href="ch03s04.html#action_menu">Action menu</a></span></dt><dt
 ><span class="section"><a href="ch03s04.html#help_menu">Help 
 >Menu</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a 
 >href="ch04.html">4. FAQ</a></span></dt><dd><dl><dt><span class="section"><a 
 >href="ch04.html#first">Why are ace archives not 
 >supported?</a></span></dt><dt><span class="section"><a 
 >href="ch04s02.html">How can I create an archive with some files password 
 >protected and others not?</a></span></dt><dt><span class="section"><a 
 >href="ch04s03.html">Why does Xarchiver emit this error message when handling 
 >tar archives?</a></span></dt><dt><span class="section"><a 
 >href="ch04s04.html">Why is the option "Extract with full path" disabled when 
 >using the -e switch with tar archives?</a></span></dt><dt><span 
 >class="section"><a href="ch04s05.html">Why does Xarchiver sometimes report 
 >errors but the Error messages window is empty?</a></span></dt><dt><span 
 >class="section"><a href="ch04s06.html">Why is the window sometimes empty when 
 >I click View?</a></span></dt></dl></
 dd></dl></div><div class="list-of-figures"><p><b>List of 
Figures</b></p><dl><dt>3.1. <a href="ch03s04.html#id2482287">New 
dialog</a></dt><dt>3.2. <a href="ch03s04.html#id2482360">Archive properties 
dialog</a></dt><dt>3.3. <a href="ch03s04.html#id2482422">Add 
dialog</a></dt><dt>3.4. <a href="ch03s04.html#id2482446">Extract 
dialog</a></dt><dt>3.5. <a href="ch03s04.html#id2482576">ISO properties 
dialog</a></dt></dl></div><div class="list-of-tables"><p><b>List of 
Tables</b></p><dl><dt>3.1. <a href="ch03s02.html#id2482072">Command line 
Options</a></dt></dl></div></div><div class="navfooter"><hr /><table 
width="100%" summary="Navigation footer"><tr><td width="40%" 
align="left"> </td><td width="20%" align="center"> </td><td width="40%" 
align="right"> <a accesskey="n" href="ch01.html">Next</a></td></tr><tr><td 
width="40%" align="left" valign="top"> </td><td width="20%" 
align="center"> </td><td width="40%" align="right" valign="top"> Chapter 1. 
                        Introduction
                </td></tr></table></div></body></html>

Modified: xarchiver/trunk/doc/xarchiver.docbook
===================================================================
--- xarchiver/trunk/doc/xarchiver.docbook       2006-10-04 06:26:18 UTC (rev 
23277)
+++ xarchiver/trunk/doc/xarchiver.docbook       2006-10-04 09:24:20 UTC (rev 
23278)
@@ -239,7 +239,9 @@
                                        <title>Open</title>
                                                <para>
                                                        Opens a new archive. If 
you force &app; to open an unsupported archive
-                                                       type an error message 
will be emitted.
+                                                       type an error message 
will be emitted. The archive type is detected by its magic header and not by 
the extension. Password protected archives are supported also. The password 
detection is done by looking for the password flag inside the archive structure 
except for rar ones since encrypted files in rar archives have an asterisk 
right before their filename. 7zip encrypted archives are not detected due to 
the complexity of 7zip format. Please see <ulink 
url="http://sourceforge.net/forum/forum.php?thread_id=1378003&amp;forum_id=383044";>
+                               <citetitle>this thread on sf.net</citetitle>
+                               </ulink>for more information.
                                                </para>
                                </section>
                                <section id="test">

Modified: xarchiver/trunk/src/Makefile.am
===================================================================
--- xarchiver/trunk/src/Makefile.am     2006-10-04 06:26:18 UTC (rev 23277)
+++ xarchiver/trunk/src/Makefile.am     2006-10-04 09:24:20 UTC (rev 23278)
@@ -8,6 +8,7 @@
        interface.c interface.h \
        callbacks.c callbacks.h \
        arj.c arj.h \
+       deb.c deb.h \
        zip.c zip.h \
        rar.c rar.h \
        7zip.c 7zip.h \

Modified: xarchiver/trunk/src/archive.c
===================================================================
--- xarchiver/trunk/src/archive.c       2006-10-04 06:26:18 UTC (rev 23277)
+++ xarchiver/trunk/src/archive.c       2006-10-04 09:24:20 UTC (rev 23278)
@@ -68,8 +68,7 @@
                response = ShowGtkMessageDialog 
(NULL,GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK, _("Can't run the 
archiver executable:"),error->message);
                g_error_free (error);
                g_strfreev ( argv );
-        archive->child_pid = 0;
-
+               archive->child_pid = 0;
                return;
        }
        g_strfreev ( argv );
@@ -102,7 +101,7 @@
 {
        if (archive == NULL)
                return;
-       
+
        if(archive->path != NULL)
        {
                g_free(archive->path);
@@ -110,11 +109,11 @@
        }
 
        if(archive->escaped_path != NULL)
-       {       
+       {
                g_free(archive->escaped_path);
                archive->escaped_path = NULL;
        }
-               
+
        if (archive->tmp != NULL)
        {
                unlink (archive->tmp);

Modified: xarchiver/trunk/src/archive.h
===================================================================
--- xarchiver/trunk/src/archive.h       2006-10-04 06:26:18 UTC (rev 23277)
+++ xarchiver/trunk/src/archive.h       2006-10-04 09:24:20 UTC (rev 23278)
@@ -23,6 +23,7 @@
        XARCHIVETYPE_UNKNOWN,
        XARCHIVETYPE_7ZIP,
        XARCHIVETYPE_ARJ,
+       XARCHIVETYPE_DEB,
        XARCHIVETYPE_BZIP2,
        XARCHIVETYPE_GZIP,
        XARCHIVETYPE_ISO,

Modified: xarchiver/trunk/src/callbacks.c
===================================================================
--- xarchiver/trunk/src/callbacks.c     2006-10-04 06:26:18 UTC (rev 23277)
+++ xarchiver/trunk/src/callbacks.c     2006-10-04 09:24:20 UTC (rev 23278)
@@ -87,10 +87,10 @@
                new = open = TRUE;
                info = exe = FALSE;
        }
-       else if (archive->type == XARCHIVETYPE_RPM)
+       else if (archive->type == XARCHIVETYPE_RPM || archive->type == 
XARCHIVETYPE_DEB)
        {
-               new = open = extract = select = TRUE;
-               info = exe = FALSE;
+               new = open = extract = select = info = TRUE;
+               exe = FALSE;
        }
        else if (archive->type == XARCHIVETYPE_TAR_BZ2 || archive->type == 
XARCHIVETYPE_TAR_GZ || archive->type == XARCHIVETYPE_TAR )
        {
@@ -355,6 +355,10 @@
                OpenArj (archive);
                break;
 
+               case XARCHIVETYPE_DEB:
+               OpenDeb (archive);
+               break;
+
                case XARCHIVETYPE_BZIP2:
                OpenBzip2 (archive);
                break;
@@ -738,25 +742,23 @@
     static GtkWidget *about = NULL;
     const char *authors[] = {"\nDevelopers:\nGiuseppe Torelli - Colossus 
<[EMAIL PROTECTED]>\nISO support: Salvatore Santagati  <[EMAIL PROTECTED]>\nLHA 
support: Łukasz <[EMAIL PROTECTED]>",NULL};
     const char *documenters[] = {"\nSpecial thanks to Bjoern Martensen for 
discovering\nmany bugs in the Xarchiver development code.\n\nThanks 
to:\nBenedikt Meurer\nStephan Arts\nEnrico Tröger\nUracile for the stunning 
logo\nThe people of gtk-app-devel-list.", NULL};
-       if (about != NULL)
+
+       if (about == NULL)
        {
-               gtk_window_present (GTK_WINDOW (about));
-               return;
-       }
-       about = gtk_about_dialog_new ();
-       gtk_about_dialog_set_email_hook (xa_activate_link, NULL, NULL);
-       gtk_about_dialog_set_url_hook (xa_activate_link, NULL, NULL);
-       g_object_set (about,
-                     "name",  "Xarchiver",
-                     "version", PACKAGE_VERSION,
-                     "copyright", "Copyright \xC2\xA9 2005-2006 Giuseppe 
Torelli",
-                     "comments", "A lightweight GTK+2 archive manager",
-                     "authors", authors,
-              "documenters",documenters,
-                     "translator_credits", _("translator-credits"),
-                     "logo_icon_name", "xarchiver",
-                     "website", "http://xarchiver.xfce.org";,
-                     "license",    "Copyright \xC2\xA9 2005-2006 Giuseppe 
Torelli - Colossus <[EMAIL PROTECTED]>\n\n"
+               about = gtk_about_dialog_new ();
+               gtk_about_dialog_set_email_hook (xa_activate_link, NULL, NULL);
+               gtk_about_dialog_set_url_hook (xa_activate_link, NULL, NULL);
+               g_object_set (about,
+                               "name",  "Xarchiver",
+                               "version", PACKAGE_VERSION,
+                               "copyright", "Copyright \xC2\xA9 2005-2006 
Giuseppe Torelli",
+                               "comments", "A lightweight GTK+2 archive 
manager",
+                               "authors", authors,
+                               "documenters",documenters,
+                               "translator_credits", _("translator-credits"),
+                               "logo_icon_name", "xarchiver",
+                               "website", "http://xarchiver.xfce.org";,
+                               "license",    "Copyright \xC2\xA9 2005-2006 
Giuseppe Torelli - Colossus <[EMAIL PROTECTED]>\n\n"
                                        "This is free software; you can 
redistribute it and/or\n"
                                        "modify it under the terms of the GNU 
Library General Public License as\n"
                                        "published by the Free Software 
Foundation; either version 2 of the\n"
@@ -772,11 +774,10 @@
                                        "write to the Free Software Foundation, 
Inc., 59 Temple Place - Suite 330,\n"
                                        "Boston, MA 02111-1307, USA.\n",
                      NULL);
-       gtk_window_set_destroy_with_parent (GTK_WINDOW (about), TRUE);
-       g_signal_connect (G_OBJECT (about), "destroy",  G_CALLBACK 
(gtk_widget_destroyed), &about);
-       gtk_window_set_position (GTK_WINDOW (about), GTK_WIN_POS_CENTER);
+               gtk_window_set_position (GTK_WINDOW (about), 
GTK_WIN_POS_CENTER);
+       }
        gtk_dialog_run ( GTK_DIALOG(about) );
-       gtk_widget_destroy (about);
+       gtk_widget_hide (about);
 }
 
 gchar *xa_open_file_dialog ()
@@ -797,6 +798,7 @@
                                                NULL);
 
                gtk_dialog_set_default_response (GTK_DIALOG (File_Selector), 
GTK_RESPONSE_ACCEPT);
+               gtk_window_set_destroy_with_parent (GTK_WINDOW (File_Selector) 
, TRUE);
 
                filter = gtk_file_filter_new ();
                gtk_file_filter_set_name ( filter , _("All files") );
@@ -843,6 +845,7 @@
        else if ( (response == GTK_RESPONSE_CANCEL) || (response == 
GTK_RESPONSE_DELETE_EVENT) )
                path = NULL;
 
+       /* Hiding the window instead of destroying it will preserve the 
pointers to the file chooser stuff */
        gtk_widget_hide (File_Selector);
        return path;
 }
@@ -956,6 +959,7 @@
     else if ( isISO ( dummy_ptr ) ) xx = XARCHIVETYPE_ISO;
        //else if ( memcmp 
(magic,"\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00",12) == 0 ) xx = 
XARCHIVETYPE_BIN;
        else if ( isLha ( dummy_ptr ) ) xx = XARCHIVETYPE_LHA;
+       else if ( memcmp ( magic,"!<arch>\n", 8 ) == 0) xx = XARCHIVETYPE_DEB;
        fclose ( dummy_ptr );
        return xx;
 }
@@ -1517,7 +1521,7 @@
                OffDeleteandViewButtons();
        else
        {
-               if ( archive->type != XARCHIVETYPE_RPM && archive->type != 
XARCHIVETYPE_ISO )
+               if ( archive->type != XARCHIVETYPE_RPM && archive->type != 
XARCHIVETYPE_ISO && archive->type != XARCHIVETYPE_DEB)
                {
                        gtk_widget_set_sensitive ( delete_menu , TRUE );
                        gtk_widget_set_sensitive ( Delete_button , TRUE );

Modified: xarchiver/trunk/src/callbacks.h
===================================================================
--- xarchiver/trunk/src/callbacks.h     2006-10-04 06:26:18 UTC (rev 23277)
+++ xarchiver/trunk/src/callbacks.h     2006-10-04 09:24:20 UTC (rev 23278)
@@ -36,6 +36,7 @@
 #include <unistd.h>
 
 #include "arj.h"
+#include "deb.h"
 #include "lha.h"
 #include "iso.h"
 #include "zip.h"

Added: xarchiver/trunk/src/deb.c
===================================================================
--- xarchiver/trunk/src/deb.c                           (rev 0)
+++ xarchiver/trunk/src/deb.c   2006-10-04 09:24:20 UTC (rev 23278)
@@ -0,0 +1,72 @@
+/*
+ *  Copyright (C) 2006 Giuseppe Torelli - <[EMAIL PROTECTED]>
+ *  Copyright (C) 2006 Lukasz 'Sil2100' Zemczak - <[EMAIL PROTECTED]>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+#include "deb.h"
+#include "string_utils.h"
+
+void OpenDeb ( XArchive *archive )
+{
+       gchar *command = NULL;
+       gchar *archive_no_path = NULL;
+       gboolean result;
+
+       archive_no_path = g_strrstr (archive->escaped_path,"/");
+       archive_no_path++;
+       archive->tmp = g_strconcat (" /tmp/",archive_no_path,NULL);
+
+       /* Let's copy the .deb archive to /tmp */
+       command = g_strconcat ("cp ",archive->escaped_path,archive->tmp,NULL);
+       result = xa_run_command ( command , 0);
+       g_free (command);
+       if (result == FALSE)
+               return;
+
+       /* Ok, let's now extract the .deb archive with ar */
+       chdir ("/tmp");
+       command = g_strconcat ("ar xv" , archive->tmp, NULL);
+       result = xa_run_command ( command , 0);
+       g_free (command);
+       g_free (archive->tmp);
+       archive->tmp = g_strdup ("/tmp/data.tar.gz");
+
+       unlink ("/tmp/control.tar.gz");
+       unlink ("/tmp/debian-binary");
+       unlink (archive_no_path);
+
+       if (result == FALSE)
+               return;
+
+       /* Finally, let's show the content in /tmp/data.tar.gz */
+       command = g_strconcat ("tar tfzv /tmp/data.tar.gz", NULL);
+       archive->dummy_size = 0;
+       archive->nr_of_files = 0;
+       archive->nr_of_dirs = 0;
+       archive->format ="DEB";
+       archive->parse_output = TarOpen;
+       SpawnAsyncProcess ( archive , command , 0, 0);
+       g_free (command);
+
+       if (archive->child_pid == 0)
+               return;
+
+       char *names[]= {(_("Filename")),(_("Permissions")),(_("Symbolic 
Link")),(_("Owner/Group")),(_("Size")),(_("Date")),(_("Time"))};
+       GType types[]= 
{G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_UINT64,G_TYPE_STRING,G_TYPE_STRING};
+       xa_create_liststore ( 7, names , (GType *)types );
+}

Added: xarchiver/trunk/src/deb.h
===================================================================
--- xarchiver/trunk/src/deb.h                           (rev 0)
+++ xarchiver/trunk/src/deb.h   2006-10-04 09:24:20 UTC (rev 23278)
@@ -0,0 +1,27 @@
+/*
+ *  Copyright (C) 2006 Giuseppe Torelli - <[EMAIL PROTECTED]>
+ *  Copyright (C) 2006 Lukasz 'Sil2100' Zemczak - <[EMAIL PROTECTED]>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef DEB_H
+#define DEB_H
+
+#include "callbacks.h"
+#include "archive.h"
+
+void OpenDeb ( XArchive *archive );
+#endif

Modified: xarchiver/trunk/src/extract_dialog.c
===================================================================
--- xarchiver/trunk/src/extract_dialog.c        2006-10-04 06:26:18 UTC (rev 
23277)
+++ xarchiver/trunk/src/extract_dialog.c        2006-10-04 09:24:20 UTC (rev 
23278)
@@ -162,7 +162,7 @@
        gtk_box_pack_start (GTK_BOX (dialog_data->vbox4), 
dialog_data->overwrite_check, FALSE, FALSE, 0);
 
        dialog_data->extract_full = gtk_check_button_new_with_mnemonic 
(_("Extract files with full path"));
-       if (cli && (archive->type == XARCHIVETYPE_TAR || archive->type == 
XARCHIVETYPE_TAR_GZ || archive->type == XARCHIVETYPE_TAR_BZ2) )
+       if (cli && (archive->type == XARCHIVETYPE_TAR || archive->type == 
XARCHIVETYPE_TAR_GZ || archive->type == XARCHIVETYPE_DEB || archive->type == 
XARCHIVETYPE_TAR_BZ2) )
        {
                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON 
(dialog_data->extract_full), TRUE);
                gtk_widget_set_sensitive (dialog_data->extract_full, FALSE);
@@ -173,7 +173,7 @@
        gtk_tooltips_set_tip 
(dialog_data->option_tooltip,dialog_data->extract_full , _("The archive's 
directory structure is recreated in the extraction directory."), NULL );
        gtk_box_pack_start (GTK_BOX (dialog_data->vbox4), 
dialog_data->extract_full, FALSE, FALSE, 0);
 
-       if (archive->type == XARCHIVETYPE_TAR || archive->type == 
XARCHIVETYPE_TAR_GZ || archive->type == XARCHIVETYPE_TAR_BZ2)
+       if (archive->type == XARCHIVETYPE_TAR || archive->type == 
XARCHIVETYPE_TAR_GZ || archive->type == XARCHIVETYPE_TAR_BZ2 || archive->type 
== XARCHIVETYPE_DEB)
        {
                dialog_data->touch = gtk_check_button_new_with_mnemonic 
(_("Touch files"));
                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON 
(dialog_data->touch), archive->tar_touch);
@@ -461,6 +461,21 @@
                                        }
                                        break;
 
+                                       case XARCHIVETYPE_DEB:
+                                       if (archive->full_path == 1)
+                                       {
+                                               command = g_strconcat (tar, " 
-xvzf " , archive->tmp,
+                                                                               
        archive->overwrite ? " --overwrite" : " --keep-old-files",
+                                                                               
        archive->tar_touch ? " --touch" : "",
+                                                                               
        " -C " , archive->extraction_path , NULL );
+                                       }
+                                       else
+                                       {
+                                               
xa_extract_tar_without_directories ( "tar -xvzf " , archive->tmp, 
archive->overwrite,archive->tar_touch,archive->extraction_path, FALSE );
+                                               command = NULL;
+                                       }
+                                       break;
+
                     case XARCHIVETYPE_ZIP:
                     if ( archive->passwd != NULL )
                                                command = g_strconcat ( "unzip 
", archive->freshen ? "-f " : "",
@@ -661,6 +676,21 @@
                }
                break;
 
+               case XARCHIVETYPE_DEB:
+               if (archive->full_path == 1)
+               {
+                       command = g_strconcat (tar, " -xvzf " , archive->tmp,
+                                       archive->overwrite ? " --overwrite" : " 
--keep-old-files",
+                                       archive->tar_touch ? " --touch" : "",
+                                       " -C " , archive->extraction_path , 
NULL );
+               }
+               else
+               {
+                       xa_extract_tar_without_directories ( "tar -xvzf " , 
archive->tmp, archive->overwrite,archive->tar_touch,archive->extraction_path, 
FALSE );
+                       command = NULL;
+               }
+               break;
+
                case XARCHIVETYPE_ZIP:
         if ( archive->passwd != NULL )
                        command = g_strconcat ( "unzip ", archive->freshen ? 
"-f " : "",

Modified: xarchiver/trunk/src/main.c
===================================================================
--- xarchiver/trunk/src/main.c  2006-10-04 06:26:18 UTC (rev 23277)
+++ xarchiver/trunk/src/main.c  2006-10-04 09:24:20 UTC (rev 23278)
@@ -257,6 +257,14 @@
 
 void GetAvailableCompressors()
 {
+       absolute_path = g_find_program_in_path("arj");
+       if ( absolute_path )
+       {
+               ArchiveType = g_list_prepend ( ArchiveType, ".arj");
+               ArchiveSuffix = g_list_prepend ( ArchiveSuffix, "*.arj");
+               g_free (absolute_path);
+       }
+
        absolute_path = g_find_program_in_path("bzip2");
     if ( absolute_path )
        {
@@ -265,6 +273,13 @@
                g_free (absolute_path);
        }
 
+       absolute_path = g_find_program_in_path("ar");
+    if ( absolute_path )
+       {
+           ArchiveSuffix = g_list_prepend ( ArchiveSuffix, "*.deb");
+               g_free (absolute_path);
+       }
+
        absolute_path = g_find_program_in_path("gzip");
        if ( absolute_path )
        {
@@ -281,24 +296,8 @@
        ArchiveType = g_list_prepend ( ArchiveType, ".iso");
        ArchiveSuffix = g_list_prepend ( ArchiveSuffix, "*.iso");
 
-       absolute_path = g_find_program_in_path("arj");
-       if ( absolute_path )
-       {
-               ArchiveType = g_list_prepend ( ArchiveType, ".arj");
-               ArchiveSuffix = g_list_prepend ( ArchiveSuffix, "*.arj");
-               g_free (absolute_path);
-       }
-
-       absolute_path = g_find_program_in_path("cpio");
-    if ( absolute_path )
-       {
-           ArchiveSuffix = g_list_prepend ( ArchiveSuffix, "*.rpm");
-               g_free (absolute_path);
-       }
-
        absolute_path = g_find_program_in_path("lha");
-
-       if(absolute_path)
+       if (absolute_path)
        {
                ArchiveType = g_list_prepend(ArchiveType, ".lzh");
                ArchiveSuffix = g_list_prepend(ArchiveSuffix, "*.lzh");
@@ -325,6 +324,14 @@
                        g_free (absolute_path);
                }
        }
+
+       absolute_path = g_find_program_in_path("cpio");
+    if ( absolute_path )
+       {
+           ArchiveSuffix = g_list_prepend ( ArchiveSuffix, "*.rpm");
+               g_free (absolute_path);
+       }
+
        absolute_path = g_find_program_in_path("tar");
        if ( absolute_path )
        {

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to