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
23
data/mcg.css
Normal file
23
data/mcg.css
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
.bg-texture {
|
||||||
|
box-shadow:inset 4px 4px 10px rgba(0,0,0,0.3);
|
||||||
|
background-image:url('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;
|
||||||
|
}
|
||||||
|
|
||||||
|
iconview.view:hover {
|
||||||
|
-gtk-icon-effect:highlight;
|
||||||
|
}
|
||||||
|
|
@ -51,15 +51,30 @@ class Application(Gtk.Application):
|
||||||
self._settings = Gio.Settings.new(Application.SETTINGS_BASE_KEY)
|
self._settings = Gio.Settings.new(Application.SETTINGS_BASE_KEY)
|
||||||
|
|
||||||
# Signals
|
# Signals
|
||||||
|
self.connect('startup', self.on_startup)
|
||||||
self.connect('activate', self.on_activate)
|
self.connect('activate', self.on_activate)
|
||||||
|
|
||||||
|
|
||||||
|
def on_startup(self, app):
|
||||||
|
self.load_css()
|
||||||
|
|
||||||
|
|
||||||
def on_activate(self, app):
|
def on_activate(self, app):
|
||||||
if not self._window:
|
if not self._window:
|
||||||
self._window = Window(self, Application.TITLE, self._settings)
|
self._window = Window(self, Application.TITLE, self._settings)
|
||||||
self._window.present()
|
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):
|
def load_thumbnail(cache, album, size):
|
||||||
cache_url = cache.create_filename(album)
|
cache_url = cache.create_filename(album)
|
||||||
pixbuf = None
|
pixbuf = None
|
||||||
|
|
@ -147,26 +162,6 @@ class Window(Gtk.ApplicationWindow):
|
||||||
|
|
||||||
# Properties
|
# Properties
|
||||||
self._header_bar.set_sensitive(False, False)
|
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.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_host(self._settings.get_string(Application.SETTING_HOST))
|
||||||
self._panels[Window._PANEL_INDEX_CONNECTION].set_port(self._settings.get_int(Application.SETTING_PORT))
|
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