From 3ed87f4aa48e69c44942e6695fbe7ad1e13586c2 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sun, 3 Oct 1999 16:54:17 +0000 Subject: [PATCH] app/fileops.c app/menus.[ch] app/menus.h show a help page for all menu 1999-10-03 Michael Natterer * 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. --- ChangeLog | 16 ++ app/actions/plug-in-commands.c | 50 ++++-- app/fileops.c | 64 ++++--- app/gui/menus.c | 242 +++++++++++++++------------ app/gui/menus.h | 68 ++++---- app/gui/plug-in-commands.c | 50 ++++-- app/gui/plug-in-menus.c | 50 ++++-- app/menus.c | 242 +++++++++++++++------------ app/menus.h | 68 ++++---- app/menus/menus.c | 242 +++++++++++++++------------ app/menus/menus.h | 68 ++++---- app/menus/plug-in-menus.c | 50 ++++-- app/plug-in/gimpplugin-message.c | 50 ++++-- app/plug-in/gimpplugin-progress.c | 50 ++++-- app/plug-in/gimpplugin.c | 50 ++++-- app/plug-in/gimppluginmanager-call.c | 50 ++++-- app/plug-in/gimppluginmanager-run.c | 50 ++++-- app/plug-in/gimppluginmanager.c | 50 ++++-- app/plug-in/gimppluginshm.c | 50 ++++-- app/plug-in/plug-in-def.c | 50 ++++-- app/plug-in/plug-in-message.c | 50 ++++-- app/plug-in/plug-in-params.c | 50 ++++-- app/plug-in/plug-in-progress.c | 50 ++++-- app/plug-in/plug-in-run.c | 50 ++++-- app/plug-in/plug-in-shm.c | 50 ++++-- app/plug-in/plug-in.c | 50 ++++-- app/plug-in/plug-ins.c | 50 ++++-- app/plug_in.c | 50 ++++-- app/widgets/gimpitemfactory.c | 242 +++++++++++++++------------ app/widgets/gimpitemfactory.h | 68 ++++---- 30 files changed, 1492 insertions(+), 828 deletions(-) diff --git a/ChangeLog b/ChangeLog index c6f5125d77..b619b5c43b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +1999-10-03 Michael Natterer + + * 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 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. Will be partially exported and moved to gimphelp.[ch] later to catch key_press for plug-in menu items (don't try this now ;-) + Renamed "Channel Ops" under /Image to "Channels" and moved + some entries to more useful places. * app/app_procs.c * app/brush_edit.c @@ -71,6 +84,9 @@ * modules/colorsel_triangle.c * 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 according to the new help file structure. diff --git a/app/actions/plug-in-commands.c b/app/actions/plug-in-commands.c index 1952ba5cfe..3cf3addd02 100644 --- a/app/actions/plug-in-commands.c +++ b/app/actions/plug-in-commands.c @@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) PlugInProcDef *proc_def; ProcRecord *proc = NULL; GSList *tmp = NULL; - GtkMenuEntry entry; + GimpItemFactoryEntry entry; char *prog = NULL; int add_proc_def; 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 (proc_install->menu_path) { - entry.path = proc_install->menu_path; - entry.accelerator = NULL; - entry.callback = plug_in_callback; - entry.callback_data = proc; + gchar *help_page; - 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; } @@ -2254,7 +2265,7 @@ plug_in_add_to_db (void) static void plug_in_make_menu (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *proc_def; GSList *tmp; @@ -2268,12 +2279,23 @@ plug_in_make_menu (void) !proc_def->prefixes && !proc_def->magics)) { - entry.path = proc_def->menu_path; - entry.accelerator = proc_def->accelerator; - entry.callback = plug_in_callback; - entry.callback_data = &proc_def->db_info; + gchar *help_page; - 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 */ 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)); argc = 3; } @@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget, { 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)); argc = 3; } diff --git a/app/fileops.c b/app/fileops.c index 9267701d62..7138549d3a 100644 --- a/app/fileops.c +++ b/app/fileops.c @@ -161,7 +161,7 @@ file_ops_pre_init (void) void file_ops_post_init (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *file_proc; GSList *tmp; @@ -171,29 +171,49 @@ file_ops_post_init (void) tmp = load_procs; while (tmp) { + gchar *help_page; + file_proc = tmp->data; tmp = tmp->next; - entry.path = file_proc->menu_path; - entry.accelerator = NULL; - entry.callback = file_load_type_callback; - entry.callback_data = file_proc; + help_page = g_strconcat (g_basename (file_proc->prog), + ".html", + NULL); + 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; while (tmp) { + gchar *help_page; + file_proc = tmp->data; tmp = tmp->next; - entry.path = file_proc->menu_path; - entry.accelerator = NULL; - entry.callback = file_save_type_callback; - entry.callback_data = file_proc; + help_page = g_strconcat (g_basename (file_proc->prog), + ".html", + NULL); + 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 */ gimp_help_connect_help_accel (fileload, gimp_standard_help_func, - "dialogs/file_open.html"); + "open/index.html"); } else { @@ -445,8 +465,16 @@ file_save_as_callback (GtkWidget *widget, "delete_event", GTK_SIGNAL_FUNC (file_dialog_hide), 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)); + + /* Connect the "F1" help key */ + gimp_help_connect_help_accel (filesave, + gimp_standard_help_func, + "save/index.html"); } else { @@ -457,11 +485,6 @@ file_save_as_callback (GtkWidget *widget, gtk_file_selection_set_filename (GTK_FILE_SELECTION(filesave), "." G_DIR_SEPARATOR_S); 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 (); @@ -471,7 +494,8 @@ file_save_as_callback (GtkWidget *widget, if (!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); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); @@ -1592,7 +1616,7 @@ file_overwrite (char *filename, overwrite_box->obox = gimp_dialog_new (_("File Exists!"), "file_exists", gimp_standard_help_func, - "dialogs/file_exists.html", + "save/file_exists.html", GTK_WIN_POS_MOUSE, FALSE, TRUE, FALSE, diff --git a/app/gui/menus.c b/app/gui/menus.c index 98c1e5694c..a4d1c578a6 100644 --- a/app/gui/menus.c +++ b/app/gui/menus.c @@ -44,15 +44,21 @@ #define MRU_MENU_ENTRY_SIZE (strlen (_("/File/MRU00 ")) + 1) #define MRU_MENU_ACCEL_SIZE sizeof ("0") -typedef struct _GimpItemFactoryEntry GimpItemFactoryEntry; - -struct _GimpItemFactoryEntry -{ - GtkItemFactoryEntry entry; - - gchar *help_page; - gchar *description; -}; +static void menus_create_item (GtkItemFactory *item_factory, + GimpItemFactoryEntry *entry, + gpointer callback_data, + guint callback_type); +static void menus_create_items (GtkItemFactory *item_factory, + guint n_entries, + GimpItemFactoryEntry *entries, + 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 "), N_("/File"), @@ -64,17 +70,6 @@ static char* G_GNUC_UNUSED dummyMenus[] = { N_("/File/MRU00 "), N_("/View/Zoom"), 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 GimpItemFactoryEntry toolbox_entries[] = @@ -84,7 +79,7 @@ static GimpItemFactoryEntry toolbox_entries[] = { { N_("/File/New"), "N", file_new_cmd_callback, 0 }, "file/dialogs/file_new.html", NULL }, { { N_("/File/Open"), "O", file_open_cmd_callback, 0 }, - "file/dialogs/file_open.html", NULL }, + "open/index.html", NULL }, { { N_("/File/Acquire/tearoff1"), NULL, NULL, 0, "" }, NULL, NULL }, { { N_("/File/About..."), NULL, about_dialog_cmd_callback, 0 }, @@ -149,11 +144,11 @@ static GimpItemFactoryEntry image_entries[] = { { N_("/File/New"), "N", file_new_cmd_callback, 1 }, "file/dialogs/file_new.html", NULL }, { { N_("/File/Open"), "O", file_open_cmd_callback, 0 }, - "file/dialogs/file_open.html", NULL }, + "open/index.html", NULL }, { { N_("/File/Save"), "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 }, - "file/dialogs/save_as.html", NULL }, + "save/index.html", NULL }, { { N_("/File/Revert"), NULL, file_revert_cmd_callback, 0 }, "file/revert.html", NULL }, { { 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) / sizeof (image_entries[0])); static GtkItemFactory *image_factory = NULL; - -static GtkItemFactoryEntry load_entries[] = + +static GimpItemFactoryEntry load_entries[] = { - { N_("/Automatic"), NULL, file_load_by_extension_callback, 0 }, - { "/---", NULL, NULL, 0, "" }, + { { N_("/Automatic"), NULL, file_load_by_extension_callback, 0 }, + NULL, NULL }, + { { "/---", NULL, NULL, 0, "" }, + 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 GtkItemFactoryEntry save_entries[] = +static GimpItemFactoryEntry save_entries[] = { - { N_("/By extension"), NULL, file_save_by_extension_callback, 0 }, - { "/---", NULL, NULL, 0, "" }, + { { N_("/By extension"), NULL, file_save_by_extension_callback, 0 }, + NULL, NULL }, + { { "/---", NULL, NULL, 0, "" }, + 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 GimpItemFactoryEntry layers_entries[] = @@ -540,7 +541,7 @@ static guint n_paths_entries = (sizeof (paths_entries) / sizeof (paths_entries[0])); static GtkItemFactory *paths_factory = NULL; -static int initialize = TRUE; +static gboolean initialize = TRUE; void menus_get_toolbox_menubar (GtkWidget **menubar, @@ -634,48 +635,69 @@ menus_get_paths_menu (GtkWidget **menu, } void -menus_create (GtkMenuEntry *entries, - int n_menu_entries) +menus_create_item_from_full_path (GimpItemFactoryEntry *entry, + gpointer callback_data) { + GtkItemFactory *ifactory; GtkWidget *menu_item; - int i; - int redo_image_menu = FALSE; + gboolean redo_image_menu = FALSE; GString *tearoff_path; + gchar *path; if (initialize) menus_init (); tearoff_path = g_string_new (""); - for (i = 0; i < n_menu_entries; i++) - if (! strncmp (entries[i].path, "", 7)) - { - char *p; + if (! strncmp (entry->entry.path, "", 7)) + { + gchar *p; - p = strchr (entries[i].path + 8, '/'); - while (p) - { - g_string_assign (tearoff_path, entries[i].path + 7); - g_string_truncate (tearoff_path, p - entries[i].path + 1 - 7); - g_string_append (tearoff_path, "tearoff1"); + p = strchr (entry->entry.path + 8, '/'); + while (p) + { + g_string_assign (tearoff_path, entry->entry.path + 7); + g_string_truncate (tearoff_path, + p - entry->entry.path + 1 - 7); + g_string_append (tearoff_path, "tearoff1"); - if (! gtk_item_factory_get_widget (image_factory, tearoff_path->str)) - { - GtkItemFactoryEntry entry = { NULL, NULL, NULL, 0, "" }; - entry.path = tearoff_path->str; - entry.callback = tearoff_cmd_callback; - gtk_item_factory_create_items_ac (image_factory, 1, &entry, NULL,2); - } + if (! gtk_item_factory_get_widget (image_factory, + tearoff_path->str)) + { + GimpItemFactoryEntry tearoff_entry = + { { NULL, NULL, NULL, 0, "" }, + 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); - 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) { @@ -719,8 +741,8 @@ menus_tools_create (ToolInfo *tool_info) } void -menus_set_sensitive (gchar *path, - gint sensitive) +menus_set_sensitive (gchar *path, + gboolean sensitive) { GtkItemFactory *ifactory; GtkWidget *widget = NULL; @@ -737,16 +759,17 @@ menus_set_sensitive (gchar *path, gtk_widget_set_sensitive (widget, sensitive); } 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 we don't need to have our menuentries twice in our catalog */ void -menus_set_sensitive_glue (gchar *prepath, - gchar *path, - gint sensitive) +menus_set_sensitive_glue (gchar *prepath, + gchar *path, + gboolean sensitive) { gchar *menupath; @@ -756,8 +779,8 @@ menus_set_sensitive_glue (gchar *prepath, } void -menus_set_state (gchar *path, - gint state) +menus_set_state (gchar *path, + gboolean state) { GtkItemFactory *ifactory; GtkWidget *widget = NULL; @@ -777,13 +800,14 @@ menus_set_state (gchar *path, widget = NULL; } 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 -menus_set_state_glue (gchar *prepath, - gchar *path, - gint state) +menus_set_state_glue (gchar *prepath, + gchar *path, + gboolean state) { gchar *menupath; @@ -793,7 +817,7 @@ menus_set_state_glue (gchar *prepath, } void -menus_destroy (char *path) +menus_destroy (gchar *path) { if (initialize) menus_init (); @@ -920,12 +944,12 @@ menus_last_opened_add (gchar *filename) void menus_init_mru (void) { - gchar *paths, *accelerators; - gint i; - GtkItemFactoryEntry *last_opened_entries; - GtkWidget *widget; + gchar *paths, *accelerators; + gint i; + GimpItemFactoryEntry *last_opened_entries; + 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); 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++) { gchar *path, *accelerator; - + path = &paths[i * MRU_MENU_ENTRY_SIZE]; if (i < 9) accelerator = &accelerators[i * MRU_MENU_ACCEL_SIZE]; else accelerator = NULL; - last_opened_entries[i].path = path; - last_opened_entries[i].accelerator = accelerator; - last_opened_entries[i].callback = (GtkItemFactoryCallback) menus_last_opened_cmd_callback; - last_opened_entries[i].callback_action = i; - last_opened_entries[i].item_type = NULL; + last_opened_entries[i].entry.path = path; + last_opened_entries[i].entry.accelerator = accelerator; + last_opened_entries[i].entry.callback = + (GtkItemFactoryCallback) menus_last_opened_cmd_callback; + 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); if (accelerator != NULL) g_snprintf (accelerator, MRU_MENU_ACCEL_SIZE, "%d", i + 1); } - gtk_item_factory_create_items_ac (toolbox_factory, last_opened_size, - last_opened_entries, NULL, 2); + menus_create_items (toolbox_factory, last_opened_size, + last_opened_entries, NULL, 2); for (i=0; i < last_opened_size; i++) { widget = gtk_item_factory_get_widget (toolbox_factory, - last_opened_entries[i].path); - gtk_object_set_data (GTK_OBJECT (widget), "help_page", - (gpointer) "file/last_opened.html"); + last_opened_entries[i].entry.path); gtk_widget_hide (widget); } widget = gtk_item_factory_get_widget (toolbox_factory, file_menu_separator.entry.path); gtk_widget_hide (widget); - + g_free (paths); g_free (accelerators); g_free (last_opened_entries); @@ -1106,7 +1131,7 @@ menus_init_toolbox (void) static void menus_init (void) { - int i; + gint i; if (initialize) { @@ -1128,22 +1153,26 @@ menus_init (void) NULL, 2); load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); + gtk_object_set_data (GTK_OBJECT (load_factory), "help_path", + (gpointer) "open"); gtk_item_factory_set_translate_func (load_factory, menu_translate, NULL, NULL); - gtk_item_factory_create_items_ac (load_factory, - n_load_entries, - load_entries, - NULL, 2); + menus_create_items (load_factory, + n_load_entries, + load_entries, + NULL, 2); save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); + gtk_object_set_data (GTK_OBJECT (save_factory), "help_path", + (gpointer) "save"); gtk_item_factory_set_translate_func (save_factory, menu_translate, NULL, NULL); - gtk_item_factory_create_items_ac (save_factory, - n_save_entries, - save_entries, - NULL, 2); + menus_create_items (save_factory, + n_save_entries, + save_entries, + NULL, 2); layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); gtk_object_set_data (GTK_OBJECT (layers_factory), "help_path", @@ -1246,25 +1275,30 @@ tearoff_cmd_callback (GtkWidget *widget, } else { - dialog_register(top); + dialog_register (top); gtk_signal_connect_object (GTK_OBJECT (top), "delete_event", GTK_SIGNAL_FUNC (tearoff_delete_cb), 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 { - GtkWidget *top = (GtkWidget *)gtk_object_get_data (GTK_OBJECT (widget),"tearoff_menu_top"); - if(!top) + GtkWidget *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")); } else { - dialog_unregister(top); + dialog_unregister (top); } } } diff --git a/app/gui/menus.h b/app/gui/menus.h index 0396757c3a..d9012f5690 100644 --- a/app/gui/menus.h +++ b/app/gui/menus.h @@ -20,38 +20,50 @@ #include "gtk/gtk.h" -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); +typedef struct _GimpItemFactoryEntry GimpItemFactoryEntry; -void menus_create (GtkMenuEntry *entries, - gint n_menu_entries); -void menus_destroy (gchar *path); +struct _GimpItemFactoryEntry +{ + 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_set_sensitive (gchar *path, - gint sensitive); -void menus_set_sensitive_glue (gchar *prepath, - gchar *path, - gint sensitive); -void menus_set_state (gchar *path, - gint state); -void menus_set_state_glue (gchar *prepath, - gchar *path, - gint state); +void menus_set_sensitive (gchar *path, + gboolean sensitive); +void menus_set_sensitive_glue (gchar *prepath, + gchar *path, + gboolean sensitive); -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__ */ diff --git a/app/gui/plug-in-commands.c b/app/gui/plug-in-commands.c index 1952ba5cfe..3cf3addd02 100644 --- a/app/gui/plug-in-commands.c +++ b/app/gui/plug-in-commands.c @@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) PlugInProcDef *proc_def; ProcRecord *proc = NULL; GSList *tmp = NULL; - GtkMenuEntry entry; + GimpItemFactoryEntry entry; char *prog = NULL; int add_proc_def; 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 (proc_install->menu_path) { - entry.path = proc_install->menu_path; - entry.accelerator = NULL; - entry.callback = plug_in_callback; - entry.callback_data = proc; + gchar *help_page; - 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; } @@ -2254,7 +2265,7 @@ plug_in_add_to_db (void) static void plug_in_make_menu (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *proc_def; GSList *tmp; @@ -2268,12 +2279,23 @@ plug_in_make_menu (void) !proc_def->prefixes && !proc_def->magics)) { - entry.path = proc_def->menu_path; - entry.accelerator = proc_def->accelerator; - entry.callback = plug_in_callback; - entry.callback_data = &proc_def->db_info; + gchar *help_page; - 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 */ 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)); argc = 3; } @@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget, { 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)); argc = 3; } diff --git a/app/gui/plug-in-menus.c b/app/gui/plug-in-menus.c index 1952ba5cfe..3cf3addd02 100644 --- a/app/gui/plug-in-menus.c +++ b/app/gui/plug-in-menus.c @@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) PlugInProcDef *proc_def; ProcRecord *proc = NULL; GSList *tmp = NULL; - GtkMenuEntry entry; + GimpItemFactoryEntry entry; char *prog = NULL; int add_proc_def; 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 (proc_install->menu_path) { - entry.path = proc_install->menu_path; - entry.accelerator = NULL; - entry.callback = plug_in_callback; - entry.callback_data = proc; + gchar *help_page; - 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; } @@ -2254,7 +2265,7 @@ plug_in_add_to_db (void) static void plug_in_make_menu (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *proc_def; GSList *tmp; @@ -2268,12 +2279,23 @@ plug_in_make_menu (void) !proc_def->prefixes && !proc_def->magics)) { - entry.path = proc_def->menu_path; - entry.accelerator = proc_def->accelerator; - entry.callback = plug_in_callback; - entry.callback_data = &proc_def->db_info; + gchar *help_page; - 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 */ 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)); argc = 3; } @@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget, { 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)); argc = 3; } diff --git a/app/menus.c b/app/menus.c index 98c1e5694c..a4d1c578a6 100644 --- a/app/menus.c +++ b/app/menus.c @@ -44,15 +44,21 @@ #define MRU_MENU_ENTRY_SIZE (strlen (_("/File/MRU00 ")) + 1) #define MRU_MENU_ACCEL_SIZE sizeof ("0") -typedef struct _GimpItemFactoryEntry GimpItemFactoryEntry; - -struct _GimpItemFactoryEntry -{ - GtkItemFactoryEntry entry; - - gchar *help_page; - gchar *description; -}; +static void menus_create_item (GtkItemFactory *item_factory, + GimpItemFactoryEntry *entry, + gpointer callback_data, + guint callback_type); +static void menus_create_items (GtkItemFactory *item_factory, + guint n_entries, + GimpItemFactoryEntry *entries, + 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 "), N_("/File"), @@ -64,17 +70,6 @@ static char* G_GNUC_UNUSED dummyMenus[] = { N_("/File/MRU00 "), N_("/View/Zoom"), 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 GimpItemFactoryEntry toolbox_entries[] = @@ -84,7 +79,7 @@ static GimpItemFactoryEntry toolbox_entries[] = { { N_("/File/New"), "N", file_new_cmd_callback, 0 }, "file/dialogs/file_new.html", NULL }, { { N_("/File/Open"), "O", file_open_cmd_callback, 0 }, - "file/dialogs/file_open.html", NULL }, + "open/index.html", NULL }, { { N_("/File/Acquire/tearoff1"), NULL, NULL, 0, "" }, NULL, NULL }, { { N_("/File/About..."), NULL, about_dialog_cmd_callback, 0 }, @@ -149,11 +144,11 @@ static GimpItemFactoryEntry image_entries[] = { { N_("/File/New"), "N", file_new_cmd_callback, 1 }, "file/dialogs/file_new.html", NULL }, { { N_("/File/Open"), "O", file_open_cmd_callback, 0 }, - "file/dialogs/file_open.html", NULL }, + "open/index.html", NULL }, { { N_("/File/Save"), "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 }, - "file/dialogs/save_as.html", NULL }, + "save/index.html", NULL }, { { N_("/File/Revert"), NULL, file_revert_cmd_callback, 0 }, "file/revert.html", NULL }, { { 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) / sizeof (image_entries[0])); static GtkItemFactory *image_factory = NULL; - -static GtkItemFactoryEntry load_entries[] = + +static GimpItemFactoryEntry load_entries[] = { - { N_("/Automatic"), NULL, file_load_by_extension_callback, 0 }, - { "/---", NULL, NULL, 0, "" }, + { { N_("/Automatic"), NULL, file_load_by_extension_callback, 0 }, + NULL, NULL }, + { { "/---", NULL, NULL, 0, "" }, + 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 GtkItemFactoryEntry save_entries[] = +static GimpItemFactoryEntry save_entries[] = { - { N_("/By extension"), NULL, file_save_by_extension_callback, 0 }, - { "/---", NULL, NULL, 0, "" }, + { { N_("/By extension"), NULL, file_save_by_extension_callback, 0 }, + NULL, NULL }, + { { "/---", NULL, NULL, 0, "" }, + 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 GimpItemFactoryEntry layers_entries[] = @@ -540,7 +541,7 @@ static guint n_paths_entries = (sizeof (paths_entries) / sizeof (paths_entries[0])); static GtkItemFactory *paths_factory = NULL; -static int initialize = TRUE; +static gboolean initialize = TRUE; void menus_get_toolbox_menubar (GtkWidget **menubar, @@ -634,48 +635,69 @@ menus_get_paths_menu (GtkWidget **menu, } void -menus_create (GtkMenuEntry *entries, - int n_menu_entries) +menus_create_item_from_full_path (GimpItemFactoryEntry *entry, + gpointer callback_data) { + GtkItemFactory *ifactory; GtkWidget *menu_item; - int i; - int redo_image_menu = FALSE; + gboolean redo_image_menu = FALSE; GString *tearoff_path; + gchar *path; if (initialize) menus_init (); tearoff_path = g_string_new (""); - for (i = 0; i < n_menu_entries; i++) - if (! strncmp (entries[i].path, "", 7)) - { - char *p; + if (! strncmp (entry->entry.path, "", 7)) + { + gchar *p; - p = strchr (entries[i].path + 8, '/'); - while (p) - { - g_string_assign (tearoff_path, entries[i].path + 7); - g_string_truncate (tearoff_path, p - entries[i].path + 1 - 7); - g_string_append (tearoff_path, "tearoff1"); + p = strchr (entry->entry.path + 8, '/'); + while (p) + { + g_string_assign (tearoff_path, entry->entry.path + 7); + g_string_truncate (tearoff_path, + p - entry->entry.path + 1 - 7); + g_string_append (tearoff_path, "tearoff1"); - if (! gtk_item_factory_get_widget (image_factory, tearoff_path->str)) - { - GtkItemFactoryEntry entry = { NULL, NULL, NULL, 0, "" }; - entry.path = tearoff_path->str; - entry.callback = tearoff_cmd_callback; - gtk_item_factory_create_items_ac (image_factory, 1, &entry, NULL,2); - } + if (! gtk_item_factory_get_widget (image_factory, + tearoff_path->str)) + { + GimpItemFactoryEntry tearoff_entry = + { { NULL, NULL, NULL, 0, "" }, + 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); - 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) { @@ -719,8 +741,8 @@ menus_tools_create (ToolInfo *tool_info) } void -menus_set_sensitive (gchar *path, - gint sensitive) +menus_set_sensitive (gchar *path, + gboolean sensitive) { GtkItemFactory *ifactory; GtkWidget *widget = NULL; @@ -737,16 +759,17 @@ menus_set_sensitive (gchar *path, gtk_widget_set_sensitive (widget, sensitive); } 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 we don't need to have our menuentries twice in our catalog */ void -menus_set_sensitive_glue (gchar *prepath, - gchar *path, - gint sensitive) +menus_set_sensitive_glue (gchar *prepath, + gchar *path, + gboolean sensitive) { gchar *menupath; @@ -756,8 +779,8 @@ menus_set_sensitive_glue (gchar *prepath, } void -menus_set_state (gchar *path, - gint state) +menus_set_state (gchar *path, + gboolean state) { GtkItemFactory *ifactory; GtkWidget *widget = NULL; @@ -777,13 +800,14 @@ menus_set_state (gchar *path, widget = NULL; } 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 -menus_set_state_glue (gchar *prepath, - gchar *path, - gint state) +menus_set_state_glue (gchar *prepath, + gchar *path, + gboolean state) { gchar *menupath; @@ -793,7 +817,7 @@ menus_set_state_glue (gchar *prepath, } void -menus_destroy (char *path) +menus_destroy (gchar *path) { if (initialize) menus_init (); @@ -920,12 +944,12 @@ menus_last_opened_add (gchar *filename) void menus_init_mru (void) { - gchar *paths, *accelerators; - gint i; - GtkItemFactoryEntry *last_opened_entries; - GtkWidget *widget; + gchar *paths, *accelerators; + gint i; + GimpItemFactoryEntry *last_opened_entries; + 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); 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++) { gchar *path, *accelerator; - + path = &paths[i * MRU_MENU_ENTRY_SIZE]; if (i < 9) accelerator = &accelerators[i * MRU_MENU_ACCEL_SIZE]; else accelerator = NULL; - last_opened_entries[i].path = path; - last_opened_entries[i].accelerator = accelerator; - last_opened_entries[i].callback = (GtkItemFactoryCallback) menus_last_opened_cmd_callback; - last_opened_entries[i].callback_action = i; - last_opened_entries[i].item_type = NULL; + last_opened_entries[i].entry.path = path; + last_opened_entries[i].entry.accelerator = accelerator; + last_opened_entries[i].entry.callback = + (GtkItemFactoryCallback) menus_last_opened_cmd_callback; + 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); if (accelerator != NULL) g_snprintf (accelerator, MRU_MENU_ACCEL_SIZE, "%d", i + 1); } - gtk_item_factory_create_items_ac (toolbox_factory, last_opened_size, - last_opened_entries, NULL, 2); + menus_create_items (toolbox_factory, last_opened_size, + last_opened_entries, NULL, 2); for (i=0; i < last_opened_size; i++) { widget = gtk_item_factory_get_widget (toolbox_factory, - last_opened_entries[i].path); - gtk_object_set_data (GTK_OBJECT (widget), "help_page", - (gpointer) "file/last_opened.html"); + last_opened_entries[i].entry.path); gtk_widget_hide (widget); } widget = gtk_item_factory_get_widget (toolbox_factory, file_menu_separator.entry.path); gtk_widget_hide (widget); - + g_free (paths); g_free (accelerators); g_free (last_opened_entries); @@ -1106,7 +1131,7 @@ menus_init_toolbox (void) static void menus_init (void) { - int i; + gint i; if (initialize) { @@ -1128,22 +1153,26 @@ menus_init (void) NULL, 2); load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); + gtk_object_set_data (GTK_OBJECT (load_factory), "help_path", + (gpointer) "open"); gtk_item_factory_set_translate_func (load_factory, menu_translate, NULL, NULL); - gtk_item_factory_create_items_ac (load_factory, - n_load_entries, - load_entries, - NULL, 2); + menus_create_items (load_factory, + n_load_entries, + load_entries, + NULL, 2); save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); + gtk_object_set_data (GTK_OBJECT (save_factory), "help_path", + (gpointer) "save"); gtk_item_factory_set_translate_func (save_factory, menu_translate, NULL, NULL); - gtk_item_factory_create_items_ac (save_factory, - n_save_entries, - save_entries, - NULL, 2); + menus_create_items (save_factory, + n_save_entries, + save_entries, + NULL, 2); layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); gtk_object_set_data (GTK_OBJECT (layers_factory), "help_path", @@ -1246,25 +1275,30 @@ tearoff_cmd_callback (GtkWidget *widget, } else { - dialog_register(top); + dialog_register (top); gtk_signal_connect_object (GTK_OBJECT (top), "delete_event", GTK_SIGNAL_FUNC (tearoff_delete_cb), 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 { - GtkWidget *top = (GtkWidget *)gtk_object_get_data (GTK_OBJECT (widget),"tearoff_menu_top"); - if(!top) + GtkWidget *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")); } else { - dialog_unregister(top); + dialog_unregister (top); } } } diff --git a/app/menus.h b/app/menus.h index 0396757c3a..d9012f5690 100644 --- a/app/menus.h +++ b/app/menus.h @@ -20,38 +20,50 @@ #include "gtk/gtk.h" -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); +typedef struct _GimpItemFactoryEntry GimpItemFactoryEntry; -void menus_create (GtkMenuEntry *entries, - gint n_menu_entries); -void menus_destroy (gchar *path); +struct _GimpItemFactoryEntry +{ + 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_set_sensitive (gchar *path, - gint sensitive); -void menus_set_sensitive_glue (gchar *prepath, - gchar *path, - gint sensitive); -void menus_set_state (gchar *path, - gint state); -void menus_set_state_glue (gchar *prepath, - gchar *path, - gint state); +void menus_set_sensitive (gchar *path, + gboolean sensitive); +void menus_set_sensitive_glue (gchar *prepath, + gchar *path, + gboolean sensitive); -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__ */ diff --git a/app/menus/menus.c b/app/menus/menus.c index 98c1e5694c..a4d1c578a6 100644 --- a/app/menus/menus.c +++ b/app/menus/menus.c @@ -44,15 +44,21 @@ #define MRU_MENU_ENTRY_SIZE (strlen (_("/File/MRU00 ")) + 1) #define MRU_MENU_ACCEL_SIZE sizeof ("0") -typedef struct _GimpItemFactoryEntry GimpItemFactoryEntry; - -struct _GimpItemFactoryEntry -{ - GtkItemFactoryEntry entry; - - gchar *help_page; - gchar *description; -}; +static void menus_create_item (GtkItemFactory *item_factory, + GimpItemFactoryEntry *entry, + gpointer callback_data, + guint callback_type); +static void menus_create_items (GtkItemFactory *item_factory, + guint n_entries, + GimpItemFactoryEntry *entries, + 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 "), N_("/File"), @@ -64,17 +70,6 @@ static char* G_GNUC_UNUSED dummyMenus[] = { N_("/File/MRU00 "), N_("/View/Zoom"), 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 GimpItemFactoryEntry toolbox_entries[] = @@ -84,7 +79,7 @@ static GimpItemFactoryEntry toolbox_entries[] = { { N_("/File/New"), "N", file_new_cmd_callback, 0 }, "file/dialogs/file_new.html", NULL }, { { N_("/File/Open"), "O", file_open_cmd_callback, 0 }, - "file/dialogs/file_open.html", NULL }, + "open/index.html", NULL }, { { N_("/File/Acquire/tearoff1"), NULL, NULL, 0, "" }, NULL, NULL }, { { N_("/File/About..."), NULL, about_dialog_cmd_callback, 0 }, @@ -149,11 +144,11 @@ static GimpItemFactoryEntry image_entries[] = { { N_("/File/New"), "N", file_new_cmd_callback, 1 }, "file/dialogs/file_new.html", NULL }, { { N_("/File/Open"), "O", file_open_cmd_callback, 0 }, - "file/dialogs/file_open.html", NULL }, + "open/index.html", NULL }, { { N_("/File/Save"), "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 }, - "file/dialogs/save_as.html", NULL }, + "save/index.html", NULL }, { { N_("/File/Revert"), NULL, file_revert_cmd_callback, 0 }, "file/revert.html", NULL }, { { 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) / sizeof (image_entries[0])); static GtkItemFactory *image_factory = NULL; - -static GtkItemFactoryEntry load_entries[] = + +static GimpItemFactoryEntry load_entries[] = { - { N_("/Automatic"), NULL, file_load_by_extension_callback, 0 }, - { "/---", NULL, NULL, 0, "" }, + { { N_("/Automatic"), NULL, file_load_by_extension_callback, 0 }, + NULL, NULL }, + { { "/---", NULL, NULL, 0, "" }, + 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 GtkItemFactoryEntry save_entries[] = +static GimpItemFactoryEntry save_entries[] = { - { N_("/By extension"), NULL, file_save_by_extension_callback, 0 }, - { "/---", NULL, NULL, 0, "" }, + { { N_("/By extension"), NULL, file_save_by_extension_callback, 0 }, + NULL, NULL }, + { { "/---", NULL, NULL, 0, "" }, + 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 GimpItemFactoryEntry layers_entries[] = @@ -540,7 +541,7 @@ static guint n_paths_entries = (sizeof (paths_entries) / sizeof (paths_entries[0])); static GtkItemFactory *paths_factory = NULL; -static int initialize = TRUE; +static gboolean initialize = TRUE; void menus_get_toolbox_menubar (GtkWidget **menubar, @@ -634,48 +635,69 @@ menus_get_paths_menu (GtkWidget **menu, } void -menus_create (GtkMenuEntry *entries, - int n_menu_entries) +menus_create_item_from_full_path (GimpItemFactoryEntry *entry, + gpointer callback_data) { + GtkItemFactory *ifactory; GtkWidget *menu_item; - int i; - int redo_image_menu = FALSE; + gboolean redo_image_menu = FALSE; GString *tearoff_path; + gchar *path; if (initialize) menus_init (); tearoff_path = g_string_new (""); - for (i = 0; i < n_menu_entries; i++) - if (! strncmp (entries[i].path, "", 7)) - { - char *p; + if (! strncmp (entry->entry.path, "", 7)) + { + gchar *p; - p = strchr (entries[i].path + 8, '/'); - while (p) - { - g_string_assign (tearoff_path, entries[i].path + 7); - g_string_truncate (tearoff_path, p - entries[i].path + 1 - 7); - g_string_append (tearoff_path, "tearoff1"); + p = strchr (entry->entry.path + 8, '/'); + while (p) + { + g_string_assign (tearoff_path, entry->entry.path + 7); + g_string_truncate (tearoff_path, + p - entry->entry.path + 1 - 7); + g_string_append (tearoff_path, "tearoff1"); - if (! gtk_item_factory_get_widget (image_factory, tearoff_path->str)) - { - GtkItemFactoryEntry entry = { NULL, NULL, NULL, 0, "" }; - entry.path = tearoff_path->str; - entry.callback = tearoff_cmd_callback; - gtk_item_factory_create_items_ac (image_factory, 1, &entry, NULL,2); - } + if (! gtk_item_factory_get_widget (image_factory, + tearoff_path->str)) + { + GimpItemFactoryEntry tearoff_entry = + { { NULL, NULL, NULL, 0, "" }, + 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); - 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) { @@ -719,8 +741,8 @@ menus_tools_create (ToolInfo *tool_info) } void -menus_set_sensitive (gchar *path, - gint sensitive) +menus_set_sensitive (gchar *path, + gboolean sensitive) { GtkItemFactory *ifactory; GtkWidget *widget = NULL; @@ -737,16 +759,17 @@ menus_set_sensitive (gchar *path, gtk_widget_set_sensitive (widget, sensitive); } 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 we don't need to have our menuentries twice in our catalog */ void -menus_set_sensitive_glue (gchar *prepath, - gchar *path, - gint sensitive) +menus_set_sensitive_glue (gchar *prepath, + gchar *path, + gboolean sensitive) { gchar *menupath; @@ -756,8 +779,8 @@ menus_set_sensitive_glue (gchar *prepath, } void -menus_set_state (gchar *path, - gint state) +menus_set_state (gchar *path, + gboolean state) { GtkItemFactory *ifactory; GtkWidget *widget = NULL; @@ -777,13 +800,14 @@ menus_set_state (gchar *path, widget = NULL; } 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 -menus_set_state_glue (gchar *prepath, - gchar *path, - gint state) +menus_set_state_glue (gchar *prepath, + gchar *path, + gboolean state) { gchar *menupath; @@ -793,7 +817,7 @@ menus_set_state_glue (gchar *prepath, } void -menus_destroy (char *path) +menus_destroy (gchar *path) { if (initialize) menus_init (); @@ -920,12 +944,12 @@ menus_last_opened_add (gchar *filename) void menus_init_mru (void) { - gchar *paths, *accelerators; - gint i; - GtkItemFactoryEntry *last_opened_entries; - GtkWidget *widget; + gchar *paths, *accelerators; + gint i; + GimpItemFactoryEntry *last_opened_entries; + 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); 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++) { gchar *path, *accelerator; - + path = &paths[i * MRU_MENU_ENTRY_SIZE]; if (i < 9) accelerator = &accelerators[i * MRU_MENU_ACCEL_SIZE]; else accelerator = NULL; - last_opened_entries[i].path = path; - last_opened_entries[i].accelerator = accelerator; - last_opened_entries[i].callback = (GtkItemFactoryCallback) menus_last_opened_cmd_callback; - last_opened_entries[i].callback_action = i; - last_opened_entries[i].item_type = NULL; + last_opened_entries[i].entry.path = path; + last_opened_entries[i].entry.accelerator = accelerator; + last_opened_entries[i].entry.callback = + (GtkItemFactoryCallback) menus_last_opened_cmd_callback; + 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); if (accelerator != NULL) g_snprintf (accelerator, MRU_MENU_ACCEL_SIZE, "%d", i + 1); } - gtk_item_factory_create_items_ac (toolbox_factory, last_opened_size, - last_opened_entries, NULL, 2); + menus_create_items (toolbox_factory, last_opened_size, + last_opened_entries, NULL, 2); for (i=0; i < last_opened_size; i++) { widget = gtk_item_factory_get_widget (toolbox_factory, - last_opened_entries[i].path); - gtk_object_set_data (GTK_OBJECT (widget), "help_page", - (gpointer) "file/last_opened.html"); + last_opened_entries[i].entry.path); gtk_widget_hide (widget); } widget = gtk_item_factory_get_widget (toolbox_factory, file_menu_separator.entry.path); gtk_widget_hide (widget); - + g_free (paths); g_free (accelerators); g_free (last_opened_entries); @@ -1106,7 +1131,7 @@ menus_init_toolbox (void) static void menus_init (void) { - int i; + gint i; if (initialize) { @@ -1128,22 +1153,26 @@ menus_init (void) NULL, 2); load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); + gtk_object_set_data (GTK_OBJECT (load_factory), "help_path", + (gpointer) "open"); gtk_item_factory_set_translate_func (load_factory, menu_translate, NULL, NULL); - gtk_item_factory_create_items_ac (load_factory, - n_load_entries, - load_entries, - NULL, 2); + menus_create_items (load_factory, + n_load_entries, + load_entries, + NULL, 2); save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); + gtk_object_set_data (GTK_OBJECT (save_factory), "help_path", + (gpointer) "save"); gtk_item_factory_set_translate_func (save_factory, menu_translate, NULL, NULL); - gtk_item_factory_create_items_ac (save_factory, - n_save_entries, - save_entries, - NULL, 2); + menus_create_items (save_factory, + n_save_entries, + save_entries, + NULL, 2); layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); gtk_object_set_data (GTK_OBJECT (layers_factory), "help_path", @@ -1246,25 +1275,30 @@ tearoff_cmd_callback (GtkWidget *widget, } else { - dialog_register(top); + dialog_register (top); gtk_signal_connect_object (GTK_OBJECT (top), "delete_event", GTK_SIGNAL_FUNC (tearoff_delete_cb), 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 { - GtkWidget *top = (GtkWidget *)gtk_object_get_data (GTK_OBJECT (widget),"tearoff_menu_top"); - if(!top) + GtkWidget *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")); } else { - dialog_unregister(top); + dialog_unregister (top); } } } diff --git a/app/menus/menus.h b/app/menus/menus.h index 0396757c3a..d9012f5690 100644 --- a/app/menus/menus.h +++ b/app/menus/menus.h @@ -20,38 +20,50 @@ #include "gtk/gtk.h" -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); +typedef struct _GimpItemFactoryEntry GimpItemFactoryEntry; -void menus_create (GtkMenuEntry *entries, - gint n_menu_entries); -void menus_destroy (gchar *path); +struct _GimpItemFactoryEntry +{ + 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_set_sensitive (gchar *path, - gint sensitive); -void menus_set_sensitive_glue (gchar *prepath, - gchar *path, - gint sensitive); -void menus_set_state (gchar *path, - gint state); -void menus_set_state_glue (gchar *prepath, - gchar *path, - gint state); +void menus_set_sensitive (gchar *path, + gboolean sensitive); +void menus_set_sensitive_glue (gchar *prepath, + gchar *path, + gboolean sensitive); -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__ */ diff --git a/app/menus/plug-in-menus.c b/app/menus/plug-in-menus.c index 1952ba5cfe..3cf3addd02 100644 --- a/app/menus/plug-in-menus.c +++ b/app/menus/plug-in-menus.c @@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) PlugInProcDef *proc_def; ProcRecord *proc = NULL; GSList *tmp = NULL; - GtkMenuEntry entry; + GimpItemFactoryEntry entry; char *prog = NULL; int add_proc_def; 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 (proc_install->menu_path) { - entry.path = proc_install->menu_path; - entry.accelerator = NULL; - entry.callback = plug_in_callback; - entry.callback_data = proc; + gchar *help_page; - 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; } @@ -2254,7 +2265,7 @@ plug_in_add_to_db (void) static void plug_in_make_menu (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *proc_def; GSList *tmp; @@ -2268,12 +2279,23 @@ plug_in_make_menu (void) !proc_def->prefixes && !proc_def->magics)) { - entry.path = proc_def->menu_path; - entry.accelerator = proc_def->accelerator; - entry.callback = plug_in_callback; - entry.callback_data = &proc_def->db_info; + gchar *help_page; - 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 */ 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)); argc = 3; } @@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget, { 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)); argc = 3; } diff --git a/app/plug-in/gimpplugin-message.c b/app/plug-in/gimpplugin-message.c index 1952ba5cfe..3cf3addd02 100644 --- a/app/plug-in/gimpplugin-message.c +++ b/app/plug-in/gimpplugin-message.c @@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) PlugInProcDef *proc_def; ProcRecord *proc = NULL; GSList *tmp = NULL; - GtkMenuEntry entry; + GimpItemFactoryEntry entry; char *prog = NULL; int add_proc_def; 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 (proc_install->menu_path) { - entry.path = proc_install->menu_path; - entry.accelerator = NULL; - entry.callback = plug_in_callback; - entry.callback_data = proc; + gchar *help_page; - 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; } @@ -2254,7 +2265,7 @@ plug_in_add_to_db (void) static void plug_in_make_menu (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *proc_def; GSList *tmp; @@ -2268,12 +2279,23 @@ plug_in_make_menu (void) !proc_def->prefixes && !proc_def->magics)) { - entry.path = proc_def->menu_path; - entry.accelerator = proc_def->accelerator; - entry.callback = plug_in_callback; - entry.callback_data = &proc_def->db_info; + gchar *help_page; - 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 */ 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)); argc = 3; } @@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget, { 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)); argc = 3; } diff --git a/app/plug-in/gimpplugin-progress.c b/app/plug-in/gimpplugin-progress.c index 1952ba5cfe..3cf3addd02 100644 --- a/app/plug-in/gimpplugin-progress.c +++ b/app/plug-in/gimpplugin-progress.c @@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) PlugInProcDef *proc_def; ProcRecord *proc = NULL; GSList *tmp = NULL; - GtkMenuEntry entry; + GimpItemFactoryEntry entry; char *prog = NULL; int add_proc_def; 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 (proc_install->menu_path) { - entry.path = proc_install->menu_path; - entry.accelerator = NULL; - entry.callback = plug_in_callback; - entry.callback_data = proc; + gchar *help_page; - 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; } @@ -2254,7 +2265,7 @@ plug_in_add_to_db (void) static void plug_in_make_menu (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *proc_def; GSList *tmp; @@ -2268,12 +2279,23 @@ plug_in_make_menu (void) !proc_def->prefixes && !proc_def->magics)) { - entry.path = proc_def->menu_path; - entry.accelerator = proc_def->accelerator; - entry.callback = plug_in_callback; - entry.callback_data = &proc_def->db_info; + gchar *help_page; - 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 */ 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)); argc = 3; } @@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget, { 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)); argc = 3; } diff --git a/app/plug-in/gimpplugin.c b/app/plug-in/gimpplugin.c index 1952ba5cfe..3cf3addd02 100644 --- a/app/plug-in/gimpplugin.c +++ b/app/plug-in/gimpplugin.c @@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) PlugInProcDef *proc_def; ProcRecord *proc = NULL; GSList *tmp = NULL; - GtkMenuEntry entry; + GimpItemFactoryEntry entry; char *prog = NULL; int add_proc_def; 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 (proc_install->menu_path) { - entry.path = proc_install->menu_path; - entry.accelerator = NULL; - entry.callback = plug_in_callback; - entry.callback_data = proc; + gchar *help_page; - 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; } @@ -2254,7 +2265,7 @@ plug_in_add_to_db (void) static void plug_in_make_menu (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *proc_def; GSList *tmp; @@ -2268,12 +2279,23 @@ plug_in_make_menu (void) !proc_def->prefixes && !proc_def->magics)) { - entry.path = proc_def->menu_path; - entry.accelerator = proc_def->accelerator; - entry.callback = plug_in_callback; - entry.callback_data = &proc_def->db_info; + gchar *help_page; - 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 */ 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)); argc = 3; } @@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget, { 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)); argc = 3; } diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c index 1952ba5cfe..3cf3addd02 100644 --- a/app/plug-in/gimppluginmanager-call.c +++ b/app/plug-in/gimppluginmanager-call.c @@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) PlugInProcDef *proc_def; ProcRecord *proc = NULL; GSList *tmp = NULL; - GtkMenuEntry entry; + GimpItemFactoryEntry entry; char *prog = NULL; int add_proc_def; 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 (proc_install->menu_path) { - entry.path = proc_install->menu_path; - entry.accelerator = NULL; - entry.callback = plug_in_callback; - entry.callback_data = proc; + gchar *help_page; - 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; } @@ -2254,7 +2265,7 @@ plug_in_add_to_db (void) static void plug_in_make_menu (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *proc_def; GSList *tmp; @@ -2268,12 +2279,23 @@ plug_in_make_menu (void) !proc_def->prefixes && !proc_def->magics)) { - entry.path = proc_def->menu_path; - entry.accelerator = proc_def->accelerator; - entry.callback = plug_in_callback; - entry.callback_data = &proc_def->db_info; + gchar *help_page; - 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 */ 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)); argc = 3; } @@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget, { 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)); argc = 3; } diff --git a/app/plug-in/gimppluginmanager-run.c b/app/plug-in/gimppluginmanager-run.c index 1952ba5cfe..3cf3addd02 100644 --- a/app/plug-in/gimppluginmanager-run.c +++ b/app/plug-in/gimppluginmanager-run.c @@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) PlugInProcDef *proc_def; ProcRecord *proc = NULL; GSList *tmp = NULL; - GtkMenuEntry entry; + GimpItemFactoryEntry entry; char *prog = NULL; int add_proc_def; 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 (proc_install->menu_path) { - entry.path = proc_install->menu_path; - entry.accelerator = NULL; - entry.callback = plug_in_callback; - entry.callback_data = proc; + gchar *help_page; - 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; } @@ -2254,7 +2265,7 @@ plug_in_add_to_db (void) static void plug_in_make_menu (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *proc_def; GSList *tmp; @@ -2268,12 +2279,23 @@ plug_in_make_menu (void) !proc_def->prefixes && !proc_def->magics)) { - entry.path = proc_def->menu_path; - entry.accelerator = proc_def->accelerator; - entry.callback = plug_in_callback; - entry.callback_data = &proc_def->db_info; + gchar *help_page; - 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 */ 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)); argc = 3; } @@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget, { 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)); argc = 3; } diff --git a/app/plug-in/gimppluginmanager.c b/app/plug-in/gimppluginmanager.c index 1952ba5cfe..3cf3addd02 100644 --- a/app/plug-in/gimppluginmanager.c +++ b/app/plug-in/gimppluginmanager.c @@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) PlugInProcDef *proc_def; ProcRecord *proc = NULL; GSList *tmp = NULL; - GtkMenuEntry entry; + GimpItemFactoryEntry entry; char *prog = NULL; int add_proc_def; 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 (proc_install->menu_path) { - entry.path = proc_install->menu_path; - entry.accelerator = NULL; - entry.callback = plug_in_callback; - entry.callback_data = proc; + gchar *help_page; - 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; } @@ -2254,7 +2265,7 @@ plug_in_add_to_db (void) static void plug_in_make_menu (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *proc_def; GSList *tmp; @@ -2268,12 +2279,23 @@ plug_in_make_menu (void) !proc_def->prefixes && !proc_def->magics)) { - entry.path = proc_def->menu_path; - entry.accelerator = proc_def->accelerator; - entry.callback = plug_in_callback; - entry.callback_data = &proc_def->db_info; + gchar *help_page; - 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 */ 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)); argc = 3; } @@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget, { 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)); argc = 3; } diff --git a/app/plug-in/gimppluginshm.c b/app/plug-in/gimppluginshm.c index 1952ba5cfe..3cf3addd02 100644 --- a/app/plug-in/gimppluginshm.c +++ b/app/plug-in/gimppluginshm.c @@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) PlugInProcDef *proc_def; ProcRecord *proc = NULL; GSList *tmp = NULL; - GtkMenuEntry entry; + GimpItemFactoryEntry entry; char *prog = NULL; int add_proc_def; 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 (proc_install->menu_path) { - entry.path = proc_install->menu_path; - entry.accelerator = NULL; - entry.callback = plug_in_callback; - entry.callback_data = proc; + gchar *help_page; - 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; } @@ -2254,7 +2265,7 @@ plug_in_add_to_db (void) static void plug_in_make_menu (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *proc_def; GSList *tmp; @@ -2268,12 +2279,23 @@ plug_in_make_menu (void) !proc_def->prefixes && !proc_def->magics)) { - entry.path = proc_def->menu_path; - entry.accelerator = proc_def->accelerator; - entry.callback = plug_in_callback; - entry.callback_data = &proc_def->db_info; + gchar *help_page; - 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 */ 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)); argc = 3; } @@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget, { 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)); argc = 3; } diff --git a/app/plug-in/plug-in-def.c b/app/plug-in/plug-in-def.c index 1952ba5cfe..3cf3addd02 100644 --- a/app/plug-in/plug-in-def.c +++ b/app/plug-in/plug-in-def.c @@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) PlugInProcDef *proc_def; ProcRecord *proc = NULL; GSList *tmp = NULL; - GtkMenuEntry entry; + GimpItemFactoryEntry entry; char *prog = NULL; int add_proc_def; 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 (proc_install->menu_path) { - entry.path = proc_install->menu_path; - entry.accelerator = NULL; - entry.callback = plug_in_callback; - entry.callback_data = proc; + gchar *help_page; - 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; } @@ -2254,7 +2265,7 @@ plug_in_add_to_db (void) static void plug_in_make_menu (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *proc_def; GSList *tmp; @@ -2268,12 +2279,23 @@ plug_in_make_menu (void) !proc_def->prefixes && !proc_def->magics)) { - entry.path = proc_def->menu_path; - entry.accelerator = proc_def->accelerator; - entry.callback = plug_in_callback; - entry.callback_data = &proc_def->db_info; + gchar *help_page; - 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 */ 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)); argc = 3; } @@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget, { 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)); argc = 3; } diff --git a/app/plug-in/plug-in-message.c b/app/plug-in/plug-in-message.c index 1952ba5cfe..3cf3addd02 100644 --- a/app/plug-in/plug-in-message.c +++ b/app/plug-in/plug-in-message.c @@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) PlugInProcDef *proc_def; ProcRecord *proc = NULL; GSList *tmp = NULL; - GtkMenuEntry entry; + GimpItemFactoryEntry entry; char *prog = NULL; int add_proc_def; 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 (proc_install->menu_path) { - entry.path = proc_install->menu_path; - entry.accelerator = NULL; - entry.callback = plug_in_callback; - entry.callback_data = proc; + gchar *help_page; - 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; } @@ -2254,7 +2265,7 @@ plug_in_add_to_db (void) static void plug_in_make_menu (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *proc_def; GSList *tmp; @@ -2268,12 +2279,23 @@ plug_in_make_menu (void) !proc_def->prefixes && !proc_def->magics)) { - entry.path = proc_def->menu_path; - entry.accelerator = proc_def->accelerator; - entry.callback = plug_in_callback; - entry.callback_data = &proc_def->db_info; + gchar *help_page; - 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 */ 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)); argc = 3; } @@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget, { 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)); argc = 3; } diff --git a/app/plug-in/plug-in-params.c b/app/plug-in/plug-in-params.c index 1952ba5cfe..3cf3addd02 100644 --- a/app/plug-in/plug-in-params.c +++ b/app/plug-in/plug-in-params.c @@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) PlugInProcDef *proc_def; ProcRecord *proc = NULL; GSList *tmp = NULL; - GtkMenuEntry entry; + GimpItemFactoryEntry entry; char *prog = NULL; int add_proc_def; 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 (proc_install->menu_path) { - entry.path = proc_install->menu_path; - entry.accelerator = NULL; - entry.callback = plug_in_callback; - entry.callback_data = proc; + gchar *help_page; - 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; } @@ -2254,7 +2265,7 @@ plug_in_add_to_db (void) static void plug_in_make_menu (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *proc_def; GSList *tmp; @@ -2268,12 +2279,23 @@ plug_in_make_menu (void) !proc_def->prefixes && !proc_def->magics)) { - entry.path = proc_def->menu_path; - entry.accelerator = proc_def->accelerator; - entry.callback = plug_in_callback; - entry.callback_data = &proc_def->db_info; + gchar *help_page; - 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 */ 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)); argc = 3; } @@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget, { 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)); argc = 3; } diff --git a/app/plug-in/plug-in-progress.c b/app/plug-in/plug-in-progress.c index 1952ba5cfe..3cf3addd02 100644 --- a/app/plug-in/plug-in-progress.c +++ b/app/plug-in/plug-in-progress.c @@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) PlugInProcDef *proc_def; ProcRecord *proc = NULL; GSList *tmp = NULL; - GtkMenuEntry entry; + GimpItemFactoryEntry entry; char *prog = NULL; int add_proc_def; 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 (proc_install->menu_path) { - entry.path = proc_install->menu_path; - entry.accelerator = NULL; - entry.callback = plug_in_callback; - entry.callback_data = proc; + gchar *help_page; - 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; } @@ -2254,7 +2265,7 @@ plug_in_add_to_db (void) static void plug_in_make_menu (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *proc_def; GSList *tmp; @@ -2268,12 +2279,23 @@ plug_in_make_menu (void) !proc_def->prefixes && !proc_def->magics)) { - entry.path = proc_def->menu_path; - entry.accelerator = proc_def->accelerator; - entry.callback = plug_in_callback; - entry.callback_data = &proc_def->db_info; + gchar *help_page; - 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 */ 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)); argc = 3; } @@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget, { 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)); argc = 3; } diff --git a/app/plug-in/plug-in-run.c b/app/plug-in/plug-in-run.c index 1952ba5cfe..3cf3addd02 100644 --- a/app/plug-in/plug-in-run.c +++ b/app/plug-in/plug-in-run.c @@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) PlugInProcDef *proc_def; ProcRecord *proc = NULL; GSList *tmp = NULL; - GtkMenuEntry entry; + GimpItemFactoryEntry entry; char *prog = NULL; int add_proc_def; 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 (proc_install->menu_path) { - entry.path = proc_install->menu_path; - entry.accelerator = NULL; - entry.callback = plug_in_callback; - entry.callback_data = proc; + gchar *help_page; - 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; } @@ -2254,7 +2265,7 @@ plug_in_add_to_db (void) static void plug_in_make_menu (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *proc_def; GSList *tmp; @@ -2268,12 +2279,23 @@ plug_in_make_menu (void) !proc_def->prefixes && !proc_def->magics)) { - entry.path = proc_def->menu_path; - entry.accelerator = proc_def->accelerator; - entry.callback = plug_in_callback; - entry.callback_data = &proc_def->db_info; + gchar *help_page; - 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 */ 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)); argc = 3; } @@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget, { 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)); argc = 3; } diff --git a/app/plug-in/plug-in-shm.c b/app/plug-in/plug-in-shm.c index 1952ba5cfe..3cf3addd02 100644 --- a/app/plug-in/plug-in-shm.c +++ b/app/plug-in/plug-in-shm.c @@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) PlugInProcDef *proc_def; ProcRecord *proc = NULL; GSList *tmp = NULL; - GtkMenuEntry entry; + GimpItemFactoryEntry entry; char *prog = NULL; int add_proc_def; 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 (proc_install->menu_path) { - entry.path = proc_install->menu_path; - entry.accelerator = NULL; - entry.callback = plug_in_callback; - entry.callback_data = proc; + gchar *help_page; - 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; } @@ -2254,7 +2265,7 @@ plug_in_add_to_db (void) static void plug_in_make_menu (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *proc_def; GSList *tmp; @@ -2268,12 +2279,23 @@ plug_in_make_menu (void) !proc_def->prefixes && !proc_def->magics)) { - entry.path = proc_def->menu_path; - entry.accelerator = proc_def->accelerator; - entry.callback = plug_in_callback; - entry.callback_data = &proc_def->db_info; + gchar *help_page; - 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 */ 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)); argc = 3; } @@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget, { 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)); argc = 3; } diff --git a/app/plug-in/plug-in.c b/app/plug-in/plug-in.c index 1952ba5cfe..3cf3addd02 100644 --- a/app/plug-in/plug-in.c +++ b/app/plug-in/plug-in.c @@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) PlugInProcDef *proc_def; ProcRecord *proc = NULL; GSList *tmp = NULL; - GtkMenuEntry entry; + GimpItemFactoryEntry entry; char *prog = NULL; int add_proc_def; 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 (proc_install->menu_path) { - entry.path = proc_install->menu_path; - entry.accelerator = NULL; - entry.callback = plug_in_callback; - entry.callback_data = proc; + gchar *help_page; - 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; } @@ -2254,7 +2265,7 @@ plug_in_add_to_db (void) static void plug_in_make_menu (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *proc_def; GSList *tmp; @@ -2268,12 +2279,23 @@ plug_in_make_menu (void) !proc_def->prefixes && !proc_def->magics)) { - entry.path = proc_def->menu_path; - entry.accelerator = proc_def->accelerator; - entry.callback = plug_in_callback; - entry.callback_data = &proc_def->db_info; + gchar *help_page; - 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 */ 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)); argc = 3; } @@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget, { 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)); argc = 3; } diff --git a/app/plug-in/plug-ins.c b/app/plug-in/plug-ins.c index 1952ba5cfe..3cf3addd02 100644 --- a/app/plug-in/plug-ins.c +++ b/app/plug-in/plug-ins.c @@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) PlugInProcDef *proc_def; ProcRecord *proc = NULL; GSList *tmp = NULL; - GtkMenuEntry entry; + GimpItemFactoryEntry entry; char *prog = NULL; int add_proc_def; 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 (proc_install->menu_path) { - entry.path = proc_install->menu_path; - entry.accelerator = NULL; - entry.callback = plug_in_callback; - entry.callback_data = proc; + gchar *help_page; - 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; } @@ -2254,7 +2265,7 @@ plug_in_add_to_db (void) static void plug_in_make_menu (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *proc_def; GSList *tmp; @@ -2268,12 +2279,23 @@ plug_in_make_menu (void) !proc_def->prefixes && !proc_def->magics)) { - entry.path = proc_def->menu_path; - entry.accelerator = proc_def->accelerator; - entry.callback = plug_in_callback; - entry.callback_data = &proc_def->db_info; + gchar *help_page; - 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 */ 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)); argc = 3; } @@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget, { 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)); argc = 3; } diff --git a/app/plug_in.c b/app/plug_in.c index 1952ba5cfe..3cf3addd02 100644 --- a/app/plug_in.c +++ b/app/plug_in.c @@ -1628,7 +1628,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install) PlugInProcDef *proc_def; ProcRecord *proc = NULL; GSList *tmp = NULL; - GtkMenuEntry entry; + GimpItemFactoryEntry entry; char *prog = NULL; int add_proc_def; 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 (proc_install->menu_path) { - entry.path = proc_install->menu_path; - entry.accelerator = NULL; - entry.callback = plug_in_callback; - entry.callback_data = proc; + gchar *help_page; - 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; } @@ -2254,7 +2265,7 @@ plug_in_add_to_db (void) static void plug_in_make_menu (void) { - GtkMenuEntry entry; + GimpItemFactoryEntry entry; PlugInProcDef *proc_def; GSList *tmp; @@ -2268,12 +2279,23 @@ plug_in_make_menu (void) !proc_def->prefixes && !proc_def->magics)) { - entry.path = proc_def->menu_path; - entry.accelerator = proc_def->accelerator; - entry.callback = plug_in_callback; - entry.callback_data = &proc_def->db_info; + gchar *help_page; - 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 */ 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)); argc = 3; } @@ -2340,7 +2362,7 @@ plug_in_callback (GtkWidget *widget, { 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)); argc = 3; } diff --git a/app/widgets/gimpitemfactory.c b/app/widgets/gimpitemfactory.c index 98c1e5694c..a4d1c578a6 100644 --- a/app/widgets/gimpitemfactory.c +++ b/app/widgets/gimpitemfactory.c @@ -44,15 +44,21 @@ #define MRU_MENU_ENTRY_SIZE (strlen (_("/File/MRU00 ")) + 1) #define MRU_MENU_ACCEL_SIZE sizeof ("0") -typedef struct _GimpItemFactoryEntry GimpItemFactoryEntry; - -struct _GimpItemFactoryEntry -{ - GtkItemFactoryEntry entry; - - gchar *help_page; - gchar *description; -}; +static void menus_create_item (GtkItemFactory *item_factory, + GimpItemFactoryEntry *entry, + gpointer callback_data, + guint callback_type); +static void menus_create_items (GtkItemFactory *item_factory, + guint n_entries, + GimpItemFactoryEntry *entries, + 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 "), N_("/File"), @@ -64,17 +70,6 @@ static char* G_GNUC_UNUSED dummyMenus[] = { N_("/File/MRU00 "), N_("/View/Zoom"), 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 GimpItemFactoryEntry toolbox_entries[] = @@ -84,7 +79,7 @@ static GimpItemFactoryEntry toolbox_entries[] = { { N_("/File/New"), "N", file_new_cmd_callback, 0 }, "file/dialogs/file_new.html", NULL }, { { N_("/File/Open"), "O", file_open_cmd_callback, 0 }, - "file/dialogs/file_open.html", NULL }, + "open/index.html", NULL }, { { N_("/File/Acquire/tearoff1"), NULL, NULL, 0, "" }, NULL, NULL }, { { N_("/File/About..."), NULL, about_dialog_cmd_callback, 0 }, @@ -149,11 +144,11 @@ static GimpItemFactoryEntry image_entries[] = { { N_("/File/New"), "N", file_new_cmd_callback, 1 }, "file/dialogs/file_new.html", NULL }, { { N_("/File/Open"), "O", file_open_cmd_callback, 0 }, - "file/dialogs/file_open.html", NULL }, + "open/index.html", NULL }, { { N_("/File/Save"), "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 }, - "file/dialogs/save_as.html", NULL }, + "save/index.html", NULL }, { { N_("/File/Revert"), NULL, file_revert_cmd_callback, 0 }, "file/revert.html", NULL }, { { 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) / sizeof (image_entries[0])); static GtkItemFactory *image_factory = NULL; - -static GtkItemFactoryEntry load_entries[] = + +static GimpItemFactoryEntry load_entries[] = { - { N_("/Automatic"), NULL, file_load_by_extension_callback, 0 }, - { "/---", NULL, NULL, 0, "" }, + { { N_("/Automatic"), NULL, file_load_by_extension_callback, 0 }, + NULL, NULL }, + { { "/---", NULL, NULL, 0, "" }, + 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 GtkItemFactoryEntry save_entries[] = +static GimpItemFactoryEntry save_entries[] = { - { N_("/By extension"), NULL, file_save_by_extension_callback, 0 }, - { "/---", NULL, NULL, 0, "" }, + { { N_("/By extension"), NULL, file_save_by_extension_callback, 0 }, + NULL, NULL }, + { { "/---", NULL, NULL, 0, "" }, + 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 GimpItemFactoryEntry layers_entries[] = @@ -540,7 +541,7 @@ static guint n_paths_entries = (sizeof (paths_entries) / sizeof (paths_entries[0])); static GtkItemFactory *paths_factory = NULL; -static int initialize = TRUE; +static gboolean initialize = TRUE; void menus_get_toolbox_menubar (GtkWidget **menubar, @@ -634,48 +635,69 @@ menus_get_paths_menu (GtkWidget **menu, } void -menus_create (GtkMenuEntry *entries, - int n_menu_entries) +menus_create_item_from_full_path (GimpItemFactoryEntry *entry, + gpointer callback_data) { + GtkItemFactory *ifactory; GtkWidget *menu_item; - int i; - int redo_image_menu = FALSE; + gboolean redo_image_menu = FALSE; GString *tearoff_path; + gchar *path; if (initialize) menus_init (); tearoff_path = g_string_new (""); - for (i = 0; i < n_menu_entries; i++) - if (! strncmp (entries[i].path, "", 7)) - { - char *p; + if (! strncmp (entry->entry.path, "", 7)) + { + gchar *p; - p = strchr (entries[i].path + 8, '/'); - while (p) - { - g_string_assign (tearoff_path, entries[i].path + 7); - g_string_truncate (tearoff_path, p - entries[i].path + 1 - 7); - g_string_append (tearoff_path, "tearoff1"); + p = strchr (entry->entry.path + 8, '/'); + while (p) + { + g_string_assign (tearoff_path, entry->entry.path + 7); + g_string_truncate (tearoff_path, + p - entry->entry.path + 1 - 7); + g_string_append (tearoff_path, "tearoff1"); - if (! gtk_item_factory_get_widget (image_factory, tearoff_path->str)) - { - GtkItemFactoryEntry entry = { NULL, NULL, NULL, 0, "" }; - entry.path = tearoff_path->str; - entry.callback = tearoff_cmd_callback; - gtk_item_factory_create_items_ac (image_factory, 1, &entry, NULL,2); - } + if (! gtk_item_factory_get_widget (image_factory, + tearoff_path->str)) + { + GimpItemFactoryEntry tearoff_entry = + { { NULL, NULL, NULL, 0, "" }, + 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); - 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) { @@ -719,8 +741,8 @@ menus_tools_create (ToolInfo *tool_info) } void -menus_set_sensitive (gchar *path, - gint sensitive) +menus_set_sensitive (gchar *path, + gboolean sensitive) { GtkItemFactory *ifactory; GtkWidget *widget = NULL; @@ -737,16 +759,17 @@ menus_set_sensitive (gchar *path, gtk_widget_set_sensitive (widget, sensitive); } 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 we don't need to have our menuentries twice in our catalog */ void -menus_set_sensitive_glue (gchar *prepath, - gchar *path, - gint sensitive) +menus_set_sensitive_glue (gchar *prepath, + gchar *path, + gboolean sensitive) { gchar *menupath; @@ -756,8 +779,8 @@ menus_set_sensitive_glue (gchar *prepath, } void -menus_set_state (gchar *path, - gint state) +menus_set_state (gchar *path, + gboolean state) { GtkItemFactory *ifactory; GtkWidget *widget = NULL; @@ -777,13 +800,14 @@ menus_set_state (gchar *path, widget = NULL; } 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 -menus_set_state_glue (gchar *prepath, - gchar *path, - gint state) +menus_set_state_glue (gchar *prepath, + gchar *path, + gboolean state) { gchar *menupath; @@ -793,7 +817,7 @@ menus_set_state_glue (gchar *prepath, } void -menus_destroy (char *path) +menus_destroy (gchar *path) { if (initialize) menus_init (); @@ -920,12 +944,12 @@ menus_last_opened_add (gchar *filename) void menus_init_mru (void) { - gchar *paths, *accelerators; - gint i; - GtkItemFactoryEntry *last_opened_entries; - GtkWidget *widget; + gchar *paths, *accelerators; + gint i; + GimpItemFactoryEntry *last_opened_entries; + 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); 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++) { gchar *path, *accelerator; - + path = &paths[i * MRU_MENU_ENTRY_SIZE]; if (i < 9) accelerator = &accelerators[i * MRU_MENU_ACCEL_SIZE]; else accelerator = NULL; - last_opened_entries[i].path = path; - last_opened_entries[i].accelerator = accelerator; - last_opened_entries[i].callback = (GtkItemFactoryCallback) menus_last_opened_cmd_callback; - last_opened_entries[i].callback_action = i; - last_opened_entries[i].item_type = NULL; + last_opened_entries[i].entry.path = path; + last_opened_entries[i].entry.accelerator = accelerator; + last_opened_entries[i].entry.callback = + (GtkItemFactoryCallback) menus_last_opened_cmd_callback; + 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); if (accelerator != NULL) g_snprintf (accelerator, MRU_MENU_ACCEL_SIZE, "%d", i + 1); } - gtk_item_factory_create_items_ac (toolbox_factory, last_opened_size, - last_opened_entries, NULL, 2); + menus_create_items (toolbox_factory, last_opened_size, + last_opened_entries, NULL, 2); for (i=0; i < last_opened_size; i++) { widget = gtk_item_factory_get_widget (toolbox_factory, - last_opened_entries[i].path); - gtk_object_set_data (GTK_OBJECT (widget), "help_page", - (gpointer) "file/last_opened.html"); + last_opened_entries[i].entry.path); gtk_widget_hide (widget); } widget = gtk_item_factory_get_widget (toolbox_factory, file_menu_separator.entry.path); gtk_widget_hide (widget); - + g_free (paths); g_free (accelerators); g_free (last_opened_entries); @@ -1106,7 +1131,7 @@ menus_init_toolbox (void) static void menus_init (void) { - int i; + gint i; if (initialize) { @@ -1128,22 +1153,26 @@ menus_init (void) NULL, 2); load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); + gtk_object_set_data (GTK_OBJECT (load_factory), "help_path", + (gpointer) "open"); gtk_item_factory_set_translate_func (load_factory, menu_translate, NULL, NULL); - gtk_item_factory_create_items_ac (load_factory, - n_load_entries, - load_entries, - NULL, 2); + menus_create_items (load_factory, + n_load_entries, + load_entries, + NULL, 2); save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); + gtk_object_set_data (GTK_OBJECT (save_factory), "help_path", + (gpointer) "save"); gtk_item_factory_set_translate_func (save_factory, menu_translate, NULL, NULL); - gtk_item_factory_create_items_ac (save_factory, - n_save_entries, - save_entries, - NULL, 2); + menus_create_items (save_factory, + n_save_entries, + save_entries, + NULL, 2); layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "", NULL); gtk_object_set_data (GTK_OBJECT (layers_factory), "help_path", @@ -1246,25 +1275,30 @@ tearoff_cmd_callback (GtkWidget *widget, } else { - dialog_register(top); + dialog_register (top); gtk_signal_connect_object (GTK_OBJECT (top), "delete_event", GTK_SIGNAL_FUNC (tearoff_delete_cb), 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 { - GtkWidget *top = (GtkWidget *)gtk_object_get_data (GTK_OBJECT (widget),"tearoff_menu_top"); - if(!top) + GtkWidget *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")); } else { - dialog_unregister(top); + dialog_unregister (top); } } } diff --git a/app/widgets/gimpitemfactory.h b/app/widgets/gimpitemfactory.h index 0396757c3a..d9012f5690 100644 --- a/app/widgets/gimpitemfactory.h +++ b/app/widgets/gimpitemfactory.h @@ -20,38 +20,50 @@ #include "gtk/gtk.h" -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); +typedef struct _GimpItemFactoryEntry GimpItemFactoryEntry; -void menus_create (GtkMenuEntry *entries, - gint n_menu_entries); -void menus_destroy (gchar *path); +struct _GimpItemFactoryEntry +{ + 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_set_sensitive (gchar *path, - gint sensitive); -void menus_set_sensitive_glue (gchar *prepath, - gchar *path, - gint sensitive); -void menus_set_state (gchar *path, - gint state); -void menus_set_state_glue (gchar *prepath, - gchar *path, - gint state); +void menus_set_sensitive (gchar *path, + gboolean sensitive); +void menus_set_sensitive_glue (gchar *prepath, + gchar *path, + gboolean sensitive); -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__ */