2 * UDP Gateway utility startup scripts support
3 * Copyright (C) 2004 Jan Kratochvil <project-udpgate@jankratochvil.net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; exactly version 2 of June 1991 is required
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <glib/gmessages.h>
25 #include "static-startup.h" /* self */
27 #include "main.h" /* for: optarg_verbose */
30 static UdpgateStartup *static_startup_udpgate;
33 static gboolean static_startup_udpgate_init(void)
35 static gboolean first=TRUE;
37 if (!static_startup_udpgate && first) {
39 static_startup_udpgate=udpgate_startup_new();
40 if (!static_startup_udpgate)
41 g_warning(_("All automatic startup methods failed; automatic startup disabled."));
44 const gchar *startup_base_name=g_type_name(UDPGATE_TYPE_STARTUP);
45 const gchar *startup_used_name=G_OBJECT_TYPE_NAME(static_startup_udpgate);
47 if (!strncmp(startup_base_name,startup_used_name,strlen(startup_base_name)))
48 startup_used_name+=strlen(startup_base_name);
50 g_message(_("Using automatic startup type: %s"),startup_used_name);
54 return !!static_startup_udpgate;
57 gboolean static_startup_supported(void)
59 return static_startup_udpgate_init();
62 gboolean static_startup_query(gboolean *is_on)
64 if (!static_startup_udpgate_init())
66 return udpgate_startup_query(static_startup_udpgate,is_on);
69 gboolean static_startup_on(void)
71 if (!static_startup_udpgate_init())
73 return udpgate_startup_on(static_startup_udpgate);
76 gboolean static_startup_off(void)
78 if (!static_startup_udpgate_init())
80 return udpgate_startup_off(static_startup_udpgate);