intro about entry infobar: fix coding style and whitespace

This commit is contained in:
Hylke Bons 2011-05-14 00:18:57 +01:00
parent 6c354b2473
commit f7a7276fcc
4 changed files with 91 additions and 123 deletions

View file

@ -20,11 +20,11 @@ using System.Drawing;
using System.IO;
using System.Timers;
using Mono.Unix;
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.ObjCRuntime;
using MonoMac.WebKit;
using Mono.Unix;
namespace SparkleShare {

View file

@ -26,26 +26,26 @@ using Mono.Unix;
namespace SparkleShare {
public class SparkleAbout : Window {
public class SparkleAbout : Window {
private Label Version;
private Label Version;
// Short alias for the translations
public static string _(string s)
{
return Catalog.GetString (s);
}
// Short alias for the translations
public static string _(string s)
{
return Catalog.GetString (s);
}
public SparkleAbout () : base ("")
{
DefaultSize = new Gdk.Size (360, 260);
BorderWidth = 0;
IconName = "folder-sparkleshare";
WindowPosition = WindowPosition.Center;
Title = "About SparkleShare";
Resizable = false;
public SparkleAbout () : base ("")
{
DefaultSize = new Gdk.Size (360, 260);
BorderWidth = 0;
IconName = "folder-sparkleshare";
WindowPosition = WindowPosition.Center;
Title = "About SparkleShare";
Resizable = false;
CreateAbout ();
@ -64,16 +64,14 @@ namespace SparkleShare {
};
SparkleShare.Controller.CheckForNewVersion ();
}
}
private void CreateAbout ()
{
Gdk.Color color = Style.Foreground (StateType.Insensitive);
string secondary_text_color = SparkleUIHelpers.GdkColorToHex (color);
EventBox box = new EventBox ();
box.ModifyBg (StateType.Normal, new TreeView ().Style.Base (StateType.Normal));
@ -86,7 +84,6 @@ namespace SparkleShare {
box.Add (header);
Version = new Label () {
Markup = "<small>Checking for updates...</small>",
Xalign = 0,
@ -152,10 +149,6 @@ namespace SparkleShare {
vbox.PackStart (button_bar, false, false, 0);
Add (vbox);
}
}
}
}

View file

@ -14,99 +14,79 @@
// You should have received a copy of the GNU General private License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using Gtk;
namespace SparkleShare {
public class SparkleEntry : Entry {
public class SparkleEntry : Entry {
public bool ExampleTextActive;
private string pExampleText;
public bool ExampleTextActive;
private string pExampleText;
public SparkleEntry ()
{
public SparkleEntry ()
{
ExampleTextActive = true;
ExampleTextActive = true;
FocusGrabbed += delegate { OnEntered (); };
ClipboardPasted += delegate { OnEntered (); };
FocusOutEvent += delegate {
FocusGrabbed += delegate { OnEntered (); };
ClipboardPasted += delegate { OnEntered (); };
FocusOutEvent += delegate {
if (Text.Equals ("") || Text == null)
ExampleTextActive = true;
if (Text.Equals ("") || Text == null)
ExampleTextActive = true;
if (ExampleTextActive)
UseExampleText ();
};
}
if (ExampleTextActive)
UseExampleText ();
};
}
private void OnEntered ()
{
if (ExampleTextActive) {
ExampleTextActive = false;
Text = "";
UseNormalTextColor ();
}
}
private void OnEntered ()
{
if (ExampleTextActive) {
ExampleTextActive = false;
Text = "";
UseNormalTextColor ();
}
}
public string ExampleText
{
public string ExampleText
{
get {
return pExampleText;
}
get {
set {
pExampleText = value;
return pExampleText;
if (ExampleTextActive) {
}
UseExampleText ();
set {
pExampleText = value;
if (ExampleTextActive) {
UseExampleText ();
}
}
}
}
}
}
private void UseExampleText ()
{
Text = pExampleText;
UseSecondaryTextColor ();
}
private void UseExampleText ()
{
Text = pExampleText;
UseSecondaryTextColor ();
}
private void UseSecondaryTextColor ()
{
ModifyText (StateType.Normal, Style.Foreground (StateType.Insensitive));
}
private void UseSecondaryTextColor ()
{
ModifyText (StateType.Normal, Style.Foreground (StateType.Insensitive));
}
private void UseNormalTextColor ()
{
ModifyText (StateType.Normal, Style.Foreground (StateType.Normal));
}
}
private void UseNormalTextColor ()
{
ModifyText (StateType.Normal, Style.Foreground (StateType.Normal));
}
}
}

View file

@ -14,42 +14,37 @@
// 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 Gtk;
namespace SparkleShare {
// An infobar
public class SparkleInfobar : EventBox
{
// An infobar
public class SparkleInfobar : EventBox {
public SparkleInfobar (string icon_name, string title, string text)
{
public SparkleInfobar (string icon_name, string title, string text)
{
Window window = new Window (WindowType.Popup) {
Name = "gtk-tooltip"
};
Window window = new Window (WindowType.Popup) {
Name = "gtk-tooltip"
};
window.EnsureStyle ();
Style = window.Style;
window.EnsureStyle ();
Label label = new Label () {
Markup = "<b>" + title + "</b>\n" + text
};
Style = window.Style;
HBox hbox = new HBox (false, 12) {
BorderWidth = 12
};
Label label = new Label () {
Markup = "<b>" + title + "</b>\n" + text
};
hbox.PackStart (new Image (SparkleUIHelpers.GetIcon (icon_name, 24)),
false, false, 0);
HBox hbox = new HBox (false, 12) {
BorderWidth = 12
};
hbox.PackStart (new Image (SparkleUIHelpers.GetIcon (icon_name, 24)),
false, false, 0);
hbox.PackStart (label, false, false, 0);
Add (hbox);
}
}
hbox.PackStart (label, false, false, 0);
Add (hbox);
}
}
}