Commit dc388813 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

plug-ins/help/domain.[ch] removed these files...

2006-11-20  Michael Natterer  <mitch@gimp.org>

	* plug-ins/help/domain.[ch]
	* plug-ins/help/help.h: removed these files...

	* plug-ins/help/gimphelptypes.h
	* plug-ins/help/gimphelp.[ch]
	* plug-ins/help/gimphelpdomain.[ch]
	* plug-ins/help/gimphelpitem.[ch]
	* plug-ins/help/gimphelplocale.[ch]: ...completely chopped them
	and added a new private utility library. Soon to be used by the
	helpbrowser too.

	* plug-ins/help/Makefile.am
	* plug-ins/help/gimp-help-lookup.c
	* plug-ins/help/help.c: changed accordingly.
parent 73b1863a
2006-11-20 Michael Natterer <mitch@gimp.org>
* plug-ins/help/domain.[ch]
* plug-ins/help/help.h: removed these files...
* plug-ins/help/gimphelptypes.h
* plug-ins/help/gimphelp.[ch]
* plug-ins/help/gimphelpdomain.[ch]
* plug-ins/help/gimphelpitem.[ch]
* plug-ins/help/gimphelplocale.[ch]: ...completely chopped and
added as new private utility library. Soon to be used by the
helpbrowser too.
* plug-ins/help/Makefile.am
* plug-ins/help/gimp-help-lookup.c
* plug-ins/help/help.c: changed accordingly.
2006-11-20 Simon Budig <simon@gimp.org>
* app/vectors/gimpstroke.[ch]
......
## Process this file with automake to produce Makefile.in
libgimphelp = libgimphelp-$(GIMP_API_VERSION).la
libgimp = $(top_builddir)/libgimp/libgimp-$(GIMP_API_VERSION).la
libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la
libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
......@@ -13,17 +14,25 @@ AM_CPPFLAGS = -DDATADIR=\""$(gimpdatadir)"\"
AM_LDFLAGS = $(mwindows)
lib_LTLIBRARIES = libgimphelp-2.0.la
libgimphelp_2_0_la_SOURCES = \
gimphelptypes.h \
gimphelp.c \
gimphelp.h \
gimphelpdomain.c \
gimphelpdomain.h \
gimphelpitem.c \
gimphelpitem.h \
gimphelplocale.c \
gimphelplocale.h \
help.h
libexecdir = $(gimpplugindir)/plug-ins
libexec_PROGRAMS = help
help_SOURCES = \
domain.c \
domain.h \
locales.c \
locales.h \
help.c \
help.h
help_SOURCES = help.c
INCLUDES = \
-I$(top_srcdir) \
......@@ -31,6 +40,7 @@ INCLUDES = \
-I$(includedir)
LDADD = \
$(libgimphelp) \
$(libgimp) \
$(libgimpcolor) \
$(libgimpbase) \
......@@ -42,14 +52,9 @@ LDADD = \
noinst_PROGRAMS = gimp-help-lookup
gimp_help_lookup_SOURCES = \
domain.c \
domain.h \
locales.c \
locales.h \
help.h \
gimp-help-lookup.c
gimp_help_lookup_SOURCES = gimp-help-lookup.c
gimp_help_lookup_LDADD = \
$(libgimphelp) \
$(libgimpbase) \
$(GLIB_LIBS)
This diff is collapsed.
......@@ -29,9 +29,7 @@
#include "libgimpbase/gimpversion.h"
#include "libgimpbase/gimpenv.h"
#include "domain.h"
#include "help.h"
#include "locales.h"
#include "gimphelp.h"
static void show_version (void) G_GNUC_NORETURN;
......@@ -99,7 +97,7 @@ main (gint argc,
else
uri = g_filename_to_uri (help_root, NULL, NULL);
domain_register (GIMP_HELP_DEFAULT_DOMAIN, uri, help_root);
gimp_help_register_domain (GIMP_HELP_DEFAULT_DOMAIN, uri, help_root);
g_free (uri);
uri = lookup (GIMP_HELP_DEFAULT_DOMAIN,
......@@ -118,23 +116,17 @@ main (gint argc,
return uri ? EXIT_SUCCESS : EXIT_FAILURE;
}
void
help_exit (void)
{
/* nothing */
}
static gchar *
lookup (const gchar *help_domain,
const gchar *help_locales,
const gchar *help_id)
{
HelpDomain *domain = domain_lookup (help_domain);
GimpHelpDomain *domain = gimp_help_lookup_domain (help_domain);
if (domain)
{
GList *locales = locales_parse (help_locales);
gchar *full_uri = domain_map (domain, locales, help_id);
GList *locales = gimp_help_parse_locales (help_locales);
gchar *full_uri = gimp_help_domain_map (domain, locales, help_id, NULL);
g_list_foreach (locales, (GFunc) g_free, NULL);
g_list_free (locales);
......
This diff is collapsed.
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* The GIMP Help plug-in
* Copyright (C) 1999-2004 Sven Neumann <sven@gimp.org>
* Michael Natterer <mitch@gimp.org>
* Henrik Brix Andersen <brix@gimp.org>
*
* 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.
*/
#ifndef __GIMP_HELP_H__
#define __GIMP_HELP_H__
#include "gimphelptypes.h"
#include "gimphelpdomain.h"
#include "gimphelpitem.h"
#include "gimphelplocale.h"
#define GIMP_HELP_DEFAULT_DOMAIN "http://www.gimp.org/help"
#define GIMP_HELP_DEFAULT_ID "gimp-main"
#define GIMP_HELP_DEFAULT_LOCALE "en"
#define GIMP_HELP_PREFIX "help"
#define GIMP_HELP_ENV_URI "GIMP2_HELP_URI"
#define GIMP_HELP_DEBUG
gboolean gimp_help_init (gint n_domain_names,
gchar **domain_names,
gint n_domain_uris,
gchar **domain_uris);
void gimp_help_exit (void);
void gimp_help_register_domain (const gchar *domain_name,
const gchar *domain_uri,
const gchar *domain_root);
GimpHelpDomain * gimp_help_lookup_domain (const gchar *domain_name);
GList * gimp_help_parse_locales (const gchar *help_locales);
#endif /* ! __GIMP_HELP_H__ */
This diff is collapsed.
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* The GIMP Help plug-in
* Copyright (C) 1999-2004 Sven Neumann <sven@gimp.org>
* Michael Natterer <mitch@gimp.org>
* Henrik Brix Andersen <brix@gimp.org>
*
* 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.
*/
#ifndef __DOMAIN_H__
#define __DOMAIN_H__
struct _GimpHelpDomain
{
gchar *help_domain;
gchar *help_uri;
gchar *help_root;
GHashTable *help_locales;
};
GimpHelpDomain * gimp_help_domain_new (const gchar *domain_name,
const gchar *domain_uri,
const gchar *domain_root);
void gimp_help_domain_free (GimpHelpDomain *domain);
GimpHelpLocale * gimp_help_domain_lookup_locale (GimpHelpDomain *domain,
const gchar *locale_id);
gchar * gimp_help_domain_map (GimpHelpDomain *domain,
GList *help_locales,
const gchar *help_id,
gboolean *fatal_error);
void gimp_help_domain_exit (void);
#endif /* ! __DOMAIN_H__ */
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* The GIMP Help plug-in
* Copyright (C) 1999-2004 Sven Neumann <sven@gimp.org>
* Michael Natterer <mitch@gimp.org>
* Henrik Brix Andersen <brix@gimp.org>
*
* 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.
*/
/* This code is written so that it can also be compiled standalone.
* It shouldn't depend on libgimp.
*/
#include "config.h"
#include <string.h>
#include <glib.h>
#include "gimphelptypes.h"
#include "gimphelpitem.h"
#ifdef DISABLE_NLS
#define _(String) (String)
#else
#include "libgimp/stdplugins-intl.h"
#endif
/* public functions */
GimpHelpItem *
gimp_help_item_new (const gchar *ref,
const gchar *title,
const gchar *parent)
{
GimpHelpItem *item = g_new0 (GimpHelpItem, 1);
item->ref = g_strdup (ref);
item->title = g_strdup (title);
item->parent = g_strdup (parent);
return item;
}
void
gimp_help_item_free (GimpHelpItem *item)
{
g_free (item->ref);
g_free (item->title);
g_free (item->parent);
g_free (item);
}
......@@ -21,22 +21,25 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __DOMAIN_H__
#define __DOMAIN_H__
#ifndef __GIMP_HELP_ITEM_H__
#define __GIMP_HELP_ITEM_H__
typedef struct _HelpDomain HelpDomain;
struct _GimpHelpItem
{
gchar *ref;
gchar *title;
gchar *parent;
GList *children;
gint index;
};
void domain_register (const gchar *domain_name,
const gchar *domain_uri,
const gchar *domain_root);
HelpDomain * domain_lookup (const gchar *domain_name);
gchar * domain_map (HelpDomain *domain,
GList *help_locales,
const gchar *help_id);
void domain_exit (void);
GimpHelpItem * gimp_help_item_new (const gchar *ref,
const gchar *title,
const gchar *parent);
void gimp_help_item_free (GimpHelpItem *item);
#endif /* ! __DOMAIN_H__ */
#endif /* __GIMP_HELP_ITEM_H__ */
This diff is collapsed.
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* The GIMP Help plug-in
* Copyright (C) 1999-2004 Sven Neumann <sven@gimp.org>
* Michael Natterer <mitch@gimp.org>
* Henrik Brix Andersen <brix@gimp.org>
*
* 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.
*/
#ifndef __GIMP_HELP_LOCALE_H__
#define __GIMP_HELP_LOCALE_H__
struct _GimpHelpLocale
{
gchar *locale_id;
GHashTable *help_id_mapping;
gchar *help_missing;
};
GimpHelpLocale * gimp_help_locale_new (const gchar *locale_id);
void gimp_help_locale_free (GimpHelpLocale *locale);
const gchar * gimp_help_locale_map (GimpHelpLocale *locale,
const gchar *help_id);
gboolean gimp_help_locale_parse (GimpHelpLocale *locale,
const gchar *filename,
const gchar *help_domain,
GError **error);
#endif /* __GIMP_HELP_LOCALE_H__ */
......@@ -21,21 +21,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __HELP_H__
#define __HELP_H__
#ifndef __GIMP_HELP_TYPES_H__
#define __GIMP_HELP_TYPES_H__
#define GIMP_HELP_DEFAULT_DOMAIN "http://www.gimp.org/help"
#define GIMP_HELP_DEFAULT_ID "gimp-main"
#define GIMP_HELP_DEFAULT_LOCALE "en"
typedef struct _GimpHelpDomain GimpHelpDomain;
typedef struct _GimpHelpItem GimpHelpItem;
typedef struct _GimpHelpLocale GimpHelpLocale;
#define GIMP_HELP_PREFIX "help"
#define GIMP_HELP_ENV_URI "GIMP2_HELP_URI"
/* #define GIMP_HELP_DEBUG */
void help_exit (void);
#endif /* ! __HELP_H__ */
#endif /* ! __GIMP_HELP_TYPES_H__ */
......@@ -29,9 +29,7 @@
#include "libgimp/gimp.h"
#include "domain.h"
#include "help.h"
#include "locales.h"
#include "gimphelp.h"
#include "libgimp/stdplugins-intl.h"
......@@ -89,14 +87,6 @@ const GimpPlugInInfo PLUG_IN_INFO =
MAIN ()
void
help_exit (void)
{
if (main_loop)
g_main_loop_quit (main_loop);
}
static void
query (void)
{
......@@ -130,54 +120,19 @@ run (const gchar *name,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
const gchar *default_env_domain_uri;
gchar *default_domain_uri;
static GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
INIT_I18N ();
/* set default values */
default_env_domain_uri = g_getenv (GIMP_HELP_ENV_URI);
if (default_env_domain_uri)
{
default_domain_uri = g_strdup (default_env_domain_uri);
}
else
{
gchar *help_root = g_build_filename (gimp_data_directory (),
GIMP_HELP_PREFIX,
NULL);
default_domain_uri = g_filename_to_uri (help_root, NULL, NULL);
g_free (help_root);
}
/* make sure all the arguments are there */
if (nparams == 4)
{
gint num_domain_names = param[0].data.d_int32;
gchar **domain_names = param[1].data.d_stringarray;
gint num_domain_uris = param[2].data.d_int32;
gchar **domain_uris = param[3].data.d_stringarray;
if (num_domain_names == num_domain_uris)
if (! gimp_help_init (param[0].data.d_int32,
param[1].data.d_stringarray,
param[2].data.d_int32,
param[3].data.d_stringarray))
{
gint i;
domain_register (GIMP_HELP_DEFAULT_DOMAIN, default_domain_uri, NULL);
for (i = 0; i < num_domain_names; i++)
{
domain_register (domain_names[i], domain_uris[i], NULL);
}
}
else
{
g_printerr ("help: number of names doesn't match number of URIs.\n");
status = GIMP_PDB_CALLING_ERROR;
}
}
......@@ -188,8 +143,6 @@ run (const gchar *name,
status = GIMP_PDB_CALLING_ERROR;
}
g_free (default_domain_uri);
if (status == GIMP_PDB_SUCCESS)
{
main_loop = g_main_loop_new (NULL, FALSE);
......@@ -305,17 +258,19 @@ load_help (const gchar *procedure,
static gboolean
load_help_idle (gpointer data)
{
IdleHelp *idle_help = data;
HelpDomain *domain;
IdleHelp *idle_help = data;
GimpHelpDomain *domain;
domain = domain_lookup (idle_help->help_domain);
domain = gimp_help_lookup_domain (idle_help->help_domain);
if (domain)
{
GList *locales = locales_parse (idle_help->help_locales);
gchar *full_uri;
GList *locales = gimp_help_parse_locales (idle_help->help_locales);
gchar *full_uri;
gboolean fatal_error;
full_uri = domain_map (domain, locales, idle_help->help_id);
full_uri = gimp_help_domain_map (domain, locales, idle_help->help_id,
&fatal_error);
g_list_foreach (locales, (GFunc) g_free, NULL);
g_list_free (locales);
......@@ -339,6 +294,10 @@ load_help_idle (gpointer data)
g_free (full_uri);
}
else if (fatal_error)
{
g_main_loop_quit (main_loop);
}
}
g_free (idle_help->procedure);
......
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