#!/usr/bin/env ruby require 'rubygems' gem 'gtk2applib', '~> 13.0' require 'gtk2applib' include Gtk2AppLib program = Program.new( { 'name' => 'Ruby-Gnome Password Manager', 'authors' => ['carlosjhr64@gmail.com'], 'website' => 'https://sites.google.com/site/gtk2applib/home/gtk2applib-applications/gtk2passwordapp', 'website-label' => 'Ruby-Gnome Password Manager', 'license' => 'GPL', 'copyright' => '2011-03-07 17:05:39', } ) begin require 'gtk2passwordapp' passwords = Gtk2PasswordApp::Passwords.new Gtk2PasswordApp.build_menu(program,passwords) modified = false program.window do |window| Gtk2AppLib::Configuration::PARAMETERS[:Account_ComboBoxEntry][0] = passwords.accounts Gtk2AppLib::Dialogs::DIALOG[:Window] = window gui = Gtk2PasswordApp::Component::Gui.new(window) do |is,signal,*emits| $stderr.puts "#{is},#{signal}:\t#{emits}" if $trace Gtk2PasswordApp.method(signal).call(is,passwords) do |action| case action when :modified then modified ||= true when :save if modified then Gtk2PasswordApp.save(program,passwords) modified = false else Gtk2AppLib::DIALOGS.quick_message(*Gtk2PasswordApp::Configuration::NO_UPDATES) end when :close if !modified || Gtk2AppLib::DIALOGS.question?(*Gtk2PasswordApp::Configuration::ARE_YOU_SURE) then passwords.load # revert modified = false program.close end end end end Gtk2PasswordApp::Component::SHARED[:Password_SpinButton].value = Gtk2PasswordApp::Configuration::DEFAULT_PASSWORD_LENGTH Gtk2PasswordApp::Component::SHARED[:Account_ComboBoxEntry].active = Gtk2PasswordApp.index window.signal_connect('destroy') do if modified then if Gtk2AppLib::DIALOGS.question?(*Gtk2PasswordApp::Configuration::WANT_TO_SAVE) then Gtk2PasswordApp.save(program,passwords) modified = false end end if modified then passwords.load # revert modified = false end end window.show_all end rescue Exception $verbose = true $!.puts_bang! ensure program.finalize end