2004-09-19 14:24:53 -06:00
|
|
|
/* 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 WIN_GPARTED
|
|
|
|
#define WIN_GPARTED
|
|
|
|
|
|
|
|
#include "../include/Device.h"
|
|
|
|
#include "../include/VBox_VisualDisk.h"
|
|
|
|
#include "../include/Partition.h"
|
|
|
|
#include "../include/TreeView_Detail.h"
|
|
|
|
#include "../include/Dialog_Partition_Info.h"
|
|
|
|
#include "../include/Dialog_Partition_New.h"
|
|
|
|
#include "../include/Operation.h"
|
|
|
|
#include "../include/Dialog_Progress.h"
|
|
|
|
#include "../include/Dialog_Partition_Resize_Move.h"
|
|
|
|
#include "../include/Dialog_Partition_Copy.h"
|
2004-11-17 06:00:25 -07:00
|
|
|
#include "../include/GParted_Core.h"
|
2004-11-27 16:31:19 -07:00
|
|
|
#include "../include/Dialog_Disklabel.h"
|
2004-12-15 09:38:37 -07:00
|
|
|
#include "../include/Dialog_Filesystems.h"
|
2004-09-19 14:24:53 -06:00
|
|
|
|
|
|
|
#include <sigc++/class_slot.h>
|
|
|
|
#include <gtkmm/main.h>
|
|
|
|
#include <gtkmm/paned.h>
|
|
|
|
#include <gtkmm/toolbar.h>
|
|
|
|
#include <gtkmm/separatortoolitem.h>
|
|
|
|
#include <gtkmm/menubar.h>
|
|
|
|
#include <gtkmm/statusbar.h>
|
|
|
|
#include <gtkmm/radiobutton.h>
|
|
|
|
#include <gtkmm/liststore.h>
|
|
|
|
|
2004-11-06 12:48:24 -07:00
|
|
|
#include <unistd.h> //should be included by gtkmm headers. but decided to include it anyway after getting some bugreports..
|
2004-09-19 14:24:53 -06:00
|
|
|
|
|
|
|
namespace GParted
|
|
|
|
{
|
|
|
|
|
|
|
|
class Win_GParted : public Gtk::Window
|
|
|
|
{
|
|
|
|
public:
|
2004-10-06 09:32:40 -06:00
|
|
|
Win_GParted( );
|
2004-09-19 14:24:53 -06:00
|
|
|
|
|
|
|
private:
|
2004-12-27 05:08:01 -07:00
|
|
|
void init_menubar( ) ;
|
|
|
|
void init_toolbar( ) ;
|
2005-01-30 07:31:29 -07:00
|
|
|
void init_partition_menu( ) ;
|
2004-12-27 05:08:01 -07:00
|
|
|
void init_convert_menu( ) ;
|
|
|
|
void init_device_info( ) ;
|
|
|
|
void init_operationslist( ) ;
|
|
|
|
void init_hpaned_main( ) ;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
2004-10-11 04:23:24 -06:00
|
|
|
void Refresh_OptionMenu( ) ;
|
|
|
|
void Show_Pulsebar( ) ;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
|
|
|
//Fill txtview_device_info_buffer with some information about the selected device
|
2005-02-01 10:04:03 -07:00
|
|
|
void Fill_Label_Device_Info( bool clear = false );
|
2004-09-19 14:24:53 -06:00
|
|
|
|
|
|
|
//overridden signalhandler
|
2004-10-11 04:23:24 -06:00
|
|
|
virtual bool on_delete_event( GdkEventAny* ) ;
|
|
|
|
|
2004-09-19 14:24:53 -06:00
|
|
|
void Add_Operation( OperationType, const Partition & );
|
|
|
|
void Refresh_Visual( );
|
2004-12-27 05:08:01 -07:00
|
|
|
bool Quit_Check_Operations( );
|
|
|
|
void Set_Valid_Operations( ) ; //determines which operations are allowed on selected_partition
|
|
|
|
void Set_Valid_Convert_Filesystems( ) ; //determines to which filesystems a partition can be converted
|
2004-09-19 14:24:53 -06:00
|
|
|
|
|
|
|
//convenience functions
|
2005-11-27 12:48:00 -07:00
|
|
|
void allow_new( bool b ) {
|
|
|
|
menu_partition .items( )[ 0 ] .set_sensitive( b );
|
|
|
|
toolbar_main .get_nth_item( 0 ) ->set_sensitive( b ); }
|
2004-11-06 12:48:24 -07:00
|
|
|
|
2005-11-27 12:48:00 -07:00
|
|
|
void allow_delete( bool b ) {
|
|
|
|
menu_partition .items( )[ 1 ] .set_sensitive( b );
|
|
|
|
toolbar_main .get_nth_item( 1 ) ->set_sensitive( b ); }
|
|
|
|
|
|
|
|
void allow_resize( bool b ) {
|
|
|
|
menu_partition .items( )[ 3 ] .set_sensitive( b );
|
|
|
|
toolbar_main .get_nth_item( 3 ) ->set_sensitive( b ); }
|
|
|
|
|
|
|
|
void allow_copy( bool b ) {
|
|
|
|
menu_partition .items( )[ 5 ] .set_sensitive( b );
|
|
|
|
toolbar_main .get_nth_item( 5 ) ->set_sensitive( b ); }
|
|
|
|
|
|
|
|
void allow_paste( bool b ) {
|
|
|
|
menu_partition .items( )[ 6 ] .set_sensitive( b );
|
|
|
|
toolbar_main .get_nth_item( 6 ) ->set_sensitive( b ); }
|
|
|
|
|
|
|
|
void allow_convert( bool b ) {
|
|
|
|
menu_partition .items( )[ 8 ] .set_sensitive( b ); }
|
|
|
|
|
|
|
|
void allow_unmount( bool b ) {
|
|
|
|
menu_partition .items( )[ 10 ] .set_sensitive( b ); }
|
|
|
|
|
|
|
|
void allow_info( bool b ) {
|
|
|
|
menu_partition .items( )[ 12 ] .set_sensitive( b ); }
|
|
|
|
|
|
|
|
void allow_undo( bool b ) {
|
|
|
|
toolbar_main .get_nth_item( 8 ) ->set_sensitive( b );
|
|
|
|
( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 1 ] .get_submenu( ) ->items( ) [ 0 ] ) ->set_sensitive( b ) ; }
|
|
|
|
|
|
|
|
void allow_apply( bool b ) {
|
|
|
|
toolbar_main .get_nth_item( 9 ) ->set_sensitive( b );
|
|
|
|
( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 1 ] .get_submenu( ) ->items( ) [ 1 ] ) ->set_sensitive( b ) ; }
|
|
|
|
|
|
|
|
void find_devices_thread( ) {
|
|
|
|
gparted_core .get_devices( devices ) ;
|
|
|
|
pulse = false ; }
|
2004-10-11 04:23:24 -06:00
|
|
|
|
2004-09-19 14:24:53 -06:00
|
|
|
//signal handlers
|
2004-12-27 05:08:01 -07:00
|
|
|
void open_operationslist( ) ;
|
|
|
|
void close_operationslist( ) ;
|
|
|
|
void clear_operationslist( ) ;
|
2004-09-19 14:24:53 -06:00
|
|
|
void optionmenu_devices_changed( );
|
2004-09-27 14:12:47 -06:00
|
|
|
|
2004-12-27 05:08:01 -07:00
|
|
|
void menu_gparted_refresh_devices( );
|
|
|
|
void menu_gparted_filesystems( );
|
|
|
|
void menu_gparted_quit( );
|
|
|
|
void menu_view_harddisk_info( );
|
|
|
|
void menu_view_operations( );
|
|
|
|
void menu_help_contents( );
|
|
|
|
void menu_help_about( );
|
2004-09-19 14:24:53 -06:00
|
|
|
|
2004-10-01 15:09:19 -06:00
|
|
|
void mouse_click( GdkEventButton*, const Partition & );
|
2004-12-27 05:08:01 -07:00
|
|
|
bool max_amount_prim_reached( ) ;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
2004-12-27 05:08:01 -07:00
|
|
|
void activate_resize( );
|
|
|
|
void activate_copy( );
|
|
|
|
void activate_paste( );
|
|
|
|
void activate_new( );
|
|
|
|
void activate_delete( );
|
|
|
|
void activate_info( );
|
2005-12-07 04:21:27 -07:00
|
|
|
void activate_convert( GParted::FILESYSTEM new_fs );
|
2004-11-06 12:48:24 -07:00
|
|
|
void activate_unmount( ) ;
|
2005-01-30 07:31:29 -07:00
|
|
|
void activate_disklabel( ) ;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
2004-12-27 05:08:01 -07:00
|
|
|
void activate_undo( );
|
|
|
|
void activate_apply( );
|
|
|
|
void apply_operations_thread( );
|
2004-09-19 14:24:53 -06:00
|
|
|
|
|
|
|
//private variables
|
2004-11-17 06:00:25 -07:00
|
|
|
unsigned int current_device ;
|
2004-09-19 14:24:53 -06:00
|
|
|
Partition selected_partition, copied_partition;
|
2004-11-17 06:00:25 -07:00
|
|
|
std::vector <Device> devices;
|
2004-09-19 14:24:53 -06:00
|
|
|
std::vector <Operation> operations;
|
|
|
|
|
|
|
|
//gui stuff
|
|
|
|
Gtk::HPaned hpaned_main;
|
|
|
|
Gtk::VPaned vpaned_main;
|
|
|
|
Gtk::VBox vbox_main,vbox_info, *vbox;
|
|
|
|
Gtk::HBox hbox_toolbar,hbox_visual, hbox_operations, *hbox;
|
|
|
|
Gtk::Toolbar toolbar_main;
|
|
|
|
Gtk::MenuBar menubar_main;
|
|
|
|
Gtk::OptionMenu optionmenu_devices;
|
2005-01-30 07:31:29 -07:00
|
|
|
Gtk::Menu menu_partition, menu_convert, *menu ;
|
2004-09-19 14:24:53 -06:00
|
|
|
Gtk::ToolButton *toolbutton;
|
|
|
|
Gtk::Statusbar statusbar;
|
|
|
|
Gtk::Image *image ;
|
|
|
|
Gtk::ScrolledWindow *scrollwindow;
|
|
|
|
Gtk::Label label_device_info1, label_device_info2, *label;
|
|
|
|
Gtk::Tooltips tooltips ;
|
|
|
|
Gtk::Button *button;
|
|
|
|
Gtk::Table *table ;
|
|
|
|
Gtk::MenuItem *menu_item;
|
|
|
|
Gtk::Entry *entry;
|
2004-10-11 04:23:24 -06:00
|
|
|
Gtk::ProgressBar *pulsebar ;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
|
|
|
Gdk::Color color ;
|
|
|
|
|
|
|
|
VBox_VisualDisk *vbox_visual_disk;
|
|
|
|
TreeView_Detail treeview_detail;
|
|
|
|
|
|
|
|
//operations list
|
|
|
|
Gtk::TreeView treeview_operations;
|
|
|
|
Gtk::TreeRow treerow;
|
|
|
|
Glib::RefPtr<Gtk::ListStore> liststore_operations;
|
|
|
|
|
|
|
|
struct treeview_operations_Columns : public Gtk::TreeModelColumnRecord
|
|
|
|
{
|
|
|
|
Gtk::TreeModelColumn<int> operation_number;
|
|
|
|
Gtk::TreeModelColumn<Glib::ustring> operation_description;
|
2004-10-02 03:39:16 -06:00
|
|
|
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > operation_icon;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
2004-12-27 05:08:01 -07:00
|
|
|
treeview_operations_Columns( ) { add( operation_number ); add( operation_description ); add( operation_icon ); }
|
2004-09-19 14:24:53 -06:00
|
|
|
};
|
|
|
|
treeview_operations_Columns treeview_operations_columns;
|
|
|
|
|
|
|
|
//usefull variables which are used by many different functions...
|
|
|
|
bool any_logic,any_extended;//used in some checks (e.g. see optionmenu_devices_changed()
|
2004-10-02 03:39:16 -06:00
|
|
|
unsigned short primary_count ;//primary_count checks for max. of 4 pimary partitions
|
|
|
|
unsigned short new_count;//new_count keeps track of the new created partitions
|
2004-12-13 06:58:51 -07:00
|
|
|
Glib::ustring str_temp ; //mostly used for constructing dialogmessages
|
|
|
|
FS fs ;
|
2004-10-02 03:39:16 -06:00
|
|
|
|
2004-11-17 06:00:25 -07:00
|
|
|
GParted_Core gparted_core ;
|
2004-10-06 09:32:40 -06:00
|
|
|
GParted::Device *temp_device ;
|
|
|
|
std::vector <Gtk::Label *> device_info ;
|
2004-11-17 06:00:25 -07:00
|
|
|
|
2004-10-16 09:42:08 -06:00
|
|
|
//stuff for progress overview and pulsebar
|
2004-09-19 14:24:53 -06:00
|
|
|
Dialog_Progress *dialog_progress;
|
2004-10-11 04:23:24 -06:00
|
|
|
Glib::Thread *thread ;
|
2004-10-16 09:42:08 -06:00
|
|
|
Glib::Dispatcher dispatcher;
|
|
|
|
sigc::connection conn ;
|
2004-10-11 04:23:24 -06:00
|
|
|
bool apply, pulse ;
|
2004-09-19 14:24:53 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
} //GParted
|
|
|
|
|
|
|
|
#endif //WIN_GPARTED
|