Commit f9d9a776 authored by Tristan Van Berkom's avatar Tristan Van Berkom
Browse files

o Cleanup build in src/Makefile.am o Now build and install a devhelp


	* configure.in, src/Makefile.am, src/glade-paths.sh.in:
	  o Cleanup build in src/Makefile.am
	  o Now build and install a devhelp module if a usable version
	    of libdevhelp is available

	* src/glade-devhelp.[ch]: A loadable devhelp dockable widgets
	  built into a plugin module.

	* src/glade-app.c, src/glade.h: Added a global for glade_plugins_dir.

	* src/glade-project-window.c, src/glade-utils.[ch]: Detect if there
	  is a devhelp plugin installed and load the devhelp window into
	  the project window in a paned window with the project view.
parent 11453fc0
2006-04-30 Tristan Van Berkom <tvb@gnome.org>
* configure.in, src/Makefile.am, src/glade-paths.sh.in:
o Cleanup build in src/Makefile.am
o Now build and install a devhelp module if a usable version
of libdevhelp is available
* src/glade-devhelp.[ch]: A loadable devhelp dockable widgets
built into a plugin module.
* src/glade-app.c, src/glade.h: Added a global for glade_plugins_dir.
* src/glade-project-window.c, src/glade-utils.[ch]: Detect if there
is a devhelp plugin installed and load the devhelp window into
the project window in a paned window with the project view.
2006-04-28 Tristan Van Berkom <tvb@gnome.org>
* src/glade-editor.c:
......
Installation Instructions
*************************
Basic Installation
==================
Glade uses configure to ease installation. The majority of people
should be able to install & run Glade by entering:
./configure (or ./configure --with-included-gettext for Solaris
machines and practically anything which doesn't have a
recent version of the GNU libc libraries.)
make
make install
glade
(As of Glade 0.5.0 you must install Glade with 'make install' if you want
to build C applications.)
If you have installed GTK+ in a non-standard directory, you will need to
make sure that the gtk-config program is in your PATH, and that the GTK+
libraries can be found when glade is run. If you installed GTK+ with the
prefix /usr/local then gtk-config will be in /usr/local/bin. To make sure
the GTK+ libraries are found, under Linux you can change /etc/ld.so.conf
and run ldconfig or add the libraries directory to LD_LIBRARY_PATH.
Common Problems
===============
The most common problem relates to the gettext translation library.
Usually when linking you see errors like this:
Unresolved reference to dcgettext()
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
Software Foundation, Inc.
To solve this, try configuring with:
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
./configure --with-included-gettext
and running make again. As a last resort you can also try
./configure --disable-nls
Generic Configure Instructions
==============================
Basic Installation
==================
These are generic installation instructions.
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. (Caching is
disabled by default to prevent problems with accidental use of stale
cache files.)
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You only need
`configure.ac' if you want to change it or regenerate `configure' using
a newer version of `autoconf'.
The simplest way to compile this package is:
......@@ -96,20 +70,22 @@ The simplest way to compile this package is:
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Some systems require unusual options for compilation or linking that the
`configure' script does not know about. Run `./configure --help' for
details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
......@@ -117,28 +93,28 @@ directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
If you have to use a `make' that does not support the `VPATH'
variable, you have to compile the package for one architecture at a
time in the source code directory. After you have installed the
package for one architecture, use `make distclean' before reconfiguring
for another architecture.
Installation Names
==================
By default, `make install' will install the package's files in
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
give `configure' the option `--exec-prefix=PREFIX', the package will
use PREFIX as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
......@@ -149,7 +125,7 @@ option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
......@@ -164,48 +140,86 @@ you can use the `configure' options `--x-includes=DIR' and
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
There may be some features `configure' cannot figure out automatically,
but needs to determine by the type of machine the package will run on.
Usually, assuming the package is built to be run on the _same_
architectures, `configure' can figure that out, but if it prints a
message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
need to know the machine type.
If you are building compiler tools for cross-compiling, you can also
If you are _building_ compiler tools for cross-compiling, you should
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
If you want to set default values for `configure' scripts to share, you
can create a site shell script called `config.site' that gives default
values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
Defining Variables
==================
`configure' recognizes the following options to control how it
operates.
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script). Here is a another example:
/bin/bash ./configure CONFIG_SHELL=/bin/bash
Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
configuration-related scripts to be executed by `/bin/bash'.
`configure' Invocation
======================
`configure' recognizes the following options to control how it operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
......@@ -217,9 +231,6 @@ operates.
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.
......@@ -49,24 +49,35 @@ AM_GLIB_GNU_GETTEXT
dnl ================================================================
dnl Start of pkg-config checks
dnl ================================================================
PKG_CHECK_MODULES(GLADE, gtk+-2.0 >= 2.8.0 libxml-2.0 >= 2.4.0)
AC_SUBST(GLADE_LIBS)
AC_SUBST(GLADE_CFLAGS)
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.8.0 libxml-2.0 >= 2.4.0)
PKG_CHECK_MODULES(DEVHELP, libdevhelp-1.0 >= 0.11,
[have_devhelp=yes],[have_devhelp=no])
AM_CONDITIONAL(WITH_DEVHELP, test x"$have_devhelp" = "xyes")
glade_version="${VERSION}"
glade_datadir='${datadir}/${PACKAGE}'
glade_libdir='${libdir}/${PACKAGE}'
glade_catalogsdir='${glade_datadir}/catalogs'
glade_modulesdir='${glade_libdir}/modules'
glade_pixmapsdir='${glade_datadir}/pixmaps'
glade_modulesdir='${glade_libdir}/modules'
glade_pluginsdir='${glade_libdir}/plugins'
glade_icondir='${datadir}/pixmaps'
glade_localedir='${prefix}/${DATADIRNAME}/locale'
AC_SUBST(GTK_LIBS)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(DEVHELP_LIBS)
AC_SUBST(DEVHELP_CFLAGS)
AC_SUBST(HAVE_DEVHELP)
AC_SUBST(glade_version)
AC_SUBST(glade_datadir)
AC_SUBST(glade_libdir)
AC_SUBST(glade_catalogsdir)
AC_SUBST(glade_modulesdir)
AC_SUBST(glade_pluginsdir)
AC_SUBST(glade_pixmapsdir)
AC_SUBST(glade_icondir)
AC_SUBST(glade_localedir)
......@@ -99,5 +110,7 @@ Configuration:
Source code location: ${srcdir}
Compiler: ${CC}
Devhelp module: ${have_devhelp}
"
## Process this file with automake to produce Makefile.in
SUBDIRS=
bin_PROGRAMS = glade-3
lib_LTLIBRARIES = libgladeui-1.la
gladegtk_LTLIBRARIES = libgladegtk.la
gladegtkdir = $(glade_modulesdir)
BUILT_SOURCES = \
glade-marshallers.c \
glade-marshallers.h \
......@@ -15,21 +13,55 @@ BUILT_SOURCES = \
CLEANFILES = $(BUILT_SOURCES)
EXTRA_DIST = glade-marshallers.list
libgladegtk_la_SOURCES = glade-gtk.c
libgladegtk_la_LDFLAGS = -module -avoid-version
libgladegtk_la_LIBADD = libgladeui-1.la $(GLADE_LIBS)
AM_CFLAGS = -g -Wall \
-I$(top_srcdir) \
-I$(top_builddir) \
$(GLADE_CFLAGS)
# The main application code
#
glade_3_CFLAGS = \
-g -Wall \
-I$(top_srcdir) \
-I$(top_builddir) \
$(GTK_CFLAGS)
glade_3_LDADD = libgladeui-1.la
glade_3_SOURCES = \
glade-project-window.c glade-project-window.h \
main.c
# The GTK catalog backend
gladegtk_LTLIBRARIES = libgladegtk.la
gladegtkdir = $(glade_modulesdir)
libgladegtk_la_CFLAGS = \
-g -Wall \
-I$(top_srcdir) \
-I$(top_builddir) \
$(GTK_CFLAGS)
libgladegtk_la_SOURCES = glade-gtk.c
libgladegtk_la_LDFLAGS = -module -avoid-version
libgladegtk_la_LIBADD = libgladeui-1.la $(GTK_LIBS)
# The Devhelp plugin
if WITH_DEVHELP
gladedevhelp_LTLIBRARIES = libgladedevhelp.la
gladedevhelpdir = $(glade_pluginsdir)
libgladedevhelp_la_CFLAGS = \
-g -Wall \
-I$(top_srcdir) \
-I$(top_builddir) \
$(DEVHELP_CFLAGS)
libgladedevhelp_la_SOURCES = glade-devhelp.c
libgladedevhelp_la_LDFLAGS = -module -avoid-version
libgladedevhelp_la_LIBADD = $(DEVHELP_LIBS)
endif
# The glade-3 core library
libgladeui_1_la_SOURCES = \
glade-debug.c \
glade-project.c \
......@@ -62,9 +94,15 @@ libgladeui_1_la_SOURCES = \
glade-fixed-manager.c \
glade-app.c
libgladeui_1_la_CFLAGS = -DINSIDE_LIBGLADEUI $(AM_CFLAGS)
libgladeui_1_la_CFLAGS = \
-DINSIDE_LIBGLADEUI \
-g -Wall \
-I$(top_srcdir) \
-I$(top_builddir) \
$(GTK_CFLAGS)
libgladeui_1_la_LDFLAGS = -version-info $(GLADE_CURRENT):$(GLADE_REVISION):$(GLADE_AGE)
libgladeui_1_la_LIBADD = $(GLADE_LIBS)
libgladeui_1_la_LIBADD = $(GTK_LIBS)
libgladeuiincludedir=$(includedir)/libgladeui-1.0/libgladeui
libgladeuiinclude_HEADERS = \
......@@ -108,6 +146,11 @@ pkgconfig_DATA = libgladeui-1.0.pc glade-3.pc
if WITH_WIN32
libgladegtk_la_LDFLAGS += -no-undefined
libgladeui_1_la_LDFLAGS += -no-undefined
if WITH_DEVHELP
libgladedevhelp_la_LDFLAGS += -no-undefined
endif
endif
#
......
......@@ -102,6 +102,7 @@ static guint glade_app_signals[LAST_SIGNAL] = { 0 };
gchar *glade_pixmaps_dir = GLADE_PIXMAPSDIR;
gchar *glade_catalogs_dir = GLADE_CATALOGSDIR;
gchar *glade_modules_dir = GLADE_MODULESDIR;
gchar *glade_plugins_dir = GLADE_PLUGINSDIR;
gchar *glade_locale_dir = GLADE_LOCALEDIR;
gchar *glade_icon_dir = GLADE_ICONDIR;
gboolean glade_verbose = FALSE;
......
......@@ -14,6 +14,7 @@ glade_datadir="@glade_datadir@"
glade_libdir="@glade_libdir@"
glade_catalogsdir="@glade_catalogsdir@"
glade_modulesdir="@glade_modulesdir@"
glade_pluginsdir="@glade_pluginsdir@"
glade_pixmapsdir="@glade_pixmapsdir@"
glade_icondir="@glade_icondir@"
glade_localedir="@glade_localedir@"
......@@ -29,6 +30,7 @@ cat <<EOF
#define GLADE_LIBDIR "$glade_libdir"
#define GLADE_CATALOGSDIR "$glade_catalogsdir"
#define GLADE_MODULESDIR "$glade_modulesdir"
#define GLADE_PLUGINSDIR "$glade_pluginsdir"
#define GLADE_PIXMAPSDIR "$glade_pixmapsdir"
#define GLADE_ICONDIR "$glade_icondir"
#define GLADE_LOCALEDIR "$glade_localedir"
......
......@@ -64,6 +64,8 @@ struct _GladeProjectWindowPriv {
GtkWindow *palette_window; /* The window that will contain the palette */
GtkWindow *editor_window; /* The window that will contain the editor */
GtkWidget *devhelp; /* The embedded devhelp widget */
GtkWidget *devhelp_paned; /* A handle to control the devhelp paned window. */
};
#define WINDOW_TITLE (_("Glade-3 GUI Builder"))
......@@ -971,7 +973,8 @@ gpw_doc_search_cb (GladeEditor *editor,
const gchar *search,
GladeProjectWindow *gpw)
{
glade_util_search_devhelp (book, page, search);
gtk_paned_set_position (GTK_PANED (gpw->priv->devhelp_paned), 0);
glade_util_search_devhelp (gpw->priv->devhelp, book, page, search);
}
static void
......@@ -985,7 +988,7 @@ gpw_create_editor (GladeProjectWindow *gpw)
gtk_window_set_default_size (GTK_WINDOW (gpw->priv->editor_window), 400, 450);
gtk_window_set_title (gpw->priv->editor_window, _("Properties"));
gtk_window_move (gpw->priv->editor_window, 350, 0);
gtk_window_move (gpw->priv->editor_window, 550, 0);
gtk_container_add (GTK_CONTAINER (gpw->priv->editor_window),
GTK_WIDGET (glade_app_get_editor ()));
......@@ -1008,6 +1011,7 @@ gpw_create_editor (GladeProjectWindow *gpw)
"/MenuBar/ViewMenu/PropertyEditorHelp");
if (glade_util_have_devhelp())
{
glade_editor_show_info (glade_app_get_editor ());
glade_editor_hide_context_info (glade_app_get_editor ());
g_signal_connect (G_OBJECT (glade_app_get_editor ()), "gtk-doc-search",
......@@ -1019,8 +1023,6 @@ gpw_create_editor (GladeProjectWindow *gpw)
{
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (editor_item), FALSE);
gtk_widget_set_sensitive (editor_item, FALSE);
g_message ("No devhelp detected, informational buttons disabled");
}
}
......@@ -1598,6 +1600,15 @@ gpw_delete_event (GtkWindow *w, GdkEvent *event, GladeProjectWindow *gpw)
return TRUE;
}
gboolean
initiate_devhelp_search (GladeProjectWindow *gpw)
{
/* Search after adding to heirarchy */
glade_util_search_devhelp (gpw->priv->devhelp,
"gladeui", NULL, NULL);
return FALSE;
}
static void
glade_project_window_create (GladeProjectWindow *gpw)
{
......@@ -1628,8 +1639,26 @@ glade_project_window_create (GladeProjectWindow *gpw)
gtk_box_pack_start (GTK_BOX (vbox), menubar, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), project_view, TRUE, TRUE, 0);
if ((gpw->priv->devhelp = glade_util_load_devhelp ()) != NULL)
{
gpw->priv->devhelp_paned = gtk_hpaned_new();
gtk_paned_add1 (GTK_PANED (gpw->priv->devhelp_paned),
project_view);
gtk_paned_add2 (GTK_PANED (gpw->priv->devhelp_paned),
gpw->priv->devhelp);
gtk_box_pack_start (GTK_BOX (vbox), gpw->priv->devhelp_paned,
TRUE, TRUE, 0);
g_idle_add ((GSourceFunc)initiate_devhelp_search, gpw);
}
else
gtk_box_pack_start (GTK_BOX (vbox), project_view, TRUE, TRUE, 0);
gtk_box_pack_end (GTK_BOX (vbox), statusbar, FALSE, TRUE, 0);
gtk_widget_show (vbox);
gpw_recent_project_config_load (gpw);
......
......@@ -1606,63 +1606,115 @@ glade_util_file_is_writeable (const gchar *path)
return FALSE;
}
/* The devhelp module api here
*/
static GModule *devhelp_mod = NULL;
static GtkWidget *(* glade_dh_widget_new) (void) = NULL;
static void (* glade_dh_widget_search) (GtkWidget *, const gchar *) = NULL;
/**
* glade_util_have_devhelp:
* glade_util_load_devhelp:
*
* FIXME: This should also parse the output of devhelp --version
* and check if it supports the search features we need.
* Attempts to load the devhelp module
*
* Returns: the devhelp widget if successfull (%NULL otherwise)
*
* Returns: whether we can use devhelp
*/
gboolean
glade_util_have_devhelp (void)
GtkWidget *
glade_util_load_devhelp (void)
{
gboolean have_devhelp = FALSE;
gchar *path;
static GtkWidget *widget = NULL;
gchar *path;
if ((path = g_find_program_in_path ("devhelp")) != NULL)
if (devhelp_mod == NULL &&
(path = g_module_build_path (glade_plugins_dir,
"gladedevhelp")) != NULL)
{
have_devhelp = TRUE;
if ((devhelp_mod =
g_module_open (path, G_MODULE_BIND_LOCAL)) != NULL)
{
if (!g_module_symbol (devhelp_mod,
"glade_dh_widget_new",
(gpointer)&glade_dh_widget_new))
{
g_critical ("Failed to load 'glade_dh_widget_new' "
"symbol from the devhelp module (%s)",
g_module_error ());
g_module_close (devhelp_mod);
devhelp_mod = NULL;