blam r604 - trunk/src



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

Log:
Make main Application class implement IFeedReader directly

DBusMgr essentially does very little now and can be rolled into
Application.cs (with appropriate #if ENABLE_DBUS wrapping).

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:54 2008
@@ -22,7 +22,15 @@
 
 namespace Imendio.Blam {
 
-    public class Application : Program {
+#if ENABLE_DBUS
+    [NDesk.DBus.Interface("org.gnome.feed.Reader")]
+#endif
+    public interface IFeedReader {
+        bool Subscribe(string url);
+        void ShowWindow();
+    }
+
+    public class Application : Program, IFeedReader {
 
 	[DllImport("libc")]
 	private static extern int prctl(int option, byte [] arg2, ulong arg3, 
@@ -234,11 +242,23 @@
             }
         }
 
+        // Exposed by D-Bus
         public void ShowWindow()
         {
             this.mainWindow.Present();
         }
 
+        // Exposed by D-Bus
+        public bool Subscribe(string url)
+        {
+            Channel channel = new Channel();
+            channel.Url = url;
+            
+            CCollection.Add(channel);
+            
+            return true;
+        }
+
 #if ENABLE_DBUS
         private void SetupDBus()
         {

Modified: trunk/src/DBus.cs
==============================================================================
--- trunk/src/DBus.cs	(original)
+++ trunk/src/DBus.cs	Tue Jun 17 02:12:54 2008
@@ -9,14 +9,7 @@
 using org.freedesktop.DBus;
 
 namespace Imendio.Blam {
-    [Interface("org.gnome.feed.Reader")]
-    public interface IFeedReader {
-        void Test();
-        bool Subscribe(string url);
-        void ShowWindow();
-    }
-
-    public class DBusMgr : IFeedReader {
+    public class DBusMgr {
 
         public static string bus_name = "org.gnome.feed.Reader";
         public static ObjectPath obj_path = new ObjectPath("/org/gnome/feed/Reader");
@@ -25,11 +18,6 @@
 
         private Application app = null;
 
-        public void Test()
-        {
-            System.Console.WriteLine("tested");
-        }
-
         public DBusMgr(Application app)
         {
             BusG.Init();
@@ -45,7 +33,7 @@
         {
             ReqNameReply = bus.RequestName(bus_name);
             if(ReqNameReply == RequestNameReply.PrimaryOwner){
-                bus.Register(obj_path, this);
+                bus.Register(obj_path, app);
             }
         }
 
@@ -69,20 +57,5 @@
 
             return bus.GetObject<IFeedReader>(bus_name, obj_path);
         }
-
-        public bool Subscribe(string url)
-        {
-            Channel channel = new Channel();
-            channel.Url = url;
-            
-            app.CCollection.Add(channel);
-            
-            return true;
-        }
-
-		public void ShowWindow()
-		{
-			app.ShowWindow();
-		}
     }
 }



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