prepare-for-gtk3: Prepare for removal of Gtk::Menu_Helpers::MenuList (#7)
GParted uses Gtk::Menu_Helpers::MenuList helper class to access
individual menu items. This helper class made it easy to navigate menu
items by index.
Gtk::Menu_Helpers::MenuList was removed in the switch from Gtkmm2 to
Gtkmm3 [1]. Instead, use a separate std::map<Gtk::MenuItem*> to keep
track of individual Gtk::MenuItem objects.
Reference:
[1] Gtkmm 3 commit "MenuShell: Remove items()." removed the code
c8e47b0db5
Closes #7 - Port to Gtk3
This commit is contained in:
parent
eb30c959a6
commit
0d73ff83d9
|
@ -53,6 +53,7 @@ private:
|
||||||
Gtk::ScrolledWindow scrollwindow ;
|
Gtk::ScrolledWindow scrollwindow ;
|
||||||
Gtk::TreeView treeview_operations ;
|
Gtk::TreeView treeview_operations ;
|
||||||
Glib::RefPtr<Gtk::ListStore> liststore_operations ;
|
Glib::RefPtr<Gtk::ListStore> liststore_operations ;
|
||||||
|
std::map<int, Gtk::MenuItem*> menu_popup_items;
|
||||||
|
|
||||||
struct treeview_operations_Columns : public Gtk::TreeModelColumnRecord
|
struct treeview_operations_Columns : public Gtk::TreeModelColumnRecord
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,8 +82,8 @@ private:
|
||||||
//convenience functions
|
//convenience functions
|
||||||
void toggle_item( bool state, int menu_item, int toolbar_item = -1 )
|
void toggle_item( bool state, int menu_item, int toolbar_item = -1 )
|
||||||
{
|
{
|
||||||
if ( menu_item >= 0 && menu_item < static_cast<int>( menu_partition .items() .size() ) )
|
if (menu_item >= 0 && partitionmenu_items.count(menu_item))
|
||||||
menu_partition .items()[ menu_item ] .set_sensitive( state ) ;
|
partitionmenu_items[menu_item]->set_sensitive(state);
|
||||||
|
|
||||||
if ( toolbar_item >= 0 && toolbar_item < toolbar_main .get_n_items() )
|
if ( toolbar_item >= 0 && toolbar_item < toolbar_main .get_n_items() )
|
||||||
toolbar_main .get_nth_item( toolbar_item ) ->set_sensitive( state ) ;
|
toolbar_main .get_nth_item( toolbar_item ) ->set_sensitive( state ) ;
|
||||||
|
@ -134,14 +134,14 @@ private:
|
||||||
void allow_undo_clear_apply( bool state )
|
void allow_undo_clear_apply( bool state )
|
||||||
{
|
{
|
||||||
toggle_item( state, -1, TOOLBAR_UNDO ) ;
|
toggle_item( state, -1, TOOLBAR_UNDO ) ;
|
||||||
static_cast<Gtk::CheckMenuItem *>( & menubar_main .items()[ 1 ] .get_submenu() ->items()[ 0 ] )
|
static_cast<Gtk::CheckMenuItem *>(mainmenu_items[MENU_UNDO_OPERATION])
|
||||||
->set_sensitive( state ) ;
|
->set_sensitive( state ) ;
|
||||||
|
|
||||||
static_cast<Gtk::CheckMenuItem *>( & menubar_main .items()[ 1 ] .get_submenu() ->items()[ 1 ] )
|
static_cast<Gtk::CheckMenuItem *>(mainmenu_items[MENU_CLEAR_OPERATIONS])
|
||||||
->set_sensitive( state ) ;
|
->set_sensitive( state ) ;
|
||||||
|
|
||||||
toggle_item( state, -1, TOOLBAR_APPLY ) ;
|
toggle_item( state, -1, TOOLBAR_APPLY ) ;
|
||||||
static_cast<Gtk::CheckMenuItem *>( & menubar_main .items()[ 1 ] .get_submenu() ->items()[ 2 ] )
|
static_cast<Gtk::CheckMenuItem *>(mainmenu_items[MENU_APPLY_OPERATIONS])
|
||||||
->set_sensitive( state ) ;
|
->set_sensitive( state ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,13 +253,37 @@ private:
|
||||||
};
|
};
|
||||||
treeview_devices_Columns treeview_devices_columns ;
|
treeview_devices_Columns treeview_devices_columns ;
|
||||||
|
|
||||||
//indices for partitionmenu and toolbar
|
// Indices for toolbar
|
||||||
int
|
int
|
||||||
MENU_NEW, TOOLBAR_NEW,
|
TOOLBAR_NEW,
|
||||||
MENU_DEL, TOOLBAR_DEL,
|
TOOLBAR_DEL,
|
||||||
MENU_RESIZE_MOVE, TOOLBAR_RESIZE_MOVE,
|
TOOLBAR_RESIZE_MOVE,
|
||||||
MENU_COPY, TOOLBAR_COPY,
|
TOOLBAR_COPY,
|
||||||
MENU_PASTE, TOOLBAR_PASTE,
|
TOOLBAR_PASTE,
|
||||||
|
TOOLBAR_UNDO,
|
||||||
|
TOOLBAR_APPLY;
|
||||||
|
|
||||||
|
enum MainMenu_Items
|
||||||
|
{
|
||||||
|
MENU_DEVICES = 0,
|
||||||
|
MENU_EDIT,
|
||||||
|
MENU_UNDO_OPERATION,
|
||||||
|
MENU_CLEAR_OPERATIONS,
|
||||||
|
MENU_APPLY_OPERATIONS,
|
||||||
|
MENU_VIEW,
|
||||||
|
MENU_DEVICE_INFORMATION,
|
||||||
|
MENU_PENDING_OPERATIONS,
|
||||||
|
MENU_DEVICE,
|
||||||
|
MENU_PARTITION
|
||||||
|
};
|
||||||
|
|
||||||
|
enum PartitionMenu_Items
|
||||||
|
{
|
||||||
|
MENU_NEW = 0,
|
||||||
|
MENU_DEL,
|
||||||
|
MENU_RESIZE_MOVE,
|
||||||
|
MENU_COPY,
|
||||||
|
MENU_PASTE,
|
||||||
MENU_FORMAT,
|
MENU_FORMAT,
|
||||||
MENU_TOGGLE_CRYPT_BUSY,
|
MENU_TOGGLE_CRYPT_BUSY,
|
||||||
MENU_TOGGLE_FS_BUSY,
|
MENU_TOGGLE_FS_BUSY,
|
||||||
|
@ -269,9 +293,10 @@ private:
|
||||||
MENU_CHECK,
|
MENU_CHECK,
|
||||||
MENU_LABEL_PARTITION,
|
MENU_LABEL_PARTITION,
|
||||||
MENU_CHANGE_UUID,
|
MENU_CHANGE_UUID,
|
||||||
MENU_INFO,
|
MENU_INFO
|
||||||
TOOLBAR_UNDO,
|
};
|
||||||
TOOLBAR_APPLY ;
|
std::map<int, Gtk::MenuItem*> mainmenu_items;
|
||||||
|
std::map<int, Gtk::MenuItem*> partitionmenu_items;
|
||||||
|
|
||||||
//usefull variables which are used by many different functions...
|
//usefull variables which are used by many different functions...
|
||||||
unsigned short new_count;//new_count keeps track of the new created partitions
|
unsigned short new_count;//new_count keeps track of the new created partitions
|
||||||
|
|
|
@ -41,20 +41,27 @@ HBoxOperations::HBoxOperations()
|
||||||
pack_start( scrollwindow, Gtk::PACK_EXPAND_WIDGET );
|
pack_start( scrollwindow, Gtk::PACK_EXPAND_WIDGET );
|
||||||
|
|
||||||
//create popupmenu
|
//create popupmenu
|
||||||
menu_popup.append(*manage(new GParted::Menu_Helpers::ImageMenuElem(
|
Gtk::MenuItem *item;
|
||||||
|
item = manage(new GParted::Menu_Helpers::ImageMenuElem(
|
||||||
_("_Undo Last Operation"),
|
_("_Undo Last Operation"),
|
||||||
* manage( new Gtk::Image( Gtk::Stock::UNDO, Gtk::ICON_SIZE_MENU ) ),
|
* manage( new Gtk::Image( Gtk::Stock::UNDO, Gtk::ICON_SIZE_MENU ) ),
|
||||||
sigc::mem_fun(*this, &HBoxOperations::on_undo))));
|
sigc::mem_fun(*this, &HBoxOperations::on_undo)));
|
||||||
|
menu_popup.append(*item);
|
||||||
|
menu_popup_items[0] = item;
|
||||||
|
|
||||||
menu_popup.append(*manage(new GParted::Menu_Helpers::ImageMenuElem(
|
item = manage(new GParted::Menu_Helpers::ImageMenuElem(
|
||||||
_("_Clear All Operations"),
|
_("_Clear All Operations"),
|
||||||
* manage( new Gtk::Image( Gtk::Stock::CLEAR, Gtk::ICON_SIZE_MENU ) ),
|
* manage( new Gtk::Image( Gtk::Stock::CLEAR, Gtk::ICON_SIZE_MENU ) ),
|
||||||
sigc::mem_fun(*this, &HBoxOperations::on_clear))));
|
sigc::mem_fun(*this, &HBoxOperations::on_clear)));
|
||||||
|
menu_popup.append(*item);
|
||||||
|
menu_popup_items[1] = item;
|
||||||
|
|
||||||
menu_popup.append(*manage(new GParted::Menu_Helpers::ImageMenuElem(
|
item = manage(new GParted::Menu_Helpers::ImageMenuElem(
|
||||||
_("_Apply All Operations"),
|
_("_Apply All Operations"),
|
||||||
* manage( new Gtk::Image( Gtk::Stock::APPLY, Gtk::ICON_SIZE_MENU ) ),
|
* manage( new Gtk::Image( Gtk::Stock::APPLY, Gtk::ICON_SIZE_MENU ) ),
|
||||||
sigc::mem_fun(*this, &HBoxOperations::on_apply))));
|
sigc::mem_fun(*this, &HBoxOperations::on_apply)));
|
||||||
|
menu_popup.append(*item);
|
||||||
|
menu_popup_items[2] = item;
|
||||||
|
|
||||||
menu_popup.append(*manage(new GParted::Menu_Helpers::SeparatorElem()));
|
menu_popup.append(*manage(new GParted::Menu_Helpers::SeparatorElem()));
|
||||||
menu_popup.append(*manage(new GParted::Menu_Helpers::StockMenuElem(
|
menu_popup.append(*manage(new GParted::Menu_Helpers::StockMenuElem(
|
||||||
|
@ -89,9 +96,9 @@ bool HBoxOperations::on_signal_button_press_event( GdkEventButton * event )
|
||||||
//right-click
|
//right-click
|
||||||
if ( event ->button == 3 )
|
if ( event ->button == 3 )
|
||||||
{
|
{
|
||||||
menu_popup .items()[0] .set_sensitive( liststore_operations ->children() .size() > 0 ) ;
|
menu_popup_items[0]->set_sensitive(liststore_operations->children().size() > 0);
|
||||||
menu_popup .items()[1] .set_sensitive( liststore_operations ->children() .size() > 0 ) ;
|
menu_popup_items[1]->set_sensitive(liststore_operations->children().size() > 0);
|
||||||
menu_popup .items()[2] .set_sensitive( liststore_operations ->children() .size() > 0 ) ;
|
menu_popup_items[2]->set_sensitive(liststore_operations->children().size() > 0);
|
||||||
|
|
||||||
menu_popup .popup( event ->button, event ->time ) ;
|
menu_popup .popup( event ->button, event ->time ) ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,22 +67,13 @@ Win_GParted::Win_GParted( const std::vector<Glib::ustring> & user_devices )
|
||||||
OPERATIONSLIST_OPEN = true ;
|
OPERATIONSLIST_OPEN = true ;
|
||||||
gparted_core .set_user_devices( user_devices ) ;
|
gparted_core .set_user_devices( user_devices ) ;
|
||||||
|
|
||||||
MENU_NEW = TOOLBAR_NEW =
|
TOOLBAR_NEW =
|
||||||
MENU_DEL = TOOLBAR_DEL =
|
TOOLBAR_DEL =
|
||||||
MENU_RESIZE_MOVE = TOOLBAR_RESIZE_MOVE =
|
TOOLBAR_RESIZE_MOVE =
|
||||||
MENU_COPY = TOOLBAR_COPY =
|
TOOLBAR_COPY =
|
||||||
MENU_PASTE = TOOLBAR_PASTE =
|
TOOLBAR_PASTE =
|
||||||
MENU_FORMAT =
|
|
||||||
MENU_TOGGLE_CRYPT_BUSY =
|
|
||||||
MENU_TOGGLE_FS_BUSY =
|
|
||||||
MENU_MOUNT =
|
|
||||||
MENU_NAME_PARTITION =
|
|
||||||
MENU_FLAGS =
|
|
||||||
MENU_INFO =
|
|
||||||
MENU_LABEL_PARTITION =
|
|
||||||
MENU_CHANGE_UUID =
|
|
||||||
TOOLBAR_UNDO =
|
TOOLBAR_UNDO =
|
||||||
TOOLBAR_APPLY = -1 ;
|
TOOLBAR_APPLY = -1;
|
||||||
|
|
||||||
//==== GUI =========================
|
//==== GUI =========================
|
||||||
this ->set_title( _("GParted") );
|
this ->set_title( _("GParted") );
|
||||||
|
@ -153,91 +144,137 @@ Win_GParted::~Win_GParted()
|
||||||
|
|
||||||
void Win_GParted::init_menubar()
|
void Win_GParted::init_menubar()
|
||||||
{
|
{
|
||||||
|
Gtk::MenuItem *item;
|
||||||
|
|
||||||
//fill menubar_main and connect callbacks
|
//fill menubar_main and connect callbacks
|
||||||
//gparted
|
//gparted
|
||||||
menu = manage( new Gtk::Menu() ) ;
|
menu = manage( new Gtk::Menu() ) ;
|
||||||
image = manage( new Gtk::Image( Gtk::Stock::REFRESH, Gtk::ICON_SIZE_MENU ) );
|
image = manage( new Gtk::Image( Gtk::Stock::REFRESH, Gtk::ICON_SIZE_MENU ) );
|
||||||
menu->append(*manage(new GParted::Menu_Helpers::ImageMenuElem(
|
item = manage(new GParted::Menu_Helpers::ImageMenuElem(
|
||||||
_("_Refresh Devices"),
|
_("_Refresh Devices"),
|
||||||
Gtk::AccelKey("<control>r"),
|
Gtk::AccelKey("<control>r"),
|
||||||
*image,
|
*image,
|
||||||
sigc::mem_fun(*this, &Win_GParted::menu_gparted_refresh_devices))));
|
sigc::mem_fun(*this, &Win_GParted::menu_gparted_refresh_devices)));
|
||||||
|
menu->append(*item);
|
||||||
|
|
||||||
image = manage( new Gtk::Image( Gtk::Stock::HARDDISK, Gtk::ICON_SIZE_MENU ) );
|
image = manage( new Gtk::Image( Gtk::Stock::HARDDISK, Gtk::ICON_SIZE_MENU ) );
|
||||||
menu->append(*manage(new GParted::Menu_Helpers::ImageMenuElem(
|
item = manage(new GParted::Menu_Helpers::ImageMenuElem(
|
||||||
_("_Devices"), *image)));
|
_("_Devices"), *image));
|
||||||
|
menu->append(*item);
|
||||||
|
mainmenu_items[MENU_DEVICES] = item;
|
||||||
|
|
||||||
menu->append(*manage(new GParted::Menu_Helpers::SeparatorElem()));
|
item = manage(new GParted::Menu_Helpers::SeparatorElem());
|
||||||
menu->append(*manage(new GParted::Menu_Helpers::StockMenuElem(
|
menu->append(*item);
|
||||||
Gtk::Stock::QUIT, sigc::mem_fun(*this, &Win_GParted::menu_gparted_quit))));
|
|
||||||
menubar_main.append(*manage(new GParted::Menu_Helpers::MenuElem(
|
item = manage(new GParted::Menu_Helpers::StockMenuElem(
|
||||||
_("_GParted"), *menu)));
|
Gtk::Stock::QUIT, sigc::mem_fun(*this, &Win_GParted::menu_gparted_quit)));
|
||||||
|
menu->append(*item);
|
||||||
|
|
||||||
|
item = manage(new GParted::Menu_Helpers::MenuElem(
|
||||||
|
_("_GParted"), *menu));
|
||||||
|
menubar_main.append(*item);
|
||||||
|
|
||||||
//edit
|
//edit
|
||||||
menu = manage( new Gtk::Menu() ) ;
|
menu = manage( new Gtk::Menu() ) ;
|
||||||
menu->append(*manage(new GParted::Menu_Helpers::ImageMenuElem(
|
item = manage(new GParted::Menu_Helpers::ImageMenuElem(
|
||||||
_("_Undo Last Operation"),
|
_("_Undo Last Operation"),
|
||||||
Gtk::AccelKey("<control>z"),
|
Gtk::AccelKey("<control>z"),
|
||||||
* manage( new Gtk::Image( Gtk::Stock::UNDO, Gtk::ICON_SIZE_MENU ) ),
|
* manage( new Gtk::Image( Gtk::Stock::UNDO, Gtk::ICON_SIZE_MENU ) ),
|
||||||
sigc::mem_fun(*this, &Win_GParted::activate_undo))));
|
sigc::mem_fun(*this, &Win_GParted::activate_undo)));
|
||||||
|
menu->append(*item);
|
||||||
|
mainmenu_items[MENU_UNDO_OPERATION] = item;
|
||||||
|
|
||||||
menu->append(*manage(new GParted::Menu_Helpers::ImageMenuElem(
|
item = manage(new GParted::Menu_Helpers::ImageMenuElem(
|
||||||
_("_Clear All Operations"),
|
_("_Clear All Operations"),
|
||||||
* manage( new Gtk::Image( Gtk::Stock::CLEAR, Gtk::ICON_SIZE_MENU ) ),
|
* manage( new Gtk::Image( Gtk::Stock::CLEAR, Gtk::ICON_SIZE_MENU ) ),
|
||||||
sigc::mem_fun(*this, &Win_GParted::clear_operationslist))));
|
sigc::mem_fun(*this, &Win_GParted::clear_operationslist)));
|
||||||
|
menu->append(*item);
|
||||||
|
mainmenu_items[MENU_CLEAR_OPERATIONS] = item;
|
||||||
|
|
||||||
menu->append(*manage(new GParted::Menu_Helpers::ImageMenuElem(
|
item = manage(new GParted::Menu_Helpers::ImageMenuElem(
|
||||||
_("_Apply All Operations"),
|
_("_Apply All Operations"),
|
||||||
Gtk::AccelKey(GDK_KEY_Return, Gdk::CONTROL_MASK),
|
Gtk::AccelKey(GDK_KEY_Return, Gdk::CONTROL_MASK),
|
||||||
* manage( new Gtk::Image( Gtk::Stock::APPLY, Gtk::ICON_SIZE_MENU ) ),
|
* manage( new Gtk::Image( Gtk::Stock::APPLY, Gtk::ICON_SIZE_MENU ) ),
|
||||||
sigc::mem_fun(*this, &Win_GParted::activate_apply))));
|
sigc::mem_fun(*this, &Win_GParted::activate_apply)));
|
||||||
menubar_main.append(*manage(new GParted::Menu_Helpers::MenuElem(
|
menu->append(*item);
|
||||||
_("_Edit"), *menu)));
|
mainmenu_items[MENU_APPLY_OPERATIONS] = item;
|
||||||
|
|
||||||
|
item = manage(new GParted::Menu_Helpers::MenuElem(
|
||||||
|
_("_Edit"), *menu));
|
||||||
|
menubar_main.append(*item);
|
||||||
|
mainmenu_items[MENU_EDIT] = item;
|
||||||
|
|
||||||
//view
|
//view
|
||||||
menu = manage( new Gtk::Menu() ) ;
|
menu = manage( new Gtk::Menu() ) ;
|
||||||
menu->append(*manage(new GParted::Menu_Helpers::CheckMenuElem(
|
|
||||||
_("Device _Information"), sigc::mem_fun(*this, &Win_GParted::menu_view_harddisk_info))));
|
|
||||||
menu->append(*manage(new GParted::Menu_Helpers::CheckMenuElem(
|
|
||||||
_("Pending _Operations"), sigc::mem_fun(*this, &Win_GParted::menu_view_operations))));
|
|
||||||
menubar_main.append(*manage(new GParted::Menu_Helpers::MenuElem(
|
|
||||||
_("_View"), *menu)));
|
|
||||||
|
|
||||||
menu->append(*manage(new GParted::Menu_Helpers::SeparatorElem()));
|
item = manage(new GParted::Menu_Helpers::CheckMenuElem(
|
||||||
menu->append(*manage(new GParted::Menu_Helpers::MenuElem(
|
_("Device _Information"), sigc::mem_fun(*this, &Win_GParted::menu_view_harddisk_info)));
|
||||||
_("_File System Support"), sigc::mem_fun(*this, &Win_GParted::menu_gparted_features))));
|
menu->append(*item);
|
||||||
|
mainmenu_items[MENU_DEVICE_INFORMATION] = item;
|
||||||
|
|
||||||
|
item = manage(new GParted::Menu_Helpers::CheckMenuElem(
|
||||||
|
_("Pending _Operations"), sigc::mem_fun(*this, &Win_GParted::menu_view_operations)));
|
||||||
|
menu->append(*item);
|
||||||
|
mainmenu_items[MENU_PENDING_OPERATIONS] = item;
|
||||||
|
|
||||||
|
item = manage(new GParted::Menu_Helpers::MenuElem(
|
||||||
|
_("_View"), *menu));
|
||||||
|
menubar_main.append(*item);
|
||||||
|
|
||||||
|
item = manage(new GParted::Menu_Helpers::SeparatorElem());
|
||||||
|
menu->append(*item);
|
||||||
|
|
||||||
|
item = manage( new GParted::Menu_Helpers::MenuElem(
|
||||||
|
_("_File System Support"), sigc::mem_fun(*this, &Win_GParted::menu_gparted_features)));
|
||||||
|
menu->append(*item);
|
||||||
|
mainmenu_items[MENU_VIEW] = item;
|
||||||
|
|
||||||
//device
|
//device
|
||||||
menu = manage( new Gtk::Menu() ) ;
|
menu = manage( new Gtk::Menu() ) ;
|
||||||
menu->append(*manage(new GParted::Menu_Helpers::MenuElem(
|
|
||||||
|
item = manage(new GParted::Menu_Helpers::MenuElem(
|
||||||
Glib::ustring(_("_Create Partition Table") ) + "...",
|
Glib::ustring(_("_Create Partition Table") ) + "...",
|
||||||
sigc::mem_fun(*this, &Win_GParted::activate_disklabel))));
|
sigc::mem_fun(*this, &Win_GParted::activate_disklabel)));
|
||||||
|
menu->append(*item);
|
||||||
|
|
||||||
menu->append(*manage(new GParted::Menu_Helpers::MenuElem(
|
item = manage(new GParted::Menu_Helpers::MenuElem(
|
||||||
Glib::ustring(_("_Attempt Data Rescue") ) + "...",
|
Glib::ustring(_("_Attempt Data Rescue") ) + "...",
|
||||||
sigc::mem_fun(*this, &Win_GParted::activate_attempt_rescue_data))));
|
sigc::mem_fun(*this, &Win_GParted::activate_attempt_rescue_data)));
|
||||||
|
menu->append(*item);
|
||||||
|
|
||||||
menubar_main.append(*manage(new GParted::Menu_Helpers::MenuElem(
|
item = manage(new GParted::Menu_Helpers::MenuElem(
|
||||||
_("_Device"), *menu)));
|
_("_Device"), *menu));
|
||||||
|
menubar_main.append(*item);
|
||||||
|
mainmenu_items[MENU_DEVICE] = item;
|
||||||
|
|
||||||
//partition
|
//partition
|
||||||
init_partition_menu() ;
|
init_partition_menu() ;
|
||||||
menubar_main.append(*manage(new GParted::Menu_Helpers::MenuElem(
|
|
||||||
_("_Partition"), menu_partition)));
|
item = manage(new GParted::Menu_Helpers::MenuElem(
|
||||||
|
_("_Partition"), menu_partition));
|
||||||
|
menubar_main.append(*item);
|
||||||
|
mainmenu_items[MENU_PARTITION] = item;
|
||||||
|
|
||||||
//help
|
//help
|
||||||
menu = manage( new Gtk::Menu() ) ;
|
menu = manage( new Gtk::Menu() ) ;
|
||||||
menu->append(*manage(new GParted::Menu_Helpers::ImageMenuElem(
|
|
||||||
|
item = manage(new GParted::Menu_Helpers::ImageMenuElem(
|
||||||
_("_Contents"),
|
_("_Contents"),
|
||||||
Gtk::AccelKey("F1"),
|
Gtk::AccelKey("F1"),
|
||||||
* manage( new Gtk::Image( Gtk::Stock::HELP, Gtk::ICON_SIZE_MENU ) ),
|
* manage( new Gtk::Image( Gtk::Stock::HELP, Gtk::ICON_SIZE_MENU ) ),
|
||||||
sigc::mem_fun(*this, &Win_GParted::menu_help_contents))));
|
sigc::mem_fun(*this, &Win_GParted::menu_help_contents)));
|
||||||
menu->append(*manage(new GParted::Menu_Helpers::SeparatorElem()));
|
menu->append(*item);
|
||||||
menu->append(*manage(new GParted::Menu_Helpers::StockMenuElem(
|
|
||||||
Gtk::Stock::ABOUT, sigc::mem_fun(*this, &Win_GParted::menu_help_about))));
|
|
||||||
|
|
||||||
menubar_main.append(*manage(new GParted::Menu_Helpers::MenuElem(
|
item = manage(new GParted::Menu_Helpers::SeparatorElem());
|
||||||
_("_Help"), *menu)));
|
menu->append(*item);
|
||||||
|
|
||||||
|
item = manage( new GParted::Menu_Helpers::StockMenuElem(
|
||||||
|
Gtk::Stock::ABOUT, sigc::mem_fun(*this, &Win_GParted::menu_help_about)));
|
||||||
|
menu->append(*item);
|
||||||
|
|
||||||
|
item = manage(new GParted::Menu_Helpers::MenuElem(
|
||||||
|
_("_Help"), *menu));
|
||||||
|
menubar_main.append(*item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Win_GParted::init_toolbar()
|
void Win_GParted::init_toolbar()
|
||||||
|
@ -333,113 +370,128 @@ void Win_GParted::init_toolbar()
|
||||||
|
|
||||||
void Win_GParted::init_partition_menu()
|
void Win_GParted::init_partition_menu()
|
||||||
{
|
{
|
||||||
int index = 0 ;
|
Gtk::MenuItem *item;
|
||||||
|
|
||||||
//fill menu_partition
|
//fill menu_partition
|
||||||
image = manage( new Gtk::Image( Gtk::Stock::NEW, Gtk::ICON_SIZE_MENU ) );
|
image = manage( new Gtk::Image( Gtk::Stock::NEW, Gtk::ICON_SIZE_MENU ) );
|
||||||
menu_partition.append(*manage(new
|
item = manage(new
|
||||||
/*TO TRANSLATORS: "_New" is a sub menu item for the partition menu. */
|
/*TO TRANSLATORS: "_New" is a sub menu item for the partition menu. */
|
||||||
GParted::Menu_Helpers::ImageMenuElem(_("_New"),
|
GParted::Menu_Helpers::ImageMenuElem(_("_New"),
|
||||||
Gtk::AccelKey(GDK_KEY_Insert, Gdk::BUTTON1_MASK),
|
Gtk::AccelKey(GDK_KEY_Insert, Gdk::BUTTON1_MASK),
|
||||||
*image,
|
*image,
|
||||||
sigc::mem_fun(*this, &Win_GParted::activate_new))));
|
sigc::mem_fun(*this, &Win_GParted::activate_new)));
|
||||||
MENU_NEW = index++ ;
|
menu_partition.append(*item);
|
||||||
|
partitionmenu_items[MENU_NEW] = item;
|
||||||
|
|
||||||
menu_partition.append(*manage(new
|
item = manage(new
|
||||||
GParted::Menu_Helpers::StockMenuElem(Gtk::Stock::DELETE,
|
GParted::Menu_Helpers::StockMenuElem(Gtk::Stock::DELETE,
|
||||||
Gtk::AccelKey(GDK_KEY_Delete, Gdk::BUTTON1_MASK),
|
Gtk::AccelKey(GDK_KEY_Delete, Gdk::BUTTON1_MASK),
|
||||||
sigc::mem_fun(*this, &Win_GParted::activate_delete))));
|
sigc::mem_fun(*this, &Win_GParted::activate_delete)));
|
||||||
MENU_DEL = index++ ;
|
menu_partition.append(*item);
|
||||||
|
partitionmenu_items[MENU_DEL] = item;
|
||||||
|
|
||||||
menu_partition.append(*manage(new GParted::Menu_Helpers::SeparatorElem()));
|
item = manage(new GParted::Menu_Helpers::SeparatorElem());
|
||||||
index++ ;
|
menu_partition.append(*item);
|
||||||
|
|
||||||
image = manage( new Gtk::Image( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_MENU ) );
|
image = manage( new Gtk::Image( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_MENU ) );
|
||||||
menu_partition.append(*manage(new
|
item = manage(new
|
||||||
GParted::Menu_Helpers::ImageMenuElem(_("_Resize/Move"),
|
GParted::Menu_Helpers::ImageMenuElem(_("_Resize/Move"),
|
||||||
*image,
|
*image,
|
||||||
sigc::mem_fun(*this, &Win_GParted::activate_resize))));
|
sigc::mem_fun(*this, &Win_GParted::activate_resize)));
|
||||||
MENU_RESIZE_MOVE = index++ ;
|
menu_partition.append(*item);
|
||||||
|
partitionmenu_items[MENU_RESIZE_MOVE] = item;
|
||||||
|
|
||||||
menu_partition.append(*manage(new GParted::Menu_Helpers::SeparatorElem()));
|
item = manage(new GParted::Menu_Helpers::SeparatorElem());
|
||||||
index++ ;
|
menu_partition.append(*item);
|
||||||
|
|
||||||
menu_partition.append(*manage(new
|
item = manage(new
|
||||||
GParted::Menu_Helpers::StockMenuElem(Gtk::Stock::COPY,
|
GParted::Menu_Helpers::StockMenuElem(Gtk::Stock::COPY,
|
||||||
sigc::mem_fun(*this, &Win_GParted::activate_copy))));
|
sigc::mem_fun(*this, &Win_GParted::activate_copy)));
|
||||||
MENU_COPY = index++ ;
|
menu_partition.append(*item);
|
||||||
|
partitionmenu_items[MENU_COPY] = item;
|
||||||
|
|
||||||
menu_partition.append(*manage(new
|
item = manage(new
|
||||||
GParted::Menu_Helpers::StockMenuElem(Gtk::Stock::PASTE,
|
GParted::Menu_Helpers::StockMenuElem(Gtk::Stock::PASTE,
|
||||||
sigc::mem_fun(*this, &Win_GParted::activate_paste))));
|
sigc::mem_fun(*this, &Win_GParted::activate_paste)));
|
||||||
MENU_PASTE = index++ ;
|
menu_partition.append(*item);
|
||||||
|
partitionmenu_items[MENU_PASTE] = item;
|
||||||
|
|
||||||
menu_partition.append(*manage(new GParted::Menu_Helpers::SeparatorElem()));
|
item = manage(new GParted::Menu_Helpers::SeparatorElem());
|
||||||
index++ ;
|
menu_partition.append(*item);
|
||||||
|
|
||||||
image = manage( new Gtk::Image( Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU ) );
|
image = manage( new Gtk::Image( Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU ) );
|
||||||
menu_partition.append(*manage(new
|
item = manage(new
|
||||||
/*TO TRANSLATORS: menuitem which holds a submenu with file systems.. */
|
/*TO TRANSLATORS: menuitem which holds a submenu with file systems.. */
|
||||||
GParted::Menu_Helpers::ImageMenuElem(_("_Format to"),
|
GParted::Menu_Helpers::ImageMenuElem(_("_Format to"),
|
||||||
*image,
|
*image,
|
||||||
*create_format_menu())));
|
*create_format_menu()));
|
||||||
MENU_FORMAT = index++ ;
|
menu_partition.append(*item);
|
||||||
|
partitionmenu_items[MENU_FORMAT] = item;
|
||||||
|
|
||||||
menu_partition.append(*manage(new GParted::Menu_Helpers::SeparatorElem()));
|
item = manage(new GParted::Menu_Helpers::SeparatorElem());
|
||||||
index++ ;
|
menu_partition.append(*item);
|
||||||
|
|
||||||
menu_partition.append(*manage(new
|
item = manage(new
|
||||||
// Placeholder text, replaced in set_valid_operations() before the menu is shown
|
// Placeholder text, replaced in set_valid_operations() before the menu is shown
|
||||||
GParted::Menu_Helpers::MenuElem("--toggle crypt busy--",
|
GParted::Menu_Helpers::MenuElem("--toggle crypt busy--",
|
||||||
sigc::mem_fun(*this, &Win_GParted::toggle_crypt_busy_state))));
|
sigc::mem_fun(*this, &Win_GParted::toggle_crypt_busy_state)));
|
||||||
MENU_TOGGLE_CRYPT_BUSY = index++;
|
menu_partition.append(*item);
|
||||||
|
partitionmenu_items[MENU_TOGGLE_CRYPT_BUSY] = item;
|
||||||
|
|
||||||
menu_partition.append(*manage(new
|
item = manage(new
|
||||||
// Placeholder text, replaced in set_valid_operations() before the menu is shown
|
// Placeholder text, replaced in set_valid_operations() before the menu is shown
|
||||||
GParted::Menu_Helpers::MenuElem("--toggle fs busy--",
|
GParted::Menu_Helpers::MenuElem("--toggle fs busy--",
|
||||||
sigc::mem_fun(*this, &Win_GParted::toggle_fs_busy_state))));
|
sigc::mem_fun(*this, &Win_GParted::toggle_fs_busy_state)));
|
||||||
MENU_TOGGLE_FS_BUSY = index++;
|
menu_partition.append(*item);
|
||||||
|
partitionmenu_items[MENU_TOGGLE_FS_BUSY] = item;
|
||||||
|
|
||||||
menu_partition.append(*manage(new
|
item = manage(new
|
||||||
/*TO TRANSLATORS: menuitem which holds a submenu with mount points.. */
|
/*TO TRANSLATORS: menuitem which holds a submenu with mount points.. */
|
||||||
GParted::Menu_Helpers::MenuElem(_("_Mount on"), *manage(new Gtk::Menu()))));
|
GParted::Menu_Helpers::MenuElem(_("_Mount on"), *manage(new Gtk::Menu())));
|
||||||
MENU_MOUNT = index++ ;
|
menu_partition.append(*item);
|
||||||
|
partitionmenu_items[MENU_MOUNT] = item;
|
||||||
|
|
||||||
menu_partition.append(*manage(new GParted::Menu_Helpers::SeparatorElem()));
|
item = manage(new GParted::Menu_Helpers::SeparatorElem());
|
||||||
index++ ;
|
menu_partition.append(*item);
|
||||||
|
|
||||||
menu_partition.append(*manage(new
|
item = manage(new
|
||||||
GParted::Menu_Helpers::MenuElem(_("_Name Partition"),
|
GParted::Menu_Helpers::MenuElem(_("_Name Partition"),
|
||||||
sigc::mem_fun(*this, &Win_GParted::activate_name_partition))));
|
sigc::mem_fun(*this, &Win_GParted::activate_name_partition)));
|
||||||
MENU_NAME_PARTITION = index++;
|
menu_partition.append(*item);
|
||||||
|
partitionmenu_items[MENU_NAME_PARTITION] = item;
|
||||||
|
|
||||||
menu_partition.append(*manage(new
|
item = manage(new
|
||||||
GParted::Menu_Helpers::MenuElem(_("M_anage Flags"),
|
GParted::Menu_Helpers::MenuElem(_("M_anage Flags"),
|
||||||
sigc::mem_fun(*this, &Win_GParted::activate_manage_flags))));
|
sigc::mem_fun(*this, &Win_GParted::activate_manage_flags)));
|
||||||
MENU_FLAGS = index++ ;
|
menu_partition.append(*item);
|
||||||
|
partitionmenu_items[MENU_FLAGS] = item;
|
||||||
|
|
||||||
menu_partition.append(*manage(new
|
item = manage(new
|
||||||
GParted::Menu_Helpers::MenuElem(_("C_heck"),
|
GParted::Menu_Helpers::MenuElem(_("C_heck"),
|
||||||
sigc::mem_fun(*this, &Win_GParted::activate_check))));
|
sigc::mem_fun(*this, &Win_GParted::activate_check)));
|
||||||
MENU_CHECK = index++ ;
|
menu_partition.append(*item);
|
||||||
|
partitionmenu_items[MENU_CHECK] = item;
|
||||||
|
|
||||||
menu_partition.append(*manage(new
|
item = manage(new
|
||||||
GParted::Menu_Helpers::MenuElem(_("_Label File System"),
|
GParted::Menu_Helpers::MenuElem(_("_Label File System"),
|
||||||
sigc::mem_fun(*this, &Win_GParted::activate_label_filesystem))));
|
sigc::mem_fun(*this, &Win_GParted::activate_label_filesystem)));
|
||||||
MENU_LABEL_PARTITION = index++ ;
|
menu_partition.append(*item);
|
||||||
|
partitionmenu_items[MENU_LABEL_PARTITION] = item;
|
||||||
|
|
||||||
menu_partition.append(*manage(new
|
item = manage(new
|
||||||
GParted::Menu_Helpers::MenuElem(_("New UU_ID"),
|
GParted::Menu_Helpers::MenuElem(_("New UU_ID"),
|
||||||
sigc::mem_fun(*this, &Win_GParted::activate_change_uuid))));
|
sigc::mem_fun(*this, &Win_GParted::activate_change_uuid)));
|
||||||
MENU_CHANGE_UUID = index++ ;
|
menu_partition.append(*item);
|
||||||
|
partitionmenu_items[MENU_CHANGE_UUID] = item;
|
||||||
|
|
||||||
menu_partition.append(*manage(new GParted::Menu_Helpers::SeparatorElem()));
|
item = manage(new GParted::Menu_Helpers::SeparatorElem());
|
||||||
index++ ;
|
menu_partition.append(*item);
|
||||||
|
|
||||||
menu_partition.append(*manage(new
|
item = manage(new
|
||||||
GParted::Menu_Helpers::StockMenuElem(Gtk::Stock::DIALOG_INFO,
|
GParted::Menu_Helpers::StockMenuElem(Gtk::Stock::DIALOG_INFO,
|
||||||
sigc::mem_fun(*this, &Win_GParted::activate_info))));
|
sigc::mem_fun(*this, &Win_GParted::activate_info)));
|
||||||
MENU_INFO = index++ ;
|
menu_partition.append(*item);
|
||||||
|
partitionmenu_items[MENU_INFO] = item;
|
||||||
|
|
||||||
menu_partition .accelerate( *this ) ;
|
menu_partition .accelerate( *this ) ;
|
||||||
}
|
}
|
||||||
|
@ -473,12 +525,13 @@ void Win_GParted::create_format_menu_add_item( FSType filesystem, bool activate
|
||||||
hbox ->pack_start( * Utils::mk_label( " " + Utils::get_filesystem_string( filesystem ) ),
|
hbox ->pack_start( * Utils::mk_label( " " + Utils::get_filesystem_string( filesystem ) ),
|
||||||
Gtk::PACK_SHRINK ) ;
|
Gtk::PACK_SHRINK ) ;
|
||||||
|
|
||||||
menu ->items() .push_back( * manage( new Gtk::MenuItem( *hbox ) ) ) ;
|
Gtk::MenuItem *item = manage(new Gtk::MenuItem(*hbox));
|
||||||
|
menu->append(*item);
|
||||||
if ( activate )
|
if ( activate )
|
||||||
menu ->items() .back() .signal_activate() .connect(
|
item->signal_activate().connect(
|
||||||
sigc::bind<FSType>( sigc::mem_fun( *this, &Win_GParted::activate_format ), filesystem ) );
|
sigc::bind<FSType>( sigc::mem_fun( *this, &Win_GParted::activate_format ), filesystem ) );
|
||||||
else
|
else
|
||||||
menu ->items() .back() .set_sensitive( false ) ;
|
item->set_sensitive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Win_GParted::init_device_info()
|
void Win_GParted::init_device_info()
|
||||||
|
@ -635,18 +688,19 @@ void Win_GParted::refresh_combo_devices()
|
||||||
hbox ->pack_start( * Utils::mk_label( " (" + Utils::format_size( devices[ i ] .length, devices[ i ] .sector_size ) + ")" ),
|
hbox ->pack_start( * Utils::mk_label( " (" + Utils::format_size( devices[ i ] .length, devices[ i ] .sector_size ) + ")" ),
|
||||||
Gtk::PACK_SHRINK ) ;
|
Gtk::PACK_SHRINK ) ;
|
||||||
|
|
||||||
menu ->items() .push_back( * manage( new Gtk::RadioMenuItem( radio_group ) ) ) ;
|
Gtk::RadioMenuItem *item = manage(new Gtk::RadioMenuItem(radio_group));
|
||||||
menu ->items() .back() .add( *hbox ) ;
|
menu->append(*item);
|
||||||
menu ->items() .back() .signal_activate() .connect(
|
item->add(*hbox);
|
||||||
|
item->signal_activate().connect(
|
||||||
sigc::bind<unsigned int>( sigc::mem_fun(*this, &Win_GParted::radio_devices_changed), i ) ) ;
|
sigc::bind<unsigned int>( sigc::mem_fun(*this, &Win_GParted::radio_devices_changed), i ) ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
menubar_main.items()[0].get_submenu()->items()[1].unset_submenu();
|
mainmenu_items[MENU_DEVICES]->unset_submenu();
|
||||||
|
|
||||||
if ( menu ->items() .size() )
|
if (menu->get_children().size())
|
||||||
{
|
{
|
||||||
menu ->show_all() ;
|
menu ->show_all() ;
|
||||||
menubar_main .items()[ 0 ] .get_submenu() ->items()[ 1 ] .set_submenu( *menu ) ;
|
mainmenu_items[MENU_DEVICES]->set_submenu(*menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
combo_devices_changed_connection .unblock();
|
combo_devices_changed_connection .unblock();
|
||||||
|
@ -1078,14 +1132,14 @@ void Win_GParted::set_valid_operations()
|
||||||
// Set default name for the open/close crypt menu item.
|
// Set default name for the open/close crypt menu item.
|
||||||
const FileSystem * luks_filesystem_object = gparted_core.get_filesystem_object( FS_LUKS );
|
const FileSystem * luks_filesystem_object = gparted_core.get_filesystem_object( FS_LUKS );
|
||||||
g_assert( luks_filesystem_object != NULL ); // Bug: LUKS FileSystem object not found
|
g_assert( luks_filesystem_object != NULL ); // Bug: LUKS FileSystem object not found
|
||||||
dynamic_cast<Gtk::Label*>( menu_partition.items()[MENU_TOGGLE_CRYPT_BUSY].get_child() )
|
dynamic_cast<Gtk::Label *>(partitionmenu_items[MENU_TOGGLE_CRYPT_BUSY]->get_child())
|
||||||
->set_label( luks_filesystem_object->get_custom_text( CTEXT_ACTIVATE_FILESYSTEM ) );
|
->set_label( luks_filesystem_object->get_custom_text( CTEXT_ACTIVATE_FILESYSTEM ) );
|
||||||
// Set default name for the file system active/deactivate menu item.
|
// Set default name for the file system active/deactivate menu item.
|
||||||
dynamic_cast<Gtk::Label*>( menu_partition.items()[MENU_TOGGLE_FS_BUSY].get_child() )
|
dynamic_cast<Gtk::Label *>(partitionmenu_items[MENU_TOGGLE_FS_BUSY]->get_child())
|
||||||
->set_label( FileSystem::get_generic_text( CTEXT_ACTIVATE_FILESYSTEM ) );
|
->set_label( FileSystem::get_generic_text( CTEXT_ACTIVATE_FILESYSTEM ) );
|
||||||
|
|
||||||
menu_partition.items()[MENU_TOGGLE_FS_BUSY].show();
|
partitionmenu_items[MENU_TOGGLE_FS_BUSY]->show();
|
||||||
menu_partition .items()[ MENU_MOUNT ] .hide() ;
|
partitionmenu_items[MENU_MOUNT]->hide();
|
||||||
|
|
||||||
// No partition selected ...
|
// No partition selected ...
|
||||||
if ( ! selected_partition_ptr )
|
if ( ! selected_partition_ptr )
|
||||||
|
@ -1105,7 +1159,7 @@ void Win_GParted::set_valid_operations()
|
||||||
// Set appropriate name for the open/close crypt menu item.
|
// Set appropriate name for the open/close crypt menu item.
|
||||||
if ( selected_partition_ptr->filesystem == FS_LUKS )
|
if ( selected_partition_ptr->filesystem == FS_LUKS )
|
||||||
{
|
{
|
||||||
dynamic_cast<Gtk::Label*>( menu_partition.items()[MENU_TOGGLE_CRYPT_BUSY].get_child() )
|
dynamic_cast<Gtk::Label *>(partitionmenu_items[MENU_TOGGLE_CRYPT_BUSY]->get_child())
|
||||||
->set_label( luks_filesystem_object->get_custom_text( selected_partition_ptr->busy
|
->set_label( luks_filesystem_object->get_custom_text( selected_partition_ptr->busy
|
||||||
? CTEXT_DEACTIVATE_FILESYSTEM
|
? CTEXT_DEACTIVATE_FILESYSTEM
|
||||||
: CTEXT_ACTIVATE_FILESYSTEM ) );
|
: CTEXT_ACTIVATE_FILESYSTEM ) );
|
||||||
|
@ -1116,14 +1170,14 @@ void Win_GParted::set_valid_operations()
|
||||||
const FileSystem * filesystem_object = gparted_core.get_filesystem_object( selected_filesystem.filesystem );
|
const FileSystem * filesystem_object = gparted_core.get_filesystem_object( selected_filesystem.filesystem );
|
||||||
if ( filesystem_object )
|
if ( filesystem_object )
|
||||||
{
|
{
|
||||||
dynamic_cast<Gtk::Label*>( menu_partition.items()[MENU_TOGGLE_FS_BUSY].get_child() )
|
dynamic_cast<Gtk::Label *>(partitionmenu_items[MENU_TOGGLE_FS_BUSY]->get_child())
|
||||||
->set_label( filesystem_object->get_custom_text( selected_filesystem.busy
|
->set_label( filesystem_object->get_custom_text( selected_filesystem.busy
|
||||||
? CTEXT_DEACTIVATE_FILESYSTEM
|
? CTEXT_DEACTIVATE_FILESYSTEM
|
||||||
: CTEXT_ACTIVATE_FILESYSTEM ) );
|
: CTEXT_ACTIVATE_FILESYSTEM ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dynamic_cast<Gtk::Label*>( menu_partition.items()[MENU_TOGGLE_FS_BUSY].get_child() )
|
dynamic_cast<Gtk::Label *>(partitionmenu_items[MENU_TOGGLE_FS_BUSY]->get_child())
|
||||||
->set_label( FileSystem::get_generic_text ( selected_filesystem.busy
|
->set_label( FileSystem::get_generic_text ( selected_filesystem.busy
|
||||||
? CTEXT_DEACTIVATE_FILESYSTEM
|
? CTEXT_DEACTIVATE_FILESYSTEM
|
||||||
: CTEXT_ACTIVATE_FILESYSTEM ) );
|
: CTEXT_ACTIVATE_FILESYSTEM ) );
|
||||||
|
@ -1337,21 +1391,26 @@ void Win_GParted::set_valid_operations()
|
||||||
selected_filesystem.filesystem != FS_LUKS &&
|
selected_filesystem.filesystem != FS_LUKS &&
|
||||||
selected_filesystem.get_mountpoints().size() )
|
selected_filesystem.get_mountpoints().size() )
|
||||||
{
|
{
|
||||||
menu = menu_partition .items()[ MENU_MOUNT ] .get_submenu() ;
|
partitionmenu_items[MENU_MOUNT]->unset_submenu();
|
||||||
menu ->items() .clear() ;
|
|
||||||
|
Gtk::Menu *menu = manage(new Gtk::Menu());
|
||||||
std::vector<Glib::ustring> temp_mountpoints = selected_filesystem.get_mountpoints();
|
std::vector<Glib::ustring> temp_mountpoints = selected_filesystem.get_mountpoints();
|
||||||
for ( unsigned int t = 0 ; t < temp_mountpoints.size() ; t++ )
|
for ( unsigned int t = 0 ; t < temp_mountpoints.size() ; t++ )
|
||||||
{
|
{
|
||||||
menu->append(*manage(new
|
Gtk::MenuItem *item;
|
||||||
|
|
||||||
|
item = manage(new
|
||||||
GParted::Menu_Helpers::MenuElem(
|
GParted::Menu_Helpers::MenuElem(
|
||||||
temp_mountpoints[t],
|
temp_mountpoints[t],
|
||||||
sigc::bind<unsigned int>(sigc::mem_fun(*this, &Win_GParted::activate_mount_partition), t))));
|
sigc::bind<unsigned int>(sigc::mem_fun(*this, &Win_GParted::activate_mount_partition), t)));
|
||||||
|
menu->append(*item);
|
||||||
|
|
||||||
dynamic_cast<Gtk::Label*>( menu ->items() .back() .get_child() ) ->set_use_underline( false ) ;
|
dynamic_cast<Gtk::Label *>(item->get_child())->set_use_underline(false);
|
||||||
}
|
}
|
||||||
|
partitionmenu_items[MENU_MOUNT]->set_submenu(*menu);
|
||||||
|
|
||||||
menu_partition.items()[MENU_TOGGLE_FS_BUSY].hide();
|
partitionmenu_items[MENU_TOGGLE_FS_BUSY]->hide();
|
||||||
menu_partition .items()[ MENU_MOUNT ] .show() ;
|
partitionmenu_items[MENU_MOUNT]->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
// See if there is a partition to be copied and it fits inside this selected partition
|
// See if there is a partition to be copied and it fits inside this selected partition
|
||||||
|
@ -1404,7 +1463,7 @@ void Win_GParted::open_operationslist()
|
||||||
Gtk::Main::iteration() ;
|
Gtk::Main::iteration() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
static_cast<Gtk::CheckMenuItem *>( & menubar_main .items()[ 2 ] .get_submenu() ->items()[ 1 ] )
|
static_cast<Gtk::CheckMenuItem *>(mainmenu_items[MENU_PENDING_OPERATIONS])
|
||||||
->set_active( true ) ;
|
->set_active( true ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1425,7 +1484,7 @@ void Win_GParted::close_operationslist()
|
||||||
|
|
||||||
hbox_operations .hide() ;
|
hbox_operations .hide() ;
|
||||||
|
|
||||||
static_cast<Gtk::CheckMenuItem *>( & menubar_main .items()[ 2 ] .get_submenu() ->items()[ 1 ] )
|
static_cast<Gtk::CheckMenuItem *>(mainmenu_items[MENU_PENDING_OPERATIONS])
|
||||||
->set_active( false ) ;
|
->set_active( false ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1455,21 +1514,21 @@ void Win_GParted::combo_devices_changed()
|
||||||
//rebuild visualdisk and treeview
|
//rebuild visualdisk and treeview
|
||||||
Refresh_Visual();
|
Refresh_Visual();
|
||||||
|
|
||||||
//uodate radiobuttons..
|
// Update radio buttons..
|
||||||
if ( menubar_main .items()[ 0 ] .get_submenu() ->items()[ 1 ] .get_submenu() )
|
if (mainmenu_items[MENU_DEVICES]->has_submenu()) {
|
||||||
static_cast<Gtk::RadioMenuItem *>(
|
std::vector<Gtk::Widget *> child_items;
|
||||||
& menubar_main .items()[ 0 ] .get_submenu() ->items()[ 1 ] .get_submenu() ->
|
child_items = mainmenu_items[MENU_DEVICES]->get_submenu()->get_children();
|
||||||
items()[ current_device ] ) ->set_active( true ) ;
|
static_cast<Gtk::RadioMenuItem *>(child_items[current_device])
|
||||||
|
->set_active(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Win_GParted::radio_devices_changed( unsigned int item )
|
void Win_GParted::radio_devices_changed( unsigned int item )
|
||||||
{
|
{
|
||||||
if ( static_cast<Gtk::RadioMenuItem *>(
|
std::vector<Gtk::Widget *> child_items;
|
||||||
& menubar_main .items()[ 0 ] .get_submenu() ->items()[ 1 ] .get_submenu() ->
|
child_items = mainmenu_items[MENU_DEVICES]->get_submenu()->get_children();
|
||||||
items()[ item ] ) ->get_active() )
|
if (static_cast<Gtk::RadioMenuItem *>(child_items[item])->get_active())
|
||||||
{
|
|
||||||
combo_devices .set_active( item ) ;
|
combo_devices .set_active( item ) ;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Win_GParted::on_show()
|
void Win_GParted::on_show()
|
||||||
|
@ -1524,11 +1583,11 @@ void Win_GParted::menu_gparted_refresh_devices()
|
||||||
this ->set_title( _("GParted") );
|
this ->set_title( _("GParted") );
|
||||||
combo_devices .hide() ;
|
combo_devices .hide() ;
|
||||||
|
|
||||||
menubar_main .items()[ 0 ] .get_submenu() ->items()[ 1 ] .set_sensitive( false ) ;
|
mainmenu_items[MENU_DEVICES]->set_sensitive(false);
|
||||||
menubar_main .items()[ 1 ] .set_sensitive( false ) ;
|
mainmenu_items[MENU_EDIT]->set_sensitive(false);
|
||||||
menubar_main .items()[ 2 ] .set_sensitive( false ) ;
|
mainmenu_items[MENU_VIEW]->set_sensitive(false);
|
||||||
menubar_main .items()[ 3 ] .set_sensitive( false ) ;
|
mainmenu_items[MENU_DEVICE]->set_sensitive(false);
|
||||||
menubar_main .items()[ 4 ] .set_sensitive( false ) ;
|
mainmenu_items[MENU_PARTITION]->set_sensitive(false);
|
||||||
toolbar_main .set_sensitive( false ) ;
|
toolbar_main .set_sensitive( false ) ;
|
||||||
drawingarea_visualdisk .set_sensitive( false ) ;
|
drawingarea_visualdisk .set_sensitive( false ) ;
|
||||||
treeview_detail .set_sensitive( false ) ;
|
treeview_detail .set_sensitive( false ) ;
|
||||||
|
@ -1550,11 +1609,11 @@ void Win_GParted::menu_gparted_refresh_devices()
|
||||||
{
|
{
|
||||||
combo_devices .show() ;
|
combo_devices .show() ;
|
||||||
|
|
||||||
menubar_main .items()[ 0 ] .get_submenu() ->items()[ 1 ] .set_sensitive( true ) ;
|
mainmenu_items[MENU_DEVICES]->set_sensitive(true);
|
||||||
menubar_main .items()[ 1 ] .set_sensitive( true ) ;
|
mainmenu_items[MENU_EDIT]->set_sensitive(true);
|
||||||
menubar_main .items()[ 2 ] .set_sensitive( true ) ;
|
mainmenu_items[MENU_VIEW]->set_sensitive(true);
|
||||||
menubar_main .items()[ 3 ] .set_sensitive( true ) ;
|
mainmenu_items[MENU_DEVICE]->set_sensitive(true);
|
||||||
menubar_main .items()[ 4 ] .set_sensitive( true ) ;
|
mainmenu_items[MENU_PARTITION]->set_sensitive(true);
|
||||||
|
|
||||||
toolbar_main .set_sensitive( true ) ;
|
toolbar_main .set_sensitive( true ) ;
|
||||||
drawingarea_visualdisk .set_sensitive( true ) ;
|
drawingarea_visualdisk .set_sensitive( true ) ;
|
||||||
|
@ -1592,9 +1651,9 @@ void Win_GParted::menu_gparted_features()
|
||||||
dialog.load_filesystems( show_fs_actions );
|
dialog.load_filesystems( show_fs_actions );
|
||||||
|
|
||||||
//recreate format menu...
|
//recreate format menu...
|
||||||
menu_partition.items()[MENU_FORMAT].unset_submenu();
|
partitionmenu_items[MENU_FORMAT]->unset_submenu();
|
||||||
menu_partition .items()[ MENU_FORMAT ] .set_submenu( * create_format_menu() ) ;
|
partitionmenu_items[MENU_FORMAT]->set_submenu(*create_format_menu());
|
||||||
menu_partition .items()[ MENU_FORMAT ] .get_submenu() ->show_all_children() ;
|
partitionmenu_items[MENU_FORMAT]->get_submenu()->show_all_children();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1606,7 +1665,7 @@ void Win_GParted::menu_gparted_quit()
|
||||||
|
|
||||||
void Win_GParted::menu_view_harddisk_info()
|
void Win_GParted::menu_view_harddisk_info()
|
||||||
{
|
{
|
||||||
if ( static_cast<Gtk::CheckMenuItem *>( & menubar_main .items()[ 2 ] .get_submenu() ->items()[ 0 ] ) ->get_active() )
|
if (static_cast<Gtk::CheckMenuItem *>(mainmenu_items[MENU_DEVICE_INFORMATION])->get_active())
|
||||||
{ //open harddisk information
|
{ //open harddisk information
|
||||||
hpaned_main .get_child1() ->show() ;
|
hpaned_main .get_child1() ->show() ;
|
||||||
for ( int t = hpaned_main .get_position() ; t < 250 ; t += 15 )
|
for ( int t = hpaned_main .get_position() ; t < 250 ; t += 15 )
|
||||||
|
@ -1630,7 +1689,7 @@ void Win_GParted::menu_view_harddisk_info()
|
||||||
|
|
||||||
void Win_GParted::menu_view_operations()
|
void Win_GParted::menu_view_operations()
|
||||||
{
|
{
|
||||||
if ( static_cast<Gtk::CheckMenuItem *>( & menubar_main .items()[ 2 ] .get_submenu() ->items()[ 1 ] ) ->get_active() )
|
if (static_cast<Gtk::CheckMenuItem *>(mainmenu_items[MENU_PENDING_OPERATIONS])->get_active())
|
||||||
open_operationslist() ;
|
open_operationslist() ;
|
||||||
else
|
else
|
||||||
close_operationslist() ;
|
close_operationslist() ;
|
||||||
|
|
Loading…
Reference in New Issue