⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 callbacks.c

📁 unix/linux下支持各种压缩算法的软件
💻 C
📖 第 1 页 / 共 4 页
字号:
		{			case 0:			Bzip2Add ( names->str , 0 );			break;            			case 1:			Bzip2Add ( names->str , 1 );			break;						case 2:            if (password != NULL) command = g_strconcat ( "rar a -p" , password, " -o+ -ep1 -idp " , path , names->str , NULL );                else command = g_strconcat ( "rar a -o+ -ep1 -idp " , path , names->str , NULL );			break;						case 3:			if ( g_file_test ( path , G_FILE_TEST_EXISTS ) ) command = g_strconcat ( "tar rvvf " , path , names->str , NULL );                else command = g_strconcat ( "tar cvvf " , path , names->str , NULL );    		break;			            case 4:            if ( g_file_test ( path , G_FILE_TEST_EXISTS ) ) DecompressBzipGzip ( names , path , 0 , 1 );                else command = g_strconcat ("tar cvvfj " , path , names->str , NULL );            break;            case 5:            if ( g_file_test ( path , G_FILE_TEST_EXISTS ) ) DecompressBzipGzip ( names , path , 1 , 1 );                else command = g_strconcat ("tar cvvfz " , path , names->str , NULL );            break;			case 6:			case 7:            if (password != NULL) command = g_strconcat ( "zip -P " , password , " -r " , path , names->str , NULL );                else command = g_strconcat ( "zip -r " , path , names->str , NULL );			break;            case 9:            if (password != NULL) command = g_strconcat ( "7za a -ms=off -p" , password , " " , path , names->str , NULL );                else command = g_strconcat ( "7za a -ms=off " , path , names->str , NULL );            break;            case 10:            if (password != NULL) command = g_strconcat ( "arj a -i -r -g" , password , " " , path , names->str , NULL );                else command = g_strconcat ( "arj a -i -r " , path , names->str , NULL );            break;		}    Update_StatusBar ( _("Adding files to the archive, please wait..."));    if (command != NULL)    {        ExtractAddDelete ( command );        g_free (command);    }	g_string_free (names , FALSE );	g_slist_free ( Files_to_Add );}void on_extract1_activate ( GtkMenuItem *menuitem , gpointer user_data ){	gchar *command = NULL;	GtkTreeSelection *selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW (treeview1) );	gint selected = gtk_tree_selection_count_selected_rows ( selection );	extract_window = prefs (selected);	gtk_dialog_set_default_response (GTK_DIALOG (extract_window), GTK_RESPONSE_OK);    if ( PasswordProtectedArchive )    {            if (password == NULL) Show_pwd_Window ( NULL , NULL );            if ( password == NULL) return;    }    done = FALSE;    while ( ! done )	{		switch (gtk_dialog_run ( GTK_DIALOG (extract_window ) ) )		{			case GTK_RESPONSE_CANCEL:			case GTK_RESPONSE_DELETE_EVENT:			done = TRUE;            gtk_widget_destroy ( extract_window );			break;						case GTK_RESPONSE_OK:            action = extract;			extract_path = g_strdup (gtk_entry_get_text ( GTK_ENTRY (entry1) ));			if ( strlen ( extract_path ) > 0 )			{				done = TRUE;                gchar *text = g_strconcat (_("Extracting files to "),extract_path,NULL );                Update_StatusBar ( text );                g_free (text);                gtk_widget_destroy ( extract_window );				if ( selected < 1 )				{					switch ( CurrentArchiveType )					{						case 0:						//Bzip2 extraction is handled when the the file is opened						//code execution never reaches here						break;												case 1:						//Gzip extraction is handled when the the file is opened						//code execution never reaches here						break;												case 2:                        if (password !=NULL) command = g_strconcat ( "rar x -p",password," -o+ -idp " , path , " " , extract_path , NULL );                        else command = g_strconcat ( "rar x -o+ -idp " , path , " " , extract_path , NULL );						break;												case 3:						command = g_strconcat ( "tar xfv " , path , " -C " , extract_path , NULL );						break;						case 4:						command = g_strconcat ( "tar xfjv " , path , " -C " , extract_path , NULL );						break;												case 5:						command = g_strconcat ( "tar xfzv " , path , " -C " , extract_path , NULL );						break;                        case 6:						case 7:                        if ( password != NULL ) command = g_strconcat ( "unzip -o -P " , password , " " , path , " -d " , extract_path , NULL );                            else command = g_strconcat ( "unzip -o " , path , " -d " , extract_path , NULL );						break;                        case 8:                        chdir ( extract_path );                        SpawnCPIO ( "cpio -ivd" , tmp , 0 , 1 );                        break;                        case 9:                        if (password != NULL) command = g_strconcat ( "7za x -aoa -bd -p",password," ", path , " -o" , extract_path , NULL );                        else command = g_strconcat ( "7za x -aoa -bd " , path , " -o" , extract_path , NULL );                        break;						case 10:						if (password !=NULL) command = g_strconcat ( "arj x -g",password," -i -y " , path , " " , extract_path , NULL );                        else command = g_strconcat ( "arj x -i -y " , path , " " , extract_path , NULL );						break;					}                    if ( command != NULL )                    {                        ExtractAddDelete ( command );                        g_free (command);                     }				}				else				{					names = g_string_new ( " " );					gtk_tree_selection_selected_foreach (selection, (GtkTreeSelectionForeachFunc) ConcatenateFileNames, names );					command = ChooseCommandtoExecute ( 1 );                    if ( command != NULL )                    {                        ExtractAddDelete ( command );                        g_free (command);                     }                    g_string_free (names , FALSE );				}			}			else response = ShowGtkMessageDialog (GTK_WINDOW (MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK, "Please select where to extract files !" );			break;		}	}}gchar *ChooseCommandtoExecute ( gboolean full_path ){    gchar *command;    int levels;    char digit[2];    gchar *strip = NULL;    if ( full_path == 0 )    {        levels = CountCharacter ( names->str , '/');        sprintf ( digit , "%d" , levels );        strip = g_strconcat ( "--strip-components=" , digit , " " , NULL );    }    switch (CurrentArchiveType)	{	    case 0:	    //Bzip2 extraction is handled when the the file is opened		//code execution never reaches here		break;								case 1:        //idem		break;								case 2:		if (password != NULL) command = g_strconcat ( "rar " , full_path ? "x" : "e" , " -p",password, " -o+ -idp " , path , " " , names->str , " " , extract_path , NULL );        else command = g_strconcat ( "rar ", full_path ? "x" : "e" , " -o+ -idp " , path , " " , names->str , " " ,extract_path ,NULL);		break;								case 3:	    command = g_strconcat ( "tar " , full_path ? "" : strip , "-xvf " , path , " -C " , extract_path , names->str , NULL );		break;								case 4:		command = g_strconcat ( "tar " , full_path ? "" : strip , "-xjvf " , path , " -C " , extract_path ,  names->str , NULL );		break;		case 5:        command = g_strconcat ( "tar " , full_path ? "" : strip , "-xvzf " , path , " -C " , extract_path , names->str , NULL );		break;        case 6:		case 7:        if ( password != NULL ) command = g_strconcat ( "unzip -o -P " , password , full_path ? " " : " -j " , path , names->str , " -d " , extract_path , NULL );        else command = g_strconcat ( "unzip -o " , full_path ? "" : "-j " , path , names->str , " -d " , extract_path , NULL );		break;                                case 8:        chdir ( extract_path );        command = g_strconcat ( "cpio -ivd" , names->str , NULL );        SpawnCPIO ( command , tmp , 0 , 1 );        g_free (command);        command = NULL;        break;        case 9:        if ( password != NULL) command = g_strconcat ("7za " , full_path ? "x" : "e" , " -p",password," -aoa -bd " , path , names->str , " -o" , extract_path , NULL );        else command = g_strconcat ( "7za " , full_path ? "x" : "e" ," -aoa -bd " , path , names->str , " -o" , extract_path , NULL );        break;		case 10:		if (password !=NULL) command = g_strconcat ( "arj x -g",password," -i -y " , path , " " , extract_path , names->str , NULL );        else command = g_strconcat ( "arj ",full_path ? "x" : "e"," -i -y " , path , " " , extract_path , names->str, NULL );		break;    }    if ( strip != NULL) g_free ( strip );    return command;}void on_about1_activate (GtkMenuItem *menuitem, gpointer user_data){	static GtkWidget *about = NULL;	const char *authors[] = {"Giuseppe Torelli - Colossus\n<gt67@users.sourceforge.net>\n\nThanks to Uracile for the stunning logo.\n\nThanks to the following translators:\nEugene Ostapets: russian\nEnrico Troeger: german\nSZERVAC Attila: hungarian\n\nThanks to the people of gtk-app-devel-list\nwho kindly answered my questions.", NULL};	if (about != NULL)	{		gtk_window_present (GTK_WINDOW (about));		return;	}	about = gtk_about_dialog_new ();	g_object_set (about,		      "name",  "Xarchiver",		      "version", VERSION,		      "copyright", "Copyright @2005 Giuseppe Torelli",		      "comments", "A lightweight GTK2 archive manager",		      "authors", authors,		      "documenters", NULL,		      "translator_credits", NULL,		      "logo_icon_name", "xarchiver",		      "website", "http://xarchiver.sourceforge.net",		      "website_label", "Home Page",		      "license",    "Copyright @2005 Giuseppe Torelli - Colossus <gt67@users.sourceforge.net>\n\n"		      			"This library is free software; you can redistribute it and/or\n"    					"modify it under the terms of the GNU Library General Public License as\n"    					"published by the Free Software Foundation; either version 2 of the\n"    					"License, or (at your option) any later version.\n"    					"\n"    					"This library is distributed in the hope that it will be useful,\n"    					"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"    					"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n"    					"Library General Public License for more details.\n"    					"\n"    					"You should have received a copy of the GNU Library General Public\n"    					"License along with the Gnome Library; see the file COPYING.LIB.  If not,\n"    					"write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,\n"    					"Boston, MA 02111-1307, USA.\n",		      NULL);	gtk_window_set_destroy_with_parent (GTK_WINDOW (about), TRUE);	g_signal_connect (G_OBJECT (about), "destroy",  G_CALLBACK (gtk_widget_destroyed), &about);	gtk_window_set_position (GTK_WINDOW (about), GTK_WIN_POS_CENTER);	gtk_widget_show (about);}GSList *Add_File_Dialog ( gchar *mode ){	GSList *list = NULL;	int flag;	if ( mode == "file" )	{		title = _("Select the files to be added to the current archive; use SHIFT to multiple select");		flag = GTK_FILE_CHOOSER_ACTION_OPEN;			}	else	{		if (CurrentArchiveType == 10) title = _("Select the folder to be added to the current archive");            else title = _("Select the folders to be added to the current archive; use SHIFT to multiple select");		flag = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;	}	File_Selector = gtk_file_chooser_dialog_new ( title,							GTK_WINDOW (MainWindow),							flag,							GTK_STOCK_CANCEL,							GTK_RESPONSE_CANCEL,							GTK_STOCK_ADD,							GTK_RESPONSE_ACCEPT,							NULL);    //We set gtk_file_chooser_set_select_multiple to FALSE because of a bug in ARJ prevents adding more of two directories    if (CurrentArchiveType == 0 || CurrentArchiveType == 1 || CurrentArchiveType == 10) gtk_file_chooser_set_select_multiple ( GTK_FILE_CHOOSER (File_Selector) , FALSE );        else gtk_file_chooser_set_select_multiple ( GTK_FILE_CHOOSER (File_Selector) , TRUE );	if (CurrentFolder != NULL) gtk_file_chooser_set_current_folder ( GTK_FILE_CHOOSER (File_Selector) , CurrentFolder );	response = gtk_dialog_run (GTK_DIALOG (File_Selector) );	if (response == GTK_RESPONSE_ACCEPT) list = gtk_file_chooser_get_filenames ( GTK_FILE_CHOOSER (File_Selector) );	gtk_widget_destroy (File_Selector);	return list;}gchar *Show_File_Dialog ( int dummy , gpointer mode ){	GtkWidget *hbox;	GtkWidget *combo_box;	GtkWidget *archive_types;	GtkWidget *check_button;	GtkFileFilter *filter;	GtkTooltips *FilterToolTip ;	gchar *path;	const gchar *flag2;	int i , flag;		if ( mode == "new" )	{		title = _("Create a new archive");		flag = GTK_FILE_CHOOSER_ACTION_SAVE;		flag2 = "gtk-new";	}	else if ( mode == "open" )		{		title = _("Open an archive");		flag = GTK_FILE_CHOOSER_ACTION_OPEN;		flag2 = "gtk-open";	}		else if (mode == "extract" )			{		title = _("Choose the destination folder where to extract the current archive");		File_Selector = gtk_file_chooser_dialog_new ( title, 		GTK_WINDOW (MainWindow),		GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,		GTK_STOCK_CANCEL,		GTK_RESPONSE_CANCEL,		GTK_STOCK_OPEN,		GTK_RESPONSE_ACCEPT,		NULL );		response = gtk_dialog_run (GTK_DIALOG (File_Selector));		if (response == GTK_RESPONSE_ACCEPT) gtk_entry_set_text (GTK_ENTRY(entry1),gtk_file_chooser_get_filename ( GTK_FILE_CHOOSER (File_Selector) ) );		gtk_widget_destroy (File_Selector);		return NULL;							}	File_Selector = gtk_file_chooser_dialog_new ( title, 							GTK_WINDOW (MainWindow),							flag,							GTK_STOCK_CANCEL,							GTK_RESPONSE_CANCEL,							flag2,							GTK_RESPONSE_ACCEPT,							NULL);	if (CurrentFolder != NULL) gtk_file_chooser_set_current_folder ( GTK_FILE_CHOOSER (File_Selector) , CurrentFolder );	gtk_dialog_set_default_response (GTK_DIALOG (File_Selector), GTK_RESPONSE_ACCEPT);		filter = gtk_file_filter_new ();	gtk_file_filter_set_name ( filter , _("All files") );	gtk_file_filter_add_pattern ( filter, "*" );	gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (File_Selector), filter);		filter = gtk_file_filter_new ();	gtk_file_filter_set_name ( filter , _("Only archives") );		Suffix = g_list_first ( ArchiveSuffix );		while ( Suffix != NULL )

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -