From c3bdd47a6232a5f34bb7f1246601e624fa85560a Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Wed, 25 Oct 2017 22:35:26 +0200 Subject: [PATCH] make MyFileChooserButton behave nicely with CSS themes Note: I still had to hardcode a set_border_width(2) for GTK+ < 3.20, because nothing I tried on the CSS worked... --- rtdata/themes/RawTherapee-GTK3-_19.css | 6 ++++++ rtgui/guiutils.cc | 12 ++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/rtdata/themes/RawTherapee-GTK3-_19.css b/rtdata/themes/RawTherapee-GTK3-_19.css index 8263dd857..8443768c3 100644 --- a/rtdata/themes/RawTherapee-GTK3-_19.css +++ b/rtdata/themes/RawTherapee-GTK3-_19.css @@ -500,3 +500,9 @@ GtkNotebook { #PartialPasteHeaderSep { color: #D8D8D8; } + + +#MyFileChooserButton { + padding-left: 3px; + padding-right: 3px; +} diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index 91e223a53..42696abb4 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -1177,20 +1177,20 @@ MyFileChooserButton::MyFileChooserButton(const Glib::ustring &title, Gtk::FileCh lbl_.set_ellipsize(Pango::ELLIPSIZE_MIDDLE); lbl_.set_justify(Gtk::JUSTIFY_LEFT); set_none(); - box_.pack_start(lbl_, true, true, 3); + box_.pack_start(lbl_, true, true); Gtk::Image *img = Gtk::manage(new Gtk::Image()); img->set_from_icon_name("document-open", Gtk::ICON_SIZE_BUTTON); box_.pack_start(*Gtk::manage(new Gtk::VSeparator()), false, false, 5); - box_.pack_start(*img, false, false, 3); + box_.pack_start(*img, false, false); box_.show_all_children(); add(box_); signal_clicked().connect(sigc::mem_fun(*this, &MyFileChooserButton::show_chooser)); - set_border_width(2); + if (GTK_MINOR_VERSION < 20) { + set_border_width(2); // agriggio: margin doesn't seem to work for me on GTK 3.18 + } + set_name("MyFileChooserButton"); - lbl_.set_name("MyFileChooserButton"); - box_.set_name("MyFileChooserButton"); - img->set_name("MyFileChooserButton"); }