gparted-0.3.6 - code recreation from Source Forge

svn path=/trunk/; revision=810
This commit is contained in:
Curtis Gedak 2008-04-07 19:41:18 +00:00
parent 6c149ea1d9
commit 8d808c0b62
52 changed files with 1006 additions and 141 deletions

27
AUTHORS
View file

@ -1,3 +1,24 @@
Bart
email: gparted@users.sourceforge.net
IRC : irc.gnome.org #gparted
This file is part of GParted
Copyright (C) 2004, 2005, 2006, 2007, 2008
Bart Hakvoort
Portions Copyright (C) 2008
Curtis Gedak
This file may be modified and/or distributed without restriction. This is
not an invitation to misrepresent who contributed to GNU GParted.
-------------------------------------------------------------------------------
We need to keep track of copyright (see the Maintainer HOWTO on www.gnu.org).
Curtis Gedak <gedakc@users.sourceforge.net>
* Wrote get_label functionality for fat16 and fat32 filesystems
* Wrote Utils::regexp_label() function
* Wrote set partition label functionality
* Created Dialog_Partion_Label.h, Dialog_Partition_Label.cc
* Created OperationLabelPartition.h, OperationLabelPartition.cc
Bart Harkvoort <gparted@users.sourceforge.net>
* Original author of GParted.
* Created and maintained up to official 0.3.3 release and
the unofficial 0.3.4 release.

178
ChangeLog
View file

@ -3,6 +3,184 @@
* MAINTAINERS: New file (bug #524276).
* configure.in: Added 'sk' to ALL_LINGUAS.
2008-03-26 Curtis Gedak <gedakc@gmail.com>
* configure.in: gparted-0.3.6
===================================================
2008-03-25 Curtis Gedak <gedakc@gmail.com>
* configure.in: Added 'sk' to ALL_LINGUAS.
Also added 'ko' and 'si' to ALL_LINGUAS.
2008-03-21 Curtis Gedak <gedakc@gmail.com>
* include/OperationLabelPartition.h,
src/OperationLabelPartition.cc: Updated to display label change
- Label change now shown prior to apply button being pressed
* src/Win_GParted.cc: Added partition duplication for use with UNDO
* src/Dialog_Partition_Label.cc: Changed label ADD button to OK
- Added trim function to get_new_label()
2008-03-19 Curtis Gedak <gedakc@gmail.com>
* src/linux_swap.cc: Fill in get_label() functionality using vol_id
* src/reiser4.cc: Enhanced get_label()
- Read partition label up to the first exclamation mark.
The exclamation mark is displayed by debugfs.reiser4 when
the label is the maximum length of 16 characters.
* src/ext2.cc,
src/ext3.cc,
src/fat16.cc,
src/fat32.cc,
src/hfs.cc,
src/jfs.cc,
src/linux_swap.cc,
src/ntfs.cc,
src/reiser4.cc,
src/reiserfs.cc,
src/xfs.cc: Added partition labelling on filesystem creation
2008-03-18 Curtis Gedak <gedakc@gmail.com>
* include/Dialog_Partition_New.h,
src/Dialog_Partition_New.cc: Added partition label entry text box
* src/jfs.cc,
src/ntfs.cc,
src/reiserfs.cc,
src/xfs.cc: Filled in set_label() functionality
2008-03-12 Curtis Gedak <gedakc@gmail.com>
* src/fat16.cc,
src/fat32.cc: Filled in set_label() functionality
* src/Win_GParted.cc: trim partition label after input accepted
* include/Utils.h,
src/Utils.cc: Added trim() function
- removes leading and trailing whitespace from a string
2008-03-06 Curtis Gedak <gedakc@gmail.com>
* include/DialogFeatures.h,
src/DialogFeatures.cc: Changed Read_Label to Label
2008-03-05 Curtis Gedak <gedakc@gmail.com>
* include/ext2.h,
include/ext3.h,
include/fat16.h,
include/fat32.h,
include/hfs.h,
include/hfsplus.h,
include/jfs.h,
include/linux_swap.h,
include/ntfs.h,
include/reiser4.h,
include/reiserfs.h,
include/ufs.h
include/xfs.h,
include/filesystem.h,
include/utils.h,
src/ext2.cc,
src/ext3.cc,
src/fat16.cc,
src/fat32.cc,
src/hfs.cc,
src/hfsplus.cc,
src/jfs.cc,
src/linux_swap.cc,
src/ntfs.cc,
src/reiser4.cc,
src/reiserfs.cc,
src/ufs.cc
src/xfs.cc: Added set_label() function stub
- Filled in set_label for ext2 and ext3
* include/Makefile.am,
include/GParted_Core.h,
include/Operation.h,
include/OperationLabelPartition.h,
src/Makefile.am,
src/GParted_Core.cc,
src/OperationLabelPartition.cc: Created operation label partition
2008-03-04 Curtis Gedak <gedakc@gmail.com>
* include/Makefile.am,
include/Win_GParted.h,
include/Dialog_Partition_Label.h,
src/Makefile.am,
src/Win_GParted.cc,
src/Dialog_Partition_Label.cc: Created partition label menu and dialog
* src/xfs.cc: Enhanced to read xfs labels while filesystem is mounted
- Thanks to Gerald Neil for the tip about adding the -r flag.
2008-02-19 Curtis Gedak <gedakc@gmail.com>
* src/Dialog_Progress.cc: Fixed two English spelling mistakes
* src/Dialog_Partition_Info.cc: Moved display of label closer to path
* src/fat16.cc,
src/fat32.cc: Changed to use new MTools temporary file functions
* include/Utils.h,
src/Utils.cc: Added create_mtoolsrc_file() and
delete_mtoolsrc_file() to handle MTools temporary file
2008-02-16 Curtis Gedak <gedakc@gmail.com>
* src/Dialog_Partition_Info.cc: Added display of partition label
2008-02-14 Curtis Gedak <gedakc@gmail.com>
* src/Win_GParted.cc: Added my name to list of authors
* src/ext2.cc,
src/ext3.cc,
src/fat16.cc,
src/fat32.cc,
src/jfs.cc,
src/ntfs.cc,
src/reiser4.cc,
src/reiserfs.cc,
src/xfs.cc: Fixed bug in get_label()
- now returns full text of label for labels that include spaces.
* include/Utils.h,
src/Utils.cc: Added regexp_label() to extract partition label text
2008-02-12 Curtis Gedak <gedakc@gmail.com>
* src/fat16.cc,
src/fat32.cc: Added get_label() support using mtools mlabel command
2008-02-07 Curtis Gedak <gedakc@gmail.com>
* src/GParted_Core.cc (GParted_Core::init_maps): Fix max path length
- GParted would crash if realpath() returned more than 255 chars
- Closes GParted bug #481768
- Thanks to Deji Akingunola for this suggestion.
(GParted_Core::read_mountpoints_from_file): Extend length of C strings
- Change C strings from 255 to 4096 (current PATH_MAX in limits.h)
to reduce chance of buffer overrun.
- PATH_MAX name not used because manpage appears to indicate
inconsistencies.
2008-02-05 Curtis Gedak <gedakc@gmail.com>
* Makefile.am: Enhanced distclean target
- Now removes autom4te.cache, .svn, and .cvsignore
- Thanks to Francois Dupoux for this suggestion.
2008-02-01 Curtis Gedak <gedakc@gmail.com>
* configure.in: gparted-0.3.5

View file

@ -19,4 +19,9 @@ DISTCLEANFILES = \
intltool-extract \
intltool-merge \
intltool-update \
$(desktop_DATA)
$(desktop_DATA)
distclean-local:
rm -rf autom4te.cache
find . -name .svn | xargs rm -rf
find . -name .cvsignore | xargs rm -rf

View file

@ -1,4 +1,4 @@
AC_INIT(gparted, 0.3.5)
AC_INIT(gparted, 0.3.6)
AC_CONFIG_SRCDIR(src/main.cc)
AM_INIT_AUTOMAKE
@ -20,7 +20,7 @@ GETTEXT_PACKAGE=gparted
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",[description])
ALL_LINGUAS="ar bg ca cs de dz el en_CA en_GB es eu fi fr gl he hu it ja lt lv mk nb ne nl oc pa pl pt pt_BR ru rw sl sv th tr uk vi zh_CN zh_HK zh_TW"
ALL_LINGUAS="ar bg ca cs de dz el en_CA en_GB es eu fi fr gl he hu it ja ko lt lv mk nb ne nl oc pa pl pt pt_BR ru rw si sk sl sv th tr uk vi zh_CN zh_HK zh_TW"
AM_GLIB_GNU_GETTEXT
AC_PROG_INTLTOOL

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004-2006 Bart 'plors' Hakvoort
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -56,7 +56,7 @@ private:
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > move ;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > copy ;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > check ;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > read_label ;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > label ;
treeview_filesystems_Columns()
{
@ -69,7 +69,7 @@ private:
add( move ) ;
add( copy ) ;
add( check ) ;
add( read_label ) ;
add( label ) ;
}
};

View file

@ -0,0 +1,55 @@
/* Copyright (C) 2008 Curtis Gedak
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef DIALOG_PARTITION_LABEL_H_
#define DIALOG_PARTITION_LABEL_H_
#include "../include/Partition.h"
#include "../include/i18n.h"
#include <gtkmm/dialog.h>
#include <gtkmm/stock.h>
#include <gtkmm/frame.h>
#include <gtkmm/table.h>
#include <gtkmm/entry.h>
#define BORDER 8
namespace GParted
{
class Dialog_Partition_Label : public Gtk::Dialog
{
public:
Dialog_Partition_Label( const Partition & partition );
~Dialog_Partition_Label();
Glib::ustring get_new_label();
private:
Partition partition ;
Gtk::HBox *hbox ;
Gtk::VBox *vbox ;
Gtk::Frame *frame;
Gtk::Image *image;
Gtk::Table *table;
Gtk::Entry *entry;
};
} //GParted
#endif //DIALOG_PARTITION_LABEL_H_

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -45,6 +45,7 @@ private:
Gtk::OptionMenu optionmenu_type, optionmenu_filesystem;
Gtk::CheckButton checkbutton_round_to_cylinders ;
Gtk::Menu menu_type, menu_filesystem;
Gtk::Entry entry;
std::vector<FS> FILESYSTEMS ;
int cylinder_size ;

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -36,6 +36,7 @@ public:
virtual FS get_filesystem_support() = 0 ;
virtual void set_used_sectors( Partition & partition ) = 0 ;
virtual void get_label( Partition & partition ) = 0 ;
virtual bool set_label( const Partition & partition, OperationDetail & operationdetail ) = 0 ;
virtual bool create( const Partition & new_partition, OperationDetail & operationdetail ) = 0 ;
virtual bool resize( const Partition & partition_new,
OperationDetail & operationdetail,

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -80,6 +80,8 @@ private:
bool Delete( const Partition & partition, OperationDetail & operationdetail ) ;
bool label_partition( const Partition & partition, OperationDetail & operation_detail ) ;
bool resize_move( const Device & device,
const Partition & partition_old,
Partition & partition_new,

View file

@ -5,7 +5,8 @@ EXTRA_DIST = \
Dialog_Base_Partition.h \
Dialog_Disklabel.h \
Dialog_Partition_Copy.h \
Dialog_Partition_Info.h \
Dialog_Partition_Info.h \
Dialog_Partition_Label.h \
Dialog_Partition_New.h \
Dialog_Partition_Resize_Move.h \
Dialog_Progress.h \
@ -25,6 +26,7 @@ EXTRA_DIST = \
OperationDetail.h \
OperationFormat.h \
OperationResizeMove.h \
OperationLabelPartition.h \
Partition.h \
TreeView_Detail.h \
Utils.h \

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -25,12 +25,13 @@ namespace GParted
{
//FIXME: stop using GParted:: in front of our own enums.. it's not necessary and clutters the code
enum OperationType {
OPERATION_DELETE = 0,
OPERATION_DELETE = 0,
OPERATION_CHECK = 1,
OPERATION_CREATE = 2,
OPERATION_RESIZE_MOVE = 3,
OPERATION_FORMAT = 4,
OPERATION_COPY = 5
OPERATION_COPY = 5,
OPERATION_LABEL_PARTITION = 6
};
class Operation

View file

@ -0,0 +1,41 @@
/* Copyright (C) 2008 Curtis Gedak
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef OPERATIONLABELPARTITION_H_
#define OPERATIONLABELPARTITION_H_
#include "../include/Operation.h"
namespace GParted
{
class OperationLabelPartition : public Operation
{
public:
OperationLabelPartition( const Device & device,
const Partition & partition_orig,
const Partition & partition_new ) ;
void apply_to_visual( std::vector<Partition> & partitions ) ;
private:
void create_description() ;
} ;
} //GParted
#endif //OPERATIONLABELPARTITION_H_

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -93,6 +93,7 @@ struct FS
FILESYSTEM filesystem ;
Support read ; //can we get the amount of used sectors?
Support get_label ;
Support set_label ;
Support create ;
Support grow ;
Support shrink ;
@ -105,7 +106,7 @@ struct FS
FS()
{
read = get_label = create = grow = shrink = move = check = copy = NONE;
read = get_label = set_label = create = grow = shrink = move = check = copy = NONE;
MIN = MAX = 0 ;
}
} ;
@ -133,6 +134,13 @@ public:
Glib::ustring & output,
Glib::ustring & error,
bool use_C_locale = false ) ;
static Glib::ustring regexp_label( const Glib::ustring & text,
const Glib::ustring & regular_sub_expression ) ;
static Glib::ustring create_mtoolsrc_file( char file_name[],
const char drive_letter, const Glib::ustring & device_path ) ;
static Glib::ustring delete_mtoolsrc_file( const char file_name[] ) ;
static Glib::ustring trim( const Glib::ustring & src, const Glib::ustring & c = " \t\r\n" ) ;
};

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -100,6 +100,9 @@ private:
void allow_check( bool state ) {
toggle_item( state, MENU_CHECK ) ; }
void allow_label_partition( bool state ) {
toggle_item( state, MENU_LABEL_PARTITION ) ; }
void allow_info( bool state ) {
toggle_item( state, MENU_INFO ) ; }
@ -158,6 +161,7 @@ private:
void activate_disklabel() ;
void activate_manage_flags() ;
void activate_check() ;
void activate_label_partition() ;
void activate_undo();
void remove_operation( int index = -1, bool remove_all = false ) ;
@ -222,7 +226,8 @@ private:
MENU_TOGGLE_MOUNT_SWAP,
MENU_MOUNT,
MENU_FLAGS,
MENU_CHECK,
MENU_CHECK,
MENU_LABEL_PARTITION,
MENU_INFO,
TOOLBAR_UNDO,
TOOLBAR_APPLY ;

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,6 +30,7 @@ public:
FS get_filesystem_support() ;
void set_used_sectors( Partition & partition ) ;
void get_label( Partition & partition ) ;
bool set_label( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool copy( const Glib::ustring & src_part_path,

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,6 +30,7 @@ public:
FS get_filesystem_support() ;
void set_used_sectors( Partition & partition ) ;
void get_label( Partition & partition ) ;
bool set_label( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool copy( const Glib::ustring & src_part_path,

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,6 +30,7 @@ public:
FS get_filesystem_support() ;
void set_used_sectors( Partition & partition ) ;
void get_label( Partition & partition ) ;
bool set_label( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool copy( const Glib::ustring & src_part_path,

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,6 +30,7 @@ public:
FS get_filesystem_support();
void set_used_sectors( Partition & partition ) ;
void get_label( Partition & partition ) ;
bool set_label( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool copy( const Glib::ustring & src_part_path,

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,6 +30,7 @@ public:
FS get_filesystem_support() ;
void set_used_sectors( Partition & partition ) ;
void get_label( Partition & partition ) ;
bool set_label( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool copy( const Glib::ustring & src_part_path,

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,6 +30,7 @@ public:
FS get_filesystem_support() ;
void set_used_sectors( Partition & partition ) ;
void get_label( Partition & partition ) ;
bool set_label( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool copy( const Glib::ustring & src_part_path,

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,6 +30,7 @@ public:
FS get_filesystem_support() ;
void set_used_sectors( Partition & partition ) ;
void get_label( Partition & partition ) ;
bool set_label( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool copy( const Glib::ustring & src_part_path,

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,6 +30,7 @@ public:
FS get_filesystem_support() ;
void set_used_sectors( Partition & partition ) ;
void get_label( Partition & partition ) ;
bool set_label( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool copy( const Glib::ustring & src_part_path,

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,6 +30,7 @@ public:
FS get_filesystem_support() ;
void set_used_sectors( Partition & partition ) ;
void get_label( Partition & partition ) ;
bool set_label( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool copy( const Glib::ustring & src_part_path,

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,6 +30,7 @@ public:
FS get_filesystem_support() ;
void set_used_sectors( Partition & partition ) ;
void get_label( Partition & partition ) ;
bool set_label( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool copy( const Glib::ustring & src_part_path,

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,6 +30,7 @@ public:
FS get_filesystem_support() ;
void set_used_sectors( Partition & partition ) ;
void get_label( Partition & partition ) ;
bool set_label( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool copy( const Glib::ustring & src_part_path,

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,6 +30,7 @@ public:
FS get_filesystem_support() ;
void set_used_sectors( Partition & partition ) ;
void get_label( Partition & partition ) ;
bool set_label( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool copy( const Glib::ustring & src_part_path,

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,6 +30,7 @@ public:
FS get_filesystem_support() ;
void set_used_sectors( Partition & partition ) ;
void get_label( Partition & partition ) ;
bool set_label( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool copy( const Glib::ustring & src_part_path,

View file

@ -2,10 +2,21 @@
* sk.po: Updated Slovak translation by Pavol Klačanský.
2008-03-26 Curtis Gedak <gedakc@gmail.com>
* gparted-0.3.6
===================================================
2008-03-25 Marcel Telka <marcel@telka.sk>
* sk.po: Added Slovak translation by Pavol Klačanský.
2008-03-24 Curtis Gedak <gedakc@gmail.com>
* POTFILES.in: Added two files
src/Dialog_Partition_Label.cc
src/OperationLabelPartition.cc
2008-03-21 Yair Hershkovitz <yairhr@gmail.com>
* he.po: Updated Hebrew translation by Mark Krapivner.

View file

@ -5,6 +5,7 @@ src/Dialog_Base_Partition.cc
src/Dialog_Disklabel.cc
src/Dialog_Partition_Copy.cc
src/Dialog_Partition_Info.cc
src/Dialog_Partition_Label.cc
src/Dialog_Partition_New.cc
src/Dialog_Partition_Resize_Move.cc
src/Dialog_Progress.cc
@ -17,6 +18,7 @@ src/OperationCheck.cc
src/OperationCreate.cc
src/OperationDelete.cc
src/OperationFormat.cc
src/OperationLabelPartition.cc
src/OperationResizeMove.cc
src/Partition.cc
src/TreeView_Detail.cc

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004-2006 Bart 'plors' Hakvoort
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -39,7 +39,7 @@ DialogFeatures::DialogFeatures()
treeview_filesystems .append_column( _("Move"), treeview_filesystems_columns .move );
treeview_filesystems .append_column( _("Copy"), treeview_filesystems_columns .copy );
treeview_filesystems .append_column( _("Check"), treeview_filesystems_columns .check );
treeview_filesystems .append_column( _("Read Label"), treeview_filesystems_columns .read_label );
treeview_filesystems .append_column( _("Label"), treeview_filesystems_columns .label );
//FIXME: add info about the relevant project (e.g an url to the projectpage)
//of course this url has to be selectable and (if possible) clickable
treeview_filesystems .get_selection() ->set_mode( Gtk::SELECTION_NONE );
@ -93,7 +93,7 @@ void DialogFeatures::show_filesystem( const FS & fs )
treerow[ treeview_filesystems_columns .move ] = fs .move ? icon_yes : icon_no ;
treerow[ treeview_filesystems_columns .copy ] = fs .copy ? icon_yes : icon_no ;
treerow[ treeview_filesystems_columns .check ] = fs .check ? icon_yes : icon_no ;
treerow[ treeview_filesystems_columns .read_label ] = fs .get_label ? icon_yes : icon_no ;
treerow[ treeview_filesystems_columns .label ] = fs .set_label ? icon_yes : icon_no ;
}
DialogFeatures::~DialogFeatures()

View file

@ -156,7 +156,7 @@ void Dialog_Partition_Info::Display_Info()
1, 2,
top++, bottom++,
Gtk::FILL ) ;
//size
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Size:") ) + "</b>" ),
0, 1,
@ -258,6 +258,19 @@ void Dialog_Partition_Info::Display_Info()
table ->attach( * Utils::mk_label( str_temp ), 1, 2, top++, bottom++, Gtk::FILL ) ;
}
//label
if ( partition.type != GParted::TYPE_UNALLOCATED && partition.type != GParted::TYPE_EXTENDED )
{
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Label:") ) + "</b>"),
0, 1,
top, bottom,
Gtk::FILL) ;
table ->attach( * Utils::mk_label( partition .label ),
1, 2,
top++, bottom++,
Gtk::FILL) ;
}
//one blank line
table ->attach( * Utils::mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ) ;

View file

@ -0,0 +1,75 @@
/* Copyright (C) 2008 Curtis Gedak
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "../include/Dialog_Partition_Label.h"
namespace GParted
{
Dialog_Partition_Label::Dialog_Partition_Label( const Partition & partition )
{
this ->partition = partition ;
this ->set_resizable( false ) ;
this ->set_has_separator( false ) ;
this ->set_size_request( 300, 70 ) ;
/*TO TRANSLATORS: dialog title, looks like Set partition label on /dev/hda3 */
this ->set_title( String::ucompose( _("Set partition label on %1"), partition .get_path() ) );
//Table
int top = 0, bottom = 1 ;
//Create table to hold Label and entry box
table = manage( new Gtk::Table() ) ;
table ->set_border_width( 5 ) ;
table ->set_col_spacings(10 ) ;
this ->get_vbox() ->pack_start( *table, Gtk::PACK_SHRINK ) ;
//Label
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Label:") ) + "</b>" ),
0, 1,
top, bottom,
Gtk::FILL ) ;
//Create Text entry box
entry = manage( new Gtk::Entry() );
entry ->set_max_length( 30 );
entry ->set_width_chars( 20 );
entry ->set_activates_default( true );
entry ->set_text( partition.label );
entry ->select_region( 0, entry ->get_text_length() );
//Add entry box to table
table ->attach( *entry,
1, 2,
top++, bottom++,
Gtk::FILL ) ;
this ->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL ) ;
this ->add_button( Gtk::Stock::OK, Gtk::RESPONSE_OK ) ;
this ->set_default_response( Gtk::RESPONSE_OK ) ;
this ->show_all_children() ;
}
Dialog_Partition_Label::~Dialog_Partition_Label()
{
}
Glib::ustring Dialog_Partition_Label::get_new_label()
{
return Utils::trim( Glib::ustring( entry ->get_text() ) );
}
} //GParted

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -107,7 +107,19 @@ void Dialog_Partition_New::Set_Data( const Partition & partition,
optionmenu_filesystem .signal_changed() .connect(
sigc::bind<bool>( sigc::mem_fun( *this, &Dialog_Partition_New::optionmenu_changed ), false ) );
table_create .attach( optionmenu_filesystem, 1, 2, 1, 2, Gtk::FILL );
//Label
table_create .attach( * Utils::mk_label( Glib::ustring( _("Label:") ) ),
0, 1, 3, 4, Gtk::FILL ) ;
//Create Text entry box
entry .set_max_length( 30 );
entry .set_width_chars( 20 );
entry .set_activates_default( true );
entry .set_text( partition.label );
entry .select_region( 0, entry .get_text_length() );
//Add entry box to table
table_create .attach( entry, 1, 2, 3, 4, Gtk::FILL ) ;
//set some widely used values...
START = partition.sector_start ;
total_length = partition.sector_end - partition.sector_start ;
@ -161,7 +173,10 @@ Partition Dialog_Partition_New::Get_New_Partition()
new_count, part_type,
FILESYSTEMS[ optionmenu_filesystem .get_history() ] .filesystem,
new_start, new_end,
selected_partition .inside_extended, false ) ;
selected_partition .inside_extended, false ) ;
//Retrieve Label info
part_temp .label = Utils::trim( entry .get_text() );
//grow new partition a bit if freespaces are < 1 MiB
if ( (part_temp.sector_start - selected_partition.sector_start) < MEBIBYTE )

View file

@ -250,7 +250,7 @@ void Dialog_Progress::on_signal_show()
//deal with succes/error...
if ( succes )
{
str_temp = _("All operations succesfully completed") ;
str_temp = _("All operations successfully completed") ;
if ( warnings > 0 )
str_temp += " (" + String::ucompose( _("%1 warnings"), warnings ) + ")" ;
@ -380,7 +380,7 @@ void Dialog_Progress::echo_operation_details( const OperationDetail & operationd
out << "( EXECUTING )" ;
break ;
case STATUS_SUCCES:
out << "( SUCCES )" ;
out << "( SUCCESS )" ;
break ;
case STATUS_ERROR:
out << "( ERROR )" ;

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart 'plors' Hakvoort
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -22,6 +22,7 @@
#include "../include/OperationDelete.h"
#include "../include/OperationFormat.h"
#include "../include/OperationResizeMove.h"
#include "../include/OperationLabelPartition.h"
#include "../include/ext2.h"
#include "../include/ext3.h"
@ -368,6 +369,9 @@ bool GParted_Core::apply_operation_to_disk( Operation * operation )
static_cast<OperationCopy*>( operation ) ->partition_copied .get_length(),
operation ->operation_detail ) ;
break ;
case OPERATION_LABEL_PARTITION:
succes = label_partition( operation ->partition_new, operation ->operation_detail ) ;
break ;
}
if ( libparted_messages .size() > 0 )
@ -527,10 +531,10 @@ void GParted_Core::init_maps()
std::ifstream proc_partitions( "/proc/partitions" ) ;
if ( proc_partitions )
{
char c_str[255] ;
char c_str[4096+1] ;
while ( getline( proc_partitions, line ) )
if ( sscanf( line .c_str(), "%*d %*d %*d %255s", c_str ) == 1 )
if ( sscanf( line .c_str(), "%*d %*d %*d %4096s", c_str ) == 1 )
{
line = "/dev/" ;
line += c_str ;
@ -555,7 +559,7 @@ void GParted_Core::read_mountpoints_from_file( const Glib::ustring & filename,
std::map< Glib::ustring, std::vector<Glib::ustring> > & map )
{
std::string line ;
char node[255], mountpoint[255] ;
char node[4096+1], mountpoint[4096+1] ;
unsigned int index ;
std::ifstream file( filename .c_str() ) ;
@ -563,7 +567,7 @@ void GParted_Core::read_mountpoints_from_file( const Glib::ustring & filename,
{
while ( getline( file, line ) )
if ( Glib::str_has_prefix( line, "/" ) &&
sscanf( line .c_str(), "%255s %255s", node, mountpoint ) == 2 &&
sscanf( line .c_str(), "%4096s %4096s", node, mountpoint ) == 2 &&
Glib::ustring( node ) != "/dev/root" )
{
line = mountpoint ;
@ -1111,7 +1115,43 @@ bool GParted_Core::Delete( const Partition & partition, OperationDetail & operat
operationdetail .get_last_child() .set_status( succes ? STATUS_SUCCES : STATUS_ERROR ) ;
return succes ;
}
bool GParted_Core::label_partition( const Partition & partition, OperationDetail & operationdetail )
{
if( partition .label .empty() ) {
operationdetail .add_child( OperationDetail( String::ucompose(
_("Clear partition label on %1"),
partition .get_path()
) ) ) ;
} else {
operationdetail .add_child( OperationDetail( String::ucompose(
_("Set partition label to \"%1\" on %2"),
partition .label, partition .get_path()
) ) ) ;
}
bool succes = false ;
if ( partition .type != TYPE_EXTENDED )
{
switch( get_fs( partition .filesystem ) .set_label )
{
case FS::EXTERNAL:
succes = set_proper_filesystem( partition .filesystem ) &&
p_filesystem ->set_label( partition, operationdetail .get_last_child() ) ;
break ;
case FS::LIBPARTED:
break ;
default:
break ;
}
}
operationdetail .get_last_child() .set_status( succes ? STATUS_SUCCES : STATUS_ERROR ) ;
return succes ;
}
bool GParted_Core::resize_move( const Device & device,
const Partition & partition_old,
Partition & partition_new,

View file

@ -15,6 +15,7 @@ gparted_SOURCES = \
Dialog_Disklabel.cc \
Dialog_Partition_Copy.cc \
Dialog_Partition_Info.cc \
Dialog_Partition_Label.cc \
Dialog_Partition_New.cc \
Dialog_Partition_Resize_Move.cc \
Dialog_Progress.cc \
@ -34,6 +35,7 @@ gparted_SOURCES = \
OperationDetail.cc \
OperationFormat.cc \
OperationResizeMove.cc \
OperationLabelPartition.cc \
Partition.cc \
TreeView_Detail.cc \
Utils.cc \

View file

@ -0,0 +1,69 @@
/* Copyright (C) 2008 Curtis Gedak
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "../include/OperationLabelPartition.h"
namespace GParted
{
OperationLabelPartition::OperationLabelPartition( const Device & device,
const Partition & partition_orig,
const Partition & partition_new )
{
type = OPERATION_LABEL_PARTITION ;
this ->device = device ;
this ->partition_original = partition_orig ;
this ->partition_new = partition_new ;
}
void OperationLabelPartition::apply_to_visual( std::vector<Partition> & partitions )
{
if ( partition_original .inside_extended )
{
index_extended = find_index_extended( partitions ) ;
if ( index_extended >= 0 )
index = find_index_original( partitions[ index_extended ] .logicals ) ;
if ( index >= 0 )
partitions[ index_extended ] .logicals[ index ] = partition_new ;
}
else
{
index = find_index_original( partitions ) ;
if ( index >= 0 )
partitions[ index ] = partition_new ;
}
}
void OperationLabelPartition::create_description()
{
if( partition_new .label .empty() ) {
/*TO TRANSLATORS: looks like Clear Partition Label on /dev/hda3 */
description = String::ucompose( _("Clear Partition Label on %1"),
partition_new .get_path() ) ;
} else {
/*TO TRANSLATORS: looks like Set Partition Label "My Label" on /dev/hda3 */
description = String::ucompose( _("Set Partition Label \"%1\" on %2"),
partition_new .label,
partition_new .get_path() ) ;
}
}
} //GParted

View file

@ -19,6 +19,7 @@
#include <sstream>
#include <iomanip>
#include <regex.h>
namespace GParted
{
@ -262,4 +263,75 @@ int Utils::execute_command( const Glib::ustring & command,
return exit_status ;
}
Glib::ustring Utils::regexp_label( const Glib::ustring & text,
const Glib::ustring & regular_sub_expression )
{
//Extract text from a regular sub-expression. E.g., "text we don't want (text we want)"
Glib::ustring label = "";
regex_t preg ;
int nmatch = 2 ;
regmatch_t pmatch[ 2 ] ;
int rc = regcomp( &preg, regular_sub_expression .c_str(), REG_EXTENDED | REG_ICASE | REG_NEWLINE ) ;
if ( ( rc == 0 ) //Reg compile OK
&& ( regexec( &preg, text .c_str(), nmatch, pmatch, 0 ) == 0 ) //Match found
)
{
label = text .substr( pmatch[1].rm_so, pmatch[1].rm_eo - pmatch[1].rm_so ) ;
}
return label ;
}
Glib::ustring Utils::create_mtoolsrc_file( char file_name[], const char drive_letter,
const Glib::ustring & device_path )
{
//Create mtools config file
//NOTE: file_name will be changed by the mkstemp() function call.
Glib::ustring err_msg = "" ;
int fd ;
fd = mkstemp( file_name ) ;
if( fd != -1 ) {
Glib::ustring fcontents =
_("# Temporary file created by gparted. It may be deleted.\n") ;
//The following file contents are mtools keywords (see man mtools.conf)
fcontents = String::ucompose(
"drive %1: file=\"%2\"\nmtools_skip_check=1\n", drive_letter, device_path
);
if( write( fd, fcontents .c_str(), fcontents .size() ) == -1 ) {
err_msg = String::ucompose(
_("Label operation failed: Unable to write to temporary file %1.\n")
, file_name
) ;
}
close( fd ) ;
}
else
{
err_msg = String::ucompose(
_("Label operation failed: Unable to create temporary file %1.\n")
, file_name
) ;
}
return err_msg ;
}
Glib::ustring Utils::delete_mtoolsrc_file( const char file_name[] )
{
//Delete mtools config file
Glib::ustring err_msg = "" ;
remove( file_name ) ;
return err_msg ;
}
Glib::ustring Utils::trim( const Glib::ustring & src, const Glib::ustring & c /* = " \t\r\n" */ )
{
//Trim leading and trailing whitespace from string
Glib::ustring::size_type p2 = src.find_last_not_of(c);
if (p2 == Glib::ustring::npos) return Glib::ustring();
Glib::ustring::size_type p1 = src.find_first_not_of(c);
if (p1 == Glib::ustring::npos) p1 = 0;
return src.substr(p1, (p2-p1)+1);
}
} //GParted..

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -23,6 +23,7 @@
#include "../include/Dialog_Partition_Copy.h"
#include "../include/Dialog_Partition_New.h"
#include "../include/Dialog_Partition_Info.h"
#include "../include/Dialog_Partition_Label.h"
#include "../include/DialogManageFlags.h"
#include "../include/OperationCopy.h"
#include "../include/OperationCheck.h"
@ -30,6 +31,7 @@
#include "../include/OperationDelete.h"
#include "../include/OperationFormat.h"
#include "../include/OperationResizeMove.h"
#include "../include/OperationLabelPartition.h"
#include <gtkmm/aboutdialog.h>
#include <gtkmm/messagedialog.h>
@ -59,6 +61,7 @@ Win_GParted::Win_GParted( const std::vector<Glib::ustring> & user_devices )
MENU_MOUNT =
MENU_FLAGS =
MENU_INFO =
MENU_LABEL_PARTITION =
TOOLBAR_UNDO =
TOOLBAR_APPLY = -1 ;
@ -340,6 +343,11 @@ void Win_GParted::init_partition_menu()
sigc::mem_fun( *this, &Win_GParted::activate_check ) ) );
MENU_CHECK = index++ ;
menu_partition .items() .push_back(
Gtk::Menu_Helpers::MenuElem( _("_Label"),
sigc::mem_fun( *this, &Win_GParted::activate_label_partition ) ) );
MENU_LABEL_PARTITION = index++ ;
menu_partition .items() .push_back( Gtk::Menu_Helpers::SeparatorElem() ) ;
index++ ;
@ -736,7 +744,8 @@ void Win_GParted::set_valid_operations()
{
allow_new( false ); allow_delete( false ); allow_resize( false ); allow_copy( false );
allow_paste( false ); allow_format( false ); allow_toggle_swap_mount_state( false ) ;
allow_manage_flags( false ) ; allow_check( false ) ; allow_info( false ) ;
allow_manage_flags( false ) ; allow_check( false ) ; allow_label_partition( false ) ;
allow_info( false ) ;
dynamic_cast<Gtk::Label*>( menu_partition .items()[ MENU_TOGGLE_MOUNT_SWAP ] .get_child() )
->set_label( _("_Unmount") ) ;
@ -831,8 +840,12 @@ void Win_GParted::set_valid_operations()
//only allow copying of real partitions
if ( selected_partition .status == GParted::STAT_REAL && fs .copy )
allow_copy( true ) ;
allow_copy( true ) ;
//only allow labelling of real partitions that support labelling
if ( selected_partition .status == GParted::STAT_REAL && fs .set_label )
allow_label_partition( true ) ;
if ( selected_partition .get_mountpoints() .size() )
{
allow_toggle_swap_mount_state( true ) ;
@ -1138,10 +1151,11 @@ void Win_GParted::menu_help_about()
dialog .set_logo( this ->get_icon() ) ;
dialog .set_version( VERSION ) ;
dialog .set_comments( _( "GNOME Partition Editor" ) ) ;
dialog .set_copyright( "Copyright © 2004-2006 Bart Hakvoort" ) ;
dialog .set_copyright( "Copyright © 2004-2008 Bart Hakvoort" ) ;
//authors
strings .push_back( "Bart Hakvoort <gparted@users.sf.net>" ) ;
strings .push_back( "Curtis Gedak <gedakc@users.sf.net>" ) ;
dialog .set_authors( strings ) ;
strings .clear() ;
@ -1784,6 +1798,36 @@ void Win_GParted::activate_check()
Add_Operation( operation ) ;
}
void Win_GParted::activate_label_partition()
{
Dialog_Partition_Label dialog( selected_partition );
dialog .set_transient_for( *this );
if ( ( dialog .run() == Gtk::RESPONSE_OK )
&& ( dialog .get_new_label() != selected_partition .label ) )
{
dialog .hide() ;
//Make a duplicate of the selected partition (used in UNDO)
Partition part_temp ;
part_temp .Set( devices[ current_device ] .get_path(),
selected_partition .get_path(),
selected_partition .partition_number,
selected_partition .type,
selected_partition .filesystem,
selected_partition .sector_start,
selected_partition .sector_end,
selected_partition .inside_extended,
false ) ;
part_temp .label = dialog .get_new_label();
Operation * operation = new OperationLabelPartition( devices[ current_device ],
selected_partition, part_temp ) ;
operation ->icon = render_icon( Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU );
Add_Operation( operation ) ;
}
}
void Win_GParted::activate_undo()
{
//when undoing a creation it's safe to decrease the newcount by one

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -28,8 +28,10 @@ FS ext2::get_filesystem_support()
if ( ! Glib::find_program_in_path( "dumpe2fs" ) .empty() )
fs .read = FS::EXTERNAL ;
if ( ! Glib::find_program_in_path( "e2label" ) .empty() )
if ( ! Glib::find_program_in_path( "e2label" ) .empty() ) {
fs .get_label = FS::EXTERNAL ;
fs .set_label = FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "mkfs.ext2" ) .empty() )
fs .create = FS::EXTERNAL ;
@ -85,10 +87,7 @@ void ext2::get_label( Partition & partition )
{
if ( ! Utils::execute_command( "e2label " + partition .get_path(), output, error, true ) )
{
if ( output .size() > 0 && output[ output .size() -1 ] == '\n' )
partition .label = output .substr( 0, output .size() -1 ) ;
else
partition .label = output ;
partition .label = Utils::regexp_label( output, "^(.*)" ) ;
}
else
{
@ -100,9 +99,14 @@ void ext2::get_label( Partition & partition )
}
}
bool ext2::set_label( const Partition & partition, OperationDetail & operationdetail )
{
return ! execute_command( "e2label " + partition .get_path() + " \"" + partition .label + "\"", operationdetail ) ;
}
bool ext2::create( const Partition & new_partition, OperationDetail & operationdetail )
{
return ! execute_command( "mkfs.ext2 " + new_partition .get_path(), operationdetail ) ;
return ! execute_command( "mkfs.ext2 -L \"" + new_partition .label + "\" " + new_partition .get_path(), operationdetail ) ;
}
bool ext2::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -29,9 +29,11 @@ FS ext3::get_filesystem_support()
if ( ! Glib::find_program_in_path( "dumpe2fs" ) .empty() )
fs .read = GParted::FS::EXTERNAL ;
if ( ! Glib::find_program_in_path( "e2label" ) .empty() )
if ( ! Glib::find_program_in_path( "e2label" ) .empty() ) {
fs .get_label = FS::EXTERNAL ;
fs .set_label = FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "mkfs.ext3" ) .empty() )
fs .create = GParted::FS::EXTERNAL ;
@ -86,10 +88,7 @@ void ext3::get_label( Partition & partition )
{
if ( ! Utils::execute_command( "e2label " + partition .get_path(), output, error, true ) )
{
if ( output .size() > 0 && output[ output .size() -1 ] == '\n' )
partition .label = output .substr( 0, output .size() -1 ) ;
else
partition .label = output ;
partition .label = Utils::regexp_label( output, "^(.*)" ) ;
}
else
{
@ -101,9 +100,14 @@ void ext3::get_label( Partition & partition )
}
}
bool ext3::set_label( const Partition & partition, OperationDetail & operationdetail )
{
return ! execute_command( "e2label " + partition .get_path() + " \"" + partition .label + "\"", operationdetail ) ;
}
bool ext3::create( const Partition & new_partition, OperationDetail & operationdetail )
{
return ! execute_command( "mkfs.ext3 " + new_partition .get_path(), operationdetail ) ;
return ! execute_command( "mkfs.ext3 -L \"" + new_partition .label + "\" " + new_partition .get_path(), operationdetail ) ;
}
bool ext3::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -18,6 +18,13 @@
#include "../include/fat16.h"
/*****
//For some reason unknown, this works without these include statements.
#include <stdlib.h> // 'C' library for mkstemp()
#include <unistd.h> // 'C' library for write(), close()
#include <stdio.h> // 'C' library for remove()
*****/
namespace GParted
{
@ -35,7 +42,12 @@ FS fat16::get_filesystem_support()
fs .check = GParted::FS::EXTERNAL ;
fs .read = GParted::FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "mlabel" ) .empty() ) {
fs .get_label = FS::EXTERNAL ;
fs .set_label = FS::EXTERNAL ;
}
//resizing of start and endpoint are provided by libparted
fs .grow = GParted::FS::LIBPARTED ;
fs .shrink = GParted::FS::LIBPARTED ;
@ -81,11 +93,66 @@ void fat16::set_used_sectors( Partition & partition )
void fat16::get_label( Partition & partition )
{
}
//Create mtools config file
char fname[] = "/tmp/gparted-XXXXXXXX" ;
char dletter = 'H' ;
Glib::ustring err_msg = "" ;
err_msg = Utils::create_mtoolsrc_file( fname, dletter, partition.get_path() ) ;
if( err_msg.length() != 0 )
partition .messages .push_back( err_msg );
Glib::ustring cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel -s %2:", fname, dletter ) ;
if ( ! Utils::execute_command( cmd, output, error, true ) )
{
partition .label = Utils::regexp_label( output, "Volume label is ([^(]*)" );
}
else
{
if ( ! output .empty() )
partition .messages .push_back( output ) ;
if ( ! error .empty() )
partition .messages .push_back( error ) ;
}
//Delete mtools config file
err_msg = Utils::delete_mtoolsrc_file( fname );
}
bool fat16::set_label( const Partition & partition, OperationDetail & operationdetail )
{
//Create mtools config file
char fname[] = "/tmp/gparted-XXXXXXXX" ;
char dletter = 'H' ;
Glib::ustring err_msg = "" ;
err_msg = Utils::create_mtoolsrc_file( fname, dletter, partition.get_path() ) ;
Glib::ustring cmd = "" ;
if( partition .label .empty() )
cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel -c %2:", fname, dletter ) ;
else
cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel %2:\"%3\"", fname, dletter, partition .label ) ;
operationdetail .add_child( OperationDetail( cmd, STATUS_NONE, FONT_BOLD_ITALIC ) ) ;
int exit_status = Utils::execute_command( cmd, output, error ) ;
if ( ! output .empty() )
operationdetail .get_last_child() .add_child( OperationDetail( output, STATUS_NONE, FONT_ITALIC ) ) ;
if ( ! error .empty() )
operationdetail .get_last_child() .add_child( OperationDetail( error, STATUS_NONE, FONT_ITALIC ) ) ;
//Delete mtools config file
err_msg = Utils::delete_mtoolsrc_file( fname );
return ( exit_status == 0 );
}
bool fat16::create( const Partition & new_partition, OperationDetail & operationdetail )
{
return ! execute_command( "mkdosfs -F16 -v " + new_partition .get_path(), operationdetail ) ;
return ! execute_command( "mkdosfs -F16 -v -n \"" + new_partition .label + "\" " + new_partition .get_path(), operationdetail ) ;
}
bool fat16::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -18,6 +18,13 @@
#include "../include/fat32.h"
/*****
//For some reason unknown, this works without these include statements.
#include <stdlib.h> // 'C' library for mkstemp()
#include <unistd.h> // 'C' library for write(), close()
#include <stdio.h> // 'C' library for remove()
*****/
namespace GParted
{
@ -35,7 +42,12 @@ FS fat32::get_filesystem_support()
fs .check = GParted::FS::EXTERNAL ;
fs .read = GParted::FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "mlabel" ) .empty() ) {
fs .get_label = FS::EXTERNAL ;
fs .set_label = FS::EXTERNAL ;
}
//resizing of start and endpoint are provided by libparted
fs .grow = GParted::FS::LIBPARTED ;
fs .shrink = GParted::FS::LIBPARTED ;
@ -81,11 +93,65 @@ void fat32::set_used_sectors( Partition & partition )
void fat32::get_label( Partition & partition )
{
//Create mtools config file
char fname[] = "/tmp/gparted-XXXXXXXX" ;
char dletter = 'H' ;
Glib::ustring err_msg = "" ;
err_msg = Utils::create_mtoolsrc_file( fname, dletter, partition.get_path() ) ;
if( err_msg.length() != 0 )
partition .messages .push_back( err_msg );
Glib::ustring cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel -s %2:", fname, dletter ) ;
if ( ! Utils::execute_command( cmd, output, error, true ) )
{
partition .label = Utils::regexp_label( output, "Volume label is ([^(]*)" );
}
else
{
if ( ! output .empty() )
partition .messages .push_back( output ) ;
if ( ! error .empty() )
partition .messages .push_back( error ) ;
}
//Delete mtools config file
err_msg = Utils::delete_mtoolsrc_file( fname );
}
bool fat32::set_label( const Partition & partition, OperationDetail & operationdetail )
{
//Create mtools config file
char fname[] = "/tmp/gparted-XXXXXXXX" ;
char dletter = 'H' ;
Glib::ustring err_msg = "" ;
err_msg = Utils::create_mtoolsrc_file( fname, dletter, partition.get_path() ) ;
Glib::ustring cmd = "" ;
if( partition .label .empty() )
cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel -c %2:", fname, dletter ) ;
else
cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel %2:\"%3\"", fname, dletter, partition .label ) ;
operationdetail .add_child( OperationDetail( cmd, STATUS_NONE, FONT_BOLD_ITALIC ) ) ;
int exit_status = Utils::execute_command( cmd, output, error ) ;
if ( ! output .empty() )
operationdetail .get_last_child() .add_child( OperationDetail( output, STATUS_NONE, FONT_ITALIC ) ) ;
if ( ! error .empty() )
operationdetail .get_last_child() .add_child( OperationDetail( error, STATUS_NONE, FONT_ITALIC ) ) ;
//Delete mtools config file
err_msg = Utils::delete_mtoolsrc_file( fname );
return ( exit_status == 0 );
}
bool fat32::create( const Partition & new_partition, OperationDetail & operationdetail )
{
return ! execute_command( "mkdosfs -F32 -v " + new_partition .get_path(), operationdetail ) ;
return ! execute_command( "mkdosfs -F32 -v -n \"" + new_partition .label + "\" " + new_partition .get_path(), operationdetail ) ;
}
bool fat32::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -80,9 +80,19 @@ void hfs::get_label( Partition & partition )
}
}
bool hfs::set_label( const Partition & partition, OperationDetail & operationdetail )
{
return true ;
}
bool hfs::create( const Partition & new_partition, OperationDetail & operationdetail )
{
return ! execute_command( "hformat " + new_partition .get_path(), operationdetail ) ;
Glib::ustring cmd = "";
if( new_partition .label .empty() )
cmd = "hformat " + new_partition .get_path() ;
else
cmd = "hformat -l \"" + new_partition .label + "\" " + new_partition .get_path() ;
return ! execute_command( cmd , operationdetail ) ;
}
bool hfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -44,6 +44,11 @@ void hfsplus::get_label( Partition & partition )
{
}
bool hfsplus::set_label( const Partition & partition, OperationDetail & operationdetail )
{
return true ;
}
bool hfsplus::create( const Partition & new_partition, OperationDetail & operationdetail )
{
return true ;

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -31,9 +31,11 @@ FS jfs::get_filesystem_support()
if ( ! Glib::find_program_in_path( "jfs_debugfs" ) .empty() )
fs .read = GParted::FS::EXTERNAL ;
if ( ! Glib::find_program_in_path( "jfs_tune" ) .empty() )
if ( ! Glib::find_program_in_path( "jfs_tune" ) .empty() ) {
fs .get_label = FS::EXTERNAL ;
fs .set_label = FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "mkfs.jfs" ) .empty() )
fs .create = GParted::FS::EXTERNAL ;
@ -106,20 +108,7 @@ void jfs::get_label( Partition & partition )
{
if ( ! Utils::execute_command( "jfs_tune -l " + partition .get_path(), output, error, true ) )
{
char buf[512] ;
index = output .find( "Volume label:" ) ;
if ( index < output .length() && sscanf( output .substr( index ) .c_str(), "Volume label: %512s", buf ) == 1 )
{
partition .label = buf ;
//remove '' from the label..
if ( partition .label .size() > 0 && partition .label[0] == '\'' )
partition .label = partition .label .substr( 1 ) ;
if ( partition .label .size() > 0 && partition .label[ partition .label .size() -1 ] == '\'' )
partition .label = partition .label .substr( 0, partition .label .size() -1 ) ;
}
partition .label = Utils::regexp_label( output, "^Volume label:[\t ]*'(.*)'" ) ;
}
else
{
@ -131,9 +120,14 @@ void jfs::get_label( Partition & partition )
}
}
bool jfs::set_label( const Partition & partition, OperationDetail & operationdetail )
{
return ! execute_command( "jfs_tune -L \"" + partition .label + "\" " + partition .get_path(), operationdetail ) ;
}
bool jfs::create( const Partition & new_partition, OperationDetail & operationdetail )
{
return ! execute_command( "mkfs.jfs -q " + new_partition .get_path(), operationdetail ) ;
return ! execute_command( "mkfs.jfs -q -L \"" + new_partition .label + "\" " + new_partition .get_path(), operationdetail ) ;
}
bool jfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -32,7 +32,10 @@ FS linux_swap::get_filesystem_support()
fs .grow = GParted::FS::EXTERNAL ;
fs .shrink = GParted::FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "vol_id" ) .empty() )
fs .get_label = FS::EXTERNAL ;
fs .copy = GParted::FS::GPARTED ;
fs .move = GParted::FS::GPARTED ;
@ -45,11 +48,28 @@ void linux_swap::set_used_sectors( Partition & partition )
void linux_swap::get_label( Partition & partition )
{
if ( ! Utils::execute_command( "vol_id --label-raw " + partition .get_path(), output, error, true ) )
{
partition .label = Utils::regexp_label( output, "^(.*)" ) ;
}
else
{
if ( ! output .empty() )
partition .messages .push_back( output ) ;
if ( ! error .empty() )
partition .messages .push_back( error ) ;
}
}
bool linux_swap::set_label( const Partition & partition, OperationDetail & operationdetail )
{
return true ;
}
bool linux_swap::create( const Partition & new_partition, OperationDetail & operationdetail )
{
return ! execute_command( "mkswap " + new_partition .get_path(), operationdetail ) ;
return ! execute_command( "mkswap -L \"" + new_partition .label + "\" " + new_partition .get_path(), operationdetail ) ;
}
bool linux_swap::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -32,9 +32,11 @@ FS ntfs::get_filesystem_support()
fs .check = GParted::FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "ntfslabel" ) .empty() )
if ( ! Glib::find_program_in_path( "ntfslabel" ) .empty() ) {
fs .get_label = FS::EXTERNAL ;
fs .set_label = FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "mkntfs" ) .empty() )
fs .create = GParted::FS::EXTERNAL ;
@ -84,10 +86,7 @@ void ntfs::get_label( Partition & partition )
{
if ( ! Utils::execute_command( "ntfslabel --force " + partition .get_path(), output, error, true ) )
{
if ( output .size() > 0 && output[ output .size() -1 ] == '\n' )
partition .label = output .substr( 0, output .size() -1 ) ;
else
partition .label = output ;
partition .label = Utils::regexp_label( output, "^(.*)" ) ;
}
else
{
@ -99,9 +98,14 @@ void ntfs::get_label( Partition & partition )
}
}
bool ntfs::set_label( const Partition & partition, OperationDetail & operationdetail )
{
return ! execute_command( "ntfslabel --force " + partition .get_path() + " \"" + partition .label + "\"", operationdetail ) ;
}
bool ntfs::create( const Partition & new_partition, OperationDetail & operationdetail )
{
return ! execute_command( "mkntfs -Q -vv " + new_partition .get_path(), operationdetail ) ;
return ! execute_command( "mkntfs -Q -vv -L \"" + new_partition .label + "\" " + new_partition .get_path(), operationdetail ) ;
}
bool ntfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -84,14 +84,10 @@ void reiser4::get_label( Partition & partition )
{
if ( ! Utils::execute_command( "debugfs.reiser4 " + partition .get_path(), output, error, true ) )
{
char buf[512] ;
index = output .find( "label" ) ;
Glib::ustring label = Utils::regexp_label( output, "^label:[\t ]*([^!]*)" ) ;
//FIXME: find a better way to see if label is empty.. imagine someone uses '<none>' as label.... ;)
if ( index < output .length() &&
sscanf( output .substr( index ) .c_str(), "label: %512s", buf ) == 1 &&
Glib::ustring( buf ) != "<none>" )
partition .label = buf ;
if( label != "<none>" )
partition .label = label ;
}
else
{
@ -103,9 +99,14 @@ void reiser4::get_label( Partition & partition )
}
}
bool reiser4::set_label( const Partition & partition, OperationDetail & operationdetail )
{
return true ;
}
bool reiser4::create( const Partition & new_partition, OperationDetail & operationdetail )
{
return ! execute_command( "mkfs.reiser4 --yes " + new_partition .get_path(), operationdetail ) ;
return ! execute_command( "mkfs.reiser4 --yes --label \"" + new_partition .label + "\" " + new_partition .get_path(), operationdetail ) ;
}
bool reiser4::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -31,7 +31,10 @@ FS reiserfs::get_filesystem_support()
fs .read = GParted::FS::EXTERNAL ;
fs .get_label = FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "reiserfstune" ) .empty() )
fs .set_label = FS::EXTERNAL ;
if ( ! Glib::find_program_in_path( "mkreiserfs" ) .empty() )
fs .create = GParted::FS::EXTERNAL ;
@ -90,11 +93,7 @@ void reiserfs::get_label( Partition & partition )
//FIXME: i think running debugreiserfs takes a long time on filled filesystems, test for this...
if ( ! Utils::execute_command( "debugreiserfs " + partition .get_path(), output, error, true ) )
{
char buf[512] ;
index = output .find( "LABEL" ) ;
if ( index < output .length() && sscanf( output .substr( index ) .c_str(), "LABEL: %512s", buf ) == 1 )
partition .label = buf ;
partition .label = Utils::regexp_label( output, "^label:[\t ]*(.*)" ) ;
}
else
{
@ -106,9 +105,14 @@ void reiserfs::get_label( Partition & partition )
}
}
bool reiserfs::set_label( const Partition & partition, OperationDetail & operationdetail )
{
return ! execute_command( "reiserfstune --label \"" + partition .label + "\" " + partition .get_path(), operationdetail ) ;
}
bool reiserfs::create( const Partition & new_partition, OperationDetail & operationdetail )
{
return ! execute_command( "mkreiserfs -f " + new_partition .get_path(), operationdetail ) ;
return ! execute_command( "mkreiserfs -f --label \"" + new_partition .label + "\" " + new_partition .get_path(), operationdetail ) ;
}
bool reiserfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -41,6 +41,11 @@ void ufs::get_label( Partition & partition )
{
}
bool ufs::set_label( const Partition & partition, OperationDetail & operationdetail )
{
return true ;
}
bool ufs::create( const Partition & new_partition, OperationDetail & operationdetail )
{
return true ;

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart
/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -33,7 +33,10 @@ FS xfs::get_filesystem_support()
fs .read = GParted::FS::EXTERNAL ;
fs .get_label = FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "xfs_admin" ) .empty() )
fs .set_label = FS::EXTERNAL ;
if ( ! Glib::find_program_in_path( "mkfs.xfs" ) .empty() )
fs .create = GParted::FS::EXTERNAL ;
@ -106,20 +109,9 @@ void xfs::set_used_sectors( Partition & partition )
void xfs::get_label( Partition & partition )
{
if ( ! Utils::execute_command( "xfs_db -c 'label' " + partition .get_path(), output, error, true ) )
if ( ! Utils::execute_command( "xfs_db -r -c 'label' " + partition .get_path(), output, error, true ) )
{
char buf[512] ;
if ( sscanf( output .c_str(), "label = %512s", buf ) == 1 )
{
partition .label = buf ;
//remove "" from the label..
if ( partition .label .size() > 0 && partition .label[0] == '\"' )
partition .label = partition .label .substr( 1 ) ;
if ( partition .label .size() > 0 && partition .label[ partition .label .size() -1 ] == '\"' )
partition .label = partition .label .substr( 0, partition .label .size() -1 ) ;
}
partition .label = Utils::regexp_label( output, "^label = \"(.*)\"" ) ;
}
else
{
@ -129,12 +121,25 @@ void xfs::get_label( Partition & partition )
if ( ! error .empty() )
partition .messages .push_back( error ) ;
}
}
bool xfs::set_label( const Partition & partition, OperationDetail & operationdetail )
{
Glib::ustring cmd = "" ;
if( partition .label .empty() )
cmd = String::ucompose( "xfs_admin -L -- %1", partition .get_path() ) ;
else
cmd = String::ucompose( "xfs_admin -L \"%1\" %2", partition .label, partition .get_path() ) ;
return ! execute_command( cmd, operationdetail ) ;
}
bool xfs::create( const Partition & new_partition, OperationDetail & operationdetail )
{
return ! execute_command( "mkfs.xfs -f " + new_partition .get_path(), operationdetail ) ;
//mkfs.xfs will not create filesystem if label is longer than 12 characters, hence truncation.
Glib::ustring label = new_partition .label ;
if( label .length() > 12 )
label = label.substr( 0, 12 ) ;
return ! execute_command( "mkfs.xfs -f -L \"" + label + "\" " + new_partition .get_path(), operationdetail ) ;
}
bool xfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )