diff --git a/include/Makefile.am b/include/Makefile.am index 1601a5bf..237a1fce 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -27,6 +27,7 @@ EXTRA_DIST = \ HBoxOperations.h \ LVM2_PV_Info.h \ LUKS_Info.h \ + MenuHelpers.h \ Mount_Info.h \ Operation.h \ OperationChangeUUID.h \ diff --git a/include/MenuHelpers.h b/include/MenuHelpers.h new file mode 100644 index 00000000..b41fd675 --- /dev/null +++ b/include/MenuHelpers.h @@ -0,0 +1,103 @@ +/* Copyright (C) 2018 Luca Bacci + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + + +#ifndef GPARTED_MENUHELPERS_H +#define GPARTED_MENUHELPERS_H + +#include +#include +#include +#include +#include +#include + +namespace GParted +{ +namespace Menu_Helpers +{ +typedef sigc::slot CallSlot; + + +class MenuElem + : public Gtk::MenuItem +{ +public: + MenuElem(const Glib::ustring& label, + const Gtk::AccelKey& key, + const CallSlot& slot = CallSlot()); + MenuElem(const Glib::ustring& label, + const CallSlot& slot = CallSlot()); + MenuElem(const Glib::ustring& label, + Gtk::Menu& submenu); +}; + + +class ImageMenuElem + : public Gtk::ImageMenuItem +{ +public: + ImageMenuElem(const Glib::ustring& label, + const Gtk::AccelKey& key, + Gtk::Widget& image_widget, + const CallSlot& slot = CallSlot()); + ImageMenuElem(const Glib::ustring& label, + Gtk::Widget& image_widget, + const CallSlot& slot = CallSlot()); + ImageMenuElem(const Glib::ustring& label, + Gtk::Widget& image_widget, + Gtk::Menu& submenu); +}; + + +class SeparatorElem + : public Gtk::SeparatorMenuItem +{ +public: + SeparatorElem(); +}; + + +class StockMenuElem + : public Gtk::ImageMenuItem +{ +public: + StockMenuElem(const Gtk::StockID& stock_id, + const Gtk::AccelKey& key, + const CallSlot& slot = CallSlot()); + StockMenuElem(const Gtk::StockID& stock_id, + const CallSlot& slot = CallSlot()); + StockMenuElem(const Gtk::StockID& stock_id, + Gtk::Menu& submenu); +}; + + +class CheckMenuElem + : public Gtk::CheckMenuItem +{ +public: + CheckMenuElem(const Glib::ustring& label, + const Gtk::AccelKey& key, + const CallSlot& slot = CallSlot()); + CheckMenuElem(const Glib::ustring& label, + const CallSlot& slot = CallSlot()); +}; + + +}//Menu_Helpers +}//GParted + +#endif /* GPARTED_MENUHELPERS_H */ diff --git a/po/POTFILES.in b/po/POTFILES.in index 9d08b7db..390ebe1f 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -25,6 +25,7 @@ src/GParted_Core.cc src/HBoxOperations.cc src/LVM2_PV_Info.cc src/LUKS_Info.cc +src/MenuHelpers.cc src/Mount_Info.cc src/OperationChangeUUID.cc src/OperationCopy.cc diff --git a/src/HBoxOperations.cc b/src/HBoxOperations.cc index 5858ed1c..30e1fa55 100644 --- a/src/HBoxOperations.cc +++ b/src/HBoxOperations.cc @@ -15,6 +15,7 @@ */ #include "HBoxOperations.h" +#include "MenuHelpers.h" #include @@ -40,24 +41,24 @@ HBoxOperations::HBoxOperations() pack_start( scrollwindow, Gtk::PACK_EXPAND_WIDGET ); //create popupmenu - menu_popup .items() .push_back( Gtk::Menu_Helpers::ImageMenuElem( + menu_popup.append(*manage(new GParted::Menu_Helpers::ImageMenuElem( _("_Undo Last Operation"), * 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 .items() .push_back( Gtk::Menu_Helpers::ImageMenuElem( + menu_popup.append(*manage(new GParted::Menu_Helpers::ImageMenuElem( _("_Clear All Operations"), * 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 .items() .push_back( Gtk::Menu_Helpers::ImageMenuElem( + menu_popup.append(*manage(new GParted::Menu_Helpers::ImageMenuElem( _("_Apply All Operations"), * 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 .items() .push_back( Gtk::Menu_Helpers::SeparatorElem() ); - menu_popup .items() .push_back( Gtk::Menu_Helpers::StockMenuElem( - Gtk::Stock::CLOSE, sigc::mem_fun(*this, &HBoxOperations::on_close) ) ); + menu_popup.append(*manage(new GParted::Menu_Helpers::SeparatorElem())); + menu_popup.append(*manage(new GParted::Menu_Helpers::StockMenuElem( + Gtk::Stock::CLOSE, sigc::mem_fun(*this, &HBoxOperations::on_close)))); } void HBoxOperations::load_operations( const std::vector operations ) diff --git a/src/Makefile.am b/src/Makefile.am index 33f8c5bd..6fa1a752 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -37,6 +37,7 @@ gpartedbin_SOURCES = \ HBoxOperations.cc \ LVM2_PV_Info.cc \ LUKS_Info.cc \ + MenuHelpers.cc \ Mount_Info.cc \ Operation.cc \ OperationChangeUUID.cc \ diff --git a/src/MenuHelpers.cc b/src/MenuHelpers.cc new file mode 100644 index 00000000..d71f8a92 --- /dev/null +++ b/src/MenuHelpers.cc @@ -0,0 +1,170 @@ +/* Copyright (C) 2018 Luca Bacci + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "MenuHelpers.h" + +#include +#include +#include + +namespace GParted +{ +namespace Menu_Helpers +{ + + +MenuElem::MenuElem(const Glib::ustring& label, + const Gtk::AccelKey& key, + const CallSlot& slot) + : Gtk::MenuItem(label, true) +{ + if (slot) + signal_activate().connect(slot); + + set_accel_key(key); + + show_all(); +} + + +MenuElem::MenuElem(const Glib::ustring & label, + const CallSlot & slot) + : Gtk::MenuItem(label, true) +{ + if (slot) + signal_activate().connect(slot); + + show_all(); +} + + +MenuElem::MenuElem(const Glib::ustring & label, + Gtk::Menu & submenu) + : Gtk::MenuItem(label, true) +{ + set_submenu(submenu); + + show_all(); +} + + +ImageMenuElem::ImageMenuElem(const Glib::ustring& label, + const Gtk::AccelKey& key, + Gtk::Widget& image_widget, + const CallSlot& slot) + : ImageMenuItem(image_widget, label, true) +{ + if (slot) + signal_activate().connect(slot); + + set_accel_key(key); + + show_all(); +} + + +ImageMenuElem::ImageMenuElem(const Glib::ustring& label, + Gtk::Widget& image_widget, + const CallSlot& slot) + : ImageMenuItem(image_widget, label, true) +{ + if (slot) + signal_activate().connect(slot); + + show_all(); +} + + +ImageMenuElem::ImageMenuElem(const Glib::ustring& label, + Gtk::Widget& image_widget, + Gtk::Menu& submenu) + : ImageMenuItem(image_widget, label, true) +{ + set_submenu(submenu); + + show_all(); +} + + +SeparatorElem::SeparatorElem() + : Gtk::SeparatorMenuItem() +{ + show_all(); +} + + +StockMenuElem::StockMenuElem(const Gtk::StockID& stock_id, + const Gtk::AccelKey& key, + const CallSlot& slot) + : Gtk::ImageMenuItem(stock_id) +{ + if (slot) + signal_activate().connect(slot); + + set_accel_key(key); + + show_all(); +} + + +StockMenuElem::StockMenuElem(const Gtk::StockID& stock_id, + const CallSlot& slot) + : Gtk::ImageMenuItem(stock_id) +{ + if (slot) + signal_activate().connect(slot); + + show_all(); +} + + +StockMenuElem::StockMenuElem(const Gtk::StockID& stock_id, + Gtk::Menu& submenu) + : Gtk::ImageMenuItem(stock_id) +{ + set_submenu(submenu); + + show_all(); +} + + +CheckMenuElem::CheckMenuElem(const Glib::ustring& label, + const Gtk::AccelKey& key, + const CallSlot& slot) + : Gtk::CheckMenuItem(label, true) +{ + if (slot) + signal_activate().connect(slot); + + set_accel_key(key); + + show_all(); +} + + +CheckMenuElem::CheckMenuElem(const Glib::ustring& label, + const CallSlot& slot) + : Gtk::CheckMenuItem(label, true) +{ + if (slot) + signal_activate().connect(slot); + + show_all(); +} + + +} //Menu_Helpers +} //GParted diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc index 41a5bee4..2a744da8 100644 --- a/src/Win_GParted.cc +++ b/src/Win_GParted.cc @@ -29,6 +29,7 @@ #include "Dialog_Partition_Name.h" #include "DialogManageFlags.h" #include "GParted_Core.h" +#include "MenuHelpers.h" #include "Mount_Info.h" #include "OperationCopy.h" #include "OperationCheck.h" @@ -156,78 +157,87 @@ void Win_GParted::init_menubar() //gparted 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( + menu->append(*manage(new GParted::Menu_Helpers::ImageMenuElem( _("_Refresh Devices"), Gtk::AccelKey("r"), *image, - sigc::mem_fun(*this, &Win_GParted::menu_gparted_refresh_devices) ) ); + sigc::mem_fun(*this, &Win_GParted::menu_gparted_refresh_devices)))); image = manage( new Gtk::Image( Gtk::Stock::HARDDISK, Gtk::ICON_SIZE_MENU ) ); - menu ->items() .push_back( Gtk::Menu_Helpers::ImageMenuElem( _("_Devices"), *image ) ) ; + menu->append(*manage(new GParted::Menu_Helpers::ImageMenuElem( + _("_Devices"), *image))); - 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->append(*manage(new GParted::Menu_Helpers::SeparatorElem())); + menu->append(*manage(new GParted::Menu_Helpers::StockMenuElem( + Gtk::Stock::QUIT, sigc::mem_fun(*this, &Win_GParted::menu_gparted_quit)))); + menubar_main.append(*manage(new GParted::Menu_Helpers::MenuElem( + _("_GParted"), *menu))); //edit menu = manage( new Gtk::Menu() ) ; - menu ->items() .push_back( Gtk::Menu_Helpers::ImageMenuElem( + menu->append(*manage(new GParted::Menu_Helpers::ImageMenuElem( _("_Undo Last Operation"), Gtk::AccelKey("z"), * 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 ->items() .push_back( Gtk::Menu_Helpers::ImageMenuElem( + menu->append(*manage(new GParted::Menu_Helpers::ImageMenuElem( _("_Clear All Operations"), * 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 ->items() .push_back( Gtk::Menu_Helpers::ImageMenuElem( + menu->append(*manage(new GParted::Menu_Helpers::ImageMenuElem( _("_Apply All Operations"), Gtk::AccelKey(GDK_KEY_Return, Gdk::CONTROL_MASK), * manage( new Gtk::Image( Gtk::Stock::APPLY, Gtk::ICON_SIZE_MENU ) ), - sigc::mem_fun(*this, &Win_GParted::activate_apply) ) ); - menubar_main .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("_Edit"), *menu ) ); + sigc::mem_fun(*this, &Win_GParted::activate_apply)))); + menubar_main.append(*manage(new GParted::Menu_Helpers::MenuElem( + _("_Edit"), *menu))); //view menu = manage( new Gtk::Menu() ) ; - menu ->items() .push_back( Gtk::Menu_Helpers::CheckMenuElem( - _("Device _Information"), sigc::mem_fun(*this, &Win_GParted::menu_view_harddisk_info) ) ); - menu ->items() .push_back( Gtk::Menu_Helpers::CheckMenuElem( - _("Pending _Operations"), sigc::mem_fun(*this, &Win_GParted::menu_view_operations) ) ); - menubar_main .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("_View"), *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 ->items() .push_back( Gtk::Menu_Helpers::SeparatorElem( ) ); - menu ->items() .push_back( Gtk::Menu_Helpers::MenuElem( - _("_File System Support"), sigc::mem_fun( *this, &Win_GParted::menu_gparted_features ) ) ); + menu->append(*manage(new GParted::Menu_Helpers::SeparatorElem())); + menu->append(*manage(new GParted::Menu_Helpers::MenuElem( + _("_File System Support"), sigc::mem_fun(*this, &Win_GParted::menu_gparted_features)))); //device menu = manage( new Gtk::Menu() ) ; - menu ->items() .push_back( Gtk::Menu_Helpers::MenuElem( Glib::ustring( _("_Create Partition Table") ) + "...", - sigc::mem_fun(*this, &Win_GParted::activate_disklabel) ) ); + menu->append(*manage(new GParted::Menu_Helpers::MenuElem( + Glib::ustring(_("_Create Partition Table") ) + "...", + sigc::mem_fun(*this, &Win_GParted::activate_disklabel)))); - menu ->items() .push_back( Gtk::Menu_Helpers::MenuElem( Glib::ustring( _("_Attempt Data Rescue") ) + "...", - sigc::mem_fun(*this, &Win_GParted::activate_attempt_rescue_data) ) ); + menu->append(*manage(new GParted::Menu_Helpers::MenuElem( + Glib::ustring(_("_Attempt Data Rescue") ) + "...", + sigc::mem_fun(*this, &Win_GParted::activate_attempt_rescue_data)))); - menubar_main .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("_Device"), *menu ) ); + menubar_main.append(*manage(new GParted::Menu_Helpers::MenuElem( + _("_Device"), *menu))); //partition init_partition_menu() ; - menubar_main .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("_Partition"), menu_partition ) ); + menubar_main.append(*manage(new GParted::Menu_Helpers::MenuElem( + _("_Partition"), menu_partition))); //help menu = manage( new Gtk::Menu() ) ; - menu ->items() .push_back( Gtk::Menu_Helpers::ImageMenuElem( + menu->append(*manage(new GParted::Menu_Helpers::ImageMenuElem( _("_Contents"), Gtk::AccelKey("F1"), * manage( new Gtk::Image( Gtk::Stock::HELP, Gtk::ICON_SIZE_MENU ) ), - sigc::mem_fun(*this, &Win_GParted::menu_help_contents) ) ); - menu ->items() .push_back( Gtk::Menu_Helpers::SeparatorElem( ) ); - menu ->items() .push_back( Gtk::Menu_Helpers::StockMenuElem( - Gtk::Stock::ABOUT, sigc::mem_fun(*this, &Win_GParted::menu_help_about) ) ); + sigc::mem_fun(*this, &Win_GParted::menu_help_contents)))); + menu->append(*manage(new GParted::Menu_Helpers::SeparatorElem())); + menu->append(*manage(new GParted::Menu_Helpers::StockMenuElem( + Gtk::Stock::ABOUT, sigc::mem_fun(*this, &Win_GParted::menu_help_about)))); - menubar_main.items() .push_back( Gtk::Menu_Helpers::MenuElem(_("_Help"), *menu ) ); + menubar_main.append(*manage(new GParted::Menu_Helpers::MenuElem( + _("_Help"), *menu))); } void Win_GParted::init_toolbar() @@ -327,108 +337,108 @@ void Win_GParted::init_partition_menu() //fill menu_partition image = manage( new Gtk::Image( Gtk::Stock::NEW, Gtk::ICON_SIZE_MENU ) ); - menu_partition .items() .push_back( + menu_partition.append(*manage(new /*TO TRANSLATORS: "_New" is a sub menu item for the partition menu. */ - Gtk::Menu_Helpers::ImageMenuElem( _("_New"), + GParted::Menu_Helpers::ImageMenuElem(_("_New"), Gtk::AccelKey(GDK_KEY_Insert, Gdk::BUTTON1_MASK), *image, - sigc::mem_fun(*this, &Win_GParted::activate_new) ) ); + sigc::mem_fun(*this, &Win_GParted::activate_new)))); MENU_NEW = index++ ; - - menu_partition .items() .push_back( - Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::DELETE, + + menu_partition.append(*manage(new + GParted::Menu_Helpers::StockMenuElem(Gtk::Stock::DELETE, 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 .items() .push_back( Gtk::Menu_Helpers::SeparatorElem() ); + menu_partition.append(*manage(new GParted::Menu_Helpers::SeparatorElem())); index++ ; image = manage( new Gtk::Image( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_MENU ) ); - menu_partition .items() .push_back( - Gtk::Menu_Helpers::ImageMenuElem( _("_Resize/Move"), + menu_partition.append(*manage(new + GParted::Menu_Helpers::ImageMenuElem(_("_Resize/Move"), *image, - sigc::mem_fun(*this, &Win_GParted::activate_resize) ) ); + sigc::mem_fun(*this, &Win_GParted::activate_resize)))); MENU_RESIZE_MOVE = index++ ; - menu_partition .items() .push_back( Gtk::Menu_Helpers::SeparatorElem() ); + menu_partition.append(*manage(new GParted::Menu_Helpers::SeparatorElem())); index++ ; - menu_partition .items() .push_back( - Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::COPY, - sigc::mem_fun(*this, &Win_GParted::activate_copy) ) ); + menu_partition.append(*manage(new + GParted::Menu_Helpers::StockMenuElem(Gtk::Stock::COPY, + sigc::mem_fun(*this, &Win_GParted::activate_copy)))); MENU_COPY = index++ ; - menu_partition .items() .push_back( - Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::PASTE, - sigc::mem_fun(*this, &Win_GParted::activate_paste) ) ); + menu_partition.append(*manage(new + GParted::Menu_Helpers::StockMenuElem(Gtk::Stock::PASTE, + sigc::mem_fun(*this, &Win_GParted::activate_paste)))); MENU_PASTE = index++ ; - menu_partition .items() .push_back( Gtk::Menu_Helpers::SeparatorElem() ); + menu_partition.append(*manage(new GParted::Menu_Helpers::SeparatorElem())); index++ ; image = manage( new Gtk::Image( Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU ) ); - menu_partition .items() .push_back( + menu_partition.append(*manage(new /*TO TRANSLATORS: menuitem which holds a submenu with file systems.. */ - Gtk::Menu_Helpers::ImageMenuElem( _("_Format to"), + GParted::Menu_Helpers::ImageMenuElem(_("_Format to"), *image, - * create_format_menu() ) ) ; + *create_format_menu()))); MENU_FORMAT = index++ ; - menu_partition .items() .push_back( Gtk::Menu_Helpers::SeparatorElem() ) ; + menu_partition.append(*manage(new GParted::Menu_Helpers::SeparatorElem())); index++ ; - menu_partition.items().push_back( + menu_partition.append(*manage(new // Placeholder text, replaced in set_valid_operations() before the menu is shown - Gtk::Menu_Helpers::MenuElem( "--toggle crypt busy--", - sigc::mem_fun( *this, &Win_GParted::toggle_crypt_busy_state ) ) ); + GParted::Menu_Helpers::MenuElem("--toggle crypt busy--", + sigc::mem_fun(*this, &Win_GParted::toggle_crypt_busy_state)))); MENU_TOGGLE_CRYPT_BUSY = index++; - menu_partition .items() .push_back( + menu_partition.append(*manage(new // Placeholder text, replaced in set_valid_operations() before the menu is shown - Gtk::Menu_Helpers::MenuElem( "--toggle fs busy--", - sigc::mem_fun( *this, &Win_GParted::toggle_fs_busy_state ) ) ); + GParted::Menu_Helpers::MenuElem("--toggle fs busy--", + sigc::mem_fun(*this, &Win_GParted::toggle_fs_busy_state)))); MENU_TOGGLE_FS_BUSY = index++; - menu_partition .items() .push_back( + menu_partition.append(*manage(new /*TO TRANSLATORS: menuitem which holds a submenu with mount points.. */ - Gtk::Menu_Helpers::MenuElem( _("_Mount on"), * manage( new Gtk::Menu() ) ) ) ; + GParted::Menu_Helpers::MenuElem(_("_Mount on"), *manage(new Gtk::Menu())))); MENU_MOUNT = index++ ; - menu_partition .items() .push_back( Gtk::Menu_Helpers::SeparatorElem() ) ; + menu_partition.append(*manage(new GParted::Menu_Helpers::SeparatorElem())); index++ ; - menu_partition.items().push_back( - Gtk::Menu_Helpers::MenuElem( _("_Name Partition"), - sigc::mem_fun( *this, &Win_GParted::activate_name_partition ) ) ); + menu_partition.append(*manage(new + GParted::Menu_Helpers::MenuElem(_("_Name Partition"), + sigc::mem_fun(*this, &Win_GParted::activate_name_partition)))); MENU_NAME_PARTITION = index++; - menu_partition .items() .push_back( - Gtk::Menu_Helpers::MenuElem( _("M_anage Flags"), - sigc::mem_fun( *this, &Win_GParted::activate_manage_flags ) ) ); + menu_partition.append(*manage(new + GParted::Menu_Helpers::MenuElem(_("M_anage Flags"), + sigc::mem_fun(*this, &Win_GParted::activate_manage_flags)))); MENU_FLAGS = index++ ; - menu_partition .items() .push_back( - Gtk::Menu_Helpers::MenuElem( _("C_heck"), - sigc::mem_fun( *this, &Win_GParted::activate_check ) ) ); + menu_partition.append(*manage(new + GParted::Menu_Helpers::MenuElem(_("C_heck"), + sigc::mem_fun(*this, &Win_GParted::activate_check)))); MENU_CHECK = index++ ; - menu_partition .items() .push_back( - Gtk::Menu_Helpers::MenuElem( _("_Label File System"), - sigc::mem_fun( *this, &Win_GParted::activate_label_filesystem ) ) ); + menu_partition.append(*manage(new + GParted::Menu_Helpers::MenuElem(_("_Label File System"), + sigc::mem_fun(*this, &Win_GParted::activate_label_filesystem)))); MENU_LABEL_PARTITION = index++ ; - menu_partition .items() .push_back( - Gtk::Menu_Helpers::MenuElem( _("New UU_ID"), - sigc::mem_fun( *this, &Win_GParted::activate_change_uuid ) ) ); + menu_partition.append(*manage(new + GParted::Menu_Helpers::MenuElem(_("New UU_ID"), + sigc::mem_fun(*this, &Win_GParted::activate_change_uuid)))); MENU_CHANGE_UUID = index++ ; - menu_partition .items() .push_back( Gtk::Menu_Helpers::SeparatorElem() ) ; + menu_partition.append(*manage(new GParted::Menu_Helpers::SeparatorElem())); index++ ; - menu_partition .items() .push_back( - Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::DIALOG_INFO, - sigc::mem_fun(*this, &Win_GParted::activate_info) ) ); + menu_partition.append(*manage(new + GParted::Menu_Helpers::StockMenuElem(Gtk::Stock::DIALOG_INFO, + sigc::mem_fun(*this, &Win_GParted::activate_info)))); MENU_INFO = index++ ; menu_partition .accelerate( *this ) ; @@ -1332,10 +1342,10 @@ void Win_GParted::set_valid_operations() std::vector temp_mountpoints = selected_filesystem.get_mountpoints(); for ( unsigned int t = 0 ; t < temp_mountpoints.size() ; t++ ) { - menu ->items() .push_back( - Gtk::Menu_Helpers::MenuElem( + menu->append(*manage(new + GParted::Menu_Helpers::MenuElem( temp_mountpoints[t], - sigc::bind( sigc::mem_fun(*this, &Win_GParted::activate_mount_partition), t ) ) ); + sigc::bind(sigc::mem_fun(*this, &Win_GParted::activate_mount_partition), t)))); dynamic_cast( menu ->items() .back() .get_child() ) ->set_use_underline( false ) ; }