/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
 * e-component-view.c
 *
 * Copyright (C) 2004 Novell Inc.
 *
 * Author(s): Michael Zucchi <notzed@ximian.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of version 2 of the GNU General Public
 * License as published by the Free Software Foundation.
 *
 * 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
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * Helper class for evolution components to setup a view
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <glib.h>

#include "e-component-view.h"

#include "bonobo/bonobo-control.h"

static BonoboObjectClass *parent_class = NULL;

static void
impl_ComponentView_getControls(PortableServer_Servant servant,
		 Bonobo_Control *side_control,
		 Bonobo_Control *view_control,
		 Bonobo_Control *statusbar_control,
		 CORBA_Environment *ev)
{
	EComponentView *ecv = (EComponentView *)bonobo_object_from_servant(servant);

	*side_control = CORBA_Object_duplicate (BONOBO_OBJREF (ecv->side_control), ev);
	*view_control = CORBA_Object_duplicate (BONOBO_OBJREF (ecv->view_control), ev);
	*statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (ecv->statusbar_control), ev);
}

/* GObject methods.  */

static void
impl_dispose (GObject *object)
{
	EComponentView *ecv = (EComponentView *)object;

	ecv->side_control = NULL;
	ecv->view_control = NULL;
	ecv->statusbar_control = NULL;

	((GObjectClass *)parent_class)->dispose(object);
}

static void
impl_finalise (GObject *object)
{
	EComponentView *ecv = (EComponentView *)object;

	g_free(ecv->id);

	((GObjectClass *)parent_class)->finalize(object);
}

static void
e_component_view_class_init (EComponentViewClass *klass)
{
	GObjectClass *object_class;
	POA_GNOME_Evolution_ComponentView__epv *epv;

	parent_class = g_type_class_ref(bonobo_object_get_type());

	object_class = G_OBJECT_CLASS (klass);
	object_class->dispose  = impl_dispose;
	object_class->finalize = impl_finalise;

	epv = & klass->epv;
	epv->getControls = impl_ComponentView_getControls;
}

static void
e_component_view_init (EComponentView *shell)
{
}

EComponentView *e_component_view_new(GNOME_Evolution_ShellView parent, const char *id, struct _GtkWidget *side, struct _GtkWidget *view, struct _GtkWidget *statusbar)
{
	EComponentView *new = g_object_new (e_component_view_get_type (), NULL);
	CORBA_Environment ev = { 0 };

	new->id = g_strdup(id);
	new->shell_view = CORBA_Object_duplicate(parent, &ev);
	CORBA_exception_free(&ev);

	/* FIXME: hook onto destroys */
	new->side_control = bonobo_control_new(side);
	new->view_control = bonobo_control_new(view);
	new->statusbar_control = bonobo_control_new(statusbar);

	return new;
}

EComponentView *e_component_view_new_controls(GNOME_Evolution_ShellView parent, const char *id, BonoboControl *side, BonoboControl *view, BonoboControl *statusbar)
{
	EComponentView *new = g_object_new (e_component_view_get_type (), NULL);
	CORBA_Environment ev = { 0 };

	new->id = g_strdup(id);
	new->shell_view = CORBA_Object_duplicate(parent, &ev);
	CORBA_exception_free(&ev);

	/* FIXME: hook onto destroys */
	new->side_control = side;
	new->view_control = view;
	new->statusbar_control = statusbar;

	return new;
}

void
e_component_view_set_title(EComponentView *ecv, const char *title)
{
	CORBA_Environment ev = { 0 };

	/* save roundtrips, check title is the same */
	GNOME_Evolution_ShellView_setTitle(ecv->shell_view, ecv->id, title, &ev);
	CORBA_exception_free(&ev);
}

BONOBO_TYPE_FUNC_FULL (EComponentView, GNOME_Evolution_ComponentView, bonobo_object_get_type(), e_component_view)

ue='gnome-3.22'>gnome-3.22</option>
<option value='gnome-3.24'>gnome-3.24</option>
<option value='gnome-3.26'>gnome-3.26</option>
<option value='gnome-3.28'>gnome-3.28</option>
<option value='gnome-3.32'>gnome-3.32</option>
<option value='gnome-3.36'>gnome-3.36</option>
<option value='gstreamer'>gstreamer</option>
<option value='gstreamer-1.16'>gstreamer-1.16</option>
<option value='gstreamer0.10-removal'>gstreamer0.10-removal</option>
<option value='main'>main</option>
<option value='master' selected='selected'>master</option>
<option value='mate-1.16'>mate-1.16</option>
<option value='mate-1.18'>mate-1.18</option>
<option value='mate-1.20'>mate-1.20</option>
<option value='mate-1.22'>mate-1.22</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>FreeBSD GNOME current development ports (https://github.com/freebsd/freebsd-ports-gnome)</td><td class='sub right'></td></tr></table>
<table class='tabs'><tr><td>
<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/about/?h=master'>about</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/?h=master'>summary</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/refs/?h=master'>refs</a><a class='active' href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/textproc/py-fingerprints/Makefile?h=master'>log</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/tree/textproc/py-fingerprints/Makefile?h=master'>tree</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/textproc/py-fingerprints/Makefile?h=master'>commit</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/diff/textproc/py-fingerprints/Makefile?h=master'>diff</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/stats/textproc/py-fingerprints/Makefile?h=master'>stats</a></td><td class='form'><form class='right' method='get' action='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/textproc/py-fingerprints/Makefile'>
<input type='hidden' name='h' value='master'/><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-gnome/log/?h=master'>root</a>/<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/textproc?h=master'>textproc</a>/<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/textproc/py-fingerprints?h=master'>py-fingerprints</a>/<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/textproc/py-fingerprints/Makefile?h=master'>Makefile</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-gnome/log/textproc/py-fingerprints/Makefile?h=master&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>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/textproc/py-fingerprints/Makefile?h=master&amp;id=9b14d17739de60f413b166738ad21c1b5be66573'>Change my maintainer email address to my new one at the FreeBSD project.</a></td><td>kai</td><td><span title='2019-02-02 02:55:18 +0800'>2019-02-02</span></td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+1</span></td></tr>