#include <config.h>

#include <gnome.h>
#include <bonobo.h>

#include "Evolution.h"
#include "evolution-storage.h"

#include "evolution-shell-component.h"

#include "e-util/e-gui-utils.h"

#define COMPONENT_FACTORY_ID "OAFIID:GNOME_Evolution_Notes_shellComponentFactory"

static const EvolutionShellComponentFolderType folder_types[] = {
	{ "notes", "evolution-notes.png", TRUE, NULL, NULL },
	{ NULL, NULL }
};

static void
new_note_cb (BonoboUIComponent *uih, void *user_data, const char *path)
{
	g_print ("new note!\n");
}

static GnomeUIInfo gnome_toolbar [] = {
	GNOMEUIINFO_ITEM_STOCK (N_("New"), N_("Create a new note"), new_note_cb, GNOME_STOCK_PIXMAP_NEW),
	GNOMEUIINFO_END
};

#ifdef THIS_NEEDS_UPDATING_FOR_NEW_BONOBOS

static void
control_deactivate (BonoboControl *control, BonoboUIComponent *uih)
{
	bonobo_ui_handler_dock_remove (uih, "/Toolbar");
}

static void
control_activate (BonoboControl *control, BonoboUIComponent *uih)
{
	Bonobo_UIContainer remote_uih;
	GtkWidget *toolbar, *toolbar_frame;
	BonoboControl *toolbar_control ;

	remote_uih = bonobo_control_get_remote_ui_handler (control);
	bonobo_ui_handler_set_container (uih, remote_uih);
	bonobo_object_release_unref (remote_uih, NULL);

	toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL,
				   GTK_TOOLBAR_BOTH);

	gnome_app_fill_toolbar_with_data (GTK_TOOLBAR (toolbar),
					  gnome_toolbar, 
					  NULL, NULL);

	toolbar_frame = gtk_frame_new (NULL);
	gtk_frame_set_shadow_type (GTK_FRAME (toolbar_frame), GTK_SHADOW_OUT);
	gtk_container_add (GTK_CONTAINER (toolbar_frame), toolbar);
	gtk_widget_show (toolbar_frame);

	gtk_widget_show_all (toolbar_frame);

	toolbar_control = bonobo_control_new (toolbar_frame);
	bonobo_ui_handler_dock_add (
				    uih, "/Toolbar",
				    bonobo_object_corba_objref (BONOBO_OBJECT (toolbar_control)),
				    GNOME_DOCK_ITEM_BEH_EXCLUSIVE,
				    GNOME_DOCK_TOP,
				    1, 1, 0);
}

		  
static void
control_activate_cb (BonoboControl *control,
		     gboolean activate)
{
	BonoboUIComponent *uih;

	uih = bonobo_control_get_ui_handler (control);
	g_assert (uih);

	if (activate)
		control_activate (control, uih);
	else
		control_deactivate (control, uih);
}
#endif

static BonoboControl *
create_view (EvolutionShellComponent *shell_component,
	     const char *physical_uri,
	     void *closure)
{
	BonoboControl * control;

	control = notes_factory_new_control ();

#ifdef THIS_CODE_IS_TOTALY_DEAD
	gtk_signal_connect (GTK_OBJECT (control), "activate",
			    control_activate_cb, NULL);
#endif
	

	return control;
}

static void
owner_set_cb (EvolutionShellComponent *shell_component,
	      EvolutionShellClient shell_client,
	      gpointer user_data)
{
	g_print ("evolution-notes: Yeeeh! We have an owner!\n");	/* FIXME */
}

static void
owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data)
{
	g_print ("No owner anymore\n");
}

/* The factory function */
static BonoboObject *
notes_component_factory (BonoboGenericFactory *factory,
			 void *closure)
{
	EvolutionShellComponent *shell_component;

	shell_component = evolution_shell_component_new (folder_types, create_view, NULL);

	gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set",
			    GTK_SIGNAL_FUNC (owner_set_cb), NULL);
	gtk_signal_connect (GTK_OBJECT (shell_component), "owner_unset",
			    GTK_SIGNAL_FUNC (owner_unset_cb), NULL);
	
	return BONOBO_OBJECT (shell_component);
}


void
component_factory_init (void)
{
	static BonoboGenericFactory *factory = NULL;

	if (factory != NULL)
		return;

	factory = bonobo_generic_factory_new (COMPONENT_FACTORY_ID, notes_component_factory, NULL);

	if (factory == NULL) {
		e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
			  _("Cannot initialize Evolution's notes component."));
		exit (1);
	}
}
ependabot/npm_and_yarn/devel/electron6/files/lodash.merge-4.6.2'>dependabot/npm_and_yarn/devel/electron6/files/lodash.merge-4.6.2</option>
<option value='dependabot/npm_and_yarn/devel/electron6/files/node-fetch-2.6.1'>dependabot/npm_and_yarn/devel/electron6/files/node-fetch-2.6.1</option>
<option value='dependabot/npm_and_yarn/devel/electron6/files/serve-10.1.2'>dependabot/npm_and_yarn/devel/electron6/files/serve-10.1.2</option>
<option value='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'>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/freebsd-ports-gnome/about/?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19'>about</a><a href='/~lantw44/cgit/freebsd-ports-gnome/?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19'>summary</a><a href='/~lantw44/cgit/freebsd-ports-gnome/refs/?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&amp;id=530706893f31269bbfa303e069f2e76cbbe2fce7'>refs</a><a class='active' href='/~lantw44/cgit/freebsd-ports-gnome/log/sysutils/open/distinfo?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19'>log</a><a href='/~lantw44/cgit/freebsd-ports-gnome/tree/sysutils/open/distinfo?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&amp;id=530706893f31269bbfa303e069f2e76cbbe2fce7'>tree</a><a href='/~lantw44/cgit/freebsd-ports-gnome/commit/sysutils/open/distinfo?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&amp;id=530706893f31269bbfa303e069f2e76cbbe2fce7'>commit</a><a href='/~lantw44/cgit/freebsd-ports-gnome/diff/sysutils/open/distinfo?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&amp;id=530706893f31269bbfa303e069f2e76cbbe2fce7'>diff</a><a href='/~lantw44/cgit/freebsd-ports-gnome/stats/sysutils/open/distinfo?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19'>stats</a></td><td class='form'><form class='right' method='get' action='/~lantw44/cgit/freebsd-ports-gnome/log/sysutils/open/distinfo'>
<input type='hidden' name='h' value='dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19'/><input type='hidden' name='id' value='530706893f31269bbfa303e069f2e76cbbe2fce7'/><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/freebsd-ports-gnome/log/?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&amp;id=530706893f31269bbfa303e069f2e76cbbe2fce7'>root</a>/<a href='/~lantw44/cgit/freebsd-ports-gnome/log/sysutils?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&amp;id=530706893f31269bbfa303e069f2e76cbbe2fce7'>sysutils</a>/<a href='/~lantw44/cgit/freebsd-ports-gnome/log/sysutils/open?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&amp;id=530706893f31269bbfa303e069f2e76cbbe2fce7'>open</a>/<a href='/~lantw44/cgit/freebsd-ports-gnome/log/sysutils/open/distinfo?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&amp;id=530706893f31269bbfa303e069f2e76cbbe2fce7'>distinfo</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th></th><th class='left'>Commit message (<a href='/~lantw44/cgit/freebsd-ports-gnome/log/sysutils/open/distinfo?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&amp;id=530706893f31269bbfa303e069f2e76cbbe2fce7&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>