prepare-for-gtk3: Prepare for removal of Gtk::Menu_Helpers::Element (#7)
Gtk::Menu_Helpers::Element class and subclasses help in Gtk::MenuItem
widgets and also automate tasks like registering keyboard accelerators
when parented to a top-level window [1][2].
Gtk::Menu_Helpers::Element class and subclasses were removed in Gtkmm3
[3]. Provide compatible implementations under the namespace
GParted::Menu_Helpers.
References:
[1] gtkmm: Gtk::Menu_Helpers Namespace Reference
https://developer.gnome.org/gtkmm/2.24/namespaceGtk_1_1Menu__Helpers.html
[2] gtkmm: Gtk::Menu_Helpers::Element Class Reference
https://developer.gnome.org/gtkmm/2.24/classGtk_1_1Menu__Helpers_1_1Element.html
[3] Gtkmm 3 commit "MenuShell: Remove items()." removed the code
c8e47b0db5
Closes #7 - Port to Gtk3
This commit is contained in:
parent
a44d548a3a
commit
eb30c959a6
|
@ -27,6 +27,7 @@ EXTRA_DIST = \
|
|||
HBoxOperations.h \
|
||||
LVM2_PV_Info.h \
|
||||
LUKS_Info.h \
|
||||
MenuHelpers.h \
|
||||
Mount_Info.h \
|
||||
Operation.h \
|
||||
OperationChangeUUID.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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GPARTED_MENUHELPERS_H
|
||||
#define GPARTED_MENUHELPERS_H
|
||||
|
||||
#include <glibmm/ustring.h>
|
||||
#include <gtkmm/menu.h>
|
||||
#include <gtkmm/menuitem.h>
|
||||
#include <gtkmm/imagemenuitem.h>
|
||||
#include <gtkmm/separatormenuitem.h>
|
||||
#include <gtkmm/checkmenuitem.h>
|
||||
|
||||
namespace GParted
|
||||
{
|
||||
namespace Menu_Helpers
|
||||
{
|
||||
typedef sigc::slot<void> 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 */
|
|
@ -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
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
|
||||
#include "HBoxOperations.h"
|
||||
#include "MenuHelpers.h"
|
||||
|
||||
#include <gtkmm/stock.h>
|
||||
|
||||
|
@ -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<Operation *> operations )
|
||||
|
|
|
@ -37,6 +37,7 @@ gpartedbin_SOURCES = \
|
|||
HBoxOperations.cc \
|
||||
LVM2_PV_Info.cc \
|
||||
LUKS_Info.cc \
|
||||
MenuHelpers.cc \
|
||||
Mount_Info.cc \
|
||||
Operation.cc \
|
||||
OperationChangeUUID.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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "MenuHelpers.h"
|
||||
|
||||
#include <gtkmm/imagemenuitem.h>
|
||||
#include <gtkmm/checkmenuitem.h>
|
||||
#include <gtkmm/separatormenuitem.h>
|
||||
|
||||
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
|
|
@ -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("<control>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("<control>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<Glib::ustring> 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<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))));
|
||||
|
||||
dynamic_cast<Gtk::Label*>( menu ->items() .back() .get_child() ) ->set_use_underline( false ) ;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue