574aa2ee06
* configure.in : check for panelapplet in enable_gnome and remove all the stuff for a separate panelapplet-sharp assembly. * Makefile.am : remove panelapplet dir from build. * gnome/BonoboUIVerb.cs : moved from panelapplet. * gnome/Gnome.metadata : add rules from panelapplet. * gnome/Makefile.am : add new files. * gnome/PanelApplet.custom : moved from panelapplet. * gnome/PanelAppletFactory.cs : moved from panelapplet. * gnome/glue/panelapplet.c : moved from panelapplet. * gnome/glue/Makefile.am : add new file. * gnomedb/GnomeDb.metadata : hide a newly parsed "obsolete" type. * gtk/Gtk.metadata : hide a newly parsed "obsolete" callback type. * panelapplet : kill dir. * parser/gapi2xml.pl : update callback name sanity check. * sources/gtk-sharp-sources.xml : move panelapplet parse into gnome. * */*-api.raw : regen. svn path=/trunk/gtk-sharp/; revision=38509
36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
using System;
|
|
using System.Reflection;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace Gnome
|
|
{
|
|
public class PanelAppletFactory
|
|
{
|
|
private PanelAppletFactory () {}
|
|
|
|
private static string _IID;
|
|
private static string _factoryIID;
|
|
private static GnomeSharp.PanelAppletFactoryCallbackWrapper cb_wrapper;
|
|
|
|
public static void Register (Type applet_type)
|
|
{
|
|
PanelApplet applet = (PanelApplet) Activator.CreateInstance (applet_type, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.CreateInstance, null, new object[] {IntPtr.Zero}, null);
|
|
|
|
cb_wrapper = new GnomeSharp.PanelAppletFactoryCallbackWrapper (new PanelAppletFactoryCallback (Creation), null);
|
|
_IID = applet.IID;
|
|
_factoryIID = applet.FactoryIID;
|
|
panel_applet_factory_main(_factoryIID, GLib.Object.LookupGType (applet_type).Val, cb_wrapper.NativeDelegate, IntPtr.Zero);
|
|
}
|
|
|
|
private static bool Creation (PanelApplet applet, string iid)
|
|
{
|
|
if (_IID != iid)
|
|
return false;
|
|
applet.Creation ();
|
|
return true;
|
|
}
|
|
|
|
[DllImport("panel-applet-2")]
|
|
static extern int panel_applet_factory_main(string iid, IntPtr applet_type, GnomeSharp.PanelAppletFactoryCallbackNative cb, IntPtr data);
|
|
}
|
|
}
|