mirror of
https://github.com/lutris/lutris
synced 2024-09-05 07:23:32 +00:00
lutris: protocol handling + installer fixes
This commit is contained in:
parent
66cd9315dc
commit
2b68731543
4
.quickly
4
.quickly
|
@ -1,4 +0,0 @@
|
|||
project = lutris
|
||||
template = ubuntu-application
|
||||
lp_id = lutris
|
||||
version = 11.10
|
|
@ -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()
|
||||
|
||||
|
|
20
data/apps.lutris.gschema.xml
Normal file
20
data/apps.lutris.gschema.xml
Normal 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>
|
|
@ -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;
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -66,6 +66,5 @@ class Downloader():
|
|||
Gio.Cancellable(),
|
||||
self.mount_cb,
|
||||
None)
|
||||
|
||||
else:
|
||||
GLib.idle_add(self.schedule_download)
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
import os
|
||||
import json
|
||||
|
||||
|
||||
from gi.repository import Gtk, GLib
|
||||
|
||||
#from lutris.util import log
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in a new issue