Commits

Erik Grinaker  committed 095f400

renamed launch to go to, and made go to default action for doubleclick

  • Participants
  • Parent commits e6acb28

Comments (0)

Files changed (12)

 
 	* wrote more ui module unit tests (yawn)
 
+	* renamed launch to go to
+
+	* removed option for launch-on-doubleclick (now default behaviour)
+
+	* on entry goto, the username isn't copied to the clipboard chain
+	if the username is given to the goto command
+
 2005-01-08  Erik Grinaker <erikg@codepoet.no>
 
 	* wrote more ui module unit tests (yawn)
 - an account password chain is copied to the clipboard when launching entry
 - added menu item for copying username and password chain to clipboard
 - username and password can be copied to clipboard, even when hidden
-- added preference for launching entries on doubleclick
+- default action for entries is "go to"
 - integrated with gnome session manager
 - new application icon
 - added icon and mime-type for the data files
 - gtk/gnome command-line arguments are handled correctly
 - don't subclass gnome.ui.HRef (abstract widget from gnome-python 2.9.x)
 - fall back to False for GNOME toolbar_detachable setting
+- renamed "launch" to "go to"
 
 Code changes:
 - rewrote and cleaned up all code

File data/revelation.schemas

 			<locale name="C">
 				<short>Autoload a file on startup</short>
 				<long>
-					If true, Revelation will automatically
+					If set, Revelation will automatically
 					load a data file on startup. The file to
 					open is specified in the "autoload_file" key.
 				</long>
 			<locale name="C">
 				<short>Autosave data when changed</short>
 				<long>
-					If true, Revelation will automatically
+					If set, Revelation will automatically
 					save the data file when an entry is added,
 					updated or removed.
 				</long>
 		</schema>
 
 		<schema>
-			<key>/schemas/apps/revelation/launching/doubleclick</key>
-			<applyto>/apps/revelation/launching/doubleclick</applyto>
-			<owner>revelation</owner>
-			<type>bool</type>
-			<default>false</default>
-
-			<locale name="C">
-				<short>Launch entries on doubleclick</short>
-				<long>
-					When enabled, doubleclicking an entry will
-					launch it instead of editing it.
-				</long>
-			</locale>
-		</schema>
-
-		<schema>
 			<key>/schemas/apps/revelation/passwordgen/avoid_ambiguous</key>
 			<applyto>/apps/revelation/passwordgen/avoid_ambiguous</applyto>
 			<owner>revelation</owner>
 			<locale name="C">
 				<short>Show passwords</short>
 				<long>
-					When true, passwords will be displayed
+					When set, passwords will be displayed
 					in plain text. Turning this option off
 					will obscure passwords with ******.
 				</long>
 			<locale name="C">
 				<short>Displays the searchbar</short>
 				<long>
-					When set to "true", Revelation will display
+					When set, Revelation will display
 					its searchbar.
 				</long>
 			</locale>
 			<locale name="C">
 				<short>Displays the statusbar</short>
 				<long>
-					When set to "true", Revelation will display
+					When set, Revelation will display
 					its statusbar.
 				</long>
 			</locale>
 			<locale name="C">
 				<short>Displays the toolbar</short>
 				<long>
-					When set to "true", Revelation will display
+					When set, Revelation will display
 					its toolbar.
 				</long>
 			</locale>

File data/ui/actions.xml

 		</action>
 	</actiongroup>
 
-	<actiongroup name="entry-launch">
+	<actiongroup name="entry-goto">
 		<action important="yes">
-			<name>entry-launch</name>
-			<label>_Launch</label>
-			<stock>revelation-launch</stock>
+			<name>entry-goto</name>
+			<label>_Go to</label>
+			<stock>revelation-goto</stock>
 			<accel>&lt;Shift&gt;&lt;Control&gt;Return</accel>
-			<description>Launch the selected entries</description>
+			<description>Go to the selected entries</description>
 		</action>
 	</actiongroup>
 

File data/ui/menubar.xml

 			<menuitem action="entry-add" />
 			<menuitem action="entry-edit" />
 			<menuitem action="entry-remove" />
-			<menuitem action="entry-launch" />
+			<menuitem action="entry-goto" />
 			<separator />
 			<menuitem action="undo" />
 			<menuitem action="redo" />

File data/ui/popup-tree.xml

 
 <ui>
 	<popup action="popup-tree">
+		<menuitem action="entry-goto" />
 		<menuitem action="entry-edit" />
 		<menuitem action="entry-remove" />
-		<menuitem action="entry-launch" />
 		<menuitem action="entry-add" />
 		<separator />
 		<menuitem action="clip-cut" />

File data/ui/toolbar.xml

 		<toolitem action="entry-add" />
 		<toolitem action="entry-edit" />
 		<toolitem action="entry-remove" />
-		<toolitem action="entry-launch" />
+		<toolitem action="entry-goto" />
 	</toolbar>
 </ui>
 

File src/lib/config.py.in

 			self.get("view/window-width")
 			self.get("launcher/website")
 			self.get("view/searchbar")
-			self.get("launching/doubleclick")
 
 		except ConfigError:
 			return False

File src/lib/dialog.py

 		self.page_general = self.notebook.create_page("General")
 		self.__init_section_file(self.page_general)
 		self.__init_section_pwgen(self.page_general)
-		self.__init_section_launching(self.page_general)
 
-		self.page_launchers = self.notebook.create_page("Launchers")
-		self.__init_section_launchers(self.page_launchers)
+		self.page_gotocmd = self.notebook.create_page("Goto commands")
+		self.__init_section_gotocmd(self.page_gotocmd)
 
 
 	def __init_section_file(self, page):
 		self.section_file.append_widget("File to open", eventbox)
 
 
-	def __init_section_launchers(self, page):
-		"Sets up the launcher section"
+	def __init_section_gotocmd(self, page):
+		"Sets up the goto command section"
 
-		self.section_launchers = page.add_section("Launcher Commands")
+		self.section_gotocmd = page.add_section("Goto commands")
 
 		for entrytype in entry.ENTRYLIST:
 			if entrytype == entry.FolderEntry:
 			widget = ui.Entry()
 			ui.config_bind(self.config, "launcher/%s" % e.id, widget)
 
-			tooltip = "Launcher command for %s accounts. The following expansion variables can be used:\n\n" % e.typename
+			tooltip = "Goto command for %s accounts. The following expansion variables can be used:\n\n" % e.typename
 
 			for field in e.fields:
 				tooltip += "%%%s: %s\n" % ( field.symbol, field.name )
 			tooltip += "%(...%): optional substring expansion"
 
 			self.tooltips.set_tip(widget, tooltip)
-			self.section_launchers.append_widget(e.typename, widget)
-
-
-	def __init_section_launching(self, page):
-		"Sets up the launching section"
-
-		self.section_launching = page.add_section("Launching")
-
-		# doubleclick action
-		self.check_doubleclick = ui.CheckButton("Launch entry on double-click")
-		ui.config_bind(self.config, "launching/doubleclick", self.check_doubleclick)
-
-		self.tooltips.set_tip(self.check_doubleclick, "When enabled, doubleclicking an entry will launch it instead of edit it")
-		self.section_launching.append_widget(None, self.check_doubleclick)
+			self.section_gotocmd.append_widget(e.typename, widget)
 
 
 	def __init_section_pwgen(self, page):

File src/lib/ui.py

 STOCK_EXPORT			= "revelation-export"
 STOCK_GENERATE			= "revelation-generate"
 STOCK_IMPORT			= "revelation-import"
-STOCK_LAUNCH			= "revelation-launch"
+STOCK_GOTO			= "revelation-goto"
 STOCK_LOCK			= "revelation-lock"
 STOCK_NEXT			= "revelation-next"
 STOCK_OVERWRITE			= "revelation-overwrite"
 			( STOCK_EDIT,		"_Edit",	"stock_edit" ),
 			( STOCK_EXPORT,		"_Export",	gtk.STOCK_EXECUTE ),
 			( STOCK_GENERATE,	"_Generate",	gtk.STOCK_EXECUTE ),
+			( STOCK_GOTO,		"_Go to",	gtk.STOCK_JUMP_TO ),
 			( STOCK_IMPORT,		"_Import",	gtk.STOCK_CONVERT ),
-			( STOCK_LAUNCH,		"_Launch",	gtk.STOCK_JUMP_TO ),
 			( STOCK_LOCK,		"_Lock",	gtk.STOCK_DIALOG_AUTHENTICATION ),
 			( STOCK_NEXT,		"Ne_xt",	gtk.STOCK_GO_FORWARD ),
 			( STOCK_OVERWRITE,	"_Overwrite",	gtk.STOCK_SAVE_AS ),

File src/revelation.in

 			"clip-paste"		: lambda w: self.clip_paste(self.entryclipboard.get(), self.tree.get_active()),
 			"entry-add"		: lambda w: self.entry_add(None, self.tree.get_active()),
 			"entry-edit"		: lambda w: self.entry_edit(self.tree.get_active()),
-			"entry-launch"		: lambda w: self.entry_launch(self.tree.get_selected()),
+			"entry-goto"		: lambda w: self.entry_goto(self.tree.get_selected()),
 			"entry-remove"		: lambda w: self.entry_remove(self.tree.get_selected()),
 			"file-change-password"	: lambda w: self.file_change_password(),
 			"file-close"		: lambda w: self.quit(),
 		self.uimanager.get_action_group("entry-single").set_sensitive(len(iters) == 1)
 		self.uimanager.get_action_group("entry-optional").set_sensitive(len(iters) < 2)
 
-		# launch sensitivity
+		# goto sensitivity
 		try:
 			for iter in iters:
 				e = self.entrystore.get_entry(iter)
 		except config.ConfigError:
 			s = False
 
-		self.uimanager.get_action_group("entry-launch").set_sensitive(s)
+		self.uimanager.get_action_group("entry-goto").set_sensitive(s)
 
 		# dynamic menu items for field copying
 		for menupath in ( "/popup-tree", "/menubar/menu-edit"):
 	def __cb_tree_doubleclick(self, widget, data = None):
 		"Handles doubleclicks on the tree"
 
-		if self.config.get("launching/doubleclick") == True:
-			self.entry_launch(self.tree.get_selected())
-
-		else:
-			self.entry_edit()
+		self.entry_goto(self.tree.get_selected())
 
 
 	def __cb_tree_drag_received(self, tree, context, x, y, seldata, info, time):
 				break
 
 
-	def entry_launch(self, iters):
-		"Launches entries"
+	def entry_goto(self, iters):
+		"Goes to an entry"
 
 		for iter in iters:
 			try:
 
-				# get launch data for entry
+				# get goto data for entry
 				e = self.entrystore.get_entry(iter)
 				command = self.config.get("launcher/%s" % e.id)
 
 				if command in ( "", None ):
-					self.statusbar.set_status("No launcher found for entry")
+					self.statusbar.set_status("No goto command found for " + e.typename + " entries")
 					return
 
 				subst = {}
 				for field in e.fields:
 					subst[field.symbol] = field.value
 
-				# copy passwords to clipboard
-				self.clip_chain(e)
+				# copy passwords to clipboar
+				chain = []
 
-				# generate and run launch command
+				if e.has_field(entry.UsernameField) == True and e[entry.UsernameField] != "" and "%" + entry.UsernameField.symbol not in command:
+					chain.append(e[entry.UsernameField])
+
+				for field in e.fields:
+					if field.datatype == entry.DATATYPE_PASSWORD and field.value != "":
+						chain.append(field.value)
+
+				self.clipboard.set(chain)
+
+				# generate and run goto command
 				command = util.parse_subst(command, subst)
 				util.execute_child(command)
 
-				self.statusbar.set_status("Entry launched")
+				self.statusbar.set_status("Entry opened")
 
 			except ( util.SubstFormatError, config.ConfigError ):
-				dialog.Error(self, "Invalid launcher format", "The launch command for '" + e.typename + "' entries is invalid, please correct this in the preferences.").run()
+				dialog.Error(self, "Invalid goto command format", "The goto command for '" + e.typename + "' entries is invalid, please correct this in the preferences.").run()
 
 			except util.SubstValueError:
-				dialog.Error(self, "Missing entry data", "The entry '" + e.name + "' does not have all the data required to launch it.").run()
+				dialog.Error(self, "Missing entry data", "The entry '" + e.name + "' does not have all the data required to go to it.").run()
 
 
 	def entry_move(self, sourceiters, parent = None, sibling = None):
 		self.assertEquals(hasattr(ui, "STOCK_EDIT"), True)
 		self.assertEquals(hasattr(ui, "STOCK_EXPORT"), True)
 		self.assertEquals(hasattr(ui, "STOCK_GENERATE"), True)
+		self.assertEquals(hasattr(ui, "STOCK_GOTO"), True)
 		self.assertEquals(hasattr(ui, "STOCK_IMPORT"), True)
-		self.assertEquals(hasattr(ui, "STOCK_LAUNCH"), True)
 		self.assertEquals(hasattr(ui, "STOCK_LOCK"), True)
 		self.assertEquals(hasattr(ui, "STOCK_NEXT"), True)
 		self.assertEquals(hasattr(ui, "STOCK_OVERWRITE"), True)