app/fileops.c app/menus.[ch] app/menus.h show a help page for all menu

1999-10-03  Michael Natterer  <mitch@gimp.org>

	* app/fileops.c
	* app/menus.[ch]
	* app/menus.h
	* app/plug_in.c: show a help page for all menu entries registered
	by plugins.
	Changed menus_create() to menus_create_item_from_full_path() which
	takes a single GimpItemFactoryEntry instead of an array as
	parameter.
This commit is contained in:
Michael Natterer
1999-10-03 16:54:17 +00:00
committed by Michael Natterer
parent bbb7130577
commit 3ed87f4aa4
30 changed files with 1492 additions and 828 deletions

View File

@ -1,3 +1,14 @@
1999-10-03 Michael Natterer <mitch@gimp.org>
* app/fileops.c
* app/menus.[ch]
* app/menus.h
* app/plug_in.c: show a help page for all menu entries registered
by plugins.
Changed menus_create() to menus_create_item_from_full_path() which
takes a single GimpItemFactoryEntry instead of an array as
parameter.
1999-10-03 Michael Natterer <mitch@gimp.org> 1999-10-03 Michael Natterer <mitch@gimp.org>
The GIMP Help System part II: press "F1" while browsing a menu The GIMP Help System part II: press "F1" while browsing a menu
@ -32,6 +43,8 @@
GimpItemFactoryEntry to allow a help path to be stored. GimpItemFactoryEntry to allow a help path to be stored.
Will be partially exported and moved to gimphelp.[ch] later to Will be partially exported and moved to gimphelp.[ch] later to
catch key_press for plug-in menu items (don't try this now ;-) catch key_press for plug-in menu items (don't try this now ;-)
Renamed "Channel Ops" under <Image>/Image to "Channels" and moved
some entries to more useful places.
* app/app_procs.c * app/app_procs.c
* app/brush_edit.c * app/brush_edit.c
@ -71,6 +84,9 @@
* modules/colorsel_triangle.c * modules/colorsel_triangle.c
* modules/colorsel_water.c: register a help page. * modules/colorsel_water.c: register a help page.
* plug-ins/common/compose.c
* plug-ins/common/decompose.c: changed the menu path.
* plug-ins/helpbrowser/helpbrowser.c: load the help files * plug-ins/helpbrowser/helpbrowser.c: load the help files
according to the new help file structure. according to the new help file structure.

View File

@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
GSList *tmp = NULL; GSList *tmp = NULL;
GtkMenuEntry entry; GimpItemFactoryEntry entry;
char *prog = NULL; char *prog = NULL;
int add_proc_def; int add_proc_def;
int i; int i;
@ -1833,12 +1833,23 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
entry.path = proc_install->menu_path; gchar *help_page;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, proc);
} }
break; break;
} }
@ -2254,7 +2265,7 @@ plug_in_add_to_db (void)
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
GSList *tmp; GSList *tmp;
@ -2268,12 +2279,23 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
entry.path = proc_def->menu_path; gchar *help_page;
entry.accelerator = proc_def->accelerator;
entry.callback = plug_in_callback;
entry.callback_data = &proc_def->db_info;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, &proc_def->db_info);
} }
} }
} }
@ -2317,7 +2339,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */ /* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }
@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget,
{ {
gdisp_ID = gdisplay->ID; gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }

View File

@ -161,7 +161,7 @@ file_ops_pre_init (void)
void void
file_ops_post_init (void) file_ops_post_init (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *file_proc; PlugInProcDef *file_proc;
GSList *tmp; GSList *tmp;
@ -171,29 +171,49 @@ file_ops_post_init (void)
tmp = load_procs; tmp = load_procs;
while (tmp) while (tmp)
{ {
gchar *help_page;
file_proc = tmp->data; file_proc = tmp->data;
tmp = tmp->next; tmp = tmp->next;
entry.path = file_proc->menu_path; help_page = g_strconcat (g_basename (file_proc->prog),
entry.accelerator = NULL; ".html",
entry.callback = file_load_type_callback; NULL);
entry.callback_data = file_proc; g_strdown (help_page);
menus_create (&entry, 1); entry.entry.path = file_proc->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = file_load_type_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, file_proc);
} }
tmp = save_procs; tmp = save_procs;
while (tmp) while (tmp)
{ {
gchar *help_page;
file_proc = tmp->data; file_proc = tmp->data;
tmp = tmp->next; tmp = tmp->next;
entry.path = file_proc->menu_path; help_page = g_strconcat (g_basename (file_proc->prog),
entry.accelerator = NULL; ".html",
entry.callback = file_save_type_callback; NULL);
entry.callback_data = file_proc; g_strdown (help_page);
menus_create (&entry, 1); entry.entry.path = file_proc->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = file_save_type_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, file_proc);
} }
} }
@ -234,7 +254,7 @@ file_open_callback (GtkWidget *widget,
/* Connect the "F1" help key */ /* Connect the "F1" help key */
gimp_help_connect_help_accel (fileload, gimp_help_connect_help_accel (fileload,
gimp_standard_help_func, gimp_standard_help_func,
"dialogs/file_open.html"); "open/index.html");
} }
else else
{ {
@ -445,8 +465,16 @@ file_save_as_callback (GtkWidget *widget,
"delete_event", "delete_event",
GTK_SIGNAL_FUNC (file_dialog_hide), GTK_SIGNAL_FUNC (file_dialog_hide),
NULL); NULL);
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filesave)->ok_button), "clicked", (GtkSignalFunc) file_save_ok_callback, filesave); gtk_signal_connect
(GTK_OBJECT (GTK_FILE_SELECTION (filesave)->ok_button), "clicked",
(GtkSignalFunc) file_save_ok_callback,
filesave);
gtk_quit_add_destroy (1, GTK_OBJECT (filesave)); gtk_quit_add_destroy (1, GTK_OBJECT (filesave));
/* Connect the "F1" help key */
gimp_help_connect_help_accel (filesave,
gimp_standard_help_func,
"save/index.html");
} }
else else
{ {
@ -457,11 +485,6 @@ file_save_as_callback (GtkWidget *widget,
gtk_file_selection_set_filename (GTK_FILE_SELECTION(filesave), gtk_file_selection_set_filename (GTK_FILE_SELECTION(filesave),
"." G_DIR_SEPARATOR_S); "." G_DIR_SEPARATOR_S);
gtk_window_set_title (GTK_WINDOW (filesave), _("Save Image")); gtk_window_set_title (GTK_WINDOW (filesave), _("Save Image"));
/* Connect the "F1" help key */
gimp_help_connect_help_accel (filesave,
gimp_standard_help_func,
"dialogs/file_save.html");
} }
gdisplay = gdisplay_active (); gdisplay = gdisplay_active ();
@ -471,7 +494,8 @@ file_save_as_callback (GtkWidget *widget,
if (!save_options) if (!save_options)
{ {
save_options = gtk_frame_new (_("Save Options")); save_options = gtk_frame_new (_("Save Options"));
gtk_frame_set_shadow_type (GTK_FRAME (save_options), GTK_SHADOW_ETCHED_IN); gtk_frame_set_shadow_type (GTK_FRAME (save_options),
GTK_SHADOW_ETCHED_IN);
hbox = gtk_hbox_new (FALSE, 1); hbox = gtk_hbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
@ -1592,7 +1616,7 @@ file_overwrite (char *filename,
overwrite_box->obox = overwrite_box->obox =
gimp_dialog_new (_("File Exists!"), "file_exists", gimp_dialog_new (_("File Exists!"), "file_exists",
gimp_standard_help_func, gimp_standard_help_func,
"dialogs/file_exists.html", "save/file_exists.html",
GTK_WIN_POS_MOUSE, GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE, FALSE, TRUE, FALSE,

View File

@ -44,15 +44,21 @@
#define MRU_MENU_ENTRY_SIZE (strlen (_("/File/MRU00 ")) + 1) #define MRU_MENU_ENTRY_SIZE (strlen (_("/File/MRU00 ")) + 1)
#define MRU_MENU_ACCEL_SIZE sizeof ("<control>0") #define MRU_MENU_ACCEL_SIZE sizeof ("<control>0")
typedef struct _GimpItemFactoryEntry GimpItemFactoryEntry; static void menus_create_item (GtkItemFactory *item_factory,
GimpItemFactoryEntry *entry,
struct _GimpItemFactoryEntry gpointer callback_data,
{ guint callback_type);
GtkItemFactoryEntry entry; static void menus_create_items (GtkItemFactory *item_factory,
guint n_entries,
gchar *help_page; GimpItemFactoryEntry *entries,
gchar *description; gpointer callback_data,
}; guint callback_type);
static void menus_init (void);
static gchar *menu_translate (const gchar *path,
gpointer data);
static void tearoff_cmd_callback (GtkWidget *widget,
gpointer callback_data,
guint callback_action);
static char* G_GNUC_UNUSED dummyMenus[] = { N_("/File/MRU00 "), static char* G_GNUC_UNUSED dummyMenus[] = { N_("/File/MRU00 "),
N_("/File"), N_("/File"),
@ -64,17 +70,6 @@ static char* G_GNUC_UNUSED dummyMenus[] = { N_("/File/MRU00 "),
N_("/View/Zoom"), N_("/View/Zoom"),
N_("/Stack")}; N_("/Stack")};
static void menus_create_item (GtkItemFactory *item_factory,
GimpItemFactoryEntry *entry,
gpointer callback_data,
guint callback_type);
static void menus_init (void);
static gchar *menu_translate (const gchar *path,
gpointer data);
static void tearoff_cmd_callback (GtkWidget *widget,
gpointer callback_data,
guint callback_action);
static GSList *last_opened_raw_filenames = NULL; static GSList *last_opened_raw_filenames = NULL;
static GimpItemFactoryEntry toolbox_entries[] = static GimpItemFactoryEntry toolbox_entries[] =
@ -84,7 +79,7 @@ static GimpItemFactoryEntry toolbox_entries[] =
{ { N_("/File/New"), "<control>N", file_new_cmd_callback, 0 }, { { N_("/File/New"), "<control>N", file_new_cmd_callback, 0 },
"file/dialogs/file_new.html", NULL }, "file/dialogs/file_new.html", NULL },
{ { N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 }, { { N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
"file/dialogs/file_open.html", NULL }, "open/index.html", NULL },
{ { N_("/File/Acquire/tearoff1"), NULL, NULL, 0, "<Tearoff>" }, { { N_("/File/Acquire/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
NULL, NULL }, NULL, NULL },
{ { N_("/File/About..."), NULL, about_dialog_cmd_callback, 0 }, { { N_("/File/About..."), NULL, about_dialog_cmd_callback, 0 },
@ -149,11 +144,11 @@ static GimpItemFactoryEntry image_entries[] =
{ { N_("/File/New"), "<control>N", file_new_cmd_callback, 1 }, { { N_("/File/New"), "<control>N", file_new_cmd_callback, 1 },
"file/dialogs/file_new.html", NULL }, "file/dialogs/file_new.html", NULL },
{ { N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 }, { { N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
"file/dialogs/file_open.html", NULL }, "open/index.html", NULL },
{ { N_("/File/Save"), "<control>S", file_save_cmd_callback, 0 }, { { N_("/File/Save"), "<control>S", file_save_cmd_callback, 0 },
"file/dialogs/file_save.html", NULL }, "save/index.html", NULL },
{ { N_("/File/Save as"), NULL, file_save_as_cmd_callback, 0 }, { { N_("/File/Save as"), NULL, file_save_as_cmd_callback, 0 },
"file/dialogs/save_as.html", NULL }, "save/index.html", NULL },
{ { N_("/File/Revert"), NULL, file_revert_cmd_callback, 0 }, { { N_("/File/Revert"), NULL, file_revert_cmd_callback, 0 },
"file/revert.html", NULL }, "file/revert.html", NULL },
{ { N_("/File/Preferences..."), NULL, file_pref_cmd_callback, 0 }, { { N_("/File/Preferences..."), NULL, file_pref_cmd_callback, 0 },
@ -414,21 +409,27 @@ static GimpItemFactoryEntry image_entries[] =
static guint n_image_entries = (sizeof (image_entries) / static guint n_image_entries = (sizeof (image_entries) /
sizeof (image_entries[0])); sizeof (image_entries[0]));
static GtkItemFactory *image_factory = NULL; static GtkItemFactory *image_factory = NULL;
static GtkItemFactoryEntry load_entries[] = static GimpItemFactoryEntry load_entries[] =
{ {
{ N_("/Automatic"), NULL, file_load_by_extension_callback, 0 }, { { N_("/Automatic"), NULL, file_load_by_extension_callback, 0 },
{ "/---", NULL, NULL, 0, "<Separator>" }, NULL, NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL }
}; };
static guint n_load_entries = sizeof (load_entries) / sizeof (load_entries[0]); static guint n_load_entries = (sizeof (load_entries) /
sizeof (load_entries[0]));
static GtkItemFactory *load_factory = NULL; static GtkItemFactory *load_factory = NULL;
static GtkItemFactoryEntry save_entries[] = static GimpItemFactoryEntry save_entries[] =
{ {
{ N_("/By extension"), NULL, file_save_by_extension_callback, 0 }, { { N_("/By extension"), NULL, file_save_by_extension_callback, 0 },
{ "/---", NULL, NULL, 0, "<Separator>" }, NULL, NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
}; };
static guint n_save_entries = sizeof (save_entries) / sizeof (save_entries[0]); static guint n_save_entries = (sizeof (save_entries) /
sizeof (save_entries[0]));
static GtkItemFactory *save_factory = NULL; static GtkItemFactory *save_factory = NULL;
static GimpItemFactoryEntry layers_entries[] = static GimpItemFactoryEntry layers_entries[] =
@ -540,7 +541,7 @@ static guint n_paths_entries = (sizeof (paths_entries) /
sizeof (paths_entries[0])); sizeof (paths_entries[0]));
static GtkItemFactory *paths_factory = NULL; static GtkItemFactory *paths_factory = NULL;
static int initialize = TRUE; static gboolean initialize = TRUE;
void void
menus_get_toolbox_menubar (GtkWidget **menubar, menus_get_toolbox_menubar (GtkWidget **menubar,
@ -634,48 +635,69 @@ menus_get_paths_menu (GtkWidget **menu,
} }
void void
menus_create (GtkMenuEntry *entries, menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
int n_menu_entries) gpointer callback_data)
{ {
GtkItemFactory *ifactory;
GtkWidget *menu_item; GtkWidget *menu_item;
int i; gboolean redo_image_menu = FALSE;
int redo_image_menu = FALSE;
GString *tearoff_path; GString *tearoff_path;
gchar *path;
if (initialize) if (initialize)
menus_init (); menus_init ();
tearoff_path = g_string_new (""); tearoff_path = g_string_new ("");
for (i = 0; i < n_menu_entries; i++) if (! strncmp (entry->entry.path, "<Image>", 7))
if (! strncmp (entries[i].path, "<Image>", 7)) {
{ gchar *p;
char *p;
p = strchr (entries[i].path + 8, '/'); p = strchr (entry->entry.path + 8, '/');
while (p) while (p)
{ {
g_string_assign (tearoff_path, entries[i].path + 7); g_string_assign (tearoff_path, entry->entry.path + 7);
g_string_truncate (tearoff_path, p - entries[i].path + 1 - 7); g_string_truncate (tearoff_path,
g_string_append (tearoff_path, "tearoff1"); p - entry->entry.path + 1 - 7);
g_string_append (tearoff_path, "tearoff1");
if (! gtk_item_factory_get_widget (image_factory, tearoff_path->str)) if (! gtk_item_factory_get_widget (image_factory,
{ tearoff_path->str))
GtkItemFactoryEntry entry = { NULL, NULL, NULL, 0, "<Tearoff>" }; {
entry.path = tearoff_path->str; GimpItemFactoryEntry tearoff_entry =
entry.callback = tearoff_cmd_callback; { { NULL, NULL, NULL, 0, "<Tearoff>" },
gtk_item_factory_create_items_ac (image_factory, 1, &entry, NULL,2); NULL, NULL };
}
p = strchr (p + 1, '/'); tearoff_entry.entry.path = tearoff_path->str;
} tearoff_entry.entry.callback = tearoff_cmd_callback;
menus_create_item (image_factory, &tearoff_entry, NULL, 2);
}
redo_image_menu = TRUE; p = strchr (p + 1, '/');
} }
redo_image_menu = TRUE;
}
g_string_free (tearoff_path, TRUE); g_string_free (tearoff_path, TRUE);
gtk_item_factory_create_menu_entries (n_menu_entries, entries); path = entry->entry.path;
ifactory = gtk_item_factory_from_path (path);
if (!ifactory)
{
g_warning ("menus_create_item_from_full_path(): "
"entry refers to unknown item factory: \"%s\"", path);
return;
}
while (*path != '>')
path++;
path++;
entry->entry.path = path;
menus_create_item (ifactory, entry,
callback_data, 2);
if (redo_image_menu) if (redo_image_menu)
{ {
@ -719,8 +741,8 @@ menus_tools_create (ToolInfo *tool_info)
} }
void void
menus_set_sensitive (gchar *path, menus_set_sensitive (gchar *path,
gint sensitive) gboolean sensitive)
{ {
GtkItemFactory *ifactory; GtkItemFactory *ifactory;
GtkWidget *widget = NULL; GtkWidget *widget = NULL;
@ -737,16 +759,17 @@ menus_set_sensitive (gchar *path,
gtk_widget_set_sensitive (widget, sensitive); gtk_widget_set_sensitive (widget, sensitive);
} }
if (!ifactory || !widget) if (!ifactory || !widget)
g_warning ("Unable to set sensitivity for menu which doesn't exist:\n%s", path); g_warning ("Unable to set sensitivity for menu which doesn't exist:\n%s",
path);
} }
/* The following function will enhance our localesystem because /* The following function will enhance our localesystem because
we don't need to have our menuentries twice in our catalog */ we don't need to have our menuentries twice in our catalog */
void void
menus_set_sensitive_glue (gchar *prepath, menus_set_sensitive_glue (gchar *prepath,
gchar *path, gchar *path,
gint sensitive) gboolean sensitive)
{ {
gchar *menupath; gchar *menupath;
@ -756,8 +779,8 @@ menus_set_sensitive_glue (gchar *prepath,
} }
void void
menus_set_state (gchar *path, menus_set_state (gchar *path,
gint state) gboolean state)
{ {
GtkItemFactory *ifactory; GtkItemFactory *ifactory;
GtkWidget *widget = NULL; GtkWidget *widget = NULL;
@ -777,13 +800,14 @@ menus_set_state (gchar *path,
widget = NULL; widget = NULL;
} }
if (!ifactory || !widget) if (!ifactory || !widget)
g_warning ("Unable to set state for menu which doesn't exist:\n%s\n", path); g_warning ("Unable to set state for menu which doesn't exist:\n%s\n",
path);
} }
void void
menus_set_state_glue (gchar *prepath, menus_set_state_glue (gchar *prepath,
gchar *path, gchar *path,
gint state) gboolean state)
{ {
gchar *menupath; gchar *menupath;
@ -793,7 +817,7 @@ menus_set_state_glue (gchar *prepath,
} }
void void
menus_destroy (char *path) menus_destroy (gchar *path)
{ {
if (initialize) if (initialize)
menus_init (); menus_init ();
@ -920,12 +944,12 @@ menus_last_opened_add (gchar *filename)
void void
menus_init_mru (void) menus_init_mru (void)
{ {
gchar *paths, *accelerators; gchar *paths, *accelerators;
gint i; gint i;
GtkItemFactoryEntry *last_opened_entries; GimpItemFactoryEntry *last_opened_entries;
GtkWidget *widget; GtkWidget *widget;
last_opened_entries = g_new (GtkItemFactoryEntry, last_opened_size); last_opened_entries = g_new (GimpItemFactoryEntry, last_opened_size);
paths = g_new (gchar, last_opened_size * MRU_MENU_ENTRY_SIZE); paths = g_new (gchar, last_opened_size * MRU_MENU_ENTRY_SIZE);
accelerators = g_new (gchar, 9 * MRU_MENU_ACCEL_SIZE); accelerators = g_new (gchar, 9 * MRU_MENU_ACCEL_SIZE);
@ -933,40 +957,41 @@ menus_init_mru (void)
for (i = 0; i < last_opened_size; i++) for (i = 0; i < last_opened_size; i++)
{ {
gchar *path, *accelerator; gchar *path, *accelerator;
path = &paths[i * MRU_MENU_ENTRY_SIZE]; path = &paths[i * MRU_MENU_ENTRY_SIZE];
if (i < 9) if (i < 9)
accelerator = &accelerators[i * MRU_MENU_ACCEL_SIZE]; accelerator = &accelerators[i * MRU_MENU_ACCEL_SIZE];
else else
accelerator = NULL; accelerator = NULL;
last_opened_entries[i].path = path; last_opened_entries[i].entry.path = path;
last_opened_entries[i].accelerator = accelerator; last_opened_entries[i].entry.accelerator = accelerator;
last_opened_entries[i].callback = (GtkItemFactoryCallback) menus_last_opened_cmd_callback; last_opened_entries[i].entry.callback =
last_opened_entries[i].callback_action = i; (GtkItemFactoryCallback) menus_last_opened_cmd_callback;
last_opened_entries[i].item_type = NULL; last_opened_entries[i].entry.callback_action = i;
last_opened_entries[i].entry.item_type = NULL;
last_opened_entries[i].help_page = "file/last_opened.html";
last_opened_entries[i].description = NULL;
g_snprintf (path, MRU_MENU_ENTRY_SIZE, N_("/File/MRU%02d"), i + 1); g_snprintf (path, MRU_MENU_ENTRY_SIZE, N_("/File/MRU%02d"), i + 1);
if (accelerator != NULL) if (accelerator != NULL)
g_snprintf (accelerator, MRU_MENU_ACCEL_SIZE, "<control>%d", i + 1); g_snprintf (accelerator, MRU_MENU_ACCEL_SIZE, "<control>%d", i + 1);
} }
gtk_item_factory_create_items_ac (toolbox_factory, last_opened_size, menus_create_items (toolbox_factory, last_opened_size,
last_opened_entries, NULL, 2); last_opened_entries, NULL, 2);
for (i=0; i < last_opened_size; i++) for (i=0; i < last_opened_size; i++)
{ {
widget = gtk_item_factory_get_widget (toolbox_factory, widget = gtk_item_factory_get_widget (toolbox_factory,
last_opened_entries[i].path); last_opened_entries[i].entry.path);
gtk_object_set_data (GTK_OBJECT (widget), "help_page",
(gpointer) "file/last_opened.html");
gtk_widget_hide (widget); gtk_widget_hide (widget);
} }
widget = gtk_item_factory_get_widget (toolbox_factory, widget = gtk_item_factory_get_widget (toolbox_factory,
file_menu_separator.entry.path); file_menu_separator.entry.path);
gtk_widget_hide (widget); gtk_widget_hide (widget);
g_free (paths); g_free (paths);
g_free (accelerators); g_free (accelerators);
g_free (last_opened_entries); g_free (last_opened_entries);
@ -1106,7 +1131,7 @@ menus_init_toolbox (void)
static void static void
menus_init (void) menus_init (void)
{ {
int i; gint i;
if (initialize) if (initialize)
{ {
@ -1128,22 +1153,26 @@ menus_init (void)
NULL, 2); NULL, 2);
load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Load>", NULL); load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Load>", NULL);
gtk_object_set_data (GTK_OBJECT (load_factory), "help_path",
(gpointer) "open");
gtk_item_factory_set_translate_func (load_factory, gtk_item_factory_set_translate_func (load_factory,
menu_translate, menu_translate,
NULL, NULL); NULL, NULL);
gtk_item_factory_create_items_ac (load_factory, menus_create_items (load_factory,
n_load_entries, n_load_entries,
load_entries, load_entries,
NULL, 2); NULL, 2);
save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Save>", NULL); save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Save>", NULL);
gtk_object_set_data (GTK_OBJECT (save_factory), "help_path",
(gpointer) "save");
gtk_item_factory_set_translate_func (save_factory, gtk_item_factory_set_translate_func (save_factory,
menu_translate, menu_translate,
NULL, NULL); NULL, NULL);
gtk_item_factory_create_items_ac (save_factory, menus_create_items (save_factory,
n_save_entries, n_save_entries,
save_entries, save_entries,
NULL, 2); NULL, 2);
layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Layers>", NULL); layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Layers>", NULL);
gtk_object_set_data (GTK_OBJECT (layers_factory), "help_path", gtk_object_set_data (GTK_OBJECT (layers_factory), "help_path",
@ -1246,25 +1275,30 @@ tearoff_cmd_callback (GtkWidget *widget,
} }
else else
{ {
dialog_register(top); dialog_register (top);
gtk_signal_connect_object (GTK_OBJECT (top), gtk_signal_connect_object (GTK_OBJECT (top),
"delete_event", "delete_event",
GTK_SIGNAL_FUNC (tearoff_delete_cb), GTK_SIGNAL_FUNC (tearoff_delete_cb),
GTK_OBJECT (top)); GTK_OBJECT (top));
gtk_object_set_data (GTK_OBJECT (widget),"tearoff_menu_top",top); gtk_object_set_data (GTK_OBJECT (widget), "tearoff_menu_top",
top);
} }
} }
else else
{ {
GtkWidget *top = (GtkWidget *)gtk_object_get_data (GTK_OBJECT (widget),"tearoff_menu_top"); GtkWidget *top;
if(!top)
top = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (widget),
"tearoff_menu_top");
if (!top)
{ {
g_message (_("can't unregister tearoff menu top level window")); g_message (_("can't unregister tearoff menu top level window"));
} }
else else
{ {
dialog_unregister(top); dialog_unregister (top);
} }
} }
} }

View File

@ -20,38 +20,50 @@
#include "gtk/gtk.h" #include "gtk/gtk.h"
void menus_get_toolbox_menubar (GtkWidget **menubar, typedef struct _GimpItemFactoryEntry GimpItemFactoryEntry;
GtkAccelGroup **accel_group);
void menus_get_image_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_load_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_save_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_layers_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_channels_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_paths_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_create (GtkMenuEntry *entries, struct _GimpItemFactoryEntry
gint n_menu_entries); {
void menus_destroy (gchar *path); GtkItemFactoryEntry entry;
gchar *help_page;
gchar *description;
};
void menus_get_toolbox_menubar (GtkWidget **menubar,
GtkAccelGroup **accel_group);
void menus_get_image_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_load_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_save_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_layers_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_channels_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_paths_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
gpointer callback_data);
void menus_destroy (gchar *path);
void menus_quit (void); void menus_quit (void);
void menus_set_sensitive (gchar *path, void menus_set_sensitive (gchar *path,
gint sensitive); gboolean sensitive);
void menus_set_sensitive_glue (gchar *prepath, void menus_set_sensitive_glue (gchar *prepath,
gchar *path, gchar *path,
gint sensitive); gboolean sensitive);
void menus_set_state (gchar *path,
gint state);
void menus_set_state_glue (gchar *prepath,
gchar *path,
gint state);
void menus_last_opened_add (gchar *filename); void menus_set_state (gchar *path,
gboolean state);
void menus_set_state_glue (gchar *prepath,
gchar *path,
gboolean state);
void menus_last_opened_add (gchar *filename);
#endif /* __MENUS_H__ */ #endif /* __MENUS_H__ */

View File

@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
GSList *tmp = NULL; GSList *tmp = NULL;
GtkMenuEntry entry; GimpItemFactoryEntry entry;
char *prog = NULL; char *prog = NULL;
int add_proc_def; int add_proc_def;
int i; int i;
@ -1833,12 +1833,23 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
entry.path = proc_install->menu_path; gchar *help_page;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, proc);
} }
break; break;
} }
@ -2254,7 +2265,7 @@ plug_in_add_to_db (void)
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
GSList *tmp; GSList *tmp;
@ -2268,12 +2279,23 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
entry.path = proc_def->menu_path; gchar *help_page;
entry.accelerator = proc_def->accelerator;
entry.callback = plug_in_callback;
entry.callback_data = &proc_def->db_info;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, &proc_def->db_info);
} }
} }
} }
@ -2317,7 +2339,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */ /* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }
@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget,
{ {
gdisp_ID = gdisplay->ID; gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }

View File

@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
GSList *tmp = NULL; GSList *tmp = NULL;
GtkMenuEntry entry; GimpItemFactoryEntry entry;
char *prog = NULL; char *prog = NULL;
int add_proc_def; int add_proc_def;
int i; int i;
@ -1833,12 +1833,23 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
entry.path = proc_install->menu_path; gchar *help_page;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, proc);
} }
break; break;
} }
@ -2254,7 +2265,7 @@ plug_in_add_to_db (void)
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
GSList *tmp; GSList *tmp;
@ -2268,12 +2279,23 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
entry.path = proc_def->menu_path; gchar *help_page;
entry.accelerator = proc_def->accelerator;
entry.callback = plug_in_callback;
entry.callback_data = &proc_def->db_info;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, &proc_def->db_info);
} }
} }
} }
@ -2317,7 +2339,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */ /* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }
@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget,
{ {
gdisp_ID = gdisplay->ID; gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }

View File

@ -44,15 +44,21 @@
#define MRU_MENU_ENTRY_SIZE (strlen (_("/File/MRU00 ")) + 1) #define MRU_MENU_ENTRY_SIZE (strlen (_("/File/MRU00 ")) + 1)
#define MRU_MENU_ACCEL_SIZE sizeof ("<control>0") #define MRU_MENU_ACCEL_SIZE sizeof ("<control>0")
typedef struct _GimpItemFactoryEntry GimpItemFactoryEntry; static void menus_create_item (GtkItemFactory *item_factory,
GimpItemFactoryEntry *entry,
struct _GimpItemFactoryEntry gpointer callback_data,
{ guint callback_type);
GtkItemFactoryEntry entry; static void menus_create_items (GtkItemFactory *item_factory,
guint n_entries,
gchar *help_page; GimpItemFactoryEntry *entries,
gchar *description; gpointer callback_data,
}; guint callback_type);
static void menus_init (void);
static gchar *menu_translate (const gchar *path,
gpointer data);
static void tearoff_cmd_callback (GtkWidget *widget,
gpointer callback_data,
guint callback_action);
static char* G_GNUC_UNUSED dummyMenus[] = { N_("/File/MRU00 "), static char* G_GNUC_UNUSED dummyMenus[] = { N_("/File/MRU00 "),
N_("/File"), N_("/File"),
@ -64,17 +70,6 @@ static char* G_GNUC_UNUSED dummyMenus[] = { N_("/File/MRU00 "),
N_("/View/Zoom"), N_("/View/Zoom"),
N_("/Stack")}; N_("/Stack")};
static void menus_create_item (GtkItemFactory *item_factory,
GimpItemFactoryEntry *entry,
gpointer callback_data,
guint callback_type);
static void menus_init (void);
static gchar *menu_translate (const gchar *path,
gpointer data);
static void tearoff_cmd_callback (GtkWidget *widget,
gpointer callback_data,
guint callback_action);
static GSList *last_opened_raw_filenames = NULL; static GSList *last_opened_raw_filenames = NULL;
static GimpItemFactoryEntry toolbox_entries[] = static GimpItemFactoryEntry toolbox_entries[] =
@ -84,7 +79,7 @@ static GimpItemFactoryEntry toolbox_entries[] =
{ { N_("/File/New"), "<control>N", file_new_cmd_callback, 0 }, { { N_("/File/New"), "<control>N", file_new_cmd_callback, 0 },
"file/dialogs/file_new.html", NULL }, "file/dialogs/file_new.html", NULL },
{ { N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 }, { { N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
"file/dialogs/file_open.html", NULL }, "open/index.html", NULL },
{ { N_("/File/Acquire/tearoff1"), NULL, NULL, 0, "<Tearoff>" }, { { N_("/File/Acquire/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
NULL, NULL }, NULL, NULL },
{ { N_("/File/About..."), NULL, about_dialog_cmd_callback, 0 }, { { N_("/File/About..."), NULL, about_dialog_cmd_callback, 0 },
@ -149,11 +144,11 @@ static GimpItemFactoryEntry image_entries[] =
{ { N_("/File/New"), "<control>N", file_new_cmd_callback, 1 }, { { N_("/File/New"), "<control>N", file_new_cmd_callback, 1 },
"file/dialogs/file_new.html", NULL }, "file/dialogs/file_new.html", NULL },
{ { N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 }, { { N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
"file/dialogs/file_open.html", NULL }, "open/index.html", NULL },
{ { N_("/File/Save"), "<control>S", file_save_cmd_callback, 0 }, { { N_("/File/Save"), "<control>S", file_save_cmd_callback, 0 },
"file/dialogs/file_save.html", NULL }, "save/index.html", NULL },
{ { N_("/File/Save as"), NULL, file_save_as_cmd_callback, 0 }, { { N_("/File/Save as"), NULL, file_save_as_cmd_callback, 0 },
"file/dialogs/save_as.html", NULL }, "save/index.html", NULL },
{ { N_("/File/Revert"), NULL, file_revert_cmd_callback, 0 }, { { N_("/File/Revert"), NULL, file_revert_cmd_callback, 0 },
"file/revert.html", NULL }, "file/revert.html", NULL },
{ { N_("/File/Preferences..."), NULL, file_pref_cmd_callback, 0 }, { { N_("/File/Preferences..."), NULL, file_pref_cmd_callback, 0 },
@ -414,21 +409,27 @@ static GimpItemFactoryEntry image_entries[] =
static guint n_image_entries = (sizeof (image_entries) / static guint n_image_entries = (sizeof (image_entries) /
sizeof (image_entries[0])); sizeof (image_entries[0]));
static GtkItemFactory *image_factory = NULL; static GtkItemFactory *image_factory = NULL;
static GtkItemFactoryEntry load_entries[] = static GimpItemFactoryEntry load_entries[] =
{ {
{ N_("/Automatic"), NULL, file_load_by_extension_callback, 0 }, { { N_("/Automatic"), NULL, file_load_by_extension_callback, 0 },
{ "/---", NULL, NULL, 0, "<Separator>" }, NULL, NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL }
}; };
static guint n_load_entries = sizeof (load_entries) / sizeof (load_entries[0]); static guint n_load_entries = (sizeof (load_entries) /
sizeof (load_entries[0]));
static GtkItemFactory *load_factory = NULL; static GtkItemFactory *load_factory = NULL;
static GtkItemFactoryEntry save_entries[] = static GimpItemFactoryEntry save_entries[] =
{ {
{ N_("/By extension"), NULL, file_save_by_extension_callback, 0 }, { { N_("/By extension"), NULL, file_save_by_extension_callback, 0 },
{ "/---", NULL, NULL, 0, "<Separator>" }, NULL, NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
}; };
static guint n_save_entries = sizeof (save_entries) / sizeof (save_entries[0]); static guint n_save_entries = (sizeof (save_entries) /
sizeof (save_entries[0]));
static GtkItemFactory *save_factory = NULL; static GtkItemFactory *save_factory = NULL;
static GimpItemFactoryEntry layers_entries[] = static GimpItemFactoryEntry layers_entries[] =
@ -540,7 +541,7 @@ static guint n_paths_entries = (sizeof (paths_entries) /
sizeof (paths_entries[0])); sizeof (paths_entries[0]));
static GtkItemFactory *paths_factory = NULL; static GtkItemFactory *paths_factory = NULL;
static int initialize = TRUE; static gboolean initialize = TRUE;
void void
menus_get_toolbox_menubar (GtkWidget **menubar, menus_get_toolbox_menubar (GtkWidget **menubar,
@ -634,48 +635,69 @@ menus_get_paths_menu (GtkWidget **menu,
} }
void void
menus_create (GtkMenuEntry *entries, menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
int n_menu_entries) gpointer callback_data)
{ {
GtkItemFactory *ifactory;
GtkWidget *menu_item; GtkWidget *menu_item;
int i; gboolean redo_image_menu = FALSE;
int redo_image_menu = FALSE;
GString *tearoff_path; GString *tearoff_path;
gchar *path;
if (initialize) if (initialize)
menus_init (); menus_init ();
tearoff_path = g_string_new (""); tearoff_path = g_string_new ("");
for (i = 0; i < n_menu_entries; i++) if (! strncmp (entry->entry.path, "<Image>", 7))
if (! strncmp (entries[i].path, "<Image>", 7)) {
{ gchar *p;
char *p;
p = strchr (entries[i].path + 8, '/'); p = strchr (entry->entry.path + 8, '/');
while (p) while (p)
{ {
g_string_assign (tearoff_path, entries[i].path + 7); g_string_assign (tearoff_path, entry->entry.path + 7);
g_string_truncate (tearoff_path, p - entries[i].path + 1 - 7); g_string_truncate (tearoff_path,
g_string_append (tearoff_path, "tearoff1"); p - entry->entry.path + 1 - 7);
g_string_append (tearoff_path, "tearoff1");
if (! gtk_item_factory_get_widget (image_factory, tearoff_path->str)) if (! gtk_item_factory_get_widget (image_factory,
{ tearoff_path->str))
GtkItemFactoryEntry entry = { NULL, NULL, NULL, 0, "<Tearoff>" }; {
entry.path = tearoff_path->str; GimpItemFactoryEntry tearoff_entry =
entry.callback = tearoff_cmd_callback; { { NULL, NULL, NULL, 0, "<Tearoff>" },
gtk_item_factory_create_items_ac (image_factory, 1, &entry, NULL,2); NULL, NULL };
}
p = strchr (p + 1, '/'); tearoff_entry.entry.path = tearoff_path->str;
} tearoff_entry.entry.callback = tearoff_cmd_callback;
menus_create_item (image_factory, &tearoff_entry, NULL, 2);
}
redo_image_menu = TRUE; p = strchr (p + 1, '/');
} }
redo_image_menu = TRUE;
}
g_string_free (tearoff_path, TRUE); g_string_free (tearoff_path, TRUE);
gtk_item_factory_create_menu_entries (n_menu_entries, entries); path = entry->entry.path;
ifactory = gtk_item_factory_from_path (path);
if (!ifactory)
{
g_warning ("menus_create_item_from_full_path(): "
"entry refers to unknown item factory: \"%s\"", path);
return;
}
while (*path != '>')
path++;
path++;
entry->entry.path = path;
menus_create_item (ifactory, entry,
callback_data, 2);
if (redo_image_menu) if (redo_image_menu)
{ {
@ -719,8 +741,8 @@ menus_tools_create (ToolInfo *tool_info)
} }
void void
menus_set_sensitive (gchar *path, menus_set_sensitive (gchar *path,
gint sensitive) gboolean sensitive)
{ {
GtkItemFactory *ifactory; GtkItemFactory *ifactory;
GtkWidget *widget = NULL; GtkWidget *widget = NULL;
@ -737,16 +759,17 @@ menus_set_sensitive (gchar *path,
gtk_widget_set_sensitive (widget, sensitive); gtk_widget_set_sensitive (widget, sensitive);
} }
if (!ifactory || !widget) if (!ifactory || !widget)
g_warning ("Unable to set sensitivity for menu which doesn't exist:\n%s", path); g_warning ("Unable to set sensitivity for menu which doesn't exist:\n%s",
path);
} }
/* The following function will enhance our localesystem because /* The following function will enhance our localesystem because
we don't need to have our menuentries twice in our catalog */ we don't need to have our menuentries twice in our catalog */
void void
menus_set_sensitive_glue (gchar *prepath, menus_set_sensitive_glue (gchar *prepath,
gchar *path, gchar *path,
gint sensitive) gboolean sensitive)
{ {
gchar *menupath; gchar *menupath;
@ -756,8 +779,8 @@ menus_set_sensitive_glue (gchar *prepath,
} }
void void
menus_set_state (gchar *path, menus_set_state (gchar *path,
gint state) gboolean state)
{ {
GtkItemFactory *ifactory; GtkItemFactory *ifactory;
GtkWidget *widget = NULL; GtkWidget *widget = NULL;
@ -777,13 +800,14 @@ menus_set_state (gchar *path,
widget = NULL; widget = NULL;
} }
if (!ifactory || !widget) if (!ifactory || !widget)
g_warning ("Unable to set state for menu which doesn't exist:\n%s\n", path); g_warning ("Unable to set state for menu which doesn't exist:\n%s\n",
path);
} }
void void
menus_set_state_glue (gchar *prepath, menus_set_state_glue (gchar *prepath,
gchar *path, gchar *path,
gint state) gboolean state)
{ {
gchar *menupath; gchar *menupath;
@ -793,7 +817,7 @@ menus_set_state_glue (gchar *prepath,
} }
void void
menus_destroy (char *path) menus_destroy (gchar *path)
{ {
if (initialize) if (initialize)
menus_init (); menus_init ();
@ -920,12 +944,12 @@ menus_last_opened_add (gchar *filename)
void void
menus_init_mru (void) menus_init_mru (void)
{ {
gchar *paths, *accelerators; gchar *paths, *accelerators;
gint i; gint i;
GtkItemFactoryEntry *last_opened_entries; GimpItemFactoryEntry *last_opened_entries;
GtkWidget *widget; GtkWidget *widget;
last_opened_entries = g_new (GtkItemFactoryEntry, last_opened_size); last_opened_entries = g_new (GimpItemFactoryEntry, last_opened_size);
paths = g_new (gchar, last_opened_size * MRU_MENU_ENTRY_SIZE); paths = g_new (gchar, last_opened_size * MRU_MENU_ENTRY_SIZE);
accelerators = g_new (gchar, 9 * MRU_MENU_ACCEL_SIZE); accelerators = g_new (gchar, 9 * MRU_MENU_ACCEL_SIZE);
@ -933,40 +957,41 @@ menus_init_mru (void)
for (i = 0; i < last_opened_size; i++) for (i = 0; i < last_opened_size; i++)
{ {
gchar *path, *accelerator; gchar *path, *accelerator;
path = &paths[i * MRU_MENU_ENTRY_SIZE]; path = &paths[i * MRU_MENU_ENTRY_SIZE];
if (i < 9) if (i < 9)
accelerator = &accelerators[i * MRU_MENU_ACCEL_SIZE]; accelerator = &accelerators[i * MRU_MENU_ACCEL_SIZE];
else else
accelerator = NULL; accelerator = NULL;
last_opened_entries[i].path = path; last_opened_entries[i].entry.path = path;
last_opened_entries[i].accelerator = accelerator; last_opened_entries[i].entry.accelerator = accelerator;
last_opened_entries[i].callback = (GtkItemFactoryCallback) menus_last_opened_cmd_callback; last_opened_entries[i].entry.callback =
last_opened_entries[i].callback_action = i; (GtkItemFactoryCallback) menus_last_opened_cmd_callback;
last_opened_entries[i].item_type = NULL; last_opened_entries[i].entry.callback_action = i;
last_opened_entries[i].entry.item_type = NULL;
last_opened_entries[i].help_page = "file/last_opened.html";
last_opened_entries[i].description = NULL;
g_snprintf (path, MRU_MENU_ENTRY_SIZE, N_("/File/MRU%02d"), i + 1); g_snprintf (path, MRU_MENU_ENTRY_SIZE, N_("/File/MRU%02d"), i + 1);
if (accelerator != NULL) if (accelerator != NULL)
g_snprintf (accelerator, MRU_MENU_ACCEL_SIZE, "<control>%d", i + 1); g_snprintf (accelerator, MRU_MENU_ACCEL_SIZE, "<control>%d", i + 1);
} }
gtk_item_factory_create_items_ac (toolbox_factory, last_opened_size, menus_create_items (toolbox_factory, last_opened_size,
last_opened_entries, NULL, 2); last_opened_entries, NULL, 2);
for (i=0; i < last_opened_size; i++) for (i=0; i < last_opened_size; i++)
{ {
widget = gtk_item_factory_get_widget (toolbox_factory, widget = gtk_item_factory_get_widget (toolbox_factory,
last_opened_entries[i].path); last_opened_entries[i].entry.path);
gtk_object_set_data (GTK_OBJECT (widget), "help_page",
(gpointer) "file/last_opened.html");
gtk_widget_hide (widget); gtk_widget_hide (widget);
} }
widget = gtk_item_factory_get_widget (toolbox_factory, widget = gtk_item_factory_get_widget (toolbox_factory,
file_menu_separator.entry.path); file_menu_separator.entry.path);
gtk_widget_hide (widget); gtk_widget_hide (widget);
g_free (paths); g_free (paths);
g_free (accelerators); g_free (accelerators);
g_free (last_opened_entries); g_free (last_opened_entries);
@ -1106,7 +1131,7 @@ menus_init_toolbox (void)
static void static void
menus_init (void) menus_init (void)
{ {
int i; gint i;
if (initialize) if (initialize)
{ {
@ -1128,22 +1153,26 @@ menus_init (void)
NULL, 2); NULL, 2);
load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Load>", NULL); load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Load>", NULL);
gtk_object_set_data (GTK_OBJECT (load_factory), "help_path",
(gpointer) "open");
gtk_item_factory_set_translate_func (load_factory, gtk_item_factory_set_translate_func (load_factory,
menu_translate, menu_translate,
NULL, NULL); NULL, NULL);
gtk_item_factory_create_items_ac (load_factory, menus_create_items (load_factory,
n_load_entries, n_load_entries,
load_entries, load_entries,
NULL, 2); NULL, 2);
save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Save>", NULL); save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Save>", NULL);
gtk_object_set_data (GTK_OBJECT (save_factory), "help_path",
(gpointer) "save");
gtk_item_factory_set_translate_func (save_factory, gtk_item_factory_set_translate_func (save_factory,
menu_translate, menu_translate,
NULL, NULL); NULL, NULL);
gtk_item_factory_create_items_ac (save_factory, menus_create_items (save_factory,
n_save_entries, n_save_entries,
save_entries, save_entries,
NULL, 2); NULL, 2);
layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Layers>", NULL); layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Layers>", NULL);
gtk_object_set_data (GTK_OBJECT (layers_factory), "help_path", gtk_object_set_data (GTK_OBJECT (layers_factory), "help_path",
@ -1246,25 +1275,30 @@ tearoff_cmd_callback (GtkWidget *widget,
} }
else else
{ {
dialog_register(top); dialog_register (top);
gtk_signal_connect_object (GTK_OBJECT (top), gtk_signal_connect_object (GTK_OBJECT (top),
"delete_event", "delete_event",
GTK_SIGNAL_FUNC (tearoff_delete_cb), GTK_SIGNAL_FUNC (tearoff_delete_cb),
GTK_OBJECT (top)); GTK_OBJECT (top));
gtk_object_set_data (GTK_OBJECT (widget),"tearoff_menu_top",top); gtk_object_set_data (GTK_OBJECT (widget), "tearoff_menu_top",
top);
} }
} }
else else
{ {
GtkWidget *top = (GtkWidget *)gtk_object_get_data (GTK_OBJECT (widget),"tearoff_menu_top"); GtkWidget *top;
if(!top)
top = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (widget),
"tearoff_menu_top");
if (!top)
{ {
g_message (_("can't unregister tearoff menu top level window")); g_message (_("can't unregister tearoff menu top level window"));
} }
else else
{ {
dialog_unregister(top); dialog_unregister (top);
} }
} }
} }

View File

@ -20,38 +20,50 @@
#include "gtk/gtk.h" #include "gtk/gtk.h"
void menus_get_toolbox_menubar (GtkWidget **menubar, typedef struct _GimpItemFactoryEntry GimpItemFactoryEntry;
GtkAccelGroup **accel_group);
void menus_get_image_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_load_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_save_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_layers_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_channels_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_paths_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_create (GtkMenuEntry *entries, struct _GimpItemFactoryEntry
gint n_menu_entries); {
void menus_destroy (gchar *path); GtkItemFactoryEntry entry;
gchar *help_page;
gchar *description;
};
void menus_get_toolbox_menubar (GtkWidget **menubar,
GtkAccelGroup **accel_group);
void menus_get_image_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_load_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_save_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_layers_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_channels_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_paths_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
gpointer callback_data);
void menus_destroy (gchar *path);
void menus_quit (void); void menus_quit (void);
void menus_set_sensitive (gchar *path, void menus_set_sensitive (gchar *path,
gint sensitive); gboolean sensitive);
void menus_set_sensitive_glue (gchar *prepath, void menus_set_sensitive_glue (gchar *prepath,
gchar *path, gchar *path,
gint sensitive); gboolean sensitive);
void menus_set_state (gchar *path,
gint state);
void menus_set_state_glue (gchar *prepath,
gchar *path,
gint state);
void menus_last_opened_add (gchar *filename); void menus_set_state (gchar *path,
gboolean state);
void menus_set_state_glue (gchar *prepath,
gchar *path,
gboolean state);
void menus_last_opened_add (gchar *filename);
#endif /* __MENUS_H__ */ #endif /* __MENUS_H__ */

View File

@ -44,15 +44,21 @@
#define MRU_MENU_ENTRY_SIZE (strlen (_("/File/MRU00 ")) + 1) #define MRU_MENU_ENTRY_SIZE (strlen (_("/File/MRU00 ")) + 1)
#define MRU_MENU_ACCEL_SIZE sizeof ("<control>0") #define MRU_MENU_ACCEL_SIZE sizeof ("<control>0")
typedef struct _GimpItemFactoryEntry GimpItemFactoryEntry; static void menus_create_item (GtkItemFactory *item_factory,
GimpItemFactoryEntry *entry,
struct _GimpItemFactoryEntry gpointer callback_data,
{ guint callback_type);
GtkItemFactoryEntry entry; static void menus_create_items (GtkItemFactory *item_factory,
guint n_entries,
gchar *help_page; GimpItemFactoryEntry *entries,
gchar *description; gpointer callback_data,
}; guint callback_type);
static void menus_init (void);
static gchar *menu_translate (const gchar *path,
gpointer data);
static void tearoff_cmd_callback (GtkWidget *widget,
gpointer callback_data,
guint callback_action);
static char* G_GNUC_UNUSED dummyMenus[] = { N_("/File/MRU00 "), static char* G_GNUC_UNUSED dummyMenus[] = { N_("/File/MRU00 "),
N_("/File"), N_("/File"),
@ -64,17 +70,6 @@ static char* G_GNUC_UNUSED dummyMenus[] = { N_("/File/MRU00 "),
N_("/View/Zoom"), N_("/View/Zoom"),
N_("/Stack")}; N_("/Stack")};
static void menus_create_item (GtkItemFactory *item_factory,
GimpItemFactoryEntry *entry,
gpointer callback_data,
guint callback_type);
static void menus_init (void);
static gchar *menu_translate (const gchar *path,
gpointer data);
static void tearoff_cmd_callback (GtkWidget *widget,
gpointer callback_data,
guint callback_action);
static GSList *last_opened_raw_filenames = NULL; static GSList *last_opened_raw_filenames = NULL;
static GimpItemFactoryEntry toolbox_entries[] = static GimpItemFactoryEntry toolbox_entries[] =
@ -84,7 +79,7 @@ static GimpItemFactoryEntry toolbox_entries[] =
{ { N_("/File/New"), "<control>N", file_new_cmd_callback, 0 }, { { N_("/File/New"), "<control>N", file_new_cmd_callback, 0 },
"file/dialogs/file_new.html", NULL }, "file/dialogs/file_new.html", NULL },
{ { N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 }, { { N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
"file/dialogs/file_open.html", NULL }, "open/index.html", NULL },
{ { N_("/File/Acquire/tearoff1"), NULL, NULL, 0, "<Tearoff>" }, { { N_("/File/Acquire/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
NULL, NULL }, NULL, NULL },
{ { N_("/File/About..."), NULL, about_dialog_cmd_callback, 0 }, { { N_("/File/About..."), NULL, about_dialog_cmd_callback, 0 },
@ -149,11 +144,11 @@ static GimpItemFactoryEntry image_entries[] =
{ { N_("/File/New"), "<control>N", file_new_cmd_callback, 1 }, { { N_("/File/New"), "<control>N", file_new_cmd_callback, 1 },
"file/dialogs/file_new.html", NULL }, "file/dialogs/file_new.html", NULL },
{ { N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 }, { { N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
"file/dialogs/file_open.html", NULL }, "open/index.html", NULL },
{ { N_("/File/Save"), "<control>S", file_save_cmd_callback, 0 }, { { N_("/File/Save"), "<control>S", file_save_cmd_callback, 0 },
"file/dialogs/file_save.html", NULL }, "save/index.html", NULL },
{ { N_("/File/Save as"), NULL, file_save_as_cmd_callback, 0 }, { { N_("/File/Save as"), NULL, file_save_as_cmd_callback, 0 },
"file/dialogs/save_as.html", NULL }, "save/index.html", NULL },
{ { N_("/File/Revert"), NULL, file_revert_cmd_callback, 0 }, { { N_("/File/Revert"), NULL, file_revert_cmd_callback, 0 },
"file/revert.html", NULL }, "file/revert.html", NULL },
{ { N_("/File/Preferences..."), NULL, file_pref_cmd_callback, 0 }, { { N_("/File/Preferences..."), NULL, file_pref_cmd_callback, 0 },
@ -414,21 +409,27 @@ static GimpItemFactoryEntry image_entries[] =
static guint n_image_entries = (sizeof (image_entries) / static guint n_image_entries = (sizeof (image_entries) /
sizeof (image_entries[0])); sizeof (image_entries[0]));
static GtkItemFactory *image_factory = NULL; static GtkItemFactory *image_factory = NULL;
static GtkItemFactoryEntry load_entries[] = static GimpItemFactoryEntry load_entries[] =
{ {
{ N_("/Automatic"), NULL, file_load_by_extension_callback, 0 }, { { N_("/Automatic"), NULL, file_load_by_extension_callback, 0 },
{ "/---", NULL, NULL, 0, "<Separator>" }, NULL, NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL }
}; };
static guint n_load_entries = sizeof (load_entries) / sizeof (load_entries[0]); static guint n_load_entries = (sizeof (load_entries) /
sizeof (load_entries[0]));
static GtkItemFactory *load_factory = NULL; static GtkItemFactory *load_factory = NULL;
static GtkItemFactoryEntry save_entries[] = static GimpItemFactoryEntry save_entries[] =
{ {
{ N_("/By extension"), NULL, file_save_by_extension_callback, 0 }, { { N_("/By extension"), NULL, file_save_by_extension_callback, 0 },
{ "/---", NULL, NULL, 0, "<Separator>" }, NULL, NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
}; };
static guint n_save_entries = sizeof (save_entries) / sizeof (save_entries[0]); static guint n_save_entries = (sizeof (save_entries) /
sizeof (save_entries[0]));
static GtkItemFactory *save_factory = NULL; static GtkItemFactory *save_factory = NULL;
static GimpItemFactoryEntry layers_entries[] = static GimpItemFactoryEntry layers_entries[] =
@ -540,7 +541,7 @@ static guint n_paths_entries = (sizeof (paths_entries) /
sizeof (paths_entries[0])); sizeof (paths_entries[0]));
static GtkItemFactory *paths_factory = NULL; static GtkItemFactory *paths_factory = NULL;
static int initialize = TRUE; static gboolean initialize = TRUE;
void void
menus_get_toolbox_menubar (GtkWidget **menubar, menus_get_toolbox_menubar (GtkWidget **menubar,
@ -634,48 +635,69 @@ menus_get_paths_menu (GtkWidget **menu,
} }
void void
menus_create (GtkMenuEntry *entries, menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
int n_menu_entries) gpointer callback_data)
{ {
GtkItemFactory *ifactory;
GtkWidget *menu_item; GtkWidget *menu_item;
int i; gboolean redo_image_menu = FALSE;
int redo_image_menu = FALSE;
GString *tearoff_path; GString *tearoff_path;
gchar *path;
if (initialize) if (initialize)
menus_init (); menus_init ();
tearoff_path = g_string_new (""); tearoff_path = g_string_new ("");
for (i = 0; i < n_menu_entries; i++) if (! strncmp (entry->entry.path, "<Image>", 7))
if (! strncmp (entries[i].path, "<Image>", 7)) {
{ gchar *p;
char *p;
p = strchr (entries[i].path + 8, '/'); p = strchr (entry->entry.path + 8, '/');
while (p) while (p)
{ {
g_string_assign (tearoff_path, entries[i].path + 7); g_string_assign (tearoff_path, entry->entry.path + 7);
g_string_truncate (tearoff_path, p - entries[i].path + 1 - 7); g_string_truncate (tearoff_path,
g_string_append (tearoff_path, "tearoff1"); p - entry->entry.path + 1 - 7);
g_string_append (tearoff_path, "tearoff1");
if (! gtk_item_factory_get_widget (image_factory, tearoff_path->str)) if (! gtk_item_factory_get_widget (image_factory,
{ tearoff_path->str))
GtkItemFactoryEntry entry = { NULL, NULL, NULL, 0, "<Tearoff>" }; {
entry.path = tearoff_path->str; GimpItemFactoryEntry tearoff_entry =
entry.callback = tearoff_cmd_callback; { { NULL, NULL, NULL, 0, "<Tearoff>" },
gtk_item_factory_create_items_ac (image_factory, 1, &entry, NULL,2); NULL, NULL };
}
p = strchr (p + 1, '/'); tearoff_entry.entry.path = tearoff_path->str;
} tearoff_entry.entry.callback = tearoff_cmd_callback;
menus_create_item (image_factory, &tearoff_entry, NULL, 2);
}
redo_image_menu = TRUE; p = strchr (p + 1, '/');
} }
redo_image_menu = TRUE;
}
g_string_free (tearoff_path, TRUE); g_string_free (tearoff_path, TRUE);
gtk_item_factory_create_menu_entries (n_menu_entries, entries); path = entry->entry.path;
ifactory = gtk_item_factory_from_path (path);
if (!ifactory)
{
g_warning ("menus_create_item_from_full_path(): "
"entry refers to unknown item factory: \"%s\"", path);
return;
}
while (*path != '>')
path++;
path++;
entry->entry.path = path;
menus_create_item (ifactory, entry,
callback_data, 2);
if (redo_image_menu) if (redo_image_menu)
{ {
@ -719,8 +741,8 @@ menus_tools_create (ToolInfo *tool_info)
} }
void void
menus_set_sensitive (gchar *path, menus_set_sensitive (gchar *path,
gint sensitive) gboolean sensitive)
{ {
GtkItemFactory *ifactory; GtkItemFactory *ifactory;
GtkWidget *widget = NULL; GtkWidget *widget = NULL;
@ -737,16 +759,17 @@ menus_set_sensitive (gchar *path,
gtk_widget_set_sensitive (widget, sensitive); gtk_widget_set_sensitive (widget, sensitive);
} }
if (!ifactory || !widget) if (!ifactory || !widget)
g_warning ("Unable to set sensitivity for menu which doesn't exist:\n%s", path); g_warning ("Unable to set sensitivity for menu which doesn't exist:\n%s",
path);
} }
/* The following function will enhance our localesystem because /* The following function will enhance our localesystem because
we don't need to have our menuentries twice in our catalog */ we don't need to have our menuentries twice in our catalog */
void void
menus_set_sensitive_glue (gchar *prepath, menus_set_sensitive_glue (gchar *prepath,
gchar *path, gchar *path,
gint sensitive) gboolean sensitive)
{ {
gchar *menupath; gchar *menupath;
@ -756,8 +779,8 @@ menus_set_sensitive_glue (gchar *prepath,
} }
void void
menus_set_state (gchar *path, menus_set_state (gchar *path,
gint state) gboolean state)
{ {
GtkItemFactory *ifactory; GtkItemFactory *ifactory;
GtkWidget *widget = NULL; GtkWidget *widget = NULL;
@ -777,13 +800,14 @@ menus_set_state (gchar *path,
widget = NULL; widget = NULL;
} }
if (!ifactory || !widget) if (!ifactory || !widget)
g_warning ("Unable to set state for menu which doesn't exist:\n%s\n", path); g_warning ("Unable to set state for menu which doesn't exist:\n%s\n",
path);
} }
void void
menus_set_state_glue (gchar *prepath, menus_set_state_glue (gchar *prepath,
gchar *path, gchar *path,
gint state) gboolean state)
{ {
gchar *menupath; gchar *menupath;
@ -793,7 +817,7 @@ menus_set_state_glue (gchar *prepath,
} }
void void
menus_destroy (char *path) menus_destroy (gchar *path)
{ {
if (initialize) if (initialize)
menus_init (); menus_init ();
@ -920,12 +944,12 @@ menus_last_opened_add (gchar *filename)
void void
menus_init_mru (void) menus_init_mru (void)
{ {
gchar *paths, *accelerators; gchar *paths, *accelerators;
gint i; gint i;
GtkItemFactoryEntry *last_opened_entries; GimpItemFactoryEntry *last_opened_entries;
GtkWidget *widget; GtkWidget *widget;
last_opened_entries = g_new (GtkItemFactoryEntry, last_opened_size); last_opened_entries = g_new (GimpItemFactoryEntry, last_opened_size);
paths = g_new (gchar, last_opened_size * MRU_MENU_ENTRY_SIZE); paths = g_new (gchar, last_opened_size * MRU_MENU_ENTRY_SIZE);
accelerators = g_new (gchar, 9 * MRU_MENU_ACCEL_SIZE); accelerators = g_new (gchar, 9 * MRU_MENU_ACCEL_SIZE);
@ -933,40 +957,41 @@ menus_init_mru (void)
for (i = 0; i < last_opened_size; i++) for (i = 0; i < last_opened_size; i++)
{ {
gchar *path, *accelerator; gchar *path, *accelerator;
path = &paths[i * MRU_MENU_ENTRY_SIZE]; path = &paths[i * MRU_MENU_ENTRY_SIZE];
if (i < 9) if (i < 9)
accelerator = &accelerators[i * MRU_MENU_ACCEL_SIZE]; accelerator = &accelerators[i * MRU_MENU_ACCEL_SIZE];
else else
accelerator = NULL; accelerator = NULL;
last_opened_entries[i].path = path; last_opened_entries[i].entry.path = path;
last_opened_entries[i].accelerator = accelerator; last_opened_entries[i].entry.accelerator = accelerator;
last_opened_entries[i].callback = (GtkItemFactoryCallback) menus_last_opened_cmd_callback; last_opened_entries[i].entry.callback =
last_opened_entries[i].callback_action = i; (GtkItemFactoryCallback) menus_last_opened_cmd_callback;
last_opened_entries[i].item_type = NULL; last_opened_entries[i].entry.callback_action = i;
last_opened_entries[i].entry.item_type = NULL;
last_opened_entries[i].help_page = "file/last_opened.html";
last_opened_entries[i].description = NULL;
g_snprintf (path, MRU_MENU_ENTRY_SIZE, N_("/File/MRU%02d"), i + 1); g_snprintf (path, MRU_MENU_ENTRY_SIZE, N_("/File/MRU%02d"), i + 1);
if (accelerator != NULL) if (accelerator != NULL)
g_snprintf (accelerator, MRU_MENU_ACCEL_SIZE, "<control>%d", i + 1); g_snprintf (accelerator, MRU_MENU_ACCEL_SIZE, "<control>%d", i + 1);
} }
gtk_item_factory_create_items_ac (toolbox_factory, last_opened_size, menus_create_items (toolbox_factory, last_opened_size,
last_opened_entries, NULL, 2); last_opened_entries, NULL, 2);
for (i=0; i < last_opened_size; i++) for (i=0; i < last_opened_size; i++)
{ {
widget = gtk_item_factory_get_widget (toolbox_factory, widget = gtk_item_factory_get_widget (toolbox_factory,
last_opened_entries[i].path); last_opened_entries[i].entry.path);
gtk_object_set_data (GTK_OBJECT (widget), "help_page",
(gpointer) "file/last_opened.html");
gtk_widget_hide (widget); gtk_widget_hide (widget);
} }
widget = gtk_item_factory_get_widget (toolbox_factory, widget = gtk_item_factory_get_widget (toolbox_factory,
file_menu_separator.entry.path); file_menu_separator.entry.path);
gtk_widget_hide (widget); gtk_widget_hide (widget);
g_free (paths); g_free (paths);
g_free (accelerators); g_free (accelerators);
g_free (last_opened_entries); g_free (last_opened_entries);
@ -1106,7 +1131,7 @@ menus_init_toolbox (void)
static void static void
menus_init (void) menus_init (void)
{ {
int i; gint i;
if (initialize) if (initialize)
{ {
@ -1128,22 +1153,26 @@ menus_init (void)
NULL, 2); NULL, 2);
load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Load>", NULL); load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Load>", NULL);
gtk_object_set_data (GTK_OBJECT (load_factory), "help_path",
(gpointer) "open");
gtk_item_factory_set_translate_func (load_factory, gtk_item_factory_set_translate_func (load_factory,
menu_translate, menu_translate,
NULL, NULL); NULL, NULL);
gtk_item_factory_create_items_ac (load_factory, menus_create_items (load_factory,
n_load_entries, n_load_entries,
load_entries, load_entries,
NULL, 2); NULL, 2);
save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Save>", NULL); save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Save>", NULL);
gtk_object_set_data (GTK_OBJECT (save_factory), "help_path",
(gpointer) "save");
gtk_item_factory_set_translate_func (save_factory, gtk_item_factory_set_translate_func (save_factory,
menu_translate, menu_translate,
NULL, NULL); NULL, NULL);
gtk_item_factory_create_items_ac (save_factory, menus_create_items (save_factory,
n_save_entries, n_save_entries,
save_entries, save_entries,
NULL, 2); NULL, 2);
layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Layers>", NULL); layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Layers>", NULL);
gtk_object_set_data (GTK_OBJECT (layers_factory), "help_path", gtk_object_set_data (GTK_OBJECT (layers_factory), "help_path",
@ -1246,25 +1275,30 @@ tearoff_cmd_callback (GtkWidget *widget,
} }
else else
{ {
dialog_register(top); dialog_register (top);
gtk_signal_connect_object (GTK_OBJECT (top), gtk_signal_connect_object (GTK_OBJECT (top),
"delete_event", "delete_event",
GTK_SIGNAL_FUNC (tearoff_delete_cb), GTK_SIGNAL_FUNC (tearoff_delete_cb),
GTK_OBJECT (top)); GTK_OBJECT (top));
gtk_object_set_data (GTK_OBJECT (widget),"tearoff_menu_top",top); gtk_object_set_data (GTK_OBJECT (widget), "tearoff_menu_top",
top);
} }
} }
else else
{ {
GtkWidget *top = (GtkWidget *)gtk_object_get_data (GTK_OBJECT (widget),"tearoff_menu_top"); GtkWidget *top;
if(!top)
top = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (widget),
"tearoff_menu_top");
if (!top)
{ {
g_message (_("can't unregister tearoff menu top level window")); g_message (_("can't unregister tearoff menu top level window"));
} }
else else
{ {
dialog_unregister(top); dialog_unregister (top);
} }
} }
} }

View File

@ -20,38 +20,50 @@
#include "gtk/gtk.h" #include "gtk/gtk.h"
void menus_get_toolbox_menubar (GtkWidget **menubar, typedef struct _GimpItemFactoryEntry GimpItemFactoryEntry;
GtkAccelGroup **accel_group);
void menus_get_image_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_load_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_save_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_layers_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_channels_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_paths_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_create (GtkMenuEntry *entries, struct _GimpItemFactoryEntry
gint n_menu_entries); {
void menus_destroy (gchar *path); GtkItemFactoryEntry entry;
gchar *help_page;
gchar *description;
};
void menus_get_toolbox_menubar (GtkWidget **menubar,
GtkAccelGroup **accel_group);
void menus_get_image_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_load_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_save_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_layers_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_channels_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_paths_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
gpointer callback_data);
void menus_destroy (gchar *path);
void menus_quit (void); void menus_quit (void);
void menus_set_sensitive (gchar *path, void menus_set_sensitive (gchar *path,
gint sensitive); gboolean sensitive);
void menus_set_sensitive_glue (gchar *prepath, void menus_set_sensitive_glue (gchar *prepath,
gchar *path, gchar *path,
gint sensitive); gboolean sensitive);
void menus_set_state (gchar *path,
gint state);
void menus_set_state_glue (gchar *prepath,
gchar *path,
gint state);
void menus_last_opened_add (gchar *filename); void menus_set_state (gchar *path,
gboolean state);
void menus_set_state_glue (gchar *prepath,
gchar *path,
gboolean state);
void menus_last_opened_add (gchar *filename);
#endif /* __MENUS_H__ */ #endif /* __MENUS_H__ */

View File

@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
GSList *tmp = NULL; GSList *tmp = NULL;
GtkMenuEntry entry; GimpItemFactoryEntry entry;
char *prog = NULL; char *prog = NULL;
int add_proc_def; int add_proc_def;
int i; int i;
@ -1833,12 +1833,23 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
entry.path = proc_install->menu_path; gchar *help_page;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, proc);
} }
break; break;
} }
@ -2254,7 +2265,7 @@ plug_in_add_to_db (void)
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
GSList *tmp; GSList *tmp;
@ -2268,12 +2279,23 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
entry.path = proc_def->menu_path; gchar *help_page;
entry.accelerator = proc_def->accelerator;
entry.callback = plug_in_callback;
entry.callback_data = &proc_def->db_info;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, &proc_def->db_info);
} }
} }
} }
@ -2317,7 +2339,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */ /* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }
@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget,
{ {
gdisp_ID = gdisplay->ID; gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }

View File

@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
GSList *tmp = NULL; GSList *tmp = NULL;
GtkMenuEntry entry; GimpItemFactoryEntry entry;
char *prog = NULL; char *prog = NULL;
int add_proc_def; int add_proc_def;
int i; int i;
@ -1833,12 +1833,23 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
entry.path = proc_install->menu_path; gchar *help_page;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, proc);
} }
break; break;
} }
@ -2254,7 +2265,7 @@ plug_in_add_to_db (void)
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
GSList *tmp; GSList *tmp;
@ -2268,12 +2279,23 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
entry.path = proc_def->menu_path; gchar *help_page;
entry.accelerator = proc_def->accelerator;
entry.callback = plug_in_callback;
entry.callback_data = &proc_def->db_info;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, &proc_def->db_info);
} }
} }
} }
@ -2317,7 +2339,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */ /* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }
@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget,
{ {
gdisp_ID = gdisplay->ID; gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }

View File

@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
GSList *tmp = NULL; GSList *tmp = NULL;
GtkMenuEntry entry; GimpItemFactoryEntry entry;
char *prog = NULL; char *prog = NULL;
int add_proc_def; int add_proc_def;
int i; int i;
@ -1833,12 +1833,23 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
entry.path = proc_install->menu_path; gchar *help_page;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, proc);
} }
break; break;
} }
@ -2254,7 +2265,7 @@ plug_in_add_to_db (void)
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
GSList *tmp; GSList *tmp;
@ -2268,12 +2279,23 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
entry.path = proc_def->menu_path; gchar *help_page;
entry.accelerator = proc_def->accelerator;
entry.callback = plug_in_callback;
entry.callback_data = &proc_def->db_info;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, &proc_def->db_info);
} }
} }
} }
@ -2317,7 +2339,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */ /* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }
@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget,
{ {
gdisp_ID = gdisplay->ID; gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }

View File

@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
GSList *tmp = NULL; GSList *tmp = NULL;
GtkMenuEntry entry; GimpItemFactoryEntry entry;
char *prog = NULL; char *prog = NULL;
int add_proc_def; int add_proc_def;
int i; int i;
@ -1833,12 +1833,23 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
entry.path = proc_install->menu_path; gchar *help_page;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, proc);
} }
break; break;
} }
@ -2254,7 +2265,7 @@ plug_in_add_to_db (void)
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
GSList *tmp; GSList *tmp;
@ -2268,12 +2279,23 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
entry.path = proc_def->menu_path; gchar *help_page;
entry.accelerator = proc_def->accelerator;
entry.callback = plug_in_callback;
entry.callback_data = &proc_def->db_info;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, &proc_def->db_info);
} }
} }
} }
@ -2317,7 +2339,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */ /* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }
@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget,
{ {
gdisp_ID = gdisplay->ID; gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }

View File

@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
GSList *tmp = NULL; GSList *tmp = NULL;
GtkMenuEntry entry; GimpItemFactoryEntry entry;
char *prog = NULL; char *prog = NULL;
int add_proc_def; int add_proc_def;
int i; int i;
@ -1833,12 +1833,23 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
entry.path = proc_install->menu_path; gchar *help_page;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, proc);
} }
break; break;
} }
@ -2254,7 +2265,7 @@ plug_in_add_to_db (void)
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
GSList *tmp; GSList *tmp;
@ -2268,12 +2279,23 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
entry.path = proc_def->menu_path; gchar *help_page;
entry.accelerator = proc_def->accelerator;
entry.callback = plug_in_callback;
entry.callback_data = &proc_def->db_info;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, &proc_def->db_info);
} }
} }
} }
@ -2317,7 +2339,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */ /* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }
@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget,
{ {
gdisp_ID = gdisplay->ID; gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }

View File

@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
GSList *tmp = NULL; GSList *tmp = NULL;
GtkMenuEntry entry; GimpItemFactoryEntry entry;
char *prog = NULL; char *prog = NULL;
int add_proc_def; int add_proc_def;
int i; int i;
@ -1833,12 +1833,23 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
entry.path = proc_install->menu_path; gchar *help_page;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, proc);
} }
break; break;
} }
@ -2254,7 +2265,7 @@ plug_in_add_to_db (void)
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
GSList *tmp; GSList *tmp;
@ -2268,12 +2279,23 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
entry.path = proc_def->menu_path; gchar *help_page;
entry.accelerator = proc_def->accelerator;
entry.callback = plug_in_callback;
entry.callback_data = &proc_def->db_info;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, &proc_def->db_info);
} }
} }
} }
@ -2317,7 +2339,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */ /* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }
@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget,
{ {
gdisp_ID = gdisplay->ID; gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }

View File

@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
GSList *tmp = NULL; GSList *tmp = NULL;
GtkMenuEntry entry; GimpItemFactoryEntry entry;
char *prog = NULL; char *prog = NULL;
int add_proc_def; int add_proc_def;
int i; int i;
@ -1833,12 +1833,23 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
entry.path = proc_install->menu_path; gchar *help_page;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, proc);
} }
break; break;
} }
@ -2254,7 +2265,7 @@ plug_in_add_to_db (void)
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
GSList *tmp; GSList *tmp;
@ -2268,12 +2279,23 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
entry.path = proc_def->menu_path; gchar *help_page;
entry.accelerator = proc_def->accelerator;
entry.callback = plug_in_callback;
entry.callback_data = &proc_def->db_info;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, &proc_def->db_info);
} }
} }
} }
@ -2317,7 +2339,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */ /* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }
@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget,
{ {
gdisp_ID = gdisplay->ID; gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }

View File

@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
GSList *tmp = NULL; GSList *tmp = NULL;
GtkMenuEntry entry; GimpItemFactoryEntry entry;
char *prog = NULL; char *prog = NULL;
int add_proc_def; int add_proc_def;
int i; int i;
@ -1833,12 +1833,23 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
entry.path = proc_install->menu_path; gchar *help_page;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, proc);
} }
break; break;
} }
@ -2254,7 +2265,7 @@ plug_in_add_to_db (void)
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
GSList *tmp; GSList *tmp;
@ -2268,12 +2279,23 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
entry.path = proc_def->menu_path; gchar *help_page;
entry.accelerator = proc_def->accelerator;
entry.callback = plug_in_callback;
entry.callback_data = &proc_def->db_info;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, &proc_def->db_info);
} }
} }
} }
@ -2317,7 +2339,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */ /* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }
@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget,
{ {
gdisp_ID = gdisplay->ID; gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }

View File

@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
GSList *tmp = NULL; GSList *tmp = NULL;
GtkMenuEntry entry; GimpItemFactoryEntry entry;
char *prog = NULL; char *prog = NULL;
int add_proc_def; int add_proc_def;
int i; int i;
@ -1833,12 +1833,23 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
entry.path = proc_install->menu_path; gchar *help_page;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, proc);
} }
break; break;
} }
@ -2254,7 +2265,7 @@ plug_in_add_to_db (void)
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
GSList *tmp; GSList *tmp;
@ -2268,12 +2279,23 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
entry.path = proc_def->menu_path; gchar *help_page;
entry.accelerator = proc_def->accelerator;
entry.callback = plug_in_callback;
entry.callback_data = &proc_def->db_info;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, &proc_def->db_info);
} }
} }
} }
@ -2317,7 +2339,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */ /* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }
@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget,
{ {
gdisp_ID = gdisplay->ID; gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }

View File

@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
GSList *tmp = NULL; GSList *tmp = NULL;
GtkMenuEntry entry; GimpItemFactoryEntry entry;
char *prog = NULL; char *prog = NULL;
int add_proc_def; int add_proc_def;
int i; int i;
@ -1833,12 +1833,23 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
entry.path = proc_install->menu_path; gchar *help_page;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, proc);
} }
break; break;
} }
@ -2254,7 +2265,7 @@ plug_in_add_to_db (void)
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
GSList *tmp; GSList *tmp;
@ -2268,12 +2279,23 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
entry.path = proc_def->menu_path; gchar *help_page;
entry.accelerator = proc_def->accelerator;
entry.callback = plug_in_callback;
entry.callback_data = &proc_def->db_info;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, &proc_def->db_info);
} }
} }
} }
@ -2317,7 +2339,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */ /* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }
@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget,
{ {
gdisp_ID = gdisplay->ID; gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }

View File

@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
GSList *tmp = NULL; GSList *tmp = NULL;
GtkMenuEntry entry; GimpItemFactoryEntry entry;
char *prog = NULL; char *prog = NULL;
int add_proc_def; int add_proc_def;
int i; int i;
@ -1833,12 +1833,23 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
entry.path = proc_install->menu_path; gchar *help_page;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, proc);
} }
break; break;
} }
@ -2254,7 +2265,7 @@ plug_in_add_to_db (void)
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
GSList *tmp; GSList *tmp;
@ -2268,12 +2279,23 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
entry.path = proc_def->menu_path; gchar *help_page;
entry.accelerator = proc_def->accelerator;
entry.callback = plug_in_callback;
entry.callback_data = &proc_def->db_info;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, &proc_def->db_info);
} }
} }
} }
@ -2317,7 +2339,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */ /* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }
@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget,
{ {
gdisp_ID = gdisplay->ID; gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }

View File

@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
GSList *tmp = NULL; GSList *tmp = NULL;
GtkMenuEntry entry; GimpItemFactoryEntry entry;
char *prog = NULL; char *prog = NULL;
int add_proc_def; int add_proc_def;
int i; int i;
@ -1833,12 +1833,23 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
entry.path = proc_install->menu_path; gchar *help_page;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, proc);
} }
break; break;
} }
@ -2254,7 +2265,7 @@ plug_in_add_to_db (void)
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
GSList *tmp; GSList *tmp;
@ -2268,12 +2279,23 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
entry.path = proc_def->menu_path; gchar *help_page;
entry.accelerator = proc_def->accelerator;
entry.callback = plug_in_callback;
entry.callback_data = &proc_def->db_info;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, &proc_def->db_info);
} }
} }
} }
@ -2317,7 +2339,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */ /* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }
@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget,
{ {
gdisp_ID = gdisplay->ID; gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }

View File

@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
GSList *tmp = NULL; GSList *tmp = NULL;
GtkMenuEntry entry; GimpItemFactoryEntry entry;
char *prog = NULL; char *prog = NULL;
int add_proc_def; int add_proc_def;
int i; int i;
@ -1833,12 +1833,23 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
entry.path = proc_install->menu_path; gchar *help_page;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, proc);
} }
break; break;
} }
@ -2254,7 +2265,7 @@ plug_in_add_to_db (void)
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
GSList *tmp; GSList *tmp;
@ -2268,12 +2279,23 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
entry.path = proc_def->menu_path; gchar *help_page;
entry.accelerator = proc_def->accelerator;
entry.callback = plug_in_callback;
entry.callback_data = &proc_def->db_info;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, &proc_def->db_info);
} }
} }
} }
@ -2317,7 +2339,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */ /* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }
@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget,
{ {
gdisp_ID = gdisplay->ID; gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }

View File

@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
GSList *tmp = NULL; GSList *tmp = NULL;
GtkMenuEntry entry; GimpItemFactoryEntry entry;
char *prog = NULL; char *prog = NULL;
int add_proc_def; int add_proc_def;
int i; int i;
@ -1833,12 +1833,23 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
entry.path = proc_install->menu_path; gchar *help_page;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, proc);
} }
break; break;
} }
@ -2254,7 +2265,7 @@ plug_in_add_to_db (void)
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
GSList *tmp; GSList *tmp;
@ -2268,12 +2279,23 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
entry.path = proc_def->menu_path; gchar *help_page;
entry.accelerator = proc_def->accelerator;
entry.callback = plug_in_callback;
entry.callback_data = &proc_def->db_info;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, &proc_def->db_info);
} }
} }
} }
@ -2317,7 +2339,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */ /* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }
@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget,
{ {
gdisp_ID = gdisplay->ID; gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }

View File

@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
GSList *tmp = NULL; GSList *tmp = NULL;
GtkMenuEntry entry; GimpItemFactoryEntry entry;
char *prog = NULL; char *prog = NULL;
int add_proc_def; int add_proc_def;
int i; int i;
@ -1833,12 +1833,23 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
entry.path = proc_install->menu_path; gchar *help_page;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, proc);
} }
break; break;
} }
@ -2254,7 +2265,7 @@ plug_in_add_to_db (void)
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
GSList *tmp; GSList *tmp;
@ -2268,12 +2279,23 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
entry.path = proc_def->menu_path; gchar *help_page;
entry.accelerator = proc_def->accelerator;
entry.callback = plug_in_callback;
entry.callback_data = &proc_def->db_info;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, &proc_def->db_info);
} }
} }
} }
@ -2317,7 +2339,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */ /* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }
@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget,
{ {
gdisp_ID = gdisplay->ID; gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }

View File

@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
GSList *tmp = NULL; GSList *tmp = NULL;
GtkMenuEntry entry; GimpItemFactoryEntry entry;
char *prog = NULL; char *prog = NULL;
int add_proc_def; int add_proc_def;
int i; int i;
@ -1833,12 +1833,23 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
entry.path = proc_install->menu_path; gchar *help_page;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, proc);
} }
break; break;
} }
@ -2254,7 +2265,7 @@ plug_in_add_to_db (void)
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
GSList *tmp; GSList *tmp;
@ -2268,12 +2279,23 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
entry.path = proc_def->menu_path; gchar *help_page;
entry.accelerator = proc_def->accelerator;
entry.callback = plug_in_callback;
entry.callback_data = &proc_def->db_info;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, &proc_def->db_info);
} }
} }
} }
@ -2317,7 +2339,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */ /* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }
@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget,
{ {
gdisp_ID = gdisplay->ID; gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }

View File

@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
GSList *tmp = NULL; GSList *tmp = NULL;
GtkMenuEntry entry; GimpItemFactoryEntry entry;
char *prog = NULL; char *prog = NULL;
int add_proc_def; int add_proc_def;
int i; int i;
@ -1833,12 +1833,23 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
entry.path = proc_install->menu_path; gchar *help_page;
entry.accelerator = NULL;
entry.callback = plug_in_callback;
entry.callback_data = proc;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, proc);
} }
break; break;
} }
@ -2254,7 +2265,7 @@ plug_in_add_to_db (void)
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GtkMenuEntry entry; GimpItemFactoryEntry entry;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
GSList *tmp; GSList *tmp;
@ -2268,12 +2279,23 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
entry.path = proc_def->menu_path; gchar *help_page;
entry.accelerator = proc_def->accelerator;
entry.callback = plug_in_callback;
entry.callback_data = &proc_def->db_info;
menus_create (&entry, 1); help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry, &proc_def->db_info);
} }
} }
} }
@ -2317,7 +2339,7 @@ plug_in_callback (GtkWidget *widget,
/* initialize the first 3 plug-in arguments */ /* initialize the first 3 plug-in arguments */
args[0].value.pdb_int = RUN_INTERACTIVE; args[0].value.pdb_int = RUN_INTERACTIVE;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }
@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget,
{ {
gdisp_ID = gdisplay->ID; gdisp_ID = gdisplay->ID;
args[1].value.pdb_int = pdb_image_to_id(gdisplay->gimage); args[1].value.pdb_int = pdb_image_to_id (gdisplay->gimage);
args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage));
argc = 3; argc = 3;
} }

View File

@ -44,15 +44,21 @@
#define MRU_MENU_ENTRY_SIZE (strlen (_("/File/MRU00 ")) + 1) #define MRU_MENU_ENTRY_SIZE (strlen (_("/File/MRU00 ")) + 1)
#define MRU_MENU_ACCEL_SIZE sizeof ("<control>0") #define MRU_MENU_ACCEL_SIZE sizeof ("<control>0")
typedef struct _GimpItemFactoryEntry GimpItemFactoryEntry; static void menus_create_item (GtkItemFactory *item_factory,
GimpItemFactoryEntry *entry,
struct _GimpItemFactoryEntry gpointer callback_data,
{ guint callback_type);
GtkItemFactoryEntry entry; static void menus_create_items (GtkItemFactory *item_factory,
guint n_entries,
gchar *help_page; GimpItemFactoryEntry *entries,
gchar *description; gpointer callback_data,
}; guint callback_type);
static void menus_init (void);
static gchar *menu_translate (const gchar *path,
gpointer data);
static void tearoff_cmd_callback (GtkWidget *widget,
gpointer callback_data,
guint callback_action);
static char* G_GNUC_UNUSED dummyMenus[] = { N_("/File/MRU00 "), static char* G_GNUC_UNUSED dummyMenus[] = { N_("/File/MRU00 "),
N_("/File"), N_("/File"),
@ -64,17 +70,6 @@ static char* G_GNUC_UNUSED dummyMenus[] = { N_("/File/MRU00 "),
N_("/View/Zoom"), N_("/View/Zoom"),
N_("/Stack")}; N_("/Stack")};
static void menus_create_item (GtkItemFactory *item_factory,
GimpItemFactoryEntry *entry,
gpointer callback_data,
guint callback_type);
static void menus_init (void);
static gchar *menu_translate (const gchar *path,
gpointer data);
static void tearoff_cmd_callback (GtkWidget *widget,
gpointer callback_data,
guint callback_action);
static GSList *last_opened_raw_filenames = NULL; static GSList *last_opened_raw_filenames = NULL;
static GimpItemFactoryEntry toolbox_entries[] = static GimpItemFactoryEntry toolbox_entries[] =
@ -84,7 +79,7 @@ static GimpItemFactoryEntry toolbox_entries[] =
{ { N_("/File/New"), "<control>N", file_new_cmd_callback, 0 }, { { N_("/File/New"), "<control>N", file_new_cmd_callback, 0 },
"file/dialogs/file_new.html", NULL }, "file/dialogs/file_new.html", NULL },
{ { N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 }, { { N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
"file/dialogs/file_open.html", NULL }, "open/index.html", NULL },
{ { N_("/File/Acquire/tearoff1"), NULL, NULL, 0, "<Tearoff>" }, { { N_("/File/Acquire/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
NULL, NULL }, NULL, NULL },
{ { N_("/File/About..."), NULL, about_dialog_cmd_callback, 0 }, { { N_("/File/About..."), NULL, about_dialog_cmd_callback, 0 },
@ -149,11 +144,11 @@ static GimpItemFactoryEntry image_entries[] =
{ { N_("/File/New"), "<control>N", file_new_cmd_callback, 1 }, { { N_("/File/New"), "<control>N", file_new_cmd_callback, 1 },
"file/dialogs/file_new.html", NULL }, "file/dialogs/file_new.html", NULL },
{ { N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 }, { { N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
"file/dialogs/file_open.html", NULL }, "open/index.html", NULL },
{ { N_("/File/Save"), "<control>S", file_save_cmd_callback, 0 }, { { N_("/File/Save"), "<control>S", file_save_cmd_callback, 0 },
"file/dialogs/file_save.html", NULL }, "save/index.html", NULL },
{ { N_("/File/Save as"), NULL, file_save_as_cmd_callback, 0 }, { { N_("/File/Save as"), NULL, file_save_as_cmd_callback, 0 },
"file/dialogs/save_as.html", NULL }, "save/index.html", NULL },
{ { N_("/File/Revert"), NULL, file_revert_cmd_callback, 0 }, { { N_("/File/Revert"), NULL, file_revert_cmd_callback, 0 },
"file/revert.html", NULL }, "file/revert.html", NULL },
{ { N_("/File/Preferences..."), NULL, file_pref_cmd_callback, 0 }, { { N_("/File/Preferences..."), NULL, file_pref_cmd_callback, 0 },
@ -414,21 +409,27 @@ static GimpItemFactoryEntry image_entries[] =
static guint n_image_entries = (sizeof (image_entries) / static guint n_image_entries = (sizeof (image_entries) /
sizeof (image_entries[0])); sizeof (image_entries[0]));
static GtkItemFactory *image_factory = NULL; static GtkItemFactory *image_factory = NULL;
static GtkItemFactoryEntry load_entries[] = static GimpItemFactoryEntry load_entries[] =
{ {
{ N_("/Automatic"), NULL, file_load_by_extension_callback, 0 }, { { N_("/Automatic"), NULL, file_load_by_extension_callback, 0 },
{ "/---", NULL, NULL, 0, "<Separator>" }, NULL, NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL }
}; };
static guint n_load_entries = sizeof (load_entries) / sizeof (load_entries[0]); static guint n_load_entries = (sizeof (load_entries) /
sizeof (load_entries[0]));
static GtkItemFactory *load_factory = NULL; static GtkItemFactory *load_factory = NULL;
static GtkItemFactoryEntry save_entries[] = static GimpItemFactoryEntry save_entries[] =
{ {
{ N_("/By extension"), NULL, file_save_by_extension_callback, 0 }, { { N_("/By extension"), NULL, file_save_by_extension_callback, 0 },
{ "/---", NULL, NULL, 0, "<Separator>" }, NULL, NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
}; };
static guint n_save_entries = sizeof (save_entries) / sizeof (save_entries[0]); static guint n_save_entries = (sizeof (save_entries) /
sizeof (save_entries[0]));
static GtkItemFactory *save_factory = NULL; static GtkItemFactory *save_factory = NULL;
static GimpItemFactoryEntry layers_entries[] = static GimpItemFactoryEntry layers_entries[] =
@ -540,7 +541,7 @@ static guint n_paths_entries = (sizeof (paths_entries) /
sizeof (paths_entries[0])); sizeof (paths_entries[0]));
static GtkItemFactory *paths_factory = NULL; static GtkItemFactory *paths_factory = NULL;
static int initialize = TRUE; static gboolean initialize = TRUE;
void void
menus_get_toolbox_menubar (GtkWidget **menubar, menus_get_toolbox_menubar (GtkWidget **menubar,
@ -634,48 +635,69 @@ menus_get_paths_menu (GtkWidget **menu,
} }
void void
menus_create (GtkMenuEntry *entries, menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
int n_menu_entries) gpointer callback_data)
{ {
GtkItemFactory *ifactory;
GtkWidget *menu_item; GtkWidget *menu_item;
int i; gboolean redo_image_menu = FALSE;
int redo_image_menu = FALSE;
GString *tearoff_path; GString *tearoff_path;
gchar *path;
if (initialize) if (initialize)
menus_init (); menus_init ();
tearoff_path = g_string_new (""); tearoff_path = g_string_new ("");
for (i = 0; i < n_menu_entries; i++) if (! strncmp (entry->entry.path, "<Image>", 7))
if (! strncmp (entries[i].path, "<Image>", 7)) {
{ gchar *p;
char *p;
p = strchr (entries[i].path + 8, '/'); p = strchr (entry->entry.path + 8, '/');
while (p) while (p)
{ {
g_string_assign (tearoff_path, entries[i].path + 7); g_string_assign (tearoff_path, entry->entry.path + 7);
g_string_truncate (tearoff_path, p - entries[i].path + 1 - 7); g_string_truncate (tearoff_path,
g_string_append (tearoff_path, "tearoff1"); p - entry->entry.path + 1 - 7);
g_string_append (tearoff_path, "tearoff1");
if (! gtk_item_factory_get_widget (image_factory, tearoff_path->str)) if (! gtk_item_factory_get_widget (image_factory,
{ tearoff_path->str))
GtkItemFactoryEntry entry = { NULL, NULL, NULL, 0, "<Tearoff>" }; {
entry.path = tearoff_path->str; GimpItemFactoryEntry tearoff_entry =
entry.callback = tearoff_cmd_callback; { { NULL, NULL, NULL, 0, "<Tearoff>" },
gtk_item_factory_create_items_ac (image_factory, 1, &entry, NULL,2); NULL, NULL };
}
p = strchr (p + 1, '/'); tearoff_entry.entry.path = tearoff_path->str;
} tearoff_entry.entry.callback = tearoff_cmd_callback;
menus_create_item (image_factory, &tearoff_entry, NULL, 2);
}
redo_image_menu = TRUE; p = strchr (p + 1, '/');
} }
redo_image_menu = TRUE;
}
g_string_free (tearoff_path, TRUE); g_string_free (tearoff_path, TRUE);
gtk_item_factory_create_menu_entries (n_menu_entries, entries); path = entry->entry.path;
ifactory = gtk_item_factory_from_path (path);
if (!ifactory)
{
g_warning ("menus_create_item_from_full_path(): "
"entry refers to unknown item factory: \"%s\"", path);
return;
}
while (*path != '>')
path++;
path++;
entry->entry.path = path;
menus_create_item (ifactory, entry,
callback_data, 2);
if (redo_image_menu) if (redo_image_menu)
{ {
@ -719,8 +741,8 @@ menus_tools_create (ToolInfo *tool_info)
} }
void void
menus_set_sensitive (gchar *path, menus_set_sensitive (gchar *path,
gint sensitive) gboolean sensitive)
{ {
GtkItemFactory *ifactory; GtkItemFactory *ifactory;
GtkWidget *widget = NULL; GtkWidget *widget = NULL;
@ -737,16 +759,17 @@ menus_set_sensitive (gchar *path,
gtk_widget_set_sensitive (widget, sensitive); gtk_widget_set_sensitive (widget, sensitive);
} }
if (!ifactory || !widget) if (!ifactory || !widget)
g_warning ("Unable to set sensitivity for menu which doesn't exist:\n%s", path); g_warning ("Unable to set sensitivity for menu which doesn't exist:\n%s",
path);
} }
/* The following function will enhance our localesystem because /* The following function will enhance our localesystem because
we don't need to have our menuentries twice in our catalog */ we don't need to have our menuentries twice in our catalog */
void void
menus_set_sensitive_glue (gchar *prepath, menus_set_sensitive_glue (gchar *prepath,
gchar *path, gchar *path,
gint sensitive) gboolean sensitive)
{ {
gchar *menupath; gchar *menupath;
@ -756,8 +779,8 @@ menus_set_sensitive_glue (gchar *prepath,
} }
void void
menus_set_state (gchar *path, menus_set_state (gchar *path,
gint state) gboolean state)
{ {
GtkItemFactory *ifactory; GtkItemFactory *ifactory;
GtkWidget *widget = NULL; GtkWidget *widget = NULL;
@ -777,13 +800,14 @@ menus_set_state (gchar *path,
widget = NULL; widget = NULL;
} }
if (!ifactory || !widget) if (!ifactory || !widget)
g_warning ("Unable to set state for menu which doesn't exist:\n%s\n", path); g_warning ("Unable to set state for menu which doesn't exist:\n%s\n",
path);
} }
void void
menus_set_state_glue (gchar *prepath, menus_set_state_glue (gchar *prepath,
gchar *path, gchar *path,
gint state) gboolean state)
{ {
gchar *menupath; gchar *menupath;
@ -793,7 +817,7 @@ menus_set_state_glue (gchar *prepath,
} }
void void
menus_destroy (char *path) menus_destroy (gchar *path)
{ {
if (initialize) if (initialize)
menus_init (); menus_init ();
@ -920,12 +944,12 @@ menus_last_opened_add (gchar *filename)
void void
menus_init_mru (void) menus_init_mru (void)
{ {
gchar *paths, *accelerators; gchar *paths, *accelerators;
gint i; gint i;
GtkItemFactoryEntry *last_opened_entries; GimpItemFactoryEntry *last_opened_entries;
GtkWidget *widget; GtkWidget *widget;
last_opened_entries = g_new (GtkItemFactoryEntry, last_opened_size); last_opened_entries = g_new (GimpItemFactoryEntry, last_opened_size);
paths = g_new (gchar, last_opened_size * MRU_MENU_ENTRY_SIZE); paths = g_new (gchar, last_opened_size * MRU_MENU_ENTRY_SIZE);
accelerators = g_new (gchar, 9 * MRU_MENU_ACCEL_SIZE); accelerators = g_new (gchar, 9 * MRU_MENU_ACCEL_SIZE);
@ -933,40 +957,41 @@ menus_init_mru (void)
for (i = 0; i < last_opened_size; i++) for (i = 0; i < last_opened_size; i++)
{ {
gchar *path, *accelerator; gchar *path, *accelerator;
path = &paths[i * MRU_MENU_ENTRY_SIZE]; path = &paths[i * MRU_MENU_ENTRY_SIZE];
if (i < 9) if (i < 9)
accelerator = &accelerators[i * MRU_MENU_ACCEL_SIZE]; accelerator = &accelerators[i * MRU_MENU_ACCEL_SIZE];
else else
accelerator = NULL; accelerator = NULL;
last_opened_entries[i].path = path; last_opened_entries[i].entry.path = path;
last_opened_entries[i].accelerator = accelerator; last_opened_entries[i].entry.accelerator = accelerator;
last_opened_entries[i].callback = (GtkItemFactoryCallback) menus_last_opened_cmd_callback; last_opened_entries[i].entry.callback =
last_opened_entries[i].callback_action = i; (GtkItemFactoryCallback) menus_last_opened_cmd_callback;
last_opened_entries[i].item_type = NULL; last_opened_entries[i].entry.callback_action = i;
last_opened_entries[i].entry.item_type = NULL;
last_opened_entries[i].help_page = "file/last_opened.html";
last_opened_entries[i].description = NULL;
g_snprintf (path, MRU_MENU_ENTRY_SIZE, N_("/File/MRU%02d"), i + 1); g_snprintf (path, MRU_MENU_ENTRY_SIZE, N_("/File/MRU%02d"), i + 1);
if (accelerator != NULL) if (accelerator != NULL)
g_snprintf (accelerator, MRU_MENU_ACCEL_SIZE, "<control>%d", i + 1); g_snprintf (accelerator, MRU_MENU_ACCEL_SIZE, "<control>%d", i + 1);
} }
gtk_item_factory_create_items_ac (toolbox_factory, last_opened_size, menus_create_items (toolbox_factory, last_opened_size,
last_opened_entries, NULL, 2); last_opened_entries, NULL, 2);
for (i=0; i < last_opened_size; i++) for (i=0; i < last_opened_size; i++)
{ {
widget = gtk_item_factory_get_widget (toolbox_factory, widget = gtk_item_factory_get_widget (toolbox_factory,
last_opened_entries[i].path); last_opened_entries[i].entry.path);
gtk_object_set_data (GTK_OBJECT (widget), "help_page",
(gpointer) "file/last_opened.html");
gtk_widget_hide (widget); gtk_widget_hide (widget);
} }
widget = gtk_item_factory_get_widget (toolbox_factory, widget = gtk_item_factory_get_widget (toolbox_factory,
file_menu_separator.entry.path); file_menu_separator.entry.path);
gtk_widget_hide (widget); gtk_widget_hide (widget);
g_free (paths); g_free (paths);
g_free (accelerators); g_free (accelerators);
g_free (last_opened_entries); g_free (last_opened_entries);
@ -1106,7 +1131,7 @@ menus_init_toolbox (void)
static void static void
menus_init (void) menus_init (void)
{ {
int i; gint i;
if (initialize) if (initialize)
{ {
@ -1128,22 +1153,26 @@ menus_init (void)
NULL, 2); NULL, 2);
load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Load>", NULL); load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Load>", NULL);
gtk_object_set_data (GTK_OBJECT (load_factory), "help_path",
(gpointer) "open");
gtk_item_factory_set_translate_func (load_factory, gtk_item_factory_set_translate_func (load_factory,
menu_translate, menu_translate,
NULL, NULL); NULL, NULL);
gtk_item_factory_create_items_ac (load_factory, menus_create_items (load_factory,
n_load_entries, n_load_entries,
load_entries, load_entries,
NULL, 2); NULL, 2);
save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Save>", NULL); save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Save>", NULL);
gtk_object_set_data (GTK_OBJECT (save_factory), "help_path",
(gpointer) "save");
gtk_item_factory_set_translate_func (save_factory, gtk_item_factory_set_translate_func (save_factory,
menu_translate, menu_translate,
NULL, NULL); NULL, NULL);
gtk_item_factory_create_items_ac (save_factory, menus_create_items (save_factory,
n_save_entries, n_save_entries,
save_entries, save_entries,
NULL, 2); NULL, 2);
layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Layers>", NULL); layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Layers>", NULL);
gtk_object_set_data (GTK_OBJECT (layers_factory), "help_path", gtk_object_set_data (GTK_OBJECT (layers_factory), "help_path",
@ -1246,25 +1275,30 @@ tearoff_cmd_callback (GtkWidget *widget,
} }
else else
{ {
dialog_register(top); dialog_register (top);
gtk_signal_connect_object (GTK_OBJECT (top), gtk_signal_connect_object (GTK_OBJECT (top),
"delete_event", "delete_event",
GTK_SIGNAL_FUNC (tearoff_delete_cb), GTK_SIGNAL_FUNC (tearoff_delete_cb),
GTK_OBJECT (top)); GTK_OBJECT (top));
gtk_object_set_data (GTK_OBJECT (widget),"tearoff_menu_top",top); gtk_object_set_data (GTK_OBJECT (widget), "tearoff_menu_top",
top);
} }
} }
else else
{ {
GtkWidget *top = (GtkWidget *)gtk_object_get_data (GTK_OBJECT (widget),"tearoff_menu_top"); GtkWidget *top;
if(!top)
top = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (widget),
"tearoff_menu_top");
if (!top)
{ {
g_message (_("can't unregister tearoff menu top level window")); g_message (_("can't unregister tearoff menu top level window"));
} }
else else
{ {
dialog_unregister(top); dialog_unregister (top);
} }
} }
} }

View File

@ -20,38 +20,50 @@
#include "gtk/gtk.h" #include "gtk/gtk.h"
void menus_get_toolbox_menubar (GtkWidget **menubar, typedef struct _GimpItemFactoryEntry GimpItemFactoryEntry;
GtkAccelGroup **accel_group);
void menus_get_image_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_load_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_save_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_layers_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_channels_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_paths_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_create (GtkMenuEntry *entries, struct _GimpItemFactoryEntry
gint n_menu_entries); {
void menus_destroy (gchar *path); GtkItemFactoryEntry entry;
gchar *help_page;
gchar *description;
};
void menus_get_toolbox_menubar (GtkWidget **menubar,
GtkAccelGroup **accel_group);
void menus_get_image_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_load_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_save_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_layers_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_channels_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_get_paths_menu (GtkWidget **menu,
GtkAccelGroup **accel_group);
void menus_create_item_from_full_path (GimpItemFactoryEntry *entry,
gpointer callback_data);
void menus_destroy (gchar *path);
void menus_quit (void); void menus_quit (void);
void menus_set_sensitive (gchar *path, void menus_set_sensitive (gchar *path,
gint sensitive); gboolean sensitive);
void menus_set_sensitive_glue (gchar *prepath, void menus_set_sensitive_glue (gchar *prepath,
gchar *path, gchar *path,
gint sensitive); gboolean sensitive);
void menus_set_state (gchar *path,
gint state);
void menus_set_state_glue (gchar *prepath,
gchar *path,
gint state);
void menus_last_opened_add (gchar *filename); void menus_set_state (gchar *path,
gboolean state);
void menus_set_state_glue (gchar *prepath,
gchar *path,
gboolean state);
void menus_last_opened_add (gchar *filename);
#endif /* __MENUS_H__ */ #endif /* __MENUS_H__ */