diff options
Diffstat (limited to 'src')
37 files changed, 2268 insertions, 1225 deletions
diff --git a/src/actions.c b/src/actions.c index 98028e4..a02e969 100644 --- a/src/actions.c +++ b/src/actions.c @@ -46,6 +46,35 @@ /* -- new archive -- */ +static struct +{ + const char *id; + void (* activate) (GtkMenuItem *menuitem, + gpointer user_data); +} engramp_menu_popup [] = { + {"popup_open_item", activate_popup_open}, + {"popup_open_select_item", activate_popup_open_select}, + {"popup_extract_item", activate_popup_extract}, + {"popup_cut_item", activate_popup_cut}, + {"popup_paste_item", activate_popup_paste}, + {"popup_rename_item", activate_popup_rename}, + {"popup_delete_item", activate_popup_delete}, + {"popup_open_item1", activate_popup_open_folder}, + {"popup_extract_item1", activate_popup_extract}, + {"popup_cut_item1", activate_popup_cut}, + {"popup_copy_item1", activate_popup_copy}, + {"popup_paste_item1", activate_popup_paste}, + {"popup_rename_item1", activate_popup_rename}, + {"popup_delete_item1", activate_popup_delete}, + {"popup_open_item2", activate_popup_open_folder_from_sidebar}, + {"popup_extract_item2", activate_popup_extract_folder_from_sidebar}, + {"popup_cut_item2", activate_popup_cut_folder_from_sidebar}, + {"popup_copy_item2", activate_popup_copy_folder_from_sidebar}, + {"popup_paste_item2", activate_popup_paste_folder_from_sidebar}, + {"popup_rename_item2", activate_popup_rename_folder_from_sidebar}, + {"popup_delete_item2", activate_popup_delete_folder_from_sidebar}, +}; + static void new_archive (DlgNewData *data, char *uri) @@ -198,6 +227,22 @@ get_archive_filename_from_selector (DlgNewData *data) } g_object_unref (info); g_object_unref (dir); + if ((data->original_file != NULL) && (g_file_equal (file, data->original_file))) { + GtkWidget *dialog; + dialog = _gtk_error_dialog_new (GTK_WINDOW (data->dialog), + GTK_DIALOG_MODAL, + NULL, + _("Could not create the archive"), + "%s", + _("New name is the same as old one, please type other name.")); + gtk_dialog_run (GTK_DIALOG (dialog)); + + gtk_widget_destroy (GTK_WIDGET (dialog)); + g_object_unref (info); + g_object_unref (file); + + return NULL; + } /* if the user did not specify a valid extension use the filetype combobox current type * or tar.gz if automatic is selected. */ @@ -287,6 +332,26 @@ new_file_response_cb (GtkWidget *w, } void +init_engramp_menu_popup (FrWindow *window, + GtkBuilder *ui) +{ + int i; + + int n_entries = G_N_ELEMENTS (engramp_menu_popup); + + for (i = 0 ; i < n_entries; i++) + { + GtkWidget *widget = (GtkWidget *)gtk_builder_get_object (ui, engramp_menu_popup[i].id); + + if (engramp_menu_popup[i].activate != NULL) + g_signal_connect (widget, + "activate", + G_CALLBACK (engramp_menu_popup[i].activate), + window); + } +} + +void show_new_archive_dialog (FrWindow *window, const char *archive_name) { @@ -305,8 +370,9 @@ show_new_archive_dialog (FrWindow *window, } void -activate_action_new (GtkAction *action, - gpointer data) +activate_action_new (GSimpleAction *action, + GVariant *parameter, + gpointer data) { show_new_archive_dialog ((FrWindow*)data, NULL); } @@ -360,8 +426,9 @@ open_file_response_cb (GtkWidget *w, } void -activate_action_open (GtkAction *action, - gpointer data) +activate_action_open (GSimpleAction *action, + GVariant *parameter, + gpointer data) { GtkWidget *file_sel; FrWindow *window = data; @@ -445,16 +512,17 @@ save_file_response_cb (GtkWidget *w, } void -activate_action_save_as (GtkAction *action, - gpointer callback_data) +activate_action_save_as (GSimpleAction *action, + GVariant *parameter, + gpointer callback_data) { FrWindow *window = callback_data; DlgNewData *data; + GFile *file = NULL; char *archive_name = NULL; if (fr_window_get_archive_uri (window)) { const char *uri; - GFile *file; GFileInfo *info; GError *err = NULL; @@ -472,10 +540,10 @@ activate_action_save_as (GtkAction *action, archive_name = g_strdup (g_file_info_get_display_name (info)); g_object_unref (info); - g_object_unref (file); } data = dlg_save_as (window, archive_name); + data->original_file = file; g_signal_connect (G_OBJECT (data->dialog), "response", G_CALLBACK (save_file_response_cb), @@ -486,8 +554,9 @@ activate_action_save_as (GtkAction *action, } void -activate_action_test_archive (GtkAction *action, - gpointer data) +activate_action_test_archive (GSimpleAction *action, + GVariant *parameter, + gpointer data) { FrWindow *window = data; @@ -495,8 +564,9 @@ activate_action_test_archive (GtkAction *action, } void -activate_action_properties (GtkAction *action, - gpointer data) +activate_action_properties (GSimpleAction *action, + GVariant *parameter, + gpointer data) { FrWindow *window = data; @@ -504,8 +574,9 @@ activate_action_properties (GtkAction *action, } void -activate_action_close (GtkAction *action, - gpointer data) +activate_action_close (GSimpleAction *action, + GVariant *parameter, + gpointer data) { FrWindow *window = data; @@ -513,106 +584,73 @@ activate_action_close (GtkAction *action, } void -activate_action_add_files (GtkAction *action, - gpointer data) +activate_action_add_files (GSimpleAction *action, + GVariant *parameter, + gpointer data) { add_files_cb (NULL, data); } void -activate_action_add_folder (GtkAction *action, - gpointer data) +activate_action_add_folder (GSimpleAction *action, + GVariant *parameter, + gpointer data) { add_folder_cb (NULL, data); } void -activate_action_extract (GtkAction *action, - gpointer data) +activate_action_extract (GSimpleAction *action, + GVariant *parameter, + gpointer data) { dlg_extract (NULL, data); } void -activate_action_extract_folder_from_sidebar (GtkAction *action, - gpointer data) -{ - dlg_extract_folder_from_sidebar (NULL, data); -} - -void -activate_action_copy (GtkAction *action, - gpointer data) +activate_action_copy (GSimpleAction *action, + GVariant *parameter, + gpointer data) { fr_window_copy_selection ((FrWindow*) data, FALSE); } void -activate_action_cut (GtkAction *action, - gpointer data) +activate_action_cut (GSimpleAction *action, + GVariant *parameter, + gpointer data) { fr_window_cut_selection ((FrWindow*) data, FALSE); } void -activate_action_paste (GtkAction *action, - gpointer data) +activate_action_paste (GSimpleAction *action, + GVariant *parameter, + gpointer data) { fr_window_paste_selection ((FrWindow*) data, FALSE); } void -activate_action_rename (GtkAction *action, - gpointer data) +activate_action_rename (GSimpleAction *action, + GVariant *parameter, + gpointer data) { fr_window_rename_selection ((FrWindow*) data, FALSE); } void -activate_action_delete (GtkAction *action, - gpointer data) +activate_action_delete (GSimpleAction *action, + GVariant *parameter, + gpointer data) { dlg_delete (NULL, data); } void -activate_action_copy_folder_from_sidebar (GtkAction *action, - gpointer data) -{ - fr_window_copy_selection ((FrWindow*) data, TRUE); -} - -void -activate_action_cut_folder_from_sidebar (GtkAction *action, - gpointer data) -{ - fr_window_cut_selection ((FrWindow*) data, TRUE); -} - -void -activate_action_paste_folder_from_sidebar (GtkAction *action, - gpointer data) -{ - fr_window_paste_selection ((FrWindow*) data, TRUE); -} - -void -activate_action_rename_folder_from_sidebar (GtkAction *action, - gpointer data) -{ - fr_window_rename_selection ((FrWindow*) data, TRUE); -} - -void -activate_action_delete_folder_from_sidebar (GtkAction *action, - gpointer data) -{ - dlg_delete_from_sidebar (NULL, data); -} - -void -activate_action_find (GtkAction *action, - gpointer data) +activate_action_find (GSimpleAction *action, + GVariant *parameter, + gpointer data) { FrWindow *window = data; @@ -620,8 +658,9 @@ activate_action_find (GtkAction *action, } void -activate_action_select_all (GtkAction *action, - gpointer data) +activate_action_select_all (GSimpleAction *action, + GVariant *parameter, + gpointer data) { FrWindow *window = data; @@ -629,8 +668,9 @@ activate_action_select_all (GtkAction *action, } void -activate_action_deselect_all (GtkAction *action, - gpointer data) +activate_action_deselect_all (GSimpleAction *action, + GVariant *parameter, + gpointer data) { FrWindow *window = data; @@ -638,93 +678,73 @@ activate_action_deselect_all (GtkAction *action, } void -activate_action_open_with (GtkAction *action, - gpointer data) +activate_action_open_with (GSimpleAction *action, + GVariant *parameter, + gpointer data) { open_with_cb (NULL, (FrWindow*) data); } void -activate_action_view_or_open (GtkAction *action, - gpointer data) -{ - FrWindow *window = data; - GList *file_list; - - file_list = fr_window_get_file_list_selection (window, FALSE, NULL); - if (file_list == NULL) - return; - fr_window_open_files (window, file_list, FALSE); - path_list_free (file_list); -} - -void -activate_action_open_folder (GtkAction *action, - gpointer data) -{ - FrWindow *window = data; - fr_window_current_folder_activated (window, FALSE); -} - -void -activate_action_open_folder_from_sidebar (GtkAction *action, - gpointer data) -{ - FrWindow *window = data; - fr_window_current_folder_activated (window, TRUE); -} - -void -activate_action_password (GtkAction *action, - gpointer data) +activate_action_password (GSimpleAction *action, + GVariant *parameter, + gpointer data) { dlg_password (NULL, (FrWindow*) data); } void -activate_action_view_toolbar (GtkAction *action, - gpointer data) +activate_action_view_toolbar (GSimpleAction *action, + GVariant *state, + gpointer data) { GSettings *settings; settings = g_settings_new (ENGRAMPA_SCHEMA_UI); - g_settings_set_boolean (settings, PREF_UI_VIEW_TOOLBAR, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))); + g_settings_set_boolean (settings, PREF_UI_VIEW_TOOLBAR, g_variant_get_boolean (state)); + g_simple_action_set_state (action, state); g_object_unref (settings); } void -activate_action_view_statusbar (GtkAction *action, - gpointer data) +activate_action_view_statusbar (GSimpleAction *action, + GVariant *state, + gpointer data) { GSettings *settings; settings = g_settings_new (ENGRAMPA_SCHEMA_UI); - g_settings_set_boolean (settings, PREF_UI_VIEW_STATUSBAR, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))); + g_settings_set_boolean (settings, PREF_UI_VIEW_STATUSBAR, g_variant_get_boolean (state)); + g_simple_action_set_state (action, state); g_object_unref (settings); } void -activate_action_view_folders (GtkAction *action, - gpointer data) +activate_action_view_folders (GSimpleAction *action, + GVariant *state, + gpointer data) { GSettings *settings; settings = g_settings_new (ENGRAMPA_SCHEMA_UI); - g_settings_set_boolean (settings, PREF_UI_VIEW_FOLDERS, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))); + g_settings_set_boolean (settings, PREF_UI_VIEW_FOLDERS, g_variant_get_boolean (state)); + g_simple_action_set_state (action, state); g_object_unref (settings); } void -activate_action_stop (GtkAction *action, - gpointer data) +activate_action_stop (GSimpleAction *action, + GVariant *parameter, + gpointer data) { FrWindow *window = data; fr_window_stop (window); } void -activate_action_reload (GtkAction *action, - gpointer data) +activate_action_reload (GSimpleAction *action, + GVariant *parameter, + gpointer data) { FrWindow *window = data; @@ -732,57 +752,54 @@ activate_action_reload (GtkAction *action, } void -activate_action_sort_reverse_order (GtkAction *action, - gpointer data) -{ - FrWindow *window = data; - - fr_window_set_sort_type (window, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)) ? GTK_SORT_DESCENDING : GTK_SORT_ASCENDING); -} - -void -activate_action_last_output (GtkAction *action, - gpointer data) +activate_action_last_output (GSimpleAction *action, + GVariant *parameter, + gpointer data) { FrWindow *window = data; fr_window_view_last_output (window, _("Last Output")); } void -activate_action_go_back (GtkAction *action, - gpointer data) +activate_action_go_back (GSimpleAction *action, + GVariant *parameter, + gpointer data) { FrWindow *window = data; fr_window_go_back (window); } void -activate_action_go_forward (GtkAction *action, - gpointer data) +activate_action_go_forward (GSimpleAction *action, + GVariant *parameter, + gpointer data) { FrWindow *window = data; fr_window_go_forward (window); } void -activate_action_go_up (GtkAction *action, - gpointer data) +activate_action_go_up (GSimpleAction *action, + GVariant *parameter, + gpointer data) { FrWindow *window = data; fr_window_go_up_one_level (window); } void -activate_action_go_home (GtkAction *action, - gpointer data) +activate_action_go_home (GSimpleAction *action, + GVariant *parameter, + gpointer data) { FrWindow *window = data; fr_window_go_to_location (window, "/", FALSE); } void -activate_action_manual (GtkAction *action, - gpointer data) +activate_action_manual (GSimpleAction *action, + GVariant *parameter, + gpointer data) { FrWindow *window = data; @@ -793,8 +810,9 @@ activate_action_manual (GtkAction *action, #define EMAILIFY(string) (g_strdelimit ((string), "%", '@')) void -activate_action_about (GtkAction *action, - gpointer gp) +activate_action_about (GSimpleAction *action, + GVariant *parameter, + gpointer gp) { FrWindow *window = gp; const char *documenters [] = { @@ -859,3 +877,136 @@ activate_action_about (GtkAction *action, g_strfreev (authors); g_free (license_text); } + +void +activate_toggle (GSimpleAction *action, + GVariant *parameter, + gpointer user_data) +{ + GVariant *state; + state = g_action_get_state (G_ACTION (action)); + g_action_change_state (G_ACTION (action), g_variant_new_boolean (!g_variant_get_boolean (state))); + g_variant_unref (state); +} + +void +activate_popup_open (GtkMenuItem *menuitem, + gpointer data) +{ + FrWindow *window = data; + GList *file_list; + + file_list = fr_window_get_file_list_selection (window, FALSE, NULL); + if (file_list == NULL) + return; + fr_window_open_files (window, file_list, FALSE); + path_list_free (file_list); + +} + +void +activate_popup_open_select (GtkMenuItem *menuitem, + gpointer data) +{ + open_with_cb (NULL, (FrWindow*) data); +} + +void +activate_popup_extract (GtkMenuItem *menuitem, + gpointer data) +{ + dlg_extract (NULL, data); +} + +void +activate_popup_cut (GtkMenuItem *menuitem, + gpointer data) +{ + fr_window_cut_selection ((FrWindow*) data, FALSE); +} + +void +activate_popup_paste (GtkMenuItem *menuitem, + gpointer data) +{ + fr_window_paste_selection ((FrWindow*) data, FALSE); +} + +void +activate_popup_rename (GtkMenuItem *menuitem, + gpointer data) +{ + fr_window_rename_selection ((FrWindow*) data, FALSE); +} + +void +activate_popup_delete (GtkMenuItem *menuitem, + gpointer data) +{ + dlg_delete (NULL, data); +} + +void +activate_popup_open_folder (GtkMenuItem *menuitem, + gpointer data) +{ + FrWindow *window = data; + fr_window_current_folder_activated (window, FALSE); +} + +void +activate_popup_copy (GtkMenuItem *menuitem, + gpointer data) +{ + fr_window_copy_selection ((FrWindow*) data, FALSE); +} + +void +activate_popup_open_folder_from_sidebar (GtkMenuItem *menuitem, + gpointer data) +{ + FrWindow *window = data; + fr_window_current_folder_activated (window, TRUE); +} + +void +activate_popup_extract_folder_from_sidebar (GtkMenuItem *menuitem, + gpointer data) +{ + dlg_extract_folder_from_sidebar (NULL, data); +} + +void +activate_popup_copy_folder_from_sidebar (GtkMenuItem *menuitem, + gpointer data) +{ + fr_window_copy_selection ((FrWindow*) data, TRUE); +} + +void +activate_popup_cut_folder_from_sidebar (GtkMenuItem *menuitem, + gpointer data) +{ + fr_window_cut_selection ((FrWindow*) data, TRUE); +} + +void +activate_popup_paste_folder_from_sidebar (GtkMenuItem *menuitem, + gpointer data) +{ + fr_window_paste_selection ((FrWindow*) data, TRUE); +} + +void +activate_popup_rename_folder_from_sidebar (GtkMenuItem *menuitem, + gpointer data) +{ + fr_window_rename_selection ((FrWindow*) data, TRUE); +} + +void +activate_popup_delete_folder_from_sidebar (GtkMenuItem *menuitem, + gpointer data) +{ + dlg_delete_from_sidebar (NULL, data); +} diff --git a/src/actions.h b/src/actions.h index f893503..4664e37 100644 --- a/src/actions.h +++ b/src/actions.h @@ -26,56 +26,189 @@ #include <gtk/gtk.h> #include "fr-window.h" -void show_new_archive_dialog (FrWindow *window, const char *archive_name); - -void activate_action_new (GtkAction *action, gpointer data); -void activate_action_open (GtkAction *action, gpointer data); -void activate_action_save_as (GtkAction *action, gpointer data); -void activate_action_test_archive (GtkAction *action, gpointer data); -void activate_action_properties (GtkAction *action, gpointer data); -void activate_action_close (GtkAction *action, gpointer data); -void activate_action_quit (GtkAction *action, gpointer data); - -void activate_action_add_files (GtkAction *action, gpointer data); -void activate_action_add_folder (GtkAction *action, gpointer data); -void activate_action_extract (GtkAction *action, gpointer data); -void activate_action_extract_folder_from_sidebar (GtkAction *action, gpointer data); - -void activate_action_copy (GtkAction *action, gpointer data); -void activate_action_cut (GtkAction *action, gpointer data); -void activate_action_paste (GtkAction *action, gpointer data); -void activate_action_rename (GtkAction *action, gpointer data); -void activate_action_delete (GtkAction *action, gpointer data); - -void activate_action_copy_folder_from_sidebar (GtkAction *action, gpointer data); -void activate_action_cut_folder_from_sidebar (GtkAction *action, gpointer data); -void activate_action_paste_folder_from_sidebar (GtkAction *action, gpointer data); -void activate_action_rename_folder_from_sidebar (GtkAction *action, gpointer data); -void activate_action_delete_folder_from_sidebar (GtkAction *action, gpointer data); - -void activate_action_find (GtkAction *action, gpointer data); -void activate_action_select_all (GtkAction *action, gpointer data); -void activate_action_deselect_all (GtkAction *action, gpointer data); -void activate_action_open_with (GtkAction *action, gpointer data); -void activate_action_view_or_open (GtkAction *action, gpointer data); -void activate_action_open_folder (GtkAction *action, gpointer data); -void activate_action_open_folder_from_sidebar (GtkAction *action, gpointer data); -void activate_action_password (GtkAction *action, gpointer data); - -void activate_action_view_toolbar (GtkAction *action, gpointer data); -void activate_action_view_statusbar (GtkAction *action, gpointer data); -void activate_action_view_folders (GtkAction *action, gpointer data); -void activate_action_stop (GtkAction *action, gpointer data); -void activate_action_reload (GtkAction *action, gpointer data); -void activate_action_sort_reverse_order (GtkAction *action, gpointer data); -void activate_action_last_output (GtkAction *action, gpointer data); - -void activate_action_go_back (GtkAction *action, gpointer data); -void activate_action_go_forward (GtkAction *action, gpointer data); -void activate_action_go_up (GtkAction *action, gpointer data); -void activate_action_go_home (GtkAction *action, gpointer data); - -void activate_action_manual (GtkAction *action, gpointer data); -void activate_action_about (GtkAction *action, gpointer data); +void show_new_archive_dialog (FrWindow *window, + const char *archive_name); +void activate_action_new (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_open (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_save_as (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_test_archive (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_properties (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_close (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_quit (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_add_files (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_add_folder (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_extract (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_copy (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_cut (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_paste (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_rename (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_delete (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_find (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_select_all (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_deselect_all (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_open_with (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_password (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_view_toolbar (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_view_statusbar (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_view_folders (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_stop (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_reload (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_last_output (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_go_back (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_go_forward (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_go_up (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_go_home (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_manual (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_action_about (GSimpleAction *action, + GVariant *parameter, + gpointer data); + +void activate_toggle (GSimpleAction *action, + GVariant *parameter, + gpointer user_data); + +void activate_popup_open (GtkMenuItem *menuitem, + gpointer data); + +void activate_popup_open_select (GtkMenuItem *menuitem, + gpointer data); + +void activate_popup_extract (GtkMenuItem *menuitem, + gpointer data); + +void activate_popup_cut (GtkMenuItem *menuitem, + gpointer data); + +void activate_popup_paste (GtkMenuItem *menuitem, + gpointer data); + +void activate_popup_rename (GtkMenuItem *menuitem, + gpointer data); + +void activate_popup_delete (GtkMenuItem *menuitem, + gpointer data); + +void init_engramp_menu_popup (FrWindow *window, + GtkBuilder *ui); + +void activate_popup_open_folder (GtkMenuItem *menuitem, + gpointer data); + +void activate_popup_copy (GtkMenuItem *menuitem, + gpointer data); + +void activate_popup_open_folder_from_sidebar (GtkMenuItem *menuitem, + gpointer data); + +void activate_popup_extract_folder_from_sidebar (GtkMenuItem *menuitem, + gpointer data); + +void activate_popup_copy_folder_from_sidebar (GtkMenuItem *menuitem, + gpointer data); + +void activate_popup_cut_folder_from_sidebar (GtkMenuItem *menuitem, + gpointer data); + +void activate_popup_paste_folder_from_sidebar (GtkMenuItem *menuitem, + gpointer data); + +void activate_popup_rename_folder_from_sidebar (GtkMenuItem *menuitem, + gpointer data); + +void activate_popup_delete_folder_from_sidebar (GtkMenuItem *menuitem, + gpointer data); #endif /* ACTIONS_H */ diff --git a/src/dlg-batch-add.c b/src/dlg-batch-add.c index 7d78e65..364b100 100644 --- a/src/dlg-batch-add.c +++ b/src/dlg-batch-add.c @@ -394,13 +394,18 @@ archive_type_combo_box_changed_cb (GtkComboBox *combo_box, const char *mime_type; int idx = gtk_combo_box_get_active (combo_box); char *icon_name; + char *content_type; mime_type = mime_type_desc[data->supported_types[idx]].mime_type; - if ((icon_name = g_content_type_get_generic_icon_name (mime_type)) != NULL) { + content_type = g_content_type_from_mime_type (mime_type); + if ((icon_name = g_content_type_get_generic_icon_name (content_type)) != NULL) { gtk_image_set_from_icon_name (GTK_IMAGE (GET_WIDGET ("archive_icon_image")), icon_name, GTK_ICON_SIZE_DIALOG); + g_free (icon_name); } + + g_free (content_type); update_sensitivity_for_mime_type (data, mime_type); } diff --git a/src/dlg-extract.c b/src/dlg-extract.c index b85d23b..6d63059 100644 --- a/src/dlg-extract.c +++ b/src/dlg-extract.c @@ -69,6 +69,8 @@ extract_cb (GtkWidget *w, FrWindow *window = data->window; gboolean do_not_extract = FALSE; char *extract_to_dir; + char *sub_dir; + gboolean extract_sub_dir; gboolean overwrite; gboolean skip_newer; gboolean selected_files; @@ -179,16 +181,18 @@ extract_cb (GtkWidget *w, return FALSE; } - fr_window_set_extract_default_dir (window, extract_to_dir, TRUE); - overwrite = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("overwrite_checkbutton"))); skip_newer = ! gtk_toggle_button_get_inconsistent (GTK_TOGGLE_BUTTON (GET_WIDGET ("not_newer_checkbutton"))) && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("not_newer_checkbutton"))); junk_paths = ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("recreate_dir_checkbutton"))); + extract_sub_dir = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("create_subdir_checkbutton"))); g_settings_set_boolean (data->settings, PREF_EXTRACT_OVERWRITE, overwrite); if (! gtk_toggle_button_get_inconsistent (GTK_TOGGLE_BUTTON (GET_WIDGET ("not_newer_checkbutton")))) g_settings_set_boolean (data->settings, PREF_EXTRACT_SKIP_NEWER, skip_newer); g_settings_set_boolean (data->settings, PREF_EXTRACT_RECREATE_FOLDERS, ! junk_paths); + g_settings_set_boolean (data->settings, PREF_EXTRACT_CREATE_SUBDIR, extract_sub_dir); + + fr_window_set_extract_default_dir (window, extract_to_dir, !extract_sub_dir); selected_files = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("selected_files_radiobutton"))); pattern_files = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("file_pattern_radiobutton"))); @@ -220,6 +224,11 @@ extract_cb (GtkWidget *w, else base_dir = NULL; + if (extract_sub_dir) + sub_dir = remove_extension_from_path (g_filename_display_basename (fr_window_get_archive_uri (window))); + else + sub_dir = NULL; + /* close the dialog. */ gtk_widget_destroy (data->dialog); @@ -229,6 +238,7 @@ extract_cb (GtkWidget *w, fr_window_archive_extract (window, file_list, extract_to_dir, + sub_dir, base_dir, skip_newer, overwrite ? FR_OVERWRITE_YES : FR_OVERWRITE_NO, @@ -237,6 +247,7 @@ extract_cb (GtkWidget *w, path_list_free (file_list); g_free (extract_to_dir); + g_free (sub_dir); g_free (base_dir); return TRUE; @@ -281,11 +292,21 @@ overwrite_toggled_cb (GtkToggleButton *button, } static void +close_dialog_changed_cb (GtkToggleButton *button, + FrWindow *window) +{ + gboolean active = gtk_toggle_button_get_active (button); + fr_window_set_close_dialog (window, active); +} + +static void dlg_extract__common (FrWindow *window, GList *selected_files, char *base_dir_for_selection) { DialogData *data; + GtkWidget *button; + const char *extract_default_dir; data = g_new0 (DialogData, 1); data->builder = gtk_builder_new_from_resource (ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "dlg-extract.ui"); @@ -298,7 +319,12 @@ dlg_extract__common (FrWindow *window, /* Set widgets data. */ - gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (data->dialog), fr_window_get_extract_default_dir (window)); + extract_default_dir = fr_window_get_extract_default_dir (window); + if (uri_is_local (extract_default_dir)) + { + extract_default_dir = g_filename_from_uri (extract_default_dir, NULL, NULL); + } + gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (data->dialog), extract_default_dir); if (data->selected_files != NULL) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("selected_files_radiobutton")), TRUE); @@ -316,6 +342,18 @@ dlg_extract__common (FrWindow *window, } gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("recreate_dir_checkbutton")), g_settings_get_boolean (data->settings, PREF_EXTRACT_RECREATE_FOLDERS)); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("create_subdir_checkbutton")), g_settings_get_boolean (data->settings, PREF_EXTRACT_CREATE_SUBDIR)); + + button = GET_WIDGET ("close_dialog_checkbutton"); + g_settings_bind (data->settings, + PREF_EXTRACT_CLOSE_DIALOG, + GTK_TOGGLE_BUTTON (button), + "active", + G_SETTINGS_BIND_GET); + g_signal_connect (button, + "toggled", + G_CALLBACK (close_dialog_changed_cb), + window); /* Set the signals handlers. */ diff --git a/src/dlg-new.c b/src/dlg-new.c index 12fc138..118e732 100644 --- a/src/dlg-new.c +++ b/src/dlg-new.c @@ -40,6 +40,8 @@ static void destroy_cb (GtkWidget *widget, DlgNewData *data) { + if (data->original_file != NULL) + g_object_unref (data->original_file); g_free (data); } diff --git a/src/dlg-new.h b/src/dlg-new.h index 3f9f6d5..1b3789a 100644 --- a/src/dlg-new.h +++ b/src/dlg-new.h @@ -35,6 +35,7 @@ typedef struct { gboolean can_create_volumes; GtkBuilder *builder; + GFile *original_file; GtkWidget *dialog; /*GtkWidget *n_archive_type_combo_box;*/ GtkWidget *n_other_options_expander; diff --git a/src/engrampa.gresource.xml b/src/engrampa.gresource.xml index deed6e3..8d7ebc2 100644 --- a/src/engrampa.gresource.xml +++ b/src/engrampa.gresource.xml @@ -2,7 +2,6 @@ <gresources> <gresource prefix="/org/mate/Engrampa"> <file compressed="true">ui/add-options.ui</file> - <file compressed="true">ui/app-menu.ui</file> <file compressed="true">ui/batch-add-files.ui</file> <file compressed="true">ui/batch-password.ui</file> <file compressed="true">ui/delete.ui</file> diff --git a/src/file-utils.c b/src/file-utils.c index 64e3b30..44fed53 100644 --- a/src/file-utils.c +++ b/src/file-utils.c @@ -27,9 +27,11 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <strings.h> #include <ctype.h> #include <time.h> #include <unistd.h> +#include <strings.h> #include <sys/param.h> #include <sys/stat.h> #include <sys/time.h> @@ -122,100 +124,6 @@ uri_is_local (const char *uri) return strncmp (uri, "file://", 7) == 0; } -gboolean -dir_is_empty (const char *uri) -{ - GFile *file; - GFileEnumerator *file_enum; - GFileInfo *info; - GError *error = NULL; - int n = 0; - - file = g_file_new_for_uri (uri); - - if (! g_file_query_exists (file, NULL)) { - g_object_unref (file); - return TRUE; - } - - file_enum = g_file_enumerate_children (file, G_FILE_ATTRIBUTE_STANDARD_NAME, 0, NULL, &error); - if (error != NULL) { - g_warning ("Failed to enumerate children of %s: %s", uri, error->message); - g_error_free (error); - g_object_unref (file_enum); - g_object_unref (file); - return TRUE; - } - - while ((n == 0) && ((info = g_file_enumerator_next_file (file_enum, NULL, &error)) != NULL)) { - if (error != NULL) { - g_warning ("Encountered error while enumerating children of %s (ignoring): %s", uri, error->message); - g_error_free (error); - } - else if (! SPECIAL_DIR (g_file_info_get_name (info))) - n++; - g_object_unref (info); - } - - g_object_unref (file); - g_object_unref (file_enum); - - return (n == 0); -} - -gboolean -dir_contains_one_object (const char *uri) -{ - GFile *file; - GFileEnumerator *file_enum; - GFileInfo *info; - GError *err = NULL; - int n = 0; - - file = g_file_new_for_uri (uri); - - if (! g_file_query_exists (file, NULL)) { - g_object_unref (file); - return FALSE; - } - - file_enum = g_file_enumerate_children (file, G_FILE_ATTRIBUTE_STANDARD_NAME, 0, NULL, &err); - if (err != NULL) { - g_warning ("Failed to enumerate children of %s: %s", uri, err->message); - g_error_free (err); - g_object_unref (file_enum); - g_object_unref (file); - return FALSE; - } - - while ((info = g_file_enumerator_next_file (file_enum, NULL, &err)) != NULL) { - const char *name; - - if (err != NULL) { - g_warning ("Encountered error while enumerating children of %s, ignoring: %s", uri, err->message); - g_error_free (err); - g_object_unref (info); - continue; - } - - name = g_file_info_get_name (info); - if (strcmp (name, ".") == 0 || strcmp (name, "..") == 0) { - g_object_unref (info); - continue; - } - - g_object_unref (info); - - if (++n > 1) - break; - } - - g_object_unref (file); - g_object_unref (file_enum); - - return (n == 1); -} - char * get_dir_content_if_unique (const char *uri) { @@ -241,6 +149,7 @@ get_dir_content_if_unique (const char *uri) while ((info = g_file_enumerator_next_file (file_enum, NULL, &err)) != NULL) { const char *name; + char *new_name; if (err != NULL) { g_warning ("Failed to get info while enumerating children: %s", err->message); @@ -262,8 +171,10 @@ get_dir_content_if_unique (const char *uri) break; } - content_uri = build_uri (uri, name, NULL); + new_name = g_uri_escape_string (name, NULL, TRUE); + content_uri = build_uri (uri, new_name, NULL); g_object_unref (info); + g_free (new_name); } if (err != NULL) { @@ -396,22 +307,6 @@ get_file_mtime_for_path (const char *path) return result; } -time_t -get_file_ctime (const char *uri) -{ - return get_file_time_type (uri, G_FILE_ATTRIBUTE_TIME_CREATED); -} - -gboolean -file_is_hidden (const gchar *name) -{ - if (name[0] != '.') return FALSE; - if (name[1] == '\0') return FALSE; - if ((name[1] == '.') && (name[2] == '\0')) return FALSE; - - return TRUE; -} - /* like g_path_get_basename but does not warn about NULL and does not * alloc a new string. */ const gchar* file_name_from_path(const gchar *file_name) @@ -521,26 +416,16 @@ build_uri (const char *base, ...) gchar * remove_extension_from_path (const gchar *path) { - int len; - int p; - const char *ptr = path; - char *new_path; - - if (! path) - return NULL; + const char *ext; - len = strlen (path); - if (len == 1) - return g_strdup (path); - - p = len - 1; - while ((p > 0) && (ptr[p] != '.')) - p--; - if (p == 0) - p = len; - new_path = g_strndup (path, (guint) p); + if (path == NULL) + return NULL; - return new_path; + ext = get_archive_filename_extension (path); + if (ext == NULL || strlen (ext) == strlen (path)) + return g_strdup (path); + else + return g_strndup (path, strlen (path) - strlen (ext)); } gboolean @@ -626,6 +511,7 @@ get_file_extension (const char *filename) int len; int p; const char *ext; + const char *tar_exts[] = {".7z", ".br", ".bz", ".bz2", ".gz", ".lrz", ".lz", ".lzma", ".lzo", ".xz", ".Z", ".xst", NULL}; if (filename == NULL) return NULL; @@ -641,10 +527,16 @@ get_file_extension (const char *filename) return NULL; ext = filename + p; + p = 0; if (ext - 4 > filename) { const char *test = ext - 4; - if (strncmp (test, ".tar", 4) == 0) - ext = ext - 4; + if (strncmp (test, ".tar", 4) == 0) { + while (tar_exts[p] != NULL) { + if (strcmp (ext, tar_exts[p]) == 0) + ext = ext - 4; + p++; + } + } } return ext; } @@ -667,7 +559,7 @@ gboolean is_mime_type (const char *mime_type, const char *pattern) { - return (strcasecmp (mime_type, pattern) == 0); + return g_content_type_equals (mime_type, pattern); } const char* @@ -995,35 +887,6 @@ file_list__get_index_from_pattern (const char *line, } char* -file_list__get_next_field (const char *line, - int start_from, - int field_n) -{ - const char *f_start, *f_end; - - line = line + start_from; - - f_start = line; - while ((*f_start == ' ') && (*f_start != *line)) - f_start++; - f_end = f_start; - - while ((field_n > 0) && (*f_end != 0)) { - if (*f_end == ' ') { - field_n--; - if (field_n != 0) { - while ((*f_end == ' ') && (*f_end != *line)) - f_end++; - f_start = f_end; - } - } else - f_end++; - } - - return g_strndup (f_start, f_end - f_start); -} - -char* file_list__get_prev_field (const char *line, int start_from, int field_n) @@ -1149,28 +1012,6 @@ get_home_uri (void) return home_uri; } -char * -get_home_relative_uri (const char *partial_uri) -{ - return g_strconcat (get_home_uri (), - "/", - partial_uri, - NULL); -} - -GFile * -get_home_relative_file (const char *partial_uri) -{ - GFile *file; - char *uri; - - uri = g_strconcat (get_home_uri (), "/", partial_uri, NULL); - file = g_file_new_for_uri (uri); - g_free (uri); - - return file; -} - GFile * get_user_config_subdirectory (const char *child_name, gboolean create_child) @@ -1193,55 +1034,6 @@ get_user_config_subdirectory (const char *child_name, return file; } -const char * -remove_host_from_uri (const char *uri) -{ - const char *idx, *sep; - - if (uri == NULL) - return NULL; - - idx = strstr (uri, "://"); - if (idx == NULL) - return uri; - idx += 3; - if (*idx == '\0') - return "/"; - sep = strstr (idx, "/"); - if (sep == NULL) - return idx; - return sep; -} - -char * -get_uri_host (const char *uri) -{ - const char *idx; - - idx = strstr (uri, "://"); - if (idx == NULL) - return NULL; - idx = strstr (idx + 3, "/"); - if (idx == NULL) - return NULL; - return g_strndup (uri, (idx - uri)); -} - -char * -get_uri_root (const char *uri) -{ - char *host; - char *root; - - host = get_uri_host (uri); - if (host == NULL) - return NULL; - root = g_strconcat (host, "/", NULL); - g_free (host); - - return root; -} - int uricmp (const char *uri1, const char *uri2) @@ -1249,9 +1041,18 @@ uricmp (const char *uri1, return g_strcmp0 (uri1, uri2); } +/** + * get_alternative_uri: + * @folder_uri: The URI of the containing folder + * @escaped_name: The URI-escaped name of the member to find a name for + * + * Tries to find an unused name for @escaped_name in @folder_uri. + * + * Returns: The full URI for the free slot (including directory) + */ char * -get_alternative_uri (const char *folder, - const char *name) +get_alternative_uri (const char *folder_uri, + const char *escaped_name) { char *new_uri = NULL; int n = 1; @@ -1259,9 +1060,9 @@ get_alternative_uri (const char *folder, do { g_free (new_uri); if (n == 1) - new_uri = g_strconcat (folder, "/", name, NULL); + new_uri = g_strconcat (folder_uri, "/", escaped_name, NULL); else - new_uri = g_strdup_printf ("%s/%s%%20(%d)", folder, name, n); + new_uri = g_strdup_printf ("%s/%s%%20(%d)", folder_uri, escaped_name, n); n++; } while (uri_exists (new_uri)); @@ -1299,15 +1100,6 @@ gio_file_list_free (GList *l) g_list_free (l); } -GList * -gio_file_list_new_from_uri_list (GList *uris) -{ - GList *r = NULL, *scan; - for (scan = uris; scan; scan = scan->next) - r = g_list_prepend (r, g_file_new_for_uri ((char*)scan->data)); - return g_list_reverse (r); -} - void g_key_file_save (GKeyFile *key_file, GFile *file) diff --git a/src/file-utils.h b/src/file-utils.h index 2d726fe..61498aa 100644 --- a/src/file-utils.h +++ b/src/file-utils.h @@ -42,8 +42,6 @@ gboolean uri_is_file (const char *uri); gboolean uri_is_dir (const char *uri); gboolean path_is_dir (const char *path); gboolean uri_is_local (const char *uri); -gboolean dir_is_empty (const char *uri); -gboolean dir_contains_one_object (const char *uri); char * get_dir_content_if_unique (const char *uri); gboolean path_in_path (const char *path_src, const char *path_dest); @@ -51,7 +49,6 @@ goffset get_file_size (const char *uri); goffset get_file_size_for_path (const char *path); time_t get_file_mtime (const char *uri); time_t get_file_mtime_for_path (const char *path); -time_t get_file_ctime (const char *uri); gboolean make_directory_tree (GFile *dir, mode_t mode, GError **error); @@ -61,7 +58,6 @@ gboolean ensure_dir_exists (const char *uri, gboolean make_directory_tree_from_path (const char *path, mode_t mode, GError **error); -gboolean file_is_hidden (const char *name); const char* file_name_from_path(const char* path); char * dir_name_from_path (const char *path); char * remove_level_from_path (const char *path); @@ -90,9 +86,6 @@ gboolean file_list__match_pattern (const char *line, const char *pattern); int file_list__get_index_from_pattern (const char *line, const char *pattern); -char* file_list__get_next_field (const char *line, - int start_from, - int field_n); char* file_list__get_prev_field (const char *line, int start_from, int field_n); @@ -107,13 +100,8 @@ gboolean is_program_available (const char *filename, /* URI utils */ const char * get_home_uri (void); -char * get_home_relative_uri (const char *partial_uri); -GFile * get_home_relative_file (const char *partial_uri); GFile * get_user_config_subdirectory (const char *child_name, gboolean create_); -const char * remove_host_from_uri (const char *uri); -char * get_uri_host (const char *uri); -char * get_uri_root (const char *uri); int uricmp (const char *uri1, const char *uri2); char * get_alternative_uri (const char *folder, @@ -125,7 +113,6 @@ GList * path_list_dup (GList *path_list); GList * gio_file_list_dup (GList *l); void gio_file_list_free (GList *l); -GList * gio_file_list_new_from_uri_list (GList *uris); void g_key_file_save (GKeyFile *key_file, GFile *file); diff --git a/src/fr-archive.c b/src/fr-archive.c index 301968f..183a5ac 100644 --- a/src/fr-archive.c +++ b/src/fr-archive.c @@ -1103,6 +1103,7 @@ load_local_archive (FrArchive *archive, old_command = archive->command; mime_type = get_mime_type_from_filename (archive->local_copy); + if (! create_command_to_load_archive (archive, mime_type)) { mime_type = get_mime_type_from_content (archive->local_copy); if (! create_command_to_load_archive (archive, mime_type)) { diff --git a/src/fr-command-7z.c b/src/fr-command-7z.c index c3c66ab..8bb474e 100644 --- a/src/fr-command-7z.c +++ b/src/fr-command-7z.c @@ -204,7 +204,15 @@ list__process_line (char *line, static void fr_command_7z_begin_command (FrCommand *comm) { - if (is_program_in_path ("7z")) + // Modern 7-Zip by the original author. + // Statically linked from a binary distribution, almost guaranteed to work. + if (is_program_in_path ("7zzs")) + fr_process_begin_command (comm->process, "7zzs"); + // Dynamically linked from either binary or source distribution. + else if (is_program_in_path ("7zz")) + fr_process_begin_command (comm->process, "7zz"); + // Legacy p7zip project. + else if (is_program_in_path ("7z")) fr_process_begin_command (comm->process, "7z"); else if (is_program_in_path ("7za")) fr_process_begin_command (comm->process, "7za"); @@ -333,8 +341,10 @@ fr_command_7z_add (FrCommand *comm, if (spd_support) fr_process_add_arg (comm->process, "-spd"); fr_process_add_arg (comm->process, "-bd"); + fr_process_add_arg (comm->process, "-bb1"); fr_process_add_arg (comm->process, "-y"); - fr_process_add_arg (comm->process, "-l"); + if (recursive) + fr_process_add_arg (comm->process, "-l"); add_password_arg (comm, comm->password, FALSE); if ((comm->password != NULL) && (*comm->password != 0) @@ -394,12 +404,27 @@ fr_command_7z_add (FrCommand *comm, } static void +process_line__delete (char *line, + gpointer data) +{ + if ((strstr (line, "Wrong password?") != NULL) + || (strstr (line, "Enter password") != NULL)) + { + password_required = TRUE; + } +} + +static void fr_command_7z_delete (FrCommand *comm, const char *from_file, GList *file_list) { GList *scan; + fr_process_set_out_line_func (comm->process, + process_line__delete, + comm); + fr_command_7z_begin_command (comm); fr_process_add_arg (comm->process, "d"); if (spd_support) fr_process_add_arg (comm->process, "-spd"); @@ -465,6 +490,7 @@ fr_command_7z_extract (FrCommand *comm, if (spd_support) fr_process_add_arg (comm->process, "-spd"); fr_process_add_arg (comm->process, "-bd"); + fr_process_add_arg (comm->process, "-bb1"); fr_process_add_arg (comm->process, "-y"); add_password_arg (comm, comm->password, FALSE); @@ -583,7 +609,7 @@ fr_command_7z_get_mime_types (FrCommand *comm) if (g_settings_get_boolean (settings, "unar-open-zip") && is_program_in_path ("unar") && is_program_in_path ("lsar")) - sevenz_mime_types [8] = NULL; + sevenz_mime_types [9] = NULL; else g_settings_set_boolean (settings, "unar-open-zip", FALSE); @@ -600,24 +626,28 @@ fr_command_7z_get_capabilities (FrCommand *comm, FrCommandCaps capabilities; capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES; - if (! is_program_available ("7za", check_command) && ! is_program_available ("7zr", check_command) && ! is_program_available ("7z", check_command)) + gboolean available_7zip = is_program_available ("7zz", check_command) || is_program_available ("7zzs", check_command); + if (! available_7zip\ + && ! is_program_available ("7za", check_command) \ + && ! is_program_available ("7zr", check_command) \ + && ! is_program_available ("7z", check_command)) return capabilities; if (is_mime_type (mime_type, "application/x-7z-compressed")) { capabilities |= FR_COMMAND_CAN_READ_WRITE | FR_COMMAND_CAN_CREATE_VOLUMES; - if (is_program_available ("7z", check_command)) + if (is_program_available ("7z", check_command) || available_7zip) capabilities |= FR_COMMAND_CAN_ENCRYPT | FR_COMMAND_CAN_ENCRYPT_HEADER; } else if (is_mime_type (mime_type, "application/x-7z-compressed-tar")) { capabilities |= FR_COMMAND_CAN_READ_WRITE; - if (is_program_available ("7z", check_command)) + if (is_program_available ("7z", check_command) || available_7zip) capabilities |= FR_COMMAND_CAN_ENCRYPT | FR_COMMAND_CAN_ENCRYPT_HEADER; } - else if (is_program_available ("7z", check_command)) { + else if (is_program_available ("7z", check_command) || available_7zip) { if (is_mime_type (mime_type, "application/x-rar") || is_mime_type (mime_type, "application/x-cbr")) { - if (! check_command || g_file_test ("/usr/lib/p7zip/Codecs/Rar29.so", G_FILE_TEST_EXISTS) || g_file_test ("/usr/lib/p7zip/Codecs/Rar.so", G_FILE_TEST_EXISTS) + if (! check_command || available_7zip || g_file_test ("/usr/lib/p7zip/Codecs/Rar29.so", G_FILE_TEST_EXISTS) || g_file_test ("/usr/lib/p7zip/Codecs/Rar.so", G_FILE_TEST_EXISTS) || g_file_test ("/usr/libexec/p7zip/Codecs/Rar29.so", G_FILE_TEST_EXISTS) || g_file_test ("/usr/libexec/p7zip/Codecs/Rar.so", G_FILE_TEST_EXISTS)) capabilities |= FR_COMMAND_CAN_READ; } @@ -655,11 +685,11 @@ fr_command_7z_get_packages (FrCommand *comm, const char *mime_type) { if (is_mime_type (mime_type, "application/x-rar")) - return PACKAGES ("p7zip,p7zip-rar"); + return PACKAGES ("7zip,7zip-rar"); else if (is_mime_type (mime_type, "application/zip") || is_mime_type (mime_type, "application/vnd.ms-cab-compressed")) - return PACKAGES ("p7zip,p7zip-full"); + return PACKAGES ("7zip,7zip-full"); else - return PACKAGES ("p7zip"); + return PACKAGES ("7zip"); } static void diff --git a/src/fr-command-cfile.c b/src/fr-command-cfile.c index 647dbe3..52b023a 100644 --- a/src/fr-command-cfile.c +++ b/src/fr-command-cfile.c @@ -296,7 +296,8 @@ fr_command_cfile_add (FrCommand *comm, compressed_filename = g_strconcat (filename, ".rz", NULL); } - else if (is_mime_type (comm->mime_type, ZSTD_MIME_TYPE)) { + else if (is_mime_type (comm->mime_type, "application/zstd") + || is_mime_type (comm->mime_type, "application/x-zstd")) { fr_process_begin_command (comm->process, "zstd"); fr_process_set_working_dir (comm->process, temp_dir); fr_process_add_arg (comm->process, filename); @@ -439,7 +440,8 @@ fr_command_cfile_extract (FrCommand *comm, fr_process_end_command (comm->process); } - else if (is_mime_type (comm->mime_type, ZSTD_MIME_TYPE)) { + else if (is_mime_type (comm->mime_type, "application/zstd") + || is_mime_type (comm->mime_type, "application/x-zstd")) { fr_process_begin_command (comm->process, "zstd"); fr_process_add_arg (comm->process, "-f"); fr_process_add_arg (comm->process, "-d"); @@ -508,7 +510,8 @@ fr_command_cfile_test (FrCommand *comm) else if (is_mime_type (comm->mime_type, "application/x-lzop")) { compress_cmd = "lzop"; } - else if (is_mime_type (comm->mime_type, ZSTD_MIME_TYPE)) { + else if (is_mime_type (comm->mime_type, "application/zstd") + || is_mime_type (comm->mime_type, "application/x-zstd")) { compress_cmd = "zstd"; fr_process_begin_command (comm->process, compress_cmd); fr_process_add_arg (comm->process, "-v"); @@ -535,7 +538,8 @@ const char *cfile_mime_type[] = { "application/x-gzip", "application/x-lzop", "application/x-rzip", "application/x-xz", - ZSTD_MIME_TYPE, + "application/zstd", + "application/x-zstd", NULL }; static const char ** @@ -590,7 +594,8 @@ fr_command_cfile_get_capabilities (FrCommand *comm, if (is_program_available ("rzip", check_command)) capabilities |= FR_COMMAND_CAN_READ_WRITE; } - else if (is_mime_type (mime_type, ZSTD_MIME_TYPE)) { + else if (is_mime_type (mime_type, "application/zstd") + || is_mime_type (mime_type, "application/x-zstd")) { if (is_program_available ("zstd", check_command)) capabilities |= FR_COMMAND_CAN_READ_WRITE; } @@ -631,7 +636,8 @@ fr_command_cfile_get_packages (FrCommand *comm, return PACKAGES ("lzop"); else if (is_mime_type (mime_type, "application/x-rzip")) return PACKAGES ("rzip"); - else if (is_mime_type (mime_type, ZSTD_MIME_TYPE)) + else if (is_mime_type (mime_type, "application/zstd") + || is_mime_type (mime_type, "application/x-zstd")) return PACKAGES ("zstd"); return NULL; diff --git a/src/fr-command-cpio.c b/src/fr-command-cpio.c index c6a7198..3d0fcd9 100644 --- a/src/fr-command-cpio.c +++ b/src/fr-command-cpio.c @@ -219,7 +219,7 @@ fr_command_cpio_extract (FrCommand *comm, fr_process_end_command (comm->process); } -const char *cpio_mime_type[] = { "application/x-cpio", NULL }; +const char *cpio_mime_type[] = { /*"application/x-cpio",*/ NULL }; static const char ** fr_command_cpio_get_mime_types (FrCommand *comm) @@ -235,8 +235,8 @@ fr_command_cpio_get_capabilities (FrCommand *comm, FrCommandCaps capabilities; capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES; - if (is_program_available (CPIO_PATH, check_command)) - capabilities |= FR_COMMAND_CAN_READ; +/* if (is_program_available (CPIO_PATH, check_command)) + capabilities |= FR_COMMAND_CAN_READ;*/ return capabilities; } diff --git a/src/fr-command-rar.c b/src/fr-command-rar.c index 7794510..6bb70cd 100644 --- a/src/fr-command-rar.c +++ b/src/fr-command-rar.c @@ -20,6 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#define _XOPEN_SOURCE 700 + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -49,10 +51,26 @@ static FrCommandClass *parent_class = NULL; static gboolean date_newstyle = FALSE; -static gboolean -have_rar (void) +static const struct { + const gchar *command; + FrCommandCaps capabilities; +} candidate_commands[] = { + { "rar", FR_COMMAND_CAN_READ_WRITE | FR_COMMAND_CAN_CREATE_VOLUMES }, + { "unrar", FR_COMMAND_CAN_READ }, + { "unrar-free", FR_COMMAND_CAN_READ } +}; + +static const gchar * +get_rar_command (void) { - return is_program_in_path ("rar"); + for (guint i = 0; i < G_N_ELEMENTS(candidate_commands); i++) { + if (is_program_in_path (candidate_commands[i].command)) + return candidate_commands[i].command; + } + + /* this should never happen as we shouldn't get called if none of the + * candidate exist, but better safe than sorry */ + return "unrar"; } /* -- list -- */ @@ -112,46 +130,19 @@ static time_t mktime_from_string (const char *date_s, const char *time_s) { - struct tm tm = {0, }; - char **fields; + struct tm tm = {0, }; + char *date_time_s; tm.tm_isdst = -1; - - /* date */ - - fields = g_strsplit (date_s, "-", 3); - if (fields[0] != NULL) { - if (date_newstyle) - tm.tm_year = atoi (fields[0]) - 1900; - else - tm.tm_mday = atoi (fields[0]); - if (fields[1] != NULL) { - tm.tm_mon = atoi (fields[1]) - 1; - if (fields[2] != NULL) { - if (date_newstyle) - tm.tm_mday = atoi (fields[2]); - else - tm.tm_year = 100 + atoi (fields[2]); - } - } - } - g_strfreev (fields); - - /* time */ - - fields = g_strsplit (time_s, ":", 2); - if (fields[0] != NULL) { - tm.tm_hour = atoi (fields[0]); - if (fields[1] != NULL) - tm.tm_min = atoi (fields[1]); - } - g_strfreev (fields); + date_time_s = g_strjoin (" ", date_s, time_s, NULL); + strptime (date_time_s, date_newstyle ? "%Y-%m-%d %H:%M" : "%d-%m-%y %H:%M", &tm); + g_free (date_time_s); return mktime (&tm); } static gboolean -attribute_field_with_space (char *line) +attribute_field_with_space (const char *line) { /* sometimes when the archive is encrypted the attributes field is * like this: "* ..A...." @@ -172,7 +163,7 @@ parse_name_field (char *line, fdata->encrypted = (line[0] == '*') ? TRUE : FALSE; - if (rar_comm->rar5) + if (rar_comm->output_type == FR_COMMAND_RAR_TYPE_RAR5) /* rar-5 output adds trailing spaces to short file names :( */ name_field = g_strchomp (g_strdup (get_last_field (line, attribute_field_with_space (line) ? 9 : 8))); else @@ -201,8 +192,8 @@ attr_field_is_dir (const char *attr_field, FrCommandRar *rar_comm) { if ((attr_field[0] == 'd') || - (rar_comm->rar5 && attr_field[3] == 'D') || - (!rar_comm->rar5 && attr_field[1] == 'D')) + (rar_comm->output_type == FR_COMMAND_RAR_TYPE_RAR5 && attr_field[3] == 'D') || + (rar_comm->output_type != FR_COMMAND_RAR_TYPE_RAR5 && attr_field[1] == 'D')) return TRUE; return FALSE; @@ -219,39 +210,27 @@ process_line (char *line, g_return_if_fail (line != NULL); if (! rar_comm->list_started) { - if (strncmp (line, "RAR ", 4) == 0) { - int version; - sscanf (line, "RAR %d.", &version); - rar_comm->rar5 = (version >= 5); + int version = 0; - if (version > 5) - date_newstyle = TRUE; - else if (version == 5) - { - sscanf (line, "RAR 5.%d ", &version); - if (version >= 30) - date_newstyle = TRUE; - } - - } - else if (strncmp (line, "UNRAR ", 6) == 0) { - int version; - sscanf (line, "UNRAR %d.", &version); - rar_comm->rar5 = (version >= 5); + if (sscanf (line, "RAR %d.", &version) == 1 || sscanf (line, "UNRAR %d.", &version) == 1) { + rar_comm->output_type = (version >= 5) ? FR_COMMAND_RAR_TYPE_RAR5 : FR_COMMAND_RAR_TYPE_RAR4; if (version > 5) date_newstyle = TRUE; - else if (version == 5) + else if (version == 5 && (sscanf (line, "RAR 5.%d ", &version) == 1 || + sscanf (line, "UNRAR 5.%d ", &version) == 1)) { - sscanf (line, "UNRAR 5.%d ", &version); if (version >= 30) date_newstyle = TRUE; } - + } + else if (g_str_has_prefix (line, "unrar-free ")) { + rar_comm->output_type = FR_COMMAND_RAR_TYPE_UNRAR_FREE; + date_newstyle = FALSE; } else if (strncmp (line, "--------", 8) == 0) { rar_comm->list_started = TRUE; - if (! rar_comm->rar5) + if (rar_comm->output_type != FR_COMMAND_RAR_TYPE_RAR5) rar_comm->rar4_odd_line = TRUE; } else if (strncmp (line, "Volume ", 7) == 0) @@ -264,35 +243,27 @@ process_line (char *line, return; } - if (rar_comm->rar4_odd_line || rar_comm->rar5) + if (rar_comm->rar4_odd_line || rar_comm->output_type == FR_COMMAND_RAR_TYPE_RAR5) parse_name_field (line, rar_comm); if (! rar_comm->rar4_odd_line) { FileData *fdata; const char *size_field, *ratio_field, *date_field, *time_field, *attr_field; + int n_fields; + + if (rar_comm->output_type == FR_COMMAND_RAR_TYPE_RAR5) + n_fields = 6 + (attribute_field_with_space (line) != 0); + else if (rar_comm->output_type == FR_COMMAND_RAR_TYPE_UNRAR_FREE) + n_fields = 4; + else + n_fields = 6; fdata = rar_comm->fdata; /* read file info. */ - fields = split_line (line, attribute_field_with_space (line) ? 7 : 6); - if (rar_comm->rar5) { - int offset = attribute_field_with_space (line) ? 1 : 0; - - size_field = fields[1+offset]; - ratio_field = fields[3+offset]; - date_field = fields[4+offset]; - time_field = fields[5+offset]; - attr_field = fields[0+offset]; - } - else { - size_field = fields[0]; - ratio_field = fields[2]; - date_field = fields[3]; - time_field = fields[4]; - attr_field = fields[5]; - } - if (g_strv_length (fields) < 6) { + fields = split_line (line, n_fields); + if (g_strv_length (fields) < (guint) n_fields) { /* wrong line format, treat this line as a filename line */ g_strfreev (fields); file_data_free (rar_comm->fdata); @@ -301,6 +272,30 @@ process_line (char *line, parse_name_field (line, rar_comm); } else { + if (rar_comm->output_type == FR_COMMAND_RAR_TYPE_RAR5) { + int offset = attribute_field_with_space (line) ? 1 : 0; + + size_field = fields[1+offset]; + ratio_field = fields[3+offset]; + date_field = fields[4+offset]; + time_field = fields[5+offset]; + attr_field = fields[0+offset]; + } + else if (rar_comm->output_type == FR_COMMAND_RAR_TYPE_UNRAR_FREE) { + size_field = fields[0]; + date_field = fields[1]; + time_field = fields[2]; + attr_field = fields[3]; + ratio_field = ""; + } + else { + size_field = fields[0]; + ratio_field = fields[2]; + date_field = fields[3]; + time_field = fields[4]; + attr_field = fields[5]; + } + if ((strcmp (ratio_field, "<->") == 0) || (strcmp (ratio_field, "<--") == 0)) { @@ -341,7 +336,7 @@ process_line (char *line, } } - if (! rar_comm->rar5) + if (rar_comm->output_type != FR_COMMAND_RAR_TYPE_RAR5) rar_comm->rar4_odd_line = ! rar_comm->rar4_odd_line; } @@ -375,10 +370,7 @@ fr_command_rar_list (FrCommand *comm) fr_process_set_out_line_func (comm->process, process_line, comm); - if (have_rar ()) - fr_process_begin_command (comm->process, "rar"); - else - fr_process_begin_command (comm->process, "unrar"); + fr_process_begin_command (comm->process, get_rar_command ()); fr_process_set_begin_func (comm->process, list__begin, comm); fr_process_add_arg (comm->process, "v"); fr_process_add_arg (comm->process, "-c-"); @@ -579,10 +571,7 @@ fr_command_rar_extract (FrCommand *comm, process_line__extract, comm); - if (have_rar ()) - fr_process_begin_command (comm->process, "rar"); - else - fr_process_begin_command (comm->process, "unrar"); + fr_process_begin_command (comm->process, get_rar_command ()); fr_process_add_arg (comm->process, "x"); @@ -623,10 +612,7 @@ fr_command_rar_extract (FrCommand *comm, static void fr_command_rar_test (FrCommand *comm) { - if (have_rar ()) - fr_process_begin_command (comm->process, "rar"); - else - fr_process_begin_command (comm->process, "unrar"); + fr_process_begin_command (comm->process, get_rar_command ()); fr_process_add_arg (comm->process, "t"); @@ -713,10 +699,13 @@ fr_command_rar_get_capabilities (FrCommand *comm, FrCommandCaps capabilities; capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES | FR_COMMAND_CAN_ENCRYPT | FR_COMMAND_CAN_ENCRYPT_HEADER; - if (is_program_available ("rar", check_command)) - capabilities |= FR_COMMAND_CAN_READ_WRITE | FR_COMMAND_CAN_CREATE_VOLUMES; - else if (is_program_available ("unrar", check_command)) - capabilities |= FR_COMMAND_CAN_READ; + /* add command-specific capabilities depending on availability */ + for (guint i = 0; i < G_N_ELEMENTS (candidate_commands); i++) { + if (is_program_available (candidate_commands[i].command, check_command)) { + capabilities |= candidate_commands[i].capabilities; + break; + } + } /* multi-volumes are read-only */ if ((comm->files->len > 0) && comm->multi_volume && (capabilities & FR_COMMAND_CAN_WRITE)) @@ -729,7 +718,7 @@ static const char * fr_command_rar_get_packages (FrCommand *comm, const char *mime_type) { - return PACKAGES ("rar,unrar"); + return PACKAGES ("rar,unrar,unrar-free"); } static void diff --git a/src/fr-command-rar.h b/src/fr-command-rar.h index eaafad4..185d24e 100644 --- a/src/fr-command-rar.h +++ b/src/fr-command-rar.h @@ -38,13 +38,20 @@ typedef struct _FrCommandRar FrCommandRar; typedef struct _FrCommandRarClass FrCommandRarClass; +typedef enum +{ + FR_COMMAND_RAR_TYPE_RAR4 = 0, + FR_COMMAND_RAR_TYPE_RAR5, + FR_COMMAND_RAR_TYPE_UNRAR_FREE, +} FrCommandRarType; + struct _FrCommandRar { FrCommand __parent; gboolean list_started; gboolean rar4_odd_line; - gboolean rar5; + FrCommandRarType output_type; FileData *fdata; }; diff --git a/src/fr-command-tar.c b/src/fr-command-tar.c index e73b214..79c0ad0 100644 --- a/src/fr-command-tar.c +++ b/src/fr-command-tar.c @@ -664,7 +664,8 @@ fr_command_tar_recompress (FrCommand *comm) fr_process_add_arg (comm->process, "a"); fr_process_add_arg (comm->process, "-bd"); fr_process_add_arg (comm->process, "-y"); - fr_process_add_arg (comm->process, "-l"); + if (g_strcmp0 (comm_tar->compress_command, "7zzs") != 0 && g_strcmp0 (comm_tar->compress_command, "7zz") != 0) + fr_process_add_arg (comm->process, "-l"); new_name = g_strconcat (c_tar->uncomp_filename, ".7z", NULL); fr_process_add_arg_concat (comm->process, new_name, NULL); @@ -1061,7 +1062,7 @@ fr_command_tar_get_capabilities (FrCommand *comm, capabilities |= FR_COMMAND_CAN_READ_WRITE; } else if (is_mime_type (mime_type, "application/x-7z-compressed-tar")) { - const char *try_command[3] = { "7za", "7zr", "7z" }; + const char *try_command[5] = { "7zzs", "7zz", "7za", "7zr", "7z" }; size_t i; for (i = 0; i < G_N_ELEMENTS (try_command); i++) { @@ -1088,7 +1089,7 @@ fr_command_tar_set_mime_type (FrCommand *comm, FR_COMMAND_CLASS (parent_class)->set_mime_type (comm, mime_type); if (is_mime_type (mime_type, "application/x-7z-compressed-tar")) { - const char *try_command[3] = { "7za", "7zr", "7z" }; + const char *try_command[5] = { "7zzs", "7zz", "7za", "7zr", "7z" }; size_t i; for (i = 0; i < G_N_ELEMENTS (try_command); i++) { @@ -1125,7 +1126,7 @@ fr_command_tar_get_packages (FrCommand *comm, else if (is_mime_type (mime_type, "application/x-lzop-compressed-tar")) return PACKAGES ("tar,lzop"); else if (is_mime_type (mime_type, "application/x-7z-compressed-tar")) - return PACKAGES ("tar,p7zip"); + return PACKAGES ("tar,7zip"); else if (is_mime_type (mime_type, "application/x-zstd-compressed-tar")) return PACKAGES ("tar,zstd"); diff --git a/src/fr-command-unarchiver.c b/src/fr-command-unarchiver.c index c7aa5e6..a6a8c2d 100644 --- a/src/fr-command-unarchiver.c +++ b/src/fr-command-unarchiver.c @@ -247,6 +247,7 @@ fr_command_unarchiver_handle_error (FrCommand *comm, const char *unarchiver_mime_type[] = { "application/zip", "application/x-cbr", "application/x-rar", + "application/x-cpio", NULL }; static const char ** diff --git a/src/fr-command-zip.c b/src/fr-command-zip.c index cd191bd..acdc5ad 100644 --- a/src/fr-command-zip.c +++ b/src/fr-command-zip.c @@ -59,6 +59,10 @@ mktime_from_string (char *datetime_s) char *min; char *sec; + /* expected YYYYMMDD.HHMMSS */ + if (strlen (datetime_s) < 15) + return mktime (&tm); + tm.tm_isdst = -1; /* date */ @@ -124,9 +128,14 @@ list__process_line (char *line, /**/ + fields = split_line (line, 7); + if (g_strv_length (fields) < 7) { + g_strfreev (fields); + return; + } + fdata = file_data_new (); - fields = split_line (line, 7); fdata->size = g_ascii_strtoull (fields[3], NULL, 10); fdata->modified = mktime_from_string (fields[6]); fdata->encrypted = (*fields[4] == 'B') || (*fields[4] == 'T'); @@ -135,6 +144,8 @@ list__process_line (char *line, /* Full path */ name_field = get_last_field (line, 8); + if (name_field == NULL) + name_field = ""; if (*name_field == '/') { fdata->full_path = g_strdup (name_field); diff --git a/src/fr-command.c b/src/fr-command.c index d840acf..dcbe9ad 100644 --- a/src/fr-command.c +++ b/src/fr-command.c @@ -79,7 +79,7 @@ const char *action_names[] = { "NONE", "CREATING_ARCHIVE", "SAVING_REMOTE_ARCHIVE" }; -#if MATE_ENABLE_DEBUG +#ifdef MATE_ENABLE_DEBUG const char * get_action_name (FrAction action) { return action_names[action]; @@ -608,14 +608,19 @@ fr_command_list (FrCommand *comm) fr_process_use_standard_locale (comm->process, TRUE); comm->multi_volume = FALSE; - if (! comm->fake_load) + if (! comm->fake_load) { FR_COMMAND_GET_CLASS (G_OBJECT (comm))->list (comm); - else + } else { + comm->process->error.type = FR_PROC_ERROR_NONE; + comm->process->error.status = 0; + g_clear_error (&comm->process->error.gerror); + g_signal_emit (G_OBJECT (comm), fr_command_signals[DONE], 0, comm->action, &comm->process->error); + } } void diff --git a/src/fr-command.h b/src/fr-command.h index 751b1bb..e2c0b4c 100644 --- a/src/fr-command.h +++ b/src/fr-command.h @@ -60,7 +60,7 @@ typedef enum { FR_ACTION_SAVING_REMOTE_ARCHIVE /* copying the archive to a remote location */ } FrAction; -#if MATE_ENABLE_DEBUG +#ifdef MATE_ENABLE_DEBUG const char * get_action_name (FrAction action); #endif diff --git a/src/fr-init.c b/src/fr-init.c index 256e13e..c7a876d 100644 --- a/src/fr-init.c +++ b/src/fr-init.c @@ -109,7 +109,8 @@ FrMimeTypeDescription mime_type_desc[] = { { "application/x-xz", ".xz", N_("Xz compressed file"), 0 }, { "application/x-xz-compressed-tar", ".tar.xz", N_("Tar compressed with xz"), 0 }, { "application/x-zoo", ".zoo", N_("Zoo"), 0 }, - { ZSTD_MIME_TYPE, ".zst", N_("Zstandard compressed file"), 0 }, + { "application/zstd", ".zst", N_("Zstandard compressed file"), 0 }, + { "application/x-zstd", ".zst", N_("Zstandard compressed file"), 0 }, { "application/x-zstd-compressed-tar", ".tar.zst", N_("Tar compressed with zstd"), 0 }, { "application/zip", ".zip", N_("Zip"), 0 }, { NULL, NULL, NULL, 0 } @@ -184,7 +185,7 @@ FrExtensionType file_ext_type[] = { { ".Z", "application/x-compress" }, { ".zip", "application/zip" }, { ".zoo", "application/x-zoo" }, - { ".zst", ZSTD_MIME_TYPE }, + { ".zst", "application/zstd" }, { NULL, NULL } }; @@ -291,7 +292,7 @@ fr_registered_command_get_capabilities (FrRegisteredCommand *reg_com, FrMimeTypeCap *cap; cap = g_ptr_array_index (reg_com->caps, i); - if (strcmp (mime_type, cap->mime_type) == 0) + if (is_mime_type (mime_type, cap->mime_type)) return cap->current_capabilities; } @@ -311,7 +312,7 @@ fr_registered_command_get_potential_capabilities (FrRegisteredCommand *reg_com, FrMimeTypeCap *cap; cap = g_ptr_array_index (reg_com->caps, i); - if ((cap->mime_type != NULL) && (strcmp (mime_type, cap->mime_type) == 0)) + if ((cap->mime_type != NULL) && (is_mime_type (mime_type, cap->mime_type))) return cap->potential_capabilities; } @@ -507,7 +508,7 @@ get_mime_type_index (const char *mime_type) int i; for (i = 0; mime_type_desc[i].mime_type != NULL; i++) - if (strcmp (mime_type_desc[i].mime_type, mime_type) == 0) + if (is_mime_type (mime_type_desc[i].mime_type, mime_type)) return i; return -1; } diff --git a/src/fr-process.c b/src/fr-process.c index c961485..7876190 100644 --- a/src/fr-process.c +++ b/src/fr-process.c @@ -85,22 +85,16 @@ fr_command_info_new (void) } static void -fr_command_info_free (FrCommandInfo *info) +fr_command_info_free (gpointer data) { + FrCommandInfo *info = data; + if (info == NULL) return; - if (info->args != NULL) { - g_list_free_full (info->args, g_free); - info->args = NULL; - } - - if (info->dir != NULL) { - g_free (info->dir); - info->dir = NULL; - } - - g_free (info); + g_list_free_full (info->args, g_free); + g_free (info->dir); + g_clear_pointer (&info, g_free); } static void @@ -289,7 +283,7 @@ fr_process_init (FrProcess *process) process->term_on_stop = TRUE; - process->priv->comm = g_ptr_array_new (); + process->priv->comm = g_ptr_array_new_with_free_func (fr_command_info_free); process->priv->n_comm = -1; process->priv->current_comm = -1; @@ -330,9 +324,8 @@ fr_process_finalize (GObject *object) process = FR_PROCESS (object); fr_process_stop_priv (process, FALSE); - fr_process_clear (process); - g_ptr_array_free (process->priv->comm, FALSE); + g_ptr_array_free (process->priv->comm, TRUE); fr_channel_data_free (&process->out); fr_channel_data_free (&process->err); @@ -378,9 +371,7 @@ fr_process_begin_command_at (FrProcess *process, process->priv->current_comm = index; old_c_info = g_ptr_array_index (process->priv->comm, index); - - if (old_c_info != NULL) - fr_command_info_free (old_c_info); + fr_command_info_free (old_c_info); info = fr_command_info_new (); info->args = g_list_prepend (NULL, g_strdup (arg)); @@ -561,14 +552,6 @@ fr_process_clear (FrProcess *process) g_return_if_fail (process != NULL); - for (i = 0; i <= process->priv->n_comm; i++) { - FrCommandInfo *info; - - info = g_ptr_array_index (process->priv->comm, i); - fr_command_info_free (info); - g_ptr_array_index (process->priv->comm, i) = NULL; - } - for (i = 0; i <= process->priv->n_comm; i++) g_ptr_array_remove_index_fast (process->priv->comm, 0); @@ -859,10 +842,9 @@ check_child (gpointer data) process->error.type = FR_PROC_ERROR_NONE; else if (WEXITSTATUS (status) == 255) process->error.type = FR_PROC_ERROR_COMMAND_NOT_FOUND; - else { + else process->error.type = FR_PROC_ERROR_COMMAND_ERROR; - process->error.status = WEXITSTATUS (status); - } + process->error.status = WEXITSTATUS (status); } else { process->error.type = FR_PROC_ERROR_EXITED_ABNORMALLY; diff --git a/src/fr-window.c b/src/fr-window.c index 6023336..20ca551 100644 --- a/src/fr-window.c +++ b/src/fr-window.c @@ -127,6 +127,7 @@ typedef enum { typedef struct { GList *file_list; char *extract_to_dir; + char *sub_dir; char *base_dir; gboolean skip_older; FrOverwrite overwrite; @@ -314,7 +315,10 @@ struct _FrWindowPrivateData { FrArchive *copy_from_archive; - GtkActionGroup *actions; + GActionGroup *actions; + GtkBuilder *ui_manager; + GtkWidget *menubar_recentmenu; + GtkWidget *toolbar_recentmenu; GtkWidget *file_popup_menu; GtkWidget *folder_popup_menu; @@ -382,6 +386,8 @@ struct _FrWindowPrivateData { GtkWindow *load_error_parent_window; gboolean showing_error_dialog; GtkWindow *error_dialog_parent; + + gboolean close_dialog; }; /* -- fr_window_free_private_data -- */ @@ -602,6 +608,12 @@ fr_window_free_private_data (FrWindow *window) if (window->priv->settings_caja) _g_object_unref (window->priv->settings_caja); + + if (window->priv->ui_manager) + { + g_object_unref (window->priv->ui_manager); + window->priv->ui_manager = NULL; + } } static void @@ -1592,13 +1604,13 @@ get_tree_iter_from_path (FrWindow *window, static void set_sensitive (FrWindow *window, - const char *action_name, - gboolean sensitive) + const char *id, + gboolean sensitive) { - GtkAction *action; + GtkWidget *widget; - action = gtk_action_group_get_action (window->priv->actions, action_name); - g_object_set (action, "sensitive", sensitive, NULL); + widget = (GtkWidget *)gtk_builder_get_object (window->priv->ui_manager, id); + g_object_set (widget, "sensitive", sensitive, NULL); } static void @@ -1617,10 +1629,10 @@ fr_window_update_current_location (FrWindow *window) gtk_entry_set_text (GTK_ENTRY (window->priv->location_entry), window->priv->archive_present? current_dir: ""); - set_sensitive (window, "GoBack", window->priv->archive_present && (current_dir != NULL) && (window->priv->history_current != NULL) && (window->priv->history_current->next != NULL)); - set_sensitive (window, "GoForward", window->priv->archive_present && (current_dir != NULL) && (window->priv->history_current != NULL) && (window->priv->history_current->prev != NULL)); - set_sensitive (window, "GoUp", window->priv->archive_present && (current_dir != NULL) && (strcmp (current_dir, "/") != 0)); - set_sensitive (window, "GoHome", window->priv->archive_present); + set_sensitive (window, "tool_goback_item", window->priv->archive_present && (current_dir != NULL) && (window->priv->history_current != NULL) && (window->priv->history_current->next != NULL)); + set_sensitive (window, "tool_gonext_item", window->priv->archive_present && (current_dir != NULL) && (window->priv->history_current != NULL) && (window->priv->history_current->prev != NULL)); + set_sensitive (window, "tool_goup_item", window->priv->archive_present && (current_dir != NULL) && (strcmp (current_dir, "/") != 0)); + set_sensitive (window, "tool_gohome_item", window->priv->archive_present); gtk_widget_set_sensitive (window->priv->location_entry, window->priv->archive_present); gtk_widget_set_sensitive (window->priv->location_label, window->priv->archive_present); gtk_widget_set_sensitive (window->priv->filter_entry, window->priv->archive_present); @@ -1931,10 +1943,10 @@ set_active (FrWindow *window, const char *action_name, gboolean is_active) { - GtkAction *action; + GAction *action; - action = gtk_action_group_get_action (window->priv->actions, action_name); - gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), is_active); + action = g_action_map_lookup_action (G_ACTION_MAP (window->priv->actions), action_name); + g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_boolean (is_active)); } static void @@ -1956,7 +1968,9 @@ fr_window_update_paste_command_sensitivity (FrWindow *window, ro = ! no_archive && window->archive->read_only; compr_file = ! no_archive && window->archive->is_compressed_file; - 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)); + set_sensitive (window, "paste_item", ! 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)); + set_sensitive (window, "popup_paste_item", ! 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)); + set_sensitive (window, "popup_paste_item1", ! 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)); } static void @@ -1985,36 +1999,44 @@ fr_window_update_sensitivity (FrWindow *window) one_file_selected = n_selected == 1; dir_selected = selection_has_a_dir (window); - 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); - set_sensitive (window, "Find", ! no_archive); - set_sensitive (window, "LastOutput", ((window->archive != NULL) + set_sensitive (window, "add_files_item", ! no_archive && ! ro && ! running && ! compr_file); + set_sensitive (window, "tool_add_files_item", ! no_archive && ! ro && ! running && ! compr_file); + set_sensitive (window, "add_folder_item", ! no_archive && ! ro && ! running && ! compr_file); + set_sensitive (window, "tool_add_folder_item", ! no_archive && ! ro && ! running && ! compr_file); + set_sensitive (window, "copy_item", ! no_archive && ! ro && ! running && ! compr_file && sel_not_null && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT)); + set_sensitive (window, "popup_copy_item", ! no_archive && ! ro && ! running && ! compr_file && sel_not_null && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT)); + set_sensitive (window, "popup_copy_item1", ! no_archive && ! ro && ! running && ! compr_file && sel_not_null && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT)); + set_sensitive (window, "cut_item", ! no_archive && ! ro && ! running && ! compr_file && sel_not_null && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT)); + set_sensitive (window, "popup_cut_item", ! no_archive && ! ro && ! running && ! compr_file && sel_not_null && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT)); + set_sensitive (window, "popup_cut_item1", ! no_archive && ! ro && ! running && ! compr_file && sel_not_null && (window->priv->list_mode != FR_WINDOW_LIST_MODE_FLAT)); + set_sensitive (window, "delete_item", ! no_archive && ! ro && ! window->priv->archive_new && ! running && ! compr_file); + set_sensitive (window, "popup_delete_item", ! no_archive && ! ro && ! window->priv->archive_new && ! running && ! compr_file); + set_sensitive (window, "popup_delete_item1", ! no_archive && ! ro && ! window->priv->archive_new && ! running && ! compr_file); + set_sensitive (window, "deselect_all_item", ! no_archive && sel_not_null); + set_sensitive (window, "extract_item", file_op); + set_sensitive (window, "tool_extract_item", file_op); + set_sensitive (window, "find_item", ! no_archive); + set_sensitive (window, "last_output_item", ((window->archive != NULL) && (window->archive->process != NULL) && (window->archive->process->out.raw != NULL))); - set_sensitive (window, "New", ! running); - set_sensitive (window, "Open", ! running); - set_sensitive (window, "Open_Toolbar", ! running); - set_sensitive (window, "OpenSelection", file_op && sel_not_null && ! dir_selected); - set_sensitive (window, "OpenFolder", file_op && one_file_selected && dir_selected); - set_sensitive (window, "Password", ! running && (window->priv->asked_for_password || (! no_archive && window->archive->command->propPassword))); - 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 && 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); - set_sensitive (window, "TestArchive", ! no_archive && ! running && window->archive->command->propTest); - set_sensitive (window, "ViewSelection", file_op && one_file_selected && ! dir_selected); - set_sensitive (window, "ViewSelection_Toolbar", file_op && one_file_selected && ! dir_selected); + set_sensitive (window, "new_item", ! running); + set_sensitive (window, "tool_new_item", ! running); + set_sensitive (window, "open_item", ! running); + set_sensitive (window, "popup_open_select_item", file_op && sel_not_null && ! dir_selected); + set_sensitive (window, "popup_open_item1", file_op && one_file_selected && dir_selected); + set_sensitive (window, "password_item", ! running && (window->priv->asked_for_password || (! no_archive && window->archive->command->propPassword))); + set_sensitive (window, "properties_item", file_op); + set_sensitive (window, "close_item", !running || window->priv->stoppable); + set_sensitive (window, "reload_item", ! (no_archive || running)); + set_sensitive (window, "rename_item", ! no_archive && ! ro && ! running && ! compr_file && one_file_selected); + set_sensitive (window, "popup_rename_item", ! no_archive && ! ro && ! running && ! compr_file && one_file_selected); + set_sensitive (window, "popup_rename_item1", ! no_archive && ! ro && ! running && ! compr_file && one_file_selected); + set_sensitive (window, "open_saveas_item", ! no_archive && ! compr_file && ! running); + set_sensitive (window, "select_all_item", ! no_archive); + set_sensitive (window, "stop_item", running && window->priv->stoppable); + set_sensitive (window, "tool_stop_item", running && window->priv->stoppable); + set_sensitive (window, "test_integrity_item", ! no_archive && ! running && window->archive->command->propTest); + set_sensitive (window, "popup_open_item", file_op && one_file_selected && ! dir_selected); if (window->priv->progress_dialog != NULL) gtk_dialog_set_response_sensitive (GTK_DIALOG (window->priv->progress_dialog), @@ -2023,15 +2045,15 @@ fr_window_update_sensitivity (FrWindow *window) fr_window_update_paste_command_sensitivity (window, NULL); - set_sensitive (window, "SelectAll", (window->priv->current_view_length > 0) && (window->priv->current_view_length != n_selected)); - set_sensitive (window, "DeselectAll", n_selected > 0); - set_sensitive (window, "OpenRecent", ! running); - set_sensitive (window, "OpenRecent_Toolbar", ! running); + set_sensitive (window, "select_all_item", (window->priv->current_view_length > 0) && (window->priv->current_view_length != n_selected)); + set_sensitive (window, "deselect_all_item", n_selected > 0); + set_sensitive (window, "open_recent_item", ! running); + set_sensitive (window, "tool_open_recent_item", ! running); - set_sensitive (window, "ViewFolders", (window->priv->list_mode == FR_WINDOW_LIST_MODE_AS_DIR)); + set_sensitive (window, "view_folder_item", (window->priv->list_mode == FR_WINDOW_LIST_MODE_AS_DIR)); - set_sensitive (window, "ViewAllFiles", ! window->priv->filter_mode); - set_sensitive (window, "ViewAsFolder", ! window->priv->filter_mode); + set_sensitive (window, "view_all_files_item", ! window->priv->filter_mode); + set_sensitive (window, "view_as_folder_item", ! window->priv->filter_mode); } static gboolean @@ -2110,7 +2132,7 @@ progress_dialog_delete_event (GtkWidget *caller, FrWindow *window) { if (window->priv->stoppable) { - activate_action_stop (NULL, window); + activate_action_stop (NULL, NULL, window); close_progress_dialog (window, TRUE); } @@ -2202,7 +2224,7 @@ progress_dialog_response (GtkDialog *dialog, switch (response_id) { case GTK_RESPONSE_CANCEL: if (window->priv->stoppable) { - activate_action_stop (NULL, window); + activate_action_stop (NULL, NULL, window); close_progress_dialog (window, TRUE); } break; @@ -2685,6 +2707,10 @@ open_progress_dialog_with_open_destination (FrWindow *window) display_progress_dialog (window); fr_window_progress_cb (NULL, 1.0, window); fr_window_message_cb (NULL, _("Extraction completed successfully"), window); + + if (window->priv->close_dialog) + close_progress_dialog (window, TRUE); + } static void @@ -4156,6 +4182,7 @@ file_list_drag_end (GtkWidget *widget, fr_window_archive_extract (window, window->priv->drag_file_list, window->priv->drag_destination_folder, + NULL, window->priv->drag_base_dir, FALSE, FR_OVERWRITE_ASK, @@ -4460,7 +4487,7 @@ key_press_cb (GtkWidget *widget, switch (event->keyval) { case GDK_KEY_Escape: - activate_action_stop (NULL, window); + activate_action_stop (NULL, NULL, window); if (window->priv->filter_mode) fr_window_deactivate_filter (window); retval = TRUE; @@ -4848,9 +4875,6 @@ sort_column_changed_cb (GtkTreeSortable *sortable, window->priv->sort_method = get_sort_method_from_column (column_id); window->priv->sort_type = order; - - /*set_active (window, get_action_from_sort_method (window->priv->sort_method), TRUE); - set_active (window, "SortReverseOrder", (window->priv->sort_type == GTK_SORT_DESCENDING));*/ } static gboolean @@ -4879,15 +4903,11 @@ pref_history_len_changed (GSettings *settings, { FrWindow *window = user_data; int limit; - GtkAction *action; limit = g_settings_get_int (settings, PREF_UI_HISTORY_LEN); - action = gtk_action_group_get_action (window->priv->actions, "OpenRecent"); - gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (action), limit); - - action = gtk_action_group_get_action (window->priv->actions, "OpenRecent_Toolbar"); - gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (action), limit); + gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (window->priv->menubar_recentmenu), limit); + gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (window->priv->toolbar_recentmenu), limit); } static void @@ -4896,7 +4916,6 @@ pref_view_toolbar_changed (GSettings *settings, gpointer user_data) { FrWindow *window = user_data; - fr_window_set_toolbar_visibility (window, g_settings_get_boolean (settings, key)); } @@ -4989,7 +5008,8 @@ fr_window_stoppable_cb (FrCommand *command, FrWindow *window) { window->priv->stoppable = stoppable; - set_sensitive (window, "Stop", stoppable); + set_sensitive (window, "stop_item", stoppable); + set_sensitive (window, "tool_stop_item", stoppable); if (window->priv->progress_dialog != NULL) gtk_dialog_set_response_sensitive (GTK_DIALOG (window->priv->progress_dialog), GTK_RESPONSE_OK, @@ -5048,15 +5068,11 @@ fr_window_fake_load (FrArchive *archive, static void menu_item_select_cb (GtkMenuItem *proxy, - FrWindow *window) + FrWindow *window) { - GtkAction *action; char *message; - action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (proxy)); - g_return_if_fail (action != NULL); - - g_object_get (G_OBJECT (action), "tooltip", &message, NULL); + message = gtk_widget_get_tooltip_text (GTK_WIDGET (proxy)); if (message) { gtk_statusbar_push (GTK_STATUSBAR (window->priv->statusbar), window->priv->help_message_cid, message); @@ -5066,59 +5082,22 @@ menu_item_select_cb (GtkMenuItem *proxy, static void menu_item_deselect_cb (GtkMenuItem *proxy, - FrWindow *window) + FrWindow *window) { gtk_statusbar_pop (GTK_STATUSBAR (window->priv->statusbar), window->priv->help_message_cid); } static void -disconnect_proxy_cb (GtkUIManager *manager, - GtkAction *action, - GtkWidget *proxy, - FrWindow *window) -{ - if (GTK_IS_MENU_ITEM (proxy)) { - g_signal_handlers_disconnect_by_func - (proxy, G_CALLBACK (menu_item_select_cb), window); - g_signal_handlers_disconnect_by_func - (proxy, G_CALLBACK (menu_item_deselect_cb), window); - } -} - -static void -connect_proxy_cb (GtkUIManager *manager, - GtkAction *action, - GtkWidget *proxy, - FrWindow *window) -{ - if (GTK_IS_MENU_ITEM (proxy)) { - g_signal_connect (proxy, "select", - G_CALLBACK (menu_item_select_cb), window); - g_signal_connect (proxy, "deselect", - G_CALLBACK (menu_item_deselect_cb), window); - } -} - -static void -view_as_radio_action (GtkAction *action, - GtkRadioAction *current, - gpointer data) +view_all_files_selected_toggled (GtkMenuItem *menuitem, + gpointer data) { FrWindow *window = data; - fr_window_set_list_mode (window, gtk_radio_action_get_current_value (current)); -} -static void -sort_by_radio_action (GtkAction *action, - GtkRadioAction *current, - gpointer data) -{ - FrWindow *window = data; - - window->priv->sort_method = gtk_radio_action_get_current_value (current); - window->priv->sort_type = GTK_SORT_ASCENDING; - fr_window_update_list_order (window); + if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menuitem))) + fr_window_set_list_mode (window, FR_WINDOW_LIST_MODE_FLAT); + else + fr_window_set_list_mode (window, FR_WINDOW_LIST_MODE_AS_DIR); } static void @@ -5134,31 +5113,34 @@ recent_chooser_item_activated_cb (GtkRecentChooser *chooser, } } -static void -fr_window_init_recent_chooser (FrWindow *window, - GtkRecentChooser *chooser) +static GtkWidget * +fr_window_create_recent_chooser (FrWindow *window) { - GtkRecentFilter *filter; - int i; + GtkRecentManager *manager; + GtkRecentFilter *filter; + GtkWidget *menu; + int i; - g_return_if_fail (chooser != NULL); + manager = gtk_recent_manager_get_default (); + menu = gtk_recent_chooser_menu_new_for_manager (manager); filter = gtk_recent_filter_new (); gtk_recent_filter_set_name (filter, _("All archives")); for (i = 0; open_type[i] != -1; i++) gtk_recent_filter_add_mime_type (filter, mime_type_desc[open_type[i]].mime_type); gtk_recent_filter_add_application (filter, "Engrampa"); - gtk_recent_chooser_add_filter (chooser, filter); + gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (menu), filter); - gtk_recent_chooser_set_local_only (chooser, FALSE); - gtk_recent_chooser_set_limit (chooser, g_settings_get_int (window->priv->settings_ui, PREF_UI_HISTORY_LEN)); - gtk_recent_chooser_set_show_not_found (chooser, TRUE); - gtk_recent_chooser_set_sort_type (chooser, GTK_RECENT_SORT_MRU); + gtk_recent_chooser_set_local_only (GTK_RECENT_CHOOSER (menu), FALSE); + gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (menu), g_settings_get_int (window->priv->settings_ui, PREF_UI_HISTORY_LEN)); + gtk_recent_chooser_set_show_not_found (GTK_RECENT_CHOOSER (menu), TRUE); + gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (menu), GTK_RECENT_SORT_MRU); - g_signal_connect (G_OBJECT (chooser), + g_signal_connect (G_OBJECT (menu), "item_activated", G_CALLBACK (recent_chooser_item_activated_cb), window); + return menu; } static void @@ -5255,17 +5237,6 @@ fr_window_attach (FrWindow *window, } static void -set_action_important (GtkUIManager *ui, - const char *action_name) -{ - GtkAction *action; - - action = gtk_ui_manager_get_action (ui, action_name); - g_object_set (action, "is_important", TRUE, NULL); - g_object_unref (action); -} - -static void fr_window_construct (FrWindow *window) { GtkWidget *menubar; @@ -5280,10 +5251,13 @@ fr_window_construct (FrWindow *window) GtkWidget *sidepane_title_box; GtkWidget *sidepane_title_label; GtkWidget *close_sidepane_button; + GtkWidget *menu_radio_files; + GtkWidget *menuitem; GtkTreeSelection *selection; - GtkActionGroup *actions; - GtkAction *action; - GtkUIManager *ui; + GActionGroup *actions; + GSimpleAction *action; + GtkAccelGroup *accel_group; + GtkBuilder *ui; GError *error = NULL; GSettingsSchemaSource *schema_source; GSettingsSchema *caja_schema; @@ -5670,100 +5644,85 @@ fr_window_construct (FrWindow *window) /* Build the menu and the toolbar. */ - ui = gtk_ui_manager_new (); + window->priv->ui_manager = ui = gtk_builder_new (); - window->priv->actions = actions = gtk_action_group_new ("Actions"); - - /* open recent toolbar item action */ - - action = g_object_new (GTK_TYPE_RECENT_ACTION, - "name", "OpenRecent", - /* Translators: this is the label for the "open recent file" sub-menu. */ - "label", _("Open _Recent"), - "tooltip", _("Open a recently used archive"), - "stock-id", "gtk-open", - NULL); - fr_window_init_recent_chooser (window, GTK_RECENT_CHOOSER (action)); - gtk_action_group_add_action (actions, action); - g_object_unref (action); - - /* open recent toolbar item action */ - - action = g_object_new (GTK_TYPE_RECENT_ACTION, - "name", "OpenRecent_Toolbar", - "label", _("Open"), - "tooltip", _("Open a recently used archive"), - "stock-id", "gtk-open", - "is-important", TRUE, - NULL); - fr_window_init_recent_chooser (window, GTK_RECENT_CHOOSER (action)); - g_signal_connect (action, - "activate", - G_CALLBACK (activate_action_open), - window); - gtk_action_group_add_action (actions, action); - g_object_unref (action); + window->priv->actions = actions = (GActionGroup*)g_simple_action_group_new (); /* other actions */ + g_action_map_add_action_entries (G_ACTION_MAP (actions), + action_entries, G_N_ELEMENTS (action_entries), + window); - gtk_action_group_set_translation_domain (actions, NULL); - gtk_action_group_add_actions (actions, - action_entries, - n_action_entries, - window); - gtk_action_group_add_toggle_actions (actions, - action_toggle_entries, - n_action_toggle_entries, - window); - gtk_action_group_add_radio_actions (actions, - view_as_entries, - n_view_as_entries, - window->priv->list_mode, - G_CALLBACK (view_as_radio_action), - window); - gtk_action_group_add_radio_actions (actions, - sort_by_entries, - n_sort_by_entries, - window->priv->sort_type, - G_CALLBACK (sort_by_radio_action), - window); - - g_signal_connect (ui, "connect_proxy", - G_CALLBACK (connect_proxy_cb), window); - g_signal_connect (ui, "disconnect_proxy", - G_CALLBACK (disconnect_proxy_cb), window); - - gtk_ui_manager_insert_action_group (ui, actions, 0); - gtk_window_add_accel_group (GTK_WINDOW (window), - gtk_ui_manager_get_accel_group (ui)); + accel_group = gtk_accel_group_new (); + gtk_widget_insert_action_group (GTK_WIDGET (window), "win", actions); + gtk_window_add_accel_group (GTK_WINDOW (window), accel_group); /* Add a hidden short cut Ctrl-Q for power users */ - gtk_accel_group_connect (gtk_ui_manager_get_accel_group (ui), + gtk_accel_group_connect (accel_group, GDK_KEY_q, GDK_CONTROL_MASK, 0, g_cclosure_new_swap (G_CALLBACK (fr_window_close), window, NULL)); - if (! gtk_ui_manager_add_ui_from_resource (ui, ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "menus-toolbars.ui", &error)) { + if (! gtk_builder_add_from_resource (ui, ENGRAMPA_RESOURCE_UI_PATH G_DIR_SEPARATOR_S "menus-toolbars.ui", &error)) { g_message ("building menus failed: %s", error->message); g_error_free (error); } + /*Add shortcut keys*/ + for (gulong i = 0; i < G_N_ELEMENTS (menu_keybindings); i++) + { + menuitem = (GtkWidget*)gtk_builder_get_object (ui, menu_keybindings[i].widget_id); + gtk_widget_add_accelerator (menuitem, "activate", accel_group, + menu_keybindings[i].keyval, + menu_keybindings[i].modifier, + GTK_ACCEL_VISIBLE); + } + + gtk_builder_add_callback_symbols (ui, + "menu_item_select_cb", G_CALLBACK (menu_item_select_cb), + "menu_item_deselect_cb", G_CALLBACK (menu_item_deselect_cb), + NULL); + gtk_builder_connect_signals (ui, window); + /* open recent toolbar item action */ + + window->priv->menubar_recentmenu = fr_window_create_recent_chooser (window); + menuitem = (GtkWidget *)gtk_builder_get_object (ui, "open_recent_item"); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), window->priv->menubar_recentmenu); + + /* open recent toolbar item action */ + menuitem = (GtkWidget *)gtk_builder_get_object (ui, "tool_open_recent_item"); + window->priv->toolbar_recentmenu = fr_window_create_recent_chooser (window); + gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (menuitem), window->priv->toolbar_recentmenu); + + if (window->priv->list_mode == FR_WINDOW_LIST_MODE_FLAT) + action = g_simple_action_new_stateful ("ViewAllFiles", G_VARIANT_TYPE ("s"), g_variant_new_string ("files")); + else + action = g_simple_action_new_stateful ("ViewAllFiles", G_VARIANT_TYPE ("s"), g_variant_new_string ("folder")); + + g_action_map_add_action (G_ACTION_MAP (actions), G_ACTION (action)); + g_object_unref (action); - menubar = gtk_ui_manager_get_widget (ui, "/MenuBar"); + menubar = (GtkWidget *)gtk_builder_get_object (ui, "engrampamenubar"); fr_window_attach (FR_WINDOW (window), menubar, FR_WINDOW_AREA_MENUBAR); gtk_widget_show (menubar); - window->priv->toolbar = toolbar = gtk_ui_manager_get_widget (ui, "/ToolBar"); + window->priv->toolbar = toolbar = (GtkWidget *)gtk_builder_get_object (ui, "engrampatoolbar"); gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), TRUE); gtk_style_context_add_class (gtk_widget_get_style_context (toolbar), GTK_STYLE_CLASS_PRIMARY_TOOLBAR); - set_action_important (ui, "/ToolBar/Extract_Toolbar"); /* location bar */ - window->priv->location_bar = gtk_ui_manager_get_widget (ui, "/LocationBar"); + window->priv->location_bar = (GtkWidget *)gtk_builder_get_object (ui, "locationbar"); gtk_toolbar_set_show_arrow (GTK_TOOLBAR (window->priv->location_bar), FALSE); gtk_toolbar_set_style (GTK_TOOLBAR (window->priv->location_bar), GTK_TOOLBAR_BOTH_HORIZ); gtk_style_context_add_class (gtk_widget_get_style_context (window->priv->location_bar), GTK_STYLE_CLASS_TOOLBAR); - set_action_important (ui, "/LocationBar/GoBack"); + init_engramp_menu_popup (window, ui); + + /* file list mode */ + menu_radio_files = (GtkWidget *)gtk_builder_get_object (ui, "view_all_files_item"); + g_signal_connect (G_OBJECT (menu_radio_files), + "toggled", + G_CALLBACK (view_all_files_selected_toggled), + window); /* current location */ location_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); @@ -5776,7 +5735,7 @@ fr_window_construct (FrWindow *window) gtk_entry_set_icon_from_icon_name (GTK_ENTRY (window->priv->location_entry), GTK_ENTRY_ICON_PRIMARY, "folder"); - gtk_label_set_mnemonic_widget (window->priv->location_label, + gtk_label_set_mnemonic_widget (GTK_LABEL (window->priv->location_label), window->priv->location_entry); gtk_box_pack_start (GTK_BOX (location_box), @@ -5815,9 +5774,9 @@ fr_window_construct (FrWindow *window) else gtk_widget_hide (toolbar); - window->priv->file_popup_menu = gtk_ui_manager_get_widget (ui, "/FilePopupMenu"); - window->priv->folder_popup_menu = gtk_ui_manager_get_widget (ui, "/FolderPopupMenu"); - window->priv->sidebar_folder_popup_menu = gtk_ui_manager_get_widget (ui, "/SidebarFolderPopupMenu"); + window->priv->file_popup_menu = (GtkWidget *)gtk_builder_get_object (ui, "FilePopupMenu"); + window->priv->folder_popup_menu = (GtkWidget *)gtk_builder_get_object (ui, "FolderPopupMenu"); + window->priv->sidebar_folder_popup_menu = (GtkWidget *)gtk_builder_get_object (ui, "SidebarFolderPopupMenu"); /* Create the statusbar. */ @@ -6171,8 +6130,8 @@ fr_window_archive_save_as (FrWindow *window, NULL, window->priv->convert_data.temp_dir, NULL, - TRUE, FALSE, + TRUE, FALSE, window->priv->password); fr_process_start (window->archive->process); @@ -6317,14 +6276,34 @@ fr_window_archive_add_dropped_items (FrWindow *window, window->priv->volume_size); } +static void +remove_data_free (GList *rdata) +{ + g_list_free_full(rdata, g_free); +} + void fr_window_archive_remove (FrWindow *window, GList *file_list) { + char *password; + GList *remove_list; + fr_window_clipboard_remove_file_list (window, file_list); fr_process_clear (window->archive->process); - fr_archive_remove (window->archive, file_list, window->priv->compression); + + remove_list = g_list_copy_deep (file_list, (GCopyFunc) g_strdup, NULL); + fr_window_set_current_batch_action (window, + FR_BATCH_ACTION_DELETE, + remove_list, + (GFreeFunc) remove_data_free); + + password = window->priv->password; + if (password != NULL && password[0] != '\0') + g_object_set (window->archive->command, "password", password, NULL); + + fr_archive_remove (window->archive, remove_list, window->priv->compression); fr_process_start (window->archive->process); } @@ -6333,6 +6312,7 @@ fr_window_archive_remove (FrWindow *window, static ExtractData* extract_data_new (GList *file_list, const char *extract_to_dir, + const char *sub_dir, const char *base_dir, gboolean skip_older, FrOverwrite overwrite, @@ -6341,11 +6321,21 @@ extract_data_new (GList *file_list, gboolean ask_to_open_destination) { ExtractData *edata; + int i = 1; edata = g_new0 (ExtractData, 1); edata->file_list = path_list_dup (file_list); - if (extract_to_dir != NULL) + if (sub_dir != NULL) + edata->sub_dir = g_strdup (sub_dir); + if (extract_to_dir != NULL && sub_dir == NULL) { edata->extract_to_dir = g_strdup (extract_to_dir); + } else if (extract_to_dir != NULL && sub_dir != NULL) { + edata->extract_to_dir = g_build_filename (extract_to_dir, sub_dir, NULL); + while (uri_exists (edata->extract_to_dir) && uri_is_file (edata->extract_to_dir)) { + g_free (edata->extract_to_dir); + edata->extract_to_dir = g_strdup_printf ("%s/%s_%d", extract_to_dir, sub_dir, i++); + } + } edata->skip_older = skip_older; edata->overwrite = overwrite; edata->junk_paths = junk_paths; @@ -6363,6 +6353,7 @@ extract_to_data_new (const char *extract_to_dir) return extract_data_new (NULL, extract_to_dir, NULL, + NULL, FALSE, TRUE, FALSE, @@ -6377,6 +6368,7 @@ extract_data_free (ExtractData *edata) path_list_free (edata->file_list); g_free (edata->extract_to_dir); + g_free (edata->sub_dir); g_free (edata->base_dir); g_free (edata); @@ -6427,6 +6419,34 @@ archive_is_encrypted (FrWindow *window, return encrypted; } +static gboolean +archive_extract_check_disk_space_full (GPtrArray *files, + const char *extract_to_dir) +{ + guint64 freespace; + guint64 archive_size = 0; + guint i; + + freespace = get_dest_free_space (g_filename_from_uri (extract_to_dir, NULL, NULL)); + + for (i = 0; i <files->len; i++) + { + FileData *fdata = g_ptr_array_index (files, i); + archive_size += fdata->size; + } + /* When the decompressed target file is less than 100MB, + 2 * (target file size) needs to disk space + and when it is greater than 100MB, + 100MB + (target file size) needs to disk space */ + + if (archive_size <= 1024 * 1024 * 100) + archive_size = archive_size * 2; + else + archive_size += 1024 * 1024 * 100; + + return freespace < archive_size * 2; +} + void fr_window_archive_extract_here (FrWindow *window, gboolean skip_older, @@ -6438,6 +6458,7 @@ fr_window_archive_extract_here (FrWindow *window, edata = extract_data_new (NULL, NULL, NULL, + NULL, skip_older, overwrite, junk_paths, @@ -6653,6 +6674,7 @@ void fr_window_archive_extract (FrWindow *window, GList *file_list, const char *extract_to_dir, + const char *sub_dir, const char *base_dir, gboolean skip_older, FrOverwrite overwrite, @@ -6665,6 +6687,7 @@ fr_window_archive_extract (FrWindow *window, edata = extract_data_new (file_list, extract_to_dir, + sub_dir, base_dir, skip_older, overwrite, @@ -6677,6 +6700,20 @@ fr_window_archive_extract (FrWindow *window, edata, (GFreeFunc) extract_data_free); + if (archive_extract_check_disk_space_full (window->archive->command->files, extract_to_dir)) + { + GtkWidget *d; + + d = _gtk_error_dialog_new (GTK_WINDOW (window), + GTK_DIALOG_MODAL, + NULL, + _("Insufficient remaining disk space"), + NULL); + gtk_dialog_run (GTK_DIALOG (d)); + gtk_widget_destroy(d); + return; + } + if (archive_is_encrypted (window, edata->file_list) && (window->priv->password == NULL)) { dlg_ask_password (window); return; @@ -6998,14 +7035,6 @@ fr_window_unselect_all (FrWindow *window) } void -fr_window_set_sort_type (FrWindow *window, - GtkSortType sort_type) -{ - window->priv->sort_type = sort_type; - fr_window_update_list_order (window); -} - -void fr_window_stop (FrWindow *window) { if (! window->priv->stoppable) @@ -7124,7 +7153,9 @@ fr_window_view_last_output (FrWindow *window, dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (window), - GTK_DIALOG_DESTROY_WITH_PARENT, + /* Make this dialog modal, otherwise with most WMs + * the focus can’t be regained without the mouse. */ + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, "gtk-close", GTK_RESPONSE_CLOSE, NULL); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE); @@ -7147,7 +7178,9 @@ fr_window_view_last_output (FrWindow *window, text_view = gtk_text_view_new_with_buffer (text_buffer); g_object_unref (text_buffer); gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE); - gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), FALSE); + /* Although this isn’t an editable text area, we do want the + * cursor for accessibility purposes. */ + gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), TRUE); /**/ @@ -7180,10 +7213,14 @@ fr_window_view_last_output (FrWindow *window, fr_window_view_last_output_print(text_buffer, &iter, window->archive->process->out.raw); /* Show STDERR of process */ fr_window_view_last_output_print(text_buffer, &iter, window->archive->process->err.raw); + /* place the cursor at the start */ + gtk_text_buffer_get_iter_at_offset (text_buffer, &iter, 0); + gtk_text_buffer_place_cursor(text_buffer, &iter); /**/ pref_util_restore_window_geometry (GTK_WINDOW (dialog), LAST_OUTPUT_DIALOG_NAME); + gtk_widget_grab_focus (text_view); } /* -- fr_window_rename_selection -- */ @@ -8521,6 +8558,12 @@ fr_window_exec_batch_action (FrWindow *window, fr_window_archive_add_dropped_items (window, (GList*) action->data, FALSE); break; + case FR_BATCH_ACTION_DELETE: + debug (DEBUG_INFO, "[BATCH] DELETE\n"); + + fr_window_archive_remove (window, (GList*) action->data); + break; + case FR_BATCH_ACTION_OPEN: debug (DEBUG_INFO, "[BATCH] OPEN\n"); @@ -8535,6 +8578,7 @@ fr_window_exec_batch_action (FrWindow *window, fr_window_archive_extract (window, edata->file_list, edata->extract_to_dir, + edata->sub_dir, edata->base_dir, edata->skip_older, edata->overwrite, @@ -8561,6 +8605,7 @@ fr_window_exec_batch_action (FrWindow *window, NULL, window->priv->extract_default_dir, NULL, + NULL, FALSE, FR_OVERWRITE_ASK, FALSE, @@ -8857,3 +8902,12 @@ fr_window_set_batch__add (FrWindow *window, NULL, NULL); } + +void +fr_window_set_close_dialog (FrWindow *window, + gboolean state) +{ + g_return_if_fail (window != NULL); + + window->priv->close_dialog = state; +} diff --git a/src/fr-window.h b/src/fr-window.h index 23ecaa0..dcbd018 100644 --- a/src/fr-window.h +++ b/src/fr-window.h @@ -53,6 +53,7 @@ typedef enum { FR_BATCH_ACTION_LOAD, FR_BATCH_ACTION_OPEN, FR_BATCH_ACTION_ADD, + FR_BATCH_ACTION_DELETE, FR_BATCH_ACTION_EXTRACT, FR_BATCH_ACTION_EXTRACT_HERE, FR_BATCH_ACTION_EXTRACT_INTERACT, @@ -151,6 +152,7 @@ void fr_window_archive_remove (FrWindow *window, void fr_window_archive_extract (FrWindow *window, GList *file_list, const char *extract_to_dir, + const char *sub_dir, const char *base_dir, gboolean skip_older, FrOverwrite overwrite, @@ -216,9 +218,6 @@ GtkTreeModel * void fr_window_find (FrWindow *window); void fr_window_select_all (FrWindow *window); void fr_window_unselect_all (FrWindow *window); -void fr_window_set_sort_type (FrWindow *window, - GtkSortType sort_type); - /**/ void fr_window_rename_selection (FrWindow *window, @@ -316,4 +315,6 @@ gboolean fr_window_file_list_drag_data_get (FrWindow *window, void fr_window_update_dialog_closed (FrWindow *window); +void fr_window_set_close_dialog (FrWindow *window, + gboolean state); #endif /* FR_WINDOW_H */ diff --git a/src/gio-utils.c b/src/gio-utils.c index 5f66e1f..2fd8b47 100644 --- a/src/gio-utils.c +++ b/src/gio-utils.c @@ -300,7 +300,7 @@ for_each_child_next_files_ready (GObject *source_object, } } - fec->for_each_file_func (uri, child_info, fec->user_data); + fec->for_each_file_func (uri, fec->follow_links, child_info, fec->user_data); g_free (uri); g_object_unref (f); @@ -360,9 +360,9 @@ for_each_child_start_current (ForEachChildData *fec) g_file_enumerate_children_async (fec->current, "standard::name,standard::type", - fec->follow_links ? G_FILE_QUERY_INFO_NONE : G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, + G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, G_PRIORITY_DEFAULT, - fec->cancellable, + fec->cancellable, for_each_child_ready, fec); } @@ -610,8 +610,9 @@ get_file_list_done (GError *error, static void get_file_list_for_each_file (const char *uri, - GFileInfo *info, - gpointer user_data) + gboolean follow_links, + GFileInfo *info, + gpointer user_data) { GetFileListData *gfl = user_data; @@ -621,6 +622,12 @@ get_file_list_for_each_file (const char *uri, if ((gfl->exclude_filter->pattern == NULL) || ! filter_matches (gfl->exclude_filter, uri)) gfl->files = g_list_prepend (gfl->files, g_strdup (uri)); break; + case G_FILE_TYPE_SYMBOLIC_LINK: + if (follow_links) + if (filter_matches (gfl->include_filter, uri)) + if ((gfl->exclude_filter->pattern == NULL) || ! filter_matches (gfl->exclude_filter, uri)) + gfl->files = g_list_prepend (gfl->files, g_strdup (uri)); + break; default: break; } @@ -1283,8 +1290,9 @@ g_directory_copy_list_ready (GError *error, static void g_directory_copy_for_each_file (const char *uri, - GFileInfo *info, - gpointer user_data) + gboolean follow_links, + GFileInfo *info, + gpointer user_data) { DirectoryCopyData *dcd = user_data; diff --git a/src/gio-utils.h b/src/gio-utils.h index 47add16..e8d99aa 100644 --- a/src/gio-utils.h +++ b/src/gio-utils.h @@ -38,8 +38,9 @@ typedef DirOp (*StartDirCallback) (const char *uri, GError **error, gpointer user_data); typedef void (*ForEachChildCallback) (const char *uri, - GFileInfo *info, - gpointer user_data); + gboolean follow_links, + GFileInfo *info, + gpointer user_data); typedef void (*ForEachDoneCallback) (GError *error, gpointer data); typedef void (*ListReadyCallback) (GList *files, diff --git a/src/glib-utils.c b/src/glib-utils.c index 2f9c02e..08dcb5c 100644 --- a/src/glib-utils.c +++ b/src/glib-utils.c @@ -240,7 +240,7 @@ g_utf8_strchug (char *string) c = g_utf8_get_char (scan); } - g_memmove (string, scan, strlen (scan) + 1); + memmove (string, scan, strlen (scan) + 1); return string; } @@ -363,7 +363,7 @@ eat_spaces (const char *line) { if (line == NULL) return NULL; - while ((*line == ' ') && (*line != 0)) + while (*line == ' ') line++; return line; } @@ -390,6 +390,10 @@ split_line (const char *line, fields[i] = g_strndup (scan, field_end - scan); scan = eat_spaces (field_end); } + else if (scan != NULL && i == n_fields - 1) + { + fields[i] = g_strdup (scan); + } } return fields; @@ -510,6 +514,9 @@ _g_path_get_base_name (const char *path, if (junk_paths) return _g_path_get_file_name (path); + if (base_dir == NULL) + return (path[0] == '/') ? path + 1 : path; + base_dir_len = strlen (base_dir); if (strlen (path) < base_dir_len) return NULL; @@ -284,7 +284,7 @@ fr_save_state (EggSMClient *client, GKeyFile *state, gpointer user_data) FrWindow *session = window->data; gchar *key; - key = g_strdup_printf ("archive%d", i); + key = g_strdup_printf ("archive%d", i+1); if ((session->archive == NULL) || (session->archive->file == NULL)) { g_key_file_set_string (state, "Session", key, ""); } diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..8b0ef91 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,111 @@ +# Sources + +source_files = files( + 'actions.c', + 'dlg-add-files.c', + 'dlg-add-folder.c', + 'dlg-ask-password.c', + 'dlg-batch-add.c', + 'dlg-delete.c', + 'dlg-extract.c', + 'dlg-new.c', + 'dlg-open-with.c', + 'dlg-package-installer.c', + 'dlg-password.c', + 'dlg-prop.c', + 'dlg-update.c', + 'eggfileformatchooser.c', + 'eggtreemultidnd.c', + 'file-data.c', + 'file-utils.c', + 'fr-archive.c', + 'fr-command-7z.c', + 'fr-command-ace.c', + 'fr-command-alz.c', + 'fr-command-ar.c', + 'fr-command-arj.c', + 'fr-command.c', + 'fr-command-cfile.c', + 'fr-command-cpio.c', + 'fr-command-dpkg.c', + 'fr-command-iso.c', + 'fr-command-jar.c', + 'fr-command-lha.c', + 'fr-command-lrzip.c', + 'fr-command-nomarch.c', + 'fr-command-rar.c', + 'fr-command-rpm.c', + 'fr-command-tar.c', + 'fr-command-unstuff.c', + 'fr-command-zip.c', + 'fr-command-zoo.c', + 'fr-error.c', + 'fr-init.c', + 'fr-list-model.c', + 'fr-proc-error.c', + 'fr-process.c', + 'fr-window.c', + 'gio-utils.c', + 'glib-utils.c', + 'gtk-utils.c', + 'java-utils.c', + 'main.c', + 'open-file.c', + 'preferences.c', + 'rar-utils.c' +) +if libjson_glib_dep.found() + source_files += [ 'fr-command-unarchiver.c' ] +endif + +gresource_files = gnome.compile_resources('fr-resources', 'engrampa.gresource.xml', c_name : 'fr') + +marshal_files = gnome.genmarshal('fr-marshal', prefix : 'fr_marshal', sources : 'fr-marshal.list' ) + +enum_files = gnome.mkenums_simple('fr-enum-types', + sources: [ 'typedefs.h' ] +) + +# Build targets + +executable('engrampa', + sources : [ + config_file, + source_files, + gresource_files, + marshal_files, + enum_files + ], + dependencies : [ + libm_dep, + thread_dep, + glib_dep, + gthread_dep, + gtk_dep, + mate_submodules_dep, + use_json_glib ? libjson_glib_dep : [], + use_magic ? libmagic_dep : [] + ], + include_directories : config_inc, + c_args : c_args, + install : true +) + +executable('test-server', 'test-server.c', + dependencies : [ + libm_dep, + thread_dep, + glib_dep, + gthread_dep, + gtk_dep, + use_json_glib ? libjson_glib_dep : [] + ], + include_directories : config_inc, + c_args : c_args, + install : true, + install_dir: privexecdir, +) + +# Subdirectories + +subdir('sh') diff --git a/src/preferences.h b/src/preferences.h index fe4df4d..330845e 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -61,7 +61,9 @@ #define PREF_EXTRACT_OVERWRITE "overwrite" #define PREF_EXTRACT_SKIP_NEWER "skip-newer" +#define PREF_EXTRACT_CLOSE_DIALOG "close-dialog" #define PREF_EXTRACT_RECREATE_FOLDERS "recreate-folders" +#define PREF_EXTRACT_CREATE_SUBDIR "create-subdirectory" #define PREF_ADD_CURRENT_FOLDER "current-folder" #define PREF_ADD_FILENAME "filename" diff --git a/src/sh/meson.build b/src/sh/meson.build new file mode 100644 index 0000000..5c7c45d --- /dev/null +++ b/src/sh/meson.build @@ -0,0 +1 @@ +install_data('isoinfo.sh', install_dir : privexecdir) @@ -25,243 +25,80 @@ #include "actions.h" -static GtkActionEntry action_entries[] = { - { "FileMenu", NULL, N_("_Archive"), NULL, NULL, NULL }, - { "EditMenu", NULL, N_("_Edit"), NULL, NULL, NULL }, - { "ViewMenu", NULL, N_("_View"), NULL, NULL, NULL }, - { "HelpMenu", NULL, N_("_Help"), NULL, NULL, NULL }, - { "ArrangeFilesMenu", NULL, N_("_Arrange Files"), NULL, NULL, NULL }, - - { "About", "help-about", - N_("_About"), NULL, - N_("Information about the program"), - G_CALLBACK (activate_action_about) }, - { "AddFiles", "add-files-to-archive", - N_("_Add Files…"), NULL, - N_("Add files to the archive"), - G_CALLBACK (activate_action_add_files) }, - { "AddFiles_Toolbar", "add-files-to-archive", - N_("Add Files"), NULL, - N_("Add files to the archive"), - G_CALLBACK (activate_action_add_files) }, - { "AddFolder", "add-folder-to-archive", - N_("Add a _Folder…"), NULL, - N_("Add a folder to the archive"), - G_CALLBACK (activate_action_add_folder) }, - { "AddFolder_Toolbar", "add-folder-to-archive", - N_("Add Folder"), NULL, - N_("Add a folder to the archive"), - G_CALLBACK (activate_action_add_folder) }, - { "Close", "window-close", - N_("_Close"), "<control>W", - N_("Close the current archive"), - G_CALLBACK (activate_action_close) }, - { "Contents", "help-browser", - N_("Contents"), "F1", - N_("Display the Engrampa Manual"), - G_CALLBACK (activate_action_manual) }, - - { "Copy", "edit-copy", - N_("_Copy"), "<control>C", - N_("Copy the selection"), - G_CALLBACK (activate_action_copy) }, - { "Cut", "edit-cut", - N_("Cu_t"), "<control>X", - N_("Cut the selection"), - G_CALLBACK (activate_action_cut) }, - { "Paste", "edit-paste", - N_("_Paste"), "<control>V", - N_("Paste the clipboard"), - G_CALLBACK (activate_action_paste) }, - { "Rename", NULL, - N_("_Rename…"), "F2", - N_("Rename the selection"), - G_CALLBACK (activate_action_rename) }, - { "Delete", "edit-delete", - N_("_Delete"), "Delete", - N_("Delete the selection from the archive"), - G_CALLBACK (activate_action_delete) }, - - { "CopyFolderFromSidebar", "edit-copy", - N_("_Copy"), "<control>C", - N_("Copy the selection"), - G_CALLBACK (activate_action_copy_folder_from_sidebar) }, - { "CutFolderFromSidebar", "edit-cut", - N_("Cu_t"), "<control>X", - N_("Cut the selection"), - G_CALLBACK (activate_action_cut_folder_from_sidebar) }, - { "PasteFolderFromSidebar", "edit-paste", - N_("_Paste"), "<control>V", - N_("Paste the clipboard"), - G_CALLBACK (activate_action_paste_folder_from_sidebar) }, - { "RenameFolderFromSidebar", NULL, - N_("_Rename…"), "F2", - N_("Rename the selection"), - G_CALLBACK (activate_action_rename_folder_from_sidebar) }, - { "DeleteFolderFromSidebar", "edit-delete", - N_("_Delete"), "Delete", - N_("Delete the selection from the archive"), - G_CALLBACK (activate_action_delete_folder_from_sidebar) }, - - { "DeselectAll", NULL, - N_("Dese_lect All"), "<shift><control>A", - N_("Deselect all files"), - G_CALLBACK (activate_action_deselect_all) }, - { "Extract", "extract-archive", - N_("_Extract…"), "<control>E", - N_("Extract files from the archive"), - G_CALLBACK (activate_action_extract) }, - { "ExtractFolderFromSidebar", "extract-archive", - N_("_Extract…"), NULL, - N_("Extract files from the archive"), - G_CALLBACK (activate_action_extract_folder_from_sidebar) }, - { "Extract_Toolbar", "extract-archive", - N_("Extract"), NULL, - N_("Extract files from the archive"), - G_CALLBACK (activate_action_extract) }, - { "Find", "edit-find", - N_("Find…"), "<control>F", - NULL, - G_CALLBACK (activate_action_find) }, - - { "LastOutput", NULL, - N_("_Last Output"), NULL, - N_("View the output produced by the last executed command"), - G_CALLBACK (activate_action_last_output) }, - { "New", "document-new", - N_("New…"), "<control>N", - N_("Create a new archive"), - G_CALLBACK (activate_action_new) }, - { "Open", "document-open", - N_("Open…"), "<control>O", - N_("Open archive"), - G_CALLBACK (activate_action_open) }, - { "Open_Toolbar", "document-open", - N_("_Open"), "<control>O", - N_("Open archive"), - G_CALLBACK (activate_action_open) }, - { "OpenSelection", NULL, - N_("_Open With…"), NULL, - N_("Open selected files with an application"), - G_CALLBACK (activate_action_open_with) }, - { "Password", NULL, - N_("Pass_word…"), NULL, - N_("Specify a password for this archive"), - G_CALLBACK (activate_action_password) }, - { "Properties", "document-properties", - N_("_Properties"), "<alt>Return", - N_("Show archive properties"), - G_CALLBACK (activate_action_properties) }, - { "Reload", "view-refresh", - N_("_Refresh"), "<control>R", - N_("Reload current archive"), - G_CALLBACK (activate_action_reload) }, - { "SaveAs", "document-save-as", - N_("Save As…"), NULL, - N_("Save the current archive with a different name"), - G_CALLBACK (activate_action_save_as) }, - { "SelectAll", "edit-select-all", - N_("Select _All"), "<control>A", - N_("Select all files"), - G_CALLBACK (activate_action_select_all) }, - { "Stop", "process-stop", - N_("_Stop"), "Escape", - N_("Stop current operation"), - G_CALLBACK (activate_action_stop) }, - { "TestArchive", NULL, - N_("_Test Integrity"), NULL, - N_("Test whether the archive contains errors"), - G_CALLBACK (activate_action_test_archive) }, - { "ViewSelection", "document-open", - N_("_Open"), "<control>O", - N_("Open the selected file"), - G_CALLBACK (activate_action_view_or_open) }, - { "ViewSelection_Toolbar", "document-open", - N_("_Open"), "<control>O", - N_("Open the selected file"), - G_CALLBACK (activate_action_view_or_open) }, - { "OpenFolder", "document-open", - N_("_Open"), "<control>O", - N_("Open the selected folder"), - G_CALLBACK (activate_action_open_folder) }, - { "OpenFolderFromSidebar", "document-open", - N_("_Open"), "<control>O", - N_("Open the selected folder"), - G_CALLBACK (activate_action_open_folder_from_sidebar) }, - - { "GoBack", "go-previous", - NULL, NULL, - N_("Go to the previous visited location"), - G_CALLBACK (activate_action_go_back) }, - { "GoForward", "go-next", - NULL, NULL, - N_("Go to the next visited location"), - G_CALLBACK (activate_action_go_forward) }, - { "GoUp", "go-up", - NULL, NULL, - N_("Go up one level"), - G_CALLBACK (activate_action_go_up) }, - { "GoHome", "go-home", - NULL, NULL, - /* Translators: the home location is the home folder. */ - N_("Go to the home location"), - G_CALLBACK (activate_action_go_home) }, -}; -static guint n_action_entries = G_N_ELEMENTS (action_entries); - -static GtkToggleActionEntry action_toggle_entries[] = { - { "ViewToolbar", NULL, - N_("_Toolbar"), NULL, - N_("View the main toolbar"), - G_CALLBACK (activate_action_view_toolbar), - TRUE }, - { "ViewStatusbar", NULL, - N_("Stat_usbar"), NULL, - N_("View the statusbar"), - G_CALLBACK (activate_action_view_statusbar), - TRUE }, - { "SortReverseOrder", NULL, - N_("_Reversed Order"), NULL, - N_("Reverse the list order"), - G_CALLBACK (activate_action_sort_reverse_order), - FALSE }, - { "ViewFolders", NULL, - N_("_Folders"), "F9", - N_("View the folders pane"), - G_CALLBACK (activate_action_view_folders), - FALSE }, -}; -static guint n_action_toggle_entries = G_N_ELEMENTS (action_toggle_entries); - -static GtkRadioActionEntry view_as_entries[] = { - { "ViewAllFiles", NULL, - N_("View All _Files"), "<control>1", - " ", FR_WINDOW_LIST_MODE_FLAT }, - { "ViewAsFolder", NULL, - N_("View as a F_older"), "<control>2", - " ", FR_WINDOW_LIST_MODE_AS_DIR }, +static GActionEntry action_entries[] = { + /* FileMenu */ + { "New", activate_action_new, NULL, NULL, NULL, { 0 } }, + { "Open", activate_action_open, NULL, NULL, NULL, { 0 } }, + { "SaveAs", activate_action_save_as, NULL, NULL, NULL, { 0 } }, + { "Extract", activate_action_extract, NULL, NULL, NULL, { 0 } }, + { "TestArchive", activate_action_test_archive, NULL, NULL, NULL, { 0 } }, + { "Properties", activate_action_properties, NULL, NULL, NULL, { 0 } }, + { "Close", activate_action_close, NULL, NULL, NULL, { 0 } }, + /* EditMenu */ + { "Copy", activate_action_copy, NULL, NULL, NULL, { 0 } }, + { "Cut", activate_action_cut, NULL, NULL, NULL, { 0 } }, + { "Paste", activate_action_paste, NULL, NULL, NULL, { 0 } }, + { "Rename", activate_action_rename, NULL, NULL, NULL, { 0 } }, + { "Delete", activate_action_delete, NULL, NULL, NULL, { 0 } }, + { "SelectAll", activate_action_select_all, NULL, NULL, NULL, { 0 } }, + { "DeselectAll", activate_action_deselect_all, NULL, NULL, NULL, { 0 } }, + { "Find", activate_action_find, NULL, NULL, NULL, { 0 } }, + { "AddFiles", activate_action_add_files, NULL, NULL, NULL, { 0 } }, + { "AddFolder", activate_action_add_folder, NULL, NULL, NULL, { 0 } }, + { "Password", activate_action_password, NULL, NULL, NULL, { 0 } }, + /* ViewMenu */ + { "ViewToolbar", activate_toggle, NULL, "true", activate_action_view_toolbar, { 0 } }, + { "ViewStatusbar", activate_toggle, NULL, "true", activate_action_view_statusbar, { 0 } }, + { "ViewFolders", activate_toggle, NULL, "false", activate_action_view_folders, { 0 } }, + { "LastOutput", activate_action_last_output, NULL, NULL, NULL, { 0 } }, + { "Stop", activate_action_stop, NULL, NULL, NULL, { 0 } }, + { "Reload", activate_action_reload, NULL, NULL, NULL, { 0 } }, + /* HelpMenu */ + { "About", activate_action_about, NULL, NULL, NULL, { 0 } }, + { "Contents", activate_action_manual, NULL, NULL, NULL, { 0 } }, + /* Toolbar */ + { "OpenRecent_Toolbar", activate_action_open, NULL, NULL, NULL, { 0 } }, + { "ExtractToolbar", activate_action_extract, NULL, NULL, NULL, { 0 } }, + { "AddFilesToolbar", activate_action_add_files, NULL, NULL, NULL, { 0 } }, + { "AddFolderToolbar", activate_action_add_folder, NULL, NULL, NULL, { 0 } }, + /* LocationBar*/ + { "GoBack", activate_action_go_back, NULL, NULL, NULL, { 0 } }, + { "GoForward", activate_action_go_forward, NULL, NULL, NULL, { 0 } }, + { "GoUp", activate_action_go_up, NULL, NULL, NULL, { 0 } }, + { "GoHome", activate_action_go_home, NULL, NULL, NULL, { 0 } }, }; -static guint n_view_as_entries = G_N_ELEMENTS (view_as_entries); -static GtkRadioActionEntry sort_by_entries[] = { - { "SortByName", NULL, - N_("by _Name"), NULL, - N_("Sort file list by name"), FR_WINDOW_SORT_BY_NAME }, - { "SortBySize", NULL, - N_("by _Size"), NULL, - N_("Sort file list by file size"), FR_WINDOW_SORT_BY_SIZE }, - { "SortByType", NULL, - N_("by T_ype"), NULL, - N_("Sort file list by type"), FR_WINDOW_SORT_BY_TYPE }, - { "SortByDate", NULL, - N_("by _Date Modified"), NULL, - N_("Sort file list by modification time"), FR_WINDOW_SORT_BY_TIME }, - { "SortByLocation", NULL, - /* Translators: this is the "sort by file location" menu item */ - N_("by _Location"), NULL, - /* Translators: location is the file location */ - N_("Sort file list by location"), FR_WINDOW_SORT_BY_PATH }, +static const struct { + guint keyval; + GdkModifierType modifier; + const gchar *widget_id; +} menu_keybindings [] = { + { GDK_KEY_N, GDK_CONTROL_MASK, "new_item"}, + { GDK_KEY_O, GDK_CONTROL_MASK, "open_item"}, + { GDK_KEY_O, GDK_CONTROL_MASK, "open_recent_item"}, + { GDK_KEY_E, GDK_CONTROL_MASK, "extract_item"}, + { GDK_KEY_Return, GDK_MOD1_MASK, "properties_item"}, + { GDK_KEY_W, GDK_CONTROL_MASK, "close_item"}, + { GDK_KEY_X, GDK_CONTROL_MASK, "cut_item"}, + { GDK_KEY_C, GDK_CONTROL_MASK, "copy_item"}, + { GDK_KEY_V, GDK_CONTROL_MASK, "paste_item"}, + { GDK_KEY_F2, 0, "rename_item"}, + { GDK_KEY_Delete, 0, "delete_item"}, + { GDK_KEY_A, GDK_CONTROL_MASK, "select_all_item"}, + { GDK_KEY_A, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "deselect_all_item"}, + { GDK_KEY_F, GDK_CONTROL_MASK, "find_item"}, + { GDK_KEY_F9, 0, "view_folder_item"}, + { GDK_KEY_1, GDK_CONTROL_MASK, "view_all_files_item"}, + { GDK_KEY_2, GDK_CONTROL_MASK, "view_as_folder_item"}, + { GDK_KEY_Escape, 0, "stop_item"}, + { GDK_KEY_R, GDK_CONTROL_MASK, "reload_item"}, + { GDK_KEY_F1, 0, "help_item"}, + { GDK_KEY_O, GDK_CONTROL_MASK, "popup_open_item2"}, + { GDK_KEY_X, GDK_CONTROL_MASK, "popup_cut_item2"}, + { GDK_KEY_C, GDK_CONTROL_MASK, "popup_copy_item2"}, + { GDK_KEY_V, GDK_CONTROL_MASK, "popup_paste_item2"}, + { GDK_KEY_F2, 0, "popup_rename_item2"}, + { GDK_KEY_Delete, 0, "popup_delete_item2"}, }; -static guint n_sort_by_entries = G_N_ELEMENTS (sort_by_entries); #endif /* UI_H */ diff --git a/src/ui/Makefile.am b/src/ui/Makefile.am index db123ae..95b9d51 100644 --- a/src/ui/Makefile.am +++ b/src/ui/Makefile.am @@ -1,6 +1,5 @@ EXTRA_DIST = \ add-options.ui \ - app-menu.ui \ batch-add-files.ui \ batch-password.ui \ delete.ui \ diff --git a/src/ui/app-menu.ui b/src/ui/app-menu.ui deleted file mode 100644 index 11428d5..0000000 --- a/src/ui/app-menu.ui +++ /dev/null @@ -1,18 +0,0 @@ -<interface> - <menu id="app-menu"> - <section> - <item> - <attribute name="action">app.help</attribute> - <attribute name="label" translatable="yes">_Help</attribute> - </item> - <item> - <attribute name="action">app.about</attribute> - <attribute name="label" translatable="yes">_About Archive Manager</attribute> - </item> - <item> - <attribute name="action">app.quit</attribute> - <attribute name="label" translatable="yes">_Quit</attribute> - </item> - </section> - </menu> -</interface> diff --git a/src/ui/dlg-extract.ui b/src/ui/dlg-extract.ui index 3a44384..e842512 100644 --- a/src/ui/dlg-extract.ui +++ b/src/ui/dlg-extract.ui @@ -288,6 +288,38 @@ <property name="position">2</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="close_dialog_checkbutton"> + <property name="label" translatable="yes">close dialog after decompression</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="halign">start</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="create_subdir_checkbutton"> + <property name="label" translatable="yes">Extract to s_ubdirectory</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="halign">start</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> </object> </child> </object> diff --git a/src/ui/menus-toolbars.ui b/src/ui/menus-toolbars.ui index b6b68ed..9c81d39 100644 --- a/src/ui/menus-toolbars.ui +++ b/src/ui/menus-toolbars.ui @@ -1,106 +1,973 @@ -<ui> - <menubar name="MenuBar"> - <menu name="Archive" action="FileMenu"> - <menuitem action="New"/> - <menuitem action="Open"/> - <menuitem action="OpenRecent"/> - <menuitem action="SaveAs"/> - <separator/> - <menuitem action="Extract"/> - <menuitem action="TestArchive"/> - <separator/> - <menuitem action="Properties"/> - <separator/> - <menuitem action="Close"/> - </menu> - <menu action="EditMenu"> - <menuitem action="Cut"/> - <menuitem action="Copy"/> - <menuitem action="Paste"/> - <menuitem action="Rename"/> - <menuitem action="Delete"/> - <separator/> - <menuitem action="SelectAll"/> - <menuitem action="DeselectAll"/> - <separator/> - <menuitem action="Find"/> - <separator/> - <menuitem action="AddFiles"/> - <menuitem action="AddFolder"/> - <separator/> - <menuitem action="Password"/> - </menu> - <menu action="ViewMenu"> - <menuitem action="ViewToolbar"/> - <menuitem action="ViewStatusbar"/> - <menuitem action="ViewFolders"/> - <separator/> - <menuitem action="ViewAllFiles"/> - <menuitem action="ViewAsFolder"/> - <separator/> - <menuitem action="LastOutput"/> - <separator/> - <menuitem action="Stop"/> - <menuitem action="Reload"/> - </menu> - <menu action="HelpMenu"> - <menuitem action="Contents"/> - <menuitem action="About"/> - </menu> - </menubar> - <toolbar name="ToolBar"> - <toolitem action="New"/> - <toolitem action="OpenRecent_Toolbar"/> - <separator/> - <toolitem action="Extract_Toolbar"/> - <separator/> - <toolitem action="AddFiles_Toolbar"/> - <toolitem action="AddFolder_Toolbar"/> - <separator/> - <toolitem action="Stop"/> - </toolbar> - <toolbar name="LocationBar"> - <toolitem action="GoBack"/> - <toolitem action="GoForward"/> - <toolitem action="GoUp"/> - <toolitem action="GoHome"/> - </toolbar> - <popup name="FilePopupMenu"> - <menuitem action="ViewSelection"/> - <menuitem action="OpenSelection"/> - <separator/> - <menuitem action="Extract"/> - <separator/> - <menuitem action="Cut"/> - <menuitem action="Copy"/> - <menuitem action="Paste"/> - <menuitem action="Rename"/> - <menuitem action="Delete"/> - </popup> - <popup name="FolderPopupMenu"> - <menuitem action="OpenFolder"/> - <separator/> - <menuitem action="Extract"/> - <separator/> - <menuitem action="Cut"/> - <menuitem action="Copy"/> - <menuitem action="Paste"/> - <menuitem action="Rename"/> - <menuitem action="Delete"/> - </popup> - <popup name="AddMenu"> - <menuitem action="AddFiles"/> - <menuitem action="AddFolder"/> - </popup> - <popup name="SidebarFolderPopupMenu"> - <menuitem action="OpenFolderFromSidebar"/> - <separator/> - <menuitem action="ExtractFolderFromSidebar"/> - <separator/> - <menuitem action="CutFolderFromSidebar"/> - <menuitem action="CopyFolderFromSidebar"/> - <menuitem action="PasteFolderFromSidebar"/> - <menuitem action="RenameFolderFromSidebar"/> - <menuitem action="DeleteFolderFromSidebar"/> - </popup> -</ui> +<interface> + <object class="GtkImage" id="menu_icon_new"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">document-new</property> + </object> + <object class="GtkImage" id="menu_icon_open"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">document-open</property> + </object> + <object class="GtkImage" id="menu_icon_open1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">document-open</property> + </object> + <object class="GtkImage" id="menu_icon_open2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">document-open</property> + </object> + <object class="GtkImage" id="menu_icon_open3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">document-open</property> + </object> + <object class="GtkImage" id="menu_icon_open_recent"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">gtk-open</property> + </object> + <object class="GtkImage" id="menu_icon_save_as"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">document-save-as</property> + </object> + <object class="GtkImage" id="menu_icon_extract"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">extract-archive</property> + </object> + <object class="GtkImage" id="menu_icon_extract1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">extract-archive</property> + </object> + <object class="GtkImage" id="menu_icon_extract2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">extract-archive</property> + </object> + <object class="GtkImage" id="menu_icon_extract3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">extract-archive</property> + </object> + <object class="GtkImage" id="menu_icon_properties"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">document-properties</property> + </object> + <object class="GtkImage" id="menu_icon_close"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">window-close</property> + </object> + <object class="GtkImage" id="menu_icon_copy"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">edit-copy</property> + </object> + <object class="GtkImage" id="menu_icon_copy1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">edit-copy</property> + </object> + <object class="GtkImage" id="menu_icon_copy2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">edit-copy</property> + </object> + <object class="GtkImage" id="menu_icon_copy3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">edit-copy</property> + </object> + <object class="GtkImage" id="menu_icon_cut"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">edit-cut</property> + </object> + <object class="GtkImage" id="menu_icon_cut1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">edit-cut</property> + </object> + <object class="GtkImage" id="menu_icon_cut2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">edit-cut</property> + </object> + <object class="GtkImage" id="menu_icon_cut3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">edit-cut</property> + </object> + <object class="GtkImage" id="menu_icon_paste"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">edit-paste</property> + </object> + <object class="GtkImage" id="menu_icon_paste1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">edit-paste</property> + </object> + <object class="GtkImage" id="menu_icon_paste2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">edit-paste</property> + </object> + <object class="GtkImage" id="menu_icon_paste3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">edit-paste</property> + </object> + <object class="GtkImage" id="menu_icon_delete"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">edit-delete</property> + </object> + <object class="GtkImage" id="menu_icon_delete1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">edit-delete</property> + </object> + <object class="GtkImage" id="menu_icon_delete2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">edit-delete</property> + </object> + <object class="GtkImage" id="menu_icon_delete3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">edit-delete</property> + </object> + <object class="GtkImage" id="menu_icon_select_all"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">edit-select-all</property> + </object> + <object class="GtkImage" id="menu_icon_find"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">edit-find</property> + </object> + <object class="GtkImage" id="menu_icon_add_files"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">add-files-to-archive</property> + </object> + <object class="GtkImage" id="menu_icon_add_folder"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">add-folder-to-archive</property> + </object> + <object class="GtkImage" id="menu_icon_stop"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">process-stop</property> + </object> + <object class="GtkImage" id="menu_icon_reload"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">view-refresh</property> + </object> + <object class="GtkImage" id="menu_icon_help"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">help-browser</property> + </object> + <object class="GtkImage" id="menu_icon_about"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon-name">help-about</property> + </object> + + <object class="GtkMenuBar" id="engrampamenubar"> + <property name="visible">1</property> + <child internal-child="accessible"> + <object class="AtkObject" id="a11y-menubar"> + <property name="AtkObject::accessible-name">The menubar</property> + </object> + </child> + <child> + <object class="GtkMenuItem"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Archive</property> + <property name="use-underline">1</property> + <child type="submenu"> + <object class="GtkMenu" id="file_menu"> + <child> + <object class="GtkImageMenuItem" id="new_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">New…</property> + <property name="tooltip-text" translatable="yes">Create a new archive</property> + <property name="use-underline">1</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + <property name="image">menu_icon_new</property> + <property name="action-name">win.New</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="open_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">Open…</property> + <property name="tooltip-text" translatable="yes">Open archive</property> + <property name="use-underline">1</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + <property name="image">menu_icon_open</property> + <property name="action-name">win.Open</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="open_recent_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">Open _Recent</property> + <property name="tooltip-text" translatable="yes">Open a recently used archive</property> + <property name="use-underline">1</property> + <property name="image">menu_icon_open_recent</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="open_saveas_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">Save As…</property> + <property name="tooltip-text" translatable="yes">Save the current archive with a different name</property> + <property name="use-underline">1</property> + <property name="image">menu_icon_save_as</property> + <property name="action-name">win.SaveAs</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem"> + <property name="visible">1</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="extract_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Extract…</property> + <property name="tooltip-text" translatable="yes">Extract files from the archive</property> + <property name="use-underline">1</property> + <property name="image">menu_icon_extract</property> + <property name="action-name">win.Extract</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkMenuItem" id="test_integrity_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Test Integrity</property> + <property name="tooltip-text" translatable="yes">Test whether the archive contains errors</property> + <property name="use-underline">1</property> + <property name="action-name">win.TestArchive</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem"> + <property name="visible">1</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="properties_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Properties</property> + <property name="tooltip-text" translatable="yes">Show archive properties</property> + <property name="use-underline">1</property> + <property name="image">menu_icon_properties</property> + <property name="action-name">win.Properties</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem"> + <property name="visible">1</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="close_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Close</property> + <property name="tooltip-text" translatable="yes">Close the current archive</property> + <property name="use-underline">1</property> + <property name="image">menu_icon_close</property> + <property name="action-name">win.Close</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + </object> + </child> + </object> + </child> + <child> + <object class="GtkMenuItem"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Edit</property> + <property name="use-underline">1</property> + <child type="submenu"> + <object class="GtkMenu"> + <child> + <object class="GtkImageMenuItem" id="copy_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Copy</property> + <property name="tooltip-text" translatable="yes">Copy the selection</property> + <property name="use-underline">1</property> + <property name="image">menu_icon_copy</property> + <property name="action-name">win.Copy</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="cut_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">Cu_t</property> + <property name="tooltip-text" translatable="yes">Cut the selection</property> + <property name="use-underline">1</property> + <property name="image">menu_icon_cut</property> + <property name="action-name">win.Cut</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="paste_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Paste</property> + <property name="tooltip-text" translatable="yes">Paste the clipboard</property> + <property name="use-underline">1</property> + <property name="image">menu_icon_paste</property> + <property name="action-name">win.Paste</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkMenuItem" id="rename_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Rename…</property> + <property name="tooltip-text" translatable="yes">Rename the selection</property> + <property name="use-underline">1</property> + <property name="action-name">win.Rename</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="delete_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Delete</property> + <property name="tooltip-text" translatable="yes">Delete the selection from the archive</property> + <property name="use-underline">1</property> + <property name="image">menu_icon_delete</property> + <property name="action-name">win.Delete</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem"> + <property name="visible">1</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="select_all_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">Select _All</property> + <property name="tooltip-text" translatable="yes">Select all files</property> + <property name="use-underline">1</property> + <property name="image">menu_icon_select_all</property> + <property name="action-name">win.SelectAll</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkMenuItem" id="deselect_all_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">Dese_lect All</property> + <property name="tooltip-text" translatable="yes">Deselect all files</property> + <property name="use-underline">1</property> + <property name="action-name">win.DeselectAll</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem"> + <property name="visible">1</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="find_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">Find…</property> + <property name="use-underline">1</property> + <property name="image">menu_icon_find</property> + <property name="action-name">win.Find</property> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem"> + <property name="visible">1</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="add_files_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Add Files…</property> + <property name="tooltip-text" translatable="yes">Add files to the archive</property> + <property name="use-underline">1</property> + <property name="image">menu_icon_add_files</property> + <property name="action-name">win.AddFiles</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="add_folder_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">Add a _Folder…</property> + <property name="tooltip-text" translatable="yes">Add a folder to the archive</property> + <property name="use-underline">1</property> + <property name="image">menu_icon_add_folder</property> + <property name="action-name">win.AddFolder</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem"> + <property name="visible">1</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="password_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">Pass_word…</property> + <property name="tooltip-text" translatable="yes">Specify a password for this archive</property> + <property name="use-underline">1</property> + <property name="action-name">win.Password</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + </object> + </child> + </object> + </child> + <child> + <object class="GtkMenuItem"> + <property name="visible">1</property> + <property name="label" translatable="yes">_View</property> + <property name="use-underline">1</property> + <child type="submenu"> + <object class="GtkMenu"> + <child> + <object class="GtkCheckMenuItem" id="toolbar_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Toolbar</property> + <property name="tooltip-text" translatable="yes">View the main toolbar</property> + <property name="use-underline">1</property> + <property name="action-name">win.ViewToolbar</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkCheckMenuItem" id="status_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">Stat_usbar</property> + <property name="tooltip-text" translatable="yes">View the statusbar</property> + <property name="use-underline">1</property> + <property name="action-name">win.ViewStatusbar</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkCheckMenuItem" id="view_folder_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Folders</property> + <property name="tooltip-text" translatable="yes">View the folders pane</property> + <property name="use-underline">1</property> + <property name="action-name">win.ViewFolders</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem"> + <property name="visible">1</property> + <property name="use_action_appearance">0</property> + </object> + </child> + <child> + <object class="GtkRadioMenuItem" id="view_all_files_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">View All _Files</property> + <property name="active">True</property> + <property name="use-underline">1</property> + <property name="action-name">win.ViewAllFiles</property> + <property name="action-target">'files'</property> + </object> + </child> + <child> + <object class="GtkRadioMenuItem" id="view_as_folder_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">View as a F_older</property> + <property name="use-underline">1</property> + <property name="group">view_all_files_item</property> + <property name="active">True</property> + <property name="action-name">win.ViewAllFiles</property> + <property name="action-target">'folder'</property> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem"> + <property name="visible">1</property> + <property name="use_action_appearance">0</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="last_output_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Last Output</property> + <property name="tooltip-text" translatable="yes">View the output produced by the last executed command</property> + <property name="use-underline">1</property> + <property name="action-name">win.LastOutput</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem"> + <property name="visible">1</property> + <property name="use_action_appearance">0</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="stop_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Stop</property> + <property name="tooltip-text" translatable="yes">Stop current operation</property> + <property name="use-underline">1</property> + <property name="image">menu_icon_stop</property> + <property name="action-name">win.Stop</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="reload_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Refresh</property> + <property name="tooltip-text" translatable="yes">Reload current archive</property> + <property name="use-underline">1</property> + <property name="image">menu_icon_reload</property> + <property name="action-name">win.Reload</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + </object> + </child> + </object> + </child> + <child> + <object class="GtkMenuItem"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Help</property> + <property name="use-underline">1</property> + <child type="submenu"> + <object class="GtkMenu"> + <child> + <object class="GtkImageMenuItem" id="help_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">Contents</property> + <property name="tooltip-text" translatable="yes">Dis_play the Engrampa Manual</property> + <property name="use-underline">1</property> + <property name="image">menu_icon_help</property> + <property name="action-name">win.Contents</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="about_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_About</property> + <property name="tooltip-text" translatable="yes">Information about the program</property> + <property name="use-underline">1</property> + <property name="image">menu_icon_about</property> + <property name="action-name">win.About</property> + <signal name="select" handler="menu_item_select_cb" swapped="no"/> + <signal name="deselect" handler="menu_item_deselect_cb" swapped="no"/> + </object> + </child> + </object> + </child> + </object> + </child> +</object> + <object class="GtkToolbar" id="engrampatoolbar"> + <property name="visible">1</property> + <child internal-child="accessible"> + <object class="AtkObject" id="a11y-toolbar"> + <property name="AtkObject::accessible-name">The Toolbar</property> + </object> + </child> + <child> + <object class="GtkToolButton" id="tool_new_item"> + <property name="visible">1</property> + <property name="icon-name">document-new</property> + <property name="action-name">win.New</property> + </object> + </child> + <child> + <object class="GtkMenuToolButton" id="tool_open_recent_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">Open</property> + <property name="icon-name">document-open</property> + <property name="is-important">1</property> + <property name="tooltip-text" translatable="yes">Open a recently used archive</property> + <property name="action-name">win.OpenRecent_Toolbar</property> + </object> + </child> + <child> + <object class="GtkSeparatorToolItem"> + <property name="visible">1</property> + </object> + </child> + <child> + <object class="GtkToolButton" id="tool_extract_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">Extract</property> + <property name="icon-name">extract-archive</property> + <property name="tooltip-text" translatable="yes">Extract files from the archive</property> + <property name="action-name">win.ExtractToolbar</property> + </object> + </child> + <child> + <object class="GtkSeparatorToolItem"> + <property name="visible">1</property> + </object> + </child> + <child> + <object class="GtkToolButton" id="tool_add_files_item"> + <property name="visible">1</property> + <property name="icon-name">add-files-to-archive</property> + <property name="tooltip-text" translatable="yes">Add files to the archive</property> + <property name="action-name">win.AddFilesToolbar</property> + </object> + </child> + <child> + <object class="GtkToolButton" id="tool_add_folder_item"> + <property name="visible">1</property> + <property name="icon-name">add-folder-to-archive</property> + <property name="tooltip-text" translatable="yes">Add a folder to the archive</property> + <property name="action-name">win.AddFolderToolbar</property> + </object> + </child> + <child> + <object class="GtkSeparatorToolItem"> + <property name="visible">1</property> + </object> + </child> + <child> + <object class="GtkToolButton" id="tool_stop_item"> + <property name="visible">1</property> + <property name="icon-name">process-stop</property> + <property name="tooltip-text" translatable="yes">Stop current operation</property> + <property name="action-name">win.Stop</property> + </object> + </child> + </object> + <object class="GtkToolbar" id="locationbar"> + <property name="visible">1</property> + <child internal-child="accessible"> + <object class="AtkObject" id="location-toolbar"> + <property name="AtkObject::accessible-name">The Location Toolbar</property> + </object> + </child> + <child> + <object class="GtkToolButton" id="tool_goback_item"> + <property name="visible">1</property> + <property name="icon-name">go-previous</property> + <property name="tooltip-text" translatable="yes">Go to the previous visited location</property> + <property name="action-name">win.GoBack</property> + </object> + </child> + <child> + <object class="GtkToolButton" id="tool_gonext_item"> + <property name="visible">1</property> + <property name="icon-name">go-next</property> + <property name="tooltip-text" translatable="yes">Go to the next visited location</property> + <property name="action-name">win.GoForward</property> + </object> + </child> + <child> + <object class="GtkToolButton" id="tool_goup_item"> + <property name="visible">1</property> + <property name="icon-name">go-up</property> + <property name="tooltip-text" translatable="yes">Go up one level</property> + <property name="action-name">win.GoUp</property> + </object> + </child> + <child> + <object class="GtkToolButton" id="tool_gohome_item"> + <property name="visible">1</property> + <property name="icon-name">go-home</property> + <property name="tooltip-text" translatable="yes">Go to the home location</property> + <property name="action-name">win.GoHome</property> + </object> + </child> + </object> + + <object class="GtkMenu" id="FilePopupMenu"> + <property name="visible">1</property> + <child> + <object class="GtkImageMenuItem" id="popup_open_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Open</property> + <property name="tooltip-text" translatable="yes">Open the selected file</property> + <property name="use_underline">1</property> + <property name="image">menu_icon_open1</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="popup_open_select_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Open With…</property> + <property name="tooltip-text" translatable="yes">Open selected files with an application</property> + <property name="use_underline">1</property> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem"> + <property name="visible">1</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="popup_extract_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Extract…</property> + <property name="tooltip-text" translatable="yes">Extract files from the archive</property> + <property name="use_underline">1</property> + <property name="image">menu_icon_extract1</property> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem"> + <property name="visible">1</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="popup_cut_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">Cu_t</property> + <property name="tooltip-text" translatable="yes">Cut the selection</property> + <property name="use_underline">1</property> + <property name="image">menu_icon_cut1</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="popup_copy_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Copy</property> + <property name="tooltip-text" translatable="yes">Copy the selection</property> + <property name="use_underline">1</property> + <property name="image">menu_icon_copy1</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="popup_paste_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Paste</property> + <property name="tooltip-text" translatable="yes">Paste the clipboard</property> + <property name="use_underline">1</property> + <property name="image">menu_icon_paste1</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="popup_rename_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Rename…</property> + <property name="tooltip-text" translatable="yes">Rename the selection</property> + <property name="use_underline">1</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="popup_delete_item"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Delete</property> + <property name="tooltip-text" translatable="yes">Delete the selection from the archive</property> + <property name="use_underline">1</property> + <property name="image">menu_icon_delete1</property> + </object> + </child> +</object> + <object class="GtkMenu" id="FolderPopupMenu"> + <property name="visible">1</property> + <child> + <object class="GtkImageMenuItem" id="popup_open_item1"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Open</property> + <property name="tooltip-text" translatable="yes">Open the selected folder</property> + <property name="use_underline">1</property> + <property name="image">menu_icon_open2</property> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem"> + <property name="visible">1</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="popup_extract_item1"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Extract…</property> + <property name="tooltip-text" translatable="yes">Extract folder from the archive</property> + <property name="use_underline">1</property> + <property name="image">menu_icon_extract2</property> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem"> + <property name="visible">1</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="popup_cut_item1"> + <property name="visible">1</property> + <property name="label" translatable="yes">Cu_t</property> + <property name="tooltip-text" translatable="yes">Cut the selection</property> + <property name="use_underline">1</property> + <property name="image">menu_icon_cut2</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="popup_copy_item1"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Copy</property> + <property name="tooltip-text" translatable="yes">Copy the selection</property> + <property name="use_underline">1</property> + <property name="image">menu_icon_copy2</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="popup_paste_item1"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Paste</property> + <property name="tooltip-text" translatable="yes">Paste the clipboard</property> + <property name="use_underline">1</property> + <property name="image">menu_icon_paste2</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="popup_rename_item1"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Rename…</property> + <property name="tooltip-text" translatable="yes">Rename the selection</property> + <property name="use_underline">1</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="popup_delete_item1"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Delete</property> + <property name="tooltip-text" translatable="yes">Delete the selection from the archive</property> + <property name="use_underline">1</property> + <property name="image">menu_icon_delete2</property> + </object> + </child> + </object> + <object class="GtkMenu" id="SidebarFolderPopupMenu"> + <property name="visible">1</property> + <child> + <object class="GtkImageMenuItem" id="popup_open_item2"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Open</property> + <property name="tooltip-text" translatable="yes">Open the selected folder</property> + <property name="use_underline">1</property> + <property name="image">menu_icon_open3</property> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem"> + <property name="visible">1</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="popup_extract_item2"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Extract…</property> + <property name="tooltip-text" translatable="yes">Extract folder from the archive</property> + <property name="use_underline">1</property> + <property name="image">menu_icon_extract3</property> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem"> + <property name="visible">1</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="popup_cut_item2"> + <property name="visible">1</property> + <property name="label" translatable="yes">Cu_t</property> + <property name="tooltip-text" translatable="yes">Cut the selection</property> + <property name="use_underline">1</property> + <property name="image">menu_icon_cut3</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="popup_copy_item2"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Copy</property> + <property name="tooltip-text" translatable="yes">Copy the selection</property> + <property name="use_underline">1</property> + <property name="image">menu_icon_copy3</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="popup_paste_item2"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Paste</property> + <property name="tooltip-text" translatable="yes">Paste the clipboard</property> + <property name="use_underline">1</property> + <property name="image">menu_icon_paste3</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="popup_rename_item2"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Rename…</property> + <property name="tooltip-text" translatable="yes">Rename the selection</property> + <property name="use_underline">1</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="popup_delete_item2"> + <property name="visible">1</property> + <property name="label" translatable="yes">_Delete</property> + <property name="tooltip-text" translatable="yes">Delete the selection from the archive</property> + <property name="use_underline">1</property> + <property name="image">menu_icon_delete3</property> + </object> + </child> + </object> +</interface> diff --git a/src/ui/new.ui b/src/ui/new.ui index 30e869b..01fe18c 100644 --- a/src/ui/new.ui +++ b/src/ui/new.ui @@ -213,7 +213,6 @@ </object> <object class="GtkFileChooserDialog" id="dialog"> <property name="can_focus">False</property> - <property name="border_width">5</property> <property name="modal">True</property> <property name="window_position">center-on-parent</property> <property name="type_hint">normal</property> |