/* gamma-dummy.c -- No-op gamma adjustment
   This file is part of redshift-ng.

   redshift-ng is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   redshift-ng is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with redshift-ng.  If not, see <http://www.gnu.org/licenses/>.

   Copyright (c) 2013-2017  Jon Lund Steffensen <jonlst@gmail.com>
*/
#include "common.h"


static int
gamma_dummy_init(struct gamma_state **state)
{
	*state = NULL;
	return 0;
}

static int
gamma_dummy_start(struct gamma_state *state, enum program_mode mode)
{
	(void) state;
	(void) mode;
	weprintf(_("WARNING: Using dummy gamma method! Display will not be affected by this gamma method.\n"));
	return 0;
}

static void
gamma_dummy_restore(struct gamma_state *state)
{
	(void) state;
}

static void
gamma_dummy_free(struct gamma_state *state)
{
	(void) state;
}

static void
gamma_dummy_print_help(FILE *f)
{
	fputs(_("Does not affect the display but prints the color temperature to the terminal.\n"), f);
	fputs("\n", f);
}

static int
gamma_dummy_set_option(struct gamma_state *state, const char *key, const char *value)
{
	(void) state;
	(void) value;
	weprintf(_("Unknown method parameter: `%s'."), key);
	return -1;
}

static int
gamma_dummy_set_temperature(
	struct gamma_state *state, const struct color_setting *setting, int preserve)
{
	(void) state;
	(void) preserve;
	printf(_("Temperature: %i\n"), setting->temperature);
	return 0;
}


const struct gamma_method dummy_gamma_method = {
	"dummy", 0,
	&gamma_dummy_init,
	&gamma_dummy_start,
	&gamma_dummy_free,
	&gamma_dummy_print_help,
	&gamma_dummy_set_option,
	&gamma_dummy_restore,
	&gamma_dummy_set_temperature
};