Skip to content

Commit

Permalink
libs: Move Notifications to its own library
Browse files Browse the repository at this point in the history
notify-sharp isn't available on many a distribution and we have two
extensions that use it, NotificationArea; of course, and Ubuntu's
SoundMenu integration.

We avoid inter-extension references by moving the INTERNAL_NOTIFY_SHARP
guarded files from NotificationArea to their own library which we
reference from both places.

If we choose to reintroduce system notify-sharp later, we may consider
renaming to B.Notifications to standardise our system interface,
although this may sit better with (or within) other backend components.
  • Loading branch information
Carbenium authored and arfbtwn committed Sep 9, 2017
1 parent d64e097 commit 62835b1
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 90 deletions.
7 changes: 7 additions & 0 deletions Banshee.sln
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Migo", "src\Libraries\Migo\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "metrics", "extras\metrics\metrics.csproj", "{6D17167C-AC3F-4D40-A652-46627276A9A1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Notifications", "src\Libraries\Notifications\Notifications.csproj", "{A9468999-D9F1-4CA3-8CEB-71E520BED921}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -408,6 +410,10 @@ Global
{FDB90084-A1E6-4497-8047-52800A4AAB28}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FDB90084-A1E6-4497-8047-52800A4AAB28}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FDB90084-A1E6-4497-8047-52800A4AAB28}.Release|Any CPU.Build.0 = Release|Any CPU
{A9468999-D9F1-4CA3-8CEB-71E520BED921}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A9468999-D9F1-4CA3-8CEB-71E520BED921}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A9468999-D9F1-4CA3-8CEB-71E520BED921}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A9468999-D9F1-4CA3-8CEB-71E520BED921}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{EB1FDF3F-048C-4010-80F5-D936A312580F} = {E6AD3714-5EA3-49D9-BA8D-12C69B2B8067}
Expand Down Expand Up @@ -483,6 +489,7 @@ Global
{A7566CDC-6033-4A16-9E9D-87D05A627066} = {4F47D6F1-4047-4A89-AE85-3AE5EF9F2961}
{C5DD02DE-4F0E-4DC0-ABC7-035A8217CD50} = {4F47D6F1-4047-4A89-AE85-3AE5EF9F2961}
{9C7B8E9C-A4E6-4459-A2C4-3D2D199EA919} = {4F47D6F1-4047-4A89-AE85-3AE5EF9F2961}
{A9468999-D9F1-4CA3-8CEB-71E520BED921} = {4F47D6F1-4047-4A89-AE85-3AE5EF9F2961}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
Expand Down
9 changes: 7 additions & 2 deletions build/build.environment.mk
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ REF_MUSICBRAINZ = $(LINK_SYSTEM)
LINK_MUSICBRAINZ = -r:$(DIR_BIN)/MusicBrainz.dll
LINK_MUSICBRAINZ_DEPS = $(REF_MUSICBRAINZ) $(LINK_MUSICBRAINZ)

# Notifications
REF_NOTIFICATIONS = $(LINK_SYSTEM) $(LINK_GLIB) $(LINK_GTK) $(LINK_DBUS)
LINK_NOTIFICATIONS = -r:$(DIR_BIN)/Notifications.dll
LINK_NOTIFICATIONS_DEPS = $(REF_NOTIFICATONS) $(LINK_NOTIFICATIONS)

# Core
REF_BANSHEE_CORE = $(LINK_HYENA_DEPS) $(LINK_MONO_POSIX) $(LINK_GLIB) \
$(LINK_DBUS) $(LINK_TAGLIB) $(LINK_MONO_ADDINS_DEPS)
Expand Down Expand Up @@ -142,15 +147,15 @@ LINK_EXTENSION_MEDIAPANEL = -r:$(DIR_BIN)/Banshee.MediaPanel.dll $(REF_EXTENSION
REF_EXTENSION_MPRIS = $(LINK_BANSHEE_THICKCLIENT_DEPS)
REF_EXTENSION_MULTIMEDIAKEYS = $(LINK_BANSHEE_SERVICES_DEPS)
REF_EXTENSION_FIXUP = $(LINK_BANSHEE_THICKCLIENT_DEPS)
REF_EXTENSION_NOTIFICATIONAREA = $(LINK_BANSHEE_THICKCLIENT_DEPS)
REF_EXTENSION_NOTIFICATIONAREA = $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_NOTIFICATIONS_DEPS)
LINK_EXTENSION_NOTIFICATIONAREA = -r:$(DIR_BIN)/Banshee.NotificationArea.dll
REF_EXTENSION_OPTICALDISC = $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_MUSICBRAINZ_DEPS)
REF_EXTENSION_PLAYER_MIGRATION = $(LINK_BANSHEE_THICKCLIENT_DEPS)
REF_EXTENSION_PLAYQUEUE = $(LINK_BANSHEE_THICKCLIENT_DEPS)
LINK_EXTENSION_PLAYQUEUE = -r:$(DIR_BIN)/Banshee.PlayQueue.dll
LINK_EXTENSION_PLAYQUEUE_DEPS = $(REF_EXTENSION_PLAYQUEUE) \
$(LINK_EXTENSION_PLAYQUEUE)
REF_EXTENSION_SOUNDMENU = $(LINK_BANSHEE_THICKCLIENT_DEPS)
REF_EXTENSION_SOUNDMENU = $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_NOTIFICATIONS_DEPS)
REF_EXTENSION_LASTFM = $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_MONO_MEDIA) $(LINK_LASTFM) $(LINK_LASTFM_GUI)
LINK_EXTENSION_LASTFM = -r:$(DIR_BIN)/Banshee.Lastfm.dll
REF_EXTENSION_LASTFM_STREAMING = $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_MONO_MEDIA) $(LINK_LASTFM) $(LINK_LASTFM_GUI) $(LINK_EXTENSION_LASTFM)
Expand Down
13 changes: 0 additions & 13 deletions build/m4/banshee/notify-sharp.m4

This file was deleted.

4 changes: 1 addition & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ BANSHEE_CHECK_DBUS_SHARP
dnl Mono.Addins libraries
BANSHEE_CHECK_MONO_ADDINS

dnl notify-sharp library
BANSHEE_CHECK_NOTIFY_SHARP

dnl Monodoc (optional through --disable-docs)
SHAMROCK_CHECK_MONODOC

Expand Down Expand Up @@ -270,6 +267,7 @@ src/Libraries/Mono.Media/Makefile
src/Libraries/Mtp/Makefile
src/Libraries/Mtp/Mtp.dll.config
src/Libraries/MusicBrainz/Makefile
src/Libraries/Notifications/Makefile
src/Dap/Makefile
src/Dap/Banshee.Dap/Makefile
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Banshee.Services/Banshee.MediaEngine/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ private void LoadAndPlay (string filename)

private void WaitFor (PlayerState state)
{
WaitFor (null, state);
WaitFor ((System.Action)null, state);
}

private void WaitFor (System.Action action, PlayerState state)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\bin</OutputPath>
<DefineConstants>INTERNAL_NOTIFY_SHARP</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>false</Optimize>
Expand All @@ -44,21 +43,10 @@
<Project>{A3701765-E571-413D-808C-9788A22791AF}</Project>
<Name>Banshee.Widgets</Name>
</ProjectReference>
<Reference Include="atk-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<Package>gtk-sharp-3.0</Package>
</Reference>
<Reference Include="cairo-sharp, Version=1.10.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756">
<HintPath>..\..\..\bin\cairo-sharp.dll</HintPath>
<Package>gtk-sharp-3.0</Package>
</Reference>
<Reference Include="dbus-sharp">
<HintPath>..\..\..\bin\dbus-sharp.dll</HintPath>
<Package>dbus-sharp-2.0</Package>
</Reference>
<Reference Include="dbus-sharp-glib">
<HintPath>..\..\..\bin\dbus-sharp-glib.dll</HintPath>
<Package>dbus-sharp-glib-2.0</Package>
</Reference>
<ProjectReference Include="..\..\Hyena\Hyena.Gui\Hyena.Gui.csproj">
<Project>{C856EFD8-E812-4E61-8B76-E3583D94C233}</Project>
<Name>Hyena.Gui</Name>
Expand All @@ -72,10 +60,10 @@
<Project>{95374549-9553-4C1E-9D89-667755F90E12}</Project>
<Name>Hyena</Name>
</ProjectReference>
<Reference Include="gio-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<Package>gio-sharp-3.0</Package>
</Reference>
<Reference Include="notify-sharp, Version=0.4.0.0, Culture=neutral, PublicKeyToken=2df29c54e245917a" />
<ProjectReference Include="..\..\Libraries\Notifications\Notifications.csproj">
<Project>{a9468999-d9f1-4ca3-8ceb-71e520bed921}</Project>
<Name>Notifications</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
Expand All @@ -97,8 +85,6 @@
<Compile Include="Banshee.NotificationArea\INotificationAreaBox.cs" />
<Compile Include="Banshee.NotificationArea\GtkNotificationAreaBox.cs" />
<Compile Include="Banshee.NotificationArea\TrackInfoPopup.cs" />
<Compile Include="Notifications\Notification.cs" />
<Compile Include="Notifications\Notifications.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\NotificationAreaMenu.xml">
Expand Down
13 changes: 2 additions & 11 deletions src/Extensions/Banshee.NotificationArea/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
if EXTERNAL_NOTIFY_SHARP
NOTIFY_SHARP_LIBS = $(NOTIFY_SHARP_LIBS)
else
MCS_FLAGS+="-define:INTERNAL_NOTIFY_SHARP"
NOTIFY_SHARP_LIBS =
endif

ASSEMBLY = Banshee.NotificationArea
TARGET = library
LINK = $(REF_EXTENSION_NOTIFICATIONAREA) $(NOTIFY_SHARP_LIBS)
LINK = $(REF_EXTENSION_NOTIFICATIONAREA)
INSTALL_DIR = $(EXTENSIONS_INSTALL_DIR)

SOURCES = \
Banshee.NotificationArea/GtkNotificationAreaBox.cs \
Banshee.NotificationArea/INotificationAreaBox.cs \
Banshee.NotificationArea/NotificationAreaService.cs \
Banshee.NotificationArea/TrackInfoPopup.cs \
Notifications/Notification.cs \
Notifications/Notifications.cs
Banshee.NotificationArea/TrackInfoPopup.cs

RESOURCES = \
Banshee.NotificationArea.addin.xml \
Expand Down
9 changes: 1 addition & 8 deletions src/Extensions/Banshee.SoundMenu/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
if EXTERNAL_NOTIFY_SHARP
REF_NOTIFY_SHARP_LIBS = $(NOTIFY_SHARP_LIBS)
else
MCS_FLAGS+="-define:INTERNAL_NOTIFY_SHARP"
REF_NOTIFY_SHARP_LIBS = $(LINK_EXTENSION_NOTIFICATIONAREA)
endif

ASSEMBLY = Banshee.SoundMenu
TARGET = library
LINK = $(REF_EXTENSION_SOUNDMENU) $(REF_NOTIFY_SHARP_LIBS)
LINK = $(REF_EXTENSION_SOUNDMENU)
INSTALL_DIR = $(EXTENSIONS_INSTALL_DIR)

SOURCES = \
Expand Down
1 change: 1 addition & 0 deletions src/Libraries/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ SUBDIRS = \
Mono.Media \
Mtp \
MusicBrainz \
Notifications \
Lastfm \
Lastfm.Gui

Expand Down
8 changes: 8 additions & 0 deletions src/Libraries/Notifications/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ASSEMBLY = Notifications
TARGET = library
LINK = $(REF_NOTIFICATIONS)
SOURCES = \
Notifications/Notification.cs \
Notifications/Notifications.cs

include $(top_srcdir)/build/build.mk
65 changes: 65 additions & 0 deletions src/Libraries/Notifications/Notifications.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A9468999-D9F1-4CA3-8CEB-71E520BED921}</ProjectGuid>
<ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Notifications</RootNamespace>
<AssemblyName>Notifications</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="dbus-sharp, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5675b0c3093115b5">
<HintPath>..\..\..\..\..\..\..\usr\lib\mono\gac\dbus-sharp\2.0.0.0__5675b0c3093115b5\dbus-sharp.dll</HintPath>
</Reference>
<Reference Include="dbus-sharp-glib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5675b0c3093115b5">
<HintPath>..\..\..\..\..\..\..\usr\lib\mono\gac\dbus-sharp-glib\2.0.0.0__5675b0c3093115b5\dbus-sharp-glib.dll</HintPath>
</Reference>
<Reference Include="gdk-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<HintPath>..\..\..\..\..\..\..\usr\lib\mono\gac\gdk-sharp\3.0.0.0__35e10195dab3c99f\gdk-sharp.dll</HintPath>
</Reference>
<Reference Include="glib-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<HintPath>..\..\..\..\..\..\..\usr\lib\mono\gac\glib-sharp\3.0.0.0__35e10195dab3c99f\glib-sharp.dll</HintPath>
</Reference>
<Reference Include="gtk-sharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<HintPath>..\..\..\..\..\..\..\usr\lib\mono\gac\gtk-sharp\3.0.0.0__35e10195dab3c99f\gtk-sharp.dll</HintPath>
</Reference>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Notifications\Notification.cs" />
<Compile Include="Notifications\Notifications.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Loading

0 comments on commit 62835b1

Please sign in to comment.