move CSS to separate file (implements #13)
This commit is contained in:
parent
826eabb729
commit
db5f5f19f0
2 changed files with 38 additions and 20 deletions
|
|
@ -51,15 +51,30 @@ class Application(Gtk.Application):
|
|||
self._settings = Gio.Settings.new(Application.SETTINGS_BASE_KEY)
|
||||
|
||||
# Signals
|
||||
self.connect('startup', self.on_startup)
|
||||
self.connect('activate', self.on_activate)
|
||||
|
||||
|
||||
def on_startup(self, app):
|
||||
self.load_css()
|
||||
|
||||
|
||||
def on_activate(self, app):
|
||||
if not self._window:
|
||||
self._window = Window(self, Application.TITLE, self._settings)
|
||||
self._window.present()
|
||||
|
||||
|
||||
def load_css(self):
|
||||
styleProvider = Gtk.CssProvider()
|
||||
styleProvider.load_from_file(Gio.File.new_for_path('data/mcg.css'))
|
||||
Gtk.StyleContext.add_provider_for_screen(
|
||||
Gdk.Screen.get_default(),
|
||||
styleProvider,
|
||||
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
|
||||
)
|
||||
|
||||
|
||||
def load_thumbnail(cache, album, size):
|
||||
cache_url = cache.create_filename(album)
|
||||
pixbuf = None
|
||||
|
|
@ -147,26 +162,6 @@ class Window(Gtk.ApplicationWindow):
|
|||
|
||||
# Properties
|
||||
self._header_bar.set_sensitive(False, False)
|
||||
styleProvider = Gtk.CssProvider()
|
||||
styleProvider.load_from_data(b"""
|
||||
.bg-texture {
|
||||
box-shadow:inset 4px 4px 10px rgba(0,0,0,0.3);
|
||||
background-image:url('data/noise-texture.png');
|
||||
}
|
||||
.no-bg {
|
||||
background:none;
|
||||
}
|
||||
.no-border {
|
||||
border:none;
|
||||
}
|
||||
iconview.view:selected,
|
||||
iconview.view:selected:focus,
|
||||
GtkIconView.cell:selected,
|
||||
GtkIconView.cell:selected:focus {
|
||||
background-color:@theme_selected_bg_color;
|
||||
}
|
||||
""")
|
||||
self.get_style_context().add_provider_for_screen(Gdk.Screen.get_default(), styleProvider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
|
||||
self.get_style_context().add_class(Window.STYLE_CLASS_BG_TEXTURE)
|
||||
self._panels[Window._PANEL_INDEX_CONNECTION].set_host(self._settings.get_string(Application.SETTING_HOST))
|
||||
self._panels[Window._PANEL_INDEX_CONNECTION].set_port(self._settings.get_int(Application.SETTING_PORT))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue