[meld] Add ability to set the tooltip text of a tab
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Add ability to set the tooltip text of a tab
- Date: Fri, 22 Oct 2010 20:43:57 +0000 (UTC)
commit 8e11c43906a6e9da3b1a24080e89e3ee27f7f367
Author: Peter Tyser <ptyser gmail com>
Date: Tue Aug 31 01:17:58 2010 -0500
Add ability to set the tooltip text of a tab
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 2abc0a0..88a741c 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -842,6 +842,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 ce9ff0f..895f781 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -742,6 +742,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 2431d57..e50ed6a 100644
--- a/meld/meldapp.py
+++ b/meld/meldapp.py
@@ -319,9 +319,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 5cbd6a4..212104c 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -301,6 +301,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):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]