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