Merge remote branch 'upstream/master' into autofoo

This commit is contained in:
Łukasz Jernaś 2010-06-18 12:34:52 +02:00
commit 89ba3de8ae
8 changed files with 72 additions and 86 deletions

View file

@ -1,32 +0,0 @@
// SparkleShare, an instant update workflow to Git.
// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// 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 Notifications;
namespace SparkleShare {
public class SparkleBubble : Notification {
public SparkleBubble (string Title, string Subtext) : base (Title, Subtext) {
Timeout = 4500;
Urgency = Urgency.Low;
Show ();
// StatusIcon = SparkleUI.NotificationIcon; // Doesn't work for some reason :(
}
}
}

View file

@ -156,7 +156,11 @@ namespace SparkleShare {
"Please double check the address and\n" +
"network connection.");
Directory.Delete (SparkleHelpers.CombineMore (SparklePaths.SparkleTmpPath, RepoName));
try {
Directory.Delete (SparkleHelpers.CombineMore (SparklePaths.SparkleTmpPath, RepoName));
} catch (System.IO.DirectoryNotFoundException) {
SparkleHelpers.DebugInfo ("Config", "[" + RepoName + "] Temporary directory did not exist...");
}
ErrorBubble.AddAction ("", _("Try Again…"),
delegate {

View file

@ -411,7 +411,7 @@ namespace SparkleShare {
if (FilesAdded > 1)
return "added " +
Line.Replace ("#\tnew file:", "").Trim () +
" and " + (FilesAdded - 1) + " more.";
"\nand " + (FilesAdded - 1) + " more.";
else
return "added " +
Line.Replace ("#\tnew file:", "").Trim () + ".";
@ -424,7 +424,7 @@ namespace SparkleShare {
if (FilesEdited > 1)
return "edited " +
Line.Replace ("#\tmodified:", "").Trim () +
" and " + (FilesEdited - 1) + " more.";
"\nand " + (FilesEdited - 1) + " more.";
else
return "edited " +
Line.Replace ("#\tmodified:", "").Trim () + ".";
@ -437,7 +437,7 @@ namespace SparkleShare {
if (FilesDeleted > 1)
return "deleted " +
Line.Replace ("#\tdeleted:", "").Trim () +
" and " + (FilesDeleted - 1) + " more.";
"\nand " + (FilesDeleted - 1) + " more.";
else
return "deleted " +
Line.Replace ("#\tdeleted:", "").Trim () + ".";

View file

@ -25,14 +25,16 @@ namespace SparkleShare {
public class SparkleShare {
// Short alias for the translations
public static string _ (string s) {
public static string _ (string s)
{
return Catalog.GetString (s);
}
public static SparkleRepo [] Repositories;
public static SparkleUI SparkleUI;
public static void Main (string [] args) {
public static void Main (string [] args)
{
// Use translations
Catalog.Init (Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR);
@ -80,7 +82,8 @@ namespace SparkleShare {
}
// Prints the help output
public static void ShowHelp () {
public static void ShowHelp ()
{
Console.WriteLine (_("SparkleShare Copyright (C) 2010 Hylke Bons"));
Console.WriteLine (" ");
Console.WriteLine (_("This program comes with ABSOLUTELY NO WARRANTY."));

View file

@ -20,7 +20,8 @@ using System.Timers;
namespace SparkleShare {
// This is a close implementation of GtkSpinner
public class SparkleSpinner : Image {
public class SparkleSpinner : Image
{
public bool Active;
@ -31,14 +32,14 @@ namespace SparkleShare {
private int NumSteps;
private int Size;
public SparkleSpinner () : base () {
public SparkleSpinner () : base ()
{
CycleDuration = 750;
CurrentStep = 0;
Size = 24;
Gdk.Pixbuf SpinnerGallery = SparkleHelpers.GetIcon ("process-working",
Size);
Gdk.Pixbuf SpinnerGallery = SparkleHelpers.GetIcon ("process-working", Size);
int FramesInWidth = SpinnerGallery.Width / Size;
int FramesInHeight = SpinnerGallery.Height / Size;
@ -49,8 +50,7 @@ namespace SparkleShare {
for (int y = 0; y < FramesInHeight; y++) {
for (int x = 0; x < FramesInWidth; x++) {
if (!(y == 0 && x == 0)) {
Images [i] = new Gdk.Pixbuf (SpinnerGallery,
x * Size, y * Size, Size, Size);
Images [i] = new Gdk.Pixbuf (SpinnerGallery, x * Size, y * Size, Size, Size);
i++;
}
}
@ -58,12 +58,15 @@ namespace SparkleShare {
Timer = new Timer ();
Timer.Interval = CycleDuration / NumSteps;
Timer.Elapsed += delegate { NextImage (); };
Timer.Elapsed += delegate {
NextImage ();
};
Start ();
}
private void NextImage () {
private void NextImage ()
{
if (CurrentStep < NumSteps)
CurrentStep++;
else
@ -71,17 +74,20 @@ namespace SparkleShare {
Pixbuf = Images [CurrentStep];
}
public bool IsActive () {
public bool IsActive ()
{
return Active;
}
public void Start () {
public void Start ()
{
CurrentStep = 0;
Active = true;
Timer.Start ();
}
public void Stop () {
public void Stop ()
{
Active = false;
Timer.Stop ();
}

View file

@ -95,7 +95,7 @@ namespace SparkleShare {
}
public ScrolledWindow CreateEventLog ()
private ScrolledWindow CreateEventLog ()
{
ListStore LogStore = new ListStore (typeof (Gdk.Pixbuf),
@ -133,25 +133,21 @@ namespace SparkleShare {
// Look for the snowman!
string [] Parts = Regex.Split (Line, "☃");
string Message = Parts [1];
string UserName = Parts [2];
string TimeAgo = Parts [3];
string Message = Parts [1];
string UserName = Parts [2];
string TimeAgo = Parts [3];
string UserEmail = Parts [4];
Message = Message.Replace ("/", " → ");
Message = Message.Replace ("\n", " ");
Iter = LogStore.Append ();
LogStore.SetValue (Iter, 0, SparkleHelpers.GetAvatar (UserEmail, 24));
if (SparkleRepo.UserEmail.Equals (UserEmail)) {
LogStore.SetValue (Iter, 1, "<b>You</b>\n" + Message.Replace ("/", " → "));
} else {
LogStore.SetValue (Iter, 1, "<b>" + UserName + "</b>\n" + Message.Replace ("/", " → "));
}
LogStore.SetValue (Iter, 2, TimeAgo + " ");
LogStore.SetValue (Iter, 1, "<b>" + UserName + "</b>\n" + Message);
// TODO Blend text color with treeview color instead of hardcoding it
LogStore.SetValue (Iter, 2, "<span fgcolor='grey'>" + TimeAgo + "</span> ");
// We're not showing email, it's only
// there for lookup purposes
@ -164,33 +160,38 @@ namespace SparkleShare {
TreeView LogView = new TreeView (LogStore);
LogView.HeadersVisible = false;
CellRendererText TextCellRight = new Gtk.CellRendererText ();
TextCellRight.Xalign = 1;
LogView.AppendColumn ("", new CellRendererPixbuf (), "pixbuf", 0);
LogView.AppendColumn ("", new Gtk.CellRendererPixbuf (), "pixbuf", 0);
CellRendererText MessageCellRenderer = new CellRendererText ();
TreeViewColumn MessageColumn = new TreeViewColumn ();
MessageColumn.PackStart (MessageCellRenderer, true);
MessageColumn.SetCellDataFunc (MessageCellRenderer, new Gtk.TreeCellDataFunc (RenderMessageRow));
LogView.AppendColumn (MessageColumn);
CellRendererText CellRendererMarkup = new CellRendererText ();
TreeViewColumn ColumnMarkup = new TreeViewColumn ();
ColumnMarkup.PackStart (CellRendererMarkup, true);
LogView.AppendColumn (ColumnMarkup);
ColumnMarkup.SetCellDataFunc (CellRendererMarkup, new Gtk.TreeCellDataFunc (RenderRow));
LogView.AppendColumn (ColumnMarkup);
LogView.AppendColumn ("", TextCellRight, "text", 2);
CellRendererText TimeAgoCellRenderer = new CellRendererText ();
TreeViewColumn TimeAgoColumn = new TreeViewColumn ();
TimeAgoColumn.PackStart (TimeAgoCellRenderer, true);
TimeAgoColumn.SetCellDataFunc (TimeAgoCellRenderer, new Gtk.TreeCellDataFunc (RenderTimeAgoRow));
TimeAgoCellRenderer.Xalign = 1;
LogView.AppendColumn (TimeAgoColumn);
TreeViewColumn [] Columns = LogView.Columns;
Columns [0].MinWidth = 42;
Columns [1].Expand = true;
Columns [2].Expand = true;
Columns [1].MinWidth = 350;
Columns [2].Expand = true;
Columns [2].MinWidth = 50;
Columns [2].Spacing = 200;
// Get the email address of the selected log message each
// time the cursor changes
LogView.CursorChanged += delegate (object o, EventArgs args) {
TreeModel Model;
if (LogView.Selection.GetSelected (out Model, out Iter)) {
SelectedEmail = (string) Model.GetValue (Iter, 3);
TreeModel model;
TreeIter iter;
if (LogView.Selection.GetSelected (out model, out iter)) {
SelectedEmail = (string) model.GetValue (iter, 3);
}
};
@ -217,12 +218,16 @@ namespace SparkleShare {
}
// Renders a row with custom markup
private void RenderRow (TreeViewColumn Column, CellRenderer Cell, TreeModel Model, TreeIter Iter)
private void RenderMessageRow (TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
{
string item = (string) model.GetValue (iter, 1);
(cell as CellRendererText).Markup = item;
}
string Item = (string) Model.GetValue (Iter, 1);
(Cell as CellRendererText).Markup = Item;
private void RenderTimeAgoRow (TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
{
string item = (string) model.GetValue (iter, 2);
(cell as CellRendererText).Markup = item;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB