Added support for autodetecting the system monitor color profile also on Linux

Code borrowed from Geeqie
This commit is contained in:
Alberto Griggio
2017-04-08 15:18:50 +02:00
parent 73e14702dd
commit b01899783d
5 changed files with 87 additions and 104 deletions

View File

@@ -756,11 +756,11 @@ Gtk::Widget* Preferences::getColorManagementPanel ()
setExpandAlignProperties(monBPC, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER);
monBPC->set_active (true);
#if defined(WIN32) // Auto-detection not implemented for Linux, see issue 851
//#if defined(WIN32) // Auto-detection not implemented for Linux, see issue 851
cbAutoMonProfile = Gtk::manage (new Gtk::CheckButton (M("PREFERENCES_AUTOMONPROFILE")));
setExpandAlignProperties(cbAutoMonProfile, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER);
autoMonProfileConn = cbAutoMonProfile->signal_toggled().connect (sigc::mem_fun(*this, &Preferences::autoMonProfileToggled));
#endif
//#endif
int row = 0;
gmonitor->attach (*mplabel, 0, row, 1, 1);
@@ -772,18 +772,18 @@ Gtk::Widget* Preferences::getColorManagementPanel ()
gmonitor->attach (*monProfile, 1, row, 1, 1);
#endif
++row;
#if defined(WIN32)
//#if defined(WIN32)
gmonitor->attach (*cbAutoMonProfile, 1, row, 1, 1);
++row;
#endif
//#endif
gmonitor->attach (*milabel, 0, row, 1, 1);
gmonitor->attach (*monIntent, 1, row, 1, 1);
++row;
gmonitor->attach (*monBPC, 0, row, 2, 1);
#if defined(WIN32)
//#if defined(WIN32)
autoMonProfileToggled();
#endif
//#endif
fmonitor->add(*gmonitor);
@@ -830,9 +830,9 @@ Gtk::Widget* Preferences::getColorManagementPanel ()
++row;
gprinter->attach (*prtBPC, 0, row, 2, 1);
#if defined(WIN32)
//#if defined(WIN32)
autoMonProfileToggled();
#endif
//#endif
fprinter->add(*gprinter);
@@ -1677,9 +1677,9 @@ void Preferences::storePreferences ()
break;
}
moptions.rtSettings.monitorBPC = monBPC->get_active ();
#if defined(WIN32)
//#if defined(WIN32)
moptions.rtSettings.autoMonitorProfile = cbAutoMonProfile->get_active ();
#endif
//#endif
#endif
moptions.rtSettings.iccDirectory = iccDir->get_filename ();
@@ -1825,9 +1825,9 @@ void Preferences::fillPreferences ()
break;
}
monBPC->set_active (moptions.rtSettings.monitorBPC);
#if defined(WIN32)
//#if defined(WIN32)
cbAutoMonProfile->set_active(moptions.rtSettings.autoMonitorProfile);
#endif
//#endif
#endif
if (Glib::file_test (moptions.rtSettings.iccDirectory, Glib::FILE_TEST_IS_DIR)) {
@@ -2033,12 +2033,12 @@ void Preferences::savePressed () {
}
*/
#if defined(WIN32)
//#if defined(WIN32)
void Preferences::autoMonProfileToggled ()
{
monProfile->set_sensitive(!cbAutoMonProfile->get_active());
}
#endif
//#endif
/*
void Preferences::autocielabToggled () {
// cbAutocielab->set_sensitive(cbAutocielab->get_active());