From a6291ab4011f176575a1da8b9459879423b357df Mon Sep 17 00:00:00 2001 From: Oleksiy Yakovenko Date: Sat, 16 Nov 2024 20:43:32 +0100 Subject: [PATCH] Add an option to disable log window auto show (#2342) --- osx/deadbeef.xcodeproj/project.pbxproj | 16 ---------------- osx/xcodeconfig/gtk2.xcconfig | 4 ++-- osx/xcodeconfig/gtk3.xcconfig | 5 ++--- plugins/cocoaui/LogWindowController.m | 14 +++++++++++++- plugins/cocoaui/XIB/Log.xib | 18 +++++++++++++++--- plugins/gtkui/callbacks.c | 11 +++++++++++ plugins/gtkui/callbacks.h | 4 ++++ plugins/gtkui/deadbeef.glade | 18 +++++++++++++++++- plugins/gtkui/gtkui.c | 11 ++++++++++- plugins/gtkui/interface.c | 9 +++++++++ tools/glade/Makefile.am | 6 ++---- tools/glade/configure.in | 1 - 12 files changed, 85 insertions(+), 32 deletions(-) diff --git a/osx/deadbeef.xcodeproj/project.pbxproj b/osx/deadbeef.xcodeproj/project.pbxproj index 263ae30522..71d1932b4d 100644 --- a/osx/deadbeef.xcodeproj/project.pbxproj +++ b/osx/deadbeef.xcodeproj/project.pbxproj @@ -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 = ( @@ -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 = ( @@ -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; @@ -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; @@ -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; @@ -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; @@ -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; @@ -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; @@ -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 = ( @@ -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 = ( @@ -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; @@ -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; @@ -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; @@ -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; @@ -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", @@ -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\""; diff --git a/osx/xcodeconfig/gtk2.xcconfig b/osx/xcodeconfig/gtk2.xcconfig index c3d2e04bba..18cf01c0d6 100644 --- a/osx/xcodeconfig/gtk2.xcconfig +++ b/osx/xcodeconfig/gtk2.xcconfig @@ -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 diff --git a/osx/xcodeconfig/gtk3.xcconfig b/osx/xcodeconfig/gtk3.xcconfig index 5b3444954a..95a66b10ae 100644 --- a/osx/xcodeconfig/gtk3.xcconfig +++ b/osx/xcodeconfig/gtk3.xcconfig @@ -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 diff --git a/plugins/cocoaui/LogWindowController.m b/plugins/cocoaui/LogWindowController.m index f4a071323d..5f946f5f3a 100644 --- a/plugins/cocoaui/LogWindowController.m +++ b/plugins/cocoaui/LogWindowController.m @@ -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 @@ -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)); } @@ -101,7 +107,9 @@ - (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]; } @@ -109,5 +117,9 @@ - (void)appendLoggerText:(const char *)text forPlugin:(DB_plugin_t *)plugin onLa }); } +- (IBAction)autoOpenButtonAction:(NSButton *)sender { + deadbeef->conf_set_int(conf_autoopen_key, sender.state == NSControlStateValueOn); + deadbeef->conf_save(); +} @end diff --git a/plugins/cocoaui/XIB/Log.xib b/plugins/cocoaui/XIB/Log.xib index 3bb5e68a99..40406bc7bd 100644 --- a/plugins/cocoaui/XIB/Log.xib +++ b/plugins/cocoaui/XIB/Log.xib @@ -1,13 +1,14 @@ - + - + + @@ -19,7 +20,7 @@ - + @@ -63,6 +64,17 @@ + diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c index 6befc5bd06..be8052752c 100644 --- a/plugins/gtkui/callbacks.c +++ b/plugins/gtkui/callbacks.c @@ -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 @@ -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(); +} diff --git a/plugins/gtkui/callbacks.h b/plugins/gtkui/callbacks.h index f0b6536dcb..6fc4a86534 100644 --- a/plugins/gtkui/callbacks.h +++ b/plugins/gtkui/callbacks.h @@ -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); diff --git a/plugins/gtkui/deadbeef.glade b/plugins/gtkui/deadbeef.glade index b0109badcf..7651239afa 100644 --- a/plugins/gtkui/deadbeef.glade +++ b/plugins/gtkui/deadbeef.glade @@ -11177,7 +11177,23 @@ Descending 0 - + + True + True + Auto-open this window on errors + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index d5604d1aef..9fe6b0d399 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -81,6 +81,9 @@ { fprintf (stderr, __VA_ARGS__); } //#define trace(fmt,...) +static const char conf_autoopen_key[] = "gtkui.log.autoopen"; +static const int conf_autoopen_default = 1; + ddb_gtkui_t plugin; DB_functions_t *deadbeef; @@ -1352,6 +1355,10 @@ gtkui_show_log_window_internal (gboolean show) { GtkWidget *menuitem = lookup_widget (mainwin, "view_log"); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem), show); + int autoshow = deadbeef->conf_get_int(conf_autoopen_key, conf_autoopen_default); + GtkWidget *autoshow_button = lookup_widget(logwindow, "autoopen_button"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(autoshow_button), autoshow); + #if GTK_CHECK_VERSION(3, 10, 0) # if USE_GTK_APPLICATION GSimpleAction *act = deadbeef_app_get_log_action (gapp); @@ -1436,7 +1443,9 @@ logwindow_addtext_cb (gpointer data) { GtkTextMark *mark = gtk_text_buffer_create_mark (buffer, NULL, &iter, FALSE); gtk_text_view_scroll_mark_onscreen (GTK_TEXT_VIEW (textview), mark); } - if (!w_logviewer_is_present () && addtext->layers == DDB_LOG_LAYER_DEFAULT) + int autoshow = deadbeef->conf_get_int(conf_autoopen_key, conf_autoopen_default); + + if (!w_logviewer_is_present () && autoshow && addtext->layers == DDB_LOG_LAYER_DEFAULT) gtkui_show_log_window_internal (TRUE); free (addtext->str); free (addtext); diff --git a/plugins/gtkui/interface.c b/plugins/gtkui/interface.c index 7f518d895e..db77e9ab72 100644 --- a/plugins/gtkui/interface.c +++ b/plugins/gtkui/interface.c @@ -5587,6 +5587,7 @@ create_log_window (void) GtkWidget *scrolledwindow14; GtkWidget *logwindow_textview; GtkWidget *hbox140; + GtkWidget *autoopen_button; GtkWidget *log_clear; log_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); @@ -5620,6 +5621,10 @@ create_log_window (void) gtk_box_pack_start (GTK_BOX (vbox49), hbox140, FALSE, FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (hbox140), 5); + autoopen_button = gtk_check_button_new_with_mnemonic (_("Auto-open this window on errors")); + gtk_widget_show (autoopen_button); + gtk_box_pack_start (GTK_BOX (hbox140), autoopen_button, FALSE, FALSE, 0); + log_clear = gtk_button_new_with_mnemonic (_("Clear")); gtk_widget_show (log_clear); gtk_box_pack_end (GTK_BOX (hbox140), log_clear, FALSE, FALSE, 0); @@ -5627,6 +5632,9 @@ create_log_window (void) g_signal_connect ((gpointer) log_window, "key_press_event", G_CALLBACK (on_log_window_key_press_event), NULL); + g_signal_connect ((gpointer) autoopen_button, "toggled", + G_CALLBACK (on_autoopen_button_toggled), + NULL); g_signal_connect ((gpointer) log_clear, "clicked", G_CALLBACK (on_log_clear_clicked), NULL); @@ -5637,6 +5645,7 @@ create_log_window (void) GLADE_HOOKUP_OBJECT (log_window, scrolledwindow14, "scrolledwindow14"); GLADE_HOOKUP_OBJECT (log_window, logwindow_textview, "logwindow_textview"); GLADE_HOOKUP_OBJECT (log_window, hbox140, "hbox140"); + GLADE_HOOKUP_OBJECT (log_window, autoopen_button, "autoopen_button"); GLADE_HOOKUP_OBJECT (log_window, log_clear, "log_clear"); return log_window; diff --git a/tools/glade/Makefile.am b/tools/glade/Makefile.am index 2d94a17399..d79d6fb988 100644 --- a/tools/glade/Makefile.am +++ b/tools/glade/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS = glade po omf-install +SUBDIRS = glade omf-install Developmentdir = $(datadir)/applications Development_in_files = glade-2.desktop.in @@ -34,9 +34,7 @@ EXTRA_DIST = \ examples/editor/src/interface.h \ examples/editor/src/main.c \ examples/editor/src/support.c \ - examples/editor/src/support.h \ - examples/editor/po/ChangeLog \ - examples/editor/po/POTFILES.in + examples/editor/src/support.h pixmapsdir = $(datadir)/pixmaps pixmaps_DATA = glade-2.png diff --git a/tools/glade/configure.in b/tools/glade/configure.in index a0c22f775b..74fe0d5048 100644 --- a/tools/glade/configure.in +++ b/tools/glade/configure.in @@ -84,7 +84,6 @@ glade/gbwidgets/Makefile glade/data/Makefile glade/data/gtk/Makefile omf-install/Makefile -po/Makefile.in ]) dnl doc/it/Makefile