New e-d-s backend which indexes all local addressbooks and calendars.
[beagle.git] / Util / GeckoUtils.cs
blob6d561bcada91eb4f810843d300742ae9ce16fa6d
1 //
2 // Author:
3 // Mikael Hallendal <micke@imendio.com>
4 //
5 // (C) 2004 Imendio HB
6 //
8 using System;
9 using System.Runtime.InteropServices;
10 using Gtk;
11 using GConf;
12 using Pango;
14 using GLib;
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,
22 IntPtr data,
23 string text,
24 uint time);
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 ()
39 string font;
41 try {
42 font = (string) gconf_client.Get ("/desktop/gnome/interface/font_name");
43 } catch (GConf.NoSuchKeyException) {
44 font = "sans 12";
47 GeckoUtils.SetFont (1, font);
49 try {
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,
59 NotifyEventArgs args)
61 if (args.Key == "/desktop/gnome/interface/font_name" ||
62 args.Key == "/desktop/gnome/interface/monospace_font_name")
63 SetFonts ();
66 public static void SetSystemFonts ()
68 EnsureClient ();
69 gconf_client = new GConf.Client ();
70 gconf_client.AddNotify ("/desktop/gnome/interface",
71 new NotifyEventHandler (FontNotifyHandler));
72 SetFonts ();
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);