events: listener: code cleanup

This commit is contained in:
Hylke Bons 2011-05-08 20:35:43 +01:00
parent 26a99679a7
commit 26dfba06e3
2 changed files with 18 additions and 14 deletions

View file

@ -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 System;
namespace SparkleLib {
@ -24,6 +25,7 @@ namespace SparkleLib {
public string Type;
public string Message;
public SparkleEventArgs (string type)
{
Type = type;
@ -34,17 +36,19 @@ namespace SparkleLib {
// Arguments for the NewCommit event
public class NewCommitArgs : EventArgs {
public string Author;
public string Email;
public string UserName;
public string UserEmail;
public string Message;
public string RepositoryPath;
public string LocalPath;
public NewCommitArgs (string author, string email, string message, string repository_path)
public NewCommitArgs (string user_name, string user_email,
string message, string local_path)
{
Author = author;
Email = email;
Message = message;
RepositoryPath = repository_path;
UserName = user_name;
UserEmail = user_email;
Message = message;
LocalPath = local_path;
}
}
}

View file

@ -36,7 +36,7 @@ namespace SparkleLib {
// listens for change notifications
public class SparkleListener {
private Thread Thread;
private Thread thread;
// FIXME: The IrcClient is a public property because
// extending it causes crashes
@ -48,7 +48,7 @@ namespace SparkleLib {
public SparkleListener (string server, string folder_name,
string user_email, NotificationServerType type)
string user_email, NotificationServerType type)
{
if (type == NotificationServerType.Own) {
Server = server;
@ -79,7 +79,7 @@ namespace SparkleLib {
// Starts a new thread and listens to the channel
public void Listen ()
{
Thread = new Thread (
this.thread = new Thread (
new ThreadStart (delegate {
try {
@ -97,7 +97,7 @@ namespace SparkleLib {
})
);
Thread.Start ();
this.thread.Start ();
}
@ -110,8 +110,8 @@ namespace SparkleLib {
// Frees all resources for this Listener
public void Dispose ()
{
Thread.Abort ();
Thread.Join ();
this.thread.Abort ();
this.thread.Join ();
}