f-spot r4240 - in trunk/dpap-sharp: . DPAPBrowser DPAPService dpap-client
- From: apart svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r4240 - in trunk/dpap-sharp: . DPAPBrowser DPAPService dpap-client
- Date: Mon, 11 Aug 2008 20:26:22 +0000 (UTC)
Author: apart
Date: Mon Aug 11 20:26:22 2008
New Revision: 4240
URL: http://svn.gnome.org/viewvc/f-spot?rev=4240&view=rev
Log:
Separating DPAP browser & server addins
Added:
trunk/dpap-sharp/DPAPBrowser/
trunk/dpap-sharp/DPAPBrowser/DPAPBrowser.addin.xml
trunk/dpap-sharp/DPAPBrowser/DPAPBrowser.cs
trunk/dpap-sharp/DPAPBrowser/DPAPBrowser.mdp
trunk/dpap-sharp/DPAPBrowser/Makefile.am
Modified:
trunk/dpap-sharp/ChangeLog
trunk/dpap-sharp/DPAPService/DPAPService.addin.xml
trunk/dpap-sharp/DPAPService/DPAPService.cs
trunk/dpap-sharp/Makefile.am
trunk/dpap-sharp/dpap-client/Makefile.am
trunk/dpap-sharp/dpap-client/dpap-client.mdp
Added: trunk/dpap-sharp/DPAPBrowser/DPAPBrowser.addin.xml
==============================================================================
--- (empty file)
+++ trunk/dpap-sharp/DPAPBrowser/DPAPBrowser.addin.xml Mon Aug 11 20:26:22 2008
@@ -0,0 +1,17 @@
+<Addin namespace="FSpot"
+ id="DPAPBrowser"
+ version="0.4.4.100"
+ name="DPAP Browser"
+ description="Browser iPhoto shares"
+ author="Andrzej Wytyczak-Partyka"
+ url="http://f-spot.org/Extensions"
+ category="Services">
+ <Dependencies>
+ <Addin id="Core" version="0.4.4.100"/>
+ </Dependencies>
+ <Extension path = "/FSpot/Sidebar">
+ <SidebarPage sidebar_page_type="DPAP.DPAPBrowser"/>
+ </Extension>
+</Addin>
+
+
Added: trunk/dpap-sharp/DPAPBrowser/DPAPBrowser.cs
==============================================================================
--- (empty file)
+++ trunk/dpap-sharp/DPAPBrowser/DPAPBrowser.cs Mon Aug 11 20:26:22 2008
@@ -0,0 +1,174 @@
+// DPAPBrowser.cs
+//
+// Author:
+// Andrzej Wytyczak-Partyka <iapart gmail com>
+// Copyright (C) 2008 Andrzej Wytyczak-Partyka
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// 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 General Public License for more details.
+//
+// You should have received a copy of the GNU 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 FSpot;
+using FSpot.Extensions;
+using FSpot.Utils;
+using FSpot.Widgets;
+
+using System.IO;
+using DPAP;
+using Gtk;
+
+namespace DPAP {
+
+ public class DPAPPageWidget : ScrolledWindow {
+ TreeView tree;
+ TreeStore list;
+ ServiceDiscovery sd;
+ Client client;
+
+ public DPAPPageWidget ()
+ {
+ Console.WriteLine ("DPAP Page widget ctor!");
+ tree = new TreeView ();
+ Add (tree);
+ TreeViewColumn artistColumn = new Gtk.TreeViewColumn ();
+ //artistColumn.Title = "Artist";
+
+ Gtk.CellRendererText artistNameCell = new Gtk.CellRendererText ();
+ artistNameCell.Visible = true;
+ artistColumn.PackStart (artistNameCell,false);
+ tree.AppendColumn (artistColumn);
+ //tree.AppendColumn ("Icon", new Gtk.CellRendererPixbuf (), "pixbuf", 0);
+
+
+ list = new TreeStore (typeof (string));
+ tree.Model = list;
+
+ artistColumn.AddAttribute (artistNameCell, "text", 0);
+ //list.AppendValues ("test");
+
+ tree.Selection.Changed += OnSelectionChanged;
+ // tree.ShowNow ();
+ // ShowAll ();
+ sd = new DPAP.ServiceDiscovery ();
+ sd.Found += OnServiceFound;
+ sd.Start ();
+ }
+
+ private void OnSelectionChanged (object o, EventArgs args)
+ {
+ Gtk.TreeSelection selection = (Gtk.TreeSelection) o;
+ Gtk.TreeModel model;
+ Gtk.TreeIter iter;
+ string data;
+ if (selection.GetSelected (out model, out iter)) {
+ GLib.Value val = GLib.Value.Empty;
+ model.GetValue (iter, 0, ref val);
+ data = (string) val.Val;
+
+ if (list.IterDepth (iter) == 0)
+ Connect (data);
+ else
+ ViewAlbum (data);
+ val.Dispose ();
+ }
+
+ }
+
+ private void ViewAlbum (string name)
+ {
+ Console.WriteLine ("View Album !");
+ Database d = client.Databases [0];
+
+ Directory.CreateDirectory ("/tmp/" + client.Databases [0].Name);
+ //Console.WriteLine ("Looking for album '" + name + "'");
+ foreach (DPAP.Album alb in d.Albums)
+ {
+ //Console.WriteLine ("\t -- album '" + alb.Name + "'");
+ if (!alb.Name.Equals (name))
+ continue;
+
+ Directory.CreateDirectory ("/tmp/" + client.Databases [0].Name + "/" + alb.Name);
+ foreach (DPAP.Photo ph in alb.Photos)
+ {
+ if (ph != null)
+ {
+ // Console.WriteLine ("\t\tFile: " + ph.Title + " format = " + ph.Format + "size=" + ph.Width +"x" +ph.Height + " ID=" + ph.Id);
+ d.DownloadPhoto (ph,"/tmp/" + client.Databases [0].Name + "/" + alb.Name + "/" + ph.FileName);
+ //FSpot.JpegFile = new JpegFile ("file:///tmp/" + client.Databases [0].Name + "/" + ph.FileName);
+ }
+ }
+ FSpot.Core.FindInstance ().View ("file:///tmp/" + client.Databases [0].Name + "/" + alb.Name);
+ break;
+ }
+
+
+ }
+
+ private void Connect (string svcName)
+ {
+ Service service = sd.ServiceByName (svcName);
+ System.Console.WriteLine ("Connecting to {0} at {1}:{2}", service.Name, service.Address, service.Port);
+
+ client = new Client (service);
+ TreeIter iter;
+ //list.GetIterFromString (out iter, svcName);
+ list.GetIterFirst (out iter);
+ foreach (Database d in client.Databases){
+
+ // list.AppendValues (iter,d.Name);
+ Console.WriteLine ("Database " + d.Name);
+
+ foreach (Album alb in d.Albums)
+ list.AppendValues (iter, alb.Name);
+
+ // Console.WriteLine ("\tAlbum: "+alb.Name + ", id=" + alb.getId () + " number of items:" + alb.Photos.Count);
+ // Console.WriteLine (d.Photos [0].FileName);
+
+ }
+ }
+
+ private void OnServiceFound (object o, ServiceArgs args)
+ {
+ Service service = args.Service;
+ Console.WriteLine ("ServiceFound " + service.Name);
+ if (service.Name.Equals ("f-spot photos")) return;
+ list.AppendValues (service.Name);
+
+/* System.Console.WriteLine ("Connecting to {0} at {1}:{2}", service.Name, service.Address, service.Port);
+
+ //client.Logout ();
+ //Console.WriteLine ("Press <enter> to exit...");
+*/
+
+ }
+
+ }
+
+ public class DPAPBrowser : SidebarPage
+ {
+ //public DPAPPage () { }
+ private static DPAPPageWidget widget;
+ public DPAPBrowser () : base (new DPAPPageWidget (), "Shared items", "gtk-new")
+ {
+ Console.WriteLine ("Starting DPAP client...");
+
+ widget = (DPAPPageWidget)SidebarWidget;
+ }
+
+
+ }
+
+}
Added: trunk/dpap-sharp/DPAPBrowser/DPAPBrowser.mdp
==============================================================================
--- (empty file)
+++ trunk/dpap-sharp/DPAPBrowser/DPAPBrowser.mdp Mon Aug 11 20:26:22 2008
@@ -0,0 +1,28 @@
+<Project name="DPAPBrowser" fileversion="2.0" language="C#" clr-version="Net_2_0" ctype="DotNetProject">
+ <Configurations active="Debug">
+ <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+ <Output directory="bin/Debug" assembly="DPAPBrowser" />
+ <Build debugmode="True" target="Exe" />
+ <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" />
+ <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" definesymbols="DEBUG" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+ </Configuration>
+ <Configuration name="Release" ctype="DotNetProjectConfiguration">
+ <Output directory="bin/Release" assembly="DPAPBrowser" />
+ <Build debugmode="False" target="Exe" />
+ <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" />
+ <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+ </Configuration>
+ </Configurations>
+ <Contents>
+ <File name="DPAPBrowser.cs" subtype="Code" buildaction="Compile" />
+ </Contents>
+ <References>
+ <ProjectReference type="Project" localcopy="True" refto="dpap-sharp" />
+ <ProjectReference type="Gac" localcopy="True" refto="FSpot.Core, Version=0.0.0.0, Culture=neutral" />
+ <ProjectReference type="Gac" localcopy="True" refto="FSpot.Utils, Version=0.0.0.0, Culture=neutral" />
+ <ProjectReference type="Gac" localcopy="True" refto="f-spot, Version=0.4.3.1, Culture=neutral" />
+ <ProjectReference type="Assembly" localcopy="True" refto="../../src/FSpot.Widgets.dll" />
+ <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ </References>
+</Project>
\ No newline at end of file
Added: trunk/dpap-sharp/DPAPBrowser/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/dpap-sharp/DPAPBrowser/Makefile.am Mon Aug 11 20:26:22 2008
@@ -0,0 +1,48 @@
+include $(top_srcdir)/Makefile.include
+
+PLUGIN_NAME = DPAPBrowser
+
+PLUGIN_MANIFEST = $(PLUGIN_NAME).addin.xml
+
+PLUGIN_ASSEMBLY = $(PLUGIN_NAME).dll
+
+PLUGIN_SOURCES = \
+ $(srcdir)/DPAPBrowser.cs
+# $(srcdir)/BeagleNotifier.cs
+
+
+REFS = \
+ -r:../../src/f-spot.exe \
+ -r:../../src/FSpot.Core.dll \
+ -r:../../src/FSpot.Widgets.dll \
+ -r:../../src/FSpot.Utils.dll \
+ -r:../lib/dpap-sharp.dll
+# $(LINK_BEAGLE)
+
+PKGS = \
+ -pkg:gtk-sharp-2.0
+
+RESOURCES = \
+ -resource:$(srcdir)/$(PLUGIN_MANIFEST)
+
+all: $(PLUGIN_ASSEMBLY)
+
+mpack: $(PLUGIN_ASSEMBLY)
+ mautil p $(PLUGIN_ASSEMBLY)
+
+$(PLUGIN_ASSEMBLY): $(PLUGIN_SOURCES) $(PLUGIN_MANIFEST)
+ $(CSC_LIB) -out:$@ $(CSC_DEFINES) $(PLUGIN_SOURCES) $(REFS) $(PKGS) $(ASSEMBLIES) $(RESOURCES)
+
+plugindir = $(pkglibdir)/extensions
+
+plugin_DATA = \
+ $(PLUGIN_ASSEMBLY)
+
+EXTRA_DIST = \
+ $(PLUGIN_SOURCES) \
+ $(PLUGIN_MANIFEST)
+
+CLEANFILES = \
+ $(PLUGIN_ASSEMBLY) \
+ $(PLUGIN_ASSEMBLY).mdb \
+ *.mpack
Modified: trunk/dpap-sharp/DPAPService/DPAPService.addin.xml
==============================================================================
--- trunk/dpap-sharp/DPAPService/DPAPService.addin.xml (original)
+++ trunk/dpap-sharp/DPAPService/DPAPService.addin.xml Mon Aug 11 20:26:22 2008
@@ -10,10 +10,7 @@
<Addin id="Core" version="0.4.4.100"/>
</Dependencies>
<Extension path = "/FSpot/Services">
- <Service class="DPAPService.DPAPService"/>
- </Extension>
- <Extension path = "/FSpot/Sidebar">
- <SidebarPage sidebar_page_type="DPAPService.DPAPPage"/>
+ <Service class="DPAP.DPAPService"/>
</Extension>
</Addin>
Modified: trunk/dpap-sharp/DPAPService/DPAPService.cs
==============================================================================
--- trunk/dpap-sharp/DPAPService/DPAPService.cs (original)
+++ trunk/dpap-sharp/DPAPService/DPAPService.cs Mon Aug 11 20:26:22 2008
@@ -1,4 +1,4 @@
-// DPAPService.cs
+// DPAPService.cs : DPAP Server for f-spot
//
// Author:
// Andrzej Wytyczak-Partyka <iapart gmail com>
@@ -30,147 +30,9 @@
using DPAP;
using Gtk;
-namespace DPAPService {
+namespace DPAP {
- public class DPAPPageWidget : ScrolledWindow {
- TreeView tree;
- TreeStore list;
- ServiceDiscovery sd;
- Client client;
-
- public DPAPPageWidget ()
- {
- Console.WriteLine ("DPAP Page widget ctor!");
- tree = new TreeView ();
- Add (tree);
- TreeViewColumn artistColumn = new Gtk.TreeViewColumn ();
- //artistColumn.Title = "Artist";
-
- Gtk.CellRendererText artistNameCell = new Gtk.CellRendererText ();
- artistNameCell.Visible = true;
- artistColumn.PackStart (artistNameCell,false);
- tree.AppendColumn (artistColumn);
- //tree.AppendColumn ("Icon", new Gtk.CellRendererPixbuf (), "pixbuf", 0);
-
- list = new TreeStore (typeof (string));
- tree.Model = list;
-
- artistColumn.AddAttribute (artistNameCell, "text", 0);
- //list.AppendValues ("test");
-
- tree.Selection.Changed += OnSelectionChanged;
- // tree.ShowNow ();
- // ShowAll ();
- sd = new DPAP.ServiceDiscovery ();
- sd.Found += OnServiceFound;
- sd.Start ();
- }
-
- private void OnSelectionChanged (object o, EventArgs args)
- {
- Gtk.TreeSelection selection = (Gtk.TreeSelection) o;
- Gtk.TreeModel model;
- Gtk.TreeIter iter;
- string data;
- if (selection.GetSelected (out model, out iter)) {
- GLib.Value val = GLib.Value.Empty;
- model.GetValue (iter, 0, ref val);
- data = (string) val.Val;
-
- if (list.IterDepth (iter) == 0)
- Connect (data);
- else
- ViewAlbum (data);
- val.Dispose ();
- }
-
- }
-
- private void ViewAlbum (string name)
- {
- Console.WriteLine ("View Album !");
- Database d = client.Databases [0];
-
- Directory.CreateDirectory ("/tmp/" + client.Databases [0].Name);
- //Console.WriteLine ("Looking for album '" + name + "'");
- foreach (DPAP.Album alb in d.Albums)
- {
- //Console.WriteLine ("\t -- album '" + alb.Name + "'");
- if (!alb.Name.Equals (name))
- continue;
-
- Directory.CreateDirectory ("/tmp/" + client.Databases [0].Name + "/" + alb.Name);
- foreach (DPAP.Photo ph in alb.Photos)
- {
- if (ph != null)
- {
- // Console.WriteLine ("\t\tFile: " + ph.Title + " format = " + ph.Format + "size=" + ph.Width +"x" +ph.Height + " ID=" + ph.Id);
- d.DownloadPhoto (ph,"/tmp/" + client.Databases [0].Name + "/" + alb.Name + "/" + ph.FileName);
- //FSpot.JpegFile = new JpegFile ("file:///tmp/" + client.Databases [0].Name + "/" + ph.FileName);
- }
- }
- FSpot.Core.FindInstance ().View ("file:///tmp/" + client.Databases [0].Name + "/" + alb.Name);
- break;
- }
-
-
- }
-
- private void Connect (string svcName)
- {
- Service service = sd.ServiceByName (svcName);
- System.Console.WriteLine ("Connecting to {0} at {1}:{2}", service.Name, service.Address, service.Port);
-
- client = new Client (service);
- TreeIter iter;
- //list.GetIterFromString (out iter, svcName);
- list.GetIterFirst (out iter);
- foreach (Database d in client.Databases){
-
- // list.AppendValues (iter,d.Name);
- Console.WriteLine ("Database " + d.Name);
-
- foreach (Album alb in d.Albums)
- list.AppendValues (iter, alb.Name);
-
- // Console.WriteLine ("\tAlbum: "+alb.Name + ", id=" + alb.getId () + " number of items:" + alb.Photos.Count);
- // Console.WriteLine (d.Photos [0].FileName);
-
- }
- }
-
- private void OnServiceFound (object o, ServiceArgs args)
- {
- Service service = args.Service;
- Console.WriteLine ("ServiceFound " + service.Name);
- if (service.Name.Equals ("f-spot photos")) return;
- list.AppendValues (service.Name);
-
-/* System.Console.WriteLine ("Connecting to {0} at {1}:{2}", service.Name, service.Address, service.Port);
-
- //client.Logout ();
- //Console.WriteLine ("Press <enter> to exit...");
-*/
-
- }
-
- }
-
- public class DPAPPage : SidebarPage
- {
- //public DPAPPage () { }
- private static DPAPPageWidget widget;
- public DPAPPage () : base (new DPAPPageWidget (), "Shared items", "gtk-new")
- {
- Console.WriteLine ("Starting DPAP client...");
-
- widget = (DPAPPageWidget)SidebarWidget;
- }
-
-
- }
-
public class DPAPService : IService
{
static ServiceDiscovery sd;
@@ -262,6 +124,7 @@
// }
}
+
public bool Stop ()
{
uint timer = Log.InformationTimerStart ("Stopping DPAP");
Modified: trunk/dpap-sharp/Makefile.am
==============================================================================
--- trunk/dpap-sharp/Makefile.am (original)
+++ trunk/dpap-sharp/Makefile.am Mon Aug 11 20:26:22 2008
@@ -2,4 +2,5 @@
lib \
dpap-server \
DPAPService \
+ DPAPBrowser \
dpap-client
Modified: trunk/dpap-sharp/dpap-client/Makefile.am
==============================================================================
--- trunk/dpap-sharp/dpap-client/Makefile.am (original)
+++ trunk/dpap-sharp/dpap-client/Makefile.am Mon Aug 11 20:26:22 2008
@@ -2,12 +2,11 @@
ASSEMBLY_NAME = dpap-client
-ASSEMBLY_SOURCES = \
- Main.cs
+ASSEMBLY_SOURCES = Main.cs
-REFS = \
- -r:Mono.Posix \
- -r:../lib/dpap-sharp.dll
+REFS = \
+ -r:../lib/dpap-sharp.dll \
+ -r:Mono.Posix
ASSEMBLY = $(ASSEMBLY_NAME).exe
Modified: trunk/dpap-sharp/dpap-client/dpap-client.mdp
==============================================================================
--- trunk/dpap-sharp/dpap-client/dpap-client.mdp (original)
+++ trunk/dpap-sharp/dpap-client/dpap-client.mdp Mon Aug 11 20:26:22 2008
@@ -15,10 +15,10 @@
</Configurations>
<Contents>
<File name="Main.cs" subtype="Code" buildaction="Compile" />
- <File name="AssemblyInfo.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Assembly" localcopy="True" refto="../lib/dpap-sharp.dll" />
+ <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
</References>
<MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="Makefile.am" SyncReferences="True" IsAutotoolsProject="True" RelativeConfigureInPath="../..">
<BuildFilesVar Sync="True" Name="ASSEMBLY_SOURCES" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]