tomboy r2314 - in trunk: . Setup Tomboy Tomboy/Addins/PrintNotes Tomboy/Notebooks



Author: sharm
Date: Mon Feb  2 07:00:28 2009
New Revision: 2314
URL: http://svn.gnome.org/viewvc/tomboy?rev=2314&view=rev

Log:
* Tomboy/Addins/PrintNotes/PrintNotesNoteAddin.cs: Move work out of
  Initialize. Ensure disposal of the print operation. Show an error message
  if an exception occurs during printing (like on Windows with GTK# 2.10).

* Tomboy.sln:
* Tomboy/Addins/PrintNotes/PrintNotes.csproj: Windows build support.

* Setup/Files.wxs:
* Setup/Setup.wisproj: Add printing add-in to installer.

* Setup/Setup.wxs: Change Manufacturer to "Tomboy Project". Add support for
  new registry key (probably) used by Novell's gtk-sharp 2.12.8.

* Tomboy/XKeybinder.cs:
* Tomboy/Notebooks/NotebookManager.cs: Clean up comments.

Added:
   trunk/Tomboy/Addins/PrintNotes/PrintNotes.csproj
Modified:
   trunk/ChangeLog
   trunk/Setup/Files.wxs
   trunk/Setup/Setup.wixproj
   trunk/Setup/Setup.wxs
   trunk/Tomboy.sln
   trunk/Tomboy/Addins/PrintNotes/PrintNotesNoteAddin.cs
   trunk/Tomboy/Notebooks/NotebookManager.cs
   trunk/Tomboy/XKeybinder.cs

Modified: trunk/Setup/Files.wxs
==============================================================================
--- trunk/Setup/Files.wxs	(original)
+++ trunk/Setup/Files.wxs	Mon Feb  2 07:00:28 2009
@@ -21,6 +21,7 @@
 						<File Source="..\bin\Debug\Mono.Posix.dll" Name="Mono.Posix.dll" Id="Mono.Posix.dll" />
 						<File Source="..\bin\Debug\MonoPosixHelper.dll" Name="MonoPosixHelper.dll" Id="MonoPosixHelper.dll" />
 						<File Source="..\bin\Debug\NoteOfTheDay.dll" Name="NoteOfTheDay.dll" Id="NoteOfTheDay.dll" />
+						<File Source="..\bin\Debug\PrintNotes.dll" Name="PrintNotes.dll" Id="PrintNotes.dll" />
 						<File Source="..\bin\Debug\Tomboy.exe" Name="Tomboy.exe" Id="Tomboy.exe" Vital="yes"></File>
 						<File Source="..\bin\Debug\Backlinks.pdb" Name="Backlinks.pdb" Id="Backlinks.pdb" />
 						<File Source="..\bin\Debug\Bugzilla.pdb" Name="Bugzilla.pdb" Id="Bugzilla.pdb" />
@@ -29,6 +30,7 @@
 						<File Source="..\bin\Debug\FixedWidth.pdb" Name="FixedWidth.pdb" Id="FixedWidth.pdb" />
 						<File Source="..\bin\Debug\InsertTimestamp.pdb" Name="InsertTimestamp.pdb" Id="InsertTimestamp.pdb" />
 						<File Source="..\bin\Debug\NoteOfTheDay.pdb" Name="NoteOfTheDay.pdb" Id="NoteOfTheDay.pdb" />
+						<File Source="..\bin\Debug\PrintNotes.pdb" Name="PrintNotes.pdb" Id="PrintNotes.pdb" />
 						<File Source="..\bin\Debug\Tomboy.pdb" Name="Tomboy.pdb" Id="Tomboy.pdb" />
 					</Component>
 					<Component Id="Shortcuts" Guid="D1F1C647-7D55-4AD2-B765-4152B337546E" DiskId="1">

Modified: trunk/Setup/Setup.wixproj
==============================================================================
--- trunk/Setup/Setup.wixproj	(original)
+++ trunk/Setup/Setup.wixproj	Mon Feb  2 07:00:28 2009
@@ -64,5 +64,9 @@
       <Project>{33026B26-C907-4DBB-A438-85F042578AEA}</Project>
       <Name>NoteOfTheDay</Name>
     </ProjectReference>
+    <ProjectReference Include="..\Tomboy\Addins\PrintNotes\PrintNotes.csproj">
+      <Project>{A13FBE2F-C5FF-4E8D-B687-4A309D3FE08F}</Project>
+      <Name>PrintNotes</Name>
+    </ProjectReference>
   </ItemGroup>
 </Project>
\ No newline at end of file

Modified: trunk/Setup/Setup.wxs
==============================================================================
--- trunk/Setup/Setup.wxs	(original)
+++ trunk/Setup/Setup.wxs	Mon Feb  2 07:00:28 2009
@@ -5,7 +5,7 @@
 		Language="1033"
 		Version="0.13.4.0"
 		UpgradeCode="4401CB77-D6D4-4903-B1F9-41E2F80DF785"
-		Manufacturer="Alex Graveley et al">
+		Manufacturer="Tomboy Project">
 		<Package Description="#Description"
 			Comments="Comments"
 			InstallerVersion="200"
@@ -30,8 +30,11 @@
 		<Property Id="GTKSHARPRUNTIMEINSTALLVERSION">
 			<RegistrySearch Id='GtksharpruntimeRegistry' Type='raw' Root='HKCU' Key='Software\Gtk# Runtime\Version' />
 		</Property>
+		<Property Id="GTKSHARPNOVELLINSTALLVERSION">
+			<RegistrySearch Id='GtksharpnovellRegistry' Type='raw' Root='HKLM' Key='Software\Novell\GtkSharp\Version' />
+		</Property>
 		<Condition Message="This setup requires Gtk# 2.10 or higher. Please download the runtime installer from http://medsphere.org/projects/gtksharp/";>
-			<![CDATA[GTKSHARPSDKINSTALLVERSION > "2.10" OR GTKSHARPRUNTIMEINSTALLVERSION > "2.10"]]>
+			<![CDATA[GTKSHARPSDKINSTALLVERSION > "2.10" OR GTKSHARPRUNTIMEINSTALLVERSION > "2.10" OR GTKSHARPNOVELLINSTALLVERSION > "2.12.8"]]>
 		</Condition>
 		<Condition Message='This setup requires the .NET Framework 2.0 or higher.'>
 			<![CDATA[MsiNetAssemblySupport >= "2.0.50727"]]>

Modified: trunk/Tomboy.sln
==============================================================================
--- trunk/Tomboy.sln	(original)
+++ trunk/Tomboy.sln	Mon Feb  2 07:00:28 2009
@@ -20,6 +20,8 @@
 EndProject
 Project("{CFEE4113-1246-4D54-95CB-156813CB8593}") = "Setup", "Setup\Setup.wixproj", "{70C6BF8A-5AFF-4EF0-8D94-77F3281B8EE2}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrintNotes", "Tomboy\Addins\PrintNotes\PrintNotes.csproj", "{A13FBE2F-C5FF-4E8D-B687-4A309D3FE08F}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -78,9 +80,15 @@
 		{70C6BF8A-5AFF-4EF0-8D94-77F3281B8EE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{70C6BF8A-5AFF-4EF0-8D94-77F3281B8EE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{70C6BF8A-5AFF-4EF0-8D94-77F3281B8EE2}.Mac|Any CPU.ActiveCfg = Release|Any CPU
+		{70C6BF8A-5AFF-4EF0-8D94-77F3281B8EE2}.Mac|Any CPU.Build.0 = Mac|Any CPU
 		{70C6BF8A-5AFF-4EF0-8D94-77F3281B8EE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{70C6BF8A-5AFF-4EF0-8D94-77F3281B8EE2}.Release|Any CPU.Build.0 = Release|Any CPU
-		{70C6BF8A-5AFF-4EF0-8D94-77F3281B8EE2}.Mac|Any CPU.Build.0 = Mac|Any CPU
+		{A13FBE2F-C5FF-4E8D-B687-4A309D3FE08F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{A13FBE2F-C5FF-4E8D-B687-4A309D3FE08F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{A13FBE2F-C5FF-4E8D-B687-4A309D3FE08F}.Mac|Any CPU.ActiveCfg = Mac|Any CPU
+		{A13FBE2F-C5FF-4E8D-B687-4A309D3FE08F}.Mac|Any CPU.Build.0 = Mac|Any CPU
+		{A13FBE2F-C5FF-4E8D-B687-4A309D3FE08F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{A13FBE2F-C5FF-4E8D-B687-4A309D3FE08F}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

Added: trunk/Tomboy/Addins/PrintNotes/PrintNotes.csproj
==============================================================================
--- (empty file)
+++ trunk/Tomboy/Addins/PrintNotes/PrintNotes.csproj	Mon Feb  2 07:00:28 2009
@@ -0,0 +1,92 @@
+ï<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003";>
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{A13FBE2F-C5FF-4E8D-B687-4A309D3FE08F}</ProjectGuid>
+    <ProductVersion>9.0.21022</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <OutputType>Library</OutputType>
+    <NoStandardLibraries>false</NoStandardLibraries>
+    <AssemblyName>PrintNotes</AssemblyName>
+    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <RootNamespace>PrintNotes</RootNamespace>
+    <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
+    <NoStdLib>False</NoStdLib>
+    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>Full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\..\..\bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <PlatformTarget>x86</PlatformTarget>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
+    <RegisterForComInterop>False</RegisterForComInterop>
+    <GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
+    <BaseAddress>4194304</BaseAddress>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Mac|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\Mac\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>Full</DebugType>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="gtk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\..\..\..\Program Files\Medsphere\Gtk# SDK\lib\gtk-sharp-2.0\gtk\gtk-sharp.dll</HintPath>
+    </Reference>
+    <Reference Include="glib-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <Reference Include="Mono.Cairo, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\..\..\..\Program Files\Medsphere\Gtk# SDK\lib\Mono.Cairo\Mono.Cairo.dll</HintPath>
+    </Reference>
+    <Reference Include="pango-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <Reference Include="gdk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <Reference Include="atk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <Reference Include="Mono.Posix, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\winbin\Mono.Posix.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="PrintNotes.addin.xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="PrintNotesNoteAddin.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Makefile.am" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\Tomboy.csproj">
+      <Project>{315DBB30-1461-4A41-A23F-A888D84E1EA0}</Project>
+      <Name>Tomboy</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
+  <ProjectExtensions>
+    <VisualStudio AllowExistingFolder="true" />
+  </ProjectExtensions>
+</Project>
\ No newline at end of file

Modified: trunk/Tomboy/Addins/PrintNotes/PrintNotesNoteAddin.cs
==============================================================================
--- trunk/Tomboy/Addins/PrintNotes/PrintNotesNoteAddin.cs	(original)
+++ trunk/Tomboy/Addins/PrintNotes/PrintNotesNoteAddin.cs	Mon Feb  2 07:00:28 2009
@@ -32,18 +32,12 @@
 	public class PrintNotesNoteAddin : NoteAddin
 	{
 		private Gtk.ImageMenuItem item;
-		private Gtk.PrintOperation print_op;
 		private PrintMargins page_margins;
 		private Pango.Layout date_time_footer;
 		private List<int> page_breaks;
 
 		public override void Initialize ()
 		{
-			page_margins = new PrintMargins ();
-			page_margins.Top = 400;
-			page_margins.Left = 200;
-			page_margins.Right = 100;
-			page_margins.Bottom = 0;
 		}
 
 		public override void Shutdown ()
@@ -66,14 +60,33 @@
 
 		private void PrintButtonClicked (object sender, EventArgs args)
 		{
-			print_op = new Gtk.PrintOperation ();
-			print_op.JobName = Note.Title;
-
-			print_op.BeginPrint += OnBeginPrint;
-			print_op.DrawPage += OnDrawPage;
-			print_op.EndPrint += OnEndPrint;
-
-			print_op.Run (Gtk.PrintOperationAction.PrintDialog, Window);
+			try {
+				page_margins = new PrintMargins ();
+				page_margins.Top = 400;
+				page_margins.Left = 200;
+				page_margins.Right = 100;
+				page_margins.Bottom = 0;
+
+				using (Gtk.PrintOperation print_op = new Gtk.PrintOperation ()) {
+					print_op.JobName = Note.Title;
+
+					print_op.BeginPrint += OnBeginPrint;
+					print_op.DrawPage += OnDrawPage;
+					print_op.EndPrint += OnEndPrint;
+
+					print_op.Run (Gtk.PrintOperationAction.PrintDialog, Window);
+				}
+			} catch (Exception e) {
+				Logger.Error (e.ToString ());
+				HIGMessageDialog dlg = new HIGMessageDialog (Note.Window,
+					Gtk.DialogFlags.Modal,
+					Gtk.MessageType.Error,
+					Gtk.ButtonsType.Ok,
+					Catalog.GetString ("Error printing note"),
+					e.Message);
+				dlg.Run ();
+				dlg.Destroy ();
+			}
 		}
 
 		private static IEnumerable<Pango.Attribute> GetParagraphAttributes (
@@ -370,9 +383,10 @@
 
 		private void OnEndPrint (object sender, Gtk.EndPrintArgs args)
 		{
-			date_time_footer.Dispose ();
-			page_breaks.Clear ();
-			print_op.Dispose ();
+			if (date_time_footer != null)
+				date_time_footer.Dispose ();
+			if (page_breaks != null)
+				page_breaks.Clear ();
 		}
 	}
 }

Modified: trunk/Tomboy/Notebooks/NotebookManager.cs
==============================================================================
--- trunk/Tomboy/Notebooks/NotebookManager.cs	(original)
+++ trunk/Tomboy/Notebooks/NotebookManager.cs	Mon Feb  2 07:00:28 2009
@@ -392,7 +392,7 @@
 			if (note == null)
 				return false;
 			
-			// TODO: In the future we may want to allow notes
+			// NOTE: In the future we may want to allow notes
 			// to exist in multiple notebooks.  For now, to
 			// alleviate the confusion, only allow a note to
 			// exist in one notebook at a time.

Modified: trunk/Tomboy/XKeybinder.cs
==============================================================================
--- trunk/Tomboy/XKeybinder.cs	(original)
+++ trunk/Tomboy/XKeybinder.cs	Mon Feb  2 07:00:28 2009
@@ -19,7 +19,6 @@
 
 		public delegate void BindkeyHandler (string key, IntPtr user_data);
 
-		// TODO: Change to IList<T>
 		List<Binding> bindings;
 		BindkeyHandler key_handler;
 



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