summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/objects.cpp
diff options
context:
space:
mode:
authorSylvain Chiron <chironsylvain@orange.fr>2017-07-01 12:08:02 +0000
committerSylvain Chiron <chironsylvain@orange.fr>2017-07-01 12:08:02 +0000
commitb311d097b148a2cf5213ca86a45cb562bdd02986 (patch)
tree56b5c507727a852325a093ddedd2c3f44793c4ce /src/ui/dialog/objects.cpp
parentUpdated libs from the Adaptagrams project: libavoid, libcola and libvspc; cha... (diff)
parentFix a compiling error on debian testing (diff)
downloadinkscape-b311d097b148a2cf5213ca86a45cb562bdd02986.tar.gz
inkscape-b311d097b148a2cf5213ca86a45cb562bdd02986.zip
Merge branch 'master' of gitlab.com:inkscape/inkscape
Diffstat (limited to 'src/ui/dialog/objects.cpp')
-rw-r--r--src/ui/dialog/objects.cpp38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp
index e76da241a..4b673b8b7 100644
--- a/src/ui/dialog/objects.cpp
+++ b/src/ui/dialog/objects.cpp
@@ -241,23 +241,25 @@ void ObjectsPanel::_styleButton(Gtk::Button& btn, char const* iconName, char con
*/
Gtk::MenuItem& ObjectsPanel::_addPopupItem( SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback, int id )
{
- GtkWidget* iconWidget = 0;
+ Gtk::Image *iconWidget = nullptr;
const char* label = 0;
if ( iconName ) {
- iconWidget = gtk_image_new_from_icon_name( iconName, GTK_ICON_SIZE_MENU );
+ iconWidget = Gtk::manage(new Gtk::Image());
+ iconWidget->set_from_icon_name( iconName, Gtk::ICON_SIZE_MENU );
}
if ( desktop ) {
Verb *verb = Verb::get( code );
if ( verb ) {
- SPAction *action = verb->get_action(desktop);
+ SPAction *action = verb->get_action(Inkscape::ActionContext(desktop));
if ( !iconWidget && action && action->image ) {
- iconWidget = gtk_image_new_from_icon_name( action->image, GTK_ICON_SIZE_MENU );
+ iconWidget = Gtk::manage(new Gtk::Image());
+ iconWidget->set_from_icon_name( action->image, Gtk::ICON_SIZE_MENU );
}
if ( action ) {
- // label = action->name;
+ label = action->name;
}
}
}
@@ -266,21 +268,23 @@ Gtk::MenuItem& ObjectsPanel::_addPopupItem( SPDesktop *desktop, unsigned int cod
label = fallback;
}
- Gtk::Widget* wrapped = 0;
- if ( iconWidget ) {
- wrapped = Gtk::manage(Glib::wrap(iconWidget));
- wrapped->show();
- }
-
-
- Gtk::MenuItem* item = 0;
+ auto box = Gtk::manage(new Gtk::Box());
+ Gtk::MenuItem* item = Gtk::manage(new Gtk::MenuItem());
- if (wrapped) {
- item = Gtk::manage(new Gtk::ImageMenuItem(*wrapped, label, true));
- } else {
- item = Gtk::manage(new Gtk::MenuItem(label, true));
+ if (iconWidget) {
+ box->pack_start(*iconWidget, false, true, 0);
+ }
+ else {
+ Gtk::Label *fake_icon = Gtk::manage(new Gtk::Label(""));
+ box->pack_start(*fake_icon, false, true, 0);
}
+ Gtk::Label *menu_label = Gtk::manage(new Gtk::Label(label, true));
+ menu_label->set_xalign(0.0);
+ box->pack_start(*menu_label, true, true, 0);
+ item->add(*box);
+ item->show_all();
+
item->signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &ObjectsPanel::_takeAction), id));
_popupMenu.append(*item);