Author: colossus Date: 2008-01-01 22:29:56 +0000 (Tue, 01 Jan 2008) New Revision: 26521
Modified: xarchiver/trunk/ChangeLog xarchiver/trunk/src/add_dialog.c xarchiver/trunk/src/add_dialog.h xarchiver/trunk/src/archive.c xarchiver/trunk/src/extract_dialog.c xarchiver/trunk/src/extract_dialog.h xarchiver/trunk/src/interface.c xarchiver/trunk/src/main.c xarchiver/trunk/src/rpm.c xarchiver/trunk/src/window.c Log: Completely redesigned the extract dialog's layout. Fixed missed archive encryption notification. Changed name of xa_add_single_files() in xa_execute_add_commands(). Modified: xarchiver/trunk/ChangeLog =================================================================== --- xarchiver/trunk/ChangeLog 2007-12-31 23:19:24 UTC (rev 26520) +++ xarchiver/trunk/ChangeLog 2008-01-01 22:29:56 UTC (rev 26521) @@ -1,11 +1,13 @@ Xarchiver changelog: xx/01/08 - 0.5: - - Archive directories are now browsable just like a file managers. + - Archive directories can be browsed just like a file manager. - Mime icon for each of the archive entries. - New archive types support: lzma and tar.lzma. - Added a brand new preferences dialog to set Xarchiver's options. - - The add and extract dialogs have been improved. + - The add and extract dialogs layout have been redesigned. + - Context menu on each of the archive entries. + - Ability to rename entries in the archives. - The cmd-line output window now displays each archiver's output. - The cmd-line output window has a close button and a better layout. - Tabs are now reorderable. Modified: xarchiver/trunk/src/add_dialog.c =================================================================== --- xarchiver/trunk/src/add_dialog.c 2007-12-31 23:19:24 UTC (rev 26520) +++ xarchiver/trunk/src/add_dialog.c 2008-01-01 22:29:56 UTC (rev 26521) @@ -38,7 +38,7 @@ add_dialog->option_tooltip = gtk_tooltips_new (); add_dialog->dialog1 = gtk_dialog_new (); - gtk_widget_set_size_request (add_dialog->dialog1, 520, 370); + 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_resizable(GTK_WINDOW (add_dialog->dialog1),FALSE); gtk_window_set_transient_for (GTK_WINDOW (add_dialog->dialog1),GTK_WINDOW(MainWindow)); @@ -48,18 +48,18 @@ add_dialog->dialog_vbox1 = GTK_DIALOG (add_dialog->dialog1)->vbox; add_dialog->notebook1 = gtk_notebook_new (); - 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); + 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); + vbox1 = gtk_vbox_new (FALSE,0); gtk_container_add (GTK_CONTAINER (add_dialog->notebook1), vbox1); label1 = gtk_label_new (_("Selection")); 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_box_pack_start (GTK_BOX (vbox1), add_dialog->filechooserwidget1, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (vbox1), add_dialog->filechooserwidget1, TRUE, TRUE,0); if (archive->type == XARCHIVETYPE_BZIP2 || archive->type == XARCHIVETYPE_GZIP || archive->type == XARCHIVETYPE_LZMA) gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(add_dialog->filechooserwidget1),FALSE); else @@ -67,8 +67,8 @@ //gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(add_dialog->filechooserwidget1)); add_dialog->frame1 = gtk_frame_new (NULL); - gtk_box_pack_start (GTK_BOX (vbox1), add_dialog->frame1, FALSE, TRUE, 5); - gtk_container_set_border_width (GTK_CONTAINER (add_dialog->frame1), 5); + 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_container_add (GTK_CONTAINER (add_dialog->frame1), alignment1); @@ -413,7 +413,7 @@ else xa_cat_filenames(archive,files,names); - command = xa_add_single_files (archive,names,compression_string); + command = xa_execute_add_commands (archive,names,compression_string); g_string_free (names,TRUE); g_slist_free(files); if (compression_string != NULL) @@ -423,7 +423,7 @@ return command; } -gchar *xa_add_single_files (XArchive *archive,GString *names,gchar *compression_string) +gchar *xa_execute_add_commands (XArchive *archive,GString *names,gchar *compression_string) { gchar *command = NULL; gchar *tar; @@ -451,7 +451,7 @@ "-idp ", "-m",compression_string," ", archive->escaped_path, - names->str , NULL ); + names->str,NULL); else command = g_strconcat ( "rar a ", archive->update ? "-u " : "", @@ -462,7 +462,7 @@ "-idp ", "-m",compression_string," ", archive->escaped_path, - names->str , NULL ); + names->str,NULL); break; case XARCHIVETYPE_TAR: @@ -472,13 +472,13 @@ archive->remove_files ? "--remove-files " : "", archive->update ? "-uvvf " : "-rvvf ", archive->escaped_path, - names->str , NULL ); + names->str,NULL); else command = g_strconcat (tar, " ", archive->add_recurse ? "" : "--no-recursion ", archive->remove_files ? "--remove-files " : "", "-cvvf ",archive->escaped_path, - names->str , NULL ); + names->str,NULL); break; case XARCHIVETYPE_TAR_BZ2: @@ -489,7 +489,7 @@ archive->add_recurse ? "" : "--no-recursion ", archive->remove_files ? "--remove-files " : "", "-cvvjf ",archive->escaped_path, - names->str , NULL ); + names->str,NULL); break; case XARCHIVETYPE_TAR_GZ: @@ -501,7 +501,7 @@ archive->add_recurse ? "" : "--no-recursion ", archive->remove_files ? "--remove-files " : "", "-cvvzf ",archive->escaped_path, - names->str , NULL ); + names->str,NULL); break; case XARCHIVETYPE_TAR_LZMA: @@ -512,7 +512,7 @@ archive->add_recurse ? "" : "--no-recursion ", archive->remove_files ? "--remove-files " : "", "--use-compress-program=lzma -cvvf ",archive->escaped_path, - names->str , NULL ); + names->str,NULL); break; case XARCHIVETYPE_ZIP: @@ -527,7 +527,7 @@ "-P ", archive->passwd," ", "-",compression_string," ", archive->escaped_path, - names->str , NULL ); + names->str,NULL); else command = g_strconcat ( "zip ", archive->update ? "-u " : "", @@ -536,7 +536,7 @@ archive->remove_files ? "-m " : "", "-",compression_string," ", archive->escaped_path, - names->str , NULL ); + names->str,NULL); break; case XARCHIVETYPE_7ZIP: @@ -550,7 +550,7 @@ archive->escaped_path, archive->add_recurse ? " -r " : " ", "-mx=",compression_string,"", - names->str , NULL ); + names->str,NULL); else command = g_strconcat ( "7za ", archive->update ? "u " : "a ", @@ -558,7 +558,7 @@ archive->escaped_path, archive->add_recurse ? " -r " : " ", "-mx=",compression_string,"", - names->str , NULL ); + names->str,NULL); break; case XARCHIVETYPE_ARJ: @@ -573,7 +573,7 @@ "-g" , archive->passwd , " -i ", "-m",compression_string," ", archive->escaped_path, - names->str , NULL ); + names->str,NULL); else command = g_strconcat ( "arj a ", archive->update ? "-u " : "", @@ -583,7 +583,7 @@ " -i ", "-m",compression_string," ", archive->escaped_path, - names->str , NULL ); + names->str,NULL); break; case XARCHIVETYPE_LHA: @@ -595,7 +595,7 @@ "o",compression_string, " ", archive->escaped_path, - names->str, NULL); + names->str,NULL); break; default: Modified: xarchiver/trunk/src/add_dialog.h =================================================================== --- xarchiver/trunk/src/add_dialog.h 2007-12-31 23:19:24 UTC (rev 26520) +++ xarchiver/trunk/src/add_dialog.h 2008-01-01 22:29:56 UTC (rev 26521) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Giuseppe Torelli - <[EMAIL PROTECTED]> + * Copyright (C) 2008 Giuseppe Torelli - <[EMAIL PROTECTED]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -56,7 +56,7 @@ void password_toggled_cb ( GtkButton* button , gpointer _add_dialog ); gchar *xa_parse_add_dialog_options ( XArchive *archive, Add_dialog_data *dialog_data ); void xa_select_files_to_add ( GtkButton* button , gpointer _add_dialog ); -gchar *xa_add_single_files ( XArchive *archive , GString *names, gchar *compression_string); +gchar *xa_execute_add_commands ( XArchive *archive , GString *names, gchar *compression_string); void fix_adjustment_value (GtkAdjustment *adjustment, gpointer user_data); #endif Modified: xarchiver/trunk/src/archive.c =================================================================== --- xarchiver/trunk/src/archive.c 2007-12-31 23:19:24 UTC (rev 26520) +++ xarchiver/trunk/src/archive.c 2008-01-01 22:29:56 UTC (rev 26521) @@ -539,7 +539,10 @@ if (entry->is_dir) pixbuf = xa_get_pixbuf_icon_from_cache("folder"); else if (entry->is_encrypted) + { pixbuf = xa_get_pixbuf_icon_from_cache("lock"); + archive->has_passwd = TRUE; + } else pixbuf = xa_get_pixbuf_icon_from_cache(entry->filename); Modified: xarchiver/trunk/src/extract_dialog.c =================================================================== --- xarchiver/trunk/src/extract_dialog.c 2007-12-31 23:19:24 UTC (rev 26520) +++ xarchiver/trunk/src/extract_dialog.c 2008-01-01 22:29:56 UTC (rev 26521) @@ -29,138 +29,104 @@ extern gboolean unrar; gchar *rar; -Extract_dialog_data *xa_create_extract_dialog (gint selected , XArchive *archive) +Extract_dialog_data *xa_create_extract_dialog (gint selected,XArchive *archive) { + GSList *radiobutton1_group = NULL; Extract_dialog_data *dialog_data; stop_flag = FALSE; + home_dir = g_get_home_dir(); dialog_data = g_new0 (Extract_dialog_data, 1); - dialog_data->radio_group = NULL; dialog_data->dialog1 = gtk_dialog_new (); if (archive->type == XARCHIVETYPE_BZIP2 || archive->type == XARCHIVETYPE_GZIP || archive->type == XARCHIVETYPE_LZMA) gtk_window_set_title (GTK_WINDOW (dialog_data->dialog1), _("Decompress file")); else gtk_window_set_title (GTK_WINDOW (dialog_data->dialog1), _("Extract files from archive")); gtk_window_set_type_hint (GTK_WINDOW (dialog_data->dialog1), GDK_WINDOW_TYPE_HINT_DIALOG); - gtk_window_set_transient_for ( GTK_WINDOW (dialog_data->dialog1) , GTK_WINDOW (MainWindow) ); - gtk_dialog_set_has_separator (GTK_DIALOG (dialog_data->dialog1), FALSE); + gtk_window_set_transient_for (GTK_WINDOW(dialog_data->dialog1),GTK_WINDOW (MainWindow)); + gtk_dialog_set_has_separator (GTK_DIALOG(dialog_data->dialog1),FALSE); + gtk_widget_set_size_request (dialog_data->dialog1,492,372); - dialog_data->option_tooltip = gtk_tooltips_new (); + option_tooltip = gtk_tooltips_new (); dialog_data->dialog_vbox1 = GTK_DIALOG (dialog_data->dialog1)->vbox; - gtk_widget_show (dialog_data->dialog_vbox1); - dialog_data->vbox1 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (dialog_data->vbox1); - gtk_box_pack_start (GTK_BOX (dialog_data->dialog_vbox1), dialog_data->vbox1, TRUE, TRUE, 0); + vbox1 = gtk_vbox_new (FALSE, 2); + gtk_box_pack_start (GTK_BOX (dialog_data->dialog_vbox1), vbox1, TRUE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2); - dialog_data->hbox3 = gtk_hbox_new (FALSE, 0); - gtk_widget_show (dialog_data->hbox3); - gtk_box_pack_start (GTK_BOX (dialog_data->vbox1), dialog_data->hbox3, FALSE, TRUE, 17); + label1 = gtk_label_new (_("Extract to:")); + gtk_box_pack_start (GTK_BOX (vbox1), label1, FALSE, FALSE, 0); + gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5); - dialog_data->extract_to_label = gtk_label_new (_("Extract to:")); - gtk_widget_show (dialog_data->extract_to_label); - gtk_box_pack_start (GTK_BOX (dialog_data->hbox3), dialog_data->extract_to_label, FALSE, TRUE, 0); - dialog_data->destination_path_entry = gtk_entry_new (); - gtk_widget_show (dialog_data->destination_path_entry); - gtk_box_pack_start (GTK_BOX (dialog_data->hbox3), dialog_data->destination_path_entry, TRUE, TRUE, 0); - gtk_widget_set_size_request (dialog_data->destination_path_entry, 385, -1); - gtk_entry_set_activates_default (GTK_ENTRY (dialog_data->destination_path_entry), TRUE); + gtk_entry_set_text (GTK_ENTRY(dialog_data->destination_path_entry),home_dir); + gtk_box_pack_start (GTK_BOX (vbox1), dialog_data->destination_path_entry, FALSE, FALSE, 0); - gchar *dummy = g_strrstr(archive->path, "."); - if (dummy != NULL) - { - dummy++; - unsigned short int x = strlen (archive->path) - strlen ( dummy ); - gchar *extraction_string = g_strndup(archive->path, x-1); - if (strstr (extraction_string,".tar")) - { - gchar *extraction_string_no_tar = g_strndup(extraction_string, x-5); - g_free (extraction_string); - extraction_string = extraction_string_no_tar; - } - gtk_entry_set_text (GTK_ENTRY(dialog_data->destination_path_entry), extraction_string); - g_free (extraction_string); - } - else - gtk_entry_set_text (GTK_ENTRY(dialog_data->destination_path_entry), archive->path); + hbox1 = gtk_hbox_new (TRUE, 10); + gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0); - dialog_data->button1 = gtk_button_new (); - gtk_widget_set_size_request (dialog_data->button1, 33, 27); - gtk_widget_show (dialog_data->button1); + vbox2 = gtk_vbox_new (FALSE, 5); + gtk_box_pack_start (GTK_BOX (hbox1), vbox2, TRUE, TRUE, 0); - dialog_data->image1 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON); - gtk_widget_show (dialog_data->image1); - gtk_box_pack_end(GTK_BOX (dialog_data->hbox3), dialog_data->button1, FALSE, TRUE, 0); - gtk_widget_set_size_request (dialog_data->image1, 30, 30); + frame1 = gtk_frame_new (NULL); + gtk_box_pack_start (GTK_BOX (vbox2), frame1, TRUE, TRUE, 0); + gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_OUT); - gtk_container_add(GTK_CONTAINER(dialog_data->button1), dialog_data->image1); - gtk_tooltips_set_tip (dialog_data->option_tooltip,dialog_data->button1 , _("Choose a directory where to extract files"), NULL ); - g_signal_connect ( (gpointer) dialog_data->button1, "clicked", G_CALLBACK (xa_choose_extraction_directory) , dialog_data ); + alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1); + gtk_container_add (GTK_CONTAINER (frame1), alignment1); + gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 12, 0); - dialog_data->hbox4 = gtk_hbox_new (TRUE, 7); - gtk_widget_show (dialog_data->hbox4); - gtk_box_pack_start (GTK_BOX (dialog_data->vbox1), dialog_data->hbox4, FALSE, FALSE, 0); + vbox3 = gtk_vbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (alignment1), vbox3); - dialog_data->frame1 = gtk_frame_new (NULL); - gtk_widget_show (dialog_data->frame1); - gtk_box_pack_start (GTK_BOX (dialog_data->hbox4), dialog_data->frame1, TRUE, TRUE, 0); - gtk_widget_set_size_request (dialog_data->frame1, 1, -1); - gtk_frame_set_shadow_type (GTK_FRAME (dialog_data->frame1), GTK_SHADOW_OUT); + dialog_data->all_files_radio = gtk_radio_button_new_with_mnemonic (NULL, _("All files")); + gtk_box_pack_start (GTK_BOX (vbox3), dialog_data->all_files_radio, FALSE, FALSE, 0); + gtk_radio_button_set_group (GTK_RADIO_BUTTON (dialog_data->all_files_radio), radiobutton1_group); + radiobutton1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (dialog_data->all_files_radio)); - dialog_data->alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1); - gtk_widget_show (dialog_data->alignment1); - gtk_container_add (GTK_CONTAINER (dialog_data->frame1), dialog_data->alignment1); - gtk_alignment_set_padding (GTK_ALIGNMENT (dialog_data->alignment1), 0, 0, 12, 0); + radiobutton1 = gtk_radio_button_new_with_mnemonic (NULL, _("Selected files")); + gtk_box_pack_start (GTK_BOX (vbox3), radiobutton1, FALSE, FALSE, 0); + gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton1), radiobutton1_group); + radiobutton1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton1)); - dialog_data->vbox3 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (dialog_data->vbox3); - gtk_container_add (GTK_CONTAINER (dialog_data->alignment1), dialog_data->vbox3); - - dialog_data->all_files_radio = gtk_radio_button_new_with_mnemonic (NULL, _("All")); - gtk_widget_show (dialog_data->all_files_radio); - gtk_box_pack_start (GTK_BOX (dialog_data->vbox3), dialog_data->all_files_radio, FALSE, FALSE, 0); - gtk_radio_button_set_group (GTK_RADIO_BUTTON (dialog_data->all_files_radio), dialog_data->radio_group); - dialog_data->radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (dialog_data->all_files_radio)); - - dialog_data->selected_files_radio = gtk_radio_button_new_with_mnemonic (NULL, _("Only selected")); - gtk_widget_show (dialog_data->selected_files_radio); - gtk_box_pack_start (GTK_BOX (dialog_data->vbox3), dialog_data->selected_files_radio, FALSE, FALSE, 0); - gtk_radio_button_set_group (GTK_RADIO_BUTTON (dialog_data->selected_files_radio), dialog_data->radio_group); - dialog_data->radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (dialog_data->selected_files_radio)); - if (selected) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog_data->selected_files_radio), TRUE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton1),TRUE); else - gtk_widget_set_sensitive (dialog_data->selected_files_radio , FALSE); + gtk_widget_set_sensitive (radiobutton1,FALSE); - dialog_data->files_frame_label = gtk_label_new (_("<b>Files to extract </b>")); - gtk_widget_show (dialog_data->files_frame_label); - gtk_frame_set_label_widget (GTK_FRAME (dialog_data->frame1), dialog_data->files_frame_label); - gtk_label_set_use_markup (GTK_LABEL (dialog_data->files_frame_label), TRUE); + hbox2 = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox3), hbox2, FALSE, FALSE, 0); - dialog_data->frame2 = gtk_frame_new (NULL); - gtk_widget_show (dialog_data->frame2); - gtk_box_pack_start (GTK_BOX (dialog_data->hbox4), dialog_data->frame2, TRUE, TRUE, 0); - gtk_frame_set_shadow_type (GTK_FRAME (dialog_data->frame2), GTK_SHADOW_OUT); + radiobutton3 = gtk_radio_button_new_with_mnemonic (NULL, _("Files: ")); + gtk_box_pack_start (GTK_BOX (hbox2), radiobutton3, FALSE, FALSE, 0); + gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton3), radiobutton1_group); + radiobutton1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton3)); - dialog_data->alignment2 = gtk_alignment_new (0.5, 0.5, 1, 1); - gtk_widget_show (dialog_data->alignment2); - gtk_container_add (GTK_CONTAINER (dialog_data->frame2), dialog_data->alignment2); - gtk_alignment_set_padding (GTK_ALIGNMENT (dialog_data->alignment2), 0, 0, 12, 0); + entry2 = gtk_entry_new (); + gtk_box_pack_start (GTK_BOX (hbox2), entry2, TRUE, TRUE, 0); + gtk_entry_set_width_chars (GTK_ENTRY (entry2),10); - dialog_data->vbox4 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (dialog_data->vbox4); - gtk_container_add (GTK_CONTAINER (dialog_data->alignment2), dialog_data->vbox4); + label2 = gtk_label_new (_("Files ")); + gtk_frame_set_label_widget (GTK_FRAME (frame1), label2); + frame2 = gtk_frame_new (NULL); + gtk_box_pack_start (GTK_BOX (vbox2), 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, 12, 0); + + vbox5 = gtk_vbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (alignment2), vbox5); + dialog_data->overwrite_check = gtk_check_button_new_with_mnemonic (_("Overwrite existing files")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog_data->overwrite_check), archive->overwrite); - gtk_widget_show (dialog_data->overwrite_check); - gtk_box_pack_start (GTK_BOX (dialog_data->vbox4), dialog_data->overwrite_check, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox5), dialog_data->overwrite_check, FALSE, FALSE, 0); dialog_data->extract_full = gtk_check_button_new_with_mnemonic (_("Extract files with full path")); - if (archive->type == XARCHIVETYPE_GZIP || archive->type == XARCHIVETYPE_LZMA || archive->type == XARCHIVETYPE_BZIP2 ) - goto here; + /*if (archive->type == XARCHIVETYPE_GZIP || archive->type == XARCHIVETYPE_LZMA || archive->type == XARCHIVETYPE_BZIP2 ) + goto here;*/ if (archive->type == XARCHIVETYPE_TAR || archive->type == XARCHIVETYPE_TAR_GZ || archive->type == XARCHIVETYPE_TAR_LZMA || archive->type == XARCHIVETYPE_DEB || archive->type == XARCHIVETYPE_TAR_BZ2) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog_data->extract_full), TRUE); @@ -168,21 +134,20 @@ } else gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog_data->extract_full), archive->full_path); - gtk_widget_show (dialog_data->extract_full); - gtk_tooltips_set_tip (dialog_data->option_tooltip,dialog_data->extract_full , _("The archive's directory structure is recreated in the extraction directory."), NULL ); - gtk_box_pack_start (GTK_BOX (dialog_data->vbox4), dialog_data->extract_full, FALSE, FALSE, 0); + gtk_tooltips_set_tip(option_tooltip,dialog_data->extract_full , _("The archive's directory structure is recreated in the extraction directory."), NULL ); + gtk_box_pack_start (GTK_BOX (vbox5), dialog_data->extract_full, FALSE, FALSE, 0); + if (archive->type == XARCHIVETYPE_TAR || archive->type == XARCHIVETYPE_TAR_GZ || archive->type == XARCHIVETYPE_TAR_LZMA || archive->type == XARCHIVETYPE_TAR_BZ2 || archive->type == XARCHIVETYPE_DEB) { dialog_data->touch = gtk_check_button_new_with_mnemonic (_("Touch files")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog_data->touch), archive->tar_touch); - gtk_widget_show (dialog_data->touch); - gtk_tooltips_set_tip (dialog_data->option_tooltip,dialog_data->touch, _("When this option is used, tar leaves the data modification times of the files it extracts as the times when the files were extracted, instead of setting it to the times recorded in the archive."), NULL ); - gtk_box_pack_start (GTK_BOX (dialog_data->vbox4), dialog_data->touch, FALSE, FALSE, 0); -here: + gtk_tooltips_set_tip (option_tooltip,dialog_data->touch, _("When this option is used, tar leaves the data modification times of the files it extracts as the times when the files were extracted, instead of setting it to the times recorded in the archive."), NULL ); + gtk_box_pack_start (GTK_BOX (vbox5), dialog_data->touch, FALSE, FALSE, 0); +/*here: dialog_data->hbox6 = gtk_hbox_new (FALSE, 2); gtk_widget_show (dialog_data->hbox6); - gtk_box_pack_start (GTK_BOX (dialog_data->vbox4), dialog_data->hbox6, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox5), dialog_data->hbox6, FALSE, FALSE, 0);*/ } else dialog_data->touch = NULL; @@ -190,17 +155,15 @@ if (archive->type == XARCHIVETYPE_RAR || archive->type == XARCHIVETYPE_ZIP || archive->type == XARCHIVETYPE_ARJ) { dialog_data->fresh = gtk_check_button_new_with_mnemonic (_("Freshen existing files")); - gtk_tooltips_set_tip (dialog_data->option_tooltip,dialog_data->fresh , _("Extract only those files that already exist on disk and that are newer than the disk copies."), NULL ); + gtk_tooltips_set_tip (option_tooltip,dialog_data->fresh , _("Extract only those files that already exist on disk and that are newer than the disk copies."), NULL ); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog_data->fresh), archive->freshen); - gtk_widget_show (dialog_data->fresh); - gtk_box_pack_start (GTK_BOX (dialog_data->vbox4), dialog_data->fresh, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox5), dialog_data->fresh, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (dialog_data->fresh),"toggled",G_CALLBACK (fresh_update_toggled_cb) , dialog_data); dialog_data->update = gtk_check_button_new_with_mnemonic (_("Update existing files")); - gtk_tooltips_set_tip (dialog_data->option_tooltip,dialog_data->update , _("This option performs the same function as the freshen one, extracting files that are newer than those with the same name on disk, and in addition it extracts those files that do not already exist on disk."), NULL ); + gtk_tooltips_set_tip (option_tooltip,dialog_data->update , _("This option performs the same function as the freshen one, extracting files that are newer than those with the same name on disk, and in addition it extracts those files that do not already exist on disk."), NULL ); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog_data->update), archive->update); - gtk_widget_show (dialog_data->update); - gtk_box_pack_start (GTK_BOX (dialog_data->vbox4), dialog_data->update, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox5), dialog_data->update, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (dialog_data->update),"toggled",G_CALLBACK (update_fresh_toggled_cb) , dialog_data); } else @@ -208,62 +171,92 @@ dialog_data->fresh = NULL; dialog_data->update = NULL; } - dialog_data->hbox5 = gtk_hbox_new (FALSE, 2); - gtk_widget_show (dialog_data->hbox5); - gtk_box_pack_start (GTK_BOX (dialog_data->vbox4), dialog_data->hbox5, FALSE, FALSE, 0); - dialog_data->label_password = gtk_label_new (_("Password:")); - gtk_widget_show (dialog_data->label_password); - gtk_box_pack_start (GTK_BOX (dialog_data->hbox5), dialog_data->label_password, FALSE, FALSE, 0); + label3 = gtk_label_new (_("Options ")); + gtk_frame_set_label_widget (GTK_FRAME (frame2), label3); + vbox4 = gtk_vbox_new (FALSE, 4); + gtk_box_pack_start (GTK_BOX (hbox1), vbox4, TRUE, TRUE, 0); + + label4 = gtk_label_new (_("Directories Tree:")); + gtk_box_pack_start (GTK_BOX (vbox4), label4, FALSE, FALSE, 0); + gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5); + + scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); + gtk_box_pack_start (GTK_BOX (vbox4), scrolledwindow1, TRUE, TRUE, 0); + g_object_set (G_OBJECT (scrolledwindow1),"hscrollbar-policy", GTK_POLICY_AUTOMATIC,"shadow-type", GTK_SHADOW_IN,"vscrollbar-policy", GTK_POLICY_AUTOMATIC, NULL); + + model = gtk_tree_store_new (3,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING); + treeview3 = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); + gtk_container_add (GTK_CONTAINER (scrolledwindow1), treeview3); + gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview3), FALSE); + gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model),1,GTK_SORT_ASCENDING); + g_signal_connect (G_OBJECT (treeview3),"row-expanded",G_CALLBACK(xa_expand_dir),dialog_data->destination_path_entry); + GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW (treeview3)); + g_signal_connect ((gpointer) sel,"changed",G_CALLBACK (xa_tree_view_row_selected),dialog_data->destination_path_entry); + + column = gtk_tree_view_column_new(); + renderer = gtk_cell_renderer_pixbuf_new(); + gtk_tree_view_column_pack_start(column,renderer, FALSE); + gtk_tree_view_column_set_attributes(column,renderer, "stock-id",0,NULL); + + renderer = gtk_cell_renderer_text_new (); + gtk_tree_view_column_pack_start(column,renderer, TRUE); + gtk_tree_view_column_set_attributes( column,renderer,"text",1,NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (treeview3), column); + + alignment3 = gtk_alignment_new (0.5, 0.5, 1, 1); + gtk_box_pack_start (GTK_BOX (vbox1), alignment3, FALSE, FALSE, 0); + gtk_alignment_set_padding (GTK_ALIGNMENT (alignment3), 0, 0, 370, 0); + + create_dir = gtk_button_new_with_mnemonic (_("Create Dir")); + gtk_container_add (GTK_CONTAINER (alignment3),create_dir); + + hbox3 = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox5), hbox3, TRUE, TRUE, 0); + + label_password = gtk_label_new (_("Password:")); + gtk_box_pack_start (GTK_BOX (hbox3), label_password, FALSE, FALSE, 0); + dialog_data->password_entry = gtk_entry_new (); - gtk_widget_show (dialog_data->password_entry); - gtk_box_pack_start (GTK_BOX (dialog_data->hbox5), dialog_data->password_entry, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox3), dialog_data->password_entry, TRUE, TRUE, 0); gtk_entry_set_visibility (GTK_ENTRY (dialog_data->password_entry), FALSE); - if ( archive->has_passwd ) + if (archive->has_passwd) { - gtk_widget_set_sensitive (dialog_data->label_password, TRUE); + gtk_widget_set_sensitive (label_password, TRUE); gtk_widget_set_sensitive (dialog_data->password_entry, TRUE); if (archive->passwd != NULL) - gtk_entry_set_text (GTK_ENTRY(dialog_data->password_entry) , archive->passwd); + gtk_entry_set_text (GTK_ENTRY(dialog_data->password_entry),archive->passwd); } else { - gtk_widget_set_sensitive (dialog_data->label_password, FALSE); - gtk_widget_set_sensitive (dialog_data->password_entry, FALSE); + gtk_widget_set_sensitive (label_password,FALSE); + gtk_widget_set_sensitive (dialog_data->password_entry,FALSE); } - dialog_data->options_frame_label = gtk_label_new (_("<b>Options </b>")); - gtk_widget_show (dialog_data->options_frame_label); - gtk_frame_set_label_widget (GTK_FRAME (dialog_data->frame2), dialog_data->options_frame_label); - gtk_label_set_use_markup (GTK_LABEL (dialog_data->options_frame_label), TRUE); + dialog_action_area1 = GTK_DIALOG (dialog_data->dialog1)->action_area; + gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); - dialog_data->dialog_action_area1 = GTK_DIALOG (dialog_data->dialog1)->action_area; - gtk_widget_show (dialog_data->dialog_action_area1); - gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_data->dialog_action_area1), GTK_BUTTONBOX_END); + cancel_button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); + gtk_dialog_add_action_widget (GTK_DIALOG (dialog_data->dialog1),cancel_button, GTK_RESPONSE_CANCEL); + GTK_WIDGET_SET_FLAGS (cancel_button, GTK_CAN_DEFAULT); - dialog_data->cancel_button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); - gtk_widget_show (dialog_data->cancel_button); - gtk_dialog_add_action_widget (GTK_DIALOG (dialog_data->dialog1), dialog_data->cancel_button, GTK_RESPONSE_CANCEL); - GTK_WIDGET_SET_FLAGS (dialog_data->cancel_button, GTK_CAN_DEFAULT); + extract_button = gtk_button_new(); + extract_image = xa_main_window_find_image("xarchiver-extract.png", GTK_ICON_SIZE_SMALL_TOOLBAR); + extract_hbox = gtk_hbox_new(FALSE, 4); + extract_label = gtk_label_new_with_mnemonic(_("_Extract")); - dialog_data->extract_button = gtk_button_new(); - dialog_data->extract_image = xa_main_window_find_image("xarchiver-extract.png", GTK_ICON_SIZE_SMALL_TOOLBAR); - dialog_data->extract_hbox = gtk_hbox_new(FALSE, 4); - dialog_data->extract_label = gtk_label_new_with_mnemonic(_("_Extract")); + alignment3 = gtk_alignment_new (0.5, 0.5, 0, 0); + gtk_container_add (GTK_CONTAINER (alignment3),extract_hbox); + gtk_box_pack_start(GTK_BOX(extract_hbox),extract_image, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(extract_hbox),extract_label, FALSE, FALSE, 0); + gtk_container_add(GTK_CONTAINER(extract_button),alignment3); - dialog_data->alignment3 = gtk_alignment_new (0.5, 0.5, 0, 0); - gtk_widget_show (dialog_data->alignment3); - gtk_container_add (GTK_CONTAINER (dialog_data->alignment3), dialog_data->extract_hbox); - - gtk_box_pack_start(GTK_BOX(dialog_data->extract_hbox), dialog_data->extract_image, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(dialog_data->extract_hbox), dialog_data->extract_label, FALSE, FALSE, 0); - gtk_widget_show_all(dialog_data->extract_hbox); - gtk_container_add(GTK_CONTAINER(dialog_data->extract_button), dialog_data->alignment3); - gtk_widget_show (dialog_data->extract_button); - gtk_dialog_add_action_widget (GTK_DIALOG (dialog_data->dialog1), dialog_data->extract_button, GTK_RESPONSE_OK); - GTK_WIDGET_SET_FLAGS (dialog_data->extract_button, GTK_CAN_DEFAULT); + gtk_dialog_add_action_widget (GTK_DIALOG (dialog_data->dialog1), extract_button, GTK_RESPONSE_OK); + GTK_WIDGET_SET_FLAGS (extract_button, GTK_CAN_DEFAULT); gtk_dialog_set_default_response (GTK_DIALOG (dialog_data->dialog1), GTK_RESPONSE_OK); + xa_browse_dir(model,"/",NULL); + gtk_widget_show_all(dialog_data->dialog1); return dialog_data; } @@ -378,7 +371,7 @@ gtk_widget_hide (dialog_data->dialog1); archive->status = XA_ARCHIVESTATUS_EXTRACT; /* Are all files selected? */ - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON ( dialog_data->all_files_radio )) ) + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON (dialog_data->all_files_radio )) ) { if (MainWindow) { @@ -867,6 +860,72 @@ return result; } +void xa_browse_dir(GtkTreeStore *model,gchar *path, GtkTreeIter *parent) +{ + DIR *dir; + struct dirent *list; + gchar *fullname; + GtkTreeIter iter; + GtkTreeIter dummy; + + dir = opendir(path); + if (dir == NULL) + return; + while ((list = readdir(dir))) + { + if (list->d_name[0] == '.') + continue; + fullname = g_strconcat (path,"/",list->d_name,NULL); + if (g_file_test(fullname,G_FILE_TEST_IS_DIR)) + { + gtk_tree_store_append(model,&iter,parent); + gtk_tree_store_set(model,&iter,0,"gtk-directory",1,list->d_name,2,fullname,-1); + gtk_tree_store_append(model,&dummy,&iter); + } + g_free(fullname); + } + closedir(dir); +} + +void xa_tree_view_row_selected(GtkTreeSelection *selection, gpointer data) +{ + GtkEntry *entry = data; + gchar *dir; + GtkTreeIter iter; + GtkTreeModel *model; + + if (gtk_tree_selection_get_selected (selection, &model, &iter)) + { + gtk_tree_model_get (model,&iter,2,&dir,-1); + gtk_entry_set_text(entry,dir); + g_free(dir); + } +} + +void xa_expand_dir(GtkTreeView *tree_view,GtkTreeIter *iter,GtkTreePath *path,gpointer data) +{ + GtkEntry *entry = data; + GtkTreeModel *model; + gchar *dir; + GtkTreeIter child; + gchar *fullname; + + model = gtk_tree_view_get_model(tree_view); + gtk_tree_model_get(model,iter,2,&dir,-1); + gtk_tree_model_iter_nth_child(model,&child,iter,0); + gtk_tree_model_get(model,&child,1,&fullname,-1); + if (fullname == NULL) + { + xa_browse_dir(GTK_TREE_STORE(model),dir,iter); + gtk_tree_store_remove(GTK_TREE_STORE(model),&child); + } + else + g_free(fullname); + + gtk_entry_set_text(entry,dir); + g_free(dir); +} + void xa_choose_extraction_directory (GtkWidget *widget, gpointer data) { Extract_dialog_data *dialog_data = data; Modified: xarchiver/trunk/src/extract_dialog.h =================================================================== --- xarchiver/trunk/src/extract_dialog.h 2007-12-31 23:19:24 UTC (rev 26520) +++ xarchiver/trunk/src/extract_dialog.h 2008-01-01 22:29:56 UTC (rev 26521) @@ -20,55 +20,45 @@ #define __EXTRACT_DIALOG_H #include "archive.h" +#include <sys/types.h> +#include <dirent.h> typedef struct { GtkWidget *dialog1; GtkWidget *dialog_vbox1; - GtkWidget *vbox1; - GtkWidget *vbox2; - GtkWidget *hbox3; - GtkWidget *extract_to_label; GtkWidget *destination_path_entry; - GtkWidget *button1; - GtkWidget *image1; - GtkWidget *hbox4; - GtkWidget *frame1; - GtkWidget *alignment1; - GtkWidget *alignment2; - GtkWidget *alignment3; - GtkWidget *vbox3; - GtkWidget *all_files_radio; - GtkWidget *selected_files_radio; - GSList *radio_group; - GtkWidget *files_frame_label; - GtkWidget *frame2; - GtkWidget *vbox4; GtkWidget *overwrite_check; GtkWidget *extract_full; GtkWidget *touch; GtkWidget *fresh; GtkWidget *update; - GtkWidget *hbox5; - GtkWidget *hbox6; - GtkWidget *label_password; + GtkWidget *all_files_radio; GtkWidget *password_entry; - GtkWidget *options_frame_label; - GtkWidget *dialog_action_area1; - GtkWidget *cancel_button; - GtkWidget *extract_button; - GtkWidget *extract_image; - GtkWidget *extract_label; - GtkWidget *extract_hbox; - GtkTooltips *option_tooltip; } Extract_dialog_data; +GtkWidget *label1,*label2,*label3,*label4,*label_password; +GtkWidget *hbox1,*hbox2,*hbox3,*vbox1,*vbox2,*vbox3,*vbox4,*vbox5; +GtkWidget *frame1,*frame2,*alignment1,*alignment2,*alignment3; +GtkWidget *radiobutton1,*radiobutton3; +GtkWidget *entry2,*create_dir; +GtkWidget *scrolledwindow1,*treeview3; +GtkWidget *dialog_action_area1,*cancel_button,*okbutton1,*extract_button,*extract_image,*extract_hbox,*extract_label; +GtkTreeStore *model; +GtkCellRenderer *renderer; +GtkTreeViewColumn *column; +GtkTooltips *option_tooltip; +const gchar *home_dir; + Extract_dialog_data *xa_create_extract_dialog (gint selected ,XArchive *archive); void fresh_update_toggled_cb (GtkToggleButton *button, Extract_dialog_data *data); void update_fresh_toggled_cb (GtkToggleButton *button, Extract_dialog_data *data); gchar *xa_parse_extract_dialog_options ( XArchive *archive , Extract_dialog_data *dialog_data, GtkTreeSelection *selection); gchar *xa_extract_single_files ( XArchive *archive , GString *files, gchar *path); gboolean xa_extract_tar_without_directories ( gchar *string, XArchive *archive,gchar *extract_path,gboolean cpio_flag); +void xa_browse_dir (GtkTreeStore *model,gchar *dir, GtkTreeIter *iter); +void xa_tree_view_row_selected(GtkTreeSelection *selection, gpointer data); +void xa_expand_dir(GtkTreeView *tree_view,GtkTreeIter *iter,GtkTreePath *path,gpointer data); void xa_choose_extraction_directory (GtkWidget *widget, gpointer data); #endif Modified: xarchiver/trunk/src/interface.c =================================================================== --- xarchiver/trunk/src/interface.c 2007-12-31 23:19:24 UTC (rev 26520) +++ xarchiver/trunk/src/interface.c 2008-01-01 22:29:56 UTC (rev 26521) @@ -589,11 +589,11 @@ gtk_drag_source_set (archive->treeview, GDK_BUTTON1_MASK, drag_targets, 1, GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_ASK); g_signal_connect ((gpointer) sel, "changed", G_CALLBACK (xa_activate_delete_and_view),archive); - g_signal_connect (G_OBJECT (archive->treeview), "drag_begin", G_CALLBACK (drag_begin),archive); - g_signal_connect (G_OBJECT (archive->treeview), "drag_data_get",G_CALLBACK (drag_data_get),archive); - g_signal_connect (G_OBJECT (archive->treeview), "drag_end", G_CALLBACK (drag_end),NULL); - g_signal_connect (G_OBJECT (archive->treeview), "row_activated",G_CALLBACK (xa_treeview_row_activated),archive); - g_signal_connect (G_OBJECT (archive->treeview), "button_press_event",G_CALLBACK (xa_mouse_button_event),archive); + g_signal_connect (G_OBJECT (archive->treeview), "drag-begin", G_CALLBACK (drag_begin),archive); + g_signal_connect (G_OBJECT (archive->treeview), "drag-data-get",G_CALLBACK (drag_data_get),archive); + g_signal_connect (G_OBJECT (archive->treeview), "drag-end", G_CALLBACK (drag_end),NULL); + g_signal_connect (G_OBJECT (archive->treeview), "row-activated",G_CALLBACK (xa_treeview_row_activated),archive); + g_signal_connect (G_OBJECT (archive->treeview), "button-press-event",G_CALLBACK (xa_mouse_button_event),archive); } void xa_close_page (GtkWidget *widget, gpointer data) Modified: xarchiver/trunk/src/main.c =================================================================== --- xarchiver/trunk/src/main.c 2007-12-31 23:19:24 UTC (rev 26520) +++ xarchiver/trunk/src/main.c 2008-01-01 22:29:56 UTC (rev 26521) @@ -190,7 +190,7 @@ archive->add_recurse = FALSE; else archive->add_recurse = TRUE; - cli_command = xa_add_single_files(archive,string,NULL); + cli_command = xa_execute_add_commands(archive,string,NULL); if (cli_command != NULL) error_output = xa_spawn_sync_process(cli_command); g_string_free (string,TRUE); Modified: xarchiver/trunk/src/rpm.c =================================================================== --- xarchiver/trunk/src/rpm.c 2007-12-31 23:19:24 UTC (rev 26520) +++ xarchiver/trunk/src/rpm.c 2008-01-01 22:29:56 UTC (rev 26521) @@ -144,8 +144,7 @@ xa_delete_temp_directory (archive[idx],1); g_free (cpio_tmp); xa_set_button_state (1,1,GTK_WIDGET_IS_SENSITIVE(close1),0,0,0,0,0); - //TODO: - //xa_hide_progress_bar_stop_button(archive[idx]); + //TODO: xa_hide_progress_bar_stop_button(archive[idx]); return FALSE; } } Modified: xarchiver/trunk/src/window.c =================================================================== --- xarchiver/trunk/src/window.c 2007-12-31 23:19:24 UTC (rev 26520) +++ xarchiver/trunk/src/window.c 2008-01-01 22:29:56 UTC (rev 26521) @@ -1886,7 +1886,7 @@ archive[idx]->full_path = 0; archive[idx]->add_recurse = 1; - command = xa_add_single_files (archive[idx],names,NULL); + command = xa_execute_add_commands(archive[idx],names,NULL); archive[idx]->has_passwd = dummy_password; archive[idx]->full_path = full_path; @@ -1901,8 +1901,8 @@ list = g_slist_append(list,command); xa_run_command (archive[idx],list); } - g_string_free (names, TRUE); - g_strfreev ( array ); + g_string_free (names,TRUE); + g_strfreev (array); } @@ -2095,14 +2095,16 @@ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (archive->treeview)); gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (archive->treeview),event->x, event->y,&path,NULL,NULL,NULL); + if (path == NULL) + return FALSE; if ((event->type == GDK_BUTTON_PRESS) && (event->button == 3)) { gtk_tree_model_get_iter (GTK_TREE_MODEL (archive->liststore),&iter,path); gtk_tree_path_free (path); - if (! gtk_tree_selection_iter_is_selected (selection, &iter)) + if (! gtk_tree_selection_iter_is_selected (selection,&iter)) { gtk_tree_selection_unselect_all (selection); - gtk_tree_selection_select_iter (selection, &iter); + gtk_tree_selection_select_iter (selection,&iter); } gtk_menu_popup (GTK_MENU (xa_popup_menu),NULL,NULL,NULL,MainWindow,event->button,event->time); return TRUE; _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits