[meld] Make uninstalled state part of conf
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Make uninstalled state part of conf
- Date: Fri, 30 Sep 2016 23:28:56 +0000 (UTC)
commit 6246f959d7eb549c4ddc578508766f5b3d049e11
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Oct 1 09:10:41 2016 +1000
Make uninstalled state part of conf
This avoids the schema-loading callers having to know whether they're
running in an uninstalled state, which is relevant now that we're
looking to add a second schema load.
bin/meld | 2 +-
meld/conf.py | 7 +++++--
meld/settings.py | 8 ++++----
3 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/bin/meld b/bin/meld
index f4dc4af..bafb4e0 100755
--- a/bin/meld
+++ b/bin/meld
@@ -215,7 +215,7 @@ def setup_settings():
cwd=melddir)
import meld.settings
- meld.settings.create_settings(uninstalled=uninstalled or frozen)
+ meld.settings.create_settings()
def setup_logging():
diff --git a/meld/conf.py b/meld/conf.py
index f244ee9..ae12f1c 100644
--- a/meld/conf.py
+++ b/meld/conf.py
@@ -10,6 +10,7 @@ DATADIR = os.path.join(sys.prefix, "share", "meld")
LOCALEDIR = os.path.join(sys.prefix, "share", "locale")
# END
UNINSTALLED = False
+UNINSTALLED_SCHEMA = False
# Installed from main script
_ = lambda x: x
@@ -17,12 +18,13 @@ ngettext = lambda x, *args: x
def frozen():
- global DATADIR, LOCALEDIR
+ global DATADIR, LOCALEDIR, UNINSTALLED_SCHEMA
melddir = os.path.dirname(sys.executable)
DATADIR = os.path.join(melddir, "share", "meld")
LOCALEDIR = os.path.join(melddir, "share", "mo")
+ UNINSTALLED_SCHEMA = True
# This first bit should be unnecessary, but some things (GTK icon theme
# location, GSettings schema location) don't fall back correctly.
@@ -32,13 +34,14 @@ def frozen():
def uninstalled():
- global DATADIR, LOCALEDIR, UNINSTALLED
+ global DATADIR, LOCALEDIR, UNINSTALLED, UNINSTALLED_SCHEMA
melddir = os.path.abspath(os.path.join(
os.path.dirname(os.path.realpath(__file__)), ".."))
DATADIR = os.path.join(melddir, "data")
LOCALEDIR = os.path.join(melddir, "build", "mo")
UNINSTALLED = True
+ UNINSTALLED_SCHEMA = True
# This first bit should be unnecessary, but some things (GTK icon theme
# location, GSettings schema location) don't fall back correctly.
diff --git a/meld/settings.py b/meld/settings.py
index db35274..ee4d02f 100644
--- a/meld/settings.py
+++ b/meld/settings.py
@@ -78,8 +78,8 @@ class MeldSettings(GObject.GObject):
return Pango.FontDescription(font_string)
-def load_settings_schema(schema_id, uninstalled=False):
- if uninstalled:
+def load_settings_schema(schema_id):
+ if meld.conf.UNINSTALLED_SCHEMA:
schema_source = Gio.SettingsSchemaSource.new_from_directory(
meld.conf.DATADIR,
Gio.SettingsSchemaSource.get_default(),
@@ -93,10 +93,10 @@ def load_settings_schema(schema_id, uninstalled=False):
return settings
-def create_settings(uninstalled=False):
+def create_settings():
global settings, interface_settings, meldsettings
- settings = load_settings_schema(MELD_SCHEMA, uninstalled)
+ settings = load_settings_schema(MELD_SCHEMA)
interface_settings = Gio.Settings.new('org.gnome.desktop.interface')
meldsettings = MeldSettings()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]