mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
apprt/gtk: stylistic changes to adwaita init
This commit is contained in:
@ -103,13 +103,23 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
|
||||
};
|
||||
|
||||
// Create our GTK Application which encapsulates our process.
|
||||
log.debug("creating GTK application id={s} single-instance={}", .{
|
||||
const app: *c.GtkApplication = app: {
|
||||
const adwaita = build_options.libadwaita and config.@"gtk-adwaita";
|
||||
|
||||
log.debug("creating GTK application id={s} single-instance={} adwaita={}", .{
|
||||
app_id,
|
||||
single_instance,
|
||||
adwaita,
|
||||
});
|
||||
|
||||
const app: *c.GtkApplication = app: {
|
||||
if (build_options.libadwaita and config.@"gtk-adwaita") {
|
||||
// If not libadwaita, create a standard GTK application.
|
||||
if (!adwaita) break :app @as(?*c.GtkApplication, @ptrCast(c.gtk_application_new(
|
||||
app_id.ptr,
|
||||
app_flags,
|
||||
))) orelse return error.GtkInitFailed;
|
||||
|
||||
// Use libadwaita if requested. Using an AdwApplication lets us use
|
||||
// Adwaita widgets and access things such as the color scheme.
|
||||
const adw_app = @as(?*c.AdwApplication, @ptrCast(c.adw_application_new(
|
||||
app_id.ptr,
|
||||
app_flags,
|
||||
@ -126,14 +136,6 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
|
||||
);
|
||||
|
||||
break :app @ptrCast(adw_app);
|
||||
} else {
|
||||
const app = @as(?*c.GtkApplication, @ptrCast(c.gtk_application_new(
|
||||
app_id.ptr,
|
||||
app_flags,
|
||||
))) orelse return error.GtkInitFailed;
|
||||
|
||||
break :app app;
|
||||
}
|
||||
};
|
||||
|
||||
errdefer c.g_object_unref(app);
|
||||
|
Reference in New Issue
Block a user