KiCad PCB EDA Suite
gtk/app.cpp
Go to the documentation of this file.
1/*
2* This program source code file is part of KiCad, a free EDA CAD application.
3*
4* Copyright (C) 2020 Mark Roszko <[email protected]>
5* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
6*
7* This program is free software: you can redistribute it and/or modify it
8* under the terms of the GNU General Public License as published by the
9* Free Software Foundation, either version 3 of the License, or (at your
10* option) any later version.
11*
12* This program is distributed in the hope that it will be useful, but
13* WITHOUT ANY WARRANTY; without even the implied warranty of
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15* General Public License for more details.
16*
17* You should have received a copy of the GNU General Public License along
18* with this program. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#include <kiplatform/app.h>
22
23#include <glib.h>
24
25#include <wx/string.h>
26#include <wx/utils.h>
27
28
29/*
30 * Function to attach to the glib logger to eat the output it gives so we don't
31 * get the message spam on the terminal from wxWidget's abuse of the GTK API.
32 */
33static GLogWriterOutput nullLogWriter( GLogLevelFlags log_level, const GLogField* fields,
34 gsize n_fields, gpointer user_data )
35{
36 return G_LOG_WRITER_HANDLED;
37}
38
39
41{
42#if !defined( KICAD_SHOW_GTK_MESSAGES )
43 // Attach a logger that will consume the annoying GTK error messages
44 g_log_set_writer_func( nullLogWriter, nullptr, nullptr );
45#endif
46
47 return true;
48}
49
50
52{
53 // Not implemented on this platform
54 return false;
55}
56
57
58bool KIPLATFORM::APP::RegisterApplicationRestart( const wxString& aCommandLine )
59{
60 // Not implemented on this platform
61 return true;
62}
63
64
66{
67 // Not implemented on this platform
68 return true;
69}
70
71
73{
74 return false;
75}
76
77
79{
80}
81
82
83void KIPLATFORM::APP::SetShutdownBlockReason( wxWindow* aWindow, const wxString& aReason )
84{
85}
86
87
89{
90}
91
92
94{
95}
static GLogWriterOutput nullLogWriter(GLogLevelFlags log_level, const GLogField *fields, gsize n_fields, gpointer user_data)
Definition: gtk/app.cpp:33
void SetShutdownBlockReason(wxWindow *aWindow, const wxString &aReason)
Sets the block reason why the window/application is preventing OS shutdown.
Definition: gtk/app.cpp:83
bool UnregisterApplicationRestart()
Unregisters the application from automatic restart.
Definition: gtk/app.cpp:65
void RemoveShutdownBlockReason(wxWindow *aWindow)
Removes any shutdown block reason set.
Definition: gtk/app.cpp:78
bool RegisterApplicationRestart(const wxString &aCommandLine)
Registers the application for restart with the OS with the given command line string to pass as args.
Definition: gtk/app.cpp:58
bool Init()
Perform application-specific initialization tasks.
Definition: gtk/app.cpp:40
void ForceTimerMessagesToBeCreatedIfNecessary()
Forces wxTimers to fire more promptly on Win32.
Definition: gtk/app.cpp:88
bool IsOperatingSystemUnsupported()
Checks if the Operating System is explicitly unsupported and we want to prevent users from sending bu...
Definition: gtk/app.cpp:51
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition: gtk/app.cpp:72
void AddDynamicLibrarySearchPath(const wxString &aPath)
Inserts a search path for loading dynamic libraries.
Definition: gtk/app.cpp:93