Skip to content

Commit

Permalink
Add an option to disable log window auto show (#2342)
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksiy-Yakovenko committed Nov 16, 2024
1 parent 059640b commit a6291ab
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 32 deletions.
16 changes: 0 additions & 16 deletions osx/deadbeef.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21592,7 +21592,6 @@
CLANG_ENABLE_MODULES = YES;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
EXCLUDED_ARCHS = arm64;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "../plugins/cocoaui/deadbeef-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
Expand Down Expand Up @@ -21640,7 +21639,6 @@
CLANG_ENABLE_MODULES = YES;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
EXCLUDED_ARCHS = arm64;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "../plugins/cocoaui/deadbeef-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
Expand Down Expand Up @@ -22468,7 +22466,6 @@
DYLIB_CURRENT_VERSION = 1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
EXCLUDED_ARCHS = arm64;
EXECUTABLE_PREFIX = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -22515,7 +22512,6 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
EXCLUDED_ARCHS = arm64;
EXECUTABLE_PREFIX = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -22802,7 +22798,6 @@
DYLIB_CURRENT_VERSION = 1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
EXCLUDED_ARCHS = arm64;
EXECUTABLE_PREFIX = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -22853,7 +22848,6 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
EXCLUDED_ARCHS = arm64;
EXECUTABLE_PREFIX = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -23208,7 +23202,6 @@
DYLIB_CURRENT_VERSION = 1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
EXCLUDED_ARCHS = arm64;
EXECUTABLE_PREFIX = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -23272,7 +23265,6 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
EXCLUDED_ARCHS = arm64;
EXECUTABLE_PREFIX = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -23318,7 +23310,6 @@
CLANG_ENABLE_MODULES = YES;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
EXCLUDED_ARCHS = arm64;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "../plugins/cocoaui/deadbeef-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
Expand Down Expand Up @@ -23367,7 +23358,6 @@
CLANG_ENABLE_MODULES = YES;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
EXCLUDED_ARCHS = arm64;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "../plugins/cocoaui/deadbeef-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
Expand Down Expand Up @@ -23533,7 +23523,6 @@
DYLIB_CURRENT_VERSION = 1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
EXCLUDED_ARCHS = arm64;
EXECUTABLE_PREFIX = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -23597,7 +23586,6 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
EXCLUDED_ARCHS = arm64;
EXECUTABLE_PREFIX = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -23747,7 +23735,6 @@
DYLIB_CURRENT_VERSION = 1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
EXCLUDED_ARCHS = arm64;
EXECUTABLE_PREFIX = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -23798,7 +23785,6 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
EXCLUDED_ARCHS = arm64;
EXECUTABLE_PREFIX = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -23834,7 +23820,6 @@
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
EXCLUDED_ARCHS = arm64;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
Expand Down Expand Up @@ -23871,7 +23856,6 @@
DEAD_CODE_STRIPPING = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
EXCLUDED_ARCHS = arm64;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../include\"";
Expand Down
4 changes: 2 additions & 2 deletions osx/xcodeconfig/gtk2.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
// Configuration settings file format documentation can be found at:
// https://help.apple.com/xcode/#/dev745c5c974

GTK2_CFLAGS = -I/usr/local/Cellar/gtk+/2.24.33_2/include/gtk-2.0 -I/usr/local/Cellar/gtk+/2.24.33_2/lib/gtk-2.0/include -I/usr/local/Cellar/pango/1.52.2/include/pango-1.0 -I/usr/local/Cellar/harfbuzz/8.4.0/include/harfbuzz -I/usr/local/Cellar/pango/1.52.2/include/pango-1.0 -I/usr/local/Cellar/fribidi/1.0.13/include/fribidi -I/usr/local/Cellar/harfbuzz/8.4.0/include/harfbuzz -I/usr/local/Cellar/graphite2/1.3.14/include -I/usr/local/Cellar/cairo/1.18.0/include -I/usr/local/Cellar/at-spi2-core/2.52.0/include/atk-1.0 -I/usr/local/Cellar/cairo/1.18.0/include/cairo -I/usr/local/Cellar/fontconfig/2.15.0/include -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/libxext/1.3.6/include -I/usr/local/Cellar/libxrender/0.9.11/include -I/usr/local/Cellar/libx11/1.8.9/include -I/usr/local/Cellar/libxcb/1.17.0/include -I/usr/local/Cellar/libxau/1.0.11/include -I/usr/local/Cellar/libxdmcp/1.1.5/include -I/usr/local/Cellar/pixman/0.42.2/include/pixman-1 -I/usr/local/Cellar/gdk-pixbuf/2.42.11/include/gdk-pixbuf-2.0 -I/usr/local/opt/libpng/include/libpng16 -I/usr/local/Cellar/libtiff/4.6.0/include -I/usr/local/opt/zstd/include -I/usr/local/Cellar/xz/5.4.6/include -I/usr/local/Cellar/jpeg-turbo/3.0.2/include -I/usr/local/Cellar/glib/2.80.0_2/include -I/usr/local/Cellar/glib/2.80.0_2/include/glib-2.0 -I/usr/local/Cellar/glib/2.80.0_2/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre2/10.43/include -I/usr/local/Cellar/xorgproto/2024.1/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/ffi
GTK2_CFLAGS = -I/opt/homebrew/Cellar/gtk+/2.24.33_2/include/gtk-2.0 -I/opt/homebrew/Cellar/gtk+/2.24.33_2/lib/gtk-2.0/include -I/opt/homebrew/Cellar/pango/1.54.0/include/pango-1.0 -I/opt/homebrew/Cellar/fribidi/1.0.16/include/fribidi -I/opt/homebrew/Cellar/harfbuzz/10.1.0/include/harfbuzz -I/opt/homebrew/Cellar/graphite2/1.3.14/include -I/opt/homebrew/Cellar/cairo/1.18.2/include -I/opt/homebrew/Cellar/at-spi2-core/2.54.0/include/atk-1.0 -I/opt/homebrew/Cellar/cairo/1.18.2/include/cairo -I/opt/homebrew/Cellar/fontconfig/2.15.0/include -I/opt/homebrew/opt/freetype/include/freetype2 -I/opt/homebrew/Cellar/libxext/1.3.6/include -I/opt/homebrew/Cellar/xorgproto/2024.1/include -I/opt/homebrew/Cellar/libxrender/0.9.11/include -I/opt/homebrew/Cellar/libx11/1.8.10/include -I/opt/homebrew/Cellar/libxcb/1.17.0/include -I/opt/homebrew/Cellar/libxau/1.0.11/include -I/opt/homebrew/Cellar/libxdmcp/1.1.5/include -I/opt/homebrew/Cellar/pixman/0.44.0/include/pixman-1 -I/opt/homebrew/Cellar/gdk-pixbuf/2.42.12/include/gdk-pixbuf-2.0 -I/opt/homebrew/opt/libpng/include/libpng16 -I/opt/homebrew/Cellar/libtiff/4.7.0/include -I/opt/homebrew/opt/zstd/include -I/opt/homebrew/Cellar/xz/5.6.3/include -I/opt/homebrew/Cellar/jpeg-turbo/3.0.4/include -I/opt/homebrew/Cellar/glib/2.82.2/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/ffi -I/opt/homebrew/Cellar/glib/2.82.2/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.82.2/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre2/10.44/include

GTK2_LDFLAGS = -L/usr/local/Cellar/gtk+/2.24.33_2/lib -L/usr/local/Cellar/pango/1.52.2/lib -L/usr/local/Cellar/harfbuzz/8.4.0/lib -L/usr/local/Cellar/at-spi2-core/2.52.0/lib -L/usr/local/Cellar/cairo/1.18.0/lib -L/usr/local/Cellar/gdk-pixbuf/2.42.11/lib -L/usr/local/Cellar/glib/2.80.0_2/lib -L/usr/local/opt/gettext/lib -lgtk-quartz-2.0 -lgdk-quartz-2.0 -framework Cocoa -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -framework CoreFoundation -framework ApplicationServices -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl
GTK2_LDFLAGS = -L/opt/homebrew/Cellar/gtk+/2.24.33_2/lib -lgtk-quartz-2.0 -lgdk-quartz-2.0 -framework Cocoa -L/opt/homebrew/Cellar/pango/1.54.0/lib -lpangocairo-1.0 -lpango-1.0 -L/opt/homebrew/Cellar/harfbuzz/10.1.0/lib -lharfbuzz -framework CoreFoundation -framework ApplicationServices -L/opt/homebrew/Cellar/at-spi2-core/2.54.0/lib -latk-1.0 -L/opt/homebrew/Cellar/cairo/1.18.2/lib -lcairo -L/opt/homebrew/Cellar/gdk-pixbuf/2.42.12/lib -lgdk_pixbuf-2.0 -L/opt/homebrew/Cellar/glib/2.82.2/lib -lgio-2.0 -lgobject-2.0 -lglib-2.0 -L/opt/homebrew/opt/gettext/lib -lintl
5 changes: 2 additions & 3 deletions osx/xcodeconfig/gtk3.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// Configuration settings file format documentation can be found at:
// https://help.apple.com/xcode/#/dev745c5c974

GTK3_CFLAGS = -I/usr/local/Cellar/gtk+3/3.24.41/include/gtk-3.0 -I/usr/local/Cellar/glib/2.80.0_2/include/gio-unix-2.0 -I/usr/local/Cellar/cairo/1.18.0/include -I/usr/local/Cellar/libepoxy/1.5.10/include -I/usr/local/Cellar/pango/1.52.2/include/pango-1.0 -I/usr/local/Cellar/harfbuzz/8.4.0/include/harfbuzz -I/usr/local/Cellar/pango/1.52.2/include/pango-1.0 -I/usr/local/Cellar/fribidi/1.0.13/include/fribidi -I/usr/local/Cellar/harfbuzz/8.4.0/include/harfbuzz -I/usr/local/Cellar/graphite2/1.3.14/include -I/usr/local/Cellar/at-spi2-core/2.52.0/include/atk-1.0 -I/usr/local/Cellar/cairo/1.18.0/include/cairo -I/usr/local/Cellar/fontconfig/2.15.0/include -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/libxext/1.3.6/include -I/usr/local/Cellar/libxrender/0.9.11/include -I/usr/local/Cellar/libx11/1.8.9/include -I/usr/local/Cellar/libxcb/1.17.0/include -I/usr/local/Cellar/libxau/1.0.11/include -I/usr/local/Cellar/libxdmcp/1.1.5/include -I/usr/local/Cellar/pixman/0.42.2/include/pixman-1 -I/usr/local/Cellar/gdk-pixbuf/2.42.11/include/gdk-pixbuf-2.0 -I/usr/local/opt/libpng/include/libpng16 -I/usr/local/Cellar/libtiff/4.6.0/include -I/usr/local/opt/zstd/include -I/usr/local/Cellar/xz/5.4.6/include -I/usr/local/Cellar/jpeg-turbo/3.0.2/include -I/usr/local/Cellar/glib/2.80.0_2/include -I/usr/local/Cellar/glib/2.80.0_2/include/glib-2.0 -I/usr/local/Cellar/glib/2.80.0_2/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre2/10.43/include -I/usr/local/Cellar/xorgproto/2024.1/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/ffi

GTK3_LDFLAGS = -L/usr/local/Cellar/gtk+3/3.24.41/lib -L/usr/local/Cellar/pango/1.52.2/lib -L/usr/local/Cellar/harfbuzz/8.4.0/lib -L/usr/local/Cellar/at-spi2-core/2.52.0/lib -L/usr/local/Cellar/cairo/1.18.0/lib -L/usr/local/Cellar/gdk-pixbuf/2.42.11/lib -L/usr/local/Cellar/glib/2.80.0_2/lib -L/usr/local/opt/gettext/lib -lgtk-3 -lgdk-3 -Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,CoreGraphics -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl
GTK3_CFLAGS = -I/opt/homebrew/Cellar/gtk+3/3.24.43/include/gtk-3.0 -I/opt/homebrew/Cellar/pango/1.54.0/include/pango-1.0 -I/opt/homebrew/Cellar/harfbuzz/10.1.0/include/harfbuzz -I/opt/homebrew/Cellar/graphite2/1.3.14/include -I/opt/homebrew/Cellar/cairo/1.18.2/include -I/opt/homebrew/Cellar/cairo/1.18.2/include/cairo -I/opt/homebrew/Cellar/fontconfig/2.15.0/include -I/opt/homebrew/opt/freetype/include/freetype2 -I/opt/homebrew/Cellar/libxext/1.3.6/include -I/opt/homebrew/Cellar/xorgproto/2024.1/include -I/opt/homebrew/Cellar/libxrender/0.9.11/include -I/opt/homebrew/Cellar/libx11/1.8.10/include -I/opt/homebrew/Cellar/libxcb/1.17.0/include -I/opt/homebrew/Cellar/libxau/1.0.11/include -I/opt/homebrew/Cellar/libxdmcp/1.1.5/include -I/opt/homebrew/Cellar/pixman/0.44.0/include/pixman-1 -I/opt/homebrew/Cellar/gdk-pixbuf/2.42.12/include/gdk-pixbuf-2.0 -I/opt/homebrew/opt/libpng/include/libpng16 -I/opt/homebrew/Cellar/libtiff/4.7.0/include -I/opt/homebrew/opt/zstd/include -I/opt/homebrew/Cellar/xz/5.6.3/include -I/opt/homebrew/Cellar/jpeg-turbo/3.0.4/include -I/opt/homebrew/Cellar/at-spi2-core/2.54.0/include/atk-1.0 -I/opt/homebrew/Cellar/libepoxy/1.5.10/include -I/opt/homebrew/Cellar/fribidi/1.0.16/include/fribidi -I/opt/homebrew/Cellar/glib/2.82.2/include/gio-unix-2.0 -I/opt/homebrew/Cellar/glib/2.82.2/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/ffi -I/opt/homebrew/Cellar/glib/2.82.2/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.82.2/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre2/10.44/include

GTK3_LDFLAGS = -L/opt/homebrew/Cellar/gtk+3/3.24.43/lib -lgtk-3 -lgdk-3 -Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,CoreGraphics -L/opt/homebrew/Cellar/pango/1.54.0/lib -lpangocairo-1.0 -lpango-1.0 -L/opt/homebrew/Cellar/harfbuzz/10.1.0/lib -lharfbuzz -L/opt/homebrew/Cellar/at-spi2-core/2.54.0/lib -latk-1.0 -L/opt/homebrew/Cellar/cairo/1.18.2/lib -lcairo-gobject -lcairo -L/opt/homebrew/Cellar/gdk-pixbuf/2.42.12/lib -lgdk_pixbuf-2.0 -L/opt/homebrew/Cellar/glib/2.82.2/lib -lgio-2.0 -lgobject-2.0 -lglib-2.0 -L/opt/homebrew/opt/gettext/lib -lintl
14 changes: 13 additions & 1 deletion plugins/cocoaui/LogWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@

extern DB_functions_t *deadbeef;

static const char conf_autoopen_key[] = "cocoaui.log.autoopen";
static const int conf_autoopen_default = 1;

@interface LogWindowController()

@property (nonatomic) BOOL wasShown;
@property (nonatomic) NSDictionary *attributes;
@property (weak) IBOutlet NSButton *autoOpenButton;

@end

Expand All @@ -51,6 +55,8 @@ - (void)windowDidLoad {
NSFontAttributeName: font
};

self.autoOpenButton.state = deadbeef->conf_get_int(conf_autoopen_key, conf_autoopen_default) ? NSControlStateValueOn : NSControlStateValueOff;

deadbeef->log_viewer_register (_cocoaui_logger_callback, (__bridge void *)(self));
}

Expand Down Expand Up @@ -101,13 +107,19 @@ - (void)appendLoggerText:(const char *)text forPlugin:(DB_plugin_t *)plugin onLa
dispatch_async(dispatch_get_main_queue(), ^{
[self appendText:str];

if (layers == DDB_LOG_LAYER_DEFAULT) {
int autoopen = deadbeef->conf_get_int(conf_autoopen_key, conf_autoopen_default);

if (autoopen && layers == DDB_LOG_LAYER_DEFAULT) {
if (!(self.window).visible) {
[self showWindow:self];
}
}
});
}

- (IBAction)autoOpenButtonAction:(NSButton *)sender {
deadbeef->conf_set_int(conf_autoopen_key, sender.state == NSControlStateValueOn);
deadbeef->conf_save();
}

@end
18 changes: 15 additions & 3 deletions plugins/cocoaui/XIB/Log.xib
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="23504" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17505"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="23504"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="LogWindowController">
<connections>
<outlet property="autoOpenButton" destination="LBo-Zo-3rH" id="i0X-XH-v7U"/>
<outlet property="clipView" destination="07q-Wq-DP9" id="FTH-FN-jyn"/>
<outlet property="textView" destination="UWH-i3-mmQ" id="NBl-wU-bzx"/>
<outlet property="window" destination="QvC-M9-y7g" id="06F-SS-He3"/>
Expand All @@ -19,7 +20,7 @@
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="920"/>
<rect key="screenRect" x="0.0" y="0.0" width="2048" height="1127"/>
<value key="minSize" type="size" width="200" height="100"/>
<view key="contentView" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
Expand Down Expand Up @@ -63,6 +64,17 @@
<action selector="clearAction:" target="-2" id="EQJ-zE-Tkg"/>
</connections>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="LBo-Zo-3rH">
<rect key="frame" x="6" y="8" width="224" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<buttonCell key="cell" type="check" title="Auto-open this window on errors" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="eKL-81-C8Y">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="autoOpenButtonAction:" target="-2" id="boi-X5-DTs"/>
</connections>
</button>
</subviews>
</view>
<connections>
Expand Down
11 changes: 11 additions & 0 deletions plugins/gtkui/callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
}
#define PL_NEXT(it, iter) (deadbeef->pl_get_next (it, iter))

static const char conf_autoopen_key[] = "gtkui.log.autoopen";

DdbListview *last_playlist;
extern DB_functions_t *deadbeef; // defined in gtkui.c

Expand Down Expand Up @@ -726,3 +728,12 @@ on_mainwin_redo_activate (GtkMenuItem *menuitem,
{
gtkui_undostack_perform_redo ();
}

void
on_autoopen_button_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
int active = gtk_toggle_button_get_active (togglebutton);
deadbeef->conf_set_int(conf_autoopen_key, active);
deadbeef->conf_save();
}
4 changes: 4 additions & 0 deletions plugins/gtkui/callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -1519,3 +1519,7 @@ on_mainwin_undo_activate (GtkMenuItem *menuitem,
void
on_mainwin_redo_activate (GtkMenuItem *menuitem,
gpointer user_data);

void
on_autoopen_button_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
18 changes: 17 additions & 1 deletion plugins/gtkui/deadbeef.glade
Original file line number Diff line number Diff line change
Expand Up @@ -11177,7 +11177,23 @@ Descending</property>
<property name="spacing">0</property>

<child>
<placeholder/>
<widget class="GtkCheckButton" id="autoopen_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Auto-open this window on errors</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_autoopen_button_toggled" last_modification_time="Sat, 16 Nov 2024 19:30:58 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>

<child>
Expand Down
Loading

0 comments on commit a6291ab

Please sign in to comment.