├── data ├── Makefile.am └── icons │ ├── hicolor_apps_16x16_gparted.png │ ├── hicolor_apps_22x22_gparted.png │ ├── hicolor_apps_24x24_gparted.png │ ├── hicolor_apps_32x32_gparted.png │ ├── hicolor_apps_48x48_gparted.png │ └── Makefile.am ├── lib ├── Makefile.am └── gtest │ ├── include │ └── gtest │ │ ├── internal │ │ └── custom │ │ │ ├── README.md │ │ │ ├── gtest.h │ │ │ ├── gtest-port.h │ │ │ └── gtest-printers.h │ │ └── gtest_prod.h │ ├── LICENSE │ ├── src │ ├── gtest-all.cc │ ├── gtest_main.cc │ └── gtest-assertion-result.cc │ └── Makefile.am ├── logo.png ├── doc ├── Makefile.am └── gparted.8 ├── help ├── C │ └── figures │ │ └── gparted_window.png ├── cs │ └── figures │ │ └── gparted_window.png ├── de │ └── figures │ │ └── gparted_window.png ├── el │ └── figures │ │ └── gparted_window.png ├── es │ └── figures │ │ └── gparted_window.png ├── fr │ └── figures │ │ └── gparted_window.png ├── id │ └── figures │ │ └── gparted_window.png ├── it │ └── figures │ │ └── gparted_window.png ├── ro │ └── figures │ │ └── gparted_window.png ├── ru │ └── figures │ │ └── gparted_window.png ├── sr │ └── figures │ │ └── gparted_window.png ├── sv │ └── figures │ │ └── gparted_window.png ├── uk │ └── figures │ │ └── gparted_window.png ├── pt_BR │ └── figures │ │ └── gparted_window.png ├── sr@latin │ └── figures │ │ └── gparted_window.png └── Makefile.am ├── include ├── i18n.h ├── minix.h ├── hfs.h ├── hfsplus.h ├── Dialog_FileSystem_Label.h ├── Dialog_Partition_Name.h ├── luks.h ├── Frame_Resizer_Extended.h ├── f2fs.h ├── reiser4.h ├── Dialog_Disklabel.h ├── DialogPasswordEntry.h ├── bcachefs.h ├── OperationCheck.h ├── SupportedFileSystems.h ├── nilfs2.h ├── BCache_Info.h ├── lvm2_pv.h ├── OperationCreate.h ├── OperationFormat.h ├── exfat.h ├── jfs.h ├── reiserfs.h ├── OperationChangeUUID.h ├── OperationNamePartition.h ├── Makefile.am ├── OperationLabelFileSystem.h ├── OperationDelete.h ├── Dialog_Partition_Copy.h ├── udf.h ├── OperationCopy.h ├── OperationResizeMove.h ├── Dialog_Partition_Resize_Move.h ├── fat16.h ├── linux_swap.h ├── PasswordRAMStore.h ├── ntfs.h ├── Proc_Partitions_Info.h ├── CopyBlocks.h ├── Dialog_Partition_Info.h ├── Device.h ├── BlockSpecial.h ├── btrfs.h ├── xfs.h ├── ProgressBar.h ├── FS_Info.h ├── HBoxOperations.h ├── LUKS_Info.h ├── PartitionLUKS.h ├── DialogManageFlags.h ├── ext2.h ├── Dialog_Partition_New.h ├── PipeCapture.h ├── SWRaid_Info.h ├── LVM2_PV_Info.h ├── Mount_Info.h ├── PartitionVector.h ├── DialogFeatures.h ├── MenuHelpers.h └── Frame_Resizer_Base.h ├── gparted.desktop.in.in ├── po ├── POTFILES.skip ├── LINGUAS └── POTFILES.in ├── tests ├── test_dummy.cc ├── makedev.sh ├── common.h ├── insertion_operators.h └── exclude_loopdev_tests.sh ├── autogen.sh ├── org.gnome.gparted.policy.in.in ├── testbuild.sh ├── .gitignore ├── gparted.doap ├── m4 └── ax_cxx_compile_stdcxx_14.m4 ├── HACKING ├── gparted.appdata.xml.in ├── src ├── minix.cc ├── Makefile.am ├── OperationCheck.cc ├── main.cc ├── hfsplus.cc ├── hfs.cc ├── BCache_Info.cc ├── Dialog_FileSystem_Label.cc ├── OperationNamePartition.cc ├── OperationLabelFileSystem.cc ├── Dialog_Partition_Name.cc ├── PartitionVector.cc ├── OperationChangeUUID.cc └── Device.cc └── Makefile.am /data/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = icons 2 | -------------------------------------------------------------------------------- /lib/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = gtest 2 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/logo.png -------------------------------------------------------------------------------- /doc/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | dist_man_MANS = gparted.8 4 | -------------------------------------------------------------------------------- /help/C/figures/gparted_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/help/C/figures/gparted_window.png -------------------------------------------------------------------------------- /help/cs/figures/gparted_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/help/cs/figures/gparted_window.png -------------------------------------------------------------------------------- /help/de/figures/gparted_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/help/de/figures/gparted_window.png -------------------------------------------------------------------------------- /help/el/figures/gparted_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/help/el/figures/gparted_window.png -------------------------------------------------------------------------------- /help/es/figures/gparted_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/help/es/figures/gparted_window.png -------------------------------------------------------------------------------- /help/fr/figures/gparted_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/help/fr/figures/gparted_window.png -------------------------------------------------------------------------------- /help/id/figures/gparted_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/help/id/figures/gparted_window.png -------------------------------------------------------------------------------- /help/it/figures/gparted_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/help/it/figures/gparted_window.png -------------------------------------------------------------------------------- /help/ro/figures/gparted_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/help/ro/figures/gparted_window.png -------------------------------------------------------------------------------- /help/ru/figures/gparted_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/help/ru/figures/gparted_window.png -------------------------------------------------------------------------------- /help/sr/figures/gparted_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/help/sr/figures/gparted_window.png -------------------------------------------------------------------------------- /help/sv/figures/gparted_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/help/sv/figures/gparted_window.png -------------------------------------------------------------------------------- /help/uk/figures/gparted_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/help/uk/figures/gparted_window.png -------------------------------------------------------------------------------- /help/pt_BR/figures/gparted_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/help/pt_BR/figures/gparted_window.png -------------------------------------------------------------------------------- /data/icons/hicolor_apps_16x16_gparted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/data/icons/hicolor_apps_16x16_gparted.png -------------------------------------------------------------------------------- /data/icons/hicolor_apps_22x22_gparted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/data/icons/hicolor_apps_22x22_gparted.png -------------------------------------------------------------------------------- /data/icons/hicolor_apps_24x24_gparted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/data/icons/hicolor_apps_24x24_gparted.png -------------------------------------------------------------------------------- /data/icons/hicolor_apps_32x32_gparted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/data/icons/hicolor_apps_32x32_gparted.png -------------------------------------------------------------------------------- /data/icons/hicolor_apps_48x48_gparted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/data/icons/hicolor_apps_48x48_gparted.png -------------------------------------------------------------------------------- /help/sr@latin/figures/gparted_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GNOME/gparted/HEAD/help/sr@latin/figures/gparted_window.png -------------------------------------------------------------------------------- /include/i18n.h: -------------------------------------------------------------------------------- 1 | #ifndef GPARTED_I18N_H 2 | #define GPARTED_I18N_H 3 | 4 | #ifdef HAVE_CONFIG_H 5 | #include "config.h" 6 | #endif /* HAVE_CONFIG_H */ 7 | 8 | #ifdef ENABLE_NLS 9 | #include 10 | #endif /* ENABLE_NLS */ 11 | 12 | #endif /* GPARTED_I18N_H */ 13 | -------------------------------------------------------------------------------- /gparted.desktop.in.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=GParted 3 | GenericName=Partition Editor 4 | X-GNOME-FullName=GParted Partition Editor 5 | Comment=Create, reorganize, and delete partitions 6 | Exec=@bindir@/gparted %f 7 | Icon=gparted 8 | Terminal=false 9 | Type=Application 10 | Categories=GNOME;System;Filesystem; 11 | Keywords=Partition; 12 | StartupNotify=true 13 | -------------------------------------------------------------------------------- /po/POTFILES.skip: -------------------------------------------------------------------------------- 1 | # List of source files containing translatable strings, but should be skipped. 2 | # Please keep this file sorted alphabetically. 3 | gparted.desktop.in 4 | org.gnome.gparted.policy.in 5 | lib/gtest/include/gtest/internal/gtest-filepath.h 6 | lib/gtest/src/gtest.cc 7 | # https://bugs.launchpad.net/intltool/+bug/1117944 8 | sub/gparted.desktop.in 9 | sub/org.gnome.gparted.policy.in 10 | -------------------------------------------------------------------------------- /tests/test_dummy.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 Mike Fleetwood 2 | * 3 | * Copying and distribution of this file, with or without modification, 4 | * are permitted in any medium without royalty provided the copyright 5 | * notice and this notice are preserved. This file is offered as-is, 6 | * without any warranty. 7 | */ 8 | 9 | #include "gtest/gtest.h" 10 | 11 | TEST( DummyTest, Success ) 12 | { 13 | EXPECT_TRUE( true ); 14 | } 15 | -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- 1 | # please keep this list sorted alphabetically 2 | # 3 | ar 4 | be 5 | bg 6 | br 7 | bs 8 | ca 9 | ca@valencia 10 | cs 11 | da 12 | de 13 | dz 14 | el 15 | en_CA 16 | en_GB 17 | eo 18 | es 19 | et 20 | eu 21 | fa 22 | fi 23 | fr 24 | fur 25 | gd 26 | gl 27 | gu 28 | he 29 | hi 30 | hr 31 | hu 32 | id 33 | ie 34 | is 35 | it 36 | ja 37 | ka 38 | kk 39 | ko 40 | lt 41 | lv 42 | mk 43 | ml 44 | nb 45 | ne 46 | nl 47 | nn 48 | oc 49 | pa 50 | pl 51 | pt 52 | pt_BR 53 | ro 54 | ru 55 | rw 56 | si 57 | sk 58 | sl 59 | sr 60 | sr@latin 61 | sv 62 | te 63 | th 64 | tr 65 | uk 66 | vi 67 | zh_CN 68 | zh_HK 69 | zh_TW 70 | -------------------------------------------------------------------------------- /help/Makefile.am: -------------------------------------------------------------------------------- 1 | @YELP_HELP_RULES@ 2 | 3 | # Name of the directory into which help files are installed: 4 | # ${datadir}/help/${LANG}/${HELP_ID}/ 5 | HELP_ID = gparted 6 | 7 | # List of help files to install. 8 | # NOTE: Top-level DocBook file MUST be named index.docbook. 9 | # https://wiki.gnome.org/Initiatives/GnomeGoals/NewDocumentationInfrastructure 10 | HELP_FILES = index.docbook 11 | 12 | #List of all the figures that are referenced in the help document 13 | HELP_MEDIA = figures/gparted_window.png 14 | 15 | #List of all the language codes for the languages in which the 16 | # document is translated 17 | HELP_LINGUAS = cs de el es fr gd id it pt_BR ro ru sl sr sr@latin sv te th uk 18 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # autogen.sh - Run this to generate all the initial makefiles, etc. 3 | # 4 | # Copyright (C) 2004 Bart 'plors' Hakvoort 5 | # Copyright (C) 2008 Curtis Gedak 6 | # 7 | # Copying and distribution of this file, with or without modification, 8 | # are permitted in any medium without royalty provided the copyright 9 | # notice and this notice are preserved. This file is offered as-is, 10 | # without any warranty. 11 | 12 | 13 | srcdir=`dirname $0` 14 | test -z "$srcdir" && srcdir=. 15 | 16 | which gnome-autogen.sh || { 17 | echo "You need to install gnome-common" 18 | exit 1 19 | } 20 | 21 | # Ensure that m4 directory exists 22 | if ! test -d $srcdir/m4; then 23 | mkdir $srcdir/m4 24 | fi 25 | 26 | which yelp-build || { 27 | echo "ERROR: Command 'yelp-build' not found" 28 | echo "ERROR: Package 'yelp-tools' needs to be installed" 29 | exit 1 30 | } 31 | 32 | REQUIRED_AUTOMAKE_VERSION=1.9 . gnome-autogen.sh 33 | -------------------------------------------------------------------------------- /org.gnome.gparted.policy.in.in: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | The GParted Project 7 | https://gparted.org 8 | gparted 9 | 10 | 11 | Run GParted as root 12 | Authentication is required to run the GParted Partition Editor as root 13 | 14 | auth_admin 15 | auth_admin 16 | auth_admin 17 | 18 | @bindir@/gparted 19 | true 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /testbuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # testbuild.sh - Build GParted, logging top commit and build results. 3 | # Command line parameters are passed to autogen.sh. 4 | # MAKEFLAGS environment variable overrides make flags. 5 | # 6 | # Copyright (C) 2013 Mike Fleetwood 7 | # 8 | # Copying and distribution of this file, with or without modification, 9 | # are permitted in any medium without royalty provided the copyright 10 | # notice and this notice are preserved. This file is offered as-is, 11 | # without any warranty. 12 | 13 | 14 | exec 1>> testbuild.log 2>&1 15 | echo '############################################################' 16 | echo "## Build date: `date`" 17 | echo '############################################################' 18 | git log -1 19 | echo '############################################################' 20 | 21 | set -x 22 | 23 | if [ "X$MAKEFLAGS" = 'X' ]; then 24 | # Default to using the number of processors to tell make how 25 | # many jobs to run simultaneously 26 | nproc=`grep -c '^processor' /proc/cpuinfo` || nproc=1 27 | MAKEFLAGS="-j $nproc" 28 | export MAKEFLAGS 29 | fi 30 | 31 | # Disable bold text escape sequences from gnome-autogen.sh 32 | TERM= 33 | 34 | ./autogen.sh "${@}" && make clean && make $MAKEFLAGS 35 | -------------------------------------------------------------------------------- /tests/makedev.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Name: tests/makedev.sh 3 | # Purpose: Create /dev special files needed for GParted unit testing 4 | # inside GitLab Docker CI images. 5 | # 6 | # Copyright (C) 2020 Mike Fleetwood 7 | # 8 | # Copying and distribution of this file, with or without modification, 9 | # are permitted in any medium without royalty provided the copyright 10 | # notice and this notice are preserved. This file is offered as-is, 11 | # without any warranty. 12 | 13 | 14 | # Create first two block special devices named in /proc/partitions, if 15 | # they don't already exist, for test_BlockSpecial. 16 | awk '$1=="major" {next} NF==4 {printf "/dev/%s %s %s\n", $4, $1, $2; p++} p>=2 {exit}' /proc/partitions | \ 17 | while read name maj min 18 | do 19 | if test ! -e "$name"; then 20 | echo mknod -m 0660 "$name" b $maj $min 21 | mknod -m 0660 "$name" b $maj $min 22 | chown root:disk "$name" 23 | fi 24 | done 25 | 26 | # Create /dev/disk/by-id/SYMLINK to first block special device named in 27 | # /proc/partitions, if directory doesn't already exist, for 28 | # test_BlockSpecial. 29 | if test ! -e /dev/disk/by-id; then 30 | mkdir -v -m 0755 -p /dev/disk/by-id/ 31 | dev=`awk '$1=="major" {next} NF==4 {print $4; exit}' /proc/partitions` 32 | ln -v -s "/dev/$dev" "/dev/disk/by-id/gparted-$dev" 33 | fi 34 | -------------------------------------------------------------------------------- /include/minix.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2018 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | #ifndef GPARTED_MINIX_H 19 | #define GPARTED_MINIX_H 20 | 21 | #include "FileSystem.h" 22 | #include "OperationDetail.h" 23 | #include "Partition.h" 24 | 25 | 26 | namespace GParted 27 | { 28 | 29 | 30 | class minix : public FileSystem 31 | { 32 | public: 33 | FS get_filesystem_support(); 34 | bool create( const Partition & new_partition, OperationDetail & operationdetail ); 35 | bool check_repair( const Partition & partition, OperationDetail & operationdetail ); 36 | }; 37 | 38 | 39 | } // namespace GParted 40 | 41 | 42 | #endif /* GPARTED_MINIX_H */ 43 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # List of file patterns for git to ignore. 2 | # 3 | # Please try to keep entries in alphabetical order :-) 4 | # 5 | *~ 6 | *.a 7 | *.gmo 8 | *.lo 9 | *.mo 10 | *.o 11 | *.stamp 12 | .cproject 13 | .csettings 14 | .deps 15 | .dirstamp 16 | .libs 17 | .project 18 | .xml2po.mo 19 | ABOUT-NLS 20 | INSTALL 21 | Makefile 22 | Makefile.in 23 | Makefile.in.in 24 | POTFILES 25 | aclocal.m4 26 | autom4te.cache 27 | compile 28 | config.* 29 | configure 30 | depcomp 31 | gparted 32 | gparted.appdata.xml 33 | gparted.desktop 34 | gparted.desktop.in 35 | gpartedbin 36 | index.docbook 37 | install-sh 38 | lib/gtest/lib 39 | libtool 40 | ltmain.sh 41 | m4/*.m4 42 | !m4/ax_cxx_compile_stdcxx_14.m4 43 | !m4/ax_cxx_compile_stdcxx.m4 44 | missing 45 | mkinstalldirs 46 | org.gnome.gparted.policy 47 | org.gnome.gparted.policy.in 48 | po/Makevars.template 49 | po/Rules-quot 50 | po/boldquot.sed 51 | po/en@boldquot.header 52 | po/en@quot.header 53 | po/gparted.pot 54 | po/insert-header.sin 55 | po/quot.sed 56 | po/remove-potcdate.sin 57 | po/remove-potcdate.sed 58 | stamp-* 59 | test-driver 60 | testbuild.log 61 | tests/*.log 62 | tests/*.trs 63 | tests/test-suite.log 64 | tests/test_BlockSpecial 65 | tests/test_EraseFileSystemSignatures 66 | tests/test_PasswordRAMStore 67 | tests/test_PipeCapture 68 | tests/test_SupportedFileSystems 69 | tests/test_dummy 70 | -------------------------------------------------------------------------------- /include/hfs.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * Copyright (C) 2008, 2009, 2010 Curtis Gedak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | */ 17 | 18 | 19 | #ifndef GPARTED_HFS_H 20 | #define GPARTED_HFS_H 21 | 22 | #include "FileSystem.h" 23 | #include "Partition.h" 24 | 25 | 26 | namespace GParted 27 | { 28 | 29 | 30 | class hfs : public FileSystem 31 | { 32 | public: 33 | FS get_filesystem_support() ; 34 | bool create( const Partition & new_partition, OperationDetail & operationdetail ) ; 35 | bool check_repair( const Partition & partition, OperationDetail & operationdetail ) ; 36 | }; 37 | 38 | 39 | } // namespace GParted 40 | 41 | 42 | #endif /* GPARTED_HFS_H */ 43 | -------------------------------------------------------------------------------- /include/hfsplus.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * Copyright (C) 2008, 2009, 2010 Curtis Gedak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | */ 17 | 18 | 19 | #ifndef GPARTED_HFSPLUS_H 20 | #define GPARTED_HFSPLUS_H 21 | 22 | #include "FileSystem.h" 23 | #include "Partition.h" 24 | 25 | 26 | namespace GParted 27 | { 28 | 29 | 30 | class hfsplus : public FileSystem 31 | { 32 | public: 33 | FS get_filesystem_support() ; 34 | bool create( const Partition & new_partition, OperationDetail & operationdetail ) ; 35 | bool check_repair( const Partition & partition, OperationDetail & operationdetail ) ; 36 | }; 37 | 38 | 39 | } // namespace GParted 40 | 41 | 42 | #endif /* GPARTED_HFSPLUS_H */ 43 | -------------------------------------------------------------------------------- /include/Dialog_FileSystem_Label.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2008 Curtis Gedak 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #ifndef GPARTED_DIALOG_FILESYSTEM_LABEL_H 18 | #define GPARTED_DIALOG_FILESYSTEM_LABEL_H 19 | 20 | #include "Partition.h" 21 | #include "i18n.h" 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | 28 | namespace GParted 29 | { 30 | 31 | 32 | class Dialog_FileSystem_Label : public Gtk::Dialog 33 | { 34 | public: 35 | Dialog_FileSystem_Label( const Partition & partition ); 36 | Glib::ustring get_new_label(); 37 | 38 | private: 39 | Gtk::Entry *entry; 40 | }; 41 | 42 | 43 | } // namespace GParted 44 | 45 | 46 | #endif /* GPARTED_DIALOG_FILESYSTEM_LABEL_H */ 47 | -------------------------------------------------------------------------------- /include/Dialog_Partition_Name.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Michael Zimmermann 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #ifndef GPARTED_DIALOG_PARTITION_NAME_H 18 | #define GPARTED_DIALOG_PARTITION_NAME_H 19 | 20 | #include "Partition.h" 21 | #include "i18n.h" 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | 28 | namespace GParted 29 | { 30 | 31 | 32 | class Dialog_Partition_Name: public Gtk::Dialog 33 | { 34 | public: 35 | Dialog_Partition_Name( const Partition & partition, int max_length ); 36 | Glib::ustring get_new_name(); 37 | 38 | private: 39 | Gtk::Entry *entry; 40 | }; 41 | 42 | 43 | } // namespace GParted 44 | 45 | 46 | #endif /* GPARTED_DIALOG_PARTITION_NAME_H */ 47 | -------------------------------------------------------------------------------- /include/luks.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | #ifndef GPARTED_LUKS_H 19 | #define GPARTED_LUKS_H 20 | 21 | #include "FileSystem.h" 22 | #include "Partition.h" 23 | 24 | 25 | namespace GParted 26 | { 27 | 28 | 29 | class luks : public FileSystem 30 | { 31 | public: 32 | const Glib::ustring & get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const; 33 | FS get_filesystem_support(); 34 | bool is_busy( const Glib::ustring & path ); 35 | void set_used_sectors( Partition & partition ); 36 | bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition ); 37 | }; 38 | 39 | 40 | } // namespace GParted 41 | 42 | 43 | #endif /* GPARTED_LUKS_H */ 44 | -------------------------------------------------------------------------------- /gparted.doap: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 14 | gparted 15 | 16 | GNOME Partition Editor for manipulating disk partitions 17 | 18 | 19 | 20 | 21 | 22 | 23 | Curtis Gedak 24 | 25 | gedakc 26 | 27 | 28 | 29 | 30 | Mike Fleetwood 31 | 32 | mfleetwo 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /tests/common.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2023 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | /* common 18 | * 19 | * Common functions used in testing that don't depend on any GParted code so don't require 20 | * any GParted objects to need to be linked in order to be used. 21 | */ 22 | 23 | #ifndef GPARTED_TEST_COMMON_H 24 | #define GPARTED_TEST_COMMON_H 25 | 26 | 27 | #include 28 | #include 29 | 30 | 31 | namespace GParted 32 | { 33 | 34 | 35 | const size_t BinaryStringChunkSize = 16; 36 | 37 | std::string binary_string_to_print(size_t offset, const char* s, size_t len); 38 | void ensure_x11_display(int argc, char** argv); 39 | 40 | 41 | } // namespace GParted 42 | 43 | 44 | #endif /* GPARTED_TEST_COMMON_H */ 45 | -------------------------------------------------------------------------------- /tests/insertion_operators.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2023 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | /* insertion_operators 18 | * 19 | * Insertion operators for various GParted object types which print the object to an 20 | * output stream. 21 | */ 22 | 23 | #ifndef GPARTED_TEST_INSERTION_OPERATORS_H 24 | #define GPARTED_TEST_INSERTION_OPERATORS_H 25 | 26 | 27 | #include "OperationDetail.h" 28 | 29 | #include 30 | 31 | 32 | namespace GParted 33 | { 34 | 35 | 36 | std::ostream& operator<<(std::ostream& out, const OperationDetailStatus od_status); 37 | std::ostream& operator<<(std::ostream& out, const OperationDetail& od); 38 | 39 | 40 | } // namespace GParted 41 | 42 | 43 | #endif /* GPARTED_TEST_INSERTION_OPERATORS_H */ 44 | -------------------------------------------------------------------------------- /include/Frame_Resizer_Extended.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | #ifndef GPARTED_FRAME_RESIZER_EXTENDED_H 19 | #define GPARTED_FRAME_RESIZER_EXTENDED_H 20 | 21 | #include "Frame_Resizer_Base.h" 22 | 23 | 24 | namespace GParted 25 | { 26 | 27 | 28 | class Frame_Resizer_Extended : public Frame_Resizer_Base 29 | { 30 | public: 31 | Frame_Resizer_Extended() ; 32 | 33 | void set_used_start( int used_start ) ; 34 | 35 | private: 36 | int USED_START ; 37 | 38 | //overridden signal handler 39 | virtual bool drawingarea_on_mouse_motion( GdkEventMotion * ev ) ; 40 | 41 | virtual void draw_partition(const Cairo::RefPtr& cr); 42 | }; 43 | 44 | 45 | } // namespace GParted 46 | 47 | 48 | #endif /* GPARTED_FRAME_RESIZER_EXTENDED_H */ 49 | -------------------------------------------------------------------------------- /include/f2fs.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2013 Patrick Verner 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | #ifndef GPARTED_F2FS_H 19 | #define GPARTED_F2FS_H 20 | 21 | #include "FileSystem.h" 22 | #include "Partition.h" 23 | 24 | 25 | namespace GParted 26 | { 27 | 28 | 29 | class f2fs : public FileSystem 30 | { 31 | public: 32 | FS get_filesystem_support() ; 33 | void set_used_sectors(Partition & partition); 34 | bool create( const Partition & new_partition, OperationDetail & operationdetail ) ; 35 | bool resize(const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition); 36 | bool check_repair(const Partition & partition, OperationDetail & operationdetail); 37 | }; 38 | 39 | 40 | } // namespace GParted 41 | 42 | 43 | #endif /* GPARTED_F2FS_H */ 44 | -------------------------------------------------------------------------------- /lib/gtest/include/gtest/internal/custom/README.md: -------------------------------------------------------------------------------- 1 | # Customization Points 2 | 3 | The custom directory is an injection point for custom user configurations. 4 | 5 | ## Header `gtest.h` 6 | 7 | ### The following macros can be defined: 8 | 9 | * `GTEST_OS_STACK_TRACE_GETTER_` - The name of an implementation of 10 | `OsStackTraceGetterInterface`. 11 | * `GTEST_CUSTOM_TEMPDIR_FUNCTION_` - An override for `testing::TempDir()`. See 12 | `testing::TempDir` for semantics and signature. 13 | 14 | ## Header `gtest-port.h` 15 | 16 | The following macros can be defined: 17 | 18 | ### Logging: 19 | 20 | * `GTEST_LOG_(severity)` 21 | * `GTEST_CHECK_(condition)` 22 | * Functions `LogToStderr()` and `FlushInfoLog()` have to be provided too. 23 | 24 | ### Threading: 25 | 26 | * `GTEST_HAS_NOTIFICATION_` - Enabled if Notification is already provided. 27 | * `GTEST_HAS_MUTEX_AND_THREAD_LOCAL_` - Enabled if `Mutex` and `ThreadLocal` 28 | are already provided. Must also provide `GTEST_DECLARE_STATIC_MUTEX_(mutex)` 29 | and `GTEST_DEFINE_STATIC_MUTEX_(mutex)` 30 | * `GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)` 31 | * `GTEST_LOCK_EXCLUDED_(locks)` 32 | 33 | ### Underlying library support features 34 | 35 | * `GTEST_HAS_CXXABI_H_` 36 | 37 | ### Exporting API symbols: 38 | 39 | * `GTEST_API_` - Specifier for exported symbols. 40 | 41 | ## Header `gtest-printers.h` 42 | 43 | * See documentation at `gtest/gtest-printers.h` for details on how to define a 44 | custom printer. 45 | -------------------------------------------------------------------------------- /include/reiser4.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * Copyright (C) 2008, 2009, 2010 Curtis Gedak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | */ 17 | 18 | 19 | #ifndef GPARTED_REISER4_H 20 | #define GPARTED_REISER4_H 21 | 22 | #include "FileSystem.h" 23 | #include "Partition.h" 24 | 25 | 26 | namespace GParted 27 | { 28 | 29 | 30 | class reiser4 : public FileSystem 31 | { 32 | public: 33 | FS get_filesystem_support() ; 34 | void set_used_sectors( Partition & partition ) ; 35 | void read_label( Partition & partition ) ; 36 | void read_uuid( Partition & partition ) ; 37 | bool create( const Partition & new_partition, OperationDetail & operationdetail ) ; 38 | bool check_repair( const Partition & partition, OperationDetail & operationdetail ) ; 39 | }; 40 | 41 | 42 | } // namespace GParted 43 | 44 | 45 | #endif /* GPARTED_REISER4_H */ 46 | -------------------------------------------------------------------------------- /m4/ax_cxx_compile_stdcxx_14.m4: -------------------------------------------------------------------------------- 1 | # ============================================================================= 2 | # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_14.html 3 | # ============================================================================= 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_CXX_COMPILE_STDCXX_14([ext|noext], [mandatory|optional]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Check for baseline language coverage in the compiler for the C++14 12 | # standard; if necessary, add switches to CXX and CXXCPP to enable 13 | # support. 14 | # 15 | # This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX 16 | # macro with the version set to C++14. The two optional arguments are 17 | # forwarded literally as the second and third argument respectively. 18 | # Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for 19 | # more information. If you want to use this macro, you also need to 20 | # download the ax_cxx_compile_stdcxx.m4 file. 21 | # 22 | # LICENSE 23 | # 24 | # Copyright (c) 2015 Moritz Klammler 25 | # 26 | # Copying and distribution of this file, with or without modification, are 27 | # permitted in any medium without royalty provided the copyright notice 28 | # and this notice are preserved. This file is offered as-is, without any 29 | # warranty. 30 | 31 | #serial 5 32 | 33 | AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) 34 | AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [AX_CXX_COMPILE_STDCXX([14], [$1], [$2])]) 35 | -------------------------------------------------------------------------------- /include/Dialog_Disklabel.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | #ifndef GPARTED_DIALOG_DISKLABEL_H 19 | #define GPARTED_DIALOG_DISKLABEL_H 20 | 21 | #include "Utils.h" 22 | #include "Device.h" 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | namespace GParted 32 | { 33 | 34 | 35 | class Dialog_Disklabel : public Gtk::Dialog 36 | { 37 | public: 38 | Dialog_Disklabel( const Device & device ) ; 39 | ~Dialog_Disklabel(); 40 | 41 | Glib::ustring Get_Disklabel( ) ; 42 | 43 | private: 44 | Gtk::ComboBoxText combo_labeltypes ; 45 | std::vector labeltypes ; 46 | }; 47 | 48 | 49 | } // namespace GParted 50 | 51 | 52 | #endif /* GPARTED_DIALOG_DISKLABEL_H */ 53 | -------------------------------------------------------------------------------- /include/DialogPasswordEntry.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #ifndef GPARTED_DIALOGPASSWORDENTRY_H 18 | #define GPARTED_DIALOGPASSWORDENTRY_H 19 | 20 | #include "Partition.h" 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | 28 | namespace GParted 29 | { 30 | 31 | 32 | class DialogPasswordEntry : public Gtk::Dialog 33 | { 34 | public: 35 | DialogPasswordEntry(const Partition& partition, const Glib::ustring& reason); 36 | const char * get_password(); 37 | void set_error_message( const Glib::ustring & message ); 38 | 39 | private: 40 | void on_button_unlock(); 41 | 42 | Gtk::Entry *m_entry; 43 | Gtk::Label *m_error_message; 44 | }; 45 | 46 | 47 | } // namespace GParted 48 | 49 | 50 | #endif /* GPARTEDPASSWORDENTRY_H */ 51 | -------------------------------------------------------------------------------- /lib/gtest/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /include/bcachefs.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2024 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | #ifndef GPARTED_BCACHEFS_H 19 | #define GPARTED_BCACHEFS_H 20 | 21 | 22 | #include "FileSystem.h" 23 | #include "OperationDetail.h" 24 | #include "Partition.h" 25 | 26 | 27 | namespace GParted 28 | { 29 | 30 | 31 | class bcachefs : public FileSystem 32 | { 33 | public: 34 | FS get_filesystem_support(); 35 | void set_used_sectors(Partition& partition); 36 | bool create(const Partition& new_partition, OperationDetail& operationdetail); 37 | void read_label(Partition& partition); 38 | void read_uuid(Partition& partition); 39 | bool resize(const Partition& partition_new, OperationDetail& operationdetail, bool fill_partition); 40 | bool check_repair(const Partition& partition, OperationDetail& operationdetail); 41 | }; 42 | 43 | 44 | } // namespace GParted 45 | 46 | 47 | #endif /* GPARTED_BCACHEFS_H */ 48 | -------------------------------------------------------------------------------- /include/OperationCheck.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 'plors' Hakvoort 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #ifndef GPARTED_OPERATIONCHECK_H 18 | #define GPARTED_OPERATIONCHECK_H 19 | 20 | 21 | #include "Device.h" 22 | #include "Operation.h" 23 | #include "Partition.h" 24 | #include "PartitionVector.h" 25 | 26 | 27 | namespace GParted 28 | { 29 | 30 | 31 | class OperationCheck : public Operation 32 | { 33 | public: 34 | OperationCheck( const Device & device, const Partition & partition ) ; 35 | 36 | OperationCheck(const OperationCheck& src) = delete; // Copy construction prohibited 37 | OperationCheck& operator=(const OperationCheck& rhs) = delete; // Copy assignment prohibited 38 | 39 | void apply_to_visual( PartitionVector & partitions ); 40 | 41 | private: 42 | void create_description() ; 43 | bool merge_operations( const Operation & candidate ); 44 | }; 45 | 46 | 47 | } // namespace GParted 48 | 49 | 50 | #endif /* GPARTED_OPERATIONCHECK_H */ 51 | -------------------------------------------------------------------------------- /include/SupportedFileSystems.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2019 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #ifndef GPARTED_SUPPORTEDFILESYSTEMS_H 18 | #define GPARTED_SUPPORTEDFILESYSTEMS_H 19 | 20 | 21 | #include "FileSystem.h" 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | 28 | namespace GParted 29 | { 30 | 31 | 32 | class SupportedFileSystems 33 | { 34 | public: 35 | SupportedFileSystems(); 36 | 37 | void find_supported_filesystems(); 38 | FileSystem* get_fs_object(FSType fstype) const; 39 | const FS& get_fs_support(FSType fstype) const; 40 | const std::vector& get_all_fs_support() const; 41 | bool supported_filesystem(FSType fstype) const; 42 | 43 | private: 44 | typedef std::map> FSObjectsMap; 45 | 46 | std::vector m_fs_support; 47 | FSObjectsMap m_fs_objects; 48 | 49 | }; 50 | 51 | 52 | } // namespace GParted 53 | 54 | 55 | #endif /* GPARTED_SUPPORTEDFILESYSTEMS_H */ 56 | -------------------------------------------------------------------------------- /include/nilfs2.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | #ifndef GPARTED_NILFS2_H 19 | #define GPARTED_NILFS2_H 20 | 21 | #include "FileSystem.h" 22 | #include "Partition.h" 23 | 24 | 25 | namespace GParted 26 | { 27 | 28 | 29 | class nilfs2 : public FileSystem 30 | { 31 | public: 32 | FS get_filesystem_support() ; 33 | void set_used_sectors( Partition & partition ) ; 34 | void read_label( Partition & partition ) ; 35 | bool write_label( const Partition & partition, OperationDetail & operationdetail ) ; 36 | void read_uuid( Partition & partition ) ; 37 | bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ; 38 | bool create( const Partition & new_partition, OperationDetail & operationdetail ) ; 39 | bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition ); 40 | }; 41 | 42 | 43 | } // namespace GParted 44 | 45 | 46 | #endif /* GPARTED_NILFS2_H */ 47 | -------------------------------------------------------------------------------- /include/BCache_Info.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2022 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | /* BCache_Info 19 | * 20 | * Simple module to query very basic information about bcache devices 21 | * (components). No caching is performed by this module. 22 | */ 23 | 24 | #ifndef GPARTED_BCACHE_INFO_H 25 | #define GPARTED_BCACHE_INFO_H 26 | 27 | 28 | #include 29 | 30 | 31 | namespace GParted 32 | { 33 | 34 | 35 | class BCache_Info 36 | { 37 | public: 38 | static bool is_active(const Glib::ustring& device_path, const Glib::ustring& partition_path); 39 | static Glib::ustring get_bcache_device(const Glib::ustring& device_path, const Glib::ustring& partition_path); 40 | 41 | private: 42 | static Glib::ustring get_sysfs_bcache_path(const Glib::ustring& device_path, 43 | const Glib::ustring& partition_path); 44 | }; 45 | 46 | 47 | } // namespace GParted 48 | 49 | 50 | #endif /* GPARTED_BCACHE_INFO_H */ 51 | -------------------------------------------------------------------------------- /include/lvm2_pv.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | #ifndef GPARTED_LVM2_PV_H 19 | #define GPARTED_LVM2_PV_H 20 | 21 | #include "FileSystem.h" 22 | #include "Partition.h" 23 | 24 | 25 | namespace GParted 26 | { 27 | 28 | 29 | class lvm2_pv : public FileSystem 30 | { 31 | public: 32 | const Glib::ustring & get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const; 33 | FS get_filesystem_support() ; 34 | bool is_busy( const Glib::ustring & path ) ; 35 | void set_used_sectors( Partition & partition ) ; 36 | bool create( const Partition & new_partition, OperationDetail & operationdetail ) ; 37 | bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition ); 38 | bool check_repair( const Partition & partition, OperationDetail & operationdetail ) ; 39 | bool remove( const Partition & partition, OperationDetail & operationdetail ) ; 40 | }; 41 | 42 | 43 | } // namespace GParted 44 | 45 | 46 | #endif /* GPARTED_LVM2_PV_H */ 47 | -------------------------------------------------------------------------------- /tests/exclude_loopdev_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Name : exclude_loopdev_tests.sh 3 | # Purpose : Generate list of tests which require loopdev so they can be 4 | # excluded in GitLab Docker CI images because loop device 5 | # creation fails. Suitable for assigning directly to the 6 | # GTEST_FILTER environment variable. 7 | # Usage : export_GTEST_FILTER=`exclude_loopdev_tests.sh tests/test_SupportedFileSystems.cc` 8 | # 9 | # Copyright (C) 2022 Mike Fleetwood 10 | # 11 | # Copying and distribution of this file, with or without modification, 12 | # are permitted in any medium without royalty provided the copyright 13 | # notice and this notice are preserved. This file is offered as-is, 14 | # without any warranty. 15 | 16 | 17 | awk ' 18 | BEGIN { 19 | FS = "(, )|\\(|\\)|," 20 | num_tests = 0 21 | param_fsname["FS_BTRFS"] = "btrfs" 22 | param_fsname["FS_JFS"] = "jfs" 23 | param_fsname["FS_LVM2_PV"] = "lvm2pv" 24 | param_fsname["FS_NILFS2"] = "nilfs2" 25 | param_fsname["FS_XFS"] = "xfs" 26 | } 27 | /^TEST_P/ { 28 | # Extract parameterised test name. 29 | ptest_name = $2 "." $3 30 | #printf "DEBUG: ptest_name=\"%s\"\n", ptest_name 31 | } 32 | /SKIP_IF_NOT_ROOT_FOR_REQUIRED_LOOPDEV_FOR_FS/ && ptest_name != "" { 33 | # Save test name. 34 | test_name[num_tests] = ptest_name "/" param_fsname[$2] 35 | #printf "DEBUG: test_name[%d]=\"%s\"\n", num_tests, test_name[num_tests] 36 | num_tests++ 37 | } 38 | /^INSTANTIATE_TEST_SUITE_P/ { 39 | # Save instantiation name. 40 | instance_name = $2 41 | } 42 | END { 43 | printf "-" 44 | for (i = 0; i < num_tests; i ++) { 45 | if (i > 0) printf ":" 46 | printf "%s/%s", instance_name, test_name[i] 47 | } 48 | } 49 | ' "${@}" 50 | -------------------------------------------------------------------------------- /include/OperationCreate.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 'plors' Hakvoort 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #ifndef GPARTED_OPERATIONCREATE_H 18 | #define GPARTED_OPERATIONCREATE_H 19 | 20 | 21 | #include "Device.h" 22 | #include "Operation.h" 23 | #include "Partition.h" 24 | #include "PartitionVector.h" 25 | 26 | 27 | namespace GParted 28 | { 29 | 30 | 31 | class OperationCreate : public Operation 32 | { 33 | public: 34 | OperationCreate( const Device & device, 35 | const Partition & partition_orig, 36 | const Partition & partition_new ) ; 37 | 38 | OperationCreate(const OperationCreate& src) = delete; // Copy construction prohibited 39 | OperationCreate& operator=(const OperationCreate& rhs) = delete; // Copy assignment prohibited 40 | 41 | void apply_to_visual( PartitionVector & partitions ); 42 | 43 | private: 44 | void create_description() ; 45 | bool merge_operations( const Operation & candidate ); 46 | }; 47 | 48 | 49 | } // namespace GParted 50 | 51 | 52 | #endif /* GPARTED_OPERATIONCREATE_H */ 53 | -------------------------------------------------------------------------------- /include/OperationFormat.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 'plors' Hakvoort 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #ifndef GPARTED_OPERATIONFORMAT_H 18 | #define GPARTED_OPERATIONFORMAT_H 19 | 20 | 21 | #include "Device.h" 22 | #include "Operation.h" 23 | #include "Partition.h" 24 | #include "PartitionVector.h" 25 | 26 | 27 | namespace GParted 28 | { 29 | 30 | 31 | class OperationFormat : public Operation 32 | { 33 | public: 34 | OperationFormat( const Device & device, 35 | const Partition & partition_orig, 36 | const Partition & partition_new ) ; 37 | 38 | OperationFormat(const OperationFormat& src) = delete; // Copy construction prohibited 39 | OperationFormat& operator=(const OperationFormat& rhs) = delete; // Copy assignment prohibited 40 | 41 | void apply_to_visual( PartitionVector & partitions ); 42 | 43 | private: 44 | void create_description() ; 45 | bool merge_operations( const Operation & candidate ); 46 | }; 47 | 48 | 49 | } // namespace GParted 50 | 51 | 52 | #endif /* GPARTED_OPERATIONFORMAT_H */ 53 | -------------------------------------------------------------------------------- /HACKING: -------------------------------------------------------------------------------- 1 | git guidelines for gparted 2 | ========================== 3 | 4 | Please do not commit directly to the git.gnome.org/gparted repository 5 | unless you have been given the green light to commit freely to 6 | gparted. When in doubt assume you haven't ;-). 7 | 8 | If you are a translator feel free to mark strings for translation, fix 9 | typos in the code, etc. I'd appreciate it if you would notify me of 10 | anything you've done. 11 | 12 | Please send patches for build & configure fixes too. I really appreciate 13 | your help, I just want to review these fixes before applying. 14 | 15 | !!WHENEVER YOU COMMIT, PLACE A COMMENT IN GIT!! 16 | even when it's only one character. =) 17 | 18 | Thanks, 19 | Curtis 20 | 21 | 22 | 23 | Coding style 24 | ============ 25 | 26 | The GParted code is all over the place in terms of coding style. New 27 | code, and updated code where reasonable, should use Allman style and 28 | Smart Tabs alignment. See src/OptionComboBox.cc and 29 | src/SupportedFileSystems.cc as examples. Don't worry too much about the 30 | style, we can always adjust it if necessary during the review and merge 31 | process. 32 | 33 | * https://en.wikipedia.org/wiki/Indentation_style#Allman_style 34 | * https://www.emacswiki.org/emacs/SmartTabs 35 | * https://vim.fandom.com/wiki/Indent_with_tabs,_align_with_spaces 36 | 37 | 38 | 39 | Translatable files 40 | ================== 41 | 42 | The file po/POTFILES.in lists all source files which do or could contain 43 | translatable strings. Remember to update when adding new and removing 44 | old source code files include/*.h and src/*.cc. Generally .cc files are 45 | included and .h files are not, but there are exceptions. Some mistakes 46 | can be detected using: 47 | make distcheck 48 | -------------------------------------------------------------------------------- /include/exfat.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011 Curtis Gedak 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #ifndef GPARTED_EXFAT_H 18 | #define GPARTED_EXFAT_H 19 | 20 | 21 | #include "FileSystem.h" 22 | #include "OperationDetail.h" 23 | #include "Partition.h" 24 | 25 | 26 | namespace GParted 27 | { 28 | 29 | 30 | class exfat : public FileSystem 31 | { 32 | public: 33 | FS get_filesystem_support(); 34 | void set_used_sectors(Partition& partition); 35 | bool create(const Partition& new_partition, OperationDetail& operationdetail); 36 | void read_label(Partition& partition); 37 | bool write_label(const Partition& partition, OperationDetail& operationdetail); 38 | void read_uuid(Partition& partition); 39 | bool write_uuid(const Partition& partition, OperationDetail& operationdetail); 40 | bool check_repair(const Partition& partition, OperationDetail& operationdetail); 41 | 42 | private: 43 | Glib::ustring serial_to_blkid_uuid(const Glib::ustring& serial); 44 | Glib::ustring random_serial(); 45 | }; 46 | 47 | 48 | } // namespace GParted 49 | 50 | 51 | #endif /* GPARTED_EXFAT_H */ 52 | -------------------------------------------------------------------------------- /include/jfs.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * Copyright (C) 2008, 2009, 2010 Curtis Gedak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | */ 17 | 18 | 19 | #ifndef GPARTED_JFS_H 20 | #define GPARTED_JFS_H 21 | 22 | #include "FileSystem.h" 23 | #include "Partition.h" 24 | 25 | 26 | namespace GParted 27 | { 28 | 29 | 30 | class jfs : public FileSystem 31 | { 32 | public: 33 | FS get_filesystem_support() ; 34 | void set_used_sectors( Partition & partition ) ; 35 | void read_label( Partition & partition ) ; 36 | bool write_label( const Partition & partition, OperationDetail & operationdetail ) ; 37 | void read_uuid( Partition & partition ) ; 38 | bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ; 39 | bool create( const Partition & new_partition, OperationDetail & operationdetail ) ; 40 | bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition ); 41 | bool check_repair( const Partition & partition, OperationDetail & operationdetail ) ; 42 | }; 43 | 44 | 45 | } // namespace GParted 46 | 47 | 48 | #endif /* GPARTED_JFS_H */ 49 | -------------------------------------------------------------------------------- /po/POTFILES.in: -------------------------------------------------------------------------------- 1 | # List of source files containing translatable strings. 2 | # Please keep this file sorted alphabetically. 3 | gparted.appdata.xml.in 4 | gparted.desktop.in.in 5 | org.gnome.gparted.policy.in.in 6 | include/Utils.h 7 | src/BCache_Info.cc 8 | src/BlockSpecial.cc 9 | src/CopyBlocks.cc 10 | src/DialogPasswordEntry.cc 11 | src/Dialog_Base_Partition.cc 12 | src/Dialog_Disklabel.cc 13 | src/Dialog_FileSystem_Label.cc 14 | src/Dialog_Partition_Copy.cc 15 | src/Dialog_Partition_Info.cc 16 | src/Dialog_Partition_Name.cc 17 | src/Dialog_Partition_New.cc 18 | src/Dialog_Partition_Resize_Move.cc 19 | src/Dialog_Progress.cc 20 | src/DialogFeatures.cc 21 | src/DialogManageFlags.cc 22 | src/DMRaid.cc 23 | src/FileSystem.cc 24 | src/GParted_Core.cc 25 | src/HBoxOperations.cc 26 | src/LVM2_PV_Info.cc 27 | src/LUKS_Info.cc 28 | src/MenuHelpers.cc 29 | src/Mount_Info.cc 30 | src/OperationChangeUUID.cc 31 | src/OperationCopy.cc 32 | src/OperationCheck.cc 33 | src/OperationCreate.cc 34 | src/OperationDelete.cc 35 | src/OperationDetail.cc 36 | src/OperationFormat.cc 37 | src/OperationLabelFileSystem.cc 38 | src/OperationNamePartition.cc 39 | src/OperationResizeMove.cc 40 | src/OptionComboBox.cc 41 | src/Partition.cc 42 | src/PartitionLUKS.cc 43 | src/PartitionVector.cc 44 | src/PasswordRAMStore.cc 45 | src/ProgressBar.cc 46 | src/SupportedFileSystems.cc 47 | src/SWRaid_Info.cc 48 | src/TreeView_Detail.cc 49 | src/Utils.cc 50 | src/Win_GParted.cc 51 | src/bcachefs.cc 52 | src/btrfs.cc 53 | src/exfat.cc 54 | src/ext2.cc 55 | src/f2fs.cc 56 | src/fat16.cc 57 | src/hfs.cc 58 | src/hfsplus.cc 59 | src/jfs.cc 60 | src/linux_swap.cc 61 | src/lvm2_pv.cc 62 | src/luks.cc 63 | src/main.cc 64 | src/minix.cc 65 | src/ntfs.cc 66 | src/nilfs2.cc 67 | src/reiser4.cc 68 | src/reiserfs.cc 69 | src/udf.cc 70 | src/xfs.cc 71 | -------------------------------------------------------------------------------- /include/reiserfs.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * Copyright (C) 2008, 2009, 2010 Curtis Gedak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | */ 17 | 18 | 19 | #ifndef GPARTED_REISERFS_H 20 | #define GPARTED_REISERFS_H 21 | 22 | #include "FileSystem.h" 23 | #include "Partition.h" 24 | 25 | 26 | namespace GParted 27 | { 28 | 29 | 30 | class reiserfs : public FileSystem 31 | { 32 | public: 33 | FS get_filesystem_support() ; 34 | void set_used_sectors( Partition & partition ) ; 35 | void read_label( Partition & partition ) ; 36 | bool write_label( const Partition & partition, OperationDetail & operationdetail ) ; 37 | void read_uuid( Partition & partition ) ; 38 | bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ; 39 | bool create( const Partition & new_partition, OperationDetail & operationdetail ) ; 40 | bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition ); 41 | bool check_repair( const Partition & partition, OperationDetail & operationdetail ) ; 42 | }; 43 | 44 | 45 | } // namespace GParted 46 | 47 | 48 | #endif /* GPARTED_REISERFS_H */ 49 | -------------------------------------------------------------------------------- /include/OperationChangeUUID.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012 Rogier Goossens 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #ifndef GPARTED_OPERATIONCHANGEUUID_H 18 | #define GPARTED_OPERATIONCHANGEUUID_H 19 | 20 | 21 | #include "Device.h" 22 | #include "Operation.h" 23 | #include "Partition.h" 24 | #include "PartitionVector.h" 25 | 26 | 27 | namespace GParted 28 | { 29 | 30 | 31 | class OperationChangeUUID : public Operation 32 | { 33 | public: 34 | OperationChangeUUID( const Device & device 35 | , const Partition & partition_orig 36 | , const Partition & partition_new 37 | ) ; 38 | 39 | OperationChangeUUID(const OperationChangeUUID& src) = delete; // Copy construction prohibited 40 | OperationChangeUUID& operator=(const OperationChangeUUID& rhs) = delete; // Copy assignment prohibited 41 | 42 | void apply_to_visual( PartitionVector & partitions ); 43 | 44 | private: 45 | void create_description() ; 46 | bool merge_operations( const Operation & candidate ); 47 | }; 48 | 49 | 50 | } // namespace GParted 51 | 52 | 53 | #endif /* GPARTED_OPERATIONCHANGEUUID_H */ 54 | -------------------------------------------------------------------------------- /include/OperationNamePartition.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Michael Zimmermann 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #ifndef GPARTED_OPERATIONNAMEPARTITION_H 18 | #define GPARTED_OPERATIONNAMEPARTITION_H 19 | 20 | 21 | #include "Device.h" 22 | #include "Operation.h" 23 | #include "Partition.h" 24 | #include "PartitionVector.h" 25 | 26 | 27 | namespace GParted 28 | { 29 | 30 | 31 | class OperationNamePartition: public Operation 32 | { 33 | public: 34 | OperationNamePartition( const Device & device, 35 | const Partition & partition_orig, 36 | const Partition & partition_new ); 37 | 38 | OperationNamePartition(const OperationNamePartition& src) = delete; // Copy construction prohibited 39 | OperationNamePartition& operator=(const OperationNamePartition& rhs) = delete; // Copy assignment prohibited 40 | 41 | void apply_to_visual( PartitionVector & partitions ); 42 | 43 | private: 44 | void create_description(); 45 | bool merge_operations( const Operation & candidate ); 46 | }; 47 | 48 | 49 | } // namespace GParted 50 | 51 | 52 | #endif /* GPARTED_OPERATIONNAMEPARTITION_H */ 53 | -------------------------------------------------------------------------------- /include/Makefile.am: -------------------------------------------------------------------------------- 1 | gparted_includedir = $(pkgincludedir) 2 | 3 | noinst_HEADERS = \ 4 | BCache_Info.h \ 5 | BlockSpecial.h \ 6 | CopyBlocks.h \ 7 | DMRaid.h \ 8 | Device.h \ 9 | DialogFeatures.h \ 10 | DialogManageFlags.h \ 11 | DialogPasswordEntry.h \ 12 | Dialog_Base_Partition.h \ 13 | Dialog_Disklabel.h \ 14 | Dialog_FileSystem_Label.h \ 15 | Dialog_Partition_Copy.h \ 16 | Dialog_Partition_Info.h \ 17 | Dialog_Partition_Name.h \ 18 | Dialog_Partition_New.h \ 19 | Dialog_Partition_Resize_Move.h \ 20 | Dialog_Progress.h \ 21 | DrawingAreaVisualDisk.h \ 22 | FS_Info.h \ 23 | FileSystem.h \ 24 | Frame_Resizer_Base.h \ 25 | Frame_Resizer_Extended.h \ 26 | GParted_Core.h \ 27 | HBoxOperations.h \ 28 | LVM2_PV_Info.h \ 29 | LUKS_Info.h \ 30 | MenuHelpers.h \ 31 | Mount_Info.h \ 32 | Operation.h \ 33 | OperationChangeUUID.h \ 34 | OperationCheck.h \ 35 | OperationCopy.h \ 36 | OperationCreate.h \ 37 | OperationDelete.h \ 38 | OperationDetail.h \ 39 | OperationFormat.h \ 40 | OperationLabelFileSystem.h \ 41 | OperationNamePartition.h \ 42 | OperationResizeMove.h \ 43 | OptionComboBox.h \ 44 | Partition.h \ 45 | PartitionLUKS.h \ 46 | PartitionVector.h \ 47 | PasswordRAMStore.h \ 48 | PipeCapture.h \ 49 | Proc_Partitions_Info.h \ 50 | ProgressBar.h \ 51 | SupportedFileSystems.h \ 52 | SWRaid_Info.h \ 53 | TreeView_Detail.h \ 54 | Utils.h \ 55 | Win_GParted.h \ 56 | bcachefs.h \ 57 | btrfs.h \ 58 | exfat.h \ 59 | ext2.h \ 60 | f2fs.h \ 61 | fat16.h \ 62 | hfs.h \ 63 | hfsplus.h \ 64 | i18n.h \ 65 | jfs.h \ 66 | linux_swap.h \ 67 | lvm2_pv.h \ 68 | luks.h \ 69 | minix.h \ 70 | nilfs2.h \ 71 | ntfs.h \ 72 | reiser4.h \ 73 | reiserfs.h \ 74 | udf.h \ 75 | xfs.h 76 | -------------------------------------------------------------------------------- /include/OperationLabelFileSystem.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2008 Curtis Gedak 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #ifndef GPARTED_OPERATIONLABELFILESYSTEM_H 18 | #define GPARTED_OPERATIONLABELFILESYSTEM_H 19 | 20 | 21 | #include "Device.h" 22 | #include "Operation.h" 23 | #include "Partition.h" 24 | #include "PartitionVector.h" 25 | 26 | 27 | namespace GParted 28 | { 29 | 30 | 31 | class OperationLabelFileSystem : public Operation 32 | { 33 | public: 34 | OperationLabelFileSystem( const Device & device, 35 | const Partition & partition_orig, 36 | const Partition & partition_new ); 37 | 38 | OperationLabelFileSystem(const OperationLabelFileSystem& src) = delete; // Copy construction prohibited 39 | OperationLabelFileSystem& operator=(const OperationLabelFileSystem& rhs) = delete; // Copy assignment prohibited 40 | 41 | void apply_to_visual( PartitionVector & partitions ); 42 | 43 | private: 44 | void create_description() ; 45 | bool merge_operations( const Operation & candidate ); 46 | }; 47 | 48 | 49 | } // namespace GParted 50 | 51 | 52 | #endif /* GPARTED_OPERATIONLABELFILESYSTEM_H */ 53 | -------------------------------------------------------------------------------- /include/OperationDelete.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 'plors' Hakvoort 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #ifndef GPARTED_OPERATIONDELETE_H 18 | #define GPARTED_OPERATIONDELETE_H 19 | 20 | 21 | #include "Device.h" 22 | #include "Operation.h" 23 | #include "Partition.h" 24 | #include "PartitionVector.h" 25 | 26 | 27 | namespace GParted 28 | { 29 | 30 | 31 | class OperationDelete : public Operation 32 | { 33 | public: 34 | OperationDelete( const Device & device, const Partition & partition_orig ) ; 35 | 36 | OperationDelete(const OperationDelete& src) = delete; // Copy construction prohibited 37 | OperationDelete& operator=(const OperationDelete& rhs) = delete; // Copy assignment prohibited 38 | 39 | void apply_to_visual( PartitionVector & partitions ); 40 | 41 | private: 42 | Partition & get_partition_new(); 43 | const Partition & get_partition_new() const; 44 | 45 | void create_description() ; 46 | bool merge_operations( const Operation & candidate ); 47 | void remove_original_and_adjacent_unallocated( PartitionVector & partitions, int index_orig ); 48 | }; 49 | 50 | 51 | } // namespace GParted 52 | 53 | 54 | #endif /* GPARTED_OPERATIONDELETE_H */ 55 | -------------------------------------------------------------------------------- /gparted.appdata.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | gparted.desktop 5 | GFDL-1.3 6 | GPL-2.0+ 7 | GParted Partition Editor 8 | Create, reorganize, and delete partitions 9 | 10 |

11 | GParted is a free partition editor for graphically managing your 12 | disk partitions. 13 |

14 |

15 | With GParted you can resize, copy, label, and move partitions 16 | without data loss. These actions enable you to grow or shrink 17 | your C: drive, create space for new operating systems, or attempt 18 | data rescue from lost partitions. 19 |

20 |

21 | GParted works with many file systems including: bcachefs, btrfs, 22 | exfat, ext2, ext3, ext4, fat16, fat32, hfs, hfs+, linux-swap, 23 | lvm2 pv, minix, nilfs2, ntfs, reiserfs, reiser4, udf, ufs, and xfs. 24 |

25 |
26 | gparted.desktop 27 | 28 | 29 | https://gparted.org/appdata/gparted-main-window.png 30 | 31 | 32 | https://gparted.org 33 | https://gitlab.gnome.org/GNOME/gparted/issues 34 | https://gparted.org/donations.php 35 | https://gparted.org/help.php 36 | https://l10n.gnome.org/module/gparted/ 37 | The GParted Project 38 | gedakc@users.sf.net 39 | GNOME 40 | gparted 41 |
42 | -------------------------------------------------------------------------------- /include/Dialog_Partition_Copy.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * Copyright (C) 2010 Curtis Gedak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | */ 17 | 18 | #ifndef GPARTED_DIALOG_PARTITION_COPY_H 19 | #define GPARTED_DIALOG_PARTITION_COPY_H 20 | 21 | 22 | #include "Device.h" 23 | #include "Dialog_Base_Partition.h" 24 | #include "FileSystem.h" 25 | #include "Partition.h" 26 | 27 | 28 | namespace GParted 29 | { 30 | 31 | 32 | class Dialog_Partition_Copy : public Dialog_Base_Partition 33 | { 34 | public: 35 | Dialog_Partition_Copy(const Device& device, const FS& fs, 36 | const FS_Limits& fs_limits, 37 | const Partition& selected_partition, 38 | const Partition& copied_partition); 39 | 40 | Dialog_Partition_Copy(const Dialog_Partition_Copy& src) = delete; // Copy construction prohibited 41 | Dialog_Partition_Copy& operator=(const Dialog_Partition_Copy& rhs) = delete; // Copy assignment prohibited 42 | 43 | const Partition& get_new_partition(); 44 | 45 | private: 46 | void set_data( const Partition & selected_partition, const Partition & copied_partition ); 47 | }; 48 | 49 | 50 | } // namespace GParted 51 | 52 | 53 | #endif /* GPARTED_DIALOG_PARTITION_COPY_H */ 54 | -------------------------------------------------------------------------------- /include/udf.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 Pali Rohár 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | #ifndef GPARTED_UDF_H 19 | #define GPARTED_UDF_H 20 | 21 | #include "FileSystem.h" 22 | #include "Partition.h" 23 | 24 | #include 25 | #include 26 | 27 | 28 | namespace GParted 29 | { 30 | 31 | 32 | class udf : public FileSystem 33 | { 34 | public: 35 | udf() : m_old_mkudffs(false) {}; 36 | 37 | FS get_filesystem_support(); 38 | FS_Limits get_filesystem_limits( const Partition & partition ) const; 39 | void set_used_sectors( Partition & partition ); 40 | void read_label( Partition & partition ); 41 | bool write_label( const Partition & partition, OperationDetail & operationdetail ); 42 | void read_uuid( Partition & partition ); 43 | bool write_uuid( const Partition & partition, OperationDetail & operationdetail ); 44 | bool create( const Partition & new_partition, OperationDetail & operationdetail ); 45 | 46 | private: 47 | static bool contains_only_ascii( const Glib::ustring & str ); 48 | static size_t find_first_non_latin1( const Glib::ustring & str ); 49 | 50 | bool m_old_mkudffs; // Pre 1.1 version of mkudffs 51 | }; 52 | 53 | 54 | } // namespace GParted 55 | 56 | 57 | #endif /* GPARTED_UDF_H */ 58 | -------------------------------------------------------------------------------- /include/OperationCopy.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 'plors' Hakvoort 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #ifndef GPARTED_OPERATIONCOPY_H 18 | #define GPARTED_OPERATIONCOPY_H 19 | 20 | 21 | #include "Device.h" 22 | #include "Operation.h" 23 | #include "Partition.h" 24 | #include "PartitionVector.h" 25 | 26 | #include 27 | 28 | 29 | namespace GParted 30 | { 31 | 32 | 33 | class OperationCopy : public Operation 34 | { 35 | public: 36 | OperationCopy( const Device & device, 37 | const Partition & partition_orig, 38 | const Partition & partition_new, 39 | const Partition & partition_copied ) ; 40 | 41 | OperationCopy(const OperationCopy& src) = delete; // Copy construction prohibited 42 | OperationCopy& operator=(const OperationCopy& rhs) = delete; // Copy assignment prohibited 43 | 44 | Partition & get_partition_copied(); 45 | const Partition & get_partition_copied() const; 46 | 47 | void apply_to_visual( PartitionVector & partitions ); 48 | 49 | private: 50 | void create_description() ; 51 | bool merge_operations( const Operation & candidate ); 52 | 53 | const std::unique_ptr m_partition_copied; 54 | }; 55 | 56 | 57 | } // namespace GParted 58 | 59 | 60 | #endif /* GPARTED_OPERATIONCOPY_H */ 61 | -------------------------------------------------------------------------------- /include/OperationResizeMove.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 'plors' Hakvoort 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #ifndef GPARTED_OPERATIONRESIZEMOVE_H 18 | #define GPARTED_OPERATIONRESIZEMOVE_H 19 | 20 | 21 | #include "Device.h" 22 | #include "Operation.h" 23 | #include "Partition.h" 24 | #include "PartitionVector.h" 25 | 26 | 27 | namespace GParted 28 | { 29 | 30 | 31 | class OperationResizeMove : public Operation 32 | { 33 | public: 34 | OperationResizeMove( const Device & device, 35 | const Partition & partition_orig, 36 | const Partition & partition_new ) ; 37 | 38 | OperationResizeMove(const OperationResizeMove& src) = delete; // Copy construction prohibited 39 | OperationResizeMove& operator=(const OperationResizeMove& rhs) = delete; // Copy assignment prohibited 40 | 41 | void apply_to_visual( PartitionVector & partitions ); 42 | 43 | private: 44 | void create_description() ; 45 | bool merge_operations( const Operation & candidate ); 46 | 47 | void apply_normal_to_visual( PartitionVector & partitions ); 48 | void apply_extended_to_visual( PartitionVector & partitions ); 49 | 50 | void remove_adjacent_unallocated( PartitionVector & partitions, int index_orig ); 51 | }; 52 | 53 | 54 | } // namespace GParted 55 | 56 | 57 | #endif /* GPARTED_OPERATIONRESIZEMOVE_H */ 58 | -------------------------------------------------------------------------------- /src/minix.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2018 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #include "FileSystem.h" 18 | #include "OperationDetail.h" 19 | #include "Partition.h" 20 | #include "Utils.h" 21 | #include "minix.h" 22 | 23 | #include 24 | 25 | 26 | namespace GParted 27 | { 28 | 29 | 30 | FS minix::get_filesystem_support() 31 | { 32 | FS fs( FS_MINIX ); 33 | 34 | fs.busy = FS::GPARTED; 35 | fs.move = FS::GPARTED; 36 | fs.copy = FS::GPARTED; 37 | fs.online_read = FS::GPARTED; 38 | 39 | if ( ! Glib::find_program_in_path( "mkfs.minix").empty() ) 40 | fs.create = FS::EXTERNAL; 41 | 42 | if ( ! Glib::find_program_in_path( "fsck.minix").empty() ) 43 | fs.check = FS::EXTERNAL; 44 | 45 | return fs; 46 | } 47 | 48 | 49 | bool minix::create( const Partition & new_partition, OperationDetail & operationdetail ) 50 | { 51 | return ! operationdetail.execute_command("mkfs.minix -3 " + Glib::shell_quote(new_partition.get_path()), 52 | EXEC_CHECK_STATUS); 53 | } 54 | 55 | 56 | bool minix::check_repair( const Partition & partition, OperationDetail & operationdetail ) 57 | { 58 | return ! operationdetail.execute_command("fsck.minix " + Glib::shell_quote(partition.get_path()), 59 | EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE); 60 | } 61 | 62 | 63 | } // namespace GParted 64 | -------------------------------------------------------------------------------- /lib/gtest/include/gtest/internal/custom/gtest.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Injection point for custom user configurations. See README for details 31 | // 32 | // ** Custom implementation starts here ** 33 | 34 | #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 35 | #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 36 | 37 | #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 38 | -------------------------------------------------------------------------------- /lib/gtest/include/gtest/internal/custom/gtest-port.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Injection point for custom user configurations. See README for details 31 | // 32 | // ** Custom implementation starts here ** 33 | 34 | #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 35 | #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 36 | 37 | #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 38 | -------------------------------------------------------------------------------- /include/Dialog_Partition_Resize_Move.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #ifndef GPARTED_DIALOG_PARTITION_RESIZE_MOVE_H 18 | #define GPARTED_DIALOG_PARTITION_RESIZE_MOVE_H 19 | 20 | 21 | #include "Device.h" 22 | #include "Dialog_Base_Partition.h" 23 | #include "FileSystem.h" 24 | #include "Partition.h" 25 | #include "PartitionVector.h" 26 | 27 | 28 | namespace GParted 29 | { 30 | 31 | 32 | class Dialog_Partition_Resize_Move : public Dialog_Base_Partition 33 | { 34 | public: 35 | Dialog_Partition_Resize_Move(const Device& device, const FS& fs, 36 | const FS_Limits& fs_limits, 37 | const Partition& selected_partition, 38 | const PartitionVector& partitions); 39 | 40 | Dialog_Partition_Resize_Move(const Dialog_Partition_Resize_Move& src) = delete; // Copy construction prohibited 41 | Dialog_Partition_Resize_Move& operator=(const Dialog_Partition_Resize_Move& rhs) = delete; // Copy assignment prohibited 42 | 43 | private: 44 | void set_data( const Partition & selected_partition, const PartitionVector & partitions ); 45 | void Resize_Move_Normal( const PartitionVector & partitions ); 46 | void Resize_Move_Extended( const PartitionVector & partitions ); 47 | }; 48 | 49 | 50 | } // namespace GParted 51 | 52 | 53 | #endif /* GPARTED_DIALOG_PARTITION_RESIZE_MOVE_H */ 54 | -------------------------------------------------------------------------------- /include/fat16.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * Copyright (C) 2008, 2009, 2010 Curtis Gedak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | */ 17 | 18 | 19 | #ifndef GPARTED_FAT16_H 20 | #define GPARTED_FAT16_H 21 | 22 | #include "FileSystem.h" 23 | #include "Partition.h" 24 | 25 | 26 | namespace GParted 27 | { 28 | 29 | 30 | class fat16 : public FileSystem 31 | { 32 | public: 33 | fat16(FSType fstype) : m_specific_fstype(fstype), m_ignore_label_noname(false) {}; 34 | 35 | const Glib::ustring & get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const; 36 | FS get_filesystem_support() ; 37 | void set_used_sectors( Partition & partition ) ; 38 | void read_label( Partition & partition ) ; 39 | bool write_label( const Partition & partition, OperationDetail & operationdetail ) ; 40 | void read_uuid( Partition & partition ) ; 41 | bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ; 42 | bool create( const Partition & new_partition, OperationDetail & operationdetail ) ; 43 | bool check_repair( const Partition & partition, OperationDetail & operationdetail ) ; 44 | 45 | private: 46 | const Glib::ustring sanitize_label( const Glib::ustring & label ) const; 47 | static Glib::ustring remove_spaces(const Glib::ustring& str); 48 | 49 | const FSType m_specific_fstype; 50 | bool m_ignore_label_noname; 51 | }; 52 | 53 | 54 | } // namespace GParted 55 | 56 | 57 | #endif /* GPARTED_FAT16_H */ 58 | -------------------------------------------------------------------------------- /include/linux_swap.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * Copyright (C) 2008, 2009, 2010 Curtis Gedak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | */ 17 | 18 | 19 | #ifndef GPARTED_LINUX_SWAP_H 20 | #define GPARTED_LINUX_SWAP_H 21 | 22 | #include "FileSystem.h" 23 | #include "Partition.h" 24 | 25 | 26 | namespace GParted 27 | { 28 | 29 | 30 | class linux_swap : public FileSystem 31 | { 32 | public: 33 | virtual const Glib::ustring & get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const; 34 | 35 | FS get_filesystem_support() ; 36 | void set_used_sectors( Partition & partition ) ; 37 | void read_label( Partition & partition ) ; 38 | bool write_label( const Partition & partition, OperationDetail & operationdetail ) ; 39 | void read_uuid( Partition & partition ) ; 40 | bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ; 41 | bool create( const Partition & new_partition, OperationDetail & operationdetail ) ; 42 | bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition ); 43 | bool move( const Partition & partition_new 44 | , const Partition & partition_old 45 | , OperationDetail & operationdetail 46 | ) ; 47 | bool copy( const Partition & src_part, 48 | Partition & dest_part, 49 | OperationDetail & operationdetail ) ; 50 | }; 51 | 52 | 53 | } // namespace GParted 54 | 55 | 56 | #endif /* GPARTED_LINUX_SWAP_H */ 57 | -------------------------------------------------------------------------------- /include/PasswordRAMStore.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2018 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | /* PasswordRAMStore 19 | * 20 | * Memory only store of passwords and passphrases. Works like an associative array with 21 | * a unique key used to identify each password. Passwords are C strings which are stored 22 | * in a block of the process' virtual memory locked into RAM. Looked up pointers to 23 | * passwords are valid at least until the next time the store is modified by an insert or 24 | * erase call. Passwords are wiped from memory when no longer wanted. 25 | * 26 | * Recommend using LUKS UUIDs as the key when storing LUKS passphrases. 27 | */ 28 | 29 | #ifndef GPARTED_PASSWORDRAMSTORE_H 30 | #define GPARTED_PASSWORDRAMSTORE_H 31 | 32 | #include 33 | 34 | 35 | namespace GParted 36 | { 37 | 38 | 39 | class PasswordRAMStore 40 | { 41 | friend class PasswordRAMStoreTest; // To allow unit testing PasswordRAMStoreTest class 42 | // access to private methods. 43 | 44 | public: 45 | static bool store( const Glib::ustring & key, const char * password ); 46 | static bool erase( const Glib::ustring & key ); 47 | static const char * lookup( const Glib::ustring & key ); 48 | 49 | private: 50 | static void erase_all(); 51 | static const char * get_protected_mem(); 52 | }; 53 | 54 | 55 | } // namespace GParted 56 | 57 | 58 | #endif /* GPARTED_PASSWORDRAMSTORE_H */ 59 | -------------------------------------------------------------------------------- /include/ntfs.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * Copyright (C) 2008, 2009, 2010 Curtis Gedak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | */ 17 | 18 | 19 | #ifndef GPARTED_NTFS_H 20 | #define GPARTED_NTFS_H 21 | 22 | #include "FileSystem.h" 23 | #include "Partition.h" 24 | 25 | 26 | namespace GParted 27 | { 28 | 29 | 30 | class ntfs : public FileSystem 31 | { 32 | public: 33 | const Glib::ustring & get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const; 34 | FS get_filesystem_support() ; 35 | void set_used_sectors( Partition & partition ) ; 36 | void read_label( Partition & partition ) ; 37 | bool write_label( const Partition & partition, OperationDetail & operationdetail ) ; 38 | void read_uuid( Partition & partition ) ; 39 | bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ; 40 | bool create( const Partition & new_partition, OperationDetail & operationdetail ) ; 41 | bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition ); 42 | bool copy( const Partition & src_part, 43 | Partition & dest_part, 44 | OperationDetail & operationdetail ) ; 45 | bool check_repair( const Partition & partition, OperationDetail & operationdetail ) ; 46 | 47 | private: 48 | void resize_progress( OperationDetail *operationdetail ); 49 | void clone_progress( OperationDetail *operationdetail ); 50 | }; 51 | 52 | 53 | } // namespace GParted 54 | 55 | 56 | #endif /* GPARTED_NTFS_H */ 57 | -------------------------------------------------------------------------------- /include/Proc_Partitions_Info.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010 Curtis Gedak 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | /* Proc_Partitions_Info 19 | * 20 | * A persistent cache of information from the file /proc/partitions 21 | * that helps to minimize the number of required disk reads. 22 | */ 23 | 24 | #ifndef GPARTED_PROC_PARTITIONS_INFO_H 25 | #define GPARTED_PROC_PARTITIONS_INFO_H 26 | 27 | 28 | #include "BlockSpecial.h" 29 | 30 | #include 31 | #include 32 | 33 | 34 | namespace GParted 35 | { 36 | 37 | 38 | class Proc_Partitions_Info 39 | { 40 | public: 41 | static void load_cache(); 42 | static const std::vector & get_device_paths(); 43 | static std::vector get_device_and_partition_paths_for( 44 | const std::vector& device_paths); 45 | 46 | private: 47 | static void initialize_if_required(); 48 | static void load_proc_partitions_info_cache(); 49 | static bool is_whole_disk_device_name(const Glib::ustring& name); 50 | static std::vector get_partition_paths_for(const Glib::ustring& name); 51 | static bool is_partition_of_device(const Glib::ustring& partname, const Glib::ustring& devname); 52 | 53 | static bool proc_partitions_info_cache_initialized ; 54 | static std::vector all_entries_cache; 55 | static std::vector device_paths_cache ; 56 | }; 57 | 58 | 59 | } // namespace GParted 60 | 61 | 62 | #endif /* GPARTED_PROC_PARTITIONS_INFO_H */ 63 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | -I$(top_srcdir)/include \ 3 | $(GTHREAD_CFLAGS) \ 4 | $(GTKMM_CFLAGS) \ 5 | -DGNOMELOCALEDIR=\""$(datadir)/locale"\" 6 | 7 | AM_CFLAGS = -Wall 8 | 9 | AM_CXXFLAGS = -Wall 10 | 11 | libexec_PROGRAMS = gpartedbin 12 | 13 | gpartedbin_SOURCES = \ 14 | BCache_Info.cc \ 15 | BlockSpecial.cc \ 16 | CopyBlocks.cc \ 17 | DMRaid.cc \ 18 | Device.cc \ 19 | DialogFeatures.cc \ 20 | DialogManageFlags.cc \ 21 | DialogPasswordEntry.cc \ 22 | Dialog_Base_Partition.cc \ 23 | Dialog_Disklabel.cc \ 24 | Dialog_FileSystem_Label.cc \ 25 | Dialog_Partition_Copy.cc \ 26 | Dialog_Partition_Info.cc \ 27 | Dialog_Partition_Name.cc \ 28 | Dialog_Partition_New.cc \ 29 | Dialog_Partition_Resize_Move.cc \ 30 | Dialog_Progress.cc \ 31 | DrawingAreaVisualDisk.cc \ 32 | FS_Info.cc \ 33 | FileSystem.cc \ 34 | Frame_Resizer_Base.cc \ 35 | Frame_Resizer_Extended.cc \ 36 | GParted_Core.cc \ 37 | HBoxOperations.cc \ 38 | LVM2_PV_Info.cc \ 39 | LUKS_Info.cc \ 40 | MenuHelpers.cc \ 41 | Mount_Info.cc \ 42 | Operation.cc \ 43 | OperationChangeUUID.cc \ 44 | OperationCheck.cc \ 45 | OperationCopy.cc \ 46 | OperationCreate.cc \ 47 | OperationDelete.cc \ 48 | OperationDetail.cc \ 49 | OperationFormat.cc \ 50 | OperationLabelFileSystem.cc \ 51 | OperationNamePartition.cc \ 52 | OperationResizeMove.cc \ 53 | OptionComboBox.cc \ 54 | Partition.cc \ 55 | PartitionLUKS.cc \ 56 | PartitionVector.cc \ 57 | PasswordRAMStore.cc \ 58 | PipeCapture.cc \ 59 | Proc_Partitions_Info.cc \ 60 | ProgressBar.cc \ 61 | SupportedFileSystems.cc \ 62 | SWRaid_Info.cc \ 63 | TreeView_Detail.cc \ 64 | Utils.cc \ 65 | Win_GParted.cc \ 66 | bcachefs.cc \ 67 | btrfs.cc \ 68 | exfat.cc \ 69 | ext2.cc \ 70 | f2fs.cc \ 71 | fat16.cc \ 72 | hfs.cc \ 73 | hfsplus.cc \ 74 | jfs.cc \ 75 | linux_swap.cc \ 76 | lvm2_pv.cc \ 77 | luks.cc \ 78 | main.cc \ 79 | minix.cc \ 80 | nilfs2.cc \ 81 | ntfs.cc \ 82 | reiser4.cc \ 83 | reiserfs.cc \ 84 | udf.cc \ 85 | xfs.cc 86 | 87 | gpartedbin_LDADD = $(GTHREAD_LIBS) $(GTKMM_LIBS) 88 | 89 | -------------------------------------------------------------------------------- /include/CopyBlocks.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2013 Phillip Susi 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #ifndef GPARTED_COPYBLOCKS_H 18 | #define GPARTED_COPYBLOCKS_H 19 | 20 | #include "OperationDetail.h" 21 | #include "Utils.h" 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | 28 | namespace GParted { 29 | 30 | 31 | class CopyBlocks 32 | { 33 | const Glib::ustring & src_device; 34 | const Glib::ustring & dst_device; 35 | Byte_Value length; 36 | Byte_Value blocksize; 37 | OperationDetail &operationdetail; 38 | Byte_Value & total_done; 39 | Byte_Value total_length; 40 | std::vector buf; 41 | Byte_Value done; 42 | PedDevice *lp_device_src; 43 | PedDevice *lp_device_dst; 44 | Sector offset_src; 45 | Sector offset_dst; 46 | bool success; 47 | Glib::ustring error_message; 48 | void copy_thread(); 49 | bool cancel; 50 | bool cancel_safe; 51 | void set_cancel( bool force ); 52 | void copy_block(); 53 | 54 | public: 55 | bool set_progress_info(); 56 | CopyBlocks( const Glib::ustring & in_src_device, 57 | const Glib::ustring & in_dst_device, 58 | Sector src_start, 59 | Sector dst_start, 60 | Byte_Value in_length, 61 | Byte_Value in_blocksize, 62 | OperationDetail & in_operationdetail, 63 | Byte_Value & in_total_done, 64 | Byte_Value in_total_length, 65 | bool cancel_safe ); 66 | bool copy(); 67 | }; 68 | 69 | 70 | } // namespace GParted 71 | 72 | 73 | #endif /* GPARTED_COPYBLOCKS_H */ 74 | -------------------------------------------------------------------------------- /include/Dialog_Partition_Info.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #ifndef GPARTED_DIALOG_PARTITION_INFO_H 18 | #define GPARTED_DIALOG_PARTITION_INFO_H 19 | 20 | //what kind of info would one prefer to see here? 21 | //my guess is, it's best to keep the amount of info minimal and wait for users requests 22 | 23 | #include "Partition.h" 24 | #include "i18n.h" 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | 33 | #define BORDER 8 34 | 35 | 36 | namespace GParted 37 | { 38 | 39 | 40 | class Dialog_Partition_Info : public Gtk::Dialog 41 | { 42 | public: 43 | Dialog_Partition_Info( const Partition & partition ); 44 | 45 | private: 46 | void init_drawingarea() ; 47 | void Display_Info(); 48 | 49 | // Signal handler 50 | bool drawingarea_on_draw(const Cairo::RefPtr& cr); 51 | 52 | const Partition& partition; // (Alias to element in Win_GParted::m_display_device.partitions[] vector). 53 | 54 | Gtk::Box *hbox; 55 | Gtk::DrawingArea drawingarea ; 56 | Gtk::Frame *frame ; 57 | Gtk::Box info_msg_vbox; 58 | Gtk::ScrolledWindow info_scrolled ; 59 | 60 | Glib::RefPtr pango_layout; 61 | 62 | Gdk::RGBA color_partition; 63 | Gdk::RGBA color_used; 64 | Gdk::RGBA color_unused; 65 | Gdk::RGBA color_unallocated; 66 | Gdk::RGBA color_text; 67 | 68 | int used, unused, unallocated ; 69 | }; 70 | 71 | 72 | } // namespace GParted 73 | 74 | 75 | #endif /* GPARTED_DIALOG_PARTITION_INFO_H */ 76 | -------------------------------------------------------------------------------- /include/Device.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * Copyright (C) 2010 Curtis Gedak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | */ 17 | 18 | #ifndef GPARTED_DEVICE_H 19 | #define GPARTED_DEVICE_H 20 | 21 | #include "Partition.h" 22 | #include "PartitionVector.h" 23 | #include "Utils.h" 24 | 25 | #include 26 | 27 | 28 | namespace GParted 29 | { 30 | 31 | 32 | class Device 33 | { 34 | public: 35 | Device() ; 36 | 37 | Device get_copy_without_partitions() const; 38 | void set_path( const Glib::ustring & path ); 39 | const Glib::ustring& get_path() const; 40 | void enable_partition_naming( int length ); // > 0 => enable partition naming support 41 | bool partition_naming_supported() const; 42 | int get_max_partition_name_length() const; 43 | 44 | bool operator==( const Device & device ) const ; 45 | bool operator!=( const Device & device ) const ; 46 | 47 | void Reset() ; 48 | PartitionVector partitions; 49 | Sector length; 50 | Sector heads ; 51 | Sector sectors ; 52 | Sector cylinders ; 53 | Sector cylsize ; 54 | Glib::ustring model; 55 | Glib::ustring serial_number; 56 | Glib::ustring disktype; 57 | int sector_size ; 58 | int max_prims ; 59 | int highest_busy ; 60 | bool readonly; // Must changes to the partition table be prevented because the OS 61 | // can't be informed of the changes while other partitions are 62 | // busy. 63 | 64 | private: 65 | Glib::ustring path; 66 | int max_partition_name_length; // > 0 => naming of partitions is supported on this device 67 | }; 68 | 69 | 70 | } // namespace GParted 71 | 72 | 73 | #endif /* GPARTED_DEVICE_H */ 74 | -------------------------------------------------------------------------------- /include/BlockSpecial.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2016 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | /* BlockSpecial 19 | * 20 | * Representation of a POSIX block special file, e.g. /dev/sda1. Also 21 | * tracks the major, minor device numbers so that different names for 22 | * the same block device can be compared equal. 23 | * Refs: mknod(1) and mknod(2). 24 | */ 25 | 26 | #ifndef GPARTED_BLOCKSPECIAL_H 27 | #define GPARTED_BLOCKSPECIAL_H 28 | 29 | #include 30 | 31 | 32 | namespace GParted 33 | { 34 | 35 | 36 | class BlockSpecial 37 | { 38 | public: 39 | BlockSpecial(); 40 | BlockSpecial( const Glib::ustring & name ); 41 | 42 | Glib::ustring m_name; // E.g. Block special file {"/dev/sda1", 8, 1}, 43 | unsigned long m_major; // plain file {"FILENAME", 0, 0} and empty object 44 | unsigned long m_minor; // {"", 0, 0}. 45 | 46 | static void clear_cache(); 47 | static void register_block_special( const Glib::ustring & name, 48 | unsigned long major, unsigned long minor ); 49 | }; 50 | 51 | // Operator overloading > The Decision between Member and Non-member 52 | // http://stackoverflow.com/questions/4421706/operator-overloading/4421729#4421729 53 | // "2. If a binary operator treats both operands equally (it leaves them unchanged), 54 | // implement this operator as a non-member function." 55 | bool operator==( const BlockSpecial & lhs, const BlockSpecial & rhs ); 56 | bool operator<( const BlockSpecial & lhs, const BlockSpecial & rhs ); 57 | 58 | 59 | } // namespace GParted 60 | 61 | 62 | #endif /* GPARTED_BLOCKSPECIAL_H */ 63 | -------------------------------------------------------------------------------- /src/OperationCheck.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 'plors' Hakvoort 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | #include "OperationCheck.h" 19 | 20 | #include "Device.h" 21 | #include "Operation.h" 22 | #include "Partition.h" 23 | #include "PartitionVector.h" 24 | 25 | #include 26 | #include 27 | 28 | 29 | namespace GParted 30 | { 31 | 32 | 33 | OperationCheck::OperationCheck( const Device & device, const Partition & partition ) 34 | : Operation(OPERATION_CHECK, device, partition, partition) 35 | { 36 | } 37 | 38 | 39 | void OperationCheck::apply_to_visual( PartitionVector & partitions ) 40 | { 41 | } 42 | 43 | 44 | void OperationCheck::create_description() 45 | { 46 | g_assert(m_partition_original != nullptr); // Bug: Not initialised by constructor or reset later 47 | 48 | /*TO TRANSLATORS: looks like Check and repair file system (ext3) on /dev/hda4 */ 49 | m_description = Glib::ustring::compose(_("Check and repair file system (%1) on %2"), 50 | m_partition_original->get_filesystem_string(), 51 | m_partition_original->get_path()); 52 | } 53 | 54 | 55 | bool OperationCheck::merge_operations( const Operation & candidate ) 56 | { 57 | g_assert(m_partition_new != nullptr); // Bug: Not initialised by constructor or reset later 58 | 59 | if (candidate.m_type == OPERATION_CHECK && 60 | *m_partition_new == candidate.get_partition_original() ) 61 | // No steps required to merge this operation 62 | return true; 63 | 64 | return false; 65 | } 66 | 67 | 68 | } // namespace GParted 69 | -------------------------------------------------------------------------------- /include/btrfs.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009,2010 Luca Bruno 2 | * Copyright (C) 2010 Curtis Gedak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | */ 17 | 18 | 19 | #ifndef GPARTED_BTRFS_H 20 | #define GPARTED_BTRFS_H 21 | 22 | #include "FileSystem.h" 23 | #include "BlockSpecial.h" 24 | #include "Partition.h" 25 | 26 | 27 | namespace GParted 28 | { 29 | 30 | 31 | struct BTRFS_Device 32 | { 33 | int devid; 34 | std::vector members; 35 | } ; 36 | 37 | class btrfs : public FileSystem 38 | { 39 | public: 40 | FS get_filesystem_support() ; 41 | void set_used_sectors( Partition & partition ) ; 42 | bool is_busy( const Glib::ustring & path ) ; 43 | void read_label( Partition & partition ) ; 44 | bool write_label( const Partition & partition, OperationDetail & operationdetail ) ; 45 | void read_uuid( Partition & partition ) ; 46 | bool write_uuid( const Partition & partition, OperationDetail & operationdetail ); 47 | bool create( const Partition & new_partition, OperationDetail & operationdetail ) ; 48 | bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition ); 49 | bool check_repair( const Partition & partition, OperationDetail & operationdetail ) ; 50 | 51 | static void clear_cache() ; 52 | static Glib::ustring get_mount_device( const Glib::ustring & path ) ; 53 | static std::vector get_members( const Glib::ustring & path ) ; 54 | 55 | private: 56 | static const BTRFS_Device & get_cache_entry( const Glib::ustring & path ) ; 57 | }; 58 | 59 | 60 | } // namespace GParted 61 | 62 | 63 | #endif /* GPARTED_BTRFS_H */ 64 | -------------------------------------------------------------------------------- /lib/gtest/include/gtest/internal/custom/gtest-printers.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // This file provides an injection point for custom printers in a local 31 | // installation of gTest. 32 | // It will be included from gtest-printers.h and the overrides in this file 33 | // will be visible to everyone. 34 | // 35 | // Injection point for custom user configurations. See README for details 36 | // 37 | // ** Custom implementation starts here ** 38 | 39 | #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 40 | #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 41 | 42 | #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 43 | -------------------------------------------------------------------------------- /include/xfs.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * Copyright (C) 2008, 2009, 2010 Curtis Gedak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | */ 17 | 18 | 19 | #ifndef GPARTED_XFS_H 20 | #define GPARTED_XFS_H 21 | 22 | #include "FileSystem.h" 23 | #include "OperationDetail.h" 24 | #include "Partition.h" 25 | #include "Utils.h" 26 | 27 | #include 28 | 29 | 30 | namespace GParted 31 | { 32 | 33 | 34 | class xfs : public FileSystem 35 | { 36 | public: 37 | xfs() : m_src_used(-1LL) {}; 38 | 39 | FS get_filesystem_support() ; 40 | void set_used_sectors( Partition & partition ) ; 41 | void read_label( Partition & partition ) ; 42 | bool write_label( const Partition & partition, OperationDetail & operationdetail ) ; 43 | void read_uuid( Partition & partition ) ; 44 | bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ; 45 | bool create( const Partition & new_partition, OperationDetail & operationdetail ) ; 46 | bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition ); 47 | bool copy( const Partition & src_part, 48 | Partition & dest_part, 49 | OperationDetail & operationdetail ) ; 50 | bool check_repair( const Partition & partition, OperationDetail & operationdetail ) ; 51 | 52 | private: 53 | bool copy_progress( OperationDetail * operationdetail ); 54 | 55 | Byte_Value m_src_used; // Used bytes in the source FS of an XFS copy operation 56 | Glib::ustring m_dest_mount_point; // Temporary FS mount point of an XFS copy operation 57 | }; 58 | 59 | 60 | } // namespace GParted 61 | 62 | 63 | #endif /* GPARTED_XFS_H */ 64 | -------------------------------------------------------------------------------- /include/ProgressBar.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2016 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | #ifndef GPARTED_PROGRESSBAR_H 19 | #define GPARTED_PROGRESSBAR_H 20 | 21 | #include 22 | #include 23 | 24 | 25 | namespace GParted 26 | { 27 | 28 | 29 | enum ProgressBar_Text 30 | { 31 | PROGRESSBAR_TEXT_TIME_REMAINING, 32 | PROGRESSBAR_TEXT_COPY_BYTES 33 | }; 34 | 35 | 36 | class ProgressBar 37 | { 38 | public: 39 | ProgressBar(); 40 | 41 | ProgressBar(const ProgressBar& src) = delete; // Copy construction prohibited 42 | ProgressBar& operator=(const ProgressBar& rhs) = delete; // Copy assignment prohibited 43 | 44 | void start(double target, ProgressBar_Text text_mode = PROGRESSBAR_TEXT_TIME_REMAINING); 45 | void update( double progress ); 46 | void stop(); 47 | bool running() const; 48 | double get_fraction() const; 49 | const Glib::ustring& get_text() const; 50 | 51 | private: 52 | void do_update(); 53 | 54 | bool m_running; // Is this progress bar running? 55 | double m_target; // Progress bar target should be > 0.0 56 | double m_progress; // Should be 0.0 <= m_progress <= m_target 57 | double m_fraction; // Always between 0.0 and 1.0 for passing to Gtk::ProgressBar.set_fraction() 58 | ProgressBar_Text m_text_mode; // Style of text generation 59 | Glib::ustring m_text; // Text for passing to Gtk::ProgressBar.set_text() 60 | Glib::Timer m_timer; // Measures elapsed time to the microsecond for accurate estimation 61 | }; 62 | 63 | 64 | } // namespace GParted 65 | 66 | 67 | #endif /* GPARTED_PROGRESS_H */ 68 | -------------------------------------------------------------------------------- /src/main.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #include "GParted_Core.h" 18 | #include "Win_GParted.h" 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | 27 | int main( int argc, char *argv[] ) 28 | { 29 | GParted::GParted_Core::mainthread = Glib::Thread::self(); 30 | 31 | Gtk::Main kit( argc, argv ) ; 32 | 33 | //Set WM_CLASS X Window property for correct naming under GNOME Shell 34 | gdk_set_program_class( "GParted" ) ; 35 | 36 | //i18n 37 | bindtextdomain( GETTEXT_PACKAGE, GNOMELOCALEDIR ) ; 38 | bind_textdomain_codeset( GETTEXT_PACKAGE, "UTF-8" ) ; 39 | textdomain( GETTEXT_PACKAGE ) ; 40 | 41 | // Display version and configuration info when starting for command line users. 42 | std::cout << GParted::GParted_Core::get_version_and_config_string() << std::endl; 43 | 44 | //check UID 45 | if ( getuid() != 0 ) 46 | { 47 | const Glib::ustring error_msg(_("Root privileges are required for running GParted")); 48 | std::cerr << error_msg << std::endl; 49 | 50 | Gtk::MessageDialog dialog(error_msg, false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK); 51 | dialog .set_secondary_text( 52 | _("Since GParted is a powerful tool capable of destroying partition tables and vast amounts of data, only root may run it.") ) ; 53 | 54 | dialog .run() ; 55 | exit(EXIT_FAILURE); 56 | } 57 | 58 | //deal with arguments.. 59 | std::vector user_devices(argv + 1, argv + argc); 60 | 61 | GParted::Win_GParted win_gparted( user_devices ) ; 62 | Gtk::Main::run( win_gparted ) ; 63 | 64 | return EXIT_SUCCESS; 65 | } 66 | -------------------------------------------------------------------------------- /include/FS_Info.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2008, 2009, 2010 Curtis Gedak 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #ifndef GPARTED_FS_INFO_H 18 | #define GPARTED_FS_INFO_H 19 | 20 | #include "BlockSpecial.h" 21 | 22 | #include 23 | #include 24 | 25 | 26 | namespace GParted 27 | { 28 | 29 | 30 | struct FS_Entry 31 | { 32 | BlockSpecial path; 33 | Glib::ustring type; 34 | Glib::ustring sec_type; 35 | Glib::ustring uuid; 36 | bool have_label; 37 | Glib::ustring label; 38 | }; 39 | 40 | class FS_Info 41 | { 42 | public: 43 | static void clear_cache(); 44 | static void load_cache_for_paths(const std::vector& paths); 45 | static Glib::ustring get_fs_type( const Glib::ustring & path ); 46 | static Glib::ustring get_label( const Glib::ustring & path, bool & found ); 47 | static Glib::ustring get_uuid( const Glib::ustring & path ); 48 | static Glib::ustring get_path_by_uuid( const Glib::ustring & uuid ); 49 | static Glib::ustring get_path_by_label( const Glib::ustring & label ); 50 | 51 | private: 52 | static bool not_initialised_then_error(); 53 | static void set_commands_found(); 54 | static const FS_Entry & get_cache_entry_by_path( const Glib::ustring & path ); 55 | static void run_blkid_load_cache(const std::vector& paths); 56 | static void update_fs_info_cache_all_labels(); 57 | static bool run_blkid_update_cache_one_label( FS_Entry & fs_entry ); 58 | 59 | static bool fs_info_cache_initialized ; 60 | static bool blkid_found ; 61 | static bool need_blkid_vfat_cache_update_workaround; 62 | static std::vector fs_info_cache; 63 | }; 64 | 65 | 66 | } // namespace GParted 67 | 68 | 69 | #endif /* GPARTED_FS_INFO_H */ 70 | -------------------------------------------------------------------------------- /lib/gtest/src/gtest-all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // 31 | // Google C++ Testing and Mocking Framework (Google Test) 32 | // 33 | // Sometimes it's desirable to build Google Test by compiling a single file. 34 | // This file serves this purpose. 35 | 36 | // This line ensures that gtest.h can be compiled on its own, even 37 | // when it's fused. 38 | #include "gtest/gtest.h" 39 | 40 | // The following lines pull in the real gtest *.cc files. 41 | #include "src/gtest-assertion-result.cc" 42 | #include "src/gtest-death-test.cc" 43 | #include "src/gtest-filepath.cc" 44 | #include "src/gtest-matchers.cc" 45 | #include "src/gtest-port.cc" 46 | #include "src/gtest-printers.cc" 47 | #include "src/gtest-test-part.cc" 48 | #include "src/gtest-typed-test.cc" 49 | #include "src/gtest.cc" 50 | -------------------------------------------------------------------------------- /include/HBoxOperations.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004-2006 Bart 'plors' Hakvoort 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #ifndef GPARTED_HBOXOPERATIONS_H 18 | #define GPARTED_HBOXOPERATIONS_H 19 | 20 | #include "Operation.h" 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | 30 | namespace GParted 31 | { 32 | 33 | 34 | class HBoxOperations : public Gtk::Box 35 | { 36 | public: 37 | HBoxOperations() ; 38 | 39 | void load_operations(const OperationVector& operations); 40 | void clear() ; 41 | 42 | sigc::signal< void > signal_undo ; 43 | sigc::signal< void > signal_clear ; 44 | sigc::signal< void > signal_apply ; 45 | sigc::signal< void > signal_close ; 46 | 47 | private: 48 | bool on_signal_button_press_event( GdkEventButton * event ) ; 49 | void on_undo() ; 50 | void on_clear() ; 51 | void on_apply() ; 52 | void on_close() ; 53 | 54 | Gtk::Menu menu_popup ; 55 | Gtk::ScrolledWindow scrollwindow ; 56 | Gtk::TreeView treeview_operations ; 57 | Glib::RefPtr liststore_operations ; 58 | std::map menu_popup_items; 59 | 60 | struct TreeView_Operations_Columns : public Gtk::TreeModelColumnRecord 61 | { 62 | Gtk::TreeModelColumn operation_description; 63 | Gtk::TreeModelColumn< Glib::RefPtr > operation_icon; 64 | 65 | TreeView_Operations_Columns() 66 | { 67 | add( operation_description ); 68 | add( operation_icon ); 69 | } 70 | }; 71 | TreeView_Operations_Columns m_treeview_operations_columns; 72 | }; 73 | 74 | 75 | } // namespace GParted 76 | 77 | 78 | #endif /* GPARTED_HBOXOPERATIONS_H */ 79 | -------------------------------------------------------------------------------- /src/hfsplus.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * Copyright (C) 2008, 2009, 2010, 2011, 2012 Curtis Gedak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | */ 17 | 18 | #include "hfsplus.h" 19 | #include "FileSystem.h" 20 | #include "Partition.h" 21 | 22 | #include 23 | #include 24 | 25 | 26 | namespace GParted 27 | { 28 | 29 | 30 | FS hfsplus::get_filesystem_support() 31 | { 32 | FS fs( FS_HFSPLUS ); 33 | 34 | fs .busy = FS::GPARTED ; 35 | fs.read = FS::LIBPARTED; 36 | fs.shrink = FS::LIBPARTED; 37 | 38 | if ( ! Glib::find_program_in_path( "mkfs.hfsplus" ) .empty() ) 39 | { 40 | fs.create = FS::EXTERNAL; 41 | fs.create_with_label = FS::EXTERNAL; 42 | } 43 | 44 | if ( ! Glib::find_program_in_path( "fsck.hfsplus" ) .empty() ) 45 | fs .check = FS::EXTERNAL ; 46 | 47 | fs.copy = FS::GPARTED; 48 | fs.move = FS::GPARTED; 49 | fs .online_read = FS::GPARTED ; 50 | 51 | return fs ; 52 | } 53 | 54 | bool hfsplus::create( const Partition & new_partition, OperationDetail & operationdetail ) 55 | { 56 | Glib::ustring cmd; 57 | if( new_partition.get_filesystem_label().empty() ) 58 | cmd = "mkfs.hfsplus " + Glib::shell_quote( new_partition.get_path() ); 59 | else 60 | cmd = "mkfs.hfsplus -v " + Glib::shell_quote( new_partition.get_filesystem_label() ) + 61 | " " + Glib::shell_quote( new_partition.get_path() ); 62 | return ! operationdetail.execute_command(cmd, EXEC_CHECK_STATUS); 63 | } 64 | 65 | 66 | bool hfsplus::check_repair( const Partition & partition, OperationDetail & operationdetail ) 67 | { 68 | return ! operationdetail.execute_command("fsck.hfsplus -f -y " + Glib::shell_quote(partition.get_path()), 69 | EXEC_CHECK_STATUS); 70 | } 71 | 72 | 73 | } // namespace GParted 74 | -------------------------------------------------------------------------------- /include/LUKS_Info.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | /* LUKS_Info 19 | * 20 | * Cache of active Linux kernel Device-mapper encryption mappings. 21 | * (Named LUKS because only encryption using the LUKS on disk format is 22 | * recognised and handled). 23 | */ 24 | 25 | #ifndef GPARTED_LUKS_INFO_H 26 | #define GPARTED_LUKS_INFO_H 27 | 28 | #include "BlockSpecial.h" 29 | #include "Utils.h" 30 | 31 | #include 32 | #include 33 | 34 | 35 | namespace GParted 36 | { 37 | 38 | 39 | enum KeyLocation 40 | { 41 | KEYLOC_DMCrypt = 0, // Master encryption key is stored in DeviceMapper crypt target 42 | KEYLOC_KeyRing // Master encryption key was stored in kernel Key Ring 43 | }; 44 | 45 | struct LUKS_Mapping 46 | { 47 | Glib::ustring name; // Name of the dm-crypt mapping 48 | BlockSpecial container; // Underlying block device containing the LUKS mapping 49 | Byte_Value offset; // Offset to the start of the mapping in the underlying block device 50 | Byte_Value length; // Length of the mapping in the underlying block device 51 | KeyLocation key_loc; // Location where the master encryption key is stored 52 | }; 53 | 54 | class LUKS_Info 55 | { 56 | public: 57 | static void clear_cache(); 58 | static const LUKS_Mapping & get_cache_entry( const Glib::ustring & path ); 59 | 60 | private: 61 | static void initialise_if_required(); 62 | static void load_cache(); 63 | static const LUKS_Mapping & get_cache_entry_internal( const Glib::ustring & path ); 64 | 65 | static std::vector luks_mapping_cache; 66 | static bool cache_initialised; 67 | }; 68 | 69 | 70 | } // namespace GParted 71 | 72 | 73 | #endif /* GPARTED_LUKS_INFO_H */ 74 | -------------------------------------------------------------------------------- /include/PartitionLUKS.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | #ifndef GPARTED_PARTITIONLUKS_H 19 | #define GPARTED_PARTITIONLUKS_H 20 | 21 | #include "Partition.h" 22 | #include "Utils.h" 23 | 24 | #include 25 | 26 | 27 | namespace GParted 28 | { 29 | 30 | 31 | class PartitionLUKS : public Partition 32 | { 33 | public: 34 | PartitionLUKS(); 35 | virtual PartitionLUKS * clone() const; 36 | Partition * clone_as_plain() const; 37 | 38 | void set_luks( const Glib::ustring & path, 39 | FSType fstype, 40 | Sector header_size, 41 | Sector mapping_size, 42 | Byte_Value sector_size, 43 | bool busy ); 44 | 45 | Partition & get_encrypted() { return encrypted; }; 46 | const Partition & get_encrypted() const { return encrypted; }; 47 | 48 | Sector get_header_size() const { return header_size; }; 49 | 50 | virtual bool sector_usage_known() const; 51 | virtual Sector estimated_min_size() const; 52 | virtual Sector get_sectors_used() const; 53 | virtual Sector get_sectors_unused() const; 54 | virtual Sector get_sectors_unallocated() const; 55 | virtual void resize( const Partition & new_size ); 56 | virtual bool have_messages() const; 57 | virtual std::vector get_messages() const; 58 | virtual void clear_messages(); 59 | 60 | virtual const Partition & get_filesystem_partition() const; 61 | virtual Partition & get_filesystem_partition(); 62 | 63 | virtual const Glib::ustring get_filesystem_string() const; 64 | 65 | private: 66 | Partition encrypted; 67 | Sector header_size; // Size of the LUKS header (everything up to the start of the mapping) 68 | }; 69 | 70 | 71 | } // namespace GParted 72 | 73 | 74 | #endif /* GPARTED_PARTITIONLUKS_H */ 75 | -------------------------------------------------------------------------------- /include/DialogManageFlags.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | #ifndef GPARTED_DIALOGMANAGEFLAGS_H 19 | #define GPARTED_DIALOGMANAGEFLAGS_H 20 | 21 | 22 | #include "Partition.h" 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | 34 | namespace GParted 35 | { 36 | 37 | 38 | class DialogManageFlags : public Gtk::Dialog 39 | { 40 | public: 41 | DialogManageFlags( const Partition & partition, std::map flag_info ) ; 42 | 43 | sigc::signal< std::map, const Partition & > signal_get_flags ; 44 | sigc::signal< bool, const Partition &, const Glib::ustring &, bool > signal_toggle_flag ; 45 | 46 | bool m_changed; 47 | 48 | private: 49 | void load_treeview() ; 50 | void on_flag_toggled( const Glib::ustring & path ) ; 51 | void update_warning(); 52 | 53 | Gtk::TreeView m_treeview_flags; 54 | Gtk::Frame m_warning_frame; 55 | Gtk::Label m_warning_message; 56 | 57 | Gtk::TreeRow m_row; 58 | 59 | Glib::RefPtr m_liststore_flags; 60 | 61 | struct TreeView_Flags_Columns : public Gtk::TreeModelColumnRecord 62 | { 63 | Gtk::TreeModelColumn flag ; 64 | Gtk::TreeModelColumn status ; 65 | 66 | TreeView_Flags_Columns() 67 | { 68 | add( flag ) ; 69 | add( status ) ; 70 | } 71 | } ; 72 | TreeView_Flags_Columns m_treeview_flags_columns; 73 | 74 | const Partition& m_partition; // (Alias to element in Win_GParted::m_display_device.partitions[] vector). 75 | std::map m_flag_info; 76 | }; 77 | 78 | 79 | } // namespace GParted 80 | 81 | 82 | #endif /* GPARTED_DIALOGMANAGEFLAGS_H */ 83 | -------------------------------------------------------------------------------- /src/hfs.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * Copyright (C) 2008, 2009, 2010, 2011, 2012 Curtis Gedak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | */ 17 | 18 | #include "hfs.h" 19 | #include "FileSystem.h" 20 | #include "Partition.h" 21 | 22 | #include 23 | #include 24 | 25 | 26 | namespace GParted 27 | { 28 | 29 | 30 | FS hfs::get_filesystem_support() 31 | { 32 | FS fs( FS_HFS ); 33 | 34 | fs .busy = FS::GPARTED ; 35 | fs.read = FS::LIBPARTED; 36 | fs.shrink = FS::LIBPARTED; 37 | 38 | if ( ! Glib::find_program_in_path( "hformat" ) .empty() ) 39 | { 40 | fs.create = FS::EXTERNAL; 41 | fs.create_with_label = FS::EXTERNAL; 42 | } 43 | 44 | if ( ! Glib::find_program_in_path( "hfsck" ) .empty() ) 45 | fs .check = FS::EXTERNAL ; 46 | 47 | fs.copy = FS::GPARTED; 48 | fs.move = FS::GPARTED; 49 | fs .online_read = FS::GPARTED ; 50 | 51 | m_fs_limits.max_size = 2048 * MEBIBYTE; 52 | 53 | return fs ; 54 | } 55 | 56 | bool hfs::create( const Partition & new_partition, OperationDetail & operationdetail ) 57 | { 58 | Glib::ustring cmd; 59 | if( new_partition.get_filesystem_label().empty() ) 60 | cmd = "hformat " + Glib::shell_quote( new_partition.get_path() ); 61 | else 62 | cmd = "hformat -l " + Glib::shell_quote( new_partition.get_filesystem_label() ) + 63 | " " + Glib::shell_quote( new_partition.get_path() ); 64 | return ! operationdetail.execute_command(cmd, EXEC_CHECK_STATUS); 65 | } 66 | 67 | 68 | bool hfs::check_repair( const Partition & partition, OperationDetail & operationdetail ) 69 | { 70 | //FIXME: find out what the returnvalue is in case of modified.. also check what the -a flag does.. (there is no manpage) 71 | return ! operationdetail.execute_command("hfsck -v " + Glib::shell_quote(partition.get_path()), 72 | EXEC_CHECK_STATUS); 73 | } 74 | 75 | 76 | } // namespace GParted 77 | -------------------------------------------------------------------------------- /include/ext2.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * Copyright (C) 2008, 2009, 2010 Curtis Gedak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | */ 17 | 18 | 19 | #ifndef GPARTED_EXT2_H 20 | #define GPARTED_EXT2_H 21 | 22 | #include "FileSystem.h" 23 | #include "OperationDetail.h" 24 | #include "Partition.h" 25 | #include "Utils.h" 26 | 27 | #include 28 | 29 | 30 | namespace GParted 31 | { 32 | 33 | 34 | class ext2 : public FileSystem 35 | { 36 | public: 37 | ext2(FSType fstype) : m_specific_fstype(fstype), m_fs_block_size(0LL) {}; 38 | 39 | FS get_filesystem_support() ; 40 | void set_used_sectors( Partition & partition ) ; 41 | void read_label( Partition & partition ) ; 42 | bool write_label( const Partition & partition, OperationDetail & operationdetail ) ; 43 | void read_uuid( Partition & partition ) ; 44 | bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ; 45 | bool create( const Partition & new_partition, OperationDetail & operationdetail ) ; 46 | bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition ); 47 | bool check_repair( const Partition & partition, OperationDetail & operationdetail ) ; 48 | bool move( const Partition & partition_new, 49 | const Partition & partition_old, 50 | OperationDetail & operationdetail ); 51 | bool copy( const Partition & partition_new, 52 | Partition & partition_old, 53 | OperationDetail & operationdetail ); 54 | 55 | private: 56 | void resize_progress( OperationDetail *operationdetail ); 57 | void create_progress( OperationDetail *operationdetail ); 58 | void check_repair_progress( OperationDetail *operationdetail ); 59 | void copy_progress( OperationDetail *operationdetail ); 60 | 61 | const FSType m_specific_fstype; 62 | Glib::ustring m_mkfs_cmd; 63 | 64 | Byte_Value m_fs_block_size; // Holds file system block size for the copy_progress() callback 65 | }; 66 | 67 | 68 | } // namespace GParted 69 | 70 | 71 | #endif /* GPARTED_EXT2_H */ 72 | -------------------------------------------------------------------------------- /lib/gtest/src/gtest_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include 31 | 32 | #include "gtest/gtest.h" 33 | 34 | #if defined(GTEST_OS_ESP8266) || defined(GTEST_OS_ESP32) || \ 35 | (defined(GTEST_OS_NRF52) && defined(ARDUINO)) 36 | // Arduino-like platforms: program entry points are setup/loop instead of main. 37 | 38 | #ifdef GTEST_OS_ESP8266 39 | extern "C" { 40 | #endif 41 | 42 | void setup() { testing::InitGoogleTest(); } 43 | 44 | void loop() { RUN_ALL_TESTS(); } 45 | 46 | #ifdef GTEST_OS_ESP8266 47 | } 48 | #endif 49 | 50 | #elif defined(GTEST_OS_QURT) 51 | // QuRT: program entry point is main, but argc/argv are unusable. 52 | 53 | GTEST_API_ int main() { 54 | printf("Running main() from %s\n", __FILE__); 55 | testing::InitGoogleTest(); 56 | return RUN_ALL_TESTS(); 57 | } 58 | #else 59 | // Normal platforms: program entry point is main, argc/argv are initialized. 60 | 61 | GTEST_API_ int main(int argc, char **argv) { 62 | printf("Running main() from %s\n", __FILE__); 63 | testing::InitGoogleTest(&argc, argv); 64 | return RUN_ALL_TESTS(); 65 | } 66 | #endif 67 | -------------------------------------------------------------------------------- /include/Dialog_Partition_New.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * Copyright (C) 2008, 2009, 2010, 2011 Curtis Gedak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | */ 17 | 18 | #ifndef GPARTED_DIALOG_PARTITION_NEW_H 19 | #define GPARTED_DIALOG_PARTITION_NEW_H 20 | 21 | 22 | #include "Device.h" 23 | #include "Dialog_Base_Partition.h" 24 | #include "FileSystem.h" 25 | #include "OptionComboBox.h" 26 | #include "Partition.h" 27 | #include "Utils.h" 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | 34 | namespace GParted 35 | { 36 | 37 | 38 | class Dialog_Partition_New : public Dialog_Base_Partition 39 | { 40 | public: 41 | Dialog_Partition_New(const Device & device, 42 | const Partition & selected_partition, 43 | bool any_extended, 44 | unsigned short new_count, 45 | const std::vector & FILESYSTEMS ); 46 | ~Dialog_Partition_New(); 47 | 48 | Dialog_Partition_New(const Dialog_Partition_New& src) = delete; // Copy construction prohibited 49 | Dialog_Partition_New& operator=(const Dialog_Partition_New& rhs) = delete; // Copy assignment prohibited 50 | 51 | const Partition& get_new_partition(); 52 | 53 | private: 54 | void set_data( const Device & device, 55 | const Partition & partition, 56 | bool any_extended, 57 | unsigned short new_count, 58 | const std::vector & FILESYSTEMS ); 59 | void build_filesystems_combo(bool only_unformatted); 60 | Byte_Value get_filesystem_min_limit( FSType fstype ); 61 | 62 | Gtk::Grid grid_create; 63 | OptionComboBox combo_type; 64 | OptionComboBox combo_filesystem; 65 | Gtk::Entry partition_name_entry; 66 | Gtk::Entry filesystem_label_entry; 67 | 68 | std::vector FILESYSTEMS ; 69 | 70 | //signal handlers 71 | void combobox_changed(bool combo_type_changed); 72 | 73 | unsigned short new_count; 74 | int default_fs; 75 | }; 76 | 77 | 78 | } // namespace GParted 79 | 80 | 81 | #endif /* GPARTED_DIALOG_PARTITION_NEW_H */ 82 | -------------------------------------------------------------------------------- /lib/gtest/include/gtest/gtest_prod.h: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Google C++ Testing and Mocking Framework definitions useful in production 31 | // code. 32 | 33 | #ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_PROD_H_ 34 | #define GOOGLETEST_INCLUDE_GTEST_GTEST_PROD_H_ 35 | 36 | // When you need to test the private or protected members of a class, 37 | // use the FRIEND_TEST macro to declare your tests as friends of the 38 | // class. For example: 39 | // 40 | // class MyClass { 41 | // private: 42 | // void PrivateMethod(); 43 | // FRIEND_TEST(MyClassTest, PrivateMethodWorks); 44 | // }; 45 | // 46 | // class MyClassTest : public testing::Test { 47 | // // ... 48 | // }; 49 | // 50 | // TEST_F(MyClassTest, PrivateMethodWorks) { 51 | // // Can call MyClass::PrivateMethod() here. 52 | // } 53 | // 54 | // Note: The test class must be in the same namespace as the class being tested. 55 | // For example, putting MyClassTest in an anonymous namespace will not work. 56 | 57 | #define FRIEND_TEST(test_case_name, test_name) \ 58 | friend class test_case_name##_##test_name##_Test 59 | 60 | #endif // GOOGLETEST_INCLUDE_GTEST_GTEST_PROD_H_ 61 | -------------------------------------------------------------------------------- /data/icons/Makefile.am: -------------------------------------------------------------------------------- 1 | NULL = 2 | 3 | public_icons_themes = \ 4 | hicolor \ 5 | $(NULL) 6 | 7 | public_icons = \ 8 | hicolor_apps_16x16_gparted.png \ 9 | hicolor_apps_22x22_gparted.png \ 10 | hicolor_apps_24x24_gparted.png \ 11 | hicolor_apps_32x32_gparted.png \ 12 | hicolor_apps_48x48_gparted.png \ 13 | hicolor_apps_scalable_gparted.svg \ 14 | $(NULL) 15 | 16 | private_icons = \ 17 | $(NULL) 18 | 19 | noinst_DATA = \ 20 | $(NULL) 21 | 22 | EXTRA_DIST = \ 23 | $(public_icons) \ 24 | $(private_icons) \ 25 | $(pixmap) \ 26 | $(noinst_DATA) \ 27 | $(NULL) 28 | 29 | ############################################################################### 30 | 31 | gtk_update_icon_cache = gtk-update-icon-cache -f -t 32 | 33 | update-icon-cache: 34 | @-if test -z "$(DESTDIR)"; then \ 35 | echo "Updating Gtk icon cache."; \ 36 | for theme in $(public_icons_themes); do \ 37 | $(gtk_update_icon_cache) $(datadir)/icons/$$theme; \ 38 | done; \ 39 | else \ 40 | echo "*** Icon cache not updated. After (un)install, run this:"; \ 41 | for theme in $(public_icons_themes); do \ 42 | echo "*** $(gtk_update_icon_cache) $(datadir)/icons/$$theme"; \ 43 | done; \ 44 | fi 45 | 46 | install-icons: 47 | for icon in $(public_icons); do \ 48 | THEME=`echo $$icon | cut -d_ -f1`; \ 49 | CONTEXT=`echo $$icon | cut -d_ -f2`; \ 50 | SIZE=`echo $$icon | cut -d_ -f3`; \ 51 | ICONFILE=`echo $$icon | cut -d_ -f4`; \ 52 | mkdir -p $(DESTDIR)$(datadir)/icons/$$THEME/$$SIZE/$$CONTEXT; \ 53 | $(INSTALL_DATA) $(srcdir)/$$icon $(DESTDIR)$(datadir)/icons/$$THEME/$$SIZE/$$CONTEXT/$$ICONFILE; \ 54 | done; \ 55 | for icon in $(private_icons); do \ 56 | THEME=`echo $$icon | cut -d_ -f1`; \ 57 | CONTEXT=`echo $$icon | cut -d_ -f2`; \ 58 | SIZE=`echo $$icon | cut -d_ -f3`; \ 59 | ICONFILE=`echo $$icon | cut -d_ -f4`; \ 60 | mkdir -p $(DESTDIR)$(pkgdatadir)/icons/$$THEME/$$SIZE/$$CONTEXT; \ 61 | $(INSTALL_DATA) $(srcdir)/$$icon $(DESTDIR)$(pkgdatadir)/icons/$$THEME/$$SIZE/$$CONTEXT/$$ICONFILE; \ 62 | done 63 | 64 | uninstall-icons: 65 | -for icon in $(public_icons); do \ 66 | THEME=`echo $$icon | cut -d_ -f1`; \ 67 | CONTEXT=`echo $$icon | cut -d_ -f2`; \ 68 | SIZE=`echo $$icon | cut -d_ -f3`; \ 69 | ICONFILE=`echo $$icon | cut -d_ -f4`; \ 70 | rm -f $(DESTDIR)$(datadir)/icons/$$THEME/$$SIZE/$$CONTEXT/$$ICONFILE; \ 71 | done; \ 72 | for icon in $(private_icons); do \ 73 | THEME=`echo $$icon | cut -d_ -f1`; \ 74 | CONTEXT=`echo $$icon | cut -d_ -f2`; \ 75 | SIZE=`echo $$icon | cut -d_ -f3`; \ 76 | ICONFILE=`echo $$icon | cut -d_ -f4`; \ 77 | rm -f $(DESTDIR)$(pkgdatadir)/icons/$$THEME/$$SIZE/$$CONTEXT/$$ICONFILE; \ 78 | done 79 | 80 | install-data-local: install-icons update-icon-cache 81 | 82 | uninstall-local: uninstall-icons update-icon-cache 83 | -------------------------------------------------------------------------------- /src/BCache_Info.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2022 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | #include "BCache_Info.h" 19 | 20 | #include // POSIX version of basename() 21 | #include 22 | #include 23 | #include 24 | 25 | 26 | namespace GParted 27 | { 28 | 29 | 30 | // Return true if this device or partition contains an active bcache component, false 31 | // otherwise. Equivalent to does the directory /sys/block/DEV[/PTN]/bcache exist? 32 | bool BCache_Info::is_active(const Glib::ustring& device_path, const Glib::ustring& partition_path) 33 | { 34 | return Glib::file_test(get_sysfs_bcache_path(device_path, partition_path), Glib::FILE_TEST_IS_DIR); 35 | } 36 | 37 | 38 | // Return the bcache device name for a registered bcache backing device (active 39 | // component), or an empty string. 40 | // E.g.: ("/dev/sdb", "/dev/sdb1") -> "/dev/bcache0" 41 | Glib::ustring BCache_Info::get_bcache_device(const Glib::ustring& device_path, const Glib::ustring& partition_path) 42 | { 43 | Glib::ustring sysfs_path = get_sysfs_bcache_path(device_path, partition_path) + "/dev"; 44 | 45 | char buf[128]; // Large enough for link target 46 | // "../../../../../../../../../../virtual/block/bcache0". 47 | ssize_t len = readlink(sysfs_path.c_str(), buf, sizeof(buf)-1); 48 | if (len < 0) 49 | return Glib::ustring(""); 50 | buf[len] = '\0'; 51 | 52 | return "/dev/" + Glib::ustring(basename(buf)); 53 | } 54 | 55 | 56 | // Private methods 57 | 58 | Glib::ustring BCache_Info::get_sysfs_bcache_path(const Glib::ustring& device_path, const Glib::ustring& partition_path) 59 | { 60 | Glib::ustring dev_name = device_path.substr(5); // Remove leading "/dev/". 61 | 62 | if (device_path == partition_path) 63 | { 64 | // Whole drive 65 | return "/sys/block/" + dev_name + "/bcache"; 66 | } 67 | else 68 | { 69 | // Partition on drive 70 | Glib::ustring ptn_name = partition_path.substr(5); // Remove leading "/dev/". 71 | return "/sys/block/" + dev_name + "/" + ptn_name + "/bcache"; 72 | } 73 | } 74 | 75 | 76 | } // namespace GParted 77 | -------------------------------------------------------------------------------- /include/PipeCapture.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2013 Phillip Susi 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #ifndef GPARTED_PIPECAPTURE_H 18 | #define GPARTED_PIPECAPTURE_H 19 | 20 | #include 21 | #include 22 | #include // typedef size_t 23 | #include // typedef gunichar 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | 30 | namespace GParted 31 | { 32 | 33 | 34 | // captures output pipe of subprocess into a ustring and emits a signal on eof 35 | class PipeCapture 36 | { 37 | public: 38 | PipeCapture( int fd, Glib::ustring &buffer ); 39 | ~PipeCapture(); 40 | 41 | void connect_signal(); 42 | sigc::signal signal_eof; 43 | sigc::signal signal_update; 44 | 45 | private: 46 | bool OnReadable( Glib::IOCondition condition ); 47 | static gboolean _OnReadable( GIOChannel *source, 48 | GIOCondition condition, 49 | gpointer data ); 50 | static void append_unichar_vector_to_utf8( std::string & str, 51 | const std::vector & ucvec ); 52 | static gunichar get_utf8_char_validated(const char *p, gssize max_len); 53 | static int utf8_char_length( unsigned char firstbyte ); 54 | 55 | Glib::RefPtr channel; // Wrapper around fd 56 | char * readbuf; // Bytes read from IOChannel (fd) 57 | size_t fill_offset; // Filling offset into readbuf 58 | std::vector linevec; // Current line stored as UCS-4 characters 59 | size_t cursor; // Cursor position index into linevec 60 | std::string capturebuf; // Captured output as UTF-8 characters 61 | size_t line_start; // Index into bytebuf where current line starts 62 | Glib::ustring & callerbuf; // Reference to caller supplied buffer 63 | bool callerbuf_uptodate; // Has capturebuf changed since last copied to callerbuf? 64 | }; 65 | 66 | 67 | } // namespace GParted 68 | 69 | 70 | #endif /* GPARTED_PIPECAPTURE_H */ 71 | -------------------------------------------------------------------------------- /doc/gparted.8: -------------------------------------------------------------------------------- 1 | .\" Copyright (c) 2008, 2009, 2010, 2011 Curtis Gedak. 2 | .\" This is free software. You may redistribute copies of it under the terms of 3 | .\" the GNU General Public License . 4 | .\" There is NO WARRANTY, to the extent permitted by law. 5 | .\" 6 | .\" Process this file with 7 | .\" groff -man -Tascii gparted.8 8 | .\" 9 | .\" Generate man page web content with 10 | .\" rman -f html gparted.8 > gparted_manpage.html 11 | .\" and manually edit out hyperlinks and leave bold. 12 | .\" 13 | .\" 14 | .TH GPARTED 8 "Jan 16th, 2011" gparted "GParted Manual" 15 | .SH NAME 16 | gparted \- GNOME Partition Editor for manipulating disk partitions. 17 | .SH SYNOPSIS 18 | .B gparted [device]... 19 | .SH DESCRIPTION 20 | The 21 | .B gparted 22 | application is the GNOME partition 23 | editor for creating, reorganizing, and deleting disk partitions. 24 | 25 | A disk device can be subdivided into one or more partitions. 26 | The 27 | .B gparted 28 | application enables you to 29 | change the partition organization on a disk device while 30 | preserving the contents of the partition. 31 | 32 | With 33 | .B gparted 34 | you can accomplish the following tasks: 35 | .br 36 | - Create a partition table on a disk device. 37 | .br 38 | - Enable and disable partition flags such as boot and hidden. 39 | .br 40 | - Perform actions with partitions such as create, delete, 41 | resize, move, check, label, copy, and paste. 42 | 43 | More documentation can be found in the application help manual, 44 | and online at: 45 | .br 46 | https://gparted.org 47 | .SH EXAMPLES 48 | You can run 49 | .B gparted 50 | from a command line 51 | and specify one or more disk devices. 52 | 53 | For example, to start gparted with the devices /dev/sda and /dev/sdc 54 | you would use the following command: 55 | 56 | .B gparted 57 | /dev/sda /dev/sdc 58 | .SH NOTES 59 | Editing partitions has the potential to cause LOSS of DATA. 60 | 61 | The 62 | .B gparted 63 | application is 64 | designed to enable you to edit partitions while 65 | reducing the risk of data loss. 66 | The application is carefully tested and is used 67 | by the GParted project team. 68 | However, loss of data might occur due to software bugs, 69 | hardware problems, or power failure. 70 | 71 | You can help to reduce the risk of data loss by 72 | not mounting or unmounting partitions outside of 73 | the 74 | .B gparted 75 | application while 76 | .B gparted 77 | is running. 78 | 79 | You are advised to BACKUP your DATA before using 80 | the 81 | .B gparted 82 | application. 83 | .SH REPORTING BUGS 84 | Report bugs at: 85 | .br 86 | https://gparted.org/bugs.php 87 | .SH AUTHOR 88 | Manual page written by Curtis Gedak 89 | .SH "SEE ALSO" 90 | .BR parted (8), 91 | .BR fdisk (8), 92 | .BR mkfs (8), 93 | .BR ntfsprogs (8) 94 | -------------------------------------------------------------------------------- /include/SWRaid_Info.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | /* SWRaid_Info 19 | * 20 | * Cache of information about RAID array members recognised by mdadm so 21 | * the command only needs to be executed once per refresh. This will 22 | * include Linux Software RAID arrays and also IMSM and DDF type 23 | * Firmware / BIOS / ATARAID arrays whether or not the distribution uses 24 | * dmraid or mdadm to manage them. 25 | * 26 | * Note that ATARAID array members will only report as active in this 27 | * module if they were started using mdadm and appear in /proc/mdstat. 28 | */ 29 | 30 | #ifndef GPARTED_SWRAID_INFO_H 31 | #define GPARTED_SWRAID_INFO_H 32 | 33 | 34 | #include "BlockSpecial.h" 35 | #include "Utils.h" 36 | 37 | #include 38 | #include 39 | 40 | 41 | namespace GParted 42 | { 43 | 44 | 45 | struct SWRaid_Member 46 | { 47 | BlockSpecial member; 48 | FSType fstype; 49 | Glib::ustring array; 50 | Glib::ustring uuid; 51 | Glib::ustring label; 52 | bool active; 53 | }; 54 | 55 | class SWRaid_Info 56 | { 57 | public: 58 | static void load_cache(); 59 | static bool is_member( const Glib::ustring & member_path ); 60 | static bool is_member_active( const Glib::ustring & member_path ); 61 | static FSType get_fstype(const Glib::ustring& member_path); 62 | static const Glib::ustring& get_array(const Glib::ustring& member_path); 63 | static const Glib::ustring& get_uuid(const Glib::ustring& member_path); 64 | static const Glib::ustring& get_label(const Glib::ustring& member_path); 65 | 66 | private: 67 | static void initialise_if_required(); 68 | static void set_command_found(); 69 | static void load_swraid_info_cache(); 70 | static SWRaid_Member & get_cache_entry_by_member( const Glib::ustring & member_path ); 71 | static Glib::ustring mdadm_to_canonical_uuid( const Glib::ustring & mdadm_uuid ); 72 | 73 | static bool cache_initialised; 74 | static bool mdadm_found; 75 | static std::vector swraid_info_cache; 76 | }; 77 | 78 | 79 | } // namespace GParted 80 | 81 | 82 | #endif /* GPARTED_SWRAID_INFO_H */ 83 | -------------------------------------------------------------------------------- /src/Dialog_FileSystem_Label.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2008 Curtis Gedak 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #include "Dialog_FileSystem_Label.h" 18 | #include "Partition.h" 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | 28 | namespace GParted 29 | { 30 | 31 | 32 | Dialog_FileSystem_Label::Dialog_FileSystem_Label( const Partition & partition ) 33 | { 34 | this ->set_resizable( false ) ; 35 | this->set_size_request( 400, -1 ); 36 | 37 | /* TO TRANSLATORS: dialog title, looks like Set file system label on /dev/hda3 */ 38 | this->set_title( Glib::ustring::compose( _("Set file system label on %1"), partition.get_path() ) ); 39 | 40 | // Horizontal box to hold the label and entry box line 41 | Gtk::Box* hbox(Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL))); 42 | hbox->set_border_width( 5 ); 43 | hbox->set_spacing( 10 ); 44 | get_content_area()->pack_start(*hbox, Gtk::PACK_SHRINK); 45 | 46 | // Only line: "Label: [EXISTINGLABEL ]" 47 | Gtk::Label *label_label = Utils::mk_label("" + Glib::ustring(_("Label:")) + ""); 48 | hbox->pack_start(*label_label, Gtk::PACK_SHRINK); 49 | entry = Gtk::manage(new Gtk::Entry()); 50 | entry->set_max_length(Utils::get_filesystem_label_maxlength(partition.fstype)); 51 | entry->set_width_chars( 30 ); 52 | entry->set_activates_default( true ); 53 | entry->set_text( partition.get_filesystem_label() ); 54 | entry->select_region( 0, entry->get_text_length() ); 55 | entry->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY, label_label->get_accessible()); 56 | hbox->pack_start( *entry, Gtk::PACK_SHRINK ); 57 | 58 | this ->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL ) ; 59 | this ->add_button( Gtk::Stock::OK, Gtk::RESPONSE_OK ) ; 60 | this ->set_default_response( Gtk::RESPONSE_OK ) ; 61 | this ->show_all_children() ; 62 | } 63 | 64 | 65 | Glib::ustring Dialog_FileSystem_Label::get_new_label() 66 | { 67 | return Utils::trim( Glib::ustring( entry ->get_text() ) ); 68 | } 69 | 70 | 71 | } // namespace GParted 72 | -------------------------------------------------------------------------------- /src/OperationNamePartition.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Michael Zimmermann 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | #include "OperationNamePartition.h" 19 | 20 | #include "Device.h" 21 | #include "Operation.h" 22 | #include "Partition.h" 23 | #include "PartitionVector.h" 24 | 25 | #include 26 | #include 27 | 28 | 29 | namespace GParted 30 | { 31 | 32 | 33 | OperationNamePartition::OperationNamePartition( const Device & device, 34 | const Partition & partition_orig, 35 | const Partition & partition_new ) 36 | : Operation(OPERATION_NAME_PARTITION, device, partition_orig, partition_new) 37 | { 38 | } 39 | 40 | 41 | void OperationNamePartition::apply_to_visual( PartitionVector & partitions ) 42 | { 43 | substitute_new( partitions ); 44 | } 45 | 46 | void OperationNamePartition::create_description() 47 | { 48 | g_assert(m_partition_new != nullptr); // Bug: Not initialised by constructor or reset later 49 | 50 | if(m_partition_new->name.empty()) 51 | { 52 | /* TO TRANSLATORS: looks like Clear partition name on /dev/hda3 */ 53 | m_description = Glib::ustring::compose(_("Clear partition name on %1"), 54 | m_partition_new->get_path()); 55 | } 56 | else 57 | { 58 | /* TO TRANSLATORS: looks like Set partition name "My Name" on /dev/hda3 */ 59 | m_description = Glib::ustring::compose(_("Set partition name \"%1\" on %2"), 60 | m_partition_new->name, 61 | m_partition_new->get_path()); 62 | } 63 | } 64 | 65 | 66 | bool OperationNamePartition::merge_operations( const Operation & candidate ) 67 | { 68 | g_assert(m_partition_new != nullptr); // Bug: Not initialised by constructor or reset later 69 | 70 | if (candidate.m_type == OPERATION_NAME_PARTITION && 71 | *m_partition_new == candidate.get_partition_original() ) 72 | { 73 | m_partition_new->name = candidate.get_partition_new().name; 74 | create_description(); 75 | return true; 76 | } 77 | 78 | return false; 79 | } 80 | 81 | 82 | } // namespace GParted 83 | -------------------------------------------------------------------------------- /src/OperationLabelFileSystem.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2008 Curtis Gedak 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | #include "OperationLabelFileSystem.h" 19 | 20 | #include "Device.h" 21 | #include "Operation.h" 22 | #include "Partition.h" 23 | #include "PartitionVector.h" 24 | 25 | #include 26 | #include 27 | 28 | 29 | namespace GParted 30 | { 31 | 32 | 33 | OperationLabelFileSystem::OperationLabelFileSystem( const Device & device, 34 | const Partition & partition_orig, 35 | const Partition & partition_new ) 36 | : Operation(OPERATION_LABEL_FILESYSTEM, device, partition_orig, partition_new) 37 | { 38 | } 39 | 40 | 41 | void OperationLabelFileSystem::apply_to_visual( PartitionVector & partitions ) 42 | { 43 | substitute_new( partitions ); 44 | } 45 | 46 | 47 | void OperationLabelFileSystem::create_description() 48 | { 49 | g_assert(m_partition_new != nullptr); // Bug: Not initialised by constructor or reset later 50 | 51 | if(m_partition_new->get_filesystem_partition().get_filesystem_label().empty()) 52 | { 53 | /* TO TRANSLATORS: looks like Clear file system Label on /dev/hda3 */ 54 | m_description = Glib::ustring::compose(_("Clear file system label on %1"), 55 | m_partition_new->get_path()); 56 | } 57 | else 58 | { 59 | /* TO TRANSLATORS: looks like Set file system label "My Label" on /dev/hda3 */ 60 | m_description = Glib::ustring::compose(_("Set file system label \"%1\" on %2"), 61 | m_partition_new->get_filesystem_partition().get_filesystem_label(), 62 | m_partition_new->get_path()); 63 | } 64 | } 65 | 66 | 67 | bool OperationLabelFileSystem::merge_operations( const Operation & candidate ) 68 | { 69 | g_assert(m_partition_new != nullptr); // Bug: Not initialised by constructor or reset later 70 | 71 | if (candidate.m_type == OPERATION_LABEL_FILESYSTEM && 72 | *m_partition_new == candidate.get_partition_original() ) 73 | { 74 | m_partition_new->set_filesystem_label(candidate.get_partition_new().get_filesystem_label()); 75 | create_description(); 76 | return true; 77 | } 78 | 79 | return false; 80 | } 81 | 82 | 83 | } // namespace GParted 84 | -------------------------------------------------------------------------------- /lib/gtest/Makefile.am: -------------------------------------------------------------------------------- 1 | # Nonstandard package files for distribution 2 | EXTRA_DIST = \ 3 | LICENSE \ 4 | README.md \ 5 | include/gtest/internal/custom/README.md 6 | 7 | # Google Test source files that we don't compile directly. (Instead 8 | # they are #included by gtest-all.cc). 9 | # List files with: 10 | # cd lib/gtest/ 11 | # find src include '(' -name '*.h' -o -name '*.cc' ')' -print | \ 12 | # egrep -v 'gtest-all.cc|gtest_main.cc' | sort 13 | GTEST_SRC = \ 14 | include/gtest/gtest-assertion-result.h \ 15 | include/gtest/gtest-death-test.h \ 16 | include/gtest/gtest.h \ 17 | include/gtest/gtest-matchers.h \ 18 | include/gtest/gtest-message.h \ 19 | include/gtest/gtest-param-test.h \ 20 | include/gtest/gtest_pred_impl.h \ 21 | include/gtest/gtest-printers.h \ 22 | include/gtest/gtest_prod.h \ 23 | include/gtest/gtest-spi.h \ 24 | include/gtest/gtest-test-part.h \ 25 | include/gtest/gtest-typed-test.h \ 26 | include/gtest/internal/custom/gtest.h \ 27 | include/gtest/internal/custom/gtest-port.h \ 28 | include/gtest/internal/custom/gtest-printers.h \ 29 | include/gtest/internal/gtest-death-test-internal.h \ 30 | include/gtest/internal/gtest-filepath.h \ 31 | include/gtest/internal/gtest-internal.h \ 32 | include/gtest/internal/gtest-param-util.h \ 33 | include/gtest/internal/gtest-port-arch.h \ 34 | include/gtest/internal/gtest-port.h \ 35 | include/gtest/internal/gtest-string.h \ 36 | include/gtest/internal/gtest-type-util.h \ 37 | src/gtest-assertion-result.cc \ 38 | src/gtest.cc \ 39 | src/gtest-death-test.cc \ 40 | src/gtest-filepath.cc \ 41 | src/gtest-internal-inl.h \ 42 | src/gtest-matchers.cc \ 43 | src/gtest-port.cc \ 44 | src/gtest-printers.cc \ 45 | src/gtest-test-part.cc \ 46 | src/gtest-typed-test.cc 47 | 48 | EXTRA_DIST += $(GTEST_SRC) 49 | 50 | # We define the global AM_CPPFLAGS as everything we compile includes from these 51 | # directories. 52 | AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/include $(GTEST_CPPFLAGS) 53 | AM_CXXFLAGS = $(GTEST_CXXFLAGS) 54 | AM_LDFLAGS = $(GTEST_LDFLAGS) 55 | LDADD = $(GTEST_LIBS) 56 | 57 | # Build rules for libraries. 58 | check_LTLIBRARIES = lib/libgtest.la lib/libgtest_main.la 59 | 60 | lib_libgtest_la_SOURCES = src/gtest-all.cc 61 | 62 | lib_libgtest_main_la_SOURCES = src/gtest_main.cc 63 | lib_libgtest_main_la_LIBADD = lib/libgtest.la 64 | -------------------------------------------------------------------------------- /include/LVM2_PV_Info.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | /* LVM2_PV_Info 19 | * 20 | * A persistent cache of information about LVM2 PVs that helps to 21 | * minimize the number of executions of lvm commands used to query 22 | * their attributes. 23 | */ 24 | 25 | #ifndef GPARTED_LVM2_PV_INFO_H 26 | #define GPARTED_LVM2_PV_INFO_H 27 | 28 | #include "BlockSpecial.h" 29 | #include "Utils.h" 30 | 31 | #include 32 | #include 33 | 34 | 35 | namespace GParted 36 | { 37 | 38 | 39 | struct LVM2_PV 40 | { 41 | BlockSpecial pv_name; 42 | Byte_Value pv_size; 43 | Byte_Value pv_free; 44 | Glib::ustring vg_name; 45 | }; 46 | 47 | struct LVM2_VG 48 | { 49 | Glib::ustring vg_name; 50 | Glib::ustring vg_attr; 51 | Glib::ustring lv_name; 52 | Glib::ustring lv_attr; 53 | }; 54 | 55 | class LVM2_PV_Info 56 | { 57 | public: 58 | static bool is_lvm2_pv_supported(); 59 | static void clear_cache(); 60 | static const Glib::ustring& get_vg_name(const Glib::ustring& path); 61 | static Byte_Value get_size_bytes( const Glib::ustring & path ); 62 | static Byte_Value get_free_bytes( const Glib::ustring & path ); 63 | static bool has_active_lvs( const Glib::ustring & path ); 64 | static bool is_vg_exported( const Glib::ustring & vgname ); 65 | static std::vector get_vg_members( const Glib::ustring & vgname ); 66 | static std::vector get_vg_lvs( const Glib::ustring & vgname ); 67 | static std::vector get_error_messages( const Glib::ustring & path ); 68 | private: 69 | static void initialize_if_required(); 70 | static void set_command_found(); 71 | static void load_lvm2_pv_info_cache(); 72 | static const LVM2_PV & get_pv_cache_entry_by_name( const Glib::ustring & pvname ); 73 | static const LVM2_VG & get_vg_cache_entry_by_name( const Glib::ustring & vgname ); 74 | static Byte_Value lvm2_pv_size_to_num(const Glib::ustring& str); 75 | static bool bit_set( const Glib::ustring & attr, unsigned int bit ) ; 76 | static bool lvm2_pv_info_cache_initialized ; 77 | static bool lvm_found ; 78 | static std::vector lvm2_pv_cache; 79 | static std::vector lvm2_vg_cache; 80 | static std::vector error_messages ; 81 | }; 82 | 83 | 84 | } // namespace GParted 85 | 86 | 87 | #endif /* GPARTED_LVM2_PV_INFO_H */ 88 | -------------------------------------------------------------------------------- /src/Dialog_Partition_Name.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Michael Zimmermann 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #include "Dialog_Partition_Name.h" 18 | #include "Partition.h" 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | 28 | namespace GParted 29 | { 30 | 31 | 32 | Dialog_Partition_Name::Dialog_Partition_Name( const Partition & partition, int max_length ) 33 | { 34 | this->set_resizable( false ); 35 | this->set_size_request( 400, -1 ); 36 | 37 | /* TO TRANSLATORS: dialog title, looks like Set partition name on /dev/hda3 */ 38 | this->set_title( Glib::ustring::compose( _("Set partition name on %1"), partition.get_path() ) ); 39 | 40 | // Horizontal box to hold the label and entry box line 41 | Gtk::Box* hbox(Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL))); 42 | hbox->set_border_width( 5 ); 43 | hbox->set_spacing( 10 ); 44 | get_content_area()->pack_start(*hbox, Gtk::PACK_SHRINK); 45 | 46 | // Only line: "Name: [EXISTINGNAME ]" 47 | Gtk::Label *label_name = Utils::mk_label("" + Glib::ustring(_("Name:")) + ""); 48 | hbox->pack_start(*label_name, Gtk::PACK_SHRINK); 49 | 50 | entry = Gtk::manage(new Gtk::Entry()); 51 | // NOTE: This limits the Gtk::Entry size in UTF-8 characters but partition names 52 | // are defined in terms of ASCII characters, or for GPT, UTF-16LE code points. 53 | // See Utils::get_max_partition_name_length(). So for certain extended characters 54 | // this limit will be too generous. 55 | entry->set_max_length( max_length ); 56 | 57 | entry->set_width_chars( 30 ); 58 | entry->set_activates_default( true ); 59 | entry->set_text( partition.name ); 60 | entry->select_region( 0, entry->get_text_length() ); 61 | entry->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY, label_name->get_accessible()); 62 | hbox->pack_start( *entry, Gtk::PACK_SHRINK ); 63 | 64 | this->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL ); 65 | this->add_button( Gtk::Stock::OK, Gtk::RESPONSE_OK ); 66 | this->set_default_response( Gtk::RESPONSE_OK ); 67 | this->show_all_children() ; 68 | } 69 | 70 | 71 | Glib::ustring Dialog_Partition_Name::get_new_name() 72 | { 73 | return Utils::trim( Glib::ustring( entry->get_text() ) ); 74 | } 75 | 76 | 77 | } // namespace GParted 78 | -------------------------------------------------------------------------------- /include/Mount_Info.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2016 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | /* Mount_Info 19 | * 20 | * Cache of mounted file systems from /proc/mounts and cache of 21 | * configured mount points from /etc/fstab. 22 | */ 23 | 24 | #ifndef GPARTED_MOUNT_INFO_H 25 | #define GPARTED_MOUNT_INFO_H 26 | 27 | #include "BlockSpecial.h" 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | 34 | namespace GParted 35 | { 36 | 37 | 38 | struct MountEntry 39 | { 40 | bool readonly; // Is the file system mounted read-only? 41 | std::vector mountpoints; // File system mounted on ... 42 | 43 | MountEntry() : readonly( false ) {}; 44 | }; 45 | 46 | class Mount_Info 47 | { 48 | public: 49 | typedef std::map MountMapping; 50 | 51 | static void load_cache(); 52 | static bool is_dev_mounted( const Glib::ustring & path ); 53 | static bool is_dev_mounted( const BlockSpecial & bs ); 54 | static bool is_dev_mounted_at(const Glib::ustring& path, const Glib::ustring& mountpoint); 55 | static bool is_dev_mounted_readonly( const Glib::ustring & path ); 56 | static bool is_dev_mounted_readonly( const BlockSpecial & bs ); 57 | static std::vector get_all_mountpoints(); 58 | static const std::vector & get_mounted_mountpoints( const Glib::ustring & path ); 59 | static const std::vector & get_fstab_mountpoints( const Glib::ustring & path ); 60 | 61 | private: 62 | static void read_mountpoints_from_file( const Glib::ustring & filename, MountMapping & map ); 63 | static void add_mountpoint_entry(MountMapping& map, 64 | const Glib::ustring& node, 65 | bool readonly, 66 | const Glib::ustring& mountpoint); 67 | static bool parse_readonly_flag( const Glib::ustring & str ); 68 | static void read_mountpoints_from_file_swaps( const Glib::ustring & filename, 69 | MountMapping & map ); 70 | static bool have_rootfs_dev( MountMapping & map ); 71 | static void read_mountpoints_from_mount_command( MountMapping & map ); 72 | static const MountEntry& find(MountMapping& map, const Glib::ustring& path); 73 | static Glib::ustring lookup_uuid_or_label(const Glib::ustring& ref); 74 | }; 75 | 76 | 77 | } // namespace GParted 78 | 79 | 80 | #endif /* GPARTED_MOUNT_INFO_H */ 81 | -------------------------------------------------------------------------------- /src/PartitionVector.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | #include "Partition.h" 18 | #include "PartitionVector.h" 19 | 20 | #include 21 | 22 | 23 | namespace GParted 24 | { 25 | 26 | 27 | PartitionVector::PartitionVector( const PartitionVector & src ) 28 | { 29 | v.resize( src.size() ); 30 | for ( unsigned int i = 0 ; i < src.size() ; i ++ ) 31 | v[i] = src[i].clone(); 32 | } 33 | 34 | PartitionVector::~PartitionVector() 35 | { 36 | for ( unsigned int i = 0 ; i < v.size() ; i ++ ) 37 | delete v[i]; 38 | } 39 | 40 | void PartitionVector::swap( PartitionVector & other ) 41 | { 42 | std::swap( this->v, other.v ); 43 | } 44 | 45 | PartitionVector & PartitionVector::operator=( PartitionVector rhs ) 46 | { 47 | // Copy assignment implemented using copy-and-swap idiom. 48 | // 1) Pass-by-value to get rhs variable copy constructed from source; 49 | // 2) Swap contents of this PartitionVector with rhs variable copy; 50 | // 3) Method returns, rhs variable goes out of scope and destructor called on old 51 | // this PartitionVector to delete owned Partitions. 52 | // Reference: 53 | // Wikibooks: More C++ Idioms / Copy-and-swap 54 | // https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Copy-and-swap 55 | rhs.swap( *this ); 56 | return *this; 57 | } 58 | 59 | void PartitionVector::pop_back() 60 | { 61 | delete v.back(); 62 | v.pop_back(); 63 | } 64 | 65 | void PartitionVector::erase( const iterator position ) 66 | { 67 | delete *position; 68 | v.erase( position ); 69 | } 70 | 71 | void PartitionVector::clear() 72 | { 73 | for ( unsigned int i = 0 ; i < v.size() ; i ++ ) 74 | delete v[i]; 75 | v.clear(); 76 | } 77 | 78 | void PartitionVector::push_back_adopt( Partition * partition ) 79 | { 80 | v.push_back( partition ); 81 | } 82 | 83 | void PartitionVector::insert_adopt( iterator position, Partition * partition ) 84 | { 85 | v.insert( position, partition ); 86 | } 87 | 88 | void PartitionVector::replace_at( size_type n, const Partition * partition ) 89 | { 90 | Partition *p = partition->clone(); 91 | delete v[n]; 92 | v[n] = p; 93 | } 94 | 95 | // Return index of the extended partition or -1 when not found 96 | int find_extended_partition( const PartitionVector & partitions ) 97 | { 98 | for ( unsigned int i = 0 ; i < partitions.size() ; i ++ ) 99 | if ( partitions[i].type == TYPE_EXTENDED ) 100 | return (int)i; 101 | return -1; 102 | } 103 | 104 | 105 | } // namespace GParted 106 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | ACLOCAL_AMFLAGS = -I m4 2 | 3 | SUBDIRS = data doc include lib po src tests 4 | # Only build GParted help documentation when enabled. (Can be disabled 5 | # with './configure --disable-doc'). 6 | if BUILD_HELP_DOC 7 | SUBDIRS += help 8 | endif 9 | 10 | DESKTOP_IN_IN_FILES = gparted.desktop.in.in 11 | DESKTOP_IN_FILES = gparted.desktop.in 12 | DESKTOP_FILES =$(DESKTOP_IN_FILES:.desktop.in=.desktop) 13 | desktopdir = $(datadir)/applications 14 | desktop_DATA = $(DESKTOP_FILES) 15 | 16 | $(DESKTOP_FILES): $(DESKTOP_IN_FILES) 17 | $(AM_V_GEN)$(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@ 18 | 19 | APPSTREAM_IN_FILES = gparted.appdata.xml.in 20 | APPSTREAM_FILES =$(APPSTREAM_IN_FILES:.xml.in=.xml) 21 | appstreamdir = $(datadir)/metainfo 22 | appstream_DATA = $(APPSTREAM_FILES) 23 | 24 | $(APPSTREAM_FILES): $(APPSTREAM_IN_FILES) 25 | $(AM_V_GEN)$(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@ 26 | 27 | polkit_action_in_in_FILES = org.gnome.gparted.policy.in.in 28 | polkit_action_in_FILES = org.gnome.gparted.policy.in 29 | polkit_action_FILES = $(polkit_action_in_FILES:.policy.in=.policy) 30 | 31 | $(polkit_action_FILES): $(polkit_action_in_FILES) 32 | $(AM_V_GEN)$(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@ 33 | 34 | polkit_actiondir = $(datadir)/polkit-1/actions 35 | if INSTALL_POLKIT_ACTIONS 36 | polkit_action_DATA = $(polkit_action_FILES) 37 | endif 38 | 39 | bin_SCRIPTS = gparted 40 | CLEANFILES = $(bin_SCRIPTS) $(DESKTOP_IN_FILES) $(polkit_action_in_FILES) 41 | 42 | do_subst = sed -e 's,[@]libexecdir[@],$(libexecdir),g' \ 43 | -e 's,[@]bindir[@],$(bindir),g' \ 44 | -e 's,[@]gksuprog[@],$(GKSUPROG),g' \ 45 | -e 's,[@]enable_xhost_root[@],$(ENABLE_XHOST_ROOT),g' 46 | 47 | gparted.desktop.in: gparted.desktop.in.in Makefile 48 | $(do_subst) < $(srcdir)/gparted.desktop.in.in > gparted.desktop.in 49 | 50 | gparted: gparted.in Makefile 51 | $(do_subst) < $(srcdir)/gparted.in > gparted 52 | chmod +x gparted 53 | 54 | org.gnome.gparted.policy.in: org.gnome.gparted.policy.in.in Makefile 55 | $(do_subst) < $(srcdir)/org.gnome.gparted.policy.in.in > org.gnome.gparted.policy.in 56 | 57 | dist-hook: 58 | @if test -d "$(srcdir)/.git"; \ 59 | then \ 60 | echo Creating ChangeLog && \ 61 | ( cd "$(top_srcdir)" && \ 62 | echo '# Generated by Makefile. Do not edit.'; echo; \ 63 | $(top_srcdir)/missing --run \ 64 | git log GPARTED_0_4_4.. --date-order --date=short | \ 65 | sed -e '/^commit.*$$/d' | \ 66 | awk '/^Author/ {sub(/\\$$/,""); getline t; print $$0 t; next}; 1' | \ 67 | sed -e 's/^Author: //g' | \ 68 | sed -e 's/>Date: \([0-9]*-[0-9]*-[0-9]*\)/>\t\1/g' | \ 69 | sed -e 's/^\([^\t<]*[<][^\t>]*>\)\t\([^\t]*\)/\2 \1/g'; \ 70 | echo; \ 71 | ) > ChangeLog.tmp \ 72 | && cat $(top_srcdir)/ChangeLog >> ChangeLog.tmp \ 73 | && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \ 74 | || ( rm -f ChangeLog.tmp ; \ 75 | echo Failed to generate ChangeLog >&2 ); \ 76 | else \ 77 | echo A git clone is required to generate a ChangeLog >&2; \ 78 | fi 79 | 80 | EXTRA_DIST = \ 81 | $(APPSTREAM_IN_FILES) \ 82 | $(APPSTREAM_FILES) \ 83 | $(DESKTOP_IN_IN_FILES) \ 84 | $(DESKTOP_FILES) \ 85 | $(polkit_action_in_in_FILES) \ 86 | gparted.in 87 | 88 | DISTCLEANFILES = \ 89 | $(appstream_DATA) \ 90 | $(desktop_DATA) \ 91 | $(polkit_action_DATA) 92 | -------------------------------------------------------------------------------- /lib/gtest/src/gtest-assertion-result.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // The Google C++ Testing and Mocking Framework (Google Test) 31 | // 32 | // This file defines the AssertionResult type. 33 | 34 | #include "gtest/gtest-assertion-result.h" 35 | 36 | #include 37 | #include 38 | 39 | #include "gtest/gtest-message.h" 40 | 41 | namespace testing { 42 | 43 | // AssertionResult constructors. 44 | // Used in EXPECT_TRUE/FALSE(assertion_result). 45 | AssertionResult::AssertionResult(const AssertionResult& other) 46 | : success_(other.success_), 47 | message_(other.message_ != nullptr 48 | ? new ::std::string(*other.message_) 49 | : static_cast< ::std::string*>(nullptr)) {} 50 | 51 | // Swaps two AssertionResults. 52 | void AssertionResult::swap(AssertionResult& other) { 53 | using std::swap; 54 | swap(success_, other.success_); 55 | swap(message_, other.message_); 56 | } 57 | 58 | // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE. 59 | AssertionResult AssertionResult::operator!() const { 60 | AssertionResult negation(!success_); 61 | if (message_ != nullptr) negation << *message_; 62 | return negation; 63 | } 64 | 65 | // Makes a successful assertion result. 66 | AssertionResult AssertionSuccess() { return AssertionResult(true); } 67 | 68 | // Makes a failed assertion result. 69 | AssertionResult AssertionFailure() { return AssertionResult(false); } 70 | 71 | // Makes a failed assertion result with the given failure message. 72 | // Deprecated; use AssertionFailure() << message. 73 | AssertionResult AssertionFailure(const Message& message) { 74 | return AssertionFailure() << message; 75 | } 76 | 77 | } // namespace testing 78 | -------------------------------------------------------------------------------- /include/PartitionVector.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Mike Fleetwood 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | /* Minimal implementation of a class with some behaviours like a std::vector. 18 | * However internally the class manages pointers to Partition objects allowing for 19 | * Partition object polymorphism. 20 | * Reference: 21 | * C++ Reference to std::vector 22 | * http://www.cplusplus.com/reference/vector/vector/ 23 | */ 24 | 25 | #ifndef GPARTED_PARTITIONVECTOR_H 26 | #define GPARTED_PARTITIONVECTOR_H 27 | 28 | #include "Partition.h" 29 | 30 | #include 31 | #include 32 | 33 | 34 | namespace GParted 35 | { 36 | 37 | 38 | class Partition; // Forward declarations as Partition and PartitionVector are 39 | class PartitionVector; // mutually recursive classes. 40 | // References: 41 | // Mutually recursive classes 42 | // http://stackoverflow.com/questions/3410637/mutually-recursive-classes 43 | // recursive definition in CPP 44 | // http://stackoverflow.com/questions/4300420/recursive-definition-in-cpp 45 | 46 | class PartitionVector { 47 | public: 48 | typedef size_t size_type; 49 | typedef std::vector::iterator iterator; 50 | 51 | PartitionVector() {}; 52 | PartitionVector( const PartitionVector & src ); 53 | ~PartitionVector(); 54 | void swap( PartitionVector & other ); 55 | PartitionVector & operator=( PartitionVector rhs ); 56 | 57 | // Iterators 58 | iterator begin() { return v.begin(); }; 59 | 60 | // Capacity 61 | bool empty() const { return v.empty(); }; 62 | 63 | // Element access 64 | Partition & operator[]( size_type n ) { return *v[n]; }; 65 | const Partition & operator[]( size_type n ) const { return *v[n]; }; 66 | size_type size() const { return v.size(); }; 67 | const Partition & front() const { return *v.front(); }; 68 | const Partition & back() const { return *v.back(); }; 69 | 70 | // Modifiers 71 | void pop_back(); 72 | void erase( const iterator position ); 73 | void clear(); 74 | void push_back_adopt( Partition * partition ); 75 | void insert_adopt( iterator position, Partition * partition ); 76 | void replace_at( size_type n, const Partition * partition ); 77 | 78 | private: 79 | std::vector v; 80 | }; 81 | 82 | int find_extended_partition( const PartitionVector & partitions ); 83 | 84 | 85 | } // namespace GParted 86 | 87 | 88 | #endif /* GPARTED_PARTITIONVECTOR_H */ 89 | -------------------------------------------------------------------------------- /src/OperationChangeUUID.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012 Rogier Goossens 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | #include "OperationChangeUUID.h" 19 | 20 | #include "Device.h" 21 | #include "Operation.h" 22 | #include "Partition.h" 23 | #include "PartitionVector.h" 24 | #include "Utils.h" 25 | 26 | #include 27 | #include 28 | 29 | 30 | namespace GParted 31 | { 32 | 33 | 34 | OperationChangeUUID::OperationChangeUUID( const Device & device 35 | , const Partition & partition_orig 36 | , const Partition & partition_new 37 | ) 38 | : Operation(OPERATION_CHANGE_UUID, device, partition_orig, partition_new) 39 | { 40 | } 41 | 42 | 43 | void OperationChangeUUID::apply_to_visual( PartitionVector & partitions ) 44 | { 45 | substitute_new( partitions ); 46 | } 47 | 48 | 49 | void OperationChangeUUID::create_description() 50 | { 51 | g_assert(m_partition_new != nullptr); // Bug: Not initialised by constructor or reset later 52 | 53 | if (m_partition_new->get_filesystem_partition().uuid == UUID_RANDOM_NTFS_HALF) 54 | { 55 | /*TO TRANSLATORS: looks like Set half the UUID to a new random value on ntfs file system on /dev/sda1 */ 56 | m_description = Glib::ustring::compose(_("Set half the UUID to a new random value on %1 file system on %2"), 57 | m_partition_new->get_filesystem_string(), 58 | m_partition_new->get_path()); 59 | } 60 | else 61 | { 62 | /*TO TRANSLATORS: looks like Set a new random UUID on ext4 file system on /dev/sda1 */ 63 | m_description = Glib::ustring::compose(_("Set a new random UUID on %1 file system on %2"), 64 | m_partition_new->get_filesystem_string(), 65 | m_partition_new->get_path()); 66 | } 67 | } 68 | 69 | 70 | bool OperationChangeUUID::merge_operations( const Operation & candidate ) 71 | { 72 | g_assert(m_partition_new != nullptr); // Bug: Not initialised by constructor or reset later 73 | 74 | if (candidate.m_type == OPERATION_CHANGE_UUID && 75 | *m_partition_new == candidate.get_partition_original() ) 76 | { 77 | // Changing half the UUID must not override changing all of it 78 | if ( candidate.get_partition_new().uuid != UUID_RANDOM_NTFS_HALF ) 79 | { 80 | m_partition_new->uuid = candidate.get_partition_new().uuid; 81 | create_description(); 82 | } 83 | // Else no change required to this operation to merge candidate 84 | 85 | return true; 86 | } 87 | 88 | return false; 89 | } 90 | 91 | 92 | } // namespace GParted 93 | -------------------------------------------------------------------------------- /include/DialogFeatures.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004-2006 Bart 'plors' Hakvoort 2 | * Copyright (C) 2008 Curtis Gedak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | */ 17 | 18 | #ifndef GPARTED_DIALOGFEATURES_H 19 | #define GPARTED_DIALOGFEATURES_H 20 | 21 | 22 | #include "FileSystem.h" 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | 34 | namespace GParted 35 | { 36 | 37 | 38 | class DialogFeatures : public Gtk::Dialog 39 | { 40 | public: 41 | DialogFeatures(); 42 | 43 | void load_filesystems(const std::vector& fss); 44 | 45 | private: 46 | void load_one_filesystem(const FS& fs); 47 | 48 | Gtk::Frame m_legend_frame; 49 | Gtk::TreeView m_treeview_filesystems; 50 | Gtk::TreeRow m_treerow; 51 | Gtk::ScrolledWindow m_filesystems_scrolled; 52 | Glib::RefPtr m_liststore_filesystems; 53 | 54 | struct TreeView_FileSystems_Columns : public Gtk::TreeModelColumnRecord 55 | { 56 | Gtk::TreeModelColumn fsname; 57 | Gtk::TreeModelColumn> create; 58 | Gtk::TreeModelColumn> grow; 59 | Gtk::TreeModelColumn> online_grow; 60 | Gtk::TreeModelColumn> shrink; 61 | Gtk::TreeModelColumn> online_shrink; 62 | Gtk::TreeModelColumn> move; 63 | Gtk::TreeModelColumn> copy; 64 | Gtk::TreeModelColumn> check; 65 | Gtk::TreeModelColumn> label; 66 | Gtk::TreeModelColumn> online_label; 67 | Gtk::TreeModelColumn> uuid; 68 | Gtk::TreeModelColumn software; 69 | 70 | TreeView_FileSystems_Columns() 71 | { 72 | add(fsname); 73 | add(create); 74 | add(grow); 75 | add(online_grow); 76 | add(shrink); 77 | add(online_shrink); 78 | add(move); 79 | add(copy); 80 | add(check); 81 | add(label); 82 | add(online_label); 83 | add(uuid); 84 | add(software); 85 | } 86 | }; 87 | 88 | TreeView_FileSystems_Columns m_treeview_filesystems_columns; 89 | 90 | Glib::RefPtr m_icon_yes; 91 | Glib::RefPtr m_icon_no; 92 | Glib::RefPtr m_icon_blank; 93 | }; 94 | 95 | 96 | } // namespace GParted 97 | 98 | 99 | #endif /* GPARTED_DIALOGFEATURES_H */ 100 | -------------------------------------------------------------------------------- /src/Device.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * Copyright (C) 2010 Curtis Gedak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | */ 17 | 18 | #include "Device.h" 19 | 20 | #include 21 | 22 | 23 | namespace GParted 24 | { 25 | 26 | 27 | Device::Device() 28 | { 29 | Reset() ; 30 | } 31 | 32 | void Device::Reset() 33 | { 34 | path.clear(); 35 | partitions .clear() ; 36 | length = cylsize = 0 ; 37 | heads = sectors = cylinders = 0 ; 38 | model = ""; 39 | serial_number = ""; 40 | disktype = ""; 41 | sector_size = max_prims = highest_busy = 0 ; 42 | readonly = false ; 43 | max_partition_name_length = 0; 44 | } 45 | 46 | Device Device::get_copy_without_partitions() const 47 | { 48 | Device new_device; // (1) Construct new Device object. 49 | new_device.length = this->length; // (2) Copy all members except partitions. 50 | new_device.heads = this->heads; 51 | new_device.sectors = this->sectors; 52 | new_device.cylinders = this->cylinders; 53 | new_device.cylsize = this->cylsize; 54 | new_device.model = this->model; 55 | new_device.disktype = this->disktype; 56 | new_device.sector_size = this->sector_size; 57 | new_device.max_prims = this->max_prims; 58 | new_device.highest_busy = this->highest_busy; 59 | new_device.readonly = this->readonly; 60 | new_device.path = this->path; 61 | new_device.max_partition_name_length = this->max_partition_name_length; 62 | return new_device; // (3) Return by value. 63 | } 64 | 65 | void Device::set_path( const Glib::ustring & path ) 66 | { 67 | this->path = path; 68 | } 69 | 70 | 71 | const Glib::ustring& Device::get_path() const 72 | { 73 | return path; 74 | } 75 | 76 | void Device::enable_partition_naming( int max_length ) 77 | { 78 | if ( max_length > 0 ) 79 | max_partition_name_length = max_length; 80 | else 81 | max_partition_name_length = 0; 82 | } 83 | 84 | bool Device::partition_naming_supported() const 85 | { 86 | return max_partition_name_length > 0; 87 | } 88 | 89 | int Device::get_max_partition_name_length() const 90 | { 91 | return max_partition_name_length; 92 | } 93 | 94 | bool Device::operator==( const Device & device ) const 95 | { 96 | return this ->get_path() == device .get_path() ; 97 | } 98 | 99 | bool Device::operator!=( const Device & device ) const 100 | { 101 | return ! ( *this == device ) ; 102 | } 103 | 104 | 105 | } // namespace GParted 106 | -------------------------------------------------------------------------------- /include/MenuHelpers.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2018 Luca Bacci 2 | * 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation; either version 2 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, see . 15 | */ 16 | 17 | 18 | #ifndef GPARTED_MENUHELPERS_H 19 | #define GPARTED_MENUHELPERS_H 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | 30 | namespace GParted 31 | { 32 | 33 | 34 | namespace Menu_Helpers 35 | { 36 | 37 | 38 | typedef sigc::slot CallSlot; 39 | 40 | 41 | class MenuElem 42 | : public Gtk::MenuItem 43 | { 44 | public: 45 | MenuElem(const Glib::ustring& label, 46 | const Gtk::AccelKey& key, 47 | const CallSlot& slot = CallSlot()); 48 | MenuElem(const Glib::ustring& label, 49 | const CallSlot& slot = CallSlot()); 50 | MenuElem(const Glib::ustring& label, 51 | Gtk::Menu& submenu); 52 | }; 53 | 54 | 55 | class ImageMenuElem 56 | : public Gtk::ImageMenuItem 57 | { 58 | public: 59 | ImageMenuElem(const Glib::ustring& label, 60 | const Gtk::AccelKey& key, 61 | Gtk::Widget& image_widget, 62 | const CallSlot& slot = CallSlot()); 63 | ImageMenuElem(const Glib::ustring& label, 64 | Gtk::Widget& image_widget, 65 | const CallSlot& slot = CallSlot()); 66 | ImageMenuElem(const Glib::ustring& label, 67 | Gtk::Widget& image_widget, 68 | Gtk::Menu& submenu); 69 | }; 70 | 71 | 72 | class SeparatorElem 73 | : public Gtk::SeparatorMenuItem 74 | { 75 | public: 76 | SeparatorElem(); 77 | }; 78 | 79 | 80 | class StockMenuElem 81 | : public Gtk::ImageMenuItem 82 | { 83 | public: 84 | StockMenuElem(const Gtk::StockID& stock_id, 85 | const Gtk::AccelKey& key, 86 | const CallSlot& slot = CallSlot()); 87 | StockMenuElem(const Gtk::StockID& stock_id, 88 | const CallSlot& slot = CallSlot()); 89 | StockMenuElem(const Gtk::StockID& stock_id, 90 | Gtk::Menu& submenu); 91 | }; 92 | 93 | 94 | class CheckMenuElem 95 | : public Gtk::CheckMenuItem 96 | { 97 | public: 98 | CheckMenuElem(const Glib::ustring& label, 99 | const Gtk::AccelKey& key, 100 | const CallSlot& slot = CallSlot()); 101 | CheckMenuElem(const Glib::ustring& label, 102 | const CallSlot& slot = CallSlot()); 103 | }; 104 | 105 | 106 | } // namespace Menu_Helpers 107 | 108 | 109 | } // namespace GParted 110 | 111 | 112 | #endif /* GPARTED_MENUHELPERS_H */ 113 | -------------------------------------------------------------------------------- /include/Frame_Resizer_Base.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Bart 2 | * Copyright (C) 2010 Curtis Gedak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | */ 17 | 18 | #ifndef GPARTED_FRAME_RESIZER_BASE_H 19 | #define GPARTED_FRAME_RESIZER_BASE_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | 26 | namespace GParted 27 | { 28 | 29 | 30 | class Frame_Resizer_Base : public Gtk::Frame 31 | { 32 | public: 33 | enum ArrowType { 34 | ARROW_LEFT = 0, 35 | ARROW_RIGHT = 1 36 | }; 37 | 38 | Frame_Resizer_Base() ; 39 | virtual ~Frame_Resizer_Base() = default; 40 | 41 | void set_rgb_partition_color(const Gdk::RGBA& color); 42 | void override_default_rgb_unused_color(const Gdk::RGBA& color); 43 | 44 | void set_x_min_space_before( int x_min_space_before ) ; 45 | void set_x_start( int x_start ) ; 46 | void set_x_end( int x_end ) ; 47 | void set_used( int used ); 48 | void set_fixed_start( bool fixed_start ) ; 49 | void set_size_limits( int min_size, int max_size ) ; 50 | 51 | int get_used(); 52 | int get_x_start() ; 53 | int get_x_end() ; 54 | 55 | virtual void draw_partition(const Cairo::RefPtr& cr); 56 | 57 | void redraw(); 58 | 59 | //public signals (emitted upon resize/move) 60 | sigc::signal signal_resize; 61 | sigc::signal signal_move; 62 | 63 | protected: 64 | int BORDER, GRIPPER ; 65 | int X_MIN_SPACE_BEFORE ; 66 | int X_START, USED, UNUSED, X_END, X_START_MOVE, MIN_SIZE, MAX_SIZE; 67 | bool GRIP_LEFT, GRIP_RIGHT, GRIP_MOVE ; 68 | 69 | //signal handlers 70 | void drawingarea_on_realize(); 71 | bool drawingarea_on_draw(const Cairo::RefPtr& cr); 72 | virtual bool drawingarea_on_mouse_motion( GdkEventMotion * ev ) ; 73 | bool drawingarea_on_button_press_event( GdkEventButton * ev ) ; 74 | bool drawingarea_on_button_release_event( GdkEventButton * ev ) ; 75 | bool drawingarea_on_leave_notify( GdkEventCrossing * ev ) ; 76 | 77 | void draw_resize_grip(const Cairo::RefPtr& cr, ArrowType); 78 | 79 | Gtk::DrawingArea drawingarea ; 80 | 81 | Gdk::RGBA color_used; 82 | Gdk::RGBA color_unused; 83 | Gdk::RGBA color_arrow; 84 | Gdk::RGBA color_background; 85 | Gdk::RGBA color_partition; 86 | Gdk::RGBA color_arrow_rectangle; 87 | 88 | std::vector arrow_points; 89 | 90 | Glib::RefPtr cursor_resize; 91 | Glib::RefPtr cursor_move; 92 | 93 | bool fixed_start; //a fixed start disables moving the start and thereby the whole move functionality.. 94 | 95 | private: 96 | void init() ; 97 | 98 | }; 99 | 100 | 101 | } // namespace GParted 102 | 103 | 104 | #endif /* GPARTED_FRAME_RESIZER_BASE_H */ 105 | --------------------------------------------------------------------------------