lutris: protocol handling + installer fixes

This commit is contained in:
Mathieu Comandon 2013-05-26 22:20:41 +02:00
parent 66cd9315dc
commit 2b68731543
9 changed files with 35 additions and 16 deletions

View file

@ -1,4 +0,0 @@
project = lutris
template = ubuntu-application
lp_id = lutris
version = 11.10

View file

@ -47,7 +47,7 @@ except ImportError:
from lutris.constants import CONFIG_EXTENSION, GAME_CONFIG_PATH
from lutris.util.log import logger
from lutris.installer import InstallerDialog
from lutris.config import check_config
from lutris.config import check_config, register_handler
from lutris.game import LutrisGame
from lutris.pga import get_games
from lutris.gui.lutriswindow import LutrisWindow
@ -89,6 +89,7 @@ check_config(force_wipe=False)
installer = False
game = None
register_handler()
signal.signal(signal.SIGINT, signal.SIG_DFL)
GObject.threads_init()

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
<schema id="desktop.gnome.url-handlers.lutris" path="/desktop/gnome/url-handlers/lutris/">
<key type="s" name="command">
<default>'lutris "%s"'</default>
<summary>The command to handle lutris scheme URLs</summary>
<description>The command to handle lutris scheme URLs.</description>
</key>
<key type="b" name="needs-terminal">
<default>false</default>
<summary>Whether command to handle lutris scheme URLs needs a terminal</summary>
<description>Whether command to handle lutris scheme URLs needs a terminal.</description>
</key>
<key type="b" name="enabled">
<default>true</default>
<summary>Whether command to handle lutris scheme URLs is enabled</summary>
<description>Whether command to handle lutris scheme URLs is enabled.</description>
</key>
</schema>
</schemalist>

View file

@ -7,4 +7,4 @@ Exec=lutris %U
Icon=lutris
Terminal=false
Type=Application
MimeType=application/x-lutris;x-scheme-handler/lutris;
MimeType=x-scheme-handler/lutris;

View file

@ -18,28 +18,26 @@
"""Handle the basic configuration of Lutris."""
import os
import sys
import yaml
import logging
from os.path import join
from gi.repository import Gio
from lutris import pga
from lutris.util.log import logger
from lutris.util.strings import slugify
from lutris.gconf import GConfSetting
from lutris.settings import PGA_DB, CONFIG_DIR, DATA_DIR, CACHE_DIR
def register_handler():
""" Register the lutris: protocol to open with the application. """
logger.info("registering protocol")
defaults = (('/desktop/gnome/url-handlers/lutris/command', "lutris '%s'"),
('/desktop/gnome/url-handlers/lutris/enabled', True),
('/desktop/gnome/url-handlers/lutris/needs-terminal', False),)
for key, value in defaults:
logger.debug("registering gconf key %s" % key)
setting = GConfSetting(key, type(value))
setting.set_key(key, value, override_type=True)
executable = os.path.abspath(sys.argv[0])
base_key = "desktop.gnome.url-handlers.lutris"
settings = Gio.Settings.new(base_key)
settings.set_string('command', executable)
def check_config(force_wipe=False):

View file

@ -66,6 +66,5 @@ class Downloader():
Gio.Cancellable(),
self.mount_cb,
None)
else:
GLib.idle_add(self.schedule_download)

View file

@ -3,6 +3,7 @@
import os
import json
from gi.repository import Gtk, GLib
#from lutris.util import log

View file

@ -269,6 +269,8 @@ class ScriptInterpreter(object):
if not os.path.exists(src):
self.errors.append("I can't move %s, it does not exist" % src)
return False
if not os.path.exists(dst):
os.makedirs(dst)
target = os.path.join(dst, os.path.basename(src))
if os.path.exists(target):
self.errors.append("Destination %s already exists" % target)

View file

@ -32,6 +32,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
## Default config options
KEEP_CACHED_ASSETS = True
## Paths
CONFIG_DIR = os.path.join(BaseDirectory.xdg_config_home, 'lutris')