mirror of https://github.com/GNOME/gimp.git
replaced HAVE_GDK_QUARTZ conditional by --disable-toolbox-menu configure
2007-09-18 Michael Natterer <mitch@gimp.org> * configure.in: replaced HAVE_GDK_QUARTZ conditional by --disable-toolbox-menu configure switch which defaults to "yes" normally and to "no" on quartz. * app/widgets/gimptoolbox.c: changed #ifdef accordingly. * app/plug-in/Makefile.am * app/plug-in/plug-in-menu-path.[ch]: new generic machanism to map around menu locations. If ENABLE_TOOLBOX_MENU is false, map "Xtns" and "Help" from <Toolbox> to <Image>. * app/plug-in/gimppluginmanager-menu-branch.c * app/plug-in/gimppluginprocedure.c: run all menu paths through the new mapping function. * menus/Makefile.am * menus/menus.xsl * menus/image-menu.xml.in: add both the "Xtns" and "Help" menus to the image menubar if TOOLBOX_MENU is false. svn path=/trunk/; revision=23581
This commit is contained in:
parent
6293c5bc2e
commit
26e11d5fc3
22
ChangeLog
22
ChangeLog
|
@ -1,3 +1,25 @@
|
|||
2007-09-18 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* configure.in: replaced HAVE_GDK_QUARTZ conditional by
|
||||
--disable-toolbox-menu configure switch which defaults to "yes"
|
||||
normally and to "no" on quartz.
|
||||
|
||||
* app/widgets/gimptoolbox.c: changed #ifdef accordingly.
|
||||
|
||||
* app/plug-in/Makefile.am
|
||||
* app/plug-in/plug-in-menu-path.[ch]: new generic machanism to map
|
||||
around menu locations. If ENABLE_TOOLBOX_MENU is false, map
|
||||
"Xtns" and "Help" from <Toolbox> to <Image>.
|
||||
|
||||
* app/plug-in/gimppluginmanager-menu-branch.c
|
||||
* app/plug-in/gimppluginprocedure.c: run all menu paths through the
|
||||
new mapping function.
|
||||
|
||||
* menus/Makefile.am
|
||||
* menus/menus.xsl
|
||||
* menus/image-menu.xml.in: add both the "Xtns" and "Help" menus to
|
||||
the image menubar if TOOLBOX_MENU is false.
|
||||
|
||||
2007-09-18 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* tools/pdbgen/pdb/fileops.pdb: canonicalize the name of the
|
||||
|
|
|
@ -68,6 +68,8 @@ libappplug_in_a_SOURCES = \
|
|||
gimptemporaryprocedure.c \
|
||||
gimptemporaryprocedure.h \
|
||||
\
|
||||
plug-in-menu-path.c \
|
||||
plug-in-menu-path.h \
|
||||
plug-in-params.c \
|
||||
plug-in-params.h \
|
||||
plug-in-rc.c \
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "gimppluginmanager.h"
|
||||
#include "gimppluginmanager-menu-branch.h"
|
||||
#include "plug-in-menu-path.h"
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
@ -67,13 +68,15 @@ gimp_plug_in_manager_add_menu_branch (GimpPlugInManager *manager,
|
|||
branch = g_slice_new (GimpPlugInMenuBranch);
|
||||
|
||||
branch->prog_name = g_strdup (prog_name);
|
||||
branch->menu_path = g_strdup (menu_path);
|
||||
branch->menu_path = plug_in_menu_path_map (menu_path);
|
||||
branch->menu_label = g_strdup (menu_label);
|
||||
|
||||
manager->menu_branches = g_slist_append (manager->menu_branches, branch);
|
||||
|
||||
g_signal_emit_by_name (manager, "menu-branch-added",
|
||||
prog_name, menu_path, menu_label);
|
||||
branch->prog_name,
|
||||
branch->menu_path,
|
||||
branch->menu_label);
|
||||
|
||||
#ifdef VERBOSE
|
||||
g_print ("added menu branch \"%s\" at path \"%s\"\n",
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#define __YES_I_NEED_GIMP_PLUG_IN_MANAGER_CALL__
|
||||
#include "gimppluginmanager-call.h"
|
||||
#include "gimppluginprocedure.h"
|
||||
#include "plug-in-menu-path.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
@ -334,6 +335,7 @@ gimp_plug_in_procedure_add_menu_path (GimpPlugInProcedure *proc,
|
|||
gchar *basename = NULL;
|
||||
const gchar *required = NULL;
|
||||
gchar *p;
|
||||
gchar *mapped_path;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc), FALSE);
|
||||
g_return_val_if_fail (menu_path != NULL, FALSE);
|
||||
|
@ -483,10 +485,12 @@ gimp_plug_in_procedure_add_menu_path (GimpPlugInProcedure *proc,
|
|||
|
||||
g_free (basename);
|
||||
|
||||
proc->menu_paths = g_list_append (proc->menu_paths, g_strdup (menu_path));
|
||||
mapped_path = plug_in_menu_path_map (menu_path);
|
||||
|
||||
proc->menu_paths = g_list_append (proc->menu_paths, mapped_path);
|
||||
|
||||
g_signal_emit (proc, gimp_plug_in_procedure_signals[MENU_PATH_ADDED], 0,
|
||||
menu_path);
|
||||
mapped_path);
|
||||
|
||||
return TRUE;
|
||||
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* plug-in-menu-path.c
|
||||
*
|
||||
* 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 "config.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "glib-object.h"
|
||||
|
||||
#include "plug-in-types.h"
|
||||
|
||||
#include "plug-in-menu-path.h"
|
||||
|
||||
|
||||
typedef struct _MenuPathMapping MenuPathMapping;
|
||||
|
||||
struct _MenuPathMapping
|
||||
{
|
||||
const gchar *orig_path;
|
||||
const gchar *mapped_path;
|
||||
};
|
||||
|
||||
|
||||
static const MenuPathMapping menu_path_mappings[] =
|
||||
{
|
||||
#ifndef ENABLE_TOOLBOX_MENU
|
||||
{ "<Toolbox>/Xtns", "<Image>/Xtns" },
|
||||
{ "<Toolbox>/Help", "<Image>/Help" }
|
||||
#endif /* ENABLE_TOOLBOX_MENU */
|
||||
};
|
||||
|
||||
|
||||
gchar *
|
||||
plug_in_menu_path_map (const gchar *menu_path)
|
||||
{
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (menu_path != NULL, NULL);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (menu_path_mappings); i++)
|
||||
{
|
||||
const MenuPathMapping *mapping = &menu_path_mappings[i];
|
||||
|
||||
if (g_str_has_prefix (menu_path, mapping->orig_path))
|
||||
{
|
||||
gint orig_len = strlen (mapping->orig_path);
|
||||
gchar *mapped_path;
|
||||
|
||||
if (strlen (menu_path) > orig_len)
|
||||
mapped_path = g_strconcat (mapping->mapped_path,
|
||||
menu_path + orig_len,
|
||||
NULL);
|
||||
else
|
||||
mapped_path = g_strdup (mapping->mapped_path);
|
||||
|
||||
#if 0
|
||||
g_printerr ("%s: mapped %s to %s\n", G_STRFUNC,
|
||||
menu_path, mapped_path);
|
||||
#endif
|
||||
|
||||
return mapped_path;
|
||||
}
|
||||
}
|
||||
|
||||
return g_strdup (menu_path);
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* plug-in-menu-path.h
|
||||
*
|
||||
* 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 __PLUG_IN_MENU_PATH_H__
|
||||
#define __PLUG_IN_MENU_PATH_H__
|
||||
|
||||
|
||||
gchar * plug_in_menu_path_map (const gchar *menu_path);
|
||||
|
||||
|
||||
#endif /* __PLUG_IN_MENU_PATH_H__ */
|
|
@ -202,9 +202,9 @@ gimp_toolbox_constructor (GType type,
|
|||
|
||||
manager = GTK_UI_MANAGER (GIMP_IMAGE_DOCK (toolbox)->ui_manager);
|
||||
|
||||
#ifndef GDK_WINDOWING_QUARTZ
|
||||
#ifdef ENABLE_TOOLBOX_MENU
|
||||
toolbox->menu_bar = gtk_ui_manager_get_widget (manager, "/toolbox-menubar");
|
||||
#endif /* !GDK_WINDOWING_QUARTZ */
|
||||
#endif /* ENABLE_TOOLBOX_MENU */
|
||||
|
||||
if (toolbox->menu_bar)
|
||||
{
|
||||
|
|
22
configure.in
22
configure.in
|
@ -878,6 +878,7 @@ if test x"$os_win32" != xyes; then
|
|||
fi
|
||||
fi
|
||||
|
||||
|
||||
#############################
|
||||
# Threads and multi processor
|
||||
#############################
|
||||
|
@ -944,11 +945,24 @@ AC_SUBST(GIMP_REMOTE)
|
|||
AC_SUBST(GIMP_COMMAND)
|
||||
|
||||
|
||||
###############################
|
||||
# Some stuff is quartz specific
|
||||
###############################
|
||||
###################################
|
||||
# Allow to disable the toolbox menu
|
||||
###################################
|
||||
|
||||
AM_CONDITIONAL(HAVE_GDK_QUARTZ, test "x$gdk_target" = "xquartz")
|
||||
AC_ARG_ENABLE(toolbox-menu,
|
||||
[ --disable-toolbox-menu disable the menu in the toolbox (default=depends on platform)], ,
|
||||
if test "x$gdk_target" = "xquartz"; then
|
||||
enable_toolbox_menu=no
|
||||
else
|
||||
enable_toolbox_menu=yes
|
||||
fi)
|
||||
|
||||
if test "x$enable_toolbox_menu" = "xyes"; then
|
||||
AC_DEFINE(ENABLE_TOOLBOX_MENU, 1,
|
||||
[Define to 1 to enable the toolbox menu.])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(TOOLBOX_MENU, test "x$enable_toolbox_menu" = "xyes")
|
||||
|
||||
|
||||
###################
|
||||
|
|
|
@ -52,13 +52,15 @@ if GIMP_UNSTABLE
|
|||
DEBUG_MENU_PARAMS = --stringparam debug-menu yes
|
||||
endif
|
||||
|
||||
if HAVE_GDK_QUARTZ
|
||||
HELP_MENU_PARAMS = --stringparam help-menu yes
|
||||
if TOOLBOX_MENU
|
||||
TOOLBOX_MENU_PARAMS = --stringparam toolbox-menu yes
|
||||
else
|
||||
TOOLBOX_MENU_PARAMS = --stringparam toolbox-menu no
|
||||
endif
|
||||
|
||||
%.xml: %.xml.in $(srcdir)/menus.xsl dialogs-menuitems.xml
|
||||
if HAVE_XSLTPROC
|
||||
$(XSLTPROC) --xinclude $(DEBUG_MENU_PARAMS) $(HELP_MENU_PARAMS) $(srcdir)/menus.xsl $< > $(@) || rm -f $(@)
|
||||
$(XSLTPROC) --xinclude $(DEBUG_MENU_PARAMS) $(TOOLBOX_MENU_PARAMS) $(srcdir)/menus.xsl $< > $(@) || rm -f $(@)
|
||||
else
|
||||
@echo "*** xsltproc is required to build the menus XML files ***"; exit 1;
|
||||
endif
|
||||
|
|
|
@ -589,6 +589,14 @@
|
|||
<separator />
|
||||
</menu>
|
||||
|
||||
<menu action="extensions-menu" name="Xtns">
|
||||
<placeholder name="Extensions">
|
||||
<menuitem action="dialogs-module-dialog"/>
|
||||
</placeholder>
|
||||
<placeholder name="Languages"/>
|
||||
<separator/>
|
||||
</menu>
|
||||
|
||||
<menu action="help-menu" name="Help">
|
||||
<menuitem action="help-help" />
|
||||
<menuitem action="help-context-help" />
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:param name="debug-menu" />
|
||||
<xsl:param name="help-menu" />
|
||||
<xsl:param name="toolbox-menu" />
|
||||
|
||||
<xsl:output method="xml"
|
||||
version="1.0"
|
||||
|
@ -45,8 +45,14 @@
|
|||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="menubar-and-popup/menu[@action='extensions-menu']">
|
||||
<xsl:if test="$toolbox-menu='no'">
|
||||
<xsl:call-template name="identity" />
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="menubar-and-popup/menu[@action='help-menu']">
|
||||
<xsl:if test="$help-menu='yes'">
|
||||
<xsl:if test="$toolbox-menu='no'">
|
||||
<xsl:call-template name="identity" />
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
|
Loading…
Reference in New Issue