[blam/blam-1.8.10] Remove gnome-sharp dependency



commit c43de2d768165ac087a6cb19ca93989b1fa60b20
Author: GyÃrgy Ballà <ballogy freestart hu>
Date:   Sat May 5 21:39:03 2012 +0200

        Remove gnome-sharp dependency

 blam.exe.config               |    1 +
 configure.in                  |    4 +--
 src/Application.cs            |   24 ++++-----------------
 src/ItemList.cs               |    6 ++--
 src/ItemView.cs               |    5 ++-
 src/Makefile.am               |    5 ++-
 src/gtk-sharp-beans/Global.cs |   46 +++++++++++++++++++++++++++++++++++++++++
 7 files changed, 62 insertions(+), 29 deletions(-)
---
diff --git a/blam.exe.config b/blam.exe.config
index 3350a9c..2bc142a 100644
--- a/blam.exe.config
+++ b/blam.exe.config
@@ -1,4 +1,5 @@
 <configuration>
   <dllmap dll="gdk-x11-2.0" target="libgdk-x11-2.0.so.0"/>
   <dllmap dll="libX11" target="libX11.so.6"/>
+  <dllmap dll="libgtk-win32-2.0-0.dll" target="libgtk-x11-2.0.so" />
 </configuration>
diff --git a/configure.in b/configure.in
index cac1eae..5a925cd 100644
--- a/configure.in
+++ b/configure.in
@@ -39,7 +39,6 @@ fi
 dnl Find mono
 MONO_REQUIRED_VERSION=1.1.17
 GTKSHARP_REQUIRED_VERSION=2.8.2
-GNOMESHARP_REQUIRED_VERSION=2.16.1
 GCONF_REQUIRED_VERSION=2.4
 WEBKITSHARP_REQUIRED_VERSION=0.2
 
@@ -47,8 +46,7 @@ PKG_CHECK_MODULES(BLAM,
 		  gtk-sharp-2.0 >= $GTKSHARP_REQUIRED_VERSION
 			webkit-sharp-1.0 >= $WEBKITSHARP_REQUIRED_VERSION
 		  gconf-sharp-2.0 >= $GTKSHARP_REQUIRED_VERSION
-		  glade-sharp-2.0 >= $GTKSHARP_REQUIRED_VERSION
-		  gnome-sharp-2.0 >= $GNOMESHARP_REQUIRED_VERSION)
+		  glade-sharp-2.0 >= $GTKSHARP_REQUIRED_VERSION)
 
 AC_SUBST(BLAM_LIBS)
 
diff --git a/src/Application.cs b/src/Application.cs
index c55d9a1..eff8f47 100644
--- a/src/Application.cs
+++ b/src/Application.cs
@@ -11,7 +11,6 @@ using Glade;
 using Gdk;
 using Gtk;
 using GtkSharp;
-using Gnome;
 using Mono.Unix;
 using System;
 using System.Collections;
@@ -45,7 +44,7 @@ namespace Imendio.Blam {
         void ShowWindow();
     }
 
-    public class Application : Program, IBlamReader, IFeedReader {
+    public class Application : IBlamReader, IFeedReader {
 
 #if ENABLE_DBUS
         static string bus_name = "org.gnome.feed.Reader";
@@ -101,8 +100,6 @@ namespace Imendio.Blam {
 
         private uint              mAutoRefreshId;
 
-        Gnome.Client client = null;
-
         public static TargetEntry[] DragEntries = new TargetEntry[] {
             new TargetEntry("STRING", 0, (uint)TargetType.String),
             new TargetEntry("text/plain", 0, (uint)TargetType.String),
@@ -139,15 +136,11 @@ namespace Imendio.Blam {
 			}
 		}
 
-        public Application (string[] args, params object[] props) : base ("Blam", Defines.VERSION, Modules.UI, args, props)
+        public Application (string[] args)
         {
             SetupDBus();
 
-            client = new Gnome.Client();
-            client.Connect();
-            client.SaveYourself += SaveMyself;
-            client.Die += QuitActivated;
-            client.RestartStyle = RestartStyle.IfRunning;
+            Gtk.Application.Init ();
 
             Proxy.InitProxy ();
 
@@ -537,13 +530,6 @@ namespace Imendio.Blam {
             args.RetVal = true;
         }
         
-        public void SaveMyself(object obj, SaveYourselfArgs args)
-        {
-            string[] argv = {"blam"};
-
-            client.SetRestartCommand(1, argv);
-        }
-
         public void QuitActivated(object obj, EventArgs args)
         {
             StopDBus();
@@ -552,7 +538,7 @@ namespace Imendio.Blam {
             mCollection.SaveToFile ();
             mCollection.StopAllThreads();
 
-            Quit();
+            Gtk.Main.Quit();
         }
 
         public void CopyActivated (object obj, EventArgs args)
@@ -882,7 +868,7 @@ namespace Imendio.Blam {
 						}
 
             TheApp = new Application (args);
-            TheApp.Run ();
+            Gtk.Application.Run ();
             // new Application(args).Run();
         }
     }
diff --git a/src/ItemList.cs b/src/ItemList.cs
index da4763c..df4e6a4 100644
--- a/src/ItemList.cs
+++ b/src/ItemList.cs
@@ -287,13 +287,13 @@ namespace Imendio.Blam {
         string icon = null;
 
         if(item.Unread == true){
-            icon = Gnome.Stock.BookRed;
+            icon = "gnome-stock-book-red";
         } else {
-            icon = Gnome.Stock.BookOpen;
+            icon = "gnome-stock-book-open";
         }
 
         if(item.Old == true && item.Unread == true){
-            icon = Gnome.Stock.BookGreen;
+            icon = "gnome-stock-book-green";
         }
 
         if((cell as CellRendererPixbuf).IconName != icon){
diff --git a/src/ItemView.cs b/src/ItemView.cs
index 3daf450..3375b4d 100644
--- a/src/ItemView.cs
+++ b/src/ItemView.cs
@@ -73,8 +73,9 @@ namespace Imendio.Blam {
                     args.RetVal = NavigationResponse.Accept;
                     return;
             }
-            Gnome.Url.Show(args.Request.Uri);
-                    args.RetVal = NavigationResponse.Ignore;
+
+            GtkBeans.Global.ShowUri(null, args.Request.Uri);
+            args.RetVal = NavigationResponse.Ignore;
         }
         catch (Exception e) {
             Console.Error.WriteLine("Couldn't show URL: " + args.Request.Uri + e.Message);
diff --git a/src/Makefile.am b/src/Makefile.am
index cfbb0bd..5daed86 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -35,7 +35,8 @@ BLAM_CSFILES = Application.cs \
 	       ThemeManager.cs \
 	       TrayIcon.cs \
 	       Utils.cs \
-	       Proxy.cs
+	       Proxy.cs \
+	       gtk-sharp-beans/*.cs
 
 GENERATED_CSFILES = \
 	       Defines.cs
@@ -59,7 +60,7 @@ Defines.cs: Defines.cs.in ../config.log
 
 blamlibdir = $(prefix)/lib/blam
 blam.exe: $(BLAM_CSFILES) $(GENERATED_CSFILES) blam.glade 
-	$(CSC) $(FLAGS) -lib:$(top_srcdir)/lib $(RESOURCES) $(BLAM_LIBS) $(ASSEMBLIES) $(BLAM_CSFILES) $(GENERATED_CSFILES) -out:$@
+	$(CSC) -unsafe $(FLAGS) -lib:$(top_srcdir)/lib $(RESOURCES) $(BLAM_LIBS) $(ASSEMBLIES) $(BLAM_CSFILES) $(GENERATED_CSFILES) -out:$@
 
 all: blam.exe
 
diff --git a/src/gtk-sharp-beans/Global.cs b/src/gtk-sharp-beans/Global.cs
new file mode 100644
index 0000000..09e065a
--- /dev/null
+++ b/src/gtk-sharp-beans/Global.cs
@@ -0,0 +1,46 @@
+// GtkBeans.Global.cs
+//
+// Author(s):
+//      Stephane Delcroix <stephane delcroix org>
+//
+// Copyright (c) 2009 Novell, Inc.
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of version 2 of the Lesser GNU General 
+// Public License as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+using System;
+using System.Collections;
+using System.Runtime.InteropServices;
+
+namespace GtkBeans {
+	public static class Global {
+		[DllImport("libgtk-win32-2.0-0.dll")]
+		static extern unsafe bool gtk_show_uri(IntPtr screen, IntPtr uri, uint timestamp, out IntPtr error);
+
+		public static unsafe bool ShowUri(Gdk.Screen screen, string uri, uint timestamp) {
+			IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
+			IntPtr error = IntPtr.Zero;
+			bool raw_ret = gtk_show_uri(screen == null ? IntPtr.Zero : screen.Handle, native_uri, timestamp, out error);
+			bool ret = raw_ret;
+			GLib.Marshaller.Free (native_uri);
+			if (error != IntPtr.Zero) throw new GLib.GException (error);
+			return ret;
+		}
+
+		public static bool ShowUri (Gdk.Screen screen, string uri)
+		{
+			return ShowUri (screen, uri, Gdk.EventHelper.GetTime (new Gdk.Event(IntPtr.Zero)));
+		}
+	}
+}



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