diff -Nur xarchiver-0.5.2.orig/doc/xarchiver.docbook xarchiver-0.5.2/doc/xarchiver.docbook
--- xarchiver-0.5.2.orig/doc/xarchiver.docbook 2007-08-22 07:49:19.000000000 -0300
+++ xarchiver-0.5.2/doc/xarchiver.docbook 2014-01-24 11:01:17.088748863 -0200
@@ -204,7 +204,7 @@
Startup
- At startup, &app; detects the available installed archivers (tar,rar,zip etc). Since Xarchiver is a frontend (a graphic user interface to the cmd-line executables) it can't create archives whose archiver is not available. For instance if you have the free edition of rar, unrar, Xarchiver can't create rar archives since unrar allows rar archives to be opened, tested and extracted but not to be created.
+ At startup, &app; detects the available installed archivers (tar,rar,zip etc). Since Xarchiver is a frontend (a graphic user interface to the cmd-line executables) it can't create archives whose archiver is not available. For instance if you have the free as in freedom alternative of rar, unar, Xarchiver can't create rar archives since unar allows rar archives to be opened and extracted but not to be created.
diff -Nur xarchiver-0.5.2.orig/src/extract_dialog.c xarchiver-0.5.2/src/extract_dialog.c
--- xarchiver-0.5.2.orig/src/extract_dialog.c 2008-11-10 08:28:11.000000000 -0200
+++ xarchiver-0.5.2/src/extract_dialog.c 2014-01-24 10:55:28.209263885 -0200
@@ -24,7 +24,7 @@
#include "string_utils.h"
#include "support.h"
-extern gboolean unrar,batch_mode;
+extern gboolean unar,batch_mode;
extern Prefs_dialog_data *prefs_window;
extern Progress_bar_data *pb;
extern extract_func extract [XARCHIVETYPE_COUNT];
@@ -290,11 +290,7 @@
GSList *names = NULL;
GtkTreeModel *model;
int response;
-
- if (unrar)
- rar = "unrar";
- else
- rar = "rar";
+ rar = "unar";
while (! done)
{
diff -Nur xarchiver-0.5.2.orig/src/interface.c xarchiver-0.5.2/src/interface.c
--- xarchiver-0.5.2.orig/src/interface.c 2008-11-11 06:09:01.000000000 -0200
+++ xarchiver-0.5.2/src/interface.c 2014-01-24 10:56:03.893317117 -0200
@@ -45,7 +45,7 @@
{ "text/uri-list",0,0 },
};
-extern gboolean unrar,batch_mode;
+extern gboolean unar,batch_mode;
static gboolean xa_progress_dialog_delete_event (GtkWidget *caller,GdkEvent *event,GPid pid);
static void xa_progress_dialog_stop_action (GtkWidget *widget,GPid pid);
@@ -629,7 +629,7 @@
{
gtk_widget_show(selected_frame);
gtk_widget_set_sensitive(deselect_all,TRUE);
- if (archive[id]->type == XARCHIVETYPE_RAR && unrar)
+ if (archive[id]->type == XARCHIVETYPE_RAR && unar)
{
gtk_widget_set_sensitive (delete_menu,FALSE);
gtk_widget_set_sensitive (rename_menu,FALSE);
diff -Nur xarchiver-0.5.2.orig/src/main.c xarchiver-0.5.2/src/main.c
--- xarchiver-0.5.2.orig/src/main.c 2008-11-10 09:21:43.000000000 -0200
+++ xarchiver-0.5.2/src/main.c 2014-01-24 12:18:53.211684553 -0200
@@ -33,7 +33,7 @@
gchar *add_files;
gboolean error_output, file_to_open, ask_and_extract, ask_and_add, multi_extract;
gboolean batch_mode = FALSE;
-gboolean unrar = FALSE;
+gboolean unar = FALSE;
gboolean sevenzr = FALSE, sevenza = FALSE, xdg_open = FALSE;
int response;
extern gchar *current_open_directory;
@@ -312,7 +312,6 @@
delete[XARCHIVETYPE_GZIP] = 0;
delete[XARCHIVETYPE_LZMA] = 0;
delete[XARCHIVETYPE_XZ] = 0;
- delete[XARCHIVETYPE_RAR] = &xa_rar_delete;
delete[XARCHIVETYPE_RPM] = 0;
delete[XARCHIVETYPE_TAR] = delete[XARCHIVETYPE_TAR_BZ2] = delete[XARCHIVETYPE_TAR_GZ] = delete[XARCHIVETYPE_TAR_LZMA] = delete[XARCHIVETYPE_TAR_XZ] = delete[XARCHIVETYPE_TAR_LZOP] = &xa_tar_delete;
delete[XARCHIVETYPE_ZIP] = &xa_zip_delete;
@@ -325,7 +324,6 @@
add[XARCHIVETYPE_ARJ] = &xa_arj_add;
add[XARCHIVETYPE_DEB] = 0;
add[XARCHIVETYPE_BZIP2] = add[XARCHIVETYPE_GZIP] = add[XARCHIVETYPE_LZMA] = add[XARCHIVETYPE_XZ] = &xa_tar_add;
- add[XARCHIVETYPE_RAR] = &xa_rar_add;
add[XARCHIVETYPE_RPM] = 0;
add[XARCHIVETYPE_TAR] = add[XARCHIVETYPE_TAR_BZ2] = add[XARCHIVETYPE_TAR_GZ] = add[XARCHIVETYPE_TAR_LZMA] = add[XARCHIVETYPE_TAR_XZ] = add[XARCHIVETYPE_TAR_LZOP] = &xa_tar_add;
add[XARCHIVETYPE_ZIP] = &xa_zip_add;
@@ -348,7 +346,6 @@
test[XARCHIVETYPE_7ZIP] = &xa_7zip_test;
test[XARCHIVETYPE_ARJ] = &xa_arj_test;
test[XARCHIVETYPE_DEB] = test[XARCHIVETYPE_BZIP2] = test[XARCHIVETYPE_GZIP] = test[XARCHIVETYPE_LZMA] = test[XARCHIVETYPE_XZ] = 0;
- test[XARCHIVETYPE_RAR] = &xa_rar_test;
test[XARCHIVETYPE_RPM] = 0;
test[XARCHIVETYPE_TAR] = test[XARCHIVETYPE_TAR_BZ2] = test[XARCHIVETYPE_TAR_GZ] = test[XARCHIVETYPE_TAR_LZMA] = test[XARCHIVETYPE_TAR_XZ] = test[XARCHIVETYPE_TAR_LZOP] = 0;
test[XARCHIVETYPE_ZIP] = &xa_zip_test;
@@ -420,24 +417,14 @@
//ArchiveSuffix = g_list_append(ArchiveSuffix, "");
}
- absolute_path = g_find_program_in_path ("rar");
- if ( absolute_path )
+ absolute_path = g_find_program_in_path("unar");
+ if ( absolute_path )
{
+ unar = TRUE;
ArchiveType = g_list_append(ArchiveType, "rar");
ArchiveSuffix = g_list_append(ArchiveSuffix, "*.rar");
g_free (absolute_path);
}
- else
- {
- absolute_path = g_find_program_in_path("unrar");
- if ( absolute_path )
- {
- unrar = TRUE;
- ArchiveType = g_list_append(ArchiveType, "rar");
- ArchiveSuffix = g_list_append(ArchiveSuffix, "*.rar");
- g_free (absolute_path);
- }
- }
absolute_path = g_find_program_in_path("cpio");
if ( absolute_path )
diff -Nur xarchiver-0.5.2.orig/src/new_dialog.c xarchiver-0.5.2/src/new_dialog.c
--- xarchiver-0.5.2.orig/src/new_dialog.c 2008-11-11 06:28:46.000000000 -0200
+++ xarchiver-0.5.2/src/new_dialog.c 2014-01-24 10:56:34.274491565 -0200
@@ -24,7 +24,7 @@
#include "string_utils.h"
#include "main.h"
-extern gboolean unrar;
+extern gboolean unar;
extern Prefs_dialog_data *prefs_window;
gchar *current_new_directory = NULL;
gint new_combo_box = -1;
diff -Nur xarchiver-0.5.2.orig/src/pref_dialog.c xarchiver-0.5.2/src/pref_dialog.c
--- xarchiver-0.5.2.orig/src/pref_dialog.c 2008-11-10 06:05:07.000000000 -0200
+++ xarchiver-0.5.2/src/pref_dialog.c 2014-01-24 10:54:07.611853842 -0200
@@ -23,7 +23,7 @@
#include "main.h"
#include "support.h"
-extern gboolean unrar;
+extern gboolean unar;
extern gboolean xdg_open;
extern Extract_dialog_data *extract_window;
extern Add_dialog_data *add_window;
@@ -104,7 +104,7 @@
{
if (strcmp(archive_type->data, "tgz") == 0 ||
strcmp(archive_type->data, "rpm") == 0 ||
- (strcmp(archive_type->data, "rar") == 0 && unrar) )
+ (strcmp(archive_type->data, "rar") == 0 && unar) )
goto next;
else
gtk_combo_box_append_text (GTK_COMBO_BOX (prefs_data->combo_prefered_format),archive_type->data );
diff -Nur xarchiver-0.5.2.orig/src/rar.c xarchiver-0.5.2/src/rar.c
--- xarchiver-0.5.2.orig/src/rar.c 2008-11-10 06:05:07.000000000 -0200
+++ xarchiver-0.5.2/src/rar.c 2014-01-24 13:09:12.838038687 -0200
@@ -20,7 +20,7 @@
#include "rar.h"
#include
-extern gboolean unrar;
+extern gboolean unar;
extern void xa_reload_archive_content(XArchive *archive);
extern void xa_create_liststore ( XArchive *archive, gchar *columns_names[]);
@@ -30,19 +30,10 @@
gchar *command = NULL;
gchar *rar = NULL;
jump_header = read_filename = last_line = encrypted = FALSE;
+ rar = "unar";
+ archive->can_add = archive->has_sfx = FALSE;
- if (unrar)
- {
- rar = "unrar";
- archive->can_add = archive->has_sfx = FALSE;
- }
- else
- {
- rar = "rar";
- archive->can_add = archive->has_sfx = TRUE;
- }
-
- command = g_strconcat ( rar," v " , archive->escaped_path, NULL );
+ command = g_strconcat ( rar, archive->escaped_path, NULL );
archive->can_extract = archive->has_test = archive->has_properties = TRUE;
archive->dummy_size = 0;
archive->nr_of_files = 0;
@@ -222,71 +213,6 @@
}
}
-void xa_rar_delete (XArchive *archive,GSList *names)
-{
- gchar *command,*e_filename = NULL;
- GSList *list = NULL,*_names;
- GString *files = g_string_new("");
-
- _names = names;
- while (_names)
- {
- e_filename = xa_escape_filename((gchar*)_names->data,"$'`\"\\!?* ()[]&|:;<>#");
- g_string_prepend (files,e_filename);
- g_string_prepend_c (files,' ');
- _names = _names->next;
- }
- g_slist_foreach(names,(GFunc)g_free,NULL);
- g_slist_free(names);
-
- command = g_strconcat ("rar d ",archive->escaped_path," ",files->str,NULL);
- g_string_free(files,TRUE);
- list = g_slist_append(list,command);
-
- xa_run_command (archive,list);
- if (archive->status == XA_ARCHIVESTATUS_DELETE)
- xa_reload_archive_content(archive);
-}
-
-void xa_rar_add (XArchive *archive,GString *files,gchar *compression_string)
-{
- GSList *list = NULL;
- gchar *command = NULL;
-
- if (archive->location_entry_path != NULL)
- archive->working_dir = g_strdup(archive->tmp);
-
- if (compression_string == NULL)
- compression_string = "3";
- if (archive->passwd != NULL)
- command = g_strconcat ( "rar a ",
- archive->update ? "-u " : "",
- archive->freshen ? "-f " : "",
- archive->solid_archive ? "-s " : "",
- archive->remove_files ? "-df " : "",
- "-p" , archive->passwd,
- " -idp ",
- "-m",compression_string," ",
- archive->escaped_path,
- files->str,NULL);
- else
- command = g_strconcat ( "rar a ",
- archive->update ? "-u " : "",
- archive->freshen ? "-f " : "",
- archive->solid_archive ? "-s " : " ",
- archive->remove_files ? "-df " : " ",
- "-idp ",
- "-m",compression_string," ",
- archive->escaped_path,
- files->str,NULL);
-
- g_string_free(files,TRUE);
- list = g_slist_append(list,command);
-
- xa_run_command (archive,list);
- xa_reload_archive_content(archive);
-}
-
gboolean xa_rar_extract(XArchive *archive,GSList *files)
{
gchar *rar, *command, *e_filename = NULL;
@@ -295,10 +221,7 @@
gboolean result = FALSE;
_files = files;
- if (unrar)
- rar = "unrar";
- else
- rar = "rar";
+ rar = "unar";
while (_files)
{
@@ -311,42 +234,16 @@
g_slist_free(_files);
if (archive->passwd != NULL)
- command = g_strconcat (rar," ",archive->full_path ? "x " : "e ",
- archive->freshen ? "-f " : "" , archive->update ? "-u " : "",
- " -p",archive->passwd,
- archive->overwrite ? " -o+" : " -o-",
- " -idp ",
- archive->escaped_path,names->str," ",archive->extraction_path , NULL );
- else
- command = g_strconcat (rar," ",archive->full_path ? "x " : "e ",
- archive->freshen ? "-f " : "" , archive->update ? "-u " : "",
- archive->overwrite ? "-o+" : "-o-",
- " -idp ",
- archive->escaped_path,names->str," ",archive->extraction_path , NULL );
+ command = g_strconcat (rar," -p",archive->passwd,
+ archive->overwrite ? " -f" : "" ,
+ archive->escaped_path,names->str," ",archive->extraction_path , NULL );
+ else
+ command = g_strconcat (rar," ",
+ archive->overwrite ? " -f" : "" ,
+ archive->escaped_path,names->str," ",archive->extraction_path , NULL );
g_string_free(names,TRUE);
list = g_slist_append(list,command);
result = xa_run_command (archive,list);
return result;
}
-
-void xa_rar_test (XArchive *archive)
-{
- gchar *rar = NULL;
- gchar *command = NULL;
- GSList *list = NULL;
-
- if (unrar)
- rar = "unrar";
- else
- rar = "rar";
-
- archive->status = XA_ARCHIVESTATUS_TEST;
- if (archive->passwd != NULL)
- command = g_strconcat (rar," t -idp -p" , archive->passwd ," " , archive->escaped_path, NULL);
- else
- command = g_strconcat (rar," t -idp " , archive->escaped_path, NULL);
-
- list = g_slist_append(list,command);
- xa_run_command (archive,list);
- }
diff -Nur xarchiver-0.5.2.orig/src/rar.h xarchiver-0.5.2/src/rar.h
--- xarchiver-0.5.2.orig/src/rar.h 2008-08-22 05:12:38.000000000 -0300
+++ xarchiver-0.5.2/src/rar.h 2014-01-24 10:49:13.140141939 -0200
@@ -26,10 +26,7 @@
#include "support.h"
#include "archive.h"
gboolean jump_header,jump_comment,read_filename, last_line, encrypted;
-void xa_rar_delete (XArchive *,GSList *);
-void xa_rar_add (XArchive *,GString *,gchar *);
gboolean xa_rar_extract(XArchive *,GSList *);
-void xa_rar_test (XArchive *);
void xa_get_rar_line_content (gchar *line, gpointer data);
void xa_open_rar ( XArchive *archive );
#endif
diff -Nur xarchiver-0.5.2.orig/src/window.c xarchiver-0.5.2/src/window.c
--- xarchiver-0.5.2.orig/src/window.c 2008-11-11 06:31:45.000000000 -0200
+++ xarchiver-0.5.2/src/window.c 2014-01-24 10:54:28.673636196 -0200
@@ -26,7 +26,7 @@
extern GList *ArchiveType;
extern GList *ArchiveSuffix;
-extern gboolean unrar;
+extern gboolean unar;
extern gboolean xdg_open;
extern Prefs_dialog_data *prefs_window;
extern Extract_dialog_data *extract_window;
@@ -1567,7 +1567,7 @@
gtk_widget_show(selected_frame);
gtk_widget_set_sensitive(deselect_all,TRUE);
}
- if ( (archive->type == XARCHIVETYPE_RAR && unrar) || archive->type == XARCHIVETYPE_BZIP2 || archive->type == XARCHIVETYPE_GZIP || archive->type == XARCHIVETYPE_LZMA || archive->type == XARCHIVETYPE_XZ || archive->type == XARCHIVETYPE_LZOP)
+ if ( (archive->type == XARCHIVETYPE_RAR && unar) || archive->type == XARCHIVETYPE_BZIP2 || archive->type == XARCHIVETYPE_GZIP || archive->type == XARCHIVETYPE_LZMA || archive->type == XARCHIVETYPE_XZ || archive->type == XARCHIVETYPE_LZOP)
{
gtk_widget_set_sensitive (delete_menu,FALSE);
gtk_widget_set_sensitive (rename_menu,FALSE);
@@ -1781,7 +1781,7 @@
else
idx = xa_find_archive_index (current_page);
- if (archive[idx]->type == XARCHIVETYPE_RAR && unrar)
+ if (archive[idx]->type == XARCHIVETYPE_RAR && unar)
{
response = xa_show_message_dialog (GTK_WINDOW (xa_main_window),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("Can't perform this action:"),_("You have to install rar package!"));
return;