banshee r3300 - in trunk/banshee: . build src/Clients/Nereid/Nereid src/Extensions src/Extensions/Banshee.Skins src/Extensions/Banshee.Skins/Banshee.Skins src/Extensions/Banshee.Skins/Resources



Author: gburt
Date: Fri Feb 22 01:56:41 2008
New Revision: 3300
URL: http://svn.gnome.org/viewvc/banshee?rev=3300&view=rev

Log:
2008-02-21  Gabriel Burt  <gabriel burt gmail com>

	* build/build.environment.mk:
	* configure.ac:
	* src/Clients/Nereid/Nereid/Client.cs:
	* src/Extensions/Banshee.Skins/Banshee.Skins.addin.xml:
	* src/Extensions/Banshee.Skins/Banshee.Skins.mdp:
	* src/Extensions/Banshee.Skins/Banshee.Skins/SkinManager.cs:
	* src/Extensions/Banshee.Skins/Makefile.am:
	* src/Extensions/Banshee.Skins/Resources/GlobalUI.xml:
	* src/Extensions/Makefile.am: New extension for switching skins (*.gtkrc
	files under ~/.config/plugins/skins/).


Added:
   trunk/banshee/src/Extensions/Banshee.Skins/   (props changed)
   trunk/banshee/src/Extensions/Banshee.Skins/Banshee.Skins/
   trunk/banshee/src/Extensions/Banshee.Skins/Banshee.Skins.addin.xml
   trunk/banshee/src/Extensions/Banshee.Skins/Banshee.Skins.mdp
   trunk/banshee/src/Extensions/Banshee.Skins/Banshee.Skins/SkinManager.cs
   trunk/banshee/src/Extensions/Banshee.Skins/Makefile.am
   trunk/banshee/src/Extensions/Banshee.Skins/Resources/
   trunk/banshee/src/Extensions/Banshee.Skins/Resources/GlobalUI.xml
Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/build/build.environment.mk
   trunk/banshee/configure.ac
   trunk/banshee/src/Clients/Nereid/Nereid/Client.cs
   trunk/banshee/src/Extensions/Makefile.am

Modified: trunk/banshee/build/build.environment.mk
==============================================================================
--- trunk/banshee/build/build.environment.mk	(original)
+++ trunk/banshee/build/build.environment.mk	Fri Feb 22 01:56:41 2008
@@ -122,6 +122,7 @@
 REF_EXTENSION_NOTIFICATIONAREA = $(LINK_BANSHEE_THICKCLIENT_DEPS)
 REF_EXTENSION_PLAYQUEUE = $(LINK_BANSHEE_THICKCLIENT_DEPS)
 REF_EXTENSION_LASTFM = $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_MONO_MEDIA) $(LINK_LASTFM) $(LINK_LASTFM_GUI)
+REF_EXTENSION_SKINS = $(LINK_BANSHEE_THICKCLIENT_DEPS)
 
 # Build rules
 # Ignoring 0278 due to a bug in gmcs: 

Modified: trunk/banshee/configure.ac
==============================================================================
--- trunk/banshee/configure.ac	(original)
+++ trunk/banshee/configure.ac	Fri Feb 22 01:56:41 2008
@@ -152,6 +152,7 @@
 src/Extensions/Banshee.MultimediaKeys/Makefile
 src/Extensions/Banshee.NotificationArea/Makefile
 src/Extensions/Banshee.PlayQueue/Makefile
+src/Extensions/Banshee.Skins/Makefile
 ])
 
 if test "x${enable_daap}" = "xyes"; then

Modified: trunk/banshee/src/Clients/Nereid/Nereid/Client.cs
==============================================================================
--- trunk/banshee/src/Clients/Nereid/Nereid/Client.cs	(original)
+++ trunk/banshee/src/Clients/Nereid/Nereid/Client.cs	Fri Feb 22 01:56:41 2008
@@ -36,13 +36,13 @@
         {
             // This could go into GtkBaseClient, but it's probably something we
             // should really only support at each client level
-            string user_gtkrc = Path.Combine (Banshee.Base.Paths.ApplicationData, "gtkrc"); 
+            /*string user_gtkrc = Path.Combine (Banshee.Base.Paths.ApplicationData, "gtkrc"); 
             
             if (File.Exists (user_gtkrc)) {
                 Gtk.Rc.AddDefaultFile (user_gtkrc);
             } else if (File.Exists ("gtkrc")) {
                 Gtk.Rc.AddDefaultFile ("gtkrc");
-            }
+            }*/
             
             // Boot the client
             Banshee.Gui.GtkBaseClient.Entry<Client> ();

Added: trunk/banshee/src/Extensions/Banshee.Skins/Banshee.Skins.addin.xml
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.Skins/Banshee.Skins.addin.xml	Fri Feb 22 01:56:41 2008
@@ -0,0 +1,12 @@
+<Addin id="Banshee.Skins">
+
+  <Dependencies>
+    <Addin id="Banshee.Services" version="1.0"/>
+    <Addin id="Banshee.ThickClient" version="1.0"/>
+  </Dependencies>
+
+  <Extension path="/Banshee/ServiceManager/Service">
+    <Service class="Banshee.Skins.SkinManager"/>
+  </Extension>
+  
+</Addin>

Added: trunk/banshee/src/Extensions/Banshee.Skins/Banshee.Skins.mdp
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.Skins/Banshee.Skins.mdp	Fri Feb 22 01:56:41 2008
@@ -0,0 +1,30 @@
+<Project name="Banshee.Skins" fileversion="2.0" language="C#" clr-version="Net_2_0" ctype="DotNetProject">
+  <Configurations active="Debug">
+    <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+      <Output directory="../../../bin" assemblyKeyFile="." assembly="Banshee.Skins" />
+      <Build debugmode="True" target="Library" />
+      <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" />
+      <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+    </Configuration>
+  </Configurations>
+  <Contents>
+    <File name="Banshee.Skins/SkingManager.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Skins.addin.xml" subtype="Code" buildaction="EmbedAsResource" />
+    <File name="Resources/GlobalUI.xml" subtype="Code" buildaction="EmbedAsResource" />
+  </Contents>
+  <References>
+    <ProjectReference type="Project" localcopy="True" refto="Banshee.Core" />
+    <ProjectReference type="Project" localcopy="True" refto="Banshee.Services" />
+    <ProjectReference type="Project" localcopy="True" refto="Banshee.ThickClient" />
+    <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+  </References>
+  <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="./Makefile.am">
+    <BuildFilesVar Sync="True" Name="SOURCES" />
+    <DeployFilesVar />
+    <ResourcesVar Sync="True" Name="RESOURCES" />
+    <OthersVar />
+    <GacRefVar />
+    <AsmRefVar />
+    <ProjectRefVar />
+  </MonoDevelop.Autotools.MakefileInfo>
+</Project>

Added: trunk/banshee/src/Extensions/Banshee.Skins/Banshee.Skins/SkinManager.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.Skins/Banshee.Skins/SkinManager.cs	Fri Feb 22 01:56:41 2008
@@ -0,0 +1,175 @@
+//
+// SkinManager.cs
+//
+// Author:
+//   Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// 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;
+
+using Mono.Unix;
+using Gtk;
+
+using Hyena.Data.Sqlite;
+
+using Banshee.ServiceStack;
+using Banshee.Configuration;
+using Banshee.Gui;
+using System.IO;
+
+namespace Banshee.Skins
+{
+    public class SkinManager : IExtensionService
+    {
+        private BansheeActionGroup actions;
+        private InterfaceActionService action_service;
+        private CheckMenuItem no_skin_item;
+
+        private string skins_directory = Path.Combine (Path.Combine (Banshee.Base.Paths.ApplicationData, "plugins"), "skins");
+        private string user_gtkrc = Path.Combine (Banshee.Base.Paths.ApplicationData, "gtkrc"); 
+        
+        public SkinManager ()
+        {
+        }
+
+        public void Initialize ()
+        {
+            action_service = ServiceManager.Get<InterfaceActionService> ();
+            action_service.GlobalActions.Add (new ActionEntry [] {
+                new ActionEntry ("SkinsMenuAction", null,
+                    Catalog.GetString ("Change Skin"), null,
+                    Catalog.GetString ("Choose a different visual theme for Banshee"), OnSkinsMenu),
+
+                new ActionEntry ("InstallSkinsAction", null,
+                    Catalog.GetString ("Install Skins"), null,
+                    Catalog.GetString ("Find and install more skins"), null)
+            });
+
+            action_service.UIManager.AddUiFromResource ("GlobalUI.xml");
+            action_service.GlobalActions ["InstallSkinsAction"].Sensitive = false;
+
+            if (!Banshee.IO.Directory.Exists (skins_directory)) {
+                Banshee.IO.Directory.Create (skins_directory);
+            }
+
+            Gtk.Rc.AddDefaultFile (user_gtkrc);
+            if (System.IO.File.Exists (user_gtkrc)) {
+                Gtk.Rc.ReparseAllForSettings (ServiceManager.Get<GtkElementsService> ().PrimaryWindow.Settings, true);
+            }
+        }
+        
+        public void Dispose ()
+        {
+            /*if (ClearOnQuitSchema.Get ()) {
+                OnClearPlayQueue (this, EventArgs.Empty);
+            }*/
+        }
+
+        private bool first = true;
+        private void OnSkinsMenu (object sender, EventArgs args)
+        {
+            MenuItem item = action_service.UIManager.GetWidget ("/MainMenu/ViewMenu/ViewMenuAdditions/SkinsMenu") as Gtk.MenuItem;
+            Menu menu = item.Submenu as Gtk.Menu;
+
+            if (first) {
+                first = false;
+                no_skin_item = new CheckMenuItem (Catalog.GetString ("No Skin"));
+                no_skin_item.DrawAsRadio = true;
+                no_skin_item.Activated += OnSkinSelected;
+
+                menu.Prepend (new SeparatorMenuItem ());
+
+                foreach (FileInfo file in new DirectoryInfo (skins_directory).GetFiles ("*.gtkrc")) {
+                    string name = file.Name.Replace (".gtkrc", "");
+                    Console.WriteLine ("adding {0}", name);
+                    CheckMenuItem skin_item = new CheckMenuItem (name);
+                    skin_item.DrawAsRadio = true;
+                    skin_item.Activated += OnSkinSelected;
+                    menu.Prepend (skin_item);
+                }
+
+                menu.Prepend (no_skin_item);
+                UpdateChecks ();
+                menu.ShowAll ();
+            } else {
+                UpdateChecks ();
+            }
+        }
+
+        private void UpdateChecks ()
+        {
+            MenuItem item = action_service.UIManager.GetWidget ("/MainMenu/ViewMenu/ViewMenuAdditions/SkinsMenu") as Gtk.MenuItem;
+            Menu menu = item.Submenu as Gtk.Menu;
+
+            string current_skin = CurrentSkinSchema.Get ();
+            foreach (Widget widget in menu.Children) {
+                CheckMenuItem skin_item = widget as CheckMenuItem;
+                if (skin_item != null) {
+                    skin_item.Activated -= OnSkinSelected;
+                    skin_item.Active = (current_skin == (skin_item.Child as Label).Text);
+                    skin_item.Activated += OnSkinSelected;
+                }
+            }
+
+            no_skin_item.Activated -= OnSkinSelected;
+            no_skin_item.Active = (current_skin == "none");
+            no_skin_item.Activated += OnSkinSelected;
+        }
+
+        private void OnSkinSelected (object sender, EventArgs args)
+        {
+            if (sender == no_skin_item) {
+                ChangeSkin ("none");
+            } else {
+                ChangeSkin (((sender as MenuItem).Child as Label).Text);
+            }
+        }
+
+        private void ChangeSkin (string name)
+        {
+            if (name == CurrentSkinSchema.Get ())
+                return;
+            
+            CurrentSkinSchema.Set (name);
+
+            System.IO.File.Delete (user_gtkrc);
+            if (name != "none") {
+                System.IO.File.Copy (Path.Combine (skins_directory, String.Format ("{0}.gtkrc", name)), user_gtkrc);
+            }
+
+            Gtk.Rc.ReparseAllForSettings (ServiceManager.Get<GtkElementsService> ().PrimaryWindow.Settings, true);
+        }
+
+        public string ServiceName {
+            get { return "SkinManager"; }
+        }
+        
+        public static readonly SchemaEntry<string> CurrentSkinSchema = new SchemaEntry<string> (
+            "plugins.skins", "current_skin",
+            "none",
+            "Name of the current skin",
+            "Name of the current skin."
+        );
+    }
+}

Added: trunk/banshee/src/Extensions/Banshee.Skins/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.Skins/Makefile.am	Fri Feb 22 01:56:41 2008
@@ -0,0 +1,12 @@
+ASSEMBLY = Banshee.Skins
+TARGET = library
+LINK = $(REF_EXTENSION_SKINS)
+
+SOURCES = Banshee.Skins/SkinManager.cs 
+
+RESOURCES =  \
+	Banshee.Skins.addin.xml \
+	Resources/GlobalUI.xml
+
+include $(top_srcdir)/build/build.mk
+

Added: trunk/banshee/src/Extensions/Banshee.Skins/Resources/GlobalUI.xml
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.Skins/Resources/GlobalUI.xml	Fri Feb 22 01:56:41 2008
@@ -0,0 +1,12 @@
+<ui>
+  <menubar name="MainMenu">
+    <menu name="ViewMenu" action="ViewMenuAction">
+      <placeholder name="ViewMenuAdditions">
+        <menu name="SkinsMenu" action="SkinsMenuAction">
+          <separator/>
+          <menuitem name="InstallSkins" action="InstallSkinsAction"/>
+        </menu>
+      </placeholder>
+    </menu>
+  </menubar>
+</ui>

Modified: trunk/banshee/src/Extensions/Makefile.am
==============================================================================
--- trunk/banshee/src/Extensions/Makefile.am	(original)
+++ trunk/banshee/src/Extensions/Makefile.am	Fri Feb 22 01:56:41 2008
@@ -3,6 +3,7 @@
 	Banshee.Lastfm \
 	Banshee.MultimediaKeys \
 	Banshee.NotificationArea \
-	Banshee.PlayQueue
+	Banshee.PlayQueue \
+	Banshee.Skins
 
 MAINTAINERCLEANFILES = Makefile.in



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