/ gwsupport.h / Content
/*  GWhere
 *  Copyright (C) 2000  Sébastien LECACHEUR
 *
 *  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; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  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 

#ifndef GW_SUPPORT_H
#define GW_SUPPORT_H


#ifdef HAVE_CONFIG_H
	#if defined ( OS_WIN32)
		#include "../win32/config.h"
	#else
		#include 
	#endif
#endif


#if defined ( OS_WIN32) || defined ( OS_CYGWIN)
	#include 
#endif


#if defined ( HAVE_GTK20)
	
	#define GTK_WINDOW_DIALOG GTK_WINDOW_TOPLEVEL
#endif


#if defined ( HAVE_GTK12)
	
	#define g_strdup_to_gtk_text(str,text) if(str!=NULL){text=g_strdup(str);}else{text=g_strdup("");}
#elif defined ( HAVE_GTK20)
	
	#define g_strdup_to_gtk_text(str,text) if(str!=NULL){text=g_locale_to_utf8(str,-1,NULL,NULL,NULL);}else{text=g_strdup("");}
#endif

#if defined ( HAVE_GTK12)
	
	#define g_strlen_gtk_text(str) strlen(str)
#elif defined ( HAVE_GTK20)
	
	#define g_strlen_gtk_text(str) g_utf8_strlen(str,-1)
#endif

#if defined ( HAVE_GTK12)
	
	#define g_strdup_from_gtk_text(str,text) if(str!=NULL){text=g_strdup(str);}else{text=g_strdup("");}
#elif defined ( HAVE_GTK20)
	
	#define g_strdup_from_gtk_text(str,text) if(str!=NULL){text=g_locale_from_utf8(str,-1,NULL,NULL,NULL);}else{text=g_strdup("");}
#endif

#if defined ( OS_LINUX) || defined ( OS_FREEBSD) || defined ( OS_OPENBSD) || defined ( OS_NETBSD)
	
	#define HAVE_MOUNT_SYSTEM
#endif


/* Defines extra long number format */
#ifndef G_HAVE_GINT64
	typdef guint64 guint32;
	#define G_MAXUINT64 G_MAXULONG
	#define G_GUINT64_FORMAT "u"
	#define strtoui64(x,y,z) strtoul(x,y,z)
#elif defined ( HAVE_GTK12)
	#define G_GUINT64_FORMAT "llu"
	#define strtoui64(x,y,z) strtoull(x,y,z)
#else
	#define strtoui64(x,y,z) strtoull(x,y,z)
#endif


/* Defines plugin file extension*/
#if defined ( HAVE_GTK12)
	#if defined ( OS_WIN32)
		#define G_MODULE_SUFFIX "dll"
	#else
		#define G_MODULE_SUFFIX "so"
	#endif
#endif


/*
 * Standard gettext macros.
 */
#ifdef ENABLE_NLS
#  include 
#  undef _
#  define _(String) dgettext (PACKAGE, String)
/*
#  define _(String) gettext ( String)
*/
#  ifdef gettext_noop
#    define N_(String) gettext_noop (String)
#  else
#    define N_(String) (String)
#  endif
#else
#  define textdomain(String) (String)
#  define gettext(String) (String)
#  define dgettext(Domain,Message) (Message)
#  define dcgettext(Domain,Message,Type) (Message)
#  define bindtextdomain(Domain,Directory) (Domain)
#  define _(String) (String)
#  define N_(String) (String)
#endif



/*
 * Public Functions.
 */

/*
 * This function returns a widget in a component created by Glade.
 * Call it with the toplevel widget in the component (i.e. a window/dialog),
 * or alternatively any widget in the component, and the name of the widget
 * you want returned.
 */
GtkWidget * lookup_widget ( GtkWidget *widget, const gchar *widget_name);


/* get_widget() is deprecated. Use lookup_widget instead. */
#define get_widget lookup_widget


/* Use this function to set the directory containing installed pixmaps. */
void add_pixmap_directory ( const gchar *directory);


/*
 * Private Functions.
 */

/* This is used to create the pixmaps in the interface. */
GtkWidget * create_pixmap ( GtkWidget *widget, const gchar *filename);


/* This is used in of Win9x where they aren't home folder. */
#if defined ( OS_WIN32)
	#define GW_HOME_DIR "C:WindowsLocalSettings"
#else
	#define GW_HOME_DIR "/home"
#endif


#if defined ( OS_WIN32) || defined ( OS_CYGWIN)

int gw_win32_get_version ( int *sys_type, int *version_major, int *version_minor, int *service_pack);


#endif



int gw_os_get_version_str ( gchar **version);


char * gw_package_get_locale_dir ( void);


char * gw_package_get_plugins_dir ( void);


#endif