Merge lp:~stan/pasaffe/window_title_and_escaping into lp:~mdeslaur/pasaffe/trunk

Proposed by Tristan Hill
Status: Merged
Merge reported by: Marc Deslauriers
Merged at revision: not available
Proposed branch: lp:~stan/pasaffe/window_title_and_escaping
Merge into: lp:~mdeslaur/pasaffe/trunk
Diff against target: 78 lines (+20/-12)
1 file modified
pasaffe/PasaffeWindow.py (+20/-12)
To merge this branch: bzr merge lp:~stan/pasaffe/window_title_and_escaping
Reviewer Review Type Date Requested Status
Marc Deslauriers Approve
Review via email: mp+333873@code.launchpad.net

Description of the change

* set window title based on current loaded file
* escape text e.g. in case of & in entry name

To post a comment you must log in.
Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

Hi! Thanks for the merge proposal.

ACK on the text escaping.

What's the use case on having the filename in the window title though? I feel that is a detail most users don't need to know when they're using the default database location. Could you perhaps make it only display the filename if it isn't the default file location?

review: Needs Fixing
692. By Tristan Hill

only display file basename when not the default

Revision history for this message
Tristan Hill (stan) wrote :

Yes I mainly use with a arbitrary database files and it is difficult to otherwise tell between different windows.

Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

Looks good, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'pasaffe/PasaffeWindow.py'
2--- pasaffe/PasaffeWindow.py 2016-10-27 13:00:56 +0000
3+++ pasaffe/PasaffeWindow.py 2017-12-13 23:36:32 +0000
4@@ -83,7 +83,6 @@
5 self.ui.textview1.connect("motion-notify-event",
6 self.textview_event_handler)
7
8- self.set_save_status(False)
9 self.passfile = None
10 self.is_locked = False
11 self.idle_id = None
12@@ -94,6 +93,9 @@
13 self.database = self.settings.get_string('database-path')
14 else:
15 self.database = database
16+ self.default_database = database is None
17+
18+ self.set_save_status(False)
19
20 self.settings = Gio.Settings.new("net.launchpad.pasaffe")
21 self.settings.connect('changed', self.on_preferences_changed)
22@@ -851,7 +853,8 @@
23
24 information = \
25 _('<big><b>Are you sure you wish to'
26- ' remove "%s"?</b></big>\n\n') % entry_name
27+ ' remove "%s"?</b></big>\n\n') % \
28+ GLib.markup_escape_text(entry_name)
29 information += _('Contents of the entry will be lost.\n')
30
31 info_dialog = Gtk.MessageDialog(
32@@ -873,7 +876,8 @@
33
34 information = \
35 _('<big><b>Are you sure you wish'
36- ' to remove folder "%s"?</b></big>\n\n') % folder_name
37+ ' to remove folder "%s"?</b></big>\n\n') % \
38+ GLib.markup_escape_text(folder_name)
39 information += _('All entries in this folder will be lost.\n')
40
41 info_dialog = Gtk.MessageDialog(
42@@ -1371,6 +1375,7 @@
43 self.passfile.get_saved_application()
44 information += '\n'
45 information += _('Database location:\n%s\n') % self.database
46+ information = GLib.markup_escape_text(information)
47
48 info_dialog = Gtk.MessageDialog(transient_for=self,
49 modal=True,
50@@ -1656,16 +1661,19 @@
51 self.ui.mnu_display_secrets.set_sensitive(True)
52 self.ui.display_secrets.set_sensitive(True)
53
54- def set_save_status(self, needed=False):
55+ def _set_title(self):
56+ prefix = ""
57+ if not self.default_database:
58+ prefix = "%s - " % os.path.basename(self.database)
59+ self.set_title("%s%sPasaffe" % (
60+ prefix,
61+ "*" if self.needs_saving else ""))
62+
63+ def set_save_status(self, needed):
64 self.needs_saving = needed
65- if needed is True:
66- self.set_title("*Pasaffe")
67- self.ui.save.set_sensitive(True)
68- self.ui.mnu_save.set_sensitive(True)
69- else:
70- self.set_title("Pasaffe")
71- self.ui.save.set_sensitive(False)
72- self.ui.mnu_save.set_sensitive(False)
73+ self.ui.save.set_sensitive(needed)
74+ self.ui.mnu_save.set_sensitive(needed)
75+ self._set_title()
76
77 def get_save_status(self):
78 return self.needs_saving

Subscribers

People subscribed via source and target branches

to all changes: