blam r617 - trunk/src



Author: atoker
Date: Fri Jul  4 11:43:58 2008
New Revision: 617
URL: http://svn.gnome.org/viewvc/blam?rev=617&view=rev

Log:
Add font settings support, not enabled for now


Modified:
   trunk/src/ItemView.cs

Modified: trunk/src/ItemView.cs
==============================================================================
--- trunk/src/ItemView.cs	(original)
+++ trunk/src/ItemView.cs	Fri Jul  4 11:43:58 2008
@@ -21,6 +21,9 @@
 namespace Imendio.Blam {
     public class ItemView : Gtk.EventBox {
         private WebView webView;
+#if ENABLE_FONTS
+        private WebSettings webSettings;
+#endif
 	private Imendio.Blam.Item currentItem;
 
 	public bool PageLoaded;
@@ -47,6 +50,10 @@
 	public ItemView () : base()
         {
             this.webView = new WebView ();
+#if ENABLE_FONTS
+            this.webSettings = new WebSettings ();
+            webView.Settings = webSettings;
+#endif
 						ScrolledWindow sw = new ScrolledWindow ();
 						sw.Add(webView);
             Add(sw);
@@ -130,8 +137,17 @@
             string varFont = Conf.Get (Preference.VARIABLE_FONT, "Sans 12");
             string fixedFont = Conf.Get (Preference.FIXED_FONT, "Mono 12");
 
-            //Utils.GeckoSetFont (1, varFont);
-            //Utils.GeckoSetFont (2, fixedFont);
+            // Disabled for now since it's not clear that overriding the
+            // default font settings makes sense.
+#if ENABLE_FONTS
+            Pango.FontDescription varDesc = Pango.FontDescription.FromString (varFont);
+						webSettings.DefaultFontFamily = varDesc.Family;
+						//webSettings.DefaultFontSize = varDesc.Size / 1024;
+
+            Pango.FontDescription fixedDesc = Pango.FontDescription.FromString (fixedFont);
+						webSettings.MonospaceFontFamily = fixedDesc.Family;
+						//webSettings.MonospaceFontSize = fixedDesc.Size / 1024;
+#endif
         }
 
         private void FontNotifyHandler (object sender, NotifyEventArgs args)
@@ -148,4 +164,25 @@
             //                     Proxy.ProxyPort);
         }
     }
+
+#if ENABLE_FONTS
+    class WebSettings : WebKit.WebSettings {
+        public WebSettings() {}
+        
+        public string DefaultFontFamily {
+            get { return (string)GetProperty("default-font-family").Val; }
+            set { SetProperty("default-font-family", new GLib.Value(value)); }
+        }
+
+        public int DefaultFontSize {
+            get { return (int)GetProperty("default-font-size").Val; }
+            set { SetProperty("default-font-size", new GLib.Value(value)); }
+        }
+
+        public string MonospaceFontFamily {
+            get { return (string)GetProperty("monospace-font-family").Val; }
+            set { SetProperty("monospace-font-family", new GLib.Value(value)); }
+        }
+    }
+#endif
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]