Author: cazfi
Date: Sun Jun 26 22:31:41 2016
New Revision: 33052

URL: http://svn.gna.org/viewcvs/freeciv?rev=33052&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_5/client/gui-gtk-3.0/gui_main.c
    branches/S2_5/doc/man/freeciv-client.6.in

Modified: branches/S2_5/client/gui-gtk-3.0/gui_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-gtk-3.0/gui_main.c?rev=33052&r1=33051&r2=33052&view=diff
==============================================================================
--- branches/S2_5/client/gui-gtk-3.0/gui_main.c (original)
+++ branches/S2_5/client/gui-gtk-3.0/gui_main.c Sun Jun 26 22:31:41 2016
@@ -278,26 +278,49 @@
              _("This client accepts the standard Gtk command-line options\n"
                "after '--'. See the Gtk documentation.\n\n"));
 
+  fc_fprintf(stderr,
+             _("Other gui-specific options are:\n"));
+
+  fc_fprintf(stderr,
+             _("-g, --gtk-warnings\tLet gtk+ to print warnings\n\n"));
+
   /* TRANS: No full stop after the URL, could cause confusion. */
   fc_fprintf(stderr, _("Report bugs at %s\n"), BUG_URL);
 }
 
 /**************************************************************************
- 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.
+  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) {
     if (is_option("--help", argv[i])) {
       print_usage(argv[0]);
       exit(EXIT_SUCCESS);
+    } else if (is_option("--gtk-warnings", argv[i])) {
+      gtk_warns_enabled = TRUE;
     }
     /* 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_5/doc/man/freeciv-client.6.in
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/doc/man/freeciv-client.6.in?rev=33052&r1=33051&r2=33052&view=diff
==============================================================================
--- branches/S2_5/doc/man/freeciv-client.6.in   (original)
+++ branches/S2_5/doc/man/freeciv-client.6.in   Sun Jun 26 22:31:41 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-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

Reply via email to