diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-07-01 02:03:38 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-07-01 02:03:38 +0000 |
| commit | 0d5bb885dee83f041830dc950d3be6f21a37f08b (patch) | |
| tree | 88a0ae7a15ed496ddad1f83f43547783b88843ac /src/ui/dialog/layers.cpp | |
| parent | Bug fixes (diff) | |
| parent | Add Mac CI build config (diff) | |
| download | inkscape-0d5bb885dee83f041830dc950d3be6f21a37f08b.tar.gz inkscape-0d5bb885dee83f041830dc950d3be6f21a37f08b.zip | |
update to trunk
Diffstat (limited to 'src/ui/dialog/layers.cpp')
| -rw-r--r-- | src/ui/dialog/layers.cpp | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index dd9d7ec25..7a650b034 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -15,7 +15,6 @@ #include "layers.h" #include <gtkmm/icontheme.h> -#include <gtkmm/imagemenuitem.h> #include <gtkmm/separatormenuitem.h> #include <glibmm/main.h> @@ -31,7 +30,6 @@ #include "ui/icon-names.h" #include "ui/widget/imagetoggler.h" #include "verbs.h" -#include "widgets/icon.h" #include "sp-root.h" #include "ui/tools/tool-base.h" #include "selection-chemistry.h" @@ -82,7 +80,7 @@ void LayersPanel::_styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned i bool set = false; if ( iconName ) { - GtkWidget *child = sp_icon_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName ); + GtkWidget *child = gtk_image_new_from_icon_name( iconName, GTK_ICON_SIZE_SMALL_TOOLBAR ); gtk_widget_show( child ); btn.add( *Gtk::manage(Glib::wrap(child)) ); btn.set_relief(Gtk::RELIEF_NONE); @@ -94,7 +92,7 @@ void LayersPanel::_styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned i if ( verb ) { SPAction *action = verb->get_action(Inkscape::ActionContext(desktop)); if ( !set && action && action->image ) { - GtkWidget *child = sp_icon_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, action->image ); + GtkWidget *child = gtk_image_new_from_icon_name( action->image, GTK_ICON_SIZE_SMALL_TOOLBAR ); gtk_widget_show( child ); btn.add( *Gtk::manage(Glib::wrap(child)) ); set = true; @@ -114,11 +112,12 @@ void LayersPanel::_styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned i Gtk::MenuItem& LayersPanel::_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 = sp_icon_new( Inkscape::ICON_SIZE_MENU, iconName ); + iconWidget = Gtk::manage(new Gtk::Image()); + iconWidget->set_from_icon_name( iconName, Gtk::ICON_SIZE_MENU ); } if ( desktop ) { @@ -126,7 +125,8 @@ Gtk::MenuItem& LayersPanel::_addPopupItem( SPDesktop *desktop, unsigned int code if ( verb ) { SPAction *action = verb->get_action(Inkscape::ActionContext(desktop)); if ( !iconWidget && action && action->image ) { - iconWidget = sp_icon_new( Inkscape::ICON_SIZE_MENU, action->image ); + iconWidget = Gtk::manage(new Gtk::Image()); + iconWidget->set_from_icon_name( action->image, Gtk::ICON_SIZE_MENU ); } if ( action ) { @@ -139,21 +139,23 @@ Gtk::MenuItem& LayersPanel::_addPopupItem( SPDesktop *desktop, unsigned int code 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, &LayersPanel::_takeAction), id)); _popupMenu.append(*item); |
