From 188b27bc50ef7909c0a68cee6dcf01b3e0a96845 Mon Sep 17 00:00:00 2001 From: Bart Hakvoort Date: Wed, 15 Dec 2004 16:38:37 +0000 Subject: [PATCH] Added dialog (accessable from 'gparted' menu) which shows supported * Added dialog (accessable from 'gparted' menu) which shows supported operations for the various filesystems. I plan to put some more info in it, like what is missing etc.. --- ChangeLog | 5 +++ include/Dialog_Filesystems.h | 64 +++++++++++++++++++++++++++++++++ include/Win_GParted.h | 2 ++ src/Dialog_Filesystems.cc | 70 ++++++++++++++++++++++++++++++++++++ src/Makefile.am | 1 + src/Win_GParted.cc | 25 ++++++++++--- 6 files changed, 162 insertions(+), 5 deletions(-) create mode 100644 include/Dialog_Filesystems.h create mode 100644 src/Dialog_Filesystems.cc diff --git a/ChangeLog b/ChangeLog index 1f7a48ea..3fe50140 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-12-15 Bart Hakvoort + + * Added dialog (accessable from 'gparted' menu) which shows supported operations for the various filesystems. + I plan to put some more info in it, like what is missing etc.. + 2004-12-15 Bart Hakvoort * src/Dialog_Partition_Copy: fixed small error with incorrect display of used space and did some cleanups. diff --git a/include/Dialog_Filesystems.h b/include/Dialog_Filesystems.h new file mode 100644 index 00000000..fbbc24e2 --- /dev/null +++ b/include/Dialog_Filesystems.h @@ -0,0 +1,64 @@ +/* Copyright (C) 2004 Bart + * + * 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_FILESYSTEMS +#define DIALOG_FILESYSTEMS + +#include "include/Utils.h" +#include "../include/i18n.h" + +#include +#include +#include +#include + +namespace GParted +{ + +class Dialog_Filesystems : public Gtk::Dialog +{ +public: + + Dialog_Filesystems( ) ; + void Load_Filesystems( const std::vector< FS > & FILESYSTEMS ) ; + ~Dialog_Filesystems( ) ; + +private: + void Show_Filesystem( const FS & fs ) ; + + Gtk::TreeView treeview_filesystems; + Gtk::TreeRow treerow; + Glib::RefPtr treestore_filesystems; + + struct treeview_filesystems_Columns : public Gtk::TreeModelColumnRecord + { + Gtk::TreeModelColumn filesystem; + Gtk::TreeModelColumn< Glib::RefPtr > create; + Gtk::TreeModelColumn< Glib::RefPtr > grow; + Gtk::TreeModelColumn< Glib::RefPtr > shrink; + Gtk::TreeModelColumn< Glib::RefPtr > move; + Gtk::TreeModelColumn< Glib::RefPtr > copy; + + treeview_filesystems_Columns( ) { add( filesystem ); add( create ); add( grow ); add( shrink ); add( move ); add( copy ); } + }; + + treeview_filesystems_Columns treeview_filesystems_columns ; +}; + +} //GParted + +#endif //DIALOG_FILESYSTEMS diff --git a/include/Win_GParted.h b/include/Win_GParted.h index 0601aa14..3f893f31 100644 --- a/include/Win_GParted.h +++ b/include/Win_GParted.h @@ -31,6 +31,7 @@ #include "../include/Dialog_Partition_Copy.h" #include "../include/GParted_Core.h" #include "../include/Dialog_Disklabel.h" +#include "../include/Dialog_Filesystems.h" #include #include @@ -100,6 +101,7 @@ private: void menu_gparted_refresh_devices(); + void menu_gparted_filesystems(); void menu_gparted_quit(); void menu_view_harddisk_info(); void menu_view_operations(); diff --git a/src/Dialog_Filesystems.cc b/src/Dialog_Filesystems.cc new file mode 100644 index 00000000..b0edcfd9 --- /dev/null +++ b/src/Dialog_Filesystems.cc @@ -0,0 +1,70 @@ +/* Copyright (C) 2004 Bart + * + * 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_Filesystems.h" + +namespace GParted +{ + +Dialog_Filesystems::Dialog_Filesystems( ) +{ + this ->set_title( _("Filesystems") ) ; + this ->set_has_separator( false ) ; + this ->set_resizable( false ) ; + + treestore_filesystems = Gtk::TreeStore::create( treeview_filesystems_columns ); + treeview_filesystems .set_model( treestore_filesystems ); + treeview_filesystems .append_column( _("Filesystem"), treeview_filesystems_columns .filesystem ); + treeview_filesystems .append_column( _("Create"), treeview_filesystems_columns .create ); + treeview_filesystems .append_column( _("Grow"), treeview_filesystems_columns .grow ); + treeview_filesystems .append_column( _("Shrink"), treeview_filesystems_columns .shrink ); + treeview_filesystems .append_column( _("Move"), treeview_filesystems_columns .move ); + treeview_filesystems .append_column( _("Copy"), treeview_filesystems_columns .copy ); + + this ->get_vbox( ) ->pack_start( treeview_filesystems ) ; + + this ->add_button( Gtk::Stock::REFRESH, Gtk::RESPONSE_OK ); + this ->add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE ); + this ->show_all_children( ) ; +} + +void Dialog_Filesystems::Load_Filesystems( const std::vector< FS > & FILESYSTEMS ) +{ + treestore_filesystems ->clear( ) ; + + for ( unsigned short t = 0; t < FILESYSTEMS .size( ) -1 ; t++ ) + Show_Filesystem( FILESYSTEMS[ t ] ) ; +} + +void Dialog_Filesystems::Show_Filesystem( const FS & fs ) +{ + treerow = *( treestore_filesystems ->append( ) ); + treerow[ treeview_filesystems_columns .filesystem ] = fs .filesystem ; + treerow[ treeview_filesystems_columns .create ] = render_icon( fs .create ? Gtk::Stock::APPLY : Gtk::Stock::CANCEL, Gtk::ICON_SIZE_MENU ); + treerow[ treeview_filesystems_columns .grow ] = render_icon( fs .grow ? Gtk::Stock::APPLY : Gtk::Stock::CANCEL, Gtk::ICON_SIZE_MENU ); + treerow[ treeview_filesystems_columns .shrink ] = render_icon( fs .shrink ? Gtk::Stock::APPLY : Gtk::Stock::CANCEL, Gtk::ICON_SIZE_MENU ); + treerow[ treeview_filesystems_columns .move ] = render_icon( fs .move ? Gtk::Stock::APPLY : Gtk::Stock::CANCEL, Gtk::ICON_SIZE_MENU ); + treerow[ treeview_filesystems_columns .copy ] = render_icon( fs .copy ? Gtk::Stock::APPLY : Gtk::Stock::CANCEL, Gtk::ICON_SIZE_MENU ); +} + +Dialog_Filesystems::~Dialog_Filesystems( ) +{ +} + +} //GParted + + diff --git a/src/Makefile.am b/src/Makefile.am index 9b1390ac..d8bd0c7e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -17,6 +17,7 @@ gparted_SOURCES = \ Dialog_About.cc\ Dialog_Base_Partition.cc\ Dialog_Disklabel.cc \ + Dialog_Filesystems.cc \ Dialog_Partition_Copy.cc\ Dialog_Partition_Info.cc\ Dialog_Partition_New.cc\ diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc index 93f0c970..14b92162 100644 --- a/src/Win_GParted.cc +++ b/src/Win_GParted.cc @@ -93,12 +93,14 @@ void Win_GParted::init_menubar() { //fill menubar_main and connect callbacks //gparted - menu = manage( new Gtk::Menu() ) ; + menu = manage( new Gtk::Menu( ) ) ; image = manage( new Gtk::Image( Gtk::Stock::REFRESH, Gtk::ICON_SIZE_MENU ) ); - menu ->items() .push_back(Gtk::Menu_Helpers::ImageMenuElem( _("_Refresh devices"), Gtk::AccelKey("r"), *image , sigc::mem_fun(*this, &Win_GParted::menu_gparted_refresh_devices) ) ); - menu ->items() .push_back( Gtk::Menu_Helpers::SeparatorElem() ); - menu ->items() .push_back(Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::QUIT, sigc::mem_fun(*this, &Win_GParted::menu_gparted_quit) ) ); - menubar_main.items().push_back( Gtk::Menu_Helpers::MenuElem( _("_GParted"), *menu ) ); + menu ->items( ) .push_back( Gtk::Menu_Helpers::ImageMenuElem( _("_Refresh devices"), Gtk::AccelKey("r"), *image , sigc::mem_fun(*this, &Win_GParted::menu_gparted_refresh_devices) ) ); + menu ->items( ) .push_back( Gtk::Menu_Helpers::SeparatorElem( ) ); + menu ->items( ) .push_back( Gtk::Menu_Helpers::MenuElem( _("Filesystems"), sigc::mem_fun( *this, &Win_GParted::menu_gparted_filesystems ) ) ); + menu ->items( ) .push_back( Gtk::Menu_Helpers::SeparatorElem( ) ); + menu ->items( ) .push_back( Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::QUIT, sigc::mem_fun(*this, &Win_GParted::menu_gparted_quit) ) ); + menubar_main .items( ) .push_back( Gtk::Menu_Helpers::MenuElem( _("_GParted"), *menu ) ); //view menu = manage( new Gtk::Menu() ) ; @@ -733,6 +735,19 @@ void Win_GParted::menu_gparted_refresh_devices() } } +void Win_GParted::menu_gparted_filesystems( ) +{ + Dialog_Filesystems dialog ; + dialog .set_transient_for( *this ) ; + + dialog .Load_Filesystems( gparted_core .get_fs( ) ) ; + while ( dialog .run( ) == Gtk::RESPONSE_OK ) + { + gparted_core .find_supported_filesystems( ) ; + dialog .Load_Filesystems( gparted_core .get_fs( ) ) ; + } +} + void Win_GParted::menu_gparted_quit() { if ( Quit_Check_Operations( ) )