[pitivi] pitivi: Add option to use a light theme
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] pitivi: Add option to use a light theme
- Date: Fri, 17 Jan 2020 00:33:49 +0000 (UTC)
commit 5b75b518e92657cb15c439895550617ca9b638cb
Author: Spiros Klouvas <spirosklouvas protonmail com>
Date: Wed Jan 15 20:36:32 2020 +0200
pitivi: Add option to use a light theme
Closes #2394.
pitivi/dialogs/prefs.py | 2 ++
pitivi/mainwindow.py | 28 +++++++++++++++++++++++-----
pitivi/utils/ui.py | 2 +-
3 files changed, 26 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/dialogs/prefs.py b/pitivi/dialogs/prefs.py
index 19e8600e..16f33621 100644
--- a/pitivi/dialogs/prefs.py
+++ b/pitivi/dialogs/prefs.py
@@ -61,6 +61,7 @@ class PreferencesDialog(Loggable):
"__plugins": _("Plugins"),
"__shortcuts": _("Shortcuts"),
"_proxies": _("Proxies"),
+ "other": _("Other"),
}
def __init__(self, app):
@@ -93,6 +94,7 @@ class PreferencesDialog(Loggable):
self.__add_proxies_section()
self.__add_shortcuts_section()
self.__add_plugin_manager_section()
+ self.add_settings_page('other')
self.__setup_css()
self.dialog.set_transient_for(app.gui)
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index a2d00b7b..00ed0aaa 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -63,6 +63,17 @@ GlobalSettings.add_config_option('lastCurrentVersion',
key='last-current-version',
default='')
+GlobalSettings.add_config_option("useDarkTheme",
+ section="user-interface",
+ key="use-dark-theme",
+ default=True,
+ notify=True)
+
+PreferencesDialog.add_toggle_preference("useDarkTheme",
+ section="other",
+ label=_("Dark Theme"),
+ description=_("Whether or not to use a dark theme."))
+
class MainWindow(Gtk.ApplicationWindow, Loggable):
"""Pitivi's main window.
@@ -75,11 +86,6 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
"""
def __init__(self, app):
- gtksettings = Gtk.Settings.get_default()
- gtksettings.set_property("gtk-application-prefer-dark-theme", True)
- theme = gtksettings.get_property("gtk-theme-name")
- os.environ["GTK_THEME"] = theme + ":dark"
-
# Pulseaudio "role"
# (http://0pointer.de/blog/projects/tagging-audio.htm)
os.environ["PULSE_PROP_media.role"] = "production"
@@ -99,12 +105,24 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
self.__perspective = None
self.__wanted_perspective = None
+ self.app.settings.connect("useDarkThemeChanged",
+ self.__use_dark_theme_changed_cb)
+ self.update_use_dark_theme()
+
app.project_manager.connect("new-project-loading",
self.__new_project_loading_cb)
app.project_manager.connect("new-project-failed",
self.__new_project_failed_cb)
app.project_manager.connect("project-closed", self.__project_closed_cb)
+ def update_use_dark_theme(self):
+ gtksettings = Gtk.Settings.get_default()
+ use_dark_theme = self.app.settings.useDarkTheme
+ gtksettings.set_property("gtk-application-prefer-dark-theme", use_dark_theme)
+
+ def __use_dark_theme_changed_cb(self, unused_settings):
+ self.update_use_dark_theme()
+
def setup_ui(self):
"""Sets up the various perspectives's UI."""
self.log("Setting up the perspectives.")
diff --git a/pitivi/utils/ui.py b/pitivi/utils/ui.py
index 848c3ae4..51b5860d 100644
--- a/pitivi/utils/ui.py
+++ b/pitivi/utils/ui.py
@@ -287,7 +287,7 @@ EDITOR_PERSPECTIVE_CSS = """
PREFERENCES_CSS = """
.sidebar list {
- background: rgb(45, 45, 45);
+ background: @content_view_bg;
}
.sidebar row {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]