Files
gimp/app/gui/file-save-menu.c
Michael Natterer 4654280114 Switch from GtkItemFactory to GtkUIManager. The migration is almost
2004-04-29  Michael Natterer  <mitch@gimp.org>

	Switch from GtkItemFactory to GtkUIManager. The migration is
	almost complete, still stuff missing/incomplete, definitely added
	a bunch of new bugs...

	* app/actions/*-commands.[ch]: converted all callback from
	GtkItemFactory callbacks to GtkAction callbacks.

	* app/actions/debug-actions.c
	* app/actions/gradient-editor-actions.c
	* app/actions/help-actions.c
	* app/actions/plug-in-actions.c
	* app/actions/qmask-actions.c
	* app/actions/tool-options-actions.c: various fixes.

	* app/display/gimpdisplay.[ch]
	* app/display/gimpdisplayshell-appearance.[ch]
	* app/display/gimpdisplayshell-callbacks.c
	* app/display/gimpdisplayshell.[ch]: move everything from
	GtkItemFactory to GtkUIManager.

	* app/gui/dialogs.[ch]: added new function dialogs_get_toolbox().
	Needed because the action callbacks don't have a widget parameter
	and sometimes we need a parent window for showing dialogs.

	* app/gui/Makefile.am
	* app/gui/brushes-menu.[ch]
	* app/gui/buffers-menu.[ch]
	* app/gui/channels-menu.[ch]
	* app/gui/colormap-editor-menu.[ch]
	* app/gui/dialogs-menu.[ch]
	* app/gui/documents-menu.[ch]
	* app/gui/error-console-menu.[ch]
	* app/gui/fonts-menu.[ch]
	* app/gui/gradient-editor-menu.[ch]
	* app/gui/gradients-menu.[ch]
	* app/gui/images-menu.[ch]
	* app/gui/layers-menu.[ch]
	* app/gui/palette-editor-menu.[ch]
	* app/gui/palettes-menu.[ch]
	* app/gui/patterns-menu.[ch]
	* app/gui/qmask-menu.[ch]
	* app/gui/templates-menu.[ch]
	* app/gui/vectors-menu.[ch]: removed these files.

	* app/gui/gui.c: create a global UI manager for the image popup
	menu and the toolbox menubar.

	* app/gui/menus.[ch]: removed all GtkItemFactory code.

	* app/gui/image-menu.[ch]
	* app/gui/toolbox-menu.[ch]: removed everything except the trivial
	setup_funcs.

	* app/gui/file-open-menu.c
	* app/gui/file-save-menu.c
	* app/gui/tool-options-menu.c: don't use the macros from menus.h
	any more, they are gone.

	* app/gui/gui-vtable.c
	* app/gui/plug-in-menus.[ch]: create/destroy the dynamic plug-in
	menu entries.

	* app/tools/gimpimagemaptool.c: s/gimp_item_factory_update/
	gimp_ui_manager_update/g

	* app/widgets/gimpuimanager.[ch]: added API to get an action
	group by name.

	* app/widgets/gimpmenufactory.c: don't choke on the item_factory
	entries being NULL.

	* app/widgets/gimpactiongroup.c: make sure booleans set using
	g_object_set() only have TRUE or FALSE values.

	* app/widgets/gimpcolormapeditor.c
	* app/widgets/gimpcomponenteditor.c
	* app/widgets/gimpcontainereditor.[ch]
	* app/widgets/gimpcontainergridview.c
	* app/widgets/gimpcontainertreeview.c
	* app/widgets/gimpdockable.[ch]
	* app/widgets/gimpdocked.[ch]
	* app/widgets/gimpeditor.[ch]
	* app/widgets/gimperrorconsole.c
	* app/widgets/gimpgradienteditor.c
	* app/widgets/gimpitemtreeview.c
	* app/widgets/gimppaletteeditor.c
	* app/widgets/gimptoolbox.c
	* app/widgets/gimptooloptionseditor.c: removed all GtkItemFactory
	code and enable the #if 0'ed UI manager stuff.

	* menus/gradient-editor-menu.xml: fixed typos.

	* menus/image-menu.xml: duplicate everything so we have both
	an image menubar and an image popup menu. Badly cries for an
	XSL processor.

	* menus/toolbox-menu.xml: added an "Extensions" placeholder.
2004-04-29 12:52:29 +00:00

135 lines
3.9 KiB
C

/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpdrawable.h"
#include "plug-in/plug-in-proc.h"
#include "plug-in/plug-ins.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpitemfactory.h"
#include "actions/file-commands.h"
#include "file-save-menu.h"
#include "gimp-intl.h"
GimpItemFactoryEntry file_save_menu_entries[] =
{
{ { N_("/By Extension"), NULL,
file_type_cmd_callback, 0 },
NULL,
GIMP_HELP_FILE_SAVE_BY_EXTENSION, NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" }, NULL, NULL, NULL }
};
gint n_file_save_menu_entries = G_N_ELEMENTS (file_save_menu_entries);
void
file_save_menu_setup (GimpItemFactory *factory,
gpointer callback_data)
{
GSList *list;
for (list = factory->gimp->save_procs; list; list = g_slist_next (list))
{
PlugInProcDef *file_proc = list->data;
const gchar *locale_domain = NULL;
const gchar *item_type = NULL;
const gchar *stock_id = NULL;
gchar *help_id;
GimpItemFactoryEntry entry;
gboolean is_xcf;
GtkWidget *menu_item;
if (! file_proc->menu_path)
continue;
is_xcf = (strcmp (file_proc->db_info.name, "gimp_xcf_save") == 0);
if (is_xcf)
{
item_type = "<StockItem>";
stock_id = GIMP_STOCK_WILBER;
help_id = g_strdup (GIMP_HELP_FILE_SAVE_XCF);
}
else
{
const gchar *progname;
const gchar *help_domain;
progname = plug_in_proc_def_get_progname (file_proc);
locale_domain = plug_ins_locale_domain (factory->gimp, progname, NULL);
help_domain = plug_ins_help_domain (factory->gimp, progname, NULL);
help_id = plug_in_proc_def_get_help_id (file_proc, help_domain);
}
entry.entry.path = strstr (file_proc->menu_path, "/");
entry.entry.accelerator = NULL;
entry.entry.callback = file_type_cmd_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = (gchar *) item_type;
entry.entry.extra_data = stock_id;
entry.quark_string = NULL;
entry.help_id = help_id;
entry.description = NULL;
gimp_item_factory_create_item (factory,
&entry,
locale_domain,
callback_data, 2, FALSE);
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory),
entry.entry.path);
if (menu_item)
{
g_object_set_data (G_OBJECT (menu_item), "file-proc", file_proc);
if (is_xcf)
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
menu_item, 1);
}
g_free (help_id);
}
}
void
file_save_menu_update (GtkItemFactory *item_factory,
gpointer data)
{
}