minor style changes

This commit is contained in:
Mitchell Hashimoto
2024-03-28 14:45:44 -07:00
parent 9f0468f950
commit b6f5970264
2 changed files with 6 additions and 18 deletions

View File

@ -1172,7 +1172,10 @@ fn addDeps(
const wf = b.addWriteFiles(); const wf = b.addWriteFiles();
const gresource_xml = wf.add( const gresource_xml = wf.add(
"gresource.xml", "gresource.xml",
if (config.libadwaita) gresource.gresource_xml_libadwaita else gresource.gresource_xml_gtk, if (config.libadwaita)
gresource.gresource_xml_libadwaita
else
gresource.gresource_xml_gtk,
); );
const generate_resources_c = b.addSystemCommand(&.{ const generate_resources_c = b.addSystemCommand(&.{
@ -1182,17 +1185,10 @@ fn addDeps(
"--generate-source", "--generate-source",
"--target", "--target",
}); });
const ghostty_resources_c = generate_resources_c.addOutputFileArg("ghostty_resources.c"); const ghostty_resources_c = generate_resources_c.addOutputFileArg("ghostty_resources.c");
generate_resources_c.addFileArg(gresource_xml); generate_resources_c.addFileArg(gresource_xml);
generate_resources_c.extra_file_dependencies = if (config.libadwaita) &gresource.dependencies_libadwaita else &gresource.dependencies_gtk; generate_resources_c.extra_file_dependencies = if (config.libadwaita) &gresource.dependencies_libadwaita else &gresource.dependencies_gtk;
step.addCSourceFile(.{ .file = ghostty_resources_c, .flags = &.{} });
step.addCSourceFile(.{
.file = ghostty_resources_c,
.flags = &.{},
});
const generate_resources_h = b.addSystemCommand(&.{ const generate_resources_h = b.addSystemCommand(&.{
"glib-compile-resources", "glib-compile-resources",
@ -1201,13 +1197,9 @@ fn addDeps(
"--generate-header", "--generate-header",
"--target", "--target",
}); });
const ghostty_resources_h = generate_resources_h.addOutputFileArg("ghostty_resources.h"); const ghostty_resources_h = generate_resources_h.addOutputFileArg("ghostty_resources.h");
generate_resources_h.addFileArg(gresource_xml); generate_resources_h.addFileArg(gresource_xml);
generate_resources_h.extra_file_dependencies = if (config.libadwaita) &gresource.dependencies_libadwaita else &gresource.dependencies_gtk; generate_resources_h.extra_file_dependencies = if (config.libadwaita) &gresource.dependencies_libadwaita else &gresource.dependencies_gtk;
step.addIncludePath(ghostty_resources_h.dirname()); step.addIncludePath(ghostty_resources_h.dirname());
} }
}, },

View File

@ -151,16 +151,12 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
break :app @ptrCast(adw_app); break :app @ptrCast(adw_app);
}; };
errdefer c.g_object_unref(app); errdefer c.g_object_unref(app);
const gapp = @as(*c.GApplication, @ptrCast(app)); const gapp = @as(*c.GApplication, @ptrCast(app));
// force the resource path to a known value so that it doesn't depend on // force the resource path to a known value so that it doesn't depend on
// the app id // the app id and load in compiled resources
c.g_application_set_resource_base_path(gapp, "/com/mitchellh/ghostty"); c.g_application_set_resource_base_path(gapp, "/com/mitchellh/ghostty");
// load compiled-in resources
c.g_resources_register(c.ghostty_get_resource()); c.g_resources_register(c.ghostty_get_resource());
// The `activate` signal is used when Ghostty is first launched and when a // The `activate` signal is used when Ghostty is first launched and when a