tasque r21 - in trunk: . src
- From: sharm svn gnome org
- To: svn-commits-list gnome org
- Subject: tasque r21 - in trunk: . src
- Date: Thu, 13 Mar 2008 23:27:02 +0000 (GMT)
Author: sharm
Date: Thu Mar 13 23:27:01 2008
New Revision: 21
URL: http://svn.gnome.org/viewvc/tasque?rev=21&view=rev
Log:
* src/TaskWindow.cs: When focusing on the Add Task field, clear our
"New task..." text. Restore this text if field is empty when
unfocused. Empty field after creating a new task. Text color in
field appears insensitive when field is not focused, if default
"New task..." text is there.
Modified:
trunk/ChangeLog
trunk/src/TaskWindow.cs
Modified: trunk/src/TaskWindow.cs
==============================================================================
--- trunk/src/TaskWindow.cs (original)
+++ trunk/src/TaskWindow.cs Thu Mar 13 23:27:01 2008
@@ -152,6 +152,8 @@
addTaskEntry.Focused += OnAddTaskEntryFocused;
addTaskEntry.Changed += OnAddTaskEntryChanged;
addTaskEntry.Activated += OnAddTaskEntryActivated;
+ addTaskEntry.FocusInEvent += OnAddTaskEntryFocused;
+ addTaskEntry.FocusOutEvent += OnAddTaskEntryUnfocused;
addTaskEntry.Show ();
topHBox.PackStart (addTaskEntry, true, true, 0);
@@ -761,7 +763,7 @@
Logger.Debug ("Error creating a new task!");
} else {
// Clear out the entry
- addTaskEntry.Text = Catalog.GetString ("New task...");
+ addTaskEntry.Text = string.Empty;
addTaskEntry.GrabFocus ();
}
@@ -817,9 +819,22 @@
void OnAddTaskEntryFocused (object sender, EventArgs args)
{
- // Select all the text in the text field so it's ready for the user
- // to start typing.
- addTaskEntry.SelectRegion (-1, -1);
+ // Clear the entry if it contains the default text
+ if (addTaskEntry.Text == Catalog.GetString ("New task...")) {
+ addTaskEntry.Text = string.Empty;
+ addTaskEntry.ModifyText (Gtk.StateType.Normal);
+ }
+ }
+
+ void OnAddTaskEntryUnfocused (object sender, EventArgs args)
+ {
+ // Restore the default text if nothing is entered
+ if (addTaskEntry.Text == string.Empty) {
+ addTaskEntry.Text = Catalog.GetString ("New task...");
+ Gdk.Color insensitiveColor =
+ addTaskEntry.Style.Text (Gtk.StateType.Insensitive);
+ addTaskEntry.ModifyText (Gtk.StateType.Normal, insensitiveColor);
+ }
}
void OnAddTaskEntryChanged (object sender, EventArgs args)
@@ -1082,6 +1097,10 @@
if (Application.Backend.Configured) {
RebuildAddTaskMenu (Application.Backend.Categories);
addTaskEntry.Sensitive = true;
+ // Keep insensitive text color
+ Gdk.Color insensitiveColor =
+ addTaskEntry.Style.Text (Gtk.StateType.Insensitive);
+ addTaskEntry.ModifyText (Gtk.StateType.Normal, insensitiveColor);
}
}
#endregion // Event Handlers
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]