/* $Id$ * UDP Gateway utility startup scripts support * Copyright (C) 2004 Jan Kratochvil * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; exactly version 2 of June 1991 is required * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "config.h" #include #include #include "static-startup.h" /* self */ #include "startup.h" #include "main.h" /* for: optarg_verbose */ static UdpgateStartup *static_startup_udpgate; static gboolean static_startup_udpgate_init(void) { static gboolean first=TRUE; if (!static_startup_udpgate && first) { first=FALSE; static_startup_udpgate=udpgate_startup_new(); if (!static_startup_udpgate) g_warning(_("All automatic startup methods failed; automatic startup disabled.")); else { if (optarg_verbose) { const gchar *startup_base_name=g_type_name(UDPGATE_TYPE_STARTUP); const gchar *startup_used_name=G_OBJECT_TYPE_NAME(static_startup_udpgate); if (!strncmp(startup_base_name,startup_used_name,strlen(startup_base_name))) startup_used_name+=strlen(startup_base_name); g_message(_("Using automatic startup type: %s"),startup_used_name); } } } return !!static_startup_udpgate; } gboolean static_startup_supported(void) { return static_startup_udpgate_init(); } gboolean static_startup_query(gboolean *is_on) { if (!static_startup_udpgate_init()) return FALSE; return udpgate_startup_query(static_startup_udpgate,is_on); } gboolean static_startup_on(void) { if (!static_startup_udpgate_init()) return FALSE; return udpgate_startup_on(static_startup_udpgate); } gboolean static_startup_off(void) { if (!static_startup_udpgate_init()) return FALSE; return udpgate_startup_off(static_startup_udpgate); }