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 {
public class SparkleAboutController {
public class AboutController {
public event Action ShowWindowEvent = delegate { };
public event Action HideWindowEvent = delegate { };
@ -39,7 +39,7 @@ namespace SparkleShare {
public string RunningVersion;
public SparkleAboutController ()
public AboutController ()
{
RunningVersion = InstallationInfo.Version;

View file

@ -278,8 +278,6 @@ namespace SparkleShare {
}).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/>.
using System;
using System.Text;
using Sparkles;
namespace SparkleShare {
public class SparkleBubblesController {
public class BubblesController {
public event ShowBubbleEventHandler ShowBubbleEvent = delegate { };
public delegate void ShowBubbleEventHandler (string title, string subtext, string image_path);
public SparkleBubblesController ()
public BubblesController ()
{
SparkleShare.Controller.AlertNotificationRaised += delegate (string title, string message) {
ShowBubble (title, message, null);

View file

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

View file

@ -22,7 +22,7 @@ using Sparkles;
namespace SparkleShare {
public class SparkleNoteController {
public class NoteController {
public event Action ShowWindowEvent = delegate { };
public event Action HideWindowEvent = delegate { };
@ -34,7 +34,7 @@ namespace SparkleShare {
public string CurrentProject { get; private set; }
public SparkleNoteController ()
public NoteController ()
{
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 HideWindowEvent = delegate { };
@ -105,7 +105,7 @@ namespace SparkleShare {
private bool fetch_prior_history = false;
public SparkleSetupController ()
public SetupController ()
{
ChangePageEvent += delegate (PageType page_type, string [] warnings) {
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 delegate void UpdateIconEventHandler (IconState state);
@ -184,7 +184,7 @@ namespace SparkleShare {
}
public SparkleStatusIconController ()
public StatusIconController ()
{
UpdateFolders ();

View file

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

View file

@ -24,12 +24,12 @@ using Sparkles;
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;
}

View file

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

View file

@ -16,7 +16,6 @@ SOURCES = \
../Common/BubblesController.cs \
../Common/BaseController.cs \
../Common/EventLogController.cs \
../Common/Invite.cs \
../Common/NoteController.cs \
../Common/SetupController.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/).
using System;
using Gtk;
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");

View file

@ -20,14 +20,16 @@ using System;
using Gtk;
using Mono.Unix;
using Sparkles;
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 {
Application.Invoke (delegate { Hide (); });
@ -71,11 +73,11 @@ namespace SparkleShare {
ActivatesDefault = true
};
try {
try {
UnixUserInfo user_info = UnixUserInfo.GetRealUser ();
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 ());
} catch (ArgumentException) {
@ -698,7 +700,7 @@ namespace SparkleShare {
private void RenderServiceColumn (TreeViewColumn column, CellRenderer cell,
TreeModel model, TreeIter iter)
ITreeModel model, TreeIter iter)
{
string markup = (string) model.GetValue (iter, 2);
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 {
public class SparkleSetupWindow : Window {
public class SetupWindow : Window {
private EventBox content_area;
private EventBox option_area;
@ -30,7 +30,7 @@ namespace SparkleShare {
public string Description;
public SparkleSetupWindow () : base ("SparkleShare Setup")
public SetupWindow () : base ("SparkleShare Setup")
{
SetWmclass ("SparkleShare", "SparkleShare");

View file

@ -27,31 +27,31 @@ using AppIndicator3;
namespace SparkleShare {
public class SparkleStatusIcon {
public class StatusIcon {
public SparkleStatusIconController Controller = new SparkleStatusIconController ();
public StatusIconController Controller = new StatusIconController ();
private Menu menu;
private MenuItem recent_events_item;
private MenuItem quit_item;
private MenuItem state_item;
private SparkleMenuItem [] state_menu_items;
Menu menu;
MenuItem recent_events_item;
MenuItem quit_item;
MenuItem state_item;
SparkleMenuItem [] state_menu_items;
#if HAVE_APP_INDICATOR
private Indicator indicator;
Indicator indicator;
#else
private StatusIcon status_icon;
Gtk.StatusIcon status_icon;
#endif
public SparkleStatusIcon ()
public StatusIcon ()
{
#if HAVE_APP_INDICATOR
this.indicator = new Indicator ("sparkleshare", "sparkleshare", (int) IndicatorCategory.ApplicationStatus);
this.indicator.IconName = "process-syncing-idle";
this.indicator.Status = (int) IndicatorStatus.Active;
#else
this.status_icon = new StatusIcon ();
this.status_icon = new Gtk.StatusIcon ();
this.status_icon.IconName = "org.sparkleshare.SparkleShare";
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
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
}

View file

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

View file

@ -57,14 +57,14 @@ namespace SparkleShare {
// Example: from "rgb:0,0,0" to "#000000"
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.Green / 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 () {
Red = (ushort) (rgba.Red * 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));
}

View file

@ -25,7 +25,7 @@ namespace SparkleShare {
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 SparkleLink website_link, credits_link, report_problem_link, debug_log_link;

View file

@ -22,7 +22,7 @@ namespace SparkleShare {
public class Bubbles : NSObject {
public SparkleBubblesController Controller = new SparkleBubblesController ();
public BubblesController Controller = new BubblesController ();
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 (() => {
NSUserNotification notification = new NSUserNotification () {
var notification = new NSUserNotification {
Title = title,
InformativeText = subtext,
DeliveryDate = DateTime.Now
@ -43,8 +43,8 @@ namespace SparkleShare {
NSUserNotificationCenter center = NSUserNotificationCenter.DefaultUserNotificationCenter;
center.ShouldPresentNotification = delegate { return true; };
center.DidActivateNotification += delegate { Controller.BubbleClicked (); };
center.DidActivateNotification += delegate { Controller.BubbleClicked (); };
center.ScheduleNotification (notification);
});
}

View file

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

View file

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

View file

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

View file

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