let getavatar return pixbuf instead of string
This commit is contained in:
parent
613fce5d0b
commit
b96526cc93
|
@ -25,7 +25,7 @@ namespace SparkleShare {
|
|||
|
||||
public static class SparkleHelpers {
|
||||
|
||||
public static string GetAvatarFileName (string Email, int Size) {
|
||||
public static Gdk.Pixbuf GetAvatar (string Email, int Size) {
|
||||
|
||||
string AvatarPath = Path.Combine (SparklePaths.SparkleAvatarPath,
|
||||
Size + "x" + Size);
|
||||
|
@ -38,7 +38,7 @@ namespace SparkleShare {
|
|||
string AvatarFilePath = AvatarPath + Email;
|
||||
|
||||
if (File.Exists (AvatarFilePath))
|
||||
return AvatarFilePath;
|
||||
return new Gdk.Pixbuf (AvatarFilePath);
|
||||
else {
|
||||
|
||||
// Let's try to get the person's gravatar for next time
|
||||
|
@ -60,14 +60,10 @@ namespace SparkleShare {
|
|||
|
||||
}
|
||||
|
||||
string FallbackFileName = CombineMore (SparklePaths.SparkleIconPath,
|
||||
Size + "x" + Size,
|
||||
"status",
|
||||
"avatar-default.png");
|
||||
if (File.Exists (AvatarPath + Email))
|
||||
return AvatarPath + Email;
|
||||
return new Gdk.Pixbuf (AvatarPath + Email);
|
||||
else
|
||||
return FallbackFileName;
|
||||
return GetIcon ("avatar-default", Size);
|
||||
|
||||
}
|
||||
|
||||
|
@ -95,7 +91,7 @@ namespace SparkleShare {
|
|||
|
||||
// Looks up an icon from the system's theme
|
||||
public static Gdk.Pixbuf GetIcon (string Name, int Size) {
|
||||
// SparkleTheme.AppendSearchPath (SparklePaths.SparkleInstallPath);
|
||||
SparkleTheme.AppendSearchPath (SparklePaths.SparkleInstallPath);
|
||||
return SparkleTheme.LoadIcon (Name, Size,
|
||||
IconLookupFlags.GenericFallback);
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ namespace SparkleShare {
|
|||
Process.StartInfo.Arguments = "commit -m \"" + Message + "\"";
|
||||
Process.Start();
|
||||
ShowEventBubble (UserName + " " + Message,
|
||||
SparkleHelpers.GetAvatarFileName (UserEmail, 48),
|
||||
SparkleHelpers.GetAvatar (UserEmail, 48),
|
||||
true);
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ namespace SparkleShare {
|
|||
string LastCommitUserName = Process.StandardOutput.ReadToEnd().Trim ();
|
||||
|
||||
ShowEventBubble (LastCommitUserName + " " + LastCommitMessage,
|
||||
SparkleHelpers.GetAvatarFileName (LastCommitEmail, 48),
|
||||
SparkleHelpers.GetAvatar (LastCommitEmail, 48),
|
||||
true);
|
||||
|
||||
}
|
||||
|
@ -371,11 +371,11 @@ namespace SparkleShare {
|
|||
|
||||
// Shows a notification with text and image
|
||||
public void ShowEventBubble (string Title,
|
||||
string IconFileName,
|
||||
bool ShowButtons) {
|
||||
Gdk.Pixbuf Avatar,
|
||||
bool ShowButtons) {
|
||||
|
||||
SparkleBubble StuffChangedBubble = new SparkleBubble (Title, "");
|
||||
StuffChangedBubble.Icon = new Gdk.Pixbuf (IconFileName);
|
||||
StuffChangedBubble.Icon = Avatar;
|
||||
|
||||
// Add a button to open the folder where the changed file is
|
||||
if (ShowButtons)
|
||||
|
|
|
@ -408,13 +408,10 @@ namespace SparkleShare {
|
|||
if (UserName.Equals (SparkleRepo.UserName))
|
||||
UserName += " (that’s you!)";
|
||||
|
||||
string AvatarFileName =
|
||||
SparkleHelpers.GetAvatarFileName (UserEmail, 32);
|
||||
|
||||
// Actually add to the list
|
||||
PeopleIter = PeopleStore.Prepend ();
|
||||
PeopleStore.SetValue (PeopleIter, 0,
|
||||
new Gdk.Pixbuf (AvatarFileName));
|
||||
SparkleHelpers.GetAvatar (UserEmail , 32));
|
||||
PeopleStore.SetValue (PeopleIter, 1, UserName + "\n" + UserEmail);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue