[PATCH] historyentry work
- From: Vincent Legoll <vincent legoll gmail com>
- To: meld-list gnome org, Kai Willadsen <kai willadsen gmail com>
- Subject: [PATCH] historyentry work
- Date: Sat, 7 Mar 2009 20:53:23 +0100
Hello,
I was trying to get VcView.fileentry to behave more
sanely, and created the attached patch. It seems to
work better now, but as I really don't know what I am
doing, I would like people to review the changes made,
and tell me if they are {,in}sane.
What was not working:
- vcview fileentry history was not saved
- need to press enter after selecting an history element
What's inside:
- don't use knowledge of HistoryEntry internals in HistoryFileEntry (1)
- send activation signal if an element from the drop down menu has been selected
- move currently selected element to the top of the history upon activation
(1) Yes, HistoryFileEntry could use more of the same treatment at other places
--
Vincent Legoll
Index: historyentry.py
===================================================================
--- historyentry.py (revision 1219)
+++ historyentry.py (working copy)
@@ -115,6 +115,13 @@
store.append((text,))
self._save_history()
+ def get_text(self):
+ return self.child.get_text()
+
+ def set_text(self, text):
+ self.child.set_text(text)
+ self.prepend_text(text)
+
def prepend_text(self, text):
if not text:
return
@@ -298,7 +305,7 @@
return self.directory_entry
def get_full_path(self, file_must_exist=False):
- text = self.__gentry.child.get_text()
+ text = self.__gentry.get_text()
if not text:
return None
@@ -324,7 +331,7 @@
return filename
def set_filename(self, filename):
- self.__gentry.child.set_text(filename)
+ self.__gentry.set_text(filename)
def set_modal(self, is_modal):
self.__is_modal = is_modal
@@ -430,8 +437,14 @@
def __entry_changed_signal(self, widget, *data):
self.emit("changed")
+ # An element from the drop down list has been selected,
+ # notify without the need for pressing "enter"
+ if self.__gentry.get_active() != -1:
+ self.__entry_activate_signal(widget, *data)
def __entry_activate_signal(self, widget, *data):
+ # Move current to top of history
+ self.__gentry.prepend_text(self.__gentry.get_text())
self.emit("activate")
def __get_history_id(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]