~ubuntu-branches/debian/jessie/file-roller/jessie

« back to all changes in this revision

Viewing changes to .pc/11_search_as_you_type.patch/src/fr-window.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach
  • Date: 2012-03-09 19:32:38 UTC
  • mfrom: (1.6.86)
  • Revision ID: package-import@ubuntu.com-20120309193238-dzn4p0szzcambb5v
Tags: 3.3.91-1
* New upstream release.
* Refresh 99_ltmain_as-needed.patch with newer copy in dh-autoreconf.
* Update to Standards-Version 3.9.3, no changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
135
135
 
136
136
 
137
137
typedef struct {
138
 
        GList    *file_list;
139
 
        char     *extract_to_dir;
140
 
        char     *base_dir;
141
 
        gboolean  skip_older;
142
 
        gboolean  overwrite;
143
 
        gboolean  junk_paths;
144
 
        char     *password;
145
 
        gboolean  extract_here;
 
138
        GList       *file_list;
 
139
        char        *extract_to_dir;
 
140
        char        *base_dir;
 
141
        gboolean     skip_older;
 
142
        FrOverwrite  overwrite;
 
143
        gboolean     junk_paths;
 
144
        char        *password;
 
145
        gboolean     extract_here;
 
146
        gboolean     ask_to_open_destination;
146
147
} ExtractData;
147
148
 
148
149
 
336
337
 
337
338
        GtkActionGroup  *actions;
338
339
 
339
 
        GtkRecentManager *recent_manager;
340
 
        GtkWidget        *recent_chooser_menu;
341
 
        GtkWidget        *recent_chooser_toolbar;
342
 
 
343
340
        GtkWidget        *file_popup_menu;
344
341
        GtkWidget        *folder_popup_menu;
345
342
        GtkWidget        *sidebar_folder_popup_menu;
346
343
        GtkWidget        *mitem_recents_menu;
347
 
        GtkWidget        *recent_toolbar_menu;
348
 
        GtkAction        *open_action;
349
344
 
350
345
        /* dragged files data */
351
346
 
548
543
                window->priv->update_timeout_handle = 0;
549
544
        }
550
545
 
551
 
        if (window->priv->open_action != NULL) {
552
 
                g_object_unref (window->priv->open_action);
553
 
                window->priv->open_action = NULL;
554
 
        }
555
 
 
556
 
        if (window->priv->recent_toolbar_menu != NULL) {
557
 
                gtk_widget_destroy (window->priv->recent_toolbar_menu);
558
 
                window->priv->recent_toolbar_menu = NULL;
559
 
        }
560
 
 
561
546
        while (window->priv->activity_ref > 0)
562
547
                fr_window_stop_activity_mode (window);
563
548
 
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);
2149
2131
 
2150
2132
        set_sensitive (window, "SelectAll", (window->priv->current_view_length > 0) && (window->priv->current_view_length != n_selected));
2151
2133
        set_sensitive (window, "DeselectAll", n_selected > 0);
2152
 
        set_sensitive (window, "OpenRecentMenu", ! running);
 
2134
        set_sensitive (window, "OpenRecent", ! running);
 
2135
        set_sensitive (window, "OpenRecent_Toolbar", ! running);
2153
2136
 
2154
2137
        set_sensitive (window, "ViewFolders", (window->priv->list_mode == FR_WINDOW_LIST_MODE_AS_DIR));
2155
2138
 
2535
2518
 
2536
2519
        /* Main */
2537
2520
 
2538
 
        hbox = gtk_hbox_new (FALSE, 24);
 
2521
        hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 24);
2539
2522
        gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
2540
2523
        gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (d)), hbox, FALSE, FALSE, 10);
2541
2524
 
2546
2529
        gtk_misc_set_alignment (GTK_MISC (window->priv->pd_icon), 0.5, 0.0);
2547
2530
        gtk_box_pack_start (GTK_BOX (hbox), window->priv->pd_icon, FALSE, FALSE, 0);
2548
2531
 
2549
 
        vbox = gtk_vbox_new (FALSE, 5);
 
2532
        vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
2550
2533
        gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
2551
2534
 
2552
2535
        /* action label */
2575
2558
                GtkWidget *hbox;
2576
2559
                char      *name;
2577
2560
 
2578
 
                hbox = gtk_hbox_new (FALSE, 6);
 
2561
                hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
2579
2562
                gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
2580
2563
 
2581
2564
                lbl = gtk_label_new ("");
2599
2582
        align = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
2600
2583
        gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 6, 0, 0);
2601
2584
 
2602
 
        progress_vbox = gtk_vbox_new (FALSE, 6);
 
2585
        progress_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
2603
2586
        gtk_container_add (GTK_CONTAINER (align), progress_vbox);
2604
2587
        gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
2605
2588
 
2821
2804
#endif
2822
2805
 
2823
2806
        message = get_message_from_action (action);
2824
 
        full_msg = g_strdup_printf ("%s, %s", message, _("please wait..."));
 
2807
        full_msg = g_strdup_printf ("%s, %s", message, _("please wait…"));
2825
2808
        fr_window_push_message (window, full_msg);
2826
2809
 
2827
2810
        switch (action) {
2859
2842
                recent_data->mime_type = g_content_type_get_mime_type (window->archive->content_type);
2860
2843
                recent_data->app_name = "File Roller";
2861
2844
                recent_data->app_exec = "file-roller";
2862
 
                gtk_recent_manager_add_full (window->priv->recent_manager, uri, recent_data);
 
2845
                gtk_recent_manager_add_full (gtk_recent_manager_get_default (), uri, recent_data);
2863
2846
 
2864
2847
                g_free (recent_data);
2865
2848
        }
2866
2849
        else
2867
 
                gtk_recent_manager_add_item (window->priv->recent_manager, uri);
 
2850
                gtk_recent_manager_add_item (gtk_recent_manager_get_default (), uri);
2868
2851
}
2869
2852
 
2870
2853
 
2873
2856
                                   char     *filename)
2874
2857
{
2875
2858
        if (filename != NULL)
2876
 
                gtk_recent_manager_remove_item (window->priv->recent_manager, filename, NULL);
 
2859
                gtk_recent_manager_remove_item (gtk_recent_manager_get_default (), filename, NULL);
2877
2860
}
2878
2861
 
2879
2862
 
4230
4213
                                           window->priv->drag_destination_folder,
4231
4214
                                           window->priv->drag_base_dir,
4232
4215
                                           FALSE,
4233
 
                                           TRUE,
 
4216
                                           FR_OVERWRITE_ASK,
4234
4217
                                           FALSE,
4235
4218
                                           FALSE);
4236
4219
                path_list_free (window->priv->drag_file_list);
4972
4955
                          const char *key,
4973
4956
                          gpointer    user_data)
4974
4957
{
4975
 
        FrWindow *window = user_data;
4976
 
 
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;
 
4959
        int        limit;
 
4960
        GtkAction *action;
 
4961
 
 
4962
        limit = g_settings_get_int (settings, PREF_UI_HISTORY_LEN);
 
4963
 
 
4964
        action = gtk_action_group_get_action (window->priv->actions, "OpenRecent");
 
4965
        gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (action), limit);
 
4966
 
 
4967
        action = gtk_action_group_get_action (window->priv->actions, "OpenRecent_Toolbar");
 
4968
        gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (action), limit);
4981
4969
}
4982
4970
 
4983
4971
 
5421
5409
        GtkWidget          *close_sidepane_button;
5422
5410
        GtkTreeSelection   *selection;
5423
5411
        GtkActionGroup     *actions;
 
5412
        GtkAction          *action;
5424
5413
        GtkUIManager       *ui;
5425
5414
        GtkToolItem        *open_recent_tool_item;
5426
5415
        GtkWidget          *menu_item;
5700
5689
 
5701
5690
        /* filter bar */
5702
5691
 
5703
 
        window->priv->filter_bar = filter_box = gtk_hbox_new (FALSE, 6);
 
5692
        window->priv->filter_bar = filter_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
5704
5693
        gtk_container_set_border_width (GTK_CONTAINER (filter_box), 3);
5705
5694
        fr_window_attach (FR_WINDOW (window), window->priv->filter_bar, FR_WINDOW_AREA_FILTERBAR);
5706
5695
 
5776
5765
 
5777
5766
        /* side pane */
5778
5767
 
5779
 
        window->priv->sidepane = gtk_vbox_new (FALSE, 0);
 
5768
        window->priv->sidepane = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
5780
5769
 
5781
5770
        sidepane_title = gtk_frame_new (NULL);
5782
5771
        gtk_frame_set_shadow_type (GTK_FRAME (sidepane_title), GTK_SHADOW_ETCHED_IN);
5783
5772
 
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 ();
5818
5807
 
5819
5808
        window->priv->actions = actions = gtk_action_group_new ("Actions");
 
5809
 
 
5810
        /* open recent menu item action  */
 
5811
 
 
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,
 
5818
                               NULL);
 
5819
        fr_window_init_recent_chooser (window, GTK_RECENT_CHOOSER (action));
 
5820
        gtk_action_group_add_action (actions, action);
 
5821
        g_object_unref (action);
 
5822
 
 
5823
        /* open recent toolbar item action  */
 
5824
 
 
5825
        action = g_object_new (GTK_TYPE_RECENT_ACTION,
 
5826
                               "name", "OpenRecent_Toolbar",
 
5827
                               "label", _("Open"),
 
5828
                               "tooltip", _("Open a recently used archive"),
 
5829
                               "stock-id", GTK_STOCK_OPEN,
 
5830
                               "is-important", TRUE,
 
5831
                               NULL);
 
5832
        fr_window_init_recent_chooser (window, GTK_RECENT_CHOOSER (action));
 
5833
        g_signal_connect (action,
 
5834
                          "activate",
 
5835
                          G_CALLBACK (activate_action_open),
 
5836
                          window);
 
5837
        gtk_action_group_add_action (actions, action);
 
5838
        g_object_unref (action);
 
5839
 
 
5840
        /* other actions */
 
5841
 
5820
5842
        gtk_action_group_set_translation_domain (actions, NULL);
5821
5843
        gtk_action_group_add_actions (actions,
5822
5844
                                      action_entries,
5878
5900
 
5879
5901
        /* current location */
5880
5902
 
5881
 
        location_box = gtk_hbox_new (FALSE, 6);
 
5903
        location_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
5882
5904
        /* Translators: after the colon there is a folder name. */
5883
5905
        window->priv->location_label = gtk_label_new_with_mnemonic (_("_Location:"));
5884
5906
        gtk_box_pack_start (GTK_BOX (location_box),
5917
5939
        else
5918
5940
                gtk_widget_show (window->priv->location_bar);
5919
5941
 
5920
 
        /* Recent manager */
5921
 
 
5922
 
        window->priv->recent_manager = gtk_recent_manager_get_default ();
5923
 
 
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);
5929
 
 
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));
5932
 
 
5933
 
        /* Add the recent menu tool item */
5934
 
 
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"));
5940
 
 
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,
5944
 
                          "activate",
5945
 
                          G_CALLBACK (activate_action_open),
5946
 
                          window);
5947
 
        gtk_activatable_set_related_action (GTK_ACTIVATABLE (open_recent_tool_item), window->priv->open_action);
5948
 
 
5949
 
        gtk_widget_show (GTK_WIDGET (open_recent_tool_item));
5950
 
        gtk_toolbar_insert (GTK_TOOLBAR (toolbar), open_recent_tool_item, 1);
5951
 
 
5952
5942
        /**/
5953
5943
 
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 );
5977
5967
#else
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);
5989
5979
        {
5990
5980
                GtkWidget *vbox;
5991
5981
 
5992
 
                vbox = gtk_vbox_new (FALSE, 0);
 
5982
                vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
5993
5983
                gtk_box_pack_start (GTK_BOX (statusbar_box), vbox, FALSE, FALSE, 0);
5994
5984
                gtk_box_pack_start (GTK_BOX (vbox), window->priv->progress_bar, TRUE, TRUE, 1);
5995
5985
                gtk_widget_show (vbox);
6518
6508
 
6519
6509
 
6520
6510
static ExtractData*
6521
 
extract_data_new (GList      *file_list,
6522
 
                  const char *extract_to_dir,
6523
 
                  const char *base_dir,
6524
 
                  gboolean    skip_older,
6525
 
                  gboolean    overwrite,
6526
 
                  gboolean    junk_paths,
6527
 
                  gboolean    extract_here)
 
6511
extract_data_new (GList       *file_list,
 
6512
                  const char  *extract_to_dir,
 
6513
                  const char  *base_dir,
 
6514
                  gboolean     skip_older,
 
6515
                  FrOverwrite  overwrite,
 
6516
                  gboolean     junk_paths,
 
6517
                  gboolean     extract_here,
 
6518
                  gboolean     ask_to_open_destination)
6528
6519
{
6529
6520
        ExtractData *edata;
6530
6521
 
6538
6529
        if (base_dir != NULL)
6539
6530
                edata->base_dir = g_strdup (base_dir);
6540
6531
        edata->extract_here = extract_here;
 
6532
        edata->ask_to_open_destination = ask_to_open_destination;
6541
6533
 
6542
6534
        return edata;
6543
6535
}
6552
6544
                                 FALSE,
6553
6545
                                 TRUE,
6554
6546
                                 FALSE,
 
6547
                                 FALSE,
6555
6548
                                 FALSE);
6556
6549
}
6557
6550
 
6629
6622
                                  skip_older,
6630
6623
                                  overwrite,
6631
6624
                                  junk_paths,
6632
 
                                  TRUE);
 
6625
                                  TRUE,
 
6626
                                  FALSE);
6633
6627
        fr_window_set_current_batch_action (window,
6634
6628
                                            FR_BATCH_ACTION_EXTRACT,
6635
6629
                                            edata,
6640
6634
                return;
6641
6635
        }
6642
6636
 
6643
 
        window->priv->ask_to_open_destination_after_extraction = FALSE;
 
6637
        window->priv->ask_to_open_destination_after_extraction = edata->ask_to_open_destination;
6644
6638
 
6645
6639
        fr_process_clear (window->archive->process);
6646
6640
        if (fr_archive_extract_here (window->archive,
6654
6648
}
6655
6649
 
6656
6650
 
 
6651
/* -- fr_window_archive_extract -- */
 
6652
 
 
6653
 
 
6654
typedef struct {
 
6655
        FrWindow    *window;
 
6656
        ExtractData *edata;
 
6657
        GList       *current_file;
 
6658
} OverwriteData;
 
6659
 
 
6660
 
 
6661
#define _FR_RESPONSE_OVERWRITE_YES_ALL 100
 
6662
#define _FR_RESPONSE_OVERWRITE_YES     101
 
6663
#define _FR_RESPONSE_OVERWRITE_NO      102
 
6664
 
 
6665
 
 
6666
static void
 
6667
_fr_window_archive_extract_from_edata (FrWindow    *window,
 
6668
                                       ExtractData *edata)
 
6669
{
 
6670
        window->priv->ask_to_open_destination_after_extraction = edata->ask_to_open_destination;
 
6671
 
 
6672
        fr_process_clear (window->archive->process);
 
6673
        fr_archive_extract (window->archive,
 
6674
                            edata->file_list,
 
6675
                            edata->extract_to_dir,
 
6676
                            edata->base_dir,
 
6677
                            edata->skip_older,
 
6678
                            edata->overwrite == FR_OVERWRITE_YES,
 
6679
                            edata->junk_paths,
 
6680
                            window->priv->password);
 
6681
        fr_process_start (window->archive->process);
 
6682
}
 
6683
 
 
6684
 
 
6685
static gboolean _fr_window_ask_overwrite_dialog (OverwriteData *odata);
 
6686
 
 
6687
 
 
6688
static void
 
6689
overwrite_dialog_response_cb (GtkDialog *dialog,
 
6690
                              int        response_id,
 
6691
                              gpointer   user_data)
 
6692
{
 
6693
        OverwriteData *odata = user_data;
 
6694
        gboolean       do_not_extract = FALSE;
 
6695
 
 
6696
        switch (response_id) {
 
6697
        case _FR_RESPONSE_OVERWRITE_YES_ALL:
 
6698
                odata->edata->overwrite = FR_OVERWRITE_YES;
 
6699
                break;
 
6700
 
 
6701
        case _FR_RESPONSE_OVERWRITE_YES:
 
6702
                odata->current_file = odata->current_file->next;
 
6703
                break;
 
6704
 
 
6705
        case _FR_RESPONSE_OVERWRITE_NO:
 
6706
                {
 
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;
 
6712
                }
 
6713
                break;
 
6714
 
 
6715
        case GTK_RESPONSE_DELETE_EVENT:
 
6716
        case GTK_RESPONSE_CANCEL:
 
6717
                do_not_extract = TRUE;
 
6718
                break;
 
6719
 
 
6720
        default:
 
6721
                break;
 
6722
        }
 
6723
 
 
6724
        gtk_widget_destroy (GTK_WIDGET (dialog));
 
6725
 
 
6726
        if (do_not_extract) {
 
6727
                fr_window_stop_batch (odata->window);
 
6728
                g_free (odata);
 
6729
                return;
 
6730
        }
 
6731
 
 
6732
        _fr_window_ask_overwrite_dialog (odata);
 
6733
}
 
6734
 
 
6735
 
 
6736
static gboolean
 
6737
_fr_window_ask_overwrite_dialog (OverwriteData *odata)
 
6738
{
 
6739
        gboolean do_not_extract = FALSE;
 
6740
 
 
6741
        while ((odata->edata->overwrite == FR_OVERWRITE_ASK) && (odata->current_file != NULL)) {
 
6742
                char      *path;
 
6743
                char      *dest_uri;
 
6744
                GFile     *file;
 
6745
                GFileInfo *info;
 
6746
                GFileType  file_type;
 
6747
 
 
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,
 
6754
                                          NULL,
 
6755
                                          NULL);
 
6756
 
 
6757
                g_free (dest_uri);
 
6758
                g_free (path);
 
6759
 
 
6760
                if (info == NULL) {
 
6761
                        g_object_unref (file);
 
6762
                        odata->current_file = odata->current_file->next;
 
6763
                        continue;
 
6764
                }
 
6765
 
 
6766
                file_type = g_file_info_get_file_type (info);
 
6767
                if ((file_type != G_FILE_TYPE_UNKNOWN) && (file_type != G_FILE_TYPE_DIRECTORY)) {
 
6768
                        char      *msg;
 
6769
                        GFile     *parent;
 
6770
                        char      *parent_name;
 
6771
                        char      *details;
 
6772
                        GtkWidget *d;
 
6773
 
 
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),
 
6779
                                                     GTK_DIALOG_MODAL,
 
6780
                                                     GTK_STOCK_DIALOG_QUESTION,
 
6781
                                                     msg,
 
6782
                                                     details,
 
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,
 
6787
                                                     NULL);
 
6788
                        gtk_dialog_set_default_response (GTK_DIALOG (d), _FR_RESPONSE_OVERWRITE_YES);
 
6789
                        g_signal_connect (d,
 
6790
                                          "response",
 
6791
                                          G_CALLBACK (overwrite_dialog_response_cb),
 
6792
                                          odata);
 
6793
                        gtk_widget_show (d);
 
6794
 
 
6795
                        g_free (parent_name);
 
6796
                        g_object_unref (parent);
 
6797
                        g_object_unref (info);
 
6798
                        g_object_unref (file);
 
6799
 
 
6800
                        return;
 
6801
                }
 
6802
 
 
6803
                g_object_unref (info);
 
6804
                g_object_unref (file);
 
6805
        }
 
6806
 
 
6807
        if (do_not_extract) {
 
6808
                fr_window_stop_batch (odata->window);
 
6809
                g_free (odata);
 
6810
                return;
 
6811
        }
 
6812
 
 
6813
        odata->edata->overwrite = FR_OVERWRITE_YES;
 
6814
        _fr_window_archive_extract_from_edata (odata->window, odata->edata);
 
6815
        g_free (odata);
 
6816
}
 
6817
 
 
6818
 
6657
6819
void
6658
 
fr_window_archive_extract (FrWindow   *window,
6659
 
                           GList      *file_list,
6660
 
                           const char *extract_to_dir,
6661
 
                           const char *base_dir,
6662
 
                           gboolean    skip_older,
6663
 
                           gboolean    overwrite,
6664
 
                           gboolean    junk_paths,
6665
 
                           gboolean    ask_to_open_destination)
 
6820
fr_window_archive_extract (FrWindow    *window,
 
6821
                           GList       *file_list,
 
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)
6666
6828
{
6667
6829
        ExtractData *edata;
6668
6830
        gboolean     do_not_extract = FALSE;
6674
6836
                                  skip_older,
6675
6837
                                  overwrite,
6676
6838
                                  junk_paths,
6677
 
                                  FALSE);
 
6839
                                  FALSE,
 
6840
                                  ask_to_open_destination);
6678
6841
 
6679
6842
        fr_window_set_current_batch_action (window,
6680
6843
                                            FR_BATCH_ACTION_EXTRACT,
6687
6850
        }
6688
6851
 
6689
6852
        if (! uri_is_dir (edata->extract_to_dir)) {
 
6853
 
 
6854
                /* There is nothing to ask if the destination doesn't exist. */
 
6855
                if (edata->overwrite == FR_OVERWRITE_ASK)
 
6856
                        edata->overwrite = FR_OVERWRITE_YES;
 
6857
 
6690
6858
                if (! ForceDirectoryCreation) {
6691
6859
                        GtkWidget *d;
6692
6860
                        int        r;
6754
6922
                return;
6755
6923
        }
6756
6924
 
6757
 
        window->priv->ask_to_open_destination_after_extraction = ask_to_open_destination;
 
6925
        if (edata->overwrite == FR_OVERWRITE_ASK) {
 
6926
                OverwriteData *odata;
6758
6927
 
6759
 
        fr_process_clear (window->archive->process);
6760
 
        fr_archive_extract (window->archive,
6761
 
                            edata->file_list,
6762
 
                            edata->extract_to_dir,
6763
 
                            edata->base_dir,
6764
 
                            edata->skip_older,
6765
 
                            edata->overwrite,
6766
 
                            edata->junk_paths,
6767
 
                            window->priv->password);
6768
 
        fr_process_start (window->archive->process);
 
6928
                odata = g_new0 (OverwriteData, 1);
 
6929
                odata->window = window;
 
6930
                odata->edata = edata;
 
6931
                odata->current_file = odata->edata->file_list;
 
6932
                _fr_window_ask_overwrite_dialog (odata);
 
6933
        }
 
6934
        else
 
6935
                _fr_window_archive_extract_from_edata (window, edata);
6769
6936
}
6770
6937
 
6771
6938
 
7154
7321
 
7155
7322
        /**/
7156
7323
 
7157
 
        vbox = gtk_vbox_new (FALSE, 6);
 
7324
        vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
7158
7325
        gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
7159
7326
 
7160
7327
        gtk_container_add (GTK_CONTAINER (scrolled), text_view);
7428
7595
 
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;
7433
7600
        }
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;
7438
7605
        }
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;
7443
7610
        }
7444
7611
 
7547
7714
                                                 (GTK_DIALOG_DESTROY_WITH_PARENT
7548
7715
                                                  | GTK_DIALOG_MODAL),
7549
7716
                                                 _("Rename"),
7550
 
                                                 (renaming_dir ? _("New folder name") : _("New file name")),
 
7717
                                                 (renaming_dir ? _("_New folder name:") : _("_New file name:")),
7551
7718
                                                 utf8_old_name,
7552
7719
                                                 1024,
7553
7720
                                                 GTK_STOCK_CANCEL,
7771
7938
                        fr_process_begin_command (window->archive->process, "mv");
7772
7939
                        fr_process_set_working_dir (window->archive->process, data->tmp_dir);
7773
7940
                        fr_process_add_arg (window->archive->process, "-f");
 
7941
                        if (old_name[0] == '/')
 
7942
                                old_name = old_name + 1;
7774
7943
                        fr_process_add_arg (window->archive->process, old_name);
7775
7944
                        fr_process_add_arg (window->archive->process, new_name);
7776
7945
                        fr_process_end_command (window->archive->process);
7987
8156
                                               (GTK_DIALOG_DESTROY_WITH_PARENT
7988
8157
                                                | GTK_DIALOG_MODAL),
7989
8158
                                               _("Paste Selection"),
7990
 
                                               _("Destination folder"),
 
8159
                                               _("_Destination folder:"),
7991
8160
                                               utf8_old_path,
7992
8161
                                               1024,
7993
8162
                                               GTK_STOCK_CANCEL,
8627
8796
                                                   window->priv->extract_default_dir,
8628
8797
                                                   NULL,
8629
8798
                                                   FALSE,
8630
 
                                                   TRUE,
 
8799
                                                   FR_OVERWRITE_ASK,
8631
8800
                                                   FALSE,
8632
8801
                                                   TRUE);
8633
8802
                }