gtk: clean up the private horror

- add gtkmodulesprivate.h and move stuff there from gtkprivate.h
- add gtkprivate.c and move stuff there from gtkmain.c
- add gtkwin32.c and move stuff there from gtkmain.c
- don't redefine GTK_DATADIR and friends in gtkprivate.h
- have _gtk_get_datadir() and friends on all platforms
- remove the horrid hacks where gtkprivate.h can't be included,
  or must be included later due to redefinition of the compile-time
  directories
This commit is contained in:
Michael Natterer
2011-10-22 08:48:13 +02:00
parent 88ad614c73
commit 2688ccdbc4
18 changed files with 450 additions and 344 deletions

View File

@ -36,17 +36,9 @@
#include "gtkimcontextsimple.h"
#include "gtksettings.h"
#include "gtkmainprivate.h"
#include "gtkprivate.h"
#include "gtkintl.h"
/* Do *not* include "gtkprivate.h" in this file. If you do, the
* correct_libdir_prefix() and correct_localedir_prefix() functions
* below will have to move somewhere else.
*/
#ifdef __GTK_PRIVATE_H__
#error gtkprivate.h should not be included in this file
#endif
#define SIMPLE_ID "gtk-im-context-simple"
/**
@ -239,10 +231,7 @@ add_module (GtkIMModule *module, GSList *infos)
static void
correct_libdir_prefix (gchar **path)
{
/* GTK_LIBDIR here is supposed to still have the definition from
* Makefile.am, i.e. the build-time value. Do *not* include gtkprivate.h
* in this file.
*/
/* GTK_LIBDIR is the build-time libdir */
if (strncmp (*path, GTK_LIBDIR, strlen (GTK_LIBDIR)) == 0)
{
/* This is an entry put there by make install on the
@ -253,7 +242,6 @@ correct_libdir_prefix (gchar **path)
* builder's machine. Replace the path with the real
* one on this machine.
*/
extern const gchar *_gtk_get_libdir ();
gchar *tem = *path;
*path = g_strconcat (_gtk_get_libdir (), tem + strlen (GTK_LIBDIR), NULL);
g_free (tem);
@ -263,12 +251,9 @@ correct_libdir_prefix (gchar **path)
static void
correct_localedir_prefix (gchar **path)
{
/* As above, but for GTK_LOCALEDIR. Use separate function in case
* GTK_LOCALEDIR isn't a subfolder of GTK_LIBDIR.
*/
/* See above */
if (strncmp (*path, GTK_LOCALEDIR, strlen (GTK_LOCALEDIR)) == 0)
{
extern const gchar *_gtk_get_localedir ();
gchar *tem = *path;
*path = g_strconcat (_gtk_get_localedir (), tem + strlen (GTK_LOCALEDIR), NULL);
g_free (tem);