From a84e37b462b2bd8c9ae09d24bf859ec98fb4b76a Mon Sep 17 00:00:00 2001
From: Manuel Kaufmann <humitos@gmail.com>
Date: Tue, 27 Nov 2012 19:42:51 -0300
Subject: [PATCH sugar-toolkit-gtk3] Auto-select text when tap/click on title
entry SL #4036
When the user taps/clicks on the title entry inside the Activity
Button, the text is selected automatically to change the whole
title of the activity easily.
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
---
src/sugar3/activity/widgets.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/sugar3/activity/widgets.py b/src/sugar3/activity/widgets.py
index 03b2415..9e552ed 100644
a
|
b
|
class TitleEntry(Gtk.ToolItem): |
178 | 178 | self.entry.set_size_request(int(Gdk.Screen.width() / 3), -1) |
179 | 179 | self.entry.set_text(activity.metadata['title']) |
180 | 180 | self.entry.connect('focus-out-event', self.__title_changed_cb, activity) |
| 181 | self.entry.connect('button-press-event', self.__button_press_event_cb) |
181 | 182 | self.entry.show() |
182 | 183 | self.add(self.entry) |
183 | 184 | |
… |
… |
class TitleEntry(Gtk.ToolItem): |
203 | 204 | self.save_title(activity) |
204 | 205 | return False |
205 | 206 | |
| 207 | def __button_press_event_cb(self, widget, event): |
| 208 | if widget.is_focus(): |
| 209 | return False |
| 210 | else: |
| 211 | widget.grab_focus() |
| 212 | widget.select_region(0, -1) |
| 213 | return True |
| 214 | |
206 | 215 | def save_title(self, activity): |
207 | 216 | title = self.entry.get_text() |
208 | 217 | if title == activity.metadata['title']: |