diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 829bb21c5..6aae2f9a9 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -904,6 +904,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel) send_to_external = Gtk::manage(new PopUpButton("", false)); send_to_external->set_tooltip_text(M("MAIN_BUTTON_SENDTOEDITOR_TOOLTIP")); + send_to_external->setEmptyImage("palette-brush.png"); setExpandAlignProperties(send_to_external->buttonGroup, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); updateExternalEditorWidget( options.externalEditorIndex >= 0 ? options.externalEditorIndex : options.externalEditors.size(), diff --git a/rtgui/popupcommon.cc b/rtgui/popupcommon.cc index a6d9b6046..2517a0a76 100644 --- a/rtgui/popupcommon.cc +++ b/rtgui/popupcommon.cc @@ -136,6 +136,21 @@ bool PopUpCommon::insertEntryImpl(int position, const Glib::ustring& fileName, c return true; } +void PopUpCommon::setEmptyImage(const Glib::ustring &fileName) +{ + emptyImageFilename = fileName; + + if (getEntryCount()) { + return; + } + if (fileName.empty()) { + buttonImage->hide(); + } else { + changeImage(emptyImageFilename, Glib::RefPtr()); + buttonImage->show(); + } +} + void PopUpCommon::removeEntry(int position) { if (position < 0 || position >= getEntryCount()) { @@ -147,8 +162,13 @@ void PopUpCommon::removeEntry(int position) button->get_style_context()->remove_class("Left"); arrowButton->hide(); hasMenu = false; - // Remove the button image. - buttonImage->hide(); + if (emptyImageFilename.empty()) { + // Remove the button image. + buttonImage->hide(); + } else { + // Show the empty icon. + changeImage(emptyImageFilename, Glib::RefPtr()); + } selected = -1; } else if (position < selected) { diff --git a/rtgui/popupcommon.h b/rtgui/popupcommon.h index 9ca6b2030..228e0fba0 100644 --- a/rtgui/popupcommon.h +++ b/rtgui/popupcommon.h @@ -64,6 +64,8 @@ public: bool addEntry (const Glib::ustring& fileName, const Glib::ustring& label, Gtk::RadioButtonGroup* radioGroup = nullptr); bool insertEntry(int position, const Glib::ustring& fileName, const Glib::ustring& label, Gtk::RadioButtonGroup* radioGroup = nullptr); bool insertEntry(int position, const Glib::RefPtr& gIcon, const Glib::ustring& label, Gtk::RadioButtonGroup* radioGroup = nullptr); + /// Sets the button image to show when there are no entries. + void setEmptyImage(const Glib::ustring &fileName); int getEntryCount () const; bool setSelected (int entryNum); int getSelected () const; @@ -77,6 +79,7 @@ private: type_signal_changed messageChanged; type_signal_item_selected messageItemSelected; + Glib::ustring emptyImageFilename; std::vector> imageIcons; std::vector imageFilenames; std::vector images;