/*
 * e-conflict-search-selector.c
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) version 3.
 *
 * This program 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with the program; if not, see <http://www.gnu.org/licenses/>
 *
 */

#include "e-conflict-search-selector.h"

#include "e-source-conflict-search.h"

/* This forces the GType to be registered in a way that
 * avoids a "statement with no effect" compiler warning. */
#define REGISTER_TYPE(type) \
	(g_type_class_unref (g_type_class_ref (type)))

G_DEFINE_TYPE (
	EConflictSearchSelector,
	e_conflict_search_selector,
	E_TYPE_SOURCE_SELECTOR)

static gboolean
conflict_search_selector_get_source_selected (ESourceSelector *selector,
                                           ESource *source)
{
	ESourceConflictSearch *extension;
	const gchar *extension_name;

	/* Make sure this source is a calendar. */
	extension_name = e_source_selector_get_extension_name (selector);
	if (!e_source_has_extension (source, extension_name))
		return FALSE;

	extension_name = E_SOURCE_EXTENSION_CONFLICT_SEARCH;
	extension = e_source_get_extension (source, extension_name);
	g_return_val_if_fail (E_IS_SOURCE_CONFLICT_SEARCH (extension), FALSE);

	return e_source_conflict_search_get_include_me (extension);
}

static void
conflict_search_selector_set_source_selected (ESourceSelector *selector,
                                           ESource *source,
                                           gboolean selected)
{
	ESourceConflictSearch *extension;
	const gchar *extension_name;

	/* Make sure this source is a calendar. */
	extension_name = e_source_selector_get_extension_name (selector);
	if (!e_source_has_extension (source, extension_name))
		return;

	extension_name = E_SOURCE_EXTENSION_CONFLICT_SEARCH;
	extension = e_source_get_extension (source, extension_name);
	g_return_if_fail (E_IS_SOURCE_CONFLICT_SEARCH (extension));

	if (selected != e_source_conflict_search_get_include_me (extension)) {
		e_source_conflict_search_set_include_me (extension, selected);
		e_source_selector_queue_write (selector, source);
	}
}

static void
e_conflict_search_selector_class_init (EConflictSearchSelectorClass *class)
{
	ESourceSelectorClass *source_selector_class;

	source_selector_class = E_SOURCE_SELECTOR_CLASS (class);
	source_selector_class->get_source_selected =
				conflict_search_selector_get_source_selected;
	source_selector_class->set_source_selected =
				conflict_search_selector_set_source_selected;

	REGISTER_TYPE (E_TYPE_SOURCE_CONFLICT_SEARCH);
}

static void
e_conflict_search_selector_init (EConflictSearchSelector *selector)
{
}

GtkWidget *
e_conflict_search_selector_new (ESourceRegistry *registry)
{
	g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);

	return g_object_new (
		E_TYPE_CONFLICT_SEARCH_SELECTOR,
		"extension-name", E_SOURCE_EXTENSION_CALENDAR,
		"registry", registry, NULL);
}
14Q3'>branches/2014Q3</option>
<option value='branches/2014Q4'>branches/2014Q4</option>
<option value='branches/2015Q1'>branches/2015Q1</option>
<option value='branches/2015Q2'>branches/2015Q2</option>
<option value='branches/2015Q3'>branches/2015Q3</option>
<option value='branches/2015Q4'>branches/2015Q4</option>
<option value='branches/2016Q1'>branches/2016Q1</option>
<option value='branches/2016Q2'>branches/2016Q2</option>
<option value='branches/2016Q3'>branches/2016Q3</option>
<option value='branches/2016Q4'>branches/2016Q4</option>
<option value='branches/2017Q1'>branches/2017Q1</option>
<option value='branches/2017Q2'>branches/2017Q2</option>
<option value='branches/2017Q3'>branches/2017Q3</option>
<option value='branches/2017Q4'>branches/2017Q4</option>
<option value='branches/2018Q1'>branches/2018Q1</option>
<option value='branches/2018Q2'>branches/2018Q2</option>
<option value='branches/2018Q3'>branches/2018Q3</option>
<option value='branches/2018Q4'>branches/2018Q4</option>
<option value='branches/2019Q1'>branches/2019Q1</option>
<option value='branches/2019Q2'>branches/2019Q2</option>
<option value='branches/2019Q3'>branches/2019Q3</option>
<option value='branches/2019Q4'>branches/2019Q4</option>
<option value='branches/2020Q1'>branches/2020Q1</option>
<option value='branches/2020Q2'>branches/2020Q2</option>
<option value='branches/2020Q3'>branches/2020Q3</option>
<option value='branches/2020Q4'>branches/2020Q4</option>
<option value='branches/2021Q1'>branches/2021Q1</option>
<option value='branches/RELEASE_8_4_0'>branches/RELEASE_8_4_0</option>
<option value='branches/RELENG_2_1_0'>branches/RELENG_2_1_0</option>
<option value='branches/RELENG_2_2'>branches/RELENG_2_2</option>
<option value='branches/RELENG_9_1_0'>branches/RELENG_9_1_0</option>
<option value='branches/RELENG_9_2_0'>branches/RELENG_9_2_0</option>
<option value='dependabot/npm_and_yarn/devel/electron4/files/eslint-utils-1.4.3'>dependabot/npm_and_yarn/devel/electron4/files/eslint-utils-1.4.3</option>
<option value='dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.15'>dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.15</option>
<option value='dependabot/npm_and_yarn/devel/electron4/files/lodash.merge-4.6.2'>dependabot/npm_and_yarn/devel/electron4/files/lodash.merge-4.6.2</option>
<option value='dependabot/npm_and_yarn/devel/electron4/files/lodash.template-4.5.0'>dependabot/npm_and_yarn/devel/electron4/files/lodash.template-4.5.0</option>
<option value='dependabot/npm_and_yarn/devel/electron4/files/minimist-1.2.2'>dependabot/npm_and_yarn/devel/electron4/files/minimist-1.2.2</option>
<option value='dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2' selected='selected'>dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2</option>
<option value='main'>main</option>
<option value='master'>master</option>
<option value='svn_head'>svn_head</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>FreeBSD Ports (https://github.com/freebsd/freebsd-ports)</td><td class='sub right'></td></tr></table>
<table class='tabs'><tr><td>
<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/about/?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2'>about</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2'>summary</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/refs/?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2&amp;id=aa3c5116b7a94aab5ad4dc2c2bd64d4876d8e9bf'>refs</a><a class='active' href='/~lantw44/cgit/cgit.cgi/freebsd-ports/log/x11/xcm?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2'>log</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/tree/x11/xcm?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2&amp;id=aa3c5116b7a94aab5ad4dc2c2bd64d4876d8e9bf'>tree</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/commit/x11/xcm?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2&amp;id=aa3c5116b7a94aab5ad4dc2c2bd64d4876d8e9bf'>commit</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/diff/x11/xcm?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2&amp;id=aa3c5116b7a94aab5ad4dc2c2bd64d4876d8e9bf'>diff</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/stats/x11/xcm?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2'>stats</a></td><td class='form'><form class='right' method='get' action='/~lantw44/cgit/cgit.cgi/freebsd-ports/log/x11/xcm'>
<input type='hidden' name='h' value='dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2'/><input type='hidden' name='id' value='aa3c5116b7a94aab5ad4dc2c2bd64d4876d8e9bf'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/log/?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2&amp;id=aa3c5116b7a94aab5ad4dc2c2bd64d4876d8e9bf'>root</a>/<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/log/x11?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2&amp;id=aa3c5116b7a94aab5ad4dc2c2bd64d4876d8e9bf'>x11</a>/<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/log/x11/xcm?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2&amp;id=aa3c5116b7a94aab5ad4dc2c2bd64d4876d8e9bf'>xcm</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th></th><th class='left'>Commit message (<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports/log/x11/xcm?h=dependabot/npm_and_yarn/devel/electron4/files/mixin-deep-1.3.2&amp;id=aa3c5116b7a94aab5ad4dc2c2bd64d4876d8e9bf&amp;showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Age</th><th class='left'>Files</th><th class='left'>Lines</th></tr>