1
// Gnome.PanelAppletFactory.cs - PanelAppletFactory class impl
3
// Copyright (c) 2004-2005 Novell, Inc.
5
// This code is inserted after the automatically generated code.
7
// This program is free software; you can redistribute it and/or
8
// modify it under the terms of version 2 of the Lesser GNU General
9
// Public License as published by the Free Software Foundation.
11
// This program is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
// Lesser General Public License for more details.
16
// You should have received a copy of the GNU Lesser General Public
17
// License along with this program; if not, write to the
18
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
// Boston, MA 02111-1307, USA.
24
using System.Reflection;
25
using System.Runtime.InteropServices;
29
public class PanelAppletFactory
31
private PanelAppletFactory () {}
33
private static string _IID;
34
private static string _factoryIID;
35
private static GnomeSharp.PanelAppletFactoryCallbackWrapper cb_wrapper;
37
public static void Register (Type applet_type)
39
PanelApplet applet = (PanelApplet) Activator.CreateInstance (applet_type, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.CreateInstance, null, new object[] {IntPtr.Zero}, null);
41
cb_wrapper = new GnomeSharp.PanelAppletFactoryCallbackWrapper (new PanelAppletFactoryCallback (Creation));
43
_factoryIID = applet.FactoryIID;
44
IntPtr native_iid = GLib.Marshaller.StringToPtrGStrdup (_factoryIID);
45
panel_applet_factory_main (native_iid, ((GLib.GType) applet_type).Val, cb_wrapper.NativeDelegate, IntPtr.Zero);
46
GLib.Marshaller.Free (native_iid);
49
private static bool Creation (PanelApplet applet, string iid)
57
[DllImport("panel-applet-2")]
58
static extern int panel_applet_factory_main(IntPtr iid, IntPtr applet_type, GnomeSharp.PanelAppletFactoryCallbackNative cb, IntPtr data);