~ubuntu-branches/ubuntu/edgy/gparted/edgy

« back to all changes in this revision

Viewing changes to src/Win_GParted.cc

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2006-09-20 13:12:48 UTC
  • Revision ID: james.westby@ubuntu.com-20060920131248-e9eeg869io1l4rop
Tags: 0.2.5-1.1ubuntu6
Add support for a --filesystem option which can be used in installer
mode (only) to allow the installer to override gparted's initial idea of
the filesystem in use on a partition. Filesystems created this way are
considered new, so they can be resized freely, etc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
namespace GParted
42
42
{
43
43
        
44
 
Win_GParted::Win_GParted( const std::vector<Glib::ustring> & user_devices, int installer ) : gparted_core( installer )
 
44
Win_GParted::Win_GParted( const std::vector<Glib::ustring> & user_devices, int installer, const std::map<Glib::ustring, FILESYSTEM> & filesystem_overrides ) : gparted_core( installer, filesystem_overrides )
45
45
{
46
46
        installer_mode = installer;
47
47
 
1288
1288
                                }
1289
1289
                        }
1290
1290
                }
 
1291
                //if it's a fake filesystem (installer mode), then we delete
 
1292
                //the partition and re-create it with the new size and position
 
1293
                else if ( selected_partition .status == GParted::STAT_FAKEFS )
 
1294
                {
 
1295
                        Glib::ustring path = devices[ current_device ] .get_path();
 
1296
                        Sector sector_start = selected_partition .sector_start;
 
1297
                        Sector sector_end = selected_partition .sector_end;
 
1298
                        bool inside_extended = selected_partition .inside_extended;
 
1299
 
 
1300
                        Add_Operation( GParted::DELETE, selected_partition );
 
1301
                        selected_partition .Set_Unallocated( path, sector_start, sector_end, inside_extended );
 
1302
                        Add_Operation( GParted::CREATE, dialog .Get_New_Partition() );
 
1303
                }
1291
1304
                else//normal move/resize on existing partition
1292
1305
                        Add_Operation( GParted::RESIZE_MOVE, dialog .Get_New_Partition() );
1293
1306
        }
1828
1841
                //reread devices and their layouts...
1829
1842
                menu_gparted_refresh_devices() ;
1830
1843
 
 
1844
                //mark any remaining fakefs partitions as to be formatted
 
1845
                //(installer mode)
 
1846
                for ( unsigned int i = 0 ; i < devices .size() ; ++i )
 
1847
                {
 
1848
                        std::vector<Partition> partitions = devices[ i ] .partitions ;
 
1849
                        for ( unsigned int j = 0 ; j < partitions .size() ; ++j )
 
1850
                        {
 
1851
                                if ( partitions[ j ] .status == STAT_FAKEFS )
 
1852
                                        gparted_core .formatted_partitions .push_back( partitions[ j ] );
 
1853
                        }
 
1854
                }
 
1855
 
1831
1856
                return response == Gtk::RESPONSE_CLOSE;
1832
1857
        }
1833
1858
        else
1848
1873
                if ( strcmp( line, "apply" ) == 0 )
1849
1874
                {
1850
1875
                        if ( activate_apply_internal( ) )
 
1876
                        {
 
1877
                                for ( unsigned int i = 0 ; i < gparted_core .formatted_partitions .size() ; ++i )
 
1878
                                {
 
1879
                                        Partition *partition = &gparted_core .formatted_partitions[ i ];
 
1880
                                        std::cout << "- FORMAT" << partition ->get_path() << " " << Utils::get_filesystem_string( partition ->filesystem ) << std::endl;
 
1881
                                }
1851
1882
                                std::cout << "0 OK" << std::endl ;
 
1883
                        }
1852
1884
                        else
1853
1885
                                std::cout << "1 Cancel" << std::endl ;
1854
1886
                }