banshee r3805 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Preferences src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui src/Core/Banshee.ThickClient/Banshee.Preferences.Gui src/Libraries/Hyena.Gui src/Libraries/Hyena.Gui/Hyena.Widgets
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3805 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Preferences src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui src/Core/Banshee.ThickClient/Banshee.Preferences.Gui src/Libraries/Hyena.Gui src/Libraries/Hyena.Gui/Hyena.Widgets
- Date: Tue, 22 Apr 2008 21:49:56 +0100 (BST)
Author: abock
Date: Tue Apr 22 20:49:55 2008
New Revision: 3805
URL: http://svn.gnome.org/viewvc/banshee?rev=3805&view=rev
Log:
2008-04-22 Aaron Bockover <abock gnome org>
* src/Core/Banshee.Services/Banshee.Preferences/Page.cs: Set up default
preferences for some more things
* src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/DefaultPreferenceWidgets.cs:
Added widget adapters for the file/folder pattern preferences
* src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/SectionBox.cs:
Layout preference widgets properly using a table so everything lines
up and looks pretty
* src/Core/Banshee.Services/Banshee.Preferences/Collection.cs: Added
FindOrAdd method
* src/Core/Banshee.Services/Banshee.Preferences/PreferenceBase.cs:
Added a ShowLabel property
* src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/WidgetFactory.cs:
Remove a console.writeline
* src/Libraries/Hyena.Gui/Hyena.Widgets/TextViewLabel.cs: Moved from
somewhere in Banshee proper
* src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/ProfileComboBoxConfigurable.cs:
* src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/ProfileConfigurationDialog.cs:
Reflect the moving of TextViewLabel to Hyena.Widgets
Added:
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/TextViewLabel.cs (contents, props changed)
- copied, changed from r3803, /trunk/banshee/src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/TextViewLabel.cs
Removed:
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/TextViewLabel.cs
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Collection.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Page.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/PreferenceBase.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/ProfileComboBoxConfigurable.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/ProfileConfigurationDialog.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/DefaultPreferenceWidgets.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/SectionBox.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/WidgetFactory.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp
trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.mdp
trunk/banshee/src/Libraries/Hyena.Gui/Makefile.am
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Collection.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Collection.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Collection.cs Tue Apr 22 20:49:55 2008
@@ -48,6 +48,13 @@
}
}
+ public T FindOrAdd (T item)
+ {
+ lock (this) {
+ return FindById (item.Id) ?? Add (item);
+ }
+ }
+
public T this[string id] {
get { return FindById (id); }
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Page.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Page.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/Page.cs Tue Apr 22 20:49:55 2008
@@ -50,10 +50,15 @@
internal static void SetupDefaults (PreferenceService service)
{
Page general = service.Add (new Page ("general", Catalog.GetString ("General"), 0));
+
Section music_library = general.Add (new Section ("music-library", Catalog.GetString ("Music _Library"), 0));
music_library.Add (new LibraryLocationPreference ());
music_library.Add (new SchemaPreference<bool> (LibrarySchema.CopyOnImport, Catalog.GetString ("Co_py files to media folders when importing")));
music_library.Add (new SchemaPreference<bool> (LibrarySchema.WriteMetadata, Catalog.GetString ("Write _metadata to files")));
+
+ Section file_system = general.Add (new Section ("file-system", Catalog.GetString ("File System Organization"), 10));
+ file_system.Add (new SchemaPreference<string> (LibrarySchema.FolderPattern, Catalog.GetString ("Folder hie_rarchy")));
+ file_system.Add (new SchemaPreference<string> (LibrarySchema.FilePattern, Catalog.GetString ("File _name")));
}
}
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/PreferenceBase.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/PreferenceBase.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Preferences/PreferenceBase.cs Tue Apr 22 20:49:55 2008
@@ -38,6 +38,12 @@
public abstract object BoxedValue { get; set; }
+ private bool show_label = true;
+ public virtual bool ShowLabel {
+ get { return show_label; }
+ set { show_label = value; }
+ }
+
private object display_widget;
public virtual object DisplayWidget {
get { return display_widget; }
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/ProfileComboBoxConfigurable.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/ProfileComboBoxConfigurable.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/ProfileComboBoxConfigurable.cs Tue Apr 22 20:49:55 2008
@@ -29,6 +29,8 @@
using System;
using Gtk;
+using Hyena.Widgets;
+
namespace Banshee.MediaProfiles.Gui
{
public class ProfileComboBoxConfigurable : VBox
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/ProfileConfigurationDialog.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/ProfileConfigurationDialog.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/ProfileConfigurationDialog.cs Tue Apr 22 20:49:55 2008
@@ -66,7 +66,7 @@
private Profile profile;
private Label header_label = new Label();
- private TextViewLabel description_label = new TextViewLabel();
+ private Hyena.Widgets.TextViewLabel description_label = new Hyena.Widgets.TextViewLabel();
private Table normal_controls_table = new Table(1, 1, false);
private Table advanced_controls_table = new Table(1, 1, false);
private Expander advanced_expander = new Expander(Catalog.GetString("Advanced"));
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/DefaultPreferenceWidgets.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/DefaultPreferenceWidgets.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/DefaultPreferenceWidgets.cs Tue Apr 22 20:49:55 2008
@@ -33,6 +33,10 @@
using Banshee.Base;
using Banshee.Library;
using Banshee.Preferences;
+using Banshee.Collection;
+
+using Hyena.Widgets;
+using Banshee.Widgets;
namespace Banshee.Preferences.Gui
{
@@ -42,6 +46,15 @@
{
PreferenceBase library_location = service["general"]["music-library"]["library-location"];
library_location.DisplayWidget = new LibraryLocationButton (library_location);
+
+ PreferenceBase folder_pattern = service["general"]["file-system"]["folder_pattern"];
+ folder_pattern.DisplayWidget = new PatternComboBox (folder_pattern, FileNamePattern.SuggestedFolders);
+
+ PreferenceBase file_pattern = service["general"]["file-system"]["file_pattern"];
+ file_pattern.DisplayWidget = new PatternComboBox (file_pattern, FileNamePattern.SuggestedFiles);
+
+ PreferenceBase pattern_display = service["general"]["file-system"].FindOrAdd (new Preference<object> ("file_folder_pattern", null));
+ pattern_display.DisplayWidget = new PatternDisplay (folder_pattern.DisplayWidget, file_pattern.DisplayWidget);
}
private class LibraryLocationButton : HBox
@@ -53,6 +66,7 @@
public LibraryLocationButton (PreferenceBase pref)
{
preference = (LibraryLocationPreference)pref;
+ preference.ShowLabel = false;
Spacing = 5;
@@ -86,5 +100,70 @@
preference.Value = chooser.Filename;
}
}
+
+ private class PatternComboBox : DictionaryComboBox<string>
+ {
+ private Preference<string> preference;
+
+ public PatternComboBox (PreferenceBase pref, string [] patterns)
+ {
+ preference = (Preference<string>)pref;
+
+ bool already_added = false;
+ string conf_pattern = preference.Value;
+
+ foreach (string pattern in patterns) {
+ if (!already_added && pattern.Equals (conf_pattern)) {
+ already_added = true;
+ }
+
+ Add (FileNamePattern.CreatePatternDescription (pattern), pattern);
+ }
+
+ if (!already_added) {
+ Add (FileNamePattern.CreatePatternDescription (conf_pattern), conf_pattern);
+ }
+
+ ActiveValue = conf_pattern;
+ }
+
+ protected override void OnChanged ()
+ {
+ preference.Value = ActiveValue;
+ base.OnChanged ();
+ }
+ }
+
+ private class PatternDisplay : TextViewLabel
+ {
+ private PatternComboBox folder;
+ private PatternComboBox file;
+
+ private SampleTrackInfo track = new SampleTrackInfo ();
+
+ public PatternDisplay (object a, object b)
+ {
+ folder= (PatternComboBox)a;
+ file = (PatternComboBox)b;
+
+ folder.Changed += OnChanged;
+ file.Changed += OnChanged;
+
+ Pango.FontDescription font = PangoContext.FontDescription.Copy ();
+ font.Style = Pango.Style.Italic;
+ font.Size = (int)(font.Size * Pango.Scale.Small);
+ ModifyFont (font);
+
+ OnChanged (null, null);
+ }
+
+ private void OnChanged (object o, EventArgs args)
+ {
+ string display = FileNamePattern.CreateFromTrackInfo (FileNamePattern.CreateFolderFilePattern (
+ folder.ActiveValue, file.ActiveValue), track);
+
+ Text = String.IsNullOrEmpty (display) ? String.Empty : String.Format ("{0}.ogg", display);
+ }
+ }
}
}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/SectionBox.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/SectionBox.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/SectionBox.cs Tue Apr 22 20:49:55 2008
@@ -33,21 +33,53 @@
namespace Banshee.Preferences.Gui
{
- public class SectionBox : VBox
+ public class SectionBox : Table
{
- public SectionBox (Section section)
+ public SectionBox (Section section) : base (1, 2, false)
{
- Spacing = 3;
-
+ ColumnSpacing = 10;
+ RowSpacing = 5;
+
foreach (PreferenceBase preference in section) {
Widget widget = WidgetFactory.GetWidget (preference);
if (widget == null) {
continue;
}
- PackStart (widget, false, false, 0);
- widget.Show ();
+ AddWidget (preference, widget);
+ }
+ }
+
+ private void AddWidget (PreferenceBase preference, Widget widget)
+ {
+ uint start_row = NRows;
+ uint start_col = 0;
+
+ if (!(widget is CheckButton) && preference.ShowLabel) {
+ AttachLabel (preference.Name, start_row);
+ start_col++;
}
+
+ widget.Show ();
+ Attach (widget, start_col, 2, start_row, start_row + 1,
+ AttachOptions.Expand | AttachOptions.Fill,
+ AttachOptions.Expand | AttachOptions.Fill, 0, 0);
+ }
+
+ private void AttachLabel (string text, uint start_row)
+ {
+ if (String.IsNullOrEmpty (text)) {
+ return;
+ }
+
+ Label label = new Label (String.Format ("{0}:", text));
+ label.UseUnderline = true;
+ label.Xalign = 0.0f;
+ label.Show ();
+
+ Attach (label, 0, 1, start_row, start_row + 1,
+ AttachOptions.Fill,
+ AttachOptions.Expand | AttachOptions.Fill, 0, 0);
}
}
}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/WidgetFactory.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/WidgetFactory.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Preferences.Gui/WidgetFactory.cs Tue Apr 22 20:49:55 2008
@@ -100,7 +100,6 @@
base.OnChanged ();
if (sync) {
- Console.WriteLine (Text);
preference.BoxedValue = Text;
}
}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp Tue Apr 22 20:49:55 2008
@@ -58,7 +58,6 @@
<File name="Banshee.MediaProfiles.Gui/ProfileComboBoxConfigurable.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.MediaProfiles.Gui/ProfileConfigurationDialog.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.MediaProfiles.Gui/ProfileConfigureButton.cs" subtype="Code" buildaction="Compile" />
- <File name="Banshee.MediaProfiles.Gui/TextViewLabel.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Collection.Gui/ColumnCellDateTime.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Gui/BansheeActionGroup.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Gui/IHasSourceView.cs" subtype="Code" buildaction="Compile" />
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am Tue Apr 22 20:49:55 2008
@@ -75,7 +75,6 @@
Banshee.MediaProfiles.Gui/ProfileComboBoxConfigurable.cs \
Banshee.MediaProfiles.Gui/ProfileConfigurationDialog.cs \
Banshee.MediaProfiles.Gui/ProfileConfigureButton.cs \
- Banshee.MediaProfiles.Gui/TextViewLabel.cs \
Banshee.Playlist.Gui/PlaylistExportDialog.cs \
Banshee.Preferences.Gui/DefaultPreferenceWidgets.cs \
Banshee.Preferences.Gui/NotebookPage.cs \
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.mdp
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.mdp (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.mdp Tue Apr 22 20:49:55 2008
@@ -67,6 +67,7 @@
<File name="Hyena.Widgets/SmoothScrolledWindow.cs" subtype="Code" buildaction="Compile" />
<File name="Hyena.Widgets/MenuButton.cs" subtype="Code" buildaction="Compile" />
<File name="Hyena.Gui/CompositeUtils.cs" subtype="Code" buildaction="Compile" />
+ <File name="Hyena.Widgets/TextViewLabel.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
Copied: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/TextViewLabel.cs (from r3803, /trunk/banshee/src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/TextViewLabel.cs)
==============================================================================
--- /trunk/banshee/src/Core/Banshee.ThickClient/Banshee.MediaProfiles.Gui/TextViewLabel.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/TextViewLabel.cs Tue Apr 22 20:49:55 2008
@@ -1,39 +1,39 @@
-/***************************************************************************
- * TextViewLabel.cs
- *
- * Copyright (C) 2007 Novell, Inc.
- * Written by Aaron Bockover <abockover novell com>
- ****************************************************************************/
+//
+// TextViewLabel.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2007-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.
+//
-/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW:
- *
- * 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 Gtk;
-namespace Banshee.MediaProfiles.Gui
+namespace Hyena.Widgets
{
public class TextViewLabel : TextView
{
- public TextViewLabel() : base()
+ public TextViewLabel () : base ()
{
WrapMode = WrapMode.Word;
Editable = false;
@@ -42,19 +42,19 @@
private bool changing_style;
- protected override void OnStyleSet(Style previous_style)
+ protected override void OnStyleSet (Style previous_style)
{
- if(changing_style) {
+ if (changing_style) {
return;
}
changing_style = true;
- base.OnStyleSet(previous_style);
+ base.OnStyleSet (previous_style);
- Window temp = new Window(WindowType.Toplevel);
- temp.EnsureStyle();
- ModifyBase(StateType.Normal, temp.Style.Background(StateType.Normal));
+ Window temp = new Window (WindowType.Toplevel);
+ temp.EnsureStyle ();
+ ModifyBase (StateType.Normal, temp.Style.Background (StateType.Normal));
changing_style = false;
}
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Makefile.am
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Makefile.am (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Makefile.am Tue Apr 22 20:49:55 2008
@@ -60,7 +60,8 @@
Hyena.Widgets/MessageBar.cs \
Hyena.Widgets/RoundedFrame.cs \
Hyena.Widgets/ScrolledWindow.cs \
- Hyena.Widgets/SmoothScrolledWindow.cs
+ Hyena.Widgets/SmoothScrolledWindow.cs \
+ Hyena.Widgets/TextViewLabel.cs
include $(top_srcdir)/build/build.mk
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]