// MIT License
//
// Copyright (c) 2014 Brendan Zagaeski
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
///
/// The Mono.Addins namespace, from the "Mono.Addins" package
///
using Mono.Addins;
///
/// The Gtk namespace, from the "gtk-sharp" package
///
using Gtk;
///
/// The MonoDevelop.Ide.WelcomePage namespace, from MonoDevelop.Ide.dll
///
///
/// Mac:
/// /Applications/Xamarin Studio.app/Contents/MacOS/lib/monodevelop/bin/MonoDevelop.Ide.dll
///
/// Windows:
/// C:\Program Files (x86)\Xamarin Studio\bin\MonoDevelop.Ide.dll
///
using MonoDevelop.Ide.WelcomePage;
///
/// The MonoDevelop.Core namespace, from MonoDevelop.Core.dll
///
///
/// Mac:
/// /Applications/Xamarin Studio.app/Contents/MacOS/lib/monodevelop/bin/MonoDevelop.Core.dll
///
/// Windows:
/// C:\Program Files (x86)\Xamarin Studio\bin\MonoDevelop.Core.dll
///
using MonoDevelop.Core;
///
/// Mark this assembly as containing addin extensions
///
[assembly:Addin]
///
/// Specify a dependency on the "MonoDevelop.Ide" `AddinRoot`
///
///
/// The MonoDevelop.Ide `AddinRoot` is defined here:
/// https://github.com/mono/monodevelop/blob/d54151b1/main/src/core/MonoDevelop.Ide/AddinInfo.cs#L5-L6
///
/// This dependency _must_ be declared to allow use of the
/// `IWelcomePageProvider` extension point, which is defined here:
/// https://github.com/mono/monodevelop/blob/0f741592/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/IWelcomePageProvider.cs#L31
///
[assembly:AddinDependency("MonoDevelop.Ide", MonoDevelop.BuildInfo.Version)]
namespace MonoDevelop.CustomWelcomePage
{
///
/// Specify that `CustomWelcomePageProvider` should be included when
/// Xamarin Studio gets the list of available extension nodes via
/// `AddinManager`.
///
///
/// The `InsertBefore` attribute is required to get the custom
/// welcome page to appear in Xamarin Studio. If this attribute is
/// left out, the `IWelcomePageProvider` provided by the Xamarin.Ide
/// addin will take precedence.
///
/// `XamarinWelcomePageProvider` is defined in:
///
/// Mac:
/// /Applications/Xamarin Studio.app/Contents/MacOS/lib/monodevelop/AddIns/Xamarin.Ide/Xamarin.Ide.dll
///
/// Windows:
/// C:\Program Files (x86)\Xamarin Studio\bin\Xamarin.Ide.dll
///
[Extension(InsertBefore = "Xamarin.Ide.WelcomePage.XamarinWelcomePageProvider")]
///
/// The addin class that provides the custom welcome page widget.
///
public class CustomWelcomePageProvider : IWelcomePageProvider
{
///
/// Creates the widget.
///
///
/// This example uses `WelcomePageRecentProjectsList()`
/// to show the recent projects list.
///
public Widget CreateWidget()
{
var widget = new EventBox();
var alignment = new Alignment(0, 0, 1, 1);
var row = new WelcomePageRow(
new WelcomePageRecentProjectsList(
GettextCatalog.GetString("Solutions"),
10)
);
alignment.Add(row);
widget.Add(alignment);
widget.ShowAll();
return widget;
}
}
}