[f-spot] Move some more stuff out of MainApp.



commit 1d338cc05fcada6091157a10a4100599ad43390a
Author: Ruben Vermeersch <ruben savanne be>
Date:   Thu Aug 12 16:55:04 2010 +0200

    Move some more stuff out of MainApp.

 src/Clients/MainApp/FSpot.Widgets/Loupe.cs         |    1 +
 src/Clients/MainApp/FSpot.Widgets/PreviewPopup.cs  |    1 +
 src/Clients/MainApp/FSpot/ControlOverlay.cs        |    1 +
 src/Clients/MainApp/FSpot/Fader.cs                 |   49 ------------------
 src/Clients/MainApp/FSpot/FullScreenView.cs        |    3 +-
 src/Clients/MainApp/MainApp.csproj                 |    5 +-
 src/Clients/MainApp/Makefile.am                    |    2 -
 src/Core/FSpot.Gui/FSpot.Gui.csproj                |   11 ++++
 .../FSpot.Gui/FSpot.Gui}/CompositeUtils.cs         |    3 +-
 src/Core/FSpot.Gui/FSpot.Gui/WindowOpacityFader.cs |   52 ++++++++++++++++++++
 src/Core/FSpot.Gui/Makefile.am                     |    2 +
 11 files changed, 75 insertions(+), 55 deletions(-)
---
diff --git a/src/Clients/MainApp/FSpot.Widgets/Loupe.cs b/src/Clients/MainApp/FSpot.Widgets/Loupe.cs
index c760b28..417e09e 100644
--- a/src/Clients/MainApp/FSpot.Widgets/Loupe.cs
+++ b/src/Clients/MainApp/FSpot.Widgets/Loupe.cs
@@ -17,6 +17,7 @@ using System.Runtime.InteropServices;
 using Mono.Unix;
 using FSpot.Core;
 using FSpot.Utils;
+using FSpot.Gui;
 using Hyena;
 
 namespace FSpot.Widgets {
diff --git a/src/Clients/MainApp/FSpot.Widgets/PreviewPopup.cs b/src/Clients/MainApp/FSpot.Widgets/PreviewPopup.cs
index 7f2a97a..cdecb66 100644
--- a/src/Clients/MainApp/FSpot.Widgets/PreviewPopup.cs
+++ b/src/Clients/MainApp/FSpot.Widgets/PreviewPopup.cs
@@ -14,6 +14,7 @@ using Gdk;
 using FSpot.Core;
 using FSpot.Widgets;
 using FSpot.Utils;
+using FSpot.Gui;
 
 namespace FSpot {
 	public class PreviewPopup : Gtk.Window {
diff --git a/src/Clients/MainApp/FSpot/ControlOverlay.cs b/src/Clients/MainApp/FSpot/ControlOverlay.cs
index c344e06..0e8fd77 100644
--- a/src/Clients/MainApp/FSpot/ControlOverlay.cs
+++ b/src/Clients/MainApp/FSpot/ControlOverlay.cs
@@ -15,6 +15,7 @@ using Gtk;
 using FSpot.Widgets;
 using FSpot.Utils;
 using FSpot.Core;
+using FSpot.Gui;
 
 namespace FSpot {
 	public class ControlOverlay : Window {
diff --git a/src/Clients/MainApp/FSpot/FullScreenView.cs b/src/Clients/MainApp/FSpot/FullScreenView.cs
index 3d76b04..9b66b7d 100644
--- a/src/Clients/MainApp/FSpot/FullScreenView.cs
+++ b/src/Clients/MainApp/FSpot/FullScreenView.cs
@@ -12,6 +12,7 @@ using Gtk;
 using Gdk;
 using FSpot.Core;
 using FSpot.Widgets;
+using FSpot.Gui;
 using FSpot.Utils;
 using Hyena;
 using Mono.Unix;
@@ -86,7 +87,7 @@ namespace FSpot {
 				slide_show.Activated += SlideShowAction;
 				actions.Add (slide_show);
 
-				new Fader (this, 1.0, 600);
+				new WindowOpacityFader (this, 1.0, 600);
 				notebook = new Notebook ();
 				notebook.ShowBorder = false;
 				notebook.ShowTabs = false;
diff --git a/src/Clients/MainApp/MainApp.csproj b/src/Clients/MainApp/MainApp.csproj
index 6e17449..9376408 100644
--- a/src/Clients/MainApp/MainApp.csproj
+++ b/src/Clients/MainApp/MainApp.csproj
@@ -74,7 +74,6 @@
     <Compile Include="FSpot.Extensions\SidebarPageNode.cs" />
     <Compile Include="FSpot.Extensions\TransitionNode.cs" />
     <Compile Include="FSpot.Extensions\ViewModeCondition.cs" />
-    <Compile Include="FSpot\Fader.cs" />
     <Compile Include="FSpot.Filters\ChmodFilter.cs" />
     <Compile Include="FSpot.Filters\FilterRequest.cs" />
     <Compile Include="FSpot.Filters\FilterSet.cs" />
@@ -158,7 +157,6 @@
     <Compile Include="FSpot.UI.Dialog\ThreadProgressDialog.cs" />
     <Compile Include="FSpot\UriCollection.cs" />
     <Compile Include="FSpot.Widgets\CellRendererTextProgress.cs" />
-    <Compile Include="FSpot.Widgets\CompositeUtils.cs" />
     <Compile Include="FSpot.Widgets\EditorPage.cs" />
     <Compile Include="FSpot.Widgets\Filmstrip.cs" />
     <Compile Include="FSpot.Widgets\FindBar.cs" />
@@ -300,12 +298,14 @@
     </Reference>
     <Reference Include="Mono.Cairo" />
     <Reference Include="Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756">
+      <Package>mono-addins</Package>
     </Reference>
     <Reference Include="System.Xml" />
     <Reference Include="System.Core" />
     <Reference Include="System" />
     <Reference Include="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
     <Reference Include="Mono.Addins.Setup, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756">
+      <Package>mono-addins-setup</Package>
     </Reference>
     <Reference Include="gio-sharp, Version=2.14.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
       <SpecificVersion>False</SpecificVersion>
@@ -317,6 +317,7 @@
     </Reference>
     <Reference Include="gnome-sharp, Version=2.24.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
     <Reference Include="Mono.Addins.Gui, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756">
+      <Package>mono-addins-gui</Package>
     </Reference>
     <Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />
   </ItemGroup>
diff --git a/src/Clients/MainApp/Makefile.am b/src/Clients/MainApp/Makefile.am
index 469673b..a4ff25f 100644
--- a/src/Clients/MainApp/Makefile.am
+++ b/src/Clients/MainApp/Makefile.am
@@ -88,7 +88,6 @@ SOURCES =  \
 	FSpot.UI.Dialog/TagSelectionDialog.cs \
 	FSpot.UI.Dialog/ThreadProgressDialog.cs \
 	FSpot.Widgets/CellRendererTextProgress.cs \
-	FSpot.Widgets/CompositeUtils.cs \
 	FSpot.Widgets/EditorPage.cs \
 	FSpot.Widgets/Filmstrip.cs \
 	FSpot.Widgets/FindBar.cs \
@@ -122,7 +121,6 @@ SOURCES =  \
 	FSpot/ControlOverlay.cs \
 	FSpot/DragDropTargets.cs \
 	FSpot/ExportStore.cs \
-	FSpot/Fader.cs \
 	FSpot/FolderQueryWidget.cs \
 	FSpot/FullScreenView.cs \
 	FSpot/GroupAdaptor.cs \
diff --git a/src/Core/FSpot.Gui/FSpot.Gui.csproj b/src/Core/FSpot.Gui/FSpot.Gui.csproj
index 2b28436..e3f432e 100644
--- a/src/Core/FSpot.Gui/FSpot.Gui.csproj
+++ b/src/Core/FSpot.Gui/FSpot.Gui.csproj
@@ -56,6 +56,8 @@
     <Compile Include="FSpot.Transitions\SlideShowTransition.cs" />
     <Compile Include="FSpot.Widgets\ImageView_Panning.cs" />
     <Compile Include="FSpot.Widgets\ImageView_Container.cs" />
+    <Compile Include="FSpot.Gui\WindowOpacityFader.cs" />
+    <Compile Include="FSpot.Gui\CompositeUtils.cs" />
   </ItemGroup>
   <ProjectExtensions>
     <MonoDevelop>
@@ -105,9 +107,18 @@
       <Project>{95374549-9553-4C1E-9D89-667755F90E12}</Project>
       <Name>Hyena</Name>
     </ProjectReference>
+    <ProjectReference Include="..\FSpot.Bling\FSpot.Bling.csproj">
+      <Project>{7281334F-0B1D-4383-9EA2-6740D56ADCDE}</Project>
+      <Name>FSpot.Bling</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\FSpot.Cms\FSpot.Cms.csproj">
+      <Project>{9D66BC1B-4390-4B8D-8468-19D5A862EC23}</Project>
+      <Name>FSpot.Cms</Name>
+    </ProjectReference>
   </ItemGroup>
   <ItemGroup>
     <Folder Include="FSpot.Transitions\" />
     <Folder Include="FSpot.Widgets\" />
+    <Folder Include="FSpot.Gui\" />
   </ItemGroup>
 </Project>
\ No newline at end of file
diff --git a/src/Clients/MainApp/FSpot.Widgets/CompositeUtils.cs b/src/Core/FSpot.Gui/FSpot.Gui/CompositeUtils.cs
similarity index 99%
rename from src/Clients/MainApp/FSpot.Widgets/CompositeUtils.cs
rename to src/Core/FSpot.Gui/FSpot.Gui/CompositeUtils.cs
index a3c8b9e..52b0343 100644
--- a/src/Clients/MainApp/FSpot.Widgets/CompositeUtils.cs
+++ b/src/Core/FSpot.Gui/FSpot.Gui/CompositeUtils.cs
@@ -5,7 +5,8 @@ using Gtk;
 using FSpot.Utils;
 using Hyena;
 
-namespace FSpot.Widgets {
+namespace FSpot.Gui {
+
 	public class CompositeUtils {
 		[DllImport("libgdk-2.0-0.dll")]
 	        static extern bool gdk_screen_is_composited (IntPtr screen);
diff --git a/src/Core/FSpot.Gui/FSpot.Gui/WindowOpacityFader.cs b/src/Core/FSpot.Gui/FSpot.Gui/WindowOpacityFader.cs
new file mode 100644
index 0000000..405da65
--- /dev/null
+++ b/src/Core/FSpot.Gui/FSpot.Gui/WindowOpacityFader.cs
@@ -0,0 +1,52 @@
+/*
+ * Fader.cs
+ *
+ * Copyright 2007 Novell Inc.
+ *
+ * Author
+ *   Larry Ewing <lewing novell com>
+ *
+ * See COPYING for license information.
+ *
+ */
+
+using System;
+using Gtk;
+using FSpot.Bling;
+
+namespace FSpot.Gui
+{
+    public class WindowOpacityFader
+    {
+        bool composited;
+        Gtk.Window win;
+        DoubleAnimation fadin;
+
+        public WindowOpacityFader (Gtk.Window win, double target, double msec)
+        {
+            this.win = win;
+            win.Mapped += HandleMapped;
+            win.Unmapped += HandleUnmapped;
+            fadin = new DoubleAnimation (0.0, target, TimeSpan.FromMilliseconds (msec), opacity => {
+                CompositeUtils.SetWinOpacity (win, opacity);
+            });
+        }
+
+        [GLib.ConnectBefore]
+        public void HandleMapped (object sender, EventArgs args)
+        {
+            composited = CompositeUtils.SupportsHint (win.Screen, "_NET_WM_WINDOW_OPACITY");
+            if (!composited) {
+                return;
+            }
+            
+            CompositeUtils.SetWinOpacity (win, 0.0);
+            fadin.Start ();
+        }
+
+        public void HandleUnmapped (object sender, EventArgs args)
+        {
+            fadin.Stop ();
+        }
+    }
+}
diff --git a/src/Core/FSpot.Gui/Makefile.am b/src/Core/FSpot.Gui/Makefile.am
index c464331..078d91f 100644
--- a/src/Core/FSpot.Gui/Makefile.am
+++ b/src/Core/FSpot.Gui/Makefile.am
@@ -3,6 +3,8 @@ TARGET = library
 LINK = $(REF_FSPOT_GUI)
 
 SOURCES =  \
+	FSpot.Gui/CompositeUtils.cs \
+	FSpot.Gui/WindowOpacityFader.cs \
 	FSpot.Transitions/CairoTransition.cs \
 	FSpot.Transitions/DissolveTransition.cs \
 	FSpot.Transitions/PushTransition.cs \



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