From 75fd87ce61ac0c32b58c2490382a78d6d51cbfda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 11 Mar 2017 21:54:20 +0000 Subject: [PATCH] meson: gtk: generate gtk.gresource.xml --- gtk/gen-gtk-gresources-xml.py | 90 ++++++++++++ gtk/gtk.gresource.xml | 269 ---------------------------------- gtk/meson.build | 13 +- 3 files changed, 101 insertions(+), 271 deletions(-) create mode 100644 gtk/gen-gtk-gresources-xml.py delete mode 100644 gtk/gtk.gresource.xml diff --git a/gtk/gen-gtk-gresources-xml.py b/gtk/gen-gtk-gresources-xml.py new file mode 100644 index 0000000000..2f4834862e --- /dev/null +++ b/gtk/gen-gtk-gresources-xml.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python3 +# +# Generate gtk.gresources.xml +# +# Usage: gen-gtk-gresources-xml SRCDIR_GTK [OUTPUT-FILE] + +import os, sys + +srcdir = sys.argv[1] + +xml = ''' + + +''' + +def get_files(subdir,extension): + return sorted(filter(lambda x: x.endswith((extension)), os.listdir(os.path.join(srcdir,subdir)))) + +xml += ''' + theme/Adwaita/gtk.css + theme/Adwaita/gtk-dark.css + theme/Adwaita/gtk-contained.css + theme/Adwaita/gtk-contained-dark.css +''' + +for f in get_files('theme/Adwaita/assets', '.png'): + xml += ' theme/Adwaita/assets/{0}\n'.format(f) + +xml += '\n' + +for f in get_files('theme/Adwaita/assets', '.svg'): + xml += ' theme/Adwaita/assets/{0}\n'.format(f) + +xml += ''' + theme/HighContrast/gtk.css + theme/HighContrast/gtk-inverse.css + theme/HighContrast/gtk-contained.css + theme/HighContrast/gtk-contained-inverse.css +''' + +for f in get_files('theme/HighContrast/assets', '.png'): + xml += ' theme/HighContrast/assets/{0}\n'.format(f) + +xml += '\n' + +for f in get_files('theme/HighContrast/assets', '.svg'): + xml += ' theme/HighContrast/assets/{0}\n'.format(f) + +xml += ''' + theme/win32/gtk-win32-base.css + theme/win32/gtk.css +''' + +for f in get_files('cursor', '.png'): + xml += ' cursor/{0}\n'.format(f) + +xml += '\n' + +for f in get_files('gesture', '.symbolic.png'): + xml += ' gesture/{0}\n'.format(f) + +xml += '\n' + +for f in get_files('ui', '.ui'): + xml += ' ui/{0}\n'.format(f) + +xml += '\n' + +for s in ['16x16', '22x22', '24x24', '32x32', '48x48']: + for c in ['actions', 'status']: + icons_dir = 'icons/{0}/{1}'.format(s,c) + if os.path.exists(os.path.join(srcdir,icons_dir)): + for f in get_files(icons_dir, '.png'): + xml += ' icons/{0}/{1}/{2}\n'.format(s,c,f) + +for f in get_files('inspector', '.ui'): + xml += ' inspector/{0}\n'.format(f) + +xml += ''' + inspector/logo.png + +''' + +if len(sys.argv) > 2: + outfile = sys.argv[2] + f = open(outfile, 'w') + f.write(xml) + f.close() +else: + print(xml) diff --git a/gtk/gtk.gresource.xml b/gtk/gtk.gresource.xml deleted file mode 100644 index 1f9992a084..0000000000 --- a/gtk/gtk.gresource.xml +++ /dev/null @@ -1,269 +0,0 @@ - - - - theme/Raleigh/gtk-default.css - theme/Adwaita/gtk.css - theme/Adwaita/gtk-dark.css - theme/Adwaita/gtk-contained.css - theme/Adwaita/gtk-contained-dark.css - theme/Adwaita/assets/bullet-symbolic.symbolic.png - theme/Adwaita/assets/checkbox-active-selectionmode@2.png - theme/Adwaita/assets/checkbox-active-selectionmode.png - theme/Adwaita/assets/checkbox-backdrop-selectionmode@2.png - theme/Adwaita/assets/checkbox-backdrop-selectionmode.png - theme/Adwaita/assets/checkbox-checked-active-selectionmode@2.png - theme/Adwaita/assets/checkbox-checked-active-selectionmode.png - theme/Adwaita/assets/checkbox-checked-backdrop-selectionmode@2.png - theme/Adwaita/assets/checkbox-checked-backdrop-selectionmode.png - theme/Adwaita/assets/checkbox-checked-hover-selectionmode@2.png - theme/Adwaita/assets/checkbox-checked-hover-selectionmode.png - theme/Adwaita/assets/checkbox-checked-selectionmode@2.png - theme/Adwaita/assets/checkbox-checked-selectionmode.png - theme/Adwaita/assets/checkbox-hover-selectionmode@2.png - theme/Adwaita/assets/checkbox-hover-selectionmode.png - theme/Adwaita/assets/checkbox-selectionmode@2.png - theme/Adwaita/assets/checkbox-selectionmode.png - theme/Adwaita/assets/check-symbolic.symbolic.png - theme/Adwaita/assets/dash-symbolic.symbolic.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-active@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-active-dark@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-active-dark.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-active.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-backdrop@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-backdrop-dark@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-backdrop-dark.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-backdrop-insensitive@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-backdrop-insensitive-dark@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-backdrop-insensitive-dark.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-backdrop-insensitive.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-backdrop.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-dark@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-dark.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-hover@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-hover-dark@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-hover-dark.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-hover.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-insensitive@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-insensitive-dark@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-insensitive-dark.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above-insensitive.png - theme/Adwaita/assets/slider-horz-scale-has-marks-above.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-active@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-active-dark@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-active-dark.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-active.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-backdrop@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-backdrop-dark@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-backdrop-dark.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-backdrop-insensitive@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-backdrop-insensitive-dark@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-backdrop-insensitive-dark.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-backdrop-insensitive.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-backdrop.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-dark@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-dark.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-hover@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-hover-dark@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-hover-dark.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-hover.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-insensitive@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-insensitive-dark@2.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-insensitive-dark.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below-insensitive.png - theme/Adwaita/assets/slider-horz-scale-has-marks-below.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-active@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-active-dark@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-active-dark.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-active.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-backdrop@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-backdrop-dark@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-backdrop-dark.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-backdrop-insensitive@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-backdrop-insensitive-dark@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-backdrop-insensitive-dark.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-backdrop-insensitive.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-backdrop.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-dark@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-dark.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-hover@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-hover-dark@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-hover-dark.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-hover.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-insensitive@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-insensitive-dark@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-insensitive-dark.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above-insensitive.png - theme/Adwaita/assets/slider-vert-scale-has-marks-above.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-active@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-active-dark@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-active-dark.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-active.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-backdrop@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-backdrop-dark@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-backdrop-dark.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-backdrop-insensitive@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-backdrop-insensitive-dark@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-backdrop-insensitive-dark.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-backdrop-insensitive.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-backdrop.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-dark@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-dark.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-hover@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-hover-dark@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-hover-dark.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-hover.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-insensitive@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-insensitive-dark@2.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-insensitive-dark.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below-insensitive.png - theme/Adwaita/assets/slider-vert-scale-has-marks-below.png - theme/Adwaita/assets/text-select-end@2.png - theme/Adwaita/assets/text-select-end-active@2.png - theme/Adwaita/assets/text-select-end-active-dark@2.png - theme/Adwaita/assets/text-select-end-active-dark.png - theme/Adwaita/assets/text-select-end-active.png - theme/Adwaita/assets/text-select-end-dark@2.png - theme/Adwaita/assets/text-select-end-dark.png - theme/Adwaita/assets/text-select-end-hover@2.png - theme/Adwaita/assets/text-select-end-hover-dark@2.png - theme/Adwaita/assets/text-select-end-hover-dark.png - theme/Adwaita/assets/text-select-end-hover.png - theme/Adwaita/assets/text-select-end.png - theme/Adwaita/assets/text-select-start@2.png - theme/Adwaita/assets/text-select-start-active@2.png - theme/Adwaita/assets/text-select-start-active-dark@2.png - theme/Adwaita/assets/text-select-start-active-dark.png - theme/Adwaita/assets/text-select-start-active.png - theme/Adwaita/assets/text-select-start-dark@2.png - theme/Adwaita/assets/text-select-start-dark.png - theme/Adwaita/assets/text-select-start-hover@2.png - theme/Adwaita/assets/text-select-start-hover-dark@2.png - theme/Adwaita/assets/text-select-start-hover-dark.png - theme/Adwaita/assets/text-select-start-hover.png - theme/Adwaita/assets/text-select-start.png - theme/Adwaita/assets/bullet-symbolic.svg - theme/Adwaita/assets/check-symbolic.svg - theme/Adwaita/assets/dash-symbolic.svg - theme/HighContrast/gtk.css - theme/HighContrast/gtk-inverse.css - theme/HighContrast/gtk-contained.css - theme/HighContrast/gtk-contained-inverse.css - theme/HighContrast/assets/bullet-symbolic.symbolic.png - theme/HighContrast/assets/check-symbolic.symbolic.png - theme/HighContrast/assets/dash-symbolic.symbolic.png - theme/HighContrast/assets/bullet-symbolic.svg - theme/HighContrast/assets/check-symbolic.svg - theme/HighContrast/assets/dash-symbolic.svg - theme/win32/gtk-win32-base.css - theme/win32/gtk.css - cursor/dnd-ask.png - cursor/dnd-copy.png - cursor/dnd-link.png - cursor/dnd-move.png - cursor/dnd-none.png - gesture/gesture-pinch-symbolic.symbolic.png - gesture/gesture-rotate-anticlockwise-symbolic.symbolic.png - gesture/gesture-rotate-clockwise-symbolic.symbolic.png - gesture/gesture-stretch-symbolic.symbolic.png - gesture/gesture-two-finger-swipe-left-symbolic.symbolic.png - gesture/gesture-two-finger-swipe-right-symbolic.symbolic.png - ui/gtkaboutdialog.ui - ui/gtkactionbar.ui - ui/gtkappchooserdialog.ui - ui/gtkappchooserwidget.ui - ui/gtkapplication-quartz.ui - ui/gtkassistant.ui - ui/gtkcolorchooserdialog.ui - ui/gtkcoloreditor.ui - ui/gtkcombobox.ui - ui/gtkdialog.ui - ui/gtkfilechooserbutton.ui - ui/gtkfilechooserdialog.ui - ui/gtkfilechooserwidget.ui - ui/gtkfontbutton.ui - ui/gtkfontchooserdialog.ui - ui/gtkfontchooserwidget.ui - ui/gtkinfobar.ui - ui/gtklockbutton.ui - ui/gtkmessagedialog.ui - ui/gtkpagesetupunixdialog.ui - ui/gtkpathbar.ui - ui/gtkplacesviewrow.ui - ui/gtkplacesview.ui - ui/gtkprintunixdialog.ui - ui/gtkrecentchooserdefault.ui - ui/gtkscalebutton.ui - ui/gtksearchbar.ui - ui/gtksidebarrow.ui - ui/gtkstatusbar.ui - ui/gtktooltipwindow.ui - ui/gtkvolumebutton.ui - icons/16x16/actions/gtk-caps-lock-warning.png - icons/16x16/actions/gtk-color-picker.png - icons/16x16/actions/gtk-connect.png - icons/16x16/actions/gtk-convert.png - icons/16x16/actions/gtk-disconnect.png - icons/16x16/actions/gtk-edit.png - icons/16x16/actions/gtk-index.png - icons/16x16/actions/gtk-orientation-landscape.png - icons/16x16/actions/gtk-orientation-portrait.png - icons/16x16/actions/gtk-orientation-reverse-landscape.png - icons/16x16/actions/gtk-orientation-reverse-portrait.png - icons/16x16/actions/gtk-page-setup.png - icons/16x16/actions/gtk-preferences.png - icons/16x16/actions/gtk-select-color.png - icons/16x16/actions/gtk-select-font.png - icons/16x16/actions/gtk-undelete.png - icons/16x16/actions/gtk-undelete-rtl.png - icons/16x16/status/image-missing.png - icons/22x22/actions/gtk-apply.png - icons/22x22/actions/gtk-cancel.png - icons/22x22/actions/gtk-no.png - icons/22x22/actions/gtk-ok.png - icons/22x22/actions/gtk-yes.png - icons/24x24/actions/gtk-caps-lock-warning.png - icons/24x24/actions/gtk-color-picker.png - icons/24x24/actions/gtk-connect.png - icons/24x24/actions/gtk-convert.png - icons/24x24/actions/gtk-disconnect.png - icons/24x24/actions/gtk-edit.png - icons/24x24/actions/gtk-index.png - icons/24x24/actions/gtk-orientation-landscape.png - icons/24x24/actions/gtk-orientation-portrait.png - icons/24x24/actions/gtk-orientation-reverse-landscape.png - icons/24x24/actions/gtk-orientation-reverse-portrait.png - icons/24x24/actions/gtk-page-setup.png - icons/24x24/actions/gtk-preferences.png - icons/24x24/actions/gtk-select-color.png - icons/24x24/actions/gtk-select-font.png - icons/24x24/actions/gtk-undelete.png - icons/24x24/actions/gtk-undelete-rtl.png - icons/24x24/status/image-missing.png - icons/32x32/actions/gtk-dnd-multiple.png - icons/32x32/actions/gtk-dnd.png - icons/32x32/status/image-missing.png - icons/48x48/status/image-missing.png - inspector/actions.ui - inspector/css-editor.ui - inspector/css-node-tree.ui - inspector/data-list.ui - inspector/general.ui - inspector/magnifier.ui - inspector/menu.ui - inspector/misc-info.ui - inspector/object-hierarchy.ui - inspector/object-tree.ui - inspector/prop-list.ui - inspector/resource-list.ui - inspector/selector.ui - inspector/signals-list.ui - inspector/statistics.ui - inspector/visual.ui - inspector/window.ui - inspector/logo.png - - diff --git a/gtk/meson.build b/gtk/meson.build index 593117851b..0d3a93552f 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -608,10 +608,19 @@ gtk_unix_sources = files([ 'gtksearchenginetracker.c', ]) +gen_gtk_gresources_xml = find_program('gen-gtk-gresources-xml.py') +# FIXME: absolute path to work around meson bug with @OUTPUT@ etc. not being +# handled here, and also with the working dir from which the script is called. +# Hopefully all to be fixed in Meson 0.39 +outfile = '@0@/gtk.gresources.xml'.format(meson.current_build_dir()) +gtk_gresources_xml = configure_file(output : 'gtk.gresources.xml', + input : 'gtk/ui/gtkdialog.ui', # FIXME: shouldn't be needed + command : [gen_gtk_gresources_xml, meson.current_source_dir(), outfile]) + gtkresources = gnome.compile_resources( 'gtkresources', - 'gtk.gresource.xml', - source_dir: '.', + gtk_gresources_xml, + source_dir: meson.current_source_dir(), c_name: '_gtk', extra_args: '--manual-register' )