[gnome-calculator] Reset text in new function name input box.
- From: Arth Patel <arthpatel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calculator] Reset text in new function name input box.
- Date: Wed, 28 May 2014 21:21:33 +0000 (UTC)
commit 22dbc47516e6d8048594cdf38e75c7e594d51b87
Author: PioneerAxon <arth svnit gmail com>
Date: Thu May 29 02:45:42 2014 +0530
Reset text in new function name input box.
Original patch submitted by ZZromanZZ gmail com
See Bug #729699 for more details.
src/math-function-popup.vala | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/math-function-popup.vala b/src/math-function-popup.vala
index b7c4149..0974941 100644
--- a/src/math-function-popup.vala
+++ b/src/math-function-popup.vala
@@ -14,7 +14,10 @@ public class MathFunctionPopup : Gtk.Window
private Gtk.ScrolledWindow scrolled_window;
private Gtk.Box vbox;
+
private Gtk.Entry function_name_entry;
+ private bool function_name_entry_placeholder_reseted = false;
+
private Gtk.Button add_function_button;
private Gtk.SpinButton add_arguments_button;
@@ -62,6 +65,7 @@ public class MathFunctionPopup : Gtk.Window
function_name_entry = new Gtk.Entry ();
function_name_entry.set_text ("Type function name here");
function_name_entry.key_press_event.connect (function_name_key_press_cb);
+ function_name_entry.button_press_event.connect (function_name_mouse_click_cb);
function_name_entry.changed.connect (function_name_changed_cb);
function_name_entry.set_margin_right (5);
function_name_entry.activate.connect (add_function_cb);
@@ -99,8 +103,21 @@ public class MathFunctionPopup : Gtk.Window
widget.get_toplevel ().destroy ();
}
+ private bool function_name_mouse_click_cb (Gtk.Widget widget, Gdk.EventButton event)
+ {
+ if(!this.function_name_entry_placeholder_reseted)
+ {
+ this.function_name_entry_placeholder_reseted = true;
+ this.function_name_entry.set_text ("");
+ }
+
+ return false;
+ }
+
private bool function_name_key_press_cb (Gtk.Widget widget, Gdk.EventKey event)
{
+ this.function_name_entry_placeholder_reseted = true;
+
/* Can't have whitespace in names, so replace with underscores */
if (event.keyval == Gdk.Key.space || event.keyval == Gdk.Key.KP_Space)
event.keyval = Gdk.Key.underscore;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]