gtk2passwordapp 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/bin/gtk2passwordapp CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
- # $Date: 2009/02/21 13:58:09 $
2
+ # $Date: 2009/02/22 16:23:11 $
3
3
  ##########################################################
4
4
  require 'lib/global_options_variables'
5
- GlobalOptionsVariables.set('0.0.4',
5
+ GlobalOptionsVariables.set('0.0.5',
6
6
  <<EOT
7
7
  Usage: #{$0.sub(/^.*\//,'')} [options]
8
8
 
@@ -1,4 +1,4 @@
1
- # $Date: 2009/02/21 13:56:55 $
1
+ # $Date: 2009/02/22 16:20:51 $
2
2
  require 'lib/passwords_data'
3
3
  require 'gtk2'
4
4
  require 'find'
@@ -13,7 +13,7 @@ class Gtk2PasswordApp
13
13
  'website' => 'http://ruby-gnome-apps.blogspot.com/search/label/Passwords',
14
14
  'website-label' => 'Ruby Gnome Password Manager',
15
15
  'license' => 'GPL',
16
- 'copyright' => '$Date: 2009/02/21 13:56:55 $'.gsub(/\s*\$\s*/,''),
16
+ 'copyright' => '$Date: 2009/02/22 16:20:51 $'.gsub(/\s*\$\s*/,''),
17
17
  'logo' => Gdk::Pixbuf.new(LOGO_IMAGE),
18
18
  }
19
19
 
@@ -382,14 +382,18 @@ class Gtk2PasswordApp
382
382
  # Change Password
383
383
  widget[:cpwd].signal_connect('clicked'){
384
384
  if verify_user then
385
- pwd1 = get_salt('New Password') || return
386
- pwd2 = get_salt('Verify') || return
387
- while !(pwd1==pwd2) do
388
- pwd1 = get_salt('Try again!') || return
389
- pwd2 = get_salt('Verify') || return
385
+ if pwd1 = get_salt('New Password') then
386
+ if pwd2 = get_salt('Verify') then
387
+ while !(pwd1==pwd2) do
388
+ pwd1 = get_salt('Try again!')
389
+ return if !pwd1
390
+ pwd2 = get_salt('Verify')
391
+ return if !pwd2
392
+ end
393
+ @pwd = pwd1
394
+ @passwords.save(@pwd+@pph)
395
+ end
390
396
  end
391
- @pwd = pwd1
392
- @passwords.save(@pwd+@pph)
393
397
  else
394
398
  quit_windows
395
399
  end
@@ -551,46 +555,51 @@ class Gtk2PasswordApp
551
555
  icon = Gtk::StatusIcon.new
552
556
  icon.set_icon_name(Gtk::Stock::DIALOG_AUTHENTICATION)
553
557
  icon.tooltip = 'Password Manager'
558
+ unlocked = true
554
559
  icon.signal_connect('activate') {
555
560
  if @window then
556
561
  quit_windows
557
- else
558
- main_quit(icon) if !verify_user
559
-
560
- menu = Gtk::Menu.new
561
- @passwords.accounts.each {|account|
562
- menuitem = Gtk::MenuItem.new(account)
563
- menuitem.child.modify_fg(Gtk::STATE_NORMAL, RED) if @passwords.expired?(account)
564
- menu.append(menuitem)
565
- menuitem.signal_connect('activate'){|b|
566
- primary = Gtk::Clipboard.get(Gdk::Selection::PRIMARY)
567
- clipboard = Gtk::Clipboard.get(Gdk::Selection::CLIPBOARD)
568
- primary.text = clipboard.text = @passwords.password_of(b.child.text.strip)
562
+ elsif unlocked then
563
+ unlocked = false
564
+ if verify_user then
565
+ menu = Gtk::Menu.new
566
+ @passwords.accounts.each {|account|
567
+ menuitem = Gtk::MenuItem.new(account)
568
+ menuitem.child.modify_fg(Gtk::STATE_NORMAL, RED) if @passwords.expired?(account)
569
+ menu.append(menuitem)
570
+ menuitem.signal_connect('activate'){|b|
571
+ primary = Gtk::Clipboard.get(Gdk::Selection::PRIMARY)
572
+ clipboard = Gtk::Clipboard.get(Gdk::Selection::CLIPBOARD)
573
+ primary.text = clipboard.text = @passwords.password_of(b.child.text.strip)
574
+ }
569
575
  }
570
- }
571
- menu.append( Gtk::SeparatorMenuItem.new )
576
+ menu.append( Gtk::SeparatorMenuItem.new )
572
577
 
573
- menuitem = Gtk::MenuItem.new('Quit')
574
- menuitem.signal_connect('activate'){ main_quit(icon) }
575
- menu.append(menuitem)
578
+ menuitem = Gtk::MenuItem.new('Quit')
579
+ menuitem.signal_connect('activate'){ main_quit(icon) }
580
+ menu.append(menuitem)
576
581
 
577
- Gtk::AboutDialog.set_url_hook{|about,link| system( "#{BROWSER} '#{link}' > /dev/null 2>&1 &" ) }
578
- menuitem = Gtk::MenuItem.new('About')
579
- menuitem.signal_connect('activate'){
580
- Gtk::AboutDialog.show(nil, ABOUT)
581
- }
582
- menu.append(menuitem)
582
+ Gtk::AboutDialog.set_url_hook{|about,link| system( "#{BROWSER} '#{link}' > /dev/null 2>&1 &" ) }
583
+ menuitem = Gtk::MenuItem.new('About')
584
+ menuitem.signal_connect('activate'){
585
+ Gtk::AboutDialog.show(nil, ABOUT)
586
+ }
587
+ menu.append(menuitem)
583
588
 
584
- menuitem = Gtk::MenuItem.new('Run')
585
- menuitem.signal_connect('activate'){
586
- if !@window
587
- run if verify_user
588
- end
589
- }
590
- menu.append(menuitem)
589
+ menuitem = Gtk::MenuItem.new('Run')
590
+ menuitem.signal_connect('activate'){
591
+ if !@window
592
+ run if verify_user
593
+ end
594
+ }
595
+ menu.append(menuitem)
591
596
 
592
- menu.show_all
593
- menu.popup(nil, nil, 0, 0)
597
+ menu.show_all
598
+ menu.popup(nil, nil, 0, 0)
599
+ unlocked = true
600
+ else
601
+ main_quit(icon)
602
+ end
594
603
  end
595
604
  }
596
605
  run if !@passwords.exist?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtk2passwordapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - carlosjhr64@gmail.com
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-15 00:00:00 -08:00
12
+ date: 2009-02-22 00:00:00 -08:00
13
13
  default_executable: gtk2youtubeapp
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency