blam r589 - trunk/src



Author: atoker
Date: Sun Jun 15 19:55:57 2008
New Revision: 589
URL: http://svn.gnome.org/viewvc/blam?rev=589&view=rev

Log:
Make it work with WebKit


Modified:
   trunk/src/Application.cs
   trunk/src/ItemView.cs
   trunk/src/Printing.cs
   trunk/src/Utils.cs

Modified: trunk/src/Application.cs
==============================================================================
--- trunk/src/Application.cs	(original)
+++ trunk/src/Application.cs	Sun Jun 15 19:55:57 2008
@@ -17,6 +17,7 @@
 using System.IO;
 using System.Text;
 using System.Runtime.InteropServices;
+using WebKit;
 
 namespace Imendio.Blam {
 
@@ -133,7 +134,6 @@
             client.RestartStyle = RestartStyle.IfRunning;
 
             Proxy.InitProxy ();
-            Utils.GeckoInit ();
 
             Catalog.Init ("blam", Defines.GNOME_LOCALE_DIR);
 
@@ -187,7 +187,7 @@
             itemPaned.Add2 (f);
             f.Show ();
             itemView.OnUrl += OnUrl;
-            itemView.Widget.DomMouseClick += new Gecko.DomMouseClickHandler(OnButtonPressEvent);
+            //itemView.Widget.DomMouseClick += new Gecko.DomMouseClickHandler(OnButtonPressEvent);
 
             itemList = new ItemList(itemView);
             ((Container)itemListSw).Child = itemList;
@@ -267,6 +267,7 @@
         }
 #endif
 
+#if FALSE
         private void OnButtonPressEvent(object o, Gecko.DomMouseClickArgs args)
         {
             int button = Utils.GeckoGetMouseButton(args.DomEvent);
@@ -288,16 +289,19 @@
 
             args.RetVal = 0;
         }
+#endif
 
         void CopyLink(object o, EventArgs args)
         {
             Clipboard clip = Clipboard.Get(Gdk.Atom.Intern("CLIPBOARD", true));
-            clip.Text = itemView.Widget.LinkMessage;
+						// FIXME: WebKit
+            //clip.Text = itemView.Widget.LinkMessage;
         }
 
         void OpenLink(object o, EventArgs args)
         {
-            Gnome.Url.Show(itemView.Widget.LinkMessage);
+						// FIXME: WebKit
+            //Gnome.Url.Show(itemView.Widget.LinkMessage);
         }
 
         private void ChannelSelected(Channel channel)

Modified: trunk/src/ItemView.cs
==============================================================================
--- trunk/src/ItemView.cs	(original)
+++ trunk/src/ItemView.cs	Sun Jun 15 19:55:57 2008
@@ -9,7 +9,7 @@
 using Gtk;
 using System;
 using GtkSharp;
-using Gecko;
+using WebKit;
 using Mono.Unix;
 using System.Collections;
 using System.Reflection;
@@ -19,7 +19,7 @@
 
 namespace Imendio.Blam {
     public class ItemView : Gtk.EventBox {
-        private WebControl mMoz;
+        private WebView mMoz;
 	private Imendio.Blam.Item currentItem;
 
 	public bool PageLoaded;
@@ -37,7 +37,7 @@
 	    }
 	}
 
-        public WebControl Widget {
+        public WebView Widget {
             get {
                 return mMoz;
             }
@@ -45,8 +45,10 @@
 
 	public ItemView () : base()
         {
-            this.mMoz = new WebControl ();
-            Add(mMoz);
+            this.mMoz = new WebView ();
+						ScrolledWindow sw = new ScrolledWindow ();
+						sw.Add(mMoz);
+            Add(sw);
 	   
             Conf.AddNotify (Preference.FONT_PATH,
                                         new NotifyEventHandler (FontNotifyHandler));
@@ -55,17 +57,20 @@
             ProxyUpdatedCb ();
             Proxy.Updated += ProxyUpdatedCb;
 
+#if USE_GECKO
             mMoz.OpenUri += new OpenUriHandler (LinkClickedCb);
             mMoz.DestroyBrowser += new EventHandler (TitleChangedCb);
             mMoz.NetStart += new EventHandler (NetStartCb);
             mMoz.NetStop += new EventHandler (NetStopCb);
             mMoz.LinkMsg += new EventHandler (LinkMsgCb);
             mMoz.NewWindow += new NewWindowHandler(WindowCb);
+#endif
             
             mMoz.Show ();
             PageLoaded = false;
         }
         
+#if USE_GECKO
         private void WindowCb(object obj, NewWindowArgs args)
         {
             WebControl wb = obj as WebControl;
@@ -100,6 +105,7 @@
         {
             System.Console.WriteLine ("Net stop");
         }
+#endif
 
         private void Load()
         {
@@ -145,11 +151,10 @@
                 "url", url
             };
 
-			mMoz.OpenStream ("file://" + theme.Path + "/", "text/html");
-            mMoz.AppendData (theme.Render(replaces));
-            mMoz.CloseStream ();
+						mMoz.LoadString (theme.Render(replaces), "text/html", "utf8", "file://" + theme.Path + "/");
 	}
 
+#if USE_GECKO
     private void LinkClickedCb(object obj, OpenUriArgs args)
     {
         try {
@@ -161,14 +166,15 @@
 
             args.RetVal = true;
     }
+#endif
 
         private void SetFonts ()
         {
             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);
+            //Utils.GeckoSetFont (1, varFont);
+            //Utils.GeckoSetFont (2, fixedFont);
         }
 
         private void FontNotifyHandler (object sender, NotifyEventArgs args)
@@ -181,8 +187,8 @@
 
         private void ProxyUpdatedCb ()
         {
-            Utils.GeckoSetProxy (Proxy.UseProxy, Proxy.ProxyHost,
-                                 Proxy.ProxyPort);
+            //Utils.GeckoSetProxy (Proxy.UseProxy, Proxy.ProxyHost,
+            //                     Proxy.ProxyPort);
         }
     }
 }

Modified: trunk/src/Printing.cs
==============================================================================
--- trunk/src/Printing.cs	(original)
+++ trunk/src/Printing.cs	Sun Jun 15 19:55:57 2008
@@ -30,10 +30,11 @@
 	    if (!itemView.PageLoaded) {
 		return;
 	    }
-	    
+	    // FIXME: WebKit
 	    printJob = new Gnome.PrintJob(LoadPrintConfig());
 	    Gnome.PrintDialog dialog = new Gnome.PrintDialog(printJob,
-							     "Print - " + itemView.Widget.Title);
+							     "Print");
+							     //"Print - " + itemView.Widget.Title);
 	    dialog.Icon = Gdk.Pixbuf.LoadFromResource("blam.png");
 	    response = dialog.Run();
 	    dialog.Destroy();
@@ -51,8 +52,10 @@
 		printJob.Print();
 		break;
 	    case ((int)PrintButtons.Preview):
+		// FIXME: WebKit
 		PrintJobPreview preview = new PrintJobPreview(printJob,
-							      itemView.Widget.Title);
+							      "Title");
+							      //itemView.Widget.Title);
 		preview.Icon = Gdk.Pixbuf.LoadFromResource("blam.png");
 		preview.Show();
 		break;

Modified: trunk/src/Utils.cs
==============================================================================
--- trunk/src/Utils.cs	(original)
+++ trunk/src/Utils.cs	Sun Jun 15 19:55:57 2008
@@ -27,10 +27,12 @@
             static extern void blam_gecko_utils_init_services ();
         public static void GeckoInit ()
         {
+#if USE_GECKO
             Gecko.WebControl.CompPath = Defines.MOZ_HOME;
             Gecko.WebControl.SetProfilePath(Defines.APP_HOMEDIR + "/mozilla", "blam");
             Gecko.WebControl.PushStartup();
             blam_gecko_utils_init_services ();
+#endif
         }
 
         [DllImport("libblam.so")]



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