Ensure icon sizes (#39)

Some icon themes only provide large icons for stock items.  This can
cause problems like overly large icons appearing in the GParted UI.
Found on Kubuntu 16.04 LTS with default breeze icon theme.

Be compatible with these icon themes by forcing scaling of stock icons
to the requested size.

Icons are used either by Gtk::Image widgets, or Gtk::CellRendererPixbuf
objects for comboboxes/treeviews.  For Gtk::Image widgets we add
Utils::mk_image() that constructs Gtk::Image widgets and then sets the
pixel-size property.  For Gtk::CellRendererPixbuf we add
Utils::mk_pixbuf() that first loads a Gdk::Pixbuf and then scales if
needed.

Closes #39 - After GTK3 port icons are too big on KDE
This commit is contained in:
Luca Bacci 2019-03-27 14:07:39 +01:00 committed by Mike Fleetwood
parent 23f956bb83
commit f252e677d4
13 changed files with 167 additions and 58 deletions

View File

@ -39,7 +39,6 @@ public:
Glib::ustring Get_Disklabel( ) ;
private:
Gtk::Image image ;
Gtk::ComboBoxText combo_labeltypes ;
std::vector<Glib::ustring> labeltypes ;
};

View File

@ -27,6 +27,8 @@
#include "i18n.h"
#include <gtkmm/label.h>
#include <gtkmm/image.h>
#include <gdkmm/pixbuf.h>
#include <glibmm/ustring.h>
#include <glibmm/spawn.h>
#include <iostream>
@ -128,6 +130,11 @@ public:
, bool selectable = false
, Gtk::Align yalign = Gtk::ALIGN_CENTER
) ;
static Gtk::Image* mk_image(const Gtk::StockID& stock_id, Gtk::IconSize icon_size);
static Glib::RefPtr<Gdk::Pixbuf> mk_pixbuf(Gtk::Widget& widget,
const Gtk::StockID& stock_id,
Gtk::IconSize icon_size);
static Glib::ustring get_stock_label(const Gtk::StockID& stock_id);
static Glib::ustring num_to_str( Sector number ) ;
static Glib::ustring get_color( FSType filesystem );
static Glib::RefPtr<Gdk::Pixbuf> get_color_as_pixbuf( FSType filesystem, int width, int height );

View File

@ -18,6 +18,7 @@
#include "DialogFeatures.h"
#include "FileSystem.h"
#include "GParted_Core.h"
#include "Utils.h"
#include <gtkmm/stock.h>
@ -31,8 +32,8 @@ DialogFeatures::DialogFeatures()
set_size_request( -1, 500 ) ;
//initialize icons
icon_yes = render_icon_pixbuf(Gtk::Stock::APPLY, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_no = render_icon_pixbuf(Gtk::Stock::CANCEL, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_yes = Utils::mk_pixbuf(*this, Gtk::Stock::APPLY, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_no = Utils::mk_pixbuf(*this, Gtk::Stock::CANCEL, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_blank = Gdk::Pixbuf::create( Gdk::COLORSPACE_RGB, true, 8,
icon_yes ->get_width(), icon_yes ->get_height() );
icon_blank ->fill( 0xFFFFFF00 );

View File

@ -17,6 +17,8 @@
#include "Dialog_Base_Partition.h"
#include "Partition.h"
#include "Utils.h"
namespace GParted
{
@ -248,7 +250,7 @@ void Dialog_Base_Partition::Set_Confirm_Button( CONFIRMBUTTON button_type )
break ;
case RESIZE_MOVE:
{
Gtk::Image* image_temp(manage(new Gtk::Image(Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_BUTTON)));
Gtk::Image* image_temp = Utils::mk_image(Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_BUTTON);
Gtk::HBox* hbox_resize_move(manage(new Gtk::HBox()));
hbox_resize_move->pack_start(*image_temp, Gtk::PACK_EXPAND_PADDING);

View File

@ -17,12 +17,13 @@
#include "Dialog_Disklabel.h"
#include "GParted_Core.h"
#include "Utils.h"
namespace GParted
{
Dialog_Disklabel::Dialog_Disklabel( const Device & device )
: image(Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_DIALOG)
{
const Glib::ustring device_path = device .get_path() ;
@ -40,7 +41,8 @@ Dialog_Disklabel::Dialog_Disklabel( const Device & device )
vbox->set_border_width(10);
hbox->pack_start(*vbox, Gtk::PACK_SHRINK);
vbox->pack_start(image, Gtk::PACK_SHRINK);
Gtk::Image* image(Utils::mk_image(Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_DIALOG));
vbox->pack_start(*image, Gtk::PACK_SHRINK);
vbox = manage(new Gtk::VBox());
vbox->set_border_width(10);

View File

@ -72,7 +72,7 @@ Dialog_Partition_Info::Dialog_Partition_Info( const Partition & partition ) : pa
frame = manage( new Gtk::Frame() );
{
Gtk::Image* image(manage(new Gtk::Image(Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_BUTTON)));
Gtk::Image* image = Utils::mk_image(Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_BUTTON);
hbox = manage(new Gtk::HBox());
hbox->pack_start(*image, Gtk::PACK_SHRINK);

View File

@ -19,6 +19,7 @@
#include "GParted_Core.h"
#include "OperationDetail.h"
#include "ProgressBar.h"
#include "Utils.h"
#include <glibmm/miscutils.h>
#include <glibmm/main.h>
@ -71,11 +72,11 @@ Dialog_Progress::Dialog_Progress( const std::vector<Operation *> & operations )
vbox->pack_start(progressbar_all, Gtk::PACK_SHRINK);
//create some icons here, instead of recreating them every time
icon_execute = render_icon_pixbuf(Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_success = render_icon_pixbuf(Gtk::Stock::APPLY, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_error = render_icon_pixbuf(Gtk::Stock::DIALOG_ERROR, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_info = render_icon_pixbuf(Gtk::Stock::INFO, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_warning = render_icon_pixbuf(Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_execute = Utils::mk_pixbuf(*this, Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_success = Utils::mk_pixbuf(*this, Gtk::Stock::APPLY, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_error = Utils::mk_pixbuf(*this, Gtk::Stock::DIALOG_ERROR, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_info = Utils::mk_pixbuf(*this, Gtk::Stock::INFO, Gtk::ICON_SIZE_LARGE_TOOLBAR);
icon_warning = Utils::mk_pixbuf(*this, Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_LARGE_TOOLBAR);
treestore_operations = Gtk::TreeStore::create( treeview_operations_columns);
treeview_operations.set_model(treestore_operations);

View File

@ -87,7 +87,7 @@ void Dialog_Rescue_Data::draw_dialog()
info_txt+=_("All mounted views will be unmounted when you close this dialog.");
Gtk::HBox *infoBox=manage(new Gtk::HBox());
Gtk::Image *infoImg=manage(new Gtk::Image( Gtk::Stock::DIALOG_INFO, Gtk::ICON_SIZE_DIALOG));
Gtk::Image *infoImg = Utils::mk_image(Gtk::Stock::DIALOG_INFO, Gtk::ICON_SIZE_DIALOG);
Gtk::Label *infoLabel= manage(new Gtk::Label (info_txt));
infoBox->pack_start(*infoImg, Gtk::PACK_SHRINK, 5);

View File

@ -16,6 +16,7 @@
#include "HBoxOperations.h"
#include "MenuHelpers.h"
#include "Utils.h"
#include <gtkmm/stock.h>
@ -44,21 +45,21 @@ HBoxOperations::HBoxOperations()
Gtk::MenuItem *item;
item = manage(new GParted::Menu_Helpers::ImageMenuElem(
_("_Undo Last Operation"),
* manage( new Gtk::Image( Gtk::Stock::UNDO, Gtk::ICON_SIZE_MENU ) ),
*Utils::mk_image(Gtk::Stock::UNDO, Gtk::ICON_SIZE_MENU),
sigc::mem_fun(*this, &HBoxOperations::on_undo)));
menu_popup.append(*item);
menu_popup_items[0] = item;
item = manage(new GParted::Menu_Helpers::ImageMenuElem(
_("_Clear All Operations"),
* manage( new Gtk::Image( Gtk::Stock::CLEAR, Gtk::ICON_SIZE_MENU ) ),
*Utils::mk_image(Gtk::Stock::CLEAR, Gtk::ICON_SIZE_MENU),
sigc::mem_fun(*this, &HBoxOperations::on_clear)));
menu_popup.append(*item);
menu_popup_items[1] = item;
item = manage(new GParted::Menu_Helpers::ImageMenuElem(
_("_Apply All Operations"),
* manage( new Gtk::Image( Gtk::Stock::APPLY, Gtk::ICON_SIZE_MENU ) ),
*Utils::mk_image(Gtk::Stock::APPLY, Gtk::ICON_SIZE_MENU),
sigc::mem_fun(*this, &HBoxOperations::on_apply)));
menu_popup.append(*item);
menu_popup_items[2] = item;

View File

@ -15,6 +15,7 @@
*/
#include "MenuHelpers.h"
#include "Utils.h"
#include <gtkmm/imagemenuitem.h>
#include <gtkmm/checkmenuitem.h>
@ -136,15 +137,23 @@ StockMenuElem::StockMenuElem(const Gtk::StockID& stock_id,
const CallSlot& slot)
: Gtk::ImageMenuItem()
{
Gtk::StockItem stock;
if (slot)
signal_activate().connect(slot);
set_accel_key(key);
set_use_stock();
set_label(stock_id.get_string());
Gtk::Image *image = Utils::mk_image(stock_id, Gtk::ICON_SIZE_MENU);
set_image(*image);
set_always_show_image(true);
if (Gtk::Stock::lookup(stock_id, stock))
{
set_label(Utils::get_stock_label(stock_id));
set_use_underline(true);
}
show_all();
}
@ -153,17 +162,23 @@ StockMenuElem::StockMenuElem(const Gtk::StockID& stock_id,
const CallSlot& slot)
: Gtk::ImageMenuItem()
{
Gtk::StockItem stock;
if (slot)
signal_activate().connect(slot);
Gtk::StockItem stock;
Gtk::Image *image = Utils::mk_image(stock_id, Gtk::ICON_SIZE_MENU);
set_image(*image);
set_always_show_image(true);
if (Gtk::Stock::lookup(stock_id, stock))
{
set_accel_key(Gtk::AccelKey(stock.get_keyval(),
stock.get_modifier()));
set_use_stock();
set_label(stock_id.get_string());
set_always_show_image(true);
set_label(Utils::get_stock_label(stock_id));
set_use_underline(true);
}
show_all();
}
@ -173,12 +188,23 @@ StockMenuElem::StockMenuElem(const Gtk::StockID& stock_id,
Gtk::Menu& submenu)
: Gtk::ImageMenuItem()
{
Gtk::StockItem stock;
set_submenu(submenu);
set_use_stock();
set_label(stock_id.get_string());
Gtk::Image *image = Utils::mk_image(stock_id, Gtk::ICON_SIZE_MENU);
set_image(*image);
set_always_show_image(true);
if (Gtk::Stock::lookup(stock_id, stock))
{
set_accel_key(Gtk::AccelKey(stock.get_keyval(),
stock.get_modifier()));
set_label(Utils::get_stock_label(stock_id));
set_use_underline(true);
}
show_all();
}

View File

@ -19,6 +19,7 @@
#include "Partition.h"
#include "PartitionLUKS.h"
#include "PartitionVector.h"
#include "Utils.h"
#include <vector>
#include <gtkmm/cellrenderer.h>
@ -161,16 +162,16 @@ void TreeView_Detail::create_row( const Gtk::TreeRow & treerow,
const Partition & filesystem_ptn = partition.get_filesystem_partition();
if ( filesystem_ptn.busy )
treerow[ treeview_detail_columns .icon1 ] =
render_icon_pixbuf(Gtk::Stock::DIALOG_AUTHENTICATION, Gtk::ICON_SIZE_BUTTON);
Utils::mk_pixbuf(*this, Gtk::Stock::DIALOG_AUTHENTICATION, Gtk::ICON_SIZE_BUTTON);
if ( partition.have_messages() > 0 )
{
if ( ! static_cast< Glib::RefPtr<Gdk::Pixbuf> >( treerow[ treeview_detail_columns .icon1 ] ) )
treerow[ treeview_detail_columns .icon1 ] =
render_icon_pixbuf(Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_BUTTON);
Utils::mk_pixbuf(*this, Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_BUTTON);
else
treerow[ treeview_detail_columns .icon2 ] =
render_icon_pixbuf(Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_BUTTON);
Utils::mk_pixbuf(*this, Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_BUTTON);
}

View File

@ -31,11 +31,16 @@
#include <glibmm/stringutils.h>
#include <glibmm/shell.h>
#include <gtkmm/main.h>
#include <gtkmm/enums.h>
#include <gtkmm/stock.h>
#include <gtkmm/stockitem.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <string.h>
#include <unistd.h>
#include <algorithm>
namespace GParted
{
@ -69,6 +74,55 @@ Gtk::Label * Utils::mk_label( const Glib::ustring & text
return label ;
}
Gtk::Image* Utils::mk_image(const Gtk::StockID& stock_id, Gtk::IconSize icon_size)
{
Gtk::Image *image = Gtk::manage(new Gtk::Image(stock_id, icon_size));
// Ensure icon size
int width = 0;
int height = 0;
if (Gtk::IconSize::lookup(icon_size, width, height) && width > 0 && height > 0)
{
int pixel_size = std::min(width, height);
image->set_pixel_size(pixel_size);
}
return image;
}
Glib::RefPtr<Gdk::Pixbuf> Utils::mk_pixbuf(Gtk::Widget& widget,
const Gtk::StockID& stock_id,
Gtk::IconSize icon_size)
{
Glib::RefPtr<Gdk::Pixbuf> theme_icon = widget.render_icon_pixbuf(stock_id, icon_size);
// Ensure icon size
int width = 0;
int height = 0;
if (Gtk::IconSize::lookup(icon_size, width, height) && width > 0 && height > 0)
{
int pixel_size = std::min(width, height);
if (theme_icon->get_width() > pixel_size || theme_icon->get_height() > pixel_size)
return theme_icon->scale_simple(pixel_size, pixel_size, Gdk::INTERP_BILINEAR);
}
return theme_icon;
}
Glib::ustring Utils::get_stock_label(const Gtk::StockID& stock_id)
{
Gtk::StockItem stock_item;
if (Gtk::Stock::lookup(stock_id, stock_item))
return stock_item.get_label();
return "";
}
Glib::ustring Utils::num_to_str( Sector number )
{
std::stringstream ss ;

View File

@ -159,7 +159,7 @@ void Win_GParted::init_menubar()
//fill menubar_main and connect callbacks
//gparted
menu = manage( new Gtk::Menu() ) ;
image = manage( new Gtk::Image( Gtk::Stock::REFRESH, Gtk::ICON_SIZE_MENU ) );
image = Utils::mk_image(Gtk::Stock::REFRESH, Gtk::ICON_SIZE_MENU);
item = manage(new GParted::Menu_Helpers::ImageMenuElem(
_("_Refresh Devices"),
Gtk::AccelKey("<control>r"),
@ -167,7 +167,7 @@ void Win_GParted::init_menubar()
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 = Utils::mk_image(Gtk::Stock::HARDDISK, Gtk::ICON_SIZE_MENU);
item = manage(new GParted::Menu_Helpers::ImageMenuElem(
_("_Devices"), *image));
menu->append(*item);
@ -189,14 +189,14 @@ void Win_GParted::init_menubar()
item = manage(new GParted::Menu_Helpers::ImageMenuElem(
_("_Undo Last Operation"),
Gtk::AccelKey("<control>z"),
* manage( new Gtk::Image( Gtk::Stock::UNDO, Gtk::ICON_SIZE_MENU ) ),
*Utils::mk_image(Gtk::Stock::UNDO, Gtk::ICON_SIZE_MENU),
sigc::mem_fun(*this, &Win_GParted::activate_undo)));
menu->append(*item);
mainmenu_items[MENU_UNDO_OPERATION] = item;
item = manage(new GParted::Menu_Helpers::ImageMenuElem(
_("_Clear All Operations"),
* manage( new Gtk::Image( Gtk::Stock::CLEAR, Gtk::ICON_SIZE_MENU ) ),
*Utils::mk_image(Gtk::Stock::CLEAR, Gtk::ICON_SIZE_MENU),
sigc::mem_fun(*this, &Win_GParted::clear_operationslist)));
menu->append(*item);
mainmenu_items[MENU_CLEAR_OPERATIONS] = item;
@ -204,7 +204,7 @@ void Win_GParted::init_menubar()
item = 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 ) ),
*Utils::mk_image(Gtk::Stock::APPLY, Gtk::ICON_SIZE_MENU),
sigc::mem_fun(*this, &Win_GParted::activate_apply)));
menu->append(*item);
mainmenu_items[MENU_APPLY_OPERATIONS] = item;
@ -271,7 +271,7 @@ void Win_GParted::init_menubar()
item = manage(new GParted::Menu_Helpers::ImageMenuElem(
_("_Contents"),
Gtk::AccelKey("F1"),
* manage( new Gtk::Image( Gtk::Stock::HELP, Gtk::ICON_SIZE_MENU ) ),
*Utils::mk_image(Gtk::Stock::HELP, Gtk::ICON_SIZE_MENU),
sigc::mem_fun(*this, &Win_GParted::menu_help_contents)));
menu->append(*item);
@ -294,7 +294,7 @@ void Win_GParted::init_toolbar()
hbox_toolbar.pack_start( toolbar_main );
//NEW and DELETE
image = manage( new Gtk::Image( Gtk::Stock::NEW, Gtk::ICON_SIZE_BUTTON ) );
image = Utils::mk_image(Gtk::Stock::NEW, Gtk::ICON_SIZE_BUTTON);
/*TO TRANSLATORS: "New" is a tool bar item for partition actions. */
Glib::ustring str_temp = _("New") ;
toolbutton = Gtk::manage(new Gtk::ToolButton( *image, str_temp ));
@ -302,7 +302,10 @@ void Win_GParted::init_toolbar()
toolbar_main .append( *toolbutton );
TOOLBAR_NEW = index++ ;
toolbutton->set_tooltip_text(_("Create a new partition in the selected unallocated space"));
toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::DELETE));
image = Utils::mk_image(Gtk::Stock::DELETE, Gtk::ICON_SIZE_BUTTON);
str_temp = Utils::get_stock_label(Gtk::Stock::DELETE);
toolbutton = Gtk::manage(new Gtk::ToolButton(*image, str_temp));
toolbutton->set_use_underline(true);
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_delete) );
toolbar_main.append(*toolbutton);
TOOLBAR_DEL = index++ ;
@ -311,7 +314,7 @@ void Win_GParted::init_toolbar()
index++ ;
//RESIZE/MOVE
image = manage( new Gtk::Image( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_BUTTON ) );
image = Utils::mk_image(Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_BUTTON);
str_temp = _("Resize/Move") ;
//Condition string split and Undo button.
// for longer translated string, split string in two and skip the Undo button to permit full toolbar to display
@ -333,12 +336,18 @@ void Win_GParted::init_toolbar()
index++ ;
//COPY and PASTE
toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::COPY));
image = Utils::mk_image(Gtk::Stock::COPY, Gtk::ICON_SIZE_BUTTON);
str_temp = Utils::get_stock_label(Gtk::Stock::COPY);
toolbutton = Gtk::manage(new Gtk::ToolButton(*image, str_temp));
toolbutton->set_use_underline(true);
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_copy) );
toolbar_main.append(*toolbutton);
TOOLBAR_COPY = index++ ;
toolbutton->set_tooltip_text(_("Copy the selected partition to the clipboard"));
toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::PASTE));
image = Utils::mk_image(Gtk::Stock::PASTE, Gtk::ICON_SIZE_BUTTON);
str_temp = Utils::get_stock_label(Gtk::Stock::PASTE);
toolbutton = Gtk::manage(new Gtk::ToolButton(*image, str_temp));
toolbutton->set_use_underline(true);
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_paste) );
toolbar_main.append(*toolbutton);
TOOLBAR_PASTE = index++ ;
@ -349,7 +358,10 @@ void Win_GParted::init_toolbar()
//UNDO and APPLY
if ( display_undo ) {
//Undo button is displayed only if translated language "Resize/Move" is not too long. See above setting of this condition.
toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::UNDO));
image = Utils::mk_image(Gtk::Stock::UNDO, Gtk::ICON_SIZE_BUTTON);
str_temp = Utils::get_stock_label(Gtk::Stock::UNDO);
toolbutton = Gtk::manage(new Gtk::ToolButton(*image, str_temp));
toolbutton->set_use_underline(true);
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_undo) );
toolbar_main.append(*toolbutton);
TOOLBAR_UNDO = index++ ;
@ -357,7 +369,10 @@ void Win_GParted::init_toolbar()
toolbutton->set_tooltip_text(_("Undo Last Operation"));
}
toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::APPLY));
image = Utils::mk_image(Gtk::Stock::APPLY, Gtk::ICON_SIZE_BUTTON);
str_temp = Utils::get_stock_label(Gtk::Stock::APPLY);
toolbutton = Gtk::manage(new Gtk::ToolButton(*image, str_temp));
toolbutton->set_use_underline(true);
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_apply) );
toolbar_main.append(*toolbutton);
TOOLBAR_APPLY = index++ ;
@ -383,7 +398,7 @@ void Win_GParted::init_partition_menu()
Gtk::MenuItem *item;
//fill menu_partition
image = manage( new Gtk::Image( Gtk::Stock::NEW, Gtk::ICON_SIZE_MENU ) );
image = Utils::mk_image(Gtk::Stock::NEW, Gtk::ICON_SIZE_MENU);
item = manage(new
/*TO TRANSLATORS: "_New" is a sub menu item for the partition menu. */
GParted::Menu_Helpers::ImageMenuElem(_("_New"),
@ -403,7 +418,7 @@ void Win_GParted::init_partition_menu()
item = manage(new GParted::Menu_Helpers::SeparatorElem());
menu_partition.append(*item);
image = manage( new Gtk::Image( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_MENU ) );
image = Utils::mk_image(Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_MENU);
item = manage(new
GParted::Menu_Helpers::ImageMenuElem(_("_Resize/Move"),
*image,
@ -429,7 +444,7 @@ void Win_GParted::init_partition_menu()
item = manage(new GParted::Menu_Helpers::SeparatorElem());
menu_partition.append(*item);
image = manage( new Gtk::Image( Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU ) );
image = Utils::mk_image(Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU);
item = manage(new
/*TO TRANSLATORS: menuitem which holds a submenu with file systems.. */
GParted::Menu_Helpers::ImageMenuElem(_("_Format to"),
@ -713,7 +728,7 @@ void Win_GParted::refresh_combo_devices()
//combo...
treerow = *( liststore_devices ->append() ) ;
treerow[ treeview_devices_columns .icon ] =
render_icon_pixbuf(Gtk::Stock::HARDDISK, Gtk::ICON_SIZE_LARGE_TOOLBAR);
Utils::mk_pixbuf(*this, Gtk::Stock::HARDDISK, Gtk::ICON_SIZE_LARGE_TOOLBAR);
treerow[ treeview_devices_columns .device ] = devices[ i ] .get_path() ;
treerow[ treeview_devices_columns .size ] = "(" + Utils::format_size( devices[ i ] .length, devices[ i ] .sector_size ) + ")" ;
@ -2059,7 +2074,7 @@ void Win_GParted::activate_resize()
Operation * operation = new OperationResizeMove( devices[current_device],
*selected_partition_ptr,
*resized_ptn );
operation->icon = render_icon_pixbuf(Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_MENU);
operation->icon = Utils::mk_pixbuf(*this, Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_MENU);
delete resized_ptn;
resized_ptn = NULL;
@ -2155,7 +2170,7 @@ void Win_GParted::activate_paste()
*selected_partition_ptr,
dialog.Get_New_Partition(),
*copied_partition );
operation ->icon = render_icon_pixbuf(Gtk::Stock::COPY, Gtk::ICON_SIZE_MENU);
operation->icon = Utils::mk_pixbuf(*this, Gtk::Stock::COPY, Gtk::ICON_SIZE_MENU);
// When pasting into unallocated space set a temporary
// path of "Copy of /dev/SRC" for display purposes until
@ -2251,7 +2266,7 @@ void Win_GParted::activate_paste()
*selected_partition_ptr,
*partition_new,
*copied_partition );
operation->icon = render_icon_pixbuf(Gtk::Stock::COPY, Gtk::ICON_SIZE_MENU);
operation->icon = Utils::mk_pixbuf(*this, Gtk::Stock::COPY, Gtk::ICON_SIZE_MENU);
delete partition_new;
partition_new = NULL;
@ -2312,7 +2327,7 @@ void Win_GParted::activate_new()
Operation * operation = new OperationCreate( devices[current_device],
*selected_partition_ptr,
dialog.Get_New_Partition() );
operation->icon = render_icon_pixbuf(Gtk::Stock::NEW, Gtk::ICON_SIZE_MENU);
operation->icon = Utils::mk_pixbuf(*this, Gtk::Stock::NEW, Gtk::ICON_SIZE_MENU);
Add_Operation( devices[current_device], operation );
@ -2426,7 +2441,7 @@ void Win_GParted::activate_delete()
else //deletion of a real partition...
{
Operation * operation = new OperationDelete( devices[ current_device ], *selected_partition_ptr );
operation->icon = render_icon_pixbuf(Gtk::Stock::DELETE, Gtk::ICON_SIZE_MENU);
operation->icon = Utils::mk_pixbuf(*this, Gtk::Stock::DELETE, Gtk::ICON_SIZE_MENU);
Add_Operation( devices[current_device], operation );
}
@ -2578,7 +2593,7 @@ void Win_GParted::activate_format( FSType new_fs )
Operation * operation = new OperationFormat( devices[current_device],
*selected_partition_ptr,
*temp_ptn );
operation->icon = render_icon_pixbuf(Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU);
operation->icon = Utils::mk_pixbuf(*this, Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU);
Add_Operation( devices[current_device], operation );
merge_operations( mergetype );
@ -3175,7 +3190,7 @@ void Win_GParted::activate_check()
// file system to fill the partition.
Operation * operation = new OperationCheck( devices[current_device], *selected_partition_ptr );
operation->icon = render_icon_pixbuf(Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU);
operation->icon = Utils::mk_pixbuf(*this, Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU);
Add_Operation( devices[current_device], operation );
// Try to merge this check operation with all previous operations.
@ -3204,7 +3219,7 @@ void Win_GParted::activate_label_filesystem()
Operation * operation = new OperationLabelFileSystem( devices[current_device],
*selected_partition_ptr, *part_temp );
operation->icon = render_icon_pixbuf(Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU);
operation->icon = Utils::mk_pixbuf(*this, Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU);
delete part_temp;
part_temp = NULL;
@ -3238,7 +3253,7 @@ void Win_GParted::activate_name_partition()
Operation * operation = new OperationNamePartition( devices[current_device],
*selected_partition_ptr, *part_temp );
operation->icon = render_icon_pixbuf(Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU);
operation->icon = Utils::mk_pixbuf(*this, Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU);
delete part_temp;
part_temp = NULL;
@ -3296,7 +3311,7 @@ void Win_GParted::activate_change_uuid()
Operation * operation = new OperationChangeUUID( devices[current_device],
*selected_partition_ptr, *temp_ptn );
operation->icon = render_icon_pixbuf(Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU);
operation->icon = Utils::mk_pixbuf(*this, Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU);
delete temp_ptn;
temp_ptn = NULL;