f-spot r4620 - in trunk: . src src/Core
- From: sdelcroix svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r4620 - in trunk: . src src/Core
- Date: Mon, 24 Nov 2008 21:04:16 +0000 (UTC)
Author: sdelcroix
Date: Mon Nov 24 21:04:16 2008
New Revision: 4620
URL: http://svn.gnome.org/viewvc/f-spot?rev=4620&view=rev
Log:
Clean up the properties
2008-11-24 Stephane Delcroix <sdelcroix novell com>
* src/Core/Tag.cs: clean up the properties, only create the stock-icons
pixbufs on demand.
* src/TagStore.cs: mark s method static
Modified:
trunk/ChangeLog
trunk/src/Core/Tag.cs
trunk/src/TagStore.cs
Modified: trunk/src/Core/Tag.cs
==============================================================================
--- trunk/src/Core/Tag.cs (original)
+++ trunk/src/Core/Tag.cs Mon Nov 24 21:04:16 2008
@@ -14,19 +14,16 @@
namespace FSpot
{
- public class Tag : DbItem, IComparable, IDisposable {
- private string name;
+ public class Tag : DbItem, IComparable<Tag>, IDisposable {
+ string name;
public string Name {
- set {
- name = value;
- }
- get {
- return name;
- }
+ get { return name; }
+ set { name = value;}
}
- private Category category;
+ Category category;
public Category Category {
+ get { return category; }
set {
if (Category != null)
Category.RemoveChild (this);
@@ -35,38 +32,37 @@
if (category != null)
category.AddChild (this);
}
- get {
- return category;
- }
}
- private int sort_priority;
+ int sort_priority;
public int SortPriority {
- set { sort_priority = value; }
get { return sort_priority; }
+ set { sort_priority = value; }
}
- private int popularity = 0;
+ int popularity = 0;
public int Popularity {
get { return popularity; }
set { popularity = value; }
}
// Icon. If theme_icon_name is not null, then we save the name of the icon instead
- // of the actual icon data.
-
- private string theme_icon_name;
+ // of the actual icon data.
+ string theme_icon_name;
public string ThemeIconName {
- set {
- theme_icon_name = value;
- cached_icon_size = IconSize.Hidden;
- icon = GtkUtil.TryLoadIcon (FSpot.Global.IconTheme, theme_icon_name, 48, (Gtk.IconLookupFlags)0);
- }
get { return theme_icon_name; }
+ set { theme_icon_name = value; }
}
- private Pixbuf icon;
+ Pixbuf icon;
public Pixbuf Icon {
+ get {
+ if (icon == null && theme_icon_name != null) {
+ cached_icon_size = IconSize.Hidden;
+ icon = GtkUtil.TryLoadIcon (FSpot.Global.IconTheme, theme_icon_name, 48, (Gtk.IconLookupFlags)0);
+ }
+ return icon;
+ }
set {
theme_icon_name = null;
if (icon != null)
@@ -74,7 +70,6 @@
icon = value;
cached_icon_size = IconSize.Hidden;
}
- get { return icon; }
}
public enum IconSize {
@@ -84,13 +79,13 @@
Large = 48
};
- private static IconSize tag_icon_size = IconSize.Large;
+ static IconSize tag_icon_size = IconSize.Large;
public static IconSize TagIconSize {
get { return tag_icon_size; }
set { tag_icon_size = value; }
}
- private Pixbuf cached_icon;
+ Pixbuf cached_icon;
private IconSize cached_icon_size = IconSize.Hidden;
// We can use a SizedIcon everywhere we were using an Icon
@@ -108,18 +103,17 @@
if (Math.Max (cached_icon.Width, cached_icon.Height) <= (int) tag_icon_size)
return cached_icon;
}
- if (icon == null)
+ if (Icon == null)
return null;
- if (Math.Max (icon.Width, icon.Height) >= (int) tag_icon_size) { //Don't upscale
+ if (Math.Max (Icon.Width, Icon.Height) >= (int) tag_icon_size) { //Don't upscale
if (cached_icon != null)
cached_icon.Dispose ();
- cached_icon = icon.ScaleSimple ((int) tag_icon_size, (int) tag_icon_size, InterpType.Bilinear);
+ cached_icon = Icon.ScaleSimple ((int) tag_icon_size, (int) tag_icon_size, InterpType.Bilinear);
cached_icon_size = tag_icon_size;
return cached_icon;
- }
- else
- return icon;
+ } else
+ return Icon;
}
}
@@ -134,10 +128,8 @@
// IComparer.
- public int CompareTo (object obj)
+ public int CompareTo (Tag tag)
{
- Tag tag = obj as Tag;
-
if (Category == tag.Category) {
if (SortPriority == tag.SortPriority)
return Name.CompareTo (tag.Name);
Modified: trunk/src/TagStore.cs
==============================================================================
--- trunk/src/TagStore.cs (original)
+++ trunk/src/TagStore.cs Mon Nov 24 21:04:16 2008
@@ -60,7 +60,7 @@
private const string STOCK_ICON_DB_PREFIX = "stock_icon:";
- private void SetIconFromString (Tag tag, string icon_string)
+ static void SetIconFromString (Tag tag, string icon_string)
{
if (icon_string == null || icon_string == String.Empty)
tag.Icon = null;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]