Merge branch 'master' of https://github.com/glenux/qasim
This commit is contained in:
commit
e1fd3ad761
4 changed files with 39 additions and 23 deletions
|
@ -7,6 +7,7 @@ $VERBOSE = true
|
||||||
|
|
||||||
require 'pp'
|
require 'pp'
|
||||||
require 'set'
|
require 'set'
|
||||||
|
require 'fcntl'
|
||||||
|
|
||||||
QASIM_INCLUDE_DIR = "."
|
QASIM_INCLUDE_DIR = "."
|
||||||
$:.push QASIM_INCLUDE_DIR
|
$:.push QASIM_INCLUDE_DIR
|
||||||
|
@ -143,13 +144,13 @@ module Qasim
|
||||||
@context_menu = Qt::Menu.new
|
@context_menu = Qt::Menu.new
|
||||||
|
|
||||||
act_pref = Qt::Action.new _('&Preferences'), @context_menu
|
act_pref = Qt::Action.new _('&Preferences'), @context_menu
|
||||||
act_pref.setIcon( Qt::Icon::fromTheme("configure") )
|
act_pref.setIcon( Qt::Icon::fromTheme("configure") ) rescue nil
|
||||||
act_pref.setIconVisibleInMenu true
|
act_pref.setIconVisibleInMenu true
|
||||||
act_pref.setEnabled false
|
act_pref.setEnabled false
|
||||||
@context_menu.addAction act_pref;
|
@context_menu.addAction act_pref;
|
||||||
|
|
||||||
act_about = Qt::Action.new '&About', @context_menu
|
act_about = Qt::Action.new '&About', @context_menu
|
||||||
act_about.setIcon( Qt::Icon::fromTheme("help-about") )
|
act_about.setIcon( Qt::Icon::fromTheme("help-about") ) rescue nil
|
||||||
act_about.setIconVisibleInMenu true
|
act_about.setIconVisibleInMenu true
|
||||||
act_about.setEnabled false
|
act_about.setEnabled false
|
||||||
@context_menu.addAction act_about;
|
@context_menu.addAction act_about;
|
||||||
|
@ -157,7 +158,7 @@ module Qasim
|
||||||
@context_menu.addSeparator
|
@context_menu.addSeparator
|
||||||
|
|
||||||
act_quit = Qt::Action.new _('Quit'), @context_menu
|
act_quit = Qt::Action.new _('Quit'), @context_menu
|
||||||
act_quit.setIcon( Qt::Icon::fromTheme("application-exit") )
|
act_quit.setIcon( Qt::Icon::fromTheme("application-exit") ) rescue nil
|
||||||
act_quit.setIconVisibleInMenu true
|
act_quit.setIconVisibleInMenu true
|
||||||
act_quit.connect(SIGNAL(:triggered)) { @app.quit }
|
act_quit.connect(SIGNAL(:triggered)) { @app.quit }
|
||||||
@context_menu.addAction act_quit
|
@context_menu.addAction act_quit
|
||||||
|
@ -209,7 +210,25 @@ module Qasim
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
def run
|
def run
|
||||||
|
# create lock
|
||||||
|
have_lock = true
|
||||||
|
|
||||||
|
FileUtils.mkdir_p APP_CONFIG_DIR unless File.exist? APP_CONFIG_DIR
|
||||||
|
lockfname = File.join APP_CONFIG_DIR, "lock"
|
||||||
|
fd = IO::sysopen( lockfname,
|
||||||
|
Fcntl::O_WRONLY | Fcntl::O_EXCL | Fcntl::O_CREAT)
|
||||||
|
f = IO.open(fd)
|
||||||
|
f.syswrite( "Process.pid\n" )
|
||||||
|
f.close
|
||||||
@app.exec
|
@app.exec
|
||||||
|
rescue Errno::EEXIST => e
|
||||||
|
warn "error: Another instance of %s is already running." % APP_NAME
|
||||||
|
exit 1
|
||||||
|
ensure
|
||||||
|
masterpid = File.read(lockfname).strip
|
||||||
|
if masterpid == Process.pid then
|
||||||
|
FileUtils.rm lockfname
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
7
debian/changelog
vendored
7
debian/changelog
vendored
|
@ -1,3 +1,10 @@
|
||||||
|
qasim (0.1.6) unstable; urgency=low
|
||||||
|
|
||||||
|
* qasim-gui: handle QIcon::fromTheme NoMethodError exception when needed.
|
||||||
|
* qasim-gui: added single instance lock.
|
||||||
|
|
||||||
|
-- Glenn Y. Rolland <glenux@glenux.net> Wed, 07 Sep 2011 01:08:48 +0200
|
||||||
|
|
||||||
qasim (0.1.5) unstable; urgency=low
|
qasim (0.1.5) unstable; urgency=low
|
||||||
|
|
||||||
* map: Added missing require for fileutils.
|
* map: Added missing require for fileutils.
|
||||||
|
|
|
@ -20,27 +20,10 @@ module Qasim
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
|
|
||||||
user = if ENV['USER'] then
|
|
||||||
ENV['USER']
|
|
||||||
else
|
|
||||||
raise "Environment variable 'USER' is missing!"
|
|
||||||
end
|
|
||||||
|
|
||||||
home_dir = if ENV['HOME'] then
|
@mnt_dir = File.join ENV['HOME'], "mnt"
|
||||||
ENV['HOME']
|
|
||||||
else
|
|
||||||
"/home/" + user
|
|
||||||
end
|
|
||||||
|
|
||||||
xdg_dir = if ENV['XDG_CONFIG_HOME'] then
|
@config_dir = APP_CONFIG_DIR
|
||||||
ENV['XDG_CONFIG_HOME']
|
|
||||||
else
|
|
||||||
home_dir + '/.config'
|
|
||||||
end
|
|
||||||
|
|
||||||
@mnt_dir = File.join home_dir, "mnt"
|
|
||||||
|
|
||||||
@config_dir = xdg_dir + '/sshfs-mapper'
|
|
||||||
@config_file = nil
|
@config_file = nil
|
||||||
@maps = []
|
@maps = []
|
||||||
@initialize_enable = false
|
@initialize_enable = false
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
module Qasim
|
module Qasim
|
||||||
APP_ICON_PATH = File.join QASIM_INCLUDE_DIR, "icons"
|
APP_ICON_PATH = File.join QASIM_INCLUDE_DIR, "icons"
|
||||||
APP_SYSCONFIG_DIR = "/etc/qasim/maps.d"
|
|
||||||
APP_NAME = "Qasim"
|
APP_NAME = "Qasim"
|
||||||
APP_VERSION = "0.1"
|
APP_VERSION = "0.1"
|
||||||
|
|
||||||
|
APP_SYSCONFIG_DIR = "/etc/qasim/maps.d"
|
||||||
|
|
||||||
|
APP_CONFIG_DIR = if ENV['XDG_CONFIG_HOME'] then
|
||||||
|
File.join ENV['XDG_CONFIG_HOME'], 'qasim'
|
||||||
|
else
|
||||||
|
File.join ENV['HOME'], '.config', 'qasim'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue