file-roller r2305 - in trunk: . data/icons/24x24/actions src
- From: paobac svn gnome org
- To: svn-commits-list gnome org
- Subject: file-roller r2305 - in trunk: . data/icons/24x24/actions src
- Date: Fri, 6 Jun 2008 11:22:49 +0000 (UTC)
Author: paobac
Date: Fri Jun 6 11:22:48 2008
New Revision: 2305
URL: http://svn.gnome.org/viewvc/file-roller?rev=2305&view=rev
Log:
2008-06-06 Paolo Bacchilega <paobac svn gnome org>
* src/fr-window.c:
added a ask_to_open_destination_after_extraction flag to open the
progress dialog only when appropriate.
* src/fr-process.c:
check whether current_comm is >= 0 before accessing the comm array.
* src/fr-command-cfile.c:
set the propAddCanUpdate and propAddCanReplace properties to TRUE.
* src/fr-command-unstuff.c:
* src/fr-command-tar.c:
* src/fr-command-rpm.c:
* src/fr-command-iso.c:
* src/fr-command-cpio.c:
* src/fr-command-ar.c:
* src/fr-command-ace.c:
* src/fr-command.h:
* src/fr-command.c:
get rid of the propCanModify property as it's been obsoleted by the
fr_command_is_capable_of() function.
* src/fr-archive.h:
* src/fr-archive.c:
add a have_permissions flag to differentiate when is not possible to
write an archive because the archive command doesn't support this
feature or because we don't have the file write permission.
* src/dlg-open-with.c (open_with__destroy_cb):
do not unref the AppInfo objects.
* src/fr-stock.h:
* src/fr-stock.c:
* data/icons/24x24/actions/Makefile.am:
* data/icons/24x24/actions/preview-file.png:
Removed the preview-file stock item, use gtk_stock_open instead.
Removed:
trunk/data/icons/24x24/actions/preview-file.png
Modified:
trunk/ChangeLog
trunk/data/icons/24x24/actions/Makefile.am
trunk/src/dlg-open-with.c
trunk/src/fr-archive.c
trunk/src/fr-archive.h
trunk/src/fr-command-ace.c
trunk/src/fr-command-ar.c
trunk/src/fr-command-cfile.c
trunk/src/fr-command-cpio.c
trunk/src/fr-command-iso.c
trunk/src/fr-command-rpm.c
trunk/src/fr-command-tar.c
trunk/src/fr-command-unstuff.c
trunk/src/fr-command.c
trunk/src/fr-command.h
trunk/src/fr-process.c
trunk/src/fr-stock.c
trunk/src/fr-stock.h
trunk/src/fr-window.c
trunk/src/ui.h
Modified: trunk/data/icons/24x24/actions/Makefile.am
==============================================================================
--- trunk/data/icons/24x24/actions/Makefile.am (original)
+++ trunk/data/icons/24x24/actions/Makefile.am Fri Jun 6 11:22:48 2008
@@ -7,8 +7,7 @@
icons_DATA = \
add-files-to-archive.png \
add-folder-to-archive.png \
- extract-archive.png \
- preview-file.png
+ extract-archive.png
noinst_DATA =
Modified: trunk/src/dlg-open-with.c
==============================================================================
--- trunk/src/dlg-open-with.c (original)
+++ trunk/src/dlg-open-with.c Fri Jun 6 11:22:48 2008
@@ -64,10 +64,8 @@
{
g_object_unref (G_OBJECT (data->gui));
- if (data->app_list != NULL) {
- g_list_foreach (data->app_list, (GFunc) g_object_unref, NULL);
+ if (data->app_list != NULL)
g_list_free (data->app_list);
- }
if (data->file_list != NULL)
path_list_free (data->file_list);
Modified: trunk/src/fr-archive.c
==============================================================================
--- trunk/src/fr-archive.c (original)
+++ trunk/src/fr-archive.c Fri Jun 6 11:22:48 2008
@@ -962,7 +962,8 @@
FrCommand *tmp_command;
const char *mime_type;
- archive->read_only = ! check_permissions (uri, W_OK);
+ archive->have_permissions = check_permissions (uri, W_OK);
+ archive->read_only = ! archive->have_permissions;
tmp_command = archive->command;
@@ -2111,7 +2112,7 @@
fr_archive_action_completed (archive,
FR_ACTION_ADDING_FILES,
FR_PROC_ERROR_GENERIC,
- _("You don't have the right permissions."));
+ ! archive->have_permissions ? _("You don't have the right permissions.") : _("This archive type cannot be modified"));
return;
}
Modified: trunk/src/fr-archive.h
==============================================================================
--- trunk/src/fr-archive.h (original)
+++ trunk/src/fr-archive.h Fri Jun 6 11:22:48 2008
@@ -51,11 +51,19 @@
FrProcess *process;
FrProcError error;
gboolean can_create_compressed_file;
- gboolean is_compressed_file; /* Whether the file is an
- * archive or a compressed
- * file. */
+ gboolean is_compressed_file; /* Whether the file is not an
+ * archive that can contain
+ * many files but simply a
+ * compressed file, for
+ * example foo.txt.gz is a
+ * compressed file, foo.zip
+ * is not. */
gboolean read_only; /* Whether archive is
- * read-only or not. */
+ * read-only for whatever
+ * reason. */
+ gboolean have_permissions; /* true if we have the
+ * permissions to write the
+ * file. */
FrArchivePrivData *priv;
};
Modified: trunk/src/fr-command-ace.c
==============================================================================
--- trunk/src/fr-command-ace.c (original)
+++ trunk/src/fr-command-ace.c Fri Jun 6 11:22:48 2008
@@ -265,7 +265,6 @@
static void
fr_command_ace_init (FrCommand *comm)
{
- comm->propCanModify = FALSE;
comm->propAddCanUpdate = TRUE;
comm->propAddCanReplace = TRUE;
comm->propExtractCanAvoidOverwrite = FALSE;
Modified: trunk/src/fr-command-ar.c
==============================================================================
--- trunk/src/fr-command-ar.c (original)
+++ trunk/src/fr-command-ar.c Fri Jun 6 11:22:48 2008
@@ -318,7 +318,6 @@
static void
fr_command_ar_init (FrCommand *comm)
{
- comm->propCanModify = TRUE;
comm->propAddCanUpdate = TRUE;
comm->propAddCanReplace = TRUE;
comm->propAddCanStoreFolders = FALSE;
Modified: trunk/src/fr-command-cfile.c
==============================================================================
--- trunk/src/fr-command-cfile.c (original)
+++ trunk/src/fr-command-cfile.c Fri Jun 6 11:22:48 2008
@@ -35,9 +35,6 @@
#include "fr-command.h"
#include "fr-command-cfile.h"
-static void fr_command_cfile_class_init (FrCommandCFileClass *class);
-static void fr_command_cfile_init (FrCommand *afile);
-static void fr_command_cfile_finalize (GObject *object);
/* Parent Class */
@@ -461,6 +458,18 @@
static void
+fr_command_cfile_finalize (GObject *object)
+{
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (FR_IS_COMMAND_CFILE (object));
+
+ /* Chain up */
+ if (G_OBJECT_CLASS (parent_class)->finalize)
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+
+static void
fr_command_cfile_class_init (FrCommandCFileClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
@@ -482,8 +491,8 @@
static void
fr_command_cfile_init (FrCommand *comm)
{
- comm->propAddCanUpdate = FALSE;
- comm->propAddCanReplace = FALSE;
+ comm->propAddCanUpdate = TRUE;
+ comm->propAddCanReplace = TRUE;
comm->propExtractCanAvoidOverwrite = FALSE;
comm->propExtractCanSkipOlder = FALSE;
comm->propExtractCanJunkPaths = FALSE;
@@ -492,22 +501,6 @@
}
-static void
-fr_command_cfile_finalize (GObject *object)
-{
- FrCommandCFile *comm_tar;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (FR_IS_COMMAND_CFILE (object));
-
- comm_tar = FR_COMMAND_CFILE (object);
-
- /* Chain up */
- if (G_OBJECT_CLASS (parent_class)->finalize)
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-
GType
fr_command_cfile_get_type ()
{
Modified: trunk/src/fr-command-cpio.c
==============================================================================
--- trunk/src/fr-command-cpio.c (original)
+++ trunk/src/fr-command-cpio.c Fri Jun 6 11:22:48 2008
@@ -217,7 +217,6 @@
static void
fr_command_cpio_init (FrCommand *comm)
{
- comm->propCanModify = FALSE;
comm->propAddCanUpdate = FALSE;
comm->propAddCanReplace = FALSE;
comm->propAddCanStoreFolders = FALSE;
Modified: trunk/src/fr-command-iso.c
==============================================================================
--- trunk/src/fr-command-iso.c (original)
+++ trunk/src/fr-command-iso.c Fri Jun 6 11:22:48 2008
@@ -250,7 +250,6 @@
comm_iso->cur_path = NULL;
comm_iso->joliet = TRUE;
- comm->propCanModify = FALSE;
comm->propAddCanUpdate = FALSE;
comm->propAddCanReplace = FALSE;
comm->propExtractCanAvoidOverwrite = FALSE;
Modified: trunk/src/fr-command-rpm.c
==============================================================================
--- trunk/src/fr-command-rpm.c (original)
+++ trunk/src/fr-command-rpm.c Fri Jun 6 11:22:48 2008
@@ -224,7 +224,6 @@
static void
fr_command_rpm_init (FrCommand *comm)
{
- comm->propCanModify = FALSE;
comm->propAddCanUpdate = FALSE;
comm->propAddCanReplace = FALSE;
comm->propExtractCanAvoidOverwrite = FALSE;
Modified: trunk/src/fr-command-tar.c
==============================================================================
--- trunk/src/fr-command-tar.c (original)
+++ trunk/src/fr-command-tar.c Fri Jun 6 11:22:48 2008
@@ -903,7 +903,6 @@
{
FrCommandTar *comm_tar = (FrCommandTar*) comm;
- comm->propCanModify = TRUE;
comm->propAddCanUpdate = FALSE;
comm->propAddCanReplace = FALSE;
comm->propAddCanStoreFolders = TRUE;
Modified: trunk/src/fr-command-unstuff.c
==============================================================================
--- trunk/src/fr-command-unstuff.c (original)
+++ trunk/src/fr-command-unstuff.c Fri Jun 6 11:22:48 2008
@@ -301,7 +301,6 @@
static void
fr_command_unstuff_init (FrCommand *comm)
{
- comm->propCanModify = FALSE;
comm->propAddCanUpdate = FALSE;
comm->propAddCanReplace = FALSE;
comm->propExtractCanAvoidOverwrite = FALSE;
Modified: trunk/src/fr-command.c
==============================================================================
--- trunk/src/fr-command.c (original)
+++ trunk/src/fr-command.c Fri Jun 6 11:22:48 2008
@@ -402,7 +402,6 @@
comm->e_filename = NULL;
comm->fake_load = FALSE;
- comm->propCanModify = TRUE;
comm->propAddCanUpdate = FALSE;
comm->propAddCanReplace = FALSE;
comm->propAddCanStoreFolders = FALSE;
Modified: trunk/src/fr-command.h
==============================================================================
--- trunk/src/fr-command.h (original)
+++ trunk/src/fr-command.h Fri Jun 6 11:22:48 2008
@@ -71,7 +71,6 @@
/* properties the command supports. */
- guint propCanModify : 1;
guint propAddCanUpdate : 1;
guint propAddCanReplace : 1;
guint propAddCanStoreFolders : 1;
Modified: trunk/src/fr-process.c
==============================================================================
--- trunk/src/fr-process.c (original)
+++ trunk/src/fr-process.c Fri Jun 6 11:22:48 2008
@@ -291,6 +291,7 @@
FrCommandInfo *c_info;
g_return_if_fail (fr_proc != NULL);
+ g_return_if_fail (fr_proc->current_comm >= 0);
c_info = g_ptr_array_index (fr_proc->comm, fr_proc->current_comm);
if (c_info->dir != NULL)
@@ -306,6 +307,7 @@
FrCommandInfo *c_info;
g_return_if_fail (fr_proc != NULL);
+ g_return_if_fail (fr_proc->current_comm >= 0);
c_info = g_ptr_array_index (fr_proc->comm, fr_proc->current_comm);
c_info->sticky = sticky;
@@ -319,6 +321,7 @@
FrCommandInfo *c_info;
g_return_if_fail (fr_proc != NULL);
+ g_return_if_fail (fr_proc->current_comm >= 0);
c_info = g_ptr_array_index (fr_proc->comm, fr_proc->current_comm);
c_info->ignore_error = ignore_error;
@@ -332,6 +335,7 @@
FrCommandInfo *c_info;
g_return_if_fail (fr_proc != NULL);
+ g_return_if_fail (fr_proc->current_comm >= 0);
c_info = g_ptr_array_index (fr_proc->comm, fr_proc->current_comm);
c_info->args = g_list_prepend (c_info->args, g_strdup (arg));
Modified: trunk/src/fr-stock.c
==============================================================================
--- trunk/src/fr-stock.c (original)
+++ trunk/src/fr-stock.c Fri Jun 6 11:22:48 2008
@@ -35,16 +35,14 @@
{ FR_STOCK_CREATE_ARCHIVE, "add-files-to-archive" },
{ FR_STOCK_ADD_FILES, "add-files-to-archive" },
{ FR_STOCK_ADD_FOLDER, "add-folder-to-archive" },
- { FR_STOCK_EXTRACT, "extract-archive" },
- { FR_STOCK_VIEW, "preview-file" }
+ { FR_STOCK_EXTRACT, "extract-archive" }
};
static const GtkStockItem stock_items [] = {
{ FR_STOCK_CREATE_ARCHIVE, N_("C_reate"), 0, 0, GETTEXT_PACKAGE },
{ FR_STOCK_ADD_FILES, N_("_Add"), 0, 0, GETTEXT_PACKAGE },
{ FR_STOCK_ADD_FOLDER, N_("_Add"), 0, 0, GETTEXT_PACKAGE },
- { FR_STOCK_EXTRACT, N_("_Extract"), 0, 0, GETTEXT_PACKAGE },
- { FR_STOCK_VIEW, N_("_View File"), 0, 0, GETTEXT_PACKAGE },
+ { FR_STOCK_EXTRACT, N_("_Extract"), 0, 0, GETTEXT_PACKAGE }
};
void
Modified: trunk/src/fr-stock.h
==============================================================================
--- trunk/src/fr-stock.h (original)
+++ trunk/src/fr-stock.h Fri Jun 6 11:22:48 2008
@@ -27,7 +27,6 @@
#define FR_STOCK_ADD_FILES "add-files-to-archive"
#define FR_STOCK_ADD_FOLDER "add-folder-to-archive"
#define FR_STOCK_EXTRACT "extract-archive"
-#define FR_STOCK_VIEW "preview-file"
void fr_stock_init (void);
Modified: trunk/src/fr-window.c
==============================================================================
--- trunk/src/fr-window.c (original)
+++ trunk/src/fr-window.c Fri Jun 6 11:22:48 2008
@@ -287,6 +287,7 @@
* in the Extract dialog. */
gboolean freeze_default_dir;
gboolean asked_for_password;
+ gboolean ask_to_open_destination_after_extraction;
FRBatchAction current_batch_action;
@@ -1992,7 +1993,6 @@
GtkClipboard *clipboard;
gboolean running;
gboolean no_archive;
- gboolean can_modify;
gboolean ro;
gboolean compr_file;
@@ -2002,11 +2002,10 @@
running = window->priv->activity_ref > 0;
no_archive = (window->archive == NULL) || ! window->priv->archive_present;
ro = ! no_archive && window->archive->read_only;
- can_modify = (window->archive != NULL) && (window->archive->command != NULL) && window->archive->command->propCanModify;
compr_file = ! no_archive && window->archive->is_compressed_file;
clipboard = gtk_clipboard_get (FR_CLIPBOARD);
- set_sensitive (window, "Paste", ! no_archive && ! ro && ! running && ! compr_file && can_modify && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT) && gtk_clipboard_wait_is_target_available (clipboard, FR_SPECIAL_URI_LIST));
+ set_sensitive (window, "Paste", ! no_archive && ! ro && ! running && ! compr_file && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT) && gtk_clipboard_wait_is_target_available (clipboard, FR_SPECIAL_URI_LIST));
return TRUE;
}
@@ -2017,7 +2016,6 @@
{
gboolean no_archive;
gboolean ro;
- gboolean can_modify;
gboolean file_op;
gboolean running;
gboolean compr_file;
@@ -2032,7 +2030,6 @@
running = window->priv->activity_ref > 0;
no_archive = (window->archive == NULL) || ! window->priv->archive_present;
ro = ! no_archive && window->archive->read_only;
- can_modify = (window->archive != NULL) && (window->archive->command != NULL) && window->archive->command->propCanModify;
file_op = ! no_archive && ! window->priv->archive_new && ! running;
compr_file = ! no_archive && window->archive->is_compressed_file;
n_selected = fr_window_get_n_selected_files (window);
@@ -2040,13 +2037,13 @@
one_file_selected = n_selected == 1;
dir_selected = selection_has_a_dir (window);
- set_sensitive (window, "AddFiles", ! no_archive && ! ro && ! running && ! compr_file && can_modify);
- set_sensitive (window, "AddFiles_Toolbar", ! no_archive && ! ro && ! running && ! compr_file && can_modify);
- set_sensitive (window, "AddFolder", ! no_archive && ! ro && ! running && ! compr_file && can_modify);
- set_sensitive (window, "AddFolder_Toolbar", ! no_archive && ! ro && ! running && ! compr_file && can_modify);
- set_sensitive (window, "Copy", ! no_archive && ! ro && ! running && ! compr_file && can_modify && sel_not_null && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT));
- set_sensitive (window, "Cut", ! no_archive && ! ro && ! running && ! compr_file && can_modify && sel_not_null && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT));
- set_sensitive (window, "Delete", ! no_archive && ! ro && ! window->priv->archive_new && ! running && ! compr_file && can_modify);
+ set_sensitive (window, "AddFiles", ! no_archive && ! ro && ! running && ! compr_file);
+ set_sensitive (window, "AddFiles_Toolbar", ! no_archive && ! ro && ! running && ! compr_file);
+ set_sensitive (window, "AddFolder", ! no_archive && ! ro && ! running && ! compr_file);
+ set_sensitive (window, "AddFolder_Toolbar", ! no_archive && ! ro && ! running && ! compr_file);
+ set_sensitive (window, "Copy", ! no_archive && ! ro && ! running && ! compr_file && sel_not_null && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT));
+ set_sensitive (window, "Cut", ! no_archive && ! ro && ! running && ! compr_file && sel_not_null && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT));
+ set_sensitive (window, "Delete", ! no_archive && ! ro && ! window->priv->archive_new && ! running && ! compr_file);
set_sensitive (window, "DeselectAll", ! no_archive && sel_not_null);
set_sensitive (window, "Extract", file_op);
set_sensitive (window, "Extract_Toolbar", file_op);
@@ -2063,7 +2060,7 @@
set_sensitive (window, "Properties", file_op);
set_sensitive (window, "Close", !running || window->priv->stoppable);
set_sensitive (window, "Reload", ! (no_archive || running));
- set_sensitive (window, "Rename", ! no_archive && ! ro && ! running && ! compr_file && can_modify && one_file_selected);
+ set_sensitive (window, "Rename", ! no_archive && ! ro && ! running && ! compr_file && one_file_selected);
set_sensitive (window, "SaveAs", ! no_archive && ! compr_file && ! running);
set_sensitive (window, "SelectAll", ! no_archive);
set_sensitive (window, "Stop", running && window->priv->stoppable);
@@ -2595,6 +2592,8 @@
static void
open_progress_dialog_with_open_destination (FrWindow *window)
{
+ window->priv->ask_to_open_destination_after_extraction = FALSE;
+
if (window->priv->hide_progress_timeout != 0) {
g_source_remove (window->priv->hide_progress_timeout);
window->priv->hide_progress_timeout = 0;
@@ -2687,7 +2686,7 @@
switch (action) {
case FR_ACTION_EXTRACTING_FILES:
- open_progress_dialog (window, TRUE);
+ open_progress_dialog (window, window->priv->ask_to_open_destination_after_extraction);
break;
default:
open_progress_dialog (window, FALSE);
@@ -3112,8 +3111,12 @@
window->priv->compression);
g_free (source_dir);
}
- else
- open_progress_dialog_with_open_destination (window);
+ else {
+ if (window->priv->ask_to_open_destination_after_extraction)
+ open_progress_dialog_with_open_destination (window);
+ else
+ close_progress_dialog (window, FALSE);
+ }
/*
else if (window->priv->view_folder_after_extraction) {
if (window->priv->batch_mode) {
@@ -3908,9 +3911,7 @@
if (window->priv->archive_present
&& (window->archive != NULL)
&& ! window->archive->read_only
- && ! window->archive->is_compressed_file
- && ((window->archive->command != NULL)
- && window->archive->command->propCanModify))
+ && ! window->archive->is_compressed_file)
{
if (one_file && is_an_archive) {
GtkWidget *d;
@@ -6127,7 +6128,6 @@
if (window->priv->activity_ref > 0)
return;
-
if (window->priv->archive_new)
return;
@@ -6365,19 +6365,22 @@
junk_paths,
password,
TRUE);
-
fr_window_set_current_batch_action (window,
FR_BATCH_ACTION_EXTRACT,
edata,
(GFreeFunc) extract_data_free);
-
+
+ window->priv->ask_to_open_destination_after_extraction = TRUE;
+
fr_process_clear (window->archive->process);
if (fr_archive_extract_here (window->archive,
edata->skip_older,
edata->overwrite,
edata->junk_paths,
edata->password))
+ {
fr_process_start (window->archive->process);
+ }
}
@@ -6473,8 +6476,9 @@
return;
}
- fr_process_clear (window->archive->process);
+ window->priv->ask_to_open_destination_after_extraction = TRUE;
+ fr_process_clear (window->archive->process);
fr_archive_extract (window->archive,
edata->file_list,
edata->extract_to_dir,
@@ -6482,8 +6486,7 @@
edata->skip_older,
edata->overwrite,
edata->junk_paths,
- edata->password);
-
+ edata->password);
fr_process_start (window->archive->process);
}
@@ -7787,6 +7790,9 @@
if (window->priv->activity_ref > 0)
return FALSE;
+ if (window->archive->read_only)
+ return FALSE;
+
fr_process_clear (window->archive->process);
for (scan = file_list; scan; scan = scan->next) {
@@ -7901,7 +7907,8 @@
if (first_file == NULL)
return FALSE;
- monitor_extracted_files (odata);
+ if (! odata->window->archive->read_only)
+ monitor_extracted_files (odata);
if (odata->ask_application) {
dlg_open_with (odata->window, file_list);
Modified: trunk/src/ui.h
==============================================================================
--- trunk/src/ui.h (original)
+++ trunk/src/ui.h Fri Jun 6 11:22:48 2008
@@ -177,13 +177,13 @@
N_("_Test Integrity"), NULL,
N_("Test whether the archive contains errors"),
G_CALLBACK (activate_action_test_archive) },
- { "ViewSelection", FR_STOCK_VIEW,
+ { "ViewSelection", GTK_STOCK_OPEN,
NULL, NULL,
- N_("View the selected file"),
+ N_("Open the selected file"),
G_CALLBACK (activate_action_view_or_open) },
- { "ViewSelection_Toolbar", FR_STOCK_VIEW,
+ { "ViewSelection_Toolbar", GTK_STOCK_OPEN,
NULL, NULL,
- N_("View the selected file"),
+ N_("Open the selected file"),
G_CALLBACK (activate_action_view_or_open) },
{ "OpenFolder", GTK_STOCK_OPEN,
NULL, NULL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]