[tomboy] Fix for bgo#401888, introduces Advanced tab



commit d3c796c6c0877b60c32d432e4e81cf5601a27e8c
Author: Alex Tereschenko <frozenblue zoho com>
Date:   Mon Jun 20 23:59:28 2011 +0400

    Fix for bgo#401888, introduces Advanced tab
    
    Adds Advanced tab to  Preferences via addin. Tab contains a setting for
    the minimum number of notes to show (10 by default, max is hardcoded to
    18 in Tray.cs)
    
    Signed-off-by: Aaron Borden <adborden live com>

 Tomboy.sln                                         |    8 ++
 .../AdvancedPreferences.addin.xml                  |   22 +++++
 .../AdvancedPreferences/AdvancedPreferences.csproj |   66 +++++++++++++++
 .../AdvancedPreferencesAddin.cs                    |   84 ++++++++++++++++++++
 Tomboy/Addins/AdvancedPreferences/Makefile.am      |   40 +++++++++
 Tomboy/Addins/Makefile.am                          |    1 +
 configure.in                                       |    1 +
 7 files changed, 222 insertions(+), 0 deletions(-)
---
diff --git a/Tomboy.sln b/Tomboy.sln
index 077833e..be04416 100644
--- a/Tomboy.sln
+++ b/Tomboy.sln
@@ -30,6 +30,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebSyncService", "Tomboy\Ad
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoveBrokenLinks", "Tomboy\Addins\RemoveBrokenLinks\RemoveBrokenLinks.csproj", "{AD6C9F12-3F95-497C-AF7E-629F787A097E}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdvancedPreferences", "Tomboy\Addins\AdvancedPreferences\AdvancedPreferences.csproj", "{35C7F93C-F4D2-4FD0-B669-B02CE1EF29FD}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -121,6 +123,12 @@ Global
 		{AD6C9F12-3F95-497C-AF7E-629F787A097E}.Mac|Any CPU.ActiveCfg = Debug|Any CPU
 		{AD6C9F12-3F95-497C-AF7E-629F787A097E}.Release|Any CPU.Build.0 = Release|Any CPU
 		{AD6C9F12-3F95-497C-AF7E-629F787A097E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{35C7F93C-F4D2-4FD0-B669-B02CE1EF29FD}.Debug|Any CPU.Build.0 = Debug|x86
+		{35C7F93C-F4D2-4FD0-B669-B02CE1EF29FD}.Debug|Any CPU.ActiveCfg = Debug|x86
+		{35C7F93C-F4D2-4FD0-B669-B02CE1EF29FD}.Mac|Any CPU.Build.0 = Debug|x86
+		{35C7F93C-F4D2-4FD0-B669-B02CE1EF29FD}.Mac|Any CPU.ActiveCfg = Debug|x86
+		{35C7F93C-F4D2-4FD0-B669-B02CE1EF29FD}.Release|Any CPU.Build.0 = Release|x86
+		{35C7F93C-F4D2-4FD0-B669-B02CE1EF29FD}.Release|Any CPU.ActiveCfg = Release|x86
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
diff --git a/Tomboy/Addins/AdvancedPreferences/AdvancedPreferences.addin.xml b/Tomboy/Addins/AdvancedPreferences/AdvancedPreferences.addin.xml
new file mode 100644
index 0000000..2f1c056
--- /dev/null
+++ b/Tomboy/Addins/AdvancedPreferences/AdvancedPreferences.addin.xml
@@ -0,0 +1,22 @@
+ï<Addin id="AdvancedPreferencesAddin"
+	namespace="Tomboy"
+	name="Advanced Preferences"
+	author="Alex Tereschenko"
+	description="Adds Advanced tab to preferences dialog"
+	category="Preferences"
+	defaultEnabled="false"
+	version="1.1">
+
+ 	<Runtime>
+ 		<Import assembly="AdvancedPreferences.dll" />
+ 	</Runtime>
+
+	<Dependencies>
+		<Addin id="Tomboy" version="0.10" />
+	</Dependencies>
+
+	<Extension path="/Tomboy/PreferenceTabAddins">
+		<PreferenceTabAddin type="Tomboy.AdvancedPreferences.AdvancedPreferencesAddin" />
+	</Extension>
+	
+</Addin>
\ No newline at end of file
diff --git a/Tomboy/Addins/AdvancedPreferences/AdvancedPreferences.csproj b/Tomboy/Addins/AdvancedPreferences/AdvancedPreferences.csproj
new file mode 100644
index 0000000..28d33af
--- /dev/null
+++ b/Tomboy/Addins/AdvancedPreferences/AdvancedPreferences.csproj
@@ -0,0 +1,66 @@
+ï<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003";>
+  <PropertyGroup>
+    <ProjectGuid>{35C7F93C-F4D2-4FD0-B669-B02CE1EF29FD}</ProjectGuid>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+    <OutputType>Library</OutputType>
+    <RootNamespace>AdvPrefTab</RootNamespace>
+    <AssemblyName>AdvancedPreferences</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <SourceAnalysisOverrideSettingsFile>C:\Users\avt\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile>
+    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
+    <NoStdLib>False</NoStdLib>
+    <WarningLevel>4</WarningLevel>
+    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Platform)' == 'x86' ">
+    <PlatformTarget>x86</PlatformTarget>
+    <RegisterForComInterop>False</RegisterForComInterop>
+    <GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
+    <BaseAddress>4194304</BaseAddress>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+    <OutputPath>..\..\..\bin\Debug\</OutputPath>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>Full</DebugType>
+    <Optimize>False</Optimize>
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+    <OutputPath>bin\Release\</OutputPath>
+    <DebugSymbols>False</DebugSymbols>
+    <DebugType>None</DebugType>
+    <Optimize>True</Optimize>
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+    <DefineConstants>TRACE</DefineConstants>
+  </PropertyGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
+  <ItemGroup>
+    <Reference Include="atk-sharp" />
+    <Reference Include="glib-sharp" />
+    <Reference Include="gtk-sharp" />
+    <Reference Include="Mono.Posix" />
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Xml.Linq">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="AdvancedPreferencesAddin.cs" />
+    <EmbeddedResource Include="AdvancedPreferences.addin.xml" />
+    <None Include="Makefile.am" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\Tomboy.csproj">
+      <Project>{315DBB30-1461-4A41-A23F-A888D84E1EA0}</Project>
+      <Name>Tomboy</Name>
+    </ProjectReference>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/Tomboy/Addins/AdvancedPreferences/AdvancedPreferencesAddin.cs b/Tomboy/Addins/AdvancedPreferences/AdvancedPreferencesAddin.cs
new file mode 100644
index 0000000..f56d03c
--- /dev/null
+++ b/Tomboy/Addins/AdvancedPreferences/AdvancedPreferencesAddin.cs
@@ -0,0 +1,84 @@
+ï// Plugin for Tomboy Advanced preferences tab
+// (c) 2011 Alex Tereschenko <frozenblue zoho com>
+// LGPL 2.1 or later
+
+using System;
+using Gtk;
+using Mono.Unix;
+using Tomboy;
+
+namespace Tomboy.AdvancedPreferences
+{
+	/// <summary>
+	/// Contains a class for Advanced preferences tab
+	/// </summary>
+	public class AdvancedPreferencesAddin : PreferenceTabAddin
+	{
+		
+		// This one is an event handler for a SpinButton, used to set the menu note count
+		private void UpdateMenuNoteCountPreference (object source, EventArgs args)
+		{
+			Gtk.SpinButton spinner = source as SpinButton;
+			Preferences.Set (Preferences.MENU_NOTE_COUNT, spinner.ValueAsInt);
+			
+		}
+		
+		
+		public override bool GetPreferenceTabWidget (	PreferencesDialog parent,
+								out string tabLabel,
+								out Gtk.Widget preferenceWidget)
+		{
+			
+			Gtk.Label label;
+			Gtk.SpinButton menuNoteCountSpinner;
+			Gtk.Alignment align;
+			int menuNoteCount;
+
+			// Addin's tab caption
+			tabLabel = Catalog.GetString ("Advanced");
+			
+			Gtk.VBox opts_list = new Gtk.VBox (false, 12);
+			opts_list.BorderWidth = 12;
+			opts_list.Show ();
+			
+			align = new Gtk.Alignment (0.5f, 0.5f, 0.0f, 1.0f);
+			align.Show ();
+			opts_list.PackStart (align, false, false, 0);
+
+			Gtk.Table table = new Gtk.Table (1, 2, false);
+			table.ColumnSpacing = 6;
+			table.RowSpacing = 6;
+			table.Show ();
+			align.Add (table);
+
+
+			// Menu Note Count option
+			label = new Gtk.Label (Catalog.GetString ("Minimum number of notes to show in Recent list (maximum 18)"));
+
+			label.UseMarkup = true;
+			label.Justify = Gtk.Justification.Left;
+			label.SetAlignment (0.0f, 0.5f);
+			label.Show ();
+			
+			table.Attach (label, 0, 1, 0, 1);
+		
+			menuNoteCount = (int) Preferences.Get (Preferences.MENU_NOTE_COUNT);
+			// we have a hard limit of 18 set, thus not allowing anything bigger than 18
+			menuNoteCountSpinner = new Gtk.SpinButton (1, 18, 1);
+			menuNoteCountSpinner.Value = menuNoteCount <= 18 ? menuNoteCount : 18;
+			
+			menuNoteCountSpinner.Show ();
+			table.Attach (menuNoteCountSpinner, 1, 2, 0, 1);
+			
+			menuNoteCountSpinner.ValueChanged += UpdateMenuNoteCountPreference;
+			
+			if (opts_list != null) {
+				preferenceWidget = opts_list;
+				return true;
+			} else {
+				preferenceWidget = null;
+				return false;
+			}
+		}
+	}
+}
diff --git a/Tomboy/Addins/AdvancedPreferences/Makefile.am b/Tomboy/Addins/AdvancedPreferences/Makefile.am
new file mode 100644
index 0000000..5e0c38d
--- /dev/null
+++ b/Tomboy/Addins/AdvancedPreferences/Makefile.am
@@ -0,0 +1,40 @@
+include $(top_srcdir)/Makefile.include
+
+CSFLAGS = 		\
+	-debug 		\
+	-define:DEBUG 	\
+	-target:library
+
+ASSEMBLIES = 					\
+	$(LINK_TOMBOY_EXE)			\
+	$(GTKSHARP_LIBS) 				\
+	$(LINK_MONO_ADDINS)			\
+	-r:Mono.Posix
+
+ADDIN_NAME = AdvancedPreferences
+TARGET = $(top_builddir)/bin/addins/$(ADDIN_NAME).dll
+CSFILES = \
+	$(srcdir)/AdvancedPreferencesAddin.cs
+	
+RESOURCES = \
+	-resource:$(srcdir)/$(ADDIN_NAME).addin.xml
+
+$(TARGET).mdb: $(TARGET)
+
+$(TARGET): $(CSFILES) $(TOMBOY_EXE_PATH)
+	mkdir -p `dirname $(TARGET)` && $(CSC) -out:$@ $(CSFLAGS) $(ASSEMBLIES) $(CSFILES) $(RESOURCES)
+
+
+addinsdir = $(pkglibdir)/addins
+addins_DATA = 			\
+	$(TARGET)		\
+	$(TARGET).mdb
+
+EXTRA_DIST =            	\
+	$(CSFILES) \
+	$(srcdir)/$(ADDIN_NAME).addin.xml
+
+CLEANFILES =				\
+	$(TARGET).mdb \
+	$(TARGET)
+
diff --git a/Tomboy/Addins/Makefile.am b/Tomboy/Addins/Makefile.am
index 1d1f8ae..b89df2e 100644
--- a/Tomboy/Addins/Makefile.am
+++ b/Tomboy/Addins/Makefile.am
@@ -1,4 +1,5 @@
 SUBDIRS =				\
+	AdvancedPreferences	\
 	Backlinks			\
 	Bugzilla			\
 	Evolution		\
diff --git a/configure.in b/configure.in
index 77bf859..d3b37b0 100644
--- a/configure.in
+++ b/configure.in
@@ -357,6 +357,7 @@ Tomboy/Addins/Underline/Makefile
 Tomboy/Addins/WebDavSyncService/Makefile
 Tomboy/Addins/WebSyncService/Makefile
 Tomboy/Addins/NoteDirectoryWatcher/Makefile
+Tomboy/Addins/AdvancedPreferences/Makefile
 test/Makefile
 po/Makefile.in
 ])



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