From 9a540841fd5c18394456a3dfcfde721a69ed4724 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 11 Feb 2021 23:00:19 -0500 Subject: flatpak: No need to build sassc anymore We should be able to do a gtk build without rebuilding css nowadays. --- build-aux/flatpak/org.gtk.Demo4.json | 30 --------------------------- build-aux/flatpak/org.gtk.IconBrowser4.json | 30 --------------------------- build-aux/flatpak/org.gtk.WidgetFactory4.json | 30 --------------------------- 3 files changed, 90 deletions(-) diff --git a/build-aux/flatpak/org.gtk.Demo4.json b/build-aux/flatpak/org.gtk.Demo4.json index 9185fada49..7e625478ee 100644 --- a/build-aux/flatpak/org.gtk.Demo4.json +++ b/build-aux/flatpak/org.gtk.Demo4.json @@ -63,36 +63,6 @@ } ] }, - { - "name" : "libsass", - "buildsystem" : "meson", - "builddir" : true, - "config-opts" : [ - "--libdir=/app/lib" - ], - "sources" : [ - { - "type" : "git", - "url" : "https://github.com/lazka/libsass.git", - "branch" : "meson" - } - ] - }, - { - "name" : "sassc", - "buildsystem" : "meson", - "builddir" : true, - "config-opts" : [ - "--libdir=/app/lib" - ], - "sources" : [ - { - "type" : "git", - "url" : "https://github.com/lazka/sassc.git", - "branch" : "meson" - } - ] - }, { "name" : "gtk", "buildsystem" : "meson", diff --git a/build-aux/flatpak/org.gtk.IconBrowser4.json b/build-aux/flatpak/org.gtk.IconBrowser4.json index d6bce54eb8..14960965cd 100644 --- a/build-aux/flatpak/org.gtk.IconBrowser4.json +++ b/build-aux/flatpak/org.gtk.IconBrowser4.json @@ -63,36 +63,6 @@ } ] }, - { - "name" : "libsass", - "buildsystem" : "meson", - "builddir" : true, - "config-opts" : [ - "--libdir=/app/lib" - ], - "sources" : [ - { - "type" : "git", - "url" : "https://github.com/lazka/libsass.git", - "branch" : "meson" - } - ] - }, - { - "name" : "sassc", - "buildsystem" : "meson", - "builddir" : true, - "config-opts" : [ - "--libdir=/app/lib" - ], - "sources" : [ - { - "type" : "git", - "url" : "https://github.com/lazka/sassc.git", - "branch" : "meson" - } - ] - }, { "name" : "gtk", "buildsystem" : "meson", diff --git a/build-aux/flatpak/org.gtk.WidgetFactory4.json b/build-aux/flatpak/org.gtk.WidgetFactory4.json index dbaee92474..ccc2c63c99 100644 --- a/build-aux/flatpak/org.gtk.WidgetFactory4.json +++ b/build-aux/flatpak/org.gtk.WidgetFactory4.json @@ -63,36 +63,6 @@ } ] }, - { - "name" : "libsass", - "buildsystem" : "meson", - "builddir" : true, - "config-opts" : [ - "--libdir=/app/lib" - ], - "sources" : [ - { - "type" : "git", - "url" : "https://github.com/lazka/libsass.git", - "branch" : "meson" - } - ] - }, - { - "name" : "sassc", - "buildsystem" : "meson", - "builddir" : true, - "config-opts" : [ - "--libdir=/app/lib" - ], - "sources" : [ - { - "type" : "git", - "url" : "https://github.com/lazka/sassc.git", - "branch" : "meson" - } - ] - }, { "name" : "gtk", "buildsystem" : "meson", -- cgit v1.2.1 From 3aa3c21d692141515f67516756fa15c2f01d0dfe Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 11 Feb 2021 23:35:26 -0500 Subject: demos: Add devel styling Add a -Dprofile=devel meson option, and add some visual hints to the demos that you are running a nightly build. --- demos/gtk-demo/main.c | 15 ++++++++++++--- demos/gtk-demo/meson.build | 2 ++ demos/icon-browser/iconbrowserapp.c | 16 +++++++++++++--- demos/icon-browser/meson.build | 2 +- demos/meson.build | 16 ++++++++++++++++ demos/node-editor/meson.build | 2 +- demos/node-editor/node-editor-application.c | 16 +++++++++++++--- demos/print-editor/meson.build | 2 +- demos/print-editor/print-editor.c | 16 +++++++++++++--- demos/widget-factory/meson.build | 2 +- demos/widget-factory/widget-factory.c | 16 +++++++++++++--- meson_options.txt | 6 ++++++ 12 files changed, 92 insertions(+), 19 deletions(-) diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c index bb1de0d6e9..5ae00882ac 100644 --- a/demos/gtk-demo/main.c +++ b/demos/gtk-demo/main.c @@ -25,6 +25,8 @@ #include "demos.h" #include "fontify.h" +#include "demo_conf.h" + static GtkWidget *info_view; static GtkWidget *source_view; @@ -196,16 +198,20 @@ activate_about (GSimpleAction *action, gtk_get_micro_version ()); g_string_append_printf (s, "\nA link can appear here: "); - version = g_strdup_printf ("%s\nRunning against GTK %d.%d.%d", + version = g_strdup_printf ("%s%s%s\nRunning against GTK %d.%d.%d", PACKAGE_VERSION, + g_strcmp0 (PROFILE, "devel") == 0 ? "-" : "", + g_strcmp0 (PROFILE, "devel") == 0 ? VCS_TAG : "", gtk_get_major_version (), gtk_get_minor_version (), gtk_get_micro_version ()); gtk_show_about_dialog (GTK_WINDOW (gtk_application_get_active_window (app)), - "program-name", "GTK Demo", + "program-name", g_strcmp0 (PROFILE, "devel") == 0 + ? "GTK Demo (Development)" + : "GTK Demo", "version", version, - "copyright", "© 1997—2020 The GTK Team", + "copyright", "© 1997—2021 The GTK Team", "license-type", GTK_LICENSE_LGPL_2_1, "website", "http://www.gtk.org", "comments", "Program to demonstrate GTK widgets", @@ -901,6 +907,9 @@ activate (GApplication *app) window = (GtkWidget *)gtk_builder_get_object (builder, "window"); gtk_application_add_window (GTK_APPLICATION (app), GTK_WINDOW (window)); + if (g_strcmp0 (PROFILE, "devel") == 0) + gtk_widget_add_css_class (window, "devel"); + action = g_simple_action_new ("run", NULL); g_signal_connect (action, "activate", G_CALLBACK (activate_run), window); g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (action)); diff --git a/demos/gtk-demo/meson.build b/demos/gtk-demo/meson.build index 546d76d2f7..f2deff1c37 100644 --- a/demos/gtk-demo/meson.build +++ b/demos/gtk-demo/meson.build @@ -167,6 +167,8 @@ foreach flag: common_cflags endif endforeach +gtkdemo_deps += [ demo_conf_h ] + executable('gtk4-demo', sources: [demos, demos_h, extra_demo_sources, gtkdemo_resources], c_args: gtkdemo_args + demo_cflags, diff --git a/demos/icon-browser/iconbrowserapp.c b/demos/icon-browser/iconbrowserapp.c index ee55407de4..3f08c8c36a 100644 --- a/demos/icon-browser/iconbrowserapp.c +++ b/demos/icon-browser/iconbrowserapp.c @@ -4,6 +4,8 @@ #include "iconbrowserapp.h" #include "iconbrowserwin.h" +#include "demo_conf.h" + struct _IconBrowserApp { GtkApplication parent; @@ -75,16 +77,20 @@ about_activated (GSimpleAction *action, gtk_get_minor_version (), gtk_get_micro_version ()); g_string_append_printf (s, "\nIcon theme\n\t%s", icon_theme); - version = g_strdup_printf ("%s\nRunning against GTK %d.%d.%d", + version = g_strdup_printf ("%s%s%s\nRunning against GTK %d.%d.%d", PACKAGE_VERSION, + g_strcmp0 (PROFILE, "devel") == 0 ? "-" : "", + g_strcmp0 (PROFILE, "devel") == 0 ? VCS_TAG : "", gtk_get_major_version (), gtk_get_minor_version (), gtk_get_micro_version ()); gtk_show_about_dialog (GTK_WINDOW (gtk_application_get_active_window (app)), - "program-name", "GTK Icon Browser", + "program-name", g_strcmp0 (PROFILE, "devel") == 0 + ? "GTK Icon Browser (Development)" + : "GTK Icon Browser", "version", version, - "copyright", "© 1997—2020 The GTK Team", + "copyright", "© 1997—2021 The GTK Team", "license-type", GTK_LICENSE_LGPL_2_1, "website", "http://www.gtk.org", "comments", "Program to browse themed icons", @@ -129,6 +135,10 @@ icon_browser_app_activate (GApplication *app) IconBrowserWindow *win; win = icon_browser_window_new (ICON_BROWSER_APP (app)); + + if (g_strcmp0 (PROFILE, "devel") == 0) + gtk_widget_add_css_class (GTK_WIDGET (win), "devel"); + gtk_window_present (GTK_WINDOW (win)); } diff --git a/demos/icon-browser/meson.build b/demos/icon-browser/meson.build index f0a449ceeb..3922811f92 100644 --- a/demos/icon-browser/meson.build +++ b/demos/icon-browser/meson.build @@ -14,7 +14,7 @@ iconbrowser_resources = gnome.compile_resources('iconbrowser_resources', executable('gtk4-icon-browser', sources: [iconbrowser_sources, iconbrowser_resources], c_args: common_cflags, - dependencies: libgtk_dep, + dependencies: [ libgtk_dep, demo_conf_h ], include_directories: confinc, gui_app: true, link_args: extra_demo_ldflags, diff --git a/demos/meson.build b/demos/meson.build index 42590368a2..79c530f4b7 100644 --- a/demos/meson.build +++ b/demos/meson.build @@ -1,3 +1,19 @@ +demo_conf = configuration_data() +demo_conf.set_quoted('PROFILE', get_option('profile')) +demo_conf.set_quoted('VCS_TAG', '@VCS_TAG@') + +demo_conf_h = declare_dependency( + sources: vcs_tag( + command: [ 'git', 'rev-parse', '--short', 'HEAD' ], + fallback: get_option('profile') != 'default' ? 'devel' : '', + input: configure_file( + output: 'demo_conf.h.in', + configuration: demo_conf + ), + output: 'demo_conf.h' + ) +) + subdir('constraint-editor') subdir('gtk-demo') subdir('icon-browser') diff --git a/demos/node-editor/meson.build b/demos/node-editor/meson.build index 336301171b..932ec19b1c 100644 --- a/demos/node-editor/meson.build +++ b/demos/node-editor/meson.build @@ -12,7 +12,7 @@ node_editor_resources = gnome.compile_resources('node_editor_resources', executable('gtk4-node-editor', sources: [node_editor_sources, node_editor_resources], - dependencies: libgtk_dep, + dependencies: [ libgtk_dep, demo_conf_h ], include_directories: confinc, c_args: [ '-DNODE_EDITOR_SOURCE_DIR="@0@/../../testsuite/gsk/compare/"'.format(meson.current_source_dir()) diff --git a/demos/node-editor/node-editor-application.c b/demos/node-editor/node-editor-application.c index d9a5ce34de..22aa743391 100644 --- a/demos/node-editor/node-editor-application.c +++ b/demos/node-editor/node-editor-application.c @@ -23,6 +23,8 @@ #include "node-editor-window.h" +#include "demo_conf.h" + static const char *css = "textview.editor {" " color: rgb(192, 197, 206);" @@ -94,17 +96,21 @@ activate_about (GSimpleAction *action, g_string_append_printf (s, "\nRenderer\n\t%s", renderer); - version = g_strdup_printf ("%s\nRunning against GTK %d.%d.%d", + version = g_strdup_printf ("%s%s%s\nRunning against GTK %d.%d.%d", PACKAGE_VERSION, + g_strcmp0 (PROFILE, "devel") == 0 ? "-" : "", + g_strcmp0 (PROFILE, "devel") == 0 ? VCS_TAG : "", gtk_get_major_version (), gtk_get_minor_version (), gtk_get_micro_version ()); dialog = g_object_new (GTK_TYPE_ABOUT_DIALOG, "transient-for", gtk_application_get_active_window (app), - "program-name", "GTK Node Editor", + "program-name", g_strcmp0 (PROFILE, "devel") == 0 + ? "GTK Node Editor (Development)" + : "GTK Node Editor", "version", version, - "copyright", "© 2019—2020 The GTK Team", + "copyright", "© 2019—2021 The GTK Team", "license-type", GTK_LICENSE_LGPL_2_1, "website", "http://www.gtk.org", "comments", "Program to test GTK rendering", @@ -207,6 +213,10 @@ node_editor_application_activate (GApplication *app) NodeEditorWindow *win; win = node_editor_window_new (NODE_EDITOR_APPLICATION (app)); + + if (g_strcmp0 (PROFILE, "devel") == 0) + gtk_widget_add_css_class (GTK_WIDGET (win), "devel"); + gtk_window_present (GTK_WINDOW (win)); } diff --git a/demos/print-editor/meson.build b/demos/print-editor/meson.build index 4be4a6f4a6..e0dbf773d9 100644 --- a/demos/print-editor/meson.build +++ b/demos/print-editor/meson.build @@ -1,7 +1,7 @@ executable('gtk4-print-editor', sources: ['print-editor.c'], c_args: common_cflags, - dependencies: libgtk_dep, + dependencies: [ libgtk_dep, demo_conf_h ], include_directories: confinc, gui_app: true, link_args: extra_demo_ldflags, diff --git a/demos/print-editor/print-editor.c b/demos/print-editor/print-editor.c index 81dce41692..2ac806df2f 100644 --- a/demos/print-editor/print-editor.c +++ b/demos/print-editor/print-editor.c @@ -4,6 +4,8 @@ #include #include +#include "demo_conf.h" + static GtkWidget *main_window; static GFile *filename = NULL; static GtkPageSetup *page_setup = NULL; @@ -641,17 +643,21 @@ activate_about (GSimpleAction *action, g_strfreev (backends); g_free (setting); - version = g_strdup_printf ("%s\nRunning against GTK %d.%d.%d", + version = g_strdup_printf ("%s%s%s\nRunning against GTK %d.%d.%d", PACKAGE_VERSION, + g_strcmp0 (PROFILE, "devel") == 0 ? "-" : "", + g_strcmp0 (PROFILE, "devel") == 0 ? VCS_TAG : "", gtk_get_major_version (), gtk_get_minor_version (), gtk_get_micro_version ()); dialog = g_object_new (GTK_TYPE_ABOUT_DIALOG, "transient-for", main_window, - "program-name", "GTK Print Editor", + "program-name", g_strcmp0 (PROFILE, "devel") == 0 + ? "GTK Print Editor (Development)" + : "GTK Print Editor", "version", version, - "copyright", "© 2006-2020 Red Hat, Inc", + "copyright", "© 2006-2021 Red Hat, Inc", "license-type", GTK_LICENSE_LGPL_2_1, "website", "http://www.gtk.org", "comments", "Program to demonstrate GTK printing", @@ -807,6 +813,10 @@ activate (GApplication *app) GtkWidget *contents; main_window = gtk_application_window_new (GTK_APPLICATION (app)); + + if (g_strcmp0 (PROFILE, "devel") == 0) + gtk_widget_add_css_class (GTK_WIDGET (main_window), "devel"); + gtk_window_set_icon_name (GTK_WINDOW (main_window), "text-editor"); gtk_window_set_default_size (GTK_WINDOW (main_window), 400, 600); gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (main_window), TRUE); diff --git a/demos/widget-factory/meson.build b/demos/widget-factory/meson.build index e43cb72c8c..e248963e24 100644 --- a/demos/widget-factory/meson.build +++ b/demos/widget-factory/meson.build @@ -8,7 +8,7 @@ widgetfactory_resources = gnome.compile_resources('widgetfactory_resources', executable('gtk4-widget-factory', sources: ['widget-factory.c', widgetfactory_resources], c_args: common_cflags, - dependencies: libgtk_dep, + dependencies: [ libgtk_dep, demo_conf_h ], include_directories: confinc, gui_app: true, link_args: extra_demo_ldflags, diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c index 6d022bb203..ef952aca6a 100644 --- a/demos/widget-factory/widget-factory.c +++ b/demos/widget-factory/widget-factory.c @@ -25,6 +25,8 @@ #include #include +#include "demo_conf.h" + static void change_dark_state (GSimpleAction *action, GVariant *state, @@ -300,8 +302,10 @@ activate_about (GSimpleAction *action, gtk_get_micro_version ()); g_string_append_printf (s, "\nA link can appear here: "); - version = g_strdup_printf ("%s\nRunning against GTK %d.%d.%d", + version = g_strdup_printf ("%s%s%s\nRunning against GTK %d.%d.%d", PACKAGE_VERSION, + g_strcmp0 (PROFILE, "devel") == 0 ? "-" : "", + g_strcmp0 (PROFILE, "devel") == 0 ? VCS_TAG : "", gtk_get_major_version (), gtk_get_minor_version (), gtk_get_micro_version ()); @@ -309,9 +313,11 @@ activate_about (GSimpleAction *action, dialog = g_object_new (GTK_TYPE_ABOUT_DIALOG, "transient-for", gtk_application_get_active_window (app), "modal", TRUE, - "program-name", "GTK Widget Factory", + "program-name", g_strcmp0 (PROFILE, "devel") == 0 + ? "GTK Widget Factory (Development)" + : "GTK Widget Factory", "version", version, - "copyright", "© 1997—2020 The GTK Team", + "copyright", "© 1997—2021 The GTK Team", "license-type", GTK_LICENSE_LGPL_2_1, "website", "http://www.gtk.org", "comments", "Program to demonstrate GTK themes and widgets", @@ -2065,6 +2071,10 @@ activate (GApplication *app) } window = (GtkWindow *)gtk_builder_get_object (builder, "window"); + + if (g_strcmp0 (PROFILE, "devel") == 0) + gtk_widget_add_css_class (GTK_WIDGET (window), "devel"); + gtk_application_add_window (GTK_APPLICATION (app), window); g_action_map_add_action_entries (G_ACTION_MAP (window), win_entries, G_N_ELEMENTS (win_entries), diff --git a/meson_options.txt b/meson_options.txt index 71b01ec5c8..16a1cbd9fe 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -111,6 +111,12 @@ option('demos', value: 'true', description : 'Build demo programs') +option('profile', + type: 'combo', + choices: [ 'default', 'devel' ], + value: 'default', + description : 'Profile to use for demos') + option('build-examples', type: 'boolean', value: 'true', -- cgit v1.2.1 From 8d4f4af8efbed7b7d4281b26e3cf7303c9d61479 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 12 Feb 2021 00:10:30 -0500 Subject: Add devel styling to nightly flatpaks Pass -Dprofile=devel to the gtk build for our nightly flatpaks, so they pick up devel styling. --- build-aux/flatpak/org.gtk.Demo4.json | 3 ++- build-aux/flatpak/org.gtk.IconBrowser4.json | 3 ++- build-aux/flatpak/org.gtk.WidgetFactory4.json | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/build-aux/flatpak/org.gtk.Demo4.json b/build-aux/flatpak/org.gtk.Demo4.json index 7e625478ee..8efb2e9d1a 100644 --- a/build-aux/flatpak/org.gtk.Demo4.json +++ b/build-aux/flatpak/org.gtk.Demo4.json @@ -70,7 +70,8 @@ "config-opts" : [ "--libdir=/app/lib", "-Denable_vulkan=no", - "-Dbuildtype=debugoptimized" + "-Dbuildtype=debugoptimized", + "-Dprofile=devel" ], "sources" : [ { diff --git a/build-aux/flatpak/org.gtk.IconBrowser4.json b/build-aux/flatpak/org.gtk.IconBrowser4.json index 14960965cd..65bb182b43 100644 --- a/build-aux/flatpak/org.gtk.IconBrowser4.json +++ b/build-aux/flatpak/org.gtk.IconBrowser4.json @@ -70,7 +70,8 @@ "config-opts" : [ "--libdir=/app/lib", "-Denable_vulkan=no", - "-Dbuildtype=debugoptimized" + "-Dbuildtype=debugoptimized", + "-Dprofile=devel" ], "sources" : [ { diff --git a/build-aux/flatpak/org.gtk.WidgetFactory4.json b/build-aux/flatpak/org.gtk.WidgetFactory4.json index ccc2c63c99..5fd1b8a678 100644 --- a/build-aux/flatpak/org.gtk.WidgetFactory4.json +++ b/build-aux/flatpak/org.gtk.WidgetFactory4.json @@ -70,7 +70,8 @@ "config-opts" : [ "--libdir=/app/lib", "-Denable_vulkan=no", - "-Dbuildtype=debugoptimized" + "-Dbuildtype=debugoptimized", + "-Dprofile=devel" ], "sources" : [ { -- cgit v1.2.1 From 3e426e4c5b3a38ab57e182b947e9b10849a8470b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 12 Feb 2021 00:26:10 -0500 Subject: flatpak: Try harder to disable sassc --- build-aux/flatpak/org.gtk.Demo4.json | 1 + build-aux/flatpak/org.gtk.IconBrowser4.json | 1 + build-aux/flatpak/org.gtk.WidgetFactory4.json | 1 + 3 files changed, 3 insertions(+) diff --git a/build-aux/flatpak/org.gtk.Demo4.json b/build-aux/flatpak/org.gtk.Demo4.json index 8efb2e9d1a..b987981577 100644 --- a/build-aux/flatpak/org.gtk.Demo4.json +++ b/build-aux/flatpak/org.gtk.Demo4.json @@ -70,6 +70,7 @@ "config-opts" : [ "--libdir=/app/lib", "-Denable_vulkan=no", + "-Dsassc=disabled", "-Dbuildtype=debugoptimized", "-Dprofile=devel" ], diff --git a/build-aux/flatpak/org.gtk.IconBrowser4.json b/build-aux/flatpak/org.gtk.IconBrowser4.json index 65bb182b43..580e4e7af9 100644 --- a/build-aux/flatpak/org.gtk.IconBrowser4.json +++ b/build-aux/flatpak/org.gtk.IconBrowser4.json @@ -70,6 +70,7 @@ "config-opts" : [ "--libdir=/app/lib", "-Denable_vulkan=no", + "-Dsassc=disabled", "-Dbuildtype=debugoptimized", "-Dprofile=devel" ], diff --git a/build-aux/flatpak/org.gtk.WidgetFactory4.json b/build-aux/flatpak/org.gtk.WidgetFactory4.json index 5fd1b8a678..138a6c73b5 100644 --- a/build-aux/flatpak/org.gtk.WidgetFactory4.json +++ b/build-aux/flatpak/org.gtk.WidgetFactory4.json @@ -70,6 +70,7 @@ "config-opts" : [ "--libdir=/app/lib", "-Denable_vulkan=no", + "-Dsassc=disabled", "-Dbuildtype=debugoptimized", "-Dprofile=devel" ], -- cgit v1.2.1