3 // Mikael Hallendal <micke@imendio.com>
9 using System
.Runtime
.InteropServices
;
16 namespace Beagle
.Util
{
18 public delegate bool ButtonPressHandler (IntPtr evnt
);
19 public delegate bool KeyPressHandler (IntPtr evnt
);
20 public delegate int SortFunc (IntPtr a
, IntPtr b
);
21 public delegate void DragDataHandler (IntPtr context
,
27 public class GeckoUtils
{
29 private static GConf
.Client gconf_client
= null;
30 private static void EnsureClient ()
32 if (gconf_client
== null)
33 gconf_client
= new GConf
.Client ();
37 private static void SetFonts ()
42 font
= (string) gconf_client
.Get ("/desktop/gnome/interface/font_name");
43 } catch (GConf
.NoSuchKeyException
) {
47 GeckoUtils
.SetFont (1, font
);
50 font
= (string) gconf_client
.Get ("/desktop/gnome/interface/monospace_font_name");
51 } catch (GConf
.NoSuchKeyException
) {
52 font
= "monospace 12";
55 GeckoUtils
.SetFont (2, font
);
58 public static void FontNotifyHandler (object sender
,
61 if (args
.Key
== "/desktop/gnome/interface/font_name" ||
62 args
.Key
== "/desktop/gnome/interface/monospace_font_name")
66 public static void SetSystemFonts ()
69 gconf_client
= new GConf
.Client ();
70 gconf_client
.AddNotify ("/desktop/gnome/interface",
71 new NotifyEventHandler (FontNotifyHandler
));
75 [DllImport("libgeckoglue.so")]
76 static extern void blam_gecko_utils_init_services ();
77 public static void Init ()
79 blam_gecko_utils_init_services ();
82 [DllImport("libgeckoglue.so")]
83 static extern void blam_gecko_utils_set_font (int type
, string font
);
84 public static void SetFont (int type
, string font
)
86 blam_gecko_utils_set_font (type
, font
);
89 [DllImport("libgeckoglue.so")]
90 static extern void blam_gecko_utils_set_proxy (bool use_proxy
, string host
, int port
);
92 public static void SetProxy (bool useProxy
, string host
, int port
)
94 blam_gecko_utils_set_proxy (useProxy
, host
, port
);