Author: cazfi Date: Sun Jun 26 22:31:35 2016 New Revision: 33051 URL: http://svn.gna.org/viewcvs/freeciv?rev=33051&view=rev Log: Silenced gtk+ warnings from gtk3-client by wrapping their printing to log_verbose(). User can override this with commadline option '-- --gtk-warnings'
See patch #7231 Modified: branches/S2_6/client/gui-gtk-3.0/gui_main.c branches/S2_6/doc/man/freeciv-client.6.in Modified: branches/S2_6/client/gui-gtk-3.0/gui_main.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/gui_main.c?rev=33051&r1=33050&r2=33051&view=diff ============================================================================== --- branches/S2_6/client/gui-gtk-3.0/gui_main.c (original) +++ branches/S2_6/client/gui-gtk-3.0/gui_main.c Sun Jun 26 22:31:35 2016 @@ -282,6 +282,9 @@ _("Other gui-specific options are:\n")); fc_fprintf(stderr, + _("-g, --gtk-warnings\tLet gtk+ to print warnings\n")); + + fc_fprintf(stderr, _("-r, --resolution WIDTHxHEIGHT\tAssume given resolution " "screen\n")); @@ -299,12 +302,23 @@ } /************************************************************************** + Dummy gtk error printer +**************************************************************************/ +static void log_gtk_warns(const gchar *log_domain, GLogLevelFlags log_level, + const gchar *message, + gpointer user_data) +{ + log_verbose("%s", message); +} + +/************************************************************************** Search for command line options. right now, it's just help semi-useless until we have options that aren't the same across all clients. **************************************************************************/ static void parse_options(int argc, char **argv) { int i = 1; + bool gtk_warns_enabled = FALSE; while (i < argc) { char *option = NULL; @@ -312,6 +326,8 @@ if (is_option("--help", argv[i])) { print_usage(); exit(EXIT_SUCCESS); + } else if (is_option("--gtk-warnings", argv[i])) { + gtk_warns_enabled = TRUE; #ifdef GTK3_ZOOM_ENABLED } else if ((option = get_option_malloc("--zoom", argv, &i, argc))) { @@ -334,6 +350,10 @@ /* Can't check against unknown options, as those might be gtk options */ i++; + } + + if (!gtk_warns_enabled) { + g_log_set_handler("Gtk", G_LOG_LEVEL_WARNING, log_gtk_warns, NULL); } } Modified: branches/S2_6/doc/man/freeciv-client.6.in URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/doc/man/freeciv-client.6.in?rev=33051&r1=33050&r2=33051&view=diff ============================================================================== --- branches/S2_6/doc/man/freeciv-client.6.in (original) +++ branches/S2_6/doc/man/freeciv-client.6.in Sun Jun 26 22:31:35 2016 @@ -9,7 +9,7 @@ .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" -.TH FREECIV 6 "December 10th 2011" +.TH FREECIV 6 "June 25th 2016" .SH NAME freeciv-gtk2, freeciv-gtk3, freeciv-sdl, freeciv-sdl2, freeciv-qt, freeciv-xaw \ \- The clients for the Freeciv game @@ -34,11 +34,15 @@ [ \-\- \fIclient-specific-parameters\fP ] .B freeciv-gtk2 -and +accept the standard Gtk parameters following \fB\-\-\fP; see the Gtk +documentation. It also accepts +.B [ \-h|\-\-help ] + .B freeciv-gtk3 accept the standard Gtk parameters following \fB\-\-\fP; see the Gtk -documentation. They also accept -.B [ \-h|\-\-help ] +documentation. It also accepts +.B [ \-g|\-\-gtk-warnings ] \ +[ \-h|\-\-help ] .B freeciv-qt accept the standard Qt parameters following \fB\-\-\fP; see the Qt _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits