blam r603 - trunk/src



Author: atoker
Date: Tue Jun 17 02:12:51 2008
New Revision: 603
URL: http://svn.gnome.org/viewvc/blam?rev=603&view=rev

Log:
Replace MarshalByRefObject use with an interface.

MarshalByRefObject for D-Bus is deprecated and adds needless indirection
here.

Modified:
   trunk/src/Application.cs
   trunk/src/DBus.cs

Modified: trunk/src/Application.cs
==============================================================================
--- trunk/src/Application.cs	(original)
+++ trunk/src/Application.cs	Tue Jun 17 02:12:51 2008
@@ -247,10 +247,9 @@
                 dbusmgr.Register();
 
 				/* Yes, this is the state that's returned to us. */
-                if(dbusmgr.ReqNameReply == org.freedesktop.DBus.RequestNameReply.InQueue){
-                    DBusClient dbc = new DBusClient();
-                    dbc.SetUp();
-                    dbc.ShowWindow();
+                if(dbusmgr.ReqNameReply != org.freedesktop.DBus.RequestNameReply.PrimaryOwner){
+                    IFeedReader reader = DBusMgr.GetInstance();
+                    reader.ShowWindow();
                     Gdk.Global.NotifyStartupComplete ();
                     Environment.Exit(0);
                 }

Modified: trunk/src/DBus.cs
==============================================================================
--- trunk/src/DBus.cs	(original)
+++ trunk/src/DBus.cs	Tue Jun 17 02:12:51 2008
@@ -10,7 +10,13 @@
 
 namespace Imendio.Blam {
     [Interface("org.gnome.feed.Reader")]
-    public class DBusMgr : MarshalByRefObject {
+    public interface IFeedReader {
+        void Test();
+        bool Subscribe(string url);
+        void ShowWindow();
+    }
+
+    public class DBusMgr : IFeedReader {
 
         public static string bus_name = "org.gnome.feed.Reader";
         public static ObjectPath obj_path = new ObjectPath("/org/gnome/feed/Reader");
@@ -38,7 +44,7 @@
         public void Register()
         {
             ReqNameReply = bus.RequestName(bus_name);
-            if(ReqNameReply ==  RequestNameReply.PrimaryOwner){
+            if(ReqNameReply == RequestNameReply.PrimaryOwner){
                 bus.Register(obj_path, this);
             }
         }
@@ -56,12 +62,12 @@
             return bus.NameHasOwner(bus_name);
         }
 
-        public static DBusMgr GetInstance()
+        public static IFeedReader GetInstance()
         {
             if(!running())
                 return null;
 
-            return bus.GetObject<DBusMgr>(bus_name, obj_path);
+            return bus.GetObject<IFeedReader>(bus_name, obj_path);
         }
 
         public bool Subscribe(string url)
@@ -79,19 +85,4 @@
 			app.ShowWindow();
 		}
     }
-
-    public class DBusClient
-    {
-        DBusMgr dbus = null;
-
-        public void SetUp()
-        {
-            dbus = DBusMgr.GetInstance();
-        }
-
-        public void ShowWindow()
-        {
-            dbus.ShowWindow();
-        }
-    }
 }



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