Rename classes

This commit is contained in:
Hylke Bons 2016-04-01 09:51:24 +01:00
parent 98def409a5
commit fa5a5b5560
23 changed files with 71 additions and 77 deletions

View file

@ -23,7 +23,7 @@ using Sparkles;
namespace SparkleShare { namespace SparkleShare {
public class SparkleAboutController { public class AboutController {
public event Action ShowWindowEvent = delegate { }; public event Action ShowWindowEvent = delegate { };
public event Action HideWindowEvent = delegate { }; public event Action HideWindowEvent = delegate { };
@ -39,7 +39,7 @@ namespace SparkleShare {
public string RunningVersion; public string RunningVersion;
public SparkleAboutController () public AboutController ()
{ {
RunningVersion = InstallationInfo.Version; RunningVersion = InstallationInfo.Version;

View file

@ -278,8 +278,6 @@ namespace SparkleShare {
}).Start (); }).Start ();
} }
AlertNotificationRaised ("Hello!", "This is a test");
} }

View file

@ -15,20 +15,18 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Text; using System.Text;
using Sparkles; using Sparkles;
namespace SparkleShare { namespace SparkleShare {
public class SparkleBubblesController { public class BubblesController {
public event ShowBubbleEventHandler ShowBubbleEvent = delegate { }; public event ShowBubbleEventHandler ShowBubbleEvent = delegate { };
public delegate void ShowBubbleEventHandler (string title, string subtext, string image_path); public delegate void ShowBubbleEventHandler (string title, string subtext, string image_path);
public SparkleBubblesController () public BubblesController ()
{ {
SparkleShare.Controller.AlertNotificationRaised += delegate (string title, string message) { SparkleShare.Controller.AlertNotificationRaised += delegate (string title, string message) {
ShowBubble (title, message, null); ShowBubble (title, message, null);

View file

@ -28,7 +28,7 @@ using Sparkles;
namespace SparkleShare { namespace SparkleShare {
public class SparkleEventLogController { public class EventLogController {
public event Action ShowWindowEvent = delegate { }; public event Action ShowWindowEvent = delegate { };
public event Action HideWindowEvent = delegate { }; public event Action HideWindowEvent = delegate { };
@ -144,7 +144,7 @@ namespace SparkleShare {
} }
public SparkleEventLogController () public EventLogController ()
{ {
SparkleShare.Controller.ShowEventLogWindowEvent += delegate { SparkleShare.Controller.ShowEventLogWindowEvent += delegate {
if (!WindowIsOpen) { if (!WindowIsOpen) {

View file

@ -22,7 +22,7 @@ using Sparkles;
namespace SparkleShare { namespace SparkleShare {
public class SparkleNoteController { public class NoteController {
public event Action ShowWindowEvent = delegate { }; public event Action ShowWindowEvent = delegate { };
public event Action HideWindowEvent = delegate { }; public event Action HideWindowEvent = delegate { };
@ -34,7 +34,7 @@ namespace SparkleShare {
public string CurrentProject { get; private set; } public string CurrentProject { get; private set; }
public SparkleNoteController () public NoteController ()
{ {
SparkleShare.Controller.ShowNoteWindowEvent += OnNoteWindowEvent; SparkleShare.Controller.ShowNoteWindowEvent += OnNoteWindowEvent;

View file

@ -44,7 +44,7 @@ namespace SparkleShare {
} }
public class SparkleSetupController { public class SetupController {
public event Action ShowWindowEvent = delegate { }; public event Action ShowWindowEvent = delegate { };
public event Action HideWindowEvent = delegate { }; public event Action HideWindowEvent = delegate { };
@ -105,7 +105,7 @@ namespace SparkleShare {
private bool fetch_prior_history = false; private bool fetch_prior_history = false;
public SparkleSetupController () public SetupController ()
{ {
ChangePageEvent += delegate (PageType page_type, string [] warnings) { ChangePageEvent += delegate (PageType page_type, string [] warnings) {
this.current_page = page_type; this.current_page = page_type;

View file

@ -118,7 +118,7 @@ namespace SparkleShare {
} }
public class SparkleStatusIconController { public class StatusIconController {
public event UpdateIconEventHandler UpdateIconEvent = delegate { }; public event UpdateIconEventHandler UpdateIconEvent = delegate { };
public delegate void UpdateIconEventHandler (IconState state); public delegate void UpdateIconEventHandler (IconState state);
@ -184,7 +184,7 @@ namespace SparkleShare {
} }
public SparkleStatusIconController () public StatusIconController ()
{ {
UpdateFolders (); UpdateFolders ();

View file

@ -22,7 +22,7 @@ namespace SparkleShare {
public class SparkleAbout : Window { public class SparkleAbout : Window {
public SparkleAboutController Controller = new SparkleAboutController (); public AboutController Controller = new AboutController ();
private Label updates; private Label updates;

View file

@ -24,12 +24,12 @@ using Sparkles;
namespace SparkleShare { namespace SparkleShare {
public class SparkleBubbles { public class Bubbles {
public SparkleBubblesController Controller = new SparkleBubblesController (); public BubblesController Controller = new BubblesController ();
public SparkleBubbles () public Bubbles ()
{ {
Controller.ShowBubbleEvent += ShowBubbleEvent; Controller.ShowBubbleEvent += ShowBubbleEvent;
} }

View file

@ -23,9 +23,9 @@ using Gtk;
namespace SparkleShare { namespace SparkleShare {
public class SparkleEventLog : Window { public class EventLog : Window {
public SparkleEventLogController Controller = new SparkleEventLogController (); public EventLogController Controller = new EventLogController ();
private Label size_label; private Label size_label;
private Label history_label; private Label history_label;
@ -35,13 +35,13 @@ namespace SparkleShare {
private HBox layout_horizontal; private HBox layout_horizontal;
private ScrolledWindow scrolled_window; private ScrolledWindow scrolled_window;
private VBox spinner_wrapper; private VBox spinner_wrapper;
// private Spinner spinner; private Spinner spinner;
// private WebView web_view; // private WebView web_view;
private int pos_x, pos_y; private int pos_x, pos_y;
public SparkleEventLog () : base ("Recent Changes") public EventLog () : base ("Recent Changes")
{ {
SetWmclass ("SparkleShare", "SparkleShare"); SetWmclass ("SparkleShare", "SparkleShare");
@ -84,8 +84,8 @@ namespace SparkleShare {
this.spinner_wrapper.PackStart (new Label(""), true, true, 0); this.spinner_wrapper.PackStart (new Label(""), true, true, 0);
this.spinner_wrapper.PackStart (this.spinner, false, false, 0); this.spinner_wrapper.PackStart (this.spinner, false, false, 0);
this.spinner_wrapper.PackStart (new Label(""), true, true, 0); this.spinner_wrapper.PackStart (new Label(""), true, true, 0);
// this.spinner.SetSizeRequest (24, 24); this.spinner.SetSizeRequest (24, 24);
// this.spinner.Start (); this.spinner.Start ();
this.content_wrapper.Add (this.spinner_wrapper); this.content_wrapper.Add (this.spinner_wrapper);

View file

@ -16,7 +16,6 @@ SOURCES = \
../Common/BubblesController.cs \ ../Common/BubblesController.cs \
../Common/BaseController.cs \ ../Common/BaseController.cs \
../Common/EventLogController.cs \ ../Common/EventLogController.cs \
../Common/Invite.cs \
../Common/NoteController.cs \ ../Common/NoteController.cs \
../Common/SetupController.cs \ ../Common/SetupController.cs \
../Common/StatusIconController.cs \ ../Common/StatusIconController.cs \

7
SparkleShare/Linux/Note.cs Executable file → Normal file
View file

@ -15,17 +15,16 @@
// along with this program. If not, see (http://www.gnu.org/licenses/). // along with this program. If not, see (http://www.gnu.org/licenses/).
using System;
using Gtk; using Gtk;
namespace SparkleShare { namespace SparkleShare {
public class SparkleNote : Window { public class Note : Window {
public SparkleNoteController Controller = new SparkleNoteController (); public NoteController Controller = new NoteController ();
public SparkleNote () : base ("Add Note") public Note () : base ("Add Note")
{ {
SetWmclass ("SparkleShare", "SparkleShare"); SetWmclass ("SparkleShare", "SparkleShare");

View file

@ -20,14 +20,16 @@ using System;
using Gtk; using Gtk;
using Mono.Unix; using Mono.Unix;
using Sparkles;
namespace SparkleShare { namespace SparkleShare {
public class SparkleSetup : SparkleSetupWindow { public class Setup : SetupWindow {
public SparkleSetupController Controller = new SparkleSetupController (); public SetupController Controller = new SetupController ();
public SparkleSetup () : base () public Setup ()
{ {
Controller.HideWindowEvent += delegate { Controller.HideWindowEvent += delegate {
Application.Invoke (delegate { Hide (); }); Application.Invoke (delegate { Hide (); });
@ -75,7 +77,7 @@ namespace SparkleShare {
UnixUserInfo user_info = UnixUserInfo.GetRealUser (); UnixUserInfo user_info = UnixUserInfo.GetRealUser ();
if (user_info != null && user_info.RealName != null) if (user_info != null && user_info.RealName != null)
// Some systems append a series of "," for some reason // Some systems append a series of "," for some reason, TODO: Report upstream
name_entry.Text = user_info.RealName.TrimEnd (",".ToCharArray ()); name_entry.Text = user_info.RealName.TrimEnd (",".ToCharArray ());
} catch (ArgumentException) { } catch (ArgumentException) {
@ -698,7 +700,7 @@ namespace SparkleShare {
private void RenderServiceColumn (TreeViewColumn column, CellRenderer cell, private void RenderServiceColumn (TreeViewColumn column, CellRenderer cell,
TreeModel model, TreeIter iter) ITreeModel model, TreeIter iter)
{ {
string markup = (string) model.GetValue (iter, 2); string markup = (string) model.GetValue (iter, 2);
TreeSelection selection = (column.TreeView as TreeView).Selection; TreeSelection selection = (column.TreeView as TreeView).Selection;

4
SparkleShare/Linux/SetupWindow.cs Executable file → Normal file
View file

@ -20,7 +20,7 @@ using Gtk;
namespace SparkleShare { namespace SparkleShare {
public class SparkleSetupWindow : Window { public class SetupWindow : Window {
private EventBox content_area; private EventBox content_area;
private EventBox option_area; private EventBox option_area;
@ -30,7 +30,7 @@ namespace SparkleShare {
public string Description; public string Description;
public SparkleSetupWindow () : base ("SparkleShare Setup") public SetupWindow () : base ("SparkleShare Setup")
{ {
SetWmclass ("SparkleShare", "SparkleShare"); SetWmclass ("SparkleShare", "SparkleShare");

View file

@ -27,31 +27,31 @@ using AppIndicator3;
namespace SparkleShare { namespace SparkleShare {
public class SparkleStatusIcon { public class StatusIcon {
public SparkleStatusIconController Controller = new SparkleStatusIconController (); public StatusIconController Controller = new StatusIconController ();
private Menu menu; Menu menu;
private MenuItem recent_events_item; MenuItem recent_events_item;
private MenuItem quit_item; MenuItem quit_item;
private MenuItem state_item; MenuItem state_item;
private SparkleMenuItem [] state_menu_items; SparkleMenuItem [] state_menu_items;
#if HAVE_APP_INDICATOR #if HAVE_APP_INDICATOR
private Indicator indicator; Indicator indicator;
#else #else
private StatusIcon status_icon; Gtk.StatusIcon status_icon;
#endif #endif
public SparkleStatusIcon () public StatusIcon ()
{ {
#if HAVE_APP_INDICATOR #if HAVE_APP_INDICATOR
this.indicator = new Indicator ("sparkleshare", "sparkleshare", (int) IndicatorCategory.ApplicationStatus); this.indicator = new Indicator ("sparkleshare", "sparkleshare", (int) IndicatorCategory.ApplicationStatus);
this.indicator.IconName = "process-syncing-idle"; this.indicator.IconName = "process-syncing-idle";
this.indicator.Status = (int) IndicatorStatus.Active; this.indicator.Status = (int) IndicatorStatus.Active;
#else #else
this.status_icon = new StatusIcon (); this.status_icon = new Gtk.StatusIcon ();
this.status_icon.IconName = "org.sparkleshare.SparkleShare"; this.status_icon.IconName = "org.sparkleshare.SparkleShare";
this.status_icon.Activate += ShowMenu; // Primary mouse button click this.status_icon.Activate += ShowMenu; // Primary mouse button click
@ -281,7 +281,7 @@ namespace SparkleShare {
// Makes sure the menu pops up in the right position // Makes sure the menu pops up in the right position
private void SetPosition (Menu menu, out int x, out int y, out bool push_in) private void SetPosition (Menu menu, out int x, out int y, out bool push_in)
{ {
StatusIcon.PositionMenu (menu, out x, out y, out push_in, this.status_icon.Handle); Gtk.StatusIcon.PositionMenu (menu, out x, out y, out push_in, this.status_icon.Handle);
} }
#endif #endif
} }

View file

@ -17,9 +17,7 @@
using System; using System;
using GLib;
using Gtk; using Gtk;
using Sparkles; using Sparkles;
namespace SparkleShare { namespace SparkleShare {
@ -28,22 +26,22 @@ namespace SparkleShare {
public static string AssetsPath = InstallationInfo.Directory; public static string AssetsPath = InstallationInfo.Directory;
public SparkleStatusIcon StatusIcon; public StatusIcon StatusIcon;
public SparkleEventLog EventLog; public EventLog EventLog;
public SparkleBubbles Bubbles; public Bubbles Bubbles;
public SparkleSetup Setup; public Setup Setup;
public SparkleAbout About; public SparkleAbout About;
public SparkleNote Note; public Note Note;
public readonly string SecondaryTextColor; public readonly string SecondaryTextColor;
public readonly string SecondaryTextColorSelected; public readonly string SecondaryTextColorSelected;
Gtk.Application application; Application application;
public UserInterface () public UserInterface ()
{ {
application = new Gtk.Application ("org.sparkleshare.SparkleShare", 0); application = new Application ("org.sparkleshare.SparkleShare", 0);
application.Register (null); application.Register (null);
application.Activated += ApplicationActivatedDelegate; application.Activated += ApplicationActivatedDelegate;
@ -82,12 +80,12 @@ namespace SparkleShare {
SparkleShare.Controller.HandleReopen (); SparkleShare.Controller.HandleReopen ();
} else { } else {
Setup = new SparkleSetup (); Setup = new Setup ();
EventLog = new SparkleEventLog (); EventLog = new EventLog ();
About = new SparkleAbout (); About = new SparkleAbout ();
Bubbles = new SparkleBubbles (); Bubbles = new Bubbles ();
StatusIcon = new SparkleStatusIcon (); StatusIcon = new StatusIcon ();
Note = new SparkleNote (); Note = new Note ();
Setup.Application = application; Setup.Application = application;
EventLog.Application = application; EventLog.Application = application;

View file

@ -57,14 +57,14 @@ namespace SparkleShare {
// Example: from "rgb:0,0,0" to "#000000" // Example: from "rgb:0,0,0" to "#000000"
public static string ColorToHex (Gdk.Color color) public static string ColorToHex (Gdk.Color color)
{ {
return String.Format ("#{0:X2}{1:X2}{2:X2}", return string.Format ("#{0:X2}{1:X2}{2:X2}",
(int) Math.Truncate (color.Red / 256.00), (int) Math.Truncate (color.Red / 256.00),
(int) Math.Truncate (color.Green / 256.00), (int) Math.Truncate (color.Green / 256.00),
(int) Math.Truncate (color.Blue / 256.00)); (int) Math.Truncate (color.Blue / 256.00));
} }
public static Gdk.Color RGBAToColor (Gdk.Rgb rgba) { public static Gdk.Color RGBAToColor (Gdk.RGBA rgba) {
return new Gdk.Color () { return new Gdk.Color () {
Red = (ushort) (rgba.Red * 65535), Red = (ushort) (rgba.Red * 65535),
Green = (ushort) (rgba.Green * 65535), Green = (ushort) (rgba.Green * 65535),
@ -73,7 +73,7 @@ namespace SparkleShare {
} }
public static string RGBAToHex (Gdk.Rgb rgba) public static string RGBAToHex (Gdk.RGBA rgba)
{ {
return ColorToHex (RGBAToColor (rgba)); return ColorToHex (RGBAToColor (rgba));
} }

View file

@ -25,7 +25,7 @@ namespace SparkleShare {
public class About : NSWindow { public class About : NSWindow {
public SparkleAboutController Controller = new SparkleAboutController (); public AboutController Controller = new AboutController ();
private NSTextField version_text_field, updates_text_field, credits_text_field; private NSTextField version_text_field, updates_text_field, credits_text_field;
private SparkleLink website_link, credits_link, report_problem_link, debug_log_link; private SparkleLink website_link, credits_link, report_problem_link, debug_log_link;

View file

@ -22,7 +22,7 @@ namespace SparkleShare {
public class Bubbles : NSObject { public class Bubbles : NSObject {
public SparkleBubblesController Controller = new SparkleBubblesController (); public BubblesController Controller = new BubblesController ();
public Bubbles () public Bubbles ()
@ -33,9 +33,9 @@ namespace SparkleShare {
} }
private void ShowBubbleEvent (string title, string subtext, string image_path) { void ShowBubbleEvent (string title, string subtext, string image_path) {
InvokeOnMainThread (() => { InvokeOnMainThread (() => {
NSUserNotification notification = new NSUserNotification () { var notification = new NSUserNotification {
Title = title, Title = title,
InformativeText = subtext, InformativeText = subtext,
DeliveryDate = DateTime.Now DeliveryDate = DateTime.Now
@ -43,8 +43,8 @@ namespace SparkleShare {
NSUserNotificationCenter center = NSUserNotificationCenter.DefaultUserNotificationCenter; NSUserNotificationCenter center = NSUserNotificationCenter.DefaultUserNotificationCenter;
center.ShouldPresentNotification = delegate { return true; }; center.ShouldPresentNotification = delegate { return true; };
center.DidActivateNotification += delegate { Controller.BubbleClicked (); };
center.DidActivateNotification += delegate { Controller.BubbleClicked (); };
center.ScheduleNotification (notification); center.ScheduleNotification (notification);
}); });
} }

View file

@ -27,7 +27,7 @@ namespace SparkleShare {
public class EventLog : NSWindow { public class EventLog : NSWindow {
public SparkleEventLogController Controller = new SparkleEventLogController (); public EventLogController Controller = new EventLogController ();
public float TitlebarHeight; public float TitlebarHeight;
WebView web_view; WebView web_view;

View file

@ -25,7 +25,7 @@ namespace SparkleShare {
public class Note : NSWindow { public class Note : NSWindow {
public SparkleNoteController Controller = new SparkleNoteController (); public NoteController Controller = new NoteController ();
private NSImage user_image, balloon_image; private NSImage user_image, balloon_image;
private NSImageView user_image_view, balloon_image_view; private NSImageView user_image_view, balloon_image_view;

View file

@ -31,7 +31,7 @@ namespace SparkleShare {
public class Setup : SetupWindow { public class Setup : SetupWindow {
public SparkleSetupController Controller = new SparkleSetupController (); public SetupController Controller = new SetupController ();
private NSButton ContinueButton, AddButton, CopyButton, TryAgainButton, CancelButton, private NSButton ContinueButton, AddButton, CopyButton, TryAgainButton, CancelButton,
SkipTutorialButton, FinishButton, ShowFilesButton; SkipTutorialButton, FinishButton, ShowFilesButton;

View file

@ -25,7 +25,7 @@ namespace SparkleShare {
public class StatusIcon { public class StatusIcon {
public SparkleStatusIconController Controller = new SparkleStatusIconController (); public StatusIconController Controller = new StatusIconController ();
private NSStatusItem status_item = NSStatusBar.SystemStatusBar.CreateStatusItem (28); private NSStatusItem status_item = NSStatusBar.SystemStatusBar.CreateStatusItem (28);
private NSMenu menu, submenu, link_code_submenu; private NSMenu menu, submenu, link_code_submenu;