diff -r 130b4aac91be src/actions.c
--- a/src/actions.c Sat Oct 23 00:54:01 2010 +0800
+++ b/src/actions.c Sat Oct 23 00:54:46 2010 +0800
@@ -240,6 +240,21 @@
return NULL;
}
+ if(!strcmp(data->window->priv->archive_uri, uri))
+ {
+ dialog = _gtk_error_dialog_new (GTK_WINDOW (data->dialog),
+ GTK_DIALOG_MODAL,
+ NULL,
+ _("Could not save the archive"),
+ "%s",
+ _("Could not save as the Archive in the same place."));
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ g_free (uri);
+
+ return NULL;
+ }
+
g_file_delete (file, NULL, &err);
if (err != NULL) {
GtkWidget *dialog;
diff -r 130b4aac91be src/fr-window.c
--- a/src/fr-window.c Sat Oct 23 00:54:01 2010 +0800
+++ b/src/fr-window.c Sat Oct 23 00:54:46 2010 +0800
@@ -111,74 +111,6 @@
};
-typedef struct {
- FrBatchActionType type;
- void * data;
- GFreeFunc free_func;
-} FRBatchAction;
-
-
-typedef struct {
- guint converting : 1;
- char *temp_dir;
- FrArchive *new_archive;
- char *password;
- gboolean encrypt_header;
- guint volume_size;
- char *new_file;
-} FRConvertData;
-
-
-typedef enum {
- FR_CLIPBOARD_OP_CUT,
- FR_CLIPBOARD_OP_COPY
-} FRClipboardOp;
-
-
-typedef struct {
- GList *file_list;
- char *extract_to_dir;
- char *base_dir;
- gboolean skip_older;
- gboolean overwrite;
- gboolean junk_paths;
- char *password;
- gboolean extract_here;
-} ExtractData;
-
-
-typedef enum {
- FR_WINDOW_AREA_MENUBAR,
- FR_WINDOW_AREA_TOOLBAR,
- FR_WINDOW_AREA_LOCATIONBAR,
- FR_WINDOW_AREA_CONTENTS,
- FR_WINDOW_AREA_FILTERBAR,
- FR_WINDOW_AREA_STATUSBAR,
-} FrWindowArea;
-
-
-typedef enum {
- DIALOG_RESPONSE_NONE = 1,
- DIALOG_RESPONSE_OPEN_ARCHIVE,
- DIALOG_RESPONSE_OPEN_DESTINATION_FOLDER,
- DIALOG_RESPONSE_QUIT
-} DialogResponse;
-
-
-/* -- FrClipboardData -- */
-
-
-typedef struct {
- int refs;
- char *archive_filename;
- char *archive_password;
- FRClipboardOp op;
- char *base_dir;
- GList *files;
- char *tmp_dir;
- char *current_dir;
-} FrClipboardData;
-
static FrClipboardData*
fr_clipboard_data_new (void)
@@ -240,170 +172,6 @@
static GtkWindowClass *parent_class = NULL;
static guint fr_window_signals[LAST_SIGNAL] = { 0 };
-struct _FrWindowPrivateData {
- GtkWidget *layout;
- GtkWidget *contents;
- GtkWidget *list_view;
- GtkListStore *list_store;
- GtkWidget *tree_view;
- GtkTreeStore *tree_store;
- GtkWidget *toolbar;
- GtkWidget *statusbar;
- GtkWidget *progress_bar;
- GtkWidget *location_bar;
- GtkWidget *location_entry;
- GtkWidget *location_label;
- GtkWidget *filter_bar;
- GtkWidget *filter_entry;
- GtkWidget *paned;
- GtkWidget *sidepane;
- GtkTreePath *tree_hover_path;
- GtkTreePath *list_hover_path;
- GtkTreeViewColumn *filename_column;
-
- gboolean filter_mode;
- gint current_view_length;
-
- guint help_message_cid;
- guint list_info_cid;
- guint progress_cid;
- char * last_status_message;
-
- GtkWidget * up_arrows[5];
- GtkWidget * down_arrows[5];
-
- FrAction action;
- gboolean archive_present;
- gboolean archive_new; /* A new archive has been created
- * but it doesn't contain any
- * file yet. The real file will
- * be created only when the user
- * adds some file to the
- * archive.*/
-
- char * archive_uri;
- char * open_default_dir; /* default directory to be used
- * in the Open dialog. */
- char * add_default_dir; /* default directory to be used
- * in the Add dialog. */
- char * extract_default_dir; /* default directory to be used
- * in the Extract dialog. */
- gboolean freeze_default_dir;
- gboolean asked_for_password;
- gboolean ask_to_open_destination_after_extraction;
- gboolean destroy_with_error_dialog;
-
- FRBatchAction current_batch_action;
-
- gboolean give_focus_to_the_list;
- gboolean single_click;
- GtkTreePath *path_clicked;
-
- FrWindowSortMethod sort_method;
- GtkSortType sort_type;
-
- char * last_location;
-
- gboolean view_folders;
- FrWindowListMode list_mode;
- FrWindowListMode last_list_mode;
- GList * history;
- GList * history_current;
- char * password;
- char * password_for_paste;
- gboolean encrypt_header;
- FrCompression compression;
- guint volume_size;
-
- guint activity_timeout_handle; /* activity timeout
- * handle. */
- gint activity_ref; /* when > 0 some activity
- * is present. */
-
- guint update_timeout_handle; /* update file list
- * timeout handle. */
-
- FRConvertData convert_data;
-
- gboolean stoppable;
- gboolean closing;
-
- FrClipboardData *clipboard_data;
- FrClipboardData *copy_data;
-
- FrArchive *copy_from_archive;
-
- GtkActionGroup *actions;
-
- GtkRecentManager *recent_manager;
- GtkWidget *recent_chooser_menu;
- GtkWidget *recent_chooser_toolbar;
-
- GtkWidget *file_popup_menu;
- GtkWidget *folder_popup_menu;
- GtkWidget *sidebar_folder_popup_menu;
- GtkWidget *mitem_recents_menu;
- GtkWidget *recent_toolbar_menu;
- GtkAction *open_action;
-
- /* dragged files data */
-
- char *drag_destination_folder;
- char *drag_base_dir;
- GError *drag_error;
- GList *drag_file_list; /* the list of files we are
- * dragging*/
-
- /* progress dialog data */
-
- GtkWidget *progress_dialog;
- GtkWidget *pd_action;
- GtkWidget *pd_archive;
- GtkWidget *pd_message;
- GtkWidget *pd_progress_bar;
- GtkWidget *pd_cancel_button;
- GtkWidget *pd_close_button;
- GtkWidget *pd_open_archive_button;
- GtkWidget *pd_open_destination_button;
- GtkWidget *pd_quit_button;
- gboolean progress_pulse;
- guint progress_timeout; /* Timeout to display the progress dialog. */
- guint hide_progress_timeout; /* Timeout to hide the progress dialog. */
- FrAction pd_last_action;
- char *pd_last_archive;
- char *working_archive;
-
- /* update dialog data */
-
- gpointer update_dialog;
- GList *open_files;
-
- /* batch mode data */
-
- gboolean batch_mode; /* whether we are in a non interactive
- * mode. */
- GList *batch_action_list; /* FRBatchAction * elements */
- GList *batch_action; /* current action. */
-
- /* misc */
-
- guint cnxn_id[GCONF_NOTIFICATIONS];
-
- gulong theme_changed_handler_id;
- gboolean non_interactive;
- char *extract_here_dir;
- gboolean extract_interact_use_default_dir;
- gboolean update_dropped_files;
- gboolean batch_adding_one_file;
-
- GtkWindow *load_error_parent_window;
- gboolean showing_error_dialog;
- GtkWindow *error_dialog_parent;
-};
-
-
-/* -- fr_window_free_private_data -- */
-
static void
fr_window_remove_notifications (FrWindow *window)
diff -r 130b4aac91be src/fr-window.h
--- a/src/fr-window.h Sat Oct 23 00:54:01 2010 +0800
+++ b/src/fr-window.h Sat Oct 23 00:54:46 2010 +0800
@@ -30,6 +30,261 @@
#define GCONF_NOTIFICATIONS 10
+//from fr-window.c
+typedef enum {
+ FR_BATCH_ACTION_NONE,
+ FR_BATCH_ACTION_LOAD,
+ FR_BATCH_ACTION_OPEN,
+ FR_BATCH_ACTION_ADD,
+ FR_BATCH_ACTION_EXTRACT,
+ FR_BATCH_ACTION_EXTRACT_HERE,
+ FR_BATCH_ACTION_EXTRACT_INTERACT,
+ FR_BATCH_ACTION_RENAME,
+ FR_BATCH_ACTION_PASTE,
+ FR_BATCH_ACTION_OPEN_FILES,
+ FR_BATCH_ACTION_SAVE_AS,
+ FR_BATCH_ACTION_TEST,
+ FR_BATCH_ACTION_CLOSE,
+ FR_BATCH_ACTION_QUIT,
+ FR_BATCH_ACTIONS
+} FrBatchActionType;
+
+typedef struct {
+ FrBatchActionType type;
+ void * data;
+ GFreeFunc free_func;
+} FRBatchAction;
+
+
+typedef struct {
+ guint converting : 1;
+ char *temp_dir;
+ FrArchive *new_archive;
+ char *password;
+ gboolean encrypt_header;
+ guint volume_size;
+ char *new_file;
+} FRConvertData;
+
+
+typedef enum {
+ FR_CLIPBOARD_OP_CUT,
+ FR_CLIPBOARD_OP_COPY
+} FRClipboardOp;
+
+
+typedef struct {
+ GList *file_list;
+ char *extract_to_dir;
+ char *base_dir;
+ gboolean skip_older;
+ gboolean overwrite;
+ gboolean junk_paths;
+ char *password;
+ gboolean extract_here;
+} ExtractData;
+
+
+typedef enum {
+ FR_WINDOW_AREA_MENUBAR,
+ FR_WINDOW_AREA_TOOLBAR,
+ FR_WINDOW_AREA_LOCATIONBAR,
+ FR_WINDOW_AREA_CONTENTS,
+ FR_WINDOW_AREA_FILTERBAR,
+ FR_WINDOW_AREA_STATUSBAR,
+} FrWindowArea;
+
+
+typedef enum {
+ DIALOG_RESPONSE_NONE = 1,
+ DIALOG_RESPONSE_OPEN_ARCHIVE,
+ DIALOG_RESPONSE_OPEN_DESTINATION_FOLDER,
+ DIALOG_RESPONSE_QUIT
+} DialogResponse;
+
+
+/* -- FrClipboardData -- */
+
+
+typedef struct {
+ int refs;
+ char *archive_filename;
+ char *archive_password;
+ FRClipboardOp op;
+ char *base_dir;
+ GList *files;
+ char *tmp_dir;
+ char *current_dir;
+} FrClipboardData;
+
+
+struct _FrWindowPrivateData {
+ GtkWidget *layout;
+ GtkWidget *contents;
+ GtkWidget *list_view;
+ GtkListStore *list_store;
+ GtkWidget *tree_view;
+ GtkTreeStore *tree_store;
+ GtkWidget *toolbar;
+ GtkWidget *statusbar;
+ GtkWidget *progress_bar;
+ GtkWidget *location_bar;
+ GtkWidget *location_entry;
+ GtkWidget *location_label;
+ GtkWidget *filter_bar;
+ GtkWidget *filter_entry;
+ GtkWidget *paned;
+ GtkWidget *sidepane;
+ GtkTreePath *tree_hover_path;
+ GtkTreePath *list_hover_path;
+ GtkTreeViewColumn *filename_column;
+
+ gboolean filter_mode;
+ gint current_view_length;
+
+ guint help_message_cid;
+ guint list_info_cid;
+ guint progress_cid;
+ char * last_status_message;
+
+ GtkWidget * up_arrows[5];
+ GtkWidget * down_arrows[5];
+
+ FrAction action;
+ gboolean archive_present;
+ gboolean archive_new; /* A new archive has been created
+ * but it doesn't contain any
+ * file yet. The real file will
+ * be created only when the user
+ * adds some file to the
+ * archive.*/
+
+ char * archive_uri;
+ char * open_default_dir; /* default directory to be used
+ * in the Open dialog. */
+ char * add_default_dir; /* default directory to be used
+ * in the Add dialog. */
+ char * extract_default_dir; /* default directory to be used
+ * in the Extract dialog. */
+ gboolean freeze_default_dir;
+ gboolean asked_for_password;
+ gboolean ask_to_open_destination_after_extraction;
+ gboolean destroy_with_error_dialog;
+
+ FRBatchAction current_batch_action;
+
+ gboolean give_focus_to_the_list;
+ gboolean single_click;
+ GtkTreePath *path_clicked;
+
+ FrWindowSortMethod sort_method;
+ GtkSortType sort_type;
+
+ char * last_location;
+
+ gboolean view_folders;
+ FrWindowListMode list_mode;
+ FrWindowListMode last_list_mode;
+ GList * history;
+ GList * history_current;
+ char * password;
+ char * password_for_paste;
+ gboolean encrypt_header;
+ FrCompression compression;
+ guint volume_size;
+
+ guint activity_timeout_handle; /* activity timeout
+ * handle. */
+ gint activity_ref; /* when > 0 some activity
+ * is present. */
+
+ guint update_timeout_handle; /* update file list
+ * timeout handle. */
+
+ FRConvertData convert_data;
+
+ gboolean stoppable;
+ gboolean closing;
+
+ FrClipboardData *clipboard_data;
+ FrClipboardData *copy_data;
+
+ FrArchive *copy_from_archive;
+
+ GtkActionGroup *actions;
+
+ GtkRecentManager *recent_manager;
+ GtkWidget *recent_chooser_menu;
+ GtkWidget *recent_chooser_toolbar;
+
+ GtkWidget *file_popup_menu;
+ GtkWidget *folder_popup_menu;
+ GtkWidget *sidebar_folder_popup_menu;
+ GtkWidget *mitem_recents_menu;
+ GtkWidget *recent_toolbar_menu;
+ GtkAction *open_action;
+
+ /* dragged files data */
+
+ char *drag_destination_folder;
+ char *drag_base_dir;
+ GError *drag_error;
+ GList *drag_file_list; /* the list of files we are
+ * dragging*/
+
+ /* progress dialog data */
+
+ GtkWidget *progress_dialog;
+ GtkWidget *pd_action;
+ GtkWidget *pd_archive;
+ GtkWidget *pd_message;
+ GtkWidget *pd_progress_bar;
+ GtkWidget *pd_cancel_button;
+ GtkWidget *pd_close_button;
+ GtkWidget *pd_open_archive_button;
+ GtkWidget *pd_open_destination_button;
+ GtkWidget *pd_quit_button;
+ gboolean progress_pulse;
+ guint progress_timeout; /* Timeout to display the progress dialog. */
+ guint hide_progress_timeout; /* Timeout to hide the progress dialog. */
+ FrAction pd_last_action;
+ char *pd_last_archive;
+ char *working_archive;
+
+ /* update dialog data */
+
+ gpointer update_dialog;
+ GList *open_files;
+
+ /* batch mode data */
+
+ gboolean batch_mode; /* whether we are in a non interactive
+ * mode. */
+ GList *batch_action_list; /* FRBatchAction * elements */
+ GList *batch_action; /* current action. */
+
+ /* misc */
+
+ guint cnxn_id[GCONF_NOTIFICATIONS];
+
+ gulong theme_changed_handler_id;
+ gboolean non_interactive;
+ char *extract_here_dir;
+ gboolean extract_interact_use_default_dir;
+ gboolean update_dropped_files;
+ gboolean batch_adding_one_file;
+
+ GtkWindow *load_error_parent_window;
+ gboolean showing_error_dialog;
+ GtkWindow *error_dialog_parent;
+};
+
+
+/* -- fr_window_free_private_data -- */
+
+
+
+//end from fr-window.c
enum {
COLUMN_FILE_DATA,
COLUMN_ICON,
@@ -50,23 +305,7 @@
TREE_NUMBER_OF_COLUMNS
};
-typedef enum {
- FR_BATCH_ACTION_NONE,
- FR_BATCH_ACTION_LOAD,
- FR_BATCH_ACTION_OPEN,
- FR_BATCH_ACTION_ADD,
- FR_BATCH_ACTION_EXTRACT,
- FR_BATCH_ACTION_EXTRACT_HERE,
- FR_BATCH_ACTION_EXTRACT_INTERACT,
- FR_BATCH_ACTION_RENAME,
- FR_BATCH_ACTION_PASTE,
- FR_BATCH_ACTION_OPEN_FILES,
- FR_BATCH_ACTION_SAVE_AS,
- FR_BATCH_ACTION_TEST,
- FR_BATCH_ACTION_CLOSE,
- FR_BATCH_ACTION_QUIT,
- FR_BATCH_ACTIONS
-} FrBatchActionType;
+
/* -- FrWindow -- */