+User notification of the probe timeout.
[udpgate.git] / src / main.c
index a302c63..a0917e6 100644 (file)
@@ -36,6 +36,7 @@
 #include "main.h"      /* self */
 #include "ui-line.h"
 #include "network.h"
+#include "configuration.h"
 
 #ifdef HAVE_GNOME
 #include "ui-gnome.h"
@@ -68,13 +69,14 @@ static const struct poptOption popt_table[]={
                        argDescrip: (argDescripP), \
                }
 
-               UDPGATE_POPT(0  ,"text"   ,POPT_ARG_NONE                          ,&optarg_text   ,0,
 #ifdef HAVE_GNOME
-                               N_("Disable Gnome UI; --text must be first argument")
+#define OPT_TEXT_IF_GNOME N_("Disable Gnome UI; --text must be first argument")
 #else /* HAVE_GNOME */
-                               N_("(no Gnome UI compiled - stub only); --text must be first argument")
+#define OPT_TEXT_IF_GNOME N_("(no Gnome UI compiled - stub only); --text must be first argument")
 #endif /* HAVE_GNOME */
-                               ,NULL),
+               UDPGATE_POPT(0  ,"text"   ,POPT_ARG_NONE                          ,&optarg_text   ,0,
+                               OPT_TEXT_IF_GNOME,NULL),
+#undef OPT_TEXT_IF_GNOME
                UDPGATE_POPT('v',"verbose",POPT_ARG_NONE                          ,&optarg_verbose,0,
                                N_("Display additional debug information"),NULL),
                UDPGATE_POPT('p',"port"   ,POPT_ARG_INT |POPT_ARGFLAG_SHOW_DEFAULT,&optarg_port   ,0,
@@ -141,6 +143,11 @@ gboolean no_gnome;
        bindtextdomain(PACKAGE,LOCALEDIR);
        textdomain(PACKAGE);
 
+       /* Read it before the command-line parsing to get the default value
+        * of 'optarg_port' displayable by 'POPT_ARGFLAG_SHOW_DEFAULT'.
+        */
+       configuration_read();
+
        if (argv[1] && !strcmp(argv[1],"--text"))
                optarg_text=1;
 
@@ -191,7 +198,7 @@ guint handler_id;
                                        NULL);
                else {
                        no_gnome=TRUE;
-                       /* No message: (captive-install-acquire:3693): Gtk-WARNING **: cannot open display:
+                       /* No message: (udpgate:3693): Gtk-WARNING **: cannot open display:
                         * was reported, probably only '--help' message was shown.
                         */
                        if (!gnome_init_g_log_handler_hit)
@@ -226,5 +233,7 @@ guint handler_id;
        else
                (*ui_interactive)();
 
+       configuration_write();
+
        return EXIT_SUCCESS;
 }