[PATCH 3/7] Add ability to set the tooltip text of a tab
- From: Peter Tyser <ptyser gmail com>
- To: meld-list gnome org
- Subject: [PATCH 3/7] Add ability to set the tooltip text of a tab
- Date: Tue, 31 Aug 2010 01:17:58 -0500
Previously, the tab title and tab tooltip text had to be identical.
Allowing different titles and tooltips can be useful, so add the
ability to set them individually.
The one functional change this patch adds is that the tooltip for a
directory or VC diff tab now says "Location: <diff directory location>".
Previously it just said the basename of directory the diff was occuring
in, which wasn't very descriptive.
Signed-off-by: Peter Tyser <ptyser gmail com>
---
meld/dirdiff.py | 1 +
meld/filediff.py | 1 +
meld/meldapp.py | 3 ++-
meld/melddoc.py | 5 +++--
meld/vcview.py | 2 ++
5 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 1f87f20..bf96e09 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -881,6 +881,7 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
filenames = self.model.value_paths(root)
shortnames = misc.shorten_names(*filenames)
self.label_text = " : ".join(shortnames)
+ self.tooltip_text = self.label_text
self.label_changed()
def _update_diffmaps(self):
diff --git a/meld/filediff.py b/meld/filediff.py
index 9ed200f..8470fdc 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -679,6 +679,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
else:
self.statusimage[i].hide()
self.label_text = " : ".join(shortnames)
+ self.tooltip_text = self.label_text
self.label_changed()
def set_files(self, files):
diff --git a/meld/meldapp.py b/meld/meldapp.py
index c408b24..d67a94b 100644
--- a/meld/meldapp.py
+++ b/meld/meldapp.py
@@ -316,9 +316,10 @@ class MeldApp(gnomeglade.Component):
self.on_next_diff_changed)
self.scheduler.add_task( newdoc.scheduler )
- def on_notebook_label_changed(self, component, text):
+ def on_notebook_label_changed(self, component, text, tooltip):
nbl = self.notebook.get_tab_label( component.widget )
nbl.set_label_text(text)
+ nbl.set_tooltip_text(tooltip)
self.widget.set_title(text + " - Meld")
self.notebook.child_set_property(component.widget, "menu-label", text)
diff --git a/meld/melddoc.py b/meld/melddoc.py
index b7e442b..776532b 100644
--- a/meld/melddoc.py
+++ b/meld/melddoc.py
@@ -33,7 +33,7 @@ class MeldDoc(gobject.GObject):
"""
__gsignals__ = {
- 'label-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_STRING,)),
+ 'label-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_STRING, gobject.TYPE_STRING)),
'file-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_STRING,)),
'create-diff': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,)),
'status-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,)),
@@ -49,6 +49,7 @@ class MeldDoc(gobject.GObject):
self.prefs.notify_add(self.on_preference_changed)
self.num_panes = 0
self.label_text = _("untitled")
+ self.tooltip_text = _("untitled")
def save(self):
pass
@@ -104,7 +105,7 @@ class MeldDoc(gobject.GObject):
pass
def label_changed(self):
- self.emit("label-changed", self.label_text)
+ self.emit("label-changed", self.label_text, self.tooltip_text)
def set_labels(self, lst):
pass
diff --git a/meld/vcview.py b/meld/vcview.py
index 883a4f4..4d1b184 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -296,6 +296,8 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
def recompute_label(self):
self.label_text = os.path.basename(self.location)
+ # TRANSLATORS: This is the location of the directory the user is diffing
+ self.tooltip_text = _("%s: %s") % (_("Location"), self.location)
self.label_changed()
def _search_recursively_iter(self, iterstart):
--
1.7.1.13.gcfb88
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]