Use an icon theme to look up icons
This commit is contained in:
parent
916d6bb8c4
commit
613fce5d0b
|
@ -24,7 +24,7 @@ namespace SparkleShare {
|
|||
Timeout = 4500;
|
||||
Urgency = Urgency.Low;
|
||||
Show ();
|
||||
// StatusIcon = SparkleUI.NotificationIcon;
|
||||
// StatusIcon = SparkleUI.NotificationIcon; // Doesn't work for some reason :(
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
using Gtk;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
|
@ -89,6 +90,16 @@ namespace SparkleShare {
|
|||
return NewPath;
|
||||
}
|
||||
|
||||
|
||||
public static IconTheme SparkleTheme = new IconTheme ();
|
||||
|
||||
// Looks up an icon from the system's theme
|
||||
public static Gdk.Pixbuf GetIcon (string Name, int Size) {
|
||||
// SparkleTheme.AppendSearchPath (SparklePaths.SparkleInstallPath);
|
||||
return SparkleTheme.LoadIcon (Name, Size,
|
||||
IconLookupFlags.GenericFallback);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,11 @@ namespace SparkleShare {
|
|||
public static string SparklePath = Path.Combine (HomePath ,"SparkleShare");
|
||||
|
||||
public static string SparkleConfigPath =
|
||||
Path.Combine (HomePath, Path.Combine (".config", "sparkleshare"));
|
||||
SparkleHelpers.CombineMore (HomePath, ".config", "sparkleshare");
|
||||
|
||||
public static string SparkleInstallPath =
|
||||
SparkleHelpers.CombineMore ("usr", "share", "sparkleshare",
|
||||
"icons", "hicolor");
|
||||
|
||||
public static string SparkleAvatarPath =
|
||||
Path.Combine (SparkleConfigPath, "avatars");
|
||||
|
|
|
@ -33,15 +33,12 @@ namespace SparkleShare {
|
|||
|
||||
public SparkleSpinner () : base () {
|
||||
|
||||
Size = 48;
|
||||
string SpinnerFileName = SparkleHelpers.CombineMore (
|
||||
SparklePaths.SparkleIconPath,
|
||||
Size + "x" + Size, "animations",
|
||||
"process-working.png");
|
||||
|
||||
Gdk.Pixbuf SpinnerGallery = new Gdk.Pixbuf (SpinnerFileName);
|
||||
CycleDuration = 750;
|
||||
CurrentStep = 0;
|
||||
Size = 48;
|
||||
|
||||
Gdk.Pixbuf SpinnerGallery = SparkleHelpers.GetIcon ("process-working",
|
||||
Size);
|
||||
|
||||
int FramesInWidth = SpinnerGallery.Width / Size;
|
||||
int FramesInHeight = SpinnerGallery.Height / Size;
|
||||
|
|
|
@ -138,15 +138,14 @@ namespace SparkleShare {
|
|||
// Creates a visual list of repositories
|
||||
public VBox CreateReposList() {
|
||||
|
||||
string FolderIcon =
|
||||
"/usr/share/icons/gnome/32x32/places/folder.png";
|
||||
Gdk.Pixbuf FolderIcon = SparkleHelpers.GetIcon ("folder", 32);
|
||||
|
||||
TreeIter ReposIter;
|
||||
foreach (SparkleRepo SparkleRepo in Repositories) {
|
||||
|
||||
ReposIter = ReposStore.Prepend ();
|
||||
|
||||
ReposStore.SetValue (ReposIter, 0, new Gdk.Pixbuf (FolderIcon));
|
||||
ReposStore.SetValue (ReposIter, 0, FolderIcon);
|
||||
|
||||
ReposStore.SetValue (ReposIter, 1, SparkleRepo.Name + " \n" +
|
||||
SparkleRepo.Domain + " ");
|
||||
|
@ -200,9 +199,11 @@ namespace SparkleShare {
|
|||
|
||||
AddRemoveButtons.PackStart (AddButton, true, true, 0);
|
||||
|
||||
Image RemoveImage = new Image ("/usr/share/icons/gnome/16x16/actions/list-remove.png");
|
||||
Image RemoveIcon = new Image (
|
||||
SparkleHelpers.GetIcon ("document-removed", 16));
|
||||
|
||||
Button RemoveButton = new Button ();
|
||||
RemoveButton.Image = RemoveImage;
|
||||
RemoveButton.Add (RemoveIcon);
|
||||
AddRemoveButtons.PackStart (RemoveButton, false, false, 0);
|
||||
|
||||
ScrolledWindow.AddWithViewport (ReposView);
|
||||
|
@ -323,25 +324,21 @@ namespace SparkleShare {
|
|||
string Message = Parts [1];
|
||||
string TimeAgo = Parts [2];
|
||||
|
||||
string IconFile =
|
||||
"/usr/share/icons/hicolor/16x16/status/document-edited.png";
|
||||
string IconFile = "document-edited";
|
||||
|
||||
if (Message.IndexOf (" added ‘") > -1)
|
||||
IconFile =
|
||||
"/usr/share/icons/hicolor/16x16/status/document-added.png";
|
||||
IconFile = "document-added";
|
||||
|
||||
if (Message.IndexOf (" deleted ‘") > -1)
|
||||
IconFile =
|
||||
"/usr/share/icons/hicolor/16x16/status/document-removed.png";
|
||||
IconFile = "document-removed";
|
||||
|
||||
if (Message.IndexOf (" moved ‘") > -1 ||
|
||||
Message.IndexOf (" renamed ‘") > -1)
|
||||
IconFile = "document-moved";
|
||||
|
||||
IconFile =
|
||||
"/usr/share/icons/hicolor/16x16/status/document-moved.png";
|
||||
|
||||
Gdk.Pixbuf ChangeIcon = SparkleHelpers.GetIcon (IconFile, 16);
|
||||
Iter = LogStore.Append ();
|
||||
LogStore.SetValue (Iter, 0, new Gdk.Pixbuf (IconFile));
|
||||
LogStore.SetValue (Iter, 0, ChangeIcon);
|
||||
LogStore.SetValue (Iter, 1, Message);
|
||||
LogStore.SetValue (Iter, 2, " " + TimeAgo);
|
||||
|
||||
|
|
Loading…
Reference in a new issue