2120
2105
set_sensitive (window, "Extract", file_op);
2121
2106
set_sensitive (window, "Extract_Toolbar", file_op);
2122
2107
set_sensitive (window, "Find", ! no_archive);
2123
set_sensitive (window, "LastOutput", ((window->archive != NULL)
2124
&& (window->archive->process != NULL)
2125
&& (window->archive->process->out.raw != NULL)));
2126
2108
set_sensitive (window, "New", ! running);
2127
2109
set_sensitive (window, "Open", ! running);
2128
2110
set_sensitive (window, "Open_Toolbar", ! running);
4972
4955
const char *key,
4973
4956
gpointer user_data)
4975
FrWindow *window = user_data;
4977
gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (window->priv->recent_chooser_menu),
4978
g_settings_get_int (settings, PREF_UI_HISTORY_LEN));
4979
gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (window->priv->recent_chooser_toolbar),
4980
g_settings_get_int (settings, PREF_UI_HISTORY_LEN));
4958
FrWindow *window = user_data;
4962
limit = g_settings_get_int (settings, PREF_UI_HISTORY_LEN);
4964
action = gtk_action_group_get_action (window->priv->actions, "OpenRecent");
4965
gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (action), limit);
4967
action = gtk_action_group_get_action (window->priv->actions, "OpenRecent_Toolbar");
4968
gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (action), limit);
5777
5766
/* side pane */
5779
window->priv->sidepane = gtk_vbox_new (FALSE, 0);
5768
window->priv->sidepane = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
5781
5770
sidepane_title = gtk_frame_new (NULL);
5782
5771
gtk_frame_set_shadow_type (GTK_FRAME (sidepane_title), GTK_SHADOW_ETCHED_IN);
5784
sidepane_title_box = gtk_hbox_new (FALSE, 0);
5773
sidepane_title_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
5785
5774
gtk_container_set_border_width (GTK_CONTAINER (sidepane_title_box), 2);
5786
5775
gtk_container_add (GTK_CONTAINER (sidepane_title), sidepane_title_box);
5787
5776
sidepane_title_label = gtk_label_new (_("Folders"));
5817
5806
ui = gtk_ui_manager_new ();
5819
5808
window->priv->actions = actions = gtk_action_group_new ("Actions");
5810
/* open recent menu item action */
5812
action = g_object_new (GTK_TYPE_RECENT_ACTION,
5813
"name", "OpenRecent",
5814
/* Translators: this is the label for the "open recent file" sub-menu. */
5815
"label", _("Open _Recent"),
5816
"tooltip", _("Open a recently used archive"),
5817
"stock-id", GTK_STOCK_OPEN,
5819
fr_window_init_recent_chooser (window, GTK_RECENT_CHOOSER (action));
5820
gtk_action_group_add_action (actions, action);
5821
g_object_unref (action);
5823
/* open recent toolbar item action */
5825
action = g_object_new (GTK_TYPE_RECENT_ACTION,
5826
"name", "OpenRecent_Toolbar",
5828
"tooltip", _("Open a recently used archive"),
5829
"stock-id", GTK_STOCK_OPEN,
5830
"is-important", TRUE,
5832
fr_window_init_recent_chooser (window, GTK_RECENT_CHOOSER (action));
5833
g_signal_connect (action,
5835
G_CALLBACK (activate_action_open),
5837
gtk_action_group_add_action (actions, action);
5838
g_object_unref (action);
5820
5842
gtk_action_group_set_translation_domain (actions, NULL);
5821
5843
gtk_action_group_add_actions (actions,
5822
5844
action_entries,
5918
5940
gtk_widget_show (window->priv->location_bar);
5920
/* Recent manager */
5922
window->priv->recent_manager = gtk_recent_manager_get_default ();
5924
window->priv->recent_chooser_menu = gtk_recent_chooser_menu_new_for_manager (window->priv->recent_manager);
5925
gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (window->priv->recent_chooser_menu), GTK_RECENT_SORT_MRU);
5926
fr_window_init_recent_chooser (window, GTK_RECENT_CHOOSER (window->priv->recent_chooser_menu));
5927
menu_item = gtk_ui_manager_get_widget (ui, "/MenuBar/Archive/OpenRecentMenu");
5928
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), window->priv->recent_chooser_menu);
5930
window->priv->recent_chooser_toolbar = gtk_recent_chooser_menu_new_for_manager (window->priv->recent_manager);
5931
fr_window_init_recent_chooser (window, GTK_RECENT_CHOOSER (window->priv->recent_chooser_toolbar));
5933
/* Add the recent menu tool item */
5935
open_recent_tool_item = gtk_menu_tool_button_new_from_stock (GTK_STOCK_OPEN);
5936
gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (open_recent_tool_item), window->priv->recent_chooser_toolbar);
5937
gtk_tool_item_set_homogeneous (open_recent_tool_item, FALSE);
5938
gtk_widget_set_tooltip_text (GTK_WIDGET (open_recent_tool_item), _("Open archive"));
5939
gtk_menu_tool_button_set_arrow_tooltip_text (GTK_MENU_TOOL_BUTTON (open_recent_tool_item), _("Open a recently used archive"));
5941
window->priv->open_action = gtk_action_new ("Toolbar_Open", _("Open"), _("Open archive"), GTK_STOCK_OPEN);
5942
g_object_set (window->priv->open_action, "is_important", TRUE, NULL);
5943
g_signal_connect (window->priv->open_action,
5945
G_CALLBACK (activate_action_open),
5947
gtk_activatable_set_related_action (GTK_ACTIVATABLE (open_recent_tool_item), window->priv->open_action);
5949
gtk_widget_show (GTK_WIDGET (open_recent_tool_item));
5950
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), open_recent_tool_item, 1);
5954
5944
fr_window_attach (FR_WINDOW (window), window->priv->toolbar, FR_WINDOW_AREA_TOOLBAR);
5975
5965
gtk_box_set_spacing (GTK_BOX (statusbar_box), 4);
5976
5966
gtk_box_set_child_packing (GTK_BOX (statusbar_box), gtk_statusbar_get_message_area (statusbar), TRUE, TRUE, 0, GTK_PACK_START );
5978
statusbar_box = gtk_hbox_new (FALSE, 4);
5968
statusbar_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
5979
5969
g_object_ref (statusbar->label);
5980
5970
gtk_container_remove (GTK_CONTAINER (statusbar->frame), statusbar->label);
5981
5971
gtk_box_pack_start (GTK_BOX (statusbar_box), statusbar->label, TRUE, TRUE, 0);
6651
/* -- fr_window_archive_extract -- */
6657
GList *current_file;
6661
#define _FR_RESPONSE_OVERWRITE_YES_ALL 100
6662
#define _FR_RESPONSE_OVERWRITE_YES 101
6663
#define _FR_RESPONSE_OVERWRITE_NO 102
6667
_fr_window_archive_extract_from_edata (FrWindow *window,
6670
window->priv->ask_to_open_destination_after_extraction = edata->ask_to_open_destination;
6672
fr_process_clear (window->archive->process);
6673
fr_archive_extract (window->archive,
6675
edata->extract_to_dir,
6678
edata->overwrite == FR_OVERWRITE_YES,
6680
window->priv->password);
6681
fr_process_start (window->archive->process);
6685
static gboolean _fr_window_ask_overwrite_dialog (OverwriteData *odata);
6689
overwrite_dialog_response_cb (GtkDialog *dialog,
6693
OverwriteData *odata = user_data;
6694
gboolean do_not_extract = FALSE;
6696
switch (response_id) {
6697
case _FR_RESPONSE_OVERWRITE_YES_ALL:
6698
odata->edata->overwrite = FR_OVERWRITE_YES;
6701
case _FR_RESPONSE_OVERWRITE_YES:
6702
odata->current_file = odata->current_file->next;
6705
case _FR_RESPONSE_OVERWRITE_NO:
6707
/* remove the file from the list to extract */
6708
GList *next = odata->current_file->next;
6709
odata->edata->file_list = g_list_remove_link (odata->edata->file_list, odata->current_file);
6710
path_list_free (odata->current_file);
6711
odata->current_file = next;
6715
case GTK_RESPONSE_DELETE_EVENT:
6716
case GTK_RESPONSE_CANCEL:
6717
do_not_extract = TRUE;
6724
gtk_widget_destroy (GTK_WIDGET (dialog));
6726
if (do_not_extract) {
6727
fr_window_stop_batch (odata->window);
6732
_fr_window_ask_overwrite_dialog (odata);
6737
_fr_window_ask_overwrite_dialog (OverwriteData *odata)
6739
gboolean do_not_extract = FALSE;
6741
while ((odata->edata->overwrite == FR_OVERWRITE_ASK) && (odata->current_file != NULL)) {
6746
GFileType file_type;
6748
path = g_uri_escape_string ((char *) odata->current_file->data, G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, TRUE);
6749
dest_uri = g_strdup_printf ("%s/%s", odata->edata->extract_to_dir, path);
6750
file = g_file_new_for_uri (dest_uri);
6751
info = g_file_query_info (file,
6752
G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_STANDARD_NAME "," G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
6753
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
6761
g_object_unref (file);
6762
odata->current_file = odata->current_file->next;
6766
file_type = g_file_info_get_file_type (info);
6767
if ((file_type != G_FILE_TYPE_UNKNOWN) && (file_type != G_FILE_TYPE_DIRECTORY)) {
6774
msg = g_strdup_printf (_("Replace file \"%s\"?"), g_file_info_get_display_name (info));
6775
parent = g_file_get_parent (file);
6776
parent_name = g_file_get_parse_name (parent);
6777
details = g_strdup_printf (_("Another file with the same name already exists in \"%s\"."), parent_name);
6778
d = _gtk_message_dialog_new (GTK_WINDOW (odata->window),
6780
GTK_STOCK_DIALOG_QUESTION,
6783
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
6784
_("Replace _All"), _FR_RESPONSE_OVERWRITE_YES_ALL,
6785
_("_Skip"), _FR_RESPONSE_OVERWRITE_NO,
6786
_("_Replace"), _FR_RESPONSE_OVERWRITE_YES,
6788
gtk_dialog_set_default_response (GTK_DIALOG (d), _FR_RESPONSE_OVERWRITE_YES);
6789
g_signal_connect (d,
6791
G_CALLBACK (overwrite_dialog_response_cb),
6793
gtk_widget_show (d);
6795
g_free (parent_name);
6796
g_object_unref (parent);
6797
g_object_unref (info);
6798
g_object_unref (file);
6803
g_object_unref (info);
6804
g_object_unref (file);
6807
if (do_not_extract) {
6808
fr_window_stop_batch (odata->window);
6813
odata->edata->overwrite = FR_OVERWRITE_YES;
6814
_fr_window_archive_extract_from_edata (odata->window, odata->edata);
6658
fr_window_archive_extract (FrWindow *window,
6660
const char *extract_to_dir,
6661
const char *base_dir,
6662
gboolean skip_older,
6664
gboolean junk_paths,
6665
gboolean ask_to_open_destination)
6820
fr_window_archive_extract (FrWindow *window,
6822
const char *extract_to_dir,
6823
const char *base_dir,
6824
gboolean skip_older,
6825
FrOverwrite overwrite,
6826
gboolean junk_paths,
6827
gboolean ask_to_open_destination)
6667
6829
ExtractData *edata;
6668
6830
gboolean do_not_extract = FALSE;
7429
7596
if (*new_name == '\0') {
7430
7597
/* Translators: the name references to a filename. This message can appear when renaming a file. */
7431
*reason = g_strdup_printf ("%s\n\n%s", _("The new name is void."), _("Please use a different name."));
7598
*reason = g_strdup (_("New name is void, please type a name."));
7432
7599
retval = FALSE;
7434
7601
else if (strcmp (new_name, old_name) == 0) {
7435
7602
/* Translators: the name references to a filename. This message can appear when renaming a file. */
7436
*reason = g_strdup_printf ("%s\n\n%s", _("The new name is equal to the old one."), _("Please use a different name."));
7603
*reason = g_strdup (_("New name is the same as old one, please type other name."));
7437
7604
retval = FALSE;
7439
7606
else if (strchrs (new_name, BAD_CHARS)) {
7440
/* Translators: the name references to a filename. This message can appear when renaming a file. */
7441
*reason = g_strdup_printf (_("The name \"%s\" is not valid because it cannot contain the characters: %s\n\n%s"), utf8_new_name, BAD_CHARS, _("Please use a different name."));
7607
/* Translators: the %s references to a filename. This message can appear when renaming a file. */
7608
*reason = g_strdup_printf (_("Name \"%s\" is not valid because it contains at least one of the following characters: %s, please type other name."), utf8_new_name, BAD_CHARS);
7442
7609
retval = FALSE;