diff --git a/SparkleDiff/RevisionView.cs b/SparkleDiff/RevisionView.cs index 49cec875..d35e68d5 100644 --- a/SparkleDiff/RevisionView.cs +++ b/SparkleDiff/RevisionView.cs @@ -66,9 +66,9 @@ namespace SparkleShare { Viewport = new Viewport (); Viewport.Add (new Label ("")); - Store = new ListStore(typeof (Gdk.Pixbuf), - typeof (string), - typeof (int)); + Store = new ListStore (typeof (Gdk.Pixbuf), + typeof (string), + typeof (int)); IconView = new IconView (Store); IconView.SelectionChanged += ChangeSelection; diff --git a/SparkleShare/Makefile.am b/SparkleShare/Makefile.am index dd7b661e..f3183d46 100644 --- a/SparkleShare/Makefile.am +++ b/SparkleShare/Makefile.am @@ -9,6 +9,7 @@ LINK = $(REF_SPARKLESHARE) SOURCES = \ SparkleBubble.cs \ + SparkleEntry.cs \ SparkleIntro.cs \ SparkleShare.cs \ SparkleSpinner.cs \ diff --git a/SparkleShare/SparkleEntry.cs b/SparkleShare/SparkleEntry.cs new file mode 100644 index 00000000..85150a41 --- /dev/null +++ b/SparkleShare/SparkleEntry.cs @@ -0,0 +1,111 @@ +// SparkleShare, an instant update workflow to Git. +// Copyright (C) 2010 Hylke Bons +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General private License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General private License for more details. +// +// You should have received a copy of the GNU General private License +// along with this program. If not, see . + +using Gtk; + +namespace SparkleShare { + + public class SparkleEntry : Entry { + + private bool ExampleTextActive; + private string pExampleText; + + + public SparkleEntry () + { + + ExampleTextActive = true; + + FocusGrabbed += delegate { + + if (ExampleTextActive) { + + ExampleTextActive = false; + Text = ""; + UseNormalTextColor (); +// ShowAll (); + + } + + }; + + FocusOutEvent += delegate { + + if (Text.Equals ("") || Text == null) { + ExampleTextActive = true; + + } + + if (ExampleTextActive) + UseExampleText (); + + }; + + } + + + public string ExampleText + { + + get { + + return pExampleText; + + } + + set { + + pExampleText = value; + + if (ExampleTextActive) { + + UseExampleText (); + + } + + } + + } + + + private void UseExampleText () + { + + Text = pExampleText; + UseSecondaryTextColor (); +// ShowAll (); + + } + + + private void UseSecondaryTextColor () + { + + ModifyText (StateType.Normal, Style.Foreground (StateType.Insensitive)); + + } + + + private void UseNormalTextColor () + { + + ModifyText (StateType.Normal, Style.Foreground (StateType.Normal)); + + } + + } + +} diff --git a/SparkleShare/SparkleIntro.cs b/SparkleShare/SparkleIntro.cs index 8f7a90f5..52195c2e 100644 --- a/SparkleShare/SparkleIntro.cs +++ b/SparkleShare/SparkleIntro.cs @@ -28,8 +28,8 @@ namespace SparkleShare { private Entry NameEntry; private Entry EmailEntry; - private Entry ServerEntry; - private Entry FolderEntry; + private SparkleEntry ServerEntry; + private SparkleEntry FolderEntry; private Button NextButton; private Button AddButton; private bool StepTwoOnly; @@ -208,7 +208,9 @@ namespace SparkleShare { HBox layout_server = new HBox (true, 0); - ServerEntry = new Entry (_("ssh://address-to-my-server/")); + ServerEntry = new SparkleEntry () { + ExampleText = _("ssh://address-to-my-server/") + }; ServerEntry.Changed += CheckStepTwoFields; @@ -252,18 +254,39 @@ namespace SparkleShare { (radio_button_gitorious.Child as Label).UseMarkup = true; (radio_button_gitorious.Child as Label).Wrap = true; + radio_button_github.Toggled += delegate { + + if (radio_button_github.Active) + FolderEntry.ExampleText = "Username/Folder"; + + }; + + radio_button_gitorious.Toggled += delegate { + + if (radio_button_gitorious.Active) + FolderEntry.ExampleText = "Project/Folder"; + + }; + + radio_button_gnome.Toggled += delegate { + + if (radio_button_gnome.Active) + FolderEntry.ExampleText = "Project"; + + }; + + radio_button.Toggled += delegate { if (radio_button.Active) { - ServerEntry.Sensitive = true; - + FolderEntry.ExampleText = "Folder"; + ServerEntry.Sensitive = true; CheckStepTwoFields (); } else { ServerEntry.Sensitive = false; - CheckStepTwoFields (); } @@ -279,7 +302,9 @@ namespace SparkleShare { HBox layout_folder = new HBox (true, 0); - FolderEntry = new Entry (); + FolderEntry = new SparkleEntry () { + ExampleText = "Folder" + }; FolderEntry.Changed += CheckStepTwoFields; diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index b29cbae0..2b824b6e 100644 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -170,7 +170,7 @@ namespace SparkleShare { Menu.Add (new SeparatorMenuItem ()); - FolderAction = new Gtk.Action ("", "SparkleShare Folder (" + GetSize (FolderSize) + ")") { + FolderAction = new Gtk.Action ("", "SparkleShare (" + GetSize (FolderSize) + ")") { IconName = "folder-sparkleshare", IsImportant = true };