Commit 949a9bba authored by Ivan Wong's avatar Ivan Wong Committed by David Hoover
Browse files

- clean up a little bit. - drop acconfig.h, use the third arg of AC_DEFINE

2004-11-17  Ivan Wong  <email@ivanwong.info>

	* configure.in:
	  - clean up a little bit.
	  - drop acconfig.h, use the third arg of AC_DEFINE instead.
	  - allow user to specify what version (dynamic/static) of
	    libpopt is to be used (win32 only).

	* acconfig.h, config.h.win: removed

	* src/Makefile.am: drop flags that are never used, and probably
	  won't be used.

	* src/glade-catalog.c, src/glade-palette.c,
	  src/glade-project-window.c, src/glade-widget-class.c,
	  src/glade.h, src/main.c:
	  use global variables instead of preprocessor definitions for
	  data/locale/pixmaps/widgets/catalogs directory names.
parent 675274fa
2004-11-17 Ivan Wong <email@ivanwong.info>
* configure.in:
- clean up a little bit.
- drop acconfig.h, use the third arg of AC_DEFINE instead.
- allow user to specify what version (dynamic/static) of
libpopt is to be used (win32 only).
* acconfig.h, config.h.win: removed
* src/Makefile.am: drop flags that are never used, and probably
won't be used.
* src/glade-catalog.c, src/glade-palette.c,
src/glade-project-window.c, src/glade-widget-class.c,
src/glade.h, src/main.c:
use global variables instead of preprocessor definitions for
data/locale/pixmaps/widgets/catalogs directory names.
2004-11-13 Ivan Wong <email@ivanwong.info>
* main.c, src/glade.h:
......
#undef ENABLE_NLS
#undef HAVE_CATGETS
#undef HAVE_GETTEXT
#undef HAVE_LC_MESSAGES
#undef HAVE_STPCPY
#undef PACKAGE
#undef VERSION
#undef GLADE_DEBUG
#undef GLADE_DATA_DIR
#undef USE_GNOME
#undef USE_GNOME_DB
#undef ENABLE_BONOBO
#undef PALETTE_TYPE
#undef USING_OAF
#undef PIXMAPS_DIR
#undef WIDGETS_DIR
#undef CATALOGS_DIR
#undef MODULES_DIR
#undef GETTEXT_PACKAGE
@BOTTOM@
#include "config.h.win"
#ifdef WIN32
#undef GLADE_DATA_DIR
#undef PIXMAPS_DIR
#undef WIDGETS_DIR
#undef CATALOGS_DIR
#undef MODULES_DIR
#undef GLADE_LOCALEDIR
#undef GLADE_ICONDIR
#define GLADE_DATA_DIR g_glade_data_dir
#define PIXMAPS_DIR g_pixmaps_dir
#define WIDGETS_DIR g_widgets_dir
#define CATALOGS_DIR g_catalogs_dir
#define MODULES_DIR g_modules_dir
#define GLADE_LOCALEDIR g_glade_localedir
#define GLADE_ICONDIR g_glade_icondir
extern char* g_glade_data_dir;
extern char* g_pixmaps_dir;
extern char* g_widgets_dir;
extern char* g_catalogs_dir;
extern char* g_modules_dir;
extern char* g_glade_localedir;
extern char* g_glade_icondir;
#endif
......@@ -28,7 +28,7 @@ dnl Gettext stuff.
dnl ================================================================
GETTEXT_PACKAGE=glade-3.0
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE")
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of the gettext package.])
ALL_LINGUAS="az es ms nn no pl pt ru sv ta tr uk"
AM_GLIB_GNU_GETTEXT
......@@ -36,8 +36,7 @@ AM_GLIB_GNU_GETTEXT
dnl ================================================================
dnl Start of pkg-config checks
dnl ================================================================
PKG_CHECK_MODULES(GLADE, gtk+-2.0 >= 2.2.0 libxml-2.0 >= 2.4.0)
GLADE_LIBS="${GLADE_LIBS}"
PKG_CHECK_MODULES(GLADE, gtk+-2.0 >= 2.2.0 libxml-2.0 >= 2.4.0)
AC_SUBST(GLADE_LIBS)
AC_SUBST(GLADE_CFLAGS)
......@@ -52,32 +51,31 @@ dnl This will substitute GLADE_DATA_DIR in config.h (from acconfig.h).
dnl ================================================================
if test "x${datadir}" = 'x${prefix}/share'; then
if test "x${prefix}" = "xNONE"; then
AC_DEFINE_UNQUOTED(GLADE_DATA_DIR, "${ac_default_prefix}/share/${PACKAGE}")
glade_data_dir="${ac_default_prefix}/share"
else
AC_DEFINE_UNQUOTED(GLADE_DATA_DIR, "${prefix}/share/${PACKAGE}")
glade_data_dir="${prefix}/share"
fi
else
AC_DEFINE_UNQUOTED(GLADE_DATA_DIR, "${datadir}/${PACKAGE}")
glade_data_dir="${datadir}"
fi
AC_DEFINE_UNQUOTED(GLADE_DATA_DIR, "${glade_data_dir}", [Data directory of Glade-3.])
AC_DEFINE_UNQUOTED(ICONS_DIR, "${glade_data_dir}/pixmaps", [Icons directory of Glade-3.])
AC_DEFINE_UNQUOTED(LOCALE_DIR, "${glade_data_dir}/locale", [Locale directory of Glade-3.])
dnl ================================================================
dnl PIXMAPS
dnl PIXMAPS, WIDGETS, CATALOGS
dnl ================================================================
if test "x${prefix}" = "xNONE"; then
AC_DEFINE_UNQUOTED(PIXMAPS_DIR, "${ac_default_prefix}/${DATADIRNAME}/${PACKAGE}-${VERSION}/pixmaps")
pixmapsdir="${ac_default_prefix}/${DATADIRNAME}/${PACKAGE}-${VERSION}/pixmaps"
AC_DEFINE_UNQUOTED(WIDGETS_DIR, "${ac_default_prefix}/${DATADIRNAME}/${PACKAGE}-${VERSION}/widgets")
widgetsdir="${ac_default_prefix}/${DATADIRNAME}/${PACKAGE}-${VERSION}/widgets"
AC_DEFINE_UNQUOTED(CATALOGS_DIR, "${ac_default_prefix}/${DATADIRNAME}/${PACKAGE}-${VERSION}/catalogs")
catalogsdir="${ac_default_prefix}/${DATADIRNAME}/${PACKAGE}-${VERSION}/catalogs"
tmp="${ac_default_prefix}"
else
AC_DEFINE_UNQUOTED(PIXMAPS_DIR, "${prefix}/${DATADIRNAME}/${PACKAGE}-${VERSION}/pixmaps")
pixmapsdir="${prefix}/${DATADIRNAME}/${PACKAGE}-${VERSION}/pixmaps"
AC_DEFINE_UNQUOTED(WIDGETS_DIR, "${prefix}/${DATADIRNAME}/${PACKAGE}-${VERSION}/widgets")
widgetsdir="${prefix}/${DATADIRNAME}/${PACKAGE}-${VERSION}/widgets"
AC_DEFINE_UNQUOTED(CATALOGS_DIR, "${prefix}/${DATADIRNAME}/${PACKAGE}-${VERSION}/catalogs")
catalogsdir="${prefix}/${DATADIRNAME}/${PACKAGE}-${VERSION}/catalogs"
tmp="${prefix}"
fi
pixmapsdir="${tmp}/${DATADIRNAME}/${PACKAGE}-${VERSION}/pixmaps"
widgetsdir="${tmp}/${DATADIRNAME}/${PACKAGE}-${VERSION}/widgets"
catalogsdir="${tmp}/${DATADIRNAME}/${PACKAGE}-${VERSION}/catalogs"
AC_DEFINE_UNQUOTED(PIXMAPS_DIR, "$pixmapsdir", [Pixmaps directory of Glade-3.])
AC_DEFINE_UNQUOTED(WIDGETS_DIR, "$widgetsdir", [Widgets directory of Glade-3.])
AC_DEFINE_UNQUOTED(CATALOGS_DIR, "$catalogsdir", [Catalogs directory of Glade-3.])
dnl ================================================================
dnl MODULES
......@@ -96,6 +94,14 @@ AC_SUBST(modulesdir)
case $host_os in
*mingw* | pw32* | cygwin*)
win32=yes
AC_ARG_ENABLE(popt_dll,
[ --disable-popt-dll disable use of libpopt.dll (use static version instead)],
popt_dll=$enableval, popt_dll=yes)
if test "x$popt_dll" = "xyes"; then
AC_DEFINE(USE_POPT_DLL, 1, [Define to 1 if libpopt.dll is to be used.])
else
AC_DEFINE(POPT_STATIC, 1, [Define to 1 if static version of libpopt is to be used.])
fi
;;
esac
AM_CONDITIONAL(WITH_WIN32, test x"$win32" = "xyes")
......
......@@ -24,14 +24,7 @@ INCLUDES = \
-I$(top_srcdir) \
-I$(top_builddir) \
$(GLADE_CFLAGS) \
-DGLADE_LIBDIR=\""$(libdir)"\" \
-DGLADE_DATADIR=\""$(datadir)"\" \
-DGLADE_BINDIR=\""$(bindir)"\" \
-DGLADE_ICONDIR=\""$(datadir)/pixmaps"\" \
-DGLADE_LOCALSTATEDIR=\""$(localstatedir)"\" \
-DGLADE_LOCALEDIR=\""$(datadir)/locale"\" \
-DMODULES_DIR=\""@modulesdir@"\" \
-DG_LOG_DOMAIN=\"Glade\"
-DMODULES_DIR=\""@modulesdir@"\"
AM_CFLAGS = -g -Wall
......
......@@ -75,7 +75,7 @@ glade_catalog_load (const char *base_catalog_filename)
char *base_library = NULL;
GList *last_widget_class = NULL;
catalog_filename = g_strdup_printf ("%s%c%s", CATALOGS_DIR, G_DIR_SEPARATOR, base_catalog_filename);
catalog_filename = g_strdup_printf ("%s%c%s", glade_catalogs_dir, G_DIR_SEPARATOR, base_catalog_filename);
if (catalog_filename == NULL)
{
g_critical (_("Not enough memory."));
......@@ -174,7 +174,7 @@ lblError:
GList *
glade_catalog_load_all (void)
{
gchar *filename = g_build_filename (CATALOGS_DIR, "glade-palette.xml", NULL);
gchar *filename = g_build_filename (glade_catalogs_dir, "glade-palette.xml", NULL);
GladeXmlContext *context;
GladeXmlNode *root;
GladeXmlNode *xml_catalogs;
......
......@@ -25,10 +25,6 @@
#include <config.h>
#endif
#ifndef PIXMAPS_DIR
#define PIXMAPS_DIR "E:/Programmation/Glade/msvc6/pixmaps"
#endif
#include "glade.h"
#include "glade-palette.h"
#include "glade-catalog.h"
......@@ -148,7 +144,7 @@ glade_palette_selector_new (GladePalette *palette)
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (palette->selector), FALSE);
palette->widgets_button_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (palette->selector));
gtk_button_set_relief (GTK_BUTTON (palette->selector), GTK_RELIEF_NONE);
filename = g_build_filename (PIXMAPS_DIR, "selector.png", NULL);
filename = g_build_filename (glade_pixmaps_dir, "selector.png", NULL);
image = gtk_image_new_from_file (filename);
g_free (filename);
......
......@@ -935,7 +935,7 @@ static void gpw_about_cb (void)
vbox = gtk_vbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (about_dialog)->vbox), vbox, TRUE, TRUE, 0);
filename = g_build_filename (GLADE_ICONDIR, "glade-3.png", NULL);
filename = g_build_filename (glade_icon_dir, "glade-3.png", NULL);
glade_image = gtk_image_new_from_file (filename);
g_free (filename);
gtk_box_pack_start (GTK_BOX (vbox), glade_image, TRUE, TRUE, 0);
......@@ -1216,7 +1216,7 @@ glade_project_window_create (GladeProjectWindow *gpw)
app = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_move (GTK_WINDOW (app), 0, 0);
gtk_window_set_default_size (GTK_WINDOW (app), 280, 220);
filename = g_build_filename (GLADE_ICONDIR, "glade-3.png", NULL);
filename = g_build_filename (glade_icon_dir, "glade-3.png", NULL);
gtk_window_set_default_icon_from_file (filename, NULL);
g_free (filename);
gpw->window = app;
......
......@@ -237,7 +237,7 @@ glade_widget_class_create_icon (GladeWidgetClass *class)
if (class->generic_name)
{
icon_path = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s.png", PIXMAPS_DIR, class->generic_name);
icon_path = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s.png", glade_pixmaps_dir, class->generic_name);
icon = gtk_image_new_from_file (icon_path);
g_free (icon_path);
}
......@@ -559,7 +559,7 @@ glade_widget_class_load_library (const gchar *library_name)
gchar *path;
GModule *module;
path = g_module_build_path (MODULES_DIR, library_name);
path = g_module_build_path (glade_modules_dir, library_name);
if (!path)
{
g_warning (_("Not enough memory."));
......@@ -641,7 +641,7 @@ glade_widget_class_new (const char *name,
if (base_filename != NULL)
{
filename = g_strconcat (WIDGETS_DIR, "/", base_filename, NULL);
filename = g_strconcat (glade_widgets_dir, "/", base_filename, NULL);
if (filename == NULL)
{
g_warning (_("Not enough memory."));
......
......@@ -123,4 +123,12 @@
extern gboolean verbose;
extern gchar* glade_data_dir;
extern gchar* glade_pixmaps_dir;
extern gchar* glade_widgets_dir;
extern gchar* glade_catalogs_dir;
extern gchar* glade_modules_dir;
extern gchar* glade_locale_dir;
extern gchar* glade_icon_dir;
#endif /* __GLADE_H__ */
......@@ -43,6 +43,18 @@
#include <stdlib.h> /* __argc & __argv on the windows build */
#endif
gchar *glade_data_dir = GLADE_DATA_DIR;
gchar *glade_pixmaps_dir = PIXMAPS_DIR;
gchar *glade_widgets_dir = WIDGETS_DIR;
gchar *glade_catalogs_dir = CATALOGS_DIR;
#ifdef MODULES_DIR
gchar *glade_modules_dir = MODULES_DIR;
#else
gchar *glade_modules_dir = NULL;
#endif
gchar *glade_locale_dir = LOCALE_DIR;
gchar *glade_icon_dir = ICONS_DIR;
static gchar *widget_name = NULL;
gboolean verbose = FALSE;
......@@ -120,16 +132,6 @@ glade_init (void)
return TRUE;
}
#ifdef G_OS_WIN32
char* g_glade_data_dir;
char* g_pixmaps_dir;
char* g_widgets_dir;
char* g_catalogs_dir;
char* g_modules_dir;
char* g_glade_localedir;
char* g_glade_icondir;
#endif
int
main (int argc, char *argv[])
{
......@@ -141,19 +143,19 @@ main (int argc, char *argv[])
gchar *prefix;
prefix = g_win32_get_package_installation_directory (NULL, NULL);
g_glade_data_dir = g_build_filename (prefix, "share", "glade", NULL);
g_pixmaps_dir = g_build_filename (prefix, "lib", PACKAGE "-" VERSION, "pixmaps", NULL);
g_widgets_dir = g_build_filename (prefix, "lib", PACKAGE "-" VERSION, "widgets", NULL);
g_catalogs_dir = g_build_filename (prefix, "lib", PACKAGE "-" VERSION, "catalogs", NULL);
g_modules_dir = g_build_filename (prefix, "lib", "glade", NULL);
g_glade_localedir = g_build_filename (prefix, "lib", "locale", NULL);
g_glade_icondir = g_build_filename (prefix, "share", "pixmaps", NULL);
glade_data_dir = g_build_filename (prefix, "share", "glade", NULL);
glade_pixmaps_dir = g_build_filename (prefix, "lib", PACKAGE "-" VERSION, "pixmaps", NULL);
glade_widgets_dir = g_build_filename (prefix, "lib", PACKAGE "-" VERSION, "widgets", NULL);
glade_catalogs_dir = g_build_filename (prefix, "lib", PACKAGE "-" VERSION, "catalogs", NULL);
glade_modules_dir = g_build_filename (prefix, "lib", "glade", NULL);
glade_locale_dir = g_build_filename (prefix, "lib", "locale", NULL);
glade_icon_dir = g_build_filename (prefix, "share", "pixmaps", NULL);
g_free (prefix);
#endif
#ifdef ENABLE_NLS
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE, GLADE_LOCALEDIR);
bindtextdomain (GETTEXT_PACKAGE, glade_locale_dir);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
#endif
......@@ -198,13 +200,13 @@ main (int argc, char *argv[])
gtk_main ();
#ifdef G_OS_WIN32
g_free (g_glade_data_dir);
g_free (g_pixmaps_dir);
g_free (g_widgets_dir);
g_free (g_catalogs_dir);
g_free (g_modules_dir);
g_free (g_glade_localedir);
g_free (g_glade_icondir);
g_free (glade_data_dir);
g_free (glade_pixmaps_dir);
g_free (glade_widgets_dir);
g_free (glade_catalogs_dir);
g_free (glade_modules_dir);
g_free (glade_locale_dir);
g_free (glade_icon_dir);
#endif
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment