Commit 0e1af3ee authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

app/actions/Makefile.am app/actions/file-open-actions.[ch] actions for the

2004-04-29  Michael Natterer  <mitch@gimp.org>

	* app/actions/Makefile.am
	* app/actions/file-open-actions.[ch]
	* app/actions/file-save-actions.[ch]: actions for the <Load> and
	<Save> menus...

	* menus/Makefile.am
	* menus/file-open-menu.xml
	* menus/file-save-menu.xml: ...and the menus.

	* app/gui/file-open-menu.[ch]
	* app/gui/file-save-menu.[ch]: ported to UI Manager.

	* app/widgets/gimpfiledialog.[ch]: ditto.

	* app/actions/actions.c
	* app/gui/menus.c
	* app/gui/file-open-dialog.c
	* app/gui/file-save-dialog.c: changed accordingly.

	* app/widgets/gimpuimanager.c: removed debugging code which
	automatically loaded all registered menus. They are now loaded on
parent d79ed2a0
2004-04-29 Michael Natterer <mitch@gimp.org>
* app/actions/Makefile.am
* app/actions/file-open-actions.[ch]
* app/actions/file-save-actions.[ch]: actions for the <Load> and
<Save> menus...
* menus/Makefile.am
* menus/file-open-menu.xml
* menus/file-save-menu.xml: ...and the menus.
* app/gui/file-open-menu.[ch]
* app/gui/file-save-menu.[ch]: ported to UI Manager.
* app/widgets/gimpfiledialog.[ch]: ditto.
* app/actions/actions.c
* app/gui/menus.c
* app/gui/file-open-dialog.c
* app/gui/file-save-dialog.c: changed accordingly.
* app/widgets/gimpuimanager.c: removed debugging code which
automatically loaded all registered menus. They are now loaded on
demand only.
2004-04-29 Michael Natterer <mitch@gimp.org>
* libgimpbase/gimputils.[ch] (gimp_escape_uline): new function
......
......@@ -55,6 +55,12 @@ libappactions_a_SOURCES = \
file-actions.h \
file-commands.c \
file-commands.h \
file-open-actions.c \
file-open-actions.h \
file-save-actions.c \
file-save-actions.h \
file-commands.c \
file-commands.h \
fonts-actions.c \
fonts-actions.h \
fonts-commands.c \
......
......@@ -40,6 +40,8 @@
#include "edit-actions.h"
#include "error-console-actions.h"
#include "file-actions.h"
#include "file-open-actions.h"
#include "file-save-actions.h"
#include "fonts-actions.h"
#include "gradient-editor-actions.h"
#include "gradients-actions.h"
......@@ -105,6 +107,12 @@ static GimpActionFactoryEntry action_groups[] =
{ "file",
file_actions_setup,
file_actions_update },
{ "file-open",
file_open_actions_setup,
file_open_actions_update },
{ "file-save",
file_save_actions_setup,
file_save_actions_update },
{ "fonts",
fonts_actions_setup,
fonts_actions_update },
......
/* 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 "actions-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/gimpactiongroup.h"
#include "widgets/gimphelp-ids.h"
#include "file-commands.h"
#include "file-open-actions.h"
#include "gimp-intl.h"
static GimpActionEntry file_open_actions[] =
{
{ "file-open-popup", NULL, N_("File Open Menu") },
{ "file-open-automatic", NULL,
N_("Automatic"), NULL, NULL,
G_CALLBACK (file_type_cmd_callback),
GIMP_HELP_FILE_OPEN_BY_EXTENSION }
};
void
file_open_actions_setup (GimpActionGroup *group)
{
GSList *list;
gimp_action_group_add_actions (group,
file_open_actions,
G_N_ELEMENTS (file_open_actions));
for (list = group->gimp->load_procs; list; list = g_slist_next (list))
{
PlugInProcDef *file_proc = list->data;
const gchar *locale_domain = NULL;
const gchar *stock_id = NULL;
gchar *help_id;
GimpActionEntry entry;
gboolean is_xcf;
GtkAction *action;
if (! file_proc->menu_path)
continue;
is_xcf = (strcmp (file_proc->db_info.name, "gimp_xcf_load") == 0);
if (is_xcf)
{
stock_id = GIMP_STOCK_WILBER;
help_id = g_strdup (GIMP_HELP_FILE_OPEN_XCF);
}
else
{
const gchar *progname;
const gchar *help_domain;
progname = plug_in_proc_def_get_progname (file_proc);
locale_domain = plug_ins_locale_domain (group->gimp, progname, NULL);
help_domain = plug_ins_help_domain (group->gimp, progname, NULL);
help_id = plug_in_proc_def_get_help_id (file_proc, help_domain);
}
entry.name = file_proc->db_info.name;
entry.stock_id = stock_id;
entry.label = strstr (file_proc->menu_path, "/") + 1;
entry.tooltip = NULL;
entry.callback = G_CALLBACK (file_type_cmd_callback);
entry.help_id = help_id;
gimp_action_group_add_actions (group, &entry, 1);
g_free (help_id);
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
file_proc->db_info.name);
g_object_set_data (G_OBJECT (action), "file-proc", file_proc);
}
}
void
file_open_actions_update (GimpActionGroup *group,
gpointer data)
{
}
/* 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.
*/
#ifndef __FILE_OPEN_ACTIONS_H__
#define __FILE_OPEN_ACTIONS_H__
void file_open_actions_setup (GimpActionGroup *group);
void file_open_actions_update (GimpActionGroup *group,
gpointer data);
#endif /* __FILE_OPEN_ACTIONS_H__ */
/* 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 "actions-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/gimpactiongroup.h"
#include "widgets/gimphelp-ids.h"
#include "file-commands.h"
#include "file-save-actions.h"
#include "gimp-intl.h"
static GimpActionEntry file_save_actions[] =
{
{ "file-save-popup", NULL, N_("File Save Menu") },
{ "file-save-by-extension", NULL,
N_("By Extension"), NULL, NULL,
G_CALLBACK (file_type_cmd_callback),
GIMP_HELP_FILE_SAVE_BY_EXTENSION }
};
void
file_save_actions_setup (GimpActionGroup *group)
{
GSList *list;
gimp_action_group_add_actions (group,
file_save_actions,
G_N_ELEMENTS (file_save_actions));
for (list = group->gimp->save_procs; list; list = g_slist_next (list))
{
PlugInProcDef *file_proc = list->data;
const gchar *locale_domain = NULL;
const gchar *stock_id = NULL;
gchar *help_id;
GimpActionEntry entry;
gboolean is_xcf;
GtkAction *action;
if (! file_proc->menu_path)
continue;
is_xcf = (strcmp (file_proc->db_info.name, "gimp_xcf_save") == 0);
if (is_xcf)
{
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 (group->gimp, progname, NULL);
help_domain = plug_ins_help_domain (group->gimp, progname, NULL);
help_id = plug_in_proc_def_get_help_id (file_proc, help_domain);
}
entry.name = file_proc->db_info.name;
entry.stock_id = stock_id;
entry.label = strstr (file_proc->menu_path, "/") + 1;
entry.tooltip = NULL;
entry.callback = G_CALLBACK (file_type_cmd_callback);
entry.help_id = help_id;
gimp_action_group_add_actions (group, &entry, 1);
g_free (help_id);
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
file_proc->db_info.name);
g_object_set_data (G_OBJECT (action), "file-proc", file_proc);
}
}
void
file_save_actions_update (GimpActionGroup *group,
gpointer data)
{
}
/* 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.
*/
#ifndef __FILE_SAVE_ACTIONS_H__
#define __FILE_SAVE_ACTIONS_H__
void file_save_actions_setup (GimpActionGroup *group);
void file_save_actions_update (GimpActionGroup *group,
gpointer data);
#endif /* __FILE_SAVE_ACTIONS_H__ */
......@@ -100,7 +100,7 @@ file_open_dialog_create (Gimp *gimp,
dialog = gimp_file_dialog_new (gimp, gimp->load_procs,
GTK_FILE_CHOOSER_ACTION_OPEN,
menu_factory, "<Load>",
menu_factory, "<Load>", "/file-open-popup",
_("Open Image"), "gimp-file-open",
GTK_STOCK_OPEN,
GIMP_HELP_FILE_OPEN);
......
......@@ -148,7 +148,7 @@ file_save_dialog_create (Gimp *gimp,
save_dialog = gimp_file_dialog_new (gimp, gimp->save_procs,
GTK_FILE_CHOOSER_ACTION_SAVE,
menu_factory, "<Save>",
menu_factory, "<Save>", "/file-save-popup",
_("Save Image"), "gimp-file-save",
GTK_STOCK_SAVE,
GIMP_HELP_FILE_SAVE);
......
......@@ -100,7 +100,7 @@ file_open_dialog_create (Gimp *gimp,
dialog = gimp_file_dialog_new (gimp, gimp->load_procs,
GTK_FILE_CHOOSER_ACTION_OPEN,
menu_factory, "<Load>",
menu_factory, "<Load>", "/file-open-popup",
_("Open Image"), "gimp-file-open",
GTK_STOCK_OPEN,
GIMP_HELP_FILE_OPEN);
......
......@@ -22,106 +22,43 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimp.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 "widgets/gimpuimanager.h"
#include "file-open-menu.h"
#include "gimp-intl.h"
GimpItemFactoryEntry file_open_menu_entries[] =
{
{ { N_("/Automatic"), NULL,
file_type_cmd_callback, 0 },
NULL,
GIMP_HELP_FILE_OPEN_BY_EXTENSION, NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" }, NULL, NULL, NULL }
};
gint n_file_open_menu_entries = G_N_ELEMENTS (file_open_menu_entries);
void
file_open_menu_setup (GimpItemFactory *factory,
gpointer callback_data)
file_open_menu_setup (GimpUIManager *manager,
const gchar *ui_path)
{
GSList *list;
guint merge_id;
for (list = factory->gimp->load_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;
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
is_xcf = (strcmp (file_proc->db_info.name, "gimp_xcf_load") == 0);
for (list = manager->gimp->load_procs; list; list = g_slist_next (list))
{
PlugInProcDef *file_proc = list->data;
gchar *path;
if (is_xcf)
{
item_type = "<StockItem>";
stock_id = GIMP_STOCK_WILBER;
help_id = g_strdup (GIMP_HELP_FILE_OPEN_XCF);
}
if (! strcmp (file_proc->db_info.name, "gimp_xcf_load"))
path = g_strdup_printf ("%s/%s", ui_path, "Internal");
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);
path = g_strdup (ui_path);
if (is_xcf)
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
menu_item, 1);
}
gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
path,
file_proc->db_info.name,
file_proc->db_info.name,
GTK_UI_MANAGER_MENUITEM,
FALSE);
g_free (help_id);
g_free (path);
}
}
......@@ -20,12 +20,8 @@
#define __FILE_OPEN_MENU_H__
extern GimpItemFactoryEntry file_open_menu_entries[];
extern gint n_file_open_menu_entries;
void file_open_menu_setup (GimpItemFactory *factory,
gpointer callback_data);
void file_open_menu_setup (GimpUIManager *manager,
const gchar *ui_path);
#endif /* __FILE_OPEN_MENU_H__ */
......@@ -148,7 +148,7 @@ file_save_dialog_create (Gimp *gimp,
save_dialog = gimp_file_dialog_new (gimp, gimp->save_procs,
GTK_FILE_CHOOSER_ACTION_SAVE,
menu_factory, "<Save>",
menu_factory, "<Save>", "/file-save-popup",
_("Save Image"), "gimp-file-save",
GTK_STOCK_SAVE,
GIMP_HELP_FILE_SAVE);
......
......@@ -22,113 +22,43 @@
#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 "widgets/gimpuimanager.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)
file_save_menu_setup (GimpUIManager *manager,
const gchar *ui_path)
{
GSList *list;
guint merge_id;
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;
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
if (! file_proc->menu_path)
continue;
is_xcf = (strcmp (file_proc->db_info.name, "gimp_xcf_save") == 0);
for (list = manager->gimp->save_procs; list; list = g_slist_next (list))
{