From 26cba70b692f297ab6b4b9601261fdbc5d311e98 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 26 Sep 2024 08:34:07 -0700 Subject: [PATCH] core: no need for hasTabs apprt function --- src/Surface.zig | 21 --------------------- src/apprt/gtk/Surface.zig | 5 ----- src/apprt/gtk/Window.zig | 5 ----- 3 files changed, 31 deletions(-) diff --git a/src/Surface.zig b/src/Surface.zig index 72b5a7060..c8a50239e 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -3670,39 +3670,18 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool }, .previous_tab => { - if (@hasDecl(apprt.Surface, "hasTabs")) { - if (!self.rt_surface.hasTabs()) { - log.debug("surface has no tabs, ignoring previous_tab binding", .{}); - return false; - } - } - if (@hasDecl(apprt.Surface, "gotoTab")) { self.rt_surface.gotoTab(.previous); } else log.warn("runtime doesn't implement gotoTab", .{}); }, .next_tab => { - if (@hasDecl(apprt.Surface, "hasTabs")) { - if (!self.rt_surface.hasTabs()) { - log.debug("surface has no tabs, ignoring next_tab binding", .{}); - return false; - } - } - if (@hasDecl(apprt.Surface, "gotoTab")) { self.rt_surface.gotoTab(.next); } else log.warn("runtime doesn't implement gotoTab", .{}); }, .last_tab => { - if (@hasDecl(apprt.Surface, "hasTabs")) { - if (!self.rt_surface.hasTabs()) { - log.debug("surface has no tabs, ignoring last_tab binding", .{}); - return false; - } - } - if (@hasDecl(apprt.Surface, "gotoTab")) { self.rt_surface.gotoTab(.last); } else log.warn("runtime doesn't implement gotoTab", .{}); diff --git a/src/apprt/gtk/Surface.zig b/src/apprt/gtk/Surface.zig index c1146d348..caa4653f0 100644 --- a/src/apprt/gtk/Surface.zig +++ b/src/apprt/gtk/Surface.zig @@ -790,11 +790,6 @@ pub fn newTab(self: *Surface) !void { try window.newTab(&self.core_surface); } -pub fn hasTabs(self: *const Surface) bool { - const window = self.container.window() orelse return false; - return window.hasTabs(); -} - pub fn gotoTab(self: *Surface, tab: apprt.GotoTab) void { const window = self.container.window() orelse { log.info( diff --git a/src/apprt/gtk/Window.zig b/src/apprt/gtk/Window.zig index efb0d2ea4..b6f896592 100644 --- a/src/apprt/gtk/Window.zig +++ b/src/apprt/gtk/Window.zig @@ -421,11 +421,6 @@ pub fn closeTab(self: *Window, tab: *Tab) void { self.notebook.closeTab(tab); } -/// Returns true if this window has any tabs. -pub fn hasTabs(self: *const Window) bool { - return self.notebook.nPages() > 0; -} - /// Go to the previous tab for a surface. pub fn gotoPreviousTab(self: *Window, surface: *Surface) void { const tab = surface.container.tab() orelse {