Commits (5)
......@@ -15,6 +15,3 @@ if not destdir:
print('Updating desktop database...')
call(['update-desktop-database', '-q', path.join(datadir, 'applications')])
print('Compiling GSettings schemas...')
call(['glib-compile-schemas', path.join(datadir, 'glib-2.0', 'schemas')])
......@@ -9,17 +9,6 @@
"--filesystem=xdg-pictures"
],
"modules": [
{
"name": "pictures",
"buildsystem": "meson",
"builddir": true,
"sources": [
{
"type": "dir",
"path": "."
}
]
},
{
"name" : "libhandy",
"buildsystem" : "meson",
......@@ -34,6 +23,17 @@
"url" : "https://source.puri.sm/Librem5/libhandy.git"
}
]
},
{
"name": "pictures",
"buildsystem": "meson",
"builddir": true,
"sources": [
{
"type": "dir",
"path": "."
}
]
}
]
}
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="pictures">
<schema id="com.example.pictures" path="/com.example.pictures/">
<key name="lowest-turns" type="i">
<default>0</default>
<summary>Thumbnail size</summary>
<description>
Holds the size of thumbnails in pixels.
</description>
</key>
</schema>
</schemalist>
......@@ -35,19 +35,5 @@ if appstream_util.found()
)
endif
# Ensure that the GSettings schema file is installed in the correct directory.
install_data('com.example.pictures.gschema.xml',
install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas')
)
# Validate the schema file at build time. Compilation will be done when the
# file is installed.
compile_schemas = find_program('glib-compile-schemas', required: false)
if compile_schemas.found()
test('Validate schema file', compile_schemas,
args: ['--strict', '--dry-run', meson.current_source_dir()]
)
endif
install_data('com.example.pictures.svg',
install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', 'scalable', 'apps'))
......@@ -81,7 +81,8 @@ class Application(Gtk.Application):
vexpand=True
)
self.image = Gtk.Image.new_from_icon_name('com.example.pictures', Gtk.IconSize.DIALOG)
self.image = Gtk.Image.new_from_icon_name('com.example.pictures',
Gtk.IconSize.DIALOG)
page.add(self.image)
return page
......@@ -93,13 +94,18 @@ class Application(Gtk.Application):
for name in os.listdir(pictures_dir):
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
os.path.join(pictures_dir, name),
self.thumbnail_width,
self.thumbnail_height,
True
)
self.model.append([pixbuf, name])
try:
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
os.path.join(pictures_dir, name),
self.thumbnail_width,
self.thumbnail_height,
True
)
if pixbuf:
self.model.append([pixbuf, name])
except GLib.Error:
pass
def show_details(self, view, tree_path):
......@@ -109,11 +115,16 @@ class Application(Gtk.Application):
tree_iter = self.model.get_iter(tree_path)
name = self.model.get_value(tree_iter, 1)
pixbuf = GdkPixbuf.Pixbuf.new_from_file(
os.path.join(pictures_dir, name)
)
try:
pixbuf = GdkPixbuf.Pixbuf.new_from_file(
os.path.join(pictures_dir, name)
)
if pixbuf:
self.image.set_from_pixbuf(pixbuf)
self.image.set_from_pixbuf(pixbuf)
except GLib.Error:
pass
# Show the details page and corresponding header.
self.pages.show_page(1, name)
......