Author: colossus
Date: 2007-12-13 10:58:18 +0000 (Thu, 13 Dec 2007)
New Revision: 26471

Modified:
   xarchiver/trunk/src/add_dialog.c
   xarchiver/trunk/src/add_dialog.h
   xarchiver/trunk/src/interface.c
   xarchiver/trunk/src/window.c
Log:
Fixed layout of the new add dialog.
Fixed crash when navigating the archive with the location bar.


Modified: xarchiver/trunk/src/add_dialog.c
===================================================================
--- xarchiver/trunk/src/add_dialog.c    2007-12-13 10:35:30 UTC (rev 26470)
+++ xarchiver/trunk/src/add_dialog.c    2007-12-13 10:58:18 UTC (rev 26471)
@@ -25,142 +25,145 @@
 
 Add_dialog_data *xa_create_add_dialog (XArchive *archive)
 {
-       GtkWidget 
*label1,*label2,*label3,*label4,*hbox1,*hbox2,*hbox3,*option_notebook_page,*hbuttonbox2,*alignment1,*alignment2;
+       GtkWidget 
*label1,*label2,*label3,*label4,*label5,*label7,*hbox1,*hbox2,*hbox3,*hbox4,*option_notebook_vbox;
+       GtkWidget 
*dialog_action_area1,*alignment1,*alignment2,*alignment3,*vbox3,*frame2,*frame3,*frame4,*alignment4;
        Add_dialog_data *add_dialog;
        unsigned short int default_value, max_value;
        default_value = max_value = 0;
        gchar *compression_msg = NULL;
+       gboolean flag = FALSE;
 
        add_dialog = g_new0 (Add_dialog_data, 1);
        add_dialog->path_group = NULL;
        add_dialog->option_tooltip = gtk_tooltips_new ();
 
        add_dialog->dialog1 = gtk_dialog_new ();
-       gtk_widget_set_size_request (add_dialog->dialog1, 537, 400);
+       gtk_widget_set_size_request (add_dialog->dialog1, 520, 370);
        gtk_window_set_title (GTK_WINDOW (add_dialog->dialog1), _("Add files to 
the archive"));
-       gtk_window_set_transient_for ( GTK_WINDOW (add_dialog->dialog1) , 
GTK_WINDOW (MainWindow) );
-       gtk_dialog_set_has_separator (GTK_DIALOG (add_dialog->dialog1), FALSE);
+       gtk_window_set_resizable(GTK_WINDOW (add_dialog->dialog1),FALSE);
+       gtk_window_set_transient_for (GTK_WINDOW 
(add_dialog->dialog1),GTK_WINDOW(MainWindow));
+       gtk_dialog_set_has_separator (GTK_DIALOG (add_dialog->dialog1),FALSE);
 
        add_dialog->add_option_tooltip = gtk_tooltips_new ();
        add_dialog->dialog_vbox1 = GTK_DIALOG (add_dialog->dialog1)->vbox;
-       gtk_widget_show (add_dialog->dialog_vbox1);
 
        add_dialog->notebook1 = gtk_notebook_new ();
-       gtk_widget_show (add_dialog->notebook1);
        gtk_box_pack_start (GTK_BOX (add_dialog->dialog_vbox1), 
add_dialog->notebook1, TRUE, TRUE, 0);
        gtk_container_set_border_width (GTK_CONTAINER (add_dialog->notebook1), 
4);
 
        /* Selection page */
        vbox1 = gtk_vbox_new (FALSE, 0);
-       gtk_widget_show (vbox1);
        gtk_container_add (GTK_CONTAINER (add_dialog->notebook1), vbox1);
 
        label1 = gtk_label_new (_("Selection"));
-       gtk_widget_show (label1);
        gtk_notebook_set_tab_label (GTK_NOTEBOOK (add_dialog->notebook1), 
gtk_notebook_get_nth_page (GTK_NOTEBOOK (add_dialog->notebook1), 0), label1);
        
        add_dialog->filechooserwidget1 = gtk_file_chooser_widget_new 
(GTK_FILE_CHOOSER_ACTION_OPEN);
        
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(add_dialog->filechooserwidget1),TRUE);
-       gtk_widget_show (add_dialog->filechooserwidget1);
+       
gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(add_dialog->filechooserwidget1));
        gtk_box_pack_start (GTK_BOX (vbox1), add_dialog->filechooserwidget1, 
TRUE, TRUE, 0);
 
        add_dialog->frame1 = gtk_frame_new (NULL);
-       gtk_widget_show (add_dialog->frame1);
        gtk_box_pack_start (GTK_BOX (vbox1), add_dialog->frame1, FALSE, TRUE, 
5);
        gtk_container_set_border_width (GTK_CONTAINER (add_dialog->frame1), 5);
 
        alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
-       gtk_widget_show (alignment1);
        gtk_container_add (GTK_CONTAINER (add_dialog->frame1), alignment1);
-       gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 5, 5);
+       gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 20, 20);
 
        label3 = gtk_label_new (_("File Paths: "));
-       gtk_widget_show (label3);
        gtk_frame_set_label_widget (GTK_FRAME (add_dialog->frame1), label3);
 
        hbox1 = gtk_hbox_new (TRUE, 0);
-       gtk_widget_show (hbox1);
        gtk_container_add (GTK_CONTAINER (alignment1), hbox1);
 
        add_dialog->radiobutton3 = gtk_radio_button_new_with_mnemonic (NULL, 
_("Store full paths"));
-       gtk_widget_show (add_dialog->radiobutton3);
-       gtk_box_pack_start (GTK_BOX (hbox1), add_dialog->radiobutton3, TRUE, 
TRUE, 0);
+       gtk_box_pack_start (GTK_BOX (hbox1), add_dialog->radiobutton3, FALSE, 
FALSE, 0);
        gtk_radio_button_set_group (GTK_RADIO_BUTTON 
(add_dialog->radiobutton3), add_dialog->path_group);
        add_dialog->path_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON 
(add_dialog->radiobutton3));
        gtk_button_set_focus_on_click (GTK_BUTTON (add_dialog->radiobutton3), 
FALSE);
 
        add_dialog->radiobutton4 = gtk_radio_button_new_with_mnemonic (NULL, 
_("Do not store paths"));
-       gtk_widget_show (add_dialog->radiobutton4);
-       gtk_box_pack_start (GTK_BOX (hbox1), add_dialog->radiobutton4, TRUE, 
TRUE, 0);
+       gtk_box_pack_start (GTK_BOX (hbox1), add_dialog->radiobutton4, FALSE, 
FALSE, 0);
        gtk_radio_button_set_group (GTK_RADIO_BUTTON 
(add_dialog->radiobutton4), add_dialog->path_group);
        add_dialog->path_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON 
(add_dialog->radiobutton4));
        gtk_button_set_focus_on_click (GTK_BUTTON (add_dialog->radiobutton4), 
FALSE);
+       
//gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(add_dialog->radiobutton4),TRUE);
 
        /* Options page */
-       option_notebook_page = gtk_vbox_new (FALSE, 0);
-       gtk_widget_show (option_notebook_page);
-       gtk_container_add (GTK_CONTAINER (add_dialog->notebook1), 
option_notebook_page);
+       option_notebook_vbox = gtk_vbox_new (FALSE, 0);
+       gtk_container_add (GTK_CONTAINER (add_dialog->notebook1), 
option_notebook_vbox);
 
        label2 = gtk_label_new (_("Options"));
-       gtk_widget_show (label2);
        gtk_notebook_set_tab_label (GTK_NOTEBOOK (add_dialog->notebook1), 
gtk_notebook_get_nth_page (GTK_NOTEBOOK (add_dialog->notebook1), 1), label2);
+       
+       hbox2 = gtk_hbox_new (TRUE, 10);
+       gtk_box_pack_start (GTK_BOX (option_notebook_vbox), hbox2, TRUE, TRUE, 
0);
+       gtk_container_set_border_width (GTK_CONTAINER (hbox2), 5);
 
-       hbuttonbox2 = gtk_hbutton_box_new ();
-       gtk_widget_show (hbuttonbox2);
-       gtk_box_pack_start (GTK_BOX (hbox1), hbuttonbox2, TRUE, TRUE, 0);
-       gtk_container_set_border_width (GTK_CONTAINER (hbuttonbox2), 5);
-       gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox2), 
GTK_BUTTONBOX_END);
-       gtk_box_set_spacing (GTK_BOX (hbuttonbox2), 8);
+       frame4 = gtk_frame_new (NULL);
+       gtk_box_pack_start (GTK_BOX (hbox2), frame4, TRUE, TRUE, 0);
+       gtk_frame_set_shadow_type (GTK_FRAME (frame4), GTK_SHADOW_OUT);
 
-       /*if(archive->type != XARCHIVETYPE_LHA)
-       {
-               add_dialog->recurse = gtk_check_button_new_with_mnemonic 
(_("Include subdirectories"));
-               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON 
(add_dialog->recurse), archive->add_recurse);
-               if (gtk_toggle_button_get_active 
(GTK_TOGGLE_BUTTON(add_dialog->files_radio)))
-                       gtk_widget_set_sensitive (add_dialog->recurse, FALSE);
-               gtk_widget_show (add_dialog->recurse);
-               gtk_box_pack_start (GTK_BOX (option_notebook_page), 
add_dialog->recurse, FALSE, FALSE, 0);
-               gtk_tooltips_set_tip 
(add_dialog->option_tooltip,add_dialog->recurse , _("Include everything in the 
directory recursively       starting from the current directory."), NULL);
-       }*/
+       alignment4 = gtk_alignment_new (0.5, 0.5, 1, 1);
+       gtk_container_add (GTK_CONTAINER (frame4),alignment4);
+       gtk_alignment_set_padding (GTK_ALIGNMENT(alignment4), 0, 0, 12, 0);
 
-       if ( (archive->type == XARCHIVETYPE_RAR) || (archive->type == 
XARCHIVETYPE_7ZIP && archive->nr_of_files == 0 && archive->nr_of_dirs == 0))
-       {
-               add_dialog->solid_archive = gtk_check_button_new_with_mnemonic 
(_("Generate a solid archive"));
-               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON 
(add_dialog->solid_archive), archive->solid_archive);
-               gtk_widget_show (add_dialog->solid_archive);
-               gtk_box_pack_start (GTK_BOX (option_notebook_page), 
add_dialog->solid_archive, FALSE, FALSE, 0);
-               gtk_tooltips_set_tip 
(add_dialog->option_tooltip,add_dialog->solid_archive , _("In a solid archive 
the files are grouped together featuring a better compression ratio."), NULL);
-       }
+       vbox3 = gtk_vbox_new (TRUE, 0);
+       gtk_container_add (GTK_CONTAINER (alignment4),vbox3);
 
-       if (archive->type == XARCHIVETYPE_TAR || archive->type == 
XARCHIVETYPE_TAR_GZ || archive->type == XARCHIVETYPE_TAR_LZMA || archive->type 
== XARCHIVETYPE_TAR_BZ2 || archive->type == XARCHIVETYPE_RAR || archive->type 
== XARCHIVETYPE_ARJ || archive->type == XARCHIVETYPE_ZIP || archive->type 
==XARCHIVETYPE_LHA)
-       {
-               add_dialog->remove_files = gtk_check_button_new_with_mnemonic 
(_("Remove files after adding"));
-               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON 
(add_dialog->remove_files), archive->remove_files);
-               gtk_widget_show (add_dialog->remove_files);
-               gtk_box_pack_start (GTK_BOX (option_notebook_page), 
add_dialog->remove_files, FALSE, FALSE, 0);
-       }
-
-       if (archive->type != XARCHIVETYPE_7ZIP && archive->type != 
XARCHIVETYPE_LHA)
-       {
-               add_dialog->freshen = gtk_check_button_new_with_mnemonic 
(_("Freshen an existing entry"));
-               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON 
(add_dialog->freshen), archive->freshen);
-               gtk_widget_show (add_dialog->freshen);
-               gtk_box_pack_start (GTK_BOX (option_notebook_page), 
add_dialog->freshen, FALSE, FALSE, 0);
-               gtk_tooltips_set_tip 
(add_dialog->option_tooltip,add_dialog->freshen , _("This option affects the 
archive only if it has been modified more recently than the version already in 
the archive; unlike the update option it will not add files that are not 
already in the archive."), NULL );
-               g_signal_connect (G_OBJECT 
(add_dialog->freshen),"toggled",G_CALLBACK (add_fresh_update_toggled_cb) , 
add_dialog);
-       }
-
-       add_dialog->update = gtk_check_button_new_with_mnemonic (_("Update an 
existing entry"));
+       add_dialog->update = gtk_check_button_new_with_mnemonic (_("Update"));
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (add_dialog->update), 
archive->update);
-       gtk_widget_show (add_dialog->update);
-       gtk_box_pack_start (GTK_BOX (option_notebook_page), add_dialog->update, 
FALSE, FALSE, 0);
        gtk_tooltips_set_tip (add_dialog->option_tooltip,add_dialog->update, 
_("This option will add any new files and update any files which have been 
modified since the archive was last created/modified."), NULL );
 
        if (archive->type != XARCHIVETYPE_7ZIP)
                g_signal_connect (G_OBJECT 
(add_dialog->update),"toggled",G_CALLBACK (add_update_fresh_toggled_cb) , 
add_dialog);
+       gtk_box_pack_start (GTK_BOX (vbox3), add_dialog->update, FALSE, FALSE, 
0);
 
+       add_dialog->freshen = gtk_check_button_new_with_mnemonic (_("Freshen"));
+       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (add_dialog->freshen), 
archive->freshen);
+       gtk_tooltips_set_tip (add_dialog->option_tooltip,add_dialog->freshen , 
_("This option affects the archive only if it has been modified more recently 
than the version already in the archive; unlike the update option it will not 
add files that are not already in the archive."), NULL );
+       if (archive->type != XARCHIVETYPE_7ZIP && archive->type != 
XARCHIVETYPE_LHA)
+               gtk_widget_set_sensitive(add_dialog->freshen,TRUE);
+       gtk_box_pack_start (GTK_BOX (vbox3), add_dialog->freshen, FALSE, FALSE, 
0);
+       g_signal_connect (G_OBJECT (add_dialog->freshen),"toggled",G_CALLBACK 
(add_fresh_update_toggled_cb) , add_dialog);
+
+       add_dialog->recurse = gtk_check_button_new_with_mnemonic (_("Include 
subdirectories"));
+       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (add_dialog->recurse), 
archive->add_recurse);
+       if(archive->type == XARCHIVETYPE_LHA)
+               gtk_widget_set_sensitive(add_dialog->recurse,FALSE);
+       gtk_box_pack_start (GTK_BOX (vbox3), add_dialog->recurse, FALSE, FALSE, 
0);
+
+       add_dialog->solid_archive = gtk_check_button_new_with_mnemonic 
(_("Create a solid archive"));
+       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON 
(add_dialog->solid_archive), archive->solid_archive);
+       gtk_tooltips_set_tip 
(add_dialog->option_tooltip,add_dialog->solid_archive , _("In a solid archive 
the files are grouped together featuring a better compression ratio."), NULL);
+       if (archive->type == XARCHIVETYPE_RAR || archive->type == 
XARCHIVETYPE_7ZIP)
+               flag = TRUE;
+       gtk_widget_set_sensitive(add_dialog->solid_archive,flag);
+       gtk_box_pack_start (GTK_BOX (vbox3), add_dialog->solid_archive, FALSE, 
FALSE, 0);
+
+       add_dialog->remove_files = gtk_check_button_new_with_mnemonic 
(_("Delete files after adding"));
+       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON 
(add_dialog->remove_files), archive->remove_files);
+       gtk_box_pack_start (GTK_BOX (vbox3),add_dialog->remove_files, FALSE, 
FALSE, 0);
+
+       label7 = gtk_label_new (_("Actions; "));
+       gtk_frame_set_label_widget (GTK_FRAME (frame4), label7);
+       
+       hbox3 = gtk_hbox_new (TRUE, 10);
+       gtk_box_pack_start (GTK_BOX (option_notebook_vbox), hbox3, TRUE, TRUE, 
0);
+       gtk_container_set_border_width (GTK_CONTAINER (hbox3), 5);
+
+       frame2 = gtk_frame_new (NULL);
+       gtk_box_pack_start (GTK_BOX (hbox3), frame2, TRUE, TRUE, 0);
+       gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_OUT);
+
+       alignment2 = gtk_alignment_new (0.5, 0.5, 1, 1);
+       gtk_container_add (GTK_CONTAINER (frame2), alignment2);
+       gtk_alignment_set_padding (GTK_ALIGNMENT (alignment2), 0, 0, 5, 5);
+       
        if (archive->type != XARCHIVETYPE_TAR && archive->type != 
XARCHIVETYPE_TAR_GZ && archive->type != XARCHIVETYPE_TAR_LZMA && archive->type 
!= XARCHIVETYPE_TAR_BZ2)
        {
+               flag = TRUE;
                if (archive->type == XARCHIVETYPE_7ZIP)
                {
                        compression_msg = _("0 = no compression, 5 is default, 
9 = best compression but slowest");
@@ -195,60 +198,70 @@
                        default_value = 5;
                        max_value = 7;
                }
+       }
+       else
+               flag = FALSE;
 
-               hbox2 = gtk_hbox_new (FALSE, 0);
-               gtk_widget_show (hbox2);
-               gtk_box_pack_start (GTK_BOX (option_notebook_page),hbox2, TRUE, 
TRUE, 0);
+       if (archive->type == XARCHIVETYPE_7ZIP)
+               add_dialog->compression_value = gtk_adjustment_new 
(default_value, 0, max_value, 2, 2, 0);
+       else if (archive->type == XARCHIVETYPE_LHA)
+               add_dialog->compression_value = gtk_adjustment_new 
(default_value, 5, max_value, 7, 7, 0);
+       else
+               add_dialog->compression_value = gtk_adjustment_new 
(default_value, 0, max_value, 0, 0, 0);
 
-               if (archive->type != XARCHIVETYPE_LHA)
-               {
-                       add_dialog->add_password = 
gtk_check_button_new_with_mnemonic (_("Password:"));
-                       gtk_widget_show (add_dialog->add_password);
-                       gtk_box_pack_start (GTK_BOX (hbox2), 
add_dialog->add_password, FALSE, FALSE, 0);
-                       g_signal_connect (G_OBJECT (add_dialog->add_password), 
"toggled",G_CALLBACK (password_toggled_cb) , add_dialog);
+       add_dialog->compression_scale = gtk_hscale_new 
(GTK_ADJUSTMENT(add_dialog->compression_value));
+       gtk_widget_set_sensitive(add_dialog->compression_scale,flag);
+       gtk_container_add (GTK_CONTAINER (alignment2), 
add_dialog->compression_scale);
+       gtk_scale_set_value_pos (GTK_SCALE (add_dialog->compression_scale), 
GTK_POS_TOP);
+       gtk_scale_set_digits (GTK_SCALE (add_dialog->compression_scale), 0);
+       if (archive->compression_level == 0)
+               archive->compression_level = default_value;
+       gtk_adjustment_set_value 
(GTK_ADJUSTMENT(add_dialog->compression_value), archive->compression_level);
 
-                       add_dialog->add_password_entry = gtk_entry_new ();
-                       gtk_widget_show (add_dialog->add_password_entry);
-                       gtk_box_pack_start (GTK_BOX (hbox2), 
add_dialog->add_password_entry, FALSE, FALSE, 0);
-                       gtk_entry_set_visibility (GTK_ENTRY 
(add_dialog->add_password_entry), FALSE);
-                       gtk_widget_set_sensitive 
(add_dialog->add_password_entry, FALSE);
-               }
-               hbox3 = gtk_hbox_new (FALSE, 6);
-               gtk_widget_show (hbox3);
-               gtk_box_pack_start (GTK_BOX (option_notebook_page), hbox3, 
TRUE, TRUE, 0);
-               label4 = gtk_label_new (_("Compression level:"));
-               gtk_widget_show (label4);
-               gtk_box_pack_start (GTK_BOX (hbox3), label4, FALSE, FALSE, 0);
+       if (archive->type == XARCHIVETYPE_ARJ)
+               gtk_range_set_inverted (GTK_RANGE 
(add_dialog->compression_scale), TRUE);
+       else if (archive->type == XARCHIVETYPE_7ZIP)
+               g_signal_connect (G_OBJECT 
(add_dialog->compression_value),"value-changed",G_CALLBACK 
(fix_adjustment_value), NULL);
 
-               if (archive->type == XARCHIVETYPE_7ZIP)
-                       add_dialog->compression_value = gtk_adjustment_new 
(default_value, 0, max_value, 2, 2, 0);
-               else if (archive->type == XARCHIVETYPE_LHA)
-                       add_dialog->compression_value = gtk_adjustment_new 
(default_value, 5, max_value, 7, 7, 0);
-               else
-                       add_dialog->compression_value = gtk_adjustment_new 
(default_value, 0, max_value, 0, 0, 0);
+       gtk_tooltips_set_tip 
(add_dialog->option_tooltip,add_dialog->compression_scale, compression_msg, 
NULL );
 
-               add_dialog->compression_scale = gtk_hscale_new ( GTK_ADJUSTMENT 
(add_dialog->compression_value) );
-               gtk_widget_show (add_dialog->compression_scale);
-               gtk_box_pack_start (GTK_BOX (hbox3), 
add_dialog->compression_scale, TRUE, TRUE, 0);
-               gtk_scale_set_value_pos (GTK_SCALE 
(add_dialog->compression_scale), GTK_POS_LEFT);
-               gtk_scale_set_digits (GTK_SCALE 
(add_dialog->compression_scale), 0);
-               if (archive->compression_level == 0)
-                       archive->compression_level = default_value;
-               gtk_adjustment_set_value 
(GTK_ADJUSTMENT(add_dialog->compression_value), archive->compression_level);
+       label4 = gtk_label_new (_("Compression: "));
+       gtk_frame_set_label_widget (GTK_FRAME (frame2), label4);
 
-               if (archive->type == XARCHIVETYPE_ARJ)
-                       gtk_range_set_inverted (GTK_RANGE 
(add_dialog->compression_scale), TRUE);
-               else if (archive->type == XARCHIVETYPE_7ZIP)
-                       g_signal_connect (G_OBJECT 
(add_dialog->compression_value),"value-changed",G_CALLBACK 
(fix_adjustment_value), NULL);
-               gtk_tooltips_set_tip 
(add_dialog->option_tooltip,add_dialog->compression_scale, compression_msg, 
NULL );
-       }
+       frame3 = gtk_frame_new (NULL);
+       gtk_box_pack_start (GTK_BOX (hbox3), frame3, TRUE, TRUE, 0);
+       gtk_frame_set_shadow_type (GTK_FRAME (frame3), GTK_SHADOW_OUT);
 
-       add_dialog->dialog_action_area2 = GTK_DIALOG 
(add_dialog->dialog1)->action_area;
-       gtk_widget_show (add_dialog->dialog_action_area2);
-       gtk_button_box_set_layout (GTK_BUTTON_BOX 
(add_dialog->dialog_action_area2), GTK_BUTTONBOX_END);
+       alignment3 = gtk_alignment_new (0.5, 0.5, 1, 1);
+       gtk_container_add (GTK_CONTAINER (frame3), alignment3);
+       gtk_alignment_set_padding (GTK_ALIGNMENT (alignment3), 0, 0, 5, 5);
 
+       hbox4 = gtk_hbox_new (FALSE, 0);
+       gtk_container_add (GTK_CONTAINER (alignment3), hbox4);
+
+       if (archive->type == XARCHIVETYPE_TAR || archive->type == 
XARCHIVETYPE_TAR_GZ || archive->type == XARCHIVETYPE_TAR_LZMA || archive->type 
== XARCHIVETYPE_TAR_BZ2)
+               flag = FALSE;
+       else
+               flag = TRUE;
+
+       add_dialog->add_password = gtk_check_button_new_with_mnemonic 
(_("Password:"));
+       gtk_box_pack_start (GTK_BOX (hbox4), add_dialog->add_password, FALSE, 
FALSE, 0);
+       gtk_widget_set_sensitive(add_dialog->add_password,flag);
+       g_signal_connect (G_OBJECT (add_dialog->add_password), 
"toggled",G_CALLBACK (password_toggled_cb) , add_dialog);
+
+       add_dialog->add_password_entry = gtk_entry_new ();
+       gtk_box_pack_start (GTK_BOX (hbox4), add_dialog->add_password_entry, 
FALSE, FALSE, 0);
+       gtk_entry_set_visibility (GTK_ENTRY (add_dialog->add_password_entry), 
FALSE);
+       gtk_entry_set_width_chars (GTK_ENTRY (add_dialog->add_password_entry), 
15);
+       gtk_widget_set_sensitive (add_dialog->add_password_entry, FALSE);
+
+       label5 = gtk_label_new (_("Encryption: "));
+       gtk_frame_set_label_widget (GTK_FRAME (frame3), label5);
+  
+       dialog_action_area1 = GTK_DIALOG (add_dialog->dialog1)->action_area;
+       gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), 
GTK_BUTTONBOX_END);
+
        add_dialog->cancel_button = gtk_button_new_from_stock ("gtk-cancel");
-       gtk_widget_show (add_dialog->cancel_button);
        gtk_dialog_add_action_widget (GTK_DIALOG (add_dialog->dialog1), 
add_dialog->cancel_button, GTK_RESPONSE_CANCEL);
        GTK_WIDGET_SET_FLAGS (add_dialog->cancel_button, GTK_CAN_DEFAULT);
 
@@ -258,17 +271,17 @@
        add_dialog->add_label = gtk_label_new_with_mnemonic(_("_Add"));
 
        alignment2 = gtk_alignment_new (0.5, 0.5, 0, 0);
-       gtk_widget_show (alignment2);
        gtk_container_add (GTK_CONTAINER (alignment2), add_dialog->add_hbox);
 
        gtk_box_pack_start(GTK_BOX(add_dialog->add_hbox), 
add_dialog->add_image, FALSE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(add_dialog->add_hbox), 
add_dialog->add_label, FALSE, TRUE, 0);
-       gtk_widget_show_all (add_dialog->add_hbox);
        gtk_container_add(GTK_CONTAINER(add_dialog->add_button), alignment2);
-       gtk_widget_show (add_dialog->add_button);
+
        gtk_dialog_add_action_widget (GTK_DIALOG (add_dialog->dialog1), 
add_dialog->add_button, GTK_RESPONSE_OK);
        GTK_WIDGET_SET_FLAGS (add_dialog->add_button, GTK_CAN_DEFAULT);
        gtk_dialog_set_default_response (GTK_DIALOG (add_dialog->dialog1), 
GTK_RESPONSE_OK);
+       
+       gtk_widget_show_all (add_dialog->dialog_vbox1);
        return add_dialog;
 }
 
@@ -316,6 +329,7 @@
        gchar *compression_string = NULL;
        gchar *first_item = NULL;
        gboolean done = FALSE;
+       GSList *files = NULL;
        GString *names;
 
        while ( ! done )
@@ -328,11 +342,12 @@
                        break;
 
                        case GTK_RESPONSE_OK:
-                       /*if 
(gtk_tree_model_get_iter_first(GTK_TREE_MODEL(add_dialog->file_liststore), 
&iter) == FALSE)
+                       files = 
gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(add_dialog->filechooserwidget1));
+                       if (g_slist_length(files) == 0)
                        {
                                response = xa_show_message_dialog (GTK_WINDOW 
(MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,_("Can't add 
files to the archive:"), _("You haven't selected any files to add!") );
                                break;
-                       }*/
+                       }
                        if ( add_dialog->add_password != NULL && 
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(add_dialog->add_password)) )
                        {
                                temp_password  = g_strdup (gtk_entry_get_text ( 
GTK_ENTRY (add_dialog->add_password_entry) ));
@@ -408,6 +423,7 @@
 
                        command = xa_add_single_files 
(archive,names,compression_string);
                        g_string_free ( names, TRUE);
+                       g_slist_free(files);
                        if (compression_string != NULL)
                                g_free (compression_string);
                }

Modified: xarchiver/trunk/src/add_dialog.h
===================================================================
--- xarchiver/trunk/src/add_dialog.h    2007-12-13 10:35:30 UTC (rev 26470)
+++ xarchiver/trunk/src/add_dialog.h    2007-12-13 10:58:18 UTC (rev 26471)
@@ -26,13 +26,11 @@
        GtkWidget *dialog1;
        GtkWidget *dialog_vbox1;
        GtkWidget *notebook1;
-       GtkWidget *vbox1;
        GtkWidget *filechooserwidget1;
        GtkWidget *frame1;
        GtkWidget *radiobutton3;
        GSList *path_group;
        GtkWidget *radiobutton4;
-       GtkWidget *dialog_action_area1;
        GtkWidget *remove_files;
        GtkWidget *update;
        GtkWidget *freshen;
@@ -48,7 +46,6 @@
        GtkWidget *add_button;
        GtkTooltips *add_option_tooltip;
        GtkWidget *add_option_label;
-       GtkWidget *dialog_action_area2;
        GtkTooltips *option_tooltip;
        GtkObject *compression_value;
 } Add_dialog_data;

Modified: xarchiver/trunk/src/interface.c
===================================================================
--- xarchiver/trunk/src/interface.c     2007-12-13 10:35:30 UTC (rev 26470)
+++ xarchiver/trunk/src/interface.c     2007-12-13 10:58:18 UTC (rev 26471)
@@ -332,7 +332,7 @@
        gtk_widget_show (AddFile_button);
        gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (AddFile_button), FALSE);
        gtk_container_add (GTK_CONTAINER (toolbar1), AddFile_button);
-       gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (AddFile_button), tooltips, 
_("Add files and directories to the current archive"), NULL);
+       gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (AddFile_button), tooltips, 
_("Add files"), NULL);
 
        tmp_image = xa_main_window_find_image("xarchiver-extract.png", 
GTK_ICON_SIZE_LARGE_TOOLBAR);
        gtk_widget_show (tmp_image);
@@ -341,7 +341,7 @@
        gtk_widget_show (Extract_button);
        gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (Extract_button), FALSE);
        gtk_container_add (GTK_CONTAINER (toolbar1), Extract_button);
-       gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (Extract_button), tooltips, 
_("Extract files from the current archive"), NULL);
+       gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (Extract_button), tooltips, 
_("Extract files"), NULL);
 
        tmp_image = gtk_image_new_from_stock ("gtk-find", 
tmp_toolbar_icon_size);
        gtk_widget_show (tmp_image);

Modified: xarchiver/trunk/src/window.c
===================================================================
--- xarchiver/trunk/src/window.c        2007-12-13 10:35:30 UTC (rev 26470)
+++ xarchiver/trunk/src/window.c        2007-12-13 10:58:18 UTC (rev 26471)
@@ -2061,15 +2061,21 @@
                xa_update_window_with_archive_entries(archive[idx],new_entry);
                return;
        }
+
        new_entry  = 
xa_find_entry_from_path(archive[idx]->root_entry,gtk_entry_get_text(GTK_ENTRY(location_entry)));
        if (new_entry == NULL)
        {
                
gtk_entry_set_text(GTK_ENTRY(location_entry),archive[idx]->location_entry_path);
                return;
        }
-       prev_entry = 
xa_find_entry_from_path(archive[idx]->root_entry,archive[idx]->location_entry_path);
+
+       if (archive[idx]->location_entry_path != NULL)
+               prev_entry = 
xa_find_entry_from_path(archive[idx]->root_entry,archive[idx]->location_entry_path);
+
        if (prev_entry != NULL)
                archive[idx]->back = 
g_slist_prepend(archive[idx]->back,prev_entry);
+       else
+               archive[idx]->back = g_slist_prepend(archive[idx]->back,NULL);
 
        xa_update_window_with_archive_entries(archive[idx],new_entry);
 }

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to