diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..677477f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +# EditorConfig +root = true + +# elementary defaults +[*] +charset = utf-8 +end_of_line = lf +indent_size = tab +indent_style = space +insert_final_newline = true +max_line_length = 80 +tab_width = 4 + +# Markup files +[{*.html,*.xml,*.xml.in,*.yml}] +tab_width = 2 diff --git a/data/com.github.mohelm97.screenrecorder.gresource.xml b/data/com.github.mohelm97.screenrecorder.gresource.xml index 82f644e..f299ca5 100644 --- a/data/com.github.mohelm97.screenrecorder.gresource.xml +++ b/data/com.github.mohelm97.screenrecorder.gresource.xml @@ -1,8 +1,8 @@ - + - grab-area-symbolic.svg - grab-screen-symbolic.svg - grab-window-symbolic.svg + icons/symbolic/grab-area-symbolic.svg + icons/symbolic/grab-screen-symbolic.svg + icons/symbolic/grab-window-symbolic.svg - \ No newline at end of file + diff --git a/data/grab-area-symbolic.svg b/data/icons/symbolic/grab-area-symbolic.svg similarity index 100% rename from data/grab-area-symbolic.svg rename to data/icons/symbolic/grab-area-symbolic.svg diff --git a/data/grab-screen-symbolic.svg b/data/icons/symbolic/grab-screen-symbolic.svg similarity index 100% rename from data/grab-screen-symbolic.svg rename to data/icons/symbolic/grab-screen-symbolic.svg diff --git a/data/grab-window-symbolic.svg b/data/icons/symbolic/grab-window-symbolic.svg similarity index 100% rename from data/grab-window-symbolic.svg rename to data/icons/symbolic/grab-window-symbolic.svg diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 0000000..919ecf0 --- /dev/null +++ b/data/meson.build @@ -0,0 +1,34 @@ +icon_sizes = ['32', '48', '64', '128'] + +foreach i : icon_sizes + install_data( + join_paths('icons', i, meson.project_name() + '.svg'), + install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', i + 'x' + i, 'apps') + ) + install_data( + join_paths('icons', i, meson.project_name() + '.svg'), + install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', i + 'x' + i + '@2', 'apps') + ) +endforeach + +i18n.merge_file( + input: meson.project_name() + '.desktop.in', + output: meson.project_name() + '.desktop', + po_dir: join_paths(meson.source_root(), 'po'), + type: 'desktop', + install: true, + install_dir: join_paths(get_option('datadir'), 'applications') +) + +i18n.merge_file( + input: meson.project_name() + '.appdata.xml.in', + output: meson.project_name() + '.appdata.xml', + po_dir: join_paths(meson.source_root(), 'po'), + install: true, + install_dir: join_paths(get_option('datadir'), 'metainfo') +) + +install_data( + meson.project_name() + '.gschema.xml', + install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas') +) diff --git a/meson.build b/meson.build index 1f34c4c..31c5436 100644 --- a/meson.build +++ b/meson.build @@ -1,20 +1,19 @@ -# project name and programming language -project('com.github.mohelm97.screenrecorder', 'vala', 'c') -# Include the translations module -i18n = import('i18n') -gnome = import('gnome') +project('com.github.mohelm97.screenrecorder', 'vala', 'c', version: '0.2.1') -# Set our translation domain -add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format (meson.project_name()), language:'c') +gnome = import('gnome') +i18n = import('i18n') -icon_res = gnome.compile_resources( - 'screenrecorder-icon-resources', - 'data/' + meson.project_name() + '.gresource.xml', - source_dir: 'data' +add_project_arguments( + '-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()), + language: 'c' ) -# Adding deps -message ('Listing dependencies') +asresources = gnome.compile_resources( + 'as-resources', + join_paths('data', meson.project_name()) + '.gresource.xml', + source_dir: 'data', + c_name: 'as' +) dependencies = [ dependency('gee-0.8'), @@ -27,56 +26,17 @@ dependencies = [ dependency('clutter-gtk-1.0') ] -# Create a new executable, list the files we want to compile, list the dependencies we need, and install +subdir('src') + executable( meson.project_name(), - icon_res, - 'src/Application.vala', - 'src/MainWindow.vala', - 'src/FFmpegWrapper.vala', - 'src/SaveDialog.vala', - 'src/Widgets/SelectionArea.vala', - 'src/Widgets/VideoPlayer.vala', - 'src/Widgets/FormatComboBox.vala', - 'src/Widgets/ScaleComboBox.vala', - 'src/Utils/KeybindingManager.vala', + asresources, + sources, dependencies: dependencies, install: true ) -#Translate and install our .desktop file -i18n.merge_file( - input: join_paths('data', meson.project_name() + '.desktop.in'), - output: meson.project_name() + '.desktop', - po_dir: join_paths(meson.source_root(), 'po'), - type: 'desktop', - install: true, - install_dir: join_paths(get_option('datadir'), 'applications') -) - -#Translate and install our .appdata file -i18n.merge_file( - input: join_paths('data', meson.project_name() + '.appdata.xml.in'), - output: meson.project_name() + '.appdata.xml', - po_dir: join_paths(meson.source_root(), 'po'), - install: true, - install_dir: join_paths(get_option('datadir'), 'metainfo') -) - -install_data( - join_paths('data', meson.project_name() + '.gschema.xml'), - install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas') -) - -#Install Icons -icon_sizes = ['32', '48', '64', '128'] - -foreach i : icon_sizes - install_data( - join_paths('data/icons', i, 'com.github.mohelm97.screenrecorder.svg'), - install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', i + 'x' + i, 'apps') - ) -endforeach - +subdir('data') subdir('po') + meson.add_install_script('meson/post_install.py') diff --git a/meson/post_install.py b/meson/post_install.py old mode 100644 new mode 100755 index 579b7e4..64a5225 --- a/meson/post_install.py +++ b/meson/post_install.py @@ -1,24 +1,17 @@ #!/usr/bin/env python3 -import os +from os import path, environ import subprocess -prefix = os.environ.get('MESON_INSTALL_PREFIX', '/usr/local') -datadir = os.path.join(prefix, 'share') -schemadir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'glib-2.0', 'schemas') +prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local') +schemadir = path.join(environ['MESON_INSTALL_PREFIX'], 'share', 'glib-2.0', 'schemas') +datadir = path.join(prefix, 'share') +desktop_database_dir = path.join(datadir, 'applications') -if not os.environ.get('DESTDIR'): - print('Compiling gsettings schemas...') +if not environ.get('DESTDIR'): + print('Compiling gsettings schemas…') subprocess.call(['glib-compile-schemas', schemadir]) - - print('Updating icon cache...') - icon_cache_dir = os.path.join(datadir, 'icons', 'hicolor') - if not os.path.exists(icon_cache_dir): - os.makedirs(icon_cache_dir) - subprocess.call(['gtk-update-icon-cache', '-qtf', icon_cache_dir]) - - print('Updating desktop database...') - desktop_database_dir = os.path.join(datadir, 'applications') - if not os.path.exists(desktop_database_dir): - os.makedirs(desktop_database_dir) + print('Updating desktop database…') subprocess.call(['update-desktop-database', '-q', desktop_database_dir]) + print('Updating icon cache…') + subprocess.call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')]) diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..869ee60 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,11 @@ +sources = files( + 'Application.vala', + 'MainWindow.vala', + 'FFmpegWrapper.vala', + 'SaveDialog.vala', + 'Widgets/SelectionArea.vala', + 'Widgets/VideoPlayer.vala', + 'Widgets/FormatComboBox.vala', + 'Widgets/ScaleComboBox.vala', + 'Utils/KeybindingManager.vala' +)