[listener] Fix crash due to empty username
This commit is contained in:
parent
8ec306bf6a
commit
5e35cb74d7
|
@ -41,7 +41,7 @@ namespace SparkleLib {
|
||||||
|
|
||||||
Server = server;
|
Server = server;
|
||||||
Channel = channel;
|
Channel = channel;
|
||||||
Nick = "test"; //nick.Replace ("@", "_at_").Replace (".", "_dot_");
|
Nick = nick.Replace ("@", "_at_").Replace (".", "_dot_");
|
||||||
|
|
||||||
// Keep the nick short
|
// Keep the nick short
|
||||||
if (Nick.Length > 9)
|
if (Nick.Length > 9)
|
||||||
|
|
128
SparkleShare/Mac/SparkleShare/SparkleUI.cs
Normal file
128
SparkleShare/Mac/SparkleShare/SparkleUI.cs
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using MonoMac.Foundation;
|
||||||
|
using MonoMac.AppKit;
|
||||||
|
using MonoMac.ObjCRuntime;
|
||||||
|
using SparkleLib;
|
||||||
|
|
||||||
|
namespace SparkleShare
|
||||||
|
{
|
||||||
|
|
||||||
|
[MonoMac.Foundation.Register("AppDelegate")]
|
||||||
|
public class SparkleUI : NSApplicationDelegate
|
||||||
|
{
|
||||||
|
public void Run () {
|
||||||
|
NSApplication.Main (new string [1] {""});
|
||||||
|
}
|
||||||
|
public SparkleUI () {NSApplication.Init ();
|
||||||
|
|
||||||
|
Console.WriteLine("HI!2");
|
||||||
|
// SparkleFetcher fetch = new SparkleFetcher ("", "");
|
||||||
|
//SparkleRepo repo = new SparkleRepo ("/Users/hbons/Code/SparkleShare");
|
||||||
|
|
||||||
|
// SparkleStatusIcon = new SparkleStatusIcon ();
|
||||||
|
|
||||||
|
|
||||||
|
var statusItem = NSStatusBar.SystemStatusBar.CreateStatusItem (32);
|
||||||
|
|
||||||
|
statusItem.Enabled = true;
|
||||||
|
|
||||||
|
statusItem.Image = NSImage.ImageNamed ("sparkleshare-idle.png");
|
||||||
|
statusItem.AlternateImage = NSImage.ImageNamed ("sparkleshare-idle-focus.png");
|
||||||
|
statusItem.Image.Size = new SizeF (16, 16);
|
||||||
|
statusItem.AlternateImage.Size = new SizeF (16, 16);
|
||||||
|
|
||||||
|
NSMenu menu = new NSMenu() {};
|
||||||
|
menu.AddItem (new NSMenuItem () { Title="Up to date (102 MB)", Enabled = true });
|
||||||
|
menu.AddItem (NSMenuItem.SeparatorItem);
|
||||||
|
|
||||||
|
var item = new NSMenuItem () {
|
||||||
|
Title="SparkleShare", Enabled = true,
|
||||||
|
Action = new Selector ("ddd")
|
||||||
|
};
|
||||||
|
|
||||||
|
item.Activated += delegate {
|
||||||
|
Console.WriteLine ("DDDD");
|
||||||
|
};
|
||||||
|
|
||||||
|
item.Image = NSImage.ImageNamed ("NSFolder");
|
||||||
|
item.Image.Size = new SizeF (16, 16);
|
||||||
|
|
||||||
|
menu.AddItem (item);
|
||||||
|
|
||||||
|
var tmp = new NSMenuItem () {
|
||||||
|
Title="gnome-design", Enabled = true,
|
||||||
|
Action = new Selector ("ddd")
|
||||||
|
};
|
||||||
|
|
||||||
|
tmp.Activated += delegate {
|
||||||
|
Console.WriteLine ("DDDD");
|
||||||
|
};
|
||||||
|
|
||||||
|
tmp.Image = NSImage.ImageNamed ("NSFolder");
|
||||||
|
tmp.Image.Size = new SizeF (16, 16);
|
||||||
|
|
||||||
|
menu.AddItem (tmp);
|
||||||
|
menu.AddItem (NSMenuItem.SeparatorItem);
|
||||||
|
|
||||||
|
Console.WriteLine (item.Action.Name);
|
||||||
|
|
||||||
|
NSMenuItem sync_menu_item = new NSMenuItem () {
|
||||||
|
Title = "Sync Remote Folder..."
|
||||||
|
};
|
||||||
|
|
||||||
|
sync_menu_item.Activated += delegate {
|
||||||
|
Console.WriteLine ("DDDD");
|
||||||
|
};
|
||||||
|
|
||||||
|
menu.AddItem (sync_menu_item);
|
||||||
|
menu.AddItem (NSMenuItem.SeparatorItem);
|
||||||
|
|
||||||
|
NSMenuItem notifications_menu_item = new NSMenuItem () {
|
||||||
|
Title = "Show Notifications",
|
||||||
|
State = NSCellStateValue.On
|
||||||
|
};
|
||||||
|
|
||||||
|
notifications_menu_item.Activated += delegate {
|
||||||
|
statusItem.Image = NSImage.ImageNamed ("NSComputer");
|
||||||
|
if (notifications_menu_item.State == NSCellStateValue.On)
|
||||||
|
notifications_menu_item.State = NSCellStateValue.Off;
|
||||||
|
else
|
||||||
|
notifications_menu_item.State = NSCellStateValue.On;
|
||||||
|
};
|
||||||
|
|
||||||
|
menu.AddItem (notifications_menu_item);
|
||||||
|
menu.AddItem (NSMenuItem.SeparatorItem);
|
||||||
|
|
||||||
|
NSMenuItem about_menu_item = new NSMenuItem () {
|
||||||
|
Title = "About"
|
||||||
|
};
|
||||||
|
|
||||||
|
about_menu_item.Activated += delegate {
|
||||||
|
Console.WriteLine ("DDDD");
|
||||||
|
statusItem.Title = "bla";
|
||||||
|
};
|
||||||
|
|
||||||
|
menu.AddItem (about_menu_item);
|
||||||
|
menu.AddItem (NSMenuItem.SeparatorItem);
|
||||||
|
|
||||||
|
NSMenuItem quit_menu_item = new NSMenuItem () {
|
||||||
|
Title = "Quit"
|
||||||
|
};
|
||||||
|
quit_menu_item.Activated += delegate {
|
||||||
|
Console.WriteLine ("DDDD");
|
||||||
|
Environment.Exit (0);
|
||||||
|
};
|
||||||
|
|
||||||
|
menu.AddItem (quit_menu_item);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
statusItem.Menu = menu;
|
||||||
|
statusItem.HighlightMode = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 192 B After Width: | Height: | Size: 192 B |
Before Width: | Height: | Size: 186 B After Width: | Height: | Size: 186 B |
|
@ -63,7 +63,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public SparkleController ()
|
public SparkleController ()
|
||||||
{
|
{
|
||||||
|
Console.WriteLine (SparkleShare.UserName + "<<<<<<");
|
||||||
SetProcessName ("sparkleshare");
|
SetProcessName ("sparkleshare");
|
||||||
|
|
||||||
InstallLauncher ();
|
InstallLauncher ();
|
||||||
|
|
|
@ -30,8 +30,8 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public static SparkleController Controller;
|
public static SparkleController Controller;
|
||||||
public static SparkleUI UI;
|
public static SparkleUI UI;
|
||||||
public static string UserName;
|
public static string UserName = "";
|
||||||
public static string UserEmail;
|
public static string UserEmail = "";
|
||||||
|
|
||||||
|
|
||||||
// Short alias for the translations
|
// Short alias for the translations
|
||||||
|
@ -174,6 +174,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
StreamReader reader = new StreamReader (global_config_file_path);
|
StreamReader reader = new StreamReader (global_config_file_path);
|
||||||
|
|
||||||
|
// TODO: Properly look at the variable name
|
||||||
// Discard the first two lines
|
// Discard the first two lines
|
||||||
reader.ReadLine ();
|
reader.ReadLine ();
|
||||||
reader.ReadLine ();
|
reader.ReadLine ();
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace SparkleShare {
|
||||||
// Create the statusicon
|
// Create the statusicon
|
||||||
StatusIcon = new SparkleStatusIcon ();
|
StatusIcon = new SparkleStatusIcon ();
|
||||||
|
|
||||||
// Keep track of event logs are open
|
// Keep track of which event logs are open
|
||||||
SparkleUI.OpenLogs = new List <SparkleLog> ();
|
SparkleUI.OpenLogs = new List <SparkleLog> ();
|
||||||
|
|
||||||
SparkleShare.Controller.OnFirstRun += delegate {
|
SparkleShare.Controller.OnFirstRun += delegate {
|
||||||
|
|
Loading…
Reference in a new issue